#include "system.h"
#include "logger.h"
-
-debug_t debug_level = DEBUG_NOTHING;
+#include "meshlink_internal.h"
+#include "sptps.h"
void logger(int level, int priority, const char *format, ...) {
- if(level > debug_level)
+ if(level > mesh->debug_level)
return;
va_list ap;
}
// TODO: make sure this gets used somewhere
-static void sptps_logger(struct sptps *s, int s_errno, const char *format, va_list ap) {
+static void sptps_logger(sptps_t *s, int s_errno, const char *format, va_list ap) {
char message[1024] = "";
int len = vsnprintf(message, sizeof message, format, ap);
if(len > 0 && len < sizeof message && message[len - 1] == '\n')
#endif
#endif
-extern debug_t debug_level;
extern void logger(int, int, const char *, ...) __attribute__ ((__format__(printf, 3, 4)));
#endif /* __TINC_LOGGER_H__ */
#include "event.h"
#include "hash.h"
+#include "logger.h"
#include "meshlink.h"
#include "sockaddr.h"
hash_t *node_udp_cache;
struct connection_t *everyone;
struct ecdsa *invitation_key;
+
+ debug_t debug_level;
};
/// A handle for a MeshLink node.
n = try_harder(&from, &pkt);
if(n)
update_node_udp(n, &from);
- else if(debug_level >= DEBUG_PROTOCOL) {
+ else if(mesh->debug_level >= DEBUG_PROTOCOL) {
hostname = sockaddr2hostname(&from);
logger(DEBUG_PROTOCOL, LOG_WARNING, "Received UDP packet from unknown source %s", hostname);
free(hostname);
io_add(&mesh->listen_socket[mesh->listen_sockets].tcp, handle_new_meta_connection, &mesh->listen_socket[mesh->listen_sockets], tcp_fd, IO_READ);
io_add(&mesh->listen_socket[mesh->listen_sockets].udp, handle_incoming_vpn_data, &mesh->listen_socket[mesh->listen_sockets], udp_fd, IO_READ);
- if(debug_level >= DEBUG_CONNECTIONS) {
+ if(mesh->debug_level >= DEBUG_CONNECTIONS) {
char *hostname = sockaddr2hostname((sockaddr_t *) aip->ai_addr);
logger(DEBUG_CONNECTIONS, LOG_NOTICE, "Listening on %s", hostname);
free(hostname);
// Symbols necessary to link with logger.o
bool send_request(void *c, const char *msg, ...) { return false; }
+void *mesh;
bool send_meta(void *c, const char *msg , int len) { return false; }
char *logfilename = NULL;
struct timeval now;
// Symbols necessary to link with logger.o
bool send_request(void *c, const char *msg, ...) { return false; }
+void *mesh;
bool send_meta(void *c, const char *msg , int len) { return false; }
char *logfilename = NULL;
struct timeval now;
if(!optarg && optind < argc && *argv[optind] != '-')
optarg = argv[optind++];
if(optarg)
- debug_level = atoi(optarg);
+ mesh->debug_level = atoi(optarg);
else
- debug_level++;
+ mesh->debug_level++;
break;
case 1: /* show help */