PcapPlusPlus
|
#include <TcpLayer.h>
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 = TCPOPT_Unknown |
||
) |
Add a new TCP option after an existing one
[in] | optionBuilder | A TcpOptionBuilder object that contains the requested TCP option data to be added |
[in] | prevOptionType | The TCP option which the newly added option should come after. This is an optional parameter which gets a default value of TCPOPT_Unknown if omitted, which means the new option will be added as the first option in the layer |
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 |
|
virtual |
Calculate tcphdr::headerChecksum field
Implements pcpp::Layer.
TcpOption pcpp::TcpLayer::getFirstTcpOption | ( | ) |
|
inlinevirtual |
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 |
|
inlinevirtual |
Implements pcpp::Layer.
|
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 | ( | TcpOptionType | option | ) |
Get a TCP option by type
[in] | option | TCP option type to retrieve |
size_t pcpp::TcpLayer::getTcpOptionCount | ( | ) |
An assignment operator that first delete all data from current layer and then copy the entire header from the other TcpLayer (including TCP options)
|
virtual |
Currently identifies the following next layers: HttpRequestLayer, HttpResponseLayer. Otherwise sets PayloadLayer
Implements pcpp::Layer.
bool pcpp::TcpLayer::removeAllTcpOptions | ( | ) |
Remove all TCP options in this layer
bool pcpp::TcpLayer::removeTcpOption | ( | TcpOptionType | optionType | ) |
Remove an existing TCP option from the layer. TCP option is found by type
[in] | optionType | The TCP option type to remove |
|
virtual |
Implements pcpp::Layer.