metaproxy 1.22.1
Classes | Functions
metaproxy_1::util Namespace Reference

Classes

class  SRUServerInfo
 

Functions

bool build_sru_debug_package (metaproxy_1::Package &package)
 
SRUServerInfo get_sru_server_info (metaproxy_1::Package &package)
 
void build_sru_explain (metaproxy_1::Package &package, metaproxy_1::odr &odr_en, Z_SRW_PDU *sru_pdu_res, SRUServerInfo sruinfo, const xmlNode *explain=0, Z_SRW_explainRequest const *er_req=0)
 
bool build_sru_response (metaproxy_1::Package &package, metaproxy_1::odr &odr_en, Z_SOAP *soap, const Z_SRW_PDU *sru_pdu_res, char *charset, const char *stylesheet)
 
Z_SRW_PDU * decode_sru_request (metaproxy_1::Package &package, metaproxy_1::odr &odr_de, metaproxy_1::odr &odr_en, Z_SRW_diagnostic **diagnostic, int *num_diagnostic, Z_SOAP **soap, char *charset)
 
bool check_sru_query_exists (metaproxy_1::Package &package, metaproxy_1::odr &odr_en, Z_SRW_PDU *sru_pdu_res, Z_SRW_searchRetrieveRequest const *sr_req)
 
Z_ElementSetNames * build_esn_from_schema (metaproxy_1::odr &odr_en, const char *schema)
 

Function Documentation

◆ build_esn_from_schema()

Z_ElementSetNames * metaproxy_1::util::build_esn_from_schema ( metaproxy_1::odr &  odr_en,
const char *  schema 
)

◆ build_sru_debug_package()

bool metaproxy_1::util::build_sru_debug_package ( metaproxy_1::Package &  package)

◆ build_sru_explain()

void metaproxy_1::util::build_sru_explain ( metaproxy_1::Package &  package,
metaproxy_1::odr &  odr_en,
Z_SRW_PDU *  sru_pdu_res,
SRUServerInfo  sruinfo,
const xmlNode *  explain = 0,
Z_SRW_explainRequest const *  er_req = 0 
)

Definition at line 89 of file sru_util.cpp.

95{
96 // z3950'fy recordPacking
97 int record_packing = Z_SRW_recordPacking_XML;
98 if (er_req && er_req->recordPacking && 's' == *(er_req->recordPacking))
99 record_packing = Z_SRW_recordPacking_string;
100
101 // preparing explain record insert
102 Z_SRW_explainResponse *sru_res = sru_pdu_res->u.explain_response;
103
104 // inserting one and only explain record
105 sru_res->record.recordPosition = odr_intdup(odr_en, 1);
106 sru_res->record.recordPacking = record_packing;
107 sru_res->record.recordSchema = odr_strdup(odr_en, xmlns_explain.c_str());
108
109 if (explain == 0 || explain->doc == 0)
110 {
111 std::string explain_xml
112 = mp_util::to_string(
113 "<explain xmlns=\"" + xmlns_explain + "\">\n"
114 " <serverInfo protocol='SRU'>\n"
115 " <host>")
116 + sruinfo.host
117 + mp_util::to_string("</host>\n"
118 " <port>")
119 + sruinfo.port
120 + mp_util::to_string("</port>\n"
121 " <database>")
122 + sruinfo.database
123 + mp_util::to_string("</database>\n"
124 " </serverInfo>\n"
125 "</explain>\n");
126
127 sru_res->record.recordData_len = explain_xml.size();
128 sru_res->record.recordData_buf = odr_strdup(odr_en, explain_xml.c_str());
129 }
130 else
131 {
132 xmlNode *tmp = xmlCopyNode((xmlNode *) explain, 1);
133 xmlBufferPtr buf = xmlBufferCreate();
134 xmlNodeDump(buf, tmp->doc, tmp, 2, 1);
135 xmlFreeNode(tmp);
136 sru_res->record.recordData_len = buf->use;
137 sru_res->record.recordData_buf = odr_strdupn(odr_en, (const char *) buf->content, buf->use);
138 xmlBufferFree(buf);
139 }
140}
const std::string xmlns_explain("http://explain.z3950.org/dtd/2.0/")

References metaproxy_1::util::SRUServerInfo::database, metaproxy_1::util::SRUServerInfo::host, metaproxy_1::util::SRUServerInfo::port, and xmlns_explain().

Referenced by metaproxy_1::filter::ZeeRexExplain::Impl::process(), and metaproxy_1::filter::SRUtoZ3950::Impl::sru().

Here is the call graph for this function:

◆ build_sru_response()

bool metaproxy_1::util::build_sru_response ( metaproxy_1::Package &  package,
metaproxy_1::odr &  odr_en,
Z_SOAP *  soap,
const Z_SRW_PDU *  sru_pdu_res,
char *  charset,
const char *  stylesheet 
)

◆ check_sru_query_exists()

bool metaproxy_1::util::check_sru_query_exists ( metaproxy_1::Package &  package,
metaproxy_1::odr &  odr_en,
Z_SRW_PDU *  sru_pdu_res,
Z_SRW_searchRetrieveRequest const *  sr_req 
)

◆ decode_sru_request()

Z_SRW_PDU * metaproxy_1::util::decode_sru_request ( metaproxy_1::Package &  package,
metaproxy_1::odr &  odr_de,
metaproxy_1::odr &  odr_en,
Z_SRW_diagnostic **  diagnostic,
int *  num_diagnostic,
Z_SOAP **  soap,
char *  charset 
)

◆ get_sru_server_info()

SRUServerInfo metaproxy_1::util::get_sru_server_info ( metaproxy_1::Package &  package)