30 #ifndef ROHC_TRACES_INTERNAL_H
31 #define ROHC_TRACES_INTERNAL_H
34 #include <rohc/rohc_buf.h>
41 #define __rohc_print(trace_cb, trace_cb_priv, \
42 level, entity, profile, format, ...) \
44 if(trace_cb != NULL) { \
45 trace_cb(trace_cb_priv, level, entity, profile, \
46 "[%s:%d %s()] " format "\n", \
47 __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); \
52 #define rohc_print(entity_struct, level, entity, profile, format, ...) \
54 __rohc_print((entity_struct)->trace_callback, \
55 (entity_struct)->trace_callback_priv, \
56 level, entity, profile, \
57 format, ##__VA_ARGS__); \
61 #define rohc_debug(entity_struct, entity, profile, format, ...) \
62 rohc_print(entity_struct, ROHC_TRACE_DEBUG, entity, profile, \
63 format, ##__VA_ARGS__)
66 #define rohc_info(entity_struct, entity, profile, format, ...) \
67 rohc_print(entity_struct, ROHC_TRACE_INFO, entity, profile, \
68 format, ##__VA_ARGS__)
71 #define rohc_warning(entity_struct, entity, profile, format, ...) \
72 rohc_print(entity_struct, ROHC_TRACE_WARNING, entity, profile, \
73 format, ##__VA_ARGS__)
76 #define rohc_error(entity_struct, entity, profile, format, ...) \
77 rohc_print(entity_struct, ROHC_TRACE_ERROR, entity, profile, \
78 format, ##__VA_ARGS__)
89 #define rohc_assert(entity_struct, entity, profile, \
90 condition, label, format, ...) \
93 rohc_error(entity_struct, entity, profile, \
94 format, ##__VA_ARGS__); \
102 void *
const trace_cb_priv,
105 const char *
const descr,
107 __attribute__((nonnull(5)));
110 void *
const trace_cb_priv,
113 const char *
const descr,
114 const uint8_t *
const packet,
116 __attribute__((nonnull(5, 6)));
rohc_trace_level_t
The different levels of the traces.
Definition: rohc_traces.h:59
void(* rohc_trace_callback2_t)(void *const priv_ctxt, const rohc_trace_level_t level, const rohc_trace_entity_t entity, const int profile, const char *const format,...)
The function prototype for the trace callback.
Definition: rohc_traces.h:118
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.
Definition: rohc_traces_internal.c:46
A network buffer for the ROHC library.
Definition: rohc_buf.h:104
ROHC definitions for traces.
rohc_trace_entity_t
The different entities concerned by the traces.
Definition: rohc_traces.h:81
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.
Definition: rohc_traces_internal.c:77