source: main/tags/2.36/gsdl/packages/yaz/asn/prt-rsc.c@ 21080

Last change on this file since 21080 was 1343, checked in by johnmcp, 24 years ago

Added the YAZ toolkit source to the packages directory (for z39.50 stuff)

  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/*
2 * Copyright (c) 1995-1999, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
5 *
6 * $Log$
7 * Revision 1.1 2000/08/03 03:09:52 johnmcp
8 * Added the YAZ toolkit source to the packages directory (for z39.50 stuff)
9 *
10 * Revision 1.8 1999/11/30 13:47:11 adam
11 * Improved installation. Moved header files to include/yaz.
12 *
13 * Revision 1.7 1999/04/20 09:56:48 adam
14 * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun).
15 * Modified all encoders/decoders to reflect this change.
16 *
17 * Revision 1.6 1998/02/11 11:53:32 adam
18 * Changed code so that it compiles as C++.
19 *
20 * Revision 1.5 1995/09/29 17:11:55 quinn
21 * Smallish
22 *
23 * Revision 1.4 1995/09/27 15:02:43 quinn
24 * Modified function heads & prototypes.
25 *
26 * Revision 1.3 1995/06/02 09:49:15 quinn
27 * Adding access control
28 *
29 * Revision 1.2 1995/06/01 14:34:53 quinn
30 * Work
31 *
32 * Revision 1.1 1995/06/01 11:22:17 quinn
33 * Resource control
34 *
35 *
36 */
37
38#include <yaz/proto.h>
39
40/* -------------------- Resource 1 ------------------------- */
41
42int z_Estimate1(ODR o, Z_Estimate1 **p, int opt, const char *name)
43{
44 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
45 return opt && odr_ok(o);
46 return
47 odr_implicit(o, odr_integer, &(*p)->type, ODR_CONTEXT, 1, 0) &&
48 odr_implicit(o, odr_integer, &(*p)->value, ODR_CONTEXT, 2, 0) &&
49 odr_implicit(o, odr_integer, &(*p)->currencyCode, ODR_CONTEXT, 3, 1) &&
50 odr_sequence_end(o);
51}
52
53int z_ResourceReport1(ODR o, Z_ResourceReport1 **p, int opt, const char *name)
54{
55 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
56 return opt && odr_ok(o);
57 return
58 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
59 odr_sequence_of(o, (Odr_fun)z_Estimate1, &(*p)->estimates,
60 &(*p)->num_estimates, 0) &&
61 odr_implicit(o, odr_visiblestring, &(*p)->message,
62 ODR_CONTEXT, 2, 0) &&
63 odr_sequence_end(o);
64}
65
66/* -------------------- Resource 2 ------------------------- */
67
68/* int z_StringOrNumeric(ODR, Z_StringOrNumeric **, int); */
69/* int z_IntUnit(ODR, Z_IntUnit **, int); */
70
71int z_Estimate2(ODR o, Z_Estimate2 **p, int opt, const char *name)
72{
73 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
74 return opt && odr_ok(o);
75 return
76 odr_explicit(o, z_StringOrNumeric, &(*p)->type, ODR_CONTEXT, 1, 0) &&
77 odr_implicit(o, z_IntUnit, &(*p)->value, ODR_CONTEXT, 2, 0) &&
78 odr_sequence_end(o);
79}
80
81int z_ResourceReport2(ODR o, Z_ResourceReport2 **p, int opt, const char *name)
82{
83 if (!odr_sequence_begin(o, p, sizeof(**p), 0))
84 return opt && odr_ok(o);
85 return
86 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
87 (odr_sequence_of(o, (Odr_fun)z_Estimate2, &(*p)->estimates,
88 &(*p)->num_estimates, 0) || odr_ok(o)) &&
89 odr_implicit(o, odr_visiblestring, &(*p)->message,
90 ODR_CONTEXT, 2, 1) &&
91 odr_sequence_end(o);
92}
93
94
Note: See TracBrowser for help on using the repository browser.