From e23446389c49d2fbe097016542b75a5f860f9713 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Sun, 24 Apr 2016 23:17:18 +0200 Subject: [PATCH] Reworked https://github.com/ntop/nDPI/commit/8a4c15ecf5c5c1430e8047324a5e336db2f503f1 to avoid adding (un-needed) pcap dependency in nDPI core --- example/Makefile.am | 2 +- {src/lib => example}/ndpi_util.c | 0 {src/include => example}/ndpi_util.h | 26 +++++++++++--------------- src/lib/Makefile.am | 1 - 4 files changed, 12 insertions(+), 17 deletions(-) rename {src/lib => example}/ndpi_util.c (100%) rename {src/include => example}/ndpi_util.h (87%) diff --git a/example/Makefile.am b/example/Makefile.am index f98bae9ae..875f9901e 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -6,7 +6,7 @@ AM_CFLAGS = @PTHREAD_CFLAGS@ LDADD = $(top_builddir)/src/lib/libndpi.la @JSON_C_LIB@ @PTHREAD_LIBS@ @PCAP_LIB@ AM_LDFLAGS = -static -ndpiReader_SOURCES = ndpiReader.c +ndpiReader_SOURCES = ndpiReader.c ndpi_util.c ndpiReader.o: ndpiReader.c diff --git a/src/lib/ndpi_util.c b/example/ndpi_util.c similarity index 100% rename from src/lib/ndpi_util.c rename to example/ndpi_util.c diff --git a/src/include/ndpi_util.h b/example/ndpi_util.h similarity index 87% rename from src/include/ndpi_util.h rename to example/ndpi_util.h index 44f7be03d..13bc02cbc 100644 --- a/src/include/ndpi_util.h +++ b/example/ndpi_util.h @@ -1,11 +1,7 @@ /* * ndpi_util.h * - * Copyright (C) 2011-15 - ntop.org - * Copyright (C) 2009-11 - ipoque GmbH - * - * This file is part of nDPI, an open source deep packet inspection - * library based on the OpenDPI and PACE technology by ipoque GmbH + * Copyright (C) 2011-16 - ntop.org * * nDPI is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -112,10 +108,10 @@ typedef struct ndpi_workflow { /* TODO: remove wrappers parameters and use ndpi global, when their initialization will be fixed... */ struct ndpi_workflow * ndpi_workflow_init(const struct ndpi_workflow_prefs * prefs, - pcap_t * pcap_handle, - void * (*malloc_wrapper)(size_t), - void (*free_wrapper)(void*), - ndpi_debug_function_ptr ndpi_debug_printf); + pcap_t * pcap_handle, + void * (*malloc_wrapper)(size_t), + void (*free_wrapper)(void*), + ndpi_debug_function_ptr ndpi_debug_printf); void ndpi_workflow_free(struct ndpi_workflow * workflow); @@ -127,20 +123,20 @@ void ndpi_free_flow_info_half(struct ndpi_flow_info *flow); /** Process a @packet and update the @workflow. */ void ndpi_workflow_process_packet (struct ndpi_workflow * workflow, - const struct pcap_pkthdr *header, - const u_char *packet); + const struct pcap_pkthdr *header, + const u_char *packet); /* flow callbacks: ndpi_flow_info will be freed right after */ static inline void ndpi_workflow_set_flow_detected_callback(struct ndpi_workflow * workflow, - ndpi_workflow_callback_ptr callback, - void * udata) { + ndpi_workflow_callback_ptr callback, + void * udata) { workflow->__flow_detected_callback = callback; workflow->__flow_detected_udata = udata; } static inline void ndpi_workflow_set_flow_giveup_callback(struct ndpi_workflow * workflow, - ndpi_workflow_callback_ptr callback, - void * udata) { + ndpi_workflow_callback_ptr callback, + void * udata) { workflow->__flow_giveup_callback = callback; workflow->__flow_giveup_udata = udata; } diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 312cdc88c..d83fdd5c0 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -16,7 +16,6 @@ libndpi_la_include_HEADERS = ../include/ndpi_api.h \ libndpi_la_SOURCES = ndpi_content_match.c.inc \ ndpi_main.c \ - ndpi_util.c \ protocols/afp.c \ protocols/aimini.c \ protocols/applejuice.c \