Initial import from FreeBSD RELENG_4:
[games.git] / crypto / kerberosIV / lib / kclient / KClient.h
1 /*
2  * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
3  * (Royal Institute of Technology, Stockholm, Sweden).
4  * All rights reserved.
5  * 
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 
17  * 3. Neither the name of the Institute nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  * 
21  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  */
33
34 /* KClient.h - KClient glue to krb4.dll
35  * Author: Jörgen Karlsson - d93-jka@nada.kth.se
36  * Date: June 1996
37  */
38
39 /* $Id: KClient.h,v 1.8 1999/12/02 16:58:40 joda Exp $ */
40
41 #ifndef KCLIENT_H
42 #define KCLIENT_H
43
44 #ifdef MacOS
45 #include <Types.h>
46 typedef OSerr Kerr;
47 #endif /* MacOS */
48
49 #ifdef WIN32    /* Visual C++ 4.0 (Windows95/NT) */
50 typedef int Kerr;
51 #endif /* WIN32 */
52
53 enum { KClientLoggedIn, KClientNotLoggedIn };
54
55 struct _KClientKey
56 {
57     unsigned char keyBytes[8];
58 };
59 typedef struct _KClientKey KClientKey;
60
61 struct _KClientSessionInfo
62 {
63     unsigned long lAddr;
64     unsigned short lPort;
65     unsigned long fAddr;
66     unsigned short fPort;
67     char user[32];
68     char inst[32];
69     char realm[32];
70     char key[8];
71 };
72 typedef struct _KClientSessionInfo KClientSessionInfo;
73
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77
78 Kerr KClientMessage(char *text, Kerr error);
79
80 /* KClientInitSession */
81 Kerr KClientInitSession(KClientSessionInfo *session,
82                         unsigned long lAddr,
83                         unsigned short lPort,
84                         unsigned long fAddr,
85                         unsigned short fPort);
86
87 /* KClientGetTicketForService */
88 Kerr KClientGetTicketForService(KClientSessionInfo *session,
89                                 char *service,
90                                 void *buf,
91                                 unsigned long *buflen);
92
93
94 /* KClientLogin */
95 Kerr KClientLogin(KClientSessionInfo *session,
96                   KClientKey *privateKey );
97
98 /* KClientPasswordLogin */
99 Kerr KClientPasswordLogin(KClientSessionInfo *session,
100                           char *password,
101                           KClientKey *privateKey);
102
103 /* KClientKeyLogin */
104 Kerr KClientKeyLogin(KClientSessionInfo *session, KClientKey *privateKey);
105
106 /* KClientLogout */
107 Kerr KClientLogout(void);
108
109 /* KClientStatus */
110 short KClientStatus(KClientSessionInfo *session);
111
112 /* KClientGetUserName */
113 Kerr KClientGetUserName(char *user);
114
115 /* KClientSetUserName */
116 Kerr KClientSetUserName(char *user);
117
118 /* KClientCacheInitialTicket */
119 Kerr KClientCacheInitialTicket(KClientSessionInfo *session,
120                                char *service);
121
122 /* KClientGetSessionKey */
123 Kerr KClientGetSessionKey(KClientSessionInfo *session,
124                           KClientKey *sessionKey);
125
126 /* KClientMakeSendAuth */
127 Kerr KClientMakeSendAuth(KClientSessionInfo *session,
128                          char *service,
129                          void *buf,
130                          unsigned long *buflen,
131                          long checksum,
132                          char *applicationVersion);
133
134 /* KClientVerifySendAuth */
135 Kerr KClientVerifySendAuth(KClientSessionInfo *session,
136                            void *buf,
137                            unsigned long *buflen);
138
139 /* KClientEncrypt */
140 Kerr KClientEncrypt(KClientSessionInfo *session,
141                     void *buf,
142                     unsigned long buflen,
143                     void *encryptBuf,
144                     unsigned long *encryptLength);
145
146 /* KClientDecrypt */
147 Kerr KClientDecrypt(KClientSessionInfo *session,
148                     void *buf,
149                     unsigned long buflen,
150                     unsigned long *decryptOffset,
151                     unsigned long *decryptLength);
152
153 /* KClientErrorText */
154 char *KClientErrorText(Kerr err, char *text);
155
156 #ifdef __cplusplus
157 }
158 #endif
159
160 #endif /* KCLIENT_H */