]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
refactor plugin loading so that builtins are loaded
authorRuss Combs <rucombs@cisco.com>
Wed, 21 Dec 2016 17:00:52 +0000 (12:00 -0500)
committerRuss Combs <rucombs@cisco.com>
Thu, 22 Dec 2016 02:37:01 +0000 (21:37 -0500)
with the same lists as dynamic plugins.

141 files changed:
src/CMakeLists.txt
src/Makefile.am
src/actions/act_react.cc
src/actions/act_reject.cc
src/actions/act_replace.cc
src/actions/ips_actions.cc
src/actions/ips_actions.h
src/codecs/codec_api.cc
src/codecs/codec_api.h
src/codecs/ip/cd_auth.cc
src/codecs/ip/cd_dst_opts.cc
src/codecs/ip/cd_esp.cc
src/codecs/ip/cd_frag.cc
src/codecs/ip/cd_gre.cc
src/codecs/ip/cd_hop_opts.cc
src/codecs/ip/cd_icmp4.cc
src/codecs/ip/cd_icmp6.cc
src/codecs/ip/cd_igmp.cc
src/codecs/ip/cd_ipv4.cc
src/codecs/ip/cd_ipv6.cc
src/codecs/ip/cd_mobility.cc
src/codecs/ip/cd_no_next.cc
src/codecs/ip/cd_pgm.cc
src/codecs/ip/cd_routing.cc
src/codecs/ip/cd_sun_nd.cc
src/codecs/ip/cd_swipe.cc
src/codecs/ip/cd_tcp.cc
src/codecs/ip/cd_udp.cc
src/codecs/link/cd_arp.cc
src/codecs/link/cd_ciscometadata.cc
src/codecs/link/cd_erspan2.cc
src/codecs/link/cd_erspan3.cc
src/codecs/link/cd_fabricpath.cc
src/codecs/link/cd_mpls.cc
src/codecs/link/cd_ppp_encap.cc
src/codecs/link/cd_pppoe.cc
src/codecs/link/cd_trans_bridge.cc
src/codecs/link/cd_vlan.cc
src/codecs/misc/cd_default.cc
src/codecs/misc/cd_gtp.cc
src/codecs/misc/cd_icmp4_ip.cc
src/codecs/misc/cd_icmp6_ip.cc
src/codecs/misc/cd_llc.cc
src/codecs/misc/cd_teredo.cc
src/codecs/misc/cd_user.cc
src/codecs/root/cd_eth.cc
src/connectors/connectors.cc
src/connectors/connectors.h
src/connectors/file_connector/file_connector.cc
src/connectors/tcp_connector/tcp_connector.cc
src/file_api/file_flows.cc
src/file_api/file_log.cc
src/file_api/file_service.h
src/ips_options/ips_ack.cc
src/ips_options/ips_asn1.cc
src/ips_options/ips_base64.cc
src/ips_options/ips_bufferlen.cc
src/ips_options/ips_byte_jump.cc
src/ips_options/ips_byte_test.cc
src/ips_options/ips_cvs.cc
src/ips_options/ips_dsize.cc
src/ips_options/ips_file_data.cc
src/ips_options/ips_file_type.cc
src/ips_options/ips_flags.cc
src/ips_options/ips_fragbits.cc
src/ips_options/ips_fragoffset.cc
src/ips_options/ips_gid.cc
src/ips_options/ips_icmp_id.cc
src/ips_options/ips_icmp_seq.cc
src/ips_options/ips_icode.cc
src/ips_options/ips_id.cc
src/ips_options/ips_ip_proto.cc
src/ips_options/ips_ipopts.cc
src/ips_options/ips_isdataat.cc
src/ips_options/ips_itype.cc
src/ips_options/ips_msg.cc
src/ips_options/ips_options.cc
src/ips_options/ips_options.h
src/ips_options/ips_priority.cc
src/ips_options/ips_raw_data.cc
src/ips_options/ips_rem.cc
src/ips_options/ips_replace.cc
src/ips_options/ips_rev.cc
src/ips_options/ips_rpc.cc
src/ips_options/ips_sd_pattern.cc
src/ips_options/ips_seq.cc
src/ips_options/ips_session.cc
src/ips_options/ips_sid.cc
src/ips_options/ips_soid.cc
src/ips_options/ips_tag.cc
src/ips_options/ips_tos.cc
src/ips_options/ips_ttl.cc
src/ips_options/ips_window.cc
src/loggers/alert_csv.cc
src/loggers/alert_fast.cc
src/loggers/alert_full.cc
src/loggers/alert_sf_socket.cc
src/loggers/alert_syslog.cc
src/loggers/log_codecs.cc
src/loggers/log_hext.cc
src/loggers/log_pcap.cc
src/loggers/loggers.cc
src/loggers/loggers.h
src/loggers/unified2.cc
src/main/snort.cc
src/managers/action_manager.cc
src/managers/plugin_manager.cc
src/managers/plugin_manager.h
src/network_inspectors/appid/appid_inspector.cc
src/network_inspectors/arp_spoof/arp_spoof.cc
src/network_inspectors/network_inspectors.cc
src/network_inspectors/network_inspectors.h
src/network_inspectors/packet_capture/packet_capture.cc
src/network_inspectors/port_scan/port_scan.cc
src/piglet_plugins/piglet_plugins.cc
src/piglet_plugins/piglet_plugins.h
src/search_engines/CMakeLists.txt
src/search_engines/Makefile.am
src/search_engines/ac_banded.cc
src/search_engines/ac_bnfa.cc
src/search_engines/ac_full.cc
src/search_engines/ac_sparse.cc
src/search_engines/ac_sparse_bands.cc
src/search_engines/ac_std.cc
src/search_engines/acsmx2_api.cc
src/search_engines/hyperscan.cc
src/search_engines/intel_cpm.cc
src/search_engines/search_engines.cc
src/search_engines/search_engines.h
src/search_engines/test/search_tool_test.cc
src/service_inspectors/dce_rpc/dce_common.cc
src/service_inspectors/dnp3/dnp3.cc
src/service_inspectors/gtp/gtp_inspect.cc
src/service_inspectors/http_inspect/http_api.cc
src/service_inspectors/modbus/modbus.cc
src/service_inspectors/service_inspectors.cc
src/service_inspectors/service_inspectors.h
src/service_inspectors/sip/sip.cc
src/service_inspectors/ssl/ssl_inspector.cc
src/stream/stream_inspectors.cc
src/stream/stream_inspectors.h

