-
Notifications
You must be signed in to change notification settings - Fork 82
/
tcpconn.hh
69 lines (55 loc) · 1.63 KB
/
tcpconn.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef CLICK_TCPCONN_HH
#define CLICK_TCPCONN_HH
#include <click/element.hh>
#include <click/timer.hh>
#include <clicknet/tcp.h>
#include <click/bighashmap.hh>
#include <click/ipflowid.hh>
CLICK_DECLS
/*
* =c
* TCPConn()
* =s tcp
* manage tcp connections
* =d
* can either start a tcp connection or listen for connections.
*
* input and output 0 carry incoming packets; input and output 1 carry
* outgoing packets; output 2 send out SYNs and SYN ACKs. incoming packets are
* pushed onto input 0, but outgoing packets are pulled thru input/output 1.
* does not allow output pull to succeed unless connection is established.
*/
class TCPDemux;
class TCPConn : public Element {
private:
TCPDemux *_tcpdemux;
bool _active;
bool _listen;
bool _established;
unsigned _seq_nxt;
IPFlowID _flow;
bool connect_handler(IPFlowID f);
bool listen_handler(IPFlowID f);
void send_syn();
void reset();
bool iput(Packet *p);
Packet *oput(Packet *p);
public:
TCPConn() CLICK_COLD;
~TCPConn() CLICK_COLD;
const char *class_name() const override { return "TCPConn"; }
const char *port_count() const override { return "2/3"; }
const char *processing() const override { return "hl/hlh"; }
int initialize(ErrorHandler *) CLICK_COLD;
void cleanup(CleanupStage) CLICK_COLD;
int configure(Vector<String> &conf, ErrorHandler *errh) CLICK_COLD;
void push(int, Packet *);
Packet *pull(int);
void add_handlers() CLICK_COLD;
static int ctrl_write_handler
(const String &, Element *, void *, ErrorHandler *);
static int reset_write_handler
(const String &, Element *, void *, ErrorHandler *);
};
CLICK_ENDDECLS
#endif