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