* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: admin.c,v 1.24 2007-04-12 13:52:57 adam Exp $
+ * $Id: admin.c,v 1.25 2007-04-16 21:53:08 adam Exp $
*/
#include <stdio.h>
printf ("Admin request\n");
fflush(stdout);
- oid = yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_EXTSERV,
- OID_STR_ADMIN,
- out);
-
+ oid = odr_oiddup(out, yaz_oid_extserv_admin);
req->packageType = oid;
req->packageName = "1.Extendedserveq";
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.333 2007-04-12 20:47:27 adam Exp $
+ * $Id: client.c,v 1.334 2007-04-16 21:53:08 adam Exp $
*/
/** \file client.c
* \brief yaz-client program
if (yazProxy && type_and_host)
{
- const int *oid_proxy = yaz_string_to_oid(yaz_oid_std(),
- CLASS_USERINFO, OID_STR_PROXY);
- yaz_oi_set_string_oid(&req->otherInfo, out, oid_proxy,
+ yaz_oi_set_string_oid(&req->otherInfo, out, yaz_oid_userinfo_proxy,
1, type_and_host);
}
static void display_record(Z_External *r)
{
- char oid_name_buf[OID_STR_MAX];
- int oclass;
const int *oid = r->direct_reference;
- const char *oid_name = 0;
record_last = r;
/*
*/
if (oid)
{
- oid_name = yaz_oid_to_string_buf(oid, &oclass, oid_name_buf);
+ int oclass;
+ char oid_name_buf[OID_STR_MAX];
+ const char *oid_name
+ = yaz_oid_to_string_buf(oid, &oclass, oid_name_buf);
printf("Record type: ");
if (oid_name)
printf("%s\n", oid_name);
}
}
}
- if (oid_name && !yaz_matchstr(oid_name, OID_STR_SOIF))
+ if (oid && !oid_oidcmp(oid, yaz_oid_recsyn_soif))
{
print_record((const unsigned char *) r->u.octet_aligned->buf,
r->u.octet_aligned->len);
else if (oid && r->which == Z_External_octet)
{
const char *octet_buf = (char*)r->u.octet_aligned->buf;
- if (oid_name && (!yaz_matchstr(oid_name, OID_STR_XML)
- || !yaz_matchstr(oid_name, OID_STR_APPLICATION_XML)
- || !yaz_matchstr(oid_name, OID_STR_HTML)))
+ if (oid && (!oid_oidcmp(oid, yaz_oid_recsyn_xml)
+ || !oid_oidcmp(oid, yaz_oid_recsyn_xml)
+ || !oid_oidcmp(oid, yaz_oid_recsyn_html)))
{
print_record((const unsigned char *) octet_buf,
r->u.octet_aligned->len);
}
- else if (oid_name && !yaz_matchstr(oid_name, OID_STR_POSTSCRIPT))
+ else if (oid && !oid_oidcmp(oid, yaz_oid_recsyn_postscript))
{
int size = r->u.octet_aligned->len;
if (size > 100)
if (marcCharset && !strcmp(marcCharset, "auto"))
{
- if (!yaz_matchstr(oid_name, OID_STR_USMARC))
+ if (!oid_oidcmp(oid, yaz_oid_recsyn_usmarc))
{
if (octet_buf[9] == 'a')
from = "UTF-8";
if (marc_file)
fwrite (octet_buf, 1, r->u.octet_aligned->len, marc_file);
}
- else if (oid_name && !yaz_matchstr(oid_name, OID_STR_SUTRS))
+ else if (oid && !oid_oidcmp(oid, yaz_oid_recsyn_sutrs))
{
if (r->which != Z_External_sutrs)
{
if (marc_file)
fwrite (r->u.sutrs->buf, 1, r->u.sutrs->len, marc_file);
}
- else if (oid_name && !yaz_matchstr(oid_name, OID_STR_GRS1))
+ else if (oid && !oid_oidcmp(oid, yaz_oid_recsyn_grs_1))
{
WRBUF w;
if (r->which != Z_External_grs1)
puts (wrbuf_cstr(w));
wrbuf_destroy(w);
}
- else if (oid_name && !yaz_matchstr(oid_name, OID_STR_OPAC))
+ else if (oid && !oid_oidcmp(oid, yaz_oid_recsyn_opac))
{
int i;
if (r->u.opac->bibliographicRecord)
const char *diag_name = 0;
diag_name = yaz_oid_to_string_buf
(r->diagnosticSetId, &oclass, diag_name_buf);
- if (yaz_matchstr(diag_name, OID_STR_BIB1))
+ if (oid_oidcmp(r->diagnosticSetId, yaz_oid_diagset_bib_1))
printf("Unknown diagset: %s\n", diag_name);
}
printf(" [%d] %s", *r->condition, diagbib1_str(*r->condition));
dnl YAZ Toolkit, Index Data 1995-2007
dnl See the file LICENSE for details.
-dnl $Id: configure.ac,v 1.73 2007-04-12 13:53:33 adam Exp $
+dnl $Id: configure.ac,v 1.74 2007-04-16 21:53:08 adam Exp $
AC_PREREQ(2.59)
-AC_INIT([yaz],[2.1.99.2],[yaz-help@indexdata.dk])
+AC_INIT([yaz],[2.1.99.3],[yaz-help@indexdata.dk])
AC_CONFIG_SRCDIR(configure.ac)
AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE([1.8])
-## $Id: Makefile.am,v 1.41 2007-04-12 13:52:57 adam Exp $
+## $Id: Makefile.am,v 1.42 2007-04-16 21:53:08 adam Exp $
pkginclude_HEADERS= backend.h ccl.h ccl_xml.h cql.h comstack.h \
diagbib1.h diagsrw.h diagsru_update.h sortspec.h log.h logrpn.h marcdisp.h \
tcpip.h test.h timing.h unix.h tpath.h wrbuf.h xmalloc.h \
yaz-ccl.h yaz-iconv.h yaz-util.h yaz-version.h yconfig.h proto.h \
xmlquery.h libxml2_error.h xmltypes.h snprintf.h query-charset.h \
- oid_db.h oid_util.h \
+ oid_db.h oid_util.h oid_std.h \
\
ill.h ill-core.h item-req.h z-accdes1.h z-accform1.h \
z-acckrb1.h z-core.h z-date.h z-diag1.h z-espec1.h z-estask.h z-exp.h \
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* $Id: oid_db.h,v 1.4 2007-04-16 08:43:08 adam Exp $ */
+/* $Id: oid_db.h,v 1.5 2007-04-16 21:53:08 adam Exp $ */
/**
* \file oid_db.h
int yaz_oid_add(yaz_oid_db_t oid_db, int oclass, const char *name,
const int *new_oid);
-#define OID_STR_BIB1 "Bib-1"
-#define OID_STR_DIAG1 "Diag-1"
-#define OID_STR_USMARC "USmarc"
-#define OID_STR_XML "XML"
-#define OID_STR_SOIF "SOIF"
-#define OID_STR_APPLICATION_XML "application-XML"
-#define OID_STR_HTML "html"
-#define OID_STR_GRS1 "GRS-1"
-#define OID_STR_POSTSCRIPT "postscript"
-#define OID_STR_SUTRS "SUTRS"
-#define OID_STR_OPAC "OPAC"
-#define OID_STR_EXPLAIN "Explain"
-#define OID_STR_SUMMARY "Summary"
-#define OID_STR_EXTENDED "Extended"
-#define OID_STR_COOKIE "Cookie"
-#define OID_STR_PROXY "Proxy"
-#define OID_STR_CLIENT_IP "Client-IP"
-#define OID_STR_ILL_1 "ISOILL-1"
-#define OID_STR_ADMIN "Admin"
-#define OID_STR_XMLES "XML-ES"
-#define OID_STR_EXT_UPDATE "DB. Update"
-#define OID_STR_ITEMORDER "Item order"
-#define OID_STR_USERINFO_1 "UserInfo-1"
-#define OID_STR_ID_CHARSET "ID-Charset"
-#define OID_STR_CHARNEG_3 "CharSetandLanguageNegotiation-3"
-#define OID_STR_CHARNEG_4 "CharSetandLanguageNegotiation-4"
-#define OID_STR_VARIANT_1 "Variant-1"
-#define OID_STR_SEARCH_RESULT_1 "searchResult-1"
-
-YAZ_EXPORT const int *yaz_oid_xml(void);
-YAZ_EXPORT const int *yaz_oid_application_xml(void);
-YAZ_EXPORT const int *yaz_oid_html(void);
-YAZ_EXPORT const int *yaz_oid_sutrs(void);
-YAZ_EXPORT const int *yaz_oid_opac(void);
-YAZ_EXPORT const int *yaz_oid_grs1(void);
-YAZ_EXPORT const int *yaz_oid_postscript(void);
-YAZ_EXPORT const int *yaz_oid_explain(void);
-YAZ_EXPORT const int *yaz_oid_extended(void);
-YAZ_EXPORT const int *yaz_oid_summary(void);
-YAZ_EXPORT const int *yaz_oid_get_usmarc(void);
-YAZ_EXPORT const int *yaz_oid_soif(void);
-YAZ_EXPORT const int *yaz_oid_attset_bib1(void);
-YAZ_EXPORT const int *yaz_oid_diag1(void);
-YAZ_EXPORT const int *yaz_oid_proxy(void);
-YAZ_EXPORT const int *yaz_oid_cookie(void);
-YAZ_EXPORT const int *yaz_oid_search_result_1(void);
-YAZ_EXPORT const int *yaz_oid_variant1(void);
+struct yaz_oid_entry {
+ int oclass;
+ const int *oid;
+ char *name;
+};
+
+#define Z3950_PREFIX 1, 2, 840, 10003
+
+#include <yaz/oid_std.h>
+
YAZ_END_CDECL
#endif
## This file is part of the YAZ toolkit.
## Copyright (C) 1995-2007, Index Data, All rights reserved.
-## $Id: Makefile.am,v 1.57 2007-04-16 11:15:51 adam Exp $
+## $Id: Makefile.am,v 1.58 2007-04-16 21:53:09 adam Exp $
YAZ_VERSION_INFO=3:0:0
charconv.tcl codetables.xml \
csvtodiag.tcl csvtobib1.tcl csvtosrw.tcl bib1.csv srw.csv \
csvtosru_update.tcl sru_update.csv \
- oid.csv
+ oidtoc.tcl oid.csv
YAZCOMP=$(top_srcdir)/util/yaz-asncomp
YAZCOMP_Z = $(YAZCOMP) -d $(srcdir)/z.tcl -i yaz -I$(top_srcdir)/include
marc8r.c: charconv.tcl codetables.xml
$(TCLSH) $(srcdir)/charconv.tcl -r -p marc8r $(srcdir)/codetables.xml -o marc8r.c
+# Generate OID database from CSV
+oid_std.c $(top_srcdir)/include/yaz/oid_std.h: oidtoc.tcl oid.csv
+ $(TCLSH) $(srcdir)/oidtoc.tcl $(srcdir)/oid.csv $(srcdir)/oid_std.c $(top_srcdir)/include/yaz/oid_std.h
+
# Generate diagnostics from CSVs
diagbib1.c $(top_srcdir)/include/yaz/diagbib1.h: csvtobib1.tcl bib1.csv
$(TCLSH) $(srcdir)/csvtobib1.tcl $(srcdir)
eventl.c seshigh.c statserv.c requestq.c tcpdchk.c \
eventl.h service.c service.h session.h test.c timing.c \
xmlquery.c http.c \
- mime.c mime.h oid_util.c \
+ mime.c mime.h oid_util.c oid_std.c \
record_conv.c retrieval.c elementset.c snprintf.c query-charset.c
libyaz_la_LDFLAGS=-version-info $(YAZ_VERSION_INFO)
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: charneg.c,v 1.8 2007-04-12 13:52:57 adam Exp $
+ * $Id: charneg.c,v 1.9 2007-04-16 21:53:09 adam Exp $
*/
/**
p->descriptor = 0;
p->indirect_reference = 0;
- p->direct_reference = yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_NEGOT,
- OID_STR_ID_CHARSET,
- o);
+ p->direct_reference = odr_oiddup(o, yaz_oid_negot_charset_id);
p->which = Z_External_octet;
if (!(p->u.octet_aligned = (Odr_oct *)odr_malloc(o, sizeof(Odr_oct)))) {
p->descriptor = 0;
p->indirect_reference = 0;
- p->direct_reference = yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_NEGOT,
- OID_STR_CHARNEG_3,
- o);
+ p->direct_reference = odr_oiddup(o, yaz_oid_negot_charset_3);
p->which = Z_External_charSetandLanguageNegotiation;
p->u.charNeg3 = z_get_CharSetandLanguageNegotiation(o);
p->descriptor = 0;
p->indirect_reference = 0;
- p->direct_reference = yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_NEGOT,
- OID_STR_CHARNEG_3,
- o);
+ p->direct_reference = odr_oiddup(o, yaz_oid_negot_charset_3);
p->which = Z_External_charSetandLanguageNegotiation;
p->u.charNeg3 = z_get_CharSetandLanguageNegotiation(o);
Z_External *pext;
if ((p->list[i]->which == Z_OtherInfo_externallyDefinedInfo) &&
(pext = p->list[i]->information.externallyDefinedInfo)) {
-
- int oclass;
- const char *name = yaz_oid_to_string(yaz_oid_std(),
- pext->direct_reference,
- &oclass);
-
- if (oclass == CLASS_NEGOT
- && name && !strcmp(name, OID_STR_CHARNEG_3)
+
+ if (!oid_oidcmp(pext->direct_reference, yaz_oid_negot_charset_3)
&& pext->which == Z_External_charSetandLanguageNegotiation)
{
return pext->u.charNeg3;
if (((*p)->list[i]->which == Z_OtherInfo_externallyDefinedInfo) &&
(pext = (*p)->list[i]->information.externallyDefinedInfo))
{
- int oclass;
- const char *name = yaz_oid_to_string(yaz_oid_std(),
- pext->direct_reference,
- &oclass);
-
- if (oclass == CLASS_NEGOT
- && name && !strcmp(name, OID_STR_CHARNEG_3)
+ if (!oid_oidcmp(pext->direct_reference, yaz_oid_negot_charset_3)
&& pext->which == Z_External_charSetandLanguageNegotiation)
{
if ((*p)->num_elements <= 1)
-"$Id: oid.csv,v 1.1 2007-04-16 11:15:51 adam Exp $"
+"$Id: oid.csv,v 1.2 2007-04-16 21:53:09 adam Exp $"
TRANSYN, 2.1.1, "BER"
TRANSYN, 1.0.2709.1.1, "ISO2709"
GENERAL, 1.0.10161.2.1, "ISOILL-1"
ACCFORM, Z3950_PREFIX.8.1, "Prompt-1"
ACCFORM, Z3950_PREFIX.8.2, "Des-1"
ACCFORM, Z3950_PREFIX.8.3, "Krb-1"
-EXTSERV, Z3950_PREFIX.9.1, "Pers. set"
-EXTSERV, Z3950_PREFIX.9.2, "Pers. query"
-EXTSERV, Z3950_PREFIX.9.3, "Per'd query"
+EXTSERV, Z3950_PREFIX.9.1, "Persistent set"
+EXTSERV, Z3950_PREFIX.9.2, "Persistent query"
+EXTSERV, Z3950_PREFIX.9.3, "Periodic query"
EXTSERV, Z3950_PREFIX.9.4, "Item order"
-EXTSERV, Z3950_PREFIX.9.5, "DB. Update (first version)"
-EXTSERV, Z3950_PREFIX.9.5.1, "DB. Update (second version)"
-EXTSERV, Z3950_PREFIX.9.5.1.1, "DB. Update"
+EXTSERV, Z3950_PREFIX.9.5, "Database Update (first version)"
+EXTSERV, Z3950_PREFIX.9.5.1, "Database Update (second version)"
+EXTSERV, Z3950_PREFIX.9.5.1.1, "Database Update"
EXTSERV, Z3950_PREFIX.9.6, "exp. spec."
EXTSERV, Z3950_PREFIX.9.7, "exp. inv."
EXTSERV, Z3950_PREFIX.9.1000.81.1, "Admin"
TAGSET, Z3950_PREFIX.14.1000.81.1, "thesaurus-tagset"
TAGSET, Z3950_PREFIX.14.1000.81.2, "Explain-tagset"
TAGSET, Z3950_PREFIX.14.8, "Zthes-tagset"
-NEGOT, Z3950_PREFIX.15.3, "CharSetandLanguageNegotiation-3"
-NEGOT, Z3950_PREFIX.15.4, "CharSetandLanguageNegotiation-4"
-NEGOT, Z3950_PREFIX.15.1000.81.1, "ID-Charset"
+NEGOT, Z3950_PREFIX.15.3, "Charset-3"
+NEGOT, Z3950_PREFIX.15.4, "Charset-4"
+NEGOT, Z3950_PREFIX.15.1000.81.1, "Charset-ID"
USERINFO, Z3950_PREFIX.16.2, "CQL"
GENERAL, 1.0.10646.1.0.2, "UCS-2"
GENERAL, 1.0.10646.1.0.4, "UCS-4"
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: oid_db.c,v 1.4 2007-04-16 08:43:08 adam Exp $
+ * $Id: oid_db.c,v 1.5 2007-04-16 21:53:09 adam Exp $
*/
/**
#include <yaz/oid_util.h>
#include <yaz/oid_db.h>
-struct yaz_oid_entry {
- int oclass;
- int oid[OID_SIZE];
- char *name;
-};
-
-#define Z3950_PREFIX 1, 2, 840, 10003
-
-static struct yaz_oid_entry standard_list[] =
-{
- /* General definitions */
- {CLASS_TRANSYN, {2, 1, 1,-1}, "BER" },
- {CLASS_TRANSYN, {1, 0, 2709, 1, 1,-1}, "ISO2709"},
- {CLASS_GENERAL, {1, 0, 10161, 2, 1,-1}, OID_STR_ILL_1 },
- {CLASS_ABSYN, {2, 1,-1}, "Z-APDU"},
- {CLASS_APPCTX, {1, 1,-1}, "Z-BASIC"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 1,-1}, "Bib-1"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 2,-1}, "Exp-1"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 3,-1}, "Ext-1"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 4,-1}, "CCL-1"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 5,-1}, "GILS"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 5,-1}, "GILS-attset"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 6,-1}, "STAS-attset"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 7,-1}, "Collections-attset"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 8,-1}, "CIMI-attset"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 9,-1}, "Geo-attset"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 10,-1}, "ZBIG"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 11,-1}, "Util"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 12,-1}, "XD-1"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 13,-1}, "Zthes"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 14,-1}, "Fin-1"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 15,-1}, "Dan-1"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 16,-1}, "Holdings"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 17,-1}, "MARC"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 18,-1}, "Bib-2"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3, 19,-1}, "ZeeRex"},
- /* New applications should use Zthes-1 instead of this Satan-spawn */
- {CLASS_ATTSET, {Z3950_PREFIX, 3,1000, 81,1,-1}, "Thesaurus-attset"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3,1000, 81,2,-1}, "IDXPATH"},
- {CLASS_ATTSET, {Z3950_PREFIX, 3,1000, 81,3,-1}, "EXTLITE"},
- {CLASS_DIAGSET, {Z3950_PREFIX, 4, 1,-1}, OID_STR_BIB1},
- {CLASS_DIAGSET, {Z3950_PREFIX, 4, 2,-1}, OID_STR_DIAG1},
- {CLASS_DIAGSET, {Z3950_PREFIX, 4, 3,-1}, "Diag-ES"},
- {CLASS_DIAGSET, {Z3950_PREFIX, 4, 3,-1}, "Diag-General"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 1,-1}, "Unimarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 2,-1}, "Intermarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 3,-1}, "CCF"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 10,-1}, OID_STR_USMARC},
- /* MARC21 is just an alias for the original USmarc */
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 10,-1}, "MARC21"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 11,-1}, "UKmarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 12,-1}, "Normarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 13,-1}, "Librismarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 14,-1}, "Danmarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 15,-1}, "Finmarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 16,-1}, "MAB"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 17,-1}, "Canmarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 18,-1}, "SBN"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 19,-1}, "Picamarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 20,-1}, "Ausmarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 21,-1}, "Ibermarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 22,-1}, "Carmarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 23,-1}, "Malmarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 24,-1}, "JPmarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 25,-1}, "SWEmarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 26,-1}, "SIGLEmarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 27,-1}, "ISDSmarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 28,-1}, "RUSmarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 29,-1}, "Hunmarc"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 30,-1}, "NACSIS-CATP"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 31,-1}, "FINMARC2000"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 32,-1}, "MARC21-fin"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 100,-1}, OID_STR_EXPLAIN},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 101,-1}, OID_STR_SUTRS},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 102,-1}, OID_STR_OPAC},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 103,-1}, OID_STR_SUMMARY},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 104,-1}, "GRS-0"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 105,-1}, OID_STR_GRS1 },
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 106,-1}, OID_STR_EXTENDED},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 107,-1}, "Fragment"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 109,1,-1}, "pdf"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 109,2,-1}, OID_STR_POSTSCRIPT},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 109,3,-1}, OID_STR_HTML},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 109,4,-1}, "tiff"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 109,5,-1}, "gif"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 109,6,-1}, "jpeg"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 109,7,-1}, "png"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 109,8,-1}, "mpeg"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 109,9,-1}, "sgml"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 110,1,-1}, "tiff-b"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 110,2,-1}, "wav"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 111,-1}, "SQL-RS"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 1000, 81, 2,-1}, OID_STR_SOIF},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 109, 10,-1}, OID_STR_XML },
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 109, 10,-1}, "application-XML"},
- {CLASS_RECSYN, {Z3950_PREFIX, 5, 109, 11,-1}, OID_STR_APPLICATION_XML },
- {CLASS_RESFORM, {Z3950_PREFIX, 7, 1,-1}, "Resource-1"},
- {CLASS_RESFORM, {Z3950_PREFIX, 7, 2,-1}, "Resource-2"},
- {CLASS_RESFORM, {Z3950_PREFIX, 7, 1000, 81, 1,-1}, "UNIverse-Resource-Report"},
- {CLASS_ACCFORM, {Z3950_PREFIX, 8, 1,-1}, "Prompt-1"},
- {CLASS_ACCFORM, {Z3950_PREFIX, 8, 2,-1}, "Des-1"},
- {CLASS_ACCFORM, {Z3950_PREFIX, 8, 3,-1}, "Krb-1"},
- {CLASS_EXTSERV, {Z3950_PREFIX, 9, 1,-1}, "Pers. set"},
- {CLASS_EXTSERV, {Z3950_PREFIX, 9, 2,-1}, "Pers. query"},
- {CLASS_EXTSERV, {Z3950_PREFIX, 9, 3,-1}, "Per'd query"},
- {CLASS_EXTSERV, {Z3950_PREFIX, 9, 4,-1}, OID_STR_ITEMORDER },
- {CLASS_EXTSERV, {Z3950_PREFIX, 9, 5,-1}, "DB. Update (first version)"},
- {CLASS_EXTSERV, {Z3950_PREFIX, 9, 5,1,-1}, "DB. Update (second version)"},
- {CLASS_EXTSERV, {Z3950_PREFIX, 9, 5, 1, 1,-1}, OID_STR_EXT_UPDATE},
- {CLASS_EXTSERV, {Z3950_PREFIX, 9, 6,-1}, "exp. spec."},
- {CLASS_EXTSERV, {Z3950_PREFIX, 9, 7,-1}, "exp. inv."},
- {CLASS_EXTSERV, {Z3950_PREFIX, 9, 1000, 81, 1,-1}, OID_STR_ADMIN},
- {CLASS_USERINFO, {Z3950_PREFIX, 10, 1,-1}, OID_STR_SEARCH_RESULT_1},
- {CLASS_USERINFO, {Z3950_PREFIX, 10, 2,-1}, "CharSetandLanguageNegotiation"},
- {CLASS_USERINFO, {Z3950_PREFIX, 10, 3,-1}, OID_STR_USERINFO_1},
- {CLASS_USERINFO, {Z3950_PREFIX, 10, 4,-1}, "MultipleSearchTerms-1"},
- {CLASS_USERINFO, {Z3950_PREFIX, 10, 5,-1}, "MultipleSearchTerms-2"},
- {CLASS_USERINFO, {Z3950_PREFIX, 10, 6,-1}, "DateTime"},
- {CLASS_USERINFO, {Z3950_PREFIX, 10, 1000, 81, 1,-1}, OID_STR_PROXY},
- {CLASS_USERINFO, {Z3950_PREFIX, 10, 1000, 81, 2,-1}, OID_STR_COOKIE},
- {CLASS_USERINFO, {Z3950_PREFIX, 10, 1000, 81, 3,-1}, OID_STR_CLIENT_IP },
- {CLASS_ELEMSPEC, {Z3950_PREFIX, 11, 1,-1}, "Espec-1"},
- {CLASS_VARSET, {Z3950_PREFIX, 12, 1,-1}, OID_STR_VARIANT_1},
- {CLASS_SCHEMA, {Z3950_PREFIX, 13, 1,-1}, "WAIS-schema"},
- {CLASS_SCHEMA, {Z3950_PREFIX, 13, 2,-1}, "GILS-schema"},
- {CLASS_SCHEMA, {Z3950_PREFIX, 13, 3,-1}, "Collections-schema"},
- {CLASS_SCHEMA, {Z3950_PREFIX, 13, 4,-1}, "Geo-schema"},
- {CLASS_SCHEMA, {Z3950_PREFIX, 13, 5,-1}, "CIMI-schema"},
- {CLASS_SCHEMA, {Z3950_PREFIX, 13, 6,-1}, "Update ES"},
- {CLASS_SCHEMA, {Z3950_PREFIX, 13, 7,-1}, "Holdings"},
- {CLASS_SCHEMA, {Z3950_PREFIX, 13, 8,-1}, "Zthes"},
- {CLASS_SCHEMA, {Z3950_PREFIX, 13, 1000, 81, 1,-1}, "thesaurus-schema"},
- {CLASS_SCHEMA, {Z3950_PREFIX, 13, 1000, 81, 2,-1}, "Explain-schema"},
- {CLASS_TAGSET, {Z3950_PREFIX, 14, 1,-1}, "TagsetM"},
- {CLASS_TAGSET, {Z3950_PREFIX, 14, 2,-1}, "TagsetG"},
- {CLASS_TAGSET, {Z3950_PREFIX, 14, 3,-1}, "STAS-tagset"},
- {CLASS_TAGSET, {Z3950_PREFIX, 14, 4,-1}, "GILS-tagset"},
- {CLASS_TAGSET, {Z3950_PREFIX, 14, 5,-1}, "Collections-tagset"},
- {CLASS_TAGSET, {Z3950_PREFIX, 14, 6,-1}, "CIMI-tagset"},
- {CLASS_TAGSET, {Z3950_PREFIX, 14, 1000, 81, 1,-1}, "thesaurus-tagset"},
- {CLASS_TAGSET, {Z3950_PREFIX, 14, 1000, 81, 2,-1}, "Explain-tagset"},
- {CLASS_TAGSET, {Z3950_PREFIX, 14, 8,-1}, "Zthes-tagset"},
- {CLASS_NEGOT, {Z3950_PREFIX, 15, 3,-1}, OID_STR_CHARNEG_3 },
- {CLASS_NEGOT, {Z3950_PREFIX, 15, 4,-1}, OID_STR_CHARNEG_4 },
- {CLASS_NEGOT, {Z3950_PREFIX, 15, 1000, 81, 1, -1}, OID_STR_ID_CHARSET },
- {CLASS_USERINFO, {1, 2, 840, 1003, 16, 2, -1}, "CQL"},
- {CLASS_GENERAL, {1,0,10646,1,0,2,-1}, "UCS-2"},
- {CLASS_GENERAL, {1,0,10646,1,0,4,-1}, "UCS-4"},
- {CLASS_GENERAL, {1,0,10646,1,0,5,-1}, "UTF-16"},
- {CLASS_GENERAL, {1,0,10646,1,0,8,-1}, "UTF-8"},
- {CLASS_USERINFO, {Z3950_PREFIX, 10, 1000, 17, 1, -1}, "OCLC-userInfo"},
- {CLASS_EXTSERV, {Z3950_PREFIX, 9, 1000,105,4,-1}, OID_STR_XMLES },
- {CLASS_NOP, {-1}, 0}
-};
-
struct yaz_oid_db {
- struct yaz_oid_entry *entries;
- struct yaz_oid_db *next;
- int xmalloced;
+ struct yaz_oid_entry *entries;
+ struct yaz_oid_db *next;
+ int xmalloced;
};
struct yaz_oid_db standard_db_l = {
- standard_list, 0, 0
+ yaz_oid_standard_entries, 0, 0
};
-
yaz_oid_db_t standard_db = &standard_db_l;
yaz_oid_db_t yaz_oid_std(void)
if (!oid)
{
struct yaz_oid_entry *ent;
+ int *alloc_oid;
while (oid_db->next)
oid_db = oid_db->next;
oid_db->next = 0;
oid_db->xmalloced = 1;
oid_db->entries = ent = xmalloc(2 * sizeof(*ent));
- ent[0].oclass = oclass;
- oid_oidcpy(ent[0].oid, new_oid);
+
+ alloc_oid = xmalloc(sizeof(*alloc_oid) * (oid_oidlen(new_oid)+1));
+ oid_oidcpy(alloc_oid, new_oid);
+ ent[0].oid = alloc_oid;
ent[0].name = xstrdup(name);
- ent[1].oclass = CLASS_NOP;
- ent[1].oid[0] = -1;
+ ent[0].oclass = oclass;
+
+ ent[1].oid = 0;
ent[1].name = 0;
+ ent[1].oclass = CLASS_NOP;
return 0;
}
return -1;
}
}
-const int *yaz_oid_xml(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_RECSYN, OID_STR_XML);
-}
-
-const int *yaz_oid_application_xml(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_RECSYN,
- OID_STR_APPLICATION_XML);
-}
-const int *yaz_oid_html(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_RECSYN, OID_STR_HTML);
-}
-
-const int *yaz_oid_sutrs(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_RECSYN, OID_STR_SUTRS);
-}
-
-const int *yaz_oid_opac(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_RECSYN, OID_STR_OPAC);
-}
-
-const int *yaz_oid_grs1(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_RECSYN, OID_STR_GRS1);
-}
-
-const int *yaz_oid_postscript(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_RECSYN, OID_STR_POSTSCRIPT);
-}
-
-const int *yaz_oid_explain(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_RECSYN, OID_STR_EXPLAIN);
-}
-
-const int *yaz_oid_extended(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_RECSYN, OID_STR_EXTENDED);
-}
-
-const int *yaz_oid_summary(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_RECSYN, OID_STR_SUMMARY);
-}
-
-const int *yaz_oid_get_usmarc(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_RECSYN, OID_STR_USMARC);
-}
-
-const int *yaz_oid_soif(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_RECSYN, OID_STR_SOIF);
-}
-
-const int *yaz_oid_attset_bib1(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_ATTSET, OID_STR_BIB1);
-}
-
-const int *yaz_oid_diag1(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_DIAGSET, OID_STR_DIAG1);
-}
-
-const int *yaz_oid_proxy(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_USERINFO, OID_STR_PROXY);
-}
-
-const int *yaz_oid_cookie(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_USERINFO, OID_STR_COOKIE);
-}
-
-const int *yaz_oid_search_result_1(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_USERINFO,
- OID_STR_SEARCH_RESULT_1);
-}
-
-const int *yaz_oid_variant1(void)
-{
- return yaz_string_to_oid(yaz_oid_std(), CLASS_VARSET, OID_STR_VARIANT_1);
-}
-
/*
* Local variables:
* c-basic-offset: 4
--- /dev/null
+# This file is part of the YAZ toolkit
+# Copyright (c) Index Data 2006-2007
+# See the file LICENSE for details.
+#
+# $Id: oidtoc.tcl,v 1.1 2007-04-16 21:53:09 adam Exp $
+#
+# Converts a CSV file with Object identifiers to C
+
+proc readoids {input} {
+ set csv [open $input r]
+ set lineno 0
+
+ while {1} {
+ incr lineno
+ set cnt [gets $csv line]
+ if {$cnt < 0} {
+ break
+ }
+ if {![string compare [string index $line 0] \"]} {
+ continue
+ }
+ set tokens [string map {, { }} $line]
+ if {[llength $tokens] != 3} {
+ puts "$input:$lineno: Bad line '$line'"
+ exit 1
+ }
+ lappend oids $tokens
+ }
+ close $csv
+ if {![info exists oids]} {
+ puts "$input:0 No OIDS"
+ exit 1
+ }
+ return $oids
+}
+
+proc oid_to_c {input cfile hfile} {
+ set oids [readoids $input]
+
+ set cfile [open $cfile w]
+ set hfile [open $hfile w]
+
+ puts $cfile "\#include <yaz/oid_db.h>"
+ puts $cfile ""
+ foreach oid $oids {
+ set lname [string tolower [lindex $oid 2]]
+ set lname [string map {- _ . _ { } _ ( {} ) {}} $lname]
+ set prefix [string tolower [lindex $oid 0]]
+
+ puts -nonewline $cfile "const int yaz_oid_${prefix}_${lname}\[\] = \{"
+ puts -nonewline $cfile [string map {. ,} [lindex $oid 1]]
+ puts $cfile ",-1\};"
+
+ puts $hfile "extern const int yaz_oid_${prefix}_${lname}\[\];"
+ }
+
+ puts $cfile "struct yaz_oid_entry yaz_oid_standard_entries\[\] ="
+ puts $cfile "\{"
+ foreach oid $oids {
+ set lname [string tolower [lindex $oid 2]]
+ set lname [string map {- _ . _ { } _ ( {} ) {}} $lname]
+ set prefix [string tolower [lindex $oid 0]]
+
+ puts -nonewline $cfile "\t\{CLASS_[lindex $oid 0], "
+ puts -nonewline $cfile "yaz_oid_${prefix}_${lname}, "
+ puts -nonewline $cfile \"[lindex $oid 2]\"
+ puts $cfile "\},"
+ }
+
+ puts $cfile "\t\{CLASS_NOP, 0, 0\}"
+ puts $cfile "\};"
+
+ puts $hfile "extern struct yaz_oid_entry yaz_oid_standard_entries\[\];"
+ close $cfile
+ close $hfile
+}
+
+if {[llength $argv] != 3} {
+ puts "oidtoc.tcl csv cfile hfile"
+ exit 1
+}
+oid_to_c [lindex $argv 0] [lindex $argv 1] [lindex $argv 2]
\ No newline at end of file
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: pquery.c,v 1.10 2007-04-12 13:52:57 adam Exp $
+ * $Id: pquery.c,v 1.11 2007-04-16 21:53:09 adam Exp $
*/
/**
* \file pquery.c
}
if (!top_set)
{
- top_set = yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_ATTSET, OID_STR_BIB1, o);
+ top_set = odr_oiddup(o, yaz_oid_attset_bib_1);
}
zq->attributeSetId = top_set;
}
if (!top_set)
{
- top_set = yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_ATTSET, OID_STR_BIB1, o);
+ top_set = odr_oiddup(o, yaz_oid_attset_bib_1);
}
*attributeSetP = top_set;
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: prt-ext.c,v 1.9 2007-04-13 09:55:41 adam Exp $
+ * $Id: prt-ext.c,v 1.10 2007-04-16 21:53:09 adam Exp $
*/
/**
*/
thisext->u.grs1 = (Z_GenericRecord*) buf;
- if (!strcmp(oid_str, OID_STR_SUTRS))
+ if (!oid_oidcmp(oid, yaz_oid_recsyn_sutrs))
{
thisext->which = Z_External_sutrs;
}
- else if (!strcmp(oid_str, OID_STR_GRS1))
+ else if (!oid_oidcmp(oid, yaz_oid_recsyn_grs_1))
{
thisext->which = Z_External_grs1;
}
- else if (!strcmp(oid_str, OID_STR_EXPLAIN))
+ else if (!oid_oidcmp(oid, yaz_oid_recsyn_explain))
{
thisext->which = Z_External_explainRecord;
}
- else if (!strcmp(oid_str, OID_STR_SUMMARY))
+ else if (!oid_oidcmp(oid, yaz_oid_recsyn_summary))
{
thisext->which = Z_External_summary;
}
- else if (!strcmp(oid_str, OID_STR_OPAC))
+ else if (!oid_oidcmp(oid, yaz_oid_recsyn_opac))
{
thisext->which = Z_External_OPAC;
}
- else if (!strcmp(oid_str, OID_STR_EXTENDED))
+ else if (!oid_oidcmp(oid, yaz_oid_recsyn_extended))
{
thisext->which = Z_External_extendedService;
}
return 0;
}
}
- else if (!strcmp(oid_str, OID_STR_SUTRS)) /* SUTRS is a single-ASN.1-type */
+ else if (!oid_oidcmp(oid, yaz_oid_recsyn_sutrs)) /* SUTRS is a single-ASN.1-type */
{
Odr_oct *sutrs = (Odr_oct *)odr_malloc(o, sizeof(*sutrs));
Z_External *z_ext_record_xml(ODR o, const char *buf, int len)
{
- const int *oid = yaz_string_to_oid(yaz_oid_std(),
- CLASS_RECSYN, OID_STR_XML);
- return z_ext_record_oid(o, oid, buf, len);
+ return z_ext_record_oid(o, yaz_oid_recsyn_xml, buf, len);
}
Z_External *z_ext_record_sutrs(ODR o, const char *buf, int len)
{
- const int *oid = yaz_string_to_oid(yaz_oid_std(),
- CLASS_RECSYN, OID_STR_SUTRS);
- return z_ext_record_oid(o, oid, buf, len);
+ return z_ext_record_oid(o, yaz_oid_recsyn_sutrs, buf, len);
}
Z_External *z_ext_record_usmarc(ODR o, const char *buf, int len)
{
- const int *oid = yaz_string_to_oid(yaz_oid_std(),
- CLASS_RECSYN, OID_STR_USMARC);
- return z_ext_record_oid(o, oid, buf, len);
+ return z_ext_record_oid(o, yaz_oid_recsyn_usmarc, buf, len);
}
/*
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: seshigh.c,v 1.114 2007-04-12 20:47:28 adam Exp $
+ * $Id: seshigh.c,v 1.115 2007-04-16 21:53:09 adam Exp $
*/
/**
* \file seshigh.c
rr.setname = "default";
rr.number = pos;
rr.referenceId = 0;
- rr.request_format = yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_RECSYN,
- OID_STR_XML,
- assoc->decode);
+ rr.request_format = odr_oiddup(assoc->decode, yaz_oid_recsyn_xml);
+
rr.comp = (Z_RecordComposition *)
odr_malloc(assoc->decode, sizeof(*rr.comp));
rr.comp->which = Z_RecordComp_complex;
static char *get_vhost(Z_OtherInformation *otherInfo)
{
- const int *oid = yaz_string_to_oid(yaz_oid_std(),
- CLASS_USERINFO, OID_STR_PROXY);
- return yaz_oi_get_string_oid(&otherInfo, oid, 1, 0);
+ return yaz_oi_get_string_oid(&otherInfo, yaz_oid_userinfo_proxy, 1, 0);
}
/*
assoc->init->implementation_name,
odr_prepend(assoc->encode, "GFS", resp->implementationName));
- version = odr_strdup(assoc->encode, "$Revision: 1.114 $");
+ version = odr_strdup(assoc->encode, "$Revision: 1.115 $");
if (strlen(version) > 10) /* check for unexpanded CVS strings */
version[strlen(version)-2] = '\0';
resp->implementationVersion = odr_prepend(assoc->encode,
/* Do something with the members of bend_extendedservice */
if (esrequest.taskPackage)
{
- const int *oid = yaz_string_to_oid(yaz_oid_std(),
- CLASS_EXTSERV, OID_STR_EXTENDED);
- resp->taskPackage = z_ext_record_oid(assoc->encode, oid,
- (const char *) esrequest.taskPackage,
- -1);
+ resp->taskPackage = z_ext_record_oid(
+ assoc->encode, yaz_oid_recsyn_extended,
+ (const char *) esrequest.taskPackage, -1
+ );
}
yaz_log(YLOG_DEBUG,"Send the result apdu");
return apdu;
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: sortspec.c,v 1.9 2007-04-12 13:52:57 adam Exp $
+ * $Id: sortspec.c,v 1.10 2007-04-16 21:53:09 adam Exp $
*/
/**
* \file sortspec.c
sk->which = Z_SortKey_sortAttributes;
sk->u.sortAttributes = (Z_SortAttributes *)
odr_malloc (out, sizeof(*sk->u.sortAttributes));
- sk->u.sortAttributes->id =
- yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_ATTSET, OID_STR_BIB1, out);
+ sk->u.sortAttributes->id = odr_oiddup(out, yaz_oid_attset_bib_1);
sk->u.sortAttributes->list = (Z_AttributeList *)
odr_malloc (out, sizeof(*sk->u.sortAttributes->list));
sk->u.sortAttributes->list->attributes = (Z_AttributeElement **)
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: zget.c,v 1.13 2007-04-12 13:52:57 adam Exp $
+ * $Id: zget.c,v 1.14 2007-04-16 21:53:09 adam Exp $
*/
/**
* \file zget.c
Z_DefaultDiagFormat *dr = (Z_DefaultDiagFormat *)
odr_malloc (o, sizeof(*dr));
- dr->diagnosticSetId = yaz_string_to_oid_odr(
- yaz_oid_std(), CLASS_DIAGSET, OID_STR_BIB1, o);
+ dr->diagnosticSetId = odr_oiddup(o, yaz_oid_diagset_bib_1);
dr->condition = odr_intdup(o, error);
dr->which = Z_DefaultDiagFormat_v2Addinfo;
dr->u.v2Addinfo = odr_strdup (o, addinfo ? addinfo : "");
x = (Z_External*) odr_malloc(odr, sizeof *x);
x->descriptor = 0;
x->indirect_reference = 0;
- x->direct_reference = yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_USERINFO,
- OID_STR_USERINFO_1,
- odr);
+ x->direct_reference = odr_oiddup(odr, yaz_oid_userinfo_userinfo_1);
x->which = Z_External_userInfo1;
u = odr_malloc(odr, sizeof *u);
l->information.externallyDefinedInfo = x2;
x2->descriptor = 0;
x2->indirect_reference = 0;
- x2->direct_reference = yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_DIAGSET,
- OID_STR_DIAG1,
- odr);
+ x2->direct_reference = odr_oiddup(odr, yaz_oid_diagset_diag_1);
x2->which = Z_External_diag1;
d = (Z_DiagnosticFormat*) odr_malloc(odr, sizeof *d);
x2->descriptor = 0;
x2->indirect_reference = 0;
- x2->direct_reference = yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_DIAGSET,
- OID_STR_DIAG1,
- odr);
+ x2->direct_reference = odr_oiddup(odr, yaz_oid_diagset_diag_1);
x2->which = Z_External_diag1;
d = (Z_DiagnosticFormat*) odr_malloc(odr, sizeof *d);
x = (Z_External*) odr_malloc(odr, sizeof *x);
x->descriptor = 0;
x->indirect_reference = 0;
- x->direct_reference = yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_USERINFO,
- OID_STR_USERINFO_1,
- odr);
-
+ x->direct_reference = odr_oiddup(odr, yaz_oid_userinfo_userinfo_1);
x->which = Z_External_octet;
x->u.octet_aligned = (Odr_oct *) odr_malloc(odr, sizeof(Odr_oct));
x->u.octet_aligned->buf = odr_malloc(odr, octet_len);
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: zoom-c.c,v 1.124 2007-04-13 09:55:41 adam Exp $
+ * $Id: zoom-c.c,v 1.125 2007-04-16 21:53:09 adam Exp $
*/
/**
* \file zoom-c.c
assert(a);
if (c->cookie_out)
{
- const int *oid = yaz_string_to_oid(
- yaz_oid_std(), CLASS_USERINFO, OID_STR_COOKIE);
Z_OtherInformation **oi;
yaz_oi_APDU(a, &oi);
- yaz_oi_set_string_oid(oi, out, oid, 1, c->cookie_out);
+ yaz_oi_set_string_oid(oi, out, yaz_oid_userinfo_cookie,
+ 1, c->cookie_out);
}
if (c->client_IP)
{
- const int *oid = yaz_string_to_oid(
- yaz_oid_std(), CLASS_USERINFO, OID_STR_CLIENT_IP);
Z_OtherInformation **oi;
yaz_oi_APDU(a, &oi);
- yaz_oi_set_string_oid(oi, out, oid, 1, c->client_IP);
+ yaz_oi_set_string_oid(oi, out, yaz_oid_userinfo_client_ip,
+ 1, c->client_IP);
}
otherInfo_attach(c, a, out);
if (!z_APDU(out, &a, 0, 0))
odr_prepend(c->odr_out, "ZOOM-C",
ireq->implementationName));
- version = odr_strdup(c->odr_out, "$Revision: 1.124 $");
+ version = odr_strdup(c->odr_out, "$Revision: 1.125 $");
if (strlen(version) > 10) /* check for unexpanded CVS strings */
version[strlen(version)-2] = '\0';
ireq->implementationVersion =
}
if (c->proxy)
{
- const int *oid = yaz_string_to_oid(
- yaz_oid_std(), CLASS_USERINFO, OID_STR_CLIENT_IP);
yaz_oi_set_string_oid(&ireq->otherInfo, c->odr_out,
- oid, 1, c->host_port);
+ yaz_oid_userinfo_proxy, 1, c->host_port);
}
if (c->charset || c->lang)
{
ZOOM_options_set(scan->options, key, val);
}
-static Z_APDU *create_es_package(ZOOM_package p, const char *type)
+static Z_APDU *create_es_package(ZOOM_package p, const int *oid)
{
const char *str;
Z_APDU *apdu = zget_APDU(p->odr_out, Z_APDU_extendedServicesRequest);
if (str)
req->userId = odr_strdup(p->odr_out, str);
- req->packageType = yaz_string_to_oid_odr(yaz_oid_std(), CLASS_EXTSERV,
- type, p->odr_out);
+ req->packageType = odr_oiddup(p->odr_out, oid);
str = ZOOM_options_get(p->options, "function");
if (str)
char *illRequest_buf = odr_getbuf(out, &illRequest_size, 0);
r = (Z_External *) odr_malloc(out, sizeof(*r));
- r->direct_reference = yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_GENERAL,
- OID_STR_ILL_1,
- out);
+ r->direct_reference = odr_oiddup(out, yaz_oid_general_isoill_1);
r->indirect_reference = 0;
r->descriptor = 0;
r->which = Z_External_single;
Z_ESAdminOriginPartToKeep **toKeepP,
Z_ESAdminOriginPartNotToKeep **notToKeepP)
{
- Z_APDU *apdu = create_es_package(p, OID_STR_ADMIN);
+ Z_APDU *apdu = create_es_package(p, yaz_oid_extserv_admin);
if (apdu)
{
Z_ESAdminOriginPartToKeep *toKeep;
if (num_db > 0)
first_db = db[0];
- r->direct_reference =
- yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_EXTSERV, OID_STR_ADMIN, p->odr_out);
+ r->direct_reference = odr_oiddup(p->odr_out, yaz_oid_extserv_admin);
r->descriptor = 0;
r->indirect_reference = 0;
r->which = Z_External_ESAdmin;
static Z_APDU *create_xmlupdate_package(ZOOM_package p)
{
- Z_APDU *apdu = create_es_package(p, OID_STR_XMLES);
+ Z_APDU *apdu = create_es_package(p, yaz_oid_extserv_xml_es);
Z_ExtendedServicesRequest *req = apdu->u.extendedServicesRequest;
Z_External *ext = (Z_External *) odr_malloc(p->odr_out, sizeof(*ext));
const char *doc = ZOOM_options_get(p->options, "doc");
else
return 0;
- apdu = create_es_package(p, OID_STR_EXT_UPDATE);
+ apdu = create_es_package(p, yaz_oid_extserv_database_update);
if (apdu)
{
Z_IUOriginPartToKeep *toKeep;
apdu->u.extendedServicesRequest->taskSpecificParameters = r;
- r->direct_reference =
- yaz_string_to_oid_odr(yaz_oid_std(), CLASS_EXTSERV,
- OID_STR_EXT_UPDATE, p->odr_out);
+ r->direct_reference = odr_oiddup(p->odr_out,
+ yaz_oid_extserv_database_update);
r->descriptor = 0;
r->which = Z_External_update;
r->indirect_reference = 0;
p->buf_out = 0;
if (!strcmp(type, "itemorder"))
{
- apdu = create_es_package(p, OID_STR_ITEMORDER);
+ apdu = create_es_package(p, yaz_oid_extserv_item_order);
if (apdu)
{
Z_External *r = (Z_External *) odr_malloc(p->odr_out, sizeof(*r));
- r->direct_reference =
- yaz_string_to_oid_odr(yaz_oid_std(), CLASS_EXTSERV,
- OID_STR_ITEMORDER, p->odr_out);
+ r->direct_reference =
+ odr_oiddup(p->odr_out, yaz_oid_extserv_item_order);
r->descriptor = 0;
r->which = Z_External_itemOrder;
r->indirect_reference = 0;
}
else
{
- const int *oid = yaz_string_to_oid(yaz_oid_std(),
- CLASS_USERINFO,
- OID_STR_COOKIE);
char *cookie =
yaz_oi_get_string_oid(&apdu->u.initResponse->otherInfo,
- oid, 1, 0);
+ yaz_oid_userinfo_cookie, 1, 0);
xfree(c->cookie_in);
c->cookie_in = 0;
if (cookie)
odr_malloc(c->odr_in, sizeof(Z_External));
npr->u.databaseRecord->descriptor = 0;
npr->u.databaseRecord->direct_reference =
- yaz_string_to_oid_odr(yaz_oid_std(), CLASS_RECSYN, OID_STR_XML,
- c->odr_in);
+ odr_oiddup(c->odr_in, yaz_oid_recsyn_xml);
npr->u.databaseRecord->which = Z_External_octet;
npr->u.databaseRecord->u.octet_aligned = (Odr_oct *)
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: ztest.c,v 1.87 2007-04-13 09:55:41 adam Exp $
+ * $Id: ztest.c,v 1.88 2007-04-16 21:53:09 adam Exp $
*/
/*
&oclass, oid_name_str);
if (oid_name)
yaz_log(log_level, "OID %s", oid_name);
- if (oid_name && !strcmp(oid_name, OID_STR_XML))
+ if (!oid_oidcmp(r->direct_reference, yaz_oid_recsyn_xml))
{
yaz_log (log_level, "ILL XML request");
if (r->which == Z_External_octet)
yaz_log (log_level, "%.*s", r->u.octet_aligned->len,
r->u.octet_aligned->buf);
}
- if (oid_name && !strcmp(oid_name, OID_STR_ILL_1))
+ if (!oid_oidcmp(r->direct_reference,
+ yaz_oid_general_isoill_1))
{
yaz_log (log_level, "Decode ItemRequest begin");
if (r->which == ODR_EXTERNAL_single)
int oclass;
char oid_str_buf[OID_STR_MAX];
const char *oid_str = 0;
+ const int *oid = r->request_format;
r->last_in_set = 0;
r->basename = "Default";
r->output_format = r->request_format;
- oid_str = yaz_oid_to_string_buf(r->request_format, &oclass,
- oid_str_buf);
-
- if (oid_str && !strcmp(oid_str, OID_STR_SUTRS))
+ oid_str = yaz_oid_to_string_buf(oid, &oclass, oid_str_buf);
+
+ if (oid && !oid_oidcmp(oid, yaz_oid_recsyn_sutrs))
{
/* this section returns a small record */
char buf[100];
r->record = (char *) odr_malloc (r->stream, r->len+1);
strcpy(r->record, buf);
}
- else if (oid_str && !strcmp(oid_str, OID_STR_GRS1))
+ else if (oid && !oid_oidcmp(oid, yaz_oid_recsyn_grs_1))
{
r->len = -1;
r->record = (char*) dummy_grs_record(r->number, r->stream);
return 0;
}
}
- else if (oid_str && !strcmp(oid_str, OID_STR_POSTSCRIPT))
+ else if (oid && !oid_oidcmp(oid, yaz_oid_recsyn_postscript))
{
char fname[20];
FILE *f;
fread (r->record, size, 1, f);
fclose (f);
}
- else if (oid_str && !strcmp(oid_str, OID_STR_XML))
+ else if (oid && !oid_oidcmp(oid, yaz_oid_recsyn_xml))
{
if ((cp = dummy_xml_record (r->number, r->stream)))
{
{
r->len = strlen(cp);
r->record = cp;
- r->output_format = yaz_string_to_oid_odr(
- yaz_oid_std(), CLASS_RECSYN, OID_STR_USMARC, r->stream);
+ r->output_format = odr_oiddup(r->stream, yaz_oid_recsyn_usmarc);
}
else
{