NetworkIpAddrPortInterface Class Reference

#include <network_ip_addr.h>

Inheritance diagram for NetworkIpAddrPortInterface:

Detailed Description

Provides an Internet Protocol (IP) address + port. This class extends the NetworkIpAddrInterface with a port.

@MAXON_ANNOTATION{refclass=false}

Public Member Functions

MAXON_METHOD void SetPort (Int32 port)
 
MAXON_METHOD Int32 GetPort () const
 
MAXON_METHOD NetworkIpAddr GetAddress () const
 
String ToString (const FormatStatement *formatStatement=nullptr) const
 
MAXON_METHOD Result< void > GetIPv4AndPort (sockaddr_in *sockaddr) const
 
MAXON_METHOD Result< void > GetIPv6AndPort (sockaddr_in6 *sockaddr) const
 
MAXON_METHOD Result< void > GetIPAndPort (sockaddr_storage *sockaddr, Int32 &len) const
 
MAXON_METHOD Result< void > SetIPv4AndPort (const sockaddr_in *in)
 
MAXON_METHOD Result< void > SetIPv6AndPort (const sockaddr_in6 *in)
 
MAXON_METHOD Result< void > SetIPAndPort (const sockaddr_storage *in)
 
MAXON_METHOD Bool IsEqual (const NetworkIpAddrPortInterface *adr) const
 
MAXON_METHOD Bool IsEqual (const NetworkIpAddrInterface *adr) const
 
- Public Member Functions inherited from NetworkIpAddrInterface
MAXON_METHOD NetworkSockAddrIn GetNetworkSockAddrIn () const
 
MAXON_METHOD void SetNetworkSockaddrIn (const NetworkSockAddrIn &sa, PROTOCOL protocol)
 
MAXON_METHOD void Reset ()
 
MAXON_METHOD void Flush ()
 
MAXON_METHOD void SetIPv4 (UInt32 ip, Bool isHostByteOrder)
 
MAXON_METHOD void SetIPv4 (UChar a, UChar b, UChar c, UChar d)
 
MAXON_METHOD void SetIPv6 (UInt16 x1, UInt16 x2, UInt16 x3, UInt16 x4, UInt16 x5, UInt16 x6, UInt16 x7, UInt16 x8)
 
MAXON_METHOD void SetIPv4 (const in_addr &in)
 
MAXON_METHOD void SetIPv6 (const in6_addr &in)
 
MAXON_METHOD Result< void > SetIPv4 (const sockaddr_in *in)
 
MAXON_METHOD Result< void > SetIPv6 (const sockaddr_in6 *in)
 
MAXON_METHOD void SetIPv4 (WILDCARD_IPV4_ADDRESS_TYPE)
 
MAXON_METHOD void SetIPv6 (WILDCARD_IPV6_ADDRESS_TYPE)
 
MAXON_METHOD Result< void > GetIPv4 (UChar &a, UChar &b, UChar &c, UChar &d) const
 
MAXON_METHOD Result< void > GetIPv6 (UInt16 &x1, UInt16 &x2, UInt16 &x3, UInt16 &x4, UInt16 &x5, UInt16 &x6, UInt16 &x7, UInt16 &x8) const
 
MAXON_METHOD Result< void > GetIPv4 (sockaddr_in *sockaddr) const
 
MAXON_METHOD Result< void > GetIPv6 (sockaddr_in6 *sockaddr) const
 
MAXON_METHOD PROTOCOL GetProtocol () const
 
MAXON_METHOD int GetNativeProtocol () const
 
MAXON_METHOD void SetProtocol (PROTOCOL protocol)
 
MAXON_METHOD Bool IsPrivateAddress () const
 
MAXON_METHOD Bool IsMulticastAddress () const
 
MAXON_METHOD Bool IsWildcardAddress () const
 
MAXON_METHOD Bool IsUnspecified () const
 
MAXON_METHOD Bool IsEmpty () const
 
MAXON_FUNCTION Bool IsPopulated () const
 
MAXON_METHOD Bool IsValid () const
 
