From 4226d2a62cc402812baa55266514f53fa332c335 Mon Sep 17 00:00:00 2001 From: John Carr Date: Fri, 21 Aug 1992 02:42:39 +0000 Subject: [PATCH] For mips compiler, allow definition of "NO_NESTED_PROTOTYPES" to suppress prototype function declarations within structure declarations. Change krb5_principal to be a pointer to structure; add accessor macros. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2337 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/krb5/base-defs.h | 45 ++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/src/include/krb5/base-defs.h b/src/include/krb5/base-defs.h index a1f8f3e55..17365df9b 100644 --- a/src/include/krb5/base-defs.h +++ b/src/include/krb5/base-defs.h @@ -97,11 +97,48 @@ typedef char const * krb5_const_pointer; #define OLDDECLARG(type, val) type val; #endif /* STDC or PROTOTYPES */ -typedef krb5_data ** krb5_principal; /* array of strings */ - /* CONVENTION: realm is first elem. */ +#ifdef NO_NESTED_PROTOTYPES +#define NPROTOTYPE(x) () +#else +#define NPROTOTYPE(x) PROTOTYPE(x) +#endif + +typedef struct krb5_principal_data { + krb5_data realm; + krb5_data *data; + krb5_int32 length; + krb5_int32 type; +} krb5_principal_data; + +typedef krb5_principal_data *krb5_principal; /* array of strings */ + +/* + * Per V5 spec on definition of principal types + */ + +/* Name type not known */ +#define KRB5_NT_UNKNOWN 0 +/* Just the name of the principal as in DCE, or for users */ +#define KRB5_NT_PRINCIPAL 1 +/* Service and other unique instance (krbtgt) */ +#define KRB5_NT_SRV_INST 2 +/* Service with host name as instance (telnet, rcommands) */ +#define KRB5_NT_SRV_HST 3 +/* Service with host as remaining components */ +#define KRB5_NT_SRV_XHST 4 +/* Unique ID */ +#define KRB5_NT_UID 5 + /* constant version thereof: */ -typedef krb5_data * const * krb5_const_principal; +typedef const krb5_principal_data *krb5_const_principal; -#define krb5_princ_realm(princ) ((princ)[0]) +#define krb5_princ_realm(princ) (&(princ)->realm) +#define krb5_princ_set_realm(princ,value) ((princ)->realm = *(value)) +#define krb5_princ_set_realm_length(princ,value) (princ)->realm.length = (value) +#define krb5_princ_set_realm_data(princ,value) (princ)->realm.data = (value) +#define krb5_princ_size(princ) (princ)->length +#define krb5_princ_type(princ) (princ)->type +#define krb5_princ_name(princ) (princ)->data +#define krb5_princ_component(princ,i) ((princ)->data + i) #endif /* KRB5_BASE_DEFS__ */ -- 2.26.2