Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > by-pkgid > ad1ba1135a9c9eeffc2e538163e00373 > files > 664

libCommonC++2_1.4-devel-1.4.1-1mdv2007.0.i586.rpm

\section{ost::IPV4Address Class Reference}
\label{classost_1_1_i_p_v4_address}\index{ost::IPV4Address@{ost::IPV4Address}}
The network name and address objects are all derived from a common {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} base class.Internet Address binary data type.  


{\tt \#include $<$address.h$>$}

Inheritance diagram for ost::IPV4Address::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2cm]{classost_1_1_i_p_v4_address}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf IPV4Address} (const {\bf IPV4Validator} $\ast$validator=NULL)
\begin{CompactList}\small\item\em Create an Internet Address object with an empty (0.0.0.0) address. \item\end{CompactList}\item 
{\bf IPV4Address} (struct in\_\-addr addr, const {\bf IPV4Validator} $\ast$validator=NULL)
\begin{CompactList}\small\item\em Convert the system internet address data type (struct in\_\-addr) into a Common C++ {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} object. \item\end{CompactList}\item 
{\bf IPV4Address} (const char $\ast$address, const {\bf IPV4Validator} $\ast$validator=NULL)
\begin{CompactList}\small\item\em Convert a null terminated ASCII host address string (example: \char`\"{}127.0.0.1\char`\"{}) or host address name (example: \char`\"{}www.voxilla.org\char`\"{}) directly into a Common C++ {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} object. \item\end{CompactList}\item 
{\bf IPV4Address} (const {\bf IPV4Address} \&rhs)
\begin{CompactList}\small\item\em Copy constructor. \item\end{CompactList}\item 
virtual {\bf $\sim$IPV4Address} ()
\begin{CompactList}\small\item\em Destructor. \item\end{CompactList}\item 
const char $\ast$ {\bf get\-Hostname} (void) const 
\begin{CompactList}\small\item\em Provide a string representation of the value (Internet Address) held in the {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} object. \item\end{CompactList}\item 
bool {\bf is\-Inet\-Address} (void) const 
\begin{CompactList}\small\item\em May be used to verify if a given {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} returned by another function contains a \char`\"{}valid\char`\"{} address, or \char`\"{}0.0.0.0\char`\"{} which is often used to mark \char`\"{}invalid\char`\"{} {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} values. \item\end{CompactList}\item 
in\_\-addr {\bf get\-Address} (void) const 
\begin{CompactList}\small\item\em Provide a low level system usable struct in\_\-addr object from the contents of {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})}. \item\end{CompactList}\item 
in\_\-addr {\bf get\-Address} (size\_\-t i) const 
\begin{CompactList}\small\item\em Provide a low level system usable struct in\_\-addr object from the contents of {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})}. \item\end{CompactList}\item 
size\_\-t {\bf get\-Address\-Count} () const 
\begin{CompactList}\small\item\em Returns the number of internet addresses that an {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} object contains. \item\end{CompactList}\item 
{\bf IPV4Address} \& {\bf operator=} (const char $\ast$str)
\item 
{\bf IPV4Address} \& {\bf operator=} (struct in\_\-addr addr)
\item 
{\bf IPV4Address} \& {\bf operator=} (const {\bf IPV4Address} \&rhs)
\item 
{\bf IPV4Address} \& {\bf operator=} (unsigned long addr)
\begin{CompactList}\small\item\em Allows assignment from the return of functions like inet\_\-addr() or htonl(). \item\end{CompactList}\item 
{\bf IPV4Address} \& {\bf operator=} (unsigned int addr)
\item 
bool {\bf operator!} () const 
\item 
bool {\bf operator==} (const {\bf IPV4Address} \&a) const 
\begin{CompactList}\small\item\em Compare two internet addresses to see if they are equal (if they specify the physical address of the same internet host). \item\end{CompactList}\item 
bool {\bf operator!=} (const {\bf IPV4Address} \&a) const 
\begin{CompactList}\small\item\em Compare two internet addresses to see if they are not equal (if they each refer to unique and different physical ip addresses). \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
bool {\bf set\-IPAddress} (const char $\ast$host)
\begin{CompactList}\small\item\em Sets the IP address from a string representation of the numeric address, ie \char`\"{}127.0.0.1\char`\"{}. \item\end{CompactList}\item 
void {\bf set\-Address} (const char $\ast$host)
\begin{CompactList}\small\item\em Used to specify a host name or numeric internet address. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
in\_\-addr $\ast$ {\bf ipaddr}
\item 
size\_\-t {\bf addr\_\-count}
\item 
char $\ast$ {\bf hostname}
\end{CompactItemize}
\subsection*{Static Protected Attributes}
\begin{CompactItemize}
\item 
static {\bf Mutex} {\bf mutex}
\end{CompactItemize}


