1 #ifndef PACKETPP_TCP_LAYER 2 #define PACKETPP_TCP_LAYER 32 #if (BYTE_ORDER == LITTLE_ENDIAN) 52 #elif (BYTE_ORDER == BIG_ENDIAN) 73 #error "Endian is not LE nor BE..." 146 #define PCPP_TCPOLEN_NOP 1 148 #define PCPP_TCPOLEN_EOL 1 150 #define PCPP_TCPOLEN_MSS 4 152 #define PCPP_TCPOLEN_WINDOW 3 154 #define PCPP_TCPOLEN_SACK_PERM 2 156 #define PCPP_TCPOLEN_SACK_MIN 2 158 #define PCPP_TCPOLEN_ECHO 6 160 #define PCPP_TCPOLEN_ECHOREPLY 6 162 #define PCPP_TCPOLEN_TIMESTAMP 10 164 #define PCPP_TCPOLEN_CC 6 166 #define PCPP_TCPOLEN_CCNEW 6 168 #define PCPP_TCPOLEN_CCECHO 6 170 #define PCPP_TCPOLEN_MD5 18 172 #define PCPP_TCPOLEN_MPTCP_MIN 8 174 #define PCPP_TCPOLEN_SCPS 4 176 #define PCPP_TCPOLEN_SNACK 6 178 #define PCPP_TCPOLEN_RECBOUND 2 180 #define PCPP_TCPOLEN_CORREXP 2 182 #define PCPP_TCPOLEN_QS 8 184 #define PCPP_TCPOLEN_USER_TO 4 186 #define PCPP_TCPOLEN_RVBD_PROBE_MIN 3 188 #define PCPP_TCPOLEN_RVBD_TRPY_MIN 16 190 #define PCPP_TCPOLEN_EXP_MIN 2 233 return sizeof(uint8_t);
235 return (
size_t)m_Data->recordLen;
246 return (
size_t)m_Data->recordLen - (2*
sizeof(uint8_t));
374 uint16_t getSrcPort()
const;
379 uint16_t getDstPort()
const;
407 size_t getTcpOptionCount()
const;
442 bool removeAllTcpOptions();
450 uint16_t calculateChecksum(
bool writeResultToPacket);
458 static inline bool isDataValid(
const uint8_t* data,
size_t dataLen);
465 void parseNextLayer();
475 void computeCalculateFields();
477 std::string toString()
const;
484 int m_NumOfTrailingBytes;
487 uint8_t* getOptionsBasePtr()
const {
return m_Data +
sizeof(
tcphdr); }
489 void adjustTcpOptionTrailer(
size_t totalOptSize);
490 void copyLayerData(
const TcpLayer& other);
498 const tcphdr* hdr =
reinterpret_cast<const tcphdr*
>(data);
499 return dataLen >=
sizeof(
tcphdr)
501 && dataLen >= hdr->
dataOffset *
sizeof(uint32_t);
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:298
Definition: TcpLayer.h:135
Definition: TcpLayer.h:121
Definition: TcpLayer.h:103
uint16_t dataOffset
Definition: TcpLayer.h:33
Definition: TcpLayer.h:131
uint16_t windowSize
Definition: TcpLayer.h:76
Definition: TLVData.h:363
uint16_t headerChecksum
Definition: TcpLayer.h:78
Definition: TcpLayer.h:115
uint16_t eceFlag
Definition: TcpLayer.h:33
uint16_t urgFlag
Definition: TcpLayer.h:33
~TcpOption()
Definition: TcpLayer.h:211
uint16_t portSrc
Definition: TcpLayer.h:25
uint16_t urgentPointer
Definition: TcpLayer.h:80
Definition: TcpLayer.h:22
Definition: TcpLayer.h:133
Definition: TLVData.h:207
uint32_t sequenceNumber
Definition: TcpLayer.h:29
NopEolOptionTypes
Definition: TcpLayer.h:264
Definition: TcpLayer.h:198
Definition: TcpLayer.h:123
size_t getTotalSize() const
Definition: TcpLayer.h:227
uint16_t pshFlag
Definition: TcpLayer.h:33
Definition: TcpLayer.h:117
Definition: TcpLayer.h:113
Definition: TcpLayer.h:127
TcpOptionBuilder(TcpOptionType optionType, const uint8_t *optionValue, uint8_t optionValueLen)
Definition: TcpLayer.h:279
uint16_t rstFlag
Definition: TcpLayer.h:33
Definition: TcpLayer.h:256
TcpOptionBuilder(TcpOptionType optionType, uint8_t optionValue)
Definition: TcpLayer.h:288
Definition: TcpLayer.h:267
Definition: TcpLayer.h:101
Definition: ProtocolType.h:307
uint32_t ackNumber
Definition: TcpLayer.h:31
uint16_t ackFlag
Definition: TcpLayer.h:33
TcpOptionType
Definition: TcpLayer.h:88
Definition: TcpLayer.h:107
Definition: TcpLayer.h:111
Definition: TcpLayer.h:119
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: TcpLayer.h:496
size_t getDataSize() const
Definition: TcpLayer.h:238
Definition: TcpLayer.h:329
tcphdr * getTcpHeader() const
Definition: TcpLayer.h:369
uint16_t synFlag
Definition: TcpLayer.h:33
Definition: TcpLayer.h:125
Definition: TcpLayer.h:137
Definition: TcpLayer.h:97
TcpOption(uint8_t *optionRawData)
Definition: TcpLayer.h:206
TcpOptionType getTcpOptionType() const
Definition: TcpLayer.h:217
Definition: TcpLayer.h:99
uint16_t cwrFlag
Definition: TcpLayer.h:33
uint16_t portDst
Definition: TcpLayer.h:27
Definition: TcpLayer.h:91
Definition: TcpLayer.h:129
Definition: TcpLayer.h:93
uint16_t finFlag
Definition: TcpLayer.h:33
TcpOptionBuilder(TcpOptionType optionType, uint32_t optionValue)
Definition: TcpLayer.h:306
Definition: TcpLayer.h:105
Definition: TcpLayer.h:139
size_t getHeaderLen() const
Definition: TcpLayer.h:470
OsiModelLayer getOsiModelLayer() const
Definition: TcpLayer.h:479
Definition: TcpLayer.h:95
Definition: TcpLayer.h:109
TcpOptionBuilder(TcpOptionType optionType, uint16_t optionValue)
Definition: TcpLayer.h:297