|
|
A socket address.
This class envelopes almost if not all socket addresses.
KSocketAddress ()
| KSocketAddress |
[protected]
Creates an empty class
KSocketAddress (const sockaddr* sa, ksocklen_t size)
| KSocketAddress |
[protected]
Creates with given data
Parameters:
sa | a sockaddr structure |
size | the size of sa
|
~KSocketAddress ()
| ~KSocketAddress |
[virtual]
Destructor.
QString pretty ()
| pretty |
[const virtual]
Returns a string representation of this socket.
Returns: a pretty string representation
const sockaddr* address ()
| address |
[const]
Returns a sockaddr structure, for passing down to library functions.
Returns: the sockaddr structure, can be 0
ksocklen_t size ()
| size |
[const virtual]
Returns sockaddr structure size.
Returns: the size of the sockaddr structre, 0 if there is none.
operator const sockaddr* ()
| operator const sockaddr* |
[const]
Returns a sockaddr structure, for passing down to library functions.
Returns: the sockaddr structure, can be 0.
See also: address()
int family ()
| family |
[const]
Returns the family of this address.
Returns: the family of this address, AF_UNSPEC if it's undefined
inline int ianaFamily ()
| ianaFamily |
[const]
Returns the IANA family number of this address.
Returns: the IANA family number of this address (1 for AF_INET. 2 for AF_INET6, otherwise 0)
bool isEqual (const KSocketAddress& other)
| isEqual |
[const virtual]
Returns true if this equals the other socket.
Parameters:
other | the other socket |
Returns: true if both sockets are equal
bool isEqual (const KSocketAddress* other)
| isEqual |
[const]
bool operator== (const KSocketAddress& other)
| operator== |
[const]
Overloaded == operator.
See also: isEqual()
bool isCoreEqual (const KSocketAddress& other)
| isCoreEqual |
[const]
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 isEqual.
Parameters:
other | the other socket |
Returns: true if the code part is equal
bool isCoreEqual (const KSocketAddress* other)
| isCoreEqual |
[const]
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 isEqual.
Parameters:
other | the other socket |
Returns: true if the code part is equal
QString nodeName ()
| nodeName |
[const virtual]
Returns the node name of this socket, as KExtendedSocket::lookup expects as the first argument. In the case of Internet sockets, this is the hostname. The default implementation returns QString::null.
Returns: the node name, can be QString::null
QString serviceName ()
| serviceName |
[const virtual]
Returns the service name for this socket, as KExtendedSocket::lookup expects as the service argument. In the case of Internet sockets, this is the port number. The default implementation returns QString::null.
Returns: the service name, can be QString::null
sockaddr* data | data |
[protected]
ksocklen_t datasize | datasize |
[protected]
bool owndata | owndata |
[protected]
KSocketAddress* newAddress (const struct sockaddr*, ksocklen_t size)
| newAddress |
[static]
Creates a new KSocketAddress or descendant class from given raw socket address.
Parameters:
sa | new socket address |
size | new socket address's length |
Returns: the new KSocketAddress, or 0 if the function failed
int ianaFamily (int af)
| ianaFamily |
[static]
Returns the IANA family number of the given address family. Returns 0 if there is no corresponding IANA family number.
Parameters:
af | the address family, in AF_* constants |
Returns: the IANA family number of this address (1 for AF_INET. 2 for AF_INET6, otherwise 0)
int fromIanaFamily (int iana)
| fromIanaFamily |
[static]
Returns the address family of the given IANA family number.
Returns: the address family, AF_UNSPEC for unknown IANA family numbers
friend class KExtendedSocket | KExtendedSocket |
void virtual_hook ( int id, void* data )
| virtual_hook |
[protected virtual]