]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
moving SO_PUBLIC into header files
authorJosh <jrosenba@cisco.com>
Thu, 28 Aug 2014 16:47:12 +0000 (12:47 -0400)
committerJosh <jrosenba@cisco.com>
Thu, 28 Aug 2014 16:47:12 +0000 (12:47 -0400)
25 files changed:
src/flow/flow.cc
src/flow/flow.h
src/framework/counts.h
src/framework/inspector.cc
src/framework/ips_option.cc
src/framework/module.cc
src/hash/sfxhash.cc
src/hash/sfxhash.h
src/log/text_log.h
src/main/snort_debug.cc
src/main/snort_debug.h
src/managers/packet_manager.cc
src/managers/packet_manager.h
src/parser/mstring.cc
src/parser/mstring.h
src/parser/parser.cc
src/parser/parser.h
src/sfip/Makefile.am
src/stream/stream_api.cc
src/stream/stream_api.h
src/stream/stream_splitter.cc
src/utils/boyer_moore.cc
src/utils/boyer_moore.h
tools/snort2lua/snort2lua.cc
tools/snort2lua/utils/converter.cc

index 499f47aa0f02a7b3a117242cd13ee6d940f35dda..6274790772d2c97edd14af226920bc48d5fcd146 100644 (file)
 
 unsigned FlowData:: flow_id = 0;
 
-SO_PUBLIC FlowData::FlowData(unsigned u, Inspector* ph)
+FlowData::FlowData(unsigned u, Inspector* ph)
 {
     assert(u > 0);
     id = u;  handler = ph;
     if ( handler ) handler->add_ref();
 }
 
-SO_PUBLIC FlowData::~FlowData()
+FlowData::~FlowData()
 { if ( handler ) handler->rem_ref(); }
 
 Flow::Flow ()
index c4322caae3c0572bd779b57a394e0e3d6e28fd76..8c01fda209503418e17d35a1d5724f2a196db5a1 100644 (file)
@@ -90,7 +90,7 @@ struct StreamFlowData
     unsigned char flowb[1];
 };
 
-class FlowData
+class SO_PUBLIC FlowData
 {
 public:
     FlowData(unsigned u, Inspector* = nullptr);
index 0626f72b372e7a6954651b5d113911047dd4bbe7..d52574afe36fe10195a7fa626d5bc996507d2df4 100644 (file)
@@ -31,7 +31,7 @@ struct SimpleStats
     PegCount total_packets;
 };
 
-extern const char* simple_pegs[];
+SO_PUBLIC extern const char* simple_pegs[];
 
 #define array_size(a) (sizeof(a)/sizeof(a[0]))
 
index 7319b9fb942185401594f83b47cd7ff6a8aebac1..baf06c005b38d3443738b6dbbcf723581725c83b 100644 (file)
 // packet handler stuff
 //-------------------------------------------------------------------------
 
-SO_PUBLIC unsigned THREAD_LOCAL Inspector::slot = 0;
+unsigned THREAD_LOCAL Inspector::slot = 0;
 unsigned Inspector::max_slots = 1;
 
-SO_PUBLIC Inspector::Inspector()
+Inspector::Inspector()
 {
     unsigned max = get_instance_max();
     assert(slot < max);
@@ -42,7 +42,7 @@ SO_PUBLIC Inspector::Inspector()
         ref_count[i] = 0;
 }
 
-SO_PUBLIC Inspector::~Inspector()
+Inspector::~Inspector()
 {
     unsigned total = 0;
 
@@ -54,7 +54,7 @@ SO_PUBLIC Inspector::~Inspector()
     delete[] ref_count;
 }
 
-SO_PUBLIC bool Inspector::is_inactive()
+bool Inspector::is_inactive()
 {
     for (unsigned i = 0; i < get_instance_max(); ++i )
         if ( ref_count[i] )
@@ -63,7 +63,7 @@ SO_PUBLIC bool Inspector::is_inactive()
     return true;
 }
 
-SO_PUBLIC unsigned Inspector::get_buf_id(const char* key)
+unsigned Inspector::get_buf_id(const char* key)
 {
     const char** p = api->buffers;
     unsigned id = 0;
@@ -77,7 +77,7 @@ SO_PUBLIC unsigned Inspector::get_buf_id(const char* key)
     return p[id] ? id+1 : 0;
 }
 
-SO_PUBLIC bool Inspector::get_buf(const char* key, Packet* p, InspectionBuffer& b)
+bool Inspector::get_buf(const char* key, Packet* p, InspectionBuffer& b)
 {
     unsigned id = get_buf_id(key);
 
@@ -87,7 +87,7 @@ SO_PUBLIC bool Inspector::get_buf(const char* key, Packet* p, InspectionBuffer&
     return get_buf(id, p, b);
 }
 
-SO_PUBLIC StreamSplitter* Inspector::get_splitter(bool to_server)
+StreamSplitter* Inspector::get_splitter(bool to_server)
 {
     if ( !api || api->type != IT_SERVICE )
         return nullptr;
index 7612eaaf799c1f5dacd3168a69ad0923fcfe3934..75b0f8cacaab16d79da95af870dfd352665273f1 100644 (file)
@@ -34,7 +34,7 @@
 
 //-------------------------------------------------------------------------
 
-SO_PUBLIC uint32_t IpsOption::hash() const
+uint32_t IpsOption::hash() const
 {
     uint32_t a=0, b=0, c=0;
     mix_str(a,b,c,get_name());
@@ -42,6 +42,6 @@ SO_PUBLIC uint32_t IpsOption::hash() const
     return c;
 }
 
-SO_PUBLIC bool IpsOption::operator==(const IpsOption& ips) const
+bool IpsOption::operator==(const IpsOption& ips) const
 { return !strcmp(get_name(), ips.get_name()); }
 
index 459cc5249f8888a9849991c9438cd32d97a355de..60d5e2e8fc7e0768bf5b07a244192a2128e6b31d 100644 (file)
@@ -37,19 +37,17 @@ void Module::init(const char* s)
     num_counts = -1;
 }
 
-SO_PUBLIC Module::Module(const char* s)
-{
-    init(s);
-}
+Module::Module(const char* s)
+{ init(s); }
 
-SO_PUBLIC Module::Module(const char* s, const Parameter* p, bool is_list)
+Module::Module(const char* s, const Parameter* p, bool is_list)
 {
     init(s);
     params = p;
     list = is_list;
 }
 
-SO_PUBLIC void Module::sum_stats()
+void Module::sum_stats()
 {
     if ( num_counts < 0 )
         reset_stats();
@@ -66,13 +64,13 @@ SO_PUBLIC void Module::sum_stats()
     }
 }
 
