feisty meow concerns codebase
2.140
|
this type of address describes a destination out on the internet. More...
#include <internet_address.h>
Public Types | |
enum | internet_address_constraints { ADDRESS_SIZE = 4 , MAXIMUM_HOSTNAME_LENGTH = 128 } |
typedef basis::abyte | address_array[ADDRESS_SIZE] |
Public Member Functions | |
internet_address () | |
internet_address (const basis::byte_array &ip_address, const basis::astring &host, int port) | |
DEFINE_CLASS_NAME ("internet_address") | |
machine_uid | convert () const |
void | fill (const basis::byte_array &ip_address, const basis::astring &host, int port) |
bool | same_host (const base_address &to_compare) const |
bool | same_port (const base_address &to_compare) const |
bool | shareable (const base_address &to_compare) const |
bool | operator== (const internet_address &to_compare) const |
basis::astring | text_form () const |
basis::astring | tokenize () const |
bool | detokenize (const basis::astring &info) |
basis::astring | normalize_host () const |
bool | is_nil_address () const |
bool | is_localhost () const |
base_address * | create_copy () const |
void | pack (basis::byte_array &packed_form) const |
Creates a packed form of the packable object in "packed_form". More... | |
bool | unpack (basis::byte_array &packed_form) |
Restores the packable from the "packed_form". More... | |
virtual int | packed_size () const |
Estimates the space needed for the packed structure. More... | |
Public Member Functions inherited from basis::nameable | |
virtual const char * | class_name () const =0 |
Returns the bare name of this class as a constant character pointer. More... | |
Static Public Member Functions | |
static const basis::byte_array & | nil_address () |
static bool | is_nil_address (const address_array &ip_address) |
static bool | appropriate_for_ip (const basis::astring &to_check) |
static bool | valid_address (const basis::astring &to_check) |
static bool | is_valid_internet_address (const basis::astring &to_check, basis::byte_array &ip_form, bool &all_zeros) |
static bool | ip_appropriate_number (const basis::astring &to_check, int indy, basis::astring &accum) |
returns true if "to_check" has a number at "indy" that works in ipv4. More... | |
static bool | has_ip_address (const basis::astring &to_check, basis::astring &ip_found) |
returns true if "to_check" has an IP address in it somewhere. More... | |
static basis::astring | ip_address_text_form (const basis::byte_array &ip_address) |
static const basis::byte_array & | localhost () |
Public Attributes | |
address_array | ip_address |
int | port |
char | hostname [MAXIMUM_HOSTNAME_LENGTH] |
this type of address describes a destination out on the internet.
Definition at line 30 of file internet_address.h.
typedef basis::abyte sockets::internet_address::address_array[ADDRESS_SIZE] |
Definition at line 38 of file internet_address.h.
Enumerator | |
---|---|
ADDRESS_SIZE | |
MAXIMUM_HOSTNAME_LENGTH |
Definition at line 33 of file internet_address.h.
sockets::internet_address::internet_address | ( | ) |
Definition at line 92 of file internet_address.cpp.
sockets::internet_address::internet_address | ( | const basis::byte_array & | ip_address, |
const basis::astring & | host, | ||
int | port | ||
) |
Definition at line 94 of file internet_address.cpp.
|
static |
Definition at line 397 of file internet_address.cpp.
References basis::astring::length().
|
virtual |
Implements sockets::base_address.
Definition at line 102 of file internet_address.cpp.
Referenced by sockets::spocket::accept(), cromp::cromp_common::chew_hostname(), sockets::tcpip_stack::enumerate_adapters(), and sockets::spocket::receive_from().
|
virtual |
Implements sockets::base_address.
Definition at line 243 of file internet_address.cpp.
sockets::internet_address::DEFINE_CLASS_NAME | ( | "internet_address" | ) |
|
virtual |
Implements sockets::base_address.
void sockets::internet_address::fill | ( | const basis::byte_array & | ip_address, |
const basis::astring & | host, | ||
int | port | ||
) |
Definition at line 232 of file internet_address.cpp.
References basis::array< contents >::length(), basis::minimum(), and basis::astring::stuff().
Referenced by sockets::tcpip_stack::convert(), and sockets::tcpip_stack::fill_and_resolve().
|
static |
returns true if "to_check" has an IP address in it somewhere.
this looks across the whole string and returns the first IP address it finds in "ip_found", if possible.
Definition at line 127 of file internet_address.cpp.
References basis::astring::find(), FUNCDEF, basis::astring::length(), basis::negative(), basis::astring::reset(), and basis::astring::substring().
|
static |
Definition at line 462 of file internet_address.cpp.
|
static |
returns true if "to_check" has a number at "indy" that works in ipv4.
this reports if the string at the position specified could be part of a valid internet address. the characters starting at the "indy" must be numeric. up to three numbers will be checked, and when we get three or less of the numbers together, we will check that they make an integer less than 255. the "accum" string will be filled with the number we found. note that this doesn't care what the characters are after our 1-3 numbers; it merely checks whether the portion of the string at "indy" could work in an IP address.
Definition at line 105 of file internet_address.cpp.
References basis::astring::convert(), timely::convert(), FUNCDEF, basis::astring::length(), and basis::astring::reset().
bool sockets::internet_address::is_localhost | ( | ) | const |
bool sockets::internet_address::is_nil_address | ( | ) | const |
|
static |
Definition at line 271 of file internet_address.cpp.
|
static |
Definition at line 412 of file internet_address.cpp.
References basis::astring::contains(), basis::astring::convert(), basis::astring::end(), basis::array< contents >::length(), NULL_POINTER, basis::array< contents >::reset(), and basis::astring::s().
Referenced by sockets::tcpip_stack::fill_and_resolve().
|
static |
Referenced by sockets::tcpip_stack::fill_and_resolve(), and sockets::tcpip_stack::full_resolve().
|
static |
Referenced by sockets::tcpip_stack::fill_and_resolve(), and sockets::tcpip_stack::full_resolve().
basis::astring sockets::internet_address::normalize_host | ( | ) | const |
Referenced by cromp::cromp_common::chew_hostname().
|
inline |
Definition at line 61 of file internet_address.h.
References same_host(), and same_port().
|
virtual |
Creates a packed form of the packable object in "packed_form".
This must append to the data in "packed_form" rather than clearing prior contents.
Implements basis::packable.
|
virtual |
Estimates the space needed for the packed structure.
Implements basis::packable.
|
virtual |
Implements sockets::base_address.
Referenced by operator==().
|
virtual |
Implements sockets::base_address.
Referenced by operator==().
|
virtual |
Implements sockets::base_address.
|
virtual |
Implements sockets::base_address.
Definition at line 249 of file internet_address.cpp.
Referenced by cromp::cromp_common::chew_hostname(), cromp::cromp_server::enable_servers(), and cromp::cromp_common::open_common().
|
virtual |
Implements sockets::base_address.
Definition at line 369 of file internet_address.cpp.
References ADD, DUMP_EXIT, basis::astring::end(), FUNCDEF, LOG, STORER_ENTRY, basis::astring::text_form(), and basis::astring::zap().
|
virtual |
Restores the packable from the "packed_form".
This object becomes the unpacked form, and therefore must lose any of its prior contents that depend on the data in "packed_form". This is up to the derived unpack function to figure out. The "packed_form" is modified by extracting all of the pieces that are used for this object; the remainder stays in "packed_form". true is returned if the unpacking was successful.
Implements basis::packable.
|
static |
Definition at line 455 of file internet_address.cpp.
char sockets::internet_address::hostname[MAXIMUM_HOSTNAME_LENGTH] |
Definition at line 42 of file internet_address.h.
Referenced by cromp::cromp_common::chew_hostname(), sockets::tcpip_stack::enumerate_adapters(), and sockets::tcpip_stack::resolve_any().
address_array sockets::internet_address::ip_address |
Definition at line 39 of file internet_address.h.
Referenced by sockets::tcpip_stack::convert(), and sockets::tcpip_stack::resolve_any().
int sockets::internet_address::port |
Definition at line 40 of file internet_address.h.
Referenced by cromp::cromp_common::chew_hostname(), and sockets::tcpip_stack::convert().