/* The Authentication Data at the end of the packet is variable-length.
RFC 2406 says that Encryption and Authentication algorithms MUST NOT
- both be NULL, so we assume NULL Encryption and some other Authentication.
+ both be null, so we assume null Encryption and some other Authentication.
The mandatory algorithms for Authentication are HMAC-MD5-96 and
HMAC-SHA-1-96, so we assume a 12-byte authentication data at the end. */
{
const icmp::ICMPHdr* const icmph = reinterpret_cast<const ICMPHdr*>(raw_pkt);
- /* 32 digits plus 7 colons and a NULL byte */
+ /* 32 digits plus 7 colons and a null byte */
char buf[8*4 + 7 + 1];
TextLog_Print(log, "Type:%d Code:%d ", icmph->type, icmph->code);
TextLog_Puts(log, "\n\t");
/* print TCP flags */
CreateTCPFlagString(tcph, tcpFlags);
- TextLog_Puts(text_log, tcpFlags); /* We don't care about the NULL */
+ TextLog_Puts(text_log, tcpFlags); /* We don't care about the null */
/* print other TCP info */
TextLog_Print(text_log, " SrcPort:%u DstPort:%u\n\tSeq: 0x%lX Ack: 0x%lX "
return File_Decomp_OK;
}
-/* If there's a previous state on the stack, return a pointer to it, else return NULL */
+/* If there's a previous state on the stack, return a pointer to it, else return null */
static inline fd_PDF_Parse_Stack_t* Get_Previous_State(fd_PDF_Parse_t* p)
{
if ( p->Parse_Stack_Index == 0 )
if ( !*existing_tree )
return -1;
- /* NULL input id (PMX *), last call for this pattern state */
+ /* null input id (PMX *), last call for this pattern state */
return finalize_detection_option_tree(sc, (detection_option_tree_root_t*)*existing_tree);
}
* @param hash - pointer to XHash that should point to either ssn_tag_cache_ptr
* or host_tag_cache_ptr.
*
- * @returns a pointer to new TagNode or NULL if memory couldn't * be allocated
+ * @returns a pointer to new TagNode or null if memory couldn't * be allocated
*/
static TagNode* TagAlloc(
XHash* hash
** sfeventq_event_alloc() allocates the memory for storing the event.
** sfeventq_add() adds the event and prioritizes the event in the queue.
** You should only allocate and add one event at a time. Otherwise,
-** event_alloc() will return NULL on memory exhaustion.
+** event_alloc() will return null on memory exhaustion.
**
** 3. Event actions
** sfeventq_action() will call the provided function on the initialized
** Allocate the memory for an event to add to the event queue. This
** function is meant to be called first, the event structure filled in,
** and then added to the queue. While you can allocate several times before
-** adding to the queue, this is not recommended as you may get a NULL ptr
+** adding to the queue, this is not recommended as you may get a null ptr
** if you allocate more than the max node number.
**
** @return void *
**
-** @retval NULL unable to allocate memory.
-** @retval !NULL ptr to memory.
+** @retval null - unable to allocate memory.
+** @retval !null - ptr to memory.
*/
void* sfeventq_event_alloc(SF_EVENTQ* eq)
{
**
** @return SF_EVENTQ_NODE *
**
-** @retval NULL resource exhaustion and event is lower priority than last node
-** @retval !NULL ptr to node memory.
+** @retval null - resource exhaustion and event is lower priority than last node
+** @retval !null - ptr to node memory.
*/
static SF_EVENTQ_NODE* get_eventq_node(SF_EVENTQ* eq, void*)
{
assert(event);
/*
- ** If get_eventq_node() returns NULL, this means that
+ ** If get_eventq_node() returns null, this means that
** we have exhausted the eventq and the incoming event
** is lower in priority then the last ranked event.
** So we just drop it.
static void PrintTests()
{
unsigned i;
- EventData* prev = NULL;
+ EventData* prev = nullptr;
for ( i = 0; i < NUM_EVENTS; i++ )
{
sizeof(THD_IP_NODE));
#ifdef THD_DEBUG
- if (local_hash == NULL)
+ if ( !local_hash )
printf("Could not allocate the sfxhash table\n");
#endif
sizeof(THD_IP_NODE));
#ifdef THD_DEBUG
- if (global_hash == NULL)
+ if ( !global_hash )
printf("Could not allocate the sfxhash table\n");
#endif
**
** @return ASN1_TYPE *
**
-** @retval NULL memory allocation failed
-** @retval !NULL function successful
+** @retval null - memory allocation failed
+** @retval !null - function successful
*/
static ASN1_TYPE* asn1_node_alloc()
{
** @retval ASN1_OK function successful
** @retval ASN1_ERR_OVERLONG_LEN tag number too large
** @retval ASN1_ERR_OOB encoding goes out of bounds
-** @retval ASN1_ERR_NULL_MEM function arguments are NULL
+** @retval ASN1_ERR_NULL_MEM function arguments are null
*/
static int asn1_decode_tag_num_ext(ASN1_DATA* asn1_data, unsigned* tag_num)
{
**
** @return integer
**
-** @retval ASN1_ERR_NULL_MEM function arguments are NULL
+** @retval ASN1_ERR_NULL_MEM function arguments are null
** @retval ASN1_ERR_OOB buffer out of bounds
** @retval ASN1_ERR_INVALID_BER_TAG_LEN tag num too large or bad encoding
** @retval ASN1_OK function ok
**
** @return integer
**
-** @retval ASN1_ERR_NULL_MEM function arguments NULL
+** @retval ASN1_ERR_NULL_MEM function arguments null
** @retval ASN1_ERR_OVERLONG_LEN length to long for us to decode
** @retval ASN1_ERR_OOB out of bounds condition
** @retval ASN1_OK function successful
**
** @return integer
**
-** @retval ASN1_ERR_NULL_MEM function arguments NULL
+** @retval ASN1_ERR_NULL_MEM function arguments null
** @retval ASN1_ERR_FATAL should never get this
** @retval ASN1_ERR_OOB out of bounds condition
** @retval ASN1_OK function successful
/*
** Check len first, because if it's 0, then we already decoded a valid
** construct. We let the caller know this, by returning OK, but setting
- ** the asn1_type ptr to NULL.
+ ** the asn1_type ptr to null.
*/
if (*len == 0)
return ASN1_OK;
** NAME
** CvsCmdCompare
** Compares two pointers to char to see if they are equal.
-** The first arg is NULL terminated. The second is not and
+** The first arg is null terminated. The second is not and
** it's length is passed in.
**
*/
** the replacement '\0' is put into the structure's command
** argument member. If there isn't a space, the entire line
** is put in the command and the command argument is set to
-** NULL.
+** null.
**
*/
/**
default:
ParseError(
"bad TCP flag = '%c'"
- "Valid options: UAPRSFCE or 0 for NO flags (e.g. NULL scan),"
+ "Valid options: UAPRSFCE or 0 for NO flags (e.g. null scan),"
" and !, + or * for modifiers",
*fptr);
return;
switch (rc)
{
/* pcre_fullinfo fails for the following:
- * PCRE_ERROR_NULL - the argument code was NULL
- * the argument where was NULL
+ * PCRE_ERROR_NULL - the argument code was null
+ * the argument where was null
* PCRE_ERROR_BADMAGIC - the "magic number" was not found
* PCRE_ERROR_BADOPTION - the value of what was invalid
* so a failure here means we passed in bad values and we should
break;
case PCRE_ERROR_NULL:
- ParseError("pcre_fullinfo: code and/or where were NULL.");
+ ParseError("pcre_fullinfo: code and/or where were null.");
return;
case PCRE_ERROR_BADMAGIC:
namespace snort
{
-// Input is packet and an nine-byte (including NULL) character array. Results
+// Input is packet and an nine-byte (including null) character array. Results
// are put into the character array.
void CreateTCPFlagString(const tcp::TCPHdr* const tcph, char* flagBuffer)
{
}
/* print TCP flags */
CreateTCPFlagString(tcph, tcpFlags);
- TextLog_Puts(log, tcpFlags); /* We don't care about the NULL */
+ TextLog_Puts(log, tcpFlags); /* We don't care about the null */
/* print other TCP info */
TextLog_Print(log, " Seq: 0x%lX Ack: 0x%lX Win: 0x%X TcpLen: %d",
*/
void LogICMPHeader(TextLog* log, Packet* p)
{
- /* 32 digits plus 7 colons and a NULL byte */
+ /* 32 digits plus 7 colons and a null byte */
char buf[8*4 + 7 + 1];
if (p->ptrs.icmph == nullptr)
uint32_t nethdr; /* network header offset. (ip etc...) */
uint32_t transhdr; /* transport header offset (tcp/udp/icmp ..) */
uint32_t data;
- uint32_t val; /* which fields are valid. (NULL could be valid also) */
+ uint32_t val; /* which fields are valid. (null could be valid also) */
/* Packet struct --> was null */
#define NOPACKET_STRUCT 0x1
/* no transport headers in packet */
return false;
}
- initializing = false;
privileges_dropped = true;
-
return true;
}
const SnortConfig* sc = SnortConfig::get_conf();
- initializing = false; // just in case we cut out early
-
memory::MemoryCap::print();
IpsManager::global_term(sc);
// public methods
//-------------------------------------------------------------------------
-bool Snort::initializing = true;
bool Snort::reloading = false;
bool Snort::privileges_dropped = false;
-bool Snort::is_starting()
-{ return initializing; }
-
bool Snort::is_reloading()
{ return reloading; }
static void do_pidfile();
static void cleanup();
- static bool is_starting();
static bool has_dropped_privileges();
SO_PUBLIC static bool is_reloading();
{
if( !pat )
{
- snort::ErrorMessage("HTTP pattern string is NULL.");
+ snort::ErrorMessage("HTTP pattern string is null.");
return false;
}
#include <CppUTest/TestHarness.h>
#include <CppUTestExt/MockSupport.h>
-ServiceRSYNCData* fake_rsync_data = NULL;
+ServiceRSYNCData* fake_rsync_data = nullptr;
TEST_GROUP(service_rsync)
{
void setup()
{
- fake_rsync_data = NULL;
+ fake_rsync_data = nullptr;
}
void teardown()
class OdpContext;
// This needs to be exported by any third party .so library.
-// Must return NULL if it fails to create the object.
+// Must return null if it fails to create the object.
typedef ThirdPartyAppIdContext* (* TpAppIdCreateCtxt)(ThirdPartyConfig& );
typedef ThirdPartyAppIdSession* (* TpAppIdCreateSession)(ThirdPartyAppIdContext& ctxt);
typedef int (* TpAppIdPfini)();
uint8_t normalizer_options[32];
// these must be in the same order PROTO_IDs are defined!
- // if entry is NULL, proto doesn't have normalization or it is disabled
+ // if entry is null, proto doesn't have normalization or it is disabled
NormalFunc normalizers[snort::PacketManager::max_protocols()];
};
ReputationConfig* ReputationModule::get_data()
{
- // FIXIT-M: this needs to be set to NULL prior to returning here.
+ // FIXIT-M: this needs to be set to null prior to returning here.
// If we do that, though, reload module will error out, even when
// reputation has been properly configured (on startup) in lua.
return conf;
* 30 bytes. For the entire list, need room for spaces and brackets and
* potential negations. Or:
* list_size * (30 + 1space_for_each_element, +
- * 1potential_negation) + surrounding_whitespace + brackets + NULL */
+ * 1potential_negation) + surrounding_whitespace + brackets + null */
bufsize = po->item_list->count * (30 + 1 + 1) + 5;
buf = (char*)snort_calloc(bufsize);
};
// Encoder Foo
-static THREAD_LOCAL PegCount total_rebuilt_pkts = 0;
static THREAD_LOCAL std::array<uint8_t, Codec::PKT_MAX>* s_pkt;
void PacketManager::thread_init()
c->context->pkth->pktlen = 0;
c->context->pkth->ts = p->pkth->ts;
- total_rebuilt_pkts++;
return 0;
}
c->context->pkth->ts = p->pkth->ts;
layer::set_packet_pointer(c); // ensure we are looking at the new packet
- total_rebuilt_pkts++;
return 0;
}
// codec support and statistics
//-------------------------------------------------------------------------
-PegCount PacketManager::get_rebuilt_packet_count()
-{ return total_rebuilt_pkts; }
-
uint16_t PacketManager::encode_get_max_payload(const Packet* p)
{
if ( !p->num_layers )
/* codec support and statistics */
- // get the number of packets which have been rebuilt by this thread
- static PegCount get_rebuilt_packet_count();
-
// get the max payload for the current packet
static uint16_t encode_get_max_payload(const Packet*);
// cip_parsing.cc author RA/Cisco
/* Description: Data parsing for EtherNet/IP and CIP formats.
- Note: No pointer parameters to these functions can be passed as NULL. */
+ Note: No pointer parameters to these functions can be passed as null. */
#ifdef HAVE_CONFIG_H
#include "config.h"
int opnum; /* Set to sentinel if not applicable */
/* dce_stub_data */
- const uint8_t* stub_data; /* Set to NULL if not applicable */
+ const uint8_t* stub_data; /* Set to null if not applicable */
};
enum DCE2_SsnFlag
* for inserting, finding, etc.
* DCE2_ListDataFree
* An optional function to call to free data in the list.
- * If NULL is passed in, the user will have to manually free
+ * If null is passed in, the user will have to manually free
* the data.
* DCE2_ListKeyFree
* An optional function to call to free keys used in the list.
- * If NULL is passed in, the user will have to manually free
+ * If null is passed in, the user will have to manually free
* the keys.
* int
* Flags that affect processing of the list.
* Returns:
* DCE2_List *
* Pointer to a valid list object.
- * NULL if an error occurs.
+ * Null if an error occurs.
*
********************************************************************/
DCE2_List* DCE2_ListNew(DCE2_ListType type, DCE2_ListKeyCompare kc,
* in the list and no duplicates are allowed.
* DCE2_RET__SUCCESS if a new node with key and data is
* successfully inserted into the list.
- * DCE2_RET__ERROR if a NULL list object was passed in.
+ * DCE2_RET__ERROR if a null list object was passed in.
*
********************************************************************/
DCE2_Ret DCE2_ListInsert(DCE2_List* list, void* key, void* data)
* Returns:
* void *
* The data in the first node in the list.
- * NULL if the list object passed in is NULL, or there are
+ * Null if the list object passed in is null, or there are
* no items in the list.
*
********************************************************************/
* Returns:
* void *
* The data in the next node in the list.
- * NULL if the list object passed in is NULL, or we are at
+ * Null if the list object passed in is null, or we are at
* the end of the list and there are no next nodes.
*
********************************************************************/
*
* Removes all of the nodes in a list. Does not delete the list
* object itself. Calls data free and key free functions for
- * data and key if they are not NULL.
+ * data and key if they are not null.
*
* Arguments:
* DCE2_List *
* void *
* If the key is found, the data associated with the node
* is returned.
- * NULL is returned if the item cannot be found given the key.
+ * Null is returned if the item cannot be found given the key.
*
********************************************************************/
void* DCE2_ListFind(DCE2_List* list, void* key)
* Returns:
* DCE2_Ret
* DCE2_RET__ERROR if a node in the list with the specified
- * key cannot be found or the list object passed in is NULL.
+ * key cannot be found or the list object passed in is null.
* DCE2_RET__SUCCESS if the node is successfully removed from
* the list.
*
* Arguments:
* DCE2_QueueDataFree
* An optional free function for the data inserted into
- * the queue. If NULL is passed in, the user will be
+ * the queue. If null is passed in, the user will be
* responsible for freeing data left in the queue.
*
* Returns:
*
* Returns:
* DCE2_Ret
- * DCE2_RET__ERROR if the queue object passed in is NULL.
+ * DCE2_RET__ERROR if the queue object passed in is null.
* DCE2_RET__SUCCESS if the data is successfully added to
* the queue.
*
* Returns:
* void *
* The data in the first node in the queue.
- * NULL if there are no items in the queue or the queue object
- * passed in is NULL.
+ * Null if there are no items in the queue or the queue object
+ * passed in is null.
*
********************************************************************/
void* DCE2_QueueDequeue(DCE2_Queue* queue)
*
* Removes all of the nodes in a queue. Does not delete the queue
* object itself. Calls data free function for data if it is
- * not NULL.
+ * not null.
*
* Arguments:
* DCE2_Queue *
* Returns:
* void *
* The data in the first node in the queue.
- * NULL if the queue object passed in is NULL, or there are
+ * Null if the queue object passed in is null, or there are
* no items in the queue.
*
********************************************************************/
* Returns:
* void *
* The data in the next node in the queue.
- * NULL if the queue object passed in is NULL, or we are at
+ * Null if the queue object passed in is null, or we are at
* the end of the queue and there are no next nodes.
*
********************************************************************/
* Returns:
* void *
* The data in the last node in the queue.
- * NULL if the queue object passed in is NULL, or there are
+ * Null if the queue object passed in is null, or there are
* no items in the queue.
*
********************************************************************/
* Returns:
* bool
* true if the list has zero nodes in it or the list object
- * passed in is NULL.
+ * passed in is null.
* false if the list has one or more nodes in it.
*
********************************************************************/
return DCE2_RET__SUCCESS;
}
- // Move past NULL string terminator
+ // Move past null string terminator
dce2_move(nb_ptr, nb_len, increment);
}
}
if (nb_len == 0)
break;
- // Just a NULL byte - acceptable by Samba and Windows
+ // Just a null byte - acceptable by Samba and Windows
if (term_ptr == nb_ptr)
continue;
&& (strncmp((const char*)nb_ptr, SMB_DIALECT_NT_LM_012, term_ptr - nb_ptr) == 0))
break;
- // Move past string and NULL byte
+ // Move past string and null byte
dce2_move(nb_ptr, nb_len, (term_ptr - nb_ptr) + 1);
ntlm_index++;
while ((bs = (const uint8_t*)memchr(nb_ptr, '\\', nb_len)) != nullptr)
dce2_move(nb_ptr, nb_len, (bs - nb_ptr) + 1);
- // Move past NULL byte if unicode
+ // Move past null byte if unicode
if (SmbUnicode(smb_hdr) && (nb_len != 0))
dce2_move(nb_ptr, nb_len, 1);
void Dce2SmbModule::get_data(dce2SmbProtoConf& dce2_smb_config)
{
- dce2_smb_config = config; // includes pointer copy so set to NULL
+ dce2_smb_config = config; // includes pointer copy so set to null
config.smb_invalid_shares = nullptr;
}
// Not implemented according to MS-CIFS
case TRANS_RAW_READ_NMPIPE:
- // Can only write 2 NULL bytes and subsequent writes return pipe disconnected
+ // Can only write 2 null bytes and subsequent writes return pipe disconnected
case TRANS_RAW_WRITE_NMPIPE:
// Can at most do a DCE/RPC bind
if (ftracker == nullptr)
return;
- // NULL out file trackers of any outstanding requests
+ // null out file trackers of any outstanding requests
// that reference this file tracker
if (ssd->rtracker.ftracker == ftracker)
ssd->rtracker.ftracker = nullptr;
*
* Arguments:
* DCE2_SmbBuffer **
- * Pointer to pointer of buffer to add data to. If NULL
+ * Pointer to pointer of buffer to add data to. If null
* a new buffer will be allocated.
* uint8_t *
* Pointer to the current data cursor in packet.
*
* Arguments:
* char *
- * NULL terminated string to prune.
+ * null terminated string to prune.
* int
* length of string
*
* still points within the original string.
*
* Side effects: Spaces at the end of the string passed in as an
- * argument are replaced by NULL bytes.
+ * argument are replaced by null bytes.
*
********************************************************************/
inline char* DCE2_PruneWhiteSpace(char* str)
if (str == nullptr)
return nullptr;
- /* Put end a char before NULL byte */
+ /* Put end a char before null byte */
end = str + (strlen(str) - 1);
while (isspace((int)*str))
/********************************************************************
* Function: DCE2_IsEmptyStr()
*
- * Checks if string is NULL, empty or just spaces.
+ * Checks if string is null, empty or just spaces.
* String must be 0 terminated.
*
* Arguments: None
* char * - string to check
*
* Returns:
- * true if string is NULL, empty or just spaces
+ * true if string is null, empty or just spaces
* false otherwise
*
********************************************************************/
uint16_t num_opnums = 0;
unsigned int i;
- /* Include NULL byte for parsing */
+ /* Include null byte for parsing */
args_end = args + (strlen(args) + 1);
memset(opnum_mask, 0, sizeof(opnum_mask));
}
/* SMB formats (smb_fmt) Dialect, Pathname and ASCII are all
- * NULL terminated ASCII strings unless Unicode is specified
- * in the NT LM 1.0 SMB header in which case they are NULL
+ * null terminated ASCII strings unless Unicode is specified
+ * in the NT LM 1.0 SMB header in which case they are null
* terminated unicode strings
*/
#define SMB_FMT__DATA_BLOCK 1
&& (DCE2_SsnGetPolicy(&ssd->sd) == DCE2_POLICY__SAMBA))
{
// Current Samba errors on a zero byte count Transaction because it
- // uses it to get the Name string and if zero Name will be NULL and
+ // uses it to get the Name string and if zero Name will be null and
// it won't process it.
com_info.cmd_error |= DCE2_SMB_COM_ERROR__BAD_LENGTH;
}
dnsSessionData->curr_txt.txt_len = (uint8_t)*data;
dnsSessionData->curr_txt.txt_count++;
- /* include the NULL */
+ /* include the null */
dnsSessionData->curr_txt.total_txt_len += dnsSessionData->curr_txt.txt_len + 1;
if (!dnsSessionData->curr_txt.alerted)
* Returns: int => return code indicating error or success
*
* Returns: FTP_CMD_CONF* => Pointer to cmd configuration structure
- * matching IP if found, NULL otherwise.
+ * matching IP if found, null otherwise.
*
*/
FTP_CMD_CONF* ftp_cmd_lookup_find(CMD_LOOKUP* CmdLookup,
/* wind it back a line? */
if (ignoreEraseCmds == FTPP_APPLY_TNC_ERASE_CMDS)
{
- /* Go back to previous CR NULL or CR LF? */
+ /* Go back to previous CR null or CR LF? */
while (write_ptr > start)
{
/* Go to previous char */
{
read_ptr++;
if (*read_ptr != 0x00)
- /* Encryption type is not NULL */
+ /* Encryption type is not null */
{
/* printf("Encryption being negotiated by
* telnet client\n"); */
* after parsing the methods list.
* SIPMethods*
* Flag for the methods.
- * NULL flag if not a valid method type
+ * Null flag if not a valid method type
* Returns:
*
********************************************************************/
SIP_MediaSession* mediaSession;
const char* authorization;
const uint8_t* header;
- const uint8_t* body_data; // Set to NULL if not applicable
+ const uint8_t* body_data; // Set to null if not applicable
uint64_t cseqnum;
uint16_t userNameLen;
uint16_t status_code; // sip_stat_code data
- const uint8_t* header_data; // Set to NULL if not applicable
+ const uint8_t* header_data; // Set to null if not applicable
uint16_t header_len;
- const uint8_t* body_data; // Set to NULL if not applicable
+ const uint8_t* body_data; // Set to null if not applicable
uint16_t body_len;
};
* int - length of the method name
*
* Returns:
- * SIPMethodNode*- the founded method node, or NULL if not founded
+ * SIPMethodNode*- the founded method node, or null if not founded
*
********************************************************************/
* int: length of the string
*
* Returns:
- * 1 if string is NULL, empty or just spaces
+ * 1 if string is null, empty or just spaces
* 0 otherwise
*
********************************************************************/
config->num_cmds++;
- /* allocate enough memory for new command - alloc one extra for NULL entry */
+ /* allocate enough memory for new command - alloc one extra for null entry */
// FIXIT-L this constant reallocation is not necessary; use vector
cmds = (SMTPToken*)snort_calloc((config->num_cmds + 1) * sizeof(*cmds));
cmd_config = (SMTPCmdConfig*)snort_calloc((config->num_cmds + 1) * sizeof(*cmd_config));
/* check for and extract a mask in CIDR form */
if ( (mask = strchr(ip, (int)'/')) != nullptr )
{
- /* NULL out this character so inet_pton will see the
+ /* Null out this character so inet_pton will see the
* correct ending to the IP string */
char* end = mask++;
while ( (end > ip) && isspace((int)end[-1]) )
return list1;
}
- /*Both lists are sorted and not NULL. If list1 or list2 contains "any", free the other list*/
+ /*Both lists are sorted and not null. If list1 or list2 contains "any", free the other list*/
if (list1->flags & SFIP_ANY)
{
merge_len = list1_len;
return list2;
}
- /*Iterate till one of the list is NULL. Append each node to merge_list*/
+ /*Iterate till one of the list is null. Append each node to merge_list*/
while (list1 && list2)
{
if ( num_nodes )
num_nodes++;
}
- /*list2 is NULL. Append list1*/
+ /*list2 is null. Append list1*/
while ( list1 )
{
tmp = list1->next;
list1 = tmp;
}
- /*list1 is NULL. Append list2*/
+ /*list1 is null. Append list2*/
while ( list2 )
{
tmp = list2->next;
/* Check's if two variables have the same nodes */
SfIpRet sfvar_compare(const sfip_var_t* one, const sfip_var_t* two)
{
- /* If both NULL, consider equal */
+ /* If both null, consider equal */
if (!one && !two)
return SFIP_EQUAL;
- /* If one NULL and not the other, consider unequal */
+ /* If one null and not the other, consider unequal */
if ((one && !two) || (!one && two))
return SFIP_FAILURE;
cleanup_func(table->data[index]);
/* cleanup_func is supposed to free memory associated with this
- * table->data[index]. Set that to NULL.
+ * table->data[index]. Set that to null.
*/
table->data[index] = nullptr;
(dir_sub_table_t*)sub_table->entries[index];
/* Check if we need to alloc a new sub table.
- * If next_sub was 0/NULL, there's no entry at this index
+ * If next_sub was 0/null, there's no entry at this index
* If the length is non-zero, there is an entry */
if (!next_sub || sub_table->lengths[index])
{
/*The first allocation always return 0*/
if (!table_ptr)
{
- // return NULL;
+ // return nullptr;
}
#endif
DIR_Entry* entry = (DIR_Entry*)(&base[sub_table->entries]);
/* Check if we need to alloc a new sub table.
- * If next_sub was 0/NULL, there's no entry at this index
+ * If next_sub was 0/null, there's no entry at this index
* If the length is non-zero, there is an entry */
if (!entry[index].value || entry[index].length)
{
ctrlPkt, type, ip_proto, srcIP, srcPort, dstIP, dstPort, direction, fd);
}
-void Stream::proxy_started(Flow* flow, unsigned dir)
-{
- if (!flow)
- return;
-
- TcpSession* tcpssn = (TcpSession*)flow->session;
- tcpssn->flush();
-
- if ( dir & SSN_DIR_FROM_SERVER )
- set_splitter(flow, true, new LogSplitter(true));
-
- if ( dir & SSN_DIR_FROM_CLIENT )
- set_splitter(flow, false, new LogSplitter(false));
-
- tcpssn->start_proxy();
- flow->set_proxied();
-}
-
void Stream::stop_inspection(
Flow* flow, Packet* p, char dir,
int32_t /*bytes*/, int /*response*/)
flow->set_state(Flow::FlowState::ALLOW);
}
-void Stream::resume_inspection(Flow* flow, char dir)
-{
- if (!flow)
- return;
-
- switch (dir)
- {
- case SSN_DIR_BOTH:
- case SSN_DIR_FROM_CLIENT:
- case SSN_DIR_FROM_SERVER:
- if (flow->ssn_state.ignore_direction & dir)
- {
- flow->ssn_state.ignore_direction &= ~dir;
- }
- break;
- }
-}
-
uint32_t Stream::get_packet_direction(Packet* p)
{
if (!p || !(p->flow))
// packet_flags field of the Packet struct to indicate the direction determined.
static uint32_t get_packet_direction(Packet*);
- // Sets the stream session into proxy mode.
- static void proxy_started(Flow*, unsigned dir); // FIXIT-L method name is misleading
-
// Stop inspection on a flow for up to count bytes (-1 to ignore for life or until resume).
// If response flag is set, automatically resume inspection up to count bytes when a data
// packet in the other direction is seen. Also marks the packet to be ignored
const Packet* ctrlPkt, PktType, IpProtocol, const snort::SfIp* srcIP, uint16_t srcPort,
const snort::SfIp* dstIP, uint16_t dstPort, char direction, FlowData* fd);
- // Resume inspection for flow.
- // FIXIT-L does resume work only for a flow that has been stopped by call to stop_inspection?
- static void resume_inspection(Flow*, char dir);
-
// Set Active status to force drop the current packet and set flow state to drop
// subsequent packets arriving from the direction specified.
static void drop_traffic(const Packet*, char dir);
// Set seq to end of right since overlap was greater than or equal to right->size and
// inserted seq has been truncated to beginning of right and reset trunc length to 0
- // since we may fall out of loop if next right is NULL
+ // since we may fall out of loop if next right is null
trs.sos.seq = trs.sos.right->i_seq + trs.sos.right->i_len;
trs.sos.left = trs.sos.right;
trs.sos.right = trs.sos.right->next;
TEST(tcp_normalizers, os_policy)
{
StreamPolicy os_policy;
- Flow* flow = new FlowMock;
+ Flow* flow = new Flow;
TcpSession* session = new TcpSessionMock( flow );
TcpNormalizerState tns;
TEST(tcp_normalizers, paws_fudge_config)
{
StreamPolicy os_policy;
- Flow* flow = new FlowMock;
+ Flow* flow = new Flow;
TcpSession* session = new TcpSessionMock( flow );
TcpNormalizerState tns;
TEST(tcp_normalizers, paws_drop_zero_ts_config)
{
StreamPolicy os_policy;
- Flow* flow = new FlowMock;
+ Flow* flow = new Flow;
TcpSession* session = new TcpSessionMock( flow );
TcpNormalizerState tns;
TEST(tcp_normalizers, norm_options_enabled)
{
StreamPolicy os_policy;
- Flow* flow = new FlowMock;
+ Flow* flow = new Flow;
TcpSession* session = new TcpSessionMock( flow );
norm_enabled = true;
/*
* Find first occurrence of char of accept in s, limited by slen.
* A 'safe' version of strpbrk that won't read past end of buffer s
- * in cases that s is not NULL terminated.
+ * in cases that s is not null terminated.
*
* This code assumes 'accept' is a static string.
*/
/*
* Find first occurrence of searchstr in s, limited by slen.
* A 'safe' version of strstr that won't read past end of buffer s
- * in cases that s is not NULL terminated.
+ * in cases that s is not null terminated.
*/
const char* SnortStrnStr(const char* s, int slen, const char* searchstr)
{