PcapPlusPlus
Next
|
#include <TcpLayer.h>
Public Member Functions | |
TcpLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) | |
TcpLayer () | |
TcpLayer (uint16_t portSrc, uint16_t portDst) | |
TcpLayer (const TcpLayer &other) | |
TcpLayer & | operator= (const TcpLayer &other) |
tcphdr * | getTcpHeader () const |
uint16_t | getSrcPort () const |
uint16_t | getDstPort () const |
PCPP_DEPRECATED ("enum TcpOptionType is deprecated; Use enum class TcpOptionEnumType instead") TcpOption getTcpOption(TcpOptionType option) const | |
TcpOption | getTcpOption (TcpOptionEnumType option) const |
TcpOption | getFirstTcpOption () const |
TcpOption | getNextTcpOption (TcpOption &tcpOption) const |
size_t | getTcpOptionCount () const |
TcpOption | addTcpOption (const TcpOptionBuilder &optionBuilder) |
TcpOption | addTcpOptionAfter (const TcpOptionBuilder &optionBuilder, TcpOptionType prevOptionType=TcpOptionType::TCPOPT_Unknown) |
TcpOption | insertTcpOptionAfter (const TcpOptionBuilder &optionBuilder, TcpOptionEnumType prevOptionType=TcpOptionEnumType::Unknown) |
PCPP_DEPRECATED ("enum TcpOptionType is deprecated; Use enum class TcpOptionEnumType instead") bool removeTcpOption(TcpOptionType optionType) | |
bool | removeTcpOption (TcpOptionEnumType optionType) |
bool | removeAllTcpOptions () |
uint16_t | calculateChecksum (bool writeResultToPacket) |
void | parseNextLayer () override |
size_t | getHeaderLen () const override |
void | computeCalculateFields () override |
std::string | toString () const override |
OsiModelLayer | getOsiModelLayer () const override |
Public Member Functions inherited from pcpp::Layer | |
~Layer () override | |
Layer * | getNextLayer () const |
Layer * | getPrevLayer () const |
ProtocolType | getProtocol () const |
bool | isMemberOfProtocolFamily (ProtocolTypeFamily protocolTypeFamily) const |
uint8_t * | getData () const |
size_t | getDataLen () const |
uint8_t * | getLayerPayload () const |
size_t | getLayerPayloadSize () const |
bool | isAllocatedToPacket () const |
void | copyData (uint8_t *toArr) const |
uint8_t * | getDataPtr (size_t offset=0) const override |
Static Public Member Functions | |
static bool | isDataValid (const uint8_t *data, size_t dataLen) |
Represents a TCP (Transmission Control Protocol) protocol layer
pcpp::TcpLayer::TcpLayer | ( | ) |
A constructor that allocates a new TCP header with zero TCP options
pcpp::TcpLayer::TcpLayer | ( | uint16_t | portSrc, |
uint16_t | portDst | ||
) |
A constructor that allocates a new TCP header with source port and destination port and zero TCP options
[in] | portSrc | Source port |
[in] | portDst | Destination port |
pcpp::TcpLayer::TcpLayer | ( | const TcpLayer & | other | ) |
A copy constructor that copy the entire header from the other TcpLayer (including TCP options)
TcpOption pcpp::TcpLayer::addTcpOption | ( | const TcpOptionBuilder & | optionBuilder | ) |
Add a new TCP option at the end of the layer (after the last TCP option)
[in] | optionBuilder | A TcpOptionBuilder object that contains the TCP option data to be added |
TcpOption pcpp::TcpLayer::addTcpOptionAfter | ( | const TcpOptionBuilder & | optionBuilder, |
TcpOptionType | prevOptionType = TcpOptionType::TCPOPT_Unknown |
||
) |
uint16_t pcpp::TcpLayer::calculateChecksum | ( | bool | writeResultToPacket | ) |
Calculate the checksum from header and data and possibly write the result to tcphdr::headerChecksum
[in] | writeResultToPacket | If set to true then checksum result will be written to tcphdr::headerChecksum |
|
overridevirtual |
Calculate tcphdr::headerChecksum field
Implements pcpp::Layer.
uint16_t pcpp::TcpLayer::getDstPort | ( | ) | const |
TcpOption pcpp::TcpLayer::getFirstTcpOption | ( | ) | const |
|
inlineoverridevirtual |
Implements pcpp::Layer.
Get the TCP option that comes after a given option. If the given option was the last one, the returned value will contain a logical null (TcpOption::isNull() == true)
[in] | tcpOption | A TCP option object that exists in the current layer |
|
inlineoverridevirtual |
Implements pcpp::Layer.
uint16_t pcpp::TcpLayer::getSrcPort | ( | ) | const |
|
inline |
Get a pointer to the TCP header. Notice this points directly to the data, so every change will change the actual packet data
TcpOption pcpp::TcpLayer::getTcpOption | ( | TcpOptionEnumType | option | ) | const |
Get a TCP option by type
[in] | option | TCP option type to retrieve |
size_t pcpp::TcpLayer::getTcpOptionCount | ( | ) | const |
TcpOption pcpp::TcpLayer::insertTcpOptionAfter | ( | const TcpOptionBuilder & | optionBuilder, |
TcpOptionEnumType | prevOptionType = TcpOptionEnumType::Unknown |
||
) |
Insert a new TCP option after an existing one
[in] | optionBuilder | A TcpOptionBuilder object that contains the requested TCP option data to be inserted |
[in] | prevOptionType | The TCP option which the newly inserted option should come after. This is an optional parameter which gets a default value of TcpOptionType::Unknown if omitted, which means the new option will be inserted as the first option in the layer |
|
inlinestatic |
The static method makes validation of input data
[in] | data | The pointer to the beginning of byte stream of TCP packet |
[in] | dataLen | The length of byte stream |
An assignment operator that first delete all data from current layer and then copy the entire header from the other TcpLayer (including TCP options)
|
overridevirtual |
Currently identifies the following next layers: HttpRequestLayer, HttpResponseLayer. Otherwise sets PayloadLayer
Implements pcpp::Layer.
pcpp::TcpLayer::PCPP_DEPRECATED | ( | "enum TcpOptionType is deprecated; Use enum class TcpOptionEnumType instead" | ) |
pcpp::TcpLayer::PCPP_DEPRECATED | ( | "enum TcpOptionType is deprecated; Use enum class TcpOptionEnumType instead" | ) | const |
bool pcpp::TcpLayer::removeAllTcpOptions | ( | ) |
Remove all TCP options in this layer
bool pcpp::TcpLayer::removeTcpOption | ( | TcpOptionEnumType | optionType | ) |
Remove an existing TCP option from the layer. TCP option is found by type
[in] | optionType | The TCP option type to remove |
|
overridevirtual |
Implements pcpp::Layer.