Danilo also says we can get rid of _MSDOS (Win16) tests, and explicit FAR/NEAR specs
[krb5.git] / src / lib / gssapi / mechglue / mglueP.h
1 /* #ident  "@(#)mglueP.h 1.2     96/01/18 SMI" */
2
3 /*
4  * This header contains the private mechglue definitions.
5  *
6  * Copyright (c) 1995, by Sun Microsystems, Inc.
7  * All rights reserved.
8  */
9
10 #ifndef _GSS_MECHGLUEP_H
11 #define _GSS_MECHGLUEP_H
12
13 #include "mechglue.h"
14
15 /*
16  * Array of context IDs typed by mechanism OID
17  */
18 typedef struct gss_union_ctx_id_t {
19         gss_OID                 mech_type;
20         gss_ctx_id_t            internal_ctx_id;
21 } gss_union_ctx_id_desc, *gss_union_ctx_id_t;
22
23 /*
24  * Generic GSSAPI names.  A name can either be a generic name, or a
25  * mechanism specific name....
26  */
27 typedef struct gss_union_name_t {
28         gss_OID                 name_type;
29         gss_buffer_t            external_name;
30         /*
31          * These last two fields are only filled in for mechanism
32          * names.
33          */
34         gss_OID                 mech_type;
35         gss_name_t              mech_name;
36 } gss_union_name_desc, *gss_union_name_t;
37
38 /*
39  * Structure for holding list of mechanism-specific name types
40  */
41 typedef struct gss_mech_spec_name_t {
42     gss_OID     name_type;
43     gss_OID     mech;
44     struct gss_mech_spec_name_t *next, *prev;
45 } gss_mech_spec_name_desc, *gss_mech_spec_name;
46
47 /*
48  * Credential auxiliary info, used in the credential structure
49  */
50 typedef struct gss_union_cred_auxinfo {
51         gss_buffer_desc         name;
52         gss_OID                 name_type;
53         time_t                  creation_time;
54         OM_uint32               time_rec;
55         int                     cred_usage;
56 } gss_union_cred_auxinfo;
57
58 /*
59  * Set of Credentials typed on mechanism OID
60  */
61 typedef struct gss_union_cred_t {
62         int                     count;
63         gss_OID                 mechs_array;
64         gss_cred_id_t *         cred_array;
65         gss_union_cred_auxinfo  auxinfo;
66 } gss_union_cred_desc, *gss_union_cred_t;
67  
68 /********************************************************/
69 /* The Mechanism Dispatch Table -- a mechanism needs to */
70 /* define one of these and provide a function to return */
71 /* it to initialize the GSSAPI library                  */
72
73 /* ultrix cc doesn't understand prototypes in structures.
74    we could autoconf test for this --marc */
75
76 #ifndef NPROTOTYPE
77 #if defined(__ultrix) && !defined (__GNUC__)
78 #define NPROTOTYPE(x) ()
79 #else
80 #define NPROTOTYPE(x) PROTOTYPE(x)
81 #endif
82 #endif
83
84 /*
85  * This is the definition of the mechs_array struct, which is used to
86  * define the mechs array table. This table is used to indirectly
87  * access mechanism specific versions of the gssapi routines through
88  * the routines in the glue module (gssd_mech_glue.c)
89  *
90  * This contants all of the functions defined in gssapi.h except for
91  * gss_release_buffer() and gss_release_oid_set(), which I am
92  * assuming, for now, to be equal across mechanisms.  
93  */
94  
95 typedef struct gss_config {
96     gss_OID_desc    mech_type;
97     void *          context;
98     OM_uint32       (*gss_acquire_cred)
99         NPROTOTYPE((
100                     void*,              /* context */
101                     OM_uint32*,         /* minor_status */
102                     gss_name_t,         /* desired_name */
103                     OM_uint32,          /* time_req */
104                     gss_OID_set,        /* desired_mechs */
105                     int,                /* cred_usage */
106                     gss_cred_id_t*,     /* output_cred_handle */
107                     gss_OID_set*,       /* actual_mechs */
108                     OM_uint32*          /* time_rec */
109                     ));
110     OM_uint32       (*gss_release_cred)
111         NPROTOTYPE((
112                     void*,              /* context */                  
113                     OM_uint32*,         /* minor_status */
114                     gss_cred_id_t*      /* cred_handle */
115                     ));
116     OM_uint32       (*gss_init_sec_context)
117         NPROTOTYPE((
118                     void*,                      /* context */
119                     OM_uint32*,                 /* minor_status */
120                     gss_cred_id_t,              /* claimant_cred_handle */
121                     gss_ctx_id_t*,              /* context_handle */
122                     gss_name_t,                 /* target_name */
123                     gss_OID,                    /* mech_type */
124                     OM_uint32,                  /* req_flags */
125                     OM_uint32,                  /* time_req */
126                     gss_channel_bindings_t,     /* input_chan_bindings */
127                     gss_buffer_t,               /* input_token */
128                     gss_OID*,                   /* actual_mech_type */
129                     gss_buffer_t,               /* output_token */
130                     OM_uint32*,                 /* ret_flags */
131                     OM_uint32*                  /* time_rec */
132                     ));
133     OM_uint32       (*gss_accept_sec_context)
134         NPROTOTYPE((
135                     void*,                      /* context */
136                     OM_uint32*,                 /* minor_status */
137                     gss_ctx_id_t*,              /* context_handle */
138                     gss_cred_id_t,              /* verifier_cred_handle */
139                     gss_buffer_t,               /* input_token_buffer */
140                     gss_channel_bindings_t,     /* input_chan_bindings */
141                     gss_name_t*,                /* src_name */
142                     gss_OID*,                   /* mech_type */
143                     gss_buffer_t,               /* output_token */
144                     OM_uint32*,                 /* ret_flags */
145                     OM_uint32*,                 /* time_rec */
146                     gss_cred_id_t*              /* delegated_cred_handle */
147                     ));
148     OM_uint32       (*gss_process_context_token)
149         NPROTOTYPE((
150                     void*,              /* context */
151                     OM_uint32*,         /* minor_status */
152                     gss_ctx_id_t,       /* context_handle */
153                     gss_buffer_t        /* token_buffer */
154                     ));
155     OM_uint32       (*gss_delete_sec_context)
156         NPROTOTYPE((
157                     void*,              /* context */
158                     OM_uint32*,         /* minor_status */
159                     gss_ctx_id_t*,      /* context_handle */
160                     gss_buffer_t        /* output_token */
161                     ));
162     OM_uint32       (*gss_context_time)
163         NPROTOTYPE((
164                     void*,              /* context */
165                     OM_uint32*,         /* minor_status */
166                     gss_ctx_id_t,       /* context_handle */
167                     OM_uint32*          /* time_rec */
168                     ));
169     OM_uint32       (*gss_sign)
170         NPROTOTYPE((
171                     void*,              /* context */
172                     OM_uint32*,         /* minor_status */
173                     gss_ctx_id_t,       /* context_handle */
174                     int,                /* qop_req */
175                     gss_buffer_t,       /* message_buffer */
176                     gss_buffer_t        /* message_token */
177                     ));
178     OM_uint32       (*gss_verify)
179         NPROTOTYPE((
180                     void*,              /* context */
181                     OM_uint32*,         /* minor_status */
182                     gss_ctx_id_t,       /* context_handle */
183                     gss_buffer_t,       /* message_buffer */
184                     gss_buffer_t,       /* token_buffer */
185                     int*                /* qop_state */
186                     ));
187     OM_uint32       (*gss_seal)
188         NPROTOTYPE((
189                     void*,              /* context */
190                     OM_uint32*,         /* minor_status */
191                     gss_ctx_id_t,       /* context_handle */
192                     int,                /* conf_req_flag */
193                     int,                /* qop_req */
194                     gss_buffer_t,       /* input_message_buffer */
195                     int*,               /* conf_state */
196                     gss_buffer_t        /* output_message_buffer */
197                     ));
198     OM_uint32       (*gss_unseal)
199         NPROTOTYPE((
200                     void*,              /* context */
201                     OM_uint32*,         /* minor_status */
202                     gss_ctx_id_t,       /* context_handle */
203                     gss_buffer_t,       /* input_message_buffer */
204                     gss_buffer_t,       /* output_message_buffer */
205                     int*,               /* conf_state */
206                     int*                /* qop_state */
207                     ));
208     OM_uint32       (*gss_display_status)
209         NPROTOTYPE((
210                     void*,              /* context */
211                     OM_uint32*,         /* minor_status */
212                     OM_uint32,          /* status_value */
213                     int,                /* status_type */
214                     gss_OID,            /* mech_type */
215                     OM_uint32*,         /* message_context */
216                     gss_buffer_t        /* status_string */
217                     ));
218     OM_uint32       (*gss_indicate_mechs)
219         NPROTOTYPE((
220                     void*,              /* context */
221                     OM_uint32*,         /* minor_status */
222                     gss_OID_set*        /* mech_set */
223                     ));
224     OM_uint32       (*gss_compare_name)
225         NPROTOTYPE((
226                     void*,              /* context */
227                     OM_uint32*,         /* minor_status */
228                     gss_name_t,         /* name1 */
229                     gss_name_t,         /* name2 */
230                     int*                /* name_equal */
231                     ));
232     OM_uint32       (*gss_display_name)
233         NPROTOTYPE((
234                     void*,              /* context */
235                     OM_uint32*,         /* minor_status */
236                     gss_name_t,         /* input_name */
237                     gss_buffer_t,       /* output_name_buffer */
238                     gss_OID*            /* output_name_type */
239                     ));
240     OM_uint32       (*gss_import_name)
241         NPROTOTYPE((
242                     void*,              /* context */
243                     OM_uint32*,         /* minor_status */
244                     gss_buffer_t,       /* input_name_buffer */
245                     gss_OID,            /* input_name_type */
246                     gss_name_t*         /* output_name */
247                     ));
248     OM_uint32       (*gss_release_name)
249         NPROTOTYPE((
250                     void*,              /* context */
251                     OM_uint32*,         /* minor_status */
252                     gss_name_t*         /* input_name */
253                     ));
254     OM_uint32       (*gss_inquire_cred)
255         NPROTOTYPE((
256                     void*,                      /* context */
257                     OM_uint32 *,                /* minor_status */
258                     gss_cred_id_t,              /* cred_handle */
259                     gss_name_t *,               /* name */
260                     OM_uint32 *,                /* lifetime */
261                     int *,                      /* cred_usage */
262                     gss_OID_set *               /* mechanisms */
263                     ));
264     OM_uint32       (*gss_add_cred)
265         NPROTOTYPE((
266                     void*,              /* context */
267                     OM_uint32 *,        /* minor_status */
268                     gss_cred_id_t,      /* input_cred_handle */
269                     gss_name_t,         /* desired_name */
270                     gss_OID,            /* desired_mech */
271                     gss_cred_usage_t,   /* cred_usage */
272                     OM_uint32,          /* initiator_time_req */
273                     OM_uint32,          /* acceptor_time_req */
274                     gss_cred_id_t *,    /* output_cred_handle */
275                     gss_OID_set *,      /* actual_mechs */
276                     OM_uint32 *,        /* initiator_time_rec */
277                     OM_uint32 *         /* acceptor_time_rec */
278                     ));
279     OM_uint32       (*gss_export_sec_context)
280         NPROTOTYPE((
281                     void*,              /* context */
282                     OM_uint32 *,        /* minor_status */
283                     gss_ctx_id_t *,     /* context_handle */
284                     gss_buffer_t        /* interprocess_token */
285                     ));
286     OM_uint32       (*gss_import_sec_context)
287         NPROTOTYPE((
288                     void *,             /* context */
289                     OM_uint32 *,        /* minor_status */
290                     gss_buffer_t,       /* interprocess_token */
291                     gss_ctx_id_t *      /* context_handle */
292                     ));
293     OM_uint32       (*gss_inquire_cred_by_mech)
294         NPROTOTYPE((
295                     void *,             /* context */
296                     OM_uint32 *,        /* minor_status */
297                     gss_cred_id_t,      /* cred_handle */
298                     gss_OID,            /* mech_type */
299                     gss_name_t *,       /* name */
300                     OM_uint32 *,        /* initiator_lifetime */
301                     OM_uint32 *,        /* acceptor_lifetime */
302                     gss_cred_usage_t *  /* cred_usage */
303                     ));
304     OM_uint32       (*gss_inquire_names_for_mech)
305         NPROTOTYPE((
306                     void *,             /* context */
307                     OM_uint32 *,        /* minor_status */
308                     gss_OID,            /* mechanism */
309                     gss_OID_set *       /* name_types */
310                     ));
311     OM_uint32   (*gss_inquire_context)
312         NPROTOTYPE((
313                     void *,             /* context */
314                     OM_uint32 *,        /* minor_status */
315                     gss_ctx_id_t,       /* context_handle */
316                     gss_name_t *,       /* src_name */
317                     gss_name_t *,       /* targ_name */
318                     OM_uint32 *,        /* lifetime_rec */
319                     gss_OID *,          /* mech_type */
320                     OM_uint32 *,        /* ctx_flags */
321                     int *,              /* locally_initiated */
322                     int *               /* open */
323                     ));
324     OM_uint32       (*gss_internal_release_oid)
325         NPROTOTYPE((
326                     void *,             /* context */
327                     OM_uint32 *,        /* minor_status */
328                     gss_OID *           /* OID */
329          ));
330     OM_uint32        (*gss_wrap_size_limit)
331         NPROTOTYPE((
332                     void *,             /* context */
333                     OM_uint32 *,        /* minor_status */
334                     gss_ctx_id_t,       /* context_handle */
335                     int,                /* conf_req_flag */
336                     gss_qop_t,          /* qop_req */
337                     OM_uint32,          /* req_output_size */
338                     OM_uint32 *         /* max_input_size */
339          ));
340     int              (*pname_to_uid)
341         NPROTOTYPE((
342                     void *,             /* context */
343                     char *,             /* pname */
344                     gss_OID,            /* name type */
345                     gss_OID,            /* mech type */
346                     uid_t *             /* uid */
347                     ));
348
349 } *gss_mechanism;
350
351 /********************************************************/
352 /* Internal mechglue routines */
353
354 gss_mechanism __gss_get_mechanism
355 PROTOTYPE((gss_OID));
356 OM_uint32 __gss_get_mech_type
357 PROTOTYPE((gss_OID, gss_buffer_t));
358 OM_uint32 __gss_import_internal_name
359 PROTOTYPE((OM_uint32 *, gss_OID, gss_union_name_t,
360            gss_name_t *));
361 OM_uint32 __gss_display_internal_name
362 PROTOTYPE((OM_uint32 *, gss_OID, gss_name_t,
363            gss_buffer_t, gss_OID *));
364 OM_uint32 __gss_release_internal_name
365 PROTOTYPE((OM_uint32 *, gss_OID, gss_name_t *));
366
367 OM_uint32 __gss_convert_name_to_union_name
368 PROTOTYPE((OM_uint32 *,         /* minor_status */
369            gss_mechanism,       /* mech */
370            gss_name_t,          /* internal_name */
371            gss_name_t *         /* external_name */
372            ));
373 gss_cred_id_t __gss_get_mechanism_cred
374 PROTOTYPE((gss_union_cred_t,    /* union_cred */
375            gss_OID              /* mech_type */
376            ));
377
378 OM_uint32 generic_gss_release_oid
379 PROTOTYPE( (OM_uint32 *,        /* minor_status */
380             gss_OID *           /* oid */
381            ));
382
383 OM_uint32 generic_gss_copy_oid
384 PROTOTYPE( (OM_uint32 *,        /* minor_status */
385             gss_OID,            /* oid */
386             gss_OID *           /* new_oid */
387             ));
388
389 OM_uint32 generic_gss_create_empty_oid_set
390 PROTOTYPE( (OM_uint32 *,        /* minor_status */
391             gss_OID_set *       /* oid_set */
392            ));
393
394 OM_uint32 generic_gss_add_oid_set_member
395 PROTOTYPE( (OM_uint32 *,        /* minor_status */
396             gss_OID,            /* member_oid */
397             gss_OID_set *       /* oid_set */
398            ));
399
400 OM_uint32 generic_gss_test_oid_set_member
401 PROTOTYPE( (OM_uint32 *,        /* minor_status */
402             gss_OID,            /* member */
403             gss_OID_set,        /* set */
404             int *               /* present */
405            ));
406
407 OM_uint32 generic_gss_oid_to_str
408 PROTOTYPE( (OM_uint32 *,        /* minor_status */
409             gss_OID,            /* oid */
410             gss_buffer_t        /* oid_str */
411            ));
412
413 OM_uint32 generic_gss_str_to_oid
414 PROTOTYPE( (OM_uint32 *,        /* minor_status */
415             gss_buffer_t,       /* oid_str */
416             gss_OID *           /* oid */
417            ));
418
419
420 gss_OID gss_find_mechanism_from_name_type
421 PROTOTYPE ( (gss_OID            /* name_type */
422              ));
423
424 OM_uint32 gss_add_mech_name_type
425 PROTOTYPE ( (OM_uint32 *,       /* minor_status */
426              gss_OID,           /* name_type */
427              gss_OID            /* mech */
428              ));
429
430 #endif /* _GSS_MECHGLUEP_H */