TrinityCore
Loading...
Searching...
No Matches
Battlenet::Session Class Referencefinal

#include <Session.h>

+ Inheritance diagram for Battlenet::Session:

Classes

struct  AccountInfo
 
struct  GameAccountInfo
 
struct  LastPlayedCharacterInfo
 

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 ()
 
uint32 GetAccountId () const
 
uint32 GetGameAccountId () 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)
 
uint32 HandleLogon (authentication::v1::LogonRequest const *logonRequest, std::function< void(ServiceBase *, uint32, ::google::protobuf::Message const *)> &continuation)
 
uint32 HandleVerifyWebCredentials (authentication::v1::VerifyWebCredentialsRequest const *verifyWebCredentialsRequest, std::function< void(ServiceBase *, uint32, ::google::protobuf::Message const *)> &continuation)
 
uint32 HandleGenerateWebCredentials (authentication::v1::GenerateWebCredentialsRequest const *request, std::function< void(ServiceBase *, uint32, google::protobuf::Message const *)> &continuation)
 
uint32 HandleGetAccountState (account::v1::GetAccountStateRequest const *request, account::v1::GetAccountStateResponse *response)
 
uint32 HandleGetGameAccountState (account::v1::GetGameAccountStateRequest const *request, account::v1::GetGameAccountStateResponse *response)
 
uint32 HandleProcessClientRequest (game_utilities::v1::ClientRequest const *request, game_utilities::v1::ClientResponse *response)
 
uint32 HandleGetAllValuesForAttribute (game_utilities::v1::GetAllValuesForAttributeRequest const *request, game_utilities::v1::GetAllValuesForAttributeResponse *response)
 
std::string GetClientInfo () const
 
Trinity::Net::SocketReadCallbackResult ReadHandler ()
 

Protected Member Functions

bool ReadHeaderLengthHandler ()
 
bool ReadHeaderHandler ()
 
bool ReadDataHandler ()
 

Private Types

typedef uint32(Session::* ClientRequestHandler) (std::unordered_map< std::string, Variant const * > const &, game_utilities::v1::ClientResponse *)
 
using Socket = Trinity::Net::Socket< Trinity::Net::SslStream<> >
 

Private Member Functions

void AsyncWrite (MessageBuffer *packet)
 
uint32 VerifyWebCredentials (std::string const &webCredentials, std::function< void(ServiceBase *, uint32, ::google::protobuf::Message const *)> &continuation)
 
uint32 GetRealmListTicket (std::unordered_map< std::string, Variant const * > const &params, game_utilities::v1::ClientResponse *response)
 
uint32 GetLastCharPlayed (std::unordered_map< std::string, Variant const * > const &params, game_utilities::v1::ClientResponse *response)
 
uint32 GetRealmList (std::unordered_map< std::string, Variant const * > const &params, game_utilities::v1::ClientResponse *response)
 
uint32 JoinRealm (std::unordered_map< std::string, Variant const * > const &params, game_utilities::v1::ClientResponse *response)
 

Static Private Member Functions

static std::shared_ptr< SocketCreateSocket (Trinity::Net::IoContextTcpSocket &&socket)
 

Private Attributes

std::shared_ptr< Socket_socket
 
MessageBuffer _headerLengthBuffer
 
MessageBuffer _headerBuffer
 
MessageBuffer _packetBuffer
 
std::shared_ptr< AccountInfo_accountInfo
 
GameAccountInfo_gameAccountInfo
 
std::string _locale
 
std::string _os
 
uint32 _build
 
ClientBuild::VariantId _clientInfo
 
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
 

Static Private Attributes

static std::unordered_map< std::string, ClientRequestHandler > const ClientRequestHandlers
 

Detailed Description

Definition at line 68 of file Session.h.

Member Typedef Documentation

◆ ClientRequestHandler

typedef uint32(Session::* Battlenet::Session::ClientRequestHandler) (std::unordered_map< std::string, Variant const * > const &, game_utilities::v1::ClientResponse *)
private

Definition at line 159 of file Session.h.

◆ Socket

Definition at line 167 of file Session.h.

Constructor & Destructor Documentation

◆ Session()

Battlenet::Session::Session ( Trinity::Net::IoContextTcpSocket &&  socket)
explicit

Definition at line 84 of file Session.cpp.

+ Here is the call graph for this function:

◆ ~Session()

Battlenet::Session::~Session ( )
default

Member Function Documentation

◆ AsyncWrite()

void Battlenet::Session::AsyncWrite ( MessageBuffer packet)
private

Definition at line 123 of file Session.cpp.

◆ CloseSocket()

void Battlenet::Session::CloseSocket ( )
inline

Definition at line 118 of file Session.h.

+ Here is the caller graph for this function:

◆ CreateSocket()

std::shared_ptr< Battlenet::Session::Socket > Battlenet::Session::CreateSocket ( Trinity::Net::IoContextTcpSocket &&  socket)
staticprivate

Definition at line 93 of file Session.cpp.

+ Here is the call graph for this function:

◆ DelayedCloseSocket()

