metaproxy  1.13.0
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)
 
bool 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

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

Referenced by build_sru_explain().

bool metaproxy_1::util::build_sru_debug_package ( metaproxy_1::Package &  package)
bool 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 94 of file sru_util.cpp.

References build_esn_from_schema(), build_sru_response(), check_sru_query_exists(), metaproxy_1::util::SRUServerInfo::database, decode_sru_request(), metaproxy_1::util::SRUServerInfo::host, metaproxy_1::util::SRUServerInfo::port, and xmlns_explain().

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

Here is the call graph for this function:

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 
)

Referenced by build_sru_explain().

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 
)

Referenced by build_sru_explain().

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 
)

Referenced by build_sru_explain().

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