]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
file reorganization; updated bindings
authorRuss Combs <rucombs@cisco.com>
Wed, 30 Apr 2014 22:17:41 +0000 (18:17 -0400)
committerRuss Combs <rucombs@cisco.com>
Wed, 30 Apr 2014 22:17:41 +0000 (18:17 -0400)
76 files changed:
configure.ac
doc/Makefile.am
src/Makefile.am
src/codecs/decode.cc
src/codecs/plugins/cd_teredo.cc
src/control/idle_processing.cc
src/detection/detect.cc
src/detection/detection_options.cc
src/events/event.h
src/file_api/file_service.cc
src/filters/sfrf.h
src/filters/sfthd.h
src/filters/sfthreshold.cc
src/framework/bits.h
src/framework/inspector.h
src/framework/mpse.h
src/framework/value.cc
src/framework/value.h
src/helpers/process.cc
src/ips_options/ips_session.cc
src/ips_options/replace.h
src/log/log.cc
src/log/messages.cc
src/log/obfuscation.cc
src/loggers/Makefile.am
src/loggers/log_tcpdump.cc
src/loggers/unified2.cc
src/main.cc
src/main/Makefile.am [new file with mode: 0644]
src/main/analyzer.cc [moved from src/analyzer.cc with 99% similarity]
src/main/analyzer.h [moved from src/analyzer.h with 100% similarity]
src/main/binder.cc [new file with mode: 0644]
src/main/binder.h [new file with mode: 0644]
src/main/build.h [moved from src/build.h with 100% similarity]
src/main/modules.cc [moved from src/parser/modules.cc with 96% similarity]
src/main/modules.h [moved from src/parser/modules.h with 96% similarity]
src/main/policy.cc [moved from src/policy.cc with 100% similarity]
src/main/policy.h [moved from src/policy.h with 97% similarity]
src/main/snort.cc [moved from src/snort.cc with 99% similarity]
src/main/snort.h [moved from src/snort.h with 99% similarity]
src/main/snort_config.cc [moved from src/snort_config.cc with 100% similarity]
src/main/snort_config.h [moved from src/snort_config.h with 99% similarity]
src/main/snort_debug.cc [moved from src/snort_debug.cc with 100% similarity]
src/main/snort_debug.h [moved from src/snort_debug.h with 100% similarity]
src/main/snort_types.h [moved from src/snort_types.h with 100% similarity]
src/main/thread.h [moved from src/thread.h with 100% similarity]
src/managers/module_manager.cc
src/managers/packet_manager.cc
src/network_inspectors/defrag/defrag.cc
src/network_inspectors/perf_monitor/perf.cc
src/network_inspectors/perf_monitor/perf_monitor.cc
src/network_inspectors/port_scan/port_scan.cc
src/network_inspectors/stream5/stream_module.cc
src/network_inspectors/stream5/stream_tcp.cc
src/parser/Makefile.am
src/parser/cmd_line.cc
src/parser/config_file.h
src/parser/parser.h
src/parser/vars.h
src/search_engines/acsmx.cc
src/search_engines/pat_stats.h
src/search_engines/str_search.cc
src/service_inspectors/ftp_telnet/ftp_module.cc
src/service_inspectors/ftp_telnet/hi_util_xmalloc.cc
src/service_inspectors/ftp_telnet/telnet_module.cc
src/service_inspectors/http_inspect/hi_include.h
src/service_inspectors/http_inspect/hi_server.cc
src/service_inspectors/http_inspect/hi_util_xmalloc.cc
src/sfip/sf_ip.cc
src/time/packet_time.cc
src/time/ppm.h
src/time/ppm_module.cc
src/time/profiler.h
src/utils/stats.h
src/utils/util_jsnorm.cc
src/utils/util_net.cc

index b813b22e53fbb0c0109daa7dc786a57dacb50cfe..3799e094c52455cfbb5d347a2a0fe4878ade4f9d 100644 (file)
@@ -28,7 +28,7 @@
 AC_INIT([snort], [2.10.075])
 AC_PREREQ([2.68])
 
-AC_CONFIG_SRCDIR([src/snort.cc])
+AC_CONFIG_SRCDIR([src/main.h])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
 
@@ -237,6 +237,8 @@ fi
 # enables
 #--------------------------------------------------------------------------
 
+AM_CONDITIONAL(LINUX, [test "x$linux" = "xyes"])
+
 AC_ARG_ENABLE(static-inspectors,
     [  --disable-static-inspectors    do not include inspectors in binary ],
        static_inspectors="$enableval", static_inspectors="yes")
@@ -847,7 +849,7 @@ CXXFLAGS="$CFLAGS"
 echo "$AM_CFLAGS $CFLAGS" > cflags.out
 echo "$AM_CPPFLAGS $CPPFLAGS" > cppflags.out
 
