YAZ  5.23.1
Data Structures | Macros | Typedefs | Enumerations | Functions
oid_db.h File Reference

Header for OID database. More...

#include <yaz/yconfig.h>
#include <yaz/oid_util.h>
#include <yaz/odr.h>
#include <yaz/oid_std.h>

Go to the source code of this file.

Data Structures

struct  yaz_oid_entry
 

Macros

#define Z3950_PREFIX   1, 2, 840, 10003
 

Typedefs

typedef struct yaz_oid_dbyaz_oid_db_t
 OID database. More...
 
typedef enum oid_class oid_class
 

Enumerations

enum  oid_class {
  CLASS_NOP =0, CLASS_APPCTX, CLASS_ABSYN, CLASS_ATTSET,
  CLASS_TRANSYN, CLASS_DIAGSET, CLASS_RECSYN, CLASS_RESFORM,
  CLASS_ACCFORM, CLASS_EXTSERV, CLASS_USERINFO, CLASS_ELEMSPEC,
  CLASS_VARSET, CLASS_SCHEMA, CLASS_TAGSET, CLASS_GENERAL,
  CLASS_NEGOT
}
 

Functions

yaz_oid_db_t yaz_oid_std (void)
 returns standard OID database More...
 
const Odr_oidyaz_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 More...
 
Odr_oidyaz_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 More...
 
Odr_oidyaz_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 More...
 
const char * yaz_oid_to_string (yaz_oid_db_t oid_db, const Odr_oid *oid, oid_class *oclass)
 maps raw OID to string More...
 
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) More...
 
char * oid_name_to_dotstring (oid_class oclass, const char *name, char *oid_buf)
 maps named from standard database to dot notation More...
 
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 More...
 
int yaz_oid_is_iso2709 (const Odr_oid *oid)
 checks if OID refers to MARC transfer syntax More...
 
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 More...
 
yaz_oid_db_t yaz_oid_db_new (void)
 creates empty OID database More...
 
void yaz_oid_db_destroy (yaz_oid_db_t oid_db)
 destroys OID database More...
 

Detailed Description

Header for OID database.

Definition in file oid_db.h.

Macro Definition Documentation

#define Z3950_PREFIX   1, 2, 840, 10003

Definition at line 194 of file oid_db.h.

Typedef Documentation

typedef enum oid_class oid_class
typedef struct yaz_oid_db* yaz_oid_db_t

OID database.

Definition at line 42 of file oid_db.h.

Enumeration Type Documentation

enum oid_class
Enumerator
CLASS_NOP 
CLASS_APPCTX 
CLASS_ABSYN 
CLASS_ATTSET 
CLASS_TRANSYN 
CLASS_DIAGSET 
CLASS_RECSYN 
CLASS_RESFORM 
CLASS_ACCFORM 
CLASS_EXTSERV 
CLASS_USERINFO 
CLASS_ELEMSPEC 
CLASS_VARSET 
CLASS_SCHEMA 
CLASS_TAGSET 
CLASS_GENERAL 
CLASS_NEGOT 

Definition at line 45 of file oid_db.h.

Function Documentation

char* oid_name_to_dotstring ( oid_class  oclass,
const char *  name,
char *  oid_buf 
)

maps named from standard database to dot notation

Parameters
oclassclass of string (enum oid_class)
namenamed OID
oid_bufbuffer for result (must be of size OID_STR_MAX)
Returns
OID string or NULL if name is not registered in database

Definition at line 110 of file oid_db.c.

References yaz_oid_entry::oid, oid_oid_to_dotstring(), yaz_oid_std(), and yaz_string_to_oid().

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

Parameters
oid_dbdatabase
oclassOID class
namename of OID
new_oidOID value (raw OID)
Return values
0OID added
-1OID name+oclass already exists

Definition at line 128 of file oid_db.c.

References CLASS_NOP, yaz_oid_db::entries, yaz_oid_entry::name, yaz_oid_db::next, yaz_oid_entry::oclass, yaz_oid_entry::oid, oid_oidcpy(), oid_oidlen(), xmalloc, yaz_oid_db::xmalloced, xstrdup, and yaz_string_to_oid().

void yaz_oid_db_destroy ( yaz_oid_db_t  oid_db)

destroys OID database

Parameters
oid_dbdatabase

