Implemented support for dynamic object identifiers.
[yaz-moved-to-github.git] / include / oid.h
1 /*
2  * Copyright (c) 1995-1998, 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 name 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  * $Log: oid.h,v $
27  * Revision 1.28  1998-10-13 16:01:52  adam
28  * Implemented support for dynamic object identifiers.
29  * Function oid_getvalbyname now accepts raw OID's as well as traditional
30  * names.
31  *
32  * Revision 1.27  1998/05/18 13:06:58  adam
33  * Changed the way attribute sets are handled by the retriaval module.
34  * Extended Explain conversion / schema.
35  * Modified server and client to work with ASN.1 compiled protocol handlers.
36  *
37  * Revision 1.26  1998/03/20 14:46:06  adam
38  * Added UNIverse Resource Reports.
39  *
40  * Revision 1.25  1998/02/10 15:31:52  adam
41  * Implemented date and time structure. Changed the Update Extended
42  * Service.
43  *
44  * Revision 1.24  1997/09/29 13:18:59  adam
45  * Added function, oid_ent_to_oid, to replace the function
46  * oid_getoidbyent, which is not thread safe.
47  *
48  * Revision 1.23  1997/09/01 08:49:50  adam
49  * New windows NT/95 port using MSV5.0. To export DLL functions the
50  * YAZ_EXPORT modifier was added. Defined in yconfig.h.
51  *
52  * Revision 1.22  1997/08/19 08:45:13  quinn
53  * Added Thesaurus
54  *
55  * Revision 1.21  1997/08/19 08:43:49  quinn
56  * Housekeeping
57  *
58  * Revision 1.19  1997/07/28 12:34:42  adam
59  * Added new OID entries (RVDM).
60  *
61  * Revision 1.18  1997/05/14 06:53:42  adam
62  * C++ support.
63  *
64  * Revision 1.17  1997/05/02 08:39:27  quinn
65  * Support for private OID table added. Thanks to Ronald van der Meer
66  *
67  * Revision 1.16  1997/04/30 08:52:08  quinn
68  * Null
69  *
70  * Revision 1.15  1996/10/09  15:54:57  quinn
71  * Added SearchInfoReport
72  *
73  * Revision 1.14  1996/10/07  15:29:17  quinn
74  * Added SOIF support
75  *
76  * Revision 1.13  1996/02/20  17:57:53  adam
77  * Added const to oid_getvalbyname.
78  *
79  * Revision 1.12  1996/02/20  12:52:37  quinn
80  * Various
81  *
82  * Revision 1.11  1996/01/02  08:57:30  quinn
83  * Changed enums in the ASN.1 .h files to #defines. Changed oident.class to oclass
84  *
85  * Revision 1.10  1995/11/13  09:27:31  quinn
86  * Fiddling with the variant stuff.
87  *
88  * Revision 1.9  1995/10/12  10:34:45  quinn
89  * Added Espec-1.
90  *
91  * Revision 1.8  1995/10/10  16:27:08  quinn
92  * *** empty log message ***
93  *
94  * Revision 1.7  1995/09/29  17:12:05  quinn
95  * Smallish
96  *
97  * Revision 1.6  1995/09/27  15:02:48  quinn
98  * Modified function heads & prototypes.
99  *
100  * Revision 1.5  1995/09/12  11:31:46  quinn
101  * Added some oids.
102  *
103  * Revision 1.4  1995/06/27  13:20:32  quinn
104  * Added SUTRS support
105  *
106  * Revision 1.3  1995/05/29  08:11:33  quinn
107  * Moved oid from odr/asn to util.
108  *
109  * Revision 1.2  1995/05/16  08:50:35  quinn
110  * License, documentation, and memory fixes
111  *
112  * Revision 1.1  1995/03/30  09:39:41  quinn
113  * Moved .h files to include directory
114  *
115  * Revision 1.1  1995/03/27  08:32:13  quinn
116  * Added OID database
117  *
118  *
119  */
120
121 #ifndef OID_H
122 #define OID_H
123
124 #include <yconfig.h>
125
126 #ifdef __cplusplus
127 extern "C" {
128 #endif
129
130 #define OID_SIZE 20
131     
132 typedef enum oid_proto
133 {
134     PROTO_NOP=0,
135     PROTO_Z3950,
136     PROTO_SR,
137     PROTO_GENERAL,
138     PROTO_WAIS
139 } oid_proto;
140
141 typedef enum oid_class
142 {
143     CLASS_NOP=0,
144     CLASS_APPCTX,
145     CLASS_ABSYN,
146     CLASS_ATTSET,
147     CLASS_TRANSYN,
148     CLASS_DIAGSET,
149     CLASS_RECSYN,
150     CLASS_RESFORM,
151     CLASS_ACCFORM,
152     CLASS_EXTSERV,
153     CLASS_USERINFO,
154     CLASS_ELEMSPEC,
155     CLASS_VARSET,
156     CLASS_SCHEMA,
157     CLASS_TAGSET,
158     CLASS_GENERAL
159 } oid_class;
160
161 typedef enum oid_value
162 {
163     VAL_NOP=0,
164     VAL_APDU,
165     VAL_BER,
166     VAL_BASIC_CTX,
167     VAL_BIB1,
168     VAL_EXP1,
169     VAL_EXT1,
170     VAL_CCL1,
171     VAL_GILS,
172     VAL_WAIS,
173     VAL_STAS,
174     VAL_COLLECT1,
175     VAL_CIMI1,
176     VAL_GEO,
177     VAL_DIAG1,
178     VAL_ISO2709,
179     VAL_UNIMARC,
180     VAL_INTERMARC,
181     VAL_CCF,
182     VAL_USMARC,
183     VAL_UKMARC,
184     VAL_NORMARC,
185     VAL_LIBRISMARC,
186     VAL_DANMARC,
187     VAL_FINMARC,
188     VAL_MAB,
189     VAL_CANMARC,
190     VAL_SBN,
191     VAL_PICAMARC,
192     VAL_AUSMARC,
193     VAL_IBERMARC,
194     VAL_CATMARC,
195     VAL_MALMARC,
196     VAL_EXPLAIN,
197     VAL_SUTRS,
198     VAL_OPAC,
199     VAL_SUMMARY,
200     VAL_GRS0,
201     VAL_GRS1,
202     VAL_EXTENDED,
203     VAL_FRAGMENT,
204     VAL_RESOURCE1,
205     VAL_RESOURCE2,
206     VAL_PROMPT1,
207     VAL_DES1,
208     VAL_KRB1,
209     VAL_PRESSET,
210     VAL_PQUERY,
211     VAL_PCQUERY,
212     VAL_ITEMORDER,
213     VAL_DBUPDATE,
214     VAL_EXPORTSPEC,
215     VAL_EXPORTINV,
216     VAL_NONE,
217     VAL_SETM,
218     VAL_SETG,
219     VAL_VAR1,
220     VAL_ESPEC1,
221     VAL_SOIF,
222     VAL_SEARCHRES1,
223     VAL_THESAURUS,
224     VAL_CHARLANG,
225     VAL_USERINFO1,
226     VAL_MULTISRCH1,
227     VAL_MULTISRCH2,
228     VAL_DATETIME,
229     VAL_SQLRS,
230     VAL_PDF,
231     VAL_POSTSCRIPT,
232     VAL_HTML,
233     VAL_TIFF,
234     VAL_GIF,
235     VAL_JPEG,
236     VAL_PNG,
237     VAL_MPEG,
238     VAL_SGML,
239     VAL_TIFFB,
240     VAL_WAV,
241     VAL_UPDATEES,
242     VAL_UNIVERSE_REPORT,
243 /* add new types here... */
244
245 /* VAL_DYNAMIC must have highest value */
246     VAL_DYNAMIC
247 } oid_value;
248
249 typedef struct oident
250 {
251     oid_proto proto;
252     oid_class oclass;
253     oid_value value;
254     int oidsuffix[OID_SIZE];
255     char *desc;
256 } oident;
257
258 YAZ_EXPORT int *oid_getoidbyent(struct oident *ent);
259 YAZ_EXPORT int *oid_ent_to_oid(struct oident *ent, int *dst);
260 YAZ_EXPORT struct oident *oid_getentbyoid(int *o);
261 YAZ_EXPORT void oid_oidcpy(int *t, int *s);
262 YAZ_EXPORT void oid_oidcat(int *t, int *s);
263 YAZ_EXPORT int oid_oidcmp(int *o1, int *o2);
264 YAZ_EXPORT int oid_oidlen(int *o);
265 YAZ_EXPORT oid_value oid_getvalbyname(const char *name);
266 YAZ_EXPORT void oid_setprivateoids(oident *list);
267 YAZ_EXPORT struct oident *oid_addent (int *oid, int proto, int oclass,
268                                       const char *desc, int value);
269
270 #ifdef __cplusplus
271 }
272 #endif
273
274 #endif