-AM_CPPFLAGS='-I$(top_srcdir) -I$(top_srcdir)/src -I$(top_srcdir)/src/parser -I$(top_srcdir)/src/utils -I$(top_srcdir)/src/loggers -I$(top_srcdir)/src/network_inspectors -I$(top_srcdir)/src/service_inspectors -I$(top_srcdir)/src/time -I$(top_srcdir)/src/protocols -I$(top_srcdir)/src/log -I$(top_srcdir)/src/events -I$(top_srcdir)/src/sfip -I$(top_srcdir)/src/rules -I$(top_srcdir)/src/detection -I$(top_srcdir)/src/hash' 
+AM_CPPFLAGS='-I$(top_srcdir) -I$(top_srcdir)/src -I$(top_srcdir)/src/main -I$(top_srcdir)/src/parser -I$(top_srcdir)/src/utils -I$(top_srcdir)/src/loggers -I$(top_srcdir)/src/time -I$(top_srcdir)/src/protocols -I$(top_srcdir)/src/network_inspectors -I$(top_srcdir)/src/log -I$(top_srcdir)/src/events -I$(top_srcdir)/src/sfip -I$(top_srcdir)/src/rules -I$(top_srcdir)/src/detection -I$(top_srcdir)/src/hash' 
 
 AC_SUBST(AM_CPPFLAGS)
 AC_SUBST(AM_CXXFLAGS)
@@ -875,6 +877,7 @@ src/helpers/Makefile \
 src/ips_options/Makefile \
 src/log/Makefile \
 src/loggers/Makefile    \
+src/main/Makefile \
 src/managers/Makefile \
 src/mempool/Makefile \
 src/network_inspectors/Makefile \
index 49b665344902b1f23092ea372646eb2227bed3f2..ecda761c5c20abb1e9f99038fba9f682d3e4f025 100644 (file)
@@ -93,6 +93,7 @@ images.tgz: images/
         .
 
 clean-local:
+       rm -f $(BUILT_SOURCES)
        rm -f *.tgz
        rm -f snort_manual.{fo,xml,html,pdf}
        rm -rf snort_manual.chunked/
index 3e1651e9722021f401112e4cadc89dabf779e805..8986378cf7a9c7808a362e321fd7a8186f02fd5d 100644 (file)
@@ -2,21 +2,9 @@ AUTOMAKE_OPTIONS=foreign no-dependencies
 
 bin_PROGRAMS = snort
 
-snort_includedir = $(pkgincludedir)
-
-snort_include_HEADERS = \
-thread.h \
-snort_debug.h \
-snort_types.h
-
 snort_SOURCES = \
-snort.cc snort.h \
-snort_debug.cc \
-snort_config.cc snort_config.h \
-analyzer.cc analyzer.h \
-policy.cc policy.h \
-main.cc main.h \
-build.h
+main.cc \
+main.h
 
 if STATIC_INSPECTORS
 lib_list = \
@@ -28,7 +16,9 @@ service_inspectors/rpc_decode/librpc_decode.a
 endif
 
 # order libs to avoid undefined symbols
+# from gnu linker
 snort_LDADD = \
+main/libmain.a \
 target_based/libtarget_based.a \
 file_api/libfile_api.a \
 file_api/libs/libfile.a \
@@ -81,6 +71,7 @@ helpers \
 ips_options \
 log \
 loggers \
+main \
 managers \
 mempool \
 network_inspectors \
index 8790ce4b813f324f7412ad97794c28257a98a7f5..b400159f87ead5828576e3163e99e299fb7a6964 100644 (file)
@@ -37,7 +37,7 @@
 #include <dnet.h>
 #endif
 
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "decode.h"
 #include "snort.h"
 #include "snort_debug.h"
index ba2fcd12e370da36a5f83ab19e03679564d952f7..c92056bb979e61100ec897de63a69946e6c47187 100644 (file)
@@ -35,7 +35,7 @@
 #include "snort_types.h"
 #include "protocols/packet.h"
 #include "snort.h"
-#include "snort_config.h"
+#include "main/snort_config.h"
 #include "packet_io/active.h"
 #include "protocols/ipv6.h"
 #include "protocols/teredo.h"
index 60c9295f8c823e05160406ef417fb4ce28272ef8..eb6ba0989c038b72f9e02e08ad745ddac12a1a9d 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <stdlib.h>
 
-#include "thread.h"
+#include "main/thread.h"
 #include "util.h"
 
 typedef struct _IDLE_HANDLER_ELEMENT
index 1c1dad67a982e767083dc15dde96b04d7fca8ec6..11c6a6527dae32d6d24ac3145f543f25139268db 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "snort_types.h"
 #include "snort_debug.h"
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "snort.h"
 #include "util.h"
 #include "mstring.h"
index 4d3031477516d583142770fcf35ceaaf209bb418..ec5234bb4e865240625147cd4d23003e5a306a26 100644 (file)
@@ -55,7 +55,7 @@
 #include "profiler.h"
 #include "filters/detection_filter.h"
 #include "encode.h"
-#include "thread.h"
+#include "main/thread.h"
 #include "framework/ips_option.h"
 #include "managers/ips_manager.h"
 
index 73ad5c1af1bd6088093807db385acb169ba0aee7..5e13608c408f891b554809f84d7e9755e281960b 100644 (file)
@@ -30,7 +30,7 @@
 #endif
 
 #include "snort_types.h"
-#include "thread.h"
+#include "main/thread.h"
 
 extern THREAD_LOCAL uint16_t event_id;
 
index bac35924f775390f8ff08118a4615bb549c82b57..1da246c721ff8682a77ac4373ba12bfed3bf2193 100644 (file)
@@ -48,7 +48,7 @@
 
 #include "file_mime_process.h"
 #include "file_resume_block.h"
-#include "http_inspect/hi_main.h"  // FIXIT bad dependency
+#include "service_inspectors/http_inspect/hi_main.h"  // FIXIT bad dependency
 #include "detection_util.h"
 
 #include "target_based/sftarget_protocol_reference.h"
