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