Open Lighting Architecture
Latest Git
|
The interface for UDPSockets.
This only supports IPv4 sockets. Its an Interface so we can mock it out for testing.
Public Member Functions | |
virtual bool | Init ()=0 |
Initialize the socket. More... | |
virtual bool | Bind (const IPV4SocketAddress &endpoint)=0 |
Bind this socket to an external address:port. More... | |
virtual bool | GetSocketAddress (IPV4SocketAddress *address) const =0 |
Return the local address this socket is bound to. More... | |
virtual bool | Close ()=0 |
Close the socket. More... | |
virtual ola::io::DescriptorHandle | ReadDescriptor () const =0 |
Returns the read descriptor for this socket. More... | |
virtual ola::io::DescriptorHandle | WriteDescriptor () const =0 |
Returns the write descriptor for this socket. More... | |
virtual ssize_t | SendTo (const uint8_t *buffer, unsigned int size, const IPV4Address &ip, unsigned short port) const =0 |
Send data on this UDPSocket. More... | |
virtual ssize_t | SendTo (const uint8_t *buffer, unsigned int size, const IPV4SocketAddress &dest) const =0 |
Send data on this UDPSocket. More... | |
virtual ssize_t | SendTo (ola::io::IOVecInterface *data, const IPV4Address &ip, unsigned short port) const =0 |
Send data from an IOVecInterface. More... | |
virtual ssize_t | SendTo (ola::io::IOVecInterface *data, const IPV4SocketAddress &dest) const =0 |
Send data from an IOVecInterface. More... | |
virtual bool | RecvFrom (uint8_t *buffer, ssize_t *data_read) const =0 |
Receive data. More... | |
virtual bool | RecvFrom (uint8_t *buffer, ssize_t *data_read, IPV4Address &source) const =0 |
Receive data. More... | |
virtual bool | RecvFrom (uint8_t *buffer, ssize_t *data_read, IPV4Address &source, uint16_t &port) const =0 |
Receive data and record the src address & port. More... | |
virtual bool | RecvFrom (uint8_t *buffer, ssize_t *data_read, IPV4SocketAddress *source)=0 |
Receive a datagram on the UDP Socket. More... | |
virtual bool | EnableBroadcast ()=0 |
Enable broadcasting for this socket. More... | |
virtual bool | SetMulticastInterface (const IPV4Address &iface)=0 |
Set the outgoing interface to be used for multicast transmission. More... | |
virtual bool | JoinMulticast (const IPV4Address &iface, const IPV4Address &group, bool multicast_loop=false)=0 |
Join a multicast group. More... | |
virtual bool | LeaveMulticast (const IPV4Address &iface, const IPV4Address &group)=0 |
Leave a multicast group. More... | |
virtual bool | SetTos (uint8_t tos)=0 |
Set the tos field for a socket. More... | |
Public Member Functions inherited from ola::io::BidirectionalFileDescriptor | |
void | SetOnData (ola::Callback0< void > *on_read) |
Set the callback to be run when data is available for reading. More... | |
void | SetOnWritable (ola::Callback0< void > *on_write) |
Set the callback to be run when the descriptor can be written to. More... | |
void | PerformRead () |
Called when there is data available on the descriptor. More... | |
void | PerformWrite () |
Called when the descriptor can be written to. More... | |
Public Member Functions inherited from ola::io::ReadFileDescriptor | |
bool | ValidReadDescriptor () const |
Check if this file descriptor is valid. More... | |
Public Member Functions inherited from ola::io::WriteFileDescriptor | |
bool | ValidWriteDescriptor () const |
Check if this file descriptor is valid. More... | |
|
pure virtual |
Bind this socket to an external address:port.
endpoint | the local socket address to bind to. |
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Close the socket.
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Enable broadcasting for this socket.
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Return the local address this socket is bound to.
[out] | address | the local socket address this socket is bound to. |
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Initialize the socket.
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Join a multicast group.
iface | the address of the interface to use. |
group | the address of the group to join |
multicast_loop | enable multicast loop |
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Leave a multicast group.
iface | the address of the interface to use. |
group | the address of the group to join |
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Returns the read descriptor for this socket.
Implements ola::io::ReadFileDescriptor.
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Receive data.
buffer | the buffer to store the data |
data_read | the size of the buffer, updated with the number of bytes read |
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Receive data.
buffer | the buffer to store the data |
data_read | the size of the buffer, updated with the number of bytes read |
source | the src ip of the packet |
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Receive data and record the src address & port.
buffer | the buffer to store the data |
data_read | the size of the buffer, updated with the number of bytes read |
source | the src ip of the packet |
port | the src port of the packet in host byte order |
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Receive a datagram on the UDP Socket.
buffer | the buffer to store the data |
data_read | the size of the buffer, updated with the number of bytes read |
source | the source of the datagram. |
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Send data on this UDPSocket.
buffer | the data to send |
size | the length of the data |
ip | the IP to send to |
port | the port to send to in HOST byte order. |
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Send data on this UDPSocket.
buffer | the data to send |
size | the length of the data |
dest | the IP:Port to send the datagram to. |
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Send data from an IOVecInterface.
data | the IOVecInterface class to send. |
ip | the IP to send to |
port | the port to send to in HOST byte order. |
This will try to send as much data as possible. If the data exceeds the MTU the UDP packet will probably get fragmented at the IP layer (depends on OS really). Try to avoid this.
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Send data from an IOVecInterface.
data | the IOVecInterface class to send. |
dest | the IPV4SocketAddress to send to |
This will try to send as much data as possible. If the data exceeds the MTU the UDP packet will probably get fragmented at the IP layer (depends on OS really). Try to avoid this.
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Set the outgoing interface to be used for multicast transmission.
iface | the address of the interface to use. |
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Set the tos field for a socket.
tos | the tos field |
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.
|
pure virtual |
Returns the write descriptor for this socket.
Implements ola::io::WriteFileDescriptor.
Implemented in ola::network::UDPSocket, and ola::testing::MockUDPSocket.