1 | #ifndef TCP_DISSECTOR_H |
---|
2 | #define TCP_DISSECTOR_H |
---|
3 | |
---|
4 | #include "Dissector.h" |
---|
5 | #include <string> |
---|
6 | |
---|
7 | class TcpDissector : public Dissector { |
---|
8 | |
---|
9 | public: |
---|
10 | TcpDissector(); |
---|
11 | virtual ~TcpDissector(); |
---|
12 | virtual TcpDissector * Clone() const; |
---|
13 | virtual bool Dissect(const unsigned char * pData, const ssize_t nDataLen); |
---|
14 | virtual bool NeedReassembly() const; |
---|
15 | virtual bool Reassemble(Dissector * pDissector, ProtocolInfo * pProtocolInfo); |
---|
16 | virtual const EProtocolType GetUpperLayerType() const; |
---|
17 | |
---|
18 | private: |
---|
19 | struct TcpHeader { |
---|
20 | unsigned short srcPort; // source port |
---|
21 | unsigned short destPort; // destination port |
---|
22 | unsigned int sequence; // sequence number - 32 bits |
---|
23 | unsigned int acknowledge; // acknowledgement number - 32 bits |
---|
24 | |
---|
25 | unsigned char ns :1; //Nonce Sum Flag Added in RFC 3540. |
---|
26 | unsigned char reservedPart1:3; //according to rfc |
---|
27 | unsigned char dataOffset:4; //number of dwords in the TCP header. |
---|
28 | |
---|
29 | unsigned char fin :1; //Finish Flag |
---|
30 | unsigned char syn :1; //Synchronise Flag |
---|
31 | unsigned char rst :1; //Reset Flag |
---|
32 | unsigned char psh :1; //Push Flag |
---|
33 | unsigned char ack :1; //Acknowledgement Flag |
---|
34 | unsigned char urg :1; //Urgent Flag |
---|
35 | |
---|
36 | unsigned char ecn :1; //ECN-Echo Flag |
---|
37 | unsigned char cwr :1; //Congestion Window Reduced Flag |
---|
38 | |
---|
39 | unsigned short window; // window |
---|
40 | unsigned short checksum; // checksum |
---|
41 | unsigned short urgentPointer; // urgent pointer |
---|
42 | }; |
---|
43 | |
---|
44 | TcpHeader * m_tcpHdr; |
---|
45 | protected: |
---|
46 | ProtocolInfoElement * CreateLayerInfo(); |
---|
47 | }; |
---|
48 | |
---|
49 | #endif |
---|