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.4 1999-03-23 14:17:57 adam
8 * More work on timeout handling. Work on yaz-client.
10 * Revision 1.3 1999/02/02 14:01:13 adam
11 * First WIN32 port of YAZ++.
13 * Revision 1.2 1999/01/28 13:08:40 adam
14 * Yaz_PDU_Assoc better encapsulated. Memory leak fix in
15 * yaz-socket-manager.cc.
17 * Revision 1.1.1.1 1999/01/28 09:41:07 adam
18 * First implementation of YAZ++.
23 #include <yaz-socket-observer.h>
24 #include <yaz-pdu-observer.h>
26 /** Simple Protocol Data Unit Assocation.
27 This object sends - and receives PDU's using the COMSTACK
28 network utility. To use the association in client role, use
29 the method connect. The server role is initiated by using the
32 class YAZ_EXPORT Yaz_PDU_Assoc : public IYaz_PDU_Observable, IYazSocketObserver {
34 enum { Connecting, Connected, Listen, Ready, Closed } m_state;
37 PDU_Queue(const char *buf, int len);
38 PDU_Queue::~PDU_Queue();
43 Yaz_PDU_Assoc *m_parent;
44 Yaz_PDU_Assoc *m_children;
45 Yaz_PDU_Assoc *m_next;
46 COMSTACK Yaz_PDU_Assoc::comstack();
48 IYazSocketObservable *m_socketObservable;
49 IYaz_PDU_Observer *m_PDU_Observer;
52 PDU_Queue *m_queue_out;
53 int Yaz_PDU_Assoc::flush_PDU();
57 /// Create object using specified socketObservable
58 Yaz_PDU_Assoc(IYazSocketObservable *socketObservable, COMSTACK cs);
59 /// Close socket and destroy object.
60 virtual ~Yaz_PDU_Assoc();
62 IYaz_PDU_Observable *clone();
64 int send_PDU(const char *buf, int len);
65 /// connect to server (client role)
66 void connect(IYaz_PDU_Observer *observer, const char *addr);
67 /// listen for clients (server role)
68 void listen(IYaz_PDU_Observer *observer, const char *addr);
69 /// Socket notification
70 void socketNotify(int event);
76 void idleTime (int timeout);