KInetSocketAddress Class Reference
An Inet (IPv4 or IPv6) socket address an Internet socket address. More...
#include <ksockaddr.h>
Inheritance diagram for KInetSocketAddress:

Public Methods | |
KInetSocketAddress () | |
Default constructor. | |
KInetSocketAddress (const KInetSocketAddress &) | |
Copy constructor. | |
KInetSocketAddress (const sockaddr_in *sin, ksocklen_t len) | |
Creates an IPv4 socket from raw sockaddr_in. | |
KInetSocketAddress (const sockaddr_in6 *sin6, ksocklen_t len) | |
Creates an IPv6 socket from raw sockaddr_in6. | |
KInetSocketAddress (const in_addr &addr, unsigned short port) | |
Creates a socket from information. | |
KInetSocketAddress (const in6_addr &addr, unsigned short port) | |
Creates a socket from information. | |
KInetSocketAddress (const QString &addr, unsigned short port, int family=-1) | |
Creates a socket from text representation. | |
virtual | ~KInetSocketAddress () |
Destructor. | |
bool | setAddress (const KInetSocketAddress &ksa) |
Sets this socket to given socket. | |
bool | setAddress (const sockaddr_in *sin, ksocklen_t len) |
Sets this socket to given raw socket. | |
bool | setAddress (const sockaddr_in6 *sin6, ksocklen_t len) |
Sets this socket to given raw socket. | |
bool | setAddress (const in_addr &addr, unsigned short port) |
Sets this socket to raw address and port. | |
bool | setAddress (const in6_addr &addr, unsigned short port) |
Sets this socket to raw address and port. | |
bool | setAddress (const QString &addr, unsigned short port, int family=-1) |
Sets this socket to text address and port. | |
bool | setHost (const in_addr &addr) |
Sets this socket's host address to given raw address. | |
bool | setHost (const in6_addr &addr) |
Sets this socket's host address to given raw address. | |
bool | setHost (const QString &addr, int family=-1) |
Sets this socket's host address to given text representation. | |
bool | setPort (unsigned short port) |
Sets this socket's port number to given port number. | |
bool | setFamily (int family) |
Turns this into an IPv4 or IPv6 address. | |
bool | setFlowinfo (Q_UINT32 flowinfo) |
Sets flowinfo information for this socket address if this is IPv6. | |
bool | setScopeId (int scopeid) |
Sets the scope id for this socket if this is IPv6. | |
virtual QString | pretty () const |
Returns a pretty representation of this address. | |
virtual QString | nodeName () const |
Returns the text representation of the host address. | |
virtual QString | serviceName () const |
Returns the text representation of the port number. | |
const sockaddr_in * | addressV4 () const |
Returns the socket address. | |
const sockaddr_in6 * | addressV6 () const |
Returns the socket address in IPv6. | |
in_addr | hostV4 () const |
Returns the host address. | |
in6_addr | hostV6 () const |
Returns the host address. | |
unsigned short | port () const |
Returns the port number. | |
Q_UINT32 | flowinfo () const |
Returns flowinfo for IPv6 socket. | |
int | scopeId () const |
Returns the scope id for this IPv6 socket. | |
virtual ksocklen_t | size () const |
Returns the socket length. | |
operator const sockaddr_in * () const | |
Returns the socket address. | |
operator const sockaddr_in6 * () const | |
Returns the socket address. | |
KInetSocketAddress & | operator= (const KInetSocketAddress &other) |
Sets this object to be the same as the other. | |
Static Public Methods | |
bool | areEqualInet (const KSocketAddress &s1, const KSocketAddress &s2, bool coreOnly) |
Compares two IPv4 addresses. | |
bool | areEqualInet6 (const KSocketAddress &s1, const KSocketAddress &s2, bool coreOnly) |
Compares two IPv6 addresses. | |
QString | addrToString (int family, const void *addr) |
Convert s the given raw address into text form. | |
bool | stringToAddr (int family, const char *text, void *dest) |
Converts the address given in text form into raw form. | |
Protected Methods | |
virtual void | virtual_hook (int id, void *data) |
Friends | |
class | KExtendedSocket |
Detailed Description
An Inet (IPv4 or IPv6) socket address an Internet socket address.This is an IPv4 or IPv6 address of the Internet
This class inherits most of the functionality from KSocketAddress, but is targeted specifically to Internet 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 236 of file ksockaddr.h.
Constructor & Destructor Documentation
|
Default constructor. Does nothing Definition at line 271 of file ksockaddr.cpp. |
|
Copy constructor.
Definition at line 276 of file ksockaddr.cpp. References setAddress(). |
|
Creates an IPv4 socket from raw sockaddr_in.
Definition at line 282 of file ksockaddr.cpp. References setAddress(). |
|
Creates an IPv6 socket from raw sockaddr_in6.
Definition at line 288 of file ksockaddr.cpp. References setAddress(). |
|
Creates a socket from information.
Definition at line 294 of file ksockaddr.cpp. References port(), and setAddress(). |
|
Creates a socket from information.
Definition at line 300 of file ksockaddr.cpp. References port(), and setAddress(). |
|
Creates a socket from text representation.
Definition at line 306 of file ksockaddr.cpp. References KSocketAddress::family(), port(), and setAddress(). |
|
Destructor.
Definition at line 312 of file ksockaddr.cpp. |
Member Function Documentation
|
Sets this socket to given socket.
Definition at line 319 of file ksockaddr.cpp. References addressV4(), addressV6(), KSocketAddress::family(), and size(). Referenced by KInetSocketAddress(), and operator=(). |
|
Sets this socket to given raw socket.
Definition at line 330 of file ksockaddr.cpp. |
|
Sets this socket to given raw socket. Note: this function does not clear the scope ID and flow info values
Definition at line 342 of file ksockaddr.cpp. |
|
Sets this socket to raw address and port.
Definition at line 370 of file ksockaddr.cpp. |
|
Sets this socket to raw address and port.
Definition at line 375 of file ksockaddr.cpp. |
|
Sets this socket to text address and port.
You can use the If the value is -1 (default), this function will make an effort to discover what is the family. That isn't too hard, actually, and it works in all cases. But, if you want to be sure that your socket is of the type you want, use this parameter. This function returns false if the socket address was not valid.
Definition at line 380 of file ksockaddr.cpp. References KSocketAddress::family(), port(), setHost(), and setPort(). |
|
Sets this socket's host address to given raw address.
Definition at line 385 of file ksockaddr.cpp. Referenced by setAddress(). |
|
Sets this socket's host address to given raw address.
Definition at line 393 of file ksockaddr.cpp. |
|
Sets this socket's host address to given text representation.
Definition at line 405 of file ksockaddr.cpp. References KSocketAddress::family(), QString::find(), and QString::latin1(). |
|
Sets this socket's port number to given port number.
Definition at line 454 of file ksockaddr.cpp. References port(). Referenced by setAddress(). |
|
Turns this into an IPv4 or IPv6 address.
Definition at line 465 of file ksockaddr.cpp. |
|
Sets flowinfo information for this socket address if this is IPv6.
Definition at line 488 of file ksockaddr.cpp. References flowinfo(). |
|
Sets the scope id for this socket if this is IPv6.
Definition at line 500 of file ksockaddr.cpp. |
|
Returns a pretty representation of this address.
Reimplemented from KSocketAddress. Definition at line 559 of file ksockaddr.cpp. References nodeName(), and serviceName(). |
|
Returns the text representation of the host address.
Reimplemented from KSocketAddress. Definition at line 574 of file ksockaddr.cpp. References QString::fromLatin1(). Referenced by pretty(). |
|
Returns the text representation of the port number.
Reimplemented from KSocketAddress. Definition at line 593 of file ksockaddr.cpp. References QString::number(), and port(). Referenced by pretty(). |
|
Returns the socket address. This will be NULL if this is a non-convertible v6. This function will return an IPv4 socket if this IPv6 socket is a v4-mapped address. That is, if it's really an IPv4 address, but in v6 disguise.
Definition at line 513 of file ksockaddr.cpp. Referenced by operator const sockaddr_in *(), and setAddress(). |
|
Returns the socket address in IPv6.
Definition at line 532 of file ksockaddr.cpp. Referenced by operator const sockaddr_in6 *(), and setAddress(). |
|
Returns the host address. Might be empty.
Definition at line 541 of file ksockaddr.cpp. |
|
Returns the host address. WARNING: this function is not defined if there is no IPv6 support
|
|
Returns the port number.
Definition at line 598 of file ksockaddr.cpp. Referenced by KInetSocketAddress(), serviceName(), setAddress(), and setPort(). |
|
Returns flowinfo for IPv6 socket.
Definition at line 608 of file ksockaddr.cpp. Referenced by setFlowinfo(). |
|
Returns the scope id for this IPv6 socket.
|
|
Returns the socket length. Will be either sizeof(sockaddr_in) or sizeof(sockaddr_in6)
Reimplemented from KSocketAddress. Definition at line 617 of file ksockaddr.cpp. Referenced by setAddress(). |
|
Compares two IPv4 addresses.
Definition at line 629 of file ksockaddr.cpp. References KSocketAddress::address(), KSocketAddress::family(), and KSocketAddress::size(). Referenced by KSocketAddress::isCoreEqual(), and KSocketAddress::isEqual(). |
|
Compares two IPv6 addresses.
Definition at line 646 of file ksockaddr.cpp. References KSocketAddress::address(), KSocketAddress::family(), and KSocketAddress::size(). Referenced by KSocketAddress::isCoreEqual(), and KSocketAddress::isEqual(). |
|
Returns the socket address. This will be NULL if this is a non-convertible v6.
Definition at line 517 of file ksockaddr.h. References addressV4(). |
|
Returns the socket address.
Definition at line 525 of file ksockaddr.h. References addressV6(). |
|
Sets this object to be the same as the other.
Definition at line 531 of file ksockaddr.h. References setAddress(). |
|
Convert s the given raw address into text form. This function returns QString::null if the address cannot be converted.
Definition at line 716 of file ksockaddr.cpp. References KSocketAddress::family(), and QString::fromLatin1(). |
|
Converts the address given in text form into raw form.
The size of the destination buffer
Definition at line 723 of file ksockaddr.cpp. References KSocketAddress::family(). |
The documentation for this class was generated from the following files: