7#ifndef __PMOCKBACKEND_H__
8#define __PMOCKBACKEND_H__
bool phoenix_loadMockSocket(const std::string &prefix, const std::string &host, size_t port, PVecMockMessage &vecMessage)
Load a mock of socket.
bool phoenix_saveMockSocket(const std::string &prefix, const std::string &host, size_t port, const PVecMockMessage &vecMessage)
Save a mock of socket.
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.
static bool send(Socket &socket, const Message &msg, PSendFlag::PSendFlag flag)
Send message on the given socket.
PMockBackend()
Default constructor of PMockBackend.
static void msgResize(Message &msg, size_t sizeMsg)
Resize a message.
static bool isConnected(const Socket &socket)
Say if the given socket is connected.
static Param server()
Create param for a server socket.
static void setIsMockRecord(Socket &socket, bool isMockRecord)
Set the mock prefix (where to find/save it)
PMockParam Param
Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketM...
static void setMockPrefix(Socket &socket, const std::string &mockPrefix)
Set the mock prefix (where to find/save it)
static void mockToMsg(Message &msg, DataStreamMsg &mockMsg)
Copy mock message data into current backend message.
static bool recv(Socket &socket, Message &msg, PRecvFlag::PRecvFlag flag)
Recieve message from the given socket.
PMockSocket Socket
Define the socket of the backend used by the PAbstractSocketManager.
static void close(Socket &socket)
Close the given socket.
static bool createClientSocket(Socket &socket, const std::string &address, size_t port, const PMockParam ¶m)
Create a client socket.
static Param client()
Create param for a client socket.
static size_t msgSize(const Message &msg)
Get the size of a message.
static bool createServerSocket(Socket &socket, const std::string &address, size_t port, const PMockParam ¶m)
Create a client socket.
DataStreamMsg Message
Define the type of message used by the PAbstractSocketManager.
PRecvFlag
describe the recieving flag of the Socket
PSendFlag
describe the sending flag of the Socket
std::vector< DataStreamMsg > PVecMockMessage
Vector of messages.
Set of parameters to be passed to create a socket with mock backend.
size_t port
Connection port.
std::string mockPrefix
Prefix where to find/save mock files.
std::string address
Host address.
bool isMockRecord
True to record the activity of the backend durring real use to make reusable mock.
Data to be used to handle the mock socket.
PMockParam param
Parameters of the mock.
std::string fileNameMessage
Name of the file to read messages.
PVecMockMessage vecMessage
Vector of messages.
size_t eventIndex
Index of the current message.