File: z-acckrb1.c

package info (click to toggle)
yaz 5.27.1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 16,184 kB
  • sloc: xml: 123,414; ansic: 72,530; sh: 5,007; tcl: 2,169; makefile: 1,321; yacc: 382
file content (54 lines) | stat: -rw-r--r-- 1,640 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/** \file z-acckrb1.c
    \brief ASN.1 Module AccessControlFormat-krb-1

    Generated automatically by YAZ ASN.1 Compiler 0.4
*/
#if HAVE_CONFIG_H
#include <config.h>
#endif

#include <yaz/z-acckrb1.h>

int z_KRBObject(ODR o, Z_KRBObject **p, int opt, const char *name)
{
	static Odr_arm arm[] = {
		{ODR_IMPLICIT, ODR_CONTEXT, 1, Z_KRBObject_challenge,
		(Odr_fun) z_KRBRequest, "challenge"},
		{ODR_IMPLICIT, ODR_CONTEXT, 2, Z_KRBObject_response,
		(Odr_fun) z_KRBResponse, "response"},
		{-1, -1, -1, -1, (Odr_fun) 0, 0}
	};
	if (!odr_initmember(o, p, sizeof(**p)))
		return odr_missing(o, opt, name);
	if (odr_choice(o, arm, &(*p)->u, &(*p)->which, name))
		return 1;
	if (o->direction == ODR_DECODE)
		*p = 0;
	return odr_missing(o, opt, name);
}

int z_KRBRequest(ODR o, Z_KRBRequest **p, int opt, const char *name)
{
	if (!odr_sequence_begin(o, p, sizeof(**p), name))
		return odr_missing(o, opt, name) && odr_ok (o);
	return
		odr_implicit_tag(o, z_InternationalString,
			&(*p)->service, ODR_CONTEXT, 1, 0, "service") &&
		odr_implicit_tag(o, z_InternationalString,
			&(*p)->instance, ODR_CONTEXT, 2, 1, "instance") &&
		odr_implicit_tag(o, z_InternationalString,
			&(*p)->realm, ODR_CONTEXT, 3, 1, "realm") &&
		odr_sequence_end(o);
}

int z_KRBResponse(ODR o, Z_KRBResponse **p, int opt, const char *name)
{
	if (!odr_sequence_begin(o, p, sizeof(**p), name))
		return odr_missing(o, opt, name) && odr_ok (o);
	return
		odr_implicit_tag(o, z_InternationalString,
			&(*p)->userid, ODR_CONTEXT, 1, 1, "userid") &&
		odr_implicit_tag(o, odr_octetstring,
			&(*p)->ticket, ODR_CONTEXT, 2, 0, "ticket") &&
		odr_sequence_end(o);
}