ROHC compression/decompression library
rohc_traces.h
Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 2 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * This program is distributed in the hope that it will be useful,
00008  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  * GNU General Public License for more details.
00011  *
00012  * You should have received a copy of the GNU General Public License
00013  * along with this program; if not, write to the Free Software
00014  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00015  */
00016 
00017 /**
00018  * @file   rohc_traces.h
00019  * @brief  ROHC definitions for traces
00020  * @author Julien Bernard <julien.bernard@toulouse.viveris.com>
00021  * @author Audric Schiltknecht <audric.schiltknecht@toulouse.viveris.com>
00022  * @author Didier Barvaux <didier@barvaux.org>
00023  */
00024 
00025 #ifndef ROHC_TRACES_H
00026 #define ROHC_TRACES_H
00027 
00028 
00029 /** A general profile number used for traces not related to a specific profile */
00030 #define ROHC_PROFILE_GENERAL       0xffff
00031 
00032 
00033 /** The different levels of the traces */
00034 typedef enum
00035 {
00036         ROHC_TRACE_DEBUG = 0,
00037         ROHC_TRACE_INFO = 1,
00038         ROHC_TRACE_WARNING = 2,
00039         ROHC_TRACE_ERROR = 3,
00040         ROHC_TRACE_LEVEL_MAX
00041 } rohc_trace_level_t;
00042 
00043 
00044 /** The different entities concerned by the traces */
00045 typedef enum
00046 {
00047         ROHC_TRACE_COMP = 0,
00048         ROHC_TRACE_DECOMP = 1,
00049         ROHC_TRACE_ENTITY_MAX
00050 } rohc_trace_entity_t;
00051 
00052 
00053 /**
00054  * @brief The function prototype for the trace callback
00055  *
00056  * @param level    The level of the message, @see rohc_trace_level_t
00057  * @param entity   The entity concerned by the traces, @see rohc_trace_entity_t
00058  * @param profile  The number of the profile concerned by the message
00059  * @param format   The format string for the trace message
00060  */
00061 typedef void (*rohc_trace_callback_t) (const rohc_trace_level_t level,
00062                                        const rohc_trace_entity_t entity,
00063                                        const int profile,
00064                                        const char *const format,
00065                                        ...)
00066 #if defined(__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO == 1
00067         /* MinGW interprets 'printf' format as 'ms_printf', so force
00068          * usage of 'gnu_printf' */
00069         __attribute__((format(gnu_printf, 4, 5)));
00070 #else
00071         /* Use 'printf' format in other cases, because old GCC versions
00072          * and Clang do not recognize 'gnu_printf' format */
00073         __attribute__((format(printf, 4, 5)));
00074 #endif
00075 
00076 
00077 #endif
00078