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

Defines

#define Z3950_PREFIX   1, 2, 840, 10003

Typedefs

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

Detailed Description

Header for OID database.

Definition in file oid_db.h.


Define 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:
oclass class of string (enum oid_class)
name named OID
oid_buf buffer for result (must be of size OID_STR_MAX)
Returns:
OID string or NULL if name is not registered in database

Definition at line 111 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_db database
oclass OID class
name name of OID
new_oid OID value (raw OID)
Return values:
0 OID added
-1 OID name+oclass already exists

Definition at line 129 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_db database

Definition at line 171 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 162 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:
oid raw OID
Return values:
1 OID is a MARC type
0 OID is not a MARC type

Definition at line 120 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_db OID database
oid raw OID
oclass holds OID class if found (output parameter)
Returns:
OID name or NULL if not found in database

Definition at line 79 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 npr_format(), yaz_oid_to_string_buf(), 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:
oid raw OID
oclass holds OID class if found (output parameter)
buf string buffer for result (must be of size OID_STR_MAX)
Returns:
OID string (named or dot notatition)

Definition at line 100 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(), z_ext_record_oid(), z_ext_record_oid_any(), 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_db OID database
func function to be called for each OID
client_data data to be passed to func (custom defined)

Definition at line 189 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_db OID database
oclass class of string (enum oid_class)
name OID 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 41 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_db OID database
oclass class of string (enum oid_class)
name OID name
nmem memory for returned OID
Returns:
raw OID or NULL if name is unknown (bad)

Definition at line 64 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_db OID database
oclass class of string (enum oid_class)
name OID name
odr memory for returned OID
Returns:
raw OID or NULL if name is unknown (bad)

Definition at line 73 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().

Generated on Tue Aug 17 13:13:20 2010 for YAZ by  doxygen 1.6.3