2 * Copyright (c) 1995-2003, Index Data
3 * See the file LICENSE for details.
5 * $Id: z3950oid.c,v 1.5 2003-01-06 08:20:29 adam Exp $
12 #include <yaz/proto.h>
14 Odr_oid *yaz_oidval_to_z3950oid (ODR o, int oid_class, int oid_value)
19 ident.proto = PROTO_Z3950;
20 ident.oclass = (enum oid_class) oid_class;
21 ident.value = (enum oid_value) oid_value;
23 if (ident.value == VAL_NONE)
26 return odr_oiddup(o, oid_ent_to_oid(&ident, oid));
29 Odr_oid *yaz_str_to_z3950oid (ODR o, int oid_class, const char *str)
34 ident.proto = PROTO_Z3950;
35 ident.oclass = (enum oid_class) oid_class;
36 ident.value = oid_getvalbyname(str);
38 if (ident.value == VAL_NONE)
41 return odr_oiddup(o, oid_ent_to_oid(&ident, oid));
44 const char *yaz_z3950oid_to_str (Odr_oid *oid, int *oid_class)
46 struct oident *ident = oid_getentbyoid(oid);
48 if (!ident || ident->value == VAL_NONE)
50 *oid_class = ident->oclass;
55 const char* yaz_z3950_oid_value_to_str(oid_value ov, oid_class oc)
57 struct oident tmpentry;
58 int tmp_oid[OID_SIZE];
60 tmpentry.proto = PROTO_Z3950;
64 if( oid_ent_to_oid(&tmpentry,tmp_oid) )
80 * vim600: sw=4 ts=8 fdm=marker