Definition at line 170 of file oid_db.c.

References yaz_oid_db::entries, yaz_oid_entry::name, yaz_oid_db::next, xfree, and yaz_oid_db::xmalloced.

yaz_oid_db_t yaz_oid_db_new ( void  )

creates empty OID database

Returns
database

Definition at line 161 of file oid_db.c.

References yaz_oid_db::entries, yaz_oid_db::next, xmalloc, and yaz_oid_db::xmalloced.

int yaz_oid_is_iso2709 ( const Odr_oid oid)

checks if OID refers to MARC transfer syntax

Parameters
oidraw OID
Return values
1OID is a MARC type
0OID is not a MARC type

Definition at line 119 of file oid_db.c.

References oid_oidlen().

Referenced by return_record_wrbuf(), and ztest_fetch().

yaz_oid_db_t yaz_oid_std ( void  )
const char* yaz_oid_to_string ( yaz_oid_db_t  oid_db,
const Odr_oid oid,
oid_class oclass 
)

maps raw OID to string

Parameters
oid_dbOID database
oidraw OID
oclassholds OID class if found (output parameter)
Returns
OID name or NULL if not found in database

Definition at line 78 of file oid_db.c.

References get_entries, yaz_oid_entry::name, yaz_oid_db::next, yaz_oid_entry::oclass, yaz_oid_entry::oid, and oid_oidcmp().

Referenced by yaz_oid_to_string_buf(), yaz_record_render(), and ZOOM_record_error().

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)

Parameters
oidraw OID
oclassholds OID class if found (output parameter)
bufstring buffer for result (must be of size OID_STR_MAX)
Returns
OID string (named or dot notatition)

Definition at line 99 of file oid_db.c.

References CLASS_GENERAL, oid_oid_to_dotstring(), yaz_oid_std(), and yaz_oid_to_string().

Referenced by display_grs1(), response_default_diag(), yaz_attribute_element_to_wrbuf(), yaz_query2xml_attribute_element(), yaz_query2xml_rpn(), yaz_rpnquery_to_wrbuf(), zlog_attributes(), and ztest_esrequest().

void yaz_oid_trav ( yaz_oid_db_t  oid_db,
void(*)(const Odr_oid *oid, oid_class oclass, const char *name, void *client_data)  func,
void *  client_data 
)

traverses OIDs in a database

Parameters
oid_dbOID database
funcfunction to be called for each OID
client_datadata to be passed to func (custom defined)

Definition at line 188 of file oid_db.c.

References get_entries, yaz_oid_entry::name, yaz_oid_db::next, yaz_oid_entry::oclass, and yaz_oid_entry::oid.

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

Parameters
oid_dbOID database
oclassclass of string (enum oid_class)
nameOID name
Returns
raw OID or NULL if name is unknown (bad)

This function only maps known names in the database provided. Use yaz_string_to_oid_nmem or yaz_string_to_oid_odr to map any named OID in dot-notation (1.2.8).

Definition at line 40 of file oid_db.c.

References CLASS_GENERAL, get_entries, yaz_oid_entry::name, yaz_oid_db::next, yaz_oid_entry::oclass, yaz_oid_entry::oid, and yaz_matchstr().

Referenced by oid_name_to_dotstring(), yaz_oid_add(), and yaz_string_to_oid_nmem().

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

Parameters
oid_dbOID database
oclassclass of string (enum oid_class)
nameOID name
nmemmemory for returned OID
Returns
raw OID or NULL if name is unknown (bad)

Definition at line 63 of file oid_db.c.

References odr_getoidbystr_nmem(), odr_oiddup_nmem(), yaz_oid_entry::oid, and yaz_string_to_oid().

Referenced by cql_transform_parse_tok_line(), and yaz_string_to_oid_odr().

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

Parameters
oid_dbOID database
oclassclass of string (enum oid_class)
nameOID name
odrmemory for returned OID
Returns
raw OID or NULL if name is unknown (bad)

Definition at line 72 of file oid_db.c.

References odr_getmem, and yaz_string_to_oid_nmem().

Referenced by conf_retrieval(), create_update_package(), otherInfo_attach(), query_oid_getvalbyname(), yaz_xml2query_attribute_element(), yaz_xml2query_rpn(), and zoom_yaz_str_to_z3950oid().