Rename all structure definitions in the "typedef struct _SomeStruct" format to "typedef struct SomeStruct_" to make the Doxygen output more useful.

Remove the Trie multi pattern matcher code. It wasn't used anymore.
remotes/origin/master-1.0.x
Victor Julien 17 years ago
parent ffa013b2d8
commit 689bbfdc45

@ -60,7 +60,6 @@ detect-flow.c detect-flow.h \
detect-dsize.c detect-dsize.h \ detect-dsize.c detect-dsize.h \
detect-noalert.c detect-noalert.h \ detect-noalert.c detect-noalert.h \
util-print.c util-print.h \ util-print.c util-print.h \
util-mpm-trie.c util-mpm-trie.h \
util-mpm.c util-mpm.h \ util-mpm.c util-mpm.h \
util-binsearch.c util-binsearch.h \ util-binsearch.c util-binsearch.h \
util-mpm-wumanber.c util-mpm-wumanber.h \ util-mpm-wumanber.c util-mpm-wumanber.h \

@ -65,7 +65,7 @@ void TmModuleAlertDebuglogIPv6Register (void) {
tmm_modules[TMM_ALERTDEBUGLOG6].RegisterTests = NULL; tmm_modules[TMM_ALERTDEBUGLOG6].RegisterTests = NULL;
} }
*/ */
typedef struct _AlertDebuglogThread { typedef struct AlertDebuglogThread_ {
FILE *fp; FILE *fp;
u_int32_t alerts; u_int32_t alerts;
} AlertDebuglogThread; } AlertDebuglogThread;

@ -65,7 +65,7 @@ void TmModuleAlertFastlogIPv6Register (void) {
tmm_modules[TMM_ALERTFASTLOG6].RegisterTests = NULL; tmm_modules[TMM_ALERTFASTLOG6].RegisterTests = NULL;
} }
typedef struct _AlertFastlogThread { typedef struct AlertFastlogThread_ {
FILE *fp; FILE *fp;
u_int32_t alerts; u_int32_t alerts;
} AlertFastlogThread; } AlertFastlogThread;

