\section{KSocket\-Address Class Reference}
\label{classKSocketAddress}\index{KSocketAddress@{KSocketAddress}}
A socket address. a socket address.  


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

Inheritance diagram for KSocket\-Address:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=135pt]{classKSocketAddress__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KSocket\-Address:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=63pt]{classKSocketAddress__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
virtual {\bf $\sim$KSocket\-Address} ()
\item 
virtual {\bf QString} {\bf pretty} () const 
\item 
const sockaddr $\ast$ {\bf address} () const 
\item 
virtual ksocklen\_\-t {\bf size} () const 
\item 
{\bf operator const sockaddr $\ast$} () const 
\item 
int {\bf family} () const 
\item 
int {\bf iana\-Family} () const 
\item 
virtual bool {\bf is\-Equal} (const {\bf KSocket\-Address} \&other) const 
\item 
bool {\bf is\-Equal} (const {\bf KSocket\-Address} $\ast$other) const \label{classKSocketAddress_a8}

\item 
bool {\bf operator==} (const {\bf KSocket\-Address} \&other) const 
\item 
bool {\bf is\-Core\-Equal} (const {\bf KSocket\-Address} \&other) const 
\item 
bool {\bf is\-Core\-Equal} (const {\bf KSocket\-Address} $\ast$other) const 
\item 
virtual {\bf QString} {\bf node\-Name} () const 
\item 
virtual {\bf QString} {\bf service\-Name} () const 
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf KSocket\-Address} $\ast$ {\bf new\-Address} (const struct sockaddr $\ast$sa, ksocklen\_\-t size)
\item 
static int {\bf iana\-Family} (int af)
\item 
static int {\bf from\-Iana\-Family} (int iana)
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf KSocket\-Address} ()
\item 
{\bf KSocket\-Address} (const sockaddr $\ast$sa, ksocklen\_\-t size)
\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKSocketAddress_b2}

\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
sockaddr $\ast$ {\bf data}\label{classKSocketAddress_p0}

\item 
ksocklen\_\-t {\bf datasize}\label{classKSocketAddress_p1}

\item 
bool {\bf owndata}\label{classKSocketAddress_p2}

\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf KExtended\-Socket}\label{classKSocketAddress_n0}

\end{CompactItemize}


\subsection{Detailed Description}
A socket address. a socket address. 

This class envelopes almost if not all socket addresses.

\begin{Desc}
\item[Author:]Thiago Macieira $<${\tt thiago.macieira@kdemail.net}$>$ \end{Desc}




Definition at line 46 of file ksockaddr.h.

\subsection{Constructor \& Destructor Documentation}
\index{KSocketAddress@{KSocket\-Address}!KSocketAddress@{KSocketAddress}}
\index{KSocketAddress@{KSocketAddress}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KSocket\-Address::KSocket\-Address ()\hspace{0.3cm}{\tt  [inline, protected]}}\label{classKSocketAddress_b0}


Creates an empty class. 



Definition at line 53 of file ksockaddr.h.

Referenced by new\-Address().\index{KSocketAddress@{KSocket\-Address}!KSocketAddress@{KSocketAddress}}
\index{KSocketAddress@{KSocketAddress}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KSocket\-Address::KSocket\-Address (const sockaddr $\ast$ {\em sa}, ksocklen\_\-t {\em size})\hspace{0.3cm}{\tt  [protected]}}\label{classKSocketAddress_b1}


Creates with given data. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sa}]a sockaddr structure \item[{\em size}]the size of {\tt sa} \end{description}
\end{Desc}


Definition at line 83 of file ksockaddr.cpp.\index{KSocketAddress@{KSocket\-Address}!~KSocketAddress@{$\sim$KSocketAddress}}
\index{~KSocketAddress@{$\sim$KSocketAddress}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KSocket\-Address::$\sim${\bf KSocket\-Address} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKSocketAddress_a0}


Destructor. 



Definition at line 104 of file ksockaddr.cpp.

\subsection{Member Function Documentation}
\index{KSocketAddress@{KSocket\-Address}!pretty@{pretty}}
\index{pretty@{pretty}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KSocket\-Address::pretty () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKSocketAddress_a1}


Returns a string representation of this socket. 

\begin{Desc}
\item[Returns:]a pretty string representation \end{Desc}


Reimplemented in {\bf KInet\-Socket\-Address} {\rm (p.\,\pageref{classKInetSocketAddress_a21})}, and {\bf KUnix\-Socket\-Address} {\rm (p.\,\pageref{classKUnixSocketAddress_a7})}.

