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