Open Lighting Architecture
Latest Git
|
Public Member Functions | |
bool | Init () |
Initialize the socket. More... | |
bool | Bind (const ola::network::IPV4SocketAddress &endpoint) |
Bind this socket to an external address:port. More... | |
bool | GetSocketAddress (ola::network::IPV4SocketAddress *address) const |
Return the local address this socket is bound to. More... | |
bool | Close () |
Close the socket. More... | |
ola::io::DescriptorHandle | ReadDescriptor () const |
Returns the read descriptor for this socket. More... | |
ola::io::DescriptorHandle | WriteDescriptor () const |
Returns the write descriptor for this socket. More... | |
ssize_t | SendTo (const uint8_t *buffer, unsigned int size, const ola::network::IPV4Address &ip, unsigned short port) const |
Send data on this UDPSocket. More... | |
ssize_t | SendTo (const uint8_t *buffer, unsigned int size, const ola::network::IPV4SocketAddress &dest) const |
Send data on this UDPSocket. More... | |
ssize_t | SendTo (ola::io::IOVecInterface *data, const ola::network::IPV4Address &ip, unsigned short port) const |
Send data from an IOVecInterface. More... | |
ssize_t | SendTo (ola::io::IOVecInterface *data, const ola::network::IPV4SocketAddress &dest) const |
Send data from an IOVecInterface. More... | |
bool | RecvFrom (uint8_t *buffer, ssize_t *data_read) const |
Receive data. More... | |
bool | RecvFrom (uint8_t *buffer, ssize_t *data_read, ola::network::IPV4Address &source) const |
Receive data. More... | |
bool | RecvFrom (uint8_t *buffer, ssize_t *data_read, ola::network::IPV4Address &source, uint16_t &port) const |
Receive data and record the src address & port. More... | |
bool | RecvFrom (uint8_t *buffer, ssize_t *data_read, ola::network::IPV4SocketAddress *source) |
Receive a datagram on the UDP Socket. More... | |
bool | EnableBroadcast () |
Enable broadcasting for this socket. More... | |
bool | SetMulticastInterface (const ola::network::IPV4Address &iface) |
Set the outgoing interface to be used for multicast transmission. More... | |
bool | JoinMulticast (const ola::network::IPV4Address &iface, const ola::network::IPV4Address &group, bool multicast_loop=false) |
Join a multicast group. More... | |
bool | LeaveMulticast (const ola::network::IPV4Address &iface, const ola::network::IPV4Address &group) |
Leave a multicast group. More... | |
bool | SetTos (uint8_t tos) |
Set the tos field for a socket. More... | |
void | SetDiscardMode (bool discard_mode) |
void | AddExpectedData (const uint8_t *data, unsigned int size, const ola::network::IPV4Address &ip, uint16_t port) |
void | AddExpectedData (ola::io::IOQueue *queue, const ola::network::IPV4SocketAddress &dest) |
void | InjectData (const uint8_t *data, unsigned int size, const ola::network::IPV4Address &ip, uint16_t port) |
void | InjectData (const uint8_t *data, unsigned int size, const ola::network::IPV4SocketAddress &source) |
void | InjectData (ola::io::IOQueue *ioqueue, const ola::network::IPV4SocketAddress &source) |
void | Verify () |
bool | CheckNetworkParamsMatch (bool init_called, bool bound_to_port, uint16_t port, bool broadcast_set) |
void | SetInterface (const ola::network::IPV4Address &iface) |
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... | |
|
virtual |
Bind this socket to an external address:port.
endpoint | the local socket address to bind to. |
Implements ola::network::UDPSocketInterface.
|
virtual |
Close the socket.
Implements ola::network::UDPSocketInterface.
|
virtual |
Enable broadcasting for this socket.
Implements ola::network::UDPSocketInterface.
|
virtual |
Return the local address this socket is bound to.
[out] | address | the local socket address this socket is bound to. |
Implements ola::network::UDPSocketInterface.
|
virtual |
Initialize the socket.
Implements ola::network::UDPSocketInterface.
void ola::testing::MockUDPSocket::InjectData | ( | const uint8_t * | data, |
unsigned int | size, | ||
const ola::network::IPV4Address & | ip, | ||
uint16_t | port | ||
) |
Ownership of the data is not transferred.
void ola::testing::MockUDPSocket::InjectData | ( | const uint8_t * | data, |
unsigned int | size, | ||
const ola::network::IPV4SocketAddress & | source | ||
) |
Ownership of the data is not transferred.
void ola::testing::MockUDPSocket::InjectData | ( | ola::io::IOQueue * | ioqueue, |
const ola::network::IPV4SocketAddress & | source | ||
) |
Inject the data in an IOQueue into the socket. This acts as if the data was received on the UDP socket.
ioqueue | the data to inject |
source | the socket address where this fake data came from |
|
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 |
Implements ola::network::UDPSocketInterface.
|
virtual |
Leave a multicast group.
iface | the address of the interface to use. |
group | the address of the group to join |
Implements ola::network::UDPSocketInterface.
|
inlinevirtual |
Returns the read descriptor for this socket.
Implements ola::network::UDPSocketInterface.
|
virtual |
Receive data.
buffer | the buffer to store the data |
data_read | the size of the buffer, updated with the number of bytes read |
Implements ola::network::UDPSocketInterface.
|
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 |
Implements ola::network::UDPSocketInterface.
|
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 |
Implements ola::network::UDPSocketInterface.
|
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. |
Implements ola::network::UDPSocketInterface.
|
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. |
Implements ola::network::UDPSocketInterface.
|
inlinevirtual |
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. |
Implements ola::network::UDPSocketInterface.
|
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.
Implements ola::network::UDPSocketInterface.
|
inlinevirtual |
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.
Implements ola::network::UDPSocketInterface.
|
virtual |
Set the outgoing interface to be used for multicast transmission.
iface | the address of the interface to use. |
Implements ola::network::UDPSocketInterface.
|
virtual |
Set the tos field for a socket.
tos | the tos field |
Implements ola::network::UDPSocketInterface.
|
inlinevirtual |
Returns the write descriptor for this socket.
Implements ola::network::UDPSocketInterface.