• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • KNetwork
  • KInetSocketAddress
Public Member Functions | Protected Member Functions | List of all members
KNetwork::KInetSocketAddress Class Reference

#include <k3socketaddress.h>

Inheritance diagram for KNetwork::KInetSocketAddress:
Inheritance graph
[legend]

Public Member Functions

 KInetSocketAddress ()
 
 KInetSocketAddress (const sockaddr *sa, quint16 len)
 
 KInetSocketAddress (const KIpAddress &host, quint16 port)
 
 KInetSocketAddress (const KInetSocketAddress &other)
 
 KInetSocketAddress (const KSocketAddress &other)
 
virtual ~KInetSocketAddress ()
 
quint32 flowinfo () const
 
KIpAddress ipAddress () const
 
int ipVersion () const
 
KInetSocketAddress & makeIPv4 ()
 
KInetSocketAddress & makeIPv6 ()
 
 operator const sockaddr_in * () const
 
 operator const sockaddr_in6 * () const
 
KInetSocketAddress & operator= (const KInetSocketAddress &other)
 
quint16 port () const
 
int scopeId () const
 
KInetSocketAddress & setFlowinfo (quint32 flowinfo)
 
KInetSocketAddress & setHost (const KIpAddress &addr)
 
KInetSocketAddress & setPort (quint16 port)
 
KInetSocketAddress & setScopeId (int scopeid)
 
- Public Member Functions inherited from KNetwork::KSocketAddress
 KSocketAddress ()
 
 KSocketAddress (const sockaddr *sa, quint16 len)
 
 KSocketAddress (const KSocketAddress &other)
 
virtual ~KSocketAddress ()
 
const sockaddr * address () const
 
sockaddr * address ()
 
KInetSocketAddress & asInet ()
 
KInetSocketAddress asInet () const
 
KUnixSocketAddress & asUnix ()
 
KUnixSocketAddress asUnix () const
 
int family () const
 
int ianaFamily () const
 
quint16 length () const
 
virtual QString nodeName () const
 
 operator const sockaddr * () const
 
KSocketAddress & operator= (const KSocketAddress &other)
 
bool operator== (const KSocketAddress &other) const
 
virtual QString serviceName () const
 
KSocketAddress & setAddress (const sockaddr *sa, quint16 len)
 
virtual KSocketAddress & setFamily (int family)
 
KSocketAddress & setLength (quint16 len)
 
virtual QString toString () const
 

Protected Member Functions

 KInetSocketAddress (KSocketAddressData *d)
 
- Protected Member Functions inherited from KNetwork::KSocketAddress
 KSocketAddress (KSocketAddressData *d)
 

Additional Inherited Members

- Static Public Member Functions inherited from KNetwork::KSocketAddress
static int fromIanaFamily (int iana)
 
static int ianaFamily (int af)
 
- Protected Attributes inherited from KNetwork::KSocketAddress
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 thiag.nosp@m.o@kd.nosp@m.e.org
Deprecated:
Use KSocketFactory or KLocalSocket instead

Definition at line 643 of file k3socketaddress.h.

Constructor & Destructor Documentation

KInetSocketAddress::KInetSocketAddress ( )

Public constructor.

Creates an empty object.

Definition at line 683 of file k3socketaddress.cpp.

KInetSocketAddress::KInetSocketAddress ( const sockaddr *  sa,
quint16  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
sathe sockaddr structure
lenthe structure's length

Definition at line 688 of file k3socketaddress.cpp.

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

Creates an object from an IP address and port.

Parameters
hostthe IP address
portthe port number

Definition at line 696 of file k3socketaddress.cpp.

KInetSocketAddress::KInetSocketAddress ( const KInetSocketAddress &  other)

Copy constructor.

Data is not shared.

Parameters
otherthe other object

Definition at line 703 of file k3socketaddress.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
otherthe other object

Definition at line 709 of file k3socketaddress.cpp.

KInetSocketAddress::~KInetSocketAddress ( )
virtual

Destroys this object.

Definition at line 723 of file k3socketaddress.cpp.

KInetSocketAddress::KInetSocketAddress ( KSocketAddressData *  d)
protected

extra constructor

Definition at line 717 of file k3socketaddress.cpp.

Member Function Documentation

quint32 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 851 of file k3socketaddress.cpp.

KIpAddress KInetSocketAddress::ipAddress ( ) const

Returns the IP address component.

Definition at line 755 of file k3socketaddress.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 736 of file k3socketaddress.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 839 of file k3socketaddress.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 845 of file k3socketaddress.cpp.

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

Cast operator to sockaddr_in.

Definition at line 707 of file k3socketaddress.h.

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

Cast operator to sockaddr_in6.

Definition at line 713 of file k3socketaddress.h.

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

Copy operator.

Copies the other object into this one.

Parameters
otherthe other object

Definition at line 729 of file k3socketaddress.cpp.

quint16 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 796 of file k3socketaddress.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 870 of file k3socketaddress.cpp.

KInetSocketAddress & KInetSocketAddress::setFlowinfo ( quint32  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
flowinfothe flowinfo to set
Returns
a reference to itself

Definition at line 863 of file k3socketaddress.cpp.

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

Sets the IP address to the given raw address.

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

Parameters
addrthe address to set to
Returns
a reference to itself

Definition at line 773 of file k3socketaddress.cpp.

KInetSocketAddress & KInetSocketAddress::setPort ( quint16  port)

Sets the port number.

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

Parameters
portthe port number to set
Returns
a reference to itself

Definition at line 815 of file k3socketaddress.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
scopeidthe scopeid to set
Returns
a reference to itself

Definition at line 882 of file k3socketaddress.cpp.


The documentation for this class was generated from the following files:
  • k3socketaddress.h
  • k3socketaddress.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:14 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal