From: Michael Altizer (mialtize) Date: Fri, 6 Jan 2017 19:06:03 +0000 (-0500) Subject: Merge pull request #767 in SNORT/snort3 from header_fixes to master X-Git-Tag: 3.0.0-233~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38a42910a4bae50ad09d2f9465273cf419b0d2a4;p=thirdparty%2Fsnort3.git Merge pull request #767 in SNORT/snort3 from header_fixes to master Squashed commit of the following: commit 844d73f41f407756e05b7784530f7690285903f8 Author: Michael Altizer Date: Fri Jan 6 11:14:12 2017 -0500 autoconf: Add piglet plugin iface headers and unit_test_main.h to sources lists commit 36ab75006d396f62642ab37f5bae14d78559d9e9 Author: Michael Altizer Date: Fri Jan 6 11:13:23 2017 -0500 sfrt: Finish removal of sfrt_trie.h commit eff74954c55abbfeb95af6865c37f06023a6d161 Author: Michael Altizer Date: Fri Jan 6 11:13:51 2017 -0500 http_inspect: Restore stdexcept header inclusion for old compilers --- diff --git a/src/catch/Makefile.am b/src/catch/Makefile.am index 5c09bc459..cf7d9a515 100644 --- a/src/catch/Makefile.am +++ b/src/catch/Makefile.am @@ -4,5 +4,6 @@ noinst_LIBRARIES = libcatch_tests.a libcatch_tests_a_SOURCES = \ catch.hpp \ unit_test.cc \ -unit_test.h +unit_test.h \ +unit_test_main.h diff --git a/src/piglet_plugins/Makefile.am b/src/piglet_plugins/Makefile.am index 2cb2f2761..721134e03 100644 --- a/src/piglet_plugins/Makefile.am +++ b/src/piglet_plugins/Makefile.am @@ -6,26 +6,44 @@ piglet_plugins.cc \ piglet_plugins.h interface_list = \ +pp_buffer_iface.cc \ +pp_buffer_iface.h \ pp_codec_data_iface.cc \ +pp_codec_data_iface.h \ +pp_codec_iface.cc \ +pp_codec_iface.h \ +pp_cursor_iface.cc \ +pp_cursor_iface.h \ +pp_daq_pkthdr_iface.cc \ +pp_daq_pkthdr_iface.h \ +pp_decode_data_iface.cc \ +pp_decode_data_iface.h \ pp_enc_state_iface.cc \ -pp_buffer_iface.cc \ +pp_enc_state_iface.h \ pp_event_iface.cc \ -pp_codec_iface.cc \ -pp_stream_splitter_iface.cc \ +pp_event_iface.h \ +pp_flow_iface.cc \ +pp_flow_iface.h \ pp_inspector_iface.cc \ -pp_cursor_iface.cc \ -pp_ips_option_iface.cc \ +pp_inspector_iface.h \ +pp_ip_api_iface.cc \ +pp_ip_api_iface.h \ pp_ips_action_iface.cc \ +pp_ips_action_iface.h \ +pp_ips_option_iface.cc \ +pp_ips_option_iface.h \ pp_logger_iface.cc \ +pp_logger_iface.h \ +pp_packet_iface.cc \ +pp_packet_iface.h \ +pp_raw_buffer_iface.cc \ +pp_raw_buffer_iface.h \ pp_search_engine_iface.cc \ +pp_search_engine_iface.h \ pp_so_rule_iface.cc \ -pp_raw_buffer_iface.cc \ -pp_packet_iface.cc \ -pp_decode_data_iface.cc \ -pp_flow_iface.cc \ -pp_event_iface.cc \ -pp_daq_pkthdr_iface.cc \ -pp_ip_api_iface.cc +pp_so_rule_iface.h \ +pp_stream_splitter_iface.cc \ +pp_stream_splitter_iface.h plugin_list = \ pp_codec.cc \ diff --git a/src/service_inspectors/http_inspect/http_test_manager.cc b/src/service_inspectors/http_inspect/http_test_manager.cc index f9745cbc0..81be99dce 100644 --- a/src/service_inspectors/http_inspect/http_test_manager.cc +++ b/src/service_inspectors/http_inspect/http_test_manager.cc @@ -23,6 +23,8 @@ #ifdef REG_TEST +#include + #include "http_test_manager.h" #include "http_test_input.h" diff --git a/src/sfrt/CMakeLists.txt b/src/sfrt/CMakeLists.txt index 12a9afe57..b5f4eb0de 100644 --- a/src/sfrt/CMakeLists.txt +++ b/src/sfrt/CMakeLists.txt @@ -12,7 +12,6 @@ add_library ( sfrt STATIC sfrt_flat.h sfrt_flat_dir.cc sfrt_flat_dir.h - sfrt_trie.h ${TEST_FILES} ) diff --git a/src/sfrt/sfrt.h b/src/sfrt/sfrt.h index ffdc4fadc..8c777419d 100644 --- a/src/sfrt/sfrt.h +++ b/src/sfrt/sfrt.h @@ -26,7 +26,12 @@ #include #include "sfip/sf_ip.h" -#include "sfrt/sfrt_trie.h" + +/* A 32-bit word is used to hold the bit patterns of + the addresses. In IPv6 this should be 128 bits. + The following typedef is machine dependent. + A word must be 32 bits long! */ +typedef unsigned long word; typedef void* GENERIC; /* To be replaced with a pointer to a policy */ struct tuple_t diff --git a/src/sfrt/sfrt_trie.h b/src/sfrt/sfrt_trie.h deleted file mode 100644 index 40f5d322a..000000000 --- a/src/sfrt/sfrt_trie.h +++ /dev/null @@ -1,153 +0,0 @@ -//-------------------------------------------------------------------------- -// Copyright (C) 2014-2016 Cisco and/or its affiliates. All rights reserved. -// Copyright (C) 2006-2013 Sourcefire, Inc. -// -// This program is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License Version 2 as published -// by the Free Software Foundation. You may not use, modify or distribute -// this program under any other version of the GNU General Public License. -// -// This program 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 -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -//-------------------------------------------------------------------------- - -/* - trie.h - - A routing table for wordsized (32bits) bitstrings implemented as a - static level- and pathcompressed trie. For details please consult - - Stefan Nilsson and Gunnar Karlsson. Fast Address Look-Up - for Internet Routers. International Conference of Broadband - Communications (BC'97). - - http://www.hut.fi/~sni/papers/router/router.html - - The code presented in this file has been tested with care but is - not guaranteed for any purpose. The writer does not offer any - warranties nor does he accept any liabilities with respect to - the code. - - Stefan Nilsson, 4 nov 1997. - - Laboratory of Information Processing Science - Helsinki University of Technology - Stefan.Nilsson@hut.fi -*/ - -/* - The trie is represented by an array and each node consists of an - unsigned word. The first 5 bits (31-27) indicate the logarithm - of the branching factor. The next 5 bits (26-22) indicate the - skip value. The final 22 (21-0) bits is an adress, either to - another internal node, or the base vector. - The maximum capacity is 2^21 strings (or a few more). The trie - is prefixfree. All strings that are prefixes of another string - are stored separately. -*/ - -#ifndef SFRT_TRIE_H -#define SFRT_TRIE_H - -#define ADRSIZE 32 /* the number of bits in an address */ - -/* A 32-bit word is used to hold the bit patterns of - the addresses. In IPv6 this should be 128 bits. - The following typedef is machine dependent. - A word must be 32 bits long! */ -typedef unsigned long word; - -/* The trie is represented by an array and each node in - the trie is compactly represented using only 32 bits: - 5 + 5 + 22 = branch + skip + adr */ -typedef word node_t; - -#define NOPRE -1 /* an empty prefix pointer */ - -#define SETBRANCH(branch) ((branch)<<27) -#define GETBRANCH(node) ((node)>>27) -#define SETSKIP(skip) ((skip)<<22) -#define GETSKIP(node) ((node)>>22 & 037) -#define SETADR(adr) (adr) -#define GETADR(node) ((node) & 017777777) - -/* extract n bits from str starting at position p */ -#define EXTRACT(p, n, str) ((str)<<(p)>>(32-(n))) - -/* remove the first p bits from string */ -#define REMOVE(p, str) ((str)<<(p)>>(p)) - -/* A next-hop table entry is a 32 bit string */ - -typedef word policy_t; - -/* The routing table entries are initially stored in - a simple array */ - -typedef struct entryrec* entry_t; -struct entryrec -{ - word data; /* the routing entry */ - int len; /* and its length */ - policy_t policy; /* the corresponding next-hop */ - int pre; /* this auxiliary variable is used in the */ -}; /* construction of the final data structure */ - -/* base vector */ - -typedef struct baserec* base_t; -struct baserec -{ - word str; /* the routing entry */ - int len; /* and its length */ - int pre; /* pointer to prefix table, -1 if no prefix */ - int policy; /* pointer to next-hop table */ -}; - -typedef struct /* compact version of above */ -{ word str; - int len; - int pre; - int policy; } comp_base_t; - -/* prefix vector */ - -typedef struct prerec* pre_t; -struct prerec -{ - int len; /* the length of the prefix */ - int pre; /* pointer to prefix, -1 if no prefix */ - int policy; /* pointer to policy table */ -}; - -typedef struct /* compact version of above */ -{ int len; - int pre; - int policy; } comp_pre_t; - -/* The complete routing table data structure consists of - a trie, a base vector, a prefix vector, and a next-hop table. */ - -typedef struct routtablerec* routtable_t; -struct routtablerec -{ - node_t* trie; /* the main trie search structure */ - int triesize; - comp_base_t* base; /* the base vector */ - int basesize; - comp_pre_t* pre; /* the prefix vector */ - int presize; - policy_t* policy; /* the next-hop table */ - int policysize; - - int dirty; /* Whether or not the table needs to be rebuilt */ -}; - -#endif -