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.
7 #include <yaz/charneg.h>
8 #include <yaz/otherinfo.h>
12 Zlint_test_init_08::Zlint_test_init_08()
17 Zlint_test_init_08::~Zlint_test_init_08()
21 Zlint_code Zlint_test_init_08::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 init message sizes %d", m_no);
29 /* set all options.. see what target really supports .. */
30 ODR_MASK_SET(init->protocolVersion, Z_ProtocolVersion_3);
32 *init->maximumRecordSize = m_no * m_no * 100000 + 2000;
33 *init->preferredMessageSize = m_no * m_no *100000 + 2000;
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_08::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;
51 if (m_no * m_no * 100000 + 2000 < *init->maximumRecordSize)
52 z->msg_check_fail("maximumRecordSize bigger than proposed size");
53 if (m_no * m_no * 100000 + 2000 < *init->preferredMessageSize)
54 z->msg_check_fail("preferredMessage bigger than proposed size");
63 z->msg_check_fail("did not receive init response as expected");
67 Zlint_code Zlint_test_init_08::recv_fail(Zlint *z, int reason)
69 z->msg_check_fail("target closed connection");
81 * c-file-style: "Stroustrup"
82 * indent-tabs-mode: nil
84 * vim: shiftwidth=4 tabstop=8 expandtab