21 #ifndef INCLUDE_OLA_TESTING_MOCKUDPSOCKET_H_
22 #define INCLUDE_OLA_TESTING_MOCKUDPSOCKET_H_
24 #include <cppunit/extensions/HelperMacros.h>
28 #include "ola/network/IPV4Address.h"
29 #include "ola/network/Socket.h"
30 #include "ola/network/SocketAddress.h"
67 int ReadDescriptor()
const {
return m_dummy_sd; }
68 int WriteDescriptor()
const {
return m_dummy_sd; }
69 ssize_t SendTo(
const uint8_t *buffer,
72 unsigned short port)
const;
73 ssize_t SendTo(
const uint8_t *buffer,
76 return SendTo(buffer, size, dest.Host(), dest.Port());
80 unsigned short port)
const;
83 return SendTo(data, dest.Host(), dest.Port());
86 bool RecvFrom(uint8_t *buffer, ssize_t *data_read)
const;
87 bool RecvFrom(uint8_t *buffer,
90 bool RecvFrom(uint8_t *buffer,
93 uint16_t &port)
const;
94 bool EnableBroadcast();
95 bool SetMulticastInterface(
const IPV4Address &interface);
102 bool SetTos(uint8_t tos);
104 void SetDiscardMode(
bool discard_mode) { m_discard_mode = discard_mode; }
107 void AddExpectedData(
const uint8_t *data,
125 bool CheckNetworkParamsMatch(
bool init_called,
141 typedef expected_call received_data;
147 bool m_bound_to_port;
148 bool m_broadcast_set;
151 mutable std::queue<expected_call> m_expected_calls;
152 mutable std::queue<received_data> m_received_data;
156 uint8_t* IOQueueToBuffer(
IOQueue *ioqueue,
unsigned int *size)
const;
177 #endif // INCLUDE_OLA_TESTING_MOCKUDPSOCKET_H_