Added default parameter for result set name to search and present request.
Commented out forced logging of PDU contents.
Added send_deleteResultSetRequest
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: yaz-ir-assoc.h,v 1.8 1999-12-06 13:52:45 adam Exp $
+ * $Id: yaz-ir-assoc.h,v 1.9 2000-05-10 11:36:58 ian Exp $
*/
#include <yaz-z-assoc.h>
const char *get_cookie();
/// Send Services
- int send_initRequest();
- int send_searchRequest(Yaz_Z_Query *query);
- int send_presentRequest(int start, int number);
+ int send_initRequest(char* pRefId=NULL);
+ int send_searchRequest(Yaz_Z_Query *query, char* pResultSetId = NULL, char* pRefId = NULL);
+ int send_presentRequest(int start, int number, char* pResultSetId = NULL, char* pRefId = NULL);
+ int send_deleteResultSetRequest(char* pResultSetId = NULL, char* pRefId = NULL);
+
/// Recv Services
virtual void recv_initRequest(Z_InitRequest *initRequest);
virtual void recv_initResponse(Z_InitResponse *initResponse);
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: yaz-z-assoc.h,v 1.5 1999-12-06 13:52:45 adam Exp $
+ * $Id: yaz-z-assoc.h,v 1.6 2000-05-10 11:36:58 ian Exp $
*/
#include <yaz/proto.h>
int oidval, int categoryValue,
const char *str);
void set_apdu_log(const char *file);
+
+ Z_ReferenceId* getRefID(char* str);
+
private:
static int yaz_init_flag;
static int yaz_init_func();
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: yaz-ir-assoc.cpp,v $
- * Revision 1.11 1999-12-06 13:52:45 adam
+ * Revision 1.12 2000-05-10 11:36:58 ian
+ * Added default parameters for refid to request functions.
+ * Added default parameter for result set name to search and present request.
+ * Commented out forced logging of PDU contents.
+ * Added send_deleteResultSetRequest
+ *
+ * Revision 1.11 1999/12/06 13:52:45 adam
* Modified for new location of YAZ header files. Experimental threaded
* operation.
*
}
}
-int Yaz_IR_Assoc::send_searchRequest(Yaz_Z_Query *query)
+int Yaz_IR_Assoc::send_searchRequest(Yaz_Z_Query *query,
+ char* pResultSetId,
+ char* pRefId)
{
Z_APDU *apdu = create_Z_PDU(Z_APDU_searchRequest);
Z_SearchRequest *req = apdu->u.searchRequest;
set_otherInformationString(&req->otherInfo, VAL_COOKIE, 1, m_cookie);
assert (req->otherInfo);
}
+
+ if ( pRefId )
+ {
+ req->referenceId = getRefID(pRefId);
+ }
+
+ if ( pResultSetId )
+ {
+ req->resultSetName = pResultSetId;
+ }
+
return send_Z_PDU(apdu);
}
-int Yaz_IR_Assoc::send_presentRequest(int start, int number)
+int Yaz_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;
compo.which = Z_RecordComp_simple;
compo.u.simple = elementSetNames;
}
+
if (m_cookie)
set_otherInformationString(&req->otherInfo, VAL_COOKIE, 1, m_cookie);
+
+ if ( pRefId )
+ {
+ req->referenceId = getRefID(pRefId);
+ }
+
+ if ( pResultSetId )
+ {
+ req->resultSetId = pResultSetId;
+ }
+
return send_Z_PDU(apdu);
}
m_lastReceived = lastReceived;
}
-int Yaz_IR_Assoc::send_initRequest()
+int Yaz_IR_Assoc::send_initRequest(char* pRefId)
{
Z_APDU *apdu = create_Z_PDU(Z_APDU_initRequest);
Z_InitRequest *req = apdu->u.initRequest;
ODR_MASK_SET(req->protocolVersion, Z_ProtocolVersion_2);
ODR_MASK_SET(req->protocolVersion, Z_ProtocolVersion_3);
+ if ( pRefId )
+ {
+ req->referenceId = getRefID(pRefId);
+ }
+
if (m_proxy && m_host)
set_otherInformationString(&req->otherInfo, VAL_PROXY, 1, m_host);
if (m_cookie)
return send_Z_PDU(apdu);
}
+int Yaz_IR_Assoc::send_deleteResultSetRequest(char* pResultSetId = NULL, char* pRefId = NULL)
+{
+ char* ResultSetIds[1];
+
+ Z_APDU *apdu = create_Z_PDU(Z_APDU_deleteResultSetRequest);
+ Z_DeleteResultSetRequest *req = apdu->u.deleteResultSetRequest;
+
+
+ if ( pResultSetId )
+ {
+ *req->deleteFunction = Z_DeleteResultSetRequest_list;
+ req->num_resultSetList = 1;
+ ResultSetIds[0] = pResultSetId;
+ req->resultSetList = ResultSetIds;
+ }
+ else
+ {
+ *req->deleteFunction = Z_DeleteResultSetRequest_all;
+ }
+
+ if ( pRefId )
+ {
+ req->referenceId = getRefID(pRefId);
+ }
+
+ if (m_proxy && m_host)
+ set_otherInformationString(&req->otherInfo, VAL_PROXY, 1, m_host);
+ if (m_cookie)
+ set_otherInformationString(&req->otherInfo, VAL_COOKIE, 1, m_cookie);
+
+
+ return send_Z_PDU(apdu);
+}
+
+
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: yaz-z-assoc.cpp,v $
- * Revision 1.6 1999-12-06 13:52:45 adam
+ * Revision 1.7 2000-05-10 11:36:58 ian
+ * Added default parameters for refid to request functions.
+ * Added default parameter for result set name to search and present request.
+ * Commented out forced logging of PDU contents.
+ * Added send_deleteResultSetRequest
+ *
+ * Revision 1.6 1999/12/06 13:52:45 adam
* Modified for new location of YAZ header files. Experimental threaded
* operation.
*
}
else
{
- z_APDU(m_odr_print, &apdu, 0, "decode");
+ // z_APDU(m_odr_print, &apdu, 0, "decode");
return apdu;
}
}
logf (LOG_LOG, "yaz_Z_Assoc::encode_Z_PDU failed");
return -1;
}
- z_APDU(m_odr_print, &apdu, 0, "encode");
+ // z_APDU(m_odr_print, &apdu, 0, "encode");
*buf = odr_getbuf (m_odr_out, len, 0);
odr_reset (m_odr_out);
return *len;
oid, categoryValue, deleteFlag);
}
+Z_ReferenceId* Yaz_Z_Assoc::getRefID(char* str)
+{
+ Z_ReferenceId* id = NULL;
+
+ if ( str )
+ {
+ id = (Z_ReferenceId*) odr_malloc (m_odr_out, sizeof(*id));
+ id->size = id->len = strlen(str);
+ id->buf = (unsigned char *) str;
+ }
+
+ return id;
+}
+
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: yaz-z-query.cpp,v $
- * Revision 1.6 1999-12-06 13:52:45 adam
+ * Revision 1.7 2000-05-10 11:36:58 ian
+ * Added default parameters for refid to request functions.
+ * Added default parameter for result set name to search and present request.
+ * Commented out forced logging of PDU contents.
+ * Added send_deleteResultSetRequest
+ *
+ * Revision 1.6 1999/12/06 13:52:45 adam
* Modified for new location of YAZ header files. Experimental threaded
* operation.
*
return -1;
if (!z_Query (odr_encode, &query, 0, 0))
return -1;
- z_Query(odr_print, &query, 0, 0);
+ // z_Query(odr_print, &query, 0, 0);
buf = odr_getbuf (odr_encode, &len, 0);
return len;
}