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