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