webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
err.h
Go to the documentation of this file.
1 /*
2  * err.h
3  *
4  * error status codes
5  *
6  * David A. McGrew
7  * Cisco Systems, Inc.
8  */
9 /*
10  *
11  * Copyright (c) 2001-2006, Cisco Systems, Inc.
12  * All rights reserved.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  *
18  * Redistributions of source code must retain the above copyright
19  * notice, this list of conditions and the following disclaimer.
20  *
21  * Redistributions in binary form must reproduce the above
22  * copyright notice, this list of conditions and the following
23  * disclaimer in the documentation and/or other materials provided
24  * with the distribution.
25  *
26  * Neither the name of the Cisco Systems, Inc. nor the names of its
27  * contributors may be used to endorse or promote products derived
28  * from this software without specific prior written permission.
29  *
30  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
33  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
34  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
35  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
37  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
41  * OF THE POSSIBILITY OF SUCH DAMAGE.
42  *
43  */
44 
45 
46 #ifndef ERR_H
47 #define ERR_H
48 
49 #include <stdio.h>
50 #include <stdarg.h>
51 #include "srtp.h"
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
70 typedef enum {
81 
82 /*
83  * err_reporting_init prepares the error system. If
84  * ERR_REPORTING_SYSLOG is defined, it will open syslog.
85  *
86  * The ident argument is a string that will be prepended to
87  * all syslog messages. It is conventionally argv[0].
88  */
89 
91 
92 /*
93  * keydaemon_report_error reports a 'printf' formatted error
94  * string, followed by a an arg list. The priority argument
95  * is equivalent to that defined for syslog.
96  *
97  * Errors will be reported to ERR_REPORTING_FILE, if defined, and to
98  * syslog, if ERR_REPORTING_SYSLOG is defined.
99  *
100  */
101 
102 void
103 srtp_err_report(int priority, const char *format, ...);
104 
105 
106 /*
107  * debug_module_t defines a debug module
108  */
109 
110 typedef struct {
111  int on; /* 1 if debugging is on, 0 if it is off */
112  const char *name; /* printable name for debug module */
114 
115 #ifdef ENABLE_DEBUGGING
116 
117 #define debug_on(mod) (mod).on = 1
118 
119 #define debug_off(mod) (mod).on = 0
120 
121 /* use err_report() to report debug message */
122 #define debug_print(mod, format, arg) \
123  if (mod.on) srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name, arg)
124 #define debug_print2(mod, format, arg1, arg2) \
125  if (mod.on) srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name, arg1, arg2)
126 
127 #else
128 
129 /* define macros to do nothing */
130 #define debug_print(mod, format, arg)
131 
132 #define debug_on(mod)
133 
134 #define debug_off(mod)
135 
136 #endif
137 
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif /* ERR_H */
int on
Definition: err.h:111
Definition: err.h:79
GLint GLint GLint GLsizei GLsizei GLenum format
Definition: gl2.h:403
Definition: err.h:72
Definition: err.h:74
const char * name
Definition: err.h:112
srtp_err_status_t srtp_err_reporting_init(const char *ident)
Definition: err.c:60
Definition: err.h:75
Definition: err.h:77
Definition: err.h:78
Definition: err.h:73
Definition: err.h:71
Definition: err.h:110
srtp_err_reporting_level_t
Definition: err.h:70
Definition: err.h:76
void srtp_err_report(int priority, const char *format,...)
Definition: err.c:81
srtp_err_status_t
Definition: srtp.h:245