]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Added static/dynamic build api to all plugins
authorJosh <jrosenba@cisco.com>
Mon, 21 Apr 2014 16:59:43 +0000 (12:59 -0400)
committerJosh <jrosenba@cisco.com>
Mon, 21 Apr 2014 16:59:43 +0000 (12:59 -0400)
18 files changed:
src/codecs/codec_api.cc
src/codecs/codec_api.h
src/codecs/plugins/cd_ah.cc
src/codecs/plugins/cd_arp.cc
src/codecs/plugins/cd_dstopts.cc
src/codecs/plugins/cd_erspan2.cc
src/codecs/plugins/cd_erspan3.cc
src/codecs/plugins/cd_ethloopback.cc
src/codecs/plugins/cd_fragment.cc
src/codecs/plugins/cd_gre.cc
src/codecs/plugins/cd_gtp.cc
src/codecs/plugins/cd_mpls.cc
src/codecs/plugins/cd_pppencap.cc
src/codecs/plugins/cd_pppoepkt.cc
src/codecs/plugins/cd_swipe.cc
src/codecs/plugins/cd_teredo.cc
src/codecs/plugins/cd_transbridge.cc
src/codecs/plugins/cd_vlan.cc

index d29484d7d1e5e22b7e754b2023c635a6c6d03348..ee50e0b3c5f671ee71657cfc43bf9a9dc6db967e 100644 (file)
@@ -38,8 +38,23 @@ const BaseApi* codecs[] =
     cd_esp,
 
 #ifdef STATIC_DECODERS
+    cd_ah,
+    cd_arp,
+    cd_erspan2,
+    cd_erspan3,
+    cd_ethloopback,
+    cd_gre,
+    cd_gtp,
+    cd_mpls,
+    cd_pppencap,
+    cd_pppoe,
+    cd_swipe,
+    cd_teredo,
+    cd_transbridge,
+    cd_vlan,
 
 #endif
+
     nullptr
 };
 
index dc53e292d7ce828d78ffa3f36155f3be5a28e3d7..45aa8f8d08264dd9bde490556c5102f348b3b81d 100644 (file)
@@ -33,6 +33,20 @@ extern const BaseApi* cd_udp;
 extern const BaseApi* cd_esp;
 
 #ifdef STATIC_DECODERS
+extern const BaseApi* cd_ah;
+extern const BaseApi* cd_arp;
+extern const BaseApi* cd_erspan2;
+extern const BaseApi* cd_erspan3; 
+extern const BaseApi* cd_ethloopback; 
+extern const BaseApi* cd_gre;
+extern const BaseApi* cd_gtp;
+extern const BaseApi* cd_mpls;
+extern const BaseApi* cd_pppencap;
+extern const BaseApi* cd_pppoe;
+extern const BaseApi* cd_swipe;
+extern const BaseApi* cd_teredo;
+extern const BaseApi* cd_transbridge;
+extern const BaseApi* cd_vlan;
 
 #endif
 
