Happy new year
[yazpp-moved-to-github.git] / src / yaz-z-server-ill.cpp
1 /* This file is part of the yazpp toolkit.
2  * Copyright (C) 1998-2011 Index Data and Mike Taylor
3  * See the file LICENSE for details.
4  */
5
6 #include <yaz/log.h>
7 #include <yazpp/z-server.h>
8
9 using namespace yazpp_1;
10
11 int Yaz_Facility_ILL::init(Z_Server *s, Z_InitRequest *initRequest,
12                            Z_InitResponse *initResponse)
13 {
14     Z_Options *req = initRequest->options;
15     Z_Options *res = initResponse->options;
16     
17     if (ODR_MASK_GET(req, Z_Options_extendedServices))
18         ODR_MASK_SET(res, Z_Options_extendedServices);
19     return 1;
20 }
21
22 int Yaz_Facility_ILL::recv(Z_Server *s, Z_APDU *apdu_request)
23 {   
24     Z_APDU *apdu_response;
25
26     if (apdu_request->which != Z_APDU_extendedServicesRequest)
27         return 0;
28     Z_ExtendedServicesRequest *req = apdu_request->u.extendedServicesRequest;
29     if (!req->taskSpecificParameters || req->taskSpecificParameters->which !=
30         Z_External_itemOrder)
31         return 0;
32     yaz_log (YLOG_LOG, "got ill p=%p", this);
33     apdu_response = s->create_Z_PDU(Z_APDU_extendedServicesResponse);
34     ill_service(req, req->taskSpecificParameters->u.itemOrder,
35         apdu_response->u.extendedServicesResponse);
36     s->transfer_referenceId(apdu_request, apdu_response);
37     s->send_Z_PDU(apdu_response, 0);
38     return 1;
39 }
40 /*
41  * Local variables:
42  * c-basic-offset: 4
43  * c-file-style: "Stroustrup"
44  * indent-tabs-mode: nil
45  * End:
46  * vim: shiftwidth=4 tabstop=8 expandtab
47  */
48