A customized UDP socket class which extends usual UDP socket functionality by adding the ability to receive the destination address of a received packet.
More...
#include <extended_udp_socket.hpp>
A customized UDP socket class which extends usual UDP socket functionality by adding the ability to receive the destination address of a received packet.
This is useful for RTP where sessions are defined by the source and destination endpoints. Also in cases where a single receiver is receiving from multiple senders, the destination address is needed to determine the source of the packet. This class also adds the ability to set dscp values for the socket.
Definition at line 46 of file extended_udp_socket.hpp.
◆ HandlerType
◆ ExtendedUdpSocket() [1/4]
| rav::ExtendedUdpSocket::ExtendedUdpSocket |
( |
boost::asio::io_context & | io_context, |
|
|
const boost::asio::ip::udp::endpoint & | endpoint ) |
Construct a new instance of the class.
- Parameters
-
| io_context | The asio io_context to use. |
| endpoint | The endpoint to bind to. |
◆ ExtendedUdpSocket() [2/4]
| rav::ExtendedUdpSocket::ExtendedUdpSocket |
( |
boost::asio::io_context & | io_context, |
|
|
const boost::asio::ip::address & | interface_address, |
|
|
uint16_t | port ) |
Construct a new instance of the class.
- Parameters
-
| io_context | The asio io_context to use. |
| interface_address | The address to bind to. |
| port | The port to bind to. |
◆ ExtendedUdpSocket() [3/4]
| rav::ExtendedUdpSocket::ExtendedUdpSocket |
( |
const ExtendedUdpSocket & | | ) |
|
|
delete |
◆ ExtendedUdpSocket() [4/4]
| rav::ExtendedUdpSocket::ExtendedUdpSocket |
( |
ExtendedUdpSocket && | | ) |
|
|
deletenoexcept |
◆ ~ExtendedUdpSocket()
| rav::ExtendedUdpSocket::~ExtendedUdpSocket |
( |
| ) |
|
◆ join_multicast_group()
| boost::system::error_code rav::ExtendedUdpSocket::join_multicast_group |
( |
const boost::asio::ip::address_v4 & | multicast_address, |
|
|
const boost::asio::ip::address_v4 & | interface_address ) const |
|
nodiscard |
Join a multicast group.
- Parameters
-
| multicast_address | The multicast address to join. |
| interface_address | The interface address to join the multicast group on. |
- Returns
- Success if the operation was successful, error code otherwise.
◆ leave_multicast_group()
| boost::system::error_code rav::ExtendedUdpSocket::leave_multicast_group |
( |
const boost::asio::ip::address_v4 & | multicast_address, |
|
|
const boost::asio::ip::address_v4 & | interface_address ) const |
|
nodiscard |
Leave a multicast group.
- Parameters
-
| multicast_address | The multicast address to leave. |
| interface_address | The interface address to leave the multicast group on. |
- Returns
- Success if the operation was successful, error code otherwise.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ send()
| void rav::ExtendedUdpSocket::send |
( |
const uint8_t * | data, |
|
|
size_t | size, |
|
|
const boost::asio::ip::udp::endpoint & | endpoint ) const |
Sends a datagram to the given endpoint.
- Parameters
-
| data | The data to send. |
| size | The size of the data. Must be smaller than MTU. |
| endpoint | The endpoint to send the data to. |
◆ set_dscp_value()
| void rav::ExtendedUdpSocket::set_dscp_value |
( |
int | value | ) |
const |
Set the DSCP value for the socket.
The value will be shifted 2 bits to the left, which sets the ECN bits to zero.
- Parameters
-
| value | The DSCP value to set. |
◆ set_multicast_loopback()
| boost::system::error_code rav::ExtendedUdpSocket::set_multicast_loopback |
( |
bool | enable | ) |
const |
|
nodiscard |
Set the multicast loopback option.
- Parameters
-
| enable | True to enable multicast loopback, false to disable. |
- Returns
- True if the operation was successful, false otherwise.
◆ set_multicast_outbound_interface()
| boost::system::error_code rav::ExtendedUdpSocket::set_multicast_outbound_interface |
( |
const boost::asio::ip::address_v4 & | interface_address | ) |
const |
|
nodiscard |
Set the outbound interface for multicast packets.
- Parameters
-
| interface_address | The address of the interface to use. |
- Returns
- True if the operation was successful, false otherwise.
◆ start()
| void rav::ExtendedUdpSocket::start |
( |
HandlerType | handler | ) |
const |
Start the receiver.
- Parameters
-
| handler | The handler to receive incoming packets. |
The documentation for this class was generated from the following file: