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>
64 int ReadDescriptor()
const {
return m_dummy_sd; }
65 int WriteDescriptor()
const {
return m_dummy_sd; }
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;
84 bool RecvFrom(uint8_t *buffer,
87 bool RecvFrom(uint8_t *buffer,
90 uint16_t &port)
const;
91 bool EnableBroadcast();
99 bool SetTos(uint8_t tos);
101 void SetDiscardMode(
bool discard_mode) { m_discard_mode = discard_mode; }
104 void AddExpectedData(
const uint8_t *data,
124 bool CheckNetworkParamsMatch(
bool init_called,
140 typedef expected_call received_data;
146 bool m_bound_to_port;
147 bool m_broadcast_set;
150 mutable std::queue<expected_call> m_expected_calls;
151 mutable std::queue<received_data> m_received_data;
156 unsigned int *size)
const;
181 #endif // INCLUDE_OLA_TESTING_MOCKUDPSOCKET_H_