OpenTTD Source  20240919-master-gdf0233f4c2
address.cpp File Reference
#include "../../stdafx.h"
#include "address.h"
#include "../network_internal.h"
#include "../../debug.h"
#include "../../safeguards.h"

Go to the source code of this file.

Functions

static const char * GetAddressFormatString (uint16_t family, bool with_family)
 Helper to get the formatting string of an address for a given family. More...
 
static SOCKET ResolveLoopProc (addrinfo *)
 Helper function to resolve without opening a socket. More...
 
static SOCKET ListenLoopProc (addrinfo *runp)
 Helper function to resolve a listening. More...
 

Detailed Description

Implementation of the address.

Definition in file address.cpp.

Function Documentation

◆ GetAddressFormatString()

static const char* GetAddressFormatString ( uint16_t  family,
bool  with_family 
)
static

Helper to get the formatting string of an address for a given family.

Parameters
familyThe family to get the address format for.
with_familyWhether to add the familty to the address (e.g. IPv4).
Returns
The format string for the address.

Definition at line 80 of file address.cpp.

Referenced by NetworkAddress::GetAddressAsString().

◆ ListenLoopProc()

static SOCKET ListenLoopProc ( addrinfo *  runp)
static

Helper function to resolve a listening.

Parameters
runpinformation about the socket to try not
Returns
the opened socket or INVALID_SOCKET

Definition at line 298 of file address.cpp.

References NetworkAddress::AddressFamilyAsString(), Debug, NetworkAddress::GetAddressAsString(), NetworkError::GetLast(), SetNoDelay(), SetNonBlocking(), SetReusePort(), and NetworkAddress::SocketTypeAsString().

Referenced by NetworkAddress::Listen().

◆ ResolveLoopProc()

static SOCKET ResolveLoopProc ( addrinfo *  )
static

Helper function to resolve without opening a socket.

Returns
the opened socket or INVALID_SOCKET

Definition at line 103 of file address.cpp.

Referenced by NetworkAddress::GetAddress(), NetworkAddress::IsFamily(), and NetworkAddress::Resolve().