1/*
2 * Copyright (c) 2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef H_LKDCHELPER_H
25#define H_LKDCHELPER_H
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#include <asl.h>
32
33#define kLKDCHelperName "com.apple.KerberosHelper.LKDCHelper"
34
35/* Possible error return codes from the LKDCHelper */
36#define ERROR(x, y) x,
37enum kLKDCHelperErrors {
38	kLKDCHelperSuccess = 0,
39	kLKDCHelperErrorBase = 38400,
40#include "LKDCHelper-error.h"
41	kLKDCHelperErrorEnd
42};
43#undef ERROR
44
45typedef enum kLKDCHelperErrors LKDCHelperErrorType;
46
47extern volatile int	LKDCLogLevel;
48
49extern	void LKDCLogFunc (const char *func, const char *fmt, ...)
50    __attribute__ ((format (printf, 2, 3)));
51
52#define LKDCLog(...)		LKDCLogFunc (__func__, __VA_ARGS__)
53#define LKDCLogEnter()		asl_log(NULL, NULL, LKDCLogLevel, "[[[ %s", __func__)
54#define LKDCLogExit(error)	asl_log(NULL, NULL, LKDCLogLevel, "]]] %s = %d (%s)", __func__, error, LKDCHelperError (error))
55
56extern	const char				*LKDCHelperError (LKDCHelperErrorType err);
57extern	void					LKDCHelperExit ();
58extern	void					LKDCDumpStatus (int logLevel);
59extern	void					LKDCSetLogLevel (int logLevel);
60extern	LKDCHelperErrorType		LKDCGetLocalRealm (char **name);
61extern	LKDCHelperErrorType		LKDCDiscoverRealm (const char *hostname, char **realm);
62extern	LKDCHelperErrorType		LKDCFindKDCForRealm (const char *realm, char **hostname, uint16_t *port);
63
64#ifdef  __cplusplus
65}
66#endif
67
68#endif /* H_LKDCHELPER_H */
69