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);
233 return (
size_t)m_Data->recordLen;
244 return (
size_t)m_Data->recordLen - (2*
sizeof(uint8_t));
372 uint16_t getSrcPort()
const;
377 uint16_t getDstPort()
const;
405 size_t getTcpOptionCount()
const;
440 bool removeAllTcpOptions();
448 uint16_t calculateChecksum(
bool writeResultToPacket);
456 static inline bool isDataValid(
const uint8_t* data,
size_t dataLen);
463 void parseNextLayer();
473 void computeCalculateFields();
475 std::string toString()
const;
482 int m_NumOfTrailingBytes;
485 uint8_t* getOptionsBasePtr()
const {
return m_Data +
sizeof(
tcphdr); }
487 void adjustTcpOptionTrailer(
size_t totalOptSize);
488 void copyLayerData(
const TcpLayer& other);
496 const tcphdr* hdr =
reinterpret_cast<const tcphdr*
>(data);
497 return dataLen >=
sizeof(
tcphdr)
499 && dataLen >= hdr->
dataOffset *
sizeof(uint32_t);
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:253
Definition: TcpLayer.h:133
Definition: TcpLayer.h:119
Definition: TcpLayer.h:101
uint16_t dataOffset
Definition: TcpLayer.h:32
Definition: TcpLayer.h:129
uint16_t windowSize
Definition: TcpLayer.h:75
Definition: TLVData.h:351
uint16_t headerChecksum
Definition: TcpLayer.h:77
Definition: TcpLayer.h:113
uint16_t eceFlag
Definition: TcpLayer.h:32
uint16_t urgFlag
Definition: TcpLayer.h:32
~TcpOption()
Definition: TcpLayer.h:209
uint16_t portSrc
Definition: TcpLayer.h:24
uint16_t urgentPointer
Definition: TcpLayer.h:79
Definition: TcpLayer.h:22
Definition: TcpLayer.h:131
Definition: TLVData.h:197
uint32_t sequenceNumber
Definition: TcpLayer.h:28
NopEolOptionTypes
Definition: TcpLayer.h:262
Definition: TcpLayer.h:196
Definition: TcpLayer.h:121
size_t getTotalSize() const
Definition: TcpLayer.h:225
uint16_t pshFlag
Definition: TcpLayer.h:32
Definition: TcpLayer.h:115
Definition: TcpLayer.h:111
Definition: TcpLayer.h:125
TcpOptionBuilder(TcpOptionType optionType, const uint8_t *optionValue, uint8_t optionValueLen)
Definition: TcpLayer.h:277
uint16_t rstFlag
Definition: TcpLayer.h:32
Definition: TcpLayer.h:254
TcpOptionBuilder(TcpOptionType optionType, uint8_t optionValue)
Definition: TcpLayer.h:286
Definition: TcpLayer.h:265
Definition: TcpLayer.h:99
Definition: ProtocolType.h:262
uint32_t ackNumber
Definition: TcpLayer.h:30
uint16_t ackFlag
Definition: TcpLayer.h:32
TcpOptionType
Definition: TcpLayer.h:87
Definition: TcpLayer.h:105
Definition: TcpLayer.h:109
Definition: TcpLayer.h:117
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: TcpLayer.h:494
size_t getDataSize() const
Definition: TcpLayer.h:236
Definition: TcpLayer.h:327
tcphdr * getTcpHeader() const
Definition: TcpLayer.h:367
uint16_t synFlag
Definition: TcpLayer.h:32
Definition: TcpLayer.h:123
Definition: TcpLayer.h:135
Definition: TcpLayer.h:95
TcpOption(uint8_t *optionRawData)
Definition: TcpLayer.h:204
TcpOptionType getTcpOptionType() const
Definition: TcpLayer.h:215
Definition: TcpLayer.h:97
uint16_t cwrFlag
Definition: TcpLayer.h:32
uint16_t portDst
Definition: TcpLayer.h:26
Definition: TcpLayer.h:89
Definition: TcpLayer.h:127
Definition: TcpLayer.h:91
uint16_t finFlag
Definition: TcpLayer.h:32
TcpOptionBuilder(TcpOptionType optionType, uint32_t optionValue)
Definition: TcpLayer.h:304
Definition: TcpLayer.h:103
Definition: TcpLayer.h:137
size_t getHeaderLen() const
Definition: TcpLayer.h:468
OsiModelLayer getOsiModelLayer() const
Definition: TcpLayer.h:477
Definition: TcpLayer.h:93
Definition: TcpLayer.h:107
TcpOptionBuilder(TcpOptionType optionType, uint16_t optionValue)
Definition: TcpLayer.h:295