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.3 1999-02-02 14:01:13 adam
8 * First WIN32 port of YAZ++.
10 * Revision 1.2 1999/01/28 13:08:40 adam
11 * Yaz_PDU_Assoc better encapsulated. Memory leak fix in
12 * yaz-socket-manager.cc.
14 * Revision 1.1.1.1 1999/01/28 09:41:07 adam
15 * First implementation of YAZ++.
20 #include <yaz-socket-observer.h>
21 #include <yaz-pdu-observer.h>
23 /** Simple Protocol Data Unit Assocation.
24 This object sends - and receives PDU's using the COMSTACK
25 network utility. To use the association in client role, use
26 the method connect. The server role is initiated by using the
29 class YAZ_EXPORT Yaz_PDU_Assoc : public IYaz_PDU_Observable, IYazSocketObserver {
31 enum { Connecting, Connected, Listen, Ready, Closed } m_state;
34 PDU_Queue(const char *buf, int len);
35 PDU_Queue::~PDU_Queue();
40 Yaz_PDU_Assoc *m_parent;
41 Yaz_PDU_Assoc *m_children;
42 Yaz_PDU_Assoc *m_next;
43 COMSTACK Yaz_PDU_Assoc::comstack();
45 IYazSocketObservable *m_socketObservable;
46 IYaz_PDU_Observer *m_PDU_Observer;
49 PDU_Queue *m_queue_out;
50 int Yaz_PDU_Assoc::flush_PDU();
53 /// Create object using specified socketObservable
54 Yaz_PDU_Assoc(IYazSocketObservable *socketObservable, COMSTACK cs);
55 /// Close socket and destroy object.
56 virtual ~Yaz_PDU_Assoc();
58 IYaz_PDU_Observable *clone();
60 int send_PDU(const char *buf, int len);
61 /// connect to server (client role)
62 void connect(IYaz_PDU_Observer *observer, const char *addr);
63 /// listen for clients (server role)
64 void listen(IYaz_PDU_Observer *observer, const char *addr);
65 /// Socket notification
66 void socketNotify(int event);