* Copyright (c) 1995-2003, Index Data
* See the file LICENSE for details.
*
- * $Id: oid.c,v 1.62 2003-06-02 12:53:28 adam Exp $
+ * $Id: oid.c,v 1.66 2003-07-24 09:44:52 mike Exp $
*/
/*
"exp. spec."},
{PROTO_Z3950, CLASS_EXTSERV, VAL_EXPORTINV, {9,7,-1},
"exp. inv."},
- {PROTO_Z3950, CLASS_EXTSERV, VAL_ADMINSERVICE, {9,81,1,-1},
+ {PROTO_Z3950, CLASS_EXTSERV, VAL_ADMINSERVICE, {9,1000,81,1,-1},
"Admin"},
{PROTO_Z3950, CLASS_USERINFO,VAL_SEARCHRES1, {10,1,-1},
"searchResult-1"},
"UTF-16"},
{PROTO_GENERAL, CLASS_GENERAL, VAL_UTF8, {1,0,10646,1,0,8,-1},
"UTF-8"},
+ {PROTO_Z3950, CLASS_USERINFO,VAL_OCLCUI, {10, 1000, 17, 1, -1},
+ "OCLC-userInfo"},
{PROTO_NOP, CLASS_NOP, VAL_NOP, {-1}, 0 }
};
for (ol = oident_table; ol; ol = ol->next)
(*func)(&ol->oident, vp);
}
+
+int *oid_name_to_oid(oid_class oclass, const char *name, int *oid) {
+ struct oident ent;
+
+ /* Translate syntax to oid_val */
+ oid_value value = oid_getvalbyname(name);
+
+ /* Build it into an oident */
+ ent.proto = PROTO_Z3950;
+ ent.oclass = oclass;
+ ent.value = value;
+
+ /* Translate to an array of int */
+ return oid_ent_to_oid(&ent, oid);
+}
+
+char *oid_to_dotstring(const int *oid, char *oidbuf) {
+ char tmpbuf[20];
+ int i;
+
+ oidbuf[0] = '\0';
+ for (i = 0; oid[i] != -1; i++) {
+ sprintf(tmpbuf, "%d", oid[i]);
+ if (i > 0) strcat(oidbuf, ".");
+ strcat(oidbuf, tmpbuf);
+ }
+
+ return oidbuf;
+}
+
+char *oid_name_to_dotstring(oid_class oclass, const char *name, char *oidbuf) {
+ int oid[OID_SIZE];
+
+ (void) oid_name_to_oid(oclass, name, oid);
+ return oid_to_dotstring(oid, oidbuf);
+}
+