5b7eb1760a2bdfdcf73fcdafa7fbc059a9653a87
[yaz-moved-to-github.git] / asn / prt-rsc.c
1 /*
2  * Copyright (c) 1995, Index Data.
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: prt-rsc.c,v $
7  * Revision 1.3  1995-06-02 09:49:15  quinn
8  * Adding access control
9  *
10  * Revision 1.2  1995/06/01  14:34:53  quinn
11  * Work
12  *
13  * Revision 1.1  1995/06/01  11:22:17  quinn
14  * Resource control
15  *
16  *
17  */
18
19 #include <proto.h>
20
21 /* -------------------- Resource 1 ------------------------- */
22
23 int z_Estimate1(ODR o, Z_Estimate1 **p, int opt)
24 {
25     if (!odr_sequence_begin(o, p, sizeof(**p)))
26         return opt && odr_ok(o);
27     return
28         odr_implicit(o, odr_integer, &(*p)->type, ODR_CONTEXT, 1, 0) &&
29         odr_implicit(o, odr_integer, &(*p)->value, ODR_CONTEXT, 2, 0) &&
30         odr_implicit(o, odr_integer, &(*p)->currencyCode, ODR_CONTEXT, 3, 1) &&
31         odr_sequence_end(o);
32 }
33
34 int z_ResourceReport1(ODR o, Z_ResourceReport1 **p, int opt)
35 {
36     if (!odr_sequence_begin(o, p, sizeof(**p)))
37         return opt && odr_ok(o);
38     return
39         odr_implicit_settag(o, ODR_CONTEXT, 1) &&
40         odr_sequence_of(o, z_Estimate1, &(*p)->estimates,
41             &(*p)->num_estimates) &&
42         odr_implicit(o, odr_visiblestring, &(*p)->message, ODR_CONTEXT, 2, 0) &&
43         odr_sequence_end(o);
44 }
45
46 /* -------------------- Resource 2 ------------------------- */
47
48 int z_StringOrNumeric(ODR, Z_StringOrNumeric **, int);
49 int z_IntUnit(ODR, Z_IntUnit **, int);
50
51 int z_Estimate2(ODR o, Z_Estimate2 **p, int opt)
52 {
53     if (!odr_sequence_begin(o, p, sizeof(**p)))
54         return opt && odr_ok(o);
55     return
56         odr_explicit(o, z_StringOrNumeric, &(*p)->type, ODR_CONTEXT, 1, 0) &&
57         odr_implicit(o, z_IntUnit, &(*p)->value, ODR_CONTEXT, 2, 0) &&
58         odr_sequence_end(o);
59 }
60
61 int z_ResourceReport2(ODR o, Z_ResourceReport2 **p, int opt)
62 {
63 if (!odr_sequence_begin(o, p, sizeof(**p)))
64     return opt && odr_ok(o);
65 return
66     odr_implicit_settag(o, ODR_CONTEXT, 1) &&
67     (odr_sequence_of(o, z_Estimate2, &(*p)->estimates,
68         &(*p)->num_estimates) || odr_ok(o)) &&
69     odr_implicit(o, odr_visiblestring, &(*p)->message, ODR_CONTEXT, 2, 1) &&
70     odr_sequence_end(o);
71 }
72
73