09dd749e226cc05934a52e6da4ca470cebdb48a5
[yaz-moved-to-github.git] / z39.50 / z-rrf2.c
1 /* YC 0.2 Tue Feb 29 16:45:07 CET 2000 */
2 /* Module-C: ResourceReport-Format-Resource-2 */
3
4 #include <yaz/z-rrf2.h>
5
6 int z_ResourceReport2 (ODR o, Z_ResourceReport2 **p, int opt, const char *name)
7 {
8         if (!odr_sequence_begin (o, p, sizeof(**p), name))
9                 return opt && odr_ok (o);
10         return
11                 odr_implicit_settag (o, ODR_CONTEXT, 1) &&
12                 (odr_sequence_of(o, (Odr_fun) z_Estimate2, &(*p)->estimates,
13                   &(*p)->num_estimates, "estimates") || odr_ok(o)) &&
14                 odr_implicit_tag (o, z_InternationalString,
15                         &(*p)->message, ODR_CONTEXT, 2, 1, "message") &&
16                 odr_sequence_end (o);
17 }
18
19 int z_Estimate2 (ODR o, Z_Estimate2 **p, int opt, const char *name)
20 {
21         if (!odr_sequence_begin (o, p, sizeof(**p), name))
22                 return opt && odr_ok (o);
23         return
24                 odr_explicit_tag (o, z_StringOrNumeric,
25                         &(*p)->type, ODR_CONTEXT, 1, 0, "type") &&
26                 odr_implicit_tag (o, z_IntUnit,
27                         &(*p)->value, ODR_CONTEXT, 2, 0, "value") &&
28                 odr_sequence_end (o);
29 }