Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: crypto/include/err.h

Issue 2344973002: Update libsrtp to version 2.0 (Closed)
Patch Set: Add '.' back to include_dirs Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « crypto/include/datatypes.h ('k') | crypto/include/integers.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
57 /**
58 * @defgroup Error Error Codes
59 *
60 * Error status codes are represented by the enumeration srtp_err_status_t.
61 *
62 * @{
63 */
64
65
66 /**
67 * @}
68 */
69
70 typedef enum {
71 srtp_err_level_emergency = 0,
72 srtp_err_level_alert,
73 srtp_err_level_critical,
74 srtp_err_level_error,
75 srtp_err_level_warning,
76 srtp_err_level_notice,
77 srtp_err_level_info,
78 srtp_err_level_debug,
79 srtp_err_level_none
80 } srtp_err_reporting_level_t;
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
90 srtp_err_status_t srtp_err_reporting_init(const char *ident);
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 */
113 } srtp_debug_module_t;
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 */
OLDNEW
« no previous file with comments | « crypto/include/datatypes.h ('k') | crypto/include/integers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698