+
+bool yf::SRUtoZ3950::Rep::build_simple_explain(mp::Package &package,
+ mp::odr &odr_en,
+ Z_SRW_PDU *sru_pdu_res,
+ Z_SRW_explainRequest
+ const *er_req) const
+{
+
+ // z3950'fy recordPacking
+ int record_packing = Z_SRW_recordPacking_XML;
+ if (er_req->recordPacking && 's' == *(er_req->recordPacking))
+ record_packing = Z_SRW_recordPacking_string;
+
+ // getting database info
+ std::string database("Default");
+ if (er_req->database)
+ database = er_req->database;
+
+ // building SRU explain record
+ std::string explain_xml
+ = mp::to_string(
+ "<explain>\n"
+ " <serverInfo protocol='SRU'>\n"
+ " <host>")
+ + package.origin().server_host()
+ + mp::to_string("</host>\n"
+ " <port>")
+ + mp::to_string(package.origin().server_port())
+ + mp::to_string("</port>\n"
+ " <database>")
+ + database
+ + mp::to_string("</database>\n"
+ " </serverInfo>\n"
+ "</explain>\n");
+
+
+ // preparing explain record insert
+ Z_SRW_explainResponse *sru_res = sru_pdu_res->u.explain_response;
+ //sru_res->record
+ // = (Z_SRW_record *) odr_malloc(odr_en, sizeof(Z_SRW_record));
+
+ // inserting one and only explain record
+
+ sru_res->record.recordPosition = odr_intdup(odr_en, 1);
+ sru_res->record.recordPacking = record_packing;
+ sru_res->record.recordSchema = "http://explain.z3950.org/dtd/2.0/";
+ sru_res->record.recordData_len = 1 + explain_xml.size();
+ sru_res->record.recordData_buf
+ = odr_strdupn(odr_en, (const char *)explain_xml.c_str(),
+ 1 + explain_xml.size());
+
+ return true;
+};
+
+