KNetwork::KSocketAddress Class Reference
A generic socket address. More...
#include <ksocketaddress.h>
Inheritance diagram for KNetwork::KSocketAddress:

Public Member Functions | |
KSocketAddress () | |
KSocketAddress (const sockaddr *sa, Q_UINT16 len) | |
KSocketAddress (const KSocketAddress &other) | |
virtual | ~KSocketAddress () |
KSocketAddress & | operator= (const KSocketAddress &other) |
const sockaddr * | address () const |
sockaddr * | address () |
KSocketAddress & | setAddress (const sockaddr *sa, Q_UINT16 len) |
operator const sockaddr * () const | |
Q_UINT16 | length () const |
KSocketAddress & | setLength (Q_UINT16 len) |
int | family () const |
virtual KSocketAddress & | setFamily (int family) |
int | ianaFamily () const |
bool | operator== (const KSocketAddress &other) const |
virtual QString | nodeName () const |
virtual QString | serviceName () const |
virtual QString | toString () const |
KInetSocketAddress & | asInet () |
KInetSocketAddress | asInet () const |
KUnixSocketAddress & | asUnix () |
KUnixSocketAddress | asUnix () const |
Static Public Member Functions | |
static int | ianaFamily (int af) |
static int | fromIanaFamily (int iana) |
Protected Member Functions | |
KSocketAddress (KSocketAddressData *d) | |
Protected Attributes | |
KSocketAddressData * | d |
Detailed Description
A generic socket address.This class holds one generic socket address.
- Author:
- Thiago Macieira <thiago.macieira@kdemail.net>
Definition at line 413 of file ksocketaddress.h.
Constructor & Destructor Documentation
|
Default constructor. Creates an empty object Definition at line 401 of file ksocketaddress.cpp. |
|
Creates this object with the given data. The raw socket address is copied into this object.
Definition at line 407 of file ksocketaddress.cpp. References setAddress(). |
|
Copy constructor. This creates a copy of the other object. Data is not shared.
Definition at line 413 of file ksocketaddress.cpp. |
|
Destructor. Frees any associated resources. Definition at line 424 of file ksocketaddress.cpp. References d. |
Member Function Documentation
|
Performs a shallow copy of the other object into this one. Data will be copied.
Definition at line 435 of file ksocketaddress.cpp. References d. Referenced by KNetwork::KUnixSocketAddress::operator=(), and KNetwork::KInetSocketAddress::operator=(). |
|
Returns the socket address structure, to be passed down to low level functions. Note that this function returns NULL for invalid or empty sockets, so you may use to to test for validity. Definition at line 444 of file ksocketaddress.cpp. References d. Referenced by KNetwork::KSocketDevice::disconnect(), KNetwork::KSocksSocketDevice::localAddress(), KNetwork::KSocketDevice::localAddress(), KNetwork::KSocksSocketDevice::peerAddress(), KNetwork::KSocketDevice::peerAddress(), KNetwork::KSocksSocketDevice::writeBlock(), and KNetwork::KSocketDevice::writeBlock(). |
|
Returns the socket address structure, to be passed down to low level functions. Note that this function returns NULL for invalid or empty sockets, so you may use to to test for validity. The returned value, if not NULL, is an internal buffer which is guaranteed to be at least length() bytes long. Definition at line 451 of file ksocketaddress.cpp. References d. |
|
Sets the address to the given address. The raw socket address is copied into this object.
Definition at line 458 of file ksocketaddress.cpp. References d. Referenced by KSocketAddress(). |
|
Returns the socket address structure, to be passed down to low level functions.
Definition at line 489 of file ksocketaddress.h. |
|
Returns the length of this socket address structure.
Definition at line 468 of file ksocketaddress.cpp. References d. Referenced by KNetwork::KSocketDevice::disconnect(), KNetwork::KSocksSocketDevice::localAddress(), KNetwork::KSocketDevice::localAddress(), KNetwork::KSocksSocketDevice::peerAddress(), KNetwork::KSocketDevice::peerAddress(), KNetwork::KSocksSocketDevice::writeBlock(), and KNetwork::KSocketDevice::writeBlock(). |
|
Sets the length of this socket structure. 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. 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:
KSocketAddress qsa; [...] qsa.setFamily(AF_UNSPEC).setLength(newlen);
Definition at line 475 of file ksocketaddress.cpp. References d. Referenced by KNetwork::KSocksSocketDevice::localAddress(), KNetwork::KSocketDevice::localAddress(), KNetwork::KSocksSocketDevice::peerAddress(), and KNetwork::KSocketDevice::peerAddress(). |
|
Returns the family of this address.
Definition at line 482 of file ksocketaddress.cpp. References d. |
|
Sets the family of this object. Note: setting the family will probably invalidate any address data contained in this object. Use this function with care.
Definition at line 489 of file ksocketaddress.cpp. References d. Referenced by KNetwork::KSocketDevice::disconnect(). |
|
Returns the IANA family number of this address.
Definition at line 540 of file ksocketaddress.h. |
|
Returns true if this equals the other socket. Socket addresses are considered matching if and only if all data is the same.
Definition at line 498 of file ksocketaddress.cpp. References d. |
|
Returns the node name of this socket. In the case of Internet sockets, this is string representation of the IP address. The default implementation returns QString::null.
Definition at line 555 of file ksocketaddress.cpp. References d, QString::number(), and QString::truncate(). Referenced by KNetwork::KHttpProxySocketDevice::connect(), and toString(). |
|
Returns the service name for this socket. In the case of Internet sockets, this is the port number. The default implementation returns QString::null.
Definition at line 581 of file ksocketaddress.cpp. References d, and QString::number(). Referenced by KNetwork::KHttpProxySocketDevice::connect(), and toString(). |
|
Returns this socket address as a string suitable for printing. Family, node and service are part of this address.
Definition at line 601 of file ksocketaddress.cpp. References QString::arg(), d, QString::fromLatin1(), nodeName(), serviceName(), and QObject::tr(). |
|
Returns an object reference that can be used to manipulate this socket as an Internet socket address. Both objects share the same data. Definition at line 622 of file ksocketaddress.cpp. References d. |
|
Returns an object is equal to this object's data, but they don't share it.
Definition at line 627 of file ksocketaddress.cpp. References d. |
|
Returns an object reference that can be used to manipulate this socket as a Unix socket address. Both objects share the same data. Definition at line 632 of file ksocketaddress.cpp. References d. |
|
Returns an object is equal to this object's data, but they don't share it.
Definition at line 637 of file ksocketaddress.cpp. References d. |
|
Returns the IANA family number of the given address family. Returns 0 if there is no corresponding IANA family number.
Definition at line 642 of file ksocketaddress.cpp. |
|
Returns the address family of the given IANA family number.
Definition at line 659 of file ksocketaddress.cpp. |
The documentation for this class was generated from the following files: