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>(
28 if (!processHandshake_channelTypeSupported(
29 static_cast<EChannelType>(_attachment->m_channelType),
true, _sender.
m_ID))
31 if (!processHandshake_versionMatch(_attachment->m_version,
true, _sender.
m_ID))
33 if (!processHandshake_sessionIDMatch(_attachment->m_sSID,
true, _sender.
m_ID))
36 this->m_protocolHeaderID = _sender.
m_ID;
37 this->m_isHandshakeOK =
true;
38 this->m_channelType = static_cast<EChannelType>(_attachment->m_channelType);
41 this->template pushMsg<cmdUNKNOWN>();
45 <<
"] has successfully connected.";
47 this->
template pushMsg<cmdREPLY_HANDSHAKE_OK>(_sender.
m_ID);
88 bool processHandshake_channelTypeSupported(
EChannelType _channelType,
bool _lobbyLeader, uint64_t _senderID)
91 bool isSupportedChnl(
false);
92 for (
const auto& v : m_requiredChannelTypes)
94 isSupportedChnl = (_channelType == v);
101 handshakeFailed(
"Unsupported channel type", _lobbyLeader, _senderID);
107 bool processHandshake_versionMatch(uint16_t _version,
bool _lobbyLeader, uint64_t _senderID)
110 if (_version != DDS_PROTOCOL_VERSION)
112 std::stringstream ss;
113 ss <<
"Incompatible protocol version. Server: " << DDS_PROTOCOL_VERSION <<
" Client: " << _version;
114 handshakeFailed(ss.str(), _lobbyLeader, _senderID);
120 bool processHandshake_sessionIDMatch(
const std::string& _sessionID,
bool _lobbyLeader, uint64_t _senderID)
125 handshakeFailed(
"Incompatible Session ID", _lobbyLeader, _senderID);
131 void handshakeFailed(
const std::string& _reason,
bool _lobbyLeader, uint64_t _senderID)
137 this->
template pushMsg<cmdREPLY_HANDSHAKE_ERR>(SSimpleMsgCmd(_reason,
MiscCommon::fatal), _senderID);
bool m_isHandshakeOK
Definition: BaseChannelImpl.h:988
Definition: BaseEventHandlersImpl.h:48
EChannelType
Definition: ProtocolDef.h:15
EChannelType m_channelType
Definition: BaseChannelImpl.h:989
std::shared_ptr< SEmptyCmd > ptr_t
Definition: CommandAttachmentImpl.h:64
std::string m_sessionID
Definition: BaseChannelImpl.h:990
#define LOG(severity)
Definition: Logger.h:56
Definition: AgentConnectionManager.h:13
std::string remoteEndIDString()
Definition: BaseChannelImpl.h:755
Definition: BaseChannelImpl.h:224
Definition: BaseChannelImpl.h:42
std::vector< EChannelType > channelTypeVector_t
Definition: ProtocolDef.h:21
boost::asio::ip::tcp::socket & socket()
Definition: BaseChannelImpl.h:326
uint64_t m_ID
Definition: BaseEventHandlersImpl.h:50