YAZ  5.23.1
z-accdes1.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-accdes1.h>
11 
12 int z_DES_RN_Object(ODR o, Z_DES_RN_Object **p, int opt, const char *name)
13 {
14  static Odr_arm arm[] = {
16  (Odr_fun) z_DRNType, "challenge"},
18  (Odr_fun) z_DRNType, "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_DRNType(ODR o, Z_DRNType **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)->userId, ODR_CONTEXT, 1, 1, "userId") &&
38  &(*p)->salt, ODR_CONTEXT, 2, 1, "salt") &&
40  &(*p)->randomNumber, ODR_CONTEXT, 3, 0, "randomNumber") &&
42 }
#define odr_ok(o)
Definition: odr.h:215
ASN.1 Module AccessControlFormat-des-1.
#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
char * name
Definition: initopt.c:18
int z_DRNType(ODR o, Z_DRNType **p, int opt, const char *name)
Definition: z-accdes1.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(* 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
#define Z_DES_RN_Object_response
Definition: z-accdes1.h:32
int opt
Definition: initopt.c:19
#define ODR_IMPLICIT
Definition: odr.h:59
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
int z_DES_RN_Object(ODR o, Z_DES_RN_Object **p, int opt, const char *name)
Definition: z-accdes1.c:12
#define Z_DES_RN_Object_challenge
Definition: z-accdes1.h:31
#define ODR_DECODE
Definition: odr.h:95