index 026ce70672d5bf130602806650eea9c9f3770e90..7ceef1e0be205bbfb668956d0d940801cb0d4e4d 100644 (file)
@@ -38,7 +38,7 @@
 #include "sflsq.h"
 #include "sfghash.h"
 #include "sfxhash.h"
-#include "policy.h"
+#include "main/policy.h"
 #include "detection/rules.h"
 
 // define to use over rate threshold
index 9cdb8940156baba1a0fa4638e84cb063e9c65e9a..08d3118c97f52bb2e6acda8f43096b592b0d130e 100644 (file)
@@ -36,7 +36,7 @@
 #include "sflsq.h"
 #include "sfghash.h"
 #include "sfxhash.h"
-#include "policy.h"
+#include "main/policy.h"
 
 /*!
     Max GEN_ID value - Set this to the Max Used by Snort, this is used for the
index 9fc14bdada05145a5fb36f2541a0165fbb68f0a4..d5bf158af3097e5644bdf47b3cb062a1c9f88056 100644 (file)
@@ -43,7 +43,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "mstring.h"
 #include "util.h"
 #include "parser.h"
index a6fe30ef608c2723615f400b1c756d0e71925a64..9a957d4ddc1be1f7ef584b9b1d4e243f30f0b499 100644 (file)
@@ -24,6 +24,7 @@
 #include <bitset>
 
 typedef std::bitset<65536> PortList;
+typedef std::bitset<4096> VlanList;
 typedef std::bitset<256> ByteList;
 
 #endif
index 75fe6e73caf73dc37f48e6f84bf302625878fff8..f5a0ddf394cbaddd75d7ff3b1d2195a899a7b4de 100644 (file)
@@ -22,7 +22,7 @@
 #define INSPECTOR_H
 
 #include "snort_types.h"
-#include "thread.h"
+#include "main/thread.h"
 #include "framework/base_api.h"
 
 struct Packet;
index 8c2eaaffa6bd8b8167d348c3239bc98044e02329..b572d790107c7a96efbc61819b4f9140d9a355eb 100644 (file)
@@ -28,7 +28,7 @@
 #endif
 
 #include "snort_types.h"
-#include "thread.h"
+#include "main/thread.h"
 #include "framework/base_api.h"
 #include "time/profiler.h"
 
index bb32db3bed491c1c9f1f44827f0cb315943c40d8..6b13e0b3510ea759d4ab9dba6feffada2de18da5 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "value.h"
 
+#include <assert.h>
 #include <iostream>
 #include <sstream>
 #include <string>
@@ -73,6 +74,20 @@ void Value::get_bits(PortList& list) const
 {
     list.reset();
     unsigned len = str.size();
+    assert(len == list.size());
+
+    for ( unsigned n = 0; n < len; ++n )
+    {   
+        if ( str[n] == '1' )
+            list.set(n);
+    }
+}
+
+void Value::get_bits(VlanList& list) const
+{
+    list.reset();
+    unsigned len = str.size();
+    assert(len == list.size());
 
     for ( unsigned n = 0; n < len; ++n )
     {   
@@ -85,6 +100,7 @@ void Value::get_bits(ByteList& list) const
 {
     list.reset();
     unsigned len = str.size();
+    assert(len == list.size());
 
     for ( unsigned n = 0; n < len; ++n )
     {   
index e8babeaf490290cbfa8e58e80837ecbe8c6f64ea..eea58a4e74a58069f35cbdffa81217a2ef98ad85 100644 (file)
@@ -86,6 +86,7 @@ public:
     { return str.c_str(); };
 
     void get_bits(PortList&) const;
+    void get_bits(VlanList&) const;
     void get_bits(ByteList&) const;
 
     void lower()
index 3406696fc1e7a40efd3ed13dd3f8725708112db1..a438d9690e3aed0f83d68ce6cb4dcc4f2ccde57b 100644 (file)
@@ -28,7 +28,7 @@
 #endif
 
 #include "utils/util.h"
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "snort.h"
 #include "utils/ring.h"
 
index 9bc17259df948b77df874288dd934ae537c488f6..e8c0dcb607a5cc019c49aa4eab2ea93a603dd5d3 100644 (file)
@@ -66,7 +66,7 @@
 #include "fpdetect.h"
 #include "sfhashfcn.h"
 #include "detection/detection_defines.h"
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "framework/ips_option.h"
 
 #define SESSION_PRINTABLE    1
index d72b592adb5ff6604f7260f7389593a614e5e0df..9961304acd0ed28dcdcad48401f5072f8f6730a6 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <assert.h>
 #include "ips_content.h"
-#include "thread.h"
+#include "main/thread.h"
 
 void PayloadReplaceInit(PatternMatchData*, char*, OptTreeNode*);
 
index 1c45403e8d84fe87d27a0a5a98341d0bfeacd9c9..11332d4d8bd643d3c12f9ab258124dfb8d9ad393 100644 (file)
@@ -36,7 +36,7 @@
 using namespace std;
 
 #include "log_text.h"
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "snort.h"
 
 #define DEFAULT_DAEMON_ALERT_FILE  "alert"
index ab9b977ce2369acde3bdea12f63f60fe5e9cbb91..1c86d0dbce4dd6e0d0911a6004aa9d06e9206a6b 100644 (file)
@@ -46,7 +46,7 @@
 #include <fcntl.h>
 
 #include "snort.h"
-#include "snort_config.h"
+#include "main/snort_config.h"
 #include "packet_io/sfdaq.h"
 #include "time/packet_time.h"
 
index 7bec95985682c9fab19560854ec7eab058321987..fff746d98d4a4af466601af796caf9ac1718151a 100644 (file)
@@ -34,7 +34,7 @@ extern "C" {
 #include "decode.h"
 #include "stream5/stream_api.h"
 #include "snort_bounds.h"
-#include "thread.h"
+#include "main/thread.h"
 #include "util.h"
 
 #ifdef OBFUSCATION_TEST_STANDALONE
index 7def995b27ab5bafaed09541268802db35102b07..cb0ef083436b3369b49996cb80b894db647858d4 100644 (file)
@@ -9,7 +9,6 @@ plugin_list = \
 alert_csv.cc \
 alert_fast.cc \
 alert_full.cc \
-alert_sf_socket.cc \
 alert_syslog.cc \
 alert_test.cc \
 alert_unixsock.cc \
@@ -20,6 +19,11 @@ unified2_common.h
 
 if STATIC_LOGGERS
 libloggers_a_SOURCES += $(plugin_list)
+
+if LINUX
+libloggers_a_SOURCES += alert_sf_socket.cc
+endif
+
 else
 ehlibdir = $(pkglibdir)/loggers
 
@@ -38,10 +42,12 @@ libalert_full_la_CXXFLAGS = $(AM_CXXFLAGS) -DBUILDING_SO
 libalert_full_la_LDFLAGS = -export-dynamic -shared
 libalert_full_la_SOURCES = alert_full.cc
 
+if LINUX
 ehlib_LTLIBRARIES += libalert_sf_socket.la
 libalert_sf_socket_la_CXXFLAGS = $(AM_CXXFLAGS) -DBUILDING_SO
 libalert_sf_socket_la_LDFLAGS = -export-dynamic -shared
 libalert_sf_socket_la_SOURCES = alert_sf_socket.cc
+endif
 
 ehlib_LTLIBRARIES += libalert_syslog.la
 libalert_syslog_la_CXXFLAGS = $(AM_CXXFLAGS) -DBUILDING_SO
index 19d7ae06033de939926340da21616d65df52db1d..e33ffe751bc5a4a27512b795ffae6123e08726bf 100644 (file)
@@ -47,7 +47,7 @@ extern "C" {
 #include "snort_debug.h"
 #include "util.h"
 #include "snort.h"
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "packet_io/sfdaq.h"
 #include "stream5/stream_api.h"
 
index 775bbe8cde28494658ba98c67cff58022321e156..444649b61acec6fe1226fa69089e431c9133fb65 100644 (file)
@@ -45,7 +45,7 @@
 #include "framework/module.h"
 #include "decode.h" /* for struct in6_addr -- maybe move to snort_types.h? */
 #include "snort_types.h"
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "decode.h"
 #include "rules.h"
 #include "treenodes.h"
