.TH "KNetwork::KSocketAddress" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KNetwork::KSocketAddress \- A generic socket address.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <ksocketaddress.h>\fP
.PP
Inherited by \fBKNetwork::KInetSocketAddress\fP, and \fBKNetwork::KUnixSocketAddress\fP.
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKSocketAddress\fP ()"
.br
.ti -1c
.RI "\fBKSocketAddress\fP (const sockaddr *sa, Q_UINT16 len)"
.br
.ti -1c
.RI "\fBKSocketAddress\fP (const \fBKSocketAddress\fP &other)"
.br
.ti -1c
.RI "virtual \fB~KSocketAddress\fP ()"
.br
.ti -1c
.RI "\fBKSocketAddress\fP & \fBoperator=\fP (const \fBKSocketAddress\fP &other)"
.br
.ti -1c
.RI "const sockaddr * \fBaddress\fP () const "
.br
.ti -1c
.RI "sockaddr * \fBaddress\fP ()"
.br
.ti -1c
.RI "\fBKSocketAddress\fP & \fBsetAddress\fP (const sockaddr *sa, Q_UINT16 len)"
.br
.ti -1c
.RI "\fBoperator const sockaddr *\fP () const "
.br
.ti -1c
.RI "Q_UINT16 \fBlength\fP () const "
.br
.ti -1c
.RI "\fBKSocketAddress\fP & \fBsetLength\fP (Q_UINT16 len)"
.br
.ti -1c
.RI "int \fBfamily\fP () const "
.br
.ti -1c
.RI "virtual \fBKSocketAddress\fP & \fBsetFamily\fP (int family)"
.br
.ti -1c
.RI "int \fBianaFamily\fP () const "
.br
.ti -1c
.RI "bool \fBoperator==\fP (const \fBKSocketAddress\fP &other) const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBnodeName\fP () const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBserviceName\fP () const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBtoString\fP () const "
.br
.ti -1c
.RI "\fBKInetSocketAddress\fP & \fBasInet\fP ()"
.br
.ti -1c
.RI "\fBKInetSocketAddress\fP \fBasInet\fP () const "
.br
.ti -1c
.RI "\fBKUnixSocketAddress\fP & \fBasUnix\fP ()"
.br
.ti -1c
.RI "\fBKUnixSocketAddress\fP \fBasUnix\fP () const "
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static int \fBianaFamily\fP (int af)"
.br
.ti -1c
.RI "static int \fBfromIanaFamily\fP (int iana)"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "\fBKSocketAddress\fP (KSocketAddressData *d)"
.br
.in -1c
.SS "Protected Attributes"

.in +1c
.ti -1c
.RI "KSocketAddressData * \fBd\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
A generic socket address. 

This class holds one generic socket address.
.PP
\fBAuthor:\fP
.RS 4
Thiago Macieira <thiago.macieira@kdemail.net> 
.RE
.PP

.PP
Definition at line 413 of file ksocketaddress.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KSocketAddress::KSocketAddress ()"
.PP
Default constructor. 
.PP
Creates an empty object 
.PP
Definition at line 401 of file ksocketaddress.cpp.
.SS "KSocketAddress::KSocketAddress (const sockaddr * sa, Q_UINT16 len)"
.PP
Creates this object with the given data. 
.PP
The raw socket address is copied into this object.
.PP
\fBParameters:\fP
.RS 4
\fIsa\fP the socket address structure 
.br
\fIlen\fP the socket address length 
.RE
.PP

.PP
Definition at line 407 of file ksocketaddress.cpp.
.PP
References setAddress().
.SS "KSocketAddress::KSocketAddress (const \fBKSocketAddress\fP & other)"
.PP
Copy constructor. 
.PP
This creates a copy of the other object.
.PP
Data is not shared.
.PP
\fBParameters:\fP
.RS 4
\fIother\fP the object to copy from 
.RE
.PP

.PP
Definition at line 413 of file ksocketaddress.cpp.
.SS "KSocketAddress::~\fBKSocketAddress\fP ()\fC [virtual]\fP"
.PP
Destructor. 
.PP
Frees any associated resources. 
.PP
Definition at line 424 of file ksocketaddress.cpp.
.SH "Member Function Documentation"
.PP 
.SS "\fBKSocketAddress\fP & KSocketAddress::operator= (const \fBKSocketAddress\fP & other)"
.PP
Performs a shallow copy of the other object into this one. 
.PP
Data will be copied.
.PP
\fBParameters:\fP
.RS 4
\fIother\fP the object to copy from 
.RE
.PP

