// Doxygen doesn't like mp::util, so we use this instead
namespace mp_util = metaproxy_1::util;
// Doxygen doesn't like mp::util, so we use this instead
namespace mp_util = metaproxy_1::util;
mp_util::record_composition_to_esn(Z_RecordComposition *comp)
{
if (comp && comp->which == Z_RecordComp_complex)
{
mp_util::record_composition_to_esn(Z_RecordComposition *comp)
{
if (comp && comp->which == Z_RecordComp_complex)
{
std::string mp_util::http_headers_debug(const Z_HTTP_Request &http_req)
{
std::string message("<html>\n<body>\n<h1>"
"Metaproxy SRUtoZ3950 filter"
"</h1>\n");
std::string mp_util::http_headers_debug(const Z_HTTP_Request &http_req)
{
std::string message("<html>\n<body>\n<h1>"
"Metaproxy SRUtoZ3950 filter"
"</h1>\n");
message += "<h3>HTTP Info</h3><br/>\n";
message += "<p>\n";
message += "<b>Method: </b> " + std::string(http_req.method) + "<br/>\n";
message += "<h3>HTTP Info</h3><br/>\n";
message += "<p>\n";
message += "<b>Method: </b> " + std::string(http_req.method) + "<br/>\n";
message += "<b>Content-Length:</b>"
+ mp_util::http_header_value(http_req.headers, "Content-Length")
+ "<br/>\n";
message += "<b>Content-Length:</b>"
+ mp_util::http_header_value(http_req.headers, "Content-Length")
+ "<br/>\n";
-void mp_util::http_response(metaproxy_1::Package &package,
- const std::string &content,
+void mp_util::http_response(metaproxy_1::Package &package,
+ const std::string &content,
- zgdu_res
- = odr.create_HTTP_Response(package.session(),
- zgdu_req->u.HTTP_Request,
+ zgdu_res
+ = odr.create_HTTP_Response(package.session(),
+ zgdu_req->u.HTTP_Request,
//z_HTTP_header_add(odr, &hres->headers,
// "Content-Type", content_type.c_str());
package.response() = zgdu_res;
//z_HTTP_header_add(odr, &hres->headers,
// "Content-Type", content_type.c_str());
package.response() = zgdu_res;
number_to_present = result_set_size;
if (element_set_name && smallSetElementSetNames)
*element_set_name = smallSetElementSetNames;
number_to_present = result_set_size;
if (element_set_name && smallSetElementSetNames)
*element_set_name = smallSetElementSetNames;
bool mp_util::pqf(ODR odr, Z_APDU *apdu, const std::string &q)
{
YAZ_PQF_Parser pqf_parser = yaz_pqf_create();
bool mp_util::pqf(ODR odr, Z_APDU *apdu, const std::string &q)
{
YAZ_PQF_Parser pqf_parser = yaz_pqf_create();
Z_Query *query = (Z_Query *) odr_malloc(odr, sizeof(Z_Query));
query->which = Z_Query_type_1;
query->u.type_1 = rpn;
Z_Query *query = (Z_Query *) odr_malloc(odr, sizeof(Z_Query));
query->which = Z_Query_type_1;
query->u.type_1 = rpn;
Z_InitResponse *initrs, int &error_code, std::string &addinfo)
{
Z_External *uif = initrs->userInformationField;
Z_InitResponse *initrs, int &error_code, std::string &addinfo)
{
Z_External *uif = initrs->userInformationField;
if (unit->which == Z_OtherInfo_externallyDefinedInfo &&
unit->information.externallyDefinedInfo &&
unit->information.externallyDefinedInfo->which ==
if (unit->which == Z_OtherInfo_externallyDefinedInfo &&
unit->information.externallyDefinedInfo &&
unit->information.externallyDefinedInfo->which ==
std::list<std::string> dblist;
split_zurl(zurl, host, dblist);
std::list<std::string> dblist;
split_zurl(zurl, host, dblist);
int reason, const char *addinfo)
{
Z_APDU *apdu = create_APDU(Z_APDU_close, in_apdu);
int reason, const char *addinfo)
{
Z_APDU *apdu = create_APDU(Z_APDU_close, in_apdu);
*apdu->u.close->closeReason = reason;
if (addinfo)
apdu->u.close->diagnosticInformation = odr_strdup(m_odr, addinfo);
*apdu->u.close->closeReason = reason;
if (addinfo)
apdu->u.close->diagnosticInformation = odr_strdup(m_odr, addinfo);
apdu->u.initResponse->implementationName =
odr_prepend(m_odr, "Metaproxy",
apdu->u.initResponse->implementationName);
apdu->u.initResponse->implementationName =
odr_prepend(m_odr, "Metaproxy",
apdu->u.initResponse->implementationName);
rec->which = Z_Records_NSD;
rec->u.nonSurrogateDiagnostic =
zget_DefaultDiagFormat(m_odr, error, addinfo);
rec->which = Z_Records_NSD;
rec->u.nonSurrogateDiagnostic =
zget_DefaultDiagFormat(m_odr, error, addinfo);
{
Z_Records *rec = (Z_Records *) odr_malloc(m_odr, sizeof(Z_Records));
apdu->u.presentResponse->records = rec;
{
Z_Records *rec = (Z_Records *) odr_malloc(m_odr, sizeof(Z_Records));
apdu->u.presentResponse->records = rec;
rec->which = Z_Records_NSD;
rec->u.nonSurrogateDiagnostic =
zget_DefaultDiagFormat(m_odr, error, addinfo);
rec->which = Z_Records_NSD;
rec->u.nonSurrogateDiagnostic =
zget_DefaultDiagFormat(m_odr, error, addinfo);
res->entries->num_nonsurrogateDiagnostics = 1;
res->entries->nonsurrogateDiagnostics = (Z_DiagRec **)
odr_malloc(m_odr, sizeof(Z_DiagRec *));
res->entries->num_nonsurrogateDiagnostics = 1;
res->entries->nonsurrogateDiagnostics = (Z_DiagRec **)
odr_malloc(m_odr, sizeof(Z_DiagRec *));
{
const char *v = z_HTTP_header_lookup(hreq->headers, "Connection");
if (v && !strcmp(v, "Keep-Alive"))
{
const char *v = z_HTTP_header_lookup(hreq->headers, "Connection");
if (v && !strcmp(v, "Keep-Alive"))
hres->version = odr_strdup(m_odr, response_version);
if (keepalive)
z_HTTP_header_add(m_odr, &hres->headers, "Connection", "Keep-Alive");
hres->version = odr_strdup(m_odr, response_version);
if (keepalive)
z_HTTP_header_add(m_odr, &hres->headers, "Connection", "Keep-Alive");
case Z_APDU_initResponse:
return &apdu->u.initResponse->referenceId;
case Z_APDU_searchRequest:
case Z_APDU_initResponse:
return &apdu->u.initResponse->referenceId;
case Z_APDU_searchRequest: