![]() |
|
PhoenixSocket
4.0.1
Library which integrates socket unix use in Phoenix
|
Example of a mock socket with vector of messages. More...
#include <PMockBackend.h>
Collaboration diagram for PMockSocket: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. | |
Public Member Functions | |
| void | close () |
| Close the PMockSocket. | |
| bool | createClientSocket (const PSocketParam &socketParam, const Param &extraParam) |
| Initialise a client socket. | |
| bool | createServerSocket (const PSocketParam &socketParam, const Param &extraParam) |
| Initialise a server socket. | |
| bool | isConnected () const |
| Say if the PMockSocket is connected. | |
| PMockSocket () | |
| Default constructor of hte PMockSocket. | |
| template<typename T> | |
| PRecvStatus::PRecvStatus | recvData (T &data, PRecvFlag::PRecvFlag flag=PRecvFlag::BLOCK) |
| Recieved data with the socket. | |
| PRecvStatus::PRecvStatus | recvMsg (Message &msg, PRecvFlag::PRecvFlag flag=PRecvFlag::BLOCK) |
| Recieved data with the socket. | |
| template<typename T> | |
| PSendStatus::PSendStatus | sendData (const T &data, PSendFlag::PSendFlag flag=PSendFlag::BLOCK) |
| Send data with the socket. | |
| PSendStatus::PSendStatus | sendMsg (const Message &msg, PSendFlag::PSendFlag flag=PSendFlag::BLOCK) |
| Specialisation to send a Message with the socket. | |
| void | setIsMockRecord (bool isMockRecord) |
| Set the mock prefix (where to find/save it) | |
| void | setMockPrefix (const std::string &mockPrefix) |
| Set the mock prefix (where to find/save it) | |
| virtual | ~PMockSocket () |
| Default destructor of hte PMockSocket. | |
Private Attributes | |
| Param | p_extraParam |
| Extra parameters of the socket. | |
| PGenericVecMock< DataStreamMsg > | p_mock |
| Mock handler. | |
| PSocketParam | p_socketParam |
| Parameters of the socket. | |
Example of a mock socket with vector of messages.
Definition at line 17 of file PMockBackend.h.
| typedef DataStreamMsg PMockSocket::Message |
Define the type of message used by the PAbstractSocketManager.
Definition at line 20 of file PMockBackend.h.
| typedef PMockParam PMockSocket::Param |
Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketManager.
Definition at line 22 of file PMockBackend.h.
| PMockSocket::PMockSocket | ( | ) |
|
virtual |
| void PMockSocket::close | ( | ) |
Close the PMockSocket.
Definition at line 112 of file PMockBackend.cpp.
References p_mock.
| bool PMockSocket::createClientSocket | ( | const PSocketParam & | socketParam, |
| const Param & | extraParam ) |
Initialise a client socket.
| socketParam | : parameters to be use to initialise the socket (hostname, port, etc) |
| extraParam | : extra customisable parameters for the creation of the socket (depends on the backend) |
Definition at line 40 of file PMockBackend.cpp.
References p_extraParam, and p_socketParam.
Referenced by PMockBackend::createClientSocket(), createServerSocket(), and phoenix_createMockBackend().
Here is the caller graph for this function:| bool PMockSocket::createServerSocket | ( | const PSocketParam & | socketParam, |
| const Param & | extraParam ) |
Initialise a server socket.
| socketParam | : parameters to be use to initialise the socket (hostname, port, etc) |
| extraParam | : extra customisable parameters for the creation of the socket (depends on the backend) |
Definition at line 51 of file PMockBackend.cpp.
References createClientSocket().
Here is the call graph for this function:| bool PMockSocket::isConnected | ( | ) | const |
Say if the PMockSocket is connected.
Definition at line 107 of file PMockBackend.cpp.
| PRecvStatus::PRecvStatus PMockSocket::recvData | ( | T & | data, |
| PRecvFlag::PRecvFlag | flag = PRecvFlag::BLOCK ) |
Recieved data with the socket.
| [out] | data | : data to be recieved with the socket |
| flag | : recieving flag (BLOCK, NON_BLOCK) |
Definition at line 61 of file PMockBackend_impl.h.
References PRecvStatus::CANNOT_DESERIALIZE_DATA, PRecvStatus::NO_MESSAGE_RECEIVED, PRecvStatus::OK, p_mock, recvMsg(), and socket_serialize_message().
Here is the call graph for this function:| PRecvStatus::PRecvStatus PMockSocket::recvMsg | ( | PMockBackend::Message & | msg, |
| PRecvFlag::PRecvFlag | flag = PRecvFlag::BLOCK ) |
Recieved data with the socket.
| [out] | msg | : Message to be recieved with the socket |
| flag | : recieving flag (BLOCK, NON_BLOCK) |
Definition at line 90 of file PMockBackend.cpp.
References PRecvStatus::NO_MESSAGE_RECEIVED, PRecvStatus::OK, and p_mock.
Referenced by recvData().
Here is the caller graph for this function:| PSendStatus::PSendStatus PMockSocket::sendData | ( | const T & | data, |
| PSendFlag::PSendFlag | flag = PSendFlag::BLOCK ) |
Send data with the socket.
| data | : data to be sent with the socket |
| flag | : sending flag (BLOCK, NON_BLOCK) |
Definition at line 32 of file PMockBackend_impl.h.
References PSendStatus::CANNOT_SERIALIZE_DATA, PSendStatus::OK, p_mock, sendMsg(), and socket_serialize_message().
Here is the call graph for this function:| PSendStatus::PSendStatus PMockSocket::sendMsg | ( | const Message & | msg, |
| PSendFlag::PSendFlag | flag = PSendFlag::BLOCK ) |
Specialisation to send a Message with the socket.
| msg | : Message to be sent |
| flag | : sending flag (BLOCK, NON_BLOCK) |
Definition at line 76 of file PMockBackend.cpp.
References PSendStatus::OK, and p_mock.
Referenced by sendData().
Here is the caller graph for this function:| void PMockSocket::setIsMockRecord | ( | bool | isMockRecord | ) |
Set the mock prefix (where to find/save it)
| isMockRecord | : true if the mock has to be recorded |
Definition at line 67 of file PMockBackend.cpp.
References p_mock.
Referenced by phoenix_createMockBackend().
Here is the caller graph for this function:| void PMockSocket::setMockPrefix | ( | const std::string & | mockPrefix | ) |
Set the mock prefix (where to find/save it)
| mockPrefix | : prefix of the mock to find or write it |
Definition at line 58 of file PMockBackend.cpp.
References p_mock, and p_socketParam.
Referenced by phoenix_createMockBackend().
Here is the caller graph for this function:
|
private |
Extra parameters of the socket.
Definition at line 49 of file PMockBackend.h.
Referenced by createClientSocket().
|
private |
Mock handler.
Definition at line 45 of file PMockBackend.h.
Referenced by close(), recvData(), recvMsg(), sendData(), sendMsg(), setIsMockRecord(), and setMockPrefix().
|
private |
Parameters of the socket.
Definition at line 47 of file PMockBackend.h.
Referenced by createClientSocket(), and setMockPrefix().