X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fdummy_device.c;h=15f0654f49be31ca59cdaeab87c8b7f5548ee8ff;hb=1c475ecb575367a6b3f9328b0f643ad636155341;hp=d50818028f18fbc9a8a0ac00ff7cb92a36ff41ce;hpb=70a1a5594af5d4e6a364186b42ba4e34c676009b;p=tinc diff --git a/src/dummy_device.c b/src/dummy_device.c index d5081802..15f0654f 100644 --- a/src/dummy_device.c +++ b/src/dummy_device.c @@ -22,15 +22,13 @@ #include "device.h" #include "logger.h" #include "net.h" +#include "xalloc.h" -static char *device_info = "dummy device"; - -static uint64_t device_total_in = 0; -static uint64_t device_total_out = 0; +static const char *device_info = "dummy device"; static bool setup_device(void) { - device = "dummy"; - iface = "dummy"; + device = xstrdup("dummy"); + iface = xstrdup("dummy"); logger(DEBUG_ALWAYS, LOG_INFO, "%s (%s) is a %s", device, iface, device_info); return true; } @@ -39,24 +37,18 @@ static void close_device(void) { } static bool read_packet(vpn_packet_t *packet) { + (void)packet; return false; } static bool write_packet(vpn_packet_t *packet) { - device_total_out += packet->len; + (void)packet; return true; } -static void dump_device_stats(void) { - logger(DEBUG_ALWAYS, LOG_DEBUG, "Statistics for %s %s:", device_info, device); - logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes in: %10"PRIu64, device_total_in); - logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes out: %10"PRIu64, device_total_out); -} - const devops_t dummy_devops = { .setup = setup_device, .close = close_device, .read = read_packet, .write = write_packet, - .dump_stats = dump_device_stats, };