7 #ifndef __PMOCKBACKEND_H__
8 #define __PMOCKBACKEND_H__
49 static Param client(
const std::string & address,
size_t port,
bool isMockRecord,
const std::string & mockDirectory);
50 static Param server(
const std::string & address,
size_t port,
bool isMockRecord,
const std::string & mockDirectory);
Backend to use Mock library with PAbtractSocket.
static void msgToMock(DataStreamMsg &mockMsg, const Message &msg)
Copy current backend message data into mock message.
static bool createClientSocket(Socket &socket, const PMockParam ¶m)
Create a client socket.
static const DataStreamIter msgData(const Message &msg)
Get the data of a message.
static Param client(const std::string &address, size_t port, bool isMockRecord, const std::string &mockDirectory)
Create param for a client socket.
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 bool createServerSocket(Socket &socket, const PMockParam ¶m)
Create a client socket.
PMockParam Param
Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketM...
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 Param server(const std::string &address, size_t port, bool isMockRecord, const std::string &mockDirectory)
Create param for a server socket.
static size_t msgSize(const Message &msg)
Get the size of a message.
DataStreamMsg Message
Define the type of message used by the PAbstractSocketManager.
std::vector< DataStreamType > DataStreamMsg
DataStreamType * DataStreamIter
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 address
Host address.
std::string mockDirectory
Directory where to find/save mock files.
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.