d59209f8bd70a13d8febb1a8ea03cf31829fb295
[yaz-moved-to-github.git] / include / yaz / oid.h
1 /*
2  * Copyright (C) 1995-2005, Index Data ApS
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  * $Id: oid.h,v 1.28 2006-05-08 19:45:29 adam Exp $
27  */
28
29 /**
30  * \file oid.h
31  * \brief Header for OID database
32  *
33  * More or less protocol-transparent OID database.
34  * We could (and should?) extend this so that the user app can add new
35  * entries to the list at initialization.
36  */
37 #ifndef OID_H
38 #define OID_H
39
40 #include <yaz/yconfig.h>
41
42 YAZ_BEGIN_CDECL
43
44 #define OID_SIZE 20
45 #define OID_STR_MAX 256
46     
47 typedef enum oid_proto
48 {
49     PROTO_NOP=0,
50     PROTO_Z3950,
51     PROTO_SR,
52     PROTO_GENERAL,
53     PROTO_WAIS,
54     PROTO_HTTP
55 } oid_proto;
56
57 typedef enum oid_class
58 {
59     CLASS_NOP=0,
60     CLASS_APPCTX,
61     CLASS_ABSYN,
62     CLASS_ATTSET,
63     CLASS_TRANSYN,
64     CLASS_DIAGSET,
65     CLASS_RECSYN,
66     CLASS_RESFORM,
67     CLASS_ACCFORM,
68     CLASS_EXTSERV,
69     CLASS_USERINFO,
70     CLASS_ELEMSPEC,
71     CLASS_VARSET,
72     CLASS_SCHEMA,
73     CLASS_TAGSET,
74     CLASS_GENERAL,
75     CLASS_NEGOT
76 } oid_class;
77
78 typedef enum oid_value
79 {
80     VAL_NOP=0,
81     VAL_APDU,
82     VAL_BER,
83     VAL_BASIC_CTX,
84     VAL_BIB1,
85
86     VAL_EXP1,
87     VAL_EXT1,
88     VAL_CCL1,
89     VAL_GILS,
90     VAL_WAIS, 
91 /* 10 */
92     VAL_STAS,
93     VAL_COLLECT1,
94     VAL_CIMI1,
95     VAL_GEO,
96     VAL_DIAG1,
97
98     VAL_ISO2709,
99     VAL_UNIMARC,
100     VAL_INTERMARC,
101     VAL_CCF,
102     VAL_USMARC,
103 /* 20 */
104     VAL_UKMARC,
105     VAL_NORMARC,
106     VAL_LIBRISMARC,
107     VAL_DANMARC,
108     VAL_FINMARC,
109
110     VAL_MAB,
111     VAL_CANMARC,
112     VAL_SBN,
113     VAL_PICAMARC,
114     VAL_AUSMARC,
115 /* 30 */
116     VAL_IBERMARC,
117     VAL_CATMARC,
118     VAL_MALMARC,
119     VAL_EXPLAIN,
120     VAL_SUTRS,
121
122     VAL_OPAC,
123     VAL_SUMMARY,
124     VAL_GRS0,
125     VAL_GRS1,
126     VAL_EXTENDED,
127 /* 40 */
128     VAL_FRAGMENT,
129     VAL_RESOURCE1,
130     VAL_RESOURCE2,
131     VAL_PROMPT1,
132     VAL_DES1,
133
134     VAL_KRB1,
135     VAL_PRESSET,
136     VAL_PQUERY,
137     VAL_PCQUERY,
138     VAL_ITEMORDER,
139
140 /* 50 */
141     VAL_DBUPDATE0,
142     VAL_DBUPDATE,
143     VAL_EXPORTSPEC,
144     VAL_EXPORTINV,
145     VAL_NONE,
146
147     VAL_SETM,
148     VAL_SETG,
149     VAL_VAR1,
150     VAL_ESPEC1,
151     VAL_SOIF,
152
153 /* 60 */
154     VAL_SEARCHRES1,
155     VAL_THESAURUS,
156     VAL_CHARLANG,
157     VAL_USERINFO1,
158     VAL_MULTISRCH1,
159
160     VAL_MULTISRCH2,
161     VAL_DATETIME,
162     VAL_SQLRS,
163     VAL_PDF,
164     VAL_POSTSCRIPT,
165
166 /* 70 */
167     VAL_HTML,
168     VAL_TIFF,
169     VAL_GIF,
170     VAL_JPEG,
171     VAL_PNG,
172
173     VAL_MPEG,
174     VAL_SGML,
175     VAL_TIFFB,
176     VAL_WAV,
177     VAL_UPDATEES,
178
179 /* 80 */
180     VAL_TEXT_XML,
181     VAL_APPLICATION_XML,
182     VAL_UNIVERSE_REPORT,
183     VAL_PROXY,
184     VAL_COOKIE,
185
186     VAL_CLIENT_IP,
187     VAL_ISO_ILL_1,
188     VAL_ZBIG,
189     VAL_UTIL,
190     VAL_XD1,
191
192 /* 90 */
193     VAL_ZTHES,
194     VAL_FIN1,
195     VAL_DAN1,
196     VAL_DIAG_ES,
197     VAL_DIAG_GENERAL,
198
199     VAL_JPMARC,
200     VAL_SWEMARC,
201     VAL_SIGLEMARC,
202     VAL_ISDSMARC,
203     VAL_RUSMARC,
204
205 /* 100 */
206     VAL_ADMINSERVICE,
207     VAL_HOLDINGS,
208     VAL_HUNMARC,
209     VAL_CHARNEG3,
210     VAL_LIB1,
211
212     VAL_VIRT,
213     VAL_UCS2,
214     VAL_UCS4,
215     VAL_UTF16,
216     VAL_UTF8,
217 /* 110 */
218
219     VAL_IDXPATH,
220     VAL_BIB2,
221     VAL_ZEEREX,
222     VAL_CQL,
223     VAL_DBUPDATE1,
224
225     VAL_OCLCUI,
226     VAL_ID_CHARSET,
227     VAL_EXTLITE,
228     VAL_NACSISCATP,
229     VAL_FINMARC2000,
230 /* 120 */
231
232     VAL_MARC21FIN,
233     VAL_CHARNEG4,
234     VAL_XMLES,
235
236 /* VAL_DYNAMIC must have highest value */
237     VAL_DYNAMIC,
238     VAL_MAX = VAL_DYNAMIC+30
239 } oid_value;
240
241 typedef struct oident
242 {
243     oid_proto proto;
244     oid_class oclass;
245     oid_value value;
246     int oidsuffix[OID_SIZE];
247     char *desc;
248 } oident;
249
250 YAZ_EXPORT int *oid_getoidbyent(struct oident *ent);
251 YAZ_EXPORT int *oid_ent_to_oid(struct oident *ent, int *dst);
252 YAZ_EXPORT struct oident *oid_getentbyoid(int *o);
253 YAZ_EXPORT void oid_oidcpy(int *t, int *s);
254 YAZ_EXPORT void oid_oidcat(int *t, int *s);
255 YAZ_EXPORT int oid_oidcmp(int *o1, int *o2);
256 YAZ_EXPORT int oid_oidlen(int *o);
257 YAZ_EXPORT oid_value oid_getvalbyname(const char *name);
258 YAZ_EXPORT void oid_setprivateoids(oident *list);
259 YAZ_EXPORT struct oident *oid_addent (int *oid, enum oid_proto proto,
260                                       enum oid_class oclass,
261                                       const char *desc, int value);
262
263 YAZ_EXPORT void oid_trav (void (*func)(struct oident *oidinfo, void *vp),
264                           void *vp);
265
266 YAZ_EXPORT void oid_init(void);
267 YAZ_EXPORT void oid_exit(void);
268 YAZ_EXPORT int *oid_name_to_oid(oid_class oclass, const char *name, int *oid);
269 YAZ_EXPORT char *oid_to_dotstring(const int *oid, char *oidbuf);
270 YAZ_EXPORT char *oid_name_to_dotstring(oid_class oclass, const char *name,
271                                        char *oidbuf);
272
273 YAZ_END_CDECL
274
275 #endif
276 /*
277  * Local variables:
278  * c-basic-offset: 4
279  * indent-tabs-mode: nil
280  * End:
281  * vim: shiftwidth=4 tabstop=8 expandtab
282  */
283