|
PcapPlusPlus
20.08
|
Go to the documentation of this file. 1 #ifndef PACKETPP_TCP_LAYER
2 #define PACKETPP_TCP_LAYER
31 #if (BYTE_ORDER == LITTLE_ENDIAN)
51 #elif (BYTE_ORDER == BIG_ENDIAN)
72 #error "Endian is not LE nor BE..."
144 #define PCPP_TCPOLEN_NOP 1
146 #define PCPP_TCPOLEN_EOL 1
148 #define PCPP_TCPOLEN_MSS 4
150 #define PCPP_TCPOLEN_WINDOW 3
152 #define PCPP_TCPOLEN_SACK_PERM 2
154 #define PCPP_TCPOLEN_SACK_MIN 2
156 #define PCPP_TCPOLEN_ECHO 6
158 #define PCPP_TCPOLEN_ECHOREPLY 6
160 #define PCPP_TCPOLEN_TIMESTAMP 10
162 #define PCPP_TCPOLEN_CC 6
164 #define PCPP_TCPOLEN_CCNEW 6
166 #define PCPP_TCPOLEN_CCECHO 6
168 #define PCPP_TCPOLEN_MD5 18
170 #define PCPP_TCPOLEN_MPTCP_MIN 8
172 #define PCPP_TCPOLEN_SCPS 4
174 #define PCPP_TCPOLEN_SNACK 6
176 #define PCPP_TCPOLEN_RECBOUND 2
178 #define PCPP_TCPOLEN_CORREXP 2
180 #define PCPP_TCPOLEN_QS 8
182 #define PCPP_TCPOLEN_USER_TO 4
184 #define PCPP_TCPOLEN_RVBD_PROBE_MIN 3
186 #define PCPP_TCPOLEN_RVBD_TRPY_MIN 16
188 #define PCPP_TCPOLEN_EXP_MIN 2
231 return sizeof(uint8_t);
244 return (
size_t)m_Data->
recordLen - (2*
sizeof(uint8_t));
349 TcpLayer(uint16_t portSrc, uint16_t portDst);
446 static inline bool isDataValid(
const uint8_t* data,
size_t dataLen);
472 int m_NumOfTrailingBytes;
475 uint8_t* getOptionsBasePtr()
const {
return m_Data +
sizeof(
tcphdr); }
476 TcpOption addTcpOptionAt(
const TcpOptionBuilder& optionBuilder,
int offset);
477 void adjustTcpOptionTrailer(
size_t totalOptSize);
478 void copyLayerData(
const TcpLayer& other);
486 const tcphdr* hdr =
reinterpret_cast<const tcphdr*
>(data);
487 return dataLen >=
sizeof(
tcphdr)
489 && dataLen >= hdr->
dataOffset *
sizeof(uint32_t);
OsiModelLayer
Definition: ProtocolType.h:233
@ TCPOPT_MSS
Definition: TcpLayer.h:93
@ TCPOPT_SNACK
Definition: TcpLayer.h:119
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: TcpLayer.h:484
@ TCPOPT_EXP_FD
Definition: TcpLayer.h:129
uint8_t recordType
Definition: TLVData.h:31
tcphdr * getTcpHeader() const
Definition: TcpLayer.h:367
NopEolOptionTypes
Definition: TcpLayer.h:262
uint16_t ackFlag
Definition: TcpLayer.h:44
TcpOptionBuilder(TcpOptionType optionType, uint8_t optionValue)
Definition: TcpLayer.h:286
Definition: TcpLayer.h:22
uint16_t cwrFlag
Definition: TcpLayer.h:50
size_t getTotalSize() const
Definition: TcpLayer.h:225
TcpOptionBuilder(TcpOptionType optionType, const uint8_t *optionValue, uint8_t optionValueLen)
Definition: TcpLayer.h:277
@ TCPOPT_MD5
Definition: TcpLayer.h:113
bool removeTcpOption(TcpOptionType optionType)
@ EOL
Definition: TcpLayer.h:267
TcpOption addTcpOption(const TcpOptionBuilder &optionBuilder)
TcpOption(uint8_t *optionRawData)
Definition: TcpLayer.h:204
uint16_t windowSize
Definition: TcpLayer.h:75
uint16_t urgentPointer
Definition: TcpLayer.h:79
@ TCPOPT_RECBOUND
Definition: TcpLayer.h:121
@ TCPOPT_EXP_FE
Definition: TcpLayer.h:131
@ TCPOPT_MPTCP
Definition: TcpLayer.h:115
TcpOptionBuilder(TcpOptionType optionType, uint16_t optionValue)
Definition: TcpLayer.h:295
uint16_t pshFlag
Definition: TcpLayer.h:42
@ TCPOPT_QS
Definition: TcpLayer.h:125
TcpOptionBuilder(TcpOptionType optionType, uint32_t optionValue)
Definition: TcpLayer.h:304
uint16_t rstFlag
Definition: TcpLayer.h:40
uint16_t calculateChecksum(bool writeResultToPacket)
uint16_t eceFlag
Definition: TcpLayer.h:48
Definition: TcpLayer.h:254
@ TCPOPT_CCECHO
Definition: TcpLayer.h:111
size_t getHeaderLen() const
Definition: TcpLayer.h:458
@ PCPP_TCPOPT_SACK
Definition: TcpLayer.h:99
size_t getTcpOptionCount() const
TcpOption getNextTcpOption(TcpOption &tcpOption) const
@ PCPP_TCPOPT_TIMESTAMP
Definition: TcpLayer.h:105
bool removeAllTcpOptions()
@ OsiModelTransportLayer
Definition: ProtocolType.h:242
@ TCPOPT_SCPS
Definition: TcpLayer.h:117
The main namespace for the PcapPlusPlus lib.
Definition: TLVData.h:351
@ TCPOPT_RVBD_TRPY
Definition: TcpLayer.h:135
uint16_t synFlag
Definition: TcpLayer.h:38
uint16_t finFlag
Definition: TcpLayer.h:36
@ TCPOPT_CCNEW
Definition: TcpLayer.h:109
TcpOptionType
Definition: TcpLayer.h:87
size_t getDataSize() const
Definition: TcpLayer.h:236
std::string toString() const
OsiModelLayer getOsiModelLayer() const
Definition: TcpLayer.h:467
Definition: TLVData.h:197
uint32_t sequenceNumber
Definition: TcpLayer.h:28
TcpOptionType getTcpOptionType() const
Definition: TcpLayer.h:215
@ TCPOPT_CORREXP
Definition: TcpLayer.h:123
Definition: TcpLayer.h:196
@ PCPP_TCPOPT_NOP
Definition: TcpLayer.h:89
uint16_t portDst
Definition: TcpLayer.h:26
TcpOption getFirstTcpOption() const
@ PCPP_TCPOPT_EOL
Definition: TcpLayer.h:91
~TcpOption()
Definition: TcpLayer.h:209
@ PCPP_TCPOPT_WINDOW
Definition: TcpLayer.h:95
uint16_t headerChecksum
Definition: TcpLayer.h:77
void computeCalculateFields()
uint16_t dataOffset
Definition: TcpLayer.h:34
uint16_t portSrc
Definition: TcpLayer.h:24
TcpOption addTcpOptionAfter(const TcpOptionBuilder &optionBuilder, TcpOptionType prevOptionType=TCPOPT_Unknown)
TcpLayer & operator=(const TcpLayer &other)
@ TCPOPT_SACK_PERM
Definition: TcpLayer.h:97
@ NOP
Definition: TcpLayer.h:265
@ TCPOPT_Unknown
Definition: TcpLayer.h:137
@ TCPOPT_USER_TO
Definition: TcpLayer.h:127
uint8_t recordLen
Definition: TLVData.h:33
@ TCPOPT_CC
Definition: TcpLayer.h:107
@ TCPOPT_RVBD_PROBE
Definition: TcpLayer.h:133
uint32_t ackNumber
Definition: TcpLayer.h:30
Definition: TcpLayer.h:327
uint16_t urgFlag
Definition: TcpLayer.h:46
@ TCPOPT_ECHOREPLY
Definition: TcpLayer.h:103
TcpOption getTcpOption(TcpOptionType option) const
@ TCPOPT_ECHO
Definition: TcpLayer.h:101