![]() |
TrinityCore
|
#include <Session.h>
Inheritance diagram for Battlenet::Session:Public Member Functions | |
| Session (Trinity::Net::IoContextTcpSocket &&socket) | |
| ~Session () | |
| void | Start () |
| bool | Update () |
| boost::asio::ip::address const & | GetRemoteIpAddress () const |
| bool | IsOpen () const |
| void | CloseSocket () |
| void | DelayedCloseSocket () |
| bool | IsAuthed () const |
| uint32 | GetSessionId () const |
| SystemTimePoint | GetCreationTime () const |
| void | SetClientInstanceId (std::string const &ciid) |
| uint32 | GetAccountId () const |
| AccountInfo const * | GetAccountInfo () const |
| uint32 | GetGameAccountId () const |
| GameAccountInfo const * | GetGameAccountInfo () const |
| GameAccountInfo const * | GetGameAccountInfo (uint32 gameAccountId) const |
| LastPlayedCharacterInfo const * | GetLastPlayedCharacter (std::string_view subRegion) const |
| std::string const & | GetLocale () const |
| std::string const & | GetOS () const |
| uint32 | GetBuild () const |
| ClientBuild::VariantId | GetBuildVariant () const |
| Minutes | GetTimezoneOffset () const |
| std::array< uint8, 32 > | GetClientSecret () const |
| void | SendResponse (uint32 token, pb::Message const *response) |
| void | SendResponse (uint32 token, uint32 status) |
| void | SendRequest (uint32 serviceHash, uint32 methodId, pb::Message const *request, std::function< void(MessageBuffer)> callback) |
| void | SendRequest (uint32 serviceHash, uint32 methodId, pb::Message const *request) |
| void | QueueQuery (QueryCallback &&queryCallback) |
| void | OnLogon (std::string_view platform, std::string_view locale, uint32 applicationVersion, Minutes timezoneOffset) |
| void | OnLogonSuccess (std::shared_ptr< AccountInfo > accountInfo, std::string_view ipCountry) |
| void | SetClientInfo (uint32 gameAccountId, ClientBuild::VariantId buildVariant, std::array< uint8, 32 > const &clientSecret) |
| std::string | GetClientInfo () const |
| Trinity::Net::SocketReadCallbackResult | ReadHandler () |
Protected Member Functions | |
| bool | ReadHeaderLengthHandler () |
| bool | ReadHeaderHandler () |
| bool | ReadDataHandler () |
Private Types | |
| enum class | PacketReadState { HeaderLength , Header , Data } |
| using | Socket = Trinity::Net::Socket< Trinity::Net::SslStream<> > |
Private Member Functions | |
| void | AsyncWrite (MessageBuffer *packet) |
Static Private Member Functions | |
| static std::shared_ptr< Socket > | CreateSocket (Trinity::Net::IoContextTcpSocket &&socket) |
Private Attributes | |
| std::shared_ptr< Socket > | _socket |
| PacketReadState | _packetReadState |
| MessageBuffer | _packetBuffer |
| uint32 const | _sessionId |
| SystemTimePoint const | _creationTime |
| std::string | _clientInstanceId |
| std::shared_ptr< AccountInfo > | _accountInfo |
| GameAccountInfo const * | _gameAccountInfo |
| std::string | _locale |
| std::string | _os |
| uint32 | _build |
| ClientBuild::VariantId | _buildVariant |
| Minutes | _timezoneOffset |
| std::string | _ipCountry |
| std::array< uint8, 32 > | _clientSecret |
| bool | _authed |
| QueryCallbackProcessor | _queryProcessor |
| std::unordered_map< uint32, std::function< void(MessageBuffer)> > | _responseCallbacks |
| uint32 | _requestToken |
|
private |
|
strongprivate |
|
explicit |
Definition at line 73 of file Session.cpp.
|
default |
|
private |
Definition at line 121 of file Session.cpp.
|
inline |
|
staticprivate |
Definition at line 83 of file Session.cpp.
References Battlenet::SslContext::instance().
|
inline |
Definition at line 92 of file Session.h.
References _socket.
Referenced by Battlenet::Services::V1::Connection::HandleRequestDisconnect().
|
inline |
Definition at line 100 of file Session.h.
References _accountInfo.
Referenced by Battlenet::Services::Shared::GameUtilities::GetRealmListTicket(), Battlenet::Services::Shared::Authentication::HandleGenerateAuthToken(), and Battlenet::Services::V2::Account::HandleGetAccountInfo().
|
inline |
Definition at line 101 of file Session.h.
References _accountInfo.
|
inline |
Definition at line 110 of file Session.h.
References _build.
Referenced by Battlenet::Services::Shared::GameUtilities::GetLastCharPlayed(), Battlenet::Services::Shared::GameUtilities::GetRealmList(), and Battlenet::Services::Shared::GameUtilities::JoinRealm().
|
inline |
Definition at line 111 of file Session.h.
References _buildVariant.
Referenced by Battlenet::Services::Shared::GameUtilities::JoinRealm().
| std::string Battlenet::Session::GetClientInfo | ( | ) | const |
Definition at line 345 of file Session.cpp.
Referenced by Battlenet::ServiceDispatcher::Dispatch(), Battlenet::Services::Shared::GameUtilities::HandleClientRequest(), Battlenet::Services::Shared::GameUtilities::HandleGetAllValuesForAttribute(), and Battlenet::Services::Shared::Authentication::HandleLogon().
|
inline |
Definition at line 113 of file Session.h.
References _clientSecret.
Referenced by Battlenet::Services::Shared::GameUtilities::JoinRealm().
|
inline |
Definition at line 97 of file Session.h.
References _creationTime.
Referenced by Battlenet::Services::V1::Connection::HandleConnect().
|
inline |
Definition at line 103 of file Session.h.
References _gameAccountInfo, and Battlenet::GameAccountInfo::Id.
|
inline |
Definition at line 104 of file Session.h.
References _gameAccountInfo.
Referenced by Battlenet::Services::Shared::GameUtilities::GetLastCharPlayed(), Battlenet::Services::Shared::GameUtilities::GetRealmList(), Battlenet::Services::Shared::GameUtilities::GetRealmListTicket(), Battlenet::Services::V2::Account::HandleGetGameAccountInfo(), Battlenet::Services::V2::Account::HandleGetGameAccountRestriction(), Battlenet::Services::V1::Account::HandleGetGameAccountState(), and Battlenet::Services::Shared::GameUtilities::JoinRealm().
| Battlenet::GameAccountInfo const * Battlenet::Session::GetGameAccountInfo | ( | uint32 | gameAccountId | ) | const |
Definition at line 113 of file Session.cpp.
References Trinity::Containers::MapGetValuePtr().
| Battlenet::LastPlayedCharacterInfo const * Battlenet::Session::GetLastPlayedCharacter | ( | std::string_view | subRegion | ) | const |
Definition at line 237 of file Session.cpp.
Referenced by Battlenet::Services::Shared::GameUtilities::GetLastCharPlayed().
|
inline |
Definition at line 108 of file Session.h.
References _locale.
Referenced by Battlenet::Services::Shared::GameUtilities::GetRealmListTicket(), and Battlenet::Services::Shared::GameUtilities::JoinRealm().
|
inline |
Definition at line 109 of file Session.h.
References _os.
Referenced by Battlenet::Services::Shared::GameUtilities::GetRealmListTicket(), and Battlenet::Services::Shared::GameUtilities::JoinRealm().
|
inline |
Definition at line 89 of file Session.h.
References _socket.
Referenced by Battlenet::Services::Shared::GameUtilities::GetRealmListTicket(), and Battlenet::Services::Shared::GameUtilities::JoinRealm().
|
inline |
Definition at line 96 of file Session.h.
References _sessionId.
Referenced by Battlenet::Services::V1::Connection::HandleConnect().
|
inline |
Definition at line 112 of file Session.h.
References _timezoneOffset.
Referenced by Battlenet::Services::Shared::GameUtilities::JoinRealm().
|
inline |
Definition at line 94 of file Session.h.
References _authed.
Referenced by Battlenet::Services::V2::Authentication::HandleGenerateAuthToken(), Battlenet::Services::V1::Authentication::HandleGenerateWebCredentials(), Battlenet::Services::V1::Account::HandleGetAccountState(), Battlenet::Services::V1::GameUtilities::HandleGetAllValuesForAttribute(), Battlenet::Services::Shared::GameUtilities::HandleGetAllValuesForAttribute(), Battlenet::Services::V1::Account::HandleGetGameAccountState(), Battlenet::Services::V1::GameUtilities::HandleProcessClientRequest(), and Battlenet::Services::V2::GameUtilities::HandleProcessTask().
|
inline |
| void Battlenet::Session::OnLogon | ( | std::string_view | platform, |
| std::string_view | locale, | ||
| uint32 | applicationVersion, | ||
| Minutes | timezoneOffset | ||
| ) |
Definition at line 214 of file Session.cpp.
Referenced by Battlenet::Services::Shared::Authentication::HandleLogon().
| void Battlenet::Session::OnLogonSuccess | ( | std::shared_ptr< AccountInfo > | accountInfo, |
| std::string_view | ipCountry | ||
| ) |
Definition at line 223 of file Session.cpp.
| void Battlenet::Session::QueueQuery | ( | QueryCallback && | queryCallback | ) |
Definition at line 209 of file Session.cpp.
Referenced by Battlenet::Services::Shared::Authentication::HandleGenerateAuthToken(), and Battlenet::Services::Shared::Authentication::HandleVerifyAuthToken().
|
protected |
Definition at line 322 of file Session.cpp.
References ASSERT, PacketHeaderLengthSize, and sServiceDispatcher.
| Trinity::Net::SocketReadCallbackResult Battlenet::Session::ReadHandler | ( | ) |
Definition at line 272 of file Session.cpp.
References MessageBuffer::GetActiveSize(), and Trinity::Net::KeepReading.
|
protected |
Definition at line 309 of file Session.cpp.
|
protected |
Definition at line 297 of file Session.cpp.
References EndianConvertReverse(), PacketHeaderLengthSize, and MessageBuffer::ReadCompleted().
| void Battlenet::Session::SendRequest | ( | uint32 | serviceHash, |
| uint32 | methodId, | ||
| pb::Message const * | request | ||
| ) |
Definition at line 182 of file Session.cpp.
References EndianConvertReverse(), MessageBuffer::GetWritePointer(), MessageBuffer::Write(), and MessageBuffer::WriteCompleted().
| void Battlenet::Session::SendRequest | ( | uint32 | serviceHash, |
| uint32 | methodId, | ||
| pb::Message const * | request, | ||
| std::function< void(MessageBuffer)> | callback | ||
| ) |
Definition at line 176 of file Session.cpp.
Referenced by Battlenet::ServiceBaseCaller::SendRequest().
| void Battlenet::Session::SendResponse | ( | uint32 | token, |
| pb::Message const * | response | ||
| ) |
Definition at line 129 of file Session.cpp.
References EndianConvertReverse(), MessageBuffer::GetWritePointer(), MessageBuffer::Write(), and MessageBuffer::WriteCompleted().
Definition at line 154 of file Session.cpp.
References EndianConvertReverse(), MessageBuffer::GetWritePointer(), MessageBuffer::Write(), and MessageBuffer::WriteCompleted().
| void Battlenet::Session::SetClientInfo | ( | uint32 | gameAccountId, |
| ClientBuild::VariantId | buildVariant, | ||
| std::array< uint8, 32 > const & | clientSecret | ||
| ) |
Definition at line 230 of file Session.cpp.
Referenced by Battlenet::Services::Shared::GameUtilities::GetRealmListTicket().
|
inline |
Definition at line 98 of file Session.h.
References _clientInstanceId.
Referenced by Battlenet::Services::V1::Connection::HandleConnect().
| void Battlenet::Session::Start | ( | ) |
Definition at line 88 of file Session.cpp.
References Trinity::Net::SocketConnectionInitializer::SetupChain(), Trinity::Net::ReadConnectionInitializer< AsyncReadObjectType, ReadHandlerObjectType >::Start(), and TC_LOG_TRACE.
| bool Battlenet::Session::Update | ( | ) |
Definition at line 103 of file Session.cpp.
|
private |
Definition at line 158 of file Session.h.
Referenced by GetAccountId(), and GetAccountInfo().
|
private |
Definition at line 171 of file Session.h.
Referenced by IsAuthed().
|
private |
Definition at line 163 of file Session.h.
Referenced by GetBuild().
|
private |
Definition at line 164 of file Session.h.
Referenced by GetBuildVariant().
|
private |
Definition at line 156 of file Session.h.
Referenced by SetClientInstanceId().
|
private |
Definition at line 169 of file Session.h.
Referenced by GetClientSecret().
|
private |
Definition at line 155 of file Session.h.
Referenced by GetCreationTime().
|
private |
Definition at line 159 of file Session.h.
Referenced by GetGameAccountId(), and GetGameAccountInfo().
|
private |
Definition at line 161 of file Session.h.
Referenced by GetLocale().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Definition at line 154 of file Session.h.
Referenced by GetSessionId().
|
private |
Definition at line 142 of file Session.h.
Referenced by CloseSocket(), DelayedCloseSocket(), GetRemoteIpAddress(), and IsOpen().
|
private |
Definition at line 165 of file Session.h.
Referenced by GetTimezoneOffset().