-SO_PUBLIC void Module::show_stats()
+void Module::show_stats()
 {
     if ( num_counts > 0 )
         ::show_stats(&counts[0], get_pegs(), num_counts, get_name());
 }
 
-SO_PUBLIC void Module::reset_stats()
+void Module::reset_stats()
 {
     num_counts = 0;
     const char** pegs = get_pegs();
@@ -89,7 +87,7 @@ SO_PUBLIC void Module::reset_stats()
         counts[i] = 0;
 }
 
-SO_PUBLIC const char* simple_pegs[] =
+const char* simple_pegs[] =
 {
     "packets",
     nullptr
index de3e305a59cf03965e2e73a67e2d5533341d3c30..ac11faa0326672174a7b7eb3362717140e22c836 100644 (file)
@@ -125,11 +125,11 @@ static inline void s_free( SFXHASH * t, void * p )
 /*
  *   User access to the memory management, do they need it ? WaitAndSee
  */
-SO_PUBLIC void * sfxhash_alloc( SFXHASH * t, unsigned nbytes )
+void * sfxhash_alloc( SFXHASH * t, unsigned nbytes )
 {
     return s_alloc( t, nbytes );
 }
-SO_PUBLIC void   sfxhash_free( SFXHASH * t, void * p )
+void   sfxhash_free( SFXHASH * t, void * p )
 {
     s_free( t, p );
 }
@@ -146,7 +146,7 @@ static int sfxhash_nearest_powerof2(int nrows)
     return nrows;
 }
 
