xref: /freebsd/crypto/krb5/src/util/et/com_err.h (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1 /*
2  * Copyright 1988, Student Information Processing Board of the
3  * Massachusetts Institute of Technology.
4  *
5  * Copyright 1995 by Cygnus Support.
6  *
7  * For copyright and distribution info, see the documentation supplied
8  * with this package.
9  */
10 
11 /* Header file for common error description library. */
12 
13 #ifndef __COM_ERR_H
14 
15 #if defined(_WIN32)
16 #include <win-mac.h>
17 #endif
18 
19 #ifndef KRB5_CALLCONV
20 #define KRB5_CALLCONV
21 #define KRB5_CALLCONV_C
22 #endif
23 
24 #include <stdarg.h>
25 
26 typedef long errcode_t;
27 typedef void (*et_old_error_hook_func) (const char *, errcode_t,
28 					const char *, va_list ap);
29 
30 struct error_table {
31 	/*@shared@*/ char const * const * msgs;
32         long base;
33 	unsigned int n_msgs;
34 };
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /* Public interfaces */
41 extern void KRB5_CALLCONV_C com_err
42 	(const char *, errcode_t, const char *, ...)
43 #if !defined(__cplusplus) && (__GNUC__ > 2)
44     __attribute__((__format__(__printf__, 3, 4)))
45 #endif
46     ;
47 extern void KRB5_CALLCONV com_err_va
48 	(const char *whoami, errcode_t code, const char *fmt,
49 	 va_list ap)
50 #if !defined(__cplusplus) && (__GNUC__ > 2)
51     __attribute__((__format__(__printf__, 3, 0)))
52 #endif
53     ;
54 extern /*@observer@*//*@dependent@*/ const char * KRB5_CALLCONV error_message
55 	(errcode_t)
56        /*@modifies internalState@*/;
57 extern errcode_t KRB5_CALLCONV add_error_table
58 	(/*@dependent@*/ const struct error_table *)
59        /*@modifies internalState@*/;
60 extern errcode_t KRB5_CALLCONV remove_error_table
61 	(const struct error_table *)
62        /*@modifies internalState@*/;
63 
64 #if !defined(_WIN32)
65 /*
66  * The display routine should be application specific.  A global hook,
67  * may cause inappropriate display procedures to be called between
68  * applications under non-Unix environments.
69  */
70 
71 extern et_old_error_hook_func set_com_err_hook (et_old_error_hook_func);
72 extern et_old_error_hook_func reset_com_err_hook (void);
73 #endif
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #define __COM_ERR_H
80 #endif /* ! defined(__COM_ERR_H) */
81