-struct utcp_connection *c;
-int dir = DIR_READ | DIR_WRITE;
-bool running = true;
-long inpktno;
-long outpktno;
-long dropfrom;
-long dropto;
-double reorder;
-long reorder_dist = 10;
-double dropin;
-double dropout;
-long total_out;
-long total_in;
-
-char *reorder_data;
-size_t reorder_len;
-int reorder_countdown;
-
-void debug(const char *format, ...) {
- struct timeval now;
- gettimeofday(&now, NULL);
- fprintf(stderr, "%lu.%lu ", now.tv_sec, now.tv_usec / 1000);
+static struct utcp_connection *c;
+static int dir = DIR_READ | DIR_WRITE;
+static long inpktno;
+static long outpktno;
+static long dropfrom;
+static long dropto;
+static double reorder;
+static long reorder_dist = 10;
+static double dropin;
+static double dropout;
+static long total_out;
+static long total_in;
+static FILE *reference;
+static long mtu;
+static long bufsize;
+
+static char *reorder_data;
+static size_t reorder_len;
+static int reorder_countdown;
+
+#if UTCP_DEBUG
+static void debug(const char *format, ...) {
+ struct timespec tv;
+ char buf[1024];
+ int len;
+
+ clock_gettime(CLOCK_REALTIME, &tv);
+ len = snprintf(buf, sizeof(buf), "%ld.%06lu ", (long)tv.tv_sec, tv.tv_nsec / 1000);