index a8764077a1a616733b52869b06217276ab032e31..0d0a2f79ad423597b42ea551e5334c9b9eea650c 100644 (file)
@@ -41,7 +41,7 @@ using namespace std;
 
 #include "snort.h"
 #include "helpers/process.h"
-#include "snort_config.h"
+#include "main/snort_config.h"
 #include "framework/module.h"
 #include "managers/module_manager.h"
 #include "managers/plugin_manager.h"
@@ -54,7 +54,7 @@ using namespace std;
 #include "control/idle_processing.h"
 #include "target_based/sftarget_reader.h"
 #include "flow/flow_control.h"
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "helpers/swapper.h"
 #include "time/periodic.h"
 
diff --git a/src/main/Makefile.am b/src/main/Makefile.am
new file mode 100644 (file)
index 0000000..d68a58b
--- /dev/null
@@ -0,0 +1,28 @@
+AUTOMAKE_OPTIONS=foreign no-dependencies
+
+x_includedir = $(pkgincludedir)/main
+
+noinst_LIBRARIES = libmain.a
+
+x_include_HEADERS = \
+snort_debug.h \
+snort_types.h \
+thread.h
+
+libmain_a_SOURCES = \
+analyzer.cc \
+analyzer.h \
+binder.cc \
+binder.h \
+build.h \
+modules.cc \
+modules.h \
+policy.cc \
+policy.h \
+snort.cc \
+snort.h \
+snort_config.cc \
+snort_config.h \
+snort_debug.cc
+
+AM_CXXFLAGS = @AM_CXXFLAGS@
similarity index 99%
rename from src/analyzer.cc
rename to src/main/analyzer.cc
index 13ff930308ff305ce2550780d33e077950076d0d..754e03401483ae3713a391b2542a75c44c3044a6 100644 (file)
@@ -32,7 +32,7 @@
 using namespace std;
 
 #include "tag.h"
-#include "thread.h"
+#include "main/thread.h"
 #include "helpers/swapper.h"
 #include "packet_io/active.h"
 #include "packet_io/sfdaq.h"