.PP
Definition at line 435 of file ksocketaddress.cpp.
.SS "const sockaddr * KSocketAddress::address () const"
.PP
Returns the socket address structure, to be passed down to low level functions. 
.PP
Note that this function returns NULL for invalid or empty sockets, so you may use to to test for validity. 
.PP
Definition at line 444 of file ksocketaddress.cpp.
.PP
Referenced by KNetwork::KSocketDevice::disconnect(), KNetwork::KSocksSocketDevice::localAddress(), KNetwork::KSocketDevice::localAddress(), KNetwork::KSocksSocketDevice::peerAddress(), and KNetwork::KSocketDevice::peerAddress().
.SS "sockaddr * KSocketAddress::address ()"
.PP
Returns the socket address structure, to be passed down to low level functions. 
.PP
Note that this function returns NULL for invalid or empty sockets, so you may use to to test for validity.
.PP
The returned value, if not NULL, is an internal buffer which is guaranteed to be at least \fBlength()\fP bytes long. 
.PP
Definition at line 451 of file ksocketaddress.cpp.
.SS "\fBKSocketAddress\fP & KSocketAddress::setAddress (const sockaddr * sa, Q_UINT16 len)"
.PP
Sets the address to the given address. 
.PP
The raw socket address is copied into this object.
.PP
\fBParameters:\fP
.RS 4
\fIsa\fP the socket address structure 
.br
\fIlen\fP the socket address length 
.RE
.PP

.PP
Definition at line 458 of file ksocketaddress.cpp.
.PP
Referenced by KSocketAddress().
.SS "KNetwork::KSocketAddress::operator const sockaddr * () const\fC [inline]\fP"
.PP
Returns the socket address structure, to be passed down to low level functions. 
.PP
Definition at line 489 of file ksocketaddress.h.
.SS "Q_UINT16 KSocketAddress::length () const"
.PP
Returns the length of this socket address structure. 
.PP
Definition at line 468 of file ksocketaddress.cpp.
.PP
Referenced by KNetwork::KSocketDevice::disconnect(), KNetwork::KSocksSocketDevice::localAddress(), KNetwork::KSocketDevice::localAddress(), KNetwork::KSocksSocketDevice::peerAddress(), and KNetwork::KSocketDevice::peerAddress().
.SS "\fBKSocketAddress\fP & KSocketAddress::setLength (Q_UINT16 len)"
.PP
Sets the length of this socket structure. 
.PP
Use this function with care. It allows you to resize the internal buffer to fit needs. This function should not be used except for handling unknown socket address structures.
.PP
Also note that this function may invalidate the socket if a known family is set (Internet or Unix socket) and the new length would be too small to hold the system's sockaddr_* structure. If unsure, reset the family:
.PP
.PP
.nf
   KSocketAddress qsa;
   [...]
   qsa.setFamily(AF_UNSPEC).setLength(newlen);
.fi
.PP
.PP
\fBParameters:\fP
.RS 4
\fIlen\fP the new length 
.RE
.PP

.PP
Definition at line 475 of file ksocketaddress.cpp.
.PP
Referenced by KNetwork::KSocksSocketDevice::localAddress(), KNetwork::KSocketDevice::localAddress(), KNetwork::KSocksSocketDevice::peerAddress(), and KNetwork::KSocketDevice::peerAddress().
.SS "int KSocketAddress::family () const"
.PP
Returns the family of this address. 
.PP
\fBReturns:\fP
.RS 4
the family of this address, AF_UNSPEC if it's undefined 
.RE
.PP

.PP
Definition at line 482 of file ksocketaddress.cpp.
.SS "\fBKSocketAddress\fP & KSocketAddress::setFamily (int family)\fC [virtual]\fP"
.PP
Sets the family of this object. 
.PP
Note: setting the family will probably invalidate any address data contained in this object. Use this function with care.
.PP
\fBParameters:\fP
.RS 4
\fIfamily\fP the new family to set 
.RE
.PP

.PP
Definition at line 489 of file ksocketaddress.cpp.
.PP
Referenced by KNetwork::KSocketDevice::disconnect().
.SS "int KNetwork::KSocketAddress::ianaFamily () const\fC [inline]\fP"
.PP
Returns the IANA family number of this address. 
.PP
\fBReturns:\fP
.RS 4
the IANA family number of this address (1 for AF_INET. 2 for AF_INET6, otherwise 0) 
.RE
.PP

