* Copyright (c) 1998-2000, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-z-assoc.h,v 1.1 2000-10-11 11:58:16 adam Exp $
+ * $Id: yaz-z-assoc.h,v 1.2 2001-04-25 18:59:30 adam Exp $
*/
#ifndef YAZ_Z_ASSOC_INCLUDED
int oidval, int categoryValue,
const char *str);
- Z_ReferenceId* getRefID(char* str);
+ Z_ReferenceId *getRefID(char* str);
+ Z_ReferenceId **get_referenceIdP(Z_APDU *apdu);
+ void transfer_referenceId(Z_APDU *from, Z_APDU *to);
const char *get_hostname();
* See the file LICENSE for details.
*
* $Log: yaz-z-assoc.cpp,v $
- * Revision 1.19 2001-03-27 14:47:45 adam
+ * Revision 1.20 2001-04-25 18:59:30 adam
+ * Added referenceId handling for server.
+ *
+ * Revision 1.19 2001/03/27 14:47:45 adam
* New server facility scheme.
*
* Revision 1.18 2001/03/26 14:43:49 adam
return apdu;
}
+Z_ReferenceId **Yaz_Z_Assoc::get_referenceIdP(Z_APDU *apdu)
+{
+ switch (apdu->which)
+ {
+ case Z_APDU_initRequest:
+ return &apdu->u.initRequest->referenceId;
+ case Z_APDU_initResponse:
+ return &apdu->u.initResponse->referenceId;
+ case Z_APDU_searchRequest:
+ return &apdu->u.searchRequest->referenceId;
+ case Z_APDU_searchResponse:
+ return &apdu->u.searchResponse->referenceId;
+ case Z_APDU_presentRequest:
+ return &apdu->u.presentRequest->referenceId;
+ case Z_APDU_presentResponse:
+ return &apdu->u.presentResponse->referenceId;
+ case Z_APDU_deleteResultSetRequest:
+ return &apdu->u.deleteResultSetRequest->referenceId;
+ case Z_APDU_deleteResultSetResponse:
+ return &apdu->u.deleteResultSetResponse->referenceId;
+ case Z_APDU_accessControlRequest:
+ return &apdu->u.accessControlRequest->referenceId;
+ case Z_APDU_accessControlResponse:
+ return &apdu->u.accessControlResponse->referenceId;
+ case Z_APDU_resourceControlRequest:
+ return &apdu->u.resourceControlRequest->referenceId;
+ case Z_APDU_resourceControlResponse:
+ return &apdu->u.resourceControlResponse->referenceId;
+ case Z_APDU_triggerResourceControlRequest:
+ return &apdu->u.triggerResourceControlRequest->referenceId;
+ case Z_APDU_resourceReportRequest:
+ return &apdu->u.resourceReportRequest->referenceId;
+ case Z_APDU_resourceReportResponse:
+ return &apdu->u.resourceReportResponse->referenceId;
+ case Z_APDU_scanRequest:
+ return &apdu->u.scanRequest->referenceId;
+ case Z_APDU_scanResponse:
+ return &apdu->u.scanResponse->referenceId;
+ case Z_APDU_sortRequest:
+ return &apdu->u.sortRequest->referenceId;
+ case Z_APDU_sortResponse:
+ return &apdu->u.sortResponse->referenceId;
+ case Z_APDU_segmentRequest:
+ return &apdu->u.segmentRequest->referenceId;
+ case Z_APDU_extendedServicesRequest:
+ return &apdu->u.extendedServicesRequest->referenceId;
+ case Z_APDU_extendedServicesResponse:
+ return &apdu->u.extendedServicesResponse->referenceId;
+ case Z_APDU_close:
+ return &apdu->u.close->referenceId;
+ }
+ return 0;
+}
+
+void Yaz_Z_Assoc::transfer_referenceId(Z_APDU *from, Z_APDU *to)
+{
+ Z_ReferenceId **id_from = get_referenceIdP(from);
+ Z_ReferenceId **id_to = get_referenceIdP(to);
+ if (id_from && *id_from && id_to)
+ {
+ *id_to = (Z_ReferenceId*) odr_malloc (m_odr_out, sizeof(**id_to));
+ (*id_to)->size = (*id_to)->len = (*id_from)->len;
+ (*id_to)->buf = (unsigned char*) odr_malloc (m_odr_out, (*id_to)->len);
+ memcpy ((*id_to)->buf, (*id_from)->buf, (*id_to)->len);
+ }
+ else if (id_to)
+ *id_to = 0;
+}
+
int Yaz_Z_Assoc::send_Z_PDU(Z_APDU *apdu)
{
char *buf;
* See the file LICENSE for details.
*
* $Log: yaz-z-server-sr.cpp,v $
- * Revision 1.2 2001-04-04 14:02:49 adam
+ * Revision 1.3 2001-04-25 18:59:30 adam
+ * Added referenceId handling for server.
+ *
+ * Revision 1.2 2001/04/04 14:02:49 adam
* URSULA / Z-ruth service.
*
* Revision 1.1 2001/03/27 15:02:14 adam
case Z_APDU_searchRequest:
yaz_log (LOG_LOG, "got SearchRequest p=%p", this);
apdu_response = s->create_Z_PDU(Z_APDU_searchResponse);
+ s->transfer_referenceId(apdu_request, apdu_response);
sr_search (apdu_request->u.searchRequest,
apdu_response->u.searchResponse);
if (!apdu_response->u.searchResponse->records)
case Z_APDU_presentRequest:
yaz_log (LOG_LOG, "got PresentRequest p=%p", this);
apdu_response = s->create_Z_PDU(Z_APDU_presentResponse);
+ s->transfer_referenceId(apdu_request, apdu_response);
sr_present (apdu_request->u.presentRequest,
apdu_response->u.presentResponse);
if (!apdu_response->u.presentResponse->records)