2 * Copyright (C) 1995-2006, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: z3950oid.c,v 1.5 2006-04-20 20:50:51 adam Exp $
9 \brief Z3950 OID conversion utilities
16 #include <yaz/proto.h>
18 Odr_oid *yaz_oidval_to_z3950oid (ODR o, int oid_class, int oid_value)
23 ident.proto = PROTO_Z3950;
24 ident.oclass = (enum oid_class) oid_class;
25 ident.value = (enum oid_value) oid_value;
27 if (ident.value == VAL_NONE)
30 return odr_oiddup(o, oid_ent_to_oid(&ident, oid));
33 Odr_oid *yaz_str_to_z3950oid (ODR o, int oid_class, const char *str)
38 ident.proto = PROTO_Z3950;
39 ident.oclass = (enum oid_class) oid_class;
40 ident.value = oid_getvalbyname(str);
42 if (ident.value == VAL_NONE)
45 return odr_oiddup(o, oid_ent_to_oid(&ident, oid));
48 const char *yaz_z3950oid_to_str (Odr_oid *oid, int *oid_class)
50 struct oident *ident = oid_getentbyoid(oid);
52 if (!ident || ident->value == VAL_NONE)
54 *oid_class = ident->oclass;
59 const char* yaz_z3950_oid_value_to_str(oid_value ov, oid_class oc)
61 struct oident tmpentry;
62 int tmp_oid[OID_SIZE];
64 tmpentry.proto = PROTO_Z3950;
68 if( oid_ent_to_oid(&tmpentry,tmp_oid) )
80 * indent-tabs-mode: nil
82 * vim: shiftwidth=4 tabstop=8 expandtab