-SO_PUBLIC int sfxhash_calcrows(int num)
+int sfxhash_calcrows(int num)
 {
     return sfxhash_nearest_powerof2(num);
 //  return sf_nearest_prime( nrows );
@@ -179,7 +179,7 @@ SO_PUBLIC int sfxhash_calcrows(int num)
   maxmem of 0 indicates no memory limits.
 
 */
-SO_PUBLIC SFXHASH * sfxhash_new( int nrows, int keysize, int datasize, unsigned long maxmem,
+SFXHASH * sfxhash_new( int nrows, int keysize, int datasize, unsigned long maxmem,
                        int anr_flag,
                        int (*anrfree)(void * key, void * data),
                        int (*usrfree)(void * key, void * data),
@@ -268,7 +268,7 @@ SO_PUBLIC SFXHASH * sfxhash_new( int nrows, int keysize, int datasize, unsigned
  * @param max_nodes maximum nodes to allow.
  *
  */
-SO_PUBLIC void sfxhash_set_max_nodes( SFXHASH *h, int max_nodes )
+void sfxhash_set_max_nodes( SFXHASH *h, int max_nodes )
 {
     if (h)
     {
@@ -283,7 +283,7 @@ SO_PUBLIC void sfxhash_set_max_nodes( SFXHASH *h, int max_nodes )
  * @param n boolean flag toggles splaying of hash nodes
  *
  */
-SO_PUBLIC void sfxhash_splaymode( SFXHASH * t, int n )
+void sfxhash_splaymode( SFXHASH * t, int n )
 {
     t->splay = n;
 }
@@ -327,7 +327,7 @@ static void sfxhash_delete_free_list(SFXHASH *t)
  * @param h SFXHASH table pointer
  *
  */
-SO_PUBLIC void sfxhash_delete( SFXHASH * h )
+void sfxhash_delete( SFXHASH * h )
 {
     unsigned    i;
     SFXHASH_NODE * node, * onode;
@@ -368,7 +368,7 @@ SO_PUBLIC void sfxhash_delete( SFXHASH * h )
  *
  * @return -1 on error
  */
-SO_PUBLIC int sfxhash_make_empty(SFXHASH *h)
+int sfxhash_make_empty(SFXHASH *h)
 {
     SFXHASH_NODE *n = NULL;
     SFXHASH_NODE *tmp = NULL;
@@ -485,7 +485,7 @@ static void sfxhash_gunlink_node( SFXHASH *t, SFXHASH_NODE * hnode )
 
 /**Move node to the front of global list. Node movement is application specific.
  */
-SO_PUBLIC void sfxhash_gmovetofront( SFXHASH *t, SFXHASH_NODE * hnode )
+void sfxhash_gmovetofront( SFXHASH *t, SFXHASH_NODE * hnode )
 {
     if( hnode != t->ghead )
     {
@@ -682,7 +682,7 @@ static SFXHASH_NODE * sfxhash_find_node_row( SFXHASH * t, const void * key, int
  * @retval SFXHASH_INTABLE already in the table, t->cnode points to the node
  * @retval SFXHASH_NOMEM   not enough memory
  */
-SO_PUBLIC int sfxhash_add( SFXHASH * t, void * key, void * data )
+int sfxhash_add( SFXHASH * t, void * key, void * data )
 {
     int            index;
     SFXHASH_NODE * hnode;
@@ -761,7 +761,7 @@ SO_PUBLIC int sfxhash_add( SFXHASH * t, void * key, void * data )
  * @retval SFXHASH_INTABLE already in the table, t->cnode points to the node
  * @retval SFXHASH_NOMEM   not enough memory
  */
-SO_PUBLIC SFXHASH_NODE * sfxhash_get_node( SFXHASH * t, const void * key )
+SFXHASH_NODE * sfxhash_get_node( SFXHASH * t, const void * key )
 {
     int            index;
     SFXHASH_NODE * hnode;
@@ -828,7 +828,7 @@ SO_PUBLIC SFXHASH_NODE * sfxhash_get_node( SFXHASH * t, const void * key )
  * @retval 0               node not found
  *
  */
-SO_PUBLIC SFXHASH_NODE * sfxhash_find_node( SFXHASH * t, const void * key)
+SFXHASH_NODE * sfxhash_find_node( SFXHASH * t, const void * key)
 {
     int            rindex;
 
@@ -845,7 +845,7 @@ SO_PUBLIC SFXHASH_NODE * sfxhash_find_node( SFXHASH * t, const void * key)
  * @retval 0       node not found
  *
  */
-SO_PUBLIC void * sfxhash_find( SFXHASH * t, void * key)
+void * sfxhash_find( SFXHASH * t, void * key)
 {
     SFXHASH_NODE * hnode;
     int            rindex;
@@ -865,7 +865,7 @@ SO_PUBLIC void * sfxhash_find( SFXHASH * t, void * key)
  *
  * @return the head of the list or NULL
  */
-SO_PUBLIC SFXHASH_NODE *sfxhash_ghead( SFXHASH * t )
+SFXHASH_NODE *sfxhash_ghead( SFXHASH * t )
 {
     if(t)
     {
@@ -883,7 +883,7 @@ SO_PUBLIC SFXHASH_NODE *sfxhash_ghead( SFXHASH * t )
  *
  * @return the next node in the list or NULL when at the end
  */
-SO_PUBLIC SFXHASH_NODE *sfxhash_gnext( SFXHASH_NODE *n )
+SFXHASH_NODE *sfxhash_gnext( SFXHASH_NODE *n )
 {
     if(n)
     {
@@ -903,7 +903,7 @@ SO_PUBLIC SFXHASH_NODE *sfxhash_gnext( SFXHASH_NODE *n )
  * @retval 0       node not found
  *
  */
-SO_PUBLIC void * sfxhash_mru( SFXHASH * t )
+void * sfxhash_mru( SFXHASH * t )
 {
     SFXHASH_NODE * hnode;
 
@@ -924,7 +924,7 @@ SO_PUBLIC void * sfxhash_mru( SFXHASH * t )
  * @retval 0       node not found
  *
  */
-SO_PUBLIC void * sfxhash_lru( SFXHASH * t )
+void * sfxhash_lru( SFXHASH * t )
 {
     SFXHASH_NODE * hnode;
 
@@ -944,7 +944,7 @@ SO_PUBLIC void * sfxhash_lru( SFXHASH * t )
  * @retval 0       node not found
  *
  */
-SO_PUBLIC SFXHASH_NODE * sfxhash_mru_node( SFXHASH * t )
+SFXHASH_NODE * sfxhash_mru_node( SFXHASH * t )
 {
     SFXHASH_NODE * hnode;
 
@@ -986,7 +986,7 @@ SFXHASH_NODE * sfxhash_lru_node( SFXHASH * t )
  * @return max depth of the table
  *
  */
-SO_PUBLIC unsigned sfxhash_maxdepth( SFXHASH * t )
+unsigned sfxhash_maxdepth( SFXHASH * t )
 {
     unsigned i;
     unsigned max_depth = 0;
@@ -1012,7 +1012,7 @@ SO_PUBLIC unsigned sfxhash_maxdepth( SFXHASH * t )
 /*
  *  Unlink and free the node
  */
-SO_PUBLIC int sfxhash_free_node( SFXHASH * t, SFXHASH_NODE * hnode)
+int sfxhash_free_node( SFXHASH * t, SFXHASH_NODE * hnode)
 {
     sfxhash_unlink_node( t, hnode ); /* unlink from the hash table row list */
 
@@ -1047,7 +1047,7 @@ SO_PUBLIC int sfxhash_free_node( SFXHASH * t, SFXHASH_NODE * hnode)
  * @retval !0  failed
  *
  */
-SO_PUBLIC int sfxhash_remove( SFXHASH * t, void * key)
+int sfxhash_remove( SFXHASH * t, void * key)
 {
     SFXHASH_NODE * hnode;
     unsigned hashkey, index;
@@ -1106,7 +1106,7 @@ static void sfxhash_next( SFXHASH * t )
  * @retval !0  valid SFXHASH_NODE *
  *
  */
-SO_PUBLIC SFXHASH_NODE * sfxhash_findfirst( SFXHASH * t )
+SFXHASH_NODE * sfxhash_findfirst( SFXHASH * t )
 {
     SFXHASH_NODE * n;
 
@@ -1138,7 +1138,7 @@ SO_PUBLIC SFXHASH_NODE * sfxhash_findfirst( SFXHASH * t )
  * @retval !0  valid SFXHASH_NODE *
  *
  */
-SO_PUBLIC SFXHASH_NODE * sfxhash_findnext( SFXHASH * t )
+SFXHASH_NODE * sfxhash_findnext( SFXHASH * t )
 {
     SFXHASH_NODE * n;
 
@@ -1165,7 +1165,7 @@ SO_PUBLIC SFXHASH_NODE * sfxhash_findnext( SFXHASH * t )
  * @param keycmp_fcn user specified key comparisoin function
  */
 
-SO_PUBLIC int sfxhash_set_keyops( SFXHASH *h ,
+int sfxhash_set_keyops( SFXHASH *h ,
                         unsigned (*hash_fcn)( SFHASHFCN * p,
                                               unsigned char *d,
                                               int n),
index 3c23657b390fffacad46ee601b6d3635898df039..b18465d1eab0384ac85b09dfb63c512eab46884a 100644 (file)
@@ -39,6 +39,7 @@
 #include <time.h>
 
 #include "utils/sfmemcap.h"
+#include "main/snort_types.h"
 
 struct SFHASHFCN;
 
@@ -107,21 +108,21 @@ struct SFXHASH
 /*
 *   HASH PROTOTYPES
 */
-int             sfxhash_calcrows(int num);
-SFXHASH       * sfxhash_new( int nrows, int keysize, int datasize, unsigned long memcap,
+SO_PUBLIC int             sfxhash_calcrows(int num);
+SO_PUBLIC SFXHASH       * sfxhash_new( int nrows, int keysize, int datasize, unsigned long memcap,
                              int anr_flag,
                              int (*anrfunc)(void *key, void * data),
                              int (*usrfunc)(void *key, void * data),
                              int recycle_flag );
 
-void            sfxhash_set_max_nodes( SFXHASH *h, int max_nodes );
+SO_PUBLIC void            sfxhash_set_max_nodes( SFXHASH *h, int max_nodes );
 
-void            sfxhash_delete( SFXHASH * h );
-int             sfxhash_make_empty(SFXHASH *);
+SO_PUBLIC void            sfxhash_delete( SFXHASH * h );
+SO_PUBLIC int             sfxhash_make_empty(SFXHASH *);
 
-int             sfxhash_add ( SFXHASH * h, void * key, void * data );
-SFXHASH_NODE * sfxhash_get_node( SFXHASH * t, const void * key );
-int             sfxhash_remove( SFXHASH * h, void * key );
+SO_PUBLIC int             sfxhash_add ( SFXHASH * h, void * key, void * data );
+SO_PUBLIC SFXHASH_NODE * sfxhash_get_node( SFXHASH * t, const void * key );
+SO_PUBLIC int             sfxhash_remove( SFXHASH * h, void * key );
 
 /*!
  *  Get the # of Nodes in HASH the table
@@ -200,31 +201,31 @@ static inline unsigned sfxhash_overhead_blocks( SFXHASH * t )
     return t->overhead_blocks;
 }
 
-void          * sfxhash_mru( SFXHASH * t );
-void          * sfxhash_lru( SFXHASH * t );
-SFXHASH_NODE  * sfxhash_mru_node( SFXHASH * t );
-SFXHASH_NODE  * sfxhash_lru_node( SFXHASH * t );
-void          * sfxhash_find( SFXHASH * h, void * key );
-SFXHASH_NODE  * sfxhash_find_node( SFXHASH * t, const void * key);
+SO_PUBLIC void          * sfxhash_mru( SFXHASH * t );
+SO_PUBLIC void          * sfxhash_lru( SFXHASH * t );
+SO_PUBLIC SFXHASH_NODE  * sfxhash_mru_node( SFXHASH * t );
+SO_PUBLIC SFXHASH_NODE  * sfxhash_lru_node( SFXHASH * t );
+SO_PUBLIC void          * sfxhash_find( SFXHASH * h, void * key );
+SO_PUBLIC SFXHASH_NODE  * sfxhash_find_node( SFXHASH * t, const void * key);
 
-SFXHASH_NODE  * sfxhash_findfirst( SFXHASH * h );
-SFXHASH_NODE  * sfxhash_findnext ( SFXHASH * h );
+SO_PUBLIC SFXHASH_NODE  * sfxhash_findfirst( SFXHASH * h );
+SO_PUBLIC SFXHASH_NODE  * sfxhash_findnext ( SFXHASH * h );
 
-SFXHASH_NODE  * sfxhash_ghead( SFXHASH * h );
-SFXHASH_NODE  * sfxhash_gnext( SFXHASH_NODE * n );
-void sfxhash_gmovetofront( SFXHASH *t, SFXHASH_NODE * hnode );
+SO_PUBLIC SFXHASH_NODE  * sfxhash_ghead( SFXHASH * h );
+SO_PUBLIC SFXHASH_NODE  * sfxhash_gnext( SFXHASH_NODE * n );
+SO_PUBLIC void sfxhash_gmovetofront( SFXHASH *t, SFXHASH_NODE * hnode );
 
 
-void            sfxhash_splaymode( SFXHASH * h, int mode );
+SO_PUBLIC void            sfxhash_splaymode( SFXHASH * h, int mode );
 
-void          * sfxhash_alloc( SFXHASH * t, unsigned nbytes );
-void            sfxhash_free( SFXHASH * t, void * p );
-int             sfxhash_free_node(SFXHASH *t, SFXHASH_NODE *node);
+SO_PUBLIC void          * sfxhash_alloc( SFXHASH * t, unsigned nbytes );
+SO_PUBLIC void            sfxhash_free( SFXHASH * t, void * p );
+SO_PUBLIC int             sfxhash_free_node(SFXHASH *t, SFXHASH_NODE *node);
 
-unsigned        sfxhash_maxdepth( SFXHASH * t );
+SO_PUBLIC unsigned        sfxhash_maxdepth( SFXHASH * t );
 
 
-int sfxhash_set_keyops( SFXHASH *h ,
+SO_PUBLIC int sfxhash_set_keyops( SFXHASH *h ,
                         unsigned (*hash_fcn)( SFHASHFCN * p,
                                               unsigned char *d,
                                               int n),
index 7bfb7f4efacf337b399ca972dcc7490ac7dcf215..6575efdefe7e0af4039f3babd9c4f6b0bc0ad51b 100644 (file)
@@ -53,7 +53,7 @@
  * DO NOT ACCESS STRUCT MEMBERS DIRECTLY
  * EXCEPT FROM WITHIN THE IMPLEMENTATION!
  */
-typedef struct _TextLog
+struct TextLog
 {
 /* private: */
 /* file attributes: */
@@ -68,7 +68,7 @@ typedef struct _TextLog
     unsigned int maxBuf;
     char buf[1];
 
-} TextLog;
+};
 
 TextLog* TextLog_Init (
     const char* name, unsigned int maxBuf = 0, size_t maxFile = 0
index ccc7a0e90cdb6d48d34b79544277ec20ed95b9e9..afe1cc6c9bf57bcc072e30c89e5f62a7586426c7 100644 (file)
@@ -41,8 +41,8 @@
 #include "snort.h"
 
 #ifdef DEBUG_MSGS
-SO_PUBLIC const char *DebugMessageFile = NULL;  // FIXIT-M use access methods
-SO_PUBLIC int DebugMessageLine = 0;  // FIXIT-M use access methods
+const char *DebugMessageFile = NULL;  // FIXIT-M use access methods
+int DebugMessageLine = 0;  // FIXIT-M use access methods
 
 int DebugThis(uint64_t level)
 {
@@ -79,7 +79,7 @@ uint64_t GetDebugLevel(void)
     return debug_level;
 }
 
-SO_PUBLIC void DebugMessageFunc(uint64_t level, const char *fmt, ...)
+void DebugMessageFunc(uint64_t level, const char *fmt, ...)
 {
     va_list ap;
 
index b2d6208ba4f8963203e015be3e4ce46112ec1d91..3e3b70058f357999e8650ff276797b594270afe7 100644 (file)
@@ -85,7 +85,7 @@
 #define DEBUG_SMTP            0x0001000000000000LL
 #define DEBUG_PP_EXP          0x8000000000000000LL
 
-void DebugMessageFunc(uint64_t dbg, const char *fmt, ...);
+SO_PUBLIC void DebugMessageFunc(uint64_t dbg, const char *fmt, ...);
 #ifdef SF_WCHAR
 void DebugWideMessageFunc(uint64_t dbg, const wchar_t *fmt, ...);
 #endif
@@ -105,9 +105,9 @@ int DebugThis(uint64_t level);
 
 #ifdef DEBUG_MSGS
 #define DEBUG_WRAP(code) code
-void DebugMessageFunc(uint64_t dbg, const char *fmt, ...);
+SO_PUBLIC void DebugMessageFunc(uint64_t dbg, const char *fmt, ...);
 #ifdef SF_WCHAR
-void DebugWideMessageFunc(uint64_t dbg, const wchar_t *fmt, ...);
+SO_PUBLIC void DebugWideMessageFunc(uint64_t dbg, const wchar_t *fmt, ...);
 #endif
 #else /* DEBUG_MSGS */
 #define DEBUG_WRAP(code)
index aeeb8a834e4b679a301c740ed66a54a5ca0f2183..6c286d66098cf6a382f57a8b5037030c968a8e4c 100644 (file)
 
 #include "protocols/packet.h"
 #include "protocols/protocol_ids.h"
-#include "time/profiler.h"
 #include "parser/parser.h"
+#include "time/profiler.h"
 
-#include "protocols/ipv4.h"
-#include "protocols/ipv6.h"
 #include "codecs/ip/ip_util.h"
-#include "codecs/codec_events.h"
 #include "codecs/decode_module.h"
+#include "codecs/codec_events.h"
 
 // Encoder FOO
 #ifdef HAVE_DUMBNET_H
@@ -353,7 +351,7 @@ void PacketManager::thread_term()
     }
 }
 
-SO_PUBLIC Packet* PacketManager::encode_new ()
+Packet* PacketManager::encode_new()
 {
     Packet* p = (Packet*)SnortAlloc(sizeof(*p));
     uint8_t* b = (uint8_t*)SnortAlloc(sizeof(*p->pkth) + Codec::PKT_MAX + SPARC_TWIDDLE);
@@ -369,7 +367,7 @@ SO_PUBLIC Packet* PacketManager::encode_new ()
     return p;
 }
 
-SO_PUBLIC void PacketManager::encode_delete (Packet* p)
+void PacketManager::encode_delete (Packet* p)
 {
     free((void*)p->pkth);  // cast away const!
     free(p);
@@ -528,7 +526,7 @@ bool PacketManager::has_codec(uint16_t cd_id)
 // * if next layer is tcp, it becomes a tcp rst or tcp fin w/opt data
 //-------------------------------------------------------------------------
 
-SO_PUBLIC const uint8_t* PacketManager::encode_response(
+const uint8_t* PacketManager::encode_response(
     EncodeType type, EncodeFlags flags, const Packet* p, uint32_t* len,
     const uint8_t* payLoad, uint32_t payLen)
 {
@@ -555,7 +553,7 @@ SO_PUBLIC const uint8_t* PacketManager::encode_response(
 // - inner layer header is very similar but payload differs
 // - original ttl is always used
 //-------------------------------------------------------------------------
-SO_PUBLIC int PacketManager::encode_format_with_daq_info (
+int PacketManager::encode_format_with_daq_info (
     EncodeFlags f, const Packet* p, Packet* c, PseudoPacketType type,
     const DAQ_PktHdr_t* phdr, uint32_t opaque)
 {
@@ -643,17 +641,17 @@ SO_PUBLIC int PacketManager::encode_format_with_daq_info (
 
 
 #ifdef HAVE_DAQ_ADDRESS_SPACE_ID
-SO_PUBLIC int PacketManager::encode_format(EncodeFlags f, const Packet* p, Packet* c, PseudoPacketType type)
+int PacketManager::encode_format(EncodeFlags f, const Packet* p, Packet* c, PseudoPacketType type)
 {
     return encode_format_with_daq_info(f, p, c, type, p->pkth, p->pkth->opaque);
 }
 #elif defined(HAVE_DAQ_ACQUIRE_WITH_META)
-SO_PUBLIC int PacketManager::encode_format(EncodeFlags f, const Packet* p, Packet* c, PseudoPacketType type)
+int PacketManager::encode_format(EncodeFlags f, const Packet* p, Packet* c, PseudoPacketType type)
 {
     return encode_format_with_daq_info(f, p, c, type, nullptr, p->pkth->opaque);
 }
 #else
-SO_PUBLIC int PacketManager::encode_format(EncodeFlags f, const Packet* p, Packet* c, PseudoPacketType type)
+int PacketManager::encode_format(EncodeFlags f, const Packet* p, Packet* c, PseudoPacketType type)
 {
     return encode_format_with_daq_info(f, p, c, type, nullptr, 0);
 }
@@ -666,7 +664,7 @@ SO_PUBLIC int PacketManager::encode_format(EncodeFlags f, const Packet* p, Packe
 // checking each time if needed.
 //-------------------------------------------------------------------------
 
-SO_PUBLIC void PacketManager::encode_update (Packet* p)
+void PacketManager::encode_update (Packet* p)
 {
     int i;
     uint32_t len = 0;
@@ -718,22 +716,14 @@ void PacketManager::dump_stats()
         "codec");
 }
 
-SO_PUBLIC void PacketManager::encode_set_dst_mac(uint8_t *mac)
-{
-   dst_mac = mac;
-}
+void PacketManager::encode_set_dst_mac(uint8_t *mac)
+{ dst_mac = mac; }
 
-SO_PUBLIC uint8_t *PacketManager::encode_get_dst_mac()
-{
-   return dst_mac;
-}
+uint8_t *PacketManager::encode_get_dst_mac()
+{ return dst_mac; }
 
 uint64_t PacketManager::get_rebuilt_packet_count(void)
-{
-    return total_rebuilt_pkts;
-}
+{ return total_rebuilt_pkts; }
 
 void PacketManager::encode_set_pkt(Packet* p)
-{
-    encode_pkt = p;
-}
+{ encode_pkt = p; }
index 76a10f8ba39cec8d0c5ebb0417332d140794a91f..fce9ea2aacedcf274e7262e9cfb2faa2b8c2d8fe 100644 (file)
@@ -42,23 +42,23 @@ extern THREAD_LOCAL ProfileStats decodePerfStats;
 /*
  *  PacketManager class
  */
-class PacketManager
+class SO_PUBLIC PacketManager
 {
 public:
     /* constructors, destructors, and statistics */
 
     // global plugin initializer. Called by LUA to add register codecs
-    static void add_plugin(const struct CodecApi*);
+    SO_PRIVATE static void add_plugin(const struct CodecApi*);
     // instantiate a specific codec with a codec specific Module
-    static void instantiate(const CodecApi*, Module*, SnortConfig*);
+    SO_PRIVATE static void instantiate(const CodecApi*, Module*, SnortConfig*);
     // instantiate any codec for which a module has not been provided.
-    static void instantiate();
+    SO_PRIVATE static void instantiate();
     // destroy all global codec related information
-    static void release_plugins();
+    SO_PRIVATE static void release_plugins();
     // initialize the current threads codecs
-    static void thread_init();
+    SO_PRIVATE static void thread_init();
     // destroy thread_local data
-    static void thread_term();
+    SO_PRIVATE static void thread_term();
     // allocate a Packet for later formatting (cloning)
     static Packet* encode_new(void);
     // release the allocated Packet
@@ -119,9 +119,7 @@ public:
 
     // reset the current 'clone' packet
     static inline void encode_reset(void)
-    {
-        encode_set_pkt(NULL);
-    }
+    { encode_set_pkt(NULL); }
 };
 
 #endif
index a3c750a7154c1435e12c3a4b7aae591c30da4d87..bae27962fa3c028e5ba24c0c7fe8f7be239b63da 100644 (file)
@@ -113,7 +113,7 @@ int main()
  *      array.
  *
  ****************************************************************/
-SO_PUBLIC char ** mSplit(const char *str, const char *sep_chars, const int max_toks,
+char ** mSplit(const char *str, const char *sep_chars, const int max_toks,
                int *num_toks, const char meta_char)
 {
     size_t cur_tok = 0;  /* current token index into array of strings */
@@ -462,7 +462,7 @@ static char * mSplitAddTok(const char *str, const int len, const char *sep_chars
  * At this point, toks is again NULL.
  *
  ****************************************************************/
-SO_PUBLIC void mSplitFree(char ***pbuf, int num_toks)
+void mSplitFree(char ***pbuf, int num_toks)
 {
     int i;
     char** buf;  /* array of string pointers */
@@ -505,7 +505,7 @@ SO_PUBLIC void mSplitFree(char ***pbuf, int num_toks)
  *      failure (substr not in str)
  *
  ****************************************************************/
-SO_PUBLIC int mContainsSubstr(const char *buf, int b_len, const char *pat, int p_len)
+int mContainsSubstr(const char *buf, int b_len, const char *pat, int p_len)
 {
     const char *b_idx;  /* index ptr into the data buffer */
     const char *p_idx;  /* index ptr into the pattern buffer */
index c3de46db81d6232d66049057673cb35bb3d868fe..10de22be764de9888265fec2321711bab6a58461 100644 (file)
 #ifndef MSTRING_H
 #define MSTRING_H
 
+#include "main/snort_types.h"
+
 /*  D E F I N E S  *******************************************************/
 #define TOKS_BUF_SIZE   100
 
 
 /*  P R O T O T Y P E S  *************************************************/
-char ** mSplit(const char *, const char *, const int, int *, const char);
-void mSplitFree(char ***toks, int numtoks);
-int mContainsSubstr(const char *, int, const char *, int);
+SO_PUBLIC char ** mSplit(const char *, const char *, const int, int *, const char);
+SO_PUBLIC void mSplitFree(char ***toks, int numtoks);
+SO_PUBLIC int mContainsSubstr(const char *, int, const char *, int);
 
 #endif  /* MSTRING_H */
index 487561578b4741a5786dba1b4f43fa9c065b074d..cc2f093a371cbe10a8c63ffd074cc72c65c5534f 100644 (file)
@@ -1044,7 +1044,7 @@ void OrderRuleLists(SnortConfig *sc, const char *order)
     sc->rule_lists = ordered_list;
 }
 
-SO_PUBLIC NORETURN void ParseAbort(const char *format, ...)
+NORETURN void ParseAbort(const char *format, ...)
 {
     char buf[STD_BUF+1];
     va_list ap;
@@ -1065,7 +1065,7 @@ SO_PUBLIC NORETURN void ParseAbort(const char *format, ...)
         FatalError("%s\n", buf);
 }
 
-SO_PUBLIC void ParseError(const char *format, ...)
+void ParseError(const char *format, ...)
 {
     char buf[STD_BUF+1];
     va_list ap;
@@ -1088,7 +1088,7 @@ SO_PUBLIC void ParseError(const char *format, ...)
     parse_errors++;
 }
 
-SO_PUBLIC void ParseWarning(const char *format, ...)
+void ParseWarning(const char *format, ...)
 {
     char buf[STD_BUF+1];
     va_list ap;
@@ -1109,7 +1109,7 @@ SO_PUBLIC void ParseWarning(const char *format, ...)
         LogMessage("%s\n", buf);
 }
 
-SO_PUBLIC void ParseMessage(const char *format, ...)
+void ParseMessage(const char *format, ...)
 {
     char buf[STD_BUF+1];
     va_list ap;
index c640197dd8f91dbf268a085435b59b1646649bfb..507a008e83d05427cac0fb04e8bcfa22f95597f3 100644 (file)
@@ -64,10 +64,10 @@ void parser_append_rules(const char*);
 
 void ConfigureSideChannelModules(SnortConfig *);
 
-NORETURN void ParseAbort(const char *, ...);
-void ParseError(const char *, ...);
-void ParseWarning(const char *, ...);
-void ParseMessage(const char *, ...);
+SO_PUBLIC NORETURN void ParseAbort(const char *, ...);
+SO_PUBLIC void ParseError(const char *, ...);
+SO_PUBLIC void ParseWarning(const char *, ...);
+SO_PUBLIC void ParseMessage(const char *, ...);
 
 int ParseBool(const char *arg);
 
index 8be5e7a32f104bc27210d3f0be920db718756aea..8d73dea7c53ebea617310e7746c74b1c8ae94be6 100644 (file)
@@ -19,4 +19,3 @@ sf_vartable.h
 libsfip_a_CXXFLAGS = $(AM_CXXFLAGS) -fvisibility=default
 
 AM_CXXFLAGS = @AM_CXXFLAGS@
-
index 94178aad4daf68752402bcbf42e7a5ee8a5c8717..1014ddc05b05532772c68d0ccb77e1d48cc425c1 100644 (file)
@@ -58,9 +58,6 @@
 #include "target_based/sftarget_protocol_reference.h"
 #include "target_based/sftarget_hostentry.h"
 
-//-------------------------------------------------------------------------
-// public methods other than ctor / dtor must all be declared SO_PUBLIC
-//-------------------------------------------------------------------------
 
 Stream stream;  // FIXIT-L global for SnortContext
 
index 57bfbc3d8711903aedf4cbb1434ecdfeeafa76b5..6fc36f49d3d2efc09cd0122da2851b47d574d5ee 100644 (file)
@@ -81,11 +81,15 @@ typedef void (*Stream_Callback)(Packet *);
 #define MAX_EVT_CB 32
 #define MAX_LOG_FN 32
 
+//-------------------------------------------------------------------------
+// public methods other than ctor / dtor must all be declared SO_PUBLIC
+//-------------------------------------------------------------------------
+
 class SO_PUBLIC Stream
 {
 public:
-    Stream();
-    ~Stream();
+    SO_PRIVATE Stream();
+    SO_PRIVATE ~Stream();
 
     static Flow* get_session(const FlowKey*);
     static Flow* new_session(const FlowKey*);
index 3d581e56ded040977283e0a88a6c2ecd559175f0..38272cf4bd53608271aeef362e7dc70652883261 100644 (file)
 static THREAD_LOCAL uint8_t pdu_buf[65536];
 static THREAD_LOCAL StreamBuffer str_buf;
 
-SO_PUBLIC uint32_t StreamSplitter::max()
+uint32_t StreamSplitter::max()
 { return 16384; }  // FIXIT-H make default configurable
 
-SO_PUBLIC const StreamBuffer* StreamSplitter::reassemble(
+const StreamBuffer* StreamSplitter::reassemble(
     Flow*, unsigned, unsigned offset, const uint8_t* p,
     unsigned n, uint32_t flags, unsigned& copied)
 { 
index 7c9067fdca5849ae215e0162dd37263c1047d109..bbfae43ecaaa4820635c56cacaf799a8011c47d4 100644 (file)
@@ -178,7 +178,7 @@ int *make_shift(char *ptrn, int plen)
  *      -1 if not found or offset >= 0 if found
  *
  ****************************************************************/
-SO_PUBLIC int mSearch(
+int mSearch(
     const char *buf, int blen, const char *ptrn, int plen, int *skip, int *shift)
 {
     DEBUG_WRAP(DebugMessage(DEBUG_PATTERN_MATCH,"buf: %p  blen: %d  ptrn: %p  "
@@ -227,7 +227,7 @@ SO_PUBLIC int mSearch(
  *      -1 if not found or offset >= 0 if found
  *
  ****************************************************************/
-SO_PUBLIC int mSearchCI(
+int mSearchCI(
     const char *buf, int blen, const char *ptrn, int plen, int *skip, int *shift)
 {
     int b_idx = plen;
@@ -273,7 +273,7 @@ SO_PUBLIC int mSearchCI(
  *      1 = found, 0 = not found
  *
  ****************************************************************/
-SO_PUBLIC int mSearchREG(
+int mSearchREG(
     const char *buf, int blen, const char *ptrn, int plen, int *skip, int *shift)
 {
     int b_idx = plen;
index 518bff49f2bcd7e7d621ed678d84da533fff0da1..95d52ac5fc6cfc76fe7fd38ddb3761348a52dc97 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef BOYER_MOORE_H
 #define BOYER_MOORE_H
 
+#include "main/snort_types.h"
 // boyer_moore.h was split out of mstring.h
 
 int *make_skip(char *, int);
index d0b3e21b6de419ba4ad4741a30e8f0b2de28a808..6056fc144bc5c750d8b0b9cac65385fe8dfdc97c 100644 (file)
@@ -74,12 +74,7 @@ int main (int argc, char* argv[])
     // keep track whether we're printing rules into a seperate file.
     bool rule_file_specifed = false;
 
-// why print variable if there are no rules?
-#if 1
-    // FIXIT-H
-    // if no rule file is specified (or the same output and rule file specified),
-    // rules will be printed in the 'default_rules' variable. Set that up
-    // now.  Otherwise, set up the include file.
+
     if (!rule_api.empty())
     {
         if (rule_file.empty() || !rule_file.compare(output_file))
@@ -100,7 +95,7 @@ int main (int argc, char* argv[])
             table_api.close_table();
         }
     }
-#endif
+
 
     // Snort++ requires a binder table to be instantiated,
     // although not necessarily filled.  So, just add this table.
@@ -109,7 +104,6 @@ int main (int argc, char* argv[])
     table_api.close_table();
 
     // finally, lets print the converter to file
-
     std::ofstream out;
     out.open(output_file,  std::ifstream::out);
     out << "require(\"snort_config\")  -- for loading\n\n";
index 5e4e19513d422fd8b1815bbb5125b56fa0147e2d..5d0168322dec3c3fe9849b0c0a5790ba550202ee 100644 (file)
@@ -50,7 +50,7 @@ bool Converter::initialize(conv_new_f func)
 
     if (state == nullptr)
     {
-        std::cout << "Failed Converter initialization!" << std::endl;
+        data_api.developer_error("Failed Converter initialization!");
         return false;
     }
 
@@ -96,24 +96,10 @@ void Converter::parse_include_file(std::string input_file)
     if (convert_rules_mult_files)
         rule_api.swap_rules(rules);
 
-    if (convert_file(input_file) < 0)
-    {
-        error = true;
-        if (convert_conf_mult_files)
-        {
-            // FIXIT:  This needs to tables, and data_api
-            data_api.swap_conf_data(vars, includes, comments);
-            table_api.swap_tables(tables);
-            delete comments;
-        }
 
-        if (convert_rules_mult_files)
-            rule_api.swap_rules(rules);
-
-        // add this new file as a snort style rule
-        rule_api.add_hdr_data("include " + input_file);
-        return;
-    }
+    // MAIN CONVERSION!!
+    if (convert_file(input_file) < 0)
+        error = true; // return a negative number to main snort2lua method
 
 
     if (convert_conf_mult_files)
@@ -128,32 +114,29 @@ void Converter::parse_include_file(std::string input_file)
             data_api.print_comments(out);
             out << std::endl;
             out.close();
+
+            data_api.add_include_file(input_file + ".lua");
         }
 
         data_api.swap_conf_data(vars, includes, comments);
-        data_api.add_include_file(input_file + ".lua");
         table_api.swap_tables(tables);
         delete comments;
     }
 
+
     if (convert_rules_mult_files)
     {
-        bool include_rule_file = false;
-
         if (!rule_api.empty())
         {
             std::ofstream out;
             out.open(input_file + ".rules");
             rule_api.print_rules(out, true); // true == output to rule file, NOT lua file
             out.close();
-            include_rule_file = true;
+
+            rule_api.add_hdr_data("include " + input_file + ".rules");
         }
 
         rule_api.swap_rules(rules);
-
-        // add this new file as a snort style rule
-        if (include_rule_file)
-            rule_api.add_hdr_data("include " + input_file + ".rules");
     }
 }