![]() |
|
PhoenixSocket
4.0.1
Library which integrates socket unix use in Phoenix
|
Abstract socket which has a mock mode to avoid heavy socket backend for unit tests. More...
#include <PGenericSocket.h>
Public Member Functions | |
| void | close () |
| Close the socket. | |
| bool | createClientSocket (_TBackend &backend, _TMockBackend &mockBackend, const PSocketParam &socketParam, const typename _TBackend::Param ¶m, const std::string &mockPrefix, const typename _TMockBackend::Param &mockParam) |
| Create a client socket. | |
| bool | createServerSocket (_TBackend &backend, _TMockBackend &mockBackend, const PSocketParam &socketParam, const typename _TBackend::Param ¶m, const std::string &mockPrefix, const typename _TMockBackend::Param &mockParam) |
| Create a server socket. | |
| bool | isConnected () const |
| Say if the Socket is connected. | |
| PGenericSocket (PSocketMode::PSocketMode mode) | |
| Default constructor of PGenericSocket. | |
| template<typename U> | |
| PRecvStatus::PRecvStatus | recvData (U &data, PRecvFlag::PRecvFlag flag) |
| Receive message from the given socket. | |
| PRecvStatus::PRecvStatus | recvMsg (typename _TBackend::Message &msg, PRecvFlag::PRecvFlag flag) |
| Receive message from the given socket. | |
| template<typename U> | |
| PSendStatus::PSendStatus | sendData (const U &data, PSendFlag::PSendFlag flag) |
| Send message on the given socket. | |
| PSendStatus::PSendStatus | sendMsg (typename _TBackend::Message &msg, PSendFlag::PSendFlag flag) |
| Send message on the given socket. | |
| void | setMode (PSocketMode::PSocketMode mode) |
| Set the mode of the generic socket. | |
| bool | waitUntilConnection (uint64_t refreshTimer, size_t nbRetry) const |
| Wait until the socket is connected. | |
| virtual | ~PGenericSocket () |
| Destructor of PGenericSocket. | |
Private Member Functions | |
| void | initialisationPGenericSocket (PSocketMode::PSocketMode mode) |
| Initialisation function of the class PGenericSocket. | |
Private Attributes | |
| _TMockBackend::Socket | p_mockSocket |
| Socket to be used with the mock backend. | |
| PSocketMode::PSocketMode | p_mode |
| Mode of the Socket (no mock, mock, mock_record) | |
| _TBackend::Socket | p_socket |
| Socket to be used with the classical backend. | |
Abstract socket which has a mock mode to avoid heavy socket backend for unit tests.
Definition at line 18 of file PGenericSocket.h.
| PGenericSocket< _TBackend, _TMockBackend >::PGenericSocket | ( | PSocketMode::PSocketMode | mode | ) |
Default constructor of PGenericSocket.
| mode | : Mode of the Socket (no mock, mock, mock_record) |
Definition at line 16 of file PGenericSocket_impl.h.
References initialisationPGenericSocket().
Here is the call graph for this function:
|
virtual |
Destructor of PGenericSocket.
Definition at line 22 of file PGenericSocket_impl.h.
References close().
Here is the call graph for this function:| void PGenericSocket< _TBackend, _TMockBackend >::close | ( | ) |
Close the socket.
Definition at line 128 of file PGenericSocket_impl.h.
References p_mockSocket, and p_socket.
Referenced by ~PGenericSocket().
Here is the caller graph for this function:| bool PGenericSocket< _TBackend, _TMockBackend >::createClientSocket | ( | _TBackend & | backend, |
| _TMockBackend & | mockBackend, | ||
| const PSocketParam & | socketParam, | ||
| const typename _TBackend::Param & | param, | ||
| const std::string & | mockPrefix, | ||
| const typename _TMockBackend::Param & | mockParam ) |
Create a client socket.
| backend | : instanciated backend of the socket |
| mockBackend | : instanciated backend of the mock socket |
| socketParam | : parameters of the socket (host, port, send/recv timeout) |
| param | : extra parameters of the backend |
| mockPrefix | : prefix where to find/save the mock |
| mockParam | : extra parameters of the mock |
Definition at line 35 of file PGenericSocket_impl.h.
References PSocketMode::MOCK_RECORD, p_mockSocket, p_mode, and p_socket.
Referenced by PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::addClientSocket().
Here is the caller graph for this function:| bool PGenericSocket< _TBackend, _TMockBackend >::createServerSocket | ( | _TBackend & | backend, |
| _TMockBackend & | mockBackend, | ||
| const PSocketParam & | socketParam, | ||
| const typename _TBackend::Param & | param, | ||
| const std::string & | mockPrefix, | ||
| const typename _TMockBackend::Param & | mockParam ) |
Create a server socket.
| backend | : instanciated backend of the socket |
| mockBackend | : instanciated backend of the mock socket |
| socketParam | : parameters of the socket (host, port, send/recv timeout) |
| param | : extra parameters of the backend |
| mockPrefix | : prefix where to find/save the mock |
| mockParam | : extra parameters of the mock |
Definition at line 53 of file PGenericSocket_impl.h.
References PSocketMode::MOCK_RECORD, p_mockSocket, p_mode, and p_socket.
Referenced by PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::addServerSocket().
Here is the caller graph for this function:
|
private |
Initialisation function of the class PGenericSocket.
| mode | : Mode of the Socket (no mock, mock, mock_record) |
Definition at line 169 of file PGenericSocket_impl.h.
References p_mode.
Referenced by PGenericSocket().
Here is the caller graph for this function:| bool PGenericSocket< _TBackend, _TMockBackend >::isConnected | ( | ) | const |
Say if the Socket is connected.
Definition at line 137 of file PGenericSocket_impl.h.
References PSocketMode::MOCK, PSocketMode::NO_MOCK, p_mockSocket, p_mode, and p_socket.
Referenced by waitUntilConnection().
Here is the caller graph for this function:
|
inline |
Receive message from the given socket.
| data | : data to be received |
| flag | : flag to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 57 of file PGenericSocket.h.
References PSocketMode::MOCK, PSocketMode::NO_MOCK, PRecvStatus::OK, p_mockSocket, p_mode, and p_socket.
Referenced by PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::recvData().
Here is the caller graph for this function:| PRecvStatus::PRecvStatus PGenericSocket< _TBackend, _TMockBackend >::recvMsg | ( | typename _TBackend::Message & | msg, |
| PRecvFlag::PRecvFlag | flag ) |
Receive message from the given socket.
| msg | : message to be received |
| flag | : flags to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 104 of file PGenericSocket_impl.h.
References PSocketMode::MOCK, PSocketMode::NO_MOCK, PRecvStatus::OK, p_mockSocket, p_mode, and p_socket.
Referenced by PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::recvMsg().
Here is the caller graph for this function:
|
inline |
Send message on the given socket.
| data | : data to be sent |
| flag | : flag to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 34 of file PGenericSocket.h.
References PSocketMode::MOCK, PSocketMode::NO_MOCK, PSendStatus::OK, p_mockSocket, p_mode, and p_socket.
Referenced by PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::sendData().
Here is the caller graph for this function:| PSendStatus::PSendStatus PGenericSocket< _TBackend, _TMockBackend >::sendMsg | ( | typename _TBackend::Message & | msg, |
| PSendFlag::PSendFlag | flag ) |
Send message on the given socket.
| msg | : message to be sent |
| flag | : flags to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 77 of file PGenericSocket_impl.h.
References PSocketMode::MOCK, PSocketMode::NO_MOCK, PSendStatus::OK, p_mockSocket, p_mode, and p_socket.
Referenced by PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::sendMsg().
Here is the caller graph for this function:| void PGenericSocket< _TBackend, _TMockBackend >::setMode | ( | PSocketMode::PSocketMode | mode | ) |
Set the mode of the generic socket.
| mode | : mode of the PGenericSocket (NO_MOCK, MOCK, MOCK_RECORD) |
Definition at line 66 of file PGenericSocket_impl.h.
References PSocketMode::MOCK_RECORD, p_mockSocket, and p_mode.
| bool PGenericSocket< _TBackend, _TMockBackend >::waitUntilConnection | ( | uint64_t | refreshTimer, |
| size_t | nbRetry ) const |
Wait until the socket is connected.
| refreshTimer | : time in µs between two checks |
| nbRetry | : number of retries before giving up |
Definition at line 153 of file PGenericSocket_impl.h.
References isConnected().
Here is the call graph for this function:
|
private |
Socket to be used with the mock backend.
Definition at line 86 of file PGenericSocket.h.
Referenced by close(), createClientSocket(), createServerSocket(), isConnected(), recvData(), recvMsg(), sendData(), sendMsg(), and setMode().
|
private |
Mode of the Socket (no mock, mock, mock_record)
Definition at line 81 of file PGenericSocket.h.
Referenced by createClientSocket(), createServerSocket(), initialisationPGenericSocket(), isConnected(), recvData(), recvMsg(), sendData(), sendMsg(), and setMode().
|
private |
Socket to be used with the classical backend.
Definition at line 84 of file PGenericSocket.h.
Referenced by close(), createClientSocket(), createServerSocket(), isConnected(), recvData(), recvMsg(), sendData(), and sendMsg().