Added simplified makefile
Fixed small warnings Compilation fixes
This commit is contained in:
@@ -736,7 +736,9 @@ extern "C" {
|
||||
void set_ndpi_flow_malloc(void* (*__ndpi_flow_malloc)(size_t size));
|
||||
void set_ndpi_flow_free(void (*__ndpi_flow_free)(void *ptr));
|
||||
void set_ndpi_debug_function(struct ndpi_detection_module_struct *ndpi_str, ndpi_debug_function_ptr ndpi_debug_printf);
|
||||
|
||||
void * ndpi_malloc(size_t size);
|
||||
void * ndpi_calloc(unsigned long count, size_t size);
|
||||
void ndpi_free(void *ptr);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# Simple non-autotools dependent makefile
|
||||
#
|
||||
# ./autogen.sh
|
||||
# cd src/lib
|
||||
# make -f Makefile.simple
|
||||
#
|
||||
CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include
|
||||
RANLIB=ranlib
|
||||
|
||||
OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) ndpi_main.o third_party/src/ndpi_patricia.o
|
||||
HEADERS = $(wildcard ../include/*.h)
|
||||
|
||||
libndpi.a: $(OBJECTS)
|
||||
ar rc $@ $(OBJECTS)
|
||||
$(RANLIB) $@
|
||||
|
||||
%.o: %.c $(HEADERS) Makefile
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
/bin/rm -f libndpi.a $(OBJECTS)
|
||||
@@ -29,17 +29,17 @@
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
/*
|
||||
typedef unsigned char u_int8_t;
|
||||
typedef unsigned short int u_int16_t;
|
||||
typedef unsigned long long int u_int64_t;
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
typedef signed long long int i_int64_t;
|
||||
|
||||
#include "btlib.h"
|
||||
|
||||
int bt_parse_debug = 0;
|
||||
@@ -90,6 +90,7 @@ static char *print_id_ip6_p(char *s,const struct bt_nodes6_data *b) {
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void dump_bt_proto_struct(struct bt_parse_protocol *p) {
|
||||
char b20h[128];
|
||||
int i;
|
||||
@@ -155,7 +156,9 @@ void dump_bt_proto_struct(struct bt_parse_protocol *p) {
|
||||
if(p->interval) printf("\tinterval\t%d\n",p->interval);
|
||||
if(p->min_interval) printf("\tmin interval\t%d\n",p->min_interval);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BTLIB_DEBUG
|
||||
static void _print_safe_str(char *msg,char *k,const u_int8_t *s,size_t l) {
|
||||
static const char *th="0123456789abcdef?";
|
||||
char *buf = (char*)ndpi_malloc((size_t)(l*3+2));
|
||||
@@ -183,6 +186,11 @@ static void print_safe_str(char *msg,bt_parse_data_cb_t *cbd) {
|
||||
}
|
||||
#define DEBUG_TRACE(cmd) { if(bt_parse_debug) cmd; }
|
||||
|
||||
#else
|
||||
#define DEBUG_TRACE(cmd) ;
|
||||
#endif
|
||||
|
||||
|
||||
#define STREQ(a,b) !strcmp(a,b)
|
||||
|
||||
|
||||
@@ -408,8 +416,8 @@ void cb_data(bt_parse_data_cb_t *cbd,int *ret) {
|
||||
const u_int8_t *bt_decode(const u_int8_t *b, size_t *l, int *ret, bt_parse_data_cb_t *cbd) {
|
||||
|
||||
unsigned int n=0,neg=0;
|
||||
i_int64_t d = 0;
|
||||
register u_int8_t c;
|
||||
int64_t d = 0;
|
||||
u_int8_t c;
|
||||
|
||||
if(*l == 0) return NULL;
|
||||
if(cbd->level > BDEC_MAXDEPT) goto bad_data;
|
||||
|
||||
@@ -171,7 +171,7 @@ typedef struct bt_parse_data_cb {
|
||||
int level;
|
||||
int t;
|
||||
union {
|
||||
i_int64_t i;
|
||||
int64_t i;
|
||||
b_elem_s_t s;
|
||||
} v;
|
||||
} bt_parse_data_cb_t;
|
||||
|
||||
+1
@@ -54,6 +54,7 @@
|
||||
#include <arpa/inet.h> /* BSD, Linux, Solaris: for inet_addr */
|
||||
#endif
|
||||
#include "ndpi_patricia.h"
|
||||
#include "ndpi_api.h"
|
||||
|
||||
void ndpi_DeleteEntry(void *a) {
|
||||
ndpi_free(a);
|
||||
|
||||
Reference in New Issue
Block a user