\subsection{Detailed Description}
The network name and address objects are all derived from a common {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} base class.Internet Address binary data type. 

Specific classes, such as {\bf IPV4Host}{\rm (p.\,\pageref{classost_1_1_i_p_v4_host})}, {\bf IPV4Mask}{\rm (p.\,\pageref{classost_1_1_i_p_v4_mask})}, etc, are defined from {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} 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 \char`\"{}connection\char`\"{} to something that is declared as a \char`\"{}IPV4Host\char`\"{} can be kept type-safe from a \char`\"{}connection\char`\"{} accidently being made to something that was declared a \char`\"{}IPV4Broadcast\char`\"{}.

\begin{Desc}
\item[Author:]David Sugar $<${\tt dyfet@ostel.com}$>$ \end{Desc}
\begin{Desc}
\item[Examples: ]\par


{\bf tcpthread.cpp}.\end{Desc}




\subsection{Constructor \& Destructor Documentation}
\index{ost::IPV4Address@{ost::IPV4Address}!IPV4Address@{IPV4Address}}
\index{IPV4Address@{IPV4Address}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::IPV4Address::IPV4Address (const {\bf IPV4Validator} $\ast$ {\em validator} = {\tt NULL})}\label{classost_1_1_i_p_v4_address_05ba4c9d7a44d647ac2b5d443c529cba}


Create an Internet Address object with an empty (0.0.0.0) address. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em validator}]optional validator function object, intended for derived classes. \end{description}
\end{Desc}
\index{ost::IPV4Address@{ost::IPV4Address}!IPV4Address@{IPV4Address}}
\index{IPV4Address@{IPV4Address}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::IPV4Address::IPV4Address (struct in\_\-addr {\em addr}, const {\bf IPV4Validator} $\ast$ {\em validator} = {\tt NULL})}\label{classost_1_1_i_p_v4_address_0aef6689f1b3c419cd28add796fde0c8}


Convert the system internet address data type (struct in\_\-addr) into a Common C++ {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} object. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em addr}]struct of system used binary internet address. \item[{\em validator}]optional validator function object, intended for derived classes. \end{description}
\end{Desc}
\index{ost::IPV4Address@{ost::IPV4Address}!IPV4Address@{IPV4Address}}
\index{IPV4Address@{IPV4Address}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::IPV4Address::IPV4Address (const char $\ast$ {\em address}, const {\bf IPV4Validator} $\ast$ {\em validator} = {\tt NULL})}\label{classost_1_1_i_p_v4_address_b77c0c8301677b654cd64c94c8442f6f}


Convert a null terminated ASCII host address string (example: \char`\"{}127.0.0.1\char`\"{}) or host address name (example: \char`\"{}www.voxilla.org\char`\"{}) directly into a Common C++ {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} object. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em address}]null terminated C string. \item[{\em validator}]optional validator function object, intended for derived classes. \end{description}
\end{Desc}
\index{ost::IPV4Address@{ost::IPV4Address}!IPV4Address@{IPV4Address}}
\index{IPV4Address@{IPV4Address}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::IPV4Address::IPV4Address (const {\bf IPV4Address} \& {\em rhs})}\label{classost_1_1_i_p_v4_address_e3fd5fd2919e5934cd7b3ae2d9b752b3}


Copy constructor. 

\index{ost::IPV4Address@{ost::IPV4Address}!~IPV4Address@{$\sim$IPV4Address}}
\index{~IPV4Address@{$\sim$IPV4Address}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual ost::IPV4Address::$\sim$IPV4Address ()\hspace{0.3cm}{\tt  [virtual]}}\label{classost_1_1_i_p_v4_address_c8c4c826369f4ce356df0392cc595c9d}


Destructor. 



\subsection{Member Function Documentation}
\index{ost::IPV4Address@{ost::IPV4Address}!getAddress@{getAddress}}
\index{getAddress@{getAddress}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct in\_\-addr ost::IPV4Address::get\-Address (size\_\-t {\em i}) const}\label{classost_1_1_i_p_v4_address_0e47b365f8d88e343963533ad54ca302}


Provide a low level system usable struct in\_\-addr object from the contents of {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})}. 

