00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef ROHC_TRACES_INTERNAL_H
00031 #define ROHC_TRACES_INTERNAL_H
00032
00033 #include "rohc_traces.h"
00034 #include <rohc/rohc_buf.h>
00035
00036 #include <stdlib.h>
00037 #include <assert.h>
00038
00039
00040
00041 #define __rohc_print(trace_cb, trace_cb_priv, \
00042 level, entity, profile, format, ...) \
00043 do { \
00044 if(trace_cb != NULL) { \
00045 trace_cb(trace_cb_priv, level, entity, profile, \
00046 "[%s:%d %s()] " format "\n", \
00047 __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); \
00048 } \
00049 } while(0)
00050
00051
00052 #define rohc_print(entity_struct, level, entity, profile, format, ...) \
00053 do { \
00054 __rohc_print((entity_struct)->trace_callback, \
00055 (entity_struct)->trace_callback_priv, \
00056 level, entity, profile, \
00057 format, ##__VA_ARGS__); \
00058 } while(0)
00059
00060
00061 #define rohc_debug(entity_struct, entity, profile, format, ...) \
00062 rohc_print(entity_struct, ROHC_TRACE_DEBUG, entity, profile, \
00063 format, ##__VA_ARGS__)
00064
00065
00066 #define rohc_info(entity_struct, entity, profile, format, ...) \
00067 rohc_print(entity_struct, ROHC_TRACE_INFO, entity, profile, \
00068 format, ##__VA_ARGS__)
00069
00070
00071 #define rohc_warning(entity_struct, entity, profile, format, ...) \
00072 rohc_print(entity_struct, ROHC_TRACE_WARNING, entity, profile, \
00073 format, ##__VA_ARGS__)
00074
00075
00076 #define rohc_error(entity_struct, entity, profile, format, ...) \
00077 rohc_print(entity_struct, ROHC_TRACE_ERROR, entity, profile, \
00078 format, ##__VA_ARGS__)
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 #define rohc_assert(entity_struct, entity, profile, \
00090 condition, label, format, ...) \
00091 do { \
00092 if(!(condition)) { \
00093 rohc_error(entity_struct, entity, profile, \
00094 format, ##__VA_ARGS__); \
00095 assert(condition); \
00096 goto label; \
00097 } \
00098 } while(0)
00099
00100
00101 void rohc_dump_packet(const rohc_trace_callback2_t trace_cb,
00102 void *const trace_cb_priv,
00103 const rohc_trace_entity_t trace_entity,
00104 const rohc_trace_level_t trace_level,
00105 const char *const descr,
00106 const struct rohc_buf packet)
00107 __attribute__((nonnull(5)));
00108
00109 void rohc_dump_buf(const rohc_trace_callback2_t trace_cb,
00110 void *const trace_cb_priv,
00111 const rohc_trace_entity_t trace_entity,
00112 const rohc_trace_level_t trace_level,
00113 const char *const descr,
00114 const uint8_t *const packet,
00115 const size_t length)
00116 __attribute__((nonnull(5, 6)));
00117
00118 #endif
00119