ROHC compression/decompression library
Macros | Functions
rohc_traces_internal.h File Reference

Internal ROHC macros and functions for traces. More...

#include "rohc_traces.h"
#include <rohc/rohc_buf.h>
#include <stdlib.h>
#include <assert.h>
Include dependency graph for rohc_traces_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __rohc_print(trace_cb, trace_cb_priv, level, entity, profile, format, ...)
 
#define rohc_print(entity_struct, level, entity, profile, format, ...)
 
#define rohc_debug(entity_struct, entity, profile, format, ...)
 
#define rohc_info(entity_struct, entity, profile, format, ...)
 
#define rohc_warning(entity_struct, entity, profile, format, ...)
 
#define rohc_error(entity_struct, entity, profile, format, ...)
 
#define rohc_assert(entity_struct, entity, profile, condition, label, format, ...)
 Stop processing if the given condition is false. More...
 

Functions

void rohc_dump_packet (const rohc_trace_callback2_t trace_cb, void *const trace_cb_priv, const rohc_trace_entity_t trace_entity, const rohc_trace_level_t trace_level, const char *const descr, const struct rohc_buf packet)
 Dump the content of the given packet. More...
 
void rohc_dump_buf (const rohc_trace_callback2_t trace_cb, void *const trace_cb_priv, const rohc_trace_entity_t trace_entity, const rohc_trace_level_t trace_level, const char *const descr, const uint8_t *const packet, const size_t length)
 Dump the content of the given buffer. More...
 

Detailed Description

Internal ROHC macros and functions for traces.

Author
Julien Bernard julie.nosp@m.n.be.nosp@m.rnard.nosp@m.@tou.nosp@m.louse.nosp@m..viv.nosp@m.eris..nosp@m.com
Audric Schiltknecht audri.nosp@m.c.sc.nosp@m.hiltk.nosp@m.nech.nosp@m.t@tou.nosp@m.lous.nosp@m.e.viv.nosp@m.eris.nosp@m..com
Didier Barvaux didie.nosp@m.r.ba.nosp@m.rvaux.nosp@m.@tou.nosp@m.louse.nosp@m..viv.nosp@m.eris..nosp@m.com
Didier Barvaux didie.nosp@m.r@ba.nosp@m.rvaux.nosp@m..org

Macro Definition Documentation

#define __rohc_print (   trace_cb,
  trace_cb_priv,
  level,
  entity,
  profile,
  format,
  ... 
)
Value:
do { \
if(trace_cb != NULL) { \
trace_cb(trace_cb_priv, level, entity, profile, \
"[%s:%d %s()] " format "\n", \
__FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); \
} \
} while(0)

Print information depending on the debug level (internal usage)

#define rohc_assert (   entity_struct,
  entity,
  profile,
  condition,
  label,
  format,
  ... 
)
Value:
do { \
if(!(condition)) { \
rohc_error(entity_struct, entity, profile, \
format, ##__VA_ARGS__); \
assert(condition); \
goto label; \
} \
} while(0)
#define rohc_error(entity_struct, entity, profile, format,...)
Definition: rohc_traces_internal.h:76

Stop processing if the given condition is false.

In non-debug mode (ie. NDEBUG set): if the given condition fails, prints the given message then jump to the given label.

In debug mode (ie. NDEBUG not set): if the given condition fails, prints the given message then asserts.

#define rohc_debug (   entity_struct,
  entity,
  profile,
  format,
  ... 
)
Value:
rohc_print(entity_struct, ROHC_TRACE_DEBUG, entity, profile, \
format, ##__VA_ARGS__)
Definition: rohc_traces.h:61
#define rohc_print(entity_struct, level, entity, profile, format,...)
Definition: rohc_traces_internal.h:52

Print debug messages prefixed with the function name

#define rohc_error (   entity_struct,
  entity,
  profile,
  format,
  ... 
)
Value:
rohc_print(entity_struct, ROHC_TRACE_ERROR, entity, profile, \
format, ##__VA_ARGS__)
Definition: rohc_traces.h:64
#define rohc_print(entity_struct, level, entity, profile, format,...)
Definition: rohc_traces_internal.h:52

Print error messages prefixed with the function name

#define rohc_info (   entity_struct,
  entity,
  profile,
  format,
  ... 
)
Value:
rohc_print(entity_struct, ROHC_TRACE_INFO, entity, profile, \
format, ##__VA_ARGS__)
Definition: rohc_traces.h:62
#define rohc_print(entity_struct, level, entity, profile, format,...)
Definition: rohc_traces_internal.h:52

Print information prefixed with the function name

#define rohc_print (   entity_struct,
  level,
  entity,
  profile,
  format,
  ... 
)
Value:
do { \
__rohc_print((entity_struct)->trace_callback, \
(entity_struct)->trace_callback_priv, \
level, entity, profile, \
format, ##__VA_ARGS__); \
} while(0)
#define __rohc_print(trace_cb, trace_cb_priv, level, entity, profile, format,...)
Definition: rohc_traces_internal.h:41

Print information depending on the debug level

#define rohc_warning (   entity_struct,
  entity,
  profile,
  format,
  ... 
)
Value:
rohc_print(entity_struct, ROHC_TRACE_WARNING, entity, profile, \
format, ##__VA_ARGS__)
Definition: rohc_traces.h:63
#define rohc_print(entity_struct, level, entity, profile, format,...)
Definition: rohc_traces_internal.h:52

Print warning messages prefixed with the function name

Function Documentation

void rohc_dump_buf ( const rohc_trace_callback2_t  trace_cb,
void *const  trace_cb_priv,
const rohc_trace_entity_t  trace_entity,
const rohc_trace_level_t  trace_level,
const char *const  descr,
const uint8_t *const  packet,
const size_t  length 
)

Dump the content of the given buffer.

Parameters
trace_cbThe function to log traces
trace_cb_privAn optional private context, may be NULL
trace_entityThe entity that emits the traces
trace_levelThe priority level for the trace
descrThe description of the packet to dump
packetThe packet to dump
lengthThe length (in bytes) of the packet to dump
void rohc_dump_packet ( const rohc_trace_callback2_t  trace_cb,
void *const  trace_cb_priv,
const rohc_trace_entity_t  trace_entity,
const rohc_trace_level_t  trace_level,
const char *const  descr,
const struct rohc_buf  packet 
)

Dump the content of the given packet.

Parameters
trace_cbThe function to log traces
trace_cb_privAn optional private context, may be NULL
trace_entityThe entity that emits the traces
trace_levelThe priority level for the trace
descrThe description of the packet to dump
packetThe packet to dump