TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Realm Struct Reference

#include <Realm.h>

Public Member Functions

ip::tcp::endpoint GetAddressForClient (ip::address const &clientAddr) const
 
uint32 GetConfigId () const
 

Public Attributes

Battlenet::RealmHandle Id
 
uint32 Build
 
ip::address ExternalAddress
 
ip::address LocalAddress
 
ip::address LocalSubnetMask
 
uint16 Port
 
std::string Name
 
uint8 Type
 
RealmFlags Flags
 
uint8 Timezone
 
AccountTypes AllowedSecurityLevel
 
float PopulationLevel
 

Static Public Attributes

static uint32 const ConfigIdByType [MAX_CLIENT_REALM_TYPE]
 

Member Function Documentation

ip::tcp::endpoint Realm::GetAddressForClient ( ip::address const clientAddr) const
22 {
23  ip::address realmIp;
24 
25  // Attempt to send best address for client
26  if (clientAddr.is_loopback())
27  {
28  // Try guessing if realm is also connected locally
29  if (LocalAddress.is_loopback() || ExternalAddress.is_loopback())
30  realmIp = clientAddr;
31  else
32  {
33  // Assume that user connecting from the machine that bnetserver is located on
34  // has all realms available in his local network
35  realmIp = LocalAddress;
36  }
37  }
38  else
39  {
40  if (clientAddr.is_v4() &&
41  (clientAddr.to_v4().to_ulong() & LocalSubnetMask.to_v4().to_ulong()) ==
42  (LocalAddress.to_v4().to_ulong() & LocalSubnetMask.to_v4().to_ulong()))
43  {
44  realmIp = LocalAddress;
45  }
46  else
47  realmIp = ExternalAddress;
48  }
49 
50  ip::tcp::endpoint endpoint(realmIp, Port);
51 
52  // Return external IP
53  return endpoint;
54 }
uint16 Port
Definition: Realm.h:91
ip::address ExternalAddress
Definition: Realm.h:88
ip::address LocalSubnetMask
Definition: Realm.h:90
ip::address LocalAddress
Definition: Realm.h:89

+ Here is the caller graph for this function:

uint32 Realm::GetConfigId ( ) const
57 {
58  return ConfigIdByType[Type];
59 }
static uint32 const ConfigIdByType[MAX_CLIENT_REALM_TYPE]
Definition: Realm.h:102
uint8 Type
Definition: Realm.h:93

+ Here is the caller graph for this function:

Member Data Documentation

AccountTypes Realm::AllowedSecurityLevel
uint32 Realm::Build
uint32 const Realm::ConfigIdByType
static
Initial value:
=
{
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
}
ip::address Realm::ExternalAddress
RealmFlags Realm::Flags
ip::address Realm::LocalAddress
ip::address Realm::LocalSubnetMask
std::string Realm::Name
float Realm::PopulationLevel
uint16 Realm::Port
uint8 Realm::Timezone
uint8 Realm::Type

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