2 * Copyright (c) 1998-1999, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: yaz-pdu-assoc.h,v 1.6 1999-11-10 10:02:34 adam Exp $
10 #include <yaz-socket-observer.h>
11 #include <yaz-pdu-observer.h>
13 /** Simple Protocol Data Unit Assocation.
14 This object sends - and receives PDU's using the COMSTACK
15 network utility. To use the association in client role, use
16 the method connect. The server role is initiated by using the
19 class YAZ_EXPORT Yaz_PDU_Assoc : public IYaz_PDU_Observable, IYazSocketObserver {
21 enum { Connecting, Connected, Listen, Ready, Closed } m_state;
24 PDU_Queue(const char *buf, int len);
25 PDU_Queue::~PDU_Queue();
30 Yaz_PDU_Assoc *m_parent;
31 Yaz_PDU_Assoc *m_children;
32 Yaz_PDU_Assoc *m_next;
33 COMSTACK Yaz_PDU_Assoc::comstack();
35 IYazSocketObservable *m_socketObservable;
36 IYaz_PDU_Observer *m_PDU_Observer;
39 PDU_Queue *m_queue_out;
40 int Yaz_PDU_Assoc::flush_PDU();
44 /// Create object using specified socketObservable
45 Yaz_PDU_Assoc(IYazSocketObservable *socketObservable, COMSTACK cs = 0);
46 /// Close socket and destroy object.
47 virtual ~Yaz_PDU_Assoc();
49 IYaz_PDU_Observable *clone();
51 int send_PDU(const char *buf, int len);
52 /// connect to server (client role)
53 void connect(IYaz_PDU_Observer *observer, const char *addr);
54 /// listen for clients (server role)
55 void listen(IYaz_PDU_Observer *observer, const char *addr);
56 /// Socket notification
57 void socketNotify(int event);
63 void idleTime (int timeout);