• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KDECore

KNetwork::KInetSocketAddress

KNetwork::KInetSocketAddress Class Reference

an Internet socket address More...

#include <ksocketaddress.h>

Inheritance diagram for KNetwork::KInetSocketAddress:

Inheritance graph
[legend]

List of all members.


Public Member Functions

Q_UINT32 flowinfo () const
KIpAddress ipAddress () const
int ipVersion () const
 KInetSocketAddress (const KSocketAddress &other)
 KInetSocketAddress (const KInetSocketAddress &other)
 KInetSocketAddress (const KIpAddress &host, Q_UINT16 port)
 KInetSocketAddress (const sockaddr *sa, Q_UINT16 len)
 KInetSocketAddress ()
KInetSocketAddress & makeIPv4 ()
KInetSocketAddress & makeIPv6 ()
 operator const sockaddr_in * () const
 operator const sockaddr_in6 * () const
KInetSocketAddress & operator= (const KInetSocketAddress &other)
Q_UINT16 port () const
int scopeId () const
KInetSocketAddress & setFlowinfo (Q_UINT32 flowinfo)
KInetSocketAddress & setHost (const KIpAddress &addr)
KInetSocketAddress & setPort (Q_UINT16 port)
KInetSocketAddress & setScopeId (int scopeid)
virtual ~KInetSocketAddress ()

Protected Member Functions

 KInetSocketAddress (KSocketAddressData *d)

Detailed Description

an Internet socket address

An Inet (IPv4 or IPv6) socket address

This is an IPv4 or IPv6 address of the Internet.

Author:
Thiago Macieira <thiago.macieira@kdemail.net>

Definition at line 651 of file ksocketaddress.h.


Constructor & Destructor Documentation

KInetSocketAddress::KInetSocketAddress (  ) 

Public constructor.

Creates an empty object.

Definition at line 685 of file ksocketaddress.cpp.

KInetSocketAddress::KInetSocketAddress ( const sockaddr *  sa,
Q_UINT16  len 
)

Creates an object from raw data.

Note: if the socket address sa does not contain a valid Internet socket (IPv4 or IPv6), this object will be empty.

Parameters:
sa the sockaddr structure
len the structure's length

Definition at line 690 of file ksocketaddress.cpp.

KInetSocketAddress::KInetSocketAddress ( const KIpAddress &  host,
Q_UINT16  port 
)

Creates an object from an IP address and port.

Parameters:
host the IP address
port the port number

Definition at line 698 of file ksocketaddress.cpp.

KInetSocketAddress::KInetSocketAddress ( const KInetSocketAddress &  other  ) 

Copy constructor.

Data is not shared.

Parameters:
other the other object

Definition at line 705 of file ksocketaddress.cpp.

KInetSocketAddress::KInetSocketAddress ( const KSocketAddress &  other  ) 

Copy constructor.

If the other, generic socket address contains an Internet address, it will be copied. Otherwise, this object will be empty.

Parameters:
other the other object

Definition at line 711 of file ksocketaddress.cpp.

KInetSocketAddress::~KInetSocketAddress (  )  [virtual]

Destroys this object.

Definition at line 725 of file ksocketaddress.cpp.

KInetSocketAddress::KInetSocketAddress ( KSocketAddressData *  d  )  [protected]

For internal use only.

extra constructor

Definition at line 719 of file ksocketaddress.cpp.


Member Function Documentation

Q_UINT32 KInetSocketAddress::flowinfo (  )  const

Returns the flowinfo information from the IPv6 socket address.

Returns:
the flowinfo information or 0 if this object is empty or IPv4

Definition at line 853 of file ksocketaddress.cpp.

KIpAddress KInetSocketAddress::ipAddress (  )  const

Returns the IP address component.

Definition at line 757 of file ksocketaddress.cpp.

int KInetSocketAddress::ipVersion (  )  const

Returns the IP version of the address this object holds.

Returns:
4 or 6, if IPv4 or IPv6, respectively; 0 if this object is empty

Definition at line 738 of file ksocketaddress.cpp.

KInetSocketAddress & KInetSocketAddress::makeIPv4 (  ) 

Converts this object to an IPv4 socket address.

It has no effect if the object is already an IPv4 socket address.

If this object is an IPv6 address, the port number is preserved. All other information is lost.

Returns:
a reference to itself

Definition at line 841 of file ksocketaddress.cpp.

KInetSocketAddress & KInetSocketAddress::makeIPv6 (  ) 

Converts this object to an IPv6 socket address.

It has no effect if the object is already an IPv6 socket address.

If this object is an IPv4 address, the port number is preserved.

Returns:
a reference to itself

Definition at line 847 of file ksocketaddress.cpp.

KNetwork::KInetSocketAddress::operator const sockaddr_in * (  )  const [inline]

Cast operator to sockaddr_in.

Definition at line 715 of file ksocketaddress.h.

KNetwork::KInetSocketAddress::operator const sockaddr_in6 * (  )  const [inline]

Cast operator to sockaddr_in6.

Definition at line 721 of file ksocketaddress.h.

KInetSocketAddress & KInetSocketAddress::operator= ( const KInetSocketAddress &  other  ) 

Copy operator.

Copies the other object into this one.

Parameters:
other the other object

Definition at line 731 of file ksocketaddress.cpp.

Q_UINT16 KInetSocketAddress::port (  )  const

Retrieves the port number stored in this object.

Returns:
a port number in the range 0 to 65535, inclusive. An empty or invalid object will have a port number of 0.

Definition at line 798 of file ksocketaddress.cpp.

int KInetSocketAddress::scopeId (  )  const

Returns the scope id this IPv6 socket is bound to.

Returns:
the scope id, or 0 if this is not an IPv6 object

Definition at line 872 of file ksocketaddress.cpp.

KInetSocketAddress & KInetSocketAddress::setFlowinfo ( Q_UINT32  flowinfo  ) 

Sets the flowinfo information for an IPv6 socket address.

If this is not an IPv6 socket address, this function converts it to one. See makeIPv6.

Parameters:
flowinfo the flowinfo to set
Returns:
a reference to itself

Definition at line 865 of file ksocketaddress.cpp.

KInetSocketAddress & KInetSocketAddress::setHost ( const KIpAddress &  addr  ) 

Sets the IP address to the given raw address.

This call will preserve port numbers accross IP versions, but will lose IPv6 specific data if the address is set to IPv4.

Parameters:
addr the address to set to
Returns:
a reference to itself

Definition at line 775 of file ksocketaddress.cpp.

KInetSocketAddress & KInetSocketAddress::setPort ( Q_UINT16  port  ) 

Sets the port number.

If this object is empty, this function will default to creating an IPv4 address.

Parameters:
port the port number to set
Returns:
a reference to itself

Definition at line 817 of file ksocketaddress.cpp.

KInetSocketAddress & KInetSocketAddress::setScopeId ( int  scopeid  ) 

Sets the scope id for this IPv6 object.

If this is not an IPv6 socket address, this function converts it to one. See makeIPv6

Parameters:
scopeid the scopeid to set
Returns:
a reference to itself

Definition at line 884 of file ksocketaddress.cpp.


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

KDECore

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal