Fixed bug in inetd code. The server listened on tcp:@:9999 even
[yaz-moved-to-github.git] / include / prt-grs.h
1 /*
2  * Copyright (c) 1995, Index Data.
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and
5  * its documentation, in whole or in part, for any purpose, is hereby granted,
6  * provided that:
7  *
8  * 1. This copyright and permission notice appear in all copies of the
9  * software and its documentation. Notices of copyright or attribution
10  * which appear at the beginning of any file must remain unchanged.
11  *
12  * 2. The names of Index Data or the individual authors may not be used to
13  * endorse or promote products derived from this software without specific
14  * prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
18  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
19  * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
20  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
21  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
22  * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24  * OF THIS SOFTWARE.
25  *
26  */
27
28 #ifndef PRT_GRS_H
29 #define PRT_GRS_H
30
31 #include <yconfig.h>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 struct Z_GenericRecord;
38 typedef struct Z_GenericRecord Z_GenericRecord;
39
40 typedef struct Z_ElementData
41 {
42     int which;
43 #define Z_ElementData_octets 0
44 #define Z_ElementData_numeric 1
45 #define Z_ElementData_date 2
46 #define Z_ElementData_ext 3
47 #define Z_ElementData_string 4
48 #define Z_ElementData_trueOrFalse 5
49 #define Z_ElementData_oid 6
50 #define Z_ElementData_intUnit 7
51 #define Z_ElementData_elementNotThere 8
52 #define Z_ElementData_elementEmpty 9
53 #define Z_ElementData_noDataRequested 10
54 #define Z_ElementData_diagnostic 11
55 #define Z_ElementData_subtree 12
56     union
57     {
58         Odr_oct *octets;                      
59         int *numeric;                         
60         char *date;             
61         Z_External *ext;                     
62         char *string;                         
63         bool_t *trueOrFalse;                  
64         Odr_oid *oid;                         
65         Z_IntUnit *intUnit;                  
66         Odr_null *elementNotThere;            
67         Odr_null *elementEmpty;               
68         Odr_null *noDataRequested;            
69         Z_External *diagnostic;              
70         Z_GenericRecord *subtree;            
71     } u;
72 } Z_ElementData;
73
74 typedef struct Z_Order
75 {
76     bool_t *ascending;                    
77     int *order;                           
78 } Z_Order;
79
80 typedef struct Z_Usage
81 {
82     int *type;                            
83 #define Z_Usage_redistributable     1
84 #define Z_Usage_restricted          2
85 #define Z_Usage_licensePointer      3
86     char *restriction;                      /* OPTIONAL */
87 } Z_Usage;
88
89 typedef struct Z_HitVector
90 {
91     Z_Term *satisfier;                      /* OPTIONAL */
92     Z_IntUnit *offsetIntoElement;           /* OPTIONAL */
93     Z_IntUnit *length;                      /* OPTIONAL */
94     int *hitRank;                           /* OPTIONAL */
95     Odr_oct *targetToken;                   /* OPTIONAL */
96 } Z_HitVector;
97
98 typedef struct Z_Triple
99 {
100     Odr_oid *variantSetId;                  /* OPTIONAL */
101     int *zclass;
102     int *type;
103     int which;
104 #define Z_Triple_integer 0
105 #define Z_Triple_internationalString 1
106 #define Z_Triple_octetString 2
107 #define Z_Triple_oid 3
108 #define Z_Triple_boolean 4
109 #define Z_Triple_null 5
110 #define Z_Triple_unit 6
111 #define Z_Triple_valueAndUnit 7
112     union
113     {
114         int *integer;
115         char *internationalString;
116         Odr_oct *octetString;
117         Odr_oid *oid;
118         bool_t *boolean;
119         Odr_null *null;
120         Z_Unit *unit;
121         Z_IntUnit *valueAndUnit;
122     } value;
123 } Z_Triple;
124
125 typedef struct Z_Variant
126 {
127     Odr_oid *globalVariantSetId;            /* OPTIONAL */
128     int num_triples;
129     Z_Triple **triples;
130 } Z_Variant;
131
132 typedef struct Z_TagUnit
133 {
134     int *tagType;                           /* OPTIONAL */
135     Z_StringOrNumeric *tagValue;         
136     int *tagOccurrence;                     /* OPTIONAL */
137 } Z_TagUnit;
138
139 typedef struct Z_TagPath
140 {
141     int num_tags;
142     Z_TagUnit **tags;
143 } Z_TagPath;
144
145 typedef struct Z_ElementMetaData
146 {
147     Z_Order *seriesOrder;                   /* OPTIONAL */
148     Z_Usage *usageRight;                    /* OPTIONAL */
149     int num_hits;
150     Z_HitVector **hits;                     /* OPTIONAL */
151     char *displayName;                      /* OPTIONAL */
152     int num_supportedVariants;
153     Z_Variant **supportedVariants;          /* OPTIONAL */
154     char *message;                          /* OPTIONAL */
155     Odr_oct *elementDescriptor;             /* OPTIONAL */
156     Z_TagPath *surrogateFor;                /* OPTIONAL */
157     Z_TagPath *surrogateElement;            /* OPTIONAL */
158     Z_External *other;                      /* OPTIONAL */
159 } Z_ElementMetaData;
160
161 typedef struct Z_TaggedElement
162 {
163     int *tagType;                           /* OPTIONAL */
164     Z_StringOrNumeric *tagValue;         
165     int *tagOccurrence;                     /* OPTIONAL */
166     Z_ElementData *content;              
167     Z_ElementMetaData *metaData;            /* OPTIONAL */
168     Z_Variant *appliedVariant;              /* OPTIONAL */
169 } Z_TaggedElement;
170
171 struct Z_GenericRecord
172 {
173     int num_elements;
174     Z_TaggedElement **elements;
175 };
176
177 YAZ_EXPORT int z_GenericRecord(ODR o, Z_GenericRecord **p, int opt);
178 YAZ_EXPORT int z_Variant(ODR o, Z_Variant **p, int opt);
179
180 #ifdef __cplusplus
181 }
182 #endif
183
184 #endif