Browse Source

Minor code claanup

pull/271/head
Luca Deri 4 years ago
parent
commit
0bf7ae0a01
  1. 1
      include/n2n.h
  2. 3
      include/n2n_define.h
  3. 4
      src/edge_utils.c
  4. 2
      tools/Makefile.in
  5. 13
      tools/benchmark.c

1
include/n2n.h

@ -129,6 +129,7 @@ typedef struct ether_hdr ether_hdr_t;
#include <signal.h> #include <signal.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>

3
include/n2n_define.h

@ -43,10 +43,11 @@
#define IP4_MIN_SIZE 20 #define IP4_MIN_SIZE 20
#define UDP_SIZE 8 #define UDP_SIZE 8
#if 0
/* heap allocation for compression as per lzo example doc */ /* heap allocation for compression as per lzo example doc */
#define HEAP_ALLOC(var,size) lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ] #define HEAP_ALLOC(var,size) lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ]
static HEAP_ALLOC(wrkmem, LZO1X_1_MEM_COMPRESS); static HEAP_ALLOC(wrkmem, LZO1X_1_MEM_COMPRESS);
#endif
/* N2N compression indicators. */ /* N2N compression indicators. */
/* Compression is disabled by default for outgoing packets if no cli /* Compression is disabled by default for outgoing packets if no cli

4
src/edge_utils.c

@ -18,6 +18,10 @@
#include "n2n.h" #include "n2n.h"
/* heap allocation for compression as per lzo example doc */
#define HEAP_ALLOC(var,size) lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ]
static HEAP_ALLOC(wrkmem, LZO1X_1_MEM_COMPRESS);
/* ************************************** */ /* ************************************** */
static const char * supernode_ip(const n2n_edge_t * eee); static const char * supernode_ip(const n2n_edge_t * eee);

2
tools/Makefile.in

@ -40,7 +40,7 @@ n2n-decode: n2n_decode.c $(N2N_LIB) $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
clean: clean:
rm -rf $(TOOLS) $(N2N_LIB) *.o *.dSYM *~ rm -rf $(TOOLS) *.o *.dSYM *~
install: $(TOOLS) install: $(TOOLS)
$(INSTALL_PROG) $(TOOLS) $(SBINDIR)/ $(INSTALL_PROG) $(TOOLS) $(SBINDIR)/

13
tools/benchmark.c

@ -1,5 +1,5 @@
/* /*
* (C) 2007-18 - ntop.org and contributors * (C) 2007-20 - ntop.org and contributors
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -16,20 +16,9 @@
* *
*/ */
#include "n2n_wire.h"
#include "n2n_transforms.h"
#include "n2n.h" #include "n2n.h"
#ifdef __GNUC__
#include <sys/time.h>
#endif
#include <time.h>
#include <string.h>
#include <stdio.h>
#if defined(WIN32) && !defined(__GNUC__) #if defined(WIN32) && !defined(__GNUC__)
#include <windows.h>
static int gettimeofday(struct timeval *tp, void *tzp) static int gettimeofday(struct timeval *tp, void *tzp)
{ {
time_t clock; time_t clock;

Loading…
Cancel
Save