00001 /* 00002 * Copyright 2012,2013 Didier Barvaux 00003 * Copyright 2009,2010 Thales Communications 00004 * Copyright 2012,2013 Viveris Technologies 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 /** 00022 * @file rohc_traces.h 00023 * @brief ROHC definitions for traces 00024 * @author Julien Bernard <julien.bernard@toulouse.viveris.com> 00025 * @author Audric Schiltknecht <audric.schiltknecht@toulouse.viveris.com> 00026 * @author Didier Barvaux <didier@barvaux.org> 00027 */ 00028 00029 #ifndef ROHC_TRACES_H 00030 #define ROHC_TRACES_H 00031 00032 #ifdef __cplusplus 00033 extern "C" 00034 { 00035 #endif 00036 00037 00038 /** 00039 * @brief A general profile number used for traces not related to a specific 00040 * profile 00041 * 00042 * @ingroup rohc 00043 */ 00044 #define ROHC_PROFILE_GENERAL 0xffff 00045 00046 00047 /** 00048 * @brief The different levels of the traces 00049 * 00050 * Used for the \e level parameter of the \ref rohc_trace_callback2_t 00051 * user-defined callback. 00052 * 00053 * @ingroup rohc 00054 * 00055 * @see rohc_trace_callback2_t 00056 * @see rohc_comp_set_traces_cb2 00057 * @see rohc_decomp_set_traces_cb2 00058 */ 00059 typedef enum 00060 { 00061 ROHC_TRACE_DEBUG = 0, /**< Print debug traces */ 00062 ROHC_TRACE_INFO = 1, /**< Print info (or lower) traces */ 00063 ROHC_TRACE_WARNING = 2, /**< Print warning (or lower) traces */ 00064 ROHC_TRACE_ERROR = 3, /**< Print error (or lower) traces */ 00065 ROHC_TRACE_LEVEL_MAX /**< The maximum number of trace levels */ 00066 } rohc_trace_level_t; 00067 00068 00069 /** 00070 * @brief The different entities concerned by the traces 00071 * 00072 * Used for the source \e entity parameter of the \ref rohc_trace_callback2_t 00073 * user-defined callback. 00074 * 00075 * @ingroup rohc 00076 * 00077 * @see rohc_trace_callback2_t 00078 * @see rohc_comp_set_traces_cb2 00079 * @see rohc_decomp_set_traces_cb2 00080 */ 00081 typedef enum 00082 { 00083 ROHC_TRACE_COMP = 0, /**< Compressor traces */ 00084 ROHC_TRACE_DECOMP = 1, /**< Decompressor traces */ 00085 ROHC_TRACE_ENTITY_MAX /**< The maximum number of trace entities */ 00086 } rohc_trace_entity_t; 00087 00088 00089 /** 00090 * @brief The function prototype for the trace callback 00091 * 00092 * User-defined function that is called by the ROHC library every time it 00093 * wants to print something, from errors to debug. User may thus decide what 00094 * traces are interesting (filter on \e level, source \e entity, or 00095 * \e profile) and what to do with them (print on console, storage in file, 00096 * syslog...). 00097 * 00098 * The user-defined function is set by calling: 00099 * \li function \ref rohc_comp_set_traces_cb2 for a ROHC compressor, 00100 * \li function \ref rohc_decomp_set_traces_cb2 for a ROHC decompressor. 00101 * 00102 * Both functions accept the NULL value to fully disable tracing. 00103 * 00104 * @param priv_ctxt An optional private context, may be NULL 00105 * @param level The level of the message, @see rohc_trace_level_t 00106 * @param entity The entity concerned by the traces 00107 * @see rohc_trace_entity_t 00108 * @param profile The number of the profile concerned by the message 00109 * @param format The format string for the trace message 00110 * 00111 * @ingroup rohc 00112 * 00113 * @see rohc_trace_level_t 00114 * @see rohc_trace_entity_t 00115 * @see rohc_comp_set_traces2_cb 00116 * @see rohc_decomp_set_traces2_cb 00117 */ 00118 typedef void (*rohc_trace_callback2_t) (void *const priv_ctxt, 00119 const rohc_trace_level_t level, 00120 const rohc_trace_entity_t entity, 00121 const int profile, 00122 const char *const format, 00123 ...) 00124 #if defined(__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO == 1 00125 /* MinGW interprets 'printf' format as 'ms_printf', so force 00126 * usage of 'gnu_printf' */ 00127 __attribute__((format(gnu_printf, 5, 6))); 00128 #else 00129 /* Use 'printf' format in other cases, because old GCC versions 00130 * and Clang do not recognize 'gnu_printf' format */ 00131 __attribute__((format(printf, 5, 6))); 00132 #endif 00133 00134 00135 #ifdef __cplusplus 00136 } 00137 #endif 00138 00139 #endif /* ROHC_TRACES_H */ 00140
1.6.1