.TH "ost::IPV4Address" 3 "Sun Dec 27 2020" "GNU CommonC++" \" -*- nroff -*- .ad l .nh .SH NAME ost::IPV4Address \- The network name and address objects are all derived from a common \fBIPV4Address\fP base class\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherited by \fBost::IPV4Broadcast\fP, \fBost::IPV4Host\fP, \fBost::IPV4Mask\fP, and \fBost::IPV4Multicast\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBIPV4Address\fP (const \fBIPV4Validator\fP *validator=NULL)" .br .RI "Create an Internet Address object with an empty (0\&.0\&.0\&.0) address\&. " .ti -1c .RI "\fBIPV4Address\fP (struct in_addr addr, const \fBIPV4Validator\fP *validator=NULL)" .br .RI "Convert the system internet address data type (struct in_addr) into a Common C++ \fBIPV4Address\fP object\&. " .ti -1c .RI "\fBIPV4Address\fP (const char *address, const \fBIPV4Validator\fP *validator=NULL)" .br .RI "Convert a null terminated ASCII host address string (example: '127\&.0\&.0\&.1') or host address name (example: 'www\&.voxilla\&.org') directly into a Common C++ \fBIPV4Address\fP object\&. " .ti -1c .RI "\fBIPV4Address\fP (const \fBIPV4Address\fP &rhs)" .br .RI "Copy constructor\&. " .ti -1c .RI "virtual \fB~IPV4Address\fP ()" .br .RI "Destructor\&. " .ti -1c .RI "const char * \fBgetHostname\fP (void) const" .br .RI "Provide a string representation of the value (Internet Address) held in the \fBIPV4Address\fP object\&. " .ti -1c .RI "bool \fBisInetAddress\fP (void) const" .br .RI "May be used to verify if a given \fBIPV4Address\fP returned by another function contains a 'valid' address, or '0\&.0\&.0\&.0' which is often used to mark 'invalid' \fBIPV4Address\fP values\&. " .ti -1c .RI "struct in_addr \fBgetAddress\fP (void) const" .br .RI "Provide a low level system usable struct in_addr object from the contents of \fBIPV4Address\fP\&. " .ti -1c .RI "struct in_addr \fBgetAddress\fP (size_t i) const" .br .RI "Provide a low level system usable struct in_addr object from the contents of \fBIPV4Address\fP\&. " .ti -1c .RI "size_t \fBgetAddressCount\fP () const" .br .RI "Returns the number of internet addresses that an \fBIPV4Address\fP object contains\&. " .ti -1c .RI "\fBIPV4Address\fP & \fBoperator=\fP (const char *str)" .br .ti -1c .RI "\fBIPV4Address\fP & \fBoperator=\fP (struct in_addr addr)" .br .ti -1c .RI "\fBIPV4Address\fP & \fBoperator=\fP (const \fBIPV4Address\fP &rhs)" .br .ti -1c .RI "\fBIPV4Address\fP & \fBoperator=\fP (unsigned long addr)" .br .RI "Allows assignment from the return of functions like inet_addr() or htonl() " .ti -1c .RI "\fBIPV4Address\fP & \fBoperator=\fP (unsigned int addr)" .br .ti -1c .RI "bool \fBoperator!\fP () const" .br .ti -1c .RI "bool \fBoperator==\fP (const \fBIPV4Address\fP &a) const" .br .RI "Compare two internet addresses to see if they are equal (if they specify the physical address of the same internet host)\&. " .ti -1c .RI "bool \fBoperator!=\fP (const \fBIPV4Address\fP &a) const" .br .RI "Compare two internet addresses to see if they are not equal (if they each refer to unique and different physical ip addresses)\&. " .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "bool \fBsetIPAddress\fP (const char *host)" .br .RI "Sets the IP address from a string representation of the numeric address, ie '127\&.0\&.0\&.1'\&. " .ti -1c .RI "void \fBsetAddress\fP (const char *host)" .br .RI "Used to specify a host name or numeric internet address\&. " .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "struct in_addr * \fBipaddr\fP" .br .ti -1c .RI "size_t \fBaddr_count\fP" .br .ti -1c .RI "char * \fBhostname\fP" .br .in -1c .SS "Static Protected Attributes" .in +1c .ti -1c .RI "static \fBMutex\fP \fBmutex\fP" .br .in -1c .SH "Detailed Description" .PP The network name and address objects are all derived from a common \fBIPV4Address\fP base class\&. Specific classes, such as \fBIPV4Host\fP, \fBIPV4Mask\fP, etc, are defined from \fBIPV4Address\fP entirely so that the manner a network address is being used can easily be documented and understood from the code and to avoid common errors and accidental misuse of the wrong address object\&. For example, a 'connection' to something that is declared as a 'IPV4Host' can be kept type-safe from a 'connection' accidently being made to something that was declared a 'IPV4Broadcast'\&. .PP \fBAuthor\fP .RS 4 David Sugar dyfet@ostel.com .RE .PP Internet Address binary data type\&. .PP \fBExamples\fP .in +1c \fBtcpthread\&.cpp\fP\&. .SH "Constructor & Destructor Documentation" .PP .SS "ost::IPV4Address::IPV4Address (const \fBIPV4Validator\fP * validator = \fCNULL\fP)" .PP Create an Internet Address object with an empty (0\&.0\&.0\&.0) address\&. .PP \fBParameters\fP .RS 4 \fIvalidator\fP optional validator function object, intended for derived classes\&. .RE .PP .SS "ost::IPV4Address::IPV4Address (struct in_addr addr, const \fBIPV4Validator\fP * validator = \fCNULL\fP)" .PP Convert the system internet address data type (struct in_addr) into a Common C++ \fBIPV4Address\fP object\&. .PP \fBParameters\fP .RS 4 \fIaddr\fP struct of system used binary internet address\&. .br \fIvalidator\fP optional validator function object, intended for derived classes\&. .RE .PP .SS "ost::IPV4Address::IPV4Address (const char * address, const \fBIPV4Validator\fP * validator = \fCNULL\fP)" .PP Convert a null terminated ASCII host address string (example: '127\&.0\&.0\&.1') or host address name (example: 'www\&.voxilla\&.org') directly into a Common C++ \fBIPV4Address\fP object\&. .PP \fBParameters\fP .RS 4 \fIaddress\fP null terminated C string\&. .br \fIvalidator\fP optional validator function object, intended for derived classes\&. .RE .PP .SS "ost::IPV4Address::IPV4Address (const \fBIPV4Address\fP & rhs)" .PP Copy constructor\&. .SS "virtual ost::IPV4Address::~IPV4Address ()\fC [virtual]\fP" .PP Destructor\&. .SH "Member Function Documentation" .PP .SS "struct in_addr ost::IPV4Address::getAddress (size_t i) const" .PP Provide a low level system usable struct in_addr object from the contents of \fBIPV4Address\fP\&. This is needed for services such as bind() and connect()\&. .PP \fBParameters\fP .RS 4 \fIi\fP for IPV4Addresses with multiple addresses, returns the address at this index\&. User should call \fBgetAddressCount()\fP to determine the number of address the object contains\&. .RE .PP \fBReturns\fP .RS 4 system binary coded internet address\&. If parameter i is out of range, the first address is returned\&. .RE .PP .SS "struct in_addr ost::IPV4Address::getAddress (void) const" .PP Provide a low level system usable struct in_addr object from the contents of \fBIPV4Address\fP\&. This is needed for services such as bind() and connect()\&. .PP \fBReturns\fP .RS 4 system binary coded internet address\&. .RE .PP .SS "size_t ost::IPV4Address::getAddressCount () const\fC [inline]\fP" .PP Returns the number of internet addresses that an \fBIPV4Address\fP object contains\&. This usually only happens with \fBIPV4Host\fP objects where multiple IP addresses are returned for a DNS lookup .SS "const char* ost::IPV4Address::getHostname (void) const" .PP Provide a string representation of the value (Internet Address) held in the \fBIPV4Address\fP object\&. .PP \fBReturns\fP .RS 4 string representation of \fBIPV4Address\fP\&. .RE .PP .PP \fBExamples\fP .in +1c \fBtcpthread\&.cpp\fP\&. .SS "bool ost::IPV4Address::isInetAddress (void) const" .PP May be used to verify if a given \fBIPV4Address\fP returned by another function contains a 'valid' address, or '0\&.0\&.0\&.0' which is often used to mark 'invalid' \fBIPV4Address\fP values\&. .PP \fBReturns\fP .RS 4 true if address != 0\&.0\&.0\&.0\&. .RE .PP .SS "bool ost::IPV4Address::operator! () const\fC [inline]\fP" .SS "bool \fBost::IPV4Address::operator!\fP= (const \fBIPV4Address\fP & a) const" .PP Compare two internet addresses to see if they are not equal (if they each refer to unique and different physical ip addresses)\&. This is implimented in terms of operator== .SS "\fBIPV4Address\fP& ost::IPV4Address::operator= (const char * str)" .PP Referenced by ost::IPV4Mask::operator=(), and ost::IPV4Host::operator=()\&. .SS "\fBIPV4Address\fP& ost::IPV4Address::operator= (const \fBIPV4Address\fP & rhs)" .SS "\fBIPV4Address\fP& ost::IPV4Address::operator= (struct in_addr addr)" .SS "\fBIPV4Address\fP& ost::IPV4Address::operator= (unsigned int addr)\fC [inline]\fP" .SS "\fBIPV4Address\fP& ost::IPV4Address::operator= (unsigned long addr)" .PP Allows assignment from the return of functions like inet_addr() or htonl() .SS "bool ost::IPV4Address::operator== (const \fBIPV4Address\fP & a) const" .PP Compare two internet addresses to see if they are equal (if they specify the physical address of the same internet host)\&. If there is more than one IP address in either \fBIPV4Address\fP object, this will return true if all of the IP addresses in the smaller are in the larger in any order\&. .SS "void ost::IPV4Address::setAddress (const char * host)\fC [protected]\fP" .PP Used to specify a host name or numeric internet address\&. .PP \fBParameters\fP .RS 4 \fIhost\fP The string representation of the IP address or a hostname, , if NULL, it will default to INADDR_ANY .RE .PP .SS "bool ost::IPV4Address::setIPAddress (const char * host)\fC [protected]\fP" .PP Sets the IP address from a string representation of the numeric address, ie '127\&.0\&.0\&.1'\&. .PP \fBParameters\fP .RS 4 \fIhost\fP The string representation of the IP address .RE .PP \fBReturns\fP .RS 4 true if successful .RE .PP .SH "Member Data Documentation" .PP .SS "size_t ost::IPV4Address::addr_count\fC [protected]\fP" .SS "char* ost::IPV4Address::hostname\fC [mutable]\fP, \fC [protected]\fP" .SS "struct in_addr* ost::IPV4Address::ipaddr\fC [protected]\fP" .SS "\fBMutex\fP ost::IPV4Address::mutex\fC [static]\fP, \fC [protected]\fP" .SH "Author" .PP Generated automatically by Doxygen for GNU CommonC++ from the source code\&.