YAZ  5.34.0
oid_db.h
Go to the documentation of this file.
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) Index Data.
3  * All rights reserved.
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of Index Data nor the names of its contributors
13  * may be used to endorse or promote products derived from this
14  * software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
32 #ifndef OID_DB_H
33 #define OID_DB_H
34 
35 #include <yaz/yconfig.h>
36 #include <yaz/oid_util.h>
37 #include <yaz/odr.h>
38 
40 
42 typedef struct yaz_oid_db *yaz_oid_db_t;
43 
44 
45 typedef enum oid_class
46 {
65 
66 
70 YAZ_EXPORT
72 
83 YAZ_EXPORT
85  oid_class oclass, const char *name);
86 
87 
95 YAZ_EXPORT
97  oid_class oclass, const char *name, NMEM nmem);
98 
106 YAZ_EXPORT
108  oid_class oclass, const char *name, ODR odr);
109 
116 YAZ_EXPORT
117 const char *yaz_oid_to_string(yaz_oid_db_t oid_db,
118  const Odr_oid *oid, oid_class *oclass);
119 
120 
127 YAZ_EXPORT
128 const char *yaz_oid_to_string_buf(const Odr_oid *oid,
129  oid_class *oclass, char *buf);
130 
131 
138 YAZ_EXPORT
139 char *oid_name_to_dotstring(oid_class oclass, const char *name, char *oid_buf);
140 
141 
147 YAZ_EXPORT void yaz_oid_trav(yaz_oid_db_t oid_db,
148  void (*func)(const Odr_oid *oid,
149  oid_class oclass, const char *name,
150  void *client_data),
151  void *client_data);
152 
158 YAZ_EXPORT
159 int yaz_oid_is_iso2709(const Odr_oid *oid);
160 
169 YAZ_EXPORT
170 int yaz_oid_add(yaz_oid_db_t oid_db, oid_class oclass, const char *name,
171  const Odr_oid *new_oid);
172 
173 
177 YAZ_EXPORT
179 
183 YAZ_EXPORT
185 
187  enum oid_class oclass;
188  const Odr_oid *oid;
189  char *name;
190 };
191 
193 
194 #define Z3950_PREFIX 1, 2, 840, 10003
195 
196 #include <yaz/oid_std.h>
197 
198 #endif
199 /*
200  * Local variables:
201  * c-basic-offset: 4
202  * c-file-style: "Stroustrup"
203  * indent-tabs-mode: nil
204  * End:
205  * vim: shiftwidth=4 tabstop=8 expandtab
206  */
207 
char * name
Definition: initopt.c:18
Header for ODR (Open Data Representation)
char * oid_name_to_dotstring(oid_class oclass, const char *name, char *oid_buf)
maps named from standard database to dot notation
Definition: oid_db.c:110
int yaz_oid_is_iso2709(const Odr_oid *oid)
checks if OID refers to MARC transfer syntax
Definition: oid_db.c:119
Odr_oid * yaz_string_to_oid_odr(yaz_oid_db_t oid_db, oid_class oclass, const char *name, ODR odr)
creates ODR malloc'ed OID from string
Definition: oid_db.c:72
void yaz_oid_trav(yaz_oid_db_t oid_db, void(*func)(const Odr_oid *oid, oid_class oclass, const char *name, void *client_data), void *client_data)
traverses OIDs in a database
Definition: oid_db.c:188
const char * yaz_oid_to_string_buf(const Odr_oid *oid, oid_class *oclass, char *buf)
maps any OID to string (named or dot-notation)
Definition: oid_db.c:99
oid_class
Definition: oid_db.h:46
@ CLASS_SCHEMA
Definition: oid_db.h:60
@ CLASS_APPCTX
Definition: oid_db.h:48
@ CLASS_ACCFORM
Definition: oid_db.h:55
@ CLASS_TRANSYN
Definition: oid_db.h:51
@ CLASS_VARSET
Definition: oid_db.h:59
@ CLASS_DIAGSET
Definition: oid_db.h:52
@ CLASS_EXTSERV
Definition: oid_db.h:56
@ CLASS_RESFORM
Definition: oid_db.h:54
@ CLASS_USERINFO
Definition: oid_db.h:57
@ CLASS_TAGSET
Definition: oid_db.h:61
@ CLASS_ATTSET
Definition: oid_db.h:50
@ CLASS_RECSYN
Definition: oid_db.h:53
@ CLASS_NOP
Definition: oid_db.h:47
@ CLASS_GENERAL
Definition: oid_db.h:62
@ CLASS_ABSYN
Definition: oid_db.h:49
@ CLASS_NEGOT
Definition: oid_db.h:63
@ CLASS_ELEMSPEC
Definition: oid_db.h:58
yaz_oid_db_t yaz_oid_std(void)
returns standard OID database
Definition: oid_db.c:33
void yaz_oid_db_destroy(yaz_oid_db_t oid_db)
destroys OID database
Definition: oid_db.c:170
struct yaz_oid_db * yaz_oid_db_t
OID database.
Definition: oid_db.h:42
Odr_oid * yaz_string_to_oid_nmem(yaz_oid_db_t oid_db, oid_class oclass, const char *name, NMEM nmem)
creates NMEM malloc'ed OID from string
Definition: oid_db.c:63
const Odr_oid * yaz_string_to_oid(yaz_oid_db_t oid_db, oid_class oclass, const char *name)
maps named OID string to raw OID by database lookup
Definition: oid_db.c:40
const char * yaz_oid_to_string(yaz_oid_db_t oid_db, const Odr_oid *oid, oid_class *oclass)
maps raw OID to string
Definition: oid_db.c:78
yaz_oid_db_t yaz_oid_db_new(void)
creates empty OID database
Definition: oid_db.c:161
int yaz_oid_add(yaz_oid_db_t oid_db, oid_class oclass, const char *name, const Odr_oid *new_oid)
adds new OID entry to database
Definition: oid_db.c:128
Standard Object Identifiers: Generated from ./oid.csv.
Header for OID basic functions.
short Odr_oid
Definition: oid_util.h:42
Definition: odr.h:125
Definition: oid_db.h:186
char * name
Definition: oid_db.h:189
enum oid_class oclass
Definition: oid_db.h:187
const Odr_oid * oid
Definition: oid_db.h:188
Header with fundamental macros.
#define YAZ_BEGIN_CDECL
Definition: yconfig.h:56
#define YAZ_END_CDECL
Definition: yconfig.h:57