TSDuck v3.40-4033
MPEG Transport Stream Toolkit
|
Representation of a packet for MPE (Multi-Protocol Encapsulation). More...
#include <tsMPEPacket.h>
Public Member Functions | |
MPEPacket ()=default | |
Default constructor. | |
MPEPacket (ByteBlockPtr datagram, ShareMode mode, const MACAddress &mac=MACAddress(), PID pid=PID_NULL) | |
Constructor from a full datagram (including network headers). | |
MPEPacket (const MPEPacket &other, ShareMode mode) | |
Copy constructor. | |
MPEPacket (const Section §ion) | |
Constructor from a DSM-CC MPE section. | |
MPEPacket (MPEPacket &&other) noexcept | |
Move constructor. | |
void | clear () |
Clear content. | |
MPEPacket & | copy (const MPEPacket &other) |
Duplication. | |
MPEPacket & | copy (const Section §ion) |
Copy content from a DSM-CC MPE section. | |
void | createSection (Section §ion) const |
Create a DSM-CC MPE section containing the MPE packet. | |
const uint8_t * | datagram () const |
Access to the binary content of the complete network datagram. | |
size_t | datagramSize () const |
Size of the binary content of the complete network datagram. | |
IPAddress | destinationIPAddress () const |
Get the destination IP address. | |
MACAddress | destinationMACAddress () const |
Get the destination MAC address. | |
IPSocketAddress | destinationSocket () const |
Get the destination socket address. | |
uint16_t | destinationUDPPort () const |
Get the destination UDP port. | |
bool | isValid () const |
Check if the packet has valid content. | |
MPEPacket & | operator= (const MPEPacket &other) |
Assignment operator. | |
MPEPacket & | operator= (MPEPacket &&other) noexcept |
Move assignment operator. | |
void | setDestinationIPAddress (const IPAddress &ip) |
Set the destination IP address. | |
void | setDestinationMACAddress (const MACAddress &mac) |
Set the destination MAC address. | |
void | setDestinationSocket (const IPSocketAddress &sock) |
Set the destination socket address. | |
void | setDestinationUDPPort (uint16_t port) |
Set the destination UDP port. | |
void | setSourceIPAddress (const IPAddress &ip) |
Set the source IP address. | |
void | setSourcePID (PID pid) |
Set the source PID. | |
void | setSourceSocket (const IPSocketAddress &sock) |
Set the source socket address. | |
void | setSourceUDPPort (uint16_t port) |
Set the source UDP port. | |
bool | setUDPMessage (const uint8_t *data, size_t size) |
Replace the binary content of the UDP message. | |
IPAddress | sourceIPAddress () const |
Get the source IP address. | |
PID | sourcePID () const |
Get the source PID. | |
IPSocketAddress | sourceSocket () const |
Get the source socket address. | |
uint16_t | sourceUDPPort () const |
Get the source UDP port. | |
const uint8_t * | udpMessage () const |
Access to the binary content of the UDP message. | |
size_t | udpMessageSize () const |
Size of the binary content of the UDP message. | |
Representation of a packet for MPE (Multi-Protocol Encapsulation).
This implementation has the following restrictions:
|
default |
Default constructor.
Section is initially marked invalid.
Copy constructor.
[in] | other | Another instance to copy. |
[in] | mode | The datagram contents are either shared (ShareMode::SHARE) between the two instances or duplicated (ts::ShareMode::COPY). |
|
noexcept |
Move constructor.
[in,out] | other | Another instance to move. |
ts::MPEPacket::MPEPacket | ( | ByteBlockPtr | datagram, |
ShareMode | mode, | ||
const MACAddress & | mac = MACAddress() , |
||
PID | pid = PID_NULL |
||
) |
Constructor from a full datagram (including network headers).
[in] | datagram | Smart pointer to the complete datagram content. The datagram typically includes the IP and UDP headers. The datagram is analyzed and marked invalid if no valid UDP/IP header is found. |
[in] | mode | The datagram contents are either shared (ShareMode::SHARE) between the two instances or duplicated (ShareMode::COPY). |
[in] | mac | Destination MAC address. If unspecified and the destination IP address is multicast, the corresponding MAC address is used. |
[in] | pid | PID from which the DSM-CC section was read. |
ts::MPEPacket::MPEPacket | ( | const Section & | section | ) |
Constructor from a DSM-CC MPE section.
[in] | section | A binary DSM-CC MPE section. |
void ts::MPEPacket::clear | ( | ) |
Clear content.
Becomes invalid.
Assignment operator.
The contents are referenced, and thus shared between the two objects.
[in] | other | Other instance to assign to this object. |
Move assignment operator.
[in,out] | other | Other instance to move into this object. |
Duplication.
Similar to assignment but the objects are duplicated.
[in] | other | Other instance to duplicate into this object. |
Copy content from a DSM-CC MPE section.
[in] | section | A binary DSM-CC MPE section. |
void ts::MPEPacket::createSection | ( | Section & | section | ) | const |
Create a DSM-CC MPE section containing the MPE packet.
[out] | section | A binary DSM-CC MPE section to create. |
|
inline |
Check if the packet has valid content.
|
inline |
Get the source PID.
|
inline |
Set the source PID.
[in] | pid | The source PID. |
|
inline |
Get the destination MAC address.
|
inline |
Set the destination MAC address.
[in] | mac | The destination MAC address. |
IPAddress ts::MPEPacket::sourceIPAddress | ( | ) | const |
Get the source IP address.
void ts::MPEPacket::setSourceIPAddress | ( | const IPAddress & | ip | ) |
Set the source IP address.
[in] | ip | The source IP address. |
IPAddress ts::MPEPacket::destinationIPAddress | ( | ) | const |
Get the destination IP address.
void ts::MPEPacket::setDestinationIPAddress | ( | const IPAddress & | ip | ) |
Set the destination IP address.
[in] | ip | The destination IP address. |
uint16_t ts::MPEPacket::sourceUDPPort | ( | ) | const |
Get the source UDP port.
void ts::MPEPacket::setSourceUDPPort | ( | uint16_t | port | ) |
Set the source UDP port.
[in] | port | The source UDP port. |
uint16_t ts::MPEPacket::destinationUDPPort | ( | ) | const |
Get the destination UDP port.
void ts::MPEPacket::setDestinationUDPPort | ( | uint16_t | port | ) |
Set the destination UDP port.
[in] | port | The destination UDP port. |
IPSocketAddress ts::MPEPacket::sourceSocket | ( | ) | const |
Get the source socket address.
void ts::MPEPacket::setSourceSocket | ( | const IPSocketAddress & | sock | ) |
Set the source socket address.
[in] | sock | The source socket address. |
IPSocketAddress ts::MPEPacket::destinationSocket | ( | ) | const |
Get the destination socket address.
void ts::MPEPacket::setDestinationSocket | ( | const IPSocketAddress & | sock | ) |
Set the destination socket address.
[in] | sock | The destination socket address. |
const uint8_t * ts::MPEPacket::udpMessage | ( | ) | const |
Access to the binary content of the UDP message.
Do not modify content.
size_t ts::MPEPacket::udpMessageSize | ( | ) | const |
Size of the binary content of the UDP message.
|
inline |
Access to the binary content of the complete network datagram.
Do not modify content.
|
inline |
Size of the binary content of the complete network datagram.
bool ts::MPEPacket::setUDPMessage | ( | const uint8_t * | data, |
size_t | size | ||
) |
Replace the binary content of the UDP message.
[in] | data | Address of the binary content of the UDP message payload. |
[in] | size | Size of the binary content of the UDP message. May be invalidated after modification in section. |