.TH "KNetwork::KIpAddress" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KNetwork::KIpAddress \- An IP address.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <ksocketaddress.h>\fP
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKIpAddress\fP ()"
.br
.ti -1c
.RI "\fBKIpAddress\fP (const \fBKIpAddress\fP &other)"
.br
.ti -1c
.RI "\fBKIpAddress\fP (const \fBQString\fP &addr)"
.br
.ti -1c
.RI "\fBKIpAddress\fP (const char *addr)"
.br
.ti -1c
.RI "\fBKIpAddress\fP (const void *addr, int version=4)"
.br
.ti -1c
.RI "\fBKIpAddress\fP (Q_UINT32 ip4addr)"
.br
.ti -1c
.RI "\fB~KIpAddress\fP ()"
.br
.ti -1c
.RI "\fBKIpAddress\fP & \fBoperator=\fP (const \fBKIpAddress\fP &other)"
.br
.ti -1c
.RI "bool \fBoperator==\fP (const \fBKIpAddress\fP &other) const "
.br
.ti -1c
.RI "bool \fBcompare\fP (const \fBKIpAddress\fP &other, bool checkMapped=true) const "
.br
.ti -1c
.RI "int \fBversion\fP () const "
.br
.ti -1c
.RI "bool \fBisIPv4Addr\fP () const "
.br
.ti -1c
.RI "bool \fBisIPv6Addr\fP () const "
.br
.ti -1c
.RI "bool \fBsetAddress\fP (const \fBQString\fP &address)"
.br
.ti -1c
.RI "bool \fBsetAddress\fP (const char *address)"
.br
.ti -1c
.RI "bool \fBsetAddress\fP (const void *raw, int version=4)"
.br
.ti -1c
.RI "\fBQString\fP \fBtoString\fP () const "
.br
.ti -1c
.RI "const void * \fBaddr\fP () const "
.br
.ti -1c
.RI "Q_UINT32 \fBIPv4Addr\fP (bool convertMapped=true) const "
.br
.ti -1c
.RI "bool \fBisUnspecified\fP () const "
.br
.ti -1c
.RI "bool \fBisLocalhost\fP () const "
.br
.ti -1c
.RI "bool \fBisLoopback\fP () const "
.br
.ti -1c
.RI "bool \fBisClassA\fP () const "
.br
.ti -1c
.RI "bool \fBisClassB\fP () const "
.br
.ti -1c
.RI "bool \fBisClassC\fP () const "
.br
.ti -1c
.RI "bool \fBisClassD\fP () const "
.br
.ti -1c
.RI "bool \fBisMulticast\fP () const "
.br
.ti -1c
.RI "bool \fBisLinkLocal\fP () const "
.br
.ti -1c
.RI "bool \fBisSiteLocal\fP () const "
.br
.ti -1c
.RI "bool \fBisGlobal\fP () const "
.br
.ti -1c
.RI "bool \fBisV4Mapped\fP () const "
.br
.ti -1c
.RI "bool \fBisV4Compat\fP () const "
.br
.ti -1c
.RI "bool \fBisMulticastNodeLocal\fP () const "
.br
.ti -1c
.RI "bool \fBisMulticastLinkLocal\fP () const "
.br
.ti -1c
.RI "bool \fBisMulticastSiteLocal\fP () const "
.br
.ti -1c
.RI "bool \fBisMulticastOrgLocal\fP () const "
.br
.ti -1c
.RI "bool \fBisMulticastGlobal\fP () const "
.br
.in -1c
.SS "Static Public Attributes"

.in +1c
.ti -1c
.RI "static const \fBKIpAddress\fP \fBlocalhostV4\fP"
.br
.ti -1c
.RI "static const \fBKIpAddress\fP \fBanyhostV4\fP"
.br
.ti -1c
.RI "static const \fBKIpAddress\fP \fBlocalhostV6\fP"
.br
.ti -1c
.RI "static const \fBKIpAddress\fP \fBanyhostV6\fP"
.br
.in -1c
.SS "Protected Attributes"

.in +1c
.ti -1c
.RI "Q_UINT32 \fBm_data\fP [4]"
.br
.ti -1c
.RI "char \fBm_version\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
An IP address. 

This class represents one IP address, version 4 or 6. This is only the address, not including port information or other data.
.PP
It is not a good programming practice to create address from objects like this. Instead, prefer a more thorough function like \fBKResolver::resolve\fP, which also handle extra information like scope ids.
.PP
This is a light-weight class. Most of the member functions are inlined and there are no virtual functions. This object's size should be less than 20 bytes. Also note that there is no sharing of data.
.PP
\fBAuthor:\fP
.RS 4
Thiago Macieira <thiago.macieira@kdemail.net> 
.RE
.PP

.PP
Definition at line 62 of file ksocketaddress.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KNetwork::KIpAddress::KIpAddress ()\fC [inline]\fP"
.PP
Default constructor. 
.PP
Creates an empty address. It defaults to IP version 4. 
.PP
Definition at line 69 of file ksocketaddress.h.
.SS "KNetwork::KIpAddress::KIpAddress (const \fBKIpAddress\fP & other)\fC [inline]\fP"
.PP
Copy constructor. 
.PP
Copies the data from the other object.
.PP
Data is not shared.
.PP
\fBParameters:\fP
.RS 4
\fIother\fP the other 
.RE
.PP

.PP
Definition at line 80 of file ksocketaddress.h.
.SS "KNetwork::KIpAddress::KIpAddress (const \fBQString\fP & addr)\fC [inline]\fP"
.PP
Creates an object from the given string representation. 
.PP
The IP version is guessed from the address format.
.PP
\fBParameters:\fP
.RS 4
\fIaddr\fP the address 
.RE
.PP

.PP
Definition at line 90 of file ksocketaddress.h.
.SS "KNetwork::KIpAddress::KIpAddress (const char * addr)\fC [inline]\fP"
.PP
Creates an object from the given string representation. 
.PP
The IP version is guessed from the address format.
.PP
\fBParameters:\fP
.RS 4
\fIaddr\fP the address 
.RE
.PP

.PP
Definition at line 100 of file ksocketaddress.h.
.SS "KNetwork::KIpAddress::KIpAddress (const void * addr, int version = \fC4\fP)\fC [inline]\fP"
.PP
Creates an object from the given raw data and IP version. 
.PP
\fBParameters:\fP
.RS 4
\fIaddr\fP the raw data 
.br
\fIversion\fP the IP version (4 or 6) 
.RE
.PP

.PP
Definition at line 109 of file ksocketaddress.h.
.SS "KNetwork::KIpAddress::KIpAddress (Q_UINT32 ip4addr)\fC [inline]\fP"
.PP
This is a convenience constructor. 
.PP
Constructs an object from the given IPv4 address in the form of an integer.
.PP
Note: do not write code to depend on IPv4 addresses being integer types. Instead, treat them as a special type, like a \fBKIpAddress\fP or the system's in_addr.
.PP
\fBParameters:\fP
.RS 4
\fIip4addr\fP the IPv4 address 
.RE
.PP

.PP
Definition at line 122 of file ksocketaddress.h.
.SS "KNetwork::KIpAddress::~\fBKIpAddress\fP ()\fC [inline]\fP"
.PP
Destructor. 
.PP
This frees resources associated with this object.
.PP
Note: destructor is non-virtual. The compiler will happily optimise it out of the way. 
.PP
Definition at line 131 of file ksocketaddress.h.
.SH "Member Function Documentation"
.PP 
.SS "\fBKIpAddress\fP & KIpAddress::operator= (const \fBKIpAddress\fP & other)"
.PP
Copy operator. 
.PP
Copies the data from the other object into this one.
.PP
\fBParameters:\fP
.RS 4
\fIother\fP the object to copy 
.RE
.PP

.PP
Definition at line 86 of file ksocketaddress.cpp.
.SS "bool KNetwork::KIpAddress::operator== (const \fBKIpAddress\fP & other) const\fC [inline]\fP"
.PP
Returns true if the two addresses match. 
.PP
This function performs a v4-mapped check. 
.PP
\fBSee also:\fP
.RS 4
\fBcompare\fP 
.RE
.PP

.PP
Definition at line 148 of file ksocketaddress.h.
.SS "bool KIpAddress::compare (const \fBKIpAddress\fP & other, bool checkMapped = \fCtrue\fP) const"
.PP
Compares this address against the other, supplied one and return true if they match. 
.PP
The \fCcheckMapped\fP parameter controls whether a check for an IPv6 v4-mapped address will be performed.
.PP
An IPv6 v4-mapped address is an IPv6 address that is, for all purposes, equivalent to an IPv4 one. The default behaviour of this function is to take that into account. If you want a strict matching, pass \fBfalse\fP to the \fCcheckMapped\fP parameter.
.PP
\fBParameters:\fP
.RS 4
\fIother\fP the other IP address 
.br
\fIcheckMapped\fP whether v4-mapped addresses will be taken into account 
.RE
.PP

.PP
Definition at line 95 of file ksocketaddress.cpp.
.SS "int KNetwork::KIpAddress::version () const\fC [inline]\fP"
.PP
Retrieves the IP version in this object. 
.PP
\fBReturns:\fP
.RS 4
the version: 4 or 6 
.RE
.PP

.PP
Definition at line 171 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isIPv4Addr () const\fC [inline]\fP"
.PP
Returns true if this is an IPv4 address. 
.PP
Definition at line 177 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isIPv6Addr () const\fC [inline]\fP"
.PP
Returns true if this is an IPv6 address. 
.PP
Definition at line 183 of file ksocketaddress.h.
.SS "bool KIpAddress::setAddress (const \fBQString\fP & address)"
.PP
Sets the address to the given string representation. 
.PP
\fBReturns:\fP
.RS 4
true if the address was successfully parsed; otherwise returns false and leaves the object unchanged. 
.RE
.PP

.PP
Definition at line 128 of file ksocketaddress.cpp.
.PP
Referenced by setAddress().
.SS "bool KIpAddress::setAddress (const char * address)"
.PP
Sets the address to the given string representation. 
.PP
\fBReturns:\fP
.RS 4
true if the address was successfully parsed; otherwise returns false and leaves the object unchanged. 
.RE
.PP

.PP
Definition at line 165 of file ksocketaddress.cpp.
.PP
References setAddress().
.SS "bool KIpAddress::setAddress (const void * raw, int version = \fC4\fP)"
.PP
Sets the address to the given raw binary representation. 
.PP
\fBParameters:\fP
.RS 4
\fIraw\fP a pointer to the raw binary data 
.br
\fIversion\fP the IP version 
.RE
.PP
\fBReturns:\fP
.RS 4
true if the address was successfully parsed; otherwise returns false and leaves the object unchanged. 
.RE
.PP

.PP
Definition at line 171 of file ksocketaddress.cpp.
.SS "\fBQString\fP KIpAddress::toString () const"
.PP
Returns the address as a string. 
.PP
Definition at line 188 of file ksocketaddress.cpp.
.PP
References QString::fromLatin1().
.SS "const void* KNetwork::KIpAddress::addr () const\fC [inline]\fP"
.PP
Returns a pointer to binary raw data representing the address. 
.PP
Definition at line 220 of file ksocketaddress.h.
.SS "Q_UINT32 KNetwork::KIpAddress::IPv4Addr (bool convertMapped = \fCtrue\fP) const\fC [inline]\fP"
.PP
This is a convenience function. 
.PP
Returns the IPv4 address in a 32-bit integer. The result is only valid if \fBisIPv4Addr\fP returns true. Alternatively, if the contained IPv6 address is a v4-mapped one and the \fCconvertMapped\fP parameter is true, the result will also be valid.
.PP
Note: you should not treat IP addresses as integers. Instead, use types defined for that purpose, such as \fBKIpAddress\fP or the system's in_addr type.
.PP
\fBBug\fP
.RS 4
Check if byte ordering is done right 
.RE
.PP

