Typedef refresh
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
|
||||
library_includedir=$(includedir)/libndpi-1.4/libndpi
|
||||
|
||||
library_include_HEADERS = ndpi_api.h \
|
||||
ndpi_debug_functions.h \
|
||||
ndpi_define.h \
|
||||
ndpi_macros.h \
|
||||
ndpi_protocols_osdpi.h \
|
||||
ndpi_public_functions.h
|
||||
ndpi_define.h \
|
||||
ndpi_typedefs.h \
|
||||
ndpi_main.h \
|
||||
ndpi_protocol_ids.h \
|
||||
ndpi_protocols.h \
|
||||
ndpi_win32.h \
|
||||
ndpi_includes.h
|
||||
|
||||
@@ -1,188 +0,0 @@
|
||||
/*
|
||||
* linux_compat.h
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __NDPI_LINUX_COMPAT_H__
|
||||
#define __NDPI_LINUX_COMPAT_H__
|
||||
|
||||
#include "ndpi_define.h"
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <machine/endian.h>
|
||||
|
||||
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
#define __LITTLE_ENDIAN__ 1
|
||||
#endif
|
||||
#else
|
||||
#ifndef __BIG_ENDIAN__
|
||||
#define __BIG_ENDIAN__ 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#pragma pack(push, 1) /* push current alignment to stack */
|
||||
#pragma pack(1) /* set alignment to 1 byte boundary */
|
||||
|
||||
#pragma pack(pop) /* restore original alignment from stack */
|
||||
|
||||
struct ndpi_ethhdr {
|
||||
u_char h_dest[6]; /* destination eth addr */
|
||||
u_char h_source[6]; /* source ether addr */
|
||||
u_int16_t h_proto; /* packet type ID field */
|
||||
};
|
||||
|
||||
struct ndpi_80211q {
|
||||
u_int16_t vlanId;
|
||||
u_int16_t protoType;
|
||||
};
|
||||
|
||||
struct ndpi_iphdr {
|
||||
#if defined(__LITTLE_ENDIAN__)
|
||||
u_int8_t ihl:4, version:4;
|
||||
#elif defined(__BIG_ENDIAN__)
|
||||
u_int8_t version:4, ihl:4;
|
||||
#else
|
||||
# error "Byte order must be defined"
|
||||
#endif
|
||||
u_int8_t tos;
|
||||
u_int16_t tot_len;
|
||||
u_int16_t id;
|
||||
u_int16_t frag_off;
|
||||
u_int8_t ttl;
|
||||
u_int8_t protocol;
|
||||
u_int16_t check;
|
||||
u_int32_t saddr;
|
||||
u_int32_t daddr;
|
||||
};
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned short u_short;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long u_long;
|
||||
typedef u_char u_int8_t;
|
||||
typedef u_short u_int16_t;
|
||||
typedef uint u_int32_t;
|
||||
|
||||
#define _WS2TCPIP_H_ /* Avoid compilation problems */
|
||||
#define HAVE_SIN6_LEN
|
||||
|
||||
|
||||
/* IPv6 address */
|
||||
/* Already defined in WS2tcpip.h */
|
||||
struct ndpi_win_in6_addr
|
||||
{
|
||||
union
|
||||
{
|
||||
u_int8_t u6_addr8[16];
|
||||
u_int16_t u6_addr16[8];
|
||||
u_int32_t u6_addr32[4];
|
||||
} in6_u;
|
||||
#ifdef s6_addr
|
||||
#undef s6_addr
|
||||
#endif
|
||||
|
||||
#ifdef s6_addr16
|
||||
#undef s6_addr16
|
||||
#endif
|
||||
|
||||
#ifdef s6_addr32
|
||||
#undef s6_addr32
|
||||
#endif
|
||||
|
||||
#define s6_addr in6_u.u6_addr8
|
||||
// #define s6_addr16 in6_u.u6_addr16
|
||||
// #define s6_addr32 in6_u.u6_addr32
|
||||
|
||||
};
|
||||
|
||||
#define in6_addr win_in6_addr
|
||||
|
||||
/* Generic extension header. */
|
||||
struct ndpi_ip6_ext
|
||||
{
|
||||
u_int8_t ip6e_nxt; /* next header. */
|
||||
u_int8_t ip6e_len; /* length in units of 8 octets. */
|
||||
};
|
||||
|
||||
#define s6_addr16 __u6_addr.__u6_addr16
|
||||
#define s6_addr32 __u6_addr.__u6_addr32
|
||||
#else
|
||||
#ifndef __KERNEL__
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
struct ndpi_in6_addr {
|
||||
union {
|
||||
u_int8_t __u6_addr8[16];
|
||||
u_int16_t __u6_addr16[8];
|
||||
u_int32_t __u6_addr32[4];
|
||||
} __u6_addr; /* 128-bit IP6 address */
|
||||
};
|
||||
|
||||
struct ndpi_ip6_hdr {
|
||||
union {
|
||||
struct ndpi_ip6_hdrctl {
|
||||
u_int32_t ip6_un1_flow;
|
||||
u_int16_t ip6_un1_plen;
|
||||
u_int8_t ip6_un1_nxt;
|
||||
u_int8_t ip6_un1_hlim;
|
||||
} ip6_un1;
|
||||
u_int8_t ip6_un2_vfc;
|
||||
} ip6_ctlun;
|
||||
struct ndpi_in6_addr ip6_src;
|
||||
struct ndpi_in6_addr ip6_dst;
|
||||
};
|
||||
|
||||
struct ndpi_tcphdr {
|
||||
u_int16_t source;
|
||||
u_int16_t dest;
|
||||
u_int32_t seq;
|
||||
u_int32_t ack_seq;
|
||||
#if defined(__LITTLE_ENDIAN__)
|
||||
u_int16_t res1:4, doff:4, fin:1, syn:1, rst:1, psh:1, ack:1, urg:1, ece:1, cwr:1;
|
||||
#elif defined(__BIG_ENDIAN__)
|
||||
u_int16_t doff:4, res1:4, cwr:1, ece:1, urg:1, ack:1, psh:1, rst:1, syn:1, fin:1;
|
||||
#else
|
||||
# error "Byte order must be defined"
|
||||
#endif
|
||||
u_int16_t window;
|
||||
u_int16_t check;
|
||||
u_int16_t urg_ptr;
|
||||
};
|
||||
|
||||
struct ndpi_udphdr {
|
||||
u_int16_t source;
|
||||
u_int16_t dest;
|
||||
u_int16_t len;
|
||||
u_int16_t check;
|
||||
};
|
||||
|
||||
#endif
|
||||
+16
-23
@@ -23,8 +23,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __NDPI_PUBLIC_FUNCTIONS_H__
|
||||
#define __NDPI_PUBLIC_FUNCTIONS_H__
|
||||
#ifndef __NDPI_API_H__
|
||||
#define __NDPI_API_H__
|
||||
|
||||
#include "ndpi_main.h"
|
||||
|
||||
@@ -32,26 +32,26 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This function returns the size of the flow struct
|
||||
* @return the size of the flow struct
|
||||
/**
|
||||
* This function returns the size of the flow struct
|
||||
* @return the size of the flow struct
|
||||
*/
|
||||
u_int32_t ndpi_detection_get_sizeof_ndpi_flow_struct(void);
|
||||
|
||||
/**
|
||||
* This function returns the size of the id struct
|
||||
* @return the size of the id struct
|
||||
|
||||
/**
|
||||
* This function returns the size of the id struct
|
||||
* @return the size of the id struct
|
||||
*/
|
||||
u_int32_t ndpi_detection_get_sizeof_ndpi_id_struct(void);
|
||||
|
||||
|
||||
/* Public malloc/free */
|
||||
void* ndpi_malloc(unsigned long size);
|
||||
void* ndpi_calloc(unsigned long count, unsigned long size);
|
||||
void ndpi_free(void *ptr);
|
||||
void *ndpi_realloc(void *ptr, size_t old_size, size_t new_size);
|
||||
char *ndpi_strdup(const char *s);
|
||||
/*
|
||||
|
||||
/**
|
||||
* Find the first occurrence of find in s, where the search is limited to the
|
||||
* first slen characters of s.
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ extern "C" {
|
||||
/**
|
||||
* This function returns a new initialized detection module.
|
||||
* @param ticks_per_second the timestamp resolution per second (like 1000 for millisecond resolution)
|
||||
* @param ndpi_malloc function pointer to a memory allocator
|
||||
* @param __ndpi_malloc function pointer to a memory allocator
|
||||
* @param ndpi_debug_printf a function pointer to a debug output function, use NULL in productive envionments
|
||||
* @return the initialized detection module
|
||||
*/
|
||||
@@ -88,8 +88,8 @@ extern "C" {
|
||||
|
||||
/**
|
||||
* This function enables cache support in nDPI used for some protocol such as Skype
|
||||
* @param cache host name
|
||||
* @param cache port
|
||||
* @param host host name
|
||||
* @param port port number
|
||||
*/
|
||||
void ndpi_enable_cache(struct ndpi_detection_module_struct *ndpi_mod, char* host, u_int port);
|
||||
|
||||
@@ -150,14 +150,6 @@ extern "C" {
|
||||
*/
|
||||
u_int8_t ndpi_detection_get_l4(const u_int8_t * l3, u_int16_t l3_len, const u_int8_t ** l4_return, u_int16_t * l4_len_return,
|
||||
u_int8_t * l4_protocol_return, u_int32_t flags);
|
||||
/**
|
||||
* returns the real protocol for the flow of the last packet given to the detection.
|
||||
* if no real protocol could be found, the unknown protocol will be returned.
|
||||
*
|
||||
* @param ndpi_struct the detection module
|
||||
* @return the protocol id of the last real protocol found in the protocol history of the flow
|
||||
*/
|
||||
/* u_int16_t ndpi_detection_get_real_protocol_of_flow(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow); */
|
||||
|
||||
/**
|
||||
* returns true if the protocol history of the flow of the last packet given to the detection
|
||||
@@ -244,4 +236,5 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __NDPI_API_H__ */
|
||||
|
||||
+17
-31
@@ -42,15 +42,22 @@
|
||||
#endif/* BYTE_ORDER */
|
||||
#endif/* __OPENBSD__ */
|
||||
|
||||
#if 0
|
||||
#ifndef NDPI_ENABLE_DEBUG_MESSAGES
|
||||
#define NDPI_ENABLE_DEBUG_MESSAGES
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
#define __LITTLE_ENDIAN__
|
||||
#endif
|
||||
#else
|
||||
#ifndef __BIG_ENDIAN__
|
||||
#define __BIG_ENDIAN__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
#define __LITTLE_ENDIAN__ 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !(defined(__LITTLE_ENDIAN__) || defined(__BIG_ENDIAN__))
|
||||
#if defined(__mips__)
|
||||
@@ -59,13 +66,6 @@
|
||||
#define __BIG_ENDIAN__
|
||||
#endif
|
||||
|
||||
/* Kernel modules */
|
||||
#if defined(__LITTLE_ENDIAN)
|
||||
#define __LITTLE_ENDIAN__
|
||||
#endif
|
||||
#if defined(__BIG_ENDIAN)
|
||||
#define __BIG_ENDIAN__
|
||||
#endif
|
||||
/* Everything else */
|
||||
#if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__))
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
@@ -165,11 +165,6 @@
|
||||
#define MAX_PACKET_COUNTER 65000
|
||||
#define MAX_DEFAULT_PORTS 5
|
||||
|
||||
/**********************
|
||||
* detection features *
|
||||
**********************/
|
||||
/* #define NDPI_SELECT_DETECTION_WITH_REAL_PROTOCOL ( 1 << 0 ) */
|
||||
|
||||
#define NDPI_DIRECTCONNECT_CONNECTION_IP_TICK_TIMEOUT 600
|
||||
#define NDPI_IRC_CONNECTION_TIMEOUT 120
|
||||
#define NDPI_GNUTELLA_CONNECTION_TIMEOUT 60
|
||||
@@ -199,7 +194,7 @@
|
||||
|
||||
#else /* NDPI_ENABLE_DEBUG_MESSAGES */
|
||||
|
||||
#if defined(WIN32)
|
||||
#ifdef WIN32
|
||||
#define NDPI_LOG(...) {}
|
||||
#else
|
||||
#define NDPI_LOG(proto, mod, log_level, args...) {}
|
||||
@@ -218,12 +213,7 @@
|
||||
#define NDPI_COMPARE_IPV6_ADDRESS_STRUCTS(x,y) \
|
||||
((((u_int64_t *)(x))[0]) < (((u_int64_t *)(y))[0]) || ( (((u_int64_t *)(x))[0]) == (((u_int64_t *)(y))[0]) && (((u_int64_t *)(x))[1]) < (((u_int64_t *)(y))[1])) )
|
||||
|
||||
#if !defined(__KERNEL__) && !defined(NDPI_IPTABLES_EXT)
|
||||
#define NDPI_NUM_BITS 256
|
||||
#else
|
||||
/* custom protocols not supported */
|
||||
#define NDPI_NUM_BITS 192
|
||||
#endif
|
||||
|
||||
#define NDPI_BITS /* 32 */ (sizeof(ndpi_ndpi_mask) * 8 /* number of bits in a byte */) /* bits per mask */
|
||||
#define howmanybits(x, y) (((x)+((y)-1))/(y))
|
||||
@@ -238,7 +228,7 @@
|
||||
#define NDPI_NUM_FDS_BITS howmanybits(NDPI_NUM_BITS, NDPI_BITS)
|
||||
|
||||
#define NDPI_PROTOCOL_BITMASK ndpi_protocol_bitmask_struct_t
|
||||
|
||||
|
||||
#define NDPI_BITMASK_ADD(a,b) NDPI_SET(&a,b)
|
||||
#define NDPI_BITMASK_DEL(a,b) NDPI_CLR(&a,b)
|
||||
#define NDPI_BITMASK_RESET(a) NDPI_ZERO(&a)
|
||||
@@ -246,7 +236,7 @@
|
||||
#define NDPI_BITMASK_SET(a, b) { memcpy(&a, &b, sizeof(NDPI_PROTOCOL_BITMASK)); }
|
||||
|
||||
/* this is a very very tricky macro *g*,
|
||||
* the compiler will remove all shifts here if the protocol is static...
|
||||
* the compiler will remove all shifts here if the protocol is static...
|
||||
*/
|
||||
#define NDPI_ADD_PROTOCOL_TO_BITMASK(bmask,value) NDPI_SET(&bmask,value)
|
||||
#define NDPI_DEL_PROTOCOL_FROM_BITMASK(bmask,value) NDPI_CLR(&bmask,value)
|
||||
@@ -289,21 +279,17 @@
|
||||
#define get_l32(X,O) get_u_int32_t(X,O)
|
||||
#elif defined(__BIG_ENDIAN__) || defined(__BIG_ENDIAN)
|
||||
/* convert the bytes from big to little endian */
|
||||
#ifndef __KERNEL__
|
||||
# define get_l16(X,O) bswap_16(get_u_int16_t(X,O))
|
||||
# define get_l32(X,O) bswap_32(get_u_int32_t(X,O))
|
||||
#else
|
||||
# define get_l16(X,O) __cpu_to_le16(get_u_int16_t(X,O))
|
||||
# define get_l32(X,O) __cpu_to_le32(get_u_int32_t(X,O))
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#error "__BYTE_ORDER MUST BE DEFINED !"
|
||||
|
||||
#endif /* __BYTE_ORDER */
|
||||
|
||||
/* define memory callback function */
|
||||
#define match_first_bytes(payload,st) (memcmp((payload),(st),(sizeof(st)-1))==0)
|
||||
|
||||
#if defined(WIN32) && !defined(snprintf)
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#endif /* __NDPI_DEFINE_INCLUDE_FILE__ */
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* ndpi_includes.h
|
||||
*
|
||||
* Copyright (C) 2011-15 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NDPI_INCLUDES_H__
|
||||
#define __NDPI_INCLUDES_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include "ndpi_win32.h"
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
#include <pthread.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/udp.h>
|
||||
|
||||
#if !defined __APPLE__ && !defined __FreeBSD__ && !defined __NetBSD__ && !defined __OpenBSD__
|
||||
#include <endian.h>
|
||||
#include <byteswap.h>
|
||||
|
||||
#if defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__
|
||||
#include <netinet/in.h>
|
||||
|
||||
#if defined __NetBSD__ || defined __OpenBSD__
|
||||
#include <netinet/in_systm.h>
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
#include <pthread.h>
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* Win32 */
|
||||
|
||||
#endif /* __NDPI_INCLUDES_H__ */
|
||||
+19
-69
@@ -22,53 +22,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NDPI_MAIN_INCLUDE_FILE__
|
||||
#define __NDPI_MAIN_INCLUDE_FILE__
|
||||
#ifndef __NDPI_MAIN_H__
|
||||
#define __NDPI_MAIN_H__
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#ifndef WIN32
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef __KERNEL__
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#if !defined __APPLE__ && !defined __FreeBSD__ && !defined __NetBSD__ && !defined __OpenBSD__
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#include <endian.h>
|
||||
#include <byteswap.h>
|
||||
#else
|
||||
#include <asm/byteorder.h>
|
||||
#include <linux/ctype.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* default includes */
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#include <sys/param.h>
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "ndpi_win32.h"
|
||||
#include "ndpi_unix.h"
|
||||
#include "ndpi_includes.h"
|
||||
#include "ndpi_define.h"
|
||||
#include "ndpi_protocol_ids.h"
|
||||
#include "ndpi_typedefs.h"
|
||||
#include "ndpi_protocols.h"
|
||||
#include "ndpi_api.h"
|
||||
|
||||
|
||||
void *ndpi_tdelete(const void * __restrict, void ** __restrict,
|
||||
@@ -103,58 +65,46 @@ void ndpi_set_detected_protocol(struct ndpi_detection_module_struct *ndpi_struct
|
||||
u_int16_t upper_detected_protocol,
|
||||
u_int16_t lower_detected_protocol);
|
||||
|
||||
|
||||
/* function to parse a packet which has line based information into a line based structure
|
||||
* this function will also set some well known line pointers like:
|
||||
* - host, user agent, empty line,....
|
||||
*/
|
||||
extern void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
extern void ndpi_parse_packet_line_info_any(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
|
||||
extern u_int16_t ndpi_check_for_email_address(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, u_int16_t counter);
|
||||
extern void ndpi_int_change_packet_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
|
||||
extern void ndpi_int_change_packet_protocol(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow,
|
||||
u_int16_t upper_detected_protocol,
|
||||
u_int16_t lower_detected_protocol);
|
||||
extern void ndpi_int_change_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
extern void ndpi_int_change_protocol(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow,
|
||||
u_int16_t upper_detected_protocol,
|
||||
u_int16_t lower_detected_protocol);
|
||||
extern void ndpi_set_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod,
|
||||
ndpi_protocol_breed_t protoBreed, u_int16_t protoId,
|
||||
u_int16_t tcp_alias_protoId[2], u_int16_t udp_alias_protoId[2],
|
||||
char *protoName,
|
||||
extern void ndpi_set_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod, ndpi_protocol_breed_t protoBreed, u_int16_t protoId,
|
||||
u_int16_t tcp_alias_protoId[2], u_int16_t udp_alias_protoId[2], char *protoName,
|
||||
ndpi_port_range *tcpDefPorts, ndpi_port_range *udpDefPorts);
|
||||
|
||||
extern void ndpi_int_reset_packet_protocol(struct ndpi_packet_struct *packet);
|
||||
extern void ndpi_int_reset_protocol(struct ndpi_flow_struct *flow);
|
||||
|
||||
extern int ndpi_packet_src_ip_eql(const struct ndpi_packet_struct *packet, const ndpi_ip_addr_t * ip);
|
||||
extern int ndpi_packet_dst_ip_eql(const struct ndpi_packet_struct *packet, const ndpi_ip_addr_t * ip);
|
||||
extern void ndpi_packet_src_ip_get(const struct ndpi_packet_struct *packet, ndpi_ip_addr_t * ip);
|
||||
extern void ndpi_packet_dst_ip_get(const struct ndpi_packet_struct *packet, ndpi_ip_addr_t * ip);
|
||||
|
||||
extern char *ndpi_get_ip_string(struct ndpi_detection_module_struct *ndpi_struct, const ndpi_ip_addr_t * ip);
|
||||
extern char *ndpi_get_packet_src_ip_string(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
const struct ndpi_packet_struct *packet);
|
||||
extern char *ndpi_get_packet_src_ip_string(struct ndpi_detection_module_struct *ndpi_struct, const struct ndpi_packet_struct *packet);
|
||||
extern char* ndpi_get_proto_by_id(struct ndpi_detection_module_struct *ndpi_mod, u_int id);
|
||||
|
||||
extern u_int16_t ndpi_guess_protocol_id(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int8_t proto, u_int16_t sport, u_int16_t dport);
|
||||
|
||||
extern u_int8_t ndpi_is_proto(ndpi_protocol p, u_int16_t proto);
|
||||
|
||||
extern u_int16_t ndpi_get_lower_proto(ndpi_protocol p);
|
||||
extern int ndpi_get_protocol_id_master_proto(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int16_t protocol_id,
|
||||
extern int ndpi_get_protocol_id_master_proto(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t protocol_id,
|
||||
u_int16_t** tcp_master_proto,
|
||||
u_int16_t** udp_master_proto);
|
||||
|
||||
extern u_int8_t ndpi_net_match(u_int32_t ip_to_check,
|
||||
u_int32_t net,
|
||||
u_int32_t num_bits);
|
||||
|
||||
extern u_int8_t ndpi_ips_match(u_int32_t src, u_int32_t dst,
|
||||
u_int32_t net, u_int32_t num_bits);
|
||||
|
||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||
void ndpi_debug_get_last_log_function_line(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
const char **file, const char **func, u_int32_t * line);
|
||||
#endif
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#endif /* __NDPI_MAIN_INCLUDE_FILE__ */
|
||||
#endif /* __NDPI_MAIN_H__ */
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __NDPI_API_INCLUDE_FILE__
|
||||
#ifndef __NDPI_API_H__
|
||||
|
||||
#endif
|
||||
|
||||
@@ -201,6 +201,11 @@
|
||||
#define NDPI_PROTOCOL_WHATSAPP_VOICE 189
|
||||
#define NDPI_PROTOCOL_STARCRAFT 213 /* Matteo Bracci <matteobracci1@gmail.com> */
|
||||
#define NDPI_PROTOCOL_TEREDO 214
|
||||
#define NDPI_PROTOCOL_HEP 216 /* Sipcapture.org QXIP BV */
|
||||
#define NDPI_PROTOCOL_UBNTAC2 217 /* Ubiquity UBNT AirControl 2 - Thomas Fjellstrom <thomas+ndpi@fjellstrom.ca> */
|
||||
#define NDPI_PROTOCOL_MS_LYNC 218
|
||||
|
||||
|
||||
|
||||
#define NDPI_CONTENT_AVI 39
|
||||
#define NDPI_CONTENT_FLASH 40
|
||||
@@ -263,7 +268,7 @@
|
||||
#define NDPI_SERVICE_HOTSPOT_SHIELD 215
|
||||
|
||||
/* UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE */
|
||||
#define NDPI_LAST_IMPLEMENTED_PROTOCOL NDPI_SERVICE_HOTSPOT_SHIELD
|
||||
#define NDPI_LAST_IMPLEMENTED_PROTOCOL NDPI_PROTOCOL_MS_LYNC
|
||||
|
||||
#define NDPI_MAX_SUPPORTED_PROTOCOLS (NDPI_LAST_IMPLEMENTED_PROTOCOL + 1)
|
||||
#define NDPI_MAX_NUM_CUSTOM_PROTOCOLS (NDPI_NUM_BITS-NDPI_LAST_IMPLEMENTED_PROTOCOL)
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __NDPI_PROTOCOLS_INCLUDE_FILE__
|
||||
#define __NDPI_PROTOCOLS_INCLUDE_FILE__
|
||||
#ifndef __NDPI_PROTOCOLS_H__
|
||||
#define __NDPI_PROTOCOLS_H__
|
||||
|
||||
#include "ndpi_main.h"
|
||||
|
||||
@@ -72,6 +72,7 @@ void ndpi_search_oscar(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
void ndpi_search_jabber_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_sip(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_hep(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_direct_download_link_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mail_pop_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mail_imap_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
@@ -195,6 +196,7 @@ void ndpi_search_eaq(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
void ndpi_search_kakaotalk_voice(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mpegts(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_starcraft(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ubntac2(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
|
||||
|
||||
/* --- INIT FUNCTIONS --- */
|
||||
@@ -288,6 +290,7 @@ void init_rtsp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
|
||||
void init_sflow_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_shoutcast_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_sip_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_hep_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_skinny_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_skype_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_smb_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
@@ -332,5 +335,6 @@ void init_yahoo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_in
|
||||
void init_zattoo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_zmq_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_stracraft_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ubntac2_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
|
||||
#endif /* __NDPI_PROTOCOLS_INCLUDE_FILE__ */
|
||||
#endif /* __NDPI_PROTOCOLS_H__ */
|
||||
|
||||
+281
-94
@@ -22,94 +22,280 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NDPI_TYPEDEFS_FILE__
|
||||
#define __NDPI_TYPEDEFS_FILE__
|
||||
#ifndef __NDPI_TYPEDEFS_H__
|
||||
#define __NDPI_TYPEDEFS_H__
|
||||
|
||||
typedef enum {
|
||||
NDPI_LOG_ERROR,
|
||||
NDPI_LOG_TRACE,
|
||||
NDPI_LOG_DEBUG
|
||||
} ndpi_log_level_t;
|
||||
#include "ndpi_define.h"
|
||||
|
||||
typedef void (*ndpi_debug_function_ptr) (u_int32_t protocol,
|
||||
void *module_struct, ndpi_log_level_t log_level,
|
||||
const char *format, ...);
|
||||
#define BT_ANNOUNCE
|
||||
#define SNAP_EXT
|
||||
|
||||
typedef enum {
|
||||
ndpi_preorder,
|
||||
ndpi_postorder,
|
||||
ndpi_endorder,
|
||||
ndpi_leaf
|
||||
} ndpi_VISIT;
|
||||
|
||||
typedef struct node_t {
|
||||
/* NDPI_LOG_LEVEL */
|
||||
typedef enum
|
||||
{
|
||||
NDPI_LOG_ERROR,
|
||||
NDPI_LOG_TRACE,
|
||||
NDPI_LOG_DEBUG
|
||||
} ndpi_log_level_t;
|
||||
|
||||
/* NDPI_VISIT */
|
||||
typedef enum
|
||||
{
|
||||
ndpi_preorder,
|
||||
ndpi_postorder,
|
||||
ndpi_endorder,
|
||||
ndpi_leaf
|
||||
} ndpi_VISIT;
|
||||
|
||||
/* NDPI_NODE */
|
||||
typedef struct node_t
|
||||
{
|
||||
char *key;
|
||||
struct node_t *left, *right;
|
||||
} ndpi_node;
|
||||
|
||||
/* NDPI_MASK_SIZE */
|
||||
typedef u_int32_t ndpi_ndpi_mask;
|
||||
|
||||
typedef struct ndpi_protocol_bitmask_struct {
|
||||
ndpi_ndpi_mask fds_bits[NDPI_NUM_FDS_BITS];
|
||||
/* NDPI_PROTO_BITMASK_STRUCT */
|
||||
typedef struct ndpi_protocol_bitmask_struct
|
||||
{
|
||||
ndpi_ndpi_mask fds_bits[NDPI_NUM_FDS_BITS];
|
||||
} ndpi_protocol_bitmask_struct_t;
|
||||
|
||||
#ifdef NDPI_DETECTION_SUPPORT_IPV6
|
||||
struct ndpi_ip6_addr {
|
||||
union {
|
||||
u_int8_t u6_addr8[16];
|
||||
u_int16_t u6_addr16[8];
|
||||
u_int32_t u6_addr32[4];
|
||||
u_int64_t u6_addr64[2];
|
||||
} ndpi_v6_u;
|
||||
/* NDPI_DEBUG_FUNCTION_PTR (cast) */
|
||||
typedef void (*ndpi_debug_function_ptr) (u_int32_t protocol, void *module_struct,
|
||||
ndpi_log_level_t log_level, const char *format, ...);
|
||||
|
||||
#define ndpi_v6_addr ndpi_v6_u.u6_addr8
|
||||
#define ndpi_v6_addr16 ndpi_v6_u.u6_addr16
|
||||
#define ndpi_v6_addr32 ndpi_v6_u.u6_addr32
|
||||
#define ndpi_v6_addr64 ndpi_v6_u.u6_addr64
|
||||
};
|
||||
|
||||
struct ndpi_ipv6hdr {
|
||||
/* use userspace and kernelspace compatible compile parameters */
|
||||
/* ************************************************************ */
|
||||
/* ******************* NDPI NETWORKS HEADERS ****************** */
|
||||
/* ************************************************************ */
|
||||
|
||||
/* ++++++++++++++++++++++++ Cisco headers +++++++++++++++++++++ */
|
||||
|
||||
/* Cisco HDLC */
|
||||
#ifdef _MSC_VER
|
||||
/* Windows */
|
||||
#define PACK_ON __pragma(pack(push, 1))
|
||||
#define PACK_OFF __pragma(pack(pop))
|
||||
#elif defined(__GNUC__)
|
||||
/* GNU C */
|
||||
#define PACK_ON
|
||||
#define PACK_OFF __attribute__((packed))
|
||||
#endif
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_chdlc
|
||||
{
|
||||
u_int8_t addr; /* 0x0F (Unicast) - 0x8F (Broadcast) */
|
||||
u_int8_t ctrl; /* always 0x00 */
|
||||
u_int16_t proto_code; /* protocol type (e.g. 0x0800 IP) */
|
||||
} PACK_OFF;
|
||||
|
||||
/* SLARP - Serial Line ARP http://tinyurl.com/qa54e95 */
|
||||
PACK_ON
|
||||
struct ndpi_slarp
|
||||
{
|
||||
/* address requests (0x00)
|
||||
address replies (0x01)
|
||||
keep-alive (0x02)
|
||||
*/
|
||||
u_int32_t slarp_type;
|
||||
u_int32_t addr_1;
|
||||
u_int32_t addr_2;
|
||||
} PACK_OFF;
|
||||
|
||||
/* Cisco Discovery Protocol http://tinyurl.com/qa6yw9l */
|
||||
PACK_ON
|
||||
struct ndpi_cdp
|
||||
{
|
||||
u_int8_t version;
|
||||
u_int8_t ttl;
|
||||
u_int16_t checksum;
|
||||
u_int16_t type;
|
||||
u_int16_t length;
|
||||
} PACK_OFF;
|
||||
|
||||
/* +++++++++++++++ Ethernet header (IEEE 802.3) +++++++++++++++ */
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_ethhdr
|
||||
{
|
||||
u_char h_dest[6]; /* destination eth addr */
|
||||
u_char h_source[6]; /* source ether addr */
|
||||
u_int16_t h_proto; /* data length (<= 1500) or type ID proto (>=1536) */
|
||||
} PACK_OFF;
|
||||
|
||||
/* +++++++++++++++++++ LLC header (IEEE 802.2) ++++++++++++++++ */
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_snap_extension
|
||||
{
|
||||
u_int16_t oui;
|
||||
u_int8_t oui2;
|
||||
u_int16_t proto_ID;
|
||||
} PACK_OFF;
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_llc_header
|
||||
{
|
||||
u_int8_t dsap;
|
||||
u_int8_t ssap;
|
||||
u_int8_t ctrl;
|
||||
#ifdef SNAP_EXT
|
||||
struct ndpi_snap_extension snap;
|
||||
#endif
|
||||
} PACK_OFF;
|
||||
|
||||
/* ++++++++++ RADIO TAP header (for IEEE 802.11) +++++++++++++ */
|
||||
PACK_ON
|
||||
struct ndpi_radiotap_header
|
||||
{
|
||||
u_int8_t version; /* set to 0 */
|
||||
u_int8_t pad;
|
||||
u_int16_t len;
|
||||
u_int32_t present;
|
||||
u_int64_t MAC_timestamp;
|
||||
u_int8_t flags;
|
||||
} PACK_OFF;
|
||||
|
||||
/* ++++++++++++ Wireless header (IEEE 802.11) ++++++++++++++++ */
|
||||
PACK_ON
|
||||
struct ndpi_wifi_header
|
||||
{
|
||||
u_int16_t fc;
|
||||
u_int16_t duration;
|
||||
u_char rcvr[6];
|
||||
u_char trsm[6];
|
||||
u_char dest[6];
|
||||
u_int16_t seq_ctrl;
|
||||
/* u_int64_t ccmp - for data encription only - check fc.flag */
|
||||
} PACK_OFF;
|
||||
|
||||
/* +++++++++++++++++++++++ MPLS header +++++++++++++++++++++++ */
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_mpls_header
|
||||
{
|
||||
u_int32_t label:20, exp:3, s:1, ttl:8;
|
||||
} PACK_OFF;
|
||||
|
||||
/* ++++++++++++++++++++++++ IP header ++++++++++++++++++++++++ */
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_iphdr {
|
||||
#if defined(__LITTLE_ENDIAN__)
|
||||
u_int8_t priority:4, version:4;
|
||||
u_int8_t ihl:4, version:4;
|
||||
#elif defined(__BIG_ENDIAN__)
|
||||
u_int8_t version:4, priority:4;
|
||||
u_int8_t version:4, ihl:4;
|
||||
#else
|
||||
# error "Byte order must be defined"
|
||||
#endif
|
||||
u_int8_t tos;
|
||||
u_int16_t tot_len;
|
||||
u_int16_t id;
|
||||
u_int16_t frag_off;
|
||||
u_int8_t ttl;
|
||||
u_int8_t protocol;
|
||||
u_int16_t check;
|
||||
u_int32_t saddr;
|
||||
u_int32_t daddr;
|
||||
} PACK_OFF;
|
||||
|
||||
u_int8_t flow_lbl[3];
|
||||
/* +++++++++++++++++++++++ IPv6 header +++++++++++++++++++++++ */
|
||||
/* rfc3542 */
|
||||
|
||||
u_int16_t payload_len;
|
||||
u_int8_t nexthdr;
|
||||
u_int8_t hop_limit;
|
||||
|
||||
struct ndpi_ip6_addr saddr;
|
||||
struct ndpi_ip6_addr daddr;
|
||||
struct ndpi_in6_addr
|
||||
{
|
||||
union
|
||||
{
|
||||
u_int8_t u6_addr8[16];
|
||||
u_int16_t u6_addr16[8];
|
||||
u_int32_t u6_addr32[4];
|
||||
} u6_addr; /* 128-bit IP6 address */
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
PACK_ON
|
||||
struct ndpi_ipv6hdr
|
||||
{
|
||||
union
|
||||
{
|
||||
struct ndpi_ip6_hdrctl
|
||||
{
|
||||
u_int32_t ip6_un1_flow;
|
||||
u_int16_t ip6_un1_plen;
|
||||
u_int8_t ip6_un1_nxt;
|
||||
u_int8_t ip6_un1_hlim;
|
||||
} ip6_un1;
|
||||
u_int8_t ip6_un2_vfc;
|
||||
} ip6_ctlun;
|
||||
|
||||
struct ndpi_in6_addr ip6_src;
|
||||
struct ndpi_in6_addr ip6_dst;
|
||||
} PACK_OFF;
|
||||
|
||||
/* +++++++++++++++++++++++ TCP header +++++++++++++++++++++++ */
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_tcphdr
|
||||
{
|
||||
u_int16_t source;
|
||||
u_int16_t dest;
|
||||
u_int32_t seq;
|
||||
u_int32_t ack_seq;
|
||||
#if defined(__LITTLE_ENDIAN__)
|
||||
u_int16_t res1:4, doff:4, fin:1, syn:1, rst:1, psh:1, ack:1, urg:1, ece:1, cwr:1;
|
||||
#elif defined(__BIG_ENDIAN__)
|
||||
u_int16_t doff:4, res1:4, cwr:1, ece:1, urg:1, ack:1, psh:1, rst:1, syn:1, fin:1;
|
||||
#else
|
||||
# error "Byte order must be defined"
|
||||
#endif
|
||||
u_int16_t window;
|
||||
u_int16_t check;
|
||||
u_int16_t urg_ptr;
|
||||
} PACK_OFF;
|
||||
|
||||
/* +++++++++++++++++++++++ UDP header +++++++++++++++++++++++ */
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_udphdr
|
||||
{
|
||||
u_int16_t source;
|
||||
u_int16_t dest;
|
||||
u_int16_t len;
|
||||
u_int16_t check;
|
||||
} PACK_OFF;
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_dns_packet_header {
|
||||
u_int16_t transaction_id, flags, num_queries, answer_rrs, authority_rrs, additional_rrs;
|
||||
} PACK_OFF;
|
||||
|
||||
typedef union
|
||||
{
|
||||
u_int32_t ipv4;
|
||||
u_int8_t ipv4_u_int8_t[4];
|
||||
#ifdef NDPI_DETECTION_SUPPORT_IPV6
|
||||
struct ndpi_ip6_addr ipv6;
|
||||
struct ndpi_in6_addr ipv6;
|
||||
#endif
|
||||
} ndpi_ip_addr_t;
|
||||
|
||||
/* ************************************************************ */
|
||||
/* ******************* ********************* ****************** */
|
||||
/* ************************************************************ */
|
||||
|
||||
#ifdef NDPI_PROTOCOL_BITTORRENT
|
||||
#ifndef __KERNEL__
|
||||
|
||||
typedef struct spinlock {
|
||||
volatile int val;
|
||||
} spinlock_t;
|
||||
|
||||
typedef struct atomic {
|
||||
volatile int counter;
|
||||
} atomic_t;
|
||||
|
||||
#endif
|
||||
|
||||
struct hash_ip4p_node {
|
||||
struct hash_ip4p_node *next,*prev;
|
||||
time_t lchg;
|
||||
@@ -155,16 +341,12 @@ typedef enum {
|
||||
} ndpi_http_method;
|
||||
|
||||
typedef struct ndpi_id_struct {
|
||||
/* detected_protocol_bitmask:
|
||||
* access this bitmask to find out whether an id has used skype or not
|
||||
* if a flag is set here, it will not be resetted
|
||||
* to compare this, use:
|
||||
* if (NDPI_BITMASK_COMPARE(id->detected_protocol_bitmask,
|
||||
* NDPI_PROTOCOL_BITMASK_XXX) != 0)
|
||||
* {
|
||||
* // protocol XXX detected on this id
|
||||
* }
|
||||
*/
|
||||
/**
|
||||
detected_protocol_bitmask:
|
||||
access this bitmask to find out whether an id has used skype or not
|
||||
if a flag is set here, it will not be resetted
|
||||
to compare this, use:
|
||||
**/
|
||||
NDPI_PROTOCOL_BITMASK detected_protocol_bitmask;
|
||||
#ifdef NDPI_PROTOCOL_RTSP
|
||||
ndpi_ip_addr_t rtsp_ip_address;
|
||||
@@ -310,7 +492,7 @@ struct ndpi_flow_tcp_struct {
|
||||
u_int32_t http_stage:2;
|
||||
u_int32_t http_empty_line_seen:1;
|
||||
u_int32_t http_wait_for_retransmission:1;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_GNUTELLA
|
||||
u_int32_t gnutella_stage:2; // 0 - 2
|
||||
#endif
|
||||
@@ -390,7 +572,7 @@ struct ndpi_flow_tcp_struct {
|
||||
u_char prev_zmq_pkt[10];
|
||||
#endif
|
||||
}
|
||||
#if !defined(WIN32)
|
||||
#ifndef WIN32
|
||||
__attribute__ ((__packed__))
|
||||
#endif
|
||||
;
|
||||
@@ -439,7 +621,7 @@ struct ndpi_flow_udp_struct {
|
||||
u_int32_t eaq_sequence;
|
||||
#endif
|
||||
}
|
||||
#if !defined(WIN32)
|
||||
#ifndef WIN32
|
||||
__attribute__ ((__packed__))
|
||||
#endif
|
||||
;
|
||||
@@ -468,10 +650,10 @@ typedef struct ndpi_packet_struct {
|
||||
u_int8_t detected_subprotocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
||||
|
||||
|
||||
#if !defined(WIN32)
|
||||
__attribute__ ((__packed__))
|
||||
#ifndef WIN32
|
||||
__attribute__ ((__packed__))
|
||||
#endif
|
||||
u_int16_t protocol_stack_info;
|
||||
u_int16_t protocol_stack_info;
|
||||
|
||||
struct ndpi_int_one_line_struct line[NDPI_MAX_PARSE_LINES_PER_PACKET];
|
||||
struct ndpi_int_one_line_struct host_line;
|
||||
@@ -574,7 +756,7 @@ typedef struct ndpi_detection_module_struct {
|
||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||
void *user_data;
|
||||
#endif
|
||||
|
||||
|
||||
/* callback function buffer */
|
||||
struct ndpi_call_function_struct callback_buffer[NDPI_MAX_SUPPORTED_PROTOCOLS + 1];
|
||||
u_int32_t callback_buffer_size;
|
||||
@@ -666,41 +848,45 @@ typedef struct ndpi_detection_module_struct {
|
||||
|
||||
typedef struct ndpi_flow_struct {
|
||||
u_int16_t detected_protocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
||||
#if !defined(WIN32)
|
||||
__attribute__ ((__packed__))
|
||||
#ifndef WIN32
|
||||
__attribute__ ((__packed__))
|
||||
#endif
|
||||
u_int16_t protocol_stack_info;
|
||||
u_int16_t protocol_stack_info;
|
||||
|
||||
/* init parameter, internal used to set up timestamp,... */
|
||||
u_int16_t guessed_protocol_id, guessed_host_proto_id;
|
||||
|
||||
u_int8_t protocol_id_already_guessed:1, host_already_guessed:1, init_finished:1, setup_packet_direction:1, packet_direction:1;
|
||||
/* if ndpi_struct->direction_detect_disable == 1 */
|
||||
/* tcp sequence number connection tracking */
|
||||
u_int8_t protocol_id_already_guessed:1, host_already_guessed:1, init_finished:1, setup_packet_direction:1, packet_direction:1;
|
||||
|
||||
/*
|
||||
if ndpi_struct->direction_detect_disable == 1
|
||||
tcp sequence number connection tracking
|
||||
*/
|
||||
u_int32_t next_tcp_seq_nr[2];
|
||||
|
||||
/* the tcp / udp / other l4 value union
|
||||
* this is used to reduce the number of bytes for tcp or udp protocol states
|
||||
* */
|
||||
/*
|
||||
the tcp / udp / other l4 value union
|
||||
used to reduce the number of bytes for tcp or udp protocol states
|
||||
*/
|
||||
union {
|
||||
struct ndpi_flow_tcp_struct tcp;
|
||||
struct ndpi_flow_udp_struct udp;
|
||||
} l4;
|
||||
|
||||
struct ndpi_id_struct *server_id; /*
|
||||
Pointer to src or dst
|
||||
that identifies the
|
||||
server of this connection
|
||||
*/
|
||||
#ifndef __KERNEL__
|
||||
u_char host_server_name[256]; /* HTTP host or DNS query */
|
||||
#else
|
||||
u_char host_server_name[160];
|
||||
#endif
|
||||
u_char detected_os[32]; /* Via HTTP User-Agent */
|
||||
u_char nat_ip[24]; /* Via HTTP X-Forwarded-For */
|
||||
/*
|
||||
Pointer to src or dst
|
||||
that identifies the
|
||||
server of this connection
|
||||
*/
|
||||
struct ndpi_id_struct *server_id;
|
||||
/* HTTP host or DNS query */
|
||||
u_char host_server_name[256];
|
||||
/* Via HTTP User-Agent */
|
||||
u_char detected_os[32];
|
||||
/* Via HTTP X-Forwarded-For */
|
||||
u_char nat_ip[24];
|
||||
|
||||
/*
|
||||
/*
|
||||
This structure below will not not stay inside the protos
|
||||
structure below as HTTP is used by many subprotocols
|
||||
such as FaceBook, Google... so it is hard to know
|
||||
@@ -708,7 +894,7 @@ typedef struct ndpi_flow_struct {
|
||||
time being.
|
||||
*/
|
||||
struct {
|
||||
ndpi_http_method method;
|
||||
ndpi_http_method method;
|
||||
char *url, *content_type;
|
||||
} http;
|
||||
|
||||
@@ -718,17 +904,18 @@ typedef struct ndpi_flow_struct {
|
||||
u_int8_t bad_packet /* the received packet looks bad */;
|
||||
u_int16_t query_type, query_class, rsp_type;
|
||||
} dns;
|
||||
|
||||
|
||||
struct {
|
||||
u_int8_t request_code;
|
||||
u_int8_t version;
|
||||
} ntp;
|
||||
|
||||
|
||||
struct {
|
||||
char client_certificate[48], server_certificate[48];
|
||||
} ssl;
|
||||
} protos;
|
||||
/* ALL protocol specific 64 bit variables here */
|
||||
|
||||
/*** ALL protocol specific 64 bit variables here ***/
|
||||
|
||||
/* protocols which have marked a connection as this connection cannot be protocol XXX, multiple u_int64_t */
|
||||
NDPI_PROTOCOL_BITMASK excluded_protocol_bitmask;
|
||||
@@ -754,7 +941,7 @@ typedef struct ndpi_flow_struct {
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_HTTP
|
||||
u_int32_t http_detected:1;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_RTSP
|
||||
u_int32_t rtsprdt_stage:2;
|
||||
u_int32_t rtsp_control_flow:1;
|
||||
@@ -818,4 +1005,4 @@ typedef struct ndpi_flow_struct {
|
||||
struct ndpi_id_struct *dst;
|
||||
} ndpi_flow_struct_t;
|
||||
|
||||
#endif/* __NDPI_TYPEDEFS_FILE__ */
|
||||
#endif/* __NDPI_TYPEDEFS_H__ */
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
#ifndef __NDPI_UNIX_INCLUDE_FILE__
|
||||
#define __NDPI_UNIX_INCLUDE_FILE__
|
||||
|
||||
#include "linux_compat.h"
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <netinet/in.h>
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
@@ -38,16 +36,9 @@
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef __KERNEL__
|
||||
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/udp.h>
|
||||
#else
|
||||
#include <linux/ip.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/udp.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __NDPI_UNIX_INCLUDE_FILE__ */
|
||||
|
||||
+17
-21
@@ -22,36 +22,34 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NDPI_WIN32_INCLUDE_FILE__
|
||||
#define __NDPI_WIN32_INCLUDE_FILE__
|
||||
#ifndef __NDPI_WIN32_H__
|
||||
#define __NDPI_WIN32_H__
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Winsock2.h> /* winsock.h is included automatically */
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <process.h>
|
||||
#include <io.h>
|
||||
#include <getopt.h> /* getopt from: http://www.pwilson.net/sample.html. */
|
||||
#include <process.h> /* for getpid() and the exec..() family */
|
||||
#include <getopt.h> /* getopt from: http://www.pwilson.net/sample.html. */
|
||||
#include <process.h> /* for getpid() and the exec..() family */
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
#define snprintf _snprintf
|
||||
|
||||
extern char* strsep(char **stringp, const char *delim);
|
||||
#define _WS2TCPIP_H_ /* Avoid compilation problems */
|
||||
|
||||
extern char* strsep(char **sp, const char *sep);
|
||||
|
||||
#define __attribute__(x)
|
||||
#include <stdint.h>
|
||||
#ifndef __GNUC__
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned short u_short;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long u_long;
|
||||
#endif
|
||||
typedef u_char u_int8_t;
|
||||
typedef u_short u_int16_t;
|
||||
typedef unsigned int u_int32_t;
|
||||
typedef unsigned __int64 u_int64_t;
|
||||
|
||||
typedef u_char u_int8_t;
|
||||
typedef u_short u_int16_t;
|
||||
typedef uint u_int32_t;
|
||||
typedef uint u_int;
|
||||
typedef unsigned __int64 u_int64_t;
|
||||
|
||||
#define pthread_t HANDLE
|
||||
#define pthread_mutex_t HANDLE
|
||||
@@ -62,12 +60,10 @@ typedef unsigned __int64 u_int64_t;
|
||||
#define pthread_rwlock_unlock pthread_mutex_unlock
|
||||
#define pthread_rwlock_destroy pthread_mutex_destroy
|
||||
|
||||
#define gmtime_r(a, b) gmtime(a) /* Already thread safe on windows */
|
||||
#define gmtime_r(a, b) memcpy(b, gmtime(a), sizeof(struct tm))
|
||||
|
||||
extern unsigned long waitForNextEvent(unsigned long ulDelay /* ms */);
|
||||
|
||||
#define sleep(a /* sec */) waitForNextEvent(1000*a /* ms */)
|
||||
|
||||
#endif /* Win32 */
|
||||
|
||||
#endif /* __NDPI_WIN32_INCLUDE_FILE__ */
|
||||
#endif /* __NDPI_WIN32_H__ */
|
||||
|
||||
+1
-4
@@ -7,14 +7,11 @@ libndpi_la_LDFLAGS = -version-info 1:0:0 -export-symbols $(top_srcdir)/libndpi.s
|
||||
libndpi_la_includedir = $(includedir)/libndpi-@VERSION@/libndpi
|
||||
|
||||
libndpi_la_include_HEADERS = ../include/ndpi_api.h \
|
||||
../include/linux_compat.h \
|
||||
../include/ndpi_define.h \
|
||||
../include/ndpi_main.h \
|
||||
../include/ndpi_protocol_ids.h \
|
||||
../include/ndpi_protocols.h \
|
||||
../include/ndpi_typedefs.h \
|
||||
../include/ndpi_unix.h \
|
||||
../include/ndpi_win32.h
|
||||
../include/ndpi_typedefs.h
|
||||
|
||||
libndpi_la_SOURCES = ndpi_content_match.c.inc \
|
||||
ndpi_main.c \
|
||||
|
||||
+244
-383
File diff suppressed because it is too large
Load Diff
+73
-73
@@ -37,108 +37,108 @@ static void ndpi_int_mdns_add_connection(struct ndpi_detection_module_struct
|
||||
}
|
||||
|
||||
static int ndpi_int_check_mdns_payload(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
if ((packet->payload[2] & 0x80) == 0 &&
|
||||
ntohs(get_u_int16_t(packet->payload, 4)) <= NDPI_MAX_MDNS_REQUESTS &&
|
||||
ntohs(get_u_int16_t(packet->payload, 6)) <= NDPI_MAX_MDNS_REQUESTS) {
|
||||
if ((packet->payload[2] & 0x80) == 0 &&
|
||||
ntohs(get_u_int16_t(packet->payload, 4)) <= NDPI_MAX_MDNS_REQUESTS &&
|
||||
ntohs(get_u_int16_t(packet->payload, 6)) <= NDPI_MAX_MDNS_REQUESTS) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_MDNS, ndpi_struct, NDPI_LOG_DEBUG, "found MDNS with question query.\n");
|
||||
NDPI_LOG(NDPI_PROTOCOL_MDNS, ndpi_struct, NDPI_LOG_DEBUG, "found MDNS with question query.\n");
|
||||
|
||||
return 1;
|
||||
} else if ((packet->payload[2] & 0x80) != 0 &&
|
||||
ntohs(get_u_int16_t(packet->payload, 4)) == 0 &&
|
||||
ntohs(get_u_int16_t(packet->payload, 6)) <= NDPI_MAX_MDNS_REQUESTS &&
|
||||
ntohs(get_u_int16_t(packet->payload, 6)) != 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MDNS, ndpi_struct, NDPI_LOG_DEBUG, "found MDNS with answer query.\n");
|
||||
return 1;
|
||||
} else if ((packet->payload[2] & 0x80) != 0 &&
|
||||
ntohs(get_u_int16_t(packet->payload, 4)) == 0 &&
|
||||
ntohs(get_u_int16_t(packet->payload, 6)) <= NDPI_MAX_MDNS_REQUESTS &&
|
||||
ntohs(get_u_int16_t(packet->payload, 6)) != 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MDNS, ndpi_struct, NDPI_LOG_DEBUG, "found MDNS with answer query.\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ndpi_search_mdns(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
u_int16_t dport;
|
||||
// const u_int16_t sport=ntohs(packet->udp->source);
|
||||
u_int16_t dport;
|
||||
// const u_int16_t sport=ntohs(packet->udp->source);
|
||||
|
||||
/* check if UDP and */
|
||||
if (packet->udp != NULL) {
|
||||
/*read destination port */
|
||||
dport = ntohs(packet->udp->dest);
|
||||
/* check if UDP and */
|
||||
if (packet->udp != NULL) {
|
||||
/*read destination port */
|
||||
dport = ntohs(packet->udp->dest);
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_MDNS, ndpi_struct, NDPI_LOG_DEBUG, "MDNS udp start \n");
|
||||
NDPI_LOG(NDPI_PROTOCOL_MDNS, ndpi_struct, NDPI_LOG_DEBUG, "MDNS udp start \n");
|
||||
|
||||
|
||||
|
||||
/*check standard MDNS to port 5353 */
|
||||
/*took this information from http://www.it-administrator.de/lexikon/multicast-dns.html */
|
||||
/*check standard MDNS to port 5353 */
|
||||
/*took this information from http://www.it-administrator.de/lexikon/multicast-dns.html */
|
||||
|
||||
if (dport == 5353 && packet->payload_packet_len >= 12) {
|
||||
if (dport == 5353 && packet->payload_packet_len >= 12) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_MDNS, ndpi_struct, NDPI_LOG_DEBUG, "found MDNS with destination port 5353\n");
|
||||
NDPI_LOG(NDPI_PROTOCOL_MDNS, ndpi_struct, NDPI_LOG_DEBUG, "found MDNS with destination port 5353\n");
|
||||
|
||||
/* MDNS header is similar to dns header */
|
||||
/* dns header
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
|
||||
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
| ID |
|
||||
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
|QR| Opcode |AA|TC|RD|RA| Z | RCODE |
|
||||
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
| QDCOUNT |
|
||||
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
| ANCOUNT |
|
||||
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
| NSCOUNT |
|
||||
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
| ARCOUNT |
|
||||
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
*
|
||||
* dns query check: query: QR set, ancount = 0, nscount = 0, QDCOUNT < MAX_MDNS, ARCOUNT < MAX_MDNS
|
||||
*
|
||||
*/
|
||||
/* MDNS header is similar to dns header */
|
||||
/* dns header
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
|
||||
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
| ID |
|
||||
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
|QR| Opcode |AA|TC|RD|RA| Z | RCODE |
|
||||
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
| QDCOUNT |
|
||||
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
| ANCOUNT |
|
||||
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
| NSCOUNT |
|
||||
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
| ARCOUNT |
|
||||
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
*
|
||||
* dns query check: query: QR set, ancount = 0, nscount = 0, QDCOUNT < MAX_MDNS, ARCOUNT < MAX_MDNS
|
||||
*
|
||||
*/
|
||||
|
||||
/* mdns protocol must have destination address 224.0.0.251 */
|
||||
/* took this information from http://www.it-administrator.de/lexikon/multicast-dns.html */
|
||||
/* mdns protocol must have destination address 224.0.0.251 */
|
||||
/* took this information from http://www.it-administrator.de/lexikon/multicast-dns.html */
|
||||
|
||||
if (packet->iph != NULL && ntohl(packet->iph->daddr) == 0xe00000fb) {
|
||||
if (packet->iph != NULL && ntohl(packet->iph->daddr) == 0xe00000fb) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_MDNS, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "found MDNS with destination address 224.0.0.251 (=0xe00000fb)\n");
|
||||
NDPI_LOG(NDPI_PROTOCOL_MDNS, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "found MDNS with destination address 224.0.0.251 (=0xe00000fb)\n");
|
||||
|
||||
if (ndpi_int_check_mdns_payload(ndpi_struct, flow) == 1) {
|
||||
ndpi_int_mdns_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (ndpi_int_check_mdns_payload(ndpi_struct, flow) == 1) {
|
||||
ndpi_int_mdns_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef NDPI_DETECTION_SUPPORT_IPV6
|
||||
if (packet->iphv6 != NULL) {
|
||||
const u_int32_t *daddr = packet->iphv6->daddr.ndpi_v6_u.u6_addr32;
|
||||
if (daddr[0] == htonl(0xff020000) && daddr[1] == 0 && daddr[2] == 0 && daddr[3] == htonl(0xfb)) {
|
||||
if (packet->iphv6 != NULL) {
|
||||
const u_int32_t *daddr = packet->iphv6->ip6_dst.u6_addr.u6_addr32;
|
||||
if (daddr[0] == htonl(0xff020000) && daddr[1] == 0 && daddr[2] == 0 && daddr[3] == htonl(0xfb)) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_MDNS, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "found MDNS with destination address ff02::fb\n");
|
||||
NDPI_LOG(NDPI_PROTOCOL_MDNS, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "found MDNS with destination address ff02::fb\n");
|
||||
|
||||
if (ndpi_int_check_mdns_payload(ndpi_struct, flow) == 1) {
|
||||
ndpi_int_mdns_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ndpi_int_check_mdns_payload(ndpi_struct, flow) == 1) {
|
||||
ndpi_int_mdns_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MDNS);
|
||||
}
|
||||
}
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MDNS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -48,6 +48,9 @@ void ndpi_search_tcp_or_udp(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
u_int proto;
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
if(flow->host_server_name[0] != '\0')
|
||||
return;
|
||||
|
||||
if(ndpi_is_tor_flow(ndpi_struct, flow)) {
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_TOR, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
@@ -61,7 +64,7 @@ void ndpi_search_tcp_or_udp(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
proto = ndpi_search_tcp_or_udp_raw(ndpi_struct,
|
||||
flow->packet.iph ? flow->packet.iph->protocol :
|
||||
#ifdef NDPI_DETECTION_SUPPORT_IPV6
|
||||
flow->packet.iphv6->nexthdr,
|
||||
flow->packet.iphv6->ip6_ctlun.ip6_un1.ip6_un1_nxt,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user