index b4ccea9a1f53be8e9f53c3d96374e09fe2cbba45..f591c2f70beda31158744df0c5750bb84ae41d44 100644 (file)
@@ -38,7 +38,7 @@ class AhCodec : public Codec
 {
 public:
     AhCodec() : Codec("ah"){};
-    ~AhCodec();
+    ~AhCodec(){};
 
 
     virtual bool decode(const uint8_t *raw_pkt, const uint32_t len, 
@@ -101,7 +101,7 @@ static void stats()
 
 
 
-static const char* name = "ah_decode";
+static const char* name = "ah_codec";
 
 static const CodecApi ah_api =
 {
@@ -117,3 +117,15 @@ static const CodecApi ah_api =
 };
 
 
+#ifdef BUILDING_SO
+SO_PUBLIC const BaseApi* snort_plugins[] =
+{
+    &ah_api.base,
+    nullptr
+};
+#else
+const BaseApi* cd_ah = &ah_api.base;
+#endif
+
+
+
index bfef8b3747f7dd08b1323a017304ce803247a92a..65e655978f7d1359253f9e1ef7599c44579cd0fa 100644 (file)
@@ -36,15 +36,14 @@ namespace
 class ArpCodec : public Codec
 {
 public:
-    ArpCodec() : Codec("NAME"){};
-    ~ArpCodec();
+    ArpCodec() : Codec("Arp"){};
+    ~ArpCodec(){};
 
 
     virtual bool decode(const uint8_t *raw_pkt, const uint32_t len, 
         Packet *, uint16_t &p_hdr_len, int &next_prot_id);
 
     virtual void get_protocol_ids(std::vector<uint16_t>&);
-    virtual void get_data_link_type(std::vector<int>&){};
     
 };
 
@@ -131,7 +130,7 @@ static void stats()
 
 static const char* name = "arp_codec";
 
-static const CodecApi codec_api =
+static const CodecApi arp_api =
 {
     { PT_CODEC, name, CDAPI_PLUGIN_V0, 0 },
     NULL, // pinit
@@ -144,4 +143,16 @@ static const CodecApi codec_api =
     stats  // stats
 };
 
+#ifdef BUILDING_SO
+SO_PUBLIC const BaseApi* snort_plugins[] =
+{
+    &arp_api.base,
+    nullptr
+};
+#else
+const BaseApi* cd_arp = &arp_api.base;
+#endif
+
+
+
 
index 2043d945afb21a700a05bd253db0d20b33793ba4..295a314c8aeb870be419fafc36871dbc226244d4 100644 (file)
@@ -44,7 +44,7 @@ namespace
 class NameCodec : public Codec
 {
 public:
-    NameCodec() : Codec("NAME"){};
+    NameCodec() : Codec("dstopts"){};
     ~NameCodec();
 
 
index b754e5ab922fc22cce82da7376fd2aeb074f496e..dbea43c8801e8488b9d87c884018968ef28bf891 100644 (file)
@@ -33,14 +33,13 @@ class Erspan2Codec : public Codec
 {
 public:
     Erspan2Codec() : Codec("ERSPAN_2"){};
-    ~Erspan2Codec();
+    ~Erspan2Codec(){};
 
 
     virtual bool decode(const uint8_t *raw_pkt, const uint32_t len, 
         Packet *, uint16_t &p_hdr_len, int &next_prot_id);
 
     virtual void get_protocol_ids(std::vector<uint16_t>&);
-    virtual void get_data_link_type(std::vector<int>&){};
     
 };
 
@@ -140,7 +139,7 @@ static void stats()
 
 static const char* name = "erspan2_codec";
 
-static const CodecApi codec_api =
+static const CodecApi erspan2_api =
 {
     { PT_CODEC, name, CDAPI_PLUGIN_V0, 0 },
     NULL, // pinit
@@ -152,3 +151,13 @@ static const CodecApi codec_api =
     sum, // sum
     stats  // stats
 };
+
+#ifdef BUILDING_SO
+SO_PUBLIC const BaseApi* snort_plugins[] =
+{
+    &erspan2_api.base,
+    nullptr
+};
+#else
+const BaseApi* cd_erspan2 = &erspan2_api.base;
+#endif
index af30e3d531ecf747c70414130e271c42e8f1fd38..71014aa020f14b77be462844895beaad900f347c 100644 (file)
@@ -35,14 +35,13 @@ class Erspan3Codec : public Codec
 {
 public:
     Erspan3Codec() : Codec("ERSPAN_3"){};
-    ~Erspan3Codec();
+    ~Erspan3Codec(){};
 
 
     virtual bool decode(const uint8_t *raw_pkt, const uint32_t len, 
         Packet *, uint16_t &p_hdr_len, int &next_prot_id);
 
     virtual void get_protocol_ids(std::vector<uint16_t>&);
-    virtual void get_data_link_type(std::vector<int>&){};
     
 };
 
@@ -143,7 +142,7 @@ static void stats()
 
 static const char* name = "erspan3_codec";
 
-static const CodecApi codec_api =
+static const CodecApi erspan3_api =
 {
     { PT_CODEC, name, CDAPI_PLUGIN_V0, 0 },
     NULL, // pinit
@@ -156,3 +155,14 @@ static const CodecApi codec_api =
     stats  // stats
 };
 
+
+
+#ifdef BUILDING_SO
+SO_PUBLIC const BaseApi* snort_plugins[] =
+{
+    &erspan3_api.base,
+    nullptr
+};
+#else
+const BaseApi* cd_erspan3 = &erspan3_api.base;
+#endif
index ae3439b4151ed1fc8da0917d3513b737274b099e..c160238df39aa7676e35b573f061edd681c5861b 100644 (file)
@@ -32,7 +32,7 @@ class EthLoopbackCodec : public Codec
 {
 public:
     EthLoopbackCodec() : Codec("Ethloopback"){};
-    ~EthLoopbackCodec();
+    ~EthLoopbackCodec(){};
 
 
     virtual bool decode(const uint8_t *raw_pkt, const uint32_t len, 
@@ -100,7 +100,7 @@ static void stats()
 
 static const char* name = "ethloopback_codec";
 
-static const CodecApi codec_api =
+static const CodecApi ethloopback_api =
 {
     { PT_CODEC, name, CDAPI_PLUGIN_V0, 0 },
     NULL, // pinit
@@ -112,3 +112,16 @@ static const CodecApi codec_api =
     sum, // sum
     stats  // stats
 };
+
+
+#ifdef BUILDING_SO
+SO_PUBLIC const BaseApi* snort_plugins[] =
+{
+    &ethloopback_api.base,
+    nullptr
+};
+#else
+const BaseApi* cd_ethloopback = &ethloopback_api.base;
+#endif
+
+
index 2043d945afb21a700a05bd253db0d20b33793ba4..16233519c9bb7042e649c0e6c0e36c76f93f3cc3 100644 (file)
@@ -52,7 +52,6 @@ public:
         Packet *, uint16_t &p_hdr_len, int &next_prot_id);
 
     virtual void get_protocol_ids(std::vector<uint16_t>&);
-    virtual void get_data_link_type(std::vector<int>&){};
     
 };
 
index 74ee495bfdf124088dc0094631028ea8da6abc90..486e4e7cedb24582ea351c2be49fac1c05e70e7f 100644 (file)
@@ -35,7 +35,7 @@ class GreCodec : public Codec
 {
 public:
     GreCodec() : Codec("GRE"){};
-    ~GreCodec();
+    ~GreCodec(){};
 
 
     virtual bool decode(const uint8_t *raw_pkt, const uint32_t len, 
@@ -279,7 +279,7 @@ static void stats()
 
 static const char* name = "gre_codec";
 
-static const CodecApi codec_api =
+static const CodecApi gre_api =
 {
     { PT_CODEC, name, CDAPI_PLUGIN_V0, 0 },
     NULL, // pinit
@@ -292,4 +292,14 @@ static const CodecApi codec_api =
     stats  // stats
 };
 
+#ifdef BUILDING_SO
+SO_PUBLIC const BaseApi* snort_plugins[] =
+{
+    &gre_api.base,
+    nullptr
+};
+#else
+const BaseApi* cd_gre = &gre_api.base;
+#endif
+
 
index e159dbb31cb966afc343d9f23f408258e5c63b77..ded90aa18f416f13e24929162f92086b5b45c142 100644 (file)
@@ -46,15 +46,13 @@ class GtpCodec : public Codec
 {
 public:
     GtpCodec() : Codec("GTP"){};
-    ~GtpCodec();
+    ~GtpCodec(){};
 
 
     virtual bool decode(const uint8_t *raw_pkt, const uint32_t len, 
         Packet *, uint16_t &p_hdr_len, int &next_prot_id);
 
-    virtual void get_protocol_ids(std::vector<uint16_t>&);
-    virtual void get_data_link_type(std::vector<int>&){};
-    
+    virtual void get_protocol_ids(std::vector<uint16_t>&);    
 };
 
 } // anonymous namespace
@@ -68,7 +66,7 @@ public:
  *
  */
 
-bool decode(const uint8_t *raw_pkt, const uint32_t len, 
+bool GtpCodec::decode(const uint8_t *raw_pkt, const uint32_t len, 
     Packet *p, uint16_t &p_hdr_len, int &next_prot_id)
 {
     uint32_t header_len;
@@ -291,7 +289,7 @@ static void dtor(Codec *cd)
 
 static const char* name = "gtp_codec";
 
-static const CodecApi ipv6_api =
+static const CodecApi gtp_api =
 {
     { PT_CODEC, name, CDAPI_PLUGIN_V0, 0 },
     NULL, // pinit
@@ -303,3 +301,14 @@ static const CodecApi ipv6_api =
     NULL, // sum
     NULL  // stats
 };
+
+#ifdef BUILDING_SO
+SO_PUBLIC const BaseApi* snort_plugins[] =
+{
+    &gtp_api.base,
+    nullptr
+};
+#else
+const BaseApi* cd_gtp = &gtp_api.base;
+#endif
+
index 43e60685a046baa81f67b8ec195ab8525d90c30a..05822c0730a74f3388f60460e2fc4a11639ad9e2 100644 (file)
@@ -41,7 +41,7 @@ class MplsCodec : public Codec
 {
 public:
     MplsCodec() : Codec("MPLS"){};
-    ~MplsCodec();
+    ~MplsCodec(){};
 
 
     virtual bool decode(const uint8_t *raw_pkt, const uint32_t len, 
@@ -287,7 +287,7 @@ static void stats()
 
 static const char* name = "mpls_codec";
 
-static const CodecApi codec_api =
+static const CodecApi mpls_api =
 {
     { PT_CODEC, name, CDAPI_PLUGIN_V0, 0 },
     NULL, // pinit
@@ -300,6 +300,17 @@ static const CodecApi codec_api =
     stats  // stats
 };
 
+#ifdef BUILDING_SO
+SO_PUBLIC const BaseApi* snort_plugins[] =
+{
+    &mpls_api.base,
+    nullptr
+};
+#else
+const BaseApi* cd_mpls = &mpls_api.base;
+#endif
+
+
 
 
 
index 27bf5ffe574fb81421093976451e6df3f4a3cbdb..d4996de930ec8d2696f2cfff22940f5c7e73845e 100644 (file)
@@ -40,14 +40,13 @@ class PppEncap : public Codec
 {
 public:
     PppEncap() : Codec("PPPEncapsulation"){};
-    ~PppEncap();
+    ~PppEncap(){};
 
 
     virtual bool decode(const uint8_t *raw_pkt, const uint32_t len, 
         Packet *, uint16_t &p_hdr_len, int &next_prot_id);
 
     virtual void get_protocol_ids(std::vector<uint16_t>&);
-    virtual void get_data_link_type(std::vector<int>&){};
     
 };
 
@@ -204,7 +203,7 @@ static void stats()
 
 static const char* name = "pppencap_codec";
 
-static const CodecApi codec_api =
+static const CodecApi pppencap_api =
 {
     { PT_CODEC, name, CDAPI_PLUGIN_V0, 0 },
     NULL, // pinit
@@ -218,3 +217,16 @@ static const CodecApi codec_api =
 };
 
 
+#ifdef BUILDING_SO
+SO_PUBLIC const BaseApi* snort_plugins[] =
+{
+    &pppencap_api.base,
+    nullptr
+};
+#else
+const BaseApi* cd_pppencap = &pppencap_api.base;
+#endif
+
+
+
+
index 0a3d5b3e111d5056f52ae7644c952bfdf287f0d4..e24c6ff3031141340d3c31ca1047991e76d1c51a 100644 (file)
@@ -34,14 +34,13 @@ class PPPoEPkt : public Codec
 {
 public:
     PPPoEPkt() : Codec("PPP_over_Eth"){};
-    ~PPPoEPkt();
+    ~PPPoEPkt(){};
 
 
     virtual bool decode(const uint8_t *raw_pkt, const uint32_t len, 
         Packet *, uint16_t &p_hdr_len, int &next_prot_id);
 
     virtual void get_protocol_ids(std::vector<uint16_t>&);
-    virtual void get_data_link_type(std::vector<int>&){};
     
 };
 
@@ -317,7 +316,7 @@ static void stats()
 
 static const char* name = "pppoe_codec";
 
-static const CodecApi codec_api =
+static const CodecApi pppoe_api =
 {
     { PT_CODEC, name, CDAPI_PLUGIN_V0, 0 },
     NULL, // pinit
@@ -330,3 +329,16 @@ static const CodecApi codec_api =
     stats  // stats
 };
 
+
+#ifdef BUILDING_SO
+SO_PUBLIC const BaseApi* snort_plugins[] =
+{
+    &pppoe_api.base,
+    nullptr
+};
+#else
+const BaseApi* cd_pppoe = &pppoe_api.base;
+#endif
+
+
+
index 7955351e4d2449cc4ee24e089b74bff76ba16aac..b24034eaabbcf53de859f79c68d365607e65e92a 100644 (file)
@@ -40,7 +40,7 @@ class SwipeCodec : public Codec{
 
 public:
     SwipeCodec() : Codec("swipe"){};
-    virtual ~SwipeCodec();
+    virtual ~SwipeCodec(){};
     
     virtual bool decode(const uint8_t* raw_packet, const uint32_t raw_len, 
         Packet *p, uint16_t &p_hdr_len, int &next_prot_id);
@@ -82,7 +82,7 @@ static void dtor(Codec *cd)
     delete cd;
 }
 
-static const CodecApi udp_api =
+static const CodecApi swipe_api =
 {
     { PT_CODEC, name, CDAPI_PLUGIN_V0, 0 },
     NULL, // pinit
@@ -96,3 +96,15 @@ static const CodecApi udp_api =
 };
 
 
+#ifdef BUILDING_SO
+SO_PUBLIC const BaseApi* snort_plugins[] =
+{
+    &swipe_api.base,
+    nullptr
+};
+#else
+const BaseApi* cd_swipe = &swipe_api.base;
+#endif
+
+
+
index 18bff15e8f93a12346a75bae59b9f9c5b39289ad..99f29dfdca771ca860e907e824eaa87aa48a2dbf 100644 (file)
@@ -48,7 +48,7 @@ class TeredoCodec : public Codec
 {
 public:
     TeredoCodec() : Codec("teredo"){};
-    ~TeredoCodec();
+    ~TeredoCodec(){};
 
 
     virtual bool decode(const uint8_t *raw_pkt, const uint32_t len, 
@@ -132,9 +132,9 @@ static void dtor(Codec *cd)
     delete cd;
 }
 
-static const char* name = "teredo_codec";
+static const char* name = "teredo";
 
-static const CodecApi ipv6_api =
+static const CodecApi teredo_api =
 {
     { PT_CODEC, name, CDAPI_PLUGIN_V0, 0 },
     NULL, // pinit
@@ -143,6 +143,22 @@ static const CodecApi ipv6_api =
     NULL, // tterm
     ctor, // ctor
     dtor, // dtor
+    NULL,
+    NULL
 };
 
 
+#ifdef BUILDING_SO
+SO_PUBLIC const BaseApi* snort_plugins[] =
+{
+    &teredo_api.base,
+    nullptr
+};
+#else
+const BaseApi* cd_teredo = &teredo_api.base;
+#endif
+
+
+
+
+
index 068726f44aad0403c1bb7216f654561f71c25b97..f71820aa71dddbb2976145987708a3eb9e9cb90a 100644 (file)
@@ -41,7 +41,7 @@ class TransbridgeCodec : public Codec
 {
 public:
     TransbridgeCodec() : Codec("Transbridge"){};
-    ~TransbridgeCodec();
+    ~TransbridgeCodec(){};
 
 
     virtual bool decode(const uint8_t *raw_pkt, const uint32_t len, 
@@ -126,7 +126,7 @@ static void stats()
 
 
 
-static const char* name = "transbridge_codec";
+static const char* name = "transbridge";
 
 static const CodecApi transbridge_api =
 {
@@ -142,5 +142,16 @@ static const CodecApi transbridge_api =
 };
 
 
+#ifdef BUILDING_SO
+SO_PUBLIC const BaseApi* snort_plugins[] =
+{
+    &transbridge_api.base,
+    nullptr
+};
+#else
+const BaseApi* cd_transbridge = &transbridge_api.base;
+#endif
+
+
 
 
index d9d31a637c84441422606c810d36399735a55a1b..b8957450884a1583e9fe9dd15cb1a4b53c4dc3ac 100644 (file)
@@ -48,7 +48,7 @@ class VlanCodec : public Codec
 {
 public:
     VlanCodec() : Codec("vlan"){};
-    ~VlanCodec();
+    ~VlanCodec(){};
 
 
     virtual bool decode(const uint8_t *raw_pkt, const uint32_t len, 
@@ -201,7 +201,7 @@ static void stats()
 
 
 
-static const char* name = "VLAN";
+static const char* name = "vlan";
 
 static const CodecApi vlan_api =
 {
@@ -216,3 +216,14 @@ static const CodecApi vlan_api =
     stats  // stats
 };
 
+
+#ifdef BUILDING_SO
+SO_PUBLIC const BaseApi* snort_plugins[] =
+{
+    &vlan_api.base,
+    nullptr
+};
+#else
+const BaseApi* cd_vlan = &vlan_api.base;
+#endif
+