2 * Copyright (c) 1998-1999, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Log: yaz-pdu-assoc.h,v $
7 * Revision 1.1 1999-01-28 09:41:07 adam
13 #include <yaz-socket-observer.h>
14 #include <yaz-pdu-observer.h>
16 /** Simple Protocol Data Unit Assocation.
17 This object sends - and receives PDU's using the COMSTACK
18 network utility. To use the association in client role, use
19 the method connect. The server role is initiated by using the
22 class Yaz_PDU_Assoc : public IYaz_PDU_Observable, IYazSocketObserver {
24 enum { Connecting, Connected, Listen, Ready, Closed } m_state;
27 PDU_Queue(const char *buf, int len);
28 PDU_Queue::~PDU_Queue();
33 Yaz_PDU_Assoc *m_parent;
34 Yaz_PDU_Assoc *m_children;
35 Yaz_PDU_Assoc *m_next;
36 COMSTACK Yaz_PDU_Assoc::comstack();
38 IYazSocketObservable *m_socketObservable;
39 IYaz_PDU_Observer *m_PDU_Observer;
42 PDU_Queue *m_queue_out;
43 int Yaz_PDU_Assoc::flush_PDU();
45 /// Create object using specified socketObservable
46 Yaz_PDU_Assoc(IYazSocketObservable *socketObservable, COMSTACK cs);
47 /// Close socket and destroy object.
48 virtual ~Yaz_PDU_Assoc();
50 IYaz_PDU_Observable *clone();
52 int send_PDU(const char *buf, int len);
53 /// connect to server (client role)
54 void connect(IYaz_PDU_Observer *observer, const char *addr);
55 /// listen for clients (server role)
56 void listen(IYaz_PDU_Observer *observer, const char *addr);
57 /// Socket notification
58 void socketNotify(int event);