AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Realm Struct Reference

#include "Realm.h"

Public Member Functions

boost::asio::ip::tcp_endpoint GetAddressForClient (boost::asio::ip::address const &clientAddr) const
 

Public Attributes

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

Detailed Description

Member Function Documentation

◆ GetAddressForClient()

boost::asio::ip::tcp_endpoint Realm::GetAddressForClient ( boost::asio::ip::address const &  clientAddr) const
24{
25 boost::asio::ip::address realmIp;
26
27 // Attempt to send best address for client
28 if (clientAddr.is_loopback())
29 {
30 // Try guessing if realm is also connected locally
31 if (LocalAddress->is_loopback() || ExternalAddress->is_loopback())
32 {
33 realmIp = clientAddr;
34 }
35 else
36 {
37 // Assume that user connecting from the machine that bnetserver is located on
38 // has all realms available in his local network
39 realmIp = *LocalAddress;
40 }
41 }
42 else
43 {
44 if (clientAddr.is_v4() && Acore::Net::IsInNetwork(LocalAddress->to_v4(), LocalSubnetMask->to_v4(), clientAddr.to_v4()))
45 {
46 realmIp = *LocalAddress;
47 }
48 else
49 {
50 realmIp = *ExternalAddress;
51 }
52 }
53
54 // Return external IP
55 return boost::asio::ip::tcp_endpoint(realmIp, Port);
56}
basic_endpoint< tcp > tcp_endpoint
Definition: AsioHacksFwd.h:45
bool IsInNetwork(boost::asio::ip::address_v4 const &networkAddress, boost::asio::ip::address_v4 const &mask, boost::asio::ip::address_v4 const &clientAddress)
Definition: IpNetwork.h:32
uint16 Port
Definition: Realm.h:73
std::unique_ptr< boost::asio::ip::address > LocalSubnetMask
Definition: Realm.h:72
std::unique_ptr< boost::asio::ip::address > LocalAddress
Definition: Realm.h:71
std::unique_ptr< boost::asio::ip::address > ExternalAddress
Definition: Realm.h:70

References ExternalAddress, Acore::Net::IsInNetwork(), LocalAddress, LocalSubnetMask, and Port.

Referenced by AuthSession::RealmListCallback().

Member Data Documentation

◆ AllowedSecurityLevel

◆ Build

◆ ExternalAddress

std::unique_ptr<boost::asio::ip::address> Realm::ExternalAddress

◆ Flags

◆ Id

◆ LocalAddress

std::unique_ptr<boost::asio::ip::address> Realm::LocalAddress

◆ LocalSubnetMask

std::unique_ptr<boost::asio::ip::address> Realm::LocalSubnetMask

◆ Name

◆ PopulationLevel

float Realm::PopulationLevel

◆ Port

◆ Timezone

◆ Type