![]() |
TSDuck v3.46-4930
MPEG Transport Stream Toolkit
|
#include <tsIPPacket.h>
Public Types | |
| using | Port = AbstractNetworkAddress::Port |
Public Member Functions | |
| IPPacket ()=default | |
| IPPacket (const void *data, size_t size) | |
| void | clear () |
| const uint8_t * | data () const |
| const IPSocketAddress & | destination () const |
| bool | fragmented () const |
| IP | generation () const |
| const uint8_t * | ipHeader () const |
| size_t | ipHeaderSize () const |
| bool | isTCP () const |
| bool | isUDP () const |
| bool | isValid () const |
| uint8_t | protocol () const |
| const uint8_t * | protocolData () const |
| size_t | protocolDataSize () const |
| const uint8_t * | protocolHeader () const |
| size_t | protocolHeaderSize () const |
| bool | reset (const void *data, size_t size) |
| size_t | size () const |
| const IPSocketAddress & | source () const |
| bool | tcpACK () const |
| bool | tcpFIN () const |
| bool | tcpRST () const |
| uint32_t | tcpSequenceNumber () const |
| bool | tcpSYN () const |
Static Public Member Functions | |
| static uint16_t | IPHeaderChecksum (const void *data, size_t size) |
| static size_t | IPHeaderSize (const void *data, size_t size, uint8_t *protocol=nullptr) |
| static bool | UpdateIPHeaderChecksum (void *data, size_t size) |
| static bool | VerifyIPHeaderChecksum (const void *data, size_t size) |
Representation of a raw IPv4 or IPv6 packet.
The concept of port is used by TCP and UDP.
|
default |
Default constructor.
| ts::IPPacket::IPPacket | ( | const void * | data, |
| size_t | size ) |
| bool ts::IPPacket::reset | ( | const void * | data, |
| size_t | size ) |
| void ts::IPPacket::clear | ( | ) |
Clear the packet content.
|
inline |
Check if the IPv4 packet is valid.
|
inline |
|
inline |
Get the sub-protocol type (TCP, UDP, etc).
|
inline |
Check if the packet is a valid TCP packet.
|
inline |
Check if the packet is a valid UDP packet.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the address of the sub-protocol header (TCP header, UDP header, etc).
|
inline |
Get the size in bytes of the sub-protocol header (TCP header, UDP header, etc).
|
inline |
Get the address of the sub-protocol payload data (TCP data, UDP data, etc).
| size_t ts::IPPacket::protocolDataSize | ( | ) | const |
Get the size in bytes of the sub-protocol payload data (TCP data, UDP data, etc).
| bool ts::IPPacket::fragmented | ( | ) | const |
Check if the IP packet is fragmented.
|
inline |
|
inline |
| uint32_t ts::IPPacket::tcpSequenceNumber | ( | ) | const |
Get the TCP sequence number in the packet.
| bool ts::IPPacket::tcpSYN | ( | ) | const |
Get the TCP SYN flag in the packet.
| bool ts::IPPacket::tcpACK | ( | ) | const |
Get the TCP ACK flag in the packet.
| bool ts::IPPacket::tcpFIN | ( | ) | const |
Get the TCP FIN flag in the packet.
|
static |
Get the size in bytes of an IP header from raw data.
| [in] | data | Address of the IP packet. |
| [in] | size | Size of the IP packet or header (must be larger than the header size). |
| [out] | protocol | If not null, receives the type of the next protocol layer (TCP, UDP, etc). |
|
static |
Compute the checksum of an IPv4 header from raw data. The concept of header checksum is specific to IPv4. IPv6 headers do not have checksums.
| [in] | data | Address of the IP packet. |
| [in] | size | Size of the IP packet or header (must be larger than the header size). |
|
static |
Verify the checksum of an IPv4 header from raw data.
| [in] | data | Address of the IP packet. |
| [in] | size | Size of the IP packet or header (must be larger than the header size). |
|
static |
Update the checksum of an IPv4 header as raw data.
| [in,out] | data | Address of the IP packet. |
| [in] | size | Size of the IP packet or header (must be larger than the header size). |