efec5e4705af07f2c396db8f2d21b1bae130aee9
[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.4  1995-09-27 15:02:43  quinn
8  * Modified function heads & prototypes.
9  *
10  * Revision 1.3  1995/06/02  09:49:15  quinn
11  * Adding access control
12  *
13  * Revision 1.2  1995/06/01  14:34:53  quinn
14  * Work
15  *
16  * Revision 1.1  1995/06/01  11:22:17  quinn
17  * Resource control
18  *
19  *
20  */
21
22 #include <proto.h>
23
24 /* -------------------- Resource 1 ------------------------- */
25
26 int z_Estimate1(ODR o, Z_Estimate1 **p, int opt)
27 {
28     if (!odr_sequence_begin(o, p, sizeof(**p)))
29         return opt && odr_ok(o);
30     return
31         odr_implicit(o, odr_integer, &(*p)->type, ODR_CONTEXT, 1, 0) &&
32         odr_implicit(o, odr_integer, &(*p)->value, ODR_CONTEXT, 2, 0) &&
33         odr_implicit(o, odr_integer, &(*p)->currencyCode, ODR_CONTEXT, 3, 1) &&
34         odr_sequence_end(o);
35 }
36
37 int MDF z_ResourceReport1(ODR o, Z_ResourceReport1 **p, int opt)
38 {
39     if (!odr_sequence_begin(o, p, sizeof(**p)))
40         return opt && odr_ok(o);
41     return
42         odr_implicit_settag(o, ODR_CONTEXT, 1) &&
43         odr_sequence_of(o, z_Estimate1, &(*p)->estimates,
44             &(*p)->num_estimates) &&
45         odr_implicit(o, odr_visiblestring, &(*p)->message, ODR_CONTEXT, 2, 0) &&
46         odr_sequence_end(o);
47 }
48
49 /* -------------------- Resource 2 ------------------------- */
50
51 int z_StringOrNumeric(ODR, Z_StringOrNumeric **, int);
52 int z_IntUnit(ODR, Z_IntUnit **, int);
53
54 int z_Estimate2(ODR o, Z_Estimate2 **p, int opt)
55 {
56     if (!odr_sequence_begin(o, p, sizeof(**p)))
57         return opt && odr_ok(o);
58     return
59         odr_explicit(o, z_StringOrNumeric, &(*p)->type, ODR_CONTEXT, 1, 0) &&
60         odr_implicit(o, z_IntUnit, &(*p)->value, ODR_CONTEXT, 2, 0) &&
61         odr_sequence_end(o);
62 }
63
64 int MDF z_ResourceReport2(ODR o, Z_ResourceReport2 **p, int opt)
65 {
66 if (!odr_sequence_begin(o, p, sizeof(**p)))
67     return opt && odr_ok(o);
68 return
69     odr_implicit_settag(o, ODR_CONTEXT, 1) &&
70     (odr_sequence_of(o, z_Estimate2, &(*p)->estimates,
71         &(*p)->num_estimates) || odr_ok(o)) &&
72     odr_implicit(o, odr_visiblestring, &(*p)->message, ODR_CONTEXT, 2, 1) &&
73     odr_sequence_end(o);
74 }
75
76