1/* $Copyright:
2 *
3 * Copyright 1998-2000 by the Massachusetts Institute of Technology.
4 *
5 * All rights reserved.
6 *
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation for any purpose and without fee is hereby granted,
9 * provided that the above copyright notice appear in all copies and that
10 * both that copyright notice and this permission notice appear in
11 * supporting documentation, and that the name of M.I.T. not be used in
12 * advertising or publicity pertaining to distribution of the software
13 * without specific, written prior permission.  Furthermore if you modify
14 * this software you must label your software as modified software and not
15 * distribute it in such a fashion that it might be confused with the
16 * original MIT software. M.I.T. makes no representations about the
17 * suitability of this software for any purpose.  It is provided "as is"
18 * without express or implied warranty.
19 *
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
22 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 *
24 * Individual source code files are copyright MIT, Cygnus Support,
25 * OpenVision, Oracle, Sun Soft, FundsXpress, and others.
26 *
27 * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,
28 * and Zephyr are trademarks of the Massachusetts Institute of Technology
29 * (MIT).  No commercial use of these trademarks may be made without prior
30 * written permission of MIT.
31 *
32 * "Commercial use" means use of a name in a product or other for-profit
33 * manner.  It does NOT prevent a commercial firm from referring to the MIT
34 * trademarks in order to convey information (although in doing so,
35 * recognition of their trademark status should be given).
36 * $
37 */
38
39/* $Header$ */
40
41/*
42 *
43 * KerberosComErr.h -- Functions to handle Kerberos errors.
44 *
45 */
46
47
48#ifndef __KERBEROSCOMERR__
49#define __KERBEROSCOMERR__
50
51#ifndef __has_extension
52#define __has_extension(x) 0
53#endif
54
55#ifndef KERBEROS_APPLE_DEPRECATED
56#if __has_extension(attribute_deprecated_with_message)
57#define KERBEROS_APPLE_DEPRECATED(x) __attribute__((deprecated(x)))
58#else
59#if !defined(__GNUC__) && !defined(__attribute__)
60#define __attribute__(x)
61#endif
62#define KERBEROS_APPLE_DEPRECATED(x) __attribute__((deprecated))
63#endif
64#endif
65
66#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))
67#    include <TargetConditionals.h>
68#    if TARGET_RT_MAC_CFM
69#        error "Use KfM 4.0 SDK headers for CFM compilation."
70#    endif
71#endif
72
73#include <sys/types.h>
74#include <stdarg.h>
75
76#ifdef __cplusplus
77extern "C" {
78#endif
79
80typedef long errcode_t;
81typedef void (*com_err_handler_t)
82    (const char *whoami, errcode_t code, const char *format, va_list args);
83
84struct error_table {
85    const char * const * const messages;
86    int32_t base;
87    int32_t count;
88};
89
90/* ******************* */
91/* Function prototypes */
92/* ******************* */
93
94void com_err    (const char *progname, errcode_t code, const char *format, ...);
95void com_err_va (const char *progname, errcode_t code, const char *format, va_list args);
96
97const char *error_message (errcode_t code);
98const char *error_manager (errcode_t code);
99
100com_err_handler_t set_com_err_hook(com_err_handler_t handler);
101com_err_handler_t reset_com_err_hook(void);
102
103errcode_t add_error_table    (const struct error_table *et);
104errcode_t remove_error_table (const struct error_table *et);
105
106#ifdef __cplusplus
107}
108#endif
109
110#endif /* __KERBEROSCOMERR__ */
111