8 #define PCPP_DEPRECATED_TCP_OPTION_TYPE \
9 PCPP_DEPRECATED("enum TcpOptionType is deprecated; Use enum class TcpOptionEnumType instead")
35 #if (BYTE_ORDER == LITTLE_ENDIAN)
36 uint16_t reserved : 4;
55 #elif (BYTE_ORDER == BIG_ENDIAN)
59 uint16_t reserved : 4;
77 # error "Endian is not LE nor BE..."
206 #define PCPP_TCPOLEN_NOP 1
208 #define PCPP_TCPOLEN_EOL 1
210 #define PCPP_TCPOLEN_MSS 4
212 #define PCPP_TCPOLEN_WINDOW 3
214 #define PCPP_TCPOLEN_SACK_PERM 2
216 #define PCPP_TCPOLEN_SACK_MIN 2
218 #define PCPP_TCPOLEN_ECHO 6
220 #define PCPP_TCPOLEN_ECHOREPLY 6
222 #define PCPP_TCPOLEN_TIMESTAMP 10
224 #define PCPP_TCPOLEN_CC 6
226 #define PCPP_TCPOLEN_CCNEW 6
228 #define PCPP_TCPOLEN_CCECHO 6
230 #define PCPP_TCPOLEN_MD5 18
232 #define PCPP_TCPOLEN_MPTCP_MIN 8
234 #define PCPP_TCPOLEN_SCPS 4
236 #define PCPP_TCPOLEN_SNACK 6
238 #define PCPP_TCPOLEN_RECBOUND 2
240 #define PCPP_TCPOLEN_CORREXP 2
242 #define PCPP_TCPOLEN_QS 8
244 #define PCPP_TCPOLEN_USER_TO 4
246 #define PCPP_TCPOLEN_RVBD_PROBE_MIN 3
248 #define PCPP_TCPOLEN_RVBD_TRPY_MIN 16
250 #define PCPP_TCPOLEN_EXP_MIN 2
275 PCPP_DEPRECATED(
"Use getTcpOptionEnumType instead")
296 static bool canAssign(
const uint8_t* recordRawData,
size_t tlvDataLen)
298 const auto* data =
reinterpret_cast<const TLVRawData*
>(recordRawData);
302 if (tlvDataLen <
sizeof(TLVRawData::recordType))
316 if (m_Data ==
nullptr)
321 return sizeof(uint8_t);
323 return static_cast<size_t>(m_Data->recordLen);
328 if (m_Data ==
nullptr)
335 return static_cast<size_t>(m_Data->recordLen) - (2 *
sizeof(uint8_t));
341 if (optionRawData ==
nullptr)
344 return static_cast<TcpOptionType>(optionRawData->recordType);
349 if (optionRawData ==
nullptr)
390 PCPP_DEPRECATED_TCP_OPTION_TYPE
404 :
TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue, optionValueLen)
410 PCPP_DEPRECATED_TCP_OPTION_TYPE
412 : TLVRecordBuilder((uint8_t)optionType, optionValue)
422 : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue)
428 PCPP_DEPRECATED_TCP_OPTION_TYPE
430 : TLVRecordBuilder((uint8_t)optionType, optionValue)
440 : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue)
446 PCPP_DEPRECATED_TCP_OPTION_TYPE
448 : TLVRecordBuilder((uint8_t)optionType, optionValue)
458 : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue)
464 PCPP_DEPRECATED(
"enum NopEolOptionTypes is deprecated; Use enum class NopEolOptionEnumType instead")
546 PCPP_DEPRECATED_TCP_OPTION_TYPE
610 PCPP_DEPRECATED_TCP_OPTION_TYPE
626 bool removeAllTcpOptions();
634 uint16_t calculateChecksum(
bool writeResultToPacket);
642 static inline
bool isDataValid(const uint8_t* data,
size_t dataLen);
650 void parseNextLayer();
655 size_t getHeaderLen()
const
657 return getTcpHeader()->dataOffset * 4;
674 int m_NumOfTrailingBytes;
677 uint8_t* getOptionsBasePtr()
const
679 return m_Data +
sizeof(
tcphdr);
681 TcpOption addTcpOptionAt(
const TcpOptionBuilder& optionBuilder,
int offset);
682 void adjustTcpOptionTrailer(
size_t totalOptSize);
683 void copyLayerData(
const TcpLayer& other);
690 const tcphdr* hdr =
reinterpret_cast<const tcphdr*
>(data);
692 && dataLen >= hdr->
dataOffset *
sizeof(uint32_t);
696 #undef PCPP_DEPRECATED_TCP_OPTION_TYPE
Definition: TLVData.h:413
static bool canAssign(const uint8_t *recordRawData, size_t tlvDataLen)
Definition: TLVData.h:79
Definition: TLVData.h:239
Definition: TcpLayer.h:487
tcphdr * getTcpHeader() const
Definition: TcpLayer.h:528
uint16_t getSrcPort() const
TcpOption getTcpOption(TcpOptionEnumType option) const
TcpOption getFirstTcpOption() const
void computeCalculateFields()
TcpLayer(const TcpLayer &other)
TcpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
uint16_t getDstPort() const
TcpLayer & operator=(const TcpLayer &other)
TcpOption addTcpOption(const TcpOptionBuilder &optionBuilder)
TcpLayer(uint16_t portSrc, uint16_t portDst)
OsiModelLayer getOsiModelLayer() const
Definition: TcpLayer.h:667
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: TcpLayer.h:688
size_t getTcpOptionCount() const
TcpOption getNextTcpOption(TcpOption &tcpOption) const
std::string toString() const
Definition: TcpLayer.h:362
PCPP_DEPRECATED("enum TcpOptionType is deprecated; Use enum class TcpOptionEnumType instead") TcpOptionBuilder(TcpOptionType optionType
NopEolOptionEnumType
Definition: TcpLayer.h:380
TcpOptionBuilder(NopEolOptionEnumType optionType)
NopEolOptionTypes
Definition: TcpLayer.h:369
@ EOL
Definition: TcpLayer.h:373
@ NOP
Definition: TcpLayer.h:371
Definition: TcpLayer.h:258
TcpOptionEnumType getTcpOptionEnumType() const
Definition: TcpLayer.h:285
TcpOptionType getTcpOptionType() const
Definition: TcpLayer.h:276
size_t getTotalSize() const
Definition: TcpLayer.h:314
size_t getDataSize() const
Definition: TcpLayer.h:326
static bool canAssign(const uint8_t *recordRawData, size_t tlvDataLen)
Definition: TcpLayer.h:296
TcpOption(uint8_t *optionRawData)
Definition: TcpLayer.h:264
The main namespace for the PcapPlusPlus lib.
TcpOptionEnumType
Definition: TcpLayer.h:150
OsiModelLayer
Definition: ProtocolType.h:354
@ OsiModelTransportLayer
Definition: ProtocolType.h:362
TcpOptionType
Definition: TcpLayer.h:93
@ TCPOPT_EXP_FD
Definition: TcpLayer.h:135
@ TCPOPT_USER_TO
Definition: TcpLayer.h:133
@ TCPOPT_SCPS
Definition: TcpLayer.h:123
@ TCPOPT_MSS
Definition: TcpLayer.h:99
@ PCPP_TCPOPT_NOP
Definition: TcpLayer.h:95
@ TCPOPT_QS
Definition: TcpLayer.h:131
@ PCPP_TCPOPT_WINDOW
Definition: TcpLayer.h:101
@ TCPOPT_CCNEW
Definition: TcpLayer.h:115
@ TCPOPT_RVBD_TRPY
Definition: TcpLayer.h:141
@ PCPP_TCPOPT_EOL
Definition: TcpLayer.h:97
@ TCPOPT_Unknown
Definition: TcpLayer.h:143
@ TCPOPT_MPTCP
Definition: TcpLayer.h:121
@ TCPOPT_EXP_FE
Definition: TcpLayer.h:137
@ TCPOPT_CC
Definition: TcpLayer.h:113
@ TCPOPT_ECHOREPLY
Definition: TcpLayer.h:109
@ TCPOPT_RVBD_PROBE
Definition: TcpLayer.h:139
@ TCPOPT_MD5
Definition: TcpLayer.h:119
@ TCPOPT_SNACK
Definition: TcpLayer.h:125
@ PCPP_TCPOPT_TIMESTAMP
Definition: TcpLayer.h:111
@ TCPOPT_CORREXP
Definition: TcpLayer.h:129
@ TCPOPT_RECBOUND
Definition: TcpLayer.h:127
@ TCPOPT_SACK_PERM
Definition: TcpLayer.h:103
@ TCPOPT_CCECHO
Definition: TcpLayer.h:117
@ PCPP_TCPOPT_SACK
Definition: TcpLayer.h:105
@ TCPOPT_ECHO
Definition: TcpLayer.h:107
Definition: TcpLayer.h:26
uint16_t pshFlag
Definition: TcpLayer.h:46
uint16_t cwrFlag
Definition: TcpLayer.h:54
uint16_t urgFlag
Definition: TcpLayer.h:50
uint32_t sequenceNumber
Definition: TcpLayer.h:32
uint16_t rstFlag
Definition: TcpLayer.h:44
uint16_t urgentPointer
Definition: TcpLayer.h:85
uint16_t synFlag
Definition: TcpLayer.h:42
uint16_t portDst
Definition: TcpLayer.h:30
uint16_t portSrc
Definition: TcpLayer.h:28
uint16_t dataOffset
Definition: TcpLayer.h:38
uint16_t eceFlag
Definition: TcpLayer.h:52
uint16_t windowSize
Definition: TcpLayer.h:80
uint16_t finFlag
Definition: TcpLayer.h:40
uint16_t ackFlag
Definition: TcpLayer.h:48
uint32_t ackNumber
Definition: TcpLayer.h:34
uint16_t headerChecksum
Definition: TcpLayer.h:82