void action_apply(RuleType, struct Packet*);
-static inline bool pass_action(RuleType a)
+inline bool pass_action(RuleType a)
{ return ( a == RULE_TYPE__PASS ); }
#endif
};
};
-static inline uint16_t cksum_add(const uint16_t* buf, std::size_t len, uint32_t cksum)
+inline uint16_t cksum_add(const uint16_t* buf, std::size_t len, uint32_t cksum)
{
const uint16_t* sp = buf;
std::size_t n, sn;
return (uint16_t)(~cksum);
}
-static inline void add_ipv4_pseudoheader(const Pseudoheader* const ph4,
+inline void add_ipv4_pseudoheader(const Pseudoheader* const ph4,
uint32_t& cksum)
{
/*
cksum += h[5];
}
-static inline void add_ipv6_pseudoheader(const Pseudoheader6* const ph6,
+inline void add_ipv6_pseudoheader(const Pseudoheader6* const ph6,
uint32_t& cksum)
{
/*
cksum += h[17];
}
-static inline void add_tcp_header(const uint16_t*& d,
+inline void add_tcp_header(const uint16_t*& d,
std::size_t& len,
uint32_t& cksum)
{
len -= 20;
}
-static inline void add_udp_header(const uint16_t*& d,
+inline void add_udp_header(const uint16_t*& d,
size_t& len,
uint32_t& cksum)
{
d += 4;
}
-static inline void add_ip_header(const uint16_t*& d,
+inline void add_ip_header(const uint16_t*& d,
std::size_t& len,
uint32_t& cksum)
{
return detail::cksum_add(buf, len, cksum);
}
-static inline uint16_t cksum_add(const uint16_t* buf, std::size_t len)
+inline uint16_t cksum_add(const uint16_t* buf, std::size_t len)
{ return detail::cksum_add(buf, len, 0); }
} // namespace checksum
/* Inline Functions */
/* If available, look at the next available byte in the input queue */
-static inline bool Peek_1(fd_session_p_t SessionPtr, uint8_t* c)
+inline bool Peek_1(fd_session_p_t SessionPtr, uint8_t* c)
{
if ( (SessionPtr->Next_In != NULL) && (SessionPtr->Avail_In > 0) )
{
}
/* If available, get a byte from the input queue */
-static inline bool Get_1(fd_session_p_t SessionPtr, uint8_t* c)
+inline bool Get_1(fd_session_p_t SessionPtr, uint8_t* c)
{
if ( (SessionPtr->Next_In != NULL) && (SessionPtr->Avail_In > 0) )
{
/* If available, get N bytes from the input queue. All N must be
availble for this call to succeed. */
-static inline bool Get_N(fd_session_p_t SessionPtr, uint8_t** c, uint16_t N)
+inline bool Get_N(fd_session_p_t SessionPtr, uint8_t** c, uint16_t N)
{
if ( (SessionPtr->Next_In != NULL) && (SessionPtr->Avail_In >= N) )
{
}
/* If there's room in the output queue, put one byte. */
-static inline bool Put_1(fd_session_p_t SessionPtr, uint8_t c)
+inline bool Put_1(fd_session_p_t SessionPtr, uint8_t c)
{
if ( (SessionPtr->Next_Out != NULL) && (SessionPtr->Avail_Out > 0) )
{
/* If the output queue has room available, place N bytes onto the queue.
The output queue must have space for N bytes for this call to succeed. */
-static inline bool Put_N(fd_session_p_t SessionPtr, uint8_t* c, uint16_t N)
+inline bool Put_N(fd_session_p_t SessionPtr, uint8_t* c, uint16_t N)
{
if ( (SessionPtr->Next_Out != NULL) && (SessionPtr->Avail_Out >= N) )
{
/* If the input queue has at least one byte available AND there's at
space for at least one byte in the output queue, then move one byte. */
-static inline bool Move_1(fd_session_p_t SessionPtr)
+inline bool Move_1(fd_session_p_t SessionPtr)
{
if ( (SessionPtr->Next_Out != NULL) && (SessionPtr->Avail_Out > 0) &&
(SessionPtr->Next_In != NULL) && (SessionPtr->Avail_In > 0) )
/* If the input queue has at least N bytes available AND there's at
space for at least N bytes in the output queue, then move all N bytes. */
-static inline bool Move_N(fd_session_p_t SessionPtr, uint16_t N)
+inline bool Move_N(fd_session_p_t SessionPtr, uint16_t N)
{
if ( (SessionPtr->Next_Out != NULL) && (SessionPtr->Avail_Out >= N) &&
(SessionPtr->Next_In != NULL) && (SessionPtr->Avail_In >= N) )
// don't eval content rules
// non-content rules are still evaluated
-static inline void DisableDetect(Packet*)
+inline void DisableDetect(Packet*)
{
do_detect_content = 0;
}
// don't want to do any detection with rules
// (no content and no non-content)
-static inline void DisableInspection(Packet*)
+inline void DisableInspection(Packet*)
{
do_detect = do_detect_content = 0;
}
#define IsLimitedDetect(pktPtr) (pktPtr->packet_flags & PKT_HTTP_DECODE)
-static inline void set_file_data(uint8_t* p, unsigned n)
+inline void set_file_data(uint8_t* p, unsigned n)
{
g_file_data.data = p;
g_file_data.len = n;
void EventTrace_Log(const Packet*, const OptTreeNode*, int action);
-static inline int EventTrace_IsEnabled(void)
+inline int EventTrace_IsEnabled(void)
{
return ( snort_conf->event_trace_max > 0 );
}
-static inline void DetectReset()
+inline void DetectReset()
{
g_file_data.len = 0;
}
SO_PUBLIC bool otn_has_plugin(OptTreeNode* otn, const char* name);
-static inline bool otn_has_plugin(OptTreeNode* otn, int id)
+inline bool otn_has_plugin(OptTreeNode* otn, int id)
{ return (otn->plugins & (0x1 << id)) != 0; }
-static inline void otn_set_plugin(OptTreeNode* otn, int id)
+inline void otn_set_plugin(OptTreeNode* otn, int id)
{ otn->plugins |= (0x1 << id); }
bool otn_set_agent(OptTreeNode*, IpsOption*);
#define DEFAULT_FILE_ID 0
-static inline void initFilePosition(FilePosition* position, uint64_t processed_size)
+inline void initFilePosition(FilePosition* position, uint64_t processed_size)
{
*position = SNORT_FILE_START;
if (processed_size)
*position = SNORT_FILE_MIDDLE;
}
-static inline void updateFilePosition(FilePosition* position, uint64_t processed_size)
+inline void updateFilePosition(FilePosition* position, uint64_t processed_size)
{
if ((*position == SNORT_FILE_END) || (*position == SNORT_FILE_FULL))
*position = SNORT_FILE_START;
*position = SNORT_FILE_MIDDLE;
}
-static inline void finalFilePosition(FilePosition* position)
+inline void finalFilePosition(FilePosition* position)
{
if (*position == SNORT_FILE_START)
*position = SNORT_FILE_FULL;
*position = SNORT_FILE_END;
}
-static inline bool isFileStart(FilePosition position)
+inline bool isFileStart(FilePosition position)
{
return ((position == SNORT_FILE_START) || (position == SNORT_FILE_FULL));
}
-static inline bool isFileEnd(FilePosition position)
+inline bool isFileEnd(FilePosition position)
{
return ((position == SNORT_FILE_END) || (position == SNORT_FILE_FULL));
}
void SFRF_ShowObjects(RateFilterConfig*);
-static inline void EnableInternalEvent(RateFilterConfig* config, uint32_t sid)
+inline void EnableInternalEvent(RateFilterConfig* config, uint32_t sid)
{
if (config == NULL)
return;
config->internal_event_mask |= (1 << sid);
}
-static inline bool InternalEventIsEnabled(RateFilterConfig* config, uint32_t sid)
+inline bool InternalEventIsEnabled(RateFilterConfig* config, uint32_t sid)
{
if (config == NULL)
return 0;
SECTION("invalid value")
{
Value test_val("12345678901234567890");
- test_str = (uint8_t*)test_val.get_buffer(num_chars);
+ test_val.get_buffer(num_chars);
REQUIRE(num_chars == 20);
test_val.get_addr(addr);
SECTION("invalid value")
{
Value test_val("123456");
- test_str = (uint8_t *)test_val.get_buffer(num_chars);
+ test_val.get_buffer(num_chars);
REQUIRE(num_chars == 6);
test_val.get_addr_ip4(addr);
SECTION("invalid value")
{
Value test_val("123456");
- test_str = (uint8_t *)test_val.get_buffer(num_chars);
+ test_val.get_buffer(num_chars);
REQUIRE(num_chars == 6);
test_val.get_addr_ip6(addr);
typedef MD5Context MD5_CTX;
-static inline int MD5_Init(MD5_CTX* c)
+inline int MD5_Init(MD5_CTX* c)
{ MD5Init(c); return 0; }
-static inline int MD5_Update(MD5_CTX* c, const unsigned char* data, unsigned long len)
+inline int MD5_Update(MD5_CTX* c, const unsigned char* data, unsigned long len)
{ MD5Update(c, data, len); return 0; }
-static inline int MD5_Final(unsigned char* md, MD5_CTX* c)
+inline int MD5_Final(unsigned char* md, MD5_CTX* c)
{ MD5Final(md, c); return 0; }
#endif
SO_PUBLIC int sfxhash_remove(SFXHASH* h, void* key);
// Get the # of Nodes in HASH the table
-static inline unsigned sfxhash_count(SFXHASH* t)
+inline unsigned sfxhash_count(SFXHASH* t)
{ return t->count; }
// Get the # auto recovery
-static inline unsigned sfxhash_anr_count(SFXHASH* t)
+inline unsigned sfxhash_anr_count(SFXHASH* t)
{ return t->anr_count; }
// Get the # finds
-static inline unsigned sfxhash_find_total(SFXHASH* t)
+inline unsigned sfxhash_find_total(SFXHASH* t)
{ return t->find_success + t->find_fail; }
// Get the # unsucessful finds
-static inline unsigned sfxhash_find_fail(SFXHASH* t)
+inline unsigned sfxhash_find_fail(SFXHASH* t)
{ return t->find_fail; }
// Get the # sucessful finds
-static inline unsigned sfxhash_find_success(SFXHASH* t)
+inline unsigned sfxhash_find_success(SFXHASH* t)
{ return t->find_success; }
// Get the # of overhead bytes
-static inline unsigned sfxhash_overhead_bytes(SFXHASH* t)
+inline unsigned sfxhash_overhead_bytes(SFXHASH* t)
{ return t->overhead_bytes; }
// Get the # of overhead blocks
-static inline unsigned sfxhash_overhead_blocks(SFXHASH* t)
+inline unsigned sfxhash_overhead_blocks(SFXHASH* t)
{ return t->overhead_blocks; }
SO_PUBLIC void* sfxhash_mru(SFXHASH* t);
* helper functions
*-------------------------------------------------------------------
*/
-static inline bool TextLog_NewLine(TextLog* const txt)
+inline bool TextLog_NewLine(TextLog* const txt)
{
return TextLog_Putc(txt, '\n');
}
-static inline bool TextLog_Puts(TextLog* const txt, const char* str)
+inline bool TextLog_Puts(TextLog* const txt, const char* str)
{
return TextLog_Write(txt, str, strlen(str));
}
inline T** regurgitate(lua_State* L, const char* name, int arg)
{ return static_cast<T**>(const_cast<void*>(luaL_checkudata(L, arg, name))); }
-static inline int register_methods(
+inline int register_methods(
lua_State* L, const luaL_Reg* methods, const char* name = nullptr)
{
luaL_register(L, name, methods);
return lua_gettop(L);
}
-static inline int register_metamethods(
+inline int register_metamethods(
lua_State* L, const luaL_Reg* methods, const char* name)
{
luaL_newmetatable(L, name);
return lua_gettop(L);
}
-static inline void register_with_closure(
+inline void register_with_closure(
lua_State* L, const luaL_Reg* methods, int table, int cl)
{
ManageStack ms(L, 2);
}
}
-static inline int new_lib(lua_State* L, const char* name)
+inline int new_lib(lua_State* L, const char* name)
{
const luaL_Reg empty[] = { { nullptr, nullptr } };
return register_methods(L, empty, name);
namespace Lua
{
template<typename T>
-static inline constexpr bool IsInteger()
+inline constexpr bool IsInteger()
{ return std::is_integral<T>::value && !std::is_same<T, bool>::value; }
template<typename T, typename Integral = void, typename Unsigned = void>
struct Stack<T, typename std::enable_if<IsInteger<T>()>::type,
typename std::enable_if<std::is_unsigned<T>::value>::type>
{
- static inline void push(lua_State* L, const T& v)
+ static void push(lua_State* L, const T& v)
{ lua_pushinteger(L, v); }
- static inline T get(lua_State* L, int n)
+ static T get(lua_State* L, int n)
{ return lua_tointeger(L, n); }
- static inline constexpr int type()
+ static constexpr int type()
{ return LUA_TNUMBER; }
- static inline bool validate(lua_State* L, int n, T& v)
+ static bool validate(lua_State* L, int n, T& v)
{
if ( lua_type(L, n) != type() )
return false;
return true;
}
- static inline bool validate(lua_State* L, int n)
+ static bool validate(lua_State* L, int n)
{
T v;
return validate(L, n, v);
struct Stack<T, typename std::enable_if<IsInteger<T>()>::type,
typename std::enable_if<!std::is_unsigned<T>::value>::type>
{
- static inline void push(lua_State* L, const T& v)
+ static void push(lua_State* L, const T& v)
{ lua_pushinteger(L, v); }
- static inline T get(lua_State* L, int n)
+ static T get(lua_State* L, int n)
{ return lua_tointeger(L, n); }
- static inline constexpr int type()
+ static constexpr int type()
{ return LUA_TNUMBER; }
- static inline bool validate(lua_State* L, int n, T& v)
+ static bool validate(lua_State* L, int n, T& v)
{
if ( lua_type(L, n) != type() )
return false;
return true;
}
- static inline bool validate(lua_State* L, int n)
+ static bool validate(lua_State* L, int n)
{
T v;
return validate(L, n, v);
template<typename T>
struct Stack<T, typename std::enable_if<!IsInteger<T>()>::type>
{
- static inline void push(lua_State*, T);
- static inline void push(lua_State*, T, size_t);
+ static void push(lua_State*, T);
+ static void push(lua_State*, T, size_t);
- static inline T get(lua_State*, int);
- static inline T get(lua_State*, int, size_t&);
+ static T get(lua_State*, int);
+ static T get(lua_State*, int, size_t&);
- static inline constexpr int type();
+ static constexpr int type();
- static inline bool validate(lua_State* L, int n, T& v)
+ static bool validate(lua_State* L, int n, T& v)
{
if ( lua_type(L, n) != type() )
return false;
return true;
}
- static inline bool validate(lua_State* L, int n)
+ static bool validate(lua_State* L, int n)
{
T v;
return validate(L, n, v);
}
- static inline bool validate(lua_State*, int, T&, size_t&);
+ static bool validate(lua_State*, int, T&, size_t&);
};
// const char*
};
template<typename T>
-static inline void fill_table_from_vector(lua_State* L, int tindex, std::vector<T>& vec)
+inline void fill_table_from_vector(lua_State* L, int tindex, std::vector<T>& vec)
{
Table table(L, tindex);
int i = 0;
#include <string.h>
#include <luajit-2.0/lua.hpp>
-static inline void l_end_lua_state(lua_State*& L_ptr)
+inline void l_end_lua_state(lua_State*& L_ptr)
{
if ( L_ptr )
{
}
}
-static inline void l_reset_lua_state(lua_State*& L_ptr)
+inline void l_reset_lua_state(lua_State*& L_ptr)
{
l_end_lua_state(L_ptr);
L_ptr = luaL_newstate();
}
template<typename T, size_t N>
-static inline constexpr size_t sizeofArray(T (&)[N])
+inline constexpr size_t sizeofArray(T (&)[N])
{ return N; }
#endif
const char* fmt_expected_message(const char* type);
const char* fmt_range_message(unsigned min, unsigned max);
-static inline void set_script_dir(
+inline void set_script_dir(
lua_State* L, const std::string varname, const std::string path)
{
std::string dir = path.substr(0, path.rfind(LUA_DIR_SEP));
MimeBoundaryState boundary_state;
};
-static inline bool scanning_boundary(MimeDataPafInfo* mime_info, uint32_t boundary_start,
- uint32_t* fp)
+inline bool scanning_boundary(MimeDataPafInfo* mime_info, uint32_t boundary_start, uint32_t* fp)
{
if (boundary_start &&
mime_info->data_state == MIME_PAF_FOUND_BOUNDARY_STATE &&
int Norm_SetConfig(NormalizerConfig*);
int Norm_Packet(NormalizerConfig*, Packet*);
-static inline void Norm_Enable(NormalizerConfig* nc, NormFlags nf)
+inline void Norm_Enable(NormalizerConfig* nc, NormFlags nf)
{
nc->normalizer_flags |= nf;
}
-static inline void Norm_Disable(NormalizerConfig* nc, NormFlags nf)
+inline void Norm_Disable(NormalizerConfig* nc, NormFlags nf)
{
nc->normalizer_flags &= ~nf;
}
-static inline void Norm_Set(NormalizerConfig* nc, NormFlags nf, bool enable)
+inline void Norm_Set(NormalizerConfig* nc, NormFlags nf, bool enable)
{
if ( enable )
Norm_Enable(nc, nf);
Norm_Disable(nc, nf);
}
-static inline int Norm_IsEnabled(const NormalizerConfig* nc, NormFlags nf)
+inline int Norm_IsEnabled(const NormalizerConfig* nc, NormFlags nf)
{
return ( (nc->normalizer_flags & nf) != 0 );
}
-static inline void Norm_TcpPassOption(NormalizerConfig* nc, uint8_t opt)
+inline void Norm_TcpPassOption(NormalizerConfig* nc, uint8_t opt)
{
uint8_t byte = (opt >> 3), bit = (1 << (opt & 0x07));
nc->normalizer_options[byte] |= bit;
}
-static inline void Norm_TcpDropOption(NormalizerConfig* nc, uint8_t opt)
+inline void Norm_TcpDropOption(NormalizerConfig* nc, uint8_t opt)
{
uint8_t byte = (opt >> 3), bit = (1 << (opt & 0x07));
nc->normalizer_options[byte] &= ~bit;
}
-static inline int Norm_TcpIsOptional(const NormalizerConfig* nc, uint8_t opt)
+inline int Norm_TcpIsOptional(const NormalizerConfig* nc, uint8_t opt)
{
uint8_t byte = (opt >> 3), bit = (1 << (opt & 0x07));
return ( (nc->normalizer_options[byte] & bit) != 0 );
extern int perfmon_rotate_perf_file;
/* functions to set & get the RotatePerfFileFlag */
-static inline void SetRotatePerfFileFlag(void)
+inline void SetRotatePerfFileFlag(void)
{
perfmon_rotate_perf_file = 1;
}
-static inline int IsSetRotatePerfFileFlag(void)
+inline int IsSetRotatePerfFileFlag(void)
{
return perfmon_rotate_perf_file;
}
-static inline void ClearRotatePerfFileFlag(void)
+inline void ClearRotatePerfFileFlag(void)
{
perfmon_rotate_perf_file = 0;
}
static bool init(SnortConfig*);
static void term();
- static inline void reset()
+ static void reset()
{
active_status = AST_ALLOW;
active_action = ACT_PASS;
RuleTreeNode* deleteRtnFromOtn(struct OptTreeNode*);
RuleTreeNode* deleteRtnFromOtn(struct OptTreeNode*, PolicyId);
-static inline RuleTreeNode* getRtnFromOtn(
+inline RuleTreeNode* getRtnFromOtn(
const struct OptTreeNode* otn, PolicyId policyId)
{
if (otn && otn->proto_nodes && (otn->proto_node_num > (unsigned)policyId))
return NULL;
}
-static inline RuleTreeNode* getRtnFromOtn(
+inline RuleTreeNode* getRtnFromOtn(
const struct OptTreeNode* otn)
{
return getRtnFromOtn(otn, get_ips_policy()->policy_id);
}
-static inline RuleTreeNode* getRuntimeRtnFromOtn(
+inline RuleTreeNode* getRuntimeRtnFromOtn(
const struct OptTreeNode* otn)
{
return getRtnFromOtn(otn);
};
template<typename... Args>
-static inline void error(std::string fmt, Args&&... args)
+inline void error(std::string fmt, Args&&... args)
{
fmt.insert(0, "piglet: ");
fmt.append("\n");
using RawBuffer = std::string;
-static inline const uint8_t* get_data(RawBuffer& rb)
+inline const uint8_t* get_data(RawBuffer& rb)
{ return reinterpret_cast<const uint8_t*>(rb.data()); }
-static inline uint8_t* get_mutable_data(RawBuffer& rb)
+inline uint8_t* get_mutable_data(RawBuffer& rb)
{ return const_cast<uint8_t*>(get_data(rb)); }
extern const struct Lua::TypeInterface<RawBuffer> RawBufferIface;
{ ip_len = htons(new_len); }
};
-static inline bool isPrivateIP(uint32_t addr)
+inline bool isPrivateIP(uint32_t addr)
{
addr = ntohl(addr);
switch (addr & 0xFF000000)
// Reflects the recomended IPv6 order in RFC 2460 4.1
constexpr int IPV6_ORDER_MAX = 7;
-static inline int IPV6ExtensionOrder(uint8_t type)
+inline int IPV6ExtensionOrder(uint8_t type)
{
switch (type)
{
#define BIT(i) (0x1 << (i-1))
-static inline void SetExtraData(Packet* p, const uint32_t xid)
+inline void SetExtraData(Packet* p, const uint32_t xid)
{ p->xtradata_mask |= BIT(xid); }
-static inline uint16_t extract_16bits(const uint8_t* const p)
+inline uint16_t extract_16bits(const uint8_t* const p)
{ return ntohs(*(uint16_t*)(p)); }
#ifdef WORDS_MUSTALIGN
#ifdef __GNUC__
/* force word-aligned ntohl parameter */
-static inline uint32_t extract_32bits(const uint8_t* p)
+inline uint32_t extract_32bits(const uint8_t* p)
{
uint32_t tmp;
memmove(&tmp, p, sizeof(uint32_t));
#else
/* allows unaligned ntohl parameter - dies w/SIGBUS on SPARCs */
-static inline uint32_t extract_32bits(const uint8_t* p)
+inline uint32_t extract_32bits(const uint8_t* p)
{ return ntohl(*(uint32_t*)p); }
#endif
static uint16_t encode_get_max_payload(const Packet*);
// reset the current 'clone' packet
- static inline void encode_reset(void)
+ static void encode_reset(void)
{ encode_set_pkt(NULL); }
// print codec information. MUST be called after thread_term.
constexpr uint16_t ETHERTYPE_EAPOL = 0x888e;
constexpr uint16_t ETHERTYPE_FPATH = 0x8903;
-static inline bool is_ip6_extension(const uint8_t proto)
+inline bool is_ip6_extension(const uint8_t proto)
{
switch (proto)
{
};
/* End Token Ring Data Structures */
-static inline const Trh_mr* get_trhmr(const Trh_llc* llc)
+inline const Trh_mr* get_trhmr(const Trh_llc* llc)
{
if (llc->dsap != IPARP_SAP && llc->ssap != IPARP_SAP)
return reinterpret_cast<const Trh_mr*>(llc);
#pragma pack()
-static inline uint8_t DceRpcCoVersMaj(const DceRpcCoHdr* co)
+inline uint8_t DceRpcCoVersMaj(const DceRpcCoHdr* co)
{
return co->pversion.major;
}
-static inline uint8_t DceRpcCoVersMin(const DceRpcCoHdr* co)
+inline uint8_t DceRpcCoVersMin(const DceRpcCoHdr* co)
{
return co->pversion.minor;
}
-static inline DceRpcPduType DceRpcCoPduType(const DceRpcCoHdr* co)
+inline DceRpcPduType DceRpcCoPduType(const DceRpcCoHdr* co)
{
return (DceRpcPduType)co->ptype;
}
-static inline DceRpcBoFlag DceRpcCoByteOrder(const DceRpcCoHdr* co)
+inline DceRpcBoFlag DceRpcCoByteOrder(const DceRpcCoHdr* co)
{
return DceRpcByteOrder(co->packed_drep[0]);
}
-static inline uint16_t DceRpcCoFragLen(const DceRpcCoHdr* co)
+inline uint16_t DceRpcCoFragLen(const DceRpcCoHdr* co)
{
return DceRpcNtohs(&co->frag_length, DceRpcCoByteOrder(co));
}
DCE2_Ret DCE2_ListInsert(DCE2_List*, void*, void*);
void* DCE2_ListFirst(DCE2_List*);
void* DCE2_ListNext(DCE2_List*);
-static inline bool DCE2_ListIsEmpty(DCE2_List*);
+inline bool DCE2_ListIsEmpty(DCE2_List*);
void DCE2_ListEmpty(DCE2_List*);
void DCE2_ListDestroy(DCE2_List*);
* false if the list has one or more nodes in it.
*
********************************************************************/
-static inline bool DCE2_ListIsEmpty(DCE2_List* list)
+inline bool DCE2_ListIsEmpty(DCE2_List* list)
{
if (list == nullptr)
return true;
// FIXIT-M add all the remaining fields
};
-static inline uint32_t NbssLen(const NbssHdr* nb)
+inline uint32_t NbssLen(const NbssHdr* nb)
{
/* Treat first bit of flags as the upper byte to length */
return ((nb->flags & 0x01) << 16) | ntohs(nb->length);
}
-static inline uint8_t NbssType(const NbssHdr* nb)
+inline uint8_t NbssType(const NbssHdr* nb)
{
return nb->type;
}
-static inline uint32_t SmbId(const SmbNtHdr* hdr)
+inline uint32_t SmbId(const SmbNtHdr* hdr)
{
#ifdef WORDS_MUSTALIGN
uint8_t* idf = (uint8_t*)hdr->smb_idf;
#endif /* WORDS_MUSTALIGN */
}
-static inline bool DCE2_SmbAutodetect(Packet* p)
+inline bool DCE2_SmbAutodetect(Packet* p)
{
if (p->dsize > (sizeof(NbssHdr) + sizeof(SmbNtHdr)))
{
DebugFormat(DEBUG_DCE_SMB, "%s\n", DCE2_DEBUG__PAF_START_MSG_SMB);
DebugFormat(DEBUG_DCE_SMB, "SMB: %u bytes of data\n", len);
+#ifdef DEBUG_MSGS
if (flags & PKT_FROM_CLIENT)
DebugMessage(DEBUG_DCE_SMB, "Packet from Client\n");
else
DebugMessage(DEBUG_DCE_SMB, "Packet from Server\n");
+#else
+ UNUSED(flags);
+#endif
if (dce2_paf_abort(flow))
{
extern THREAD_LOCAL ProfileStats dce2_tcp_pstat_co_reass;
extern THREAD_LOCAL ProfileStats dce2_tcp_pstat_co_ctx;
-static inline bool DCE2_TcpAutodetect(Packet* p)
+inline bool DCE2_TcpAutodetect(Packet* p)
{
if (p->dsize >= sizeof(DceRpcCoHdr))
{
DebugFormat(DEBUG_DCE_TCP, "%s\n", DCE2_DEBUG__PAF_START_MSG_TCP);
DebugFormat(DEBUG_DCE_TCP, "TCP: %u bytes of data\n", len);
+#ifdef DEBUG_MSGS
if (flags & PKT_FROM_CLIENT)
DebugMessage(DEBUG_DCE_TCP, "Packet from Client\n");
else
DebugMessage(DEBUG_DCE_TCP, "Packet from Server\n");
+#endif
if (dce2_paf_abort(flow))
{
* Inline function prototypes
********************************************************************/
-static inline bool DCE2_IsSpaceChar(const char);
-static inline bool DCE2_IsConfigEndChar(const char);
+inline bool DCE2_IsSpaceChar(const char);
+inline bool DCE2_IsConfigEndChar(const char);
-static inline char* DCE2_PruneWhiteSpace(char*);
-static inline bool DCE2_IsEmptyStr(char*);
+inline char* DCE2_PruneWhiteSpace(char*);
+inline bool DCE2_IsEmptyStr(char*);
-static inline int DCE2_UuidCompare(const void*, const void*);
+inline int DCE2_UuidCompare(const void*, const void*);
/********************************************************************
* Public function prototypes
* false if not a valid space character.
*
********************************************************************/
-static inline bool DCE2_IsSpaceChar(const char c)
+inline bool DCE2_IsSpaceChar(const char c)
{
if (isspace((int)c))
return true;
* false if not a valid end of configuration character.
*
********************************************************************/
-static inline bool DCE2_IsConfigEndChar(const char c)
+inline bool DCE2_IsConfigEndChar(const char c)
{
if (c == DCE2_CFG_TOK__END)
return true;
* argument are replaced by NULL bytes.
*
********************************************************************/
-static inline char* DCE2_PruneWhiteSpace(char* str)
+inline char* DCE2_PruneWhiteSpace(char* str)
{
char* end;
* false otherwise
*
********************************************************************/
-static inline bool DCE2_IsEmptyStr(char* str)
+inline bool DCE2_IsEmptyStr(char* str)
{
char* end;
return false;
}
-static inline int DCE2_UuidCompare(const void* data1, const void* data2)
+inline int DCE2_UuidCompare(const void* data1, const void* data2)
{
const Uuid* uuid1 = (Uuid*)data1;
const Uuid* uuid2 = (Uuid*)data2;
FTP_CMD_CONF* FTPCmd = NULL;
FTP_PARAM_FMT* HeadFmt = NULL;
+ assert(fmt);
+
char buf[1024];
strncpy(buf, fmt, sizeof(buf));
buf[sizeof(buf)-1] = '\0';
int IsJSNormData(Flow* flow);
int IsGzipData(Flow* flow);
-static inline void ClearHttpBuffers(void)
+inline void ClearHttpBuffers(void)
{
http_mask = 0;
}
-static inline uint32_t GetHttpBufferMask(void)
+inline uint32_t GetHttpBufferMask(void)
{
return http_mask;
}
-static inline const HttpBuffer* GetHttpBuffer(HTTP_BUFFER b)
+inline const HttpBuffer* GetHttpBuffer(HTTP_BUFFER b)
{
if ( !((1 << b) & http_mask) )
return NULL;
return http_buffer + b;
}
-static inline void SetHttpBuffer(
+inline void SetHttpBuffer(
HTTP_BUFFER b, const uint8_t* buf, unsigned len, uint32_t enc = 0)
{
HttpBuffer* hb = http_buffer + b;
http_mask |= (1 << b);
}
-static inline void ResetGzipState(DECOMPRESS_STATE* ds)
+inline void ResetGzipState(DECOMPRESS_STATE* ds)
{
if (ds == NULL)
return;
ds->decompress_data = 0;
}
-static inline void ResetRespState(HTTP_RESP_STATE* ds)
+inline void ResetRespState(HTTP_RESP_STATE* ds)
{
if (ds == NULL)
return;
ds->max_seq = 0;
}
-static inline int SetLogBuffers(HttpSessionData* hsd)
+inline int SetLogBuffers(HttpSessionData* hsd)
{
int iRet = 0;
return iRet;
}
-static inline void SetHttpDecode(uint16_t altLen)
+inline void SetHttpDecode(uint16_t altLen)
{
HttpDecodeBuf.len = altLen;
}
** @retval 1 within bounds
** @retval 0 not within bounds
*/
-static inline int hi_util_in_bounds(const u_char* start, const u_char* end, const u_char* p)
+inline int hi_util_in_bounds(const u_char* start, const u_char* end, const u_char* p)
{
if (p >= start && p < end)
{
return 0;
}
-static inline void SkipWhiteSpace(const u_char* start, const u_char* end,
+inline void SkipWhiteSpace(const u_char* start, const u_char* end,
const u_char** ptr)
{
while (hi_util_in_bounds(start, end, *ptr) && isspace((int)**ptr) && (**ptr != '\n'))
(*ptr)++;
}
-static inline int SkipBlankSpace(const u_char* start, const u_char* end,
+inline int SkipBlankSpace(const u_char* start, const u_char* end,
const u_char** ptr)
{
int count = 0;
return count;
}
-static inline void SkipDigits(const u_char* start, const u_char* end,
+inline void SkipDigits(const u_char* start, const u_char* end,
const u_char** ptr)
{
while ((hi_util_in_bounds(start, end, *ptr)) && (isdigit((int)**ptr)) )
}
}
-static inline void SkipBlankAndNewLine(const u_char* start, const u_char* end,
+inline void SkipBlankAndNewLine(const u_char* start, const u_char* end,
const u_char** ptr)
{
while ( (hi_util_in_bounds(start, end, *ptr)) &&
}
}
-static inline void SkipCRLF(const u_char* start, const u_char* end,
+inline void SkipCRLF(const u_char* start, const u_char* end,
const u_char** ptr)
{
while ( (hi_util_in_bounds(start, end, *ptr)) &&
}
}
-static inline int IsHeaderFieldName(const u_char* p, const u_char* end,
+inline int IsHeaderFieldName(const u_char* p, const u_char* end,
const char* header_name, size_t header_len)
{
if ((p+header_len) <= end)
/* return required size (eg for hashing)
* requires that address bytes be the last field in sfip_t */
-static inline unsigned int sfip_size(const sfip_t* ipt)
+inline unsigned int sfip_size(const sfip_t* ipt)
{
if ( ipt->family == AF_INET6 )
return sizeof(*ipt);
#define sfip_family(ip) ip->family
/* Returns the number of bits used for masking "ip" */
-static inline unsigned char sfip_bits(const sfip_t* ip)
+inline unsigned char sfip_bits(const sfip_t* ip)
{
ARG_CHECK1(ip, 0);
return (unsigned char)ip->bits;
}
-static inline void sfip_set_bits(sfip_t* p, int bits)
+inline void sfip_set_bits(sfip_t* p, int bits)
{
if (!p)
return;
/* IP Comparisons ******************************************************/
// Functions which will be defined below.
-static inline int sfip_is_set(const sfip_t& ip);
-static inline int sfip_is_set(const sfip_t* const ip);
-static inline bool sfip_equals(const sfip_t* const lhs, const sfip_t* const rhs);
-static inline bool sfip_unset_equals(const sfip_t* const lhs, const sfip_t* const rhs);
-static inline bool sfip_not_equals(const sfip_t* const lhs, const sfip_t* const rhs);
-static inline bool sfip_lesser(const sfip_t* const lhs, const sfip_t* const rhs);
-static inline bool sfip_greater(const sfip_t* const lhs, const sfip_t* const rhs);
-static inline void sfip_clear(sfip_t& x);
-static inline void sfip_copy(sfip_t& lhs, const sfip_t* const rhs);
+inline int sfip_is_set(const sfip_t& ip);
+inline int sfip_is_set(const sfip_t* const ip);
+inline bool sfip_equals(const sfip_t* const lhs, const sfip_t* const rhs);
+inline bool sfip_unset_equals(const sfip_t* const lhs, const sfip_t* const rhs);
+inline bool sfip_not_equals(const sfip_t* const lhs, const sfip_t* const rhs);
+inline bool sfip_lesser(const sfip_t* const lhs, const sfip_t* const rhs);
+inline bool sfip_greater(const sfip_t* const lhs, const sfip_t* const rhs);
+inline void sfip_clear(sfip_t& x);
+inline void sfip_copy(sfip_t& lhs, const sfip_t* const rhs);
/* Check if ip is contained within the network specified by net
Returns SFIP_EQUAL if so */
/* Returns 1 if the IP is non-zero. 0 otherwise */
/* XXX This is a performance critical function, \
* need to determine if it's safe to not check these pointers */
-static inline int sfip_is_set(const sfip_t* ip)
+inline int sfip_is_set(const sfip_t* ip)
{
// ARG_CHECK1(ip, -1);
return ip->ip32[0] ||
int sfip_ismapped(const sfip_t* ip);
/* Support function for sfip_compare */
-static inline SFIP_RET _ip4_cmp(u_int32_t ip1, u_int32_t ip2)
+inline SFIP_RET _ip4_cmp(u_int32_t ip1, u_int32_t ip2)
{
u_int32_t hip1 = htonl(ip1);
u_int32_t hip2 = htonl(ip2);
}
/* Support function for sfip_compare */
-static inline SFIP_RET _ip6_cmp(const sfip_t* ip1, const sfip_t* ip2)
+inline SFIP_RET _ip6_cmp(const sfip_t* ip1, const sfip_t* ip2)
{
SFIP_RET ret;
const u_int32_t* p1, * p2;
* or greater than ip2 In the case of mismatched families, the IPv4 address
* is converted to an IPv6 representation. */
/* XXX-IPv6 Should add version of sfip_compare that just tests equality */
-static inline SFIP_RET sfip_compare(const sfip_t* const ip1, const sfip_t* const ip2)
+inline SFIP_RET sfip_compare(const sfip_t* const ip1, const sfip_t* const ip2)
{
int f1,f2;
* or greater than ip2 In the case of mismatched families, the IPv4 address
* is converted to an IPv6 representation. */
/* XXX-IPv6 Should add version of sfip_compare that just tests equality */
-static inline SFIP_RET sfip_compare_unset(const sfip_t* const ip1, const sfip_t* const ip2)
+inline SFIP_RET sfip_compare_unset(const sfip_t* const ip1, const sfip_t* const ip2)
{
int f1,f2;
return SFIP_FAILURE;
}
-static inline int sfip_fast_lt4(const sfip_t* const ip1, const sfip_t* const ip2)
+inline int sfip_fast_lt4(const sfip_t* const ip1, const sfip_t* const ip2)
{
return *ip1->ip32 < *ip2->ip32;
}
-static inline int sfip_fast_gt4(const sfip_t* const ip1, const sfip_t* const ip2)
+inline int sfip_fast_gt4(const sfip_t* const ip1, const sfip_t* const ip2)
{
return *ip1->ip32 > *ip2->ip32;
}
-static inline int sfip_fast_eq4(const sfip_t* const ip1, const sfip_t* const ip2)
+inline int sfip_fast_eq4(const sfip_t* const ip1, const sfip_t* const ip2)
{
return *ip1->ip32 == *ip2->ip32;
}
-static inline int sfip_fast_lt6(const sfip_t* const ip1, const sfip_t* const ip2)
+inline int sfip_fast_lt6(const sfip_t* const ip1, const sfip_t* const ip2)
{
const u_int32_t* p1, * p2;
return 0;
}
-static inline int sfip_fast_gt6(const sfip_t* const ip1, const sfip_t* const ip2)
+inline int sfip_fast_gt6(const sfip_t* const ip1, const sfip_t* const ip2)
{
const u_int32_t* p1, * p2;
return 0;
}
-static inline int sfip_fast_eq6(const sfip_t* ip1, const sfip_t* ip2)
+inline int sfip_fast_eq6(const sfip_t* ip1, const sfip_t* ip2)
{
const u_int32_t* p1, * p2;
}
/* Checks if ip2 is equal to ip1 or contained within the CIDR ip1 */
-static inline bool sfip_fast_cont4(const sfip_t* ip1, const sfip_t* ip2)
+inline bool sfip_fast_cont4(const sfip_t* ip1, const sfip_t* ip2)
{
u_int32_t shift = 32 - sfip_bits(ip1);
u_int32_t ip = ntohl(*ip2->ip32);
}
/* Checks if ip2 is equal to ip1 or contained within the CIDR ip1 */
-static inline int sfip_fast_cont6(const sfip_t* ip1, const sfip_t* ip2)
+inline int sfip_fast_cont6(const sfip_t* ip1, const sfip_t* ip2)
{
u_int32_t ip;
int i, bits = sfip_bits(ip1);
/* Compares two IPs
* Returns 1 for equal and 0 for not equal
*/
-static inline int sfip_fast_equals_raw(const sfip_t* ip1, const sfip_t* ip2)
+inline int sfip_fast_equals_raw(const sfip_t* ip1, const sfip_t* ip2)
{
int f1,f2;
* 0 otherwise
*
********************************************************************/
-static inline int sfip_is_private(const sfip_t* ip)
+inline int sfip_is_private(const sfip_t* ip)
{
const unsigned int* p;
*
* SNORT RELIC
*/
-static inline int sfip_is_set(const sfip_t* const ip)
+inline int sfip_is_set(const sfip_t* const ip)
{
// ARG_CHECK1(ip, -1);
return ip->ip32[0] ||
ip->ip32[3] || ip->bits != 128)) || ((ip->family == AF_INET) && ip->bits != 32);
}
-static inline int sfip_is_set(const sfip_t& ip)
+inline int sfip_is_set(const sfip_t& ip)
{
// ARG_CHECK1(ip, -1);
return ip.ip32[0] ||
ip.ip32[3] || ip.bits != 128)) || ((ip.family == AF_INET) && ip.bits != 32);
}
-static inline bool _is_sfip_equals(const sfip_t* const lhs, const sfip_t* const rhs)
+inline bool _is_sfip_equals(const sfip_t* const lhs, const sfip_t* const rhs)
{
if (lhs->is_ip4())
{
}
}
-static inline bool _is_sfip_lesser(const sfip_t* const lhs, const sfip_t* const rhs)
+inline bool _is_sfip_lesser(const sfip_t* const lhs, const sfip_t* const rhs)
{
if (lhs->is_ip4())
{
}
}
-static inline bool sfip_equals(const sfip_t* const lhs, const sfip_t* const rhs)
+inline bool sfip_equals(const sfip_t* const lhs, const sfip_t* const rhs)
{
if (!sfip_is_set(lhs) || !sfip_is_set(rhs))
return true;
return _is_sfip_equals(lhs, rhs);
}
-static inline bool sfip_not_equals(const sfip_t* const lhs, const sfip_t* const rhs)
+inline bool sfip_not_equals(const sfip_t* const lhs, const sfip_t* const rhs)
{ return !sfip_equals(lhs,rhs); }
-static inline bool sfip_unset_equals(const sfip_t* const lhs, const sfip_t* const rhs)
+inline bool sfip_unset_equals(const sfip_t* const lhs, const sfip_t* const rhs)
{
if (!sfip_is_set(lhs) || !sfip_is_set(rhs))
return false;
return _is_sfip_equals(lhs, rhs);
}
-static inline bool sfip_lesser(const sfip_t* const lhs, const sfip_t* const rhs)
+inline bool sfip_lesser(const sfip_t* const lhs, const sfip_t* const rhs)
{
// I'm copying and pasting. Don't ask me why this is different then sfip_equals
if (!sfip_is_set(lhs) || !sfip_is_set(rhs))
return _is_sfip_lesser(lhs, rhs);
}
-static inline bool sfip_greater(const sfip_t* const lhs, const sfip_t* const rhs)
+inline bool sfip_greater(const sfip_t* const lhs, const sfip_t* const rhs)
{
// I'm copying and pasting. Don't ask me why this is different then sfip_equals
if (!sfip_is_set(lhs) || !sfip_is_set(rhs))
return _is_sfip_lesser(rhs, lhs);
}
-static inline void sfip_clear(sfip_t& x)
+inline void sfip_clear(sfip_t& x)
{
x.family = 0;
x.bits = 0;
* specific operator since the default equals operator will
* correctly assign values
*/
-static inline void sfip_copy(sfip_t& lhs, const sfip_t* const rhs)
+inline void sfip_copy(sfip_t& lhs, const sfip_t* const rhs)
{ lhs = *rhs; }
#if 0
/* Perform a lookup on value contained in "ip"
* For performance reason, we use this simplified version instead of sfrt_lookup
* Note: this only applied to table setting: DIR_8x16 (DIR_16_8_4x2 for IPV4), DIR_8x4*/
-static inline GENERIC sfrt_dir8x_lookup(void* adr, table_t* table)
+inline GENERIC sfrt_dir8x_lookup(void* adr, table_t* table)
{
dir_sub_table_t* subtable;
int i;
&tsd, &tracker, tracker.get_tcp_state(), tracker.get_tcp_event() );
#else
UNUSED(tsd);
- UNUSED(tracker)
+ UNUSED(tracker);
#endif
return true;
void paf_reset(PAF_State*); // called for do overs
void paf_clear(PAF_State*); // called at session end
-static inline uint32_t paf_position (PAF_State* ps)
+inline uint32_t paf_position (PAF_State* ps)
{
return ps->seq;
}
-static inline uint32_t paf_initialized (PAF_State* ps)
+inline uint32_t paf_initialized (PAF_State* ps)
{
return ( ps->paf != StreamSplitter::START );
}
-static inline uint32_t paf_active (PAF_State* ps)
+inline uint32_t paf_active (PAF_State* ps)
{
return ( ps->paf != StreamSplitter::ABORT );
}
-static inline void paf_jump(PAF_State* ps, uint32_t n)
+inline void paf_jump(PAF_State* ps, uint32_t n)
{
ps->pos += n;
ps->seq = ps->pos;
// FIXIT-L this should not be thread specific
static THREAD_LOCAL int s5_trace_enabled = -1;
-static inline void TraceEvent(const Packet* p, TcpSegmentDescriptor*, uint32_t txd, uint32_t rxd)
+inline void TraceEvent(const Packet* p, TcpSegmentDescriptor*, uint32_t txd, uint32_t rxd)
{
int i;
char flags[7] = "UAPRSF";
pc.total_from_daq, flags, h->th_flags, rseq, rack, h->win(), p->dsize, order);
}
-static inline void TraceSession(const Flow* lws)
+inline void TraceSession(const Flow* lws)
{
fprintf(stdout, " LWS: ST=0x%x SF=0x%x CP=%u SP=%u\n", (unsigned)lws->session_state,
lws->ssn_state.session_flags, lws->client_port, lws->server_port);
}
-static inline void TraceState(const TcpTracker* a, const TcpTracker* b, const char* s)
+inline void TraceState(const TcpTracker* a, const TcpTracker* b, const char* s)
{
uint32_t ua = a->get_snd_una() ? LCL(a, get_snd_una) : 0;
uint32_t ns = a->get_snd_nxt() ? LCL(a, get_snd_nxt) : 0;
fprintf(stdout, "\n");
}
-static inline void TraceTCP(const Packet* p, const Flow* lws, TcpSegmentDescriptor* tsd, int event)
+inline void TraceTCP(const Packet* p, const Flow* lws, TcpSegmentDescriptor* tsd, int event)
{
const TcpSession* ssn = (TcpSession*)lws->session;
const TcpTracker* srv = ssn ? ssn->server : NULL;
}
}
-static inline void S5TraceTCP(const Packet* p, const Flow* lws, TcpSegmentDescriptor* tsd, int
- event)
+inline void S5TraceTCP(const Packet* p, const Flow* lws, TcpSegmentDescriptor* tsd, int event)
{
if (!s5_trace_enabled)
return;
extern THREAD_LOCAL struct TcpStats tcpStats;
-static inline void inc_tcp_discards()
+inline void inc_tcp_discards()
{
tcpStats.discards++;
}
bool TcpStateClosed::syn_sent(TcpSegmentDescriptor& tsd, TcpStreamTracker& tracker)
{
auto& trk = static_cast< TcpTracker& >( tracker );
- Flow* flow = tsd.get_flow();
trk.s_mgr.sub_state |= SUB_SYN_SENT;
SNORT_PROTO_MAX
};
-static inline bool is_network_protocol(int16_t proto)
+inline bool is_network_protocol(int16_t proto)
{ return (proto >= SNORT_PROTO_IP and proto <= SNORT_PROTO_UDP); }
-static inline bool is_builtin_protocol(int16_t proto)
+inline bool is_builtin_protocol(int16_t proto)
{ return proto < SNORT_PROTO_MAX; }
-static inline bool is_service_protocol(int16_t proto)
+inline bool is_service_protocol(int16_t proto)
{ return !is_network_protocol(proto); }
void InitializeProtocolReferenceTable(void);
#endif // __ia64 && __GNUC__
#endif // __i386 || __amd64 || __x86_64__
-static inline double get_ticks_per_usec(void)
+inline double get_ticks_per_usec(void)
{
uint64_t start = 0, end = 0;
get_clockticks(start);
// Check to make sure that p is less than or equal to the ptr range
// returns 1 if in bounds, 0 otherwise
// FIXIT-L: Change return type to bool
-static inline int inBounds(const void* start, const void* end, const void* p)
+inline int inBounds(const void* start, const void* end, const void* p)
{
const uint8_t* pstart = (uint8_t*)start;
const uint8_t* pend = (uint8_t*)end;
}
// FIXIT-L: Change return type to bool
-static inline int SafeMemCheck(const void* dst, size_t n,
+inline int SafeMemCheck(const void* dst, size_t n,
const void* start, const void* end)
{
const uint8_t* pstart = (uint8_t*)start;
// returns SAFEMEM_ERROR on failure, SAFEMEM_SUCCESS on success
// FIXIT-L: Change return type to bool
-static inline int SafeMemcpy(
+inline int SafeMemcpy(
void* dst, const void* src, size_t n, const void* start, const void* end)
{
if ( !n )
// dst and src can be in the same buffer
// returns SAFEMEM_ERROR on failure, SAFEMEM_SUCCESS on success
// FIXIT-L: Change return type to bool
-static inline int SafeMemmove(
+inline int SafeMemmove(
void* dst, const void* src, size_t n, const void* start, const void* end)
{
if (SafeMemCheck(dst, n, start, end) != SAFEMEM_SUCCESS)
// dst and src can be in the same buffer
// returns SAFEMEM_ERROR on failure, SAFEMEM_SUCCESS on success
// FIXIT-L: Change return type to bool
-static inline int SafeBoundsMemmove(
+inline int SafeBoundsMemmove(
void* dst, const void* src, size_t n, const void* start, const void* end)
{
size_t overlap = 0;
// returns SAFEMEM_ERROR on failure, SAFEMEM_SUCCESS on success
// FIXIT-L: Change return type to bool
-static inline int SafeMemset(
+inline int SafeMemset(
void* dst, uint8_t c, size_t n, const void* start, const void* end)
{
if (SafeMemCheck(dst, n, start, end) != SAFEMEM_SUCCESS)
// returns 0 on failure, 1 on success
// FIXIT-L: Change return type to bool
-static inline int SafeWrite(uint8_t* start, uint8_t* end, uint8_t* dst, uint8_t* src)
+inline int SafeWrite(uint8_t* start, uint8_t* end, uint8_t* dst, uint8_t* src)
{
if (!inBounds(start, end, dst))
{
// returns 0 on failure, 1 on success
// FIXIT-L: Change return type to bool
-static inline int SafeRead(uint8_t* start, uint8_t* end, uint8_t* src, uint8_t* read)
+inline int SafeRead(uint8_t* start, uint8_t* end, uint8_t* src, uint8_t* read)
{
if (!inBounds(start,end, src))
{
// An wrapper around snprintf to make it safe.
// returns the number of bytes written to the buffer
-static inline size_t SafeSnprintf(char* str, size_t size, const char* format, ...)
+inline size_t SafeSnprintf(char* str, size_t size, const char* format, ...)
{
va_list ap;
int ret;
void SetNoCores(void);
#endif
-static inline void* SnortAlloc(unsigned long size)
+inline void* SnortAlloc(unsigned long size)
{
void* pv = calloc(size, sizeof(char));
return NULL;
}
-static inline long SnortStrtol(const char* nptr, char** endptr, int base)
+inline long SnortStrtol(const char* nptr, char** endptr, int base)
{
long iRet;
errno = 0;
return iRet;
}
-static inline unsigned long SnortStrtoul(const char* nptr, char** endptr, int base)
+inline unsigned long SnortStrtoul(const char* nptr, char** endptr, int base)
{
unsigned long iRet;
errno = 0;
// Also will set errno to ERANGE on a value returned from strtoul that is
// greater than UINT32_MAX, but still return success.
//
-static inline int SnortStrToU32(const char* buffer, char** endptr,
+inline int SnortStrToU32(const char* buffer, char** endptr,
uint32_t* value, int base)
{
unsigned long int tmp;
return 0;
}
-static inline pid_t gettid(void)
+inline pid_t gettid(void)
{
#if defined(LINUX) && defined(SYS_gettid)
return syscall(SYS_gettid);
virtual bool convert(std::istringstream& data);
};
-static inline ConversionState* init_state_ctor(Converter& c)
+inline ConversionState* init_state_ctor(Converter& c)
{
return new InitState(c);
}
if ( s_off )
{
- fseek(it->file, s_pos+s_off, SEEK_SET);
- if (fseek(it->file, s_pos+s_off, SEEK_SET))
+ if ( fseek(it->file, s_pos+s_off, SEEK_SET) )
{
puts("Unable to SEEK on current file .. and this is not being handled yet.");
return false;