similarity index 100%
rename from src/analyzer.h
rename to src/main/analyzer.h
diff --git a/src/main/binder.cc b/src/main/binder.cc
new file mode 100644 (file)
index 0000000..81806ae
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+** Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved.
+**
+** 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.
+*/
+// binder.cc author Russ Combs <rucombs@cisco.com>
+
+#include "binder.h"
+
diff --git a/src/main/binder.h b/src/main/binder.h
new file mode 100644 (file)
index 0000000..2238a77
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+** Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved.
+**
+** 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.
+*/
+// binder.cc author Russ Combs <rucombs@cisco.com>
+
+#ifndef BINDER_H
+#define BINDER_H
+
+#include <string>
+
+#include "framework/bits.h"
+
+enum BindRole
+{
+    BR_EITHER,
+    BR_CLIENT,
+    BR_SERVER
+};
+
+enum BindAction
+{
+    BA_INSPECT,
+    BA_ALLOW,
+    BA_BLOCK
+};
+
+struct Binding
+{
+    // when
+    std::string id;
+    VlanList vlans;
+    std::string nets;
+    ByteList protos;
+    PortList ports;
+    BindRole role;
+
+    // use
+    std::string type;
+    std::string name;
+
+    // action
+    BindAction action;
+
+    Binding()
+    { role = BR_EITHER; action = BA_INSPECT; };
+};
+
+#endif
+
similarity index 100%
rename from src/build.h
rename to src/main/build.h
similarity index 96%
rename from src/parser/modules.cc
rename to src/main/modules.cc
index 1890c1b3b2697bf44d22ca8ca156499e143cdfab..684b0aae8bc380d783599863e3a5de70da29ffbe 100644 (file)
@@ -27,7 +27,9 @@
 
 #include <assert.h>
 #include <string.h>
+
 #include <string>
+#include <vector>
 using namespace std;
 
 #include "framework/module.h"
@@ -36,6 +38,7 @@ using namespace std;
 #include "main.h"
 #include "snort.h"
 #include "snort_config.h"
+#include "binder.h"
 #include "parser/parser.h"
 #include "parser/parse_conf.h"
 #include "parser/config_file.h"
@@ -1003,6 +1006,7 @@ bool AttributeTableModule::set(const char*, Value& v, SnortConfig* sc)
 //-------------------------------------------------------------------------
 // network module
 //-------------------------------------------------------------------------
