![]() |
PhoenixSocket
1.0.0
Library which integrates socket unix use in Phoenix
|
Backend to use Mock library with PAbtractSocket. More...
#include <PMockBackend.h>
Public Types | |
typedef DataStreamMsg | Message |
Define the type of message used by the PAbstractSocketManager. | |
typedef PMockParam | Param |
Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketManager. | |
typedef PMockSocket | Socket |
Define the socket of the backend used by the PAbstractSocketManager. | |
Public Member Functions | |
PMockBackend () | |
Default constructor of PMockBackend. | |
Static Public Member Functions | |
static Param | client () |
Create param for a client socket. | |
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 bool | createServerSocket (Socket &socket, const std::string &address, size_t port, const PMockParam ¶m) |
Create a client socket. | |
static bool | isConnected (const Socket &socket) |
Say if the given socket is connected. | |
static void | mockToMsg (Message &msg, DataStreamMsg &mockMsg) |
Copy mock message data into current backend message. | |
static const DataStreamIter | msgData (const Message &msg) |
Get the data of a message. | |
static DataStreamIter | msgData (Message &msg) |
Get the data of a message. | |
static void | msgResize (Message &msg, size_t sizeMsg) |
Resize a message. | |
static size_t | msgSize (const Message &msg) |
Get the size of a message. | |
static void | msgToMock (DataStreamMsg &mockMsg, const Message &msg) |
Copy current backend message data into mock message. | |
static bool | recv (Socket &socket, Message &msg, PRecvFlag::PRecvFlag flag) |
Recieve message from the given socket. | |
static bool | send (Socket &socket, const Message &msg, PSendFlag::PSendFlag flag) |
Send message on the given socket. | |
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) | |
static void | setMockPrefix (Socket &socket, const std::string &mockPrefix) |
Set the mock prefix (where to find/save it) | |
Backend to use Mock library with PAbtractSocket.
Definition at line 38 of file PMockBackend.h.
typedef DataStreamMsg PMockBackend::Message |
Define the type of message used by the PAbstractSocketManager.
Definition at line 43 of file PMockBackend.h.
typedef PMockParam PMockBackend::Param |
Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketManager.
Definition at line 45 of file PMockBackend.h.
typedef PMockSocket PMockBackend::Socket |
Define the socket of the backend used by the PAbstractSocketManager.
Definition at line 41 of file PMockBackend.h.
PMockBackend::PMockBackend | ( | ) |
|
static |
Create param for a client socket.
Definition at line 66 of file PMockBackend.cpp.
Referenced by server().
|
static |
Close the given socket.
[out] | socket | : socket to be closed |
Definition at line 216 of file PMockBackend.cpp.
References PMockSocket::fileNameMessage, PMockParam::isMockRecord, PMockSocket::param, and PMockSocket::vecMessage.
|
static |
Create a client socket.
[out] | socket | : socket to be created |
address | : address of the server, the client has to connect to | |
port | : port to be used for the connection | |
param | : extra customisable parameters for the creation of the socket (depends on the backend) |
Definition at line 85 of file PMockBackend.cpp.
References PMockSocket::eventIndex, PMockSocket::fileNameMessage, PMockParam::isMockRecord, PMockParam::mockPrefix, PMockSocket::param, and PMockSocket::vecMessage.
Referenced by createServerSocket().
|
static |
Create a client socket.
[out] | socket | : socket to be created |
param | : extra customisable parameters for the creation of the socket (depends on the backend) |
Definition at line 108 of file PMockBackend.cpp.
References createClientSocket().
|
static |
Say if the given socket is connected.
socket | : socket to be checked |
Definition at line 226 of file PMockBackend.cpp.
|
static |
Copy mock message data into current backend message.
[out] | msg | : message of the current backend to be converted |
mockMsg | : mock message |
Definition at line 244 of file PMockBackend.cpp.
References msgData(), and msgResize().
|
static |
Get the data of a message.
msg | : message to be used |
Definition at line 201 of file PMockBackend.cpp.
Referenced by mockToMsg(), and msgToMock().
|
static |
Get the data of a message.
msg | : message to be used |
Definition at line 209 of file PMockBackend.cpp.
|
static |
Resize a message.
[out] | msg | : message to be resized |
sizeMsg | : new size of the message |
Definition at line 185 of file PMockBackend.cpp.
Referenced by mockToMsg().
|
static |
Get the size of a message.
msg | : message to be used |
Definition at line 193 of file PMockBackend.cpp.
Referenced by msgToMock().
|
static |
Copy current backend message data into mock message.
[out] | mockMsg | : mock message |
msg | : message of the current backend to be converted |
Definition at line 234 of file PMockBackend.cpp.
References msgData(), and msgSize().
|
static |
Recieve message from the given socket.
socket | : socket to be used |
msg | : message to be recieved |
flag | : flag to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 163 of file PMockBackend.cpp.
References PMockSocket::eventIndex, PMockParam::isMockRecord, PMockSocket::param, and PMockSocket::vecMessage.
|
static |
Send message on the given socket.
socket | : socket to be used |
msg | : message to be sent |
flag | : flag to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 135 of file PMockBackend.cpp.
References PMockSocket::eventIndex, PMockParam::isMockRecord, PMockSocket::param, and PMockSocket::vecMessage.
|
static |
Create param for a server socket.
Definition at line 74 of file PMockBackend.cpp.
References client().
|
static |
Set the mock prefix (where to find/save it)
[out] | socket | : socket to be modified |
isMockRecord | : true if the mock has to be recorded |
Definition at line 124 of file PMockBackend.cpp.
References PMockParam::isMockRecord, and PMockSocket::param.
|
static |
Set the mock prefix (where to find/save it)
[out] | socket | : socket to be modified |
mockPrefix | : prefix of the mock to find or write it |
Definition at line 116 of file PMockBackend.cpp.
References PMockParam::mockPrefix, and PMockSocket::param.