2 * include/krb5/base-defs.h
4 * Copyright 1989,1990 by the Massachusetts Institute of Technology.
7 * Export of this software from the United States of America may
8 * require a specific license from the United States Government.
9 * It is the responsibility of any person or organization contemplating
10 * export to obtain such a license before exporting.
12 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13 * distribute this software and its documentation for any purpose and
14 * without fee is hereby granted, provided that the above copyright
15 * notice appear in all copies and that both that copyright notice and
16 * this permission notice appear in supporting documentation, and that
17 * the name of M.I.T. not be used in advertising or publicity pertaining
18 * to distribution of the software without specific, written prior
19 * permission. M.I.T. makes no representations about the suitability of
20 * this software for any purpose. It is provided "as is" without express
21 * or implied warranty.
24 * Basic definitions for Kerberos V5 library
27 #ifndef KRB5_BASE_DEFS__
28 #define KRB5_BASE_DEFS__
39 typedef unsigned int krb5_boolean;
40 typedef unsigned int krb5_msgtype;
41 typedef unsigned int krb5_kvno;
43 typedef unsigned int krb5_addrtype;
44 typedef unsigned int krb5_keytype;
45 typedef unsigned int krb5_enctype;
46 typedef unsigned int krb5_cksumtype;
47 typedef unsigned int krb5_authdatatype;
49 typedef krb5_int32 krb5_preauthtype; /* This may change, later on */
50 typedef krb5_int32 krb5_flags;
51 typedef krb5_int32 krb5_timestamp;
52 typedef krb5_int32 krb5_error_code;
53 typedef krb5_int32 krb5_deltat;
55 typedef krb5_error_code krb5_magic;
57 typedef struct _krb5_data {
63 /* make const & volatile available without effect */
65 #if !defined(__STDC__) && !defined(HAS_ANSI_CONST) && !defined(_WINDOWS)
68 #if !defined(__STDC__) && !defined(HAS_ANSI_VOLATILE) && !defined(_WINDOWS)
72 #if defined(__STDC__) || defined(HAS_VOID_TYPE) || defined(_WINDOWS)
73 typedef void FAR * krb5_pointer;
74 typedef void const FAR * krb5_const_pointer;
76 typedef char FAR * krb5_pointer;
77 typedef char const FAR * krb5_const_pointer;
80 #if defined(__STDC__) || defined(KRB5_PROVIDE_PROTOTYPES) || defined(_WINDOWS)
81 #define PROTOTYPE(x) x
82 #if defined(__STDC__) || defined(HAVE_STDARG_H) || defined(_WINDOWS)
85 #define STDARG_P(x) ()
86 #endif /* defined(__STDC__) || defined(HAVE_STDARG_H) */
88 #define PROTOTYPE(x) ()
89 #define STDARG_P(x) ()
90 #endif /* STDC or PROTOTYPES */
92 #ifdef NO_NESTED_PROTOTYPES
93 #define NPROTOTYPE(x) ()
95 #define NPROTOTYPE(x) PROTOTYPE(x)
98 typedef struct krb5_principal_data {
101 krb5_data FAR *data; /* An array of strings */
104 } krb5_principal_data;
106 typedef krb5_principal_data FAR * krb5_principal;
109 * Per V5 spec on definition of principal types
112 /* Name type not known */
113 #define KRB5_NT_UNKNOWN 0
114 /* Just the name of the principal as in DCE, or for users */
115 #define KRB5_NT_PRINCIPAL 1
116 /* Service and other unique instance (krbtgt) */
117 #define KRB5_NT_SRV_INST 2
118 /* Service with host name as instance (telnet, rcommands) */
119 #define KRB5_NT_SRV_HST 3
120 /* Service with host as remaining components */
121 #define KRB5_NT_SRV_XHST 4
123 #define KRB5_NT_UID 5
125 /* constant version thereof: */
126 typedef const krb5_principal_data FAR *krb5_const_principal;
128 #define krb5_princ_realm(context, princ) (&(princ)->realm)
129 #define krb5_princ_set_realm(context, princ,value) ((princ)->realm = *(value))
130 #define krb5_princ_set_realm_length(context, princ,value) (princ)->realm.length = (value)
131 #define krb5_princ_set_realm_data(context, princ,value) (princ)->realm.data = (value)
132 #define krb5_princ_size(context, princ) (princ)->length
133 #define krb5_princ_type(context, princ) (princ)->type
134 #define krb5_princ_name(context, princ) (princ)->data
135 #define krb5_princ_component(context, princ,i) ((princ)->data + i)
137 #endif /* KRB5_BASE_DEFS__ */