6 #ifndef DDS_ServerChannelImpl_h 7 #define DDS_ServerChannelImpl_h 15 namespace protocol_api
18 class CServerChannelImpl :
public CBaseChannelImpl<T>
23 , m_requiredChannelTypes(_requiredChannelTypes)
26 this->
template registerHandler<cmdHANDSHAKE>(
29 if (!processHandshake_channelTypeSupported(
30 static_cast<EChannelType>(_attachment->m_channelType),
true, _sender.m_ID))
32 if (!processHandshake_versionMatch(_attachment->m_version,
true, _sender.m_ID))
34 if (!processHandshake_sessionIDMatch(_attachment->m_sSID,
true, _sender.m_ID))
42 this->
template pushMsg<cmdUNKNOWN>();
46 <<
"] has successfully connected.";
48 this->
template pushMsg<cmdREPLY_HANDSHAKE_OK>(_sender.m_ID);
55 this->
template registerHandler<cmdLOBBY_MEMBER_HANDSHAKE>(
59 if (!processHandshake_channelTypeSupported(
60 static_cast<EChannelType>(_attachment->m_channelType),
false, _sender.m_ID))
62 if (!processHandshake_versionMatch(_attachment->m_version,
false, _sender.m_ID))
64 if (!processHandshake_sessionIDMatch(_attachment->m_sSID,
false, _sender.m_ID))
69 <<
"New lobby member [" << _sender.m_ID <<
"] has successfully connected.";
71 this->
template pushMsg<cmdREPLY_LOBBY_MEMBER_HANDSHAKE_OK>(_sender.m_ID);
83 bool processHandshake_channelTypeSupported(
EChannelType _channelType,
bool _lobbyLeader, uint64_t _senderID)
86 bool isSupportedChnl(
false);
87 for (
const auto& v : m_requiredChannelTypes)
89 isSupportedChnl = (_channelType == v);
96 handshakeFailed(
"Unsupported channel type", _lobbyLeader, _senderID);
102 bool processHandshake_versionMatch(uint16_t _version,
bool _lobbyLeader, uint64_t _senderID)
105 if (_version != DDS_PROTOCOL_VERSION)
107 std::stringstream ss;
108 ss <<
"Incompatible protocol version. Server: " << DDS_PROTOCOL_VERSION <<
" Client: " << _version;
109 handshakeFailed(ss.str(), _lobbyLeader, _senderID);
115 bool processHandshake_sessionIDMatch(
const std::string& _sessionID,
bool _lobbyLeader, uint64_t _senderID)
120 handshakeFailed(
"Incompatible Session ID", _lobbyLeader, _senderID);
126 void handshakeFailed(
const std::string& _reason,
bool _lobbyLeader, uint64_t _senderID)
141 this->
template pushMsg<cmdREPLY_LOBBY_MEMBER_HANDSHAKE_ERR>(
bool m_isHandshakeOK
Definition: BaseChannelImpl.h:966
Definition: BaseEventHandlersImpl.h:48
EChannelType
Definition: ProtocolDef.h:15
EChannelType m_channelType
Definition: BaseChannelImpl.h:967
std::shared_ptr< SEmptyCmd > ptr_t
Definition: CommandAttachmentImpl.h:66
std::string m_sessionID
Definition: BaseChannelImpl.h:968
#define LOG(severity)
Definition: Logger.h:54
Definition: SimpleMsgCmd.h:16
Definition: dds-agent/src/AgentConnectionManager.h:18
std::string remoteEndIDString()
Definition: BaseChannelImpl.h:733
Definition: BaseChannelImpl.h:205
Definition: BaseChannelImpl.h:43
std::vector< EChannelType > channelTypeVector_t
Definition: ProtocolDef.h:22
boost::asio::ip::tcp::socket & socket()
Definition: BaseChannelImpl.h:304
uint64_t m_protocolHeaderID
Definition: BaseChannelImpl.h:969