suricata
util-print.h File Reference

Go to the source code of this file.

Macros

#define PrintBufferData(buf, buf_offset_ptr, buf_size, ...)
 

Functions

void PrintBufferRawLineHex (char *, int *, int, const uint8_t *, uint32_t)
 print a buffer as hex on a single line More...
 
void PrintRawUriFp (FILE *, uint8_t *, uint32_t)
 
void PrintRawUriBuf (char *, uint32_t *, uint32_t, uint8_t *, uint32_t)
 
void PrintRawJsonFp (FILE *, uint8_t *, uint32_t)
 
void PrintRawDataFp (FILE *, const uint8_t *, uint32_t)
 
void PrintRawDataToBuffer (uint8_t *dst_buf, uint32_t *dst_buf_offset_ptr, uint32_t dst_buf_size, const uint8_t *src_buf, uint32_t src_buf_len)
 
void PrintStringsToBuffer (uint8_t *dst_buf, uint32_t *dst_buf_offset_ptr, uint32_t dst_buf_size, const uint8_t *src_buf, const uint32_t src_buf_len)
 
void PrintRawLineHexBuf (char *, uint32_t, const uint8_t *, uint32_t)
 print a buffer as hex on a single line in to retbuf buffer More...
 
const char * PrintInet (int, const void *, char *, socklen_t)
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t

Definition in file util-print.h.

Macro Definition Documentation

◆ PrintBufferData

#define PrintBufferData (   buf,
  buf_offset_ptr,
  buf_size,
  ... 
)
Value:
do { \
int cw = snprintf((buf) + *(buf_offset_ptr), \
(buf_size) - *(buf_offset_ptr), \
__VA_ARGS__); \
if (cw >= 0) { \
if ( (*(buf_offset_ptr) + cw) >= buf_size) { \
SCLogDebug("Truncating data write since it exceeded buffer " \
"limit of - %"PRIu32"\n", buf_size); \
*(buf_offset_ptr) = buf_size - 1; \
} else { \
*(buf_offset_ptr) += cw; \
} \
} \
} while (0)

Definition at line 29 of file util-print.h.

Function Documentation

◆ PrintBufferRawLineHex()

void PrintBufferRawLineHex ( char *  nbuf,
int *  offset,
int  max_size,
const uint8_t *  buf,
uint32_t  buflen 
)

print a buffer as hex on a single line

Prints in the format "00 AA BB"

Parameters
nbufbuffer into which the output is written
offsetof where to start writting into the buffer
max_sizethe size of the output buffer
bufbuffer to print from
buflenlength of the input buffer

Definition at line 42 of file util-print.c.

References offset, and PrintBufferData.

Referenced by AlertFastLogger().

Here is the caller graph for this function:

◆ PrintInet()

const char* PrintInet ( int  ,
const void *  ,
char *  ,
socklen_t   
)

Definition at line 267 of file util-print.c.

References af, dst, and src.

Referenced by AddressDebugPrint(), AlertFastLogger(), JsonFiveTuple(), and TLSGetIPInformations().

Here is the caller graph for this function:

◆ PrintRawDataFp()

void PrintRawDataFp ( FILE *  ,
const uint8_t *  ,
uint32_t   
)

Definition at line 141 of file util-print.c.

Referenced by DetectBase64DecodeDoMatch(), HtpBodyPrint(), and StreamingBufferCompareRawData().

Here is the caller graph for this function:

◆ PrintRawDataToBuffer()

void PrintRawDataToBuffer ( uint8_t *  dst_buf,
uint32_t *  dst_buf_offset_ptr,
uint32_t  dst_buf_size,
const uint8_t *  src_buf,
uint32_t  src_buf_len 
)

Definition at line 175 of file util-print.c.

References PrintBufferData.

◆ PrintRawJsonFp()

void PrintRawJsonFp ( FILE *  ,
uint8_t *  ,
uint32_t   
)

Definition at line 71 of file util-print.c.

References BUFFER_LENGTH, offset, and PrintBufferData.

◆ PrintRawLineHexBuf()

void PrintRawLineHexBuf ( char *  retbuf,
uint32_t  retbuflen,
const uint8_t *  buf,
uint32_t  buflen 
)

print a buffer as hex on a single line in to retbuf buffer

Prints in the format "00 AA BB"

Parameters
retbufpointer to the buffer which will have the result
rebuflenlenght of the buffer
bufbuffer to print from
buflenlength of the input buffer

Definition at line 61 of file util-print.c.

References offset, and PrintBufferData.

◆ PrintRawUriBuf()

void PrintRawUriBuf ( char *  ,
uint32_t *  ,
uint32_t  ,
uint8_t *  ,
uint32_t   
)

Definition at line 118 of file util-print.c.

References offset, and PrintBufferData.

Referenced by LogCustomFormatWriteTimestamp().

Here is the caller graph for this function:

◆ PrintRawUriFp()

void PrintRawUriFp ( FILE *  ,
uint8_t *  ,
uint32_t   
)

Definition at line 93 of file util-print.c.

References BUFFER_LENGTH, offset, and PrintBufferData.

◆ PrintStringsToBuffer()

void PrintStringsToBuffer ( uint8_t *  dst_buf,
uint32_t *  dst_buf_offset_ptr,
uint32_t  dst_buf_size,
const uint8_t *  src_buf,
const uint32_t  src_buf_len 
)

Definition at line 224 of file util-print.c.

References PrintBufferData.