void Battlenet::Session::DelayedCloseSocket ( )
inline

Definition at line 119 of file Session.h.

◆ GetAccountId()

uint32 Battlenet::Session::GetAccountId ( ) const
inline

Definition at line 121 of file Session.h.

◆ GetClientInfo()

std::string Battlenet::Session::GetClientInfo ( ) const

Definition at line 806 of file Session.cpp.

+ Here is the caller graph for this function:

◆ GetGameAccountId()

uint32 Battlenet::Session::GetGameAccountId ( ) const
inline

Definition at line 122 of file Session.h.

◆ GetLastCharPlayed()

uint32 Battlenet::Session::GetLastCharPlayed ( std::unordered_map< std::string, Variant const * > const &  params,
game_utilities::v1::ClientResponse *  response 
)
private

Definition at line 610 of file Session.cpp.

+ Here is the call graph for this function:

◆ GetRealmList()

uint32 Battlenet::Session::GetRealmList ( std::unordered_map< std::string, Variant const * > const &  params,
game_utilities::v1::ClientResponse *  response 
)
private

Definition at line 645 of file Session.cpp.

+ Here is the call graph for this function:

◆ GetRealmListTicket()

uint32 Battlenet::Session::GetRealmListTicket ( std::unordered_map< std::string, Variant const * > const &  params,
game_utilities::v1::ClientResponse *  response 
)
private

Definition at line 553 of file Session.cpp.

+ Here is the call graph for this function:

◆ GetRemoteIpAddress()

boost::asio::ip::address const & Battlenet::Session::GetRemoteIpAddress ( ) const
inline

Definition at line 116 of file Session.h.

◆ HandleGenerateWebCredentials()

uint32 Battlenet::Session::HandleGenerateWebCredentials ( authentication::v1::GenerateWebCredentialsRequest const *  request,
std::function< void(ServiceBase *, uint32, google::protobuf::Message const *)> &  continuation 
)

Definition at line 264 of file Session.cpp.

+ Here is the call graph for this function:

◆ HandleGetAccountState()

uint32 Battlenet::Session::HandleGetAccountState ( account::v1::GetAccountStateRequest const *  request,
account::v1::GetAccountStateResponse *  response 
)

Definition at line 450 of file Session.cpp.

◆ HandleGetAllValuesForAttribute()

uint32 Battlenet::Session::HandleGetAllValuesForAttribute ( game_utilities::v1::GetAllValuesForAttributeRequest const *  request,
game_utilities::v1::GetAllValuesForAttributeResponse *  response 
)

Definition at line 695 of file Session.cpp.

◆ HandleGetGameAccountState()

uint32 Battlenet::Session::HandleGetGameAccountState ( account::v1::GetGameAccountStateRequest const *  request,
account::v1::GetGameAccountStateResponse *  response 
)

Definition at line 467 of file Session.cpp.

◆ HandleLogon()

uint32 Battlenet::Session::HandleLogon ( authentication::v1::LogonRequest const *  logonRequest,
std::function< void(ServiceBase *, uint32, ::google::protobuf::Message const *)> &  continuation 
)

Definition at line 201 of file Session.cpp.

+ Here is the call graph for this function:

◆ HandleProcessClientRequest()

uint32 Battlenet::Session::HandleProcessClientRequest ( game_utilities::v1::ClientRequest const *  request,
game_utilities::v1::ClientResponse *  response 
)

Definition at line 509 of file Session.cpp.

+ Here is the call graph for this function:

◆ HandleVerifyWebCredentials()

uint32 Battlenet::Session::HandleVerifyWebCredentials ( authentication::v1::VerifyWebCredentialsRequest const *  verifyWebCredentialsRequest,
std::function< void(ServiceBase *, uint32, ::google::protobuf::Message const *)> &  continuation 
)

Definition at line 256 of file Session.cpp.

◆ IsOpen()

bool Battlenet::Session::IsOpen ( ) const
inline

Definition at line 117 of file Session.h.

◆ JoinRealm()

uint32 Battlenet::Session::JoinRealm ( std::unordered_map< std::string, Variant const * > const &  params,
game_utilities::v1::ClientResponse *  response 
)
private

Definition at line 686 of file Session.cpp.

+ Here is the call graph for this function:

◆ QueueQuery()

void Battlenet::Session::QueueQuery ( QueryCallback &&  queryCallback)

Definition at line 196 of file Session.cpp.

◆ ReadDataHandler()

bool Battlenet::Session::ReadDataHandler ( )
protected

Definition at line 781 of file Session.cpp.

+ Here is the call graph for this function:

◆ ReadHandler()

Trinity::Net::SocketReadCallbackResult Battlenet::Session::ReadHandler ( )

Definition at line 742 of file Session.cpp.

+ Here is the call graph for this function:

◆ ReadHeaderHandler()

bool Battlenet::Session::ReadHeaderHandler ( )
protected

Definition at line 771 of file Session.cpp.

+ Here is the call graph for this function:

◆ ReadHeaderLengthHandler()

bool Battlenet::Session::ReadHeaderLengthHandler ( )
protected