Definition at line 110 of file ksockaddr.cpp.\index{KSocketAddress@{KSocket\-Address}!address@{address}}
\index{address@{address}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const sockaddr$\ast$ KSocket\-Address::address () const\hspace{0.3cm}{\tt  [inline]}}\label{classKSocketAddress_a2}


Returns a sockaddr structure, for passing down to library functions. 

\begin{Desc}
\item[Returns:]the sockaddr structure, can be 0 \end{Desc}


Reimplemented in {\bf KUnix\-Socket\-Address} {\rm (p.\,\pageref{classKUnixSocketAddress_a9})}.

Definition at line 78 of file ksockaddr.h.

Referenced by KNetwork::KInet\-Socket\-Address::operator const sockaddr\_\-in $\ast$(), KNetwork::KInet\-Socket\-Address::operator const sockaddr\_\-in6 $\ast$(), KNetwork::KUnix\-Socket\-Address::operator const sockaddr\_\-un $\ast$(), and KUnix\-Socket\-Address::operator const sockaddr\_\-un $\ast$().\index{KSocketAddress@{KSocket\-Address}!size@{size}}
\index{size@{size}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual ksocklen\_\-t KSocket\-Address::size () const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKSocketAddress_a3}


Returns sockaddr structure size. 

\begin{Desc}
\item[Returns:]the size of the sockaddr structre, 0 if there is none. \end{Desc}


Reimplemented in {\bf KInet\-Socket\-Address} {\rm (p.\,\pageref{classKInetSocketAddress_a31})}.

Definition at line 85 of file ksockaddr.h.\index{KSocketAddress@{KSocket\-Address}!operator const sockaddr *@{operator const sockaddr $\ast$}}
\index{operator const sockaddr *@{operator const sockaddr $\ast$}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KSocket\-Address::operator const sockaddr $\ast$ () const\hspace{0.3cm}{\tt  [inline]}}\label{classKSocketAddress_a4}


Returns a sockaddr structure, for passing down to library functions. 

\begin{Desc}
\item[Returns:]the sockaddr structure, can be 0. \end{Desc}
\begin{Desc}
\item[See also:]{\bf address()}{\rm (p.\,\pageref{classKSocketAddress_a2})} \end{Desc}


Definition at line 93 of file ksockaddr.h.\index{KSocketAddress@{KSocket\-Address}!family@{family}}
\index{family@{family}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocket\-Address::family () const}\label{classKSocketAddress_a5}


Returns the family of this address. 

\begin{Desc}
\item[Returns:]the family of this address, AF\_\-UNSPEC if it's undefined \end{Desc}


Definition at line 115 of file ksockaddr.cpp.

Referenced by is\-Core\-Equal(), and is\-Equal().\index{KSocketAddress@{KSocket\-Address}!ianaFamily@{ianaFamily}}
\index{ianaFamily@{ianaFamily}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocket\-Address::iana\-Family () const\hspace{0.3cm}{\tt  [inline]}}\label{classKSocketAddress_a6}


Returns the IANA family number of this address. 

\begin{Desc}
\item[Returns:]the IANA family number of this address (1 for AF\_\-INET. 2 for AF\_\-INET6, otherwise 0) \end{Desc}


Definition at line 107 of file ksockaddr.h.\index{KSocketAddress@{KSocket\-Address}!isEqual@{isEqual}}
\index{isEqual@{isEqual}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSocket\-Address::is\-Equal (const {\bf KSocket\-Address} \& {\em other}) const\hspace{0.3cm}{\tt  [virtual]}}\label{classKSocketAddress_a7}


Returns true if this equals the other socket. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em other}]the other socket \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if both sockets are equal \end{Desc}


Definition at line 159 of file ksockaddr.cpp.

References KInet\-Socket\-Address::are\-Equal\-Inet(), KInet\-Socket\-Address::are\-Equal\-Inet6(), KUnix\-Socket\-Address::are\-Equal\-Unix(), and family().\index{KSocketAddress@{KSocket\-Address}!operator==@{operator==}}
\index{operator==@{operator==}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSocket\-Address::operator== (const {\bf KSocket\-Address} \& {\em other}) const\hspace{0.3cm}{\tt  [inline]}}\label{classKSocketAddress_a9}


Overloaded == operator. 

\begin{Desc}
\item[See also:]{\bf is\-Equal()}{\rm (p.\,\pageref{classKSocketAddress_a7})} \end{Desc}


Definition at line 123 of file ksockaddr.h.\index{KSocketAddress@{KSocket\-Address}!isCoreEqual@{isCoreEqual}}
\index{isCoreEqual@{isCoreEqual}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSocket\-Address::is\-Core\-Equal (const {\bf KSocket\-Address} \& {\em other}) const}\label{classKSocketAddress_a10}


