+ get_databaseNames (&req->num_databaseNames, &req->databaseNames);
+ const char *recordSyntax;
+ get_preferredRecordSyntax(&recordSyntax);
+ if (recordSyntax && *recordSyntax)
+ {
+ req->preferredRecordSyntax
+ = yaz_string_to_oid_odr(yaz_oid_std(), CLASS_RECSYN, recordSyntax,
+ odr_encode());
+ }
+ yaz_log (m_log, "send_searchRequest");
+ assert (req->otherInfo == 0);
+ if (m_cookie)
+ {
+ set_otherInformationString(&req->otherInfo, yaz_oid_userinfo_cookie,
+ 1, m_cookie);
+ assert (req->otherInfo);
+ }
+
+ if ( pRefId )
+ {
+ req->referenceId = getRefID(pRefId);
+ }
+
+ if ( pResultSetId )
+ {
+ req->resultSetName = pResultSetId;
+ }
+
+ return send_Z_PDU(apdu, 0);
+}
+
+int IR_Assoc::send_presentRequest(int start,
+ int number,
+ char* pResultSetId,
+ char* pRefId)
+{
+ Z_APDU *apdu = create_Z_PDU(Z_APDU_presentRequest);
+ Z_PresentRequest *req = apdu->u.presentRequest;
+
+ req->resultSetStartPoint = &start;
+ req->numberOfRecordsRequested = &number;
+
+ const char *recordSyntax;
+ get_preferredRecordSyntax (&recordSyntax);
+ if (recordSyntax && *recordSyntax)
+ {
+ req->preferredRecordSyntax =
+ yaz_string_to_oid_odr(yaz_oid_std(), CLASS_RECSYN, recordSyntax,
+ odr_encode());
+ }
+ Z_RecordComposition compo;
+ Z_ElementSetNames *elementSetNames;
+ get_elementSetName (&elementSetNames);
+ if (elementSetNames)
+ {
+ req->recordComposition = &compo;
+ compo.which = Z_RecordComp_simple;
+ compo.u.simple = elementSetNames;
+ }
+
+ if (m_cookie)
+ set_otherInformationString(&req->otherInfo, yaz_oid_userinfo_cookie,
+ 1, m_cookie);
+
+ if ( pRefId )
+ {
+ req->referenceId = getRefID(pRefId);
+ }
+
+ if ( pResultSetId )
+ {
+ req->resultSetId = pResultSetId;
+ }
+
+ return send_Z_PDU(apdu, 0);
+}
+
+void IR_Assoc::set_proxy(const char *str)
+{
+ delete [] m_proxy;
+ m_proxy = 0;
+ if (str)
+ {
+ m_proxy = new char[strlen(str)+1];
+ strcpy (m_proxy, str);
+ }
+}
+
+void IR_Assoc::set_cookie(const char *str)
+{
+ delete [] m_cookie;
+ m_cookie = 0;
+ if (str)
+ {
+ m_cookie = new char[strlen(str)+1];
+ strcpy(m_cookie, str);
+ }
+}
+
+const char *IR_Assoc::get_cookie()
+{
+ return m_cookie;
+}
+
+void IR_Assoc::client(const char *addr)
+{
+ delete [] m_host;
+ m_host = new char[strlen(addr)+1];
+ strcpy(m_host, addr);
+ const char *dbpart = strchr(m_host, '/');
+ if (dbpart)
+ set_databaseNames (dbpart+1, "+ ");
+ Z_Assoc::client(m_proxy ? m_proxy : m_host);
+}
+
+const char *IR_Assoc::get_proxy()
+{
+ return m_proxy;
+}
+
+const char *IR_Assoc::get_host()
+{
+ return m_host;
+}
+
+void IR_Assoc::recv_searchRequest(Z_SearchRequest *searchRequest)
+{
+ Z_APDU *apdu = create_Z_PDU(Z_APDU_searchResponse);
+ send_Z_PDU(apdu, 0);
+}
+
+void IR_Assoc::recv_presentRequest(Z_PresentRequest *presentRequest)
+{
+ Z_APDU *apdu = create_Z_PDU(Z_APDU_presentResponse);
+ send_Z_PDU(apdu, 0);
+}
+
+void IR_Assoc::recv_initRequest(Z_InitRequest *initRequest)
+{
+ Z_APDU *apdu = create_Z_PDU(Z_APDU_initResponse);
+ send_Z_PDU(apdu, 0);
+}
+
+void IR_Assoc::recv_searchResponse (Z_SearchResponse *searchResponse)
+{