This is needed for services such as bind() and connect().

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em i}]for IPV4Addresses with multiple addresses, returns the address at this index. User should call {\bf get\-Address\-Count()}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address_90c4bc29684968f09d5cf61f3d7d7524})} to determine the number of address the object contains. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]system binary coded internet address. If parameter i is out of range, the first address is returned. \end{Desc}
\index{ost::IPV4Address@{ost::IPV4Address}!getAddress@{getAddress}}
\index{getAddress@{getAddress}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct in\_\-addr ost::IPV4Address::get\-Address (void) const}\label{classost_1_1_i_p_v4_address_43a862793e22c0cf16416470490423b1}


Provide a low level system usable struct in\_\-addr object from the contents of {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})}. 

This is needed for services such as bind() and connect().

\begin{Desc}
\item[Returns:]system binary coded internet address. \end{Desc}
\index{ost::IPV4Address@{ost::IPV4Address}!getAddressCount@{getAddressCount}}
\index{getAddressCount@{getAddressCount}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}size\_\-t ost::IPV4Address::get\-Address\-Count () const\hspace{0.3cm}{\tt  [inline]}}\label{classost_1_1_i_p_v4_address_90c4bc29684968f09d5cf61f3d7d7524}


Returns the number of internet addresses that an {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} object contains. 

This usually only happens with {\bf IPV4Host}{\rm (p.\,\pageref{classost_1_1_i_p_v4_host})} objects where multiple IP addresses are returned for a DNS lookup \index{ost::IPV4Address@{ost::IPV4Address}!getHostname@{getHostname}}
\index{getHostname@{getHostname}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ ost::IPV4Address::get\-Hostname (void) const}\label{classost_1_1_i_p_v4_address_af68688cd2253cdcd313a12ab6177167}


Provide a string representation of the value (Internet Address) held in the {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} object. 

\begin{Desc}
\item[Returns:]string representation of {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})}. \end{Desc}
\begin{Desc}
\item[Examples: ]\par
{\bf tcpthread.cpp}.\end{Desc}
\index{ost::IPV4Address@{ost::IPV4Address}!isInetAddress@{isInetAddress}}
\index{isInetAddress@{isInetAddress}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool ost::IPV4Address::is\-Inet\-Address (void) const}\label{classost_1_1_i_p_v4_address_68aa94e15b9b662ddded4fb3e4810933}


May be used to verify if a given {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} returned by another function contains a \char`\"{}valid\char`\"{} address, or \char`\"{}0.0.0.0\char`\"{} which is often used to mark \char`\"{}invalid\char`\"{} {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} values. 

\begin{Desc}
\item[Returns:]true if address != 0.0.0.0. \end{Desc}
\index{ost::IPV4Address@{ost::IPV4Address}!operator"!@{operator"!}}
\index{operator"!@{operator"!}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool ost::IPV4Address::operator! () const\hspace{0.3cm}{\tt  [inline]}}\label{classost_1_1_i_p_v4_address_028f090c2d60034c3cbc4a23efafd356}


\index{ost::IPV4Address@{ost::IPV4Address}!operator"!=@{operator"!=}}
\index{operator"!=@{operator"!=}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool ost::IPV4Address::operator!= (const {\bf IPV4Address} \& {\em a}) const}\label{classost_1_1_i_p_v4_address_e905a9689c6c05d6c3eb70ebadf8b9ab}


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== \index{ost::IPV4Address@{ost::IPV4Address}!operator=@{operator=}}
\index{operator=@{operator=}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf IPV4Address}\& ost::IPV4Address::operator= (unsigned int {\em addr})\hspace{0.3cm}{\tt  [inline]}}\label{classost_1_1_i_p_v4_address_8198f8d8f9fae2de78194fc26c3b44c6}


\index{ost::IPV4Address@{ost::IPV4Address}!operator=@{operator=}}
\index{operator=@{operator=}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf IPV4Address}\& ost::IPV4Address::operator= (unsigned long {\em addr})}\label{classost_1_1_i_p_v4_address_c05d9c4599ad313dec545a9e89e7e2d5}


