9#include "data_stream_check_value.h"
59 std::stringstream socketFileName;
61 p_mock.setFileName(socketFileName.str());
68 p_mock.setIsRecord(isMockRecord);
80 check_stream_assert(
p_mock.checkCurrentValue(
"PMockSocket::sendMsg", msg));
95 p_mock.getCurrentValue(msg);
96 if(msg.size() == 0lu){
179 return (
const DataStreamIter)msg.data();
196 mockMsg.resize(dataSize);
205 size_t dataSize(mockMsg.size());
bool phoenix_createMockBackend(PMockSocket &mock, const PSocketParam &socketParam, const std::string &prefix, const PMockParam &extraParam)
Create a mock backend.
static void msgToMock(DataStreamMsg &mockMsg, const Message &msg)
Copy current backend message data into mock message.
static const DataStreamIter msgData(const Message &msg)
Get the data of a message.
PMockBackend()
Default constructor of PMockBackend.
static void msgResize(Message &msg, size_t sizeMsg)
Resize a message.
static Param server()
Create param for a server socket.
PMockParam Param
Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketM...
bool createClientSocket(Socket &socket, const PSocketParam &socketParam, const PMockParam ¶m)
Create a client socket.
static void mockToMsg(Message &msg, DataStreamMsg &mockMsg)
Copy mock message data into current backend message.
PMockSocket Socket
Define the socket of the backend used by the PAbstractSocketManager.
static Param client()
Create param for a client socket.
static size_t msgSize(const Message &msg)
Get the size of a message.
bool createServerSocket(Socket &socket, const PSocketParam &socketParam, const PMockParam ¶m)
Create a client socket.
DataStreamMsg Message
Define the type of message used by the PAbstractSocketManager.
Example of a mock socket with vector of messages.
PGenericVecMock< DataStreamMsg > p_mock
Mock handler.
PMockSocket()
Default constructor of hte PMockSocket.
Param p_extraParam
Extra parameters of the socket.
PSocketParam p_socketParam
Parameters of the socket.
void close()
Close the PMockSocket.
PSendStatus::PSendStatus sendMsg(const Message &msg, PSendFlag::PSendFlag flag=PSendFlag::BLOCK)
Specialisation to send a Message with the socket.
bool createServerSocket(const PSocketParam &socketParam, const Param &extraParam)
Initialise a server socket.
bool createClientSocket(const PSocketParam &socketParam, const Param &extraParam)
Initialise a client socket.
PRecvStatus::PRecvStatus recvMsg(Message &msg, PRecvFlag::PRecvFlag flag=PRecvFlag::BLOCK)
Recieved data with the socket.
bool isConnected() const
Say if the PMockSocket is connected.
void setIsMockRecord(bool isMockRecord)
Set the mock prefix (where to find/save it)
virtual ~PMockSocket()
Default destructor of hte PMockSocket.
void setMockPrefix(const std::string &mockPrefix)
Set the mock prefix (where to find/save it)
PRecvFlag
describe the receiving flag of the Socket
PRecvStatus
describe the result of the recv
PSendFlag
describe the sending flag of the Socket
PSendStatus
describe the result of the send
Set of parameters to be passed to create a socket with mock backend.
Parameters to create a socket.