23 #ifndef INCLUDE_OLA_NETWORK_SOCKET_H_ 24 #define INCLUDE_OLA_NETWORK_SOCKET_H_ 35 #include <ola/io/IOQueue.h> 57 virtual bool Init() = 0;
77 virtual bool Close() = 0;
92 virtual ssize_t
SendTo(
const uint8_t *buffer,
95 unsigned short port)
const = 0;
104 virtual ssize_t
SendTo(
const uint8_t *buffer,
123 unsigned short port)
const = 0;
145 virtual bool RecvFrom(uint8_t *buffer, ssize_t *data_read)
const = 0;
177 uint16_t &port)
const = 0;
187 virtual bool RecvFrom(uint8_t *buffer,
212 bool multicast_loop =
false) = 0;
228 virtual bool SetTos(uint8_t tos) = 0;
242 m_handle(ola::io::INVALID_DESCRIPTOR),
243 m_bound_to_port(
false) {}
253 ssize_t
SendTo(
const uint8_t *buffer,
256 unsigned short port)
const;
257 ssize_t
SendTo(
const uint8_t *buffer,
262 unsigned short port)
const;
266 bool RecvFrom(uint8_t *buffer, ssize_t *data_read)
const;
273 uint16_t &port)
const;
283 bool multicast_loop =
false);
290 ola::io::DescriptorHandle m_handle;
291 bool m_bound_to_port;
297 #endif // INCLUDE_OLA_NETWORK_SOCKET_H_ virtual bool LeaveMulticast(const IPV4Address &iface, const IPV4Address &group)=0
Leave a multicast group.
Represents Socket Addresses.
virtual bool GetSocketAddress(IPV4SocketAddress *address) const =0
Return the local address this socket is bound to.
virtual ssize_t SendTo(const uint8_t *buffer, unsigned int size, const IPV4Address &ip, unsigned short port) const =0
Send data on this UDPSocket.
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Creates dummy copy constructor and assignment operator declarations.
Definition: Macro.h:44
The interface for UDPSockets.
Definition: Socket.h:48
virtual bool SetMulticastInterface(const IPV4Address &iface)=0
Set the outgoing interface to be used for multicast transmission.
virtual bool RecvFrom(uint8_t *buffer, ssize_t *data_read) const =0
Receive data.
ola::io::DescriptorHandle WriteDescriptor() const
Returns the write descriptor for this socket.
Definition: Socket.h:252
ola::io::DescriptorHandle ReadDescriptor() const
Returns the read descriptor for this socket.
Definition: Socket.h:251
virtual bool Init()=0
Initialize the socket.
virtual bool JoinMulticast(const IPV4Address &iface, const IPV4Address &group, bool multicast_loop=false)=0
Join a multicast group.
Represents a IPv4 Address.
Definition: IPV4Address.h:55
A file descriptor that supports both read & write.
Definition: Descriptor.h:200
virtual ola::io::DescriptorHandle WriteDescriptor() const =0
Returns the write descriptor for this socket.
virtual bool Bind(const IPV4SocketAddress &endpoint)=0
Bind this socket to an external address:port.
virtual ola::io::DescriptorHandle ReadDescriptor() const =0
Returns the read descriptor for this socket.
virtual bool Close()=0
Close the socket.
Definition: IOVecInterface.h:53
Represents an IPv4 Address.
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
virtual bool SetTos(uint8_t tos)=0
Set the tos field for a socket.
An IPv4 SocketAddress.
Definition: SocketAddress.h:78
virtual bool EnableBroadcast()=0
Enable broadcasting for this socket.