2 * Copyright (c) 1998-2005, Index Data.
3 * See the file LICENSE for details.
5 * $Id: gdu.cpp,v 1.2 2005-06-25 15:53:19 adam Exp $
10 using namespace yazpp_1;
12 GDU::GDU(Z_APDU *apdu)
14 ODR encode = odr_createmem(ODR_ENCODE);
15 Z_GDU *gdu = (Z_GDU *) odr_malloc(encode, sizeof(*gdu));
16 gdu->which = Z_GDU_Z3950;
23 base(gdu, odr_createmem(ODR_ENCODE));
26 void GDU::base(Z_GDU *gdu, ODR encode)
28 m_decode = odr_createmem(ODR_DECODE);
30 if (z_GDU(encode, &gdu, 0, "encode"))
33 char *buf = odr_getbuf(encode, &len, 0);
35 odr_setbuf(m_decode, buf, len, 0);
36 z_GDU(m_decode, &m_gdu, 0, 0);
43 odr_destroy(m_decode);
51 void GDU::extract_odr_to(ODR dst)
53 NMEM nmem = odr_extract_mem(m_decode);
55 dst->mem = nmem_create();
56 nmem_transfer(dst->mem, nmem);
70 for (l = m_list; l; l = l->m_next)
75 void GDUQueue::enqueue(GDU *gdu)
77 GDUQueue_List *l = new GDUQueue_List;
83 GDU *GDUQueue::dequeue()
85 GDUQueue_List **l = &m_list;
90 GDU *m = (*l)->m_item;
96 void GDUQueue::clear()
99 while ((g = dequeue()))
103 GDUQueue::~GDUQueue()
110 * indent-tabs-mode: nil
112 * vim: shiftwidth=4 tabstop=8 expandtab