Debian Codegraph @

protolib/src/sim/ns/tcp/TCPEvent.h

raw
1 #ifndef _TCPEvent
2 #define _TCPEvent
3
4 #include "app.h"
5
6 /**
7 * TCPEvent.h: is a container for events created through a typical TCP session. Some
8 * events are generated during the negotiation of a connection, whilst others are generated when
9 * data is received or when data is sent and the output buffer is ready for writing to again. The
10 * following events are supported:
11 *
12 * <ol>
13 *
14 * <li> <bf>ACCEPT:</bf> this is generated when a server receives a SYN from a client to request
15 * a connection. An application normally responds by invoking the accept() method call in
16 * order to accept the incoming connection request.
17 *
18 * <li> <bf>CONNECTED:</bf> This is generated on the client once they receive the ACK in response to
19 * a SYN connection request. Once the ACK is returned from the server, it is assumed that the
20 * server has accepted the connection. A connected event is also fired after a server has accepted
21 * a connection.
22 *
23 * <li> <bf>SEND:</bf> a send event is generated for a client or serv er to indicate that the output buffer has
24 * been emptied and is ready to accomodate new data i.e. the client or server can now SEND data.
25 *
26 * <li> <bf>RECEIVE:</bf> a RECEIVE event is generated when data has been received at the client or server.
27 *
28 * <li> <bf>DISCONNECT:</bf> is generated when a socket has been disconnected.
29 *
30 * </ol>
31 *
32 * Created by Ian Taylor on 11/01/2007.
33 *
34 */
35 class TCPEvent {
36
37 public:
38 enum Event {ACCEPT, CONNECTED, SEND, RECEIVE, DISCONNECTED, SENDACK};
39
40 TCPEvent(Event theType, void *source, void *theData, int dataSize);
41
42 void setSourceObject(void *source) { sourceObject=source; }
43 void setFlags(int theflags) { flags=theflags; }
44
45 void *getData() { return data;}
46 void *getSource() { return sourceObject;}
47 int getDataSize() { return dataSize;}
48 int getFlags() { return flags;}
49 Event getType() { return type;}
50
51 private:
52 void *sourceObject;
53 void *data;
54 Event type;
55 int dataSize;
56 int flags;
57 };
58
59
60 /**
61 * TCPSocketAgentListener.h
62 * FullerTCP
63 *
64 * Created by Ian Taylor on 05/01/2007.
65 *
66 */
67 class TCPSocketAgentListener {
68 public:
69 virtual bool tcpEventReceived(TCPEvent *event)=0;
70 virtual ~TCPSocketAgentListener() {}
71 };
72
73
74 #endif // _TCPEvent
75