MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
mtcore::SubnetV4 Struct Reference

A masked IP version 4 address. More...

#include <ip.hpp>

Collaboration diagram for mtcore::SubnetV4:

Public Member Functions

bool is_valid () const
 Checks if a masked IP address is valid (i.e.
 
bool operator== (const SubnetV4 &o) const
 
bool operator!= (const SubnetV4 &o) const
 

Public Attributes

IPv4 ip = {}
 
u8 mask_id = 0
 

Detailed Description

A masked IP version 4 address.

Definition at line 237 of file ip.hpp.

Member Function Documentation

◆ is_valid()

bool mtcore::SubnetV4::is_valid ( ) const
inlinenodiscard

Checks if a masked IP address is valid (i.e.

the subnet id is correct and the mask is applied)

Definition at line 244 of file ip.hpp.

244 {
246 return false;
247 }
249 }
static constexpr bool valid_id(u8 id)
Checks if an id is a valid subnet mask id (0-32)
Definition ip.hpp:167
SubnetV4 subnet_ip(const IPv4 &ip)
Subnets an IP address based on the IP mask.
static SubnetMaskV4 by_id(u8 id)
Retrieves a subnet mask by id (valid ids is 0-32).
Definition ip.hpp:169
Here is the call graph for this function:

◆ operator!=()

bool mtcore::SubnetV4::operator!= ( const SubnetV4 & o) const
inline

Definition at line 252 of file ip.hpp.

252{ return !(o == *this); }

◆ operator==()

bool mtcore::SubnetV4::operator== ( const SubnetV4 & o) const
inline

Definition at line 251 of file ip.hpp.

251{ return mask_id == o.mask_id && ip == o.ip; }

Member Data Documentation

◆ ip

IPv4 mtcore::SubnetV4::ip = {}

Definition at line 238 of file ip.hpp.

238{};

◆ mask_id

u8 mtcore::SubnetV4::mask_id = 0

Definition at line 239 of file ip.hpp.


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