AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Acore::Net Namespace Reference

Functions

uint32 address_to_uint (boost::asio::ip::address_v4 const &address)
 
bool IsInNetwork (boost::asio::ip::address_v4 const &networkAddress, boost::asio::ip::address_v4 const &mask, boost::asio::ip::address_v4 const &clientAddress)
 
boost::asio::ip::address_v4 GetDefaultNetmaskV4 (boost::asio::ip::address_v4 const &networkAddress)
 
bool IsInNetwork (boost::asio::ip::address_v6 const &networkAddress, uint16 prefixLength, boost::asio::ip::address_v6 const &clientAddress)
 

Function Documentation

◆ address_to_uint()

uint32 Acore::Net::address_to_uint ( boost::asio::ip::address_v4 const &  address)
inline
28{ return address.to_uint(); }

Referenced by GetDefaultNetmaskV4(), and IpLocationStore::GetLocationRecord().

◆ GetDefaultNetmaskV4()

boost::asio::ip::address_v4 Acore::Net::GetDefaultNetmaskV4 ( boost::asio::ip::address_v4 const &  networkAddress)
inline
36 {
37 if ((address_to_uint(networkAddress) & 0x80000000) == 0)
38 {
39 return boost::asio::ip::address_v4(0xFF000000);
40 }
41 if ((address_to_uint(networkAddress) & 0xC0000000) == 0x80000000)
42 {
43 return boost::asio::ip::address_v4(0xFFFF0000);
44 }
45 if ((address_to_uint(networkAddress) & 0xE0000000) == 0xC0000000)
46 {
47 return boost::asio::ip::address_v4(0xFFFFFF00);
48 }
49 return boost::asio::ip::address_v4(0xFFFFFFFF);
50 }
uint32 address_to_uint(boost::asio::ip::address_v4 const &address)
Definition: IpAddress.h:28

References address_to_uint().

◆ IsInNetwork() [1/2]

bool Acore::Net::IsInNetwork ( boost::asio::ip::address_v4 const &  networkAddress,
boost::asio::ip::address_v4 const &  mask,
boost::asio::ip::address_v4 const &  clientAddress 
)
inline
29 {
30 boost::asio::ip::network_v4 network = boost::asio::ip::make_network_v4(networkAddress, mask);
31 boost::asio::ip::address_v4_range hosts = network.hosts();
32 return hosts.find(clientAddress) != hosts.end();
33 }

Referenced by Realm::GetAddressForClient().

◆ IsInNetwork() [2/2]

bool Acore::Net::IsInNetwork ( boost::asio::ip::address_v6 const &  networkAddress,
uint16  prefixLength,
boost::asio::ip::address_v6 const &  clientAddress 
)
inline
53 {
54 boost::asio::ip::network_v6 network = boost::asio::ip::make_network_v6(networkAddress, prefixLength);
55 boost::asio::ip::address_v6_range hosts = network.hosts();
56 return hosts.find(clientAddress) != hosts.end();
57 }