Fixes #777
This commit is contained in:
+4
-3
@@ -1,6 +1,7 @@
|
|||||||
CC=@CC@
|
CC=@CC@
|
||||||
CFLAGS=-I. -I../src/include -I./src/lib/third_party/include -shared -Wl,
|
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
|
LDFLAGS=$(CFILE) $(LIBNDPI) -lpcap
|
||||||
SHARE = -soname,ndpi_wrap
|
SHARE = -soname,ndpi_wrap
|
||||||
SO=ndpi_wrap.so
|
SO=ndpi_wrap.so
|
||||||
@@ -17,9 +18,9 @@ endif
|
|||||||
|
|
||||||
all: $(SO)
|
all: $(SO)
|
||||||
|
|
||||||
$(SO): $(CFILE) $(LIBNDPI)
|
$(SO): $(CFILE) $(LIBNDPI) Makefile
|
||||||
$(CC) $(CFLAGS)$(SHARE) -o $@ $(PIC) $(LDFLAGS)
|
$(CC) $(CFLAGS)$(SHARE) -o $@ $(PIC) $(LDFLAGS)
|
||||||
ln -s $(LIBNDPI) .
|
# ln -s $(LIBNDPI) .
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
/bin/rm -f $(SO)
|
/bin/rm -f $(SO)
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ def packetcaptured(packet):
|
|||||||
#filling pcap_pkthdr
|
#filling pcap_pkthdr
|
||||||
h.len = h.caplen = len(packet)
|
h.len = h.caplen = len(packet)
|
||||||
h.ts.tv_sec = int(packet["IP"].time/1000000)
|
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
|
# real work
|
||||||
if int(packet[1].frag) == 0: # not fragmented packet
|
if int(packet[1].frag) == 0: # not fragmented packet
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# ndpi_typestruct.h
|
# 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
|
# 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
|
# it under the terms of the GNU Lesser General Public License as published by
|
||||||
@@ -21,11 +21,10 @@
|
|||||||
import os
|
import os
|
||||||
from ctypes import *
|
from ctypes import *
|
||||||
|
|
||||||
ndpi = CDLL(os.path.abspath("libndpi.so.2.9.0"))
|
ndpi = CDLL('./ndpi_wrap.so')
|
||||||
ndpi = CDLL(os.path.abspath("ndpi_wrap.so"))
|
|
||||||
|
|
||||||
# NDPI_SELECTION_BITMASK_PROTOCOL_SIZE = c_uint32
|
# 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):
|
class ndpi_detection_module_struct(Structure):
|
||||||
pass
|
pass
|
||||||
@@ -102,13 +101,13 @@ class ndpi_default_ports_tree_node_t(Structure):
|
|||||||
|
|
||||||
# NDPI_PROTOCOL_BITTORRENT
|
# NDPI_PROTOCOL_BITTORRENT
|
||||||
class spinlock_t(Structure):
|
class spinlock_t(Structure):
|
||||||
_fields_ = [("val", c_int)] #volatile mancante
|
_fields_ = [("val", c_int)] #missing volatile
|
||||||
|
|
||||||
class atomic_t(Structure):
|
class atomic_t(Structure):
|
||||||
_fields_ = [("counter", c_int)] #volatile mancante
|
_fields_ = [("counter", c_int)] #missing volatile
|
||||||
|
|
||||||
class time_t(Structure):
|
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):
|
class hash_ip4p_node(Structure):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -53,3 +53,8 @@ int ndpi_wrap_ndpi_procol_size(){
|
|||||||
void ndpi_wrap_NDPI_BITMASK_SET_ALL(NDPI_PROTOCOL_BITMASK* bitmask){
|
void ndpi_wrap_NDPI_BITMASK_SET_ALL(NDPI_PROTOCOL_BITMASK* bitmask){
|
||||||
NDPI_ONE(bitmask);
|
NDPI_ONE(bitmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dummy() {
|
||||||
|
/* Dummy call just to cause linker to include the ndpi library */
|
||||||
|
ndpi_tfind(NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user