Merge branch 'dev' of https://github.com/ntop/nDPI into dev
This commit is contained in:
@@ -5,4 +5,6 @@ library_include_HEADERS = ndpi_api.h \
|
|||||||
ndpi_typedefs.h \
|
ndpi_typedefs.h \
|
||||||
ndpi_main.h \
|
ndpi_main.h \
|
||||||
ndpi_protocol_ids.h \
|
ndpi_protocol_ids.h \
|
||||||
ndpi_protocols.h
|
ndpi_protocols.h \
|
||||||
|
ndpi_win32.h \
|
||||||
|
ndpi_includes.h
|
||||||
|
|||||||
@@ -23,8 +23,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __NDPI_PUBLIC_FUNCTIONS_H__
|
#ifndef __NDPI_API_H__
|
||||||
#define __NDPI_PUBLIC_FUNCTIONS_H__
|
#define __NDPI_API_H__
|
||||||
|
|
||||||
#include "ndpi_main.h"
|
#include "ndpi_main.h"
|
||||||
|
|
||||||
@@ -236,4 +236,5 @@ extern "C" {
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
#endif /* __NDPI_API_H__ */
|
||||||
|
|||||||
@@ -194,7 +194,7 @@
|
|||||||
|
|
||||||
#else /* NDPI_ENABLE_DEBUG_MESSAGES */
|
#else /* NDPI_ENABLE_DEBUG_MESSAGES */
|
||||||
|
|
||||||
#if defined(WIN32)
|
#ifdef WIN32
|
||||||
#define NDPI_LOG(...) {}
|
#define NDPI_LOG(...) {}
|
||||||
#else
|
#else
|
||||||
#define NDPI_LOG(proto, mod, log_level, args...) {}
|
#define NDPI_LOG(proto, mod, log_level, args...) {}
|
||||||
@@ -236,7 +236,7 @@
|
|||||||
#define NDPI_BITMASK_SET(a, b) { memcpy(&a, &b, sizeof(NDPI_PROTOCOL_BITMASK)); }
|
#define NDPI_BITMASK_SET(a, b) { memcpy(&a, &b, sizeof(NDPI_PROTOCOL_BITMASK)); }
|
||||||
|
|
||||||
/* this is a very very tricky macro *g*,
|
/* 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_ADD_PROTOCOL_TO_BITMASK(bmask,value) NDPI_SET(&bmask,value)
|
||||||
#define NDPI_DEL_PROTOCOL_FROM_BITMASK(bmask,value) NDPI_CLR(&bmask,value)
|
#define NDPI_DEL_PROTOCOL_FROM_BITMASK(bmask,value) NDPI_CLR(&bmask,value)
|
||||||
|
|||||||
@@ -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 <sys/param.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include "ndpi_win32.h"
|
||||||
|
#else
|
||||||
|
#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__ */
|
||||||
+4
-35
@@ -22,41 +22,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __NDPI_MAIN_INCLUDE_FILE__
|
#ifndef __NDPI_MAIN_H__
|
||||||
#define __NDPI_MAIN_INCLUDE_FILE__
|
#define __NDPI_MAIN_H__
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <string.h>
|
|
||||||
#ifndef WIN32
|
|
||||||
#include <pthread.h>
|
|
||||||
#endif
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include <winsock2.h>
|
|
||||||
#include <ws2tcpip.h>
|
|
||||||
#else
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/socket.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>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* default includes */
|
|
||||||
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#include "ndpi_includes.h"
|
||||||
#include "ndpi_define.h"
|
#include "ndpi_define.h"
|
||||||
#include "ndpi_protocol_ids.h"
|
#include "ndpi_protocol_ids.h"
|
||||||
#include "ndpi_typedefs.h"
|
#include "ndpi_typedefs.h"
|
||||||
@@ -138,4 +107,4 @@ void ndpi_debug_get_last_log_function_line(struct ndpi_detection_module_struct *
|
|||||||
const char **file, const char **func, u_int32_t * line);
|
const char **file, const char **func, u_int32_t * line);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __NDPI_MAIN_INCLUDE_FILE__ */
|
#endif /* __NDPI_MAIN_H__ */
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __NDPI_API_INCLUDE_FILE__
|
#ifndef __NDPI_API_H__
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __NDPI_PROTOCOLS_INCLUDE_FILE__
|
#ifndef __NDPI_PROTOCOLS_H__
|
||||||
#define __NDPI_PROTOCOLS_INCLUDE_FILE__
|
#define __NDPI_PROTOCOLS_H__
|
||||||
|
|
||||||
#include "ndpi_main.h"
|
#include "ndpi_main.h"
|
||||||
|
|
||||||
@@ -337,4 +337,4 @@ void init_zmq_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
|
|||||||
void init_stracraft_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);
|
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__ */
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
#include "ndpi_define.h"
|
#include "ndpi_define.h"
|
||||||
|
|
||||||
#define BT_ANNOUNCE
|
#define BT_ANNOUNCE
|
||||||
#define _WS2TCPIP_H_ /* Avoid compilation problems */
|
|
||||||
#define SNAP_EXT
|
#define SNAP_EXT
|
||||||
|
|
||||||
|
|
||||||
@@ -56,18 +55,6 @@ typedef struct node_t
|
|||||||
struct node_t *left, *right;
|
struct node_t *left, *right;
|
||||||
} ndpi_node;
|
} ndpi_node;
|
||||||
|
|
||||||
#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;
|
|
||||||
typedef uint u_int;
|
|
||||||
typedef unsigned __int64 u_int64_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* NDPI_MASK_SIZE */
|
/* NDPI_MASK_SIZE */
|
||||||
typedef u_int32_t ndpi_ndpi_mask;
|
typedef u_int32_t ndpi_ndpi_mask;
|
||||||
|
|
||||||
@@ -585,7 +572,7 @@ struct ndpi_flow_tcp_struct {
|
|||||||
u_char prev_zmq_pkt[10];
|
u_char prev_zmq_pkt[10];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if !defined(WIN32)
|
#ifndef WIN32
|
||||||
__attribute__ ((__packed__))
|
__attribute__ ((__packed__))
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
@@ -634,7 +621,7 @@ struct ndpi_flow_udp_struct {
|
|||||||
u_int32_t eaq_sequence;
|
u_int32_t eaq_sequence;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if !defined(WIN32)
|
#ifndef WIN32
|
||||||
__attribute__ ((__packed__))
|
__attribute__ ((__packed__))
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
@@ -663,7 +650,7 @@ typedef struct ndpi_packet_struct {
|
|||||||
u_int8_t detected_subprotocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
u_int8_t detected_subprotocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
||||||
|
|
||||||
|
|
||||||
#if !defined(WIN32)
|
#ifndef WIN32
|
||||||
__attribute__ ((__packed__))
|
__attribute__ ((__packed__))
|
||||||
#endif
|
#endif
|
||||||
u_int16_t protocol_stack_info;
|
u_int16_t protocol_stack_info;
|
||||||
@@ -861,7 +848,7 @@ typedef struct ndpi_detection_module_struct {
|
|||||||
|
|
||||||
typedef struct ndpi_flow_struct {
|
typedef struct ndpi_flow_struct {
|
||||||
u_int16_t detected_protocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
u_int16_t detected_protocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
||||||
#if !defined(WIN32)
|
#ifndef WIN32
|
||||||
__attribute__ ((__packed__))
|
__attribute__ ((__packed__))
|
||||||
#endif
|
#endif
|
||||||
u_int16_t protocol_stack_info;
|
u_int16_t protocol_stack_info;
|
||||||
|
|||||||
+16
-20
@@ -22,36 +22,34 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __NDPI_WIN32_INCLUDE_FILE__
|
#ifndef __NDPI_WIN32_H__
|
||||||
#define __NDPI_WIN32_INCLUDE_FILE__
|
#define __NDPI_WIN32_H__
|
||||||
|
|
||||||
#ifdef WIN32
|
#include <winsock2.h>
|
||||||
#include <Winsock2.h> /* winsock.h is included automatically */
|
#include <ws2tcpip.h>
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <getopt.h> /* getopt from: http://www.pwilson.net/sample.html. */
|
#include <getopt.h> /* getopt from: http://www.pwilson.net/sample.html. */
|
||||||
#include <process.h> /* for getpid() and the exec..() family */
|
#include <process.h> /* for getpid() and the exec..() family */
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#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 char u_char;
|
||||||
typedef unsigned short u_short;
|
typedef unsigned short u_short;
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
typedef unsigned long u_long;
|
typedef unsigned long u_long;
|
||||||
#endif
|
typedef u_char u_int8_t;
|
||||||
typedef u_char u_int8_t;
|
typedef u_short u_int16_t;
|
||||||
typedef u_short u_int16_t;
|
typedef uint u_int32_t;
|
||||||
typedef unsigned int u_int32_t;
|
typedef uint u_int;
|
||||||
typedef unsigned __int64 u_int64_t;
|
typedef unsigned __int64 u_int64_t;
|
||||||
|
|
||||||
|
|
||||||
#define pthread_t HANDLE
|
#define pthread_t HANDLE
|
||||||
#define pthread_mutex_t HANDLE
|
#define pthread_mutex_t HANDLE
|
||||||
@@ -68,6 +66,4 @@ extern unsigned long waitForNextEvent(unsigned long ulDelay /* ms */);
|
|||||||
|
|
||||||
#define sleep(a /* sec */) waitForNextEvent(1000*a /* ms */)
|
#define sleep(a /* sec */) waitForNextEvent(1000*a /* ms */)
|
||||||
|
|
||||||
#endif /* Win32 */
|
#endif /* __NDPI_WIN32_H__ */
|
||||||
|
|
||||||
#endif /* __NDPI_WIN32_INCLUDE_FILE__ */
|
|
||||||
|
|||||||
@@ -4484,45 +4484,3 @@ void NDPI_DUMP_BITMASK(NDPI_PROTOCOL_BITMASK a) {
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* #ifdef WIN32 */
|
|
||||||
/* /\* http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/libkern/strsep.c *\/ */
|
|
||||||
|
|
||||||
/* /\* */
|
|
||||||
/* * Get next token from string *stringp, where tokens are possibly-empty */
|
|
||||||
/* * strings separated by characters from delim. */
|
|
||||||
/* * */
|
|
||||||
/* * Writes NULs into the string at *stringp to end tokens. */
|
|
||||||
/* * delim need not remain constant from call to call. */
|
|
||||||
/* * On return, *stringp points past the last NUL written (if there might */
|
|
||||||
/* * be further tokens), or is NULL (if there are definitely no more tokens). */
|
|
||||||
/* * */
|
|
||||||
/* * If *stringp is NULL, strsep returns NULL. */
|
|
||||||
/* *\/ */
|
|
||||||
/* char* strsep(char **stringp, const char *delim) { */
|
|
||||||
/* char *s; */
|
|
||||||
/* const char *spanp; */
|
|
||||||
/* int c, sc; */
|
|
||||||
/* char *tok; */
|
|
||||||
|
|
||||||
/* if((s = *stringp) == NULL) */
|
|
||||||
/* return (NULL); */
|
|
||||||
/* for(tok = s;;) { */
|
|
||||||
/* c = *s++; */
|
|
||||||
/* spanp = delim; */
|
|
||||||
/* do { */
|
|
||||||
/* if((sc = *spanp++) == c) { */
|
|
||||||
/* if(c == 0) */
|
|
||||||
/* s = NULL; */
|
|
||||||
/* else */
|
|
||||||
/* s[-1] = 0; */
|
|
||||||
/* *stringp = s; */
|
|
||||||
/* return (tok); */
|
|
||||||
/* } */
|
|
||||||
/* } while (sc != 0); */
|
|
||||||
/* } */
|
|
||||||
/* /\* NOTREACHED *\/ */
|
|
||||||
/* } */
|
|
||||||
/* #endif */
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ndpi_protocols.h"
|
#include "ndpi_protocols.h"
|
||||||
|
|
||||||
#ifdef NDPI_PROTOCOL_AFP
|
#ifdef NDPI_PROTOCOL_AFP
|
||||||
|
|
||||||
static void ndpi_int_afp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
static void ndpi_int_afp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||||
|
|||||||
@@ -22,8 +22,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* include files */
|
|
||||||
#include "ndpi_protocols.h"
|
#include "ndpi_protocols.h"
|
||||||
|
|
||||||
#ifdef NDPI_PROTOCOL_ARMAGETRON
|
#ifdef NDPI_PROTOCOL_ARMAGETRON
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
-41
@@ -84,47 +84,6 @@ int ndpi_comp_with_mask (void *addr, void *dest, u_int mask) {
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* this implementation does not support IPv6, using system inet_pton */
|
|
||||||
#ifndef WIN32
|
|
||||||
/* inet_pton substitute implementation
|
|
||||||
* Uses inet_addr to convert an IP address in dotted decimal notation into
|
|
||||||
* unsigned long and copies the result to dst.
|
|
||||||
* Only supports AF_INET. Follows standard error return conventions of
|
|
||||||
* inet_pton.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
inet_pton (int af, const char *src, void *dst)
|
|
||||||
{
|
|
||||||
u_long result;
|
|
||||||
|
|
||||||
if(af == AF_INET) {
|
|
||||||
result = inet_addr(src);
|
|
||||||
if(result == -1)
|
|
||||||
return 0;
|
|
||||||
else {
|
|
||||||
memcpy (dst, &result, sizeof(struct in_addr));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef NT
|
|
||||||
#if defined(PATRICIA_IPV6)
|
|
||||||
else if(af == AF_INET6) {
|
|
||||||
struct in6_addr Address;
|
|
||||||
return (inet6_addr(src, &Address));
|
|
||||||
}
|
|
||||||
#endif /* PATRICIA_IPV6 */
|
|
||||||
#endif /* NT */
|
|
||||||
#ifndef NT
|
|
||||||
else {
|
|
||||||
printf("NOT SUPP\n");
|
|
||||||
errno = EAFNOSUPPORT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif /* NT */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* this allows imcomplete prefix */
|
/* this allows imcomplete prefix */
|
||||||
int
|
int
|
||||||
ndpi_my_inet_pton (int af, const char *src, void *dst)
|
ndpi_my_inet_pton (int af, const char *src, void *dst)
|
||||||
|
|||||||
Reference in New Issue
Block a user