Debian Codegraph @

Xpjproject/pjlib/include/pj/errno.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <[email protected]>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 #ifndef __PJ_ERRNO_H__
20 #define __PJ_ERRNO_H__
21
22 /**
23 * @file errno.h
24 * @brief PJLIB Error Subsystem
25 */
26 #include <pj/types.h>
27 #include <pj/compat/errno.h>
28 #include <stdarg.h>
29
30 PJ_BEGIN_DECL
31
32 /**
33 * @defgroup pj_errno Error Subsystem
34 * @{
35 *
36 * The PJLIB Error Subsystem is a framework to unify all error codes
37 * produced by all components into a single error space, and provide
38 * uniform set of APIs to access them. With this framework, any error
39 * codes are encoded as pj_status_t value. The framework is extensible,
40 * application may register new error spaces to be recognized by
41 * the framework.
42 *
43 * @section pj_errno_retval Return Values
44 *
45 * All functions that returns @a pj_status_t returns @a PJ_SUCCESS if the
46 * operation was completed successfully, or non-zero value to indicate
47 * error. If the error came from operating system, then the native error
48 * code is translated/folded into PJLIB's error namespace by using
49 * #PJ_STATUS_FROM_OS() macro. The function will do this automatically
50 * before returning the error to caller.
51 *
52 * @section err_services Retrieving and Displaying Error Messages
53 *
54 * The framework provides the following APIs to retrieve and/or display
55 * error messages:
56 *
57 * - #pj_strerror(): this is the base API to retrieve error string
58 * description for the specified pj_status_t error code.
59 *
60 * - #PJ_PERROR() macro: use this macro similar to PJ_LOG to format
61 * an error message and display them to the log
62 *
63 * - #pj_perror(): this function is similar to PJ_PERROR() but unlike
64 * #PJ_PERROR(), this function will always be included in the
65 * link process. Due to this reason, prefer to use #PJ_PERROR()
66 * if the application is concerned about the executable size.
67 *
68 * Application MUST NOT pass native error codes (such as error code from
69 * functions like GetLastError() or errno) to PJLIB functions expecting
70 * @a pj_status_t.
71 *
72 * @section err_extending Extending the Error Space
73 *
74 * Application may register new error space to be recognized by the
75 * framework by using #pj_register_strerror(). Use the range started
76 * from PJ_ERRNO_START_USER to avoid conflict with existing error
77 * spaces.
78 *
79 */
80
81 /**
82 * Guidelines on error message length.
83 */
84 #ifndef PJ_ERR_MSG_SIZE
85 # define PJ_ERR_MSG_SIZE 80
86 #endif
87
88 /**
89 * Buffer for title string of #PJ_PERROR().
90 */
91 #ifndef PJ_PERROR_TITLE_BUF_SIZE
92 # define PJ_PERROR_TITLE_BUF_SIZE 120
93 #endif
94
95 /**
96 * On Windows XP and later, force the use of GetThreadLocale() in pj_strerror()
97 * to obtain the required locale and corresponding language for the platform
98 * error message string.
99 * Default value is set to "no" for compatibility reason, which means use
100 * "User default language".
101 *
102 * Default: 0 (no)
103 */
104 #ifndef PJ_STRERROR_USE_WIN_GET_THREAD_LOCALE
105 # define PJ_STRERROR_USE_WIN_GET_THREAD_LOCALE 0
106 #endif
107
108 /**
109 * Get the last platform error/status, folded into pj_status_t.
110 * @return OS dependent error code, folded into pj_status_t.
111 * @remark This function gets errno, or calls GetLastError() function and
112 * convert the code into pj_status_t with PJ_STATUS_FROM_OS. Do
113 * not call this for socket functions!
114 * @see pj_get_netos_error()
115 */
116 PJ_DECL(pj_status_t) pj_get_os_error(void);
117
118 /**
119 * Set last error.
120 * @param code pj_status_t
121 */
122 PJ_DECL(void) pj_set_os_error(pj_status_t code);
123
124 /**
125 * Get the last error from socket operations.
126 * @return Last socket error, folded into pj_status_t.
127 */
128 PJ_DECL(pj_status_t) pj_get_netos_error(void);
129
130 /**
131 * Set error code.
132 * @param code pj_status_t.
133 */
134 PJ_DECL(void) pj_set_netos_error(pj_status_t code);
135
136
137 /**
138 * Get the error message for the specified error code. The message
139 * string will be NULL terminated.
140 *
141 * @param statcode The error code.
142 * @param buf Buffer to hold the error message string.
143 * @param bufsize Size of the buffer.
144 *
145 * @return The error message as NULL terminated string,
146 * wrapped with pj_str_t.
147 */
148 PJ_DECL(pj_str_t) pj_strerror( pj_status_t statcode,
149 char *buf, pj_size_t bufsize);
150
151 /**
152 * A utility macro to print error message pertaining to the specified error
153 * code to the log. This macro will construct the error message title
154 * according to the 'title_fmt' argument, and add the error string pertaining
155 * to the error code after the title string. A colon (':') will be added
156 * automatically between the title and the error string.
157 *
158 * This function is similar to pj_perror() function, but has the advantage
159 * that the function call can be omitted from the link process if the
160 * log level argument is below PJ_LOG_MAX_LEVEL threshold.
161 *
162 * Note that the title string constructed from the title_fmt will be built on
163 * a string buffer which size is PJ_PERROR_TITLE_BUF_SIZE, which normally is
164 * allocated from the stack. By default this buffer size is small (around
165 * 120 characters). Application MUST ensure that the constructed title string
166 * will not exceed this limit, since not all platforms support truncating
167 * the string.
168 *
169 * @see pj_perror()
170 *
171 * @param level The logging verbosity level, valid values are 0-6. Lower
172 * number indicates higher importance, with level zero
173 * indicates fatal error. Only numeral argument is
174 * permitted (e.g. not variable).
175 * @param arg Enclosed 'printf' like arguments, with the following
176 * arguments:
177 * - the sender (NULL terminated string),
178 * - the error code (pj_status_t)
179 * - the format string (title_fmt), and
180 * - optional variable number of arguments suitable for the
181 * format string.
182 *
183 * Sample:
184 * \verbatim
185 PJ_PERROR(2, (__FILE__, PJ_EBUSY, "Error making %s", "coffee"));
186 \endverbatim
187 * @hideinitializer
188 */
189 #define PJ_PERROR(level,arg) do { \
190 pj_perror_wrapper_##level(arg); \
191 } while (0)
192
193 /**
194 * A utility macro to print error message pertaining to the specified error
195 * code to the log. This macro will construct the error message title
196 * according to the 'title_fmt' argument, and add the error string pertaining
197 * to the error code after the title string. A colon (':') will be added
198 * automatically between the title and the error string.
199 *
200 * This function is similar to pj_perror() function, but has the advantage
201 * that the function call can be omitted from the link process if the
202 * log level argument is below PJ_LOG_MAX_LEVEL threshold.
203 *
204 * Note that the title string constructed from the title_fmt will be built on
205 * a string buffer which size is PJ_PERROR_TITLE_BUF_SIZE, which normally is
206 * allocated from the stack. By default this buffer size is small (around
207 * 120 characters). Application MUST ensure that the constructed title string
208 * will not exceed this limit, since not all platforms support truncating
209 * the string.
210 *
211 * @see pj_perror()
212 *
213 * @param LVL The logging verbosity level, valid values are 0-6. Lower
214 * number indicates higher importance, with level zero
215 * indicates fatal error. Variable argument is not permitted,
216 * the argument may be a numeral constant or a numeral value
217 * macros.
218 * @param arg Enclosed 'printf' like arguments, with the following
219 * arguments:
220 * @param sender the sender (NULL terminated string),
221 * @param status the error code (pj_status_t)
222 * @param title_fmt the printf style format string, and optional variable
223 * number of arguments suitable for the format string.
224 *
225 * Sample:
226 * \verbatim
227 #ifdef PJ_DEBUG
228 # define MY_ERROR_LEVEL 1
229 #else
230 # define MY_ERROR_LEVEL 2
231 #endif
232 PJ_PERROR_(MY_ERROR_LEVEL, __FILE__, PJ_EBUSY, "Error making %s", "coffee");
233 \endverbatim
234 * @hideinitializer
235 */
236 #define PJ_PERROR_(LVL, sender, status, title_fmt, ...) \
237 PJ_PERROR(LVL,(sender,status,title_fmt, __VA_ARGS__))
238
239 /**
240 * A utility function to print error message pertaining to the specified error
241 * code to the log. This function will construct the error message title
242 * according to the 'title_fmt' argument, and add the error string pertaining
243 * to the error code after the title string. A colon (':') will be added
244 * automatically between the title and the error string.
245 *
246 * Unlike the PJ_PERROR() macro, this function takes the \a log_level argument
247 * as a normal argument, unlike in PJ_PERROR() where a numeral value must be
248 * given. However this function will always be linked to the executable,
249 * unlike PJ_PERROR() which can be omitted when the level is below the
250 * PJ_LOG_MAX_LEVEL.
251 *
252 * Note that the title string constructed from the title_fmt will be built on
253 * a string buffer which size is PJ_PERROR_TITLE_BUF_SIZE, which normally is
254 * allocated from the stack. By default this buffer size is small (around
255 * 120 characters). Application MUST ensure that the constructed title string
256 * will not exceed this limit, since not all platforms support truncating
257 * the string.
258 *
259 * @see PJ_PERROR()
260 */
261 PJ_DECL(void) pj_perror(int log_level, const char *sender, pj_status_t status,
262 PJ_PRINT_PARAM_DECOR const char *title_fmt, ...)
263 PJ_PRINT_FUNC_DECOR(4);
264
265
266 /**
267 * Type of callback to be specified in #pj_register_strerror()
268 *
269 * @param e The error code to lookup.
270 * @param msg Buffer to store the error message.
271 * @param max Length of the buffer.
272 *
273 * @return The error string.
274 */
275 typedef pj_str_t (*pj_error_callback)(pj_status_t e, char *msg, pj_size_t max);
276
277
278 /**
279 * Register strerror message handler for the specified error space.
280 * Application can register its own handler to supply the error message
281 * for the specified error code range. This handler will be called
282 * by #pj_strerror().
283 *
284 * @param start_code The starting error code where the handler should
285 * be called to retrieve the error message.
286 * @param err_space The size of error space. The error code range then
287 * will fall in start_code to start_code+err_space-1
288 * range.
289 * @param f The handler to be called when #pj_strerror() is
290 * supplied with error code that falls into this range.
291 *
292 * @return PJ_SUCCESS or the specified error code. The
293 * registration may fail when the error space has been
294 * occupied by other handler, or when there are too many
295 * handlers registered to PJLIB.
296 */
297 PJ_DECL(pj_status_t) pj_register_strerror(pj_status_t start_code,
298 pj_status_t err_space,
299 pj_error_callback f);
300
301 /**
302 * @hideinitializer
303 * Return platform os error code folded into pj_status_t code. This is
304 * the macro that is used throughout the library for all PJLIB's functions
305 * that returns error from operating system. Application may override
306 * this macro to reduce size (e.g. by defining it to always return
307 * #PJ_EUNKNOWN).
308 *
309 * Note:
310 * This macro MUST return non-zero value regardless whether zero is
311 * passed as the argument. The reason is to protect logic error when
312 * the operating system doesn't report error codes properly.
313 *
314 * @param os_code Platform OS error code. This value may be evaluated
315 * more than once.
316 * @return The platform os error code folded into pj_status_t.
317 */
318 #ifndef PJ_RETURN_OS_ERROR
319 # define PJ_RETURN_OS_ERROR(os_code) (os_code ? \
320 PJ_STATUS_FROM_OS(os_code) : -1)
321 #endif
322
323
324 /**
325 * @hideinitializer
326 * Fold a platform specific error into an pj_status_t code.
327 *
328 * @param e The platform os error code.
329 * @return pj_status_t
330 * @warning Macro implementation; the syserr argument may be evaluated
331 * multiple times.
332 */
333 #if PJ_NATIVE_ERR_POSITIVE
334 # define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
335 #else
336 # define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : PJ_ERRNO_START_SYS - e)
337 #endif
338
339 /**
340 * @hideinitializer
341 * Fold an pj_status_t code back to the native platform defined error.
342 *
343 * @param e The pj_status_t folded platform os error code.
344 * @return pj_os_err_type
345 * @warning macro implementation; the statcode argument may be evaluated
346 * multiple times. If the statcode was not created by
347 * pj_get_os_error or PJ_STATUS_FROM_OS, the results are undefined.
348 */
349 #if PJ_NATIVE_ERR_POSITIVE
350 # define PJ_STATUS_TO_OS(e) (e == 0 ? PJ_SUCCESS : e - PJ_ERRNO_START_SYS)
351 #else
352 # define PJ_STATUS_TO_OS(e) (e == 0 ? PJ_SUCCESS : PJ_ERRNO_START_SYS - e)
353 #endif
354
355
356 /**
357 * @defgroup pj_errnum PJLIB's Own Error Codes
358 * @ingroup pj_errno
359 * @{
360 */
361
362 /**
363 * Use this macro to generate error message text for your error code,
364 * so that they look uniformly as the rest of the libraries.
365 *
366 * @param code The error code
367 * @param msg The error test.
368 */
369 #ifndef PJ_BUILD_ERR
370 # define PJ_BUILD_ERR(code,msg) { code, msg " (" #code ")" }
371 #endif
372
373
374 /**
375 * @hideinitializer
376 * Unknown error has been reported.
377 */
378 #define PJ_EUNKNOWN (PJ_ERRNO_START_STATUS + 1) /* 70001 */
379 /**
380 * @hideinitializer
381 * The operation is pending and will be completed later.
382 */
383 #define PJ_EPENDING (PJ_ERRNO_START_STATUS + 2) /* 70002 */
384 /**
385 * @hideinitializer
386 * Too many connecting sockets.
387 */
388 #define PJ_ETOOMANYCONN (PJ_ERRNO_START_STATUS + 3) /* 70003 */
389 /**
390 * @hideinitializer
391 * Invalid argument.
392 */
393 #define PJ_EINVAL (PJ_ERRNO_START_STATUS + 4) /* 70004 */
394 /**
395 * @hideinitializer
396 * Name too long (eg. hostname too long).
397 */
398 #define PJ_ENAMETOOLONG (PJ_ERRNO_START_STATUS + 5) /* 70005 */
399 /**
400 * @hideinitializer
401 * Not found.
402 */
403 #define PJ_ENOTFOUND (PJ_ERRNO_START_STATUS + 6) /* 70006 */
404 /**
405 * @hideinitializer
406 * Not enough memory.
407 */
408 #define PJ_ENOMEM (PJ_ERRNO_START_STATUS + 7) /* 70007 */
409 /**
410 * @hideinitializer
411 * Bug detected!
412 */
413 #define PJ_EBUG (PJ_ERRNO_START_STATUS + 8) /* 70008 */
414 /**
415 * @hideinitializer
416 * Operation timed out.
417 */
418 #define PJ_ETIMEDOUT (PJ_ERRNO_START_STATUS + 9) /* 70009 */
419 /**
420 * @hideinitializer
421 * Too many objects.
422 */
423 #define PJ_ETOOMANY (PJ_ERRNO_START_STATUS + 10)/* 70010 */
424 /**
425 * @hideinitializer
426 * Object is busy.
427 */
428 #define PJ_EBUSY (PJ_ERRNO_START_STATUS + 11)/* 70011 */
429 /**
430 * @hideinitializer
431 * The specified option is not supported.
432 */
433 #define PJ_ENOTSUP (PJ_ERRNO_START_STATUS + 12)/* 70012 */
434 /**
435 * @hideinitializer
436 * Invalid operation.
437 */
438 #define PJ_EINVALIDOP (PJ_ERRNO_START_STATUS + 13)/* 70013 */
439 /**
440 * @hideinitializer
441 * Operation is cancelled.
442 */
443 #define PJ_ECANCELLED (PJ_ERRNO_START_STATUS + 14)/* 70014 */
444 /**
445 * @hideinitializer
446 * Object already exists.
447 */
448 #define PJ_EEXISTS (PJ_ERRNO_START_STATUS + 15)/* 70015 */
449 /**
450 * @hideinitializer
451 * End of file.
452 */
453 #define PJ_EEOF (PJ_ERRNO_START_STATUS + 16)/* 70016 */
454 /**
455 * @hideinitializer
456 * Size is too big.
457 */
458 #define PJ_ETOOBIG (PJ_ERRNO_START_STATUS + 17)/* 70017 */
459 /**
460 * @hideinitializer
461 * Error in gethostbyname(). This is a generic error returned when
462 * gethostbyname() has returned an error.
463 */
464 #define PJ_ERESOLVE (PJ_ERRNO_START_STATUS + 18)/* 70018 */
465 /**
466 * @hideinitializer
467 * Size is too small.
468 */
469 #define PJ_ETOOSMALL (PJ_ERRNO_START_STATUS + 19)/* 70019 */
470 /**
471 * @hideinitializer
472 * Ignored
473 */
474 #define PJ_EIGNORED (PJ_ERRNO_START_STATUS + 20)/* 70020 */
475 /**
476 * @hideinitializer
477 * IPv6 is not supported
478 */
479 #define PJ_EIPV6NOTSUP (PJ_ERRNO_START_STATUS + 21)/* 70021 */
480 /**
481 * @hideinitializer
482 * Unsupported address family
483 */
484 #define PJ_EAFNOTSUP (PJ_ERRNO_START_STATUS + 22)/* 70022 */
485 /**
486 * @hideinitializer
487 * Object no longer exists
488 */
489 #define PJ_EGONE (PJ_ERRNO_START_STATUS + 23)/* 70023 */
490 /**
491 * @hideinitializer
492 * Socket is stopped
493 */
494 #define PJ_ESOCKETSTOP (PJ_ERRNO_START_STATUS + 24)/* 70024 */
495 /**
496 * @hideinitializer
497 * Try again
498 */
499 #define PJ_ETRYAGAIN (PJ_ERRNO_START_STATUS + 25)/* 70025 */
500
501 /** @} */ /* pj_errnum */
502
503 /** @} */ /* pj_errno */
504
505
506 /**
507 * PJ_ERRNO_START is where PJLIB specific error values start.
508 */
509 #define PJ_ERRNO_START 20000
510
511 /**
512 * PJ_ERRNO_SPACE_SIZE is the maximum number of errors in one of
513 * the error/status range below.
514 */
515 #define PJ_ERRNO_SPACE_SIZE 50000
516
517 /**
518 * PJ_ERRNO_START_STATUS is where PJLIB specific status codes start.
519 * Effectively the error in this class would be 70000 - 119000.
520 */
521 #define PJ_ERRNO_START_STATUS (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
522
523 /**
524 * PJ_ERRNO_START_SYS converts platform specific error codes into
525 * pj_status_t values.
526 * Effectively the error in this class would be 120000 - 169000.
527 */
528 #define PJ_ERRNO_START_SYS (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
529
530 /**
531 * PJ_ERRNO_START_USER are reserved for applications that use error
532 * codes along with PJLIB codes.
533 * Effectively the error in this class would be 170000 - 219000.
534 */
535 #define PJ_ERRNO_START_USER (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
536
537
538 /*
539 * Below are list of error spaces that have been taken so far:
540 * - PJSIP_ERRNO_START (PJ_ERRNO_START_USER)
541 * - PJMEDIA_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE)
542 * - PJSIP_SIMPLE_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*2)
543 * - PJLIB_UTIL_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*3)
544 * - PJNATH_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*4)
545 * - PJMEDIA_AUDIODEV_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*5)
546 * - PJ_SSL_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*6)
547 * - PJMEDIA_VIDEODEV_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*7)
548 */
549
550 /** Internal */
551 void pj_errno_clear_handlers(void);
552
553
554 /****** Internal for PJ_PERROR *******/
555
556 /**
557 * @def pj_perror_wrapper_1(arg)
558 * Internal function to write log with verbosity 1. Will evaluate to
559 * empty expression if PJ_LOG_MAX_LEVEL is below 1.
560 * @param arg Log expression.
561 */
562 #if PJ_LOG_MAX_LEVEL >= 1
563 #define pj_perror_wrapper_1(arg) pj_perror_1 arg
564 /** Internal function. */
565 PJ_DECL(void) pj_perror_1(const char *sender, pj_status_t status,
566 PJ_PRINT_PARAM_DECOR const char *title_fmt, ...)
567 PJ_PRINT_FUNC_DECOR(3);
568 #else
569 #define pj_perror_wrapper_1(arg)
570 #endif
571
572 /**
573 * @def pj_perror_wrapper_2(arg)
574 * Internal function to write log with verbosity 2. Will evaluate to
575 * empty expression if PJ_LOG_MAX_LEVEL is below 2.
576 * @param arg Log expression.
577 */
578 #if PJ_LOG_MAX_LEVEL >= 2
579 #define pj_perror_wrapper_2(arg) pj_perror_2 arg
580 /** Internal function. */
581 PJ_DECL(void) pj_perror_2(const char *sender, pj_status_t status,
582 PJ_PRINT_PARAM_DECOR const char *title_fmt, ...)
583 PJ_PRINT_FUNC_DECOR(3);
584 #else
585 #define pj_perror_wrapper_2(arg)
586 #endif
587
588 /**
589 * @def pj_perror_wrapper_3(arg)
590 * Internal function to write log with verbosity 3. Will evaluate to
591 * empty expression if PJ_LOG_MAX_LEVEL is below 3.
592 * @param arg Log expression.
593 */
594 #if PJ_LOG_MAX_LEVEL >= 3
595 #define pj_perror_wrapper_3(arg) pj_perror_3 arg
596 /** Internal function. */
597 PJ_DECL(void) pj_perror_3(const char *sender, pj_status_t status,
598 PJ_PRINT_PARAM_DECOR const char *title_fmt, ...)
599 PJ_PRINT_FUNC_DECOR(3);
600 #else
601 #define pj_perror_wrapper_3(arg)
602 #endif
603
604 /**
605 * @def pj_perror_wrapper_4(arg)
606 * Internal function to write log with verbosity 4. Will evaluate to
607 * empty expression if PJ_LOG_MAX_LEVEL is below 4.
608 * @param arg Log expression.
609 */
610 #if PJ_LOG_MAX_LEVEL >= 4
611 #define pj_perror_wrapper_4(arg) pj_perror_4 arg
612 /** Internal function. */
613 PJ_DECL(void) pj_perror_4(const char *sender, pj_status_t status,
614 PJ_PRINT_PARAM_DECOR const char *title_fmt, ...)
615 PJ_PRINT_FUNC_DECOR(3);
616 #else
617 #define pj_perror_wrapper_4(arg)
618 #endif
619
620 /**
621 * @def pj_perror_wrapper_5(arg)
622 * Internal function to write log with verbosity 5. Will evaluate to
623 * empty expression if PJ_LOG_MAX_LEVEL is below 5.
624 * @param arg Log expression.
625 */
626 #if PJ_LOG_MAX_LEVEL >= 5
627 #define pj_perror_wrapper_5(arg) pj_perror_5 arg
628 /** Internal function. */
629 PJ_DECL(void) pj_perror_5(const char *sender, pj_status_t status,
630 PJ_PRINT_PARAM_DECOR const char *title_fmt, ...)
631 PJ_PRINT_FUNC_DECOR(3);
632 #else
633 #define pj_perror_wrapper_5(arg)
634 #endif
635
636 /**
637 * @def pj_perror_wrapper_6(arg)
638 * Internal function to write log with verbosity 6. Will evaluate to
639 * empty expression if PJ_LOG_MAX_LEVEL is below 6.
640 * @param arg Log expression.
641 */
642 #if PJ_LOG_MAX_LEVEL >= 6
643 #define pj_perror_wrapper_6(arg) pj_perror_6 arg
644 /** Internal function. */
645 PJ_DECL(void) pj_perror_6(const char *sender, pj_status_t status,
646 PJ_PRINT_PARAM_DECOR const char *title_fmt, ...)
647 PJ_PRINT_FUNC_DECOR(3);
648 #else
649 #define pj_perror_wrapper_6(arg)
650 #endif
651
652
653
654
655 PJ_END_DECL
656
657 #endif /* __PJ_ERRNO_H__ */
658