.PP
Definition at line 236 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isUnspecified () const\fC [inline]\fP"
.PP
Returns true if this is the IPv4 or IPv6 unspecified address. 
.PP
Definition at line 246 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isLocalhost () const\fC [inline]\fP"
.PP
Returns true if this is either the IPv4 or the IPv6 localhost address. 
.PP
Definition at line 252 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isLoopback () const\fC [inline]\fP"
.PP
This is an alias for \fBisLocalhost\fP. 
.PP
Definition at line 258 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isClassA () const\fC [inline]\fP"
.PP
Returns true if this is an IPv4 class A address, i.e., from 0.0.0.0 to 127.255.255.255. 
.PP
This function does not test for v4-mapped addresses. 
.PP
Definition at line 267 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isClassB () const\fC [inline]\fP"
.PP
Returns true if this is an IPv4 class B address, i.e., one from 128.0.0.0 to 191.255.255.255. 
.PP
This function does not test for v4-mapped addresses. 
.PP
Definition at line 276 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isClassC () const\fC [inline]\fP"
.PP
Returns true if this is an IPv4 class C address, i.e., one from 192.0.0.0 to 223.255.255.255. 
.PP
This function does not test for v4-mapped addresses. 
.PP
Definition at line 285 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isClassD () const\fC [inline]\fP"
.PP
Returns true if this is an IPv4 class D (a.k.a. 
.PP
multicast) address.
.PP
Note: this function is not the same as \fBisMulticast\fP. isMulticast also tests for IPv6 multicast addresses. 
.PP
Definition at line 294 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isMulticast () const\fC [inline]\fP"
.PP
Returns true if this is a multicast address, be it IPv4 or IPv6. 
.PP
Definition at line 300 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isLinkLocal () const\fC [inline]\fP"
.PP
Returns true if this is an IPv6 link-local address. 
.PP
Definition at line 310 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isSiteLocal () const\fC [inline]\fP"
.PP
Returns true if this is an IPv6 site-local address. 
.PP
Definition at line 321 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isGlobal () const\fC [inline]\fP"
.PP
Returns true if this is a global IPv6 address. 
.PP
Definition at line 332 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isV4Mapped () const\fC [inline]\fP"
.PP
Returns true if this is a v4-mapped IPv6 address. 
.PP
Definition at line 338 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isV4Compat () const\fC [inline]\fP"
.PP
Returns true if this is a v4-compat IPv6 address. 
.PP
Definition at line 350 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isMulticastNodeLocal () const\fC [inline]\fP"
.PP
Returns true if this is an IPv6 node-local multicast address. 
.PP
Definition at line 360 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isMulticastLinkLocal () const\fC [inline]\fP"
.PP
Returns true if this is an IPv6 link-local multicast address. 
.PP
Definition at line 366 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isMulticastSiteLocal () const\fC [inline]\fP"
.PP
Returns true if this is an IPv6 site-local multicast address. 
.PP
Definition at line 372 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isMulticastOrgLocal () const\fC [inline]\fP"
.PP
Returns true if this is an IPv6 organisational-local multicast address. 
.PP
Definition at line 378 of file ksocketaddress.h.
.SS "bool KNetwork::KIpAddress::isMulticastGlobal () const\fC [inline]\fP"
.PP
Returns true if this is an IPv6 global multicast address. 
.PP
Definition at line 384 of file ksocketaddress.h.
.SH "Member Data Documentation"
.PP 
.SS "const \fBKIpAddress\fP \fBKIpAddress::localhostV4\fP\fC [static]\fP"
.PP
localhost in IPv4 (127.0.0.1) 
.PP
.SS "const \fBKIpAddress\fP \fBKIpAddress::anyhostV4\fP\fC [static]\fP"
.PP
the any host or undefined address in IPv4 (0.0.0.0) 
.PP
.SS "const \fBKIpAddress\fP \fBKIpAddress::localhostV6\fP\fC [static]\fP"
.PP
localhost in IPv6 (::1) 
.PP
.SS "const \fBKIpAddress\fP \fBKIpAddress::anyhostV6\fP\fC [static]\fP"
.PP
the any host or undefined address in IPv6 (::) 
.PP


.SH "Author"
.PP 
Generated automatically by Doxygen for kdecore Library from the source code.