index b8848ede8aa047c7b23dc3d6fe6e521b713b509d..08a62d96fd714a72119623b6a73d5b6a0d1f8532 100644 (file)
@@ -71,8 +71,9 @@ add_executable( snort
 target_link_libraries( snort
     ${UNIT_TESTS_LIBRARIES}
     managers
-    loggers
+    main
     codecs
+    loggers
     ip_codecs
     misc_codecs
     ${STATIC_CODEC_LIBRARIES}
@@ -94,11 +95,10 @@ target_link_libraries( snort
     stream_file
     stream_paf
     mime
-    ${PIGLET_LIBRARIES}
     ips_options
     search_engines
     target_based
-    main
+    ${PIGLET_LIBRARIES}
     codec_module
     memory
     host_tracker
index c40bfeea9e3cb9ac65ea72ff07d7b50eadf6c899..99ec8e95a0c684cd6cac85b63b03b5331f688ebc 100644 (file)
@@ -44,11 +44,12 @@ snort_LDFLAGS = $(AM_LDFLAGS) -export-dynamic
 snort_LDADD = \
 $(test_list) \
 managers/libmanagers.a \
-loggers/libloggers.a \
+main/libmain.a \
 codecs/libcodecs.a \
 codecs/ip/libip_codecs.a \
 codecs/misc/libmisc_codecs.a \
 $(codec_list) \
+loggers/libloggers.a \
 network_inspectors/libnetwork_inspectors.a \
 network_inspectors/appid/libappid.a \
 network_inspectors/binder/libbinder.a \
@@ -76,11 +77,10 @@ stream/user/libstream_user.a \
 stream/file/libstream_file.a \
 stream/libstream_paf.a \
 mime/libmime.a \
-$(pig_list) \
 ips_options/libips_options.a \
 search_engines/libsearch_engines.a \
 target_based/libtarget_based.a \
-main/libmain.a \
+$(pig_list) \
 codecs/libcodec_module.a \
 memory/libmemory.a \
 host_tracker/libhost_tracker.a \
index 4b792dd2916cea9575d277a208c935326c578d9d..ea9be0be87c96654d045f65129b54311ce59c6c2 100644 (file)
@@ -357,11 +357,11 @@ static const ActionApi react_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* act_react[] =
+#endif
 {
     &react_api.base,
     nullptr
 };
-#else
-const BaseApi* act_react = &react_api.base;
-#endif
 
index 28501c19485083976665db8547b0f0d690a6f399..3e589d86faeed2764eb615120440cbe65dae05fc 100644 (file)
@@ -240,11 +240,11 @@ static const ActionApi rej_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* act_reject[] =
+#endif
 {
     &rej_api.base,
     nullptr
 };
-#else
-const BaseApi* act_reject = &rej_api.base;
-#endif
 
index 9e2a5229d9c9392258549758ca201376b92e1e62..c250c03ed47f80ee992c38237550cd05de0630a5 100644 (file)
@@ -203,11 +203,11 @@ static ActionApi rep_api
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* act_replace[] =
+#endif
 {
     &rep_api.base,
     nullptr
 };
-#else
-const BaseApi* act_replace = &rep_api.base;
-#endif
 
index 969a0bc4a62473309555a0766e4d982a2b915d61..79d1673f27e6ae0175a0e2ec477c4188a6848421 100644 (file)
 // ips_actions.cc author Russ Combs <rucombs@cisco.com>
 
 #include "ips_actions.h"
+#include "managers/plugin_manager.h"
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #ifdef STATIC_IPS_ACTIONS
-extern const BaseApi* act_react;
-extern const BaseApi* act_reject;
+extern const BaseApi* act_react[];
+extern const BaseApi* act_reject[];
 #endif
-extern const BaseApi* act_replace;
+extern const BaseApi* act_replace[];
 
-const BaseApi* ips_actions[] =
+void load_actions()
 {
 #ifdef STATIC_IPS_ACTIONS
-    act_react,
-    act_reject,
+    PluginManager::load_plugins(act_react);
+    PluginManager::load_plugins(act_reject);
 #endif
-    act_replace,
-    nullptr,
-};
+    PluginManager::load_plugins(act_replace);
+}
 
index 4ca691827154f73f369d49676b5bee61430d2241..a021e45dc4e3c4a709ba9fc7f7b395b74a68ae90 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef IPS_ACTIONS_H
 #define IPS_ACTIONS_H
 
-extern const struct BaseApi* ips_actions[];
+void load_actions();
 
 #endif
 
index b982d2d85a6eddf2444945370802f95af742b43d..4838efc3f4bbc424d1a3088f79c35f928e93fe9f 100644 (file)
 #endif
 
 #include "framework/codec.h"
+#include "managers/plugin_manager.h"
 
-extern const BaseApi* cd_ipv4;    // static due to dependence on fpdetect
-extern const BaseApi* cd_hopopts; // static to ensure the symbols CheckIPV6HopOptions
-                                  // and CheckIPv6ExtensionOrder the final executuable.
-extern const BaseApi* cd_tcp;     // static because only file that specific functions
-                                  //    (symbols will be removed from final executabel)
+extern const BaseApi* cd_ipv4[];    // static due to dependence on fpdetect
+extern const BaseApi* cd_hopopts[]; // static to ensure the symbols CheckIPV6HopOptions
+                                    // and CheckIPv6ExtensionOrder the final executuable.
+extern const BaseApi* cd_tcp[];     // static because only file that specific functions
+                                    // (symbols will be removed from final executabel)
 
 #ifdef STATIC_CODECS
-extern const BaseApi* cd_ah;
-extern const BaseApi* cd_arp;
-extern const BaseApi* cd_ciscometadata;
-extern const BaseApi* cd_dstopts;
-extern const BaseApi* cd_erspan2;
-extern const BaseApi* cd_erspan3;
-extern const BaseApi* cd_esp;
-extern const BaseApi* cd_eth;
-extern const BaseApi* cd_fabricpath;
-extern const BaseApi* cd_frag;
-extern const BaseApi* cd_gre;
-extern const BaseApi* cd_gtp;
-extern const BaseApi* cd_icmp4;
-extern const BaseApi* cd_icmp4_ip;
-extern const BaseApi* cd_icmp6;
-extern const BaseApi* cd_icmp6_ip;
-extern const BaseApi* cd_ipv6;
-extern const BaseApi* cd_igmp;
-extern const BaseApi* cd_llc;
-extern const BaseApi* cd_mobility;
-extern const BaseApi* cd_mpls;
-extern const BaseApi* cd_no_next;
-extern const BaseApi* cd_pgm;
-extern const BaseApi* cd_pppencap;
-extern const BaseApi* cd_pppoepkt_disc;
-extern const BaseApi* cd_pppoepkt_sess;
-extern const BaseApi* cd_routing;
-extern const BaseApi* cd_sun_nd;
-extern const BaseApi* cd_swipe;
-extern const BaseApi* cd_teredo;
-extern const BaseApi* cd_transbridge;
-extern const BaseApi* cd_udp;
-extern const BaseApi* cd_user;
-extern const BaseApi* cd_vlan;
+extern const BaseApi* cd_ah[];
+extern const BaseApi* cd_arp[];
+extern const BaseApi* cd_ciscometadata[];
+extern const BaseApi* cd_dstopts[];
+extern const BaseApi* cd_erspan2[];
+extern const BaseApi* cd_erspan3[];
+extern const BaseApi* cd_esp[];
+extern const BaseApi* cd_eth[];
+extern const BaseApi* cd_fabricpath[];
+extern const BaseApi* cd_frag[];
+extern const BaseApi* cd_gre[];
+extern const BaseApi* cd_gtp[];
+extern const BaseApi* cd_icmp4[];
+extern const BaseApi* cd_icmp4_ip[];
+extern const BaseApi* cd_icmp6[];
+extern const BaseApi* cd_icmp6_ip[];
+extern const BaseApi* cd_ipv6[];
+extern const BaseApi* cd_igmp[];
+extern const BaseApi* cd_llc[];
+extern const BaseApi* cd_mobility[];
+extern const BaseApi* cd_mpls[];
+extern const BaseApi* cd_no_next[];
+extern const BaseApi* cd_pgm[];
+extern const BaseApi* cd_pppencap[];
+extern const BaseApi* cd_pppoepkt[];
+extern const BaseApi* cd_routing[];
+extern const BaseApi* cd_sun_nd[];
+extern const BaseApi* cd_swipe[];
+extern const BaseApi* cd_teredo[];
+extern const BaseApi* cd_transbridge[];
+extern const BaseApi* cd_udp[];
+extern const BaseApi* cd_user[];
+extern const BaseApi* cd_vlan[];
 #endif
 
-const BaseApi* codecs[] =
+void load_codecs()
 {
-    cd_ipv4,
-    cd_tcp,
-    cd_hopopts,
+    PluginManager::load_plugins(cd_ipv4);
+    PluginManager::load_plugins(cd_tcp);
+    PluginManager::load_plugins(cd_hopopts);
 
 #ifdef STATIC_CODECS
-    cd_ah,
-    cd_arp,
-    cd_ciscometadata,
-    cd_dstopts,
-    cd_erspan2,
-    cd_erspan3,
-    cd_esp,
-    cd_eth,
-    cd_fabricpath,
-    cd_frag,
-    cd_gre,
-    cd_gtp,
-    cd_icmp4,
-    cd_icmp4_ip,
-    cd_icmp6,
-    cd_icmp6_ip,
-    cd_ipv6,
-    cd_igmp,
-    cd_llc,
-    cd_mobility,
-    cd_mpls,
-    cd_no_next,
-    cd_pgm,
-    cd_pppencap,
-    cd_pppoepkt_disc,
-    cd_pppoepkt_sess,
-    cd_routing,
-    cd_sun_nd,
-    cd_swipe,
-    cd_teredo,
-    cd_transbridge,
-    cd_udp,
-    cd_user,
-    cd_vlan,
+    PluginManager::load_plugins(cd_ah);
+    PluginManager::load_plugins(cd_arp);
+    PluginManager::load_plugins(cd_ciscometadata);
+    PluginManager::load_plugins(cd_dstopts);
+    PluginManager::load_plugins(cd_erspan2);
+    PluginManager::load_plugins(cd_erspan3);
+    PluginManager::load_plugins(cd_esp);
+    PluginManager::load_plugins(cd_eth);
+    PluginManager::load_plugins(cd_fabricpath);
+    PluginManager::load_plugins(cd_frag);
+    PluginManager::load_plugins(cd_gre);
+    PluginManager::load_plugins(cd_gtp);
+    PluginManager::load_plugins(cd_icmp4);
+    PluginManager::load_plugins(cd_icmp4_ip);
+    PluginManager::load_plugins(cd_icmp6);
+    PluginManager::load_plugins(cd_icmp6_ip);
+    PluginManager::load_plugins(cd_ipv6);
+    PluginManager::load_plugins(cd_igmp);
+    PluginManager::load_plugins(cd_llc);
+    PluginManager::load_plugins(cd_mobility);
+    PluginManager::load_plugins(cd_mpls);
+    PluginManager::load_plugins(cd_no_next);
+    PluginManager::load_plugins(cd_pgm);
+    PluginManager::load_plugins(cd_pppencap);
+    PluginManager::load_plugins(cd_pppoepkt);
+    PluginManager::load_plugins(cd_routing);
+    PluginManager::load_plugins(cd_sun_nd);
+    PluginManager::load_plugins(cd_swipe);
+    PluginManager::load_plugins(cd_teredo);
+    PluginManager::load_plugins(cd_transbridge);
+    PluginManager::load_plugins(cd_udp);
+    PluginManager::load_plugins(cd_user);
+    PluginManager::load_plugins(cd_vlan);
 #endif
-
-    nullptr
-};
+}
 
index cdd9540c631c7e6dceebdd6eaef5013ce8c0b773..11bf411d28fc7ac7427487b1f0816c14fd4dfb94 100644 (file)
 //--------------------------------------------------------------------------
 // codec_api.h author Josh Rosenbaum <jrosenba@cisco.com>
 
-#ifndef CODEC_CODECS_API_H
-#define CODEC_CODECS_API_H
+#ifndef CODEC_API_H
+#define CODEC_API_H
 
-extern const struct BaseApi* codecs[];
+void load_codecs();
 
 #endif
 
index 68d0c78b6c88e7ca863c17c5897f8f62efcf7c56..68b4758242774815f8e6fbfaaa707d2767ca94ee 100644 (file)
@@ -160,11 +160,11 @@ static const CodecApi ah_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_ah[] =
+#endif
 {
     &ah_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_ah = &ah_api.base;
-#endif
 
index 4029343f5153d7cc6cc8ffb66d11379e2564ceee..0787be02503822920b8d278666f2155402648a79 100644 (file)
@@ -126,11 +126,11 @@ static const CodecApi ipv6_dstopts_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_dstopts[] =
+#endif
 {
     &ipv6_dstopts_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_dstopts = &ipv6_dstopts_api.base;
-#endif
 
index ad4fc907cdb59dfb357c02dcaea7a914000eac4d..344008ffedbceecda8b1b531f2d93d31eb01589a 100644 (file)
@@ -217,11 +217,11 @@ static const CodecApi esp_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_esp[] =
+#endif
 {
     &esp_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_esp = &esp_api.base;
-#endif
 
index e199b0099e6b84e9c15a3ec4456b910511e9025b..df4e90fdc5d9b5a116dfcf2b949f147f278467ee 100644 (file)
@@ -183,11 +183,11 @@ static const CodecApi ipv6_frag_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_frag[] =
+#endif
 {
     &ipv6_frag_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_frag = &ipv6_frag_api.base;
-#endif
 
index 2cbedba8b5ffd941ae256e5d0fa417e399a5ed05..8c78b0172e8fa4c16bd0cbd17fdc7e619c4aec30 100644 (file)
@@ -265,11 +265,11 @@ static const CodecApi gre_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_gre[] =
+#endif
 {
     &gre_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_gre = &gre_api.base;
-#endif
 
index bcfa0c7c60adac04a1471c7531e7fe708177240e..55698d6fedd4d297f35a88f396b3e9afa19fd79e 100644 (file)
@@ -130,23 +130,15 @@ static const CodecApi ipv6_hopopts_api =
 
 /*  This codec is static to ensure the symbols CheckIPV6HopOptions
  *  and CheckIPv6ExtensionOrder are included in the binary.
- *
- *  If this Codec is no longer static, also edit the file codec_api.cc
  */
-#if 0
 
-#ifdef BUILDING_SO
-SO_PUBLIC const BaseApi* snort_plugins[] =
+//#ifdef BUILDING_SO
+//SO_PUBLIC const BaseApi* snort_plugins[] =
+//#else
+const BaseApi* cd_hopopts[] =
+//#endif
 {
     &ipv6_hopopts_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_hopopts = &ipv6_hopopts_api.base;
-#endif
-
-#else /* 0 */
-const BaseApi* cd_hopopts = &ipv6_hopopts_api.base;
-
-#endif /* 0 */
 
index 30597a0300f5faf7c16d39e2442b88b5d26249b4..989bcae7dbc2e5ead2a865371d5cfccd68120f82 100644 (file)
@@ -615,11 +615,11 @@ static const CodecApi icmp4_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_icmp4[] =
+#endif
 {
     &icmp4_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_icmp4 = &icmp4_api.base;
-#endif
 
index e59a8c9957ac175b193882dbd0db1421583a8169..749e183dea426cd63ef3998691e007001f8460bc 100644 (file)
@@ -405,11 +405,11 @@ static const CodecApi ipv6_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_icmp6[] =
+#endif
 {
     &ipv6_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_icmp6 = &ipv6_api.base;
-#endif
 
index fd388a937ccdf9b596b274e6f7272e0703bc3780..2a1f5deaa1e0aad588d3ff61ef0c1c9629747bc1 100644 (file)
@@ -129,11 +129,11 @@ static const CodecApi igmp_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_igmp[] =
+#endif
 {
     &igmp_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_igmp = &igmp_api.base;
-#endif
 
index 46e0ff49ee43ede817f0f39bd8e7637d80e9d766..78d866804dd2f3b11b788dcbdd684d08e47adcfa 100644 (file)
@@ -783,18 +783,13 @@ static const CodecApi ipv4_api =
     dtor, // dtor
 };
 
-#if 0
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_ipv4[] =
+#endif
 {
     &ipv4_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_ipv4 = &ipv4_api.base;
-#endif
-#endif
-
-// Currently needs to be static
-const BaseApi* cd_ipv4 = &ipv4_api.base;
 
index 6ea817a3b8558d40811ee6cb1cd628f97f5db8c3..e05f489c45692a1081705e8dae366f5750e0f3dc 100644 (file)
@@ -670,11 +670,11 @@ static const CodecApi ipv6_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_ipv6[] =
+#endif
 {
     &ipv6_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_ipv6 = &ipv6_api.base;
-#endif
 
index a8bfdc585181a0752c5c768b1357d5cf577da480..69460d701040502252dd90b501684c6afa9d709b 100644 (file)
@@ -95,11 +95,11 @@ static const CodecApi mobility_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_mobility[] =
+#endif
 {
     &mobility_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_mobility = &mobility_api.base;
-#endif
 
index 73ce9201c31737e1cd93c6f6f6f520240a11f84b..dfe719d372d4e162123161e8e33d371f9e4aaf4f 100644 (file)
@@ -104,11 +104,11 @@ static const CodecApi no_next_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_no_next[] =
+#endif
 {
     &no_next_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_no_next = &no_next_api.base;
-#endif
 
index c09f9fed676485ff68a50fd4d1822fd670e1d895..83e2be2498c01d6027ae95f19425b4984275aec1 100644 (file)
@@ -192,11 +192,11 @@ static const CodecApi pgm_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_pgm[] =
+#endif
 {
     &pgm_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_pgm = &pgm_api.base;
-#endif
 
index 587953ccdda2270dbd3bf20aeb4437bb6e2f5e7c..06df4e5a6744a4112360de16cf37971fa8a43b09 100644 (file)
@@ -154,11 +154,11 @@ static const CodecApi ipv6_routing_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_routing[] =
+#endif
 {
     &ipv6_routing_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_routing = &ipv6_routing_api.base;
-#endif
 
index 9aeeb5ee4ca691599b96700faba943ab7200a26a..bbaa036b14c0863a3db201795e05a5f0c8a548e1 100644 (file)
@@ -87,11 +87,11 @@ static const CodecApi sun_nd_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_sun_nd[] =
+#endif
 {
     &sun_nd_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_sun_nd = &sun_nd_api.base;
-#endif
 
index 5640ea8f0dd50ff0f055f8d6153541047a1b802c..608f7e067bed3ea494f0c1d82c19b3a8cb17656e 100644 (file)
@@ -84,11 +84,11 @@ static const CodecApi swipe_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_swipe[] =
+#endif
 {
     &swipe_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_swipe = &swipe_api.base;
-#endif
 
index 6c6ab6beb95cd7b66f23bbe7ce1edcb0ee809e57..571a704d6a049e8cd815c38cbaf2fb7399a8a270 100644 (file)
@@ -784,5 +784,13 @@ static const CodecApi tcp_api =
     dtor, // dtor
 };
 
-const BaseApi* cd_tcp = &tcp_api.base;
+//#ifdef BUILDING_SO
+//SO_PUBLIC const BaseApi* snort_plugins[] =
+//#else
+const BaseApi* cd_tcp[] =
+//#endif
+{
+    &tcp_api.base,
+    nullptr
+};
 
index 672dbada15f34d29f0f841aaf8d2ffa4994641f9..e42521e35656be0b91c32c672173d787c2599de0 100644 (file)
@@ -495,11 +495,11 @@ static const CodecApi udp_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_udp[] =
+#endif
 {
     &udp_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_udp = &udp_api.base;
-#endif
 
index 116cb2de90ea94337f13db815a9e7bf5b57d5193..9d669f347b65a55f97ff3103e9f26f4e364da4f9 100644 (file)
@@ -123,11 +123,11 @@ static const CodecApi arp_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_arp[] =
+#endif
 {
     &arp_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_arp = &arp_api.base;
-#endif
 
index 377e4c97364a4a458eebeb2625aa4ffcb1125dd2..17abcb5d5fcd572c14ead98feb7f8104026529c7 100644 (file)
@@ -176,11 +176,11 @@ static const CodecApi ciscometadata_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_ciscometadata[] =
+#endif
 {
     &ciscometadata_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_ciscometadata = &ciscometadata_api.base;
-#endif
 
index 457358277a9857ffd780d24ee1fcaac9a6c8a05c..32f62ee91a8957b0f215cca0b87c1231882311a2 100644 (file)
@@ -132,11 +132,11 @@ static const CodecApi erspan2_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_erspan2[] =
+#endif
 {
     &erspan2_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_erspan2 = &erspan2_api.base;
-#endif
 
index ee40181b1b97f8680489f9cefa7cb51e4173362f..69cf1c2304df99f752c9b471d5b54a28c451f71f 100644 (file)
@@ -144,11 +144,11 @@ static const CodecApi erspan3_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_erspan3[] =
+#endif
 {
     &erspan3_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_erspan3 = &erspan3_api.base;
-#endif
 
index 917b02405cc7603d7d388039a5940bf32be48286..0b1aed80d6b9756668f557621e902e116c595eb2 100644 (file)
@@ -173,11 +173,11 @@ static const CodecApi fabricpath_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_fabricpath[] =
+#endif
 {
     &fabricpath_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_fabricpath = &fabricpath_api.base;
-#endif
 
index edae2aaef55ddd44c2d1e85fcf21ec6efeb3607a..059fe39f5105e5ba8f3acfebeb33c3b24531400e 100644 (file)
@@ -390,11 +390,11 @@ static const CodecApi mpls_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_mpls[] =
+#endif
 {
     &mpls_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_mpls = &mpls_api.base;
-#endif
 
index cd2576d395edfec97272db30fa9ee5a7c62f9880..d9ba8a6f1456d787bbb8c4f0f0b3d6b68480b0b6 100644 (file)
@@ -148,11 +148,11 @@ static const CodecApi pppencap_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_pppencap[] =
+#endif
 {
     &pppencap_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_pppencap = &pppencap_api.base;
-#endif
 
index f31442415eecc045011031864ea7c2b6cc047fb4..1120202b11fe616dafeece6baa9c385994fc8c63 100644 (file)
@@ -382,13 +382,12 @@ static const CodecApi pppoepkt_sess_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_pppoepkt[] =
+#endif
 {
     &pppoepkt_disc_api.base,
     &pppoepkt_sess_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_pppoepkt_disc = &pppoepkt_disc_api.base;
-const BaseApi* cd_pppoepkt_sess = &pppoepkt_sess_api.base;
-#endif
 
index 1e3dad45c5bd129c32f17ed1078134f0c696f117..88f743e1a607020297ffa3fe851837c9fed1ba37 100644 (file)
@@ -101,11 +101,11 @@ static const CodecApi transbridge_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_transbridge[] =
+#endif
 {
     &transbridge_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_transbridge = &transbridge_api.base;
-#endif
 
index a2dbbd04d649c16b854f5081e8a4e931f4a30d5f..0c5a9f71b6e56c8efa1ee5017abdaa2cf84e5b2a 100644 (file)
@@ -164,11 +164,11 @@ static const CodecApi vlan_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_vlan[] =
+#endif
 {
     &vlan_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_vlan = &vlan_api.base;
-#endif
 
index cafe68c4dced9fcc84b09abcf6754bda65a5da93..12d4f44bb0be3df037e9303e99d5abf600bf1589 100644 (file)
@@ -71,5 +71,9 @@ static const CodecApi default_api =
     dtor, // dtor
 };
 
-const CodecApi* default_codec = &default_api;
+const CodecApi* default_codec[] =
+{
+    &default_api,
+    nullptr
+};
 
index 2c5e1ce9f2ed4e734d66875ca2868c82425ec62d..b75f0c351c1e3414368127a0a3ab5c9806bb3601 100644 (file)
@@ -293,11 +293,11 @@ static const CodecApi gtp_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_gtp[] =
+#endif
 {
     &gtp_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_gtp = &gtp_api.base;
-#endif
 
index 105ef72e30f51143c6291017d8e853738947fd5f..d71cf62f0bc229515b34116f871d67a129cfedc3 100644 (file)
@@ -337,11 +337,11 @@ static const CodecApi icmp4_ip_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_icmp4_ip[] =
+#endif
 {
     &icmp4_ip_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_icmp4_ip = &icmp4_ip_api.base;
-#endif
 
index 3f75573d3afa8896b0f16e292ceb8baf9a058c25..b18b121e5028d7063ea256500b33a83073be3557 100644 (file)
@@ -154,11 +154,11 @@ static const CodecApi icmp6_ip_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_icmp6_ip[] =
+#endif
 {
     &icmp6_ip_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_icmp6_ip = &icmp6_ip_api.base;
-#endif
 
index 39f8e2886824c162c317b519b591c581f07106d4..22abad96dbdb3536cca02386ecbdb468b8d6d720 100644 (file)
@@ -174,11 +174,11 @@ static const CodecApi llc_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_llc[] =
+#endif
 {
     &llc_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_llc = &llc_api.base;
-#endif
 
index 78ed8787e1310312678111a76a7618eca399b62c..c1fccc7dd5a3a509c925c5b639114055e50e8a5a 100644 (file)
@@ -137,11 +137,11 @@ static const CodecApi teredo_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_teredo[] =
+#endif
 {
     &teredo_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_teredo = &teredo_api.base;
-#endif
 
index 513636a2cc4be034d7d63d192b57e72f211b14ab..de4b235c8bfb14aed0d68d439bd64bd1a5bc1a73 100644 (file)
@@ -147,11 +147,11 @@ static const CodecApi user_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_user[] =
+#endif
 {
     &user_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_user = &user_api.base;
-#endif
 
index f5fc29967bf117bccf6dfc86260d227ad57da45e..afb45c4b5f5c00e1d095642d3557219e9b0277d8 100644 (file)
@@ -260,11 +260,11 @@ static const CodecApi eth_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* cd_eth[] =
+#endif
 {
     &eth_api.base,
     nullptr
 };
-#else
-const BaseApi* cd_eth = &eth_api.base;
-#endif
 
index 400a9ac8569d86f50219a53948c77619dbe82c4d..cda850530df2f8fec9d6000de8a18c48ad638742 100644 (file)
 #include "connectors.h"
 
 #include "framework/connector.h"
+#include "managers/plugin_manager.h"
 
-extern const BaseApi* file_connector;
-extern const BaseApi* tcp_connector;
+extern const BaseApi* file_connector[];
+extern const BaseApi* tcp_connector[];
 
-const BaseApi* connectors[] =
+void load_connectors()
 {
-    file_connector,
-    tcp_connector,
-    nullptr
-};
+    PluginManager::load_plugins(file_connector);
+    PluginManager::load_plugins(tcp_connector);
+}
 
index 92aa3305f7765167afed0c17b27b388af65a746a..ff923a85415f9c75b3d08c0bf2959f6651946c10 100644 (file)
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //--------------------------------------------------------------------------
 
-#ifndef CONNECTORS
-#define CONNECTORS
+#ifndef CONNECTORS_H
+#define CONNECTORS_H
 
-extern const struct BaseApi* connectors[];
+void load_connectors();
 
 #endif
 
index 594ed4fb63a3ca3b4d6d2d6f377919fa8a673079..5d48d66839f326044e3397293f614acf85ceba31 100644 (file)
@@ -353,11 +353,11 @@ const ConnectorApi file_connector_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* file_connector[] =
+#endif
 {
     &file_connector_api.base,
     nullptr
 };
-#else
-const BaseApi* file_connector = &file_connector_api.base;
-#endif
 
index b4758f94bac56d3a996e720570ff602b58231a36..fe567231152b2a5bcbc968385aa8549bc12bd130 100644 (file)
@@ -501,11 +501,11 @@ const ConnectorApi tcp_connector_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* tcp_connector[] =
+#endif
 {
     &tcp_connector_api.base,
     nullptr
 };
-#else
-const BaseApi* tcp_connector = &tcp_connector_api.base;
-#endif
 
index 0e0a4be92e1ecccea2b888ae3be6177ec0504298..6c1282470865382b2a540c5ca52e721426a2df2e 100644 (file)
@@ -302,5 +302,5 @@ static const InspectApi file_inspect_api =
     nullptr  // reset
 };
 
-const BaseApi* sin_file = &file_inspect_api.base;
+const BaseApi* sin_file_flow = &file_inspect_api.base;
 
index 0d52e2bca9bbf6f96dd2bce1837618945a8f1bf6..49c139ecbde312d64e6c0a6ce8adc0adcd3f4106 100644 (file)
@@ -302,12 +302,12 @@ static const InspectApi fl_api
     nullptr  // reset
 };
 
-extern const BaseApi* sin_file;
+extern const BaseApi* sin_file_flow;
 
-const BaseApi* file_inspectors[] =
+const BaseApi* sin_file[] =
 {
     &fl_api.base,
-    sin_file,
+    sin_file_flow,
     nullptr
 };
 
index 7392ede5b1921d5d3c8d78b122b4280abbaecbed..c2974d9b88aa478026eb548707de9125b7586e26 100644 (file)
@@ -67,6 +67,5 @@ private:
     static FileCache* file_cache;
 };
 
-extern const struct BaseApi* file_inspectors[];
 #endif
 
index e6f54f138a9b213ce5bc1365bc32cf29f331539e..447ed17a9ab14508ac25d52e4ec8fdd5945c9f52 100644 (file)
@@ -192,11 +192,11 @@ static const IpsApi ack_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_ack[] =
+#endif
 {
     &ack_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_ack = &ack_api.base;
-#endif
 
index acfbc581d31e99f20e4c8f8e2812685f1ddcd867..5a98b1204c4299092a1983757e553de5ea0deb93 100644 (file)
@@ -310,11 +310,11 @@ static const IpsApi asn1_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_asn1[] =
+#endif
 {
     &asn1_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_asn1 = &asn1_api.base;
-#endif
 
index 547a32cf8bc7e02d3fd5b860cd4dd1d9b2d95e31..0e05ed495e5cd5610213a729df42bb8c3eeabb7d 100644 (file)
@@ -355,13 +355,12 @@ static const IpsApi base64_data_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_base64[] =
+#endif
 {
     &base64_decode_api.base,
     &base64_data_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_base64_decode = &base64_decode_api.base;
-const BaseApi* ips_base64_data = &base64_data_api.base;
-#endif
 
index 237064cdb2b80a2eb9d1ef6d6a3ae728a79e3157..33136ca17d6f47ce11dafc7b5089c5e71de5102f 100644 (file)
@@ -187,11 +187,11 @@ static const IpsApi len_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_bufferlen[] =
+#endif
 {
     &len_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_bufferlen = &len_api.base;
-#endif
 
index 7fa6762b5d49fa2996bc1516d0759263afb458e4..243c4a9f16ba0716b9702e1674ba3d245ae1738a 100644 (file)
@@ -503,11 +503,11 @@ static const IpsApi byte_jump_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_byte_jump[] =
+#endif
 {
     &byte_jump_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_byte_jump = &byte_jump_api.base;
-#endif
 
index 7f0235f517a8610f0c91ed88a462bc413e50d80a..ef18a071967bc0dbfe5c149e49a618bc9e20f22c 100644 (file)
@@ -648,11 +648,11 @@ static const IpsApi byte_test_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_byte_test[] =
+#endif
 {
     &byte_test_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_byte_test = &byte_test_api.base;
-#endif
 
index a480d998f8793e5af966dd9ea1ca9565e782932a..26b75c3e9cd73528b1ae14bb1bbb8ebd36fb2b65 100644 (file)
@@ -494,11 +494,11 @@ static const IpsApi cvs_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_cvs[] =
+#endif
 {
     &cvs_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_cvs = &cvs_api.base;
-#endif
 
index bdcb269406800ab5032b8c0eb551e64967d903c2..981434819f2959ea83b0c3e8a8f39ee1895c2c8d 100644 (file)
@@ -200,11 +200,11 @@ static const IpsApi dsize_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_dsize[] =
+#endif
 {
     &dsize_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_dsize = &dsize_api.base;
-#endif
 
index 94715dffa2f537c0d7a9d6beef9249281e31ad53..d1f05058732bbf353dfb7f46a526186203e2f4db 100644 (file)
@@ -137,11 +137,11 @@ static const IpsApi file_data_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_file_data[] =
+#endif
 {
     &file_data_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_file_data = &file_data_api.base;
-#endif
 
index 543bf6bc1c0c24d5283f944a71c5d0617ee29f33..a55a446edbca961c958b973cda5e5aef55fc2630 100644 (file)
@@ -213,11 +213,11 @@ static const IpsApi file_type_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_file_type[] =
+#endif
 {
     &file_type_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_file_type = &file_type_api.base;
-#endif
 
index 3df71e4dda7c58583fa1fdefc93e213148d8bb43..874540db7dd412da9c534d609b3dd71d13e41d90 100644 (file)
@@ -490,11 +490,11 @@ static const IpsApi flags_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_flags[] =
+#endif
 {
     &flags_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_flags = &flags_api.base;
-#endif
 
index 3194eb39c45ba0d91d35ce5b92f58f4837707383..7508d18d4426e5f0d4b2799ff8adc60d255ba046 100644 (file)
@@ -460,10 +460,11 @@ static const IpsApi fragbits_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_fragbits[] =
+#endif
 {
     &fragbits_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_fragbits = &fragbits_api.base;
-#endif
+
index 06c8cdf822aceaf195c504aea178b58eed4cccea..fe8f78452386ba03881f22e97ddb92932a8d2d00 100644 (file)
@@ -193,11 +193,11 @@ static const IpsApi fragoffset_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_fragoffset[] =
+#endif
 {
     &fragoffset_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_fragoffset = &fragoffset_api.base;
-#endif
 
index de0f190914455d9dfc0c8fcfa2b05aabdec6ba9d..ca620ce87e71f6195be35383363ab00becc215e3 100644 (file)
@@ -114,11 +114,11 @@ static const IpsApi gid_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_gid[] =
+#endif
 {
     &gid_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_gid = &gid_api.base;
-#endif
 
index 487196f5dc26b647bc23f0b22fd15fc1844b345f..f57159fa51fff5575ae1e5ceb265cb9045946e46 100644 (file)
@@ -220,11 +220,11 @@ static const IpsApi icmp_id_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_icmp_id[] =
+#endif
 {
     &icmp_id_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_icmp_id = &icmp_id_api.base;
-#endif
 
index a10485e67c16262f5d2319ccee5718d822555a74..afabd2bddd33c221d9753c682e27b891f52a3523 100644 (file)
@@ -221,11 +221,11 @@ static const IpsApi icmp_seq_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_icmp_seq[] =
+#endif
 {
     &icmp_seq_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_icmp_seq = &icmp_seq_api.base;
-#endif
 
index 24909610a9b9b2d6f0501c3bb4f0475702faa708..8cb61f116769902c30e3911de39f97c92a5f5616 100644 (file)
@@ -193,11 +193,11 @@ static const IpsApi icode_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_icode[] =
+#endif
 {
     &icode_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_icode = &icode_api.base;
-#endif
 
index 1c804c74d3c245237177fd61b66addc244121ee7..afa83307b7eb4c7d1ca2710966a2f3c68836ba57 100644 (file)
@@ -193,11 +193,11 @@ static const IpsApi id_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_id[] =
+#endif
 {
     &id_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_id = &id_api.base;
-#endif
 
index 9a5c2168c36a0cfd524e72990305c6ff6dac17d2..7f8bd59debfcb7be7e575b75e9f130959f76413f 100644 (file)
@@ -320,11 +320,11 @@ static const IpsApi ip_proto_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_ip_proto[] =
+#endif
 {
     &ip_proto_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_ip_proto = &ip_proto_api.base;
-#endif
 
index 469eb6941d3a27d1606e25ce31b90653d53fb8c8..9e6ea9c6b7914a5a7e9182419f066774d3edc93f 100644 (file)
@@ -299,11 +299,11 @@ static const IpsApi ipopts_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_ipopts[] =
+#endif
 {
     &ipopts_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_ipopts = &ipopts_api.base;
-#endif
 
index b07442f5f260b9b7ea4bd63f47fe9fd1991bdd7c..d15aaab31fc2a99eff3772577355cd828e5c807a 100644 (file)
@@ -342,11 +342,11 @@ static const IpsApi isdataat_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_isdataat[] =
+#endif
 {
     &isdataat_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_isdataat = &isdataat_api.base;
-#endif
 
index 9caff5f8ec1451622012b1641d4139f672c42f4d..4ef4e6adc5a420ddc35dac1e586b14d400eb257a 100644 (file)
@@ -190,11 +190,11 @@ static const IpsApi itype_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_itype[] =
+#endif
 {
     &itype_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_itype = &itype_api.base;
-#endif
 
index eaca6cc3db3b676a3793ec5f26f58dd0297bc954..de505984e92706d3d93e7ef757767165d613e3d3 100644 (file)
@@ -117,11 +117,11 @@ static const IpsApi msg_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_msg[] =
+#endif
 {
     &msg_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_msg = &msg_api.base;
-#endif
 
index a823b558dbbc01410954908727bd97820b055dbc..f7d7b0340f3ce47ef882cdaebb59cbcdb6f28572 100644 (file)
@@ -22,7 +22,9 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+
 #include "framework/ips_option.h"
+#include "managers/plugin_manager.h"
 
 extern const BaseApi* ips_byte_extract;
 extern const BaseApi* ips_classtype;
@@ -47,44 +49,43 @@ extern const BaseApi* ips_sha512;
 extern const BaseApi* ips_so;
 
 #ifdef STATIC_IPS_OPTIONS
-extern const BaseApi* ips_ack;
-extern const BaseApi* ips_asn1;
-extern const BaseApi* ips_base64_data;
-extern const BaseApi* ips_base64_decode;
-extern const BaseApi* ips_byte_jump;
-extern const BaseApi* ips_byte_test;
-extern const BaseApi* ips_cvs;
-extern const BaseApi* ips_file_type;
-extern const BaseApi* ips_flags;
-extern const BaseApi* ips_fragbits;
-extern const BaseApi* ips_fragoffset;
-extern const BaseApi* ips_gid;
-extern const BaseApi* ips_icmp_id;
-extern const BaseApi* ips_icmp_seq;
-extern const BaseApi* ips_icode;
-extern const BaseApi* ips_id;
-extern const BaseApi* ips_ipopts;
-extern const BaseApi* ips_ip_proto;
-extern const BaseApi* ips_isdataat;
-extern const BaseApi* ips_itype;
-extern const BaseApi* ips_msg;
-extern const BaseApi* ips_priority;
-extern const BaseApi* ips_raw_data;
-extern const BaseApi* ips_rem;
-extern const BaseApi* ips_rev;
-extern const BaseApi* ips_rpc;
-extern const BaseApi* ips_seq;
-extern const BaseApi* ips_session;
-extern const BaseApi* ips_sid;
-extern const BaseApi* ips_soid;
-extern const BaseApi* ips_tag;
-extern const BaseApi* ips_tos;
-extern const BaseApi* ips_ttl;
-extern const BaseApi* ips_bufferlen;
-extern const BaseApi* ips_window;
+extern const BaseApi* ips_ack[];
+extern const BaseApi* ips_asn1[];
+extern const BaseApi* ips_base64[];
+extern const BaseApi* ips_byte_jump[];
+extern const BaseApi* ips_byte_test[];
+extern const BaseApi* ips_cvs[];
+extern const BaseApi* ips_file_type[];
+extern const BaseApi* ips_flags[];
+extern const BaseApi* ips_fragbits[];
+extern const BaseApi* ips_fragoffset[];
+extern const BaseApi* ips_gid[];
+extern const BaseApi* ips_icmp_id[];
+extern const BaseApi* ips_icmp_seq[];
+extern const BaseApi* ips_icode[];
+extern const BaseApi* ips_id[];
+extern const BaseApi* ips_ipopts[];
+extern const BaseApi* ips_ip_proto[];
+extern const BaseApi* ips_isdataat[];
+extern const BaseApi* ips_itype[];
+extern const BaseApi* ips_msg[];
+extern const BaseApi* ips_priority[];
+extern const BaseApi* ips_raw_data[];
+extern const BaseApi* ips_rem[];
+extern const BaseApi* ips_rev[];
+extern const BaseApi* ips_rpc[];
+extern const BaseApi* ips_seq[];
+extern const BaseApi* ips_session[];
+extern const BaseApi* ips_sid[];
+extern const BaseApi* ips_soid[];
+extern const BaseApi* ips_tag[];
+extern const BaseApi* ips_tos[];
+extern const BaseApi* ips_ttl[];
+extern const BaseApi* ips_bufferlen[];
+extern const BaseApi* ips_window[];
 #endif
 
-const BaseApi* ips_options[] =
+static const BaseApi* ips_options[] =
 {
     ips_byte_extract,
     ips_classtype,
@@ -107,44 +108,48 @@ const BaseApi* ips_options[] =
     ips_sha256,
     ips_sha512,
     ips_so,
+    nullptr
+};
+
+void load_ips_options()
+{
+    PluginManager::load_plugins(ips_options);
 
 #ifdef STATIC_IPS_OPTIONS
-    ips_ack,
-    ips_asn1,
-    ips_base64_data,
-    ips_base64_decode,
-    ips_byte_jump,
-    ips_byte_test,
-    ips_cvs,
-    ips_file_type,
-    ips_flags,
-    ips_fragbits,
-    ips_fragoffset,
-    ips_gid,
-    ips_icmp_id,
-    ips_icmp_seq,
-    ips_icode,
-    ips_id,
-    ips_ipopts,
-    ips_ip_proto,
-    ips_isdataat,
-    ips_itype,
-    ips_msg,
-    ips_priority,
-    ips_raw_data,
-    ips_rem,
-    ips_rev,
-    ips_rpc,
-    ips_seq,
-    ips_session,
-    ips_sid,
-    ips_soid,
-    ips_tag,
-    ips_tos,
-    ips_ttl,
-    ips_bufferlen,
-    ips_window,
+    PluginManager::load_plugins(ips_ack);
+    PluginManager::load_plugins(ips_asn1);
+    PluginManager::load_plugins(ips_base64);
+    PluginManager::load_plugins(ips_byte_jump);
+    PluginManager::load_plugins(ips_byte_test);
+    PluginManager::load_plugins(ips_cvs);
+    PluginManager::load_plugins(ips_file_type);
+    PluginManager::load_plugins(ips_flags);
+    PluginManager::load_plugins(ips_fragbits);
+    PluginManager::load_plugins(ips_fragoffset);
+    PluginManager::load_plugins(ips_gid);
+    PluginManager::load_plugins(ips_icmp_id);
+    PluginManager::load_plugins(ips_icmp_seq);
+    PluginManager::load_plugins(ips_icode);
+    PluginManager::load_plugins(ips_id);
+    PluginManager::load_plugins(ips_ipopts);
+    PluginManager::load_plugins(ips_ip_proto);
+    PluginManager::load_plugins(ips_isdataat);
+    PluginManager::load_plugins(ips_itype);
+    PluginManager::load_plugins(ips_msg);
+    PluginManager::load_plugins(ips_priority);
+    PluginManager::load_plugins(ips_raw_data);
+    PluginManager::load_plugins(ips_rem);
+    PluginManager::load_plugins(ips_rev);
+    PluginManager::load_plugins(ips_rpc);
+    PluginManager::load_plugins(ips_seq);
+    PluginManager::load_plugins(ips_session);
+    PluginManager::load_plugins(ips_sid);
+    PluginManager::load_plugins(ips_soid);
+    PluginManager::load_plugins(ips_tag);
+    PluginManager::load_plugins(ips_tos);
+    PluginManager::load_plugins(ips_ttl);
+    PluginManager::load_plugins(ips_bufferlen);
+    PluginManager::load_plugins(ips_window);
 #endif
-    nullptr
-};
+}
 
index ff7ac00eb28e649acb17441e33ded51c16f947e0..901a2a2ff43dad7557bf348850c19618a78160a7 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef IPS_OPTIONS_H
 #define IPS_OPTIONS_H
 
-extern const struct BaseApi* ips_options[];
+void load_ips_options();
 
 #endif
 
index 0b874a510c8663d0a97e916dd69a746d4bbbd5dd..701e9f4ce9eca20a10aaf448e6e2fd58235eb619 100644 (file)
@@ -114,11 +114,11 @@ static const IpsApi priority_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_priority[] =
+#endif
 {
     &priority_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_priority = &priority_api.base;
-#endif
 
index 9ef3c57edd9d40a469f5ba903922767148c56775..91da11d256cfefe4f26bced023fa8022a6a7a18b 100644 (file)
@@ -121,11 +121,11 @@ static const IpsApi raw_data_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_raw_data[] =
+#endif
 {
     &raw_data_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_raw_data = &raw_data_api.base;
-#endif
 
index dc9bbdd7f644eca8bd5dccbeef1b172e8a330db7..7ad89dcdb7d734a426f0932cdc0988b91f9dbe69 100644 (file)
@@ -109,11 +109,11 @@ static const IpsApi rem_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_rem[] =
+#endif
 {
     &rem_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_rem = &rem_api.base;
-#endif
 
index edf8ef143358549dcab5d8bdd09abe20a483abbc..209727ba0c47a67c84807f99c86d646fac73aba5 100644 (file)
@@ -293,11 +293,11 @@ static const IpsApi replace_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_replace[] =
+#endif
 {
     &replace_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_replace = &replace_api.base;
-#endif
 
index b3809b4248d28dc3db8271c2e766929c949e39dc..c568e51012aab1010e780af2c60e1fe100eed96b 100644 (file)
@@ -112,11 +112,11 @@ static const IpsApi rev_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_rev[] =
+#endif
 {
     &rev_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_rev = &rev_api.base;
-#endif
 
index c8638aa489f8bca601f45e649e4ec793135fee02..2976c1e837e56bced82bef36ba27e7630abfc619 100644 (file)
@@ -363,10 +363,11 @@ static const IpsApi rpc_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_rpc[] =
+#endif
 {
     &rpc_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_rpc = &rpc_api.base;
-#endif
+
index 4b2cf6baf3aefa8694ac744c83ea123bb9659be4..390a0f28aa041ffec1cb768067aff2908a6e20a9 100644 (file)
@@ -435,11 +435,11 @@ static const IpsApi sd_pattern_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_sd_pattern[] =
+#endif
 {
     &sd_pattern_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_sd_pattern = &sd_pattern_api.base;
-#endif
 
index 66d6bdf1624bba143b233c41e0dadeff0a7120be..9fd166906e1f10dd71fb481af16f38522818fe52 100644 (file)
@@ -187,11 +187,11 @@ static const IpsApi seq_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_seq[] =
+#endif
 {
     &seq_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_seq = &seq_api.base;
-#endif
 
index ccf03181580ec3aa6dc17f9ad3c0b6c1315e0f43..d85512ec2cd1d491584536a5071171ab58cbe450 100644 (file)
@@ -412,11 +412,11 @@ static const IpsApi session_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_session[] =
+#endif
 {
     &session_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_session = &session_api.base;
-#endif
 
index f52774d5f34dbc3b2b98499ac9a06cc55f11666c..9db9dd17e6d7c785eb1a9c8461e7e2ac6fe4774a 100644 (file)
@@ -112,11 +112,11 @@ static const IpsApi sid_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_sid[] =
+#endif
 {
     &sid_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_sid = &sid_api.base;
-#endif
 
index 57e9252e7575d0c722abd123c177baaf6432585c..ca7af2c42ed1d5ae8860109f2a53f21caef9d479 100644 (file)
@@ -117,11 +117,11 @@ static const IpsApi soid_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_soid[] =
+#endif
 {
     &soid_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_soid = &soid_api.base;
-#endif
 
index 71a221b1915f91d7ca260ac1cb7f3b747a03794a..d0f5166d962f39647b976c7133b1bc7d3015abed 100644 (file)
@@ -189,11 +189,11 @@ static const IpsApi tag_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_tag[] =
+#endif
 {
     &tag_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_tag = &tag_api.base;
-#endif
 
index f8b312cb12fbcf236bd35522cf35b2ca9c9c987d..36d933a7b294b17ab211381f6b8e6e4065771f5c 100644 (file)
@@ -190,11 +190,11 @@ static const IpsApi tos_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_tos[] =
+#endif
 {
     &tos_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_tos = &tos_api.base;
-#endif
 
index 8b75f8ee297e6f390e97b8c1aaf2c5bb5e08392c..69a0e4cd21d8ea9611c81a83b9f96930eb2aba85 100644 (file)
@@ -188,11 +188,11 @@ static const IpsApi ttl_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_ttl[] =
+#endif
 {
     &ttl_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_ttl = &ttl_api.base;
-#endif
 
index 1b981cbceaaca4965abdd0ed0603431b4c4f4b22..b49f66609089e59a6ff6ce61fbd9a24f92290d81 100644 (file)
@@ -188,11 +188,11 @@ static const IpsApi window_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* ips_window[] =
+#endif
 {
     &window_api.base,
     nullptr
 };
-#else
-const BaseApi* ips_window = &window_api.base;
-#endif
 
index 64c6cfc7538c06052f61c297559ffd15af10dfc3..e7f35f6033e42376e2e7d0ea22fbec4c113190b4 100644 (file)
@@ -562,11 +562,11 @@ static LogApi csv_api
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* alert_csv[] =
+#endif
 {
     &csv_api.base,
     nullptr
 };
-#else
-const BaseApi* alert_csv = &csv_api.base;
-#endif
 
index e57735c073e0611cc7498ef62a315795505dd651..e62741a53e992f1c245c5fcc2b0f8d77f1c5c273 100644 (file)
@@ -278,11 +278,11 @@ static LogApi fast_api
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* alert_fast[] =
+#endif
 {
     &fast_api.base,
     nullptr
 };
-#else
-const BaseApi* alert_fast = &fast_api.base;
-#endif
 
index cb2ab821a2c2963d12c12c06fb86eed8af7b785d..b5e411984516746e7522693d57bacaac10e98d2a 100644 (file)
@@ -290,11 +290,11 @@ static LogApi full_api
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* alert_full[] =
+#endif
 {
     &full_api.base,
     nullptr
 };
-#else
-const BaseApi* alert_full = &full_api.base;
-#endif
 
index 5d6bb18301bc2e0c099a6eba42692d8e5e927354..96daa14a649c4ba314843ff0a7d3afaecc8d4e58 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #endif
 
-#if defined(__linux__)
+#ifdef __linux__
 #include <sys/socket.h>
 #include <sys/un.h>
 
@@ -415,8 +415,13 @@ static LogApi sf_sock_api
     sf_sock_ctor,
     sf_sock_dtor
 };
-
-const BaseApi* alert_sf_socket = &sf_sock_api.base;
-
 #endif   /* __linux__ */
 
+const BaseApi* alert_sf_socket[] =
+{
+#ifdef __linux__
+    &sf_sock_api.base,
+#endif
+    nullptr
+};
+
index 24a43e54345cbb4bb34d4a1cfa0d194b685044e7..a64bc948aee592447edb51466a71b66dc26dc731 100644 (file)
@@ -371,11 +371,11 @@ static LogApi syslog_api
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* alert_syslog[] =
+#endif
 {
     &syslog_api.base,
     nullptr
 };
-#else
-const BaseApi* alert_syslog = &syslog_api.base;
-#endif
 
index f0081d09c42e040713acd4cfe2ba037fd29ee2fe..66b9ef610153e2cd19ed29c4eecadef6824f0b04 100644 (file)
@@ -201,5 +201,9 @@ static const LogApi log_codecs_api =
     codec_log_dtor
 };
 
-const BaseApi* log_codecs = &log_codecs_api.base;
+const BaseApi* log_codecs[] =
+{
+    &log_codecs_api.base,
+    nullptr
+};
 
index aa91e8ef1cacda1c400ada06caa8685a5e6cef29..658c7d76588cee117f17b51a3d0c484e73e0494d 100644 (file)
@@ -279,11 +279,11 @@ static const LogApi hext_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* log_hext[] =
+#endif
 {
     &hext_api.base,
     nullptr
 };
-#else
-const BaseApi* log_hext = &hext_api.base;
-#endif
 
index e6fd0e09d8f180a21e7b1aef35bbd96de5d6f206..4c7c69f8d5166085867eaa8af318f9636e7c30f1 100644 (file)
@@ -371,11 +371,11 @@ static LogApi tcpdump_api
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* log_pcap[] =
+#endif
 {
     &tcpdump_api.base,
     nullptr
 };
-#else
-const BaseApi* log_pcap = &tcpdump_api.base;
-#endif
 
index 6deb62d5c998be2b3fc69168bd1e208ac4281d66..88532879ecdb8885105403a990d8d353d60e1297 100644 (file)
 #endif
 
 #include "framework/logger.h"
+#include "managers/plugin_manager.h"
 
 // to ensure PacketManager::log_protocols() is built into Snort++
-extern const BaseApi* log_codecs;
-
-#if defined(__linux__)
-extern const BaseApi* alert_sf_socket;
-#endif
+extern const BaseApi* log_codecs[];
+extern const BaseApi* alert_sf_socket[];
 
 #ifdef STATIC_LOGGERS
-extern const BaseApi* alert_csv;
-extern const BaseApi* alert_fast;
-extern const BaseApi* alert_full;
-extern const BaseApi* alert_syslog;
-extern const BaseApi* log_hext;
-extern const BaseApi* log_pcap;
-extern const BaseApi* eh_unified2;
+extern const BaseApi* alert_csv[];
+extern const BaseApi* alert_fast[];
+extern const BaseApi* alert_full[];
+extern const BaseApi* alert_syslog[];
+extern const BaseApi* log_hext[];
+extern const BaseApi* log_pcap[];
+extern const BaseApi* eh_unified2[];
 #endif
 
-const BaseApi* loggers[] =
+void load_loggers()
 {
     // loggers
-    log_codecs,
-
-#if defined(__linux__)
-    alert_sf_socket,
-#endif
+    PluginManager::load_plugins(log_codecs);
+    PluginManager::load_plugins(alert_sf_socket);
 
 #ifdef STATIC_LOGGERS
     // alerters
-    alert_csv,
-    alert_fast,
-    alert_full,
-    alert_syslog,
+    PluginManager::load_plugins(alert_csv);
+    PluginManager::load_plugins(alert_fast);
+    PluginManager::load_plugins(alert_full);
+    PluginManager::load_plugins(alert_syslog);
 
     // loggers
-    log_hext,
-    log_pcap,
+    PluginManager::load_plugins(log_hext);
+    PluginManager::load_plugins(log_pcap);
 
     // both
-    eh_unified2,
+    PluginManager::load_plugins(eh_unified2);
 #endif
-
-    nullptr
-};
+}
 
index 59dcda5d3727c7cc518bd8aca180e402cbba79d8..085f20cd1fa01650350fb8444e523e134825c660 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef LOGGERS_H
 #define LOGGERS_H
 
-extern const struct BaseApi* loggers[];
+void load_loggers();
 
 #endif
 
index b724db24a5cb78326e6626ebfe06bc75e46b58bb..a93641a2f9567743df2191258928667d03cb82ab 100644 (file)
@@ -984,11 +984,11 @@ static LogApi u2_api
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* eh_unified2[] =
+#endif
 {
     &u2_api.base,
     nullptr
 };
-#else
-const BaseApi* eh_unified2 = &u2_api.base;
-#endif
 
index a57ddfb04e529d3def7a525a73210e4732e32cd3..ab7b8b0059161fc0c572e6367988fec1d44c45d0 100644 (file)
@@ -35,6 +35,9 @@
 #include <netinet/in.h>
 #include <sys/stat.h>
 
+#include "actions/ips_actions.h"
+#include "codecs/codec_api.h"
+#include "connectors/connectors.h"
 #include "decompress/file_decomp.h"
 #include "detection/detect.h"
 #include "detection/detection_util.h"
 #include "helpers/process.h"
 #include "host_tracker/host_cache.h"
 #include "ips_options/ips_flowbits.h"
+#include "ips_options/ips_options.h"
 #include "latency/packet_latency.h"
 #include "latency/rule_latency.h"
 #include "log/messages.h"
+#include "loggers/loggers.h"
 #include "managers/action_manager.h"
 #include "managers/codec_manager.h"
 #include "managers/inspector_manager.h"
@@ -62,6 +67,7 @@
 #include "managers/mpse_manager.h"
 #include "managers/plugin_manager.h"
 #include "managers/script_manager.h"
+#include "network_inspectors/network_inspectors.h"
 #include "packet_io/sfdaq.h"
 #include "packet_io/active.h"
 #include "packet_io/trough.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 #include "protocols/packet_manager.h"
+#include "search_engines/search_engines.h"
+#include "service_inspectors/service_inspectors.h"
 #include "side_channel/side_channel.h"
 #include "stream/stream.h"
+#include "stream/stream_inspectors.h"
 #include "target_based/sftarget_reader.h"
 #include "time/packet_time.h"
 #include "time/periodic.h"
@@ -84,6 +93,7 @@
 #ifdef PIGLET
 #include "piglet/piglet.h"
 #include "piglet/piglet_manager.h"
+#include "piglet_plugins/piglet_plugins.h"
 #endif
 
 #include "build.h"
@@ -214,6 +224,19 @@ void Snort::init(int argc, char** argv)
     InitProtoNames();
     SFAT_Init();
 
+    load_actions();
+    load_codecs();
+    load_connectors();
+    load_ips_options();
+    load_loggers();
+#ifdef PIGLET
+    load_piglets();
+#endif
+    load_search_engines();
+    load_stream_inspectors();
+    load_network_inspectors();
+    load_service_inspectors();
+
     /* chew up the command line */
     snort_cmd_line_conf = parse_cmd_line(argc, argv);
     snort_conf = snort_cmd_line_conf;
index 9a94a95c2e6946801ab160a5cd2afe3e241cd0d8..954fc319e073e8d272a6a0f7cebc879538444c37 100644 (file)
 
 #include <list>
 
+#include "actions/act_replace.h"
+#include "actions/ips_actions.h"
+#include "framework/ips_action.h"
+#include "log/messages.h"
 #include "main/snort_types.h"
 #include "main/snort_config.h"
 #include "main/snort_debug.h"
-#include "utils/util.h"
 #include "managers/module_manager.h"
-#include "framework/ips_action.h"
 #include "parser/parser.h"
-#include "log/messages.h"
-#include "actions/act_replace.h"
 #include "packet_io/active.h"
+#include "utils/util.h"
 
 using namespace std;
 
index ac70ab946f7c111d02bdf4a4a09052f765d78010..521fe8eab71f28b1a72686c489ac96dda013265f 100644 (file)
 #include <vector>
 #include <iostream>
 
-#include "action_manager.h"
-#include "event_manager.h"
-#include "inspector_manager.h"
-#include "ips_manager.h"
-#include "module_manager.h"
-#include "mpse_manager.h"
-#include "codec_manager.h"
-#include "script_manager.h"
-#include "so_manager.h"
-
 #ifdef PIGLET
 #include "piglet/piglet_api.h"
 #include "piglet/piglet_manager.h"
-#include "piglet_plugins/piglet_plugins.h"
 #endif
 
-#include "connector_manager.h"
-#include "connectors/connectors.h"
-
 #include "framework/codec.h"
 #include "framework/logger.h"
 #include "framework/ips_action.h"
 #include "framework/mpse.h"
 #include "framework/so_rule.h"
 
-#include "loggers/loggers.h"
-#include "ips_options/ips_options.h"
-#include "actions/ips_actions.h"
 #include "log/messages.h"
-#include "stream/stream_inspectors.h"
-#include "network_inspectors/network_inspectors.h"
-#include "service_inspectors/service_inspectors.h"
-#include "search_engines/search_engines.h"
-#include "codecs/codec_api.h"
 #include "helpers/directory.h"
 #include "helpers/markup.h"
 #include "parser/parser.h"
-#include "file_api/file_service.h"
+
+#include "action_manager.h"
+#include "connector_manager.h"
+#include "event_manager.h"
+#include "inspector_manager.h"
+#include "ips_manager.h"
+#include "module_manager.h"
+#include "mpse_manager.h"
+#include "codec_manager.h"
+#include "script_manager.h"
+#include "so_manager.h"
 
 using namespace std;
 
@@ -401,23 +389,14 @@ static void unload_plugins()
 // framework methods
 //-------------------------------------------------------------------------
 
-void PluginManager::load_plugins(const std::string& paths)
+void PluginManager::load_plugins(const BaseApi** lp)
 {
     // builtins
-    load_list(codecs);
-    load_list(ips_actions);
-    load_list(ips_options);
-    load_list(stream_inspectors);
-    load_list(network_inspectors);
-    load_list(service_inspectors);
-    load_list(search_engines);
-    load_list(loggers);
-    load_list(connectors);
-    load_list(file_inspectors);
-#ifdef PIGLET
-    load_list(piglets);
-#endif
+    load_list(lp);
+}
 
+void PluginManager::load_plugins(const std::string& paths)
+{
     // dynamic plugins
     if ( !paths.empty() )
         ::load_plugins(paths);
index 9885913d4afe251bcbb51e2194f199ca73c7473a..1c97cd0c9134e243df10ebfef1d2ad55c260dd7a 100644 (file)
@@ -44,7 +44,9 @@ class PluginManager
 {
 public:
     // plugin methods
+    static void load_plugins(const BaseApi**);
     static void load_plugins(const std::string& lib_paths);
+
     static void list_plugins();
     static void show_plugins();
     static void dump_plugins();
index 3cc93775a08bde1a252169c7f2636ca4e4b750aa..75bfda4d111d9b2c618fac3263c4799b3fa1c737 100644 (file)
@@ -227,18 +227,18 @@ const InspectApi appid_inspector_api =
     nullptr  // reset
 };
 
-#ifdef BUILDING_SO
 extern const BaseApi* ips_appid;
 
+#ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* nin_appid[] =
+#endif
 {
     &appid_inspector_api.base,
     ips_appid,
     nullptr
 };
-#else
-const BaseApi* nin_appid = &appid_inspector_api.base;
-#endif
 
 /**
  * @returns 1 if some appid is found, 0 otherwise.
index 0e75ed757cb1151cc2e30b9fc67f89e12d7df9fd..579c7965dbe121a78140ca9a1ede7c183bdc9b2c 100644 (file)
@@ -317,11 +317,11 @@ static const InspectApi as_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* nin_arp_spoof[] =
+#endif
 {
     &as_api.base,
     nullptr
 };
-#else
-const BaseApi* nin_arp_spoof = &as_api.base;
-#endif
 
index 8afcb029bc12029f48334bbc526b5b292629c799..3c02009ed0284ef7a482332eeeeecc1815b56a42 100644 (file)
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+
 #include "framework/inspector.h"
+#include "managers/plugin_manager.h"
 
-extern const BaseApi* nin_appid;
 extern const BaseApi* nin_binder;
 extern const BaseApi* nin_normalize;
 extern const BaseApi* nin_perf_monitor;
-extern const BaseApi* nin_port_scan_global;
-extern const BaseApi* nin_port_scan;
 extern const BaseApi* nin_reputation;
 
-extern const BaseApi* ips_appid;
+extern const BaseApi* nin_appid[];
+extern const BaseApi* nin_port_scan[];
 
 #ifdef STATIC_INSPECTORS
-extern const BaseApi* nin_arp_spoof;
-extern const BaseApi* nin_packet_capture;
+extern const BaseApi* nin_arp_spoof[];
+extern const BaseApi* nin_packet_capture[];
 #endif
 
-const BaseApi* network_inspectors[] =
+static const BaseApi* network_inspectors[] =
 {
-    nin_appid,
     nin_binder,
     nin_normalize,
     nin_perf_monitor,
-    nin_port_scan_global,
-    nin_port_scan,
     nin_reputation,
+    nullptr
+};
 
-    ips_appid,
+void load_network_inspectors()
+{
+    PluginManager::load_plugins(network_inspectors);
+    PluginManager::load_plugins(nin_appid);
+    PluginManager::load_plugins(nin_port_scan);
 
 #ifdef STATIC_INSPECTORS
-    nin_arp_spoof,
-    nin_packet_capture,
+    PluginManager::load_plugins(nin_arp_spoof);
+    PluginManager::load_plugins(nin_packet_capture);
 #endif
-    nullptr
-};
+}
 
index 66f163284d5f45a38bd972bc81bee6b2ac598358..c798a08ca0b4f4e784b5e641dce6fe3a94d9593e 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef NETWORK_INSPECTORS_H
 #define NETWORK_INSPECTORS_H
 
-extern const struct BaseApi* network_inspectors[];
+void load_network_inspectors();
 
 #endif
 
index d3cb6f658be6a89a51dd785f33e1048cfc7255c4..4ffeb8a6815bce9c6e56548a358ab39e63d02326 100644 (file)
@@ -213,13 +213,13 @@ static const InspectApi pc_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* nin_packet_capture[] =
+#endif
 {
     &pc_api.base,
     nullptr
 };
-#else
-const BaseApi* nin_packet_capture = &pc_api.base;
-#endif
 
 #ifdef UNIT_TEST
 static Packet* init_null_packet()
index 3736307ef6678d1ac6eaf2a0742b33ee14b6a089..c00c842c2478666b039fc489a66527c31a44889b 100644 (file)
@@ -1038,13 +1038,12 @@ static const InspectApi sp_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* nin_port_scan[] =
+#endif
 {
     &sd_api.base,
     &sp_api.base,
     nullptr
 };
-#else
-const BaseApi* nin_port_scan_global = &sd_api.base;
-const BaseApi* nin_port_scan = &sp_api.base;
-#endif
 
index f5c2da3346533c30de0290d2634f9c53e37e4701..d1c520267355dfceabd3ea7f6b61df1e53b1c94b 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "piglet_plugins.h"
 
+#include "managers/plugin_manager.h"
+
 extern const BaseApi* pp_codec;
 extern const BaseApi* pp_inspector;
 extern const BaseApi* pp_ips_action;
@@ -28,7 +30,8 @@ extern const BaseApi* pp_search_engine;
 extern const BaseApi* pp_so_rule;
 extern const BaseApi* pp_test;
 
-const struct BaseApi* piglets[] = {
+static const BaseApi* pp_piglets[] =
+{
     pp_codec,
     pp_inspector,
     pp_ips_action,
@@ -40,3 +43,8 @@ const struct BaseApi* piglets[] = {
     nullptr
 };
 
+void load_piglets()
+{
+    PluginManager::load_plugins(pp_piglets);
+}
+
index 31d3afa38f7d5f54cf2ecf810f5d38de5368d45e..283a8dccbc2d5a1eafefa9114777cfd376700bb4 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef PIGLET_PLUGINS_H
 #define PIGLET_PLUGINS_H
 
-extern const struct BaseApi* piglets[];
+void load_piglets();
 
 #endif
 
index 3166be46f37593b61e44654895ebfde26eecfe24..06ed9d00987cb30363a5cabc57d83d6bd404ef71 100644 (file)
@@ -18,6 +18,7 @@ set (ACSMX2_SOURCES
     ac_sparse_bands.cc
     acsmx2.cc
     acsmx2.h
+    acsmx2_api.cc
 )
 
 set (BNFA_SOURCES
@@ -66,7 +67,7 @@ else ( STATIC_SEARCH_ENGINES)
     )
 
     add_shared_library(acsmx search_engines ${ACSMX_SOURCES})
-    add_shared_library(acsmx2 search_engines ${ACSMX2_SOURCES} acsmx2_api.cc)
+    add_shared_library(acsmx2 search_engines ${ACSMX2_SOURCES})
 
 endif (STATIC_SEARCH_ENGINES)
 
index 99a1131dec85c6b9180193294d04fda50579fe9e..2ca19c1282e57276fa3f6a883aec827d9cc6116e 100644 (file)
@@ -19,7 +19,8 @@ ac_full.cc \
 ac_sparse.cc \
 ac_sparse_bands.cc \
 acsmx2.cc \
-acsmx2.h
+acsmx2.h \
+acsmx2_api.cc
 
 bnfa_sources = \
 ac_bnfa.cc \
@@ -64,7 +65,7 @@ libacsmx_la_SOURCES = $(acsmx_sources)
 mpselib_LTLIBRARIES += libacsmx2.la
 libacsmx2_la_CXXFLAGS = $(AM_CXXFLAGS) -DBUILDING_SO
 libacsmx2_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -shared
-libacsmx2_la_SOURCES = $(acsmx2_sources) acsmx2_api.cc
+libacsmx2_la_SOURCES = $(acsmx2_sources)
 endif
 
 if BUILD_CPPUTESTS
index 2dcde3cd8f5e252b696c1d933c5fdb1cab31fd52..2e4ddddbf95539c21df33f8ba84b35a820baa90d 100644 (file)
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //--------------------------------------------------------------------------
 
-#include "acsmx.h"
-#include "acsmx2.h"
-
+#include "framework/mpse.h"
 #include "main/snort_debug.h"
 #include "main/snort_types.h"
 #include "main/snort_config.h"
-#include "utils/util.h"
 #include "profiler/profiler.h"
-#include "framework/mpse.h"
+#include "utils/util.h"
+
+#include "acsmx.h"
+#include "acsmx2.h"
 
 //-------------------------------------------------------------------------
 // "ac_banded"
index 1afa1aaed74e875bca3765940c3a0208aa3c5bae..f0c56f3cbed481b9b3edc1bfe81fda057be37d5d 100644 (file)
 *   3/06 - Added AC_BNFA search
 */
 
-#include "bnfa_search.h"
-
+#include "framework/mpse.h"
 #include "main/snort_debug.h"
 #include "main/snort_types.h"
 #include "main/snort_config.h"
-#include "utils/util.h"
 #include "profiler/profiler.h"
-#include "framework/mpse.h"
+#include "utils/util.h"
+
+#include "bnfa_search.h"
 
 //-------------------------------------------------------------------------
 // "ac_bnfa"
@@ -150,5 +150,9 @@ static const MpseApi bnfa_api =
     bnfa_print,
 };
 
-const BaseApi* se_ac_bnfa = &bnfa_api.base;
+const BaseApi* se_ac_bnfa[] =
+{
+    &bnfa_api.base,
+    nullptr
+};
 
index b73fbfedd95598ab506a9400d5aef61d321e99b4..3264ce4edd20944ad6450595d02f95d7fd6e951e 100644 (file)
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //--------------------------------------------------------------------------
 
-#include "acsmx.h"
-#include "acsmx2.h"
-
+#include "framework/mpse.h"
 #include "main/snort_debug.h"
 #include "main/snort_types.h"
 #include "main/snort_config.h"
-#include "utils/util.h"
 #include "profiler/profiler.h"
-#include "framework/mpse.h"
+#include "utils/util.h"
+
+#include "acsmx.h"
+#include "acsmx2.h"
 
 //-------------------------------------------------------------------------
 // "ac_full"
index 41351b894d1e36e945c1ad890bc2652fec502b93..ab104a051ebb7140ff8a151138b98e665c639413 100644 (file)
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //--------------------------------------------------------------------------
 
-#include "acsmx.h"
-#include "acsmx2.h"
-
+#include "framework/mpse.h"
 #include "main/snort_debug.h"
 #include "main/snort_types.h"
 #include "main/snort_config.h"
-#include "utils/util.h"
 #include "profiler/profiler.h"
-#include "framework/mpse.h"
+#include "utils/util.h"
+
+#include "acsmx.h"
+#include "acsmx2.h"
 
 //-------------------------------------------------------------------------
 // "ac_sparse"
index 57417fc73d3c3c4ad4c2eb4136dd9aad23fb4854..97ebebcb6787f80ac498d4dc301ec8f5c78ef598 100644 (file)
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //--------------------------------------------------------------------------
 
-#include "acsmx.h"
-#include "acsmx2.h"
-
+#include "framework/mpse.h"
 #include "main/snort_debug.h"
 #include "main/snort_types.h"
 #include "main/snort_config.h"
-#include "utils/util.h"
 #include "profiler/profiler.h"
-#include "framework/mpse.h"
+#include "utils/util.h"
+
+#include "acsmx.h"
+#include "acsmx2.h"
 
 //-------------------------------------------------------------------------
 // "ac_sparse_bands"
index 58743354cdba8b485f0b225cb3a4e5125f82d189..c8384f1e14e7e63d527921d7999353019686b39e 100644 (file)
 #include "config.h"
 #endif
 
-#include "acsmx.h"
-#include "acsmx2.h"
-
+#include "framework/mpse.h"
 #include "main/snort_debug.h"
 #include "main/snort_types.h"
 #include "main/snort_config.h"
-#include "utils/util.h"
 #include "profiler/profiler.h"
-#include "framework/mpse.h"
+#include "utils/util.h"
+
+#include "acsmx.h"
+#include "acsmx2.h"
 
 //-------------------------------------------------------------------------
 // "ac_std"
@@ -124,11 +124,11 @@ static const MpseApi ac_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* se_ac_std[] =
+#endif
 {
     &ac_api.base,
     nullptr
 };
-#else
-const BaseApi* se_ac_std = &ac_api.base;
-#endif
 
index c6b5fb36795652c0e853f726cd286487d2a22bc7..6b65cf911d187b1cddf962c9eec89bf8bc446a5e 100644 (file)
 #include "config.h"
 #endif
 
-#include "search_engines.h"
 #include "framework/mpse.h"
+#include "search_engines.h"
 
-#ifdef BUILDING_SO
 extern const BaseApi* se_ac_banded;
 extern const BaseApi* se_ac_full;
 extern const BaseApi* se_ac_sparse;
 extern const BaseApi* se_ac_sparse_bands;
 
+#ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* se_acsmx2[] =
+#endif
 {
     se_ac_banded,
     se_ac_full,
@@ -38,5 +41,4 @@ SO_PUBLIC const BaseApi* snort_plugins[] =
     se_ac_sparse_bands,
     nullptr
 };
-#endif
 
index 57153a531688e26a866532b888328f970597e7ba..7349ff9bb4fb413b1e8fb5203fe98dbd94cf5f22 100644 (file)
@@ -362,11 +362,11 @@ static const MpseApi hs_api =
 
 //#ifdef BUILDING_SO
 //SO_PUBLIC const BaseApi* snort_plugins[] =
-//{
-//    &hs_api.base,
-//    nullptr
-//};
 //#else
-const BaseApi* se_hyperscan = &hs_api.base;
+const BaseApi* se_hyperscan[] =
 //#endif
+{
+    &hs_api.base,
+    nullptr
+};
 
index 10b0c5b56b6d1ad93dbc5d3c748d168c80dae764..13179bdb7de2e1f90a3b48d29d96cbe79669a30a 100644 (file)
 #include "config.h"
 #endif
 
+#include "framework/mpse.h"
 #include "main/snort_debug.h"
 #include "main/snort_types.h"
 #include "main/snort_config.h"
-#include "utils/util.h"
 #include "profiler/profiler.h"
-#include "framework/mpse.h"
+#include "utils/util.h"
 
 //-------------------------------------------------------------------------
 // "intel_cpm"
@@ -149,13 +149,13 @@ static const MpseApi cpm_api =
 
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* se_intel_cpm[] =
+#endif
 {
     &cpm_api.base,
     nullptr
 };
-#else
-const BaseApi* se_intel_cpm = &cpm_api.base;
-#endif
 
 #endif
 
index d2b6346c3a9b72a64326d195983504d2f241f820..a758a7d42a20bb366f0015ea164fa8e0c4a59531 100644 (file)
 #include "config.h"
 #endif
 
-struct BaseApi;
+#include "managers/plugin_manager.h"
 
-extern const BaseApi* se_ac_bnfa;
+struct BaseApi;
+extern const BaseApi* se_ac_bnfa[];
 
 #ifdef INTEL_SOFT_CPM
-extern const BaseApi* se_intel_cpm;
+extern const BaseApi* se_intel_cpm[];
 #endif
 
 #ifdef HAVE_HYPERSCAN
-extern const BaseApi* se_hyperscan;
+extern const BaseApi* se_hyperscan[];
 #endif
 
 #ifdef STATIC_SEARCH_ENGINES
-extern const BaseApi* se_ac_banded;
-extern const BaseApi* se_ac_full;
-extern const BaseApi* se_ac_sparse;
-extern const BaseApi* se_ac_sparse_bands;
-extern const BaseApi* se_ac_std;
+extern const BaseApi* se_ac_std[];
+extern const BaseApi* se_acsmx2[];
 #endif
 
-const BaseApi* search_engines[] =
+void load_search_engines()
 {
-    se_ac_bnfa,
+    PluginManager::load_plugins(se_ac_bnfa);
 
 #ifdef INTEL_SOFT_CPM
-    se_intel_cpm,
+    PluginManager::load_plugins(se_intel_cpm);
 #endif
 
 #ifdef HAVE_HYPERSCAN
-    se_hyperscan,
+    PluginManager::load_plugins(se_hyperscan);
 #endif
 
 #ifdef STATIC_SEARCH_ENGINES
-    se_ac_banded,
-    se_ac_full,
-    se_ac_sparse,
-    se_ac_sparse_bands,
-    se_ac_std,
+    PluginManager::load_plugins(se_ac_std);
+    PluginManager::load_plugins(se_acsmx2);
 #endif
-
-    nullptr
-};
+}
 
index 0bcd9156d8132d0419b50b7a0b2ba482ed46c737..02e3f9d1ae5464b7a2f196c3bc82120251f70f5b 100644 (file)
@@ -21,7 +21,7 @@
 
 struct BaseApi;
 
-extern const BaseApi* search_engines[];
+void load_search_engines();
 
 #endif
 
index 99fa6de29d8005dcf75c14837be3defae5fba992..a82c5db71b49a8474189b1503b59f5fac3aaf117 100644 (file)
@@ -111,17 +111,17 @@ static MpseAgent s_agent =
     [](void** ppl) { CHECK(*ppl == s_list); }
 };
 
-extern const BaseApi* se_ac_full;
-const MpseApi* mpse_api = (MpseApi*)se_ac_full;
+extern const BaseApi* se_ac_bnfa;
+const MpseApi* mpse_api = (MpseApi*)se_ac_bnfa;
 Mpse* acf = nullptr;
 
 Mpse* MpseManager::get_search_engine(const char *type)
 {
     acf = nullptr;
 
-    if(strcmp(type, "ac_full") == 0)
+    if(strcmp(type, "ac_bnfa") == 0)
     {
-        CHECK(se_ac_full);
+        CHECK(se_ac_bnfa);
         mpse_api->init();
         acf = mpse_api->ctor(snort_conf, nullptr, false, &s_agent);
         CHECK(acf);
@@ -168,18 +168,13 @@ TEST_GROUP(search_tool_tests)
 {
     void setup()
     {
-        CHECK(se_ac_full);
+        CHECK(se_ac_bnfa);
     }
 };
 
-TEST(search_tool_tests, ac_full)
+TEST(search_tool_tests, ac_bnfa)
 {
-    // get_search_engine returns nullptr any search engine other than ac_full.
     SearchTool *stool = new SearchTool;
-    CHECK(!stool->mpse);
-    delete stool;
-
-    stool = new SearchTool("ac_full");
     CHECK(stool->mpse);
 
     pattern_id = 1;
@@ -206,9 +201,9 @@ TEST(search_tool_tests, ac_full)
     delete stool;
 }
 
-TEST(search_tool_tests, search_all_ac_full)
+TEST(search_tool_tests, search_all_ac_bnfa)
 {
-    SearchTool *stool = new SearchTool("ac_full");
+    SearchTool *stool = new SearchTool("ac_bnfa");
     CHECK(stool->mpse);
 
     pattern_id = 1;
index dd3f7b1720c001d1501d03ea3f9fe0cd31eae83f..c51a31b04fb3004d4ee8557d07a9e93eb138c9fb 100644 (file)
@@ -577,13 +577,15 @@ DCE2_Ret DCE2_AddDataToRpkt(Packet* rpkt, const uint8_t* data, uint32_t data_len
     return DCE2_RET__SUCCESS;
 }
 
-#ifdef BUILDING_SO
-
 extern const BaseApi* ips_dce_iface;
 extern const BaseApi* ips_dce_opnum;
 extern const BaseApi* ips_dce_stub_data;
 
+#ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* sin_dce[] =
+#endif
 {
     &dce2_tcp_api.base,
     &dce2_smb_api.base,
@@ -593,11 +595,4 @@ SO_PUBLIC const BaseApi* snort_plugins[] =
     ips_dce_stub_data,
     nullptr
 };
-#else
-
-const BaseApi* sin_dce_tcp = &dce2_tcp_api.base;
-const BaseApi* sin_dce_smb = &dce2_smb_api.base;
-const BaseApi* sin_dce_udp = &dce2_udp_api.base;
-
-#endif
 
index ad46cefed17b9b02f6e6f40625dbbcf70bde42cc..e145bc27d35a6fcf0ff7f115c3670b5db56d0a72 100644 (file)
@@ -317,13 +317,17 @@ const InspectApi dnp3_api =
     nullptr, // ssn
     nullptr  // reset
 };
-#ifdef BUILDING_SO
+
 extern const BaseApi* ips_dnp3_func;
 extern const BaseApi* ips_dnp3_ind;
 extern const BaseApi* ips_dnp3_obj;
 extern const BaseApi* ips_dnp3_data;
 
+#ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* sin_dnp3[] =
+#endif
 {
     &dnp3_api.base,
     ips_dnp3_func,
@@ -332,7 +336,4 @@ SO_PUBLIC const BaseApi* snort_plugins[] =
     ips_dnp3_data,
     nullptr
 };
-#else
-const BaseApi* sin_dnp3 = &dnp3_api.base;
-#endif
 
index 48d4f8a0ed61d8125bbbeae5b59e2381880019a3..6d4115e2858b78f73c7f37dd95d888a0750386b2 100644 (file)
@@ -207,12 +207,15 @@ static const InspectApi gtp_api =
     nullptr  // reset
 };
 
-#ifdef BUILDING_SO
 extern const BaseApi* ips_gtp_info;
 extern const BaseApi* ips_gtp_type;
 extern const BaseApi* ips_gtp_version;
 
+#ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* sin_gtp[] =
+#endif
 {
     &gtp_api.base,
     ips_gtp_info,
@@ -220,7 +223,4 @@ SO_PUBLIC const BaseApi* snort_plugins[] =
     ips_gtp_version,
     nullptr
 };
-#else
-const BaseApi* sin_gtp = &gtp_api.base;
-#endif
 
index 71a17483e25ccc9389342f9d866b37dcf6a47100..fcfb0c8a1495c3f2e11e701992b671e8ebe41a28 100644 (file)
@@ -81,7 +81,6 @@ const InspectApi HttpApi::http_api =
     nullptr
 };
 
-#ifdef BUILDING_SO
 extern const BaseApi* ips_http_uri;
 extern const BaseApi* ips_http_client_body;
 extern const BaseApi* ips_http_method;
@@ -98,7 +97,11 @@ extern const BaseApi* ips_http_raw_trailer;
 extern const BaseApi* ips_http_raw_request;
 extern const BaseApi* ips_http_raw_status;
 
+#ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* sin_http[] =
+#endif
 {
     &HttpApi::http_api.base,
     ips_http_uri,
@@ -118,7 +121,4 @@ SO_PUBLIC const BaseApi* snort_plugins[] =
     ips_http_raw_status,
     nullptr
 };
-#else
-const BaseApi* sin_http = &HttpApi::http_api.base;
-#endif
 
index e7b0faf317e088b0d9134138742ea2c10391433a..8e745deecc072dea9e2d3c0742cd96cec5a1010b 100644 (file)
@@ -161,12 +161,15 @@ static const InspectApi modbus_api =
     nullptr  // reset
 };
 
-#ifdef BUILDING_SO
 extern const BaseApi* ips_modbus_data;
 extern const BaseApi* ips_modbus_func;
 extern const BaseApi* ips_modbus_unit;
 
+#ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* sin_modbus[] =
+#endif
 {
     &modbus_api.base,
     ips_modbus_data,
@@ -174,7 +177,4 @@ SO_PUBLIC const BaseApi* snort_plugins[] =
     ips_modbus_unit,
     nullptr
 };
-#else
-const BaseApi* sin_modbus = &modbus_api.base;
-#endif
 
index e53b87438078879eda7a6f0ad58b410b2faf5ac1..7a377818d01b9284ebd36bce53d8234167f349f6 100644 (file)
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+
 #include "framework/inspector.h"
+#include "managers/plugin_manager.h"
 
-extern const BaseApi* sin_http;
 extern const BaseApi* sin_imap;
 extern const BaseApi* sin_pop;
-extern const BaseApi* sin_sip;
 extern const BaseApi* sin_smtp;
-extern const BaseApi* sin_ssl;
 
-extern const BaseApi* ips_http_uri;
-extern const BaseApi* ips_http_client_body;
-extern const BaseApi* ips_http_method;
-extern const BaseApi* ips_http_cookie;
-extern const BaseApi* ips_http_stat_code;
-extern const BaseApi* ips_http_stat_msg;
-extern const BaseApi* ips_http_raw_uri;
-extern const BaseApi* ips_http_raw_header;
-extern const BaseApi* ips_http_raw_cookie;
-extern const BaseApi* ips_http_version;
-extern const BaseApi* ips_http_header;
-extern const BaseApi* ips_http_trailer;
-extern const BaseApi* ips_http_raw_trailer;
-extern const BaseApi* ips_http_raw_request;
-extern const BaseApi* ips_http_raw_status;
-extern const BaseApi* ips_sip_body;
-extern const BaseApi* ips_sip_header;
-extern const BaseApi* ips_sip_method;
-extern const BaseApi* ips_sip_stat_code;
-extern const BaseApi* ips_ssl_state;
-extern const BaseApi* ips_ssl_version;
+extern const BaseApi* sin_file[];
+extern const BaseApi* sin_http[];
+extern const BaseApi* sin_sip[];
+extern const BaseApi* sin_ssl[];
 
 #ifdef STATIC_INSPECTORS
-extern const BaseApi* ips_dce_iface;
-extern const BaseApi* ips_dce_opnum;
-extern const BaseApi* ips_dce_stub_data;
-extern const BaseApi* ips_dnp3_data;
-extern const BaseApi* ips_dnp3_func;
-extern const BaseApi* ips_dnp3_ind;
-extern const BaseApi* ips_dnp3_obj;
-extern const BaseApi* ips_gtp_info;
-extern const BaseApi* ips_gtp_type;
-extern const BaseApi* ips_gtp_version;
-extern const BaseApi* ips_modbus_data;
-extern const BaseApi* ips_modbus_func;
-extern const BaseApi* ips_modbus_unit;
-
-// FIXIT-L use snort_plugins aliases for static builds
-// so only one extern symbol per library is required
 extern const BaseApi* sin_bo;
-extern const BaseApi* sin_dce_smb;
-extern const BaseApi* sin_dce_tcp;
-extern const BaseApi* sin_dce_udp;
-extern const BaseApi* sin_dnp3;
 extern const BaseApi* sin_dns;
 extern const BaseApi* sin_ftp_client;
 extern const BaseApi* sin_ftp_server;
 extern const BaseApi* sin_ftp_data;
-extern const BaseApi* sin_gtp;
-extern const BaseApi* sin_modbus;
 extern const BaseApi* sin_rpc_decode;
 extern const BaseApi* sin_ssh;
 extern const BaseApi* sin_telnet;
 extern const BaseApi* sin_wizard;
+
+extern const BaseApi* sin_dce[];
+extern const BaseApi* sin_dnp3[];
+extern const BaseApi* sin_gtp[];
+extern const BaseApi* sin_modbus[];
 #endif
 
 const BaseApi* service_inspectors[] =
 {
-    sin_http,
     sin_imap,
     sin_pop,
-    sin_sip,
     sin_smtp,
-    sin_ssl,
-
-    ips_http_uri,
-    ips_http_client_body,
-    ips_http_method,
-    ips_http_cookie,
-    ips_http_stat_code,
-    ips_http_stat_msg,
-    ips_http_raw_uri,
-    ips_http_raw_header,
-    ips_http_raw_cookie,
-    ips_http_version,
-    ips_http_header,
-    ips_http_trailer,
-    ips_http_raw_trailer,
-    ips_http_raw_request,
-    ips_http_raw_status,
-    ips_sip_body,
-    ips_sip_header,
-    ips_sip_method,
-    ips_sip_stat_code,
-    ips_ssl_state,
-    ips_ssl_version,
 
 #ifdef STATIC_INSPECTORS
-    ips_dce_iface,
-    ips_dce_opnum,
-    ips_dce_stub_data,
-    ips_dnp3_data,
-    ips_dnp3_func,
-    ips_dnp3_ind,
-    ips_dnp3_obj,
-    ips_gtp_info,
-    ips_gtp_type,
-    ips_gtp_version,
-    ips_modbus_data,
-    ips_modbus_func,
-    ips_modbus_unit,
-
     sin_bo,
-    sin_dce_smb,
-    sin_dce_tcp,
-    sin_dce_udp,
-    sin_dnp3,
     sin_dns,
     sin_ftp_client,
     sin_ftp_server,
     sin_ftp_data,
-    sin_gtp,
-    sin_modbus,
     sin_rpc_decode,
     sin_ssh,
     sin_telnet,
     sin_wizard,
 #endif
+
     nullptr
 };
 
+void load_service_inspectors()
+{
+    PluginManager::load_plugins(service_inspectors);
+
+    PluginManager::load_plugins(sin_file);
+    PluginManager::load_plugins(sin_http);
+    PluginManager::load_plugins(sin_sip);
+    PluginManager::load_plugins(sin_ssl);
+
+#ifdef STATIC_INSPECTORS
+    PluginManager::load_plugins(sin_dce);
+    PluginManager::load_plugins(sin_dnp3);
+    PluginManager::load_plugins(sin_gtp);
+    PluginManager::load_plugins(sin_modbus);
+#endif
+}
+
index d3f2a73598d29ebc0cce4fe9239afe79fbc66936..7ee621be9b3ed3a9c28da14c706af6e1a5516b0e 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef SERVICE_INSPECTORS_H
 #define SERVICE_INSPECTORS_H
 
-extern const struct BaseApi* service_inspectors[];
+void load_service_inspectors();
 
 #endif
 
index 3d0e6b1a385121858c38a9a0a2a7ea4353c6bdc3..87e641493c1e5b1029164e4ff712fd95bb3dd377 100644 (file)
@@ -428,13 +428,16 @@ const InspectApi sip_api =
     nullptr  // reset
 };
 
-#ifdef BUILDING_SO
 extern const BaseApi* ips_sip_header;
 extern const BaseApi* ips_sip_body;
 extern const BaseApi* ips_sip_method;
 extern const BaseApi* ips_sip_stat_code;
 
+#ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* sin_sip[] =
+#endif
 {
     &sip_api.base,
     ips_sip_header,
@@ -443,7 +446,4 @@ SO_PUBLIC const BaseApi* snort_plugins[] =
     ips_sip_stat_code,
     nullptr
 };
-#else
-const BaseApi* sin_sip = &sip_api.base;
-#endif
 
index 454edd84b5c3c9783af0a4cbc1d3ae0d012e11f0..17532d0dc51e217add6ffbc80c65c97749559af3 100644 (file)
@@ -513,13 +513,18 @@ const InspectApi ssl_api =
 
 #undef BUILDING_SO  // FIXIT-L can't be linked dynamically yet
 
+extern const BaseApi* ips_ssl_state;
+extern const BaseApi* ips_ssl_version;
+
 #ifdef BUILDING_SO
 SO_PUBLIC const BaseApi* snort_plugins[] =
+#else
+const BaseApi* sin_ssl[] =
+#endif
 {
     &ssl_api.base,
+    ips_ssl_state,
+    ips_ssl_version,
     nullptr
 };
-#else
-const BaseApi* sin_ssl = &ssl_api.base;
-#endif
 
index f70af773139d08dc5d2c2fea86cff108415cc06b..14a030eef8313f35a1b7a84473743899ad0f791b 100644 (file)
 
 #include "stream_inspectors.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
 #include "framework/inspector.h"
+#include "managers/plugin_manager.h"
 
 extern const BaseApi* nin_stream_base;
 extern const BaseApi* nin_stream_ip;
@@ -35,7 +33,7 @@ extern const BaseApi* nin_stream_file;
 extern const BaseApi* ips_stream_reassemble;
 extern const BaseApi* ips_stream_size;
 
-const BaseApi* stream_inspectors[] =
+static const BaseApi* stream_inspectors[] =
 {
     nin_stream_base,
     nin_stream_ip,
@@ -51,3 +49,8 @@ const BaseApi* stream_inspectors[] =
     nullptr
 };
 
+void load_stream_inspectors()
+{
+    PluginManager::load_plugins(stream_inspectors);
+}
+
index 0bbc34e7450fd10c63c359a2b6433a9ce48a13e0..8c618dba46af421f141ca414473ba79b63ba75b6 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef STREAM_INSPECTORS_H
 #define STREAM_INSPECTORS_H
 
-extern const struct BaseApi* stream_inspectors[];
+void load_stream_inspectors();
 
 #endif