1 /* This file is part of the yazpp toolkit.
2 * Copyright (C) 1998-2009 Index Data and Mike Taylor
3 * See the file LICENSE for details.
10 Zlint_test_init_03::Zlint_test_init_03()
14 Zlint_test_init_03::~Zlint_test_init_03()
18 Zlint_code Zlint_test_init_03::init(Zlint *z)
21 Z_APDU *apdu = z->create_Z_PDU(Z_APDU_initRequest);
22 Z_InitRequest *init = apdu->u.initRequest;
24 z->msg_check_for("for V9 init");
26 ODR_MASK_ZERO(init->protocolVersion);
28 for (i = 0; i< 9; i++)
29 ODR_MASK_SET(init->protocolVersion, i);
31 int r = z->send_Z_PDU(apdu, &len);
34 z->msg_check_fail("unable to send init request");
40 Zlint_code Zlint_test_init_03::recv_gdu(Zlint *z, Z_GDU *gdu)
42 if (gdu->which == Z_GDU_Z3950 &&
43 gdu->u.z3950 && gdu->u.z3950->which == Z_APDU_initResponse)
45 Z_InitResponse *init = gdu->u.z3950->u.initResponse;
46 int ver = z->initResponseGetVersion(init);
48 if (ver < 2 || ver > 5)
49 z->msg_check_fail("%sgot version %d, expected 2-5", ver);
53 z->msg_check_fail("did not receive init response as expected");
61 * c-file-style: "Stroustrup"
62 * indent-tabs-mode: nil
64 * vim: shiftwidth=4 tabstop=8 expandtab