Definition at line 763 of file Session.cpp.

+ Here is the call graph for this function:

◆ SendRequest() [1/2]

void Battlenet::Session::SendRequest ( uint32  serviceHash,
uint32  methodId,
pb::Message const *  request 
)

Definition at line 172 of file Session.cpp.

+ Here is the call graph for this function:

◆ SendRequest() [2/2]

void Battlenet::Session::SendRequest ( uint32  serviceHash,
uint32  methodId,
pb::Message const *  request,
std::function< void(MessageBuffer)>  callback 
)
inline

Definition at line 127 of file Session.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendResponse() [1/2]

void Battlenet::Session::SendResponse ( uint32  token,
pb::Message const *  response 
)

Definition at line 131 of file Session.cpp.

+ Here is the call graph for this function:

◆ SendResponse() [2/2]

void Battlenet::Session::SendResponse ( uint32  token,
uint32  status 
)

Definition at line 153 of file Session.cpp.

+ Here is the call graph for this function:

◆ Start()

void Battlenet::Session::Start ( )

Definition at line 98 of file Session.cpp.

+ Here is the call graph for this function:

◆ Update()

bool Battlenet::Session::Update ( )

Definition at line 113 of file Session.cpp.

◆ VerifyWebCredentials()

uint32 Battlenet::Session::VerifyWebCredentials ( std::string const &  webCredentials,
std::function< void(ServiceBase *, uint32, ::google::protobuf::Message const *)> &  continuation 
)
private

Definition at line 300 of file Session.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ _accountInfo

std::shared_ptr<AccountInfo> Battlenet::Session::_accountInfo
private

Definition at line 175 of file Session.h.

◆ _authed

bool Battlenet::Session::_authed
private

Definition at line 188 of file Session.h.

◆ _build

uint32 Battlenet::Session::_build
private

Definition at line 180 of file Session.h.

◆ _clientInfo

ClientBuild::VariantId Battlenet::Session::_clientInfo
private

Definition at line 181 of file Session.h.

◆ _clientSecret

std::array<uint8, 32> Battlenet::Session::_clientSecret
private

Definition at line 186 of file Session.h.

◆ _gameAccountInfo

GameAccountInfo* Battlenet::Session::_gameAccountInfo
private

Definition at line 176 of file Session.h.

◆ _headerBuffer

MessageBuffer Battlenet::Session::_headerBuffer
private

Definition at line 172 of file Session.h.

◆ _headerLengthBuffer

MessageBuffer Battlenet::Session::_headerLengthBuffer
private

Definition at line 171 of file Session.h.

◆ _ipCountry

std::string Battlenet::Session::_ipCountry
private

Definition at line 184 of file Session.h.

◆ _locale

std::string Battlenet::Session::_locale
private

Definition at line 178 of file Session.h.

◆ _os

std::string Battlenet::Session::_os
private

Definition at line 179 of file Session.h.

◆ _packetBuffer

MessageBuffer Battlenet::Session::_packetBuffer
private

Definition at line 173 of file Session.h.

◆ _queryProcessor

QueryCallbackProcessor Battlenet::Session::_queryProcessor
private

Definition at line 190 of file Session.h.

◆ _requestToken

uint32 Battlenet::Session::_requestToken
private

Definition at line 193 of file Session.h.

◆ _responseCallbacks

std::unordered_map<uint32, std::function<void(MessageBuffer)> > Battlenet::Session::_responseCallbacks
private

Definition at line 192 of file Session.h.

◆ _socket

std::shared_ptr<Socket> Battlenet::Session::_socket
private

Definition at line 170 of file Session.h.

◆ _timezoneOffset

Minutes Battlenet::Session::_timezoneOffset
private

Definition at line 182 of file Session.h.

◆ ClientRequestHandlers

std::unordered_map< std::string, Battlenet::Session::ClientRequestHandler > const Battlenet::Session::ClientRequestHandlers
staticprivate
Initial value:
=
{
{ "Command_RealmListTicketRequest_v1", &Battlenet::Session::GetRealmListTicket },
{ "Command_LastCharPlayedRequest_v1", &Battlenet::Session::GetLastCharPlayed },
{ "Command_RealmListRequest_v1", &Battlenet::Session::GetRealmList },
{ "Command_RealmJoinRequest_v1", &Battlenet::Session::JoinRealm },
}
uint32 JoinRealm(std::unordered_map< std::string, Variant const * > const &params, game_utilities::v1::ClientResponse *response)
Definition Session.cpp:686
uint32 GetRealmList(std::unordered_map< std::string, Variant const * > const &params, game_utilities::v1::ClientResponse *response)
Definition Session.cpp:645
uint32 GetLastCharPlayed(std::unordered_map< std::string, Variant const * > const &params, game_utilities::v1::ClientResponse *response)
Definition Session.cpp:610
uint32 GetRealmListTicket(std::unordered_map< std::string, Variant const * > const &params, game_utilities::v1::ClientResponse *response)
Definition Session.cpp:553

Definition at line 501 of file Session.h.


The documentation for this class was generated from the following files: