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