@ -45,7 +45,7 @@ void TmModuleAlertUnifiedAlertRegister (void) {
tmm_modules[TMM_ALERTUNIFIEDALERT].RegisterTests = NULL; tmm_modules[TMM_ALERTUNIFIEDALERT].RegisterTests = NULL;
} }
typedef struct _AlertUnifiedAlertThread { typedef struct AlertUnifiedAlertThread_ {
FILE *fp; FILE *fp;
u_int32_t size_limit; u_int32_t size_limit;
u_int32_t size_current; u_int32_t size_current;
@ -55,14 +55,14 @@ typedef struct _AlertUnifiedAlertThread {
#define ALERTUNIFIEDALERT_VERMAJOR 1 /* taken from Snort */ #define ALERTUNIFIEDALERT_VERMAJOR 1 /* taken from Snort */
#define ALERTUNIFIEDALERT_VERMINOR 81 /* taken from Snort */ #define ALERTUNIFIEDALERT_VERMINOR 81 /* taken from Snort */
typedef struct _AlertUnifiedAlertFileHeader { typedef struct AlertUnifiedAlertFileHeader_ {
u_int32_t magic; u_int32_t magic;
u_int32_t ver_major; u_int32_t ver_major;
u_int32_t ver_minor; u_int32_t ver_minor;
u_int32_t timezone; u_int32_t timezone;
} AlertUnifiedAlertFileHeader; } AlertUnifiedAlertFileHeader;
typedef struct _AlertUnifiedAlertPacketHeader { typedef struct AlertUnifiedAlertPacketHeader_ {
/* Snort's 'Event' structure */ /* Snort's 'Event' structure */
u_int32_t sig_gen; u_int32_t sig_gen;
u_int32_t sig_sid; u_int32_t sig_sid;

@ -45,7 +45,7 @@ void TmModuleAlertUnifiedLogRegister (void) {
tmm_modules[TMM_ALERTUNIFIEDLOG].RegisterTests = NULL; tmm_modules[TMM_ALERTUNIFIEDLOG].RegisterTests = NULL;
} }
typedef struct _AlertUnifiedLogThread { typedef struct AlertUnifiedLogThread_ {
FILE *fp; FILE *fp;
u_int32_t size_limit; u_int32_t size_limit;
u_int32_t size_current; u_int32_t size_current;
@ -55,7 +55,7 @@ typedef struct _AlertUnifiedLogThread {
#define ALERTUNIFIEDLOG_VERMAJOR 1 /* taken from Snort */ #define ALERTUNIFIEDLOG_VERMAJOR 1 /* taken from Snort */
#define ALERTUNIFIEDLOG_VERMINOR 2 /* taken from Snort */ #define ALERTUNIFIEDLOG_VERMINOR 2 /* taken from Snort */
typedef struct _AlertUnifiedLogFileHeader { typedef struct AlertUnifiedLogFileHeader_ {
u_int32_t magic; u_int32_t magic;
u_int16_t ver_major; u_int16_t ver_major;
u_int16_t ver_minor; u_int16_t ver_minor;
@ -65,7 +65,7 @@ typedef struct _AlertUnifiedLogFileHeader {
u_int32_t linktype; u_int32_t linktype;
} AlertUnifiedLogFileHeader; } AlertUnifiedLogFileHeader;
typedef struct _AlertUnifiedLogPacketHeader { typedef struct AlertUnifiedLogPacketHeader_ {
/* Snort's 'Event' structure */ /* Snort's 'Event' structure */
u_int32_t sig_gen; u_int32_t sig_gen;
u_int32_t sig_sid; u_int32_t sig_sid;

@ -17,7 +17,7 @@
#define ETHERNET_TYPE_8021Q 0x8100 #define ETHERNET_TYPE_8021Q 0x8100
#define ETHERNET_TYPE_LOOP 0x9000 #define ETHERNET_TYPE_LOOP 0x9000
typedef struct _EthernetHdr { typedef struct EthernetHdr_ {
u_int8_t eth_dst[6]; u_int8_t eth_dst[6];
u_int8_t eth_src[6]; u_int8_t eth_src[6];
u_int16_t eth_type; u_int16_t eth_type;

@ -124,7 +124,7 @@
#endif #endif
/* ICMPv4 header structure */ /* ICMPv4 header structure */
typedef struct _ICMPV4Hdr typedef struct ICMPV4Hdr_
{ {
u_int8_t type; u_int8_t type;
u_int8_t code; u_int8_t code;

@ -64,7 +64,7 @@
#endif #endif
typedef struct _ICMPV6Hdr typedef struct ICMPV6Hdr_
{ {
u_int8_t type; u_int8_t type;
u_int8_t code; u_int8_t code;

@ -21,7 +21,7 @@
#define IPV4_OPT_SECURITY 0x82 #define IPV4_OPT_SECURITY 0x82
#define IPV4_OPT_LSRR 0x83 #define IPV4_OPT_LSRR 0x83
typedef struct _IPV4Hdr typedef struct IPV4Hdr_
{ {
u_int8_t ip_verhl; /* version & header length */ u_int8_t ip_verhl; /* version & header length */
u_int8_t ip_tos; u_int8_t ip_tos;
@ -113,8 +113,12 @@ typedef struct _IPV4Hdr
#define IPV4_CACHE_IPTTL 0x0400 /* 1024*/ #define IPV4_CACHE_IPTTL 0x0400 /* 1024*/
#define IPV4_CACHE_IPPROTO 0x0800 /* 2048 */ #define IPV4_CACHE_IPPROTO 0x0800 /* 2048 */
/* decoder cache */ /**
typedef struct _IPV4Cache * IPv4 decoder cache
*
* Used for storing parsed values.
*/
typedef struct IPV4Cache_
{ {
u_int16_t flags; u_int16_t flags;
@ -137,7 +141,7 @@ typedef struct _IPV4Cache
} IPV4Cache; } IPV4Cache;
/* helper structure with parsed ipv4 info */ /* helper structure with parsed ipv4 info */
typedef struct _IPV4Vars typedef struct IPV4Vars_
{ {
u_int8_t ip_opts_len; u_int8_t ip_opts_len;
} IPV4Vars; } IPV4Vars;

@ -13,10 +13,10 @@
#define IPV6_MAXPACKET 65535 /* maximum packet size */ #define IPV6_MAXPACKET 65535 /* maximum packet size */
#define IPV6_MAX_OPT 40 #define IPV6_MAX_OPT 40
typedef struct _IPV6Hdr typedef struct IPV6Hdr_
{ {
union { union {
struct _ip6_un1 { struct ip6_un1_ {
u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */ u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */
u_int16_t ip6_un1_plen; /* payload length */ u_int16_t ip6_un1_plen; /* payload length */
u_int8_t ip6_un1_nxt; /* next header */ u_int8_t ip6_un1_nxt; /* next header */
@ -83,7 +83,7 @@ typedef struct _IPV6Hdr
#define IPV6_CACHE_HLIM 0x0020 /* 32 */ #define IPV6_CACHE_HLIM 0x0020 /* 32 */
/* decoder cache */ /* decoder cache */
typedef struct _IPV6Cache typedef struct IPV6Cache_
{ {
u_int16_t flags; u_int16_t flags;
u_int8_t ver; u_int8_t ver;
@ -95,7 +95,7 @@ typedef struct _IPV6Cache
} IPV6Cache; } IPV6Cache;
/* helper structure with parsed ipv6 info */ /* helper structure with parsed ipv6 info */
typedef struct _IPV6Vars typedef struct IPV6Vars_
{ {
u_int8_t ip_opts_len; u_int8_t ip_opts_len;
u_int8_t l4proto; /* the proto after the extension headers u_int8_t l4proto; /* the proto after the extension headers
@ -104,7 +104,7 @@ typedef struct _IPV6Vars
} IPV6Vars; } IPV6Vars;
/* Fragment header */ /* Fragment header */
typedef struct _IPV6FragHdr typedef struct IPV6FragHdr_
{ {
u_int8_t ip6fh_nxt; /* next header */ u_int8_t ip6fh_nxt; /* next header */
u_int8_t ip6fh_reserved; /* reserved field */ u_int8_t ip6fh_reserved; /* reserved field */
@ -125,7 +125,7 @@ typedef struct _IPV6FragHdr
#define IPV6_EXTHDR_GET_FH_ID(p) IPV6_EXTHDR_GET_RAW_FH_ID((p)) #define IPV6_EXTHDR_GET_FH_ID(p) IPV6_EXTHDR_GET_RAW_FH_ID((p))
/* rfc 1826 */ /* rfc 1826 */
typedef struct _IPV6AuthHdr typedef struct IPV6AuthHdr_
{ {
u_int8_t ip6ah_nxt; /* next header */ u_int8_t ip6ah_nxt; /* next header */
u_int8_t ip6ah_len; /* header length in units of 8 bytes, not u_int8_t ip6ah_len; /* header length in units of 8 bytes, not
@ -135,13 +135,13 @@ typedef struct _IPV6AuthHdr
u_int32_t ip6ah_seq; /* sequence number */ u_int32_t ip6ah_seq; /* sequence number */
} IPV6AuthHdr; } IPV6AuthHdr;
typedef struct _IPV6EspHdr typedef struct IPV6EspHdr_
{ {
u_int32_t ip6esph_spi; /* SECURITY PARAMETERS INDEX (SPI) */ u_int32_t ip6esph_spi; /* SECURITY PARAMETERS INDEX (SPI) */
u_int32_t ip6esph_seq; /* sequence number */ u_int32_t ip6esph_seq; /* sequence number */
} IPV6EspHdr; } IPV6EspHdr;
typedef struct _IPV6RouteHdr typedef struct IPV6RouteHdr_
{ {
u_int8_t ip6rh_nxt; /* next header */ u_int8_t ip6rh_nxt; /* next header */
u_int8_t ip6rh_len; /* header length in units of 8 bytes, not u_int8_t ip6rh_len; /* header length in units of 8 bytes, not
@ -174,7 +174,7 @@ typedef struct _IPV6RouteHdr
#define IPV6OPT_HAO 0xC9 #define IPV6OPT_HAO 0xC9
/* Home Address Option */ /* Home Address Option */
typedef struct _IPV6OptHAO typedef struct IPV6OptHAO_
{ {
u_int8_t ip6hao_type; /* Option type */ u_int8_t ip6hao_type; /* Option type */
u_int8_t ip6hao_len; /* Option Data len (excludes type and len) */ u_int8_t ip6hao_len; /* Option Data len (excludes type and len) */
@ -182,7 +182,7 @@ typedef struct _IPV6OptHAO
} IPV6OptHAO; } IPV6OptHAO;
/* Router Alert Option */ /* Router Alert Option */
typedef struct _IPV6OptRA typedef struct IPV6OptRA_
{ {
u_int8_t ip6ra_type; /* Option type */ u_int8_t ip6ra_type; /* Option type */
u_int8_t ip6ra_len; /* Option Data len (excludes type and len) */ u_int8_t ip6ra_len; /* Option Data len (excludes type and len) */
@ -190,14 +190,14 @@ typedef struct _IPV6OptRA
} IPV6OptRA; } IPV6OptRA;
/* Jumbo Option */ /* Jumbo Option */
typedef struct _IPV6OptJumbo typedef struct IPV6OptJumbo_
{ {
u_int8_t ip6j_type; /* Option type */ u_int8_t ip6j_type; /* Option type */
u_int8_t ip6j_len; /* Option Data len (excludes type and len) */ u_int8_t ip6j_len; /* Option Data len (excludes type and len) */
u_int32_t ip6j_payload_len; /* Jumbo Payload Length */ u_int32_t ip6j_payload_len; /* Jumbo Payload Length */
} IPV6OptJumbo; } IPV6OptJumbo;
typedef struct _IPV6HopOptsHdr typedef struct IPV6HopOptsHdr_
{ {
u_int8_t ip6hh_nxt; /* next header */ u_int8_t ip6hh_nxt; /* next header */
u_int8_t ip6hh_len; /* header length in units of 8 bytes, not u_int8_t ip6hh_len; /* header length in units of 8 bytes, not
@ -212,7 +212,7 @@ typedef struct _IPV6HopOptsHdr
#define IPV6_EXTHDR_GET_HH_HDRLEN(p) IPV6_EXTHDR_GET_RAW_HH_HDRLEN((p)) #define IPV6_EXTHDR_GET_HH_HDRLEN(p) IPV6_EXTHDR_GET_RAW_HH_HDRLEN((p))
/* XXX */ /* XXX */
typedef struct _IPV6DstOptsHdr typedef struct IPV6DstOptsHdr_
{ {
u_int8_t ip6dh_nxt; /* next header */ u_int8_t ip6dh_nxt; /* next header */
u_int8_t ip6dh_len; /* header length in units of 8 bytes, not u_int8_t ip6dh_len; /* header length in units of 8 bytes, not
@ -235,7 +235,7 @@ typedef struct _IPV6DstOptsHdr
#define IPV6_EXTHDR_GET_DH2_HDRLEN(p) IPV6_EXTHDR_GET_RAW_DH2_HDRLEN((p)) #define IPV6_EXTHDR_GET_DH2_HDRLEN(p) IPV6_EXTHDR_GET_RAW_DH2_HDRLEN((p))
/* XXX */ /* XXX */
typedef struct _IPV6GenOptHdr typedef struct IPV6GenOptHdr_
{ {
u_int8_t type; u_int8_t type;
u_int8_t next; u_int8_t next;
@ -243,7 +243,7 @@ typedef struct _IPV6GenOptHdr
u_int8_t *data; u_int8_t *data;
} IPV6GenOptHdr; } IPV6GenOptHdr;
typedef struct _IPV6ExtHdrs typedef struct IPV6ExtHdrs_
{ {
IPV6FragHdr *ip6fh; IPV6FragHdr *ip6fh;
/* In fh_offset we store the offset of this extension into the packet past /* In fh_offset we store the offset of this extension into the packet past

@ -6,49 +6,49 @@
/* Point to Point Protocol RFC1331 - Supported tyes */ /* Point to Point Protocol RFC1331 - Supported tyes */
#define PPP_IP 0x0021 /* Internet Protocol */ #define PPP_IP 0x0021 /* Internet Protocol */
#define PPP_IPV6 0x0057 /* Internet Protocol version 6 */ #define PPP_IPV6 0x0057 /* Internet Protocol version 6 */
#define PPP_VJ_UCOMP 0x002f /* VJ uncompressed TCP/IP */ #define PPP_VJ_UCOMP 0x002f /* VJ uncompressed TCP/IP */
/* Unsupported PPP types (libpcap source reference) */ /* Unsupported PPP types (libpcap source reference) */
#define PPP_IPX 0x002b /* Novell IPX Protocol */ #define PPP_IPX 0x002b /* Novell IPX Protocol */
#define PPP_VJ_COMP 0x002d /* VJ compressed TCP/IP */ #define PPP_VJ_COMP 0x002d /* VJ compressed TCP/IP */
#define PPP_IPX 0x002b /* Novell IPX Protocol */ #define PPP_IPX 0x002b /* Novell IPX Protocol */
#define PPP_OSI 0x0023 /* OSI Network Layer */ #define PPP_OSI 0x0023 /* OSI Network Layer */
#define PPP_NS 0x0025 /* Xerox NS IDP */ #define PPP_NS 0x0025 /* Xerox NS IDP */
#define PPP_DECNET 0x0027 /* DECnet Phase IV */ #define PPP_DECNET 0x0027 /* DECnet Phase IV */
#define PPP_APPLE 0x0029 /* Appletalk */ #define PPP_APPLE 0x0029 /* Appletalk */
#define PPP_BRPDU 0x0031 /* Bridging PDU */ #define PPP_BRPDU 0x0031 /* Bridging PDU */
#define PPP_STII 0x0033 /* Stream Protocol (ST-II) */ #define PPP_STII 0x0033 /* Stream Protocol (ST-II) */
#define PPP_VINES 0x0035 /* Banyan Vines */ #define PPP_VINES 0x0035 /* Banyan Vines */
#define PPP_HELLO 0x0201 /* 802.1d Hello Packets */ #define PPP_HELLO 0x0201 /* 802.1d Hello Packets */
#define PPP_LUXCOM 0x0231 /* Luxcom */ #define PPP_LUXCOM 0x0231 /* Luxcom */
#define PPP_SNS 0x0233 /* Sigma Network Systems */ #define PPP_SNS 0x0233 /* Sigma Network Systems */
#define PPP_MPLS_UCAST 0x0281 /* rfc 3032 */ #define PPP_MPLS_UCAST 0x0281 /* rfc 3032 */
#define PPP_MPLS_MCAST 0x0283 /* rfc 3022 */ #define PPP_MPLS_MCAST 0x0283 /* rfc 3022 */
#define PPP_IPCP 0x8021 /* IP Control Protocol */ #define PPP_IPCP 0x8021 /* IP Control Protocol */
#define PPP_OSICP 0x8023 /* OSI Network Layer Control Protocol */ #define PPP_OSICP 0x8023 /* OSI Network Layer Control Protocol */
#define PPP_NSCP 0x8025 /* Xerox NS IDP Control Protocol */ #define PPP_NSCP 0x8025 /* Xerox NS IDP Control Protocol */
#define PPP_DECNETCP 0x8027 /* DECnet Control Protocol */ #define PPP_DECNETCP 0x8027 /* DECnet Control Protocol */
#define PPP_APPLECP 0x8029 /* Appletalk Control Protocol */ #define PPP_APPLECP 0x8029 /* Appletalk Control Protocol */
#define PPP_IPXCP 0x802b /* Novell IPX Control Protocol */ #define PPP_IPXCP 0x802b /* Novell IPX Control Protocol */
#define PPP_STIICP 0x8033 /* Strean Protocol Control Protocol */ #define PPP_STIICP 0x8033 /* Strean Protocol Control Protocol */
#define PPP_VINESCP 0x8035 /* Banyan Vines Control Protocol */ #define PPP_VINESCP 0x8035 /* Banyan Vines Control Protocol */
#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */ #define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */
#define PPP_MPLSCP 0x8281 /* rfc 3022 */ #define PPP_MPLSCP 0x8281 /* rfc 3022 */
#define PPP_LCP 0xc021 /* Link Control Protocol */ #define PPP_LCP 0xc021 /* Link Control Protocol */
#define PPP_PAP 0xc023 /* Password Authentication Protocol */ #define PPP_PAP 0xc023 /* Password Authentication Protocol */
#define PPP_LQM 0xc025 /* Link Quality Monitoring */ #define PPP_LQM 0xc025 /* Link Quality Monitoring */
#define PPP_CHAP 0xc223 /* Challenge Handshake Authentication Protocol */ #define PPP_CHAP 0xc223 /* Challenge Handshake Authentication Protocol */
typedef struct _PPPHdr { typedef struct PPPHdr_ {
u_int8_t address; u_int8_t address;
u_int8_t control; u_int8_t control;
u_int16_t protocol; u_int16_t protocol;
} PPPHdr; } PPPHdr;
#define PPP_HEADER_LEN (sizeof(struct _PPPHdr)) #define PPP_HEADER_LEN 4
void DecodePPPRegisterTests(void); void DecodePPPRegisterTests(void);

@ -71,13 +71,13 @@
#define TCP_ISSET_FLAG_RES2(p) ((p)->tcph->th_flags & TH_RES2) #define TCP_ISSET_FLAG_RES2(p) ((p)->tcph->th_flags & TH_RES2)
#define TCP_ISSET_FLAG_RES1(p) ((p)->tcph->th_flags & TH_RES1) #define TCP_ISSET_FLAG_RES1(p) ((p)->tcph->th_flags & TH_RES1)
typedef struct _TCPOpt { typedef struct TCPOpt_ {
u_int8_t type; u_int8_t type;
u_int8_t len; u_int8_t len;
u_int8_t *data; u_int8_t *data;
} TCPOpt; } TCPOpt;
typedef struct _TCPHdr typedef struct TCPHdr_
{ {
u_int16_t th_sport; /* source port */ u_int16_t th_sport; /* source port */
u_int16_t th_dport; /* destination port */ u_int16_t th_dport; /* destination port */
@ -90,7 +90,7 @@ typedef struct _TCPHdr
u_int16_t th_urp; /* urgent pointer */ u_int16_t th_urp; /* urgent pointer */
} TCPHdr; } TCPHdr;
typedef struct _TCPVars typedef struct TCPVars_
{ {
u_int8_t hlen; u_int8_t hlen;

@ -15,7 +15,7 @@
#define UDP_GET_DST_PORT(p) UDP_GET_RAW_DST_PORT(p->udph) #define UDP_GET_DST_PORT(p) UDP_GET_RAW_DST_PORT(p->udph)
/* UDP header structure */ /* UDP header structure */
typedef struct _UDPHdr typedef struct UDPHdr_
{ {
u_int16_t uh_sport; /* source port */ u_int16_t uh_sport; /* source port */
u_int16_t uh_dport; /* destination port */ u_int16_t uh_dport; /* destination port */
@ -23,7 +23,7 @@ typedef struct _UDPHdr
u_int16_t uh_sum; /* checksum */ u_int16_t uh_sum; /* checksum */
} UDPHdr; } UDPHdr;
typedef struct _UDPVars typedef struct UDPVars_
{ {
u_int8_t hlen; u_int8_t hlen;
} UDPVars; } UDPVars;

@ -44,7 +44,7 @@
#include "decode-udp.h" #include "decode-udp.h"
/* Address */ /* Address */
typedef struct _Address typedef struct Address_
{ {
char family; char family;
union { union {
@ -152,7 +152,7 @@ typedef u_int16_t Port;
/* structure to store the sids/gids/etc the detection engine /* structure to store the sids/gids/etc the detection engine
* found in this packet */ * found in this packet */
typedef struct _PacketAlert { typedef struct PacketAlert_ {
u_int8_t gid; u_int8_t gid;
u_int32_t sid; u_int32_t sid;
u_int8_t rev; u_int8_t rev;
@ -163,7 +163,7 @@ typedef struct _PacketAlert {
#define PACKET_ALERT_MAX 256 #define PACKET_ALERT_MAX 256
typedef struct _PacketAlerts { typedef struct PacketAlerts_ {
u_int16_t cnt; u_int16_t cnt;
PacketAlert alerts[PACKET_ALERT_MAX]; PacketAlert alerts[PACKET_ALERT_MAX];
} PacketAlerts; } PacketAlerts;
@ -171,7 +171,7 @@ typedef struct _PacketAlerts {
#define HTTP_URI_MAXCNT 8 #define HTTP_URI_MAXCNT 8
#define HTTP_URI_MAXLEN 1024 #define HTTP_URI_MAXLEN 1024
typedef struct _HttpUri { typedef struct HttpUri_ {
/* the raw uri for the packet as set by pcre */ /* the raw uri for the packet as set by pcre */
u_int8_t *raw[HTTP_URI_MAXCNT]; u_int8_t *raw[HTTP_URI_MAXCNT];
u_int16_t raw_size[HTTP_URI_MAXCNT]; u_int16_t raw_size[HTTP_URI_MAXCNT];
@ -183,16 +183,16 @@ typedef struct _HttpUri {
u_int8_t cnt; u_int8_t cnt;
} HttpUri; } HttpUri;
typedef struct _PktVar { typedef struct PktVar_ {
char *name; char *name;
u_int8_t *value; u_int8_t *value;
u_int16_t value_len; u_int16_t value_len;
struct _PktVar *next; /* right now just implement this as a list, struct PktVar_ *next; /* right now just implement this as a list,
* in the long run we have thing of something * in the long run we have thing of something
* faster. */ * faster. */
} PktVar; } PktVar;
typedef struct _Packet typedef struct Packet_
{ {
/* Addresses, Ports and protocol /* Addresses, Ports and protocol
* these are on top so we can use * these are on top so we can use
@ -232,7 +232,7 @@ typedef struct _Packet
u_int16_t pktlen; u_int16_t pktlen;
/* flow */ /* flow */
struct _Flow *flow; struct Flow_ *flow;
u_int8_t flowflags; u_int8_t flowflags;
/* pkt vars */ /* pkt vars */
@ -276,11 +276,11 @@ typedef struct _Packet
int action; int action;
/* double linked list ptrs */ /* double linked list ptrs */
struct _Packet *next; struct Packet_ *next;
struct _Packet *prev; struct Packet_ *prev;
/* tunnel/encapsulation handling */ /* tunnel/encapsulation handling */
struct _Packet *root; /* in case of tunnel this is a ptr struct Packet_ *root; /* in case of tunnel this is a ptr
* to the 'real' packet, the one we * to the 'real' packet, the one we
* need to set the verdict on -- * need to set the verdict on --
* It should always point to the lowest * It should always point to the lowest
@ -288,7 +288,7 @@ typedef struct _Packet
} Packet; } Packet;
typedef struct _PacketQueue { typedef struct PacketQueue_ {
Packet *top; Packet *top;
Packet *bot; Packet *bot;
u_int16_t len; u_int16_t len;

@ -10,7 +10,7 @@
#define DETECT_CONTENT_RAWBYTES 0x20 #define DETECT_CONTENT_RAWBYTES 0x20
typedef struct _DetectContentData { typedef struct DetectContentData_ {
u_int8_t *content; u_int8_t *content;
u_int8_t content_len; u_int8_t content_len;
u_int32_t id; u_int32_t id;

@ -6,7 +6,7 @@
#define DETECTDSIZE_GT 2 #define DETECTDSIZE_GT 2
#define DETECTDSIZE_RA 3 #define DETECTDSIZE_RA 3
typedef struct _DetectDsizeData { typedef struct DetectDsizeData_ {
u_int16_t dsize; u_int16_t dsize;
u_int16_t dsize2; u_int16_t dsize2;
u_int8_t mode; u_int8_t mode;

@ -182,7 +182,7 @@ void SigGroupHeadSetMpmMaxlen(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
} }
} }
typedef struct _ContentHash { typedef struct ContentHash_ {
DetectContentData *ptr; DetectContentData *ptr;
u_int16_t cnt; u_int16_t cnt;
u_int8_t use; /* use no matter what */ u_int8_t use; /* use no matter what */

@ -1,7 +1,7 @@
#ifndef __DETECT_FLOW_H__ #ifndef __DETECT_FLOW_H__
#define __DETECT_FLOW_H__ #define __DETECT_FLOW_H__
typedef struct _DetectFlowData { typedef struct DetectFlowData_ {
u_int8_t flags; /* flags to match */ u_int8_t flags; /* flags to match */
u_int8_t match_cnt; /* number of matches we need */ u_int8_t match_cnt; /* number of matches we need */
} DetectFlowData; } DetectFlowData;

@ -8,7 +8,7 @@
#define DETECT_FLOWBITS_CMD_TOGGLE 4 #define DETECT_FLOWBITS_CMD_TOGGLE 4
#define DETECT_FLOWBITS_CMD_NOALERT 5 #define DETECT_FLOWBITS_CMD_NOALERT 5
typedef struct _DetectFlowbitsData { typedef struct DetectFlowbitsData_ {
u_int16_t idx; u_int16_t idx;
u_int8_t cmd; u_int8_t cmd;
} DetectFlowbitsData; } DetectFlowbitsData;

@ -3,7 +3,7 @@
#define DETECT_CONTENT_NOCASE 0x01 #define DETECT_CONTENT_NOCASE 0x01
typedef struct _DetectFlowvarData { typedef struct DetectFlowvarData_ {
char *name; char *name;
u_int16_t idx; u_int16_t idx;
u_int8_t *content; u_int8_t *content;

@ -14,7 +14,7 @@
#define DETECT_PCRE_CAPTURE_PKT 0x0080 #define DETECT_PCRE_CAPTURE_PKT 0x0080
#define DETECT_PCRE_CAPTURE_FLOW 0x0100 #define DETECT_PCRE_CAPTURE_FLOW 0x0100
typedef struct _DetectPcreData { typedef struct DetectPcreData_ {
/* pcre options */ /* pcre options */
pcre *re; pcre *re;
pcre_extra *sd; pcre_extra *sd;

@ -3,7 +3,7 @@
#define DETECT_CONTENT_NOCASE 0x01 #define DETECT_CONTENT_NOCASE 0x01
typedef struct _DetectPktvarData { typedef struct DetectPktvarData_ {
char *name; char *name;
u_int8_t *content; u_int8_t *content;
u_int8_t content_len; u_int8_t content_len;

@ -10,7 +10,7 @@
#define DETECT_URICONTENT_RAWBYTES 0x20 #define DETECT_URICONTENT_RAWBYTES 0x20
typedef struct _DetectUricontentData { typedef struct DetectUricontentData_ {
u_int8_t *uricontent; u_int8_t *uricontent;
u_int8_t uricontent_len; u_int8_t uricontent_len;
u_int32_t id; u_int32_t id;

@ -43,12 +43,12 @@ typedef struct DetectAddressGroup_ {
DetectAddressData *ad; DetectAddressData *ad;
/* XXX ptr to rules, or PortGroup or whatever */ /* XXX ptr to rules, or PortGroup or whatever */
union { union {
struct DetectAddressGroupsHead_ *dst_gh; struct DetectAddressGroupsHead_ *dst_gh;
struct DetectPort_ *port; struct DetectPort_ *port;
}; };
/* signatures that belong in this group */ /* signatures that belong in this group */
struct _SigGroupHead *sh; struct SigGroupHead_ *sh;
u_int8_t flags; u_int8_t flags;
/* double linked list */ /* double linked list */
@ -93,7 +93,7 @@ typedef struct DetectPort_ {
u_int16_t port2; u_int16_t port2;
/* signatures that belong in this group */ /* signatures that belong in this group */
struct _SigGroupHead *sh; struct SigGroupHead_ *sh;
struct DetectPort_ *dst_ph; struct DetectPort_ *dst_ph;
@ -126,7 +126,11 @@ typedef struct DetectEngineIPOnlyThreadCtx_ {
u_int32_t sig_match_size; /* size in bytes of the array */ u_int32_t sig_match_size; /* size in bytes of the array */
} DetectEngineIPOnlyThreadCtx; } DetectEngineIPOnlyThreadCtx;
typedef struct _PatternMatcherThread { /**
* Detection engine thread data.
* XXX: we should rename this
*/
typedef struct PatternMatcherThread_ {
/* detection engine variables */ /* detection engine variables */
u_int8_t *pkt_ptr; /* ptr to the current position in the pkt */ u_int8_t *pkt_ptr; /* ptr to the current position in the pkt */
u_int16_t pkt_off; u_int16_t pkt_off;
@ -142,7 +146,7 @@ typedef struct _PatternMatcherThread {
* or uricontent ctx. */ * or uricontent ctx. */
MpmThreadCtx mtc; /* thread ctx for the mpm */ MpmThreadCtx mtc; /* thread ctx for the mpm */
MpmThreadCtx mtcu; MpmThreadCtx mtcu;
struct _SigGroupHead *sgh; struct SigGroupHead_ *sgh;
PatternMatcherQueue pmq; PatternMatcherQueue pmq;
/* counters */ /* counters */
@ -174,7 +178,7 @@ typedef struct _PatternMatcherThread {
} PatternMatcherThread; } PatternMatcherThread;
typedef struct _Signature { typedef struct Signature_ {
u_int16_t flags; u_int16_t flags;
u_int32_t num; /* signature number, internal id */ u_int32_t num; /* signature number, internal id */
@ -188,8 +192,8 @@ typedef struct _Signature {
DetectProto proto; DetectProto proto;
DetectPort *sp, *dp; DetectPort *sp, *dp;
struct _SigMatch *match; struct SigMatch_ *match;
struct _Signature *next; struct Signature_ *next;
} Signature; } Signature;
typedef struct DetectEngineIPOnlyCtx_ { typedef struct DetectEngineIPOnlyCtx_ {
@ -247,8 +251,6 @@ typedef struct DetectEngineCtx_ {
u_int32_t signum; u_int32_t signum;
/* main sigs */ /* main sigs */
// DetectAddressGroupsHead *src_gh[256]; /* a head for each protocol */
// DetectAddressGroupsHead *tmp_gh[256];
DetectEngineLookupDsize dsize_gh[DSIZE_STATES]; DetectEngineLookupDsize dsize_gh[DSIZE_STATES];
u_int32_t mpm_unique, mpm_reuse, mpm_none, u_int32_t mpm_unique, mpm_reuse, mpm_none,
@ -283,14 +285,14 @@ typedef struct DetectEngineCtx_ {
DetectEngineIPOnlyCtx io_ctx; DetectEngineIPOnlyCtx io_ctx;
} DetectEngineCtx; } DetectEngineCtx;
typedef struct _SigMatch { typedef struct SigMatch_ {
u_int8_t type; u_int8_t type;
void *ctx; void *ctx;
struct _SigMatch *next; struct SigMatch_ *next;
struct _SigMatch *prev; struct SigMatch_ *prev;
} SigMatch; } SigMatch;
typedef struct SigTableElmt { typedef struct SigTableElmt_ {
int (*Match)(ThreadVars *, PatternMatcherThread *, Packet *, Signature *, SigMatch *); int (*Match)(ThreadVars *, PatternMatcherThread *, Packet *, Signature *, SigMatch *);
int (*Setup)(DetectEngineCtx *, Signature *, SigMatch *, char *); int (*Setup)(DetectEngineCtx *, Signature *, SigMatch *, char *);
int (*Free)(SigMatch *); int (*Free)(SigMatch *);
@ -309,7 +311,7 @@ typedef struct SigTableElmt {
#define SIG_GROUP_HEAD_MPM_URI_NOSCAN 0x40 #define SIG_GROUP_HEAD_MPM_URI_NOSCAN 0x40
/* head of the list of containers. */ /* head of the list of containers. */
typedef struct _SigGroupHead { typedef struct SigGroupHead_ {
u_int8_t flags; u_int8_t flags;
/* pattern matcher instance */ /* pattern matcher instance */

@ -5,7 +5,7 @@
#include "flow.h" #include "flow.h"
#include "util-var.h" #include "util-var.h"
typedef struct _FlowBit { typedef struct FlowBit_ {
u_int8_t type; /* type, DETECT_FLOWBITS in this case */ u_int8_t type; /* type, DETECT_FLOWBITS in this case */
u_int16_t idx; /* name idx */ u_int16_t idx; /* name idx */
GenericVar *next; /* right now just implement this as a list, GenericVar *next; /* right now just implement this as a list,

@ -7,7 +7,7 @@
* Each bucket contains a flow or list of flows. All these flows have * Each bucket contains a flow or list of flows. All these flows have
* the same hashkey (the hash is a chained hash). When doing modifications * the same hashkey (the hash is a chained hash). When doing modifications
* to the list, the entire bucket is locked. */ * to the list, the entire bucket is locked. */
typedef struct _FlowBucket { typedef struct FlowBucket_ {
Flow *f; Flow *f;
pthread_mutex_t m; pthread_mutex_t m;
} FlowBucket; } FlowBucket;

@ -6,7 +6,7 @@
#include "flow.h" #include "flow.h"
/* Define a queue for storing flows */ /* Define a queue for storing flows */
typedef struct _FlowQueue typedef struct FlowQueue_
{ {
Flow *top; Flow *top;
Flow *bot; Flow *bot;

@ -5,7 +5,7 @@
#include "flow.h" #include "flow.h"
#include "util-var.h" #include "util-var.h"
typedef struct _FlowVar { typedef struct FlowVar_ {
u_int8_t type; /* type, DETECT_FLOWVAR in this case */ u_int8_t type; /* type, DETECT_FLOWVAR in this case */
u_int16_t idx; /* name idx */ u_int16_t idx; /* name idx */
GenericVar *next; /* right now just implement this as a list, GenericVar *next; /* right now just implement this as a list,

@ -15,7 +15,7 @@
#define FLOW_PKT_TOCLIENT_IPONLY_SET 0x20 #define FLOW_PKT_TOCLIENT_IPONLY_SET 0x20
/* global flow config */ /* global flow config */
typedef struct _FlowCnf typedef struct FlowCnf_
{ {
u_int32_t hash_rand; u_int32_t hash_rand;
u_int32_t hash_size; u_int32_t hash_size;
@ -33,7 +33,7 @@ typedef struct _FlowCnf
} FlowConfig; } FlowConfig;
/* Hash key for the flow hash */ /* Hash key for the flow hash */
typedef struct _FlowKey typedef struct FlowKey_
{ {
Address src, dst; Address src, dst;
Port sp, dp; Port sp, dp;
@ -42,7 +42,7 @@ typedef struct _FlowKey
} FlowKey; } FlowKey;
typedef struct _Flow typedef struct Flow_
{ {
Address src, dst; Address src, dst;
Port sp, dp; Port sp, dp;
@ -70,12 +70,12 @@ typedef struct _Flow
/* list flow ptrs /* list flow ptrs
* NOTE!!! These are NOT protected by the * NOTE!!! These are NOT protected by the
* above mutex, but by the FlowQ's */ * above mutex, but by the FlowQ's */
struct _Flow *hnext; /* hash list */ struct Flow_ *hnext; /* hash list */
struct _Flow *hprev; struct Flow_ *hprev;
struct _Flow *lnext; /* list */ struct Flow_ *lnext; /* list */
struct _Flow *lprev; struct Flow_ *lprev;
struct _FlowBucket *fb; struct FlowBucket_ *fb;
} Flow; } Flow;
void FlowHandlePacket (ThreadVars *, Packet *); void FlowHandlePacket (ThreadVars *, Packet *);

@ -6,7 +6,7 @@
#include "util-hash.h" #include "util-hash.h"
#include "util-bloomfilter-counting.h" #include "util-bloomfilter-counting.h"
typedef struct _HostTable { typedef struct HostTable_ {
pthread_mutex_t m; pthread_mutex_t m;
/* storage & lookup */ /* storage & lookup */
@ -16,7 +16,7 @@ typedef struct _HostTable {
u_int32_t cnt; u_int32_t cnt;
} HostTable; } HostTable;
typedef struct _Host { typedef struct Host_ {
pthread_mutex_t m; pthread_mutex_t m;
Address addr; Address addr;

@ -20,7 +20,7 @@
static u_int8_t l7_proto_id = 0; static u_int8_t l7_proto_id = 0;
typedef struct _L7AppDetectDataProto { typedef struct L7AppDetectDataProto_ {
u_int8_t proto; u_int8_t proto;
} L7AppDetectDataProto; } L7AppDetectDataProto;

@ -60,7 +60,7 @@ void TmModuleLogHttplogIPv6Register (void) {
tmm_modules[TMM_LOGHTTPLOG6].RegisterTests = NULL; tmm_modules[TMM_LOGHTTPLOG6].RegisterTests = NULL;
} }
typedef struct _LogHttplogThread { typedef struct LogHttplogThread_ {
FILE *fp; FILE *fp;
u_int32_t uri_cnt; u_int32_t uri_cnt;
} LogHttplogThread; } LogHttplogThread;

@ -8,7 +8,7 @@
/* XXX: moved to decode.h */ /* XXX: moved to decode.h */
#if 0 #if 0
typedef struct _PacketQueue { typedef struct PacketQueue_ {
Packet *top; Packet *top;
Packet *bot; Packet *bot;
u_int16_t len; u_int16_t len;

@ -32,7 +32,7 @@
#include "respond-reject.h" #include "respond-reject.h"
#include "respond-reject-libnet11.h" #include "respond-reject-libnet11.h"
typedef struct _Libnet11Packet typedef struct Libnet11Packet_
{ {
u_int32_t ack, seq; u_int32_t ack, seq;
u_int16_t window, dsize; u_int16_t window, dsize;

@ -12,7 +12,7 @@
/* idea: set the recv-thread id in the packet to /* idea: set the recv-thread id in the packet to
* select an verdict-queue */ * select an verdict-queue */
typedef struct _NFQPacketVars typedef struct NFQPacketVars_
{ {
int id; /* this nfq packets id */ int id; /* this nfq packets id */
@ -22,7 +22,7 @@ typedef struct _NFQPacketVars
u_int16_t hw_protocol; u_int16_t hw_protocol;
} NFQPacketVars; } NFQPacketVars;
typedef struct _NFQThreadVars typedef struct NFQThreadVars_
{ {
struct nfq_handle *h; struct nfq_handle *h;
struct nfnl_handle *nh; struct nfnl_handle *nh;
@ -47,7 +47,7 @@ typedef struct _NFQThreadVars
ThreadVars *tv; ThreadVars *tv;
} NFQThreadVars; } NFQThreadVars;
typedef struct _NFQGlobalVars typedef struct NFQGlobalVars_
{ {
char unbind; char unbind;
} NFQGlobalVars; } NFQGlobalVars;

@ -12,7 +12,7 @@ void TmModuleDecodePcapRegister (void);
#define LIBPCAP_PROMISC 1 #define LIBPCAP_PROMISC 1
/* per packet Pcap vars */ /* per packet Pcap vars */
typedef struct _PcapPacketVars typedef struct PcapPacketVars_
{ {
int datalink; /* datalink from libpcap */ int datalink; /* datalink from libpcap */
} PcapPacketVars; } PcapPacketVars;

@ -1,16 +1,16 @@
#ifndef __STREAM_TCP_PRIVATE_H__ #ifndef __STREAM_TCP_PRIVATE_H__
#define __STREAM_TCP_PRIVATE_H__ #define __STREAM_TCP_PRIVATE_H__
typedef struct _TcpSegment { typedef struct TcpSegment_ {
u_int8_t *payload; u_int8_t *payload;
u_int16_t payload_len; /* actual size of the payload */ u_int16_t payload_len; /* actual size of the payload */
u_int32_t seq; u_int32_t seq;
u_int16_t pool_size; /* size of the memory */ u_int16_t pool_size; /* size of the memory */
struct _TcpSegment *next; struct TcpSegment_ *next;
struct _TcpSegment *prev; struct TcpSegment_ *prev;
} TcpSegment; } TcpSegment;
typedef struct _TcpStream { typedef struct TcpStream_ {
u_int32_t isn; /* initial sequence number */ u_int32_t isn; /* initial sequence number */
u_int32_t next_seq; /* next expected sequence number */ u_int32_t next_seq; /* next expected sequence number */
u_int32_t last_ack; /* last ack'd sequence number */ u_int32_t last_ack; /* last ack'd sequence number */
@ -47,7 +47,7 @@ enum
#define SEQ_GT(a,b) ((int)((a) - (b)) > 0) #define SEQ_GT(a,b) ((int)((a) - (b)) > 0)
#define SEQ_GEQ(a,b) ((int)((a) - (b)) >= 0) #define SEQ_GEQ(a,b) ((int)((a) - (b)) >= 0)
typedef struct _TcpSession { typedef struct TcpSession_ {
u_int8_t state; u_int8_t state;
TcpStream server; TcpStream server;
TcpStream client; TcpStream client;

@ -65,7 +65,7 @@ void TmModuleStreamTcpRegister (void) {
pthread_mutex_init(&ssn_pool_mutex, NULL); pthread_mutex_init(&ssn_pool_mutex, NULL);
} }
typedef struct _StreamTcpThread { typedef struct StreamTcpThread_ {
u_int64_t pkts; u_int64_t pkts;
} StreamTcpThread; } StreamTcpThread;

@ -13,7 +13,7 @@
#define MSG_DATA_SIZE 512 #define MSG_DATA_SIZE 512
typedef struct _StreamMsg { typedef struct StreamMsg_ {
u_int32_t id; /* unique stream id */ u_int32_t id; /* unique stream id */
u_int8_t flags; /* msg flags */ u_int8_t flags; /* msg flags */
Flow *flow; /* parent flow */ Flow *flow; /* parent flow */
@ -32,11 +32,11 @@ typedef struct _StreamMsg {
} gap; } gap;
}; };
struct _StreamMsg *next; struct StreamMsg_ *next;
struct _StreamMsg *prev; struct StreamMsg_ *prev;
} StreamMsg; } StreamMsg;
typedef struct _StreamMsgQueue { typedef struct StreamMsgQueue_ {
StreamMsg *top; StreamMsg *top;
StreamMsg *bot; StreamMsg *bot;
u_int16_t len; u_int16_t len;

@ -11,7 +11,7 @@
#define THV_KILL 0x02 #define THV_KILL 0x02
#define THV_CLOSED 0x04 /* thread done, should be joinable */ #define THV_CLOSED 0x04 /* thread done, should be joinable */
typedef struct _ThreadVars { typedef struct ThreadVars_ {
pthread_t t; pthread_t t;
char *name; char *name;
u_int8_t flags; u_int8_t flags;
@ -21,8 +21,8 @@ typedef struct _ThreadVars {
Tmq *outq; Tmq *outq;
/* queue handlers */ /* queue handlers */
struct _Packet * (*tmqh_in)(struct _ThreadVars *); struct Packet_ * (*tmqh_in)(struct ThreadVars_ *);
void (*tmqh_out)(struct _ThreadVars *, struct _Packet *); void (*tmqh_out)(struct ThreadVars_ *, struct Packet_ *);
/* slot functions */ /* slot functions */
void *(*tm_func)(void *); void *(*tm_func)(void *);
@ -31,8 +31,8 @@ typedef struct _ThreadVars {
char set_cpu_affinity; /* bool: 0 no, 1 yes */ char set_cpu_affinity; /* bool: 0 no, 1 yes */
int cpu_affinity; /* cpu or core to set affinity to */ int cpu_affinity; /* cpu or core to set affinity to */
struct _ThreadVars *next; struct ThreadVars_ *next;
struct _ThreadVars *prev; struct ThreadVars_ *prev;
} ThreadVars; } ThreadVars;
#endif /* __THREADVARS_H__ */ #endif /* __THREADVARS_H__ */

@ -1,7 +1,7 @@
#ifndef __TM_MODULES_H__ #ifndef __TM_MODULES_H__
#define __TM_MODULES_H__ #define __TM_MODULES_H__
typedef struct _TmModule { typedef struct TmModule_ {
char *name; char *name;
int (*Init)(ThreadVars *, void *, void **); int (*Init)(ThreadVars *, void *, void **);
int (*Func)(ThreadVars *, Packet *, void *, PacketQueue *); int (*Func)(ThreadVars *, Packet *, void *, PacketQueue *);

@ -11,7 +11,7 @@ enum {
TMQH_SIZE, TMQH_SIZE,
}; };
typedef struct _Tmqh { typedef struct Tmqh_ {
char *name; char *name;
Packet *(*InHandler)(ThreadVars *); Packet *(*InHandler)(ThreadVars *);
void (*OutHandler)(ThreadVars *, Packet *); void (*OutHandler)(ThreadVars *, Packet *);

@ -1,7 +1,7 @@
#ifndef __TM_QUEUES_H__ #ifndef __TM_QUEUES_H__
#define __TM_QUEUES_H__ #define __TM_QUEUES_H__
typedef struct _Tmq { typedef struct Tmq_ {
char *name; char *name;
u_int16_t id; u_int16_t id;
u_int16_t usecnt; u_int16_t usecnt;

@ -19,7 +19,7 @@ static int SetCPUAffinity(int cpu);
/* root of the threadvars list */ /* root of the threadvars list */
static ThreadVars *tv_root; static ThreadVars *tv_root;
typedef struct _TmSlot { typedef struct TmSlot_ {
/* function pointers */ /* function pointers */
int (*SlotInit)(ThreadVars *, void *, void **); int (*SlotInit)(ThreadVars *, void *, void **);
int (*SlotFunc)(ThreadVars *, Packet *, void *, PacketQueue *); int (*SlotFunc)(ThreadVars *, Packet *, void *, PacketQueue *);
@ -32,26 +32,26 @@ typedef struct _TmSlot {
PacketQueue slot_pq; PacketQueue slot_pq;
/* linked list, only used by TmVarSlot */ /* linked list, only used by TmVarSlot */
struct _TmSlot *slot_next; struct TmSlot_ *slot_next;
} TmSlot; } TmSlot;
/* 1 function slot */ /* 1 function slot */
typedef struct _Tm1Slot { typedef struct Tm1Slot_ {
TmSlot s; TmSlot s;
} Tm1Slot; } Tm1Slot;
/* 2 function slot */ /* 2 function slot */
typedef struct _Tm2Slot { typedef struct Tm2Slot_ {
TmSlot s1, s2; TmSlot s1, s2;
} Tm2Slot; } Tm2Slot;
/* 3 function slot */ /* 3 function slot */
typedef struct _Tm3Slot { typedef struct Tm3Slot_ {
TmSlot s1, s2, s3; TmSlot s1, s2, s3;
} Tm3Slot; } Tm3Slot;
/* Variable number of function slots */ /* Variable number of function slots */
typedef struct _TmVarSlot { typedef struct TmVarSlot_ {
TmSlot *s; TmSlot *s;
} TmVarSlot; } TmVarSlot;

@ -4,7 +4,7 @@
#define __BLOOMFILTERCOUNTING_H__ #define __BLOOMFILTERCOUNTING_H__
/* Bloom filter structure */ /* Bloom filter structure */
typedef struct _BloomFilterCounting { typedef struct BloomFilterCounting_ {
u_int8_t *array; u_int8_t *array;
u_int32_t array_size; /* size in buckets */ u_int32_t array_size; /* size in buckets */
u_int8_t type; /* 1, 2 or 4 byte counters */ u_int8_t type; /* 1, 2 or 4 byte counters */

@ -4,7 +4,7 @@
#define __BLOOMFILTER_H__ #define __BLOOMFILTER_H__
/* Bloom Filter structure */ /* Bloom Filter structure */
typedef struct _BloomFilter { typedef struct BloomFilter_ {
u_int8_t *bitarray; u_int8_t *bitarray;
u_int32_t bitarray_size; u_int32_t bitarray_size;
u_int8_t hash_iterations; u_int8_t hash_iterations;

@ -14,7 +14,7 @@
#include "util-unittest.h" #include "util-unittest.h"
HashTable* HashTableInit(u_int32_t size, u_int32_t (*Hash)(struct _HashTable *, void *, u_int16_t), char (*Compare)(void *, u_int16_t, void *, u_int16_t), void (*Free)(void *)) { HashTable* HashTableInit(u_int32_t size, u_int32_t (*Hash)(struct HashTable_ *, void *, u_int16_t), char (*Compare)(void *, u_int16_t, void *, u_int16_t), void (*Free)(void *)) {
HashTable *ht = NULL; HashTable *ht = NULL;

@ -4,23 +4,23 @@
#define __HASH_H__ #define __HASH_H__
/* hash bucket structure */ /* hash bucket structure */
typedef struct _HashTableBucket { typedef struct HashTableBucket_ {
void *data; void *data;
u_int16_t size; u_int16_t size;
struct _HashTableBucket *next; struct HashTableBucket_ *next;
} HashTableBucket; } HashTableBucket;
/* hash table structure */ /* hash table structure */
typedef struct _HashTable { typedef struct HashTable_ {
HashTableBucket **array; HashTableBucket **array;
u_int32_t array_size; u_int32_t array_size;
u_int32_t (*Hash)(struct _HashTable *, void *, u_int16_t); u_int32_t (*Hash)(struct HashTable_ *, void *, u_int16_t);
char (*Compare)(void *, u_int16_t, void *, u_int16_t); char (*Compare)(void *, u_int16_t, void *, u_int16_t);
void (*Free)(void *); void (*Free)(void *);
} HashTable; } HashTable;
/* prototypes */ /* prototypes */
HashTable* HashTableInit(u_int32_t, u_int32_t (*Hash)(struct _HashTable *, void *, u_int16_t), char (*Compare)(void *, u_int16_t, void *, u_int16_t), void (*Free)(void *)); HashTable* HashTableInit(u_int32_t, u_int32_t (*Hash)(struct HashTable_ *, void *, u_int16_t), char (*Compare)(void *, u_int16_t, void *, u_int16_t), void (*Free)(void *));
void HashTableFree(HashTable *); void HashTableFree(HashTable *);
void HashTablePrint(HashTable *); void HashTablePrint(HashTable *);
int HashTableAdd(HashTable *, void *, u_int16_t); int HashTableAdd(HashTable *, void *, u_int16_t);

@ -14,7 +14,7 @@
#include "util-unittest.h" #include "util-unittest.h"
HashListTable* HashListTableInit(u_int32_t size, u_int32_t (*Hash)(struct _HashListTable *, void *, u_int16_t), char (*Compare)(void *, u_int16_t, void *, u_int16_t), void (*Free)(void *)) { HashListTable* HashListTableInit(u_int32_t size, u_int32_t (*Hash)(struct HashListTable_ *, void *, u_int16_t), char (*Compare)(void *, u_int16_t, void *, u_int16_t), void (*Free)(void *)) {
HashListTable *ht = NULL; HashListTable *ht = NULL;

@ -4,27 +4,27 @@
#define __HASHLIST_H__ #define __HASHLIST_H__
/* hash bucket structure */ /* hash bucket structure */
typedef struct _HashListTableBucket { typedef struct HashListTableBucket_ {
void *data; void *data;
u_int16_t size; u_int16_t size;
struct _HashListTableBucket *bucknext; struct HashListTableBucket_ *bucknext;
struct _HashListTableBucket *listnext; struct HashListTableBucket_ *listnext;
struct _HashListTableBucket *listprev; struct HashListTableBucket_ *listprev;
} HashListTableBucket; } HashListTableBucket;
/* hash table structure */ /* hash table structure */
typedef struct _HashListTable { typedef struct HashListTable_ {
HashListTableBucket **array; HashListTableBucket **array;
HashListTableBucket *listhead; HashListTableBucket *listhead;
HashListTableBucket *listtail; HashListTableBucket *listtail;
u_int32_t array_size; u_int32_t array_size;
u_int32_t (*Hash)(struct _HashListTable *, void *, u_int16_t); u_int32_t (*Hash)(struct HashListTable_ *, void *, u_int16_t);
char (*Compare)(void *, u_int16_t, void *, u_int16_t); char (*Compare)(void *, u_int16_t, void *, u_int16_t);
void (*Free)(void *); void (*Free)(void *);
} HashListTable; } HashListTable;
/* prototypes */ /* prototypes */
HashListTable* HashListTableInit(u_int32_t, u_int32_t (*Hash)(struct _HashListTable *, void *, u_int16_t), char (*Compare)(void *, u_int16_t, void *, u_int16_t), void (*Free)(void *)); HashListTable* HashListTableInit(u_int32_t, u_int32_t (*Hash)(struct HashListTable_ *, void *, u_int16_t), char (*Compare)(void *, u_int16_t, void *, u_int16_t), void (*Free)(void *));
void HashListTableFree(HashListTable *); void HashListTableFree(HashListTable *);
void HashListTablePrint(HashListTable *); void HashListTablePrint(HashListTable *);
int HashListTableAdd(HashListTable *, void *, u_int16_t); int HashListTableAdd(HashListTable *, void *, u_int16_t);

@ -44,22 +44,22 @@
//#define B2G_SCAN2 //#define B2G_SCAN2
//#define B2G_COUNTERS //#define B2G_COUNTERS
typedef struct _B2gPattern { typedef struct B2gPattern_ {
u_int8_t flags; u_int8_t flags;
u_int16_t len; u_int16_t len;
u_int8_t *cs; /* case sensitive */ u_int8_t *cs; /* case sensitive */
u_int8_t *ci; /* case INsensitive */ u_int8_t *ci; /* case INsensitive */
struct _B2gPattern *next; struct B2gPattern_ *next;
MpmEndMatch *em; MpmEndMatch *em;
} B2gPattern; } B2gPattern;
typedef struct _B2gHashItem_ { typedef struct B2gHashItem_ {
u_int16_t idx; u_int16_t idx;
struct _B2gHashItem_ *nxt; struct B2gHashItem_ *nxt;
u_int8_t flags; u_int8_t flags;
} B2gHashItem; } B2gHashItem;
typedef struct _B2gCtx { typedef struct B2gCtx_ {
B2G_TYPE *scan_B2G; B2G_TYPE *scan_B2G;
B2G_TYPE scan_m; B2G_TYPE scan_m;
BloomFilter **scan_bloom; BloomFilter **scan_bloom;
@ -99,14 +99,14 @@ typedef struct _B2gCtx {
u_int8_t search_s0; u_int8_t search_s0;
/* we store our own multi byte scan ptr here for B2gSearch1 */ /* we store our own multi byte scan ptr here for B2gSearch1 */
u_int32_t (*MBScan2)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t); u_int32_t (*MBScan2)(struct MpmCtx_ *, struct MpmThreadCtx_ *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
u_int32_t (*MBScan)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t); u_int32_t (*MBScan)(struct MpmCtx_ *, struct MpmThreadCtx_ *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
/* we store our own multi byte search ptr here for B2gSearch1 */ /* we store our own multi byte search ptr here for B2gSearch1 */
u_int32_t (*MBSearch)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t); u_int32_t (*MBSearch)(struct MpmCtx_ *, struct MpmThreadCtx_ *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
} B2gCtx; } B2gCtx;
typedef struct _B2gThreadCtx { typedef struct B2gThreadCtx_ {
#ifdef B2G_COUNTERS #ifdef B2G_COUNTERS
u_int32_t scan_stat_pminlen_calls; u_int32_t scan_stat_pminlen_calls;
u_int32_t scan_stat_pminlen_total; u_int32_t scan_stat_pminlen_total;

@ -39,22 +39,22 @@
//#define B3G_COUNTERS //#define B3G_COUNTERS
typedef struct _B3gPattern { typedef struct B3gPattern_ {
u_int8_t *cs; /* case sensitive */ u_int8_t *cs; /* case sensitive */
u_int8_t *ci; /* case INsensitive */ u_int8_t *ci; /* case INsensitive */
u_int16_t len; u_int16_t len;
struct _B3gPattern *next; struct B3gPattern_ *next;
u_int8_t flags; u_int8_t flags;
MpmEndMatch *em; MpmEndMatch *em;
} B3gPattern; } B3gPattern;
typedef struct _B3gHashItem_ { typedef struct B3gHashItem_ {
u_int8_t flags; u_int8_t flags;
u_int16_t idx; u_int16_t idx;
struct _B3gHashItem_ *nxt; struct B3gHashItem_ *nxt;
} B3gHashItem; } B3gHashItem;
typedef struct _B3gCtx { typedef struct B3gCtx_ {
/* hash used during ctx initialization */ /* hash used during ctx initialization */
B3gPattern **init_hash; B3gPattern **init_hash;
@ -93,17 +93,17 @@ typedef struct _B3gCtx {
B3gHashItem **search_hash2; B3gHashItem **search_hash2;
/* we store our own multi byte scan ptr here for B3gSearch1 */ /* we store our own multi byte scan ptr here for B3gSearch1 */
u_int32_t (*MBScan2)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t); u_int32_t (*MBScan2)(struct MpmCtx_ *, struct MpmThreadCtx_ *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
u_int32_t (*MBScan)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t); u_int32_t (*MBScan)(struct MpmCtx_ *, struct MpmThreadCtx_ *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
/* we store our own multi byte search ptr here for B3gSearch1 */ /* we store our own multi byte search ptr here for B3gSearch1 */
u_int32_t (*MBSearch2)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t); u_int32_t (*MBSearch2)(struct MpmCtx_ *, struct MpmThreadCtx_ *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
u_int32_t (*MBSearch)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t); u_int32_t (*MBSearch)(struct MpmCtx_ *, struct MpmThreadCtx_ *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
/* pattern arrays */ /* pattern arrays */
B3gPattern **parray; B3gPattern **parray;
} B3gCtx; } B3gCtx;
typedef struct _B3gThreadCtx { typedef struct B3gThreadCtx_ {
#ifdef B3G_COUNTERS #ifdef B3G_COUNTERS
u_int32_t scan_stat_pminlen_calls; u_int32_t scan_stat_pminlen_calls;
u_int32_t scan_stat_pminlen_total; u_int32_t scan_stat_pminlen_total;

File diff suppressed because it is too large Load Diff

@ -1,86 +0,0 @@
/* Copyright (c) 2008 Victor Julien <victor@inliniac.net> */
#ifndef __UTIL_MPM_TRIE_H__
#define __UTIL_MPM_TRIE_H__
//#define MPM_DBG_PERF
#define MPM_ENDMATCH_SINGLE 0x01 /* A single match is sufficient */
#define MPM_ENDMATCH_OFFSET 0x02 /* has offset setting */
#define MPM_ENDMATCH_DEPTH 0x04 /* has depth setting */
typedef struct _TrieCharacter {
u_int16_t min_matchlen_left; /* minimum match length left from this
* character. Used for determining if this
* leaf can match at all */
struct _TrieCharacter *nc[256];
MpmEndMatch *em;
} TrieCharacter;
typedef struct _TriePartialMatch {
struct _TriePartialMatch *prev;
struct _TriePartialMatch *next;
TrieCharacter *c;
} TriePartialMatch;
typedef struct _TriePartialMatchList {
TriePartialMatch *top;
} TriePartialMatchList;
/* global ctx */
typedef struct _TrieCtx {
u_int32_t queuelen;
u_int32_t max_queuelen;
u_int32_t keywords;
u_int32_t nocase_keywords;
u_int32_t characters;
TrieCharacter root;
TrieCharacter nocase_root;
} TrieCtx;
/* thread ctx */
typedef struct _TrieThreadCtx {
#ifdef MPM_DBG_PERF
/* debug/performance counters */
u_int64_t mpmsearch;
u_int64_t mpmsearchoffsetdepth;
u_int64_t searchchar_cnt;
u_int64_t searchchar_pmloop_cnt;
u_int64_t searchchar_nocase_cnt;
u_int64_t searchchar_nocase_pmloop_cnt;
u_int64_t searchchar_nocase_matchroot_cnt;
u_int64_t searchchar_nocase_prepeek_cnt;
u_int64_t searchchar_nocase_prepeekmatch_cnt;
u_int64_t searchchar_nocase_prepeek_nomatchnobuf_cnt;
u_int64_t searchchar_nocase_prepeek_nomatchbuflen_cnt;
u_int64_t searchchar_nocase_pmcreate_cnt;
u_int64_t searchchar_matchroot_cnt;
u_int64_t searchchar_prepeek_cnt;
u_int64_t searchchar_prepeekmatch_cnt;
u_int64_t searchchar_prepeek_nomatchnobuf_cnt;
u_int64_t searchchar_prepeek_nomatchbuflen_cnt;
u_int64_t searchchar_pmcreate_cnt;
#endif /* MPM_DBG_PERF */
/* workspace for partial matches in TrieSearch */
TriePartialMatchList spare_queue;
TriePartialMatch *pmqueue;
TriePartialMatch *nocase_pmqueue;
u_int8_t *buf;
u_int8_t *bufmin;
u_int8_t *bufmax;
u_int8_t *buflast;
} TrieThreadCtx;
/* prototypes */
void MpmTrieRegister(void);
#endif /* __UTIL_MPM_TRIE_H__ */

@ -13,24 +13,24 @@
//#define WUMANBER_COUNTERS //#define WUMANBER_COUNTERS
typedef struct _WmPattern { typedef struct WmPattern_ {
u_int8_t *cs; /* case sensitive */ u_int8_t *cs; /* case sensitive */
u_int8_t *ci; /* case INsensitive */ u_int8_t *ci; /* case INsensitive */
u_int16_t len; u_int16_t len;
struct _WmPattern *next; struct WmPattern_ *next;
u_int16_t prefix_ci; u_int16_t prefix_ci;
u_int16_t prefix_cs; u_int16_t prefix_cs;
u_int8_t flags; u_int8_t flags;
MpmEndMatch *em; MpmEndMatch *em;
} WmPattern; } WmPattern;
typedef struct _WmHashItem_ { typedef struct WmHashItem_ {
u_int8_t flags; u_int8_t flags;
u_int16_t idx; u_int16_t idx;
struct _WmHashItem_ *nxt; struct WmHashItem_ *nxt;
} WmHashItem; } WmHashItem;
typedef struct _WmCtx { typedef struct WmCtx_ {
/* hash used during ctx initialization */ /* hash used during ctx initialization */
WmPattern **init_hash; WmPattern **init_hash;
@ -49,9 +49,9 @@ typedef struct _WmCtx {
WmHashItem search_hash1[256]; WmHashItem search_hash1[256];
/* we store our own multi byte scan ptr here for WmSearch1 */ /* we store our own multi byte scan ptr here for WmSearch1 */
u_int32_t (*MBScan)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t); u_int32_t (*MBScan)(struct MpmCtx_ *, struct MpmThreadCtx_ *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
/* we store our own multi byte search ptr here for WmSearch1 */ /* we store our own multi byte search ptr here for WmSearch1 */
u_int32_t (*MBSearch)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t); u_int32_t (*MBSearch)(struct MpmCtx_ *, struct MpmThreadCtx_ *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
/* pattern arrays */ /* pattern arrays */
WmPattern **parray; WmPattern **parray;
@ -61,7 +61,7 @@ typedef struct _WmCtx {
u_int16_t *search_shifttable; u_int16_t *search_shifttable;
} WmCtx; } WmCtx;
typedef struct _WmThreadCtx { typedef struct WmThreadCtx_ {
#ifdef WUMANBER_COUNTERS #ifdef WUMANBER_COUNTERS
u_int32_t scan_stat_pminlen_calls; u_int32_t scan_stat_pminlen_calls;
u_int32_t scan_stat_pminlen_total; u_int32_t scan_stat_pminlen_total;

@ -8,7 +8,6 @@
#include "util-mpm.h" #include "util-mpm.h"
/* include pattern matchers */ /* include pattern matchers */
#include "util-mpm-trie.h"
#include "util-mpm-wumanber.h" #include "util-mpm-wumanber.h"
#include "util-mpm-b2g.h" #include "util-mpm-b2g.h"
#include "util-mpm-b3g.h" #include "util-mpm-b3g.h"
@ -226,7 +225,6 @@ void MpmInitCtx (MpmCtx *mpm_ctx, u_int16_t matcher) {
void MpmTableSetup(void) { void MpmTableSetup(void) {
memset(mpm_table, 0, sizeof(mpm_table)); memset(mpm_table, 0, sizeof(mpm_table));
//MpmTrieRegister();
MpmWuManberRegister(); MpmWuManberRegister();
MpmB2gRegister(); MpmB2gRegister();
MpmB3gRegister(); MpmB3gRegister();

@ -9,7 +9,6 @@
#define MPM_ENDMATCH_NOSEARCH 0x08 /* if this matches, no search is required (for this pattern) */ #define MPM_ENDMATCH_NOSEARCH 0x08 /* if this matches, no search is required (for this pattern) */
enum { enum {
MPM_TRIE,
MPM_WUMANBER, MPM_WUMANBER,
MPM_B2G, MPM_B2G,
MPM_B3G, MPM_B3G,
@ -19,31 +18,31 @@ enum {
}; };
/* Data structures */ /* Data structures */
typedef struct _MpmEndMatch { typedef struct MpmEndMatch_ {
u_int32_t id; u_int32_t id;
u_int16_t depth; u_int16_t depth;
u_int16_t offset; u_int16_t offset;
u_int8_t flags; u_int8_t flags;
struct _MpmEndMatch *next; struct MpmEndMatch_ *next;
u_int32_t sig_id; /* sig callback stuff -- internal id */ u_int32_t sig_id; /* sig callback stuff -- internal id */
} MpmEndMatch; } MpmEndMatch;
typedef struct _MpmMatch { typedef struct MpmMatch_ {
u_int16_t offset; /* offset of this match in the search buffer */ u_int16_t offset; /* offset of this match in the search buffer */
struct _MpmMatch *next; /* match list -- used to connect a match to a struct MpmMatch_ *next; /* match list -- used to connect a match to a
* pattern id. */ * pattern id. */
struct _MpmMatch *qnext; /* queue list -- used to cleanup all matches after struct MpmMatch_ *qnext; /* queue list -- used to cleanup all matches after
* the inspection. */ * the inspection. */
struct _MpmMatchBucket *mb; /* pointer back to the bucket */ struct MpmMatchBucket_ *mb; /* pointer back to the bucket */
} MpmMatch; } MpmMatch;
typedef struct _MpmMatchBucket { typedef struct MpmMatchBucket_ {
MpmMatch *top; MpmMatch *top;
MpmMatch *bot; MpmMatch *bot;
u_int32_t len; u_int32_t len;
} MpmMatchBucket; } MpmMatchBucket;
typedef struct _MpmThreadCtx { typedef struct MpmThreadCtx_ {
void *ctx; void *ctx;
u_int32_t memory_cnt; u_int32_t memory_cnt;
@ -65,7 +64,7 @@ typedef struct _MpmThreadCtx {
/* helper structure for the detection engine. The Pattern Matcher thread /* helper structure for the detection engine. The Pattern Matcher thread
* has this and passes a pointer to it to the pattern matcher. The actual * has this and passes a pointer to it to the pattern matcher. The actual
* pattern matcher will fill the structure. */ * pattern matcher will fill the structure. */
typedef struct _PatternMatcherQueue { typedef struct PatternMatcherQueue_ {
/* sig callback stuff XXX consider a separate struct for this*/ /* sig callback stuff XXX consider a separate struct for this*/
u_int32_t *sig_id_array; /* array with internal sig id's that had a u_int32_t *sig_id_array; /* array with internal sig id's that had a
pattern match. These will be inspected pattern match. These will be inspected
@ -77,23 +76,23 @@ typedef struct _PatternMatcherQueue {
require a search-followup */ require a search-followup */
} PatternMatcherQueue; } PatternMatcherQueue;
typedef struct _MpmCtx { typedef struct MpmCtx_ {
void *ctx; void *ctx;
void (*InitCtx)(struct _MpmCtx *); void (*InitCtx)(struct MpmCtx_ *);
void (*InitThreadCtx)(struct _MpmCtx *, struct _MpmThreadCtx *, u_int32_t); void (*InitThreadCtx)(struct MpmCtx_ *, struct MpmThreadCtx_ *, u_int32_t);
void (*DestroyCtx)(struct _MpmCtx *); void (*DestroyCtx)(struct MpmCtx_ *);
void (*DestroyThreadCtx)(struct _MpmCtx *, struct _MpmThreadCtx *); void (*DestroyThreadCtx)(struct MpmCtx_ *, struct MpmThreadCtx_ *);
int (*AddScanPattern)(struct _MpmCtx *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t, u_int8_t); int (*AddScanPattern)(struct MpmCtx_ *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t, u_int8_t);
int (*AddScanPatternNocase)(struct _MpmCtx *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t, u_int8_t); int (*AddScanPatternNocase)(struct MpmCtx_ *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t, u_int8_t);
int (*AddPattern)(struct _MpmCtx *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t); int (*AddPattern)(struct MpmCtx_ *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t);
int (*AddPatternNocase)(struct _MpmCtx *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t); int (*AddPatternNocase)(struct MpmCtx_ *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t);
int (*Prepare)(struct _MpmCtx *); int (*Prepare)(struct MpmCtx_ *);
u_int32_t (*Scan)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t); u_int32_t (*Scan)(struct MpmCtx_ *, struct MpmThreadCtx_ *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
u_int32_t (*Search)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t); u_int32_t (*Search)(struct MpmCtx_ *, struct MpmThreadCtx_ *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
void (*Cleanup)(struct _MpmThreadCtx *); void (*Cleanup)(struct MpmThreadCtx_ *);
void (*PrintCtx)(struct _MpmCtx *); void (*PrintCtx)(struct MpmCtx_ *);
void (*PrintThreadCtx)(struct _MpmThreadCtx *); void (*PrintThreadCtx)(struct MpmThreadCtx_ *);
u_int32_t memory_cnt; u_int32_t memory_cnt;
u_int32_t memory_size; u_int32_t memory_size;
@ -115,22 +114,22 @@ typedef struct _MpmCtx {
} MpmCtx; } MpmCtx;
typedef struct MpmTableElmt { typedef struct MpmTableElmt_ {
char *name; char *name;
void (*InitCtx)(struct _MpmCtx *); void (*InitCtx)(struct MpmCtx_ *);
void (*InitThreadCtx)(struct _MpmCtx *, struct _MpmThreadCtx *, u_int32_t); void (*InitThreadCtx)(struct MpmCtx_ *, struct MpmThreadCtx_ *, u_int32_t);
void (*DestroyCtx)(struct _MpmCtx *); void (*DestroyCtx)(struct MpmCtx_ *);
void (*DestroyThreadCtx)(struct _MpmCtx *, struct _MpmThreadCtx *); void (*DestroyThreadCtx)(struct MpmCtx_ *, struct MpmThreadCtx_ *);
int (*AddScanPattern)(struct _MpmCtx *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t, u_int8_t); int (*AddScanPattern)(struct MpmCtx_ *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t, u_int8_t);
int (*AddScanPatternNocase)(struct _MpmCtx *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t, u_int8_t); int (*AddScanPatternNocase)(struct MpmCtx_ *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t, u_int8_t);
int (*AddPattern)(struct _MpmCtx *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t); int (*AddPattern)(struct MpmCtx_ *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t);
int (*AddPatternNocase)(struct _MpmCtx *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t); int (*AddPatternNocase)(struct MpmCtx_ *, u_int8_t *, u_int16_t, u_int16_t, u_int16_t, u_int32_t, u_int32_t);
int (*Prepare)(struct _MpmCtx *); int (*Prepare)(struct MpmCtx_ *);
u_int32_t (*Scan)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t); u_int32_t (*Scan)(struct MpmCtx_ *, struct MpmThreadCtx_ *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
u_int32_t (*Search)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t); u_int32_t (*Search)(struct MpmCtx_ *, struct MpmThreadCtx_ *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
void (*Cleanup)(struct _MpmThreadCtx *); void (*Cleanup)(struct MpmThreadCtx_ *);
void (*PrintCtx)(struct _MpmCtx *); void (*PrintCtx)(struct MpmCtx_ *);
void (*PrintThreadCtx)(struct _MpmThreadCtx *); void (*PrintThreadCtx)(struct MpmThreadCtx_ *);
void (*RegisterUnittests)(void); void (*RegisterUnittests)(void);
u_int8_t flags; u_int8_t flags;
} MpmTableElmt; } MpmTableElmt;

@ -4,13 +4,13 @@
#define __UTIL_POOL_H__ #define __UTIL_POOL_H__
/* pool bucket structure */ /* pool bucket structure */
typedef struct _PoolBucket { typedef struct PoolBucket_ {
void *data; void *data;
struct _PoolBucket *next; struct PoolBucket_ *next;
} PoolBucket; } PoolBucket;
/* pool structure */ /* pool structure */
typedef struct _Pool { typedef struct Pool_ {
u_int32_t max_buckets; u_int32_t max_buckets;
u_int32_t allocated; u_int32_t allocated;

@ -33,13 +33,13 @@ static int UtAppendTest(UtTest **list, UtTest *test) {
return 0; return 0;
} }
void UtRegisterTest(char *name, int(*testfn)(void), int evalue) { void UtRegisterTest(char *name, int(*TestFn)(void), int evalue) {
UtTest *ut = UtAllocTest(); UtTest *ut = UtAllocTest();
if (ut == NULL) if (ut == NULL)
return; return;
ut->name = name; ut->name = name;
ut->testfn = testfn; ut->TestFn = TestFn;
ut->evalue = evalue; ut->evalue = evalue;
ut->next = NULL; ut->next = NULL;
@ -55,7 +55,7 @@ int UtRunTests(void) {
for (ut = ut_list; ut != NULL; ut = ut->next) { for (ut = ut_list; ut != NULL; ut = ut->next) {
printf("Test %-60s : ", ut->name); printf("Test %-60s : ", ut->name);
fflush(stdout); /* flush so in case of a segv we see the testname */ fflush(stdout); /* flush so in case of a segv we see the testname */
int ret = ut->testfn(); int ret = ut->TestFn();
printf("%s\n", (ret == ut->evalue) ? "pass" : "FAILED"); printf("%s\n", (ret == ut->evalue) ? "pass" : "FAILED");
if (ret != ut->evalue) { if (ret != ut->evalue) {
result = 1; result = 1;

@ -3,18 +3,18 @@
#ifndef __UTIL_UNITTEST_H__ #ifndef __UTIL_UNITTEST_H__
#define __UTIL_UNITTEST_H__ #define __UTIL_UNITTEST_H__
typedef struct _UtTest { typedef struct UtTest_ {
char *name; char *name;
int(*testfn)(void); int(*TestFn)(void);
int evalue; int evalue;
struct _UtTest *next; struct UtTest_ *next;
} UtTest; } UtTest;
void UtRegisterTest(char *name, int(*testfn)(void), int evalue); void UtRegisterTest(char *name, int(*TestFn)(void), int evalue);
int UtRunTests(void); int UtRunTests(void);
void UtInitialize(void); void UtInitialize(void);
void UtCleanup(void); void UtCleanup(void);

@ -2,7 +2,7 @@
#include "detect.h" #include "detect.h"
#include "util-hashlist.h" #include "util-hashlist.h"
typedef struct _VariableName { typedef struct VariableName_ {
char *name; char *name;
u_int8_t type; /* flowbit, pktvar, etc */ u_int8_t type; /* flowbit, pktvar, etc */
u_int16_t idx; u_int16_t idx;

@ -1,10 +1,10 @@
#ifndef __UTIL_VAR_H__ #ifndef __UTIL_VAR_H__
#define __UTIL_VAR_H__ #define __UTIL_VAR_H__
typedef struct _GenericVar { typedef struct GenericVar_ {
u_int8_t type; u_int8_t type;
u_int16_t idx; u_int16_t idx;
struct _GenericVar *next; struct GenericVar_ *next;
} GenericVar; } GenericVar;
void GenericVarFree(GenericVar *); void GenericVarFree(GenericVar *);

Loading…
Cancel
Save