.PP
Definition at line 540 of file ksocketaddress.h.
.SS "bool KSocketAddress::operator== (const \fBKSocketAddress\fP & other) const"
.PP
Returns true if this equals the other socket. 
.PP
Socket addresses are considered matching if and only if all data is the same.
.PP
\fBParameters:\fP
.RS 4
\fIother\fP the other socket 
.RE
.PP
\fBReturns:\fP
.RS 4
true if both sockets are equal 
.RE
.PP

.PP
Definition at line 498 of file ksocketaddress.cpp.
.PP
References d.
.SS "\fBQString\fP KSocketAddress::nodeName () const\fC [virtual]\fP"
.PP
Returns the node name of this socket. 
.PP
In the case of Internet sockets, this is string representation of the IP address. The default implementation returns QString::null.
.PP
\fBReturns:\fP
.RS 4
the node name, can be QString::null 
.RE
.PP
\fBBug\fP
.RS 4
use \fBKResolver\fP to resolve unknown families 
.RE
.PP

.PP
Definition at line 555 of file ksocketaddress.cpp.
.PP
References QString::number(), QString::ref(), and QString::truncate().
.PP
Referenced by toString().
.SS "\fBQString\fP KSocketAddress::serviceName () const\fC [virtual]\fP"
.PP
Returns the service name for this socket. 
.PP
In the case of Internet sockets, this is the port number. The default implementation returns QString::null.
.PP
\fBReturns:\fP
.RS 4
the service name, can be QString::null 
.RE
.PP
\fBBug\fP
.RS 4
use \fBKResolver\fP to resolve unknown families 
.RE
.PP

.PP
Definition at line 581 of file ksocketaddress.cpp.
.PP
References QString::number(), and QString::ref().
.PP
Referenced by toString().
.SS "\fBQString\fP KSocketAddress::toString () const\fC [virtual]\fP"
.PP
Returns this socket address as a string suitable for printing. 
.PP
Family, node and service are part of this address.
.PP
\fBBug\fP
.RS 4
use \fBKResolver\fP to resolve unknown families 
.RE
.PP

.PP
Definition at line 601 of file ksocketaddress.cpp.
.PP
References QString::arg(), QString::fromLatin1(), nodeName(), serviceName(), and QObject::tr().
.SS "\fBKInetSocketAddress\fP & KSocketAddress::asInet ()"
.PP
Returns an object reference that can be used to manipulate this socket as an Internet socket address. 
.PP
Both objects share the same data. 
.PP
Definition at line 622 of file ksocketaddress.cpp.
.PP
References QString::ref().
.SS "\fBKInetSocketAddress\fP KSocketAddress::asInet () const"
.PP
Returns an object is equal to this object's data, but they don't share it. 
.PP
Definition at line 627 of file ksocketaddress.cpp.
.PP
References QString::ref().
.SS "\fBKUnixSocketAddress\fP & KSocketAddress::asUnix ()"
.PP
Returns an object reference that can be used to manipulate this socket as a Unix socket address. 
.PP
Both objects share the same data. 
.PP
Definition at line 632 of file ksocketaddress.cpp.
.PP
References QString::ref().
.SS "\fBKUnixSocketAddress\fP KSocketAddress::asUnix () const"
.PP
Returns an object is equal to this object's data, but they don't share it. 
.PP
Definition at line 637 of file ksocketaddress.cpp.
.PP
References QString::ref().
.SS "int KSocketAddress::ianaFamily (int af)\fC [static]\fP"
.PP
Returns the IANA family number of the given address family. 
.PP
Returns 0 if there is no corresponding IANA family number. 
.PP
\fBParameters:\fP
.RS 4
\fIaf\fP the address family, in AF_* constants 
.RE
.PP
\fBReturns:\fP
.RS 4
the IANA family number of this address (1 for AF_INET. 2 for AF_INET6, otherwise 0) 
.RE
.PP

.PP
Definition at line 642 of file ksocketaddress.cpp.
.SS "int KSocketAddress::fromIanaFamily (int iana)\fC [static]\fP"
.PP
Returns the address family of the given IANA family number. 
.PP
\fBReturns:\fP
.RS 4
the address family, AF_UNSPEC for unknown IANA family numbers 
.RE
.PP

.PP
Definition at line 659 of file ksocketaddress.cpp.

.SH "Author"
.PP 
Generated automatically by Doxygen for kdecore Library from the source code.
