• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
TDESocketAddress Class Reference

#include <ksockaddr.h>

Inheritance diagram for TDESocketAddress:
KInetSocketAddress KUnixSocketAddress

Public Member Functions

virtual ~TDESocketAddress ()
 
virtual TQString 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 TDESocketAddress &other) const
 
bool isEqual (const TDESocketAddress *other) const
 
bool operator== (const TDESocketAddress &other) const
 
bool isCoreEqual (const TDESocketAddress &other) const
 
bool isCoreEqual (const TDESocketAddress *other) const
 
virtual TQString nodeName () const
 
virtual TQString serviceName () const
 

Static Public Member Functions

static TDESocketAddress * newAddress (const struct sockaddr *sa, ksocklen_t size)
 
static int ianaFamily (int af)
 
static int fromIanaFamily (int iana)
 

Protected Member Functions

 TDESocketAddress ()
 
 TDESocketAddress (const sockaddr *sa, ksocklen_t size)
 
virtual void virtual_hook (int id, void *data)
 

Protected Attributes

sockaddr * data
 
ksocklen_t datasize
 
bool owndata
 

Friends

class KExtendedSocket
 

Detailed Description

A socket address.

This class envelopes almost if not all socket addresses.

Author
Thiago Macieira thiag.nosp@m.o.ma.nosp@m.cieir.nosp@m.a@kd.nosp@m.email.nosp@m..net

a socket address.

Definition at line 46 of file ksockaddr.h.

Constructor & Destructor Documentation

◆ TDESocketAddress() [1/2]

TDESocketAddress::TDESocketAddress ( )
inlineprotected

Creates an empty class.

Definition at line 53 of file ksockaddr.h.

◆ TDESocketAddress() [2/2]

TDESocketAddress::TDESocketAddress ( const sockaddr *  sa,
ksocklen_t  size 
)
protected

Creates with given data.

Class TDESocketAddress.

Parameters
saa sockaddr structure
sizethe size of sa

Definition at line 83 of file ksockaddr.cpp.

◆ ~TDESocketAddress()

TDESocketAddress::~TDESocketAddress ( )
virtual

Destructor.

Definition at line 104 of file ksockaddr.cpp.

Member Function Documentation

◆ address()

const sockaddr * TDESocketAddress::address ( ) const
inline

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

Returns
the sockaddr structure, can be 0

Definition at line 78 of file ksockaddr.h.

◆ family()

int TDESocketAddress::family ( ) const

Returns the family of this address.

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

Definition at line 115 of file ksockaddr.cpp.

◆ fromIanaFamily()

int TDESocketAddress::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

Definition at line 221 of file ksockaddr.cpp.

◆ ianaFamily() [1/2]

int TDESocketAddress::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 107 of file ksockaddr.h.

◆ ianaFamily() [2/2]

int TDESocketAddress::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
afthe address family, in AF_* constants
Returns
the IANA family number of this address (1 for AF_INET. 2 for AF_INET6, otherwise 0)

Definition at line 206 of file ksockaddr.cpp.

◆ isCoreEqual() [1/2]

bool TDESocketAddress::isCoreEqual ( const TDESocketAddress &  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
otherthe other socket
Returns
true if the code part is equal

Definition at line 179 of file ksockaddr.cpp.

◆ isCoreEqual() [2/2]

bool TDESocketAddress::isCoreEqual ( const TDESocketAddress *  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
otherthe other socket
Returns
true if the code part is equal

Definition at line 148 of file ksockaddr.h.

◆ isEqual() [1/2]

bool TDESocketAddress::isEqual ( const TDESocketAddress &  other) const
virtual

Returns true if this equals the other socket.

Parameters
otherthe other socket
Returns
true if both sockets are equal

Definition at line 159 of file ksockaddr.cpp.

◆ isEqual() [2/2]

bool TDESocketAddress::isEqual ( const TDESocketAddress *  other) const
inline

Definition at line 116 of file ksockaddr.h.

◆ newAddress()

TDESocketAddress * TDESocketAddress::newAddress ( const struct sockaddr *  sa,
ksocklen_t  size 
)
static

Creates a new TDESocketAddress or descendant class from given raw socket address.

Parameters
sanew socket address
sizenew socket address's length
Returns
the new TDESocketAddress, or 0 if the function failed

Definition at line 123 of file ksockaddr.cpp.

◆ nodeName()

TQString TDESocketAddress::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 TQString::null.

Returns
the node name, can be TQString::null

Reimplemented in KInetSocketAddress.

Definition at line 196 of file ksockaddr.cpp.

◆ operator const sockaddr *()

TDESocketAddress::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 93 of file ksockaddr.h.

◆ operator==()

bool TDESocketAddress::operator== ( const TDESocketAddress &  other) const
inline

Overloaded == operator.

See also
isEqual()

Definition at line 123 of file ksockaddr.h.

◆ pretty()

TQString TDESocketAddress::pretty ( ) const
virtual

Returns a string representation of this socket.

Returns
a pretty string representation

Reimplemented in KInetSocketAddress, and KUnixSocketAddress.

Definition at line 110 of file ksockaddr.cpp.

◆ serviceName()

TQString TDESocketAddress::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 TQString::null.

Returns
the service name, can be TQString::null

Reimplemented in KInetSocketAddress, and KUnixSocketAddress.

Definition at line 201 of file ksockaddr.cpp.

◆ size()

virtual ksocklen_t TDESocketAddress::size ( ) const
inlinevirtual

Returns sockaddr structure size.

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

Reimplemented in KInetSocketAddress.

Definition at line 85 of file ksockaddr.h.

◆ virtual_hook()

void TDESocketAddress::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 884 of file ksockaddr.cpp.

Friends And Related Function Documentation

◆ KExtendedSocket

friend class KExtendedSocket
friend

Definition at line 205 of file ksockaddr.h.

Member Data Documentation

◆ data

sockaddr* TDESocketAddress::data
protected

Definition at line 170 of file ksockaddr.h.

◆ datasize

ksocklen_t TDESocketAddress::datasize
protected

Definition at line 171 of file ksockaddr.h.

◆ owndata

bool TDESocketAddress::owndata
protected

Definition at line 172 of file ksockaddr.h.


The documentation for this class was generated from the following files:
  • ksockaddr.h
  • ksockaddr.cpp

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.