+
 static const Parameter network_params[] =
 {
     { "checksum_drop", Parameter::PT_MULTI,
@@ -1665,27 +1669,30 @@ public:
 // bindings module
 //-------------------------------------------------------------------------
 
-static const Parameter bindings_match_params[] =
+static const Parameter bindings_when_params[] =
 {
-    { "id", Parameter::PT_INT, "1:", nullptr,
+    { "id", Parameter::PT_STRING, nullptr, nullptr,
       "unique ID for selection of this config by external logic" },
 
     { "vlans", Parameter::PT_STRING, nullptr, nullptr,
       "list of VLAN IDs" },
 
-    { "networks", Parameter::PT_ADDR_LIST, nullptr, nullptr,
-      "list of CIDRs" },
+    { "nets", Parameter::PT_ADDR_LIST, nullptr, nullptr,
+      "list of networks" },
+
+    { "protos", Parameter::PT_SELECT, "ip | icmp | tcp | udp", nullptr,
+      "list of protocols" },
 
     { "ports", Parameter::PT_BIT_LIST, "65535", nullptr,
       "list of ports" },
 
-    { "protocol", Parameter::PT_SELECT, "ip | icmp | tcp | udp", nullptr,
-      "list of protocols" },
+    { "role", Parameter::PT_ENUM, "client | server | any", "any",
+      "use the given configuration on one or any end of a session" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
 
-static const Parameter bindings_config_params[] =
+static const Parameter bindings_use_params[] =
 {
     { "type", Parameter::PT_STRING, nullptr, nullptr,
       "select module for binding" },
@@ -1693,22 +1700,19 @@ static const Parameter bindings_config_params[] =
     { "name", Parameter::PT_STRING, nullptr, "defaults to type",
       "symbol name" },
 
-    { "direction", Parameter::PT_SELECT, "to_client | to_server | any", nullptr,
-      "direction" },
-
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
 
 static const Parameter bindings_params[] =
 {
-    { "match", Parameter::PT_TABLE, nullptr, bindings_match_params,
+    { "when", Parameter::PT_TABLE, nullptr, bindings_when_params,
       "match criteria" },
 
-    { "config", Parameter::PT_TABLE, nullptr, bindings_config_params,
+    { "use", Parameter::PT_TABLE, nullptr, bindings_use_params,
       "target configuration" },
 
-    { "action", Parameter::PT_ENUM, "inspect | allow | block", "block",
-      "what to do with matching traffic (no config needed for allow and block)" },
+    { "action", Parameter::PT_ENUM, "inspect | allow | block", "inspect",
+      "what to do with matching traffic (use not needed for allow and block)" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
@@ -1716,44 +1720,45 @@ static const Parameter bindings_params[] =
 class BindingsModule : public Module
 {
 public:
-    BindingsModule() : Module("bindings", bindings_params) { };
+    BindingsModule() : Module("bindings", bindings_params) { work = nullptr; };
     bool set(const char*, Value&, SnortConfig*);
     bool begin(const char*, int, SnortConfig*);
+    bool end(const char*, int, SnortConfig*);
 
 private:
-    string type;
-    string name;
-    unsigned ignore; // FIXIT only using type and name for now
+    vector<Binding*> bindings;
+    Binding* work;
 };
 
 bool BindingsModule::set(const char*, Value& v, SnortConfig*)
 {
-    if ( v.is("type") )
-        type = v.get_string();
-
-    else if ( v.is("name") )
-        name = v.get_string();
-
-    else if ( v.is("direction") )
-        ignore++;
+    if ( v.is("role") )
+        work->role = (BindRole)v.get_long();
 
     else if ( v.is("id") )
-        ignore++;
+        work->id = v.get_string();
 
     else if ( v.is("vlans") )
-        ignore++;
+        v.get_bits(work->vlans);
 
-    else if ( v.is("networks") )
-        ignore++;
+    else if ( v.is("nets") )
+        work->nets = v.get_string();
 
+    else if ( v.is("protos") )
+    {
+        //v.get_bits(work->protos); FIXIT ?
+    }
     else if ( v.is("ports") )
-        ignore++;
+        v.get_bits(work->ports);
+
+    else if ( v.is("type") )
+        work->type = v.get_string();
 
-    else if ( v.is("protocol") )
-        ignore++;
+    else if ( v.is("name") )
+        work->name = v.get_string();
 
     else if ( v.is("action") )
-        ignore++;
+        work->action = (BindAction)v.get_long();
 
     else
         return false;
@@ -1761,11 +1766,21 @@ bool BindingsModule::set(const char*, Value& v, SnortConfig*)
     return true;
 }
 
-bool BindingsModule::begin(const char*, int, SnortConfig*)
+bool BindingsModule::begin(const char* fqn, int, SnortConfig*)
+{
+    if ( !strcmp(fqn, "bindings") )
+        work = new Binding;
+
+    return true;
+}
+
+bool BindingsModule::end(const char* fqn, int, SnortConfig*)
 {
-    type.clear();
-    name.clear();
-    ignore = 0;
+    if ( !strcmp(fqn, "bindings") )
+    {
+        bindings.push_back(work);
+        work = nullptr;
+    }
     return true;
 }
 
similarity index 96%
rename from src/parser/modules.h
rename to src/main/modules.h
index d44207d8a7376b146545272ff142cb8ab580c2da..133590880478bb6decd57886f3387821091ba917 100644 (file)
@@ -19,8 +19,6 @@
 
 // modules.cc author Russ Combs <rucombs@cisco.com>
 
-// prototype of parsing approach
-
 #ifndef MODULES_H
 #define MODULES_H
 
similarity index 100%
rename from src/policy.cc
rename to src/main/policy.cc
similarity index 97%
rename from src/policy.h
rename to src/main/policy.h
index f03f11476423a541ca53b0b5b7683b3b2826dc42..4a20f4df0dc8638f67513258c6b0dd22d36a16db 100644 (file)
@@ -52,9 +52,8 @@ enum DecodeEventFlag
     DECODE_EVENT_FLAG__DEFAULT = 0x00000001
 };
 
-// this is the nap post ac-split
-// really it is a decoder policy
-// similar to inspector policy
+// Snort ac-split creates the nap
+// Snort++ breaks that into network and inspection
 struct NetworkPolicy
 {
 public:
similarity index 99%
rename from src/snort.cc
rename to src/main/snort.cc
index 620d9bded8ea888356a01710699a7f219676b629..ad4c2dbd11d96f679a90543cbf553fb5f401375f 100644 (file)
@@ -61,7 +61,7 @@ using namespace std;
 #include "rules.h"
 #include "treenodes.h"
 #include "snort_debug.h"
-#include "snort_config.h"
+#include "main/snort_config.h"
 #include "util.h"
 #include "parser.h"
 #include "packet_io/trough.h"
@@ -99,7 +99,7 @@ using namespace std;
 #include "control/idle_processing.h"
 #include "file_api/file_service.h"
 #include "flow/flow_control.h"
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "log/sf_textlog.h"
 #include "log/log_text.h"
 #include "time/periodic.h"
similarity index 99%
rename from src/snort.h
rename to src/main/snort.h
index 71a4904f91c9eec2cddbd04df8e41f048b305d2f..b7d4c58337a2752c9c2484b554bd1fe9e2f7c843 100644 (file)
@@ -34,7 +34,7 @@
 #include "snort_types.h"
 #include "protocols/decode.h"
 #include "sfip/sf_ipvar.h"
-#include "snort_config.h"
+#include "main/snort_config.h"
 
 SnortConfig* reload_config();
 void snort_setup(int argc, char *argv[]);
similarity index 100%
rename from src/snort_config.cc
rename to src/main/snort_config.cc
similarity index 99%
rename from src/snort_config.h
rename to src/main/snort_config.h
index d6027f5e22e14cfb67e9aed368a8918d2744554f..e3ad51db67a61a1bc16018b26ce57c5694470c81 100644 (file)
@@ -43,7 +43,7 @@
 #include "hash/sfxhash.h"
 #include "utils/sfportobject.h"
 #include "hash/sfghash.h"
-#include "policy.h"
+#include "main/policy.h"
 
 #define MAX_PIDFILE_SUFFIX 11 /* uniqueness extension to PID file, see '-R' */
 
similarity index 100%
rename from src/snort_debug.cc
rename to src/main/snort_debug.cc
similarity index 100%
rename from src/snort_debug.h
rename to src/main/snort_debug.h
similarity index 100%
rename from src/snort_types.h
rename to src/main/snort_types.h
similarity index 100%
rename from src/thread.h
rename to src/main/thread.h
index 98e5b74bdc71fd0292689dec8b09671d124e0b3c..e2b642f74b383510d7b07b1b63a7d97d4038f3ac 100644 (file)
 #include "framework/base_api.h"
 #include "framework/module.h"
 #include "managers/plugin_manager.h"
-#include "snort_config.h"
+#include "main/snort_config.h"
+#include "main/modules.h"
 #include "parser/parser.h"
 #include "parser/parse_conf.h"
-#include "parser/modules.h"
 #include "parser/vars.h"
 
 using namespace std;
index 09f12724588968d7776a759bd309263be5f65678..4faeb4a86afafece81e0f2791766c9d4efdc5501 100644 (file)
@@ -25,7 +25,7 @@
 #include "packet_manager.h"
 #include "framework/codec.h"
 #include "snort.h"
-#include "thread.h"
+#include "main/thread.h"
 #include "log/messages.h"
 #include "packet_io/sfdaq.h"
 
index 9d880fcc99f7d67284529d93e7b179a33e71c1e9..2194237fe13de57ec60cc0128a6c9251784b8265 100644 (file)
@@ -84,7 +84,7 @@
 #include <errno.h>
 
 #include "defrag_module.h"
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "snort_bounds.h"
 #include "log_text.h"
 #include "detect.h"
index 69a8de370881c73dbf7567bcaa230c003f0d5564..346800ce6a3bf715872f2f81826687987aee8a87 100644 (file)
@@ -44,7 +44,7 @@
 #include <unistd.h>
 #include <string>
 
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "util.h"
 #include "snort_types.h"
 #include "decode.h"
index ecf4ed554c01eec58f3adc78585ae97c32d9e3cb..a29dc517109adfdff2a256f25fbb0148f4580617 100644 (file)
@@ -42,7 +42,7 @@
 #include "perf.h"
 #include "perf_base.h"
 #include "perf_module.h"
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "snort_types.h"
 #include "mstring.h"
 #include "util.h"
index 07a52e611f6db953d2be6cf7a75aea7c416874fc..5c0b72c5f0594b15f1f165fed917d9ba22109f30 100644 (file)
@@ -54,7 +54,7 @@
 #include "ps_inspect.h"
 #include "ps_module.h"
 
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "decode.h"
 #include "encode.h"
 #include "event_wrapper.h"
index baa0ba46d97235068bb53ad5e13251e18010fb74..f43459e5b3a3c2bd5ac9685a47fb2180a5c8c80a 100644 (file)
@@ -24,7 +24,7 @@
 #include <string>
 using namespace std;
 
-#include "snort_config.h"
+#include "main/snort_config.h"
 #include "stream_common.h"
 
 #include "ip_config.h"
index 61c35063d685f28a88025fbe73284aa13297cf6f..046197a634e180922f51d20f0bcf43208411444b 100644 (file)
@@ -54,7 +54,7 @@
 #include <errno.h>
 #include <assert.h>
 
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "perf_monitor/perf.h"
 #include "snort_types.h"
 #include "snort_debug.h"
index 20bb67c4311b605fff24bbd6595ffda85d7804fa..4227b4d168c53fdfdd18b3051309e0056e16b5d8 100644 (file)
@@ -9,7 +9,6 @@ parse_rule.cc parse_rule.h \
 parse_otn.cc parse_otn.h \
 cmd_line.cc cmd_line.h \
 config_file.cc config_file.h \
-modules.cc modules.h \
 keywords.h \
 ip_addr_set.cc ip_addr_set.h \
 mstring.cc mstring.h \
index e8562bd86806bfe6128aa0df014322027c582f18..fd237a23300a0b10451ad8a2c8d64a23e5bf14ae 100644 (file)
@@ -31,7 +31,7 @@ using namespace std;
 #include "config_file.h"
 #include "parser.h"
 #include "vars.h"
-#include "analyzer.h"
+#include "main/analyzer.h"
 #include "managers/shell.h"
 #include "managers/event_manager.h"
 #include "managers/ips_manager.h"
index 6c917e5ef93f18e1c9e0e10e560bbb41f2fe5a24..a7a6a591c38fca51819a3f772b54f00dc7be07a3 100644 (file)
@@ -25,7 +25,7 @@
 # include "config.h"
 #endif
 
-#include "snort_config.h"
+#include "main/snort_config.h"
 #include "snort_types.h"
 #include "snort.h"
 
index 5b1da6044d652d234f3ee7396eb4fd1f3a9b2ff8..7ff2d38b0b905c688aec4fbbc9465e96185f0e06 100644 (file)
@@ -30,7 +30,7 @@
 #include "rules.h"
 #include "treenodes.h"
 #include "decode.h"
-#include "policy.h"
+#include "main/policy.h"
 #include "sflsq.h"
 #include "snort.h"
 #include "util.h"
index edf7217ab3333372712546d0cbb7b299dd7cbc17..14dd75e846c44a522c7f698e5e577615ebb8a767 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef VARS_H
 #define VARS_H
 
-#include "snort_config.h"
+#include "main/snort_config.h"
 #include "sfip/sf_vartable.h"
 
 //-------------------------------------------------------------------------
index b16ab92a1e8ad20c778036ed77bc8d340e3bfd02..47d0ece8dcbdb1a0356bd16323aa46e7008b74fb 100644 (file)
@@ -66,7 +66,7 @@
 
 #include "snort_debug.h"
 #include "util.h"
-#include "thread.h"
+#include "main/thread.h"
 
 #define MEMASSERT(p,s) if(!p){fprintf(stderr,"ACSM-No Memory: %s!\n",s);exit(0);}
 
index 5b758f83fe2c1331cdca3cfa68b907acd2577050..d5ce2d2779ecdd9dd2b0b7ab1574b692ec3c430f 100644 (file)
@@ -22,7 +22,7 @@
 #define PAT_STATS_H
 
 #include "snort_types.h"
-#include "thread.h"
+#include "main/thread.h"
 #include "utils/stats.h"
 
 // pattern matcher queue statistics
index 3cde1267c4988584c482a510bb3ddde93d3a0279..449ec847ec0685bb68cf2baff1d9194faf5d590e 100644 (file)
@@ -26,7 +26,7 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#include "thread.h"
+#include "main/thread.h"
 #include "framework/mpse.h"
 #include "managers/mpse_manager.h"
 
index ee84278b3f98b938eea7b1b7671e7a341f4e39cc..a0af84486d1ab95d69c04774e69885b652bb2426 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "ftp_module.h"
 #include <sstream>
-#include "snort_config.h"
+#include "main/snort_config.h"
 
 using namespace std;
 
index 30a2723db881617e3c842b8adc21f07ff3632057..fa582f3dd68d8a930acdc87c1f99cc1c6af9707e 100644 (file)
@@ -33,7 +33,7 @@
 #include <time.h>
 #include <sys/types.h>
 
-#include "thread.h"
+#include "main/thread.h"
 
 //#define MDEBUG
 
index 7378612a6068003d5985f9b74bf329576d308114..b4d16e366be61a679a11de43e91030a1c64c9a74 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "telnet_module.h"
 #include <sstream>
-#include "snort_config.h"
+#include "main/snort_config.h"
 
 using namespace std;
 
index 33f4ec594e9cb6f101e2d1561e37e1c0787b4b43..2bcd46101822d4536a15aab155fea2ecc7675632 100644 (file)
@@ -26,7 +26,7 @@
 #include "snort_types.h"
 #include "snort_debug.h"
 #include "ipv6_port.h"
-#include "thread.h"
+#include "main/thread.h"
 #include "utils/stats.h"
 
 #define HI_UNKNOWN_METHOD 1
index 285c3c1eb4bebe11f3833e9965ba1b166f912c7a..ad672ea2157dd4ac69c9f0d9d575f902579a4470 100644 (file)
@@ -43,7 +43,7 @@
 
 #include "mempool/mempool.h"
 #include "hi_paf.h"
-#include "thread.h"
+#include "main/thread.h"
 
 static THREAD_LOCAL bool simple_response = false;
 
index acc545cc741127f9a1e5f6646d88811ac6890ad8..c796986428a60d8940af04bed90e25045a8aa083 100644 (file)
@@ -33,7 +33,7 @@
 #include <time.h>
 #include <sys/types.h>
 
-#include "thread.h"
+#include "main/thread.h"
 
 //#define MDEBUG
 
index bcae54ce4833f53715cca7e93c1a8e282697085b..e44ffc0f8df17bc3bc9f1c5f346a8c8c462deaa0 100644 (file)
@@ -44,7 +44,7 @@
 #include <sys/types.h>
 #include <arpa/inet.h>
 
-#include "thread.h"
+#include "main/thread.h"
 #include "protocols/ipv6.h"
 
 #if 0
index 0be9c48819269230de68d797ddbffc5b8121a8eb..70bf4f1a35624f8912d7e1937e67f231b3af2f1e 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 #include "packet_time.h"
-#include "thread.h"
+#include "main/thread.h"
 
 static THREAD_LOCAL struct timeval s_recent_packet = { 0, 0 };
 static THREAD_LOCAL uint32_t s_first_packet = 0;
index b72be2059474712a34f9cf3bcaee1ae33d37b717..80277c11b8b452a0615fc754fd23ab62cbdd72a1 100644 (file)
@@ -35,7 +35,7 @@
 
 #ifdef PPM_MGR
 #include "snort_types.h"
-#include "thread.h"
+#include "main/thread.h"
 #include "cpuclock.h"
 #include "detection/detection_options.h"
 
index fc63bafd706631b8efb44e41103e657561223a24..ff620fba06d5235d4dede492d864380d8deb3973 100644 (file)
@@ -26,7 +26,7 @@
 #endif
 
 #include "ppm.h"
-#include "snort_config.h"
+#include "main/snort_config.h"
 
 //-------------------------------------------------------------------------
 // ppm attributes
index b0bbf5093236d1ef36b7637ed480baa69cb8ad3a..2abee3f51dc1d05c6f7d113ce31c74c37c6c581a 100644 (file)
@@ -28,7 +28,7 @@
 #endif
 
 #ifdef PERF_PROFILING
-#include "thread.h"
+#include "main/thread.h"
 #include "time/cpuclock.h"
 
 /* Sort preferences for rule profiling */
index db2ef6d9c6729e2457bbbef71c887048c9d12443..1ac41ef0200b36b544169db6b0e6bc97023a0893 100644 (file)
@@ -34,7 +34,7 @@
 #include <string.h>
 
 #include "snort_types.h"
-#include "thread.h"
+#include "main/thread.h"
 #include "sfip/sf_ipvar.h"
 #include "sfip/ipv6_port.h"
 #include "utils/sflsq.h"
index 0b349fb3dd028a8757f86e06b21c2b9e0cbf577f..d60915177afcd0877c85082c859bdfd7df956b8b 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 #include"util_jsnorm.h"
-#include"thread.h"
+#include"main/thread.h"
 
 #define INVALID_HEX_VAL -1
 #define MAX_BUF 8
index 1c334f5ed53cfc7cd533e829fbe911d9639ddec1..6dd3e855c1441369b444d2ed318c2b4e4ab64d01 100644 (file)
@@ -32,7 +32,7 @@
 /* for inet_ntoa */
 #include <arpa/inet.h>
 
-#include "thread.h"
+#include "main/thread.h"
 #include "util.h"
 
 /**