7#ifndef __PGENERIC_SOCKET_H__
8#define __PGENERIC_SOCKET_H__
17template<
typename _TBackend,
typename _TMockBackend>
23 bool createClientSocket(_TBackend & backend, _TMockBackend & mockBackend,
const PSocketParam & socketParam,
const typename _TBackend::Param & param,
const std::string & mockPrefix,
const typename _TMockBackend::Param & mockParam);
24 bool createServerSocket(_TBackend & backend, _TMockBackend & mockBackend,
const PSocketParam & socketParam,
const typename _TBackend::Param & param,
const std::string & mockPrefix,
const typename _TMockBackend::Param & mockParam);
45 sendStatus =
p_socket.sendData(data, flag);
60 recvStatus =
p_socket.recvData(data, flag);
64 recvStatus =
p_socket.recvData(data, flag);
PGenericSocket(PSocketMode::PSocketMode mode)
Default constructor of PGenericSocket.
PSendStatus::PSendStatus sendData(const U &data, PSendFlag::PSendFlag flag)
Send message on the given socket.
void close()
Close the socket.
_TMockBackend::Socket p_mockSocket
Socket to be used with the mock backend.
PSendStatus::PSendStatus sendMsg(typename _TBackend::Message &msg, PSendFlag::PSendFlag flag)
Send message on the given socket.
_TBackend::Socket p_socket
Socket to be used with the classical backend.
bool isConnected() const
Say if the Socket is connected.
PRecvStatus::PRecvStatus recvMsg(typename _TBackend::Message &msg, PRecvFlag::PRecvFlag flag)
Receive message from the given socket.
virtual ~PGenericSocket()
Destructor of PGenericSocket.
bool waitUntilConnection(uint64_t refreshTimer, size_t nbRetry) const
Wait until the socket is connected.
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.
PSocketMode::PSocketMode p_mode
Mode of the Socket (no mock, mock, mock_record)
PRecvStatus::PRecvStatus recvData(U &data, PRecvFlag::PRecvFlag flag)
Receive message from the given socket.
void initialisationPGenericSocket(PSocketMode::PSocketMode mode)
Initialisation function of the class PGenericSocket.
void setMode(PSocketMode::PSocketMode mode)
Set the mode of the generic socket.
PRecvFlag
describe the receiving flag of the Socket
PRecvStatus
describe the result of the recv
PSendFlag
describe the sending flag of the Socket
PSendStatus
describe the result of the send
PSocketMode
describe the mode of the Socket
Parameters to create a socket.