MAXON_METHOD String GetString (Int32 port=0) const
 
String ToString (const FormatStatement *formatStatement=nullptr) const
 
MAXON_METHOD Bool IsEqual (const NetworkIpAddrInterface *adr) const
 
MAXON_METHOD Bool IsInSameNetwork (const NetworkIpAddr &otherAddress, const NetworkIpAddr &subnetMask) const
 
MAXON_METHOD HashInt GetHashCode () const
 

Static Public Member Functions

static MAXON_METHOD NetworkIpAddrPortInterfaceAlloc (MAXON_SOURCE_LOCATION_DECLARATION, const NetworkIpAddr &addr, Int32 port)
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL_DERIVED (NetworkIpAddrPortInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.interface.networkipaddrport")
 

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL_DERIVED()

MAXON_INTERFACE_NONVIRTUAL_DERIVED ( NetworkIpAddrPortInterface  ,
MAXON_REFERENCE_COPY_ON_WRITE  ,
"net.maxon.interface.networkipaddrport"   
)
private

◆ Alloc()

static MAXON_METHOD NetworkIpAddrPortInterface* Alloc ( MAXON_SOURCE_LOCATION_DECLARATION  ,
const NetworkIpAddr addr,
Int32  port 
)
static

◆ SetPort()

MAXON_METHOD void SetPort ( Int32  port)

Sets the port.

Parameters
[in]portThe port or 0 to reset port information.

◆ GetPort()

MAXON_METHOD Int32 GetPort ( ) const

Returns the port.

Returns
The port or 0 if no port was set.

◆ GetAddress()

MAXON_METHOD NetworkIpAddr GetAddress ( ) const

Returns the address without the port.

Returns
Returns the address without the port.

◆ ToString()

String ToString ( const FormatStatement formatStatement = nullptr) const

Returns a readable string of the content.

Parameters
[in]formatStatementNullptr or additional formatting instruction. Currently no additional formatting instructions are supported.
Returns
The converted result.

◆ GetIPv4AndPort()

MAXON_METHOD Result<void> GetIPv4AndPort ( sockaddr_in *  sockaddr) const

Returns the ip v4 address and port in the passed sockaddr structure

Parameters
[in,out]sockaddrPointer to sockaddr structure.

◆ GetIPv6AndPort()

MAXON_METHOD Result<void> GetIPv6AndPort ( sockaddr_in6 *  sockaddr) const

Returns the ip v6 address and port in the passed sockaddr structure

Parameters
[in,out]sockaddrPointer to sockaddr structure.

◆ GetIPAndPort()

MAXON_METHOD Result<void> GetIPAndPort ( sockaddr_storage *  sockaddr,
Int32 len 
) const

Returns the ip address and port based on the ip family choosen for this socket

Parameters
[in,out]sockaddrPointer to sockaddr structure.
[in,out]lenContains the length of the data returned in the sockaddr structure.

◆ SetIPv4AndPort()

MAXON_METHOD Result<void> SetIPv4AndPort ( const sockaddr_in *  in)

Sets an ip v4 address from the native sockaddr_in structure.

Parameters
[in]inPointer to sockaddr_in structure.

◆ SetIPv6AndPort()

MAXON_METHOD Result<void> SetIPv6AndPort ( const sockaddr_in6 *  in)

Sets an ip v4 address from the native sockaddr_in6 structure.

Parameters
[in]inPointer to sockaddr_in6 structure.

◆ SetIPAndPort()

MAXON_METHOD Result<void> SetIPAndPort ( const sockaddr_storage *  in)

Sets the ip and port based on the specified protocol (IP4 or IP6)

Parameters
[in]inPointer to sockaddr_storage structure.

◆ IsEqual() [1/2]

MAXON_METHOD Bool IsEqual ( const NetworkIpAddrPortInterface adr) const

Compares the object against another given object.

Parameters
[in]adrIP address to compare.
Returns
True if both ip addresses are identical.

◆ IsEqual() [2/2]

MAXON_METHOD Bool IsEqual ( const NetworkIpAddrInterface adr) const