1 /* This file is part of the yazpp toolkit.
2 * Copyright (C) 1998-2012 Index Data and Mike Taylor
3 * See the file LICENSE for details.
13 Zlint_test_init_02::Zlint_test_init_02()
17 Zlint_test_init_02::~Zlint_test_init_02()
21 Zlint_code Zlint_test_init_02::init(Zlint *z)
24 Z_APDU *apdu = z->create_Z_PDU(Z_APDU_initRequest);
25 Z_InitRequest *init = apdu->u.initRequest;
27 z->msg_check_for("for V2 init");
29 ODR_MASK_ZERO(init->protocolVersion);
30 ODR_MASK_SET(init->protocolVersion, Z_ProtocolVersion_1);
31 ODR_MASK_SET(init->protocolVersion, Z_ProtocolVersion_2);
33 int r = z->send_Z_PDU(apdu, &len);
36 z->msg_check_fail("unable to send init request");
42 Zlint_code Zlint_test_init_02::recv_gdu(Zlint *z, Z_GDU *gdu)
44 if (gdu->which == Z_GDU_Z3950 &&
45 gdu->u.z3950 && gdu->u.z3950->which == Z_APDU_initResponse)
47 Z_InitResponse *init = gdu->u.z3950->u.initResponse;
48 int ver = z->initResponseGetVersion(init);
50 z->msg_check_fail("got version %d, expected 2", ver);
54 z->msg_check_fail("did not receive init response as expected");
63 * c-file-style: "Stroustrup"
64 * indent-tabs-mode: nil
66 * vim: shiftwidth=4 tabstop=8 expandtab