This commit is contained in:
Luca Deri
2019-09-23 18:04:55 +02:00
parent 3f56b2476a
commit 19dbcaa3a9
4 changed files with 188 additions and 183 deletions
+4 -3
View File
@@ -1,6 +1,7 @@
CC=@CC@
CFLAGS=-I. -I../src/include -I./src/lib/third_party/include -shared -Wl,
LIBNDPI=../src/lib/libndpi.so.@NDPI_VERSION_SHORT@
#LIBNDPI=../src/lib/libndpi.so.@NDPI_VERSION_SHORT@
LIBNDPI=../src/lib/libndpi.a
LDFLAGS=$(CFILE) $(LIBNDPI) -lpcap
SHARE = -soname,ndpi_wrap
SO=ndpi_wrap.so
@@ -17,9 +18,9 @@ endif
all: $(SO)
$(SO): $(CFILE) $(LIBNDPI)
$(SO): $(CFILE) $(LIBNDPI) Makefile
$(CC) $(CFLAGS)$(SHARE) -o $@ $(PIC) $(LDFLAGS)
ln -s $(LIBNDPI) .
# ln -s $(LIBNDPI) .
clean:
/bin/rm -f $(SO)
+1 -1
View File
@@ -166,7 +166,7 @@ def packetcaptured(packet):
#filling pcap_pkthdr
h.len = h.caplen = len(packet)
h.ts.tv_sec = int(packet["IP"].time/1000000)
h.ts.tv_usec = round(packet["IP"].time)
h.ts.tv_usec = int(packet["IP"].time)
# real work
if int(packet[1].frag) == 0: # not fragmented packet
+6 -7
View File
@@ -1,7 +1,7 @@
#
# ndpi_typestruct.h
#
# Copyright (C) 2011-18 - ntop.org
# Copyright (C) 2019 - 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
@@ -21,11 +21,10 @@
import os
from ctypes import *
ndpi = CDLL(os.path.abspath("libndpi.so.2.9.0"))
ndpi = CDLL(os.path.abspath("ndpi_wrap.so"))
ndpi = CDLL('./ndpi_wrap.so')
# NDPI_SELECTION_BITMASK_PROTOCOL_SIZE = c_uint32
# ndpi_protocol_category_t, ndpi_protocol_breed_t e ndpi_log_level_t sono enumeratori e vengono impostati come c_int
# ndpi_protocol_category_t, ndpi_protocol_breed_t e ndpi_log_level_t are enum and are imported as c_int
class ndpi_detection_module_struct(Structure):
pass
@@ -102,13 +101,13 @@ class ndpi_default_ports_tree_node_t(Structure):
# NDPI_PROTOCOL_BITTORRENT
class spinlock_t(Structure):
_fields_ = [("val", c_int)] #volatile mancante
_fields_ = [("val", c_int)] #missing volatile
class atomic_t(Structure):
_fields_ = [("counter", c_int)] #volatile mancante
_fields_ = [("counter", c_int)] #missing volatile
class time_t(Structure):
_fields_ = [("counter", c_longlong)] #piattaforma dipendente, tuttavia è solo un intero
_fields_ = [("counter", c_longlong)] # piattaform dependent
class hash_ip4p_node(Structure):
pass
+5
View File
@@ -53,3 +53,8 @@ int ndpi_wrap_ndpi_procol_size(){
void ndpi_wrap_NDPI_BITMASK_SET_ALL(NDPI_PROTOCOL_BITMASK* bitmask){
NDPI_ONE(bitmask);
}
void dummy() {
/* Dummy call just to cause linker to include the ndpi library */
ndpi_tfind(NULL, NULL, NULL);
}