-/* $Id: yaz-proxy.cpp,v 1.73 2007-04-12 18:18:42 adam Exp $
+/* $Id: yaz-proxy.cpp,v 1.74 2007-04-16 21:54:27 adam Exp $
Copyright (c) 1998-2007, Index Data.
This file is part of the yazproxy.
char *Yaz_Proxy::get_cookie(Z_OtherInformation **otherInfo)
{
- Z_OtherInformationUnit *oi;
- const int *oid = yaz_string_to_oid(yaz_oid_std(),
- CLASS_USERINFO, OID_STR_COOKIE);
+ Z_OtherInformationUnit *oi =
+ update_otherInformation(otherInfo, 0, yaz_oid_userinfo_cookie, 1, 1);
- if (oid &&
- (oi = update_otherInformation(otherInfo, 0, oid, 1, 1)) &&
- oi->which == Z_OtherInfo_characterInfo)
+ if (oi->which == Z_OtherInfo_characterInfo)
return oi->information.characterInfo;
return 0;
}
char *Yaz_Proxy::get_proxy(Z_OtherInformation **otherInfo)
{
- Z_OtherInformationUnit *oi;
- const int *oid = yaz_string_to_oid(yaz_oid_std(),
- CLASS_USERINFO, OID_STR_COOKIE);
- if (oid &&
- (oi = update_otherInformation(otherInfo, 0, oid, 1, 1)) &&
- oi->which == Z_OtherInfo_characterInfo)
+ Z_OtherInformationUnit *oi =
+ update_otherInformation(otherInfo, 0, yaz_oid_userinfo_proxy, 1, 1);
+
+ if (oi->which == Z_OtherInfo_characterInfo)
return oi->information.characterInfo;
return 0;
}
xmlChar *out_buf;
int out_len;
xmlDocDumpFormatMemory (res, &out_buf, &out_len, 1);
- const int *oid = yaz_string_to_oid(yaz_oid_std(),
- CLASS_RECSYN, OID_STR_XML);
m_stylesheet_nprl->records[m_stylesheet_offset]->
u.databaseRecord =
- z_ext_record_oid(odr_encode(), oid,
+ z_ext_record_oid(odr_encode(), yaz_oid_recsyn_xml,
(char*) out_buf, out_len);
xmlFree(out_buf);
xmlFreeDoc(res);
if (!oid)
continue;
- char oid_name_str[OID_STR_MAX];
- int oclass;
- const char *oid_name = yaz_oid_to_string_buf(
- oid, &oclass, oid_name_str);
-
- if (oid_name && !strcmp(oid_name, OID_STR_SUTRS))
+ if (!oid_oidcmp(oid, yaz_oid_recsyn_sutrs))
{
WRBUF w = wrbuf_alloc();
wrbuf_len(w));
wrbuf_destroy(w);
}
- else if (oid_name && !strcmp(oid_name, OID_STR_XML))
+ else if (!oid_oidcmp(oid, yaz_oid_recsyn_xml))
{
;
}
Z_NamePlusRecord *npr = p->records[i];
if (npr->which == Z_NamePlusRecord_databaseRecord)
{
- const int *xml_oid = yaz_string_to_oid(yaz_oid_std(),
- CLASS_RECSYN,
- OID_STR_XML);
Z_External *r = npr->u.databaseRecord;
if (r->which == Z_External_OPAC)
{
yaz_opac_decode_wrbuf(mt, r->u.opac, w);
npr->u.databaseRecord = z_ext_record_oid(
- odr_encode(), xml_oid,
+ odr_encode(), yaz_oid_recsyn_xml,
wrbuf_buf(w), wrbuf_len(w));
wrbuf_destroy(w);
}
&result, &rlen))
{
npr->u.databaseRecord =
- z_ext_record_oid(odr_encode(), xml_oid, result, rlen);
+ z_ext_record_oid(odr_encode(), yaz_oid_recsyn_xml,
+ result, rlen);
}
}
}
}
Z_External *r = npr->u.databaseRecord;
- const int *xml_oid = yaz_string_to_oid(
- yaz_oid_std(), CLASS_RECSYN, OID_STR_XML);
if (r->which == Z_External_octet
- && !oid_oidcmp(r->direct_reference, xml_oid))
+ && !oid_oidcmp(r->direct_reference, yaz_oid_recsyn_xml))
{
srw_res->records[i].recordSchema = m_schema;
srw_res->records[i].recordPacking = m_s2z_packing;
*err = error;
rec->which = Z_Records_NSD;
rec->u.nonSurrogateDiagnostic = dr;
- dr->diagnosticSetId =
- yaz_string_to_oid_odr(yaz_oid_std(), CLASS_DIAGSET, OID_STR_BIB1, odr);
+ dr->diagnosticSetId = odr_oiddup(odr, yaz_oid_diagset_bib_1);
dr->condition = err;
dr->which = Z_DefaultDiagFormat_v2Addinfo;
dr->u.v2Addinfo = odr_strdup (odr, addinfo ? addinfo : "");
sr->preferredRecordSyntax =
yaz_string_to_oid_odr(
yaz_oid_std(), CLASS_RECSYN,
- m_backend_type ? m_backend_type : OID_STR_USMARC,
+ m_backend_type ? m_backend_type : "usmarc",
odr_encode());
}
else if (err)
pr->preferredRecordSyntax =
yaz_string_to_oid_odr(
yaz_oid_std(), CLASS_RECSYN,
- m_backend_type ? m_backend_type : OID_STR_USMARC,
+ m_backend_type ? m_backend_type : "usmarc",
odr_encode());
}
else if (err)
*z_searchRequest->largeSetLowerBound = 2000000000; // 2e9
z_searchRequest->preferredRecordSyntax =
- yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_RECSYN, OID_STR_XML,
- m_s2z_odr_search);
+ odr_oiddup(m_s2z_odr_search, yaz_oid_recsyn_xml);
if (srw_req->recordSchema)
{
*z_presentRequest->numberOfRecordsRequested = max;
z_presentRequest->preferredRecordSyntax =
- yaz_string_to_oid_odr(yaz_oid_std(),
- CLASS_RECSYN, OID_STR_XML,
- m_s2z_odr_search);
-
+ odr_oiddup(m_s2z_odr_search, yaz_oid_recsyn_xml);
if (srw_req->recordSchema)
{
z_presentRequest->recordComposition =
Z_APDU *apdu2 = m_client->m_initResponse;
apdu2->u.initResponse->otherInfo = 0;
if (m_client->m_cookie && *m_client->m_cookie)
- set_otherInformationString(apdu2, OID_STR_COOKIE, 1,
- m_client->m_cookie);
+ set_otherInformationString(apdu2, yaz_oid_userinfo_cookie,
+ 1, m_client->m_cookie);
apdu2->u.initResponse->referenceId =
apdu->u.initRequest->referenceId;
apdu2->u.initResponse->options = m_client->m_initResponse_options;
}
}
if (m_cookie)
- set_otherInformationString (apdu, OID_STR_COOKIE, 1, m_cookie);
+ set_otherInformationString(apdu, yaz_oid_userinfo_cookie, 1, m_cookie);
Yaz_Proxy *server = m_server; // save it. send_to_client may destroy us