Minetest  5.4.0
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)
 
bool operator!= (const Address &address)
 
void Resolve (const char *name)
 
struct sockaddr_in getAddress () const
 
unsigned short getPort () const
 
void setAddress (u32 address)
 
void setAddress (u8 a, u8 b, u8 c, u8 d)
 
void setAddress (const IPv6AddressBytes *ipv6_bytes)
 
struct sockaddr_in6 getAddress6 () const
 
int getFamily () const
 
bool isIPv6 () const
 
bool isZero () const
 
void setPort (unsigned short port)
 
void print (std::ostream *s) const
 
std::string serializeString () const
 
bool isLocalhost () const
 

Private Attributes

unsigned int m_addr_family = 0
 
union {
   struct sockaddr_in   ipv4
 
   struct sockaddr_in6   ipv6
 
m_address
 
u16 m_port = 0
 

Constructor & Destructor Documentation

◆ Address() [1/4]

Address::Address ( )

References m_address.

◆ 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 sockaddr_in Address::getAddress ( ) const

References itos(), m_addr_family, and m_address.

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

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

◆ getAddress6()

struct sockaddr_in6 Address::getAddress6 ( ) const

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

+ Here is the caller graph for this function:

◆ getFamily()

int Address::getFamily ( ) const

References m_addr_family.

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

+ Here is the caller graph for this function:

◆ getPort()

u16 Address::getPort ( ) const

References m_port.

Referenced by Server::AsyncRunStep(), UDPSocket::Bind(), con::ConnectionSendThread::connect(), ModApiClient::l_get_server_info(), UDPSocket::Send(), Game::showPauseMenu(), and Server::start().

+ Here is the caller graph for this function:

◆ isIPv6()

bool Address::isIPv6 ( ) const

References m_addr_family.

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

+ Here is the caller graph for this function:

◆ isLocalhost()

bool Address::isLocalhost ( ) const

References isIPv6(), and m_address.

Referenced by TestAddress::testIsLocalhost().

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

◆ isZero()

bool Address::isZero ( ) const

References m_addr_family, and m_address.

Referenced by Game::connectToServer().

+ Here is the caller graph for this function:

◆ operator!=()

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

◆ operator==()

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

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 Game::connectToServer(), UDPSocket::Receive(), and UDPSocket::Send().

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

◆ Resolve()

void Address::Resolve ( const char *  name)

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

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

+ 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(), con::ConnectionSendThread::connect(), Game::connectToServer(), Game::createSingleplayerServer(), Resolve(), and run_dedicated_server().

+ Here is the caller graph for this function:

◆ setAddress() [3/3]

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

References m_addr_family, and m_address.

◆ setPort()

void Address::setPort ( unsigned short  port)

References m_port.

Referenced by Address().

+ Here is the caller graph for this function:

Member Data Documentation

◆ ipv4

struct sockaddr_in Address::ipv4

Referenced by operator==().

◆ ipv6

struct sockaddr_in6 Address::ipv6

Referenced by operator==().

◆ m_addr_family

unsigned int Address::m_addr_family = 0
private

◆ 

union { ... } Address::m_address

◆ 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: