2 * Copyright (c) 1998-2000, Index Data.
3 * See the file LICENSE for details.
5 * $Id: yaz-pdu-assoc.h,v 1.9 2000-09-12 12:09:53 adam Exp $
8 #include <yaz/comstack.h>
9 #include <yaz-socket-observer.h>
10 #include <yaz-pdu-observer.h>
12 /** Simple Protocol Data Unit Assocation.
13 This object sends - and receives PDU's using the COMSTACK
14 network utility. To use the association in client role, use
15 the method connect. The server role is initiated by using the
18 class YAZ_EXPORT Yaz_PDU_Assoc : public IYaz_PDU_Observable, IYazSocketObserver {
20 enum { Connecting, Listen, Ready, Closed } m_state;
23 PDU_Queue(const char *buf, int len);
24 PDU_Queue::~PDU_Queue();
29 Yaz_PDU_Assoc *m_parent;
30 Yaz_PDU_Assoc *m_children;
31 Yaz_PDU_Assoc *m_next;
32 COMSTACK Yaz_PDU_Assoc::comstack();
34 IYazSocketObservable *m_socketObservable;
35 IYaz_PDU_Observer *m_PDU_Observer;
38 PDU_Queue *m_queue_out;
39 int Yaz_PDU_Assoc::flush_PDU();
44 /// Create object using specified socketObservable
45 Yaz_PDU_Assoc(IYazSocketObservable *socketObservable);
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 /// open with existing socket
57 void socket(IYaz_PDU_Observer *observer, int fd);
58 /// Socket notification
59 void socketNotify(int event);
65 void idleTime (int timeout);
67 virtual void childNotify(int fd);