Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
Address Class Reference

#include <address.h>

Public Member Functions

 Address ()
 
 Address (u32 address, u16 port)
 
 Address (u8 a, u8 b, u8 c, u8 d, u16 port)
 
 Address (const IPv6AddressBytes *ipv6_bytes, u16 port)
 
bool operator== (const Address &address) const
 
bool operator!= (const Address &address) const
 
int getFamily () const
 
bool isValid () const
 
bool isIPv6 () const
 
struct in_addr getAddress () const
 
struct in6_addr getAddress6 () const
 
u16 getPort () const
 
void print (std::ostream &s) const
 
std::string serializeString () const
 
bool isAny () const
 
bool isLocalhost () const
 
void Resolve (const char *name, Address *fallback=nullptr)
 
void setAddress (u32 address)
 
void setAddress (u8 a, u8 b, u8 c, u8 d)
 
void setAddress (const IPv6AddressBytes *ipv6_bytes)
 
void setPort (u16 port)
 

Private Attributes

unsigned short m_addr_family = 0
 
union { 
 
   struct in_addr   ipv4 
 
   struct in6_addr   ipv6 
 
m_address 
 
u16 m_port = 0
 

Constructor & Destructor Documentation

◆ Address() [1/4]

Address::Address ( )

References m_address.

Referenced by Resolve().

+ Here is the caller graph for this function:

◆ Address() [2/4]

Address::Address ( u32 address,
u16 port )

References m_address, setAddress(), and setPort().

+ Here is the call graph for this function:

◆ Address() [3/4]

Address::Address ( u8 a,
u8 b,
u8 c,
u8 d,
u16 port )

References m_address, setAddress(), and setPort().

+ Here is the call graph for this function:

◆ Address() [4/4]

Address::Address ( const IPv6AddressBytes * ipv6_bytes,
u16 port )

References m_address, setAddress(), and setPort().

+ Here is the call graph for this function:

Member Function Documentation

◆ getAddress()

struct in_addr Address::getAddress ( ) const
inline

Referenced by UDPSocket::Bind(), UDPSocket::Send(), and TestSocket::testIPv4Socket().

+ Here is the caller graph for this function:

◆ getAddress6()

struct in6_addr Address::getAddress6 ( ) const
inline

Referenced by UDPSocket::Bind(), UDPSocket::Send(), and TestSocket::testIPv6Socket().

+ Here is the caller graph for this function:

◆ getFamily()

int Address::getFamily ( ) const
inline

References m_addr_family.

Referenced by UDPSocket::Bind(), ModApiServer::l_get_player_information(), UDPSocket::Send(), TestAddress::testBasic(), and TestAddress::testResolve().

+ Here is the caller graph for this function:

◆ getPort()

u16 Address::getPort ( ) const
inline

References m_port.

Referenced by Server::AsyncRunStep(), UDPSocket::Bind(), Game::connectToServer(), ModApiClient::l_get_server_info(), and UDPSocket::Send().

+ Here is the caller graph for this function:

◆ isAny()

bool Address::isAny ( ) const

References m_addr_family, and m_address.

Referenced by Game::connectToServer(), TestAddress::testBasic(), and TestAddress::testResolve().

+ Here is the caller graph for this function:

◆ isIPv6()

bool Address::isIPv6 ( ) const
inline

References m_addr_family.

Referenced by Client::connect(), con::ConnectionSendThread::connect(), Game::connectToServer(), Game::createSingleplayerServer(), run_dedicated_server(), TestConnection::testConnectSendReceive(), and TestSocket::testIPv4Socket().

+ Here is the caller graph for this function:

◆ isLocalhost()

bool Address::isLocalhost ( ) const

References m_addr_family, and m_address.

Referenced by TestAddress::testIsLocalhost(), and TestAddress::testResolve().

+ Here is the caller graph for this function:

◆ isValid()

bool Address::isValid ( ) const
inline

References m_addr_family.

Referenced by Game::connectToServer(), TestAddress::testBasic(), and TestAddress::testResolve().

+ Here is the caller graph for this function:

◆ operator!=()

bool Address::operator!= ( const Address & address) const
inline

◆ operator==()

bool Address::operator== ( const Address & address) const

References ipv4, ipv6, m_addr_family, m_address, and m_port.

◆ print()

void Address::print ( std::ostream & s) const

References m_addr_family, m_port, and serializeString().

Referenced by Client::connect(), con::ConnectionSendThread::connect(), and Server::start().

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

◆ Resolve()

void Address::Resolve ( const char * name,
Address * fallback = nullptr )

References Address(), g_settings, Settings::getBool(), m_addr_family, and setAddress().

Referenced by Game::connectToServer(), Game::createSingleplayerServer(), run_dedicated_server(), TestConnection::testConnectSendReceive(), TestSocket::testIPv4Socket(), and TestAddress::testResolve().

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

◆ serializeString()

◆ setAddress() [1/3]

void Address::setAddress ( const IPv6AddressBytes * ipv6_bytes)

◆ setAddress() [2/3]

void Address::setAddress ( u32 address)

References m_addr_family, and m_address.

Referenced by Address(), Address(), Address(), con::ConnectionSendThread::connect(), Game::connectToServer(), Game::createSingleplayerServer(), Resolve(), run_dedicated_server(), and setAddress().

+ Here is the caller graph for this function:

◆ setAddress() [3/3]

void Address::setAddress ( u8 a,
u8 b,
u8 c,
u8 d )

References setAddress().

+ Here is the call graph for this function:

◆ setPort()

void Address::setPort ( u16 port)

References m_port.

Referenced by Address(), Address(), Address(), and Game::connectToServer().

+ Here is the caller graph for this function:

Member Data Documentation

◆ ipv4

struct in_addr Address::ipv4

Referenced by operator==().

◆ ipv6

struct in6_addr Address::ipv6

Referenced by operator==().

◆ m_addr_family

unsigned short Address::m_addr_family = 0
private

◆ [union]

◆ m_port

u16 Address::m_port = 0
private

Referenced by getPort(), operator==(), print(), and setPort().


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