Some sockets may differ in such things as services or port numbers, like Internet sockets. 

This function compares only the core part of that, if possible.

If not possible, like the default implementation, this returns the same as is\-Equal. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em other}]the other socket \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if the code part is equal \end{Desc}


Definition at line 179 of file ksockaddr.cpp.

References KInet\-Socket\-Address::are\-Equal\-Inet(), KInet\-Socket\-Address::are\-Equal\-Inet6(), KUnix\-Socket\-Address::are\-Equal\-Unix(), and family().\index{KSocketAddress@{KSocket\-Address}!isCoreEqual@{isCoreEqual}}
\index{isCoreEqual@{isCoreEqual}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSocket\-Address::is\-Core\-Equal (const {\bf KSocket\-Address} $\ast$ {\em other}) const\hspace{0.3cm}{\tt  [inline]}}\label{classKSocketAddress_a11}


Some sockets may differ in such things as services or port numbers, like Internet sockets. 

This function compares only the core part of that, if possible.

If not possible, like the default implementation, this returns the same as is\-Equal. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em other}]the other socket \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if the code part is equal \end{Desc}


Definition at line 148 of file ksockaddr.h.\index{KSocketAddress@{KSocket\-Address}!nodeName@{nodeName}}
\index{nodeName@{nodeName}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KSocket\-Address::node\-Name () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKSocketAddress_a12}


Returns the node name of this socket, as KExtended\-Socket::lookup expects as the first argument. 

In the case of Internet sockets, this is the hostname. The default implementation returns QString::null. \begin{Desc}
\item[Returns:]the node name, can be QString::null \end{Desc}


Reimplemented in {\bf KInet\-Socket\-Address} {\rm (p.\,\pageref{classKInetSocketAddress_a22})}.

Definition at line 196 of file ksockaddr.cpp.\index{KSocketAddress@{KSocket\-Address}!serviceName@{serviceName}}
\index{serviceName@{serviceName}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KSocket\-Address::service\-Name () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKSocketAddress_a13}


Returns the service name for this socket, as KExtended\-Socket::lookup expects as the service argument. 

In the case of Internet sockets, this is the port number. The default implementation returns QString::null. \begin{Desc}
\item[Returns:]the service name, can be QString::null \end{Desc}


Reimplemented in {\bf KInet\-Socket\-Address} {\rm (p.\,\pageref{classKInetSocketAddress_a23})}, and {\bf KUnix\-Socket\-Address} {\rm (p.\,\pageref{classKUnixSocketAddress_a8})}.

Definition at line 201 of file ksockaddr.cpp.\index{KSocketAddress@{KSocket\-Address}!newAddress@{newAddress}}
\index{newAddress@{newAddress}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KSocket\-Address} $\ast$ KSocket\-Address::new\-Address (const struct sockaddr $\ast$ {\em sa}, ksocklen\_\-t {\em size})\hspace{0.3cm}{\tt  [static]}}\label{classKSocketAddress_e0}


Creates a new KSocket\-Address or descendant class from given raw socket address. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sa}]new socket address \item[{\em size}]new socket address's length \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the new KSocket\-Address, or 0 if the function failed \end{Desc}


Definition at line 123 of file ksockaddr.cpp.

References KSocket\-Address().\index{KSocketAddress@{KSocket\-Address}!ianaFamily@{ianaFamily}}
\index{ianaFamily@{ianaFamily}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocket\-Address::iana\-Family (int {\em af})\hspace{0.3cm}{\tt  [static]}}\label{classKSocketAddress_e1}


Returns the IANA family number of the given address family. 

Returns 0 if there is no corresponding IANA family number. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em af}]the address family, in AF\_\-$\ast$ constants \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the IANA family number of this address (1 for AF\_\-INET. 2 for AF\_\-INET6, otherwise 0) \end{Desc}


Definition at line 206 of file ksockaddr.cpp.\index{KSocketAddress@{KSocket\-Address}!fromIanaFamily@{fromIanaFamily}}
\index{fromIanaFamily@{fromIanaFamily}!KSocketAddress@{KSocket\-Address}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocket\-Address::from\-Iana\-Family (int {\em iana})\hspace{0.3cm}{\tt  [static]}}\label{classKSocketAddress_e2}


Returns the address family of the given IANA family number. 

\begin{Desc}
\item[Returns:]the address family, AF\_\-UNSPEC for unknown IANA family numbers \end{Desc}


Definition at line 221 of file ksockaddr.cpp.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
ksockaddr.h\item 
ksockaddr.cpp\end{CompactItemize}
