windows-kfw-sdk-20060921
[openafs.git] / src / WINNT / kfw / inc / krb5 / gssapi / gssapi.h
1 /*
2  * Copyright 1993 by OpenVision Technologies, Inc.
3  * 
4  * Permission to use, copy, modify, distribute, and sell this software
5  * and its documentation for any purpose is hereby granted without fee,
6  * provided that the above copyright notice appears in all copies and
7  * that both that copyright notice and this permission notice appear in
8  * supporting documentation, and that the name of OpenVision not be used
9  * in advertising or publicity pertaining to distribution of the software
10  * without specific, written prior permission. OpenVision makes no
11  * representations about the suitability of this software for any
12  * purpose.  It is provided "as is" without express or implied warranty.
13  * 
14  * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16  * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
18  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20  * PERFORMANCE OF THIS SOFTWARE.
21  */
22
23 #ifndef _GSSAPI_H_
24 #define _GSSAPI_H_
25
26 /*
27  * Determine platform-dependent configuration.
28  */
29
30 #if defined(__MACH__) && defined(__APPLE__)
31 #       include <TargetConditionals.h>
32 #       if TARGET_RT_MAC_CFM
33 #               error "Use KfM 4.0 SDK headers for CFM compilation."
34 #       endif
35 #endif
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /* __cplusplus */
40
41 #if TARGET_OS_MAC
42 #       pragma options align=mac68k
43 #endif
44
45 #if defined(_MSDOS) || defined(_WIN32)
46 #include <win-mac.h>
47 #endif
48
49 #ifndef KRB5_CALLCONV
50 #define KRB5_CALLCONV
51 #define KRB5_CALLCONV_C
52 #endif
53
54 /*
55  * First, include stddef.h to get size_t defined.
56  */
57 #include <stddef.h>
58
59 /*
60  * POSIX says that sys/types.h is where size_t is defined.
61  */
62 #include <sys/types.h>
63
64 /*
65  * $Id$
66  */
67
68 /*
69  * First, define the three platform-dependent pointer types.
70  */
71
72 typedef void * gss_name_t;
73 typedef void * gss_cred_id_t;
74 typedef void * gss_ctx_id_t;
75
76 /*
77  * The following type must be defined as the smallest natural unsigned integer
78  * supported by the platform that has at least 32 bits of precision.
79  */
80 typedef uint32_t gss_uint32;
81 typedef int32_t gss_int32;
82
83 #ifdef  OM_STRING
84 /*
85  * We have included the xom.h header file.  Use the definition for
86  * OM_object identifier.
87  */
88 typedef OM_object_identifier    gss_OID_desc, *gss_OID;
89 #else   /* OM_STRING */
90 /*
91  * We can't use X/Open definitions, so roll our own.
92  */
93 typedef gss_uint32      OM_uint32;
94
95 typedef struct gss_OID_desc_struct {
96       OM_uint32 length;
97       void *elements;
98 } gss_OID_desc, *gss_OID;
99 #endif  /* OM_STRING */
100
101 typedef struct gss_OID_set_desc_struct  {
102       size_t  count;
103       gss_OID elements;
104 } gss_OID_set_desc, *gss_OID_set;
105
106 typedef struct gss_buffer_desc_struct {
107       size_t length;
108       void *value;
109 } gss_buffer_desc, *gss_buffer_t;
110
111 typedef struct gss_channel_bindings_struct {
112       OM_uint32 initiator_addrtype;
113       gss_buffer_desc initiator_address;
114       OM_uint32 acceptor_addrtype;
115       gss_buffer_desc acceptor_address;
116       gss_buffer_desc application_data;
117 } *gss_channel_bindings_t;
118
119 /*
120  * For now, define a QOP-type as an OM_uint32 (pending resolution of ongoing
121  * discussions).
122  */
123 typedef OM_uint32       gss_qop_t;
124 typedef int             gss_cred_usage_t;
125
126 /*
127  * Flag bits for context-level services.
128  */
129 #define GSS_C_DELEG_FLAG 1
130 #define GSS_C_MUTUAL_FLAG 2
131 #define GSS_C_REPLAY_FLAG 4
132 #define GSS_C_SEQUENCE_FLAG 8
133 #define GSS_C_CONF_FLAG 16
134 #define GSS_C_INTEG_FLAG 32
135 #define GSS_C_ANON_FLAG 64
136 #define GSS_C_PROT_READY_FLAG 128
137 #define GSS_C_TRANS_FLAG 256
138
139 /*
140  * Credential usage options
141  */
142 #define GSS_C_BOTH 0
143 #define GSS_C_INITIATE 1
144 #define GSS_C_ACCEPT 2
145
146 /*
147  * Status code types for gss_display_status
148  */
149 #define GSS_C_GSS_CODE 1
150 #define GSS_C_MECH_CODE 2
151
152 /*
153  * The constant definitions for channel-bindings address families
154  */
155 #define GSS_C_AF_UNSPEC     0
156 #define GSS_C_AF_LOCAL      1
157 #define GSS_C_AF_INET       2
158 #define GSS_C_AF_IMPLINK    3
159 #define GSS_C_AF_PUP        4
160 #define GSS_C_AF_CHAOS      5
161 #define GSS_C_AF_NS         6
162 #define GSS_C_AF_NBS        7
163 #define GSS_C_AF_ECMA       8
164 #define GSS_C_AF_DATAKIT    9
165 #define GSS_C_AF_CCITT      10
166 #define GSS_C_AF_SNA        11
167 #define GSS_C_AF_DECnet     12
168 #define GSS_C_AF_DLI        13
169 #define GSS_C_AF_LAT        14
170 #define GSS_C_AF_HYLINK     15
171 #define GSS_C_AF_APPLETALK  16
172 #define GSS_C_AF_BSC        17
173 #define GSS_C_AF_DSS        18
174 #define GSS_C_AF_OSI        19
175 #define GSS_C_AF_X25        21
176
177 #define GSS_C_AF_NULLADDR   255
178
179 /*
180  * Various Null values.
181  */
182 #define GSS_C_NO_NAME ((gss_name_t) 0)
183 #define GSS_C_NO_BUFFER ((gss_buffer_t) 0)
184 #define GSS_C_NO_OID ((gss_OID) 0)
185 #define GSS_C_NO_OID_SET ((gss_OID_set) 0)
186 #define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0)
187 #define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0)
188 #define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0)
189 #define GSS_C_EMPTY_BUFFER {0, NULL}
190
191 /*
192  * Some alternate names for a couple of the above values.  These are defined
193  * for V1 compatibility.
194  */
195 #define GSS_C_NULL_OID          GSS_C_NO_OID
196 #define GSS_C_NULL_OID_SET      GSS_C_NO_OID_SET
197
198 /*
199  * Define the default Quality of Protection for per-message services.  Note
200  * that an implementation that offers multiple levels of QOP may either reserve
201  * a value (for example zero, as assumed here) to mean "default protection", or
202  * alternatively may simply equate GSS_C_QOP_DEFAULT to a specific explicit
203  * QOP value.  However a value of 0 should always be interpreted by a GSSAPI
204  * implementation as a request for the default protection level.
205  */
206 #define GSS_C_QOP_DEFAULT 0
207
208 /*
209  * Expiration time of 2^32-1 seconds means infinite lifetime for a
210  * credential or security context
211  */
212 #define GSS_C_INDEFINITE ((OM_uint32) 0xfffffffful)
213
214
215 /* Major status codes */
216
217 #define GSS_S_COMPLETE 0
218
219 /*
220  * Some "helper" definitions to make the status code macros obvious.
221  */
222 #define GSS_C_CALLING_ERROR_OFFSET 24
223 #define GSS_C_ROUTINE_ERROR_OFFSET 16
224 #define GSS_C_SUPPLEMENTARY_OFFSET 0
225 #define GSS_C_CALLING_ERROR_MASK ((OM_uint32) 0377ul)
226 #define GSS_C_ROUTINE_ERROR_MASK ((OM_uint32) 0377ul)
227 #define GSS_C_SUPPLEMENTARY_MASK ((OM_uint32) 0177777ul)
228
229 /*
230  * The macros that test status codes for error conditions.  Note that the
231  * GSS_ERROR() macro has changed slightly from the V1 GSSAPI so that it now
232  * evaluates its argument only once.
233  */
234 #define GSS_CALLING_ERROR(x) \
235   ((x) & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))
236 #define GSS_ROUTINE_ERROR(x) \
237   ((x) & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))
238 #define GSS_SUPPLEMENTARY_INFO(x) \
239   ((x) & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))
240 #define GSS_ERROR(x) \
241   ((x) & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \
242           (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)))
243
244 /*
245  * Now the actual status code definitions
246  */
247
248 /*
249  * Calling errors:
250  */
251 #define GSS_S_CALL_INACCESSIBLE_READ \
252                              (((OM_uint32) 1ul) << GSS_C_CALLING_ERROR_OFFSET)
253 #define GSS_S_CALL_INACCESSIBLE_WRITE \
254                              (((OM_uint32) 2ul) << GSS_C_CALLING_ERROR_OFFSET)
255 #define GSS_S_CALL_BAD_STRUCTURE \
256                              (((OM_uint32) 3ul) << GSS_C_CALLING_ERROR_OFFSET)
257
258 /*
259  * Routine errors:
260  */
261 #define GSS_S_BAD_MECH (((OM_uint32) 1ul) << GSS_C_ROUTINE_ERROR_OFFSET)
262 #define GSS_S_BAD_NAME (((OM_uint32) 2ul) << GSS_C_ROUTINE_ERROR_OFFSET)
263 #define GSS_S_BAD_NAMETYPE (((OM_uint32) 3ul) << GSS_C_ROUTINE_ERROR_OFFSET)
264 #define GSS_S_BAD_BINDINGS (((OM_uint32) 4ul) << GSS_C_ROUTINE_ERROR_OFFSET)
265 #define GSS_S_BAD_STATUS (((OM_uint32) 5ul) << GSS_C_ROUTINE_ERROR_OFFSET)
266 #define GSS_S_BAD_SIG (((OM_uint32) 6ul) << GSS_C_ROUTINE_ERROR_OFFSET)
267 #define GSS_S_NO_CRED (((OM_uint32) 7ul) << GSS_C_ROUTINE_ERROR_OFFSET)
268 #define GSS_S_NO_CONTEXT (((OM_uint32) 8ul) << GSS_C_ROUTINE_ERROR_OFFSET)
269 #define GSS_S_DEFECTIVE_TOKEN (((OM_uint32) 9ul) << GSS_C_ROUTINE_ERROR_OFFSET)
270 #define GSS_S_DEFECTIVE_CREDENTIAL \
271      (((OM_uint32) 10ul) << GSS_C_ROUTINE_ERROR_OFFSET)
272 #define GSS_S_CREDENTIALS_EXPIRED \
273      (((OM_uint32) 11ul) << GSS_C_ROUTINE_ERROR_OFFSET)
274 #define GSS_S_CONTEXT_EXPIRED \
275      (((OM_uint32) 12ul) << GSS_C_ROUTINE_ERROR_OFFSET)
276 #define GSS_S_FAILURE (((OM_uint32) 13ul) << GSS_C_ROUTINE_ERROR_OFFSET)
277 #define GSS_S_BAD_QOP (((OM_uint32) 14ul) << GSS_C_ROUTINE_ERROR_OFFSET)
278 #define GSS_S_UNAUTHORIZED (((OM_uint32) 15ul) << GSS_C_ROUTINE_ERROR_OFFSET)
279 #define GSS_S_UNAVAILABLE (((OM_uint32) 16ul) << GSS_C_ROUTINE_ERROR_OFFSET)
280 #define GSS_S_DUPLICATE_ELEMENT \
281      (((OM_uint32) 17ul) << GSS_C_ROUTINE_ERROR_OFFSET)
282 #define GSS_S_NAME_NOT_MN \
283      (((OM_uint32) 18ul) << GSS_C_ROUTINE_ERROR_OFFSET)
284
285 /*
286  * Supplementary info bits:
287  */
288 #define GSS_S_CONTINUE_NEEDED (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 0))
289 #define GSS_S_DUPLICATE_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 1))
290 #define GSS_S_OLD_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 2))
291 #define GSS_S_UNSEQ_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 3))
292 #define GSS_S_GAP_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 4))
293
294
295 /*
296  * Finally, function prototypes for the GSSAPI routines.
297  */
298
299 #if defined (_WIN32) && defined (_MSC_VER)
300 # ifdef GSS_DLL_FILE
301 #  define GSS_DLLIMP __declspec(dllexport)
302 # else
303 #  define GSS_DLLIMP __declspec(dllimport)
304 # endif
305 #else
306 # define GSS_DLLIMP
307 #endif
308
309 /* Reserved static storage for GSS_oids.  Comments are quotes from RFC 2744.
310  *
311  * The implementation must reserve static storage for a
312  * gss_OID_desc object containing the value
313  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01"},
314  * corresponding to an object-identifier value of
315  * {iso(1) member-body(2) United States(840) mit(113554)
316  * infosys(1) gssapi(2) generic(1) user_name(1)}.  The constant
317  * GSS_C_NT_USER_NAME should be initialized to point
318  * to that gss_OID_desc.
319  */
320 GSS_DLLIMP extern gss_OID GSS_C_NT_USER_NAME;
321
322 /*
323  * The implementation must reserve static storage for a
324  * gss_OID_desc object containing the value
325  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02"},
326  * corresponding to an object-identifier value of
327  * {iso(1) member-body(2) United States(840) mit(113554)
328  * infosys(1) gssapi(2) generic(1) machine_uid_name(2)}.
329  * The constant GSS_C_NT_MACHINE_UID_NAME should be
330  * initialized to point to that gss_OID_desc.
331  */
332 GSS_DLLIMP extern gss_OID GSS_C_NT_MACHINE_UID_NAME;
333
334 /*
335  * The implementation must reserve static storage for a
336  * gss_OID_desc object containing the value
337  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03"},
338  * corresponding to an object-identifier value of
339  * {iso(1) member-body(2) United States(840) mit(113554)
340  * infosys(1) gssapi(2) generic(1) string_uid_name(3)}.
341  * The constant GSS_C_NT_STRING_UID_NAME should be
342  * initialized to point to that gss_OID_desc.
343  */
344 GSS_DLLIMP extern gss_OID GSS_C_NT_STRING_UID_NAME;
345
346 /*
347  * The implementation must reserve static storage for a
348  * gss_OID_desc object containing the value
349  * {6, (void *)"\x2b\x06\x01\x05\x06\x02"},
350  * corresponding to an object-identifier value of
351  * {iso(1) org(3) dod(6) internet(1) security(5)
352  * nametypes(6) gss-host-based-services(2)).  The constant
353  * GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point
354  * to that gss_OID_desc.  This is a deprecated OID value, and
355  * implementations wishing to support hostbased-service names
356  * should instead use the GSS_C_NT_HOSTBASED_SERVICE OID,
357  * defined below, to identify such names;
358  * GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym
359  * for GSS_C_NT_HOSTBASED_SERVICE when presented as an input
360  * parameter, but should not be emitted by GSS-API
361  * implementations
362  */
363 GSS_DLLIMP extern gss_OID GSS_C_NT_HOSTBASED_SERVICE_X;
364
365 /*
366  * The implementation must reserve static storage for a
367  * gss_OID_desc object containing the value
368  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
369  *              "\x01\x02\x01\x04"}, corresponding to an
370  * object-identifier value of {iso(1) member-body(2)
371  * Unites States(840) mit(113554) infosys(1) gssapi(2)
372  * generic(1) service_name(4)}.  The constant
373  * GSS_C_NT_HOSTBASED_SERVICE should be initialized
374  * to point to that gss_OID_desc.
375  */
376 GSS_DLLIMP extern gss_OID GSS_C_NT_HOSTBASED_SERVICE;
377
378 /*
379  * The implementation must reserve static storage for a
380  * gss_OID_desc object containing the value
381  * {6, (void *)"\x2b\x06\01\x05\x06\x03"},
382  * corresponding to an object identifier value of
383  * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
384  * 6(nametypes), 3(gss-anonymous-name)}.  The constant
385  * and GSS_C_NT_ANONYMOUS should be initialized to point
386  * to that gss_OID_desc.
387  */
388 GSS_DLLIMP extern gss_OID GSS_C_NT_ANONYMOUS;
389
390
391 /*
392  * The implementation must reserve static storage for a
393  * gss_OID_desc object containing the value
394  * {6, (void *)"\x2b\x06\x01\x05\x06\x04"},
395  * corresponding to an object-identifier value of
396  * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
397  * 6(nametypes), 4(gss-api-exported-name)}.  The constant
398  * GSS_C_NT_EXPORT_NAME should be initialized to point
399  * to that gss_OID_desc.
400  */
401 GSS_DLLIMP extern gss_OID GSS_C_NT_EXPORT_NAME;
402
403 /* Function Prototypes */
404
405 OM_uint32 KRB5_CALLCONV gss_acquire_cred
406 (OM_uint32 *,           /* minor_status */
407             gss_name_t,                 /* desired_name */
408             OM_uint32,                  /* time_req */
409             gss_OID_set,                /* desired_mechs */
410             gss_cred_usage_t,           /* cred_usage */
411             gss_cred_id_t *,    /* output_cred_handle */
412             gss_OID_set *,              /* actual_mechs */
413             OM_uint32 *         /* time_rec */
414            );
415
416 OM_uint32 KRB5_CALLCONV gss_release_cred
417 (OM_uint32 *,           /* minor_status */
418             gss_cred_id_t *             /* cred_handle */
419            );
420
421 OM_uint32 KRB5_CALLCONV gss_init_sec_context
422 (OM_uint32 *,           /* minor_status */
423             gss_cred_id_t,              /* claimant_cred_handle */
424             gss_ctx_id_t *,             /* context_handle */
425             gss_name_t,                 /* target_name */
426             gss_OID,                    /* mech_type (used to be const) */
427             OM_uint32,                  /* req_flags */
428             OM_uint32,                  /* time_req */
429             gss_channel_bindings_t,     /* input_chan_bindings */
430             gss_buffer_t,               /* input_token */
431             gss_OID *,          /* actual_mech_type */
432             gss_buffer_t,               /* output_token */
433             OM_uint32 *,                /* ret_flags */
434             OM_uint32 *         /* time_rec */
435            );
436
437 OM_uint32 KRB5_CALLCONV gss_accept_sec_context
438 (OM_uint32 *,           /* minor_status */
439             gss_ctx_id_t *,             /* context_handle */
440             gss_cred_id_t,              /* acceptor_cred_handle */
441             gss_buffer_t,               /* input_token_buffer */
442             gss_channel_bindings_t,     /* input_chan_bindings */
443             gss_name_t *,               /* src_name */
444             gss_OID *,          /* mech_type */
445             gss_buffer_t,               /* output_token */
446             OM_uint32 *,                /* ret_flags */
447             OM_uint32 *,                /* time_rec */
448             gss_cred_id_t *             /* delegated_cred_handle */
449            );
450
451 OM_uint32 KRB5_CALLCONV gss_process_context_token
452 (OM_uint32 *,           /* minor_status */
453             gss_ctx_id_t,               /* context_handle */
454             gss_buffer_t                /* token_buffer */
455            );
456
457 OM_uint32 KRB5_CALLCONV gss_delete_sec_context
458 (OM_uint32 *,           /* minor_status */
459             gss_ctx_id_t *,             /* context_handle */
460             gss_buffer_t                /* output_token */
461            );
462
463 OM_uint32 KRB5_CALLCONV gss_context_time
464 (OM_uint32 *,           /* minor_status */
465             gss_ctx_id_t,               /* context_handle */
466             OM_uint32 *         /* time_rec */
467            );
468
469 /* New for V2 */
470 OM_uint32 KRB5_CALLCONV gss_get_mic
471 (OM_uint32 *,           /* minor_status */
472             gss_ctx_id_t,               /* context_handle */
473             gss_qop_t,                  /* qop_req */
474             gss_buffer_t,               /* message_buffer */
475             gss_buffer_t                /* message_token */
476            );
477
478 /* New for V2 */
479 OM_uint32 KRB5_CALLCONV gss_verify_mic
480 (OM_uint32 *,           /* minor_status */
481             gss_ctx_id_t,               /* context_handle */
482             gss_buffer_t,               /* message_buffer */
483             gss_buffer_t,               /* message_token */
484             gss_qop_t *                 /* qop_state */
485            );
486
487 /* New for V2 */
488 OM_uint32 KRB5_CALLCONV gss_wrap
489 (OM_uint32 *,           /* minor_status */
490             gss_ctx_id_t,               /* context_handle */
491             int,                        /* conf_req_flag */
492             gss_qop_t,                  /* qop_req */
493             gss_buffer_t,               /* input_message_buffer */
494             int *,                      /* conf_state */
495             gss_buffer_t                /* output_message_buffer */
496            );
497
498 /* New for V2 */
499 OM_uint32 KRB5_CALLCONV gss_unwrap
500 (OM_uint32 *,           /* minor_status */
501             gss_ctx_id_t,               /* context_handle */
502             gss_buffer_t,               /* input_message_buffer */
503             gss_buffer_t,               /* output_message_buffer */
504             int *,                      /* conf_state */
505             gss_qop_t *         /* qop_state */
506            );
507
508 OM_uint32 KRB5_CALLCONV gss_display_status
509 (OM_uint32 *,           /* minor_status */
510             OM_uint32,                  /* status_value */
511             int,                        /* status_type */
512             gss_OID,                    /* mech_type (used to be const) */
513             OM_uint32 *,                /* message_context */
514             gss_buffer_t                /* status_string */
515            );
516
517 OM_uint32 KRB5_CALLCONV gss_indicate_mechs
518 (OM_uint32 *,           /* minor_status */
519             gss_OID_set *               /* mech_set */
520            );
521
522 OM_uint32 KRB5_CALLCONV gss_compare_name
523 (OM_uint32 *,           /* minor_status */
524             gss_name_t,                 /* name1 */
525             gss_name_t,                 /* name2 */
526             int *                       /* name_equal */
527            );
528
529 OM_uint32 KRB5_CALLCONV gss_display_name
530 (OM_uint32 *,           /* minor_status */
531             gss_name_t,                 /* input_name */
532             gss_buffer_t,               /* output_name_buffer */
533             gss_OID *           /* output_name_type */
534            );
535
536 OM_uint32 KRB5_CALLCONV gss_import_name
537 (OM_uint32 *,           /* minor_status */
538             gss_buffer_t,               /* input_name_buffer */
539             gss_OID,                    /* input_name_type(used to be const) */
540             gss_name_t *                /* output_name */
541            );
542
543 OM_uint32 KRB5_CALLCONV gss_release_name
544 (OM_uint32 *,           /* minor_status */
545             gss_name_t *                /* input_name */
546            );
547
548 OM_uint32 KRB5_CALLCONV gss_release_buffer
549 (OM_uint32 *,           /* minor_status */
550             gss_buffer_t                /* buffer */
551            );
552
553 OM_uint32 KRB5_CALLCONV gss_release_oid_set
554 (OM_uint32 *,           /* minor_status */
555             gss_OID_set *               /* set */
556            );
557
558 OM_uint32 KRB5_CALLCONV gss_inquire_cred
559 (OM_uint32 *,           /* minor_status */
560             gss_cred_id_t,              /* cred_handle */
561             gss_name_t *,               /* name */
562             OM_uint32 *,                /* lifetime */
563             gss_cred_usage_t *, /* cred_usage */
564             gss_OID_set *               /* mechanisms */
565            );
566
567 /* Last argument new for V2 */
568 OM_uint32 KRB5_CALLCONV gss_inquire_context
569 (OM_uint32 *,           /* minor_status */
570             gss_ctx_id_t,               /* context_handle */
571             gss_name_t *,               /* src_name */
572             gss_name_t *,               /* targ_name */
573             OM_uint32 *,                /* lifetime_rec */
574             gss_OID *,          /* mech_type */
575             OM_uint32 *,                /* ctx_flags */
576             int *,              /* locally_initiated */
577             int *                       /* open */
578            );
579
580 /* New for V2 */
581 OM_uint32 KRB5_CALLCONV gss_wrap_size_limit
582 (OM_uint32 *,           /* minor_status */
583             gss_ctx_id_t,               /* context_handle */
584             int,                        /* conf_req_flag */
585             gss_qop_t,                  /* qop_req */
586             OM_uint32,                  /* req_output_size */
587             OM_uint32 *                 /* max_input_size */
588            );
589
590 /* New for V2 */
591 OM_uint32 KRB5_CALLCONV gss_import_name_object
592 (OM_uint32 *,           /* minor_status */
593             void *,                     /* input_name */
594             gss_OID,                    /* input_name_type */
595             gss_name_t *                /* output_name */
596            );
597
598 /* New for V2 */
599 OM_uint32 KRB5_CALLCONV gss_export_name_object
600 (OM_uint32 *,           /* minor_status */
601             gss_name_t,                 /* input_name */
602             gss_OID,                    /* desired_name_type */
603             void **             /* output_name */
604            );
605
606 /* New for V2 */
607 OM_uint32 KRB5_CALLCONV gss_add_cred
608 (OM_uint32 *,           /* minor_status */
609             gss_cred_id_t,              /* input_cred_handle */
610             gss_name_t,                 /* desired_name */
611             gss_OID,                    /* desired_mech */
612             gss_cred_usage_t,           /* cred_usage */
613             OM_uint32,                  /* initiator_time_req */
614             OM_uint32,                  /* acceptor_time_req */
615             gss_cred_id_t *,    /* output_cred_handle */
616             gss_OID_set *,              /* actual_mechs */
617             OM_uint32 *,                /* initiator_time_rec */
618             OM_uint32 *         /* acceptor_time_rec */
619            );
620
621 /* New for V2 */
622 OM_uint32 KRB5_CALLCONV gss_inquire_cred_by_mech
623 (OM_uint32 *,           /* minor_status */
624             gss_cred_id_t,              /* cred_handle */
625             gss_OID,                    /* mech_type */
626             gss_name_t *,               /* name */
627             OM_uint32 *,                /* initiator_lifetime */
628             OM_uint32 *,                /* acceptor_lifetime */
629             gss_cred_usage_t *  /* cred_usage */
630            );
631
632 /* New for V2 */
633 OM_uint32 KRB5_CALLCONV gss_export_sec_context
634 (OM_uint32 *,           /* minor_status */
635             gss_ctx_id_t *,             /* context_handle */
636             gss_buffer_t                /* interprocess_token */
637             );
638
639 /* New for V2 */
640 OM_uint32 KRB5_CALLCONV gss_import_sec_context
641 (OM_uint32 *,           /* minor_status */
642             gss_buffer_t,               /* interprocess_token */
643             gss_ctx_id_t *              /* context_handle */
644             );
645
646 /* New for V2 */
647 OM_uint32 KRB5_CALLCONV gss_release_oid
648 (OM_uint32 *,           /* minor_status */
649             gss_OID *           /* oid */
650            );
651
652 /* New for V2 */
653 OM_uint32 KRB5_CALLCONV gss_create_empty_oid_set
654 (OM_uint32 *,           /* minor_status */
655             gss_OID_set *               /* oid_set */
656            );
657
658 /* New for V2 */
659 OM_uint32 KRB5_CALLCONV gss_add_oid_set_member
660 (OM_uint32 *,           /* minor_status */
661             gss_OID,                    /* member_oid */
662             gss_OID_set *               /* oid_set */
663            );
664
665 /* New for V2 */
666 OM_uint32 KRB5_CALLCONV gss_test_oid_set_member
667 (OM_uint32 *,           /* minor_status */
668             gss_OID,                    /* member */
669             gss_OID_set,                /* set */
670             int *                       /* present */
671            );
672
673 /* New for V2 */
674 OM_uint32 KRB5_CALLCONV gss_str_to_oid
675 (OM_uint32 *,           /* minor_status */
676             gss_buffer_t,               /* oid_str */
677             gss_OID *           /* oid */
678            );
679
680 /* New for V2 */
681 OM_uint32 KRB5_CALLCONV gss_oid_to_str
682 (OM_uint32 *,           /* minor_status */
683             gss_OID,                    /* oid */
684             gss_buffer_t                /* oid_str */
685            );
686
687 /* New for V2 */
688 OM_uint32 KRB5_CALLCONV gss_inquire_names_for_mech
689 (OM_uint32 *,           /* minor_status */
690             gss_OID,                    /* mechanism */
691             gss_OID_set *               /* name_types */
692            );
693
694 /* New for V2 */
695 OM_uint32 KRB5_CALLCONV gss_inquire_mechs_for_name(
696     OM_uint32 *,                /* minor_status */
697     const gss_name_t,           /* input_name */
698     gss_OID_set *               /* mech_types */
699 );
700
701 /*
702  * The following routines are obsolete variants of gss_get_mic, gss_wrap,
703  * gss_verify_mic and gss_unwrap.  They should be provided by GSSAPI V2
704  * implementations for backwards compatibility with V1 applications.  Distinct
705  * entrypoints (as opposed to #defines) should be provided, to allow GSSAPI
706  * V1 applications to link against GSSAPI V2 implementations.
707  */
708 OM_uint32 KRB5_CALLCONV gss_sign
709 (OM_uint32 *,    /* minor_status */
710             gss_ctx_id_t,       /* context_handle */
711             int,                /* qop_req */
712             gss_buffer_t,       /* message_buffer */
713             gss_buffer_t        /* message_token */
714            );
715
716 OM_uint32 KRB5_CALLCONV gss_verify
717 (OM_uint32 *,    /* minor_status */
718             gss_ctx_id_t,       /* context_handle */
719             gss_buffer_t,       /* message_buffer */
720             gss_buffer_t,       /* token_buffer */
721             int *           /* qop_state */
722            );
723
724 OM_uint32 KRB5_CALLCONV gss_seal
725 (OM_uint32 *,    /* minor_status */
726             gss_ctx_id_t,       /* context_handle */
727             int,                /* conf_req_flag */
728             int,                /* qop_req */
729             gss_buffer_t,       /* input_message_buffer */
730             int *,          /* conf_state */
731             gss_buffer_t        /* output_message_buffer */
732            );
733
734 OM_uint32 KRB5_CALLCONV gss_unseal
735 (OM_uint32 *,    /* minor_status */
736             gss_ctx_id_t,       /* context_handle */
737             gss_buffer_t,       /* input_message_buffer */
738             gss_buffer_t,       /* output_message_buffer */
739             int *,          /* conf_state */
740             int *           /* qop_state */
741            );
742
743 /* New for V2 */
744 OM_uint32 KRB5_CALLCONV gss_export_name
745 (OM_uint32  *,          /* minor_status */
746                  const gss_name_t,      /* input_name */
747                  gss_buffer_t           /* exported_name */
748         );
749
750 /* New for V2 */
751 OM_uint32 KRB5_CALLCONV gss_duplicate_name
752 (OM_uint32  *,          /* minor_status */
753                  const gss_name_t,      /* input_name */
754                  gss_name_t *           /* dest_name */
755         );
756
757 /* New for V2 */
758 OM_uint32 KRB5_CALLCONV gss_canonicalize_name
759 (OM_uint32  *,          /* minor_status */
760                  const gss_name_t,      /* input_name */
761                  const gss_OID,         /* mech_type */
762                  gss_name_t *           /* output_name */
763         );
764
765 #if TARGET_OS_MAC
766 #  pragma options align=reset
767 #endif
768
769 #ifdef __cplusplus
770 }
771 #endif
772
773 /* XXXX these are not part of the GSSAPI C bindings!  (but should be) */
774
775 #define GSS_CALLING_ERROR_FIELD(x) \
776    (((x) >> GSS_C_CALLING_ERROR_OFFSET) & GSS_C_CALLING_ERROR_MASK)
777 #define GSS_ROUTINE_ERROR_FIELD(x) \
778    (((x) >> GSS_C_ROUTINE_ERROR_OFFSET) & GSS_C_ROUTINE_ERROR_MASK)
779 #define GSS_SUPPLEMENTARY_INFO_FIELD(x) \
780    (((x) >> GSS_C_SUPPLEMENTARY_OFFSET) & GSS_C_SUPPLEMENTARY_MASK)
781
782 /* XXXX This is a necessary evil until the spec is fixed */
783 #define GSS_S_CRED_UNAVAIL GSS_S_FAILURE
784
785 #endif /* _GSSAPI_H_ */