2 * Copyright (c) 2004, Index Data.
3 * See the file LICENSE for details.
5 * $Id: test-init-06.cpp,v 1.1 2004-03-25 23:14:07 adam Exp $
12 Zlint_test_init_06::Zlint_test_init_06()
16 Zlint_test_init_06::~Zlint_test_init_06()
20 Zlint_code Zlint_test_init_06::init(Zlint *z)
23 Z_APDU *apdu = z->create_Z_PDU(Z_APDU_initRequest);
24 Z_InitRequest *init = apdu->u.initRequest;
26 z->msg_check_for("for init options");
28 /* set all options.. see what target really supports .. */
29 ODR_MASK_SET(init->protocolVersion, Z_ProtocolVersion_3);
30 ODR_MASK_ZERO(init->options);
32 for (i = 0; i <= 24; i++)
33 ODR_MASK_SET(init->options, i);
35 int r = z->send_Z_PDU(apdu, &len);
38 z->msg_check_fail("unable to send init request");
44 Zlint_code Zlint_test_init_06::recv_gdu(Zlint *z, Z_GDU *gdu)
46 if (gdu->which == Z_GDU_Z3950 &&
47 gdu->u.z3950 && gdu->u.z3950->which == Z_APDU_initResponse)
49 Z_InitResponse *init = gdu->u.z3950->u.initResponse;
50 int ver = z->initResponseGetVersion(init);
51 int result = init->result ? *init->result : 0;
58 for (i = 0; i <= 24; i++)
59 if (ODR_MASK_GET(init->options, i))
65 z->msg_check_fail("suspicuously few option bits set");
70 z->msg_check_fail("suspicuously many option bits set");
77 z->msg_check_fail("did not receive init response as expected");