YAZ  5.23.1
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 {
64 } oid_class;
65 
66 
70 YAZ_EXPORT
71 yaz_oid_db_t yaz_oid_std(void);
72 
83 YAZ_EXPORT
84 const Odr_oid *yaz_string_to_oid(yaz_oid_db_t oid_db,
85  oid_class oclass, const char *name);
86 
87 
95 YAZ_EXPORT
96 Odr_oid *yaz_string_to_oid_nmem(yaz_oid_db_t oid_db,
97  oid_class oclass, const char *name, NMEM nmem);
98 
106 YAZ_EXPORT
107 Odr_oid *yaz_string_to_oid_odr(yaz_oid_db_t oid_db,
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
178 yaz_oid_db_t yaz_oid_db_new(void);
179 
183 YAZ_EXPORT
184 void yaz_oid_db_destroy(yaz_oid_db_t oid_db);
185 
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 
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
yaz_oid_db_t yaz_oid_db_new(void)
creates empty OID database
Definition: oid_db.c:161
#define YAZ_END_CDECL
Definition: yconfig.h:57
Definition: oid_db.h:186
char * name
Definition: initopt.c:18
Standard Object Identifiers: Generated from ./oid.csv.
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
short Odr_oid
Definition: oid_util.h:42
char * name
Definition: oid_db.h:189
Header for OID basic functions.
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
struct yaz_oid_db * yaz_oid_db_t
OID database.
Definition: oid_db.h:42
int yaz_oid_is_iso2709(const Odr_oid *oid)
checks if OID refers to MARC transfer syntax
Definition: oid_db.c:119
yaz_oid_db_t yaz_oid_std(void)
returns standard OID database
Definition: oid_db.c:33
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
Header with fundamental macros.
const Odr_oid * oid
Definition: oid_db.h:188
void yaz_oid_db_destroy(yaz_oid_db_t oid_db)
destroys OID database
Definition: oid_db.c:170
Definition: odr.h:124
enum oid_class oclass
Definition: oid_db.h:187
oid_class
Definition: oid_db.h:45
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
Odr_oid * yaz_string_to_oid_nmem(yaz_oid_db_t oid_db, oid_class oclass, const char *name, NMEM nmem)
creates NMEM malloc&#39;ed OID from string
Definition: oid_db.c:63
Odr_oid * yaz_string_to_oid_odr(yaz_oid_db_t oid_db, oid_class oclass, const char *name, ODR odr)
creates ODR malloc&#39;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
#define YAZ_BEGIN_CDECL
Definition: yconfig.h:56