reorganized header files - added ndpi_includes.h
This commit is contained in:
@@ -5,4 +5,6 @@ library_include_HEADERS = ndpi_api.h \
|
||||
ndpi_typedefs.h \
|
||||
ndpi_main.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__
|
||||
#define __NDPI_PUBLIC_FUNCTIONS_H__
|
||||
#ifndef __NDPI_API_H__
|
||||
#define __NDPI_API_H__
|
||||
|
||||
#include "ndpi_main.h"
|
||||
|
||||
@@ -236,4 +236,5 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __NDPI_API_H__ */
|
||||
|
||||
@@ -194,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...) {}
|
||||
@@ -236,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)
|
||||
|
||||
@@ -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__
|
||||
#define __NDPI_MAIN_INCLUDE_FILE__
|
||||
|
||||
#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
|
||||
#ifndef __NDPI_MAIN_H__
|
||||
#define __NDPI_MAIN_H__
|
||||
|
||||
#include "ndpi_includes.h"
|
||||
#include "ndpi_define.h"
|
||||
#include "ndpi_protocol_ids.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);
|
||||
#endif
|
||||
|
||||
#endif /* __NDPI_MAIN_INCLUDE_FILE__ */
|
||||
#endif /* __NDPI_MAIN_H__ */
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __NDPI_API_INCLUDE_FILE__
|
||||
#ifndef __NDPI_API_H__
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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_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"
|
||||
|
||||
#define BT_ANNOUNCE
|
||||
#define _WS2TCPIP_H_ /* Avoid compilation problems */
|
||||
#define SNAP_EXT
|
||||
|
||||
|
||||
@@ -56,18 +55,6 @@ typedef struct node_t
|
||||
struct node_t *left, *right;
|
||||
} 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 */
|
||||
typedef u_int32_t ndpi_ndpi_mask;
|
||||
|
||||
@@ -585,7 +572,7 @@ struct ndpi_flow_tcp_struct {
|
||||
u_char prev_zmq_pkt[10];
|
||||
#endif
|
||||
}
|
||||
#if !defined(WIN32)
|
||||
#ifndef WIN32
|
||||
__attribute__ ((__packed__))
|
||||
#endif
|
||||
;
|
||||
@@ -634,7 +621,7 @@ struct ndpi_flow_udp_struct {
|
||||
u_int32_t eaq_sequence;
|
||||
#endif
|
||||
}
|
||||
#if !defined(WIN32)
|
||||
#ifndef WIN32
|
||||
__attribute__ ((__packed__))
|
||||
#endif
|
||||
;
|
||||
@@ -663,7 +650,7 @@ typedef struct ndpi_packet_struct {
|
||||
u_int8_t detected_subprotocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
||||
|
||||
|
||||
#if !defined(WIN32)
|
||||
#ifndef WIN32
|
||||
__attribute__ ((__packed__))
|
||||
#endif
|
||||
u_int16_t protocol_stack_info;
|
||||
@@ -861,7 +848,7 @@ typedef struct ndpi_detection_module_struct {
|
||||
|
||||
typedef struct ndpi_flow_struct {
|
||||
u_int16_t detected_protocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
||||
#if !defined(WIN32)
|
||||
#ifndef WIN32
|
||||
__attribute__ ((__packed__))
|
||||
#endif
|
||||
u_int16_t protocol_stack_info;
|
||||
|
||||
+16
-20
@@ -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
|
||||
@@ -68,6 +66,4 @@ 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__ */
|
||||
|
||||
Reference in New Issue
Block a user