TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Session.cpp File Reference
#include "Session.h"
#include "BattlenetRpcErrorCodes.h"
#include "ByteConverter.h"
#include "Database/DatabaseEnv.h"
#include "LoginRESTService.h"
#include "ProtobufJSON.h"
#include "RealmList.h"
#include "ServiceDispatcher.h"
#include "RealmList.pb.h"
#include <zlib.h>
+ Include dependency graph for Session.cpp:

Functions

Variant constGetParam (std::unordered_map< std::string, Variant const * > const &params, char const *paramName)
 
template<bool(Battlenet::Session::*)() processMethod, MessageBuffer Battlenet::Session::* outputBuffer>
bool PartialProcessPacket (Battlenet::Session *session, MessageBuffer &inputBuffer)
 

Function Documentation

Variant const* GetParam ( std::unordered_map< std::string, Variant const * > const params,
char const paramName 
)
inline
410 {
411  auto itr = params.find(paramName);
412  return itr != params.end() ? itr->second : nullptr;
413 }

+ Here is the caller graph for this function:

template<bool(Battlenet::Session::*)() processMethod, MessageBuffer Battlenet::Session::* outputBuffer>
bool PartialProcessPacket ( Battlenet::Session session,
MessageBuffer inputBuffer 
)
inline
576 {
577  MessageBuffer& buffer = session->*outputBuffer;
578 
579  // We have full read header, now check the data payload
580  if (buffer.GetRemainingSpace() > 0)
581  {
582  // need more data in the payload
583  std::size_t readDataSize = std::min(inputBuffer.GetActiveSize(), buffer.GetRemainingSpace());
584  buffer.Write(inputBuffer.GetReadPointer(), readDataSize);
585  inputBuffer.ReadCompleted(readDataSize);
586  }
587 
588  if (buffer.GetRemainingSpace() > 0)
589  {
590  // Couldn't receive the whole data this time.
591  ASSERT(inputBuffer.GetActiveSize() == 0);
592  return false;
593  }
594 
595  // just received fresh new payload
596  if (!(session->*processMethod)())
597  {
598  session->CloseSocket();
599  return false;
600  }
601 
602  return true;
603 }
size_type GetRemainingSpace() const
Definition: MessageBuffer.h:68
T min(const T &x, const T &y)
Definition: g3dmath.h:305
void ReadCompleted(size_type bytes)
Definition: MessageBuffer.h:62
void Write(void const *data, std::size_t size)
Definition: MessageBuffer.h:92
size_type GetActiveSize() const
Definition: MessageBuffer.h:66
#define ASSERT
Definition: Errors.h:55
uint8 * GetReadPointer()
Definition: MessageBuffer.h:58
void CloseSocket()
Definition: Socket.h:142
Definition: MessageBuffer.h:24

+ Here is the call graph for this function: