21 #ifndef INCLUDE_OLA_TESTING_MOCKUDPSOCKET_H_ 22 #define INCLUDE_OLA_TESTING_MOCKUDPSOCKET_H_ 24 #include <cppunit/extensions/HelperMacros.h> 28 #include <ola/network/Socket.h> 66 ssize_t
SendTo(
const uint8_t *buffer,
69 unsigned short port)
const;
70 ssize_t
SendTo(
const uint8_t *buffer,
73 return SendTo(buffer, size, dest.Host(), dest.Port());
77 unsigned short port)
const;
80 return SendTo(data, dest.Host(), dest.Port());
83 bool RecvFrom(uint8_t *buffer, ssize_t *data_read)
const;
92 uint16_t &port)
const;
100 bool multicast_loop =
false);
106 void SetDiscardMode(
bool discard_mode) { m_discard_mode = discard_mode; }
109 void AddExpectedData(
const uint8_t *data,
129 bool CheckNetworkParamsMatch(
bool init_called,
145 typedef expected_call received_data;
150 ola::io::DescriptorHandle m_dummy_handle;
151 bool m_bound_to_port;
152 bool m_broadcast_set;
155 mutable std::queue<expected_call> m_expected_calls;
156 mutable std::queue<received_data> m_received_data;
161 unsigned int *size)
const;
186 #endif // INCLUDE_OLA_TESTING_MOCKUDPSOCKET_H_ bool EnableBroadcast()
Enable broadcasting for this socket.
Definition: MockUDPSocket.cpp:209
Represents Socket Addresses.
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Creates dummy copy constructor and assignment operator declarations.
Definition: Macro.h:44
bool SetTos(uint8_t tos)
Set the tos field for a socket.
Definition: MockUDPSocket.cpp:236
Definition: MockUDPSocket.h:170
The interface for UDPSockets.
Definition: Socket.h:48
bool Init()
Initialize the socket.
Definition: MockUDPSocket.cpp:59
bool JoinMulticast(const ola::network::IPV4Address &iface, const ola::network::IPV4Address &group, bool multicast_loop=false)
Join a multicast group.
Definition: MockUDPSocket.cpp:221
bool GetSocketAddress(ola::network::IPV4SocketAddress *address) const
Return the local address this socket is bound to.
Definition: MockUDPSocket.cpp:84
Definition: MockUDPSocket.h:54
ssize_t SendTo(ola::io::IOVecInterface *data, const ola::network::IPV4SocketAddress &dest) const
Send data from an IOVecInterface.
Definition: MockUDPSocket.h:78
bool Bind(const ola::network::IPV4SocketAddress &endpoint)
Bind this socket to an external address:port.
Definition: MockUDPSocket.cpp:77
ssize_t SendTo(const uint8_t *buffer, unsigned int size, const ola::network::IPV4Address &ip, unsigned short port) const
Send data on this UDPSocket.
Definition: MockUDPSocket.cpp:102
Represents a IPv4 Address.
Definition: IPV4Address.h:55
ssize_t SendTo(const uint8_t *buffer, unsigned int size, const ola::network::IPV4SocketAddress &dest) const
Send data on this UDPSocket.
Definition: MockUDPSocket.h:70
bool Close()
Close the socket.
Definition: MockUDPSocket.cpp:90
ola::io::DescriptorHandle WriteDescriptor() const
Returns the write descriptor for this socket.
Definition: MockUDPSocket.h:65
Definition: IOVecInterface.h:53
Represents an IPv4 Address.
bool SetMulticastInterface(const ola::network::IPV4Address &iface)
Set the outgoing interface to be used for multicast transmission.
Definition: MockUDPSocket.cpp:215
bool LeaveMulticast(const ola::network::IPV4Address &iface, const ola::network::IPV4Address &group)
Leave a multicast group.
Definition: MockUDPSocket.cpp:229
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
bool RecvFrom(uint8_t *buffer, ssize_t *data_read) const
Receive data.
Definition: MockUDPSocket.cpp:155
An IPv4 SocketAddress.
Definition: SocketAddress.h:78
ola::io::DescriptorHandle ReadDescriptor() const
Returns the read descriptor for this socket.
Definition: MockUDPSocket.h:64
void InjectData(const uint8_t *data, unsigned int size, const ola::network::IPV4Address &ip, uint16_t port)
Definition: MockUDPSocket.cpp:263