Fixes #777
This commit is contained in:
+4
-3
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
+17
-18
@@ -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
|
||||
@@ -315,7 +314,7 @@ ndpi_detection_module_struct._fields_ = [
|
||||
("enable_category_substring_match", c_uint8, 1), # Default is perfect match
|
||||
|
||||
("hyperscan", c_void_p) # Intel Hyperscan
|
||||
]
|
||||
]
|
||||
|
||||
class u6_addr(Union): # 128-bit IP6 address
|
||||
_fields_ = [
|
||||
@@ -333,7 +332,7 @@ class ndpi_ip_addr_t(Union):
|
||||
('ipv4', c_uint32),
|
||||
('ipv4_u_int8_t', c_uint8 * 4),
|
||||
('ipv6', ndpi_in6_addr),
|
||||
]
|
||||
]
|
||||
|
||||
class ndpi_id_struct(Structure):
|
||||
_fields_ = [
|
||||
@@ -370,7 +369,7 @@ class ndpi_id_struct(Structure):
|
||||
('yahoo_conf_logged_in', c_uint32, 1),
|
||||
('yahoo_voice_conf_logged_in', c_uint32, 1),
|
||||
('rtsp_ts_set', c_uint32, 1),
|
||||
]
|
||||
]
|
||||
|
||||
#struct flow
|
||||
class ndpi_flow_tcp_struct(Structure):
|
||||
@@ -434,7 +433,7 @@ class ndpi_flow_tcp_struct(Structure):
|
||||
('ppstream_stage', c_uint32, 3),
|
||||
('memcached_matches', c_uint8),
|
||||
('nest_log_sink_matches', c_uint8),
|
||||
]
|
||||
]
|
||||
|
||||
class ndpi_flow_udp_struct(Structure):
|
||||
_fields_ = [
|
||||
@@ -543,13 +542,13 @@ class tinc_cache_entry(Structure):
|
||||
('src_address', c_uint32),
|
||||
('dst_address', c_uint32),
|
||||
('dst_port', c_uint16),
|
||||
]
|
||||
]
|
||||
|
||||
class struct_ndpi_int_one_line_struct(Structure):
|
||||
_fields_ = [
|
||||
('ptr', POINTER(c_uint8)),
|
||||
('len', c_uint16),
|
||||
]
|
||||
]
|
||||
|
||||
class struct_ndpi_iphdr_little_end(Structure):
|
||||
_fields_ = [
|
||||
@@ -571,14 +570,14 @@ class struct_ndpi_ip6_hdrctl(Structure):
|
||||
('ip6_un1_plen', c_uint16),
|
||||
('ip6_un1_nxt', c_uint8),
|
||||
('ip6_un1_hlim', c_uint8),
|
||||
]
|
||||
]
|
||||
|
||||
class struct_ndpi_ipv6hdr(Structure):
|
||||
_fields_ = [
|
||||
('ip6_hdr', struct_ndpi_ip6_hdrctl),
|
||||
('ip6_src', ndpi_in6_addr),
|
||||
('ip6_dst', ndpi_in6_addr),
|
||||
]
|
||||
]
|
||||
|
||||
class struct_ndpi_tcphdr(Structure):
|
||||
_fields_ = [
|
||||
@@ -599,7 +598,7 @@ class struct_ndpi_tcphdr(Structure):
|
||||
('window', c_uint16),
|
||||
('check', c_uint16),
|
||||
('urg_ptr', c_uint16),
|
||||
]
|
||||
]
|
||||
|
||||
class struct_ndpi_udphdr(Structure):
|
||||
_fields_ = [
|
||||
@@ -607,7 +606,7 @@ class struct_ndpi_udphdr(Structure):
|
||||
('dest', c_uint16),
|
||||
('len', c_uint16),
|
||||
('check', c_uint16),
|
||||
]
|
||||
]
|
||||
|
||||
class ndpi_packet_struct(Structure):
|
||||
_fields_ = [
|
||||
@@ -655,7 +654,7 @@ class ndpi_packet_struct(Structure):
|
||||
('packet_lines_parsed_complete', c_uint8, 1),
|
||||
('packet_direction', c_uint8, 1),
|
||||
('empty_line_position_set', c_uint8, 1),
|
||||
]
|
||||
]
|
||||
|
||||
ndpi_flow_struct._fields_ = [
|
||||
("detected_protocol_stack", c_uint16 * ndpi.ndpi_wrap_ndpi_procol_size()),
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user