BitShares-Core  7.0.1
BitShares blockchain node software and command-line wallet software
Public Member Functions | Friends | List of all members
fc::ip::address Class Reference

#include <ip.hpp>

Public Member Functions

 address (uint32_t ip=0)
 
 address (const std::string &s)
 
addressoperator= (const std::string &s)
 
addressoperator= (uint32_t ip)
 
 operator std::string () const
 
 operator uint32_t () const
 
bool is_private_address () const
 
bool is_multicast_address () const
 
bool is_loopback_address () const
 
bool is_public_address () const
 

Friends

bool operator== (const address &a, const address &b)
 
bool operator!= (const address &a, const address &b)
 

Detailed Description

Definition at line 10 of file ip.hpp.

Constructor & Destructor Documentation

◆ address() [1/2]

fc::ip::address::address ( uint32_t  ip = 0)
explicit

Definition at line 10 of file ip.cpp.

◆ address() [2/2]

fc::ip::address::address ( const std::string &  s)
explicit

Definition at line 13 of file ip.cpp.

Member Function Documentation

◆ is_loopback_address()

bool fc::ip::address::is_loopback_address ( ) const

127.0.0.0 to 127.255.255.255

Definition at line 142 of file ip.cpp.

◆ is_multicast_address()

bool fc::ip::address::is_multicast_address ( ) const

224.0.0.0 to 239.255.255.255

Definition at line 132 of file ip.cpp.

◆ is_private_address()

bool fc::ip::address::is_private_address ( ) const
Returns
true if the ip is in the following ranges:
  • 10.0.0.0 to 10.255.255.255
  • 172.16.0.0 to 172.31.255.255
  • 192.168.0.0 to 192.168.255.255
  • 169.254.0.0 to 169.254.255.255

Definition at line 112 of file ip.cpp.

◆ is_public_address()

bool fc::ip::address::is_public_address ( ) const

not private, not loopback, and not multicast

Note
technically there are some addresses that are reserved but not public (see https://en.wikipedia.org/wiki/Reserved_IP_addresses), but so far we haven't distinguished them.
  • 0.0.0.0–0.255.255.255
  • 100.64.0.0–100.127.255.255
  • 192.0.0.0–192.0.0.255
  • 192.0.2.0–192.0.2.255
  • 192.88.99.0–192.88.99.255
  • 198.18.0.0–198.19.255.255
  • 198.51.100.0–198.51.100.255
  • 203.0.113.0–203.0.113.255
  • 233.252.0.0-233.252.0.255 (within the range 224.0.0.0–239.255.255.255)
  • 240.0.0.0–255.255.255.254
  • 255.255.255.255

Definition at line 150 of file ip.cpp.

◆ operator std::string()

fc::ip::address::operator std::string ( ) const
explicit

Definition at line 45 of file ip.cpp.

◆ operator uint32_t()

fc::ip::address::operator uint32_t ( ) const

Definition at line 53 of file ip.cpp.

◆ operator=() [1/2]

address & fc::ip::address::operator= ( const std::string &  s)

Definition at line 29 of file ip.cpp.

◆ operator=() [2/2]

address & fc::ip::address::operator= ( uint32_t  ip)

Definition at line 39 of file ip.cpp.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const address a,
const address b 
)
friend

Definition at line 25 of file ip.cpp.

◆ operator==

bool operator== ( const address a,
const address b 
)
friend

Definition at line 22 of file ip.cpp.


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