Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

KSocketAddress Class Reference

a socket address. More...

#include <ksockaddr.h>

Inheritance diagram for KSocketAddress:

KInetSocketAddress KUnixSocketAddress List of all members.

Public Methods

virtual ~KSocketAddress ()
virtual QString pretty () const
const sockaddr * address () const
virtual ksocklen_t size () const
 operator const sockaddr * () const
int family () const
int ianaFamily () const
virtual bool isEqual (const KSocketAddress &other) const
bool operator== (const KSocketAddress &other) const
bool isCoreEqual (const KSocketAddress &other) const
bool isCoreEqual (const KSocketAddress *other) const
virtual QString nodeName () const
virtual QString serviceName () const

Static Public Methods

KSocketAddress * newAddress (const struct sockaddr *, ksocklen_t size)
int ianaFamily (int af)
int fromIanaFamily (int iana)

Protected Methods

 KSocketAddress ()
 KSocketAddress (const sockaddr *sa, ksocklen_t size)

Detailed Description

a socket address.

A socket address.

This class envelopes almost if not all socket addresses.

Author:
Thiago Macieira <thiagom@mail.com>
Version:
Id:
ksockaddr.h,v 1.15 2002/09/09 21:11:35 tjansen Exp

Definition at line 48 of file ksockaddr.h.


Constructor & Destructor Documentation

KSocketAddress::KSocketAddress   [inline, protected]
 

Creates an empty class

Definition at line 55 of file ksockaddr.h.

KSocketAddress::KSocketAddress const sockaddr *    sa,
ksocklen_t    size
[protected]
 

Creates with given data

Parameters:
sa  a sockaddr structure
size  the size of sa

virtual KSocketAddress::~KSocketAddress   [virtual]
 

Destructor.


Member Function Documentation

const sockaddr* KSocketAddress::address   const [inline]
 

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

Returns:
the sockaddr structure, can be 0

Reimplemented in KUnixSocketAddress.

Definition at line 80 of file ksockaddr.h.

int KSocketAddress::family  
 

Returns the family of this address.

Returns:
the family of this address, AF_UNSPEC if it's undefined

Referenced by ianaFamily().

int KSocketAddress::fromIanaFamily int    iana [static]
 

Returns the address family of the given IANA family number.

Returns:
the address family, AF_UNSPEC for unknown IANA family numbers

int KSocketAddress::ianaFamily int    af [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 KSocketAddress::ianaFamily   const [inline]
 

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)

Definition at line 109 of file ksockaddr.h.

References family().

bool KSocketAddress::isCoreEqual const KSocketAddress *    other const [inline]
 

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

Definition at line 150 of file ksockaddr.h.

References isCoreEqual().

bool KSocketAddress::isCoreEqual const KSocketAddress &    other 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

Referenced by isCoreEqual().

virtual bool KSocketAddress::isEqual const KSocketAddress &    other const [virtual]
 

Returns true if this equals the other socket.

Parameters:
other  the other socket
Returns:
true if both sockets are equal

Referenced by operator==().

KSocketAddress* KSocketAddress::newAddress const struct sockaddr *   ,
ksocklen_t    size
[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

virtual QString KSocketAddress::nodeName   [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

Reimplemented in KInetSocketAddress.

KSocketAddress::operator const sockaddr *   const [inline]
 

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

Returns:
the sockaddr structure, can be 0.
See also:
address()

Definition at line 95 of file ksockaddr.h.

bool KSocketAddress::operator== const KSocketAddress &    other const [inline]
 

Overloaded == operator.

See also:
isEqual()

Definition at line 125 of file ksockaddr.h.

References isEqual().

virtual QString KSocketAddress::pretty   [virtual]
 

Returns a string representation of this socket.

Returns:
a pretty string representation

Reimplemented in KInetSocketAddress, and KUnixSocketAddress.

virtual QString KSocketAddress::serviceName   [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

Reimplemented in KInetSocketAddress, and KUnixSocketAddress.

virtual ksocklen_t KSocketAddress::size   const [inline, virtual]
 

Returns sockaddr structure size.

Returns:
the size of the sockaddr structre, 0 if there is none.

Reimplemented in KInetSocketAddress.

Definition at line 87 of file ksockaddr.h.

Referenced by KAddressInfo::length().


The documentation for this class was generated from the following file:
Generated on Wed Aug 13 23:30:24 2003 for kdelibs by doxygen1.2.18