Open 3D Engine AzNetworking API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzNetworking::CidrAddress Class Reference

Helper class that implements Classless Inter-Domain Routing (CIDR) IP address filtering. More...

#include <CidrAddress.h>

Public Member Functions

 CidrAddress (const AZStd::string &cidrAddress)
 
bool ParseAddress (const AZStd::string &cidrAddress)
 
bool IsMatch (const IpAddress &address) const
 
bool IsMatch (uint32_t address) const
 
uint32_t GetIp () const
 
uint32_t GetMask () const
 

Protected Attributes

uint32_t m_ip = 0
 
uint32_t m_mask = 0xFFFFFFFF
 

Detailed Description

Helper class that implements Classless Inter-Domain Routing (CIDR) IP address filtering.

Constructor & Destructor Documentation

◆ CidrAddress()

AzNetworking::CidrAddress::CidrAddress ( const AZStd::string &  cidrAddress)

Construct from an input string.

Parameters
cidrAddressthe input string to parse as a CIDR address (dotted quad/mask, ie 127.0.0.1/32)

Member Function Documentation

◆ GetIp()

uint32_t AzNetworking::CidrAddress::GetIp ( ) const

Returns the IP of this CIDR address in host byte order.

Returns
the IP of this CIDR address in host byte order

◆ GetMask()

uint32_t AzNetworking::CidrAddress::GetMask ( ) const

Returns the mask of this CIDR address.

Returns
the mask of this CIDR address

◆ IsMatch() [1/2]

bool AzNetworking::CidrAddress::IsMatch ( const IpAddress address) const

Check to see if a AzNetworking uint IP matches this CIDR address instance.

Parameters
addressinput IpAddress to validate
Returns
boolean true if the address matches, false if it fails

◆ IsMatch() [2/2]

bool AzNetworking::CidrAddress::IsMatch ( uint32_t  address) const

Check to see if a AzNetworking uint IP matches this CIDR address instance.

Parameters
addressinput IPv4 address as a uint32_t ** must be in host byte order **
Returns
boolean true if the address matches, false if it fails

◆ ParseAddress()

bool AzNetworking::CidrAddress::ParseAddress ( const AZStd::string &  cidrAddress)

Parse the address from the provided string.

Parameters
cidrAddressthe input string to parse as a CIDR address (dotted quad/mask, ie 127.0.0.1/32)
Returns
boolean true if the input was successfully parsed, false on error

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