No empty .Rs/.Re
[netbsd-mini2440.git] / crypto / dist / heimdal / lib / krb5 / krb5_ccapi.h
blobf0cd640fd3bb201700e3b9c64d7d2d2d10bc26f4
1 /*
2 * Copyright (c) 2004 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
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.
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.
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.
34 /* $Heimdal: krb5_ccapi.h 22090 2007-12-02 23:23:43Z lha $
35 $NetBSD$ */
37 #ifndef KRB5_CCAPI_H
38 #define KRB5_CCAPI_H 1
40 #ifndef __krb5_types_h__
41 #define __krb5_types_h__
42 #include <sys/types.h>
43 #include <inttypes.h>
44 #include <sys/socket.h>
45 typedef socklen_t krb5_socklen_t;
46 typedef ssize_t krb5_ssize_t;
47 #endif
49 enum {
50 cc_credentials_v5 = 2
53 enum {
54 ccapi_version_3 = 3,
55 ccapi_version_4 = 4
58 enum {
59 ccNoError = 0,
61 ccIteratorEnd = 201,
62 ccErrBadParam,
63 ccErrNoMem,
64 ccErrInvalidContext,
65 ccErrInvalidCCache,
67 ccErrInvalidString, /* 206 */
68 ccErrInvalidCredentials,
69 ccErrInvalidCCacheIterator,
70 ccErrInvalidCredentialsIterator,
71 ccErrInvalidLock,
73 ccErrBadName, /* 211 */
74 ccErrBadCredentialsVersion,
75 ccErrBadAPIVersion,
76 ccErrContextLocked,
77 ccErrContextUnlocked,
79 ccErrCCacheLocked, /* 216 */
80 ccErrCCacheUnlocked,
81 ccErrBadLockType,
82 ccErrNeverDefault,
83 ccErrCredentialsNotFound,
85 ccErrCCacheNotFound, /* 221 */
86 ccErrContextNotFound,
87 ccErrServerUnavailable,
88 ccErrServerInsecure,
89 ccErrServerCantBecomeUID,
91 ccErrTimeOffsetNotSet /* 226 */
94 typedef int32_t cc_int32;
95 typedef uint32_t cc_uint32;
96 typedef struct cc_context_t *cc_context_t;
97 typedef struct cc_ccache_t *cc_ccache_t;
98 typedef struct cc_ccache_iterator_t *cc_ccache_iterator_t;
99 typedef struct cc_credentials_v5_t cc_credentials_v5_t;
100 typedef struct cc_credentials_t *cc_credentials_t;
101 typedef struct cc_credentials_iterator_t *cc_credentials_iterator_t;
102 typedef struct cc_string_t *cc_string_t;
103 typedef time_t cc_time_t;
105 typedef struct cc_data {
106 cc_uint32 type;
107 cc_uint32 length;
108 void *data;
109 } cc_data;
111 struct cc_credentials_v5_t {
112 char *client;
113 char *server;
114 cc_data keyblock;
115 cc_time_t authtime;
116 cc_time_t starttime;
117 cc_time_t endtime;
118 cc_time_t renew_till;
119 cc_uint32 is_skey;
120 cc_uint32 ticket_flags;
121 #define KRB5_CCAPI_TKT_FLG_FORWARDABLE 0x40000000
122 #define KRB5_CCAPI_TKT_FLG_FORWARDED 0x20000000
123 #define KRB5_CCAPI_TKT_FLG_PROXIABLE 0x10000000
124 #define KRB5_CCAPI_TKT_FLG_PROXY 0x08000000
125 #define KRB5_CCAPI_TKT_FLG_MAY_POSTDATE 0x04000000
126 #define KRB5_CCAPI_TKT_FLG_POSTDATED 0x02000000
127 #define KRB5_CCAPI_TKT_FLG_INVALID 0x01000000
128 #define KRB5_CCAPI_TKT_FLG_RENEWABLE 0x00800000
129 #define KRB5_CCAPI_TKT_FLG_INITIAL 0x00400000
130 #define KRB5_CCAPI_TKT_FLG_PRE_AUTH 0x00200000
131 #define KRB5_CCAPI_TKT_FLG_HW_AUTH 0x00100000
132 #define KRB5_CCAPI_TKT_FLG_TRANSIT_POLICY_CHECKED 0x00080000
133 #define KRB5_CCAPI_TKT_FLG_OK_AS_DELEGATE 0x00040000
134 #define KRB5_CCAPI_TKT_FLG_ANONYMOUS 0x00020000
135 cc_data **addresses;
136 cc_data ticket;
137 cc_data second_ticket;
138 cc_data **authdata;
142 typedef struct cc_string_functions {
143 cc_int32 (*release)(cc_string_t);
144 } cc_string_functions;
146 struct cc_string_t {
147 const char *data;
148 const cc_string_functions *func;
151 typedef struct cc_credentials_union {
152 cc_int32 version;
153 union {
154 cc_credentials_v5_t* credentials_v5;
155 } credentials;
156 } cc_credentials_union;
158 struct cc_credentials_functions {
159 cc_int32 (*release)(cc_credentials_t);
160 cc_int32 (*compare)(cc_credentials_t, cc_credentials_t, cc_uint32*);
163 struct cc_credentials_t {
164 const cc_credentials_union* data;
165 const struct cc_credentials_functions* func;
168 struct cc_credentials_iterator_functions {
169 cc_int32 (*release)(cc_credentials_iterator_t);
170 cc_int32 (*next)(cc_credentials_iterator_t, cc_credentials_t*);
173 struct cc_credentials_iterator_t {
174 const struct cc_credentials_iterator_functions *func;
177 struct cc_ccache_iterator_functions {
178 cc_int32 (*release) (cc_ccache_iterator_t);
179 cc_int32 (*next)(cc_ccache_iterator_t, cc_ccache_t*);
182 struct cc_ccache_iterator_t {
183 const struct cc_ccache_iterator_functions* func;
186 typedef struct cc_ccache_functions {
187 cc_int32 (*release)(cc_ccache_t);
188 cc_int32 (*destroy)(cc_ccache_t);
189 cc_int32 (*set_default)(cc_ccache_t);
190 cc_int32 (*get_credentials_version)(cc_ccache_t, cc_uint32*);
191 cc_int32 (*get_name)(cc_ccache_t, cc_string_t*);
192 cc_int32 (*get_principal)(cc_ccache_t, cc_uint32, cc_string_t*);
193 cc_int32 (*set_principal)(cc_ccache_t, cc_uint32, const char*);
194 cc_int32 (*store_credentials)(cc_ccache_t, const cc_credentials_union*);
195 cc_int32 (*remove_credentials)(cc_ccache_t, cc_credentials_t);
196 cc_int32 (*new_credentials_iterator)(cc_ccache_t,
197 cc_credentials_iterator_t*);
198 cc_int32 (*move)(cc_ccache_t, cc_ccache_t);
199 cc_int32 (*lock)(cc_ccache_t, cc_uint32, cc_uint32);
200 cc_int32 (*unlock)(cc_ccache_t);
201 cc_int32 (*get_last_default_time)(cc_ccache_t, cc_time_t*);
202 cc_int32 (*get_change_time)(cc_ccache_t, cc_time_t*);
203 cc_int32 (*compare)(cc_ccache_t, cc_ccache_t, cc_uint32*);
204 cc_int32 (*get_kdc_time_offset)(cc_ccache_t, cc_int32, cc_time_t *);
205 cc_int32 (*set_kdc_time_offset)(cc_ccache_t, cc_int32, cc_time_t);
206 cc_int32 (*clear_kdc_time_offset)(cc_ccache_t, cc_int32);
207 } cc_ccache_functions;
209 struct cc_ccache_t {
210 const cc_ccache_functions *func;
213 struct cc_context_functions {
214 cc_int32 (*release)(cc_context_t);
215 cc_int32 (*get_change_time)(cc_context_t, cc_time_t *);
216 cc_int32 (*get_default_ccache_name)(cc_context_t, cc_string_t*);
217 cc_int32 (*open_ccache)(cc_context_t, const char*, cc_ccache_t *);
218 cc_int32 (*open_default_ccache)(cc_context_t, cc_ccache_t*);
219 cc_int32 (*create_ccache)(cc_context_t,const char*, cc_uint32,
220 const char*, cc_ccache_t*);
221 cc_int32 (*create_default_ccache)(cc_context_t, cc_uint32,
222 const char*, cc_ccache_t*);
223 cc_int32 (*create_new_ccache)(cc_context_t, cc_uint32,
224 const char*, cc_ccache_t*);
225 cc_int32 (*new_ccache_iterator)(cc_context_t, cc_ccache_iterator_t*);
226 cc_int32 (*lock)(cc_context_t, cc_uint32, cc_uint32);
227 cc_int32 (*unlock)(cc_context_t);
228 cc_int32 (*compare)(cc_context_t, cc_context_t, cc_uint32*);
231 struct cc_context_t {
232 const struct cc_context_functions* func;
235 typedef cc_int32
236 (*cc_initialize_func)(cc_context_t*, cc_int32, cc_int32 *, char const **);
238 #endif /* KRB5_CCAPI_H */