-
Notifications
You must be signed in to change notification settings - Fork 0
/
utility_tcp.h
77 lines (58 loc) · 1.38 KB
/
utility_tcp.h
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
69
70
71
72
73
74
75
76
77
#ifndef CLIXON_PLUGIN_TCP_UTILITY_TCP_H
#define CLIXON_PLUGIN_TCP_UTILITY_TCP_H
#include <string>
#include <list>
class TCPStats {
public:
std::string activeOpens;
std::string passiveOpens;
std::string attemptFails;
std::string establishResets;
std::string currentlyEstablished;
std::string inSegments;
std::string outSegments;
std::string retransmittedSegments;
std::string inErrors;
std::string outResets;
TCPStats() = default;
~TCPStats() = default;
};
class TCPStatisticsManager {
public:
static TCPStats *readStatistics();
};
class TCPAddress {
public:
std::string ipAddress;
std::string port;
explicit TCPAddress(const std::string &rawAddress);
};
enum TCPConState {
UNDEFINED = 0,
TCP_ESTABLISHED = 1,
TCP_SYN_SENT = 2,
TCP_SYN_RECV = 3,
TCP_FIN_WAIT1 = 4,
TCP_FIN_WAIT2 = 5,
TCP_TIME_WAIT = 6,
TCP_CLOSE = 7,
TCP_CLOSE_WAIT = 8,
TCP_LAST_ACK = 9,
TCP_LISTEN = 10,
TCP_CLOSING = 11,
TCP_NEW_SYN_RECV = 12,
TCP_MAX_STATES = 13
};
class TCPConnection {
public:
TCPAddress *localAddress{};
TCPAddress *remoteAddress{};
TCPConState conState = UNDEFINED;
TCPConnection() = default;
~ TCPConnection() = default;
};
class TCPConnectionManager {
public:
static std::list<TCPConnection *> readConnections();
};
#endif //CLIXON_PLUGIN_TCP_UTILITY_TCP_H