YAZ  5.23.1
z-acckrb1.c
Go to the documentation of this file.
1 
6 #if HAVE_CONFIG_H
7 #include <config.h>
8 #endif
9 
10 #include <yaz/z-acckrb1.h>
11 
12 int z_KRBObject(ODR o, Z_KRBObject **p, int opt, const char *name)
13 {
14  static Odr_arm arm[] = {
16  (Odr_fun) z_KRBRequest, "challenge"},
18  (Odr_fun) z_KRBResponse, "response"},
19  {-1, -1, -1, -1, (Odr_fun) 0, 0}
20  };
21  if (!odr_initmember(o, p, sizeof(**p)))
22  return odr_missing(o, opt, name);
23  if (odr_choice(o, arm, &(*p)->u, &(*p)->which, name))
24  return 1;
25  if (o->direction == ODR_DECODE)
26  *p = 0;
27  return odr_missing(o, opt, name);
28 }
29 
30 int z_KRBRequest(ODR o, Z_KRBRequest **p, int opt, const char *name)
31 {
32  if (!odr_sequence_begin(o, p, sizeof(**p), name))
33  return odr_missing(o, opt, name) && odr_ok (o);
34  return
36  &(*p)->service, ODR_CONTEXT, 1, 0, "service") &&
38  &(*p)->instance, ODR_CONTEXT, 2, 1, "instance") &&
40  &(*p)->realm, ODR_CONTEXT, 3, 1, "realm") &&
42 }
43 
44 int z_KRBResponse(ODR o, Z_KRBResponse **p, int opt, const char *name)
45 {
46  if (!odr_sequence_begin(o, p, sizeof(**p), name))
47  return odr_missing(o, opt, name) && odr_ok (o);
48  return
50  &(*p)->userid, ODR_CONTEXT, 1, 1, "userid") &&
52  &(*p)->ticket, ODR_CONTEXT, 2, 0, "ticket") &&
54 }
#define odr_ok(o)
Definition: odr.h:215
int z_KRBObject(ODR o, Z_KRBObject **p, int opt, const char *name)
Definition: z-acckrb1.c:12
#define Z_KRBObject_response
Definition: z-acckrb1.h:36
#define odr_implicit_tag(o, t, p, cl, tg, opt, name)
Definition: odr.h:192
int odr_sequence_begin(ODR o, void *p, int size, const char *name)
Definition: odr_seq.c:15
ASN.1 Module AccessControlFormat-krb-1.
char * name
Definition: initopt.c:18
int z_KRBRequest(ODR o, Z_KRBRequest **p, int opt, const char *name)
Definition: z-acckrb1.c:30
int odr_initmember(ODR o, void *p, int size)
Definition: odr_tag.c:44
int direction
Definition: odr.h:126
int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp, const char *name)
Definition: odr_choice.c:17
int z_KRBResponse(ODR o, Z_KRBResponse **p, int opt, const char *name)
Definition: z-acckrb1.c:44
int(* Odr_fun)(ODR, char **, int, const char *)
Definition: odr.h:135
int which
Definition: odr.h:142
Definition: odr.h:137
int odr_missing(ODR o, int opt, const char *name)
Definition: odr_util.c:82
Definition: odr.h:124
int odr_sequence_end(ODR o)
Definition: odr_seq.c:61
int opt
Definition: initopt.c:19
#define ODR_IMPLICIT
Definition: odr.h:59
int z_InternationalString(ODR o, Z_InternationalString **p, int opt, const char *name)
Definition: z-core.c:1598
int odr_octetstring(ODR o, Odr_oct **p, int opt, const char *name)
Definition: odr_oct.c:19
#define ODR_CONTEXT
Definition: odr.h:67
#define ODR_DECODE
Definition: odr.h:95
#define Z_KRBObject_challenge
Definition: z-acckrb1.h:35