Allows assignment from the return of functions like inet\_\-addr() or htonl(). 



Reimplemented in {\bf ost::IPV4Mask} {\rm (p.\,\pageref{classost_1_1_i_p_v4_mask_49ec7fe09dfcc3b9a963e2dc6f1186d4})}, and {\bf ost::IPV4Host} {\rm (p.\,\pageref{classost_1_1_i_p_v4_host_28be54aa5dd6c5ed9feeeb6c76ab0b27})}.\index{ost::IPV4Address@{ost::IPV4Address}!operator=@{operator=}}
\index{operator=@{operator=}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf IPV4Address}\& ost::IPV4Address::operator= (const {\bf IPV4Address} \& {\em rhs})}\label{classost_1_1_i_p_v4_address_c59145207f75857c414ade190e618290}


\index{ost::IPV4Address@{ost::IPV4Address}!operator=@{operator=}}
\index{operator=@{operator=}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf IPV4Address}\& ost::IPV4Address::operator= (struct in\_\-addr {\em addr})}\label{classost_1_1_i_p_v4_address_3d81a8ccf64b8647426e18e534c48e5d}


\index{ost::IPV4Address@{ost::IPV4Address}!operator=@{operator=}}
\index{operator=@{operator=}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf IPV4Address}\& ost::IPV4Address::operator= (const char $\ast$ {\em str})}\label{classost_1_1_i_p_v4_address_aeab0179a7fa73673815e1cc623ab709}


\index{ost::IPV4Address@{ost::IPV4Address}!operator==@{operator==}}
\index{operator==@{operator==}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool ost::IPV4Address::operator== (const {\bf IPV4Address} \& {\em a}) const}\label{classost_1_1_i_p_v4_address_f1ddac78ac54d96dca8462fccd34233d}


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 {\bf IPV4Address}{\rm (p.\,\pageref{classost_1_1_i_p_v4_address})} object, this will return true if all of the IP addresses in the smaller are in the larger in any order. \index{ost::IPV4Address@{ost::IPV4Address}!setAddress@{setAddress}}
\index{setAddress@{setAddress}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::IPV4Address::set\-Address (const char $\ast$ {\em host})\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_i_p_v4_address_3a2e12b44eb5455b2c68b1b84bd2a31f}


Used to specify a host name or numeric internet address. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em host}]The string representation of the IP address or a hostname, , if NULL, it will default to INADDR\_\-ANY \end{description}
\end{Desc}
\index{ost::IPV4Address@{ost::IPV4Address}!setIPAddress@{setIPAddress}}
\index{setIPAddress@{setIPAddress}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool ost::IPV4Address::set\-IPAddress (const char $\ast$ {\em host})\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_i_p_v4_address_928ae39893ca3d158505c527610f9a84}


Sets the IP address from a string representation of the numeric address, ie \char`\"{}127.0.0.1\char`\"{}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em host}]The string representation of the IP address \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful \end{Desc}


\subsection{Member Data Documentation}
\index{ost::IPV4Address@{ost::IPV4Address}!addr_count@{addr\_\-count}}
\index{addr_count@{addr\_\-count}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}size\_\-t {\bf ost::IPV4Address::addr\_\-count}\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_i_p_v4_address_3128cf0e2832071593f940717b484e88}


\index{ost::IPV4Address@{ost::IPV4Address}!hostname@{hostname}}
\index{hostname@{hostname}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ {\bf ost::IPV4Address::hostname}\hspace{0.3cm}{\tt  [mutable, protected]}}\label{classost_1_1_i_p_v4_address_9c3cc2812bf79827298211ed4ca4550b}


\index{ost::IPV4Address@{ost::IPV4Address}!ipaddr@{ipaddr}}
\index{ipaddr@{ipaddr}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct in\_\-addr$\ast$ {\bf ost::IPV4Address::ipaddr}\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_i_p_v4_address_4437ba1e6bde3e8252df8a1a591ecfe5}


\index{ost::IPV4Address@{ost::IPV4Address}!mutex@{mutex}}
\index{mutex@{mutex}!ost::IPV4Address@{ost::IPV4Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Mutex} {\bf ost::IPV4Address::mutex}\hspace{0.3cm}{\tt  [static, protected]}}\label{classost_1_1_i_p_v4_address_5bbe8d3806115e2c4882efb728ba039d}




The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
{\bf address.h}\end{CompactItemize}