.TH "KNetwork::KResolver" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KNetwork::KResolver \- Name and service resolution class.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kresolver.h>\fP
.PP
Inherits \fBQObject\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBSocketFamilies\fP { \fBUnknownFamily\fP =  0x0001, \fBUnixFamily\fP =  0x0002, \fBLocalFamily\fP =  UnixFamily, \fBIPv4Family\fP =  0x0004, \fBIPv6Family\fP =  0x0008, \fBInternetFamily\fP =  IPv4Family | IPv6Family, \fBInetFamily\fP =  InternetFamily, \fBKnownFamily\fP =  ~UnknownFamily, \fBAnyFamily\fP =  KnownFamily | UnknownFamily }"
.br
.ti -1c
.RI "enum \fBFlags\fP { \fBPassive\fP =  0x01, \fBCanonName\fP =  0x02, \fBNoResolve\fP =  0x04, \fBNoSrv\fP =  0x08, \fBMultiport\fP =  0x10 }"
.br
.ti -1c
.RI "enum \fBErrorCodes\fP { \fBNoError\fP =  0, \fBAddrFamily\fP =  -1, \fBTryAgain\fP =  -2, \fBNonRecoverable\fP =  -3, \fBBadFlags\fP =  -4, \fBMemory\fP =  -5, \fBNoName\fP =  -6, \fBUnsupportedFamily\fP =  -7, \fBUnsupportedService\fP =  -8, \fBUnsupportedSocketType\fP =  -9, \fBUnknownError\fP =  -10, \fBSystemError\fP =  -11, \fBCanceled\fP =  -100 }"
.br
.ti -1c
.RI "enum \fBStatusCodes\fP { \fBIdle\fP =  0, \fBQueued\fP =  1, \fBInProgress\fP =  5, \fBPostProcessing\fP =  6, \fBSuccess\fP =  10, \fBFailed\fP =  -101 }"
.br
.in -1c
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBfinished\fP (\fBKResolverResults\fP results)"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKResolver\fP (\fBQObject\fP *=0L, const char *=0L)"
.br
.ti -1c
.RI "\fBKResolver\fP (const \fBQString\fP &nodename, const \fBQString\fP &servicename=QString::null, \fBQObject\fP *=0L, const char *=0L)"
.br
.ti -1c
.RI "virtual \fB~KResolver\fP ()"
.br
.ti -1c
.RI "int \fBstatus\fP () const "
.br
.ti -1c
.RI "int \fBerror\fP () const "
.br
.ti -1c
.RI "int \fBsystemError\fP () const "
.br
.ti -1c
.RI "\fBQString\fP \fBerrorString\fP () const "
.br
.ti -1c
.RI "bool \fBisRunning\fP () const "
.br
.ti -1c
.RI "\fBQString\fP \fBnodeName\fP () const "
.br
.ti -1c
.RI "\fBQString\fP \fBserviceName\fP () const "
.br
.ti -1c
.RI "void \fBsetNodeName\fP (const \fBQString\fP &nodename)"
.br
.ti -1c
.RI "void \fBsetServiceName\fP (const \fBQString\fP &service)"
.br
.ti -1c
.RI "void \fBsetAddress\fP (const \fBQString\fP &node, const \fBQString\fP &service)"
.br
.ti -1c
.RI "int \fBflags\fP () const "
.br
.ti -1c
.RI "int \fBsetFlags\fP (int flags)"
.br
.ti -1c
.RI "void \fBsetFamily\fP (int families)"
.br
.ti -1c
.RI "void \fBsetSocketType\fP (int type)"
.br
.ti -1c
.RI "void \fBsetProtocol\fP (int protonum, const char *\fBname\fP=0L)"
.br
.ti -1c
.RI "bool \fBstart\fP ()"
.br
.ti -1c
.RI "bool \fBwait\fP (int msec=0)"
.br
.ti -1c
.RI "void \fBcancel\fP (bool emitSignal=true)"
.br
.ti -1c
.RI "\fBKResolverResults\fP \fBresults\fP () const "
.br
.ti -1c
.RI "virtual bool \fBevent\fP (\fBQEvent\fP *)"
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static \fBQString\fP \fBerrorString\fP (int errorcode, int syserror=0)"
.br
.ti -1c
.RI "static \fBKResolverResults\fP \fBresolve\fP (const \fBQString\fP &host, const \fBQString\fP &service, int flags=0, int families=KResolver::InternetFamily)"
.br
.ti -1c
.RI "static bool \fBresolveAsync\fP (\fBQObject\fP *userObj, const char *userSlot, const \fBQString\fP &host, const \fBQString\fP &service, int flags=0, int families=KResolver::InternetFamily)"
.br
.ti -1c
.RI "static \fBQCString\fP \fBdomainToAscii\fP (const \fBQString\fP &unicodeDomain)"
.br
.ti -1c
.RI "static \fBQString\fP \fBdomainToUnicode\fP (const \fBQCString\fP &asciiDomain)"
.br
.ti -1c
.RI "static \fBQString\fP \fBdomainToUnicode\fP (const \fBQString\fP &asciiDomain)"
.br
.ti -1c
.RI "static \fBQString\fP \fBnormalizeDomain\fP (const \fBQString\fP &domain)"
.br
.ti -1c
.RI "static \fBQStrList\fP \fBprotocolName\fP (int protonum)"
.br
.ti -1c
.RI "static \fBQStrList\fP \fBprotocolName\fP (const char *protoname)"
.br
.ti -1c
.RI "static int \fBprotocolNumber\fP (const char *protoname)"
.br
.ti -1c
.RI "static int \fBservicePort\fP (const char *servname, const char *protoname)"
.br
.ti -1c
.RI "static \fBQStrList\fP \fBserviceName\fP (const char *servname, const char *protoname)"
.br
.ti -1c
.RI "static \fBQStrList\fP \fBserviceName\fP (int port, const char *protoname)"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "void \fBsetError\fP (int errorcode, int systemerror=0)"
.br
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SS "Friends"

.in +1c
.ti -1c
.RI "class \fBKResolverResults\fP"
.br
.ti -1c
.RI "class \fB::KNetwork::Internal::KResolverManager\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
Name and service resolution class. 

This class provides support for doing name-to-binary resolution for nodenames and service ports. You should use this class if you need specific resolution techniques when creating a socket or if you want to inspect the results before calling the socket functions.
.PP
You can either create an object and set the options you want in it or you can simply call the static member functions, which will create standard Resolver objects and dispatch the resolution for you. Normally, the static functions will be used, except in cases where specific options must be set.
.PP
A Resolver object defaults to the following: 
.PD 0

.IP "\(bu" 2
address family: any address family 
.IP "\(bu" 2
socket type: streaming socket 
.IP "\(bu" 2
protocol: implementation-defined. Generally, TCP 
.IP "\(bu" 2
host and service: unset
.PP
\fBAuthor:\fP
.RS 4
Thiago Macieira <thiago.macieira@kdemail.net> 
.RE
.PP

.PP
Definition at line 295 of file kresolver.h.
.SH "Member Enumeration Documentation"
.PP 
.SS "enum \fBKNetwork::KResolver::SocketFamilies\fP"
.PP
Address family selection types. 
.PP
These values can be OR-ed together to form a composite family selection.
.PP
.PD 0
.IP "\(bu" 2
UnknownFamily: a family that is unknown to the current implementation 
.IP "\(bu" 2
KnownFamily: a family that is known to the implementation (the exact opposite of UnknownFamily) 
.IP "\(bu" 2
AnyFamilies: any address family is acceptable 
.IP "\(bu" 2
InternetFamily: an address for connecting to the Internet 
.IP "\(bu" 2
InetFamily: alias for InternetFamily 
.IP "\(bu" 2
IPv6Family: an IPv6 address only 
.IP "\(bu" 2
IPv4Family: an IPv4 address only 
.IP "\(bu" 2
UnixFamily: an address for the local Unix namespace (i.e., Unix sockets) 
.IP "\(bu" 2
LocalFamily: alias for UnixFamily 
.PP

.PP
Definition at line 317 of file kresolver.h.
.SS "enum \fBKNetwork::KResolver::Flags\fP"
.PP
Flags for the resolution. 
.PP
These flags are used for setting the resolution behaviour for this object: 
.PD 0

.IP "\(bu" 2
Passive: resolve to a passive socket (i.e., one that can be used for binding to a local interface) 
.IP "\(bu" 2
CanonName: request that the canonical name for the given nodename be found and recorded 
.IP "\(bu" 2
NoResolve: request that no external resolution be performed. The given nodename and servicename will be resolved locally only. 
.IP "\(bu" 2
NoSrv: don't try to use SRV-based name-resolution. 
.IP "\(bu" 2
Multiport: the port/service argument is a list of port numbers and ranges. (future extension)
.PP
\fBNote:\fP
.RS 4
SRV-based lookup and Multiport are not implemented yet. 
.RE
.PP

.PP
Definition at line 350 of file kresolver.h.
.SS "enum \fBKNetwork::KResolver::ErrorCodes\fP"
.PP
Error codes. 
.PP
These are the possible error values that objects of this class may return. See \fBerrorString()\fP for getting a string representation for these errors.
.PP
.PD 0
.IP "\(bu" 2
AddrFamily: Address family for the given nodename is not supported. 
.IP "\(bu" 2
TryAgain: Temporary failure in name resolution. You should try again. 
.IP "\(bu" 2
NonRecoverable: Non-recoverable failure in name resolution. 
.IP "\(bu" 2
BadFlags: Invalid flags were given. 
.IP "\(bu" 2
Memory: Memory allocation failure. 
.IP "\(bu" 2
NoName: The specified name or service doesn't exist. 
.IP "\(bu" 2
UnsupportedFamily: The requested socket family is not supported. 
.IP "\(bu" 2
UnsupportedService: The requested service is not supported for this socket type (i.e., a datagram service in a streaming socket). 
.IP "\(bu" 2
UnsupportedSocketType: The requested socket type is not supported. 
.IP "\(bu" 2
UnknownError: An unknown, unexpected error occurred. 
.IP "\(bu" 2
SystemError: A system error occurred. See \fBsystemError\fP. 
.IP "\(bu" 2
Canceled: This request was cancelled by the user. 
.PP

.PP
Definition at line 380 of file kresolver.h.
.SS "enum \fBKNetwork::KResolver::StatusCodes\fP"
.PP
Status codes. 
.PP
These are the possible status for a Resolver object. A value greater than zero indicates normal behaviour, while negative values either indicate failure or error.
.PP
.PD 0
.IP "\(bu" 2
Idle: resolution has not yet been started. 
.IP "\(bu" 2
Queued: resolution is queued but not yet in progress. 
.IP "\(bu" 2
InProgress: resolution is in progress. 
.IP "\(bu" 2
PostProcessing: resolution is in progress. 
.IP "\(bu" 2
Success: resolution is done; you can retrieve the results. 
.IP "\(bu" 2
Canceled: request cancelled by the user. 
.IP "\(bu" 2
Failed: resolution is done, but failed.
.PP
Note: the status Canceled and the error code Canceled are the same.
.PP
Note 2: the status Queued and InProgress might not be distinguishable. Some implementations might not differentiate one from the other. 
.PP
Definition at line 418 of file kresolver.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KResolver::KResolver (\fBQObject\fP * = \fC0L\fP, const char * = \fC0L\fP)"
.PP
Default constructor. 
.PP
Creates an empty Resolver object. You should set the wanted names and flags using the member functions before starting the name resolution. 
.PP
Definition at line 290 of file kresolver.cpp.
.PP
Referenced by resolveAsync().
.SS "KResolver::KResolver (const \fBQString\fP & nodename, const \fBQString\fP & servicename = \fCQString::null\fP, \fBQObject\fP * = \fC0L\fP, const char * = \fC0L\fP)"
.PP
Constructor with host and service names. 
.PP
Creates a Resolver object with the given host and service names. Flags are initialised to 0 and any address family will be accepted.
.PP
\fBParameters:\fP
.RS 4
\fInodename\fP The host name we want resolved. 
.br
\fIservicename\fP The service name associated, like 'http'. 
.RE
.PP

.PP
Definition at line 296 of file kresolver.cpp.
.SS "KResolver::~\fBKResolver\fP ()\fC [virtual]\fP"
.PP
Destructor. 
.PP
When this object is deleted, it'll destroy all associated resources. If the resolution is still in progress, it will be cancelled and the signal will \fBnot\fP be emitted. 
.PP
Definition at line 303 of file kresolver.cpp.
.PP
References cancel().
.SH "Member Function Documentation"
.PP 
.SS "int KResolver::status () const"
.PP
Retrieve the current status of this object. 
.PP
\fBSee also:\fP
.RS 4
\fBStatusCodes\fP for the possible \fBstatus\fP codes. 
.RE
.PP

.PP
Definition at line 310 of file kresolver.cpp.
.SS "int KResolver::error () const"
.PP
Retrieve the error code in this object. 
.PP
This function will return NoError if we are not in an error condition. See \fBstatus\fP and \fBStatusCodes\fP to find out what the current status is.
.PP
\fBSee also:\fP
.RS 4
\fBerrorString\fP for getting a textual representation of this \fBerror\fP 
.RE
.PP

.PP
Definition at line 316 of file kresolver.cpp.
.SS "int KResolver::systemError () const"
.PP
Retrieve the associated system error code in this object. 
.PP
Many resolution operations may generate an extra error code as given by the C errno variable. That value is stored in the object and can be retrieved by this function. 
.PP
Definition at line 322 of file kresolver.cpp.
.SS "\fBQString\fP KNetwork::KResolver::errorString () const\fC [inline]\fP"
.PP
Returns the textual representation of the error in this object. 
.PP
Definition at line 491 of file kresolver.h.
.SS "bool KResolver::isRunning () const"
.PP
Returns true if this object is currently running. 
.PP
Definition at line 328 of file kresolver.cpp.
.PP
Referenced by results(), setFamily(), setFlags(), setNodeName(), setProtocol(), setServiceName(), setSocketType(), start(), and wait().
.SS "\fBQString\fP KResolver::nodeName () const"
.PP
The nodename to which the resolution was/is to be performed. 
.PP
Definition at line 334 of file kresolver.cpp.
.SS "\fBQString\fP KResolver::serviceName () const"
.PP
The service name to which the resolution was/is to be performed. 
.PP
Definition at line 340 of file kresolver.cpp.
.SS "void KResolver::setNodeName (const \fBQString\fP & nodename)"
.PP
Sets the nodename for the resolution. 
.PP
Set the nodename to QString::null to unset it. 
.PP
\fBParameters:\fP
.RS 4
\fInodename\fP The nodename to be resolved. 
.RE
.PP

.PP
Definition at line 346 of file kresolver.cpp.
.PP
References isRunning().
.PP
Referenced by KNetwork::KStreamSocket::bind(), KNetwork::KStreamSocket::connect(), KNetwork::KStreamSocket::KStreamSocket(), and setAddress().
.SS "void KResolver::setServiceName (const \fBQString\fP & service)"
.PP
Sets the service name to be resolved. 
.PP
Set it to QString::null to unset it. 
.PP
\fBParameters:\fP
.RS 4
\fIservice\fP The service to be resolved. 
.RE
.PP

.PP
Definition at line 358 of file kresolver.cpp.
.PP
References isRunning().
.PP
Referenced by KNetwork::KStreamSocket::bind(), KNetwork::KStreamSocket::connect(), KNetwork::KStreamSocket::KStreamSocket(), and setAddress().
.SS "void KResolver::setAddress (const \fBQString\fP & node, const \fBQString\fP & service)"
.PP
Sets both the host and the service names. 
.PP
Setting either value to QString::null will unset them. 
.PP
\fBParameters:\fP
.RS 4
\fInode\fP The nodename 
.br
\fIservice\fP The service name 
.RE
.PP

.PP
Definition at line 370 of file kresolver.cpp.
.PP
References setNodeName(), and setServiceName().
.PP
Referenced by KNetwork::KDatagramSocket::bind(), and KNetwork::KDatagramSocket::connect().
.SS "int KResolver::flags () const"
.PP
Retrieves the flags set for the resolution. 
.PP
\fBSee also:\fP
.RS 4
\fBFlags\fP for an explanation on what \fBflags\fP are possible 
.RE
.PP

.PP
Definition at line 377 of file kresolver.cpp.
.SS "int KResolver::setFlags (int flags)"
.PP
Sets the flags. 
.PP
\fBParameters:\fP
.RS 4
\fIflags\fP the new flags 
.RE
.PP
\fBReturns:\fP
.RS 4
the old flags 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBFlags\fP for an explanation on the \fBflags\fP 
.RE
.PP

.PP
Definition at line 383 of file kresolver.cpp.
.PP
References isRunning().
.PP
Referenced by KNetwork::KDatagramSocket::KDatagramSocket(), resolve(), and resolveAsync().
.SS "void KResolver::setFamily (int families)"
.PP
Sets the allowed socket families. 
.PP
\fBParameters:\fP
.RS 4
\fIfamilies\fP the families that we want/accept 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBSocketFamilies\fP for possible values 
.RE
.PP

.PP
Definition at line 395 of file kresolver.cpp.
.PP
References isRunning().
.PP
Referenced by KNetwork::KDatagramSocket::KDatagramSocket(), KNetwork::KStreamSocket::KStreamSocket(), resolve(), and resolveAsync().
.SS "void KResolver::setSocketType (int type)"
.PP
Sets the socket type we want. 
.PP
The values for the \fCtype\fP parameter are the SOCK_* constants, defined in <sys/socket.h>. The most common values are: 
.PD 0

.IP "\(bu" 2
SOCK_STREAM streaming socket (= reliable, sequenced, connection-based) 
.IP "\(bu" 2
SOCK_DGRAM datagram socket (= unreliable, connectionless) 
.IP "\(bu" 2
SOCK_RAW raw socket, with direct access to the container protocol (such as IP)
.PP
These three are the only values to which it is guaranteed that resolution will work. Some systems may define other constants (such as SOCK_RDM for reliable datagrams), but support is implementation-defined.
.PP
\fBParameters:\fP
.RS 4
\fItype\fP the wanted socket type (SOCK_* constants). Set 0 to use the default. 
.RE
.PP

.PP
Definition at line 405 of file kresolver.cpp.
.PP
References isRunning().
.PP
Referenced by KNetwork::KDatagramSocket::KDatagramSocket().
.SS "void KResolver::setProtocol (int protonum, const char * name = \fC0L\fP)"
.PP
Sets the protocol we want. 
.PP
Protocols are dependant on the selected address family, so you should know what you are doing if you use this function. Besides, protocols generally are either stream-based or datagram-based, so the value of the socket type is also important. The resolution will fail if these values don't match.
.PP
When using an Internet socket, the values for the protocol are the IPPROTO_* constants, defined in <netinet/in.h>.
.PP
You may choose to set the protocol either by its number or by its name, or by both. If you set: 
.PD 0

.IP "\(bu" 2
the number and the name: both values will be stored internally; you may set the name to an empty value, if wanted 
.IP "\(bu" 2
the number only (name = NULL): the name will be searched in the protocols database 
.IP "\(bu" 2
the name only (number = 0): the number will be searched in the database 
.IP "\(bu" 2
neither name nor number: reset to default behaviour
.PP
\fBParameters:\fP
.RS 4
\fIprotonum\fP the protocol number we want 
.br
\fIname\fP the protocol name 
.RE
.PP

.PP
Definition at line 415 of file kresolver.cpp.
.PP
References isRunning().
.SS "bool KResolver::start ()"
.PP
Starts the name resolution asynchronously. 
.PP
This function will queue this object for resolution and will return immediately. The status upon exit will either be Queued or InProgress or Failed.
.PP
This function does nothing if the object is already queued. But if it had already succeeded or failed, this function will re-start it.
.PP
Note: if both the nodename and the servicename are unset, this function will not queue, but will set a success state and emit the signal. Also note that in this case and maybe others, the signal \fBfinished\fP might be emitted before this function returns.
.PP
\fBReturns:\fP
.RS 4
true if this request was successfully queued for asynchronous resolution 
.RE
.PP

.PP
Definition at line 436 of file kresolver.cpp.
.PP
References isRunning().
.PP
Referenced by KNetwork::KStreamSocket::connect(), resolve(), and resolveAsync().
.SS "bool KResolver::wait (int msec = \fC0\fP)"
.PP
Waits for a request to finish resolving. 
.PP
This function will wait on a running request for its termination. The status upon exit will either be Success or Failed or Canceled.
.PP
This function may be called from any thread, even one that is not the GUI thread or the one that started the resolution process. But note this function is not thread-safe nor reentrant: i.e., only one thread can be waiting on one given object.
.PP
Also note that this function ensures that the \fBfinished\fP signal is emitted before it returns. That means that, as a side-effect, whenever \fBwait()\fP is called, the signal is emitted on the thread calling \fBwait()\fP.
.PP
\fBParameters:\fP
.RS 4
\fImsec\fP the time to wait, in milliseconds or 0 to wait forever 
.RE
.PP
\fBReturns:\fP
.RS 4
true if the resolution has finished processing, even when it failed or was canceled. False means the wait timed out and the resolution is still running. 
.RE
.PP

.PP
Definition at line 455 of file kresolver.cpp.
.PP
References QTime::elapsed(), isRunning(), and QTime::start().
.PP
Referenced by KNetwork::KClientSocketBase::lookup(), and resolve().
.SS "void KResolver::cancel (bool emitSignal = \fCtrue\fP)"
.PP
Cancels a running request. 
.PP
This function will cancel a running request. If the request is not currently running or queued, this function does nothing.
.PP
Note: if you tell the signal to be emitted, be aware that it might or might not be emitted before this function returns.
.PP
\fBParameters:\fP
.RS 4
\fIemitSignal\fP whether to emit the \fBfinished\fP signal or not 
.RE
.PP

.PP
Definition at line 506 of file kresolver.cpp.
.PP
Referenced by KNetwork::KDatagramSocket::bind(), and ~KResolver().
.SS "\fBKResolverResults\fP KResolver::results () const"
.PP
Retrieves the results of this resolution. 
.PP
Use this function to retrieve the results of the resolution. If no data was resolved (yet) or if we failed, this function will return an empty object.
.PP
\fBReturns:\fP
.RS 4
the resolved data 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBstatus\fP for information on finding out if the resolution was successful 
.RE
.PP

.PP
Definition at line 514 of file kresolver.cpp.
.PP
References isRunning(), KNetwork::KResolverResults::setAddress(), and KNetwork::KResolverResults::setError().
.PP
Referenced by resolve().
.SS "bool KResolver::event (\fBQEvent\fP *)\fC [virtual]\fP"
.PP
Handles events. 
.PP
Reimplemented from \fBQObject\fP.
.PP
This function handles the events generated by the manager indicating that this object has finished processing.
.PP
Do not post events to this object. 
.PP
Reimplemented from \fBQObject\fP.
.PP
Definition at line 526 of file kresolver.cpp.
.SS "void KNetwork::KResolver::finished (\fBKResolverResults\fP results)\fC [signal]\fP"
.PP
This signal is emitted whenever the resolution is finished, one way or another (success or failure). 
.PP
The \fCresults\fP parameter will contain the resolved data.
.PP
Note: if you are doing multiple resolutions, you can use the \fBQObject::sender()\fP function to distinguish one Resolver object from another.
.PP
\fBParameters:\fP
.RS 4
\fIresults\fP the resolved data; might be empty if the resolution failed 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBresults\fP for information on what the \fBresults\fP are
.RE
.PP
\fBNote:\fP
.RS 4
This signal is \fBalways\fP delivered in the GUI event thread, even for resolutions that were started in secondary threads. 
.RE
.PP

.PP
Referenced by resolveAsync().
.SS "\fBQString\fP KResolver::errorString (int errorcode, int syserror = \fC0\fP)\fC [static]\fP"
.PP
Returns the string representation of this error code. 
.PP
\fBParameters:\fP
.RS 4
\fIerrorcode\fP the error code. See \fBErrorCodes\fP. 
.br
\fIsyserror\fP the system error code associated. 
.RE
.PP
\fBReturns:\fP
.RS 4
the string representation. This is already i18n'ed. 
.RE
.PP

.PP
Definition at line 550 of file kresolver.cpp.
.PP
References QString::arg(), I18N_NOOP, and I18N_NOOP2.
.SS "\fBKResolverResults\fP KResolver::resolve (const \fBQString\fP & host, const \fBQString\fP & service, int flags = \fC0\fP, int families = \fCKResolver::InternetFamily\fP)\fC [static]\fP"
.PP
Resolve the nodename and service name synchronously. 
.PP
This static function is provided as convenience for simplifying name resolution. It resolves the given host and service names synchronously and returns the results it found. It is equivalent to the following code:
.PP
.PP
.nf
   KResolver qres(host, service);
   qres.setFlags(flags);
   qres.setFamily(families)
   qres.start();
   qres.wait();
   return qres.results();
.fi
.PP
.PP
\fBParameters:\fP
.RS 4
\fIhost\fP the nodename to resolve 
.br
\fIservice\fP the service to resolve 
.br
\fIflags\fP flags to be used 
.br
\fIfamilies\fP the families to be searched 
.RE
.PP
\fBReturns:\fP
.RS 4
a \fBKResolverResults\fP object containing the results 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBKResolverResults\fP for information on how to obtain the \fBerror\fP code 
.RE
.PP

.PP
Definition at line 585 of file kresolver.cpp.
.PP
References results(), setFamily(), setFlags(), start(), and wait().
.SS "bool KResolver::resolveAsync (\fBQObject\fP * userObj, const char * userSlot, const \fBQString\fP & host, const \fBQString\fP & service, int flags = \fC0\fP, int families = \fCKResolver::InternetFamily\fP)\fC [static]\fP"
.PP
Start an asynchronous name resolution. 
.PP
This function is provided as a convenience to simplify the resolution process. It creates an internal \fBKResolver\fP object, connects the \fBfinished\fP signal to the given slot and starts the resolution asynchronously. It is more or less equivalent to the following code:
.PP
\fBNote:\fP this function may trigger the signal before it returns, so your code must be prepared for this situation.
.PP
.PP
.nf
   KResolver* qres = new KResolver(host, service);
   QObject::connect(qres, SIGNAL(finished(KResolverResults)),
              userObj, userSlot);
   qres->setFlags(flags);
   qres->setFamily(families);
   return qres->start();
.fi
.PP
.PP
You should use it like this in your code: 
.PP
.nf
   KResolver::resolveAsync(myObj, SLOT(mySlot(KResolverResults)), host, service);

.fi
.PP
.PP
\fBParameters:\fP
.RS 4
\fIuserObj\fP the object whose slot \fCuserSlot\fP we will connect 
.br
\fIuserSlot\fP the slot to which we'll connect 
.br
\fIhost\fP the nodename to resolve 
.br
\fIservice\fP the service to resolve 
.br
\fIflags\fP flags to be used 
.br
\fIfamilies\fP families to be searcheed 
.RE
.PP
\fBReturns:\fP
.RS 4
true if the queueing was successful, false if not 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBKResolverResults\fP for information on how to obtain the \fBerror\fP code 
.RE
.PP

.PP
Definition at line 596 of file kresolver.cpp.
.PP
References QObject::connect(), d, finished(), KResolver(), setFamily(), setFlags(), and start().
.SS "\fBQCString\fP KResolver::domainToAscii (const \fBQString\fP & unicodeDomain)\fC [static]\fP"
.PP
Returns the domain name in an ASCII Compatible Encoding form, suitable for DNS lookups. 
.PP
This is the base for International Domain Name support over the Internet.
.PP
Note this function may fail, in which case it'll return a null \fBQCString\fP. Reasons for failure include use of unknown code points (Unicode characters).
.PP
Note that the encoding is illegible and, thus, should not be presented to the user, except if requested.
.PP
\fBParameters:\fP
.RS 4
\fIunicodeDomain\fP the domain name to be encoded 
.RE
.PP
\fBReturns:\fP
.RS 4
the ACE-encoded suitable for DNS queries if successful, a null \fBQCString\fP if failure. 
.RE
.PP

.PP
Definition at line 890 of file kresolver.cpp.
.PP
References QCString::isEmpty(), QCString::isNull(), and QStringList::join().
.PP
Referenced by normalizeDomain().
.SS "\fBQString\fP KResolver::domainToUnicode (const \fBQCString\fP & asciiDomain)\fC [static]\fP"
.PP
Does the inverse of \fBdomainToAscii\fP and return an Unicode domain name from the given ACE-encoded domain. 
.PP
This function may fail if the given domain cannot be successfully converted back to Unicode. Reasons for failure include a malformed domain name or good ones whose reencoding back to ACE don't match the form given here (e.g., ACE-encoding of an already ASCII-compatible domain).
.PP
It is, however, guaranteed that domains returned by \fBdomainToAscii\fP will work.
.PP
\fBParameters:\fP
.RS 4
\fIasciiDomain\fP the ACE-encoded domain name to be decoded 
.RE
.PP
\fBReturns:\fP
.RS 4
the Unicode representation of the given domain name if successful, the original string if not 
.RE
.PP
\fBNote:\fP
.RS 4
ACE = ASCII-Compatible Encoding, i.e., 7-bit 
.RE
.PP

.PP
Definition at line 928 of file kresolver.cpp.
.PP
Referenced by normalizeDomain().
.SS "\fBQString\fP KResolver::domainToUnicode (const \fBQString\fP & asciiDomain)\fC [static]\fP"
.PP
The same as above, but taking a \fBQString\fP argument. 
.PP
\fBParameters:\fP
.RS 4
\fIasciiDomain\fP the ACE-encoded domain name to be decoded 
.RE
.PP
\fBReturns:\fP
.RS 4
the Unicode representation of the given domain name if successful, QString::null if not. 
.RE
.PP

.PP
Definition at line 934 of file kresolver.cpp.
.PP
References QString::isEmpty(), and QString::lower().
.SS "\fBQString\fP KResolver::normalizeDomain (const \fBQString\fP & domain)\fC [static]\fP"
.PP
Normalise a domain name. 
.PP
In order to prevent simple mistakes in International Domain Names (IDN), it has been decided that certain code points (characters in Unicode) would be instead converted to others. This includes turning them all to lower case, as well certain other specific operations, as specified in the documents.
.PP
For instance, the German 'ß' will be changed into 'ss', while the micro symbol 'µ' will be changed to the Greek mu 'μ'.
.PP
Two equivalent domains have the same normalised form. And the normalised form of a normalised domain is itself (i.e., if d is normalised, the following is true: d == normalizeDomain(d) )
.PP
This operation is equivalent to encoding and the decoding a Unicode hostname.
.PP
\fBParameters:\fP
.RS 4
\fIdomain\fP a domain to be normalised 
.RE
.PP
\fBReturns:\fP
.RS 4
the normalised domain, or QString::null if the domain is invalid. 
.RE
.PP

.PP
Definition at line 974 of file kresolver.cpp.
.PP
References domainToAscii(), and domainToUnicode().
.SS "\fBQStrList\fP KResolver::protocolName (int protonum)\fC [static]\fP"
.PP
Resolves a protocol number to its names. 
.PP
Note: the returned \fBQStrList\fP operates on deep-copies.
.PP
\fBParameters:\fP
.RS 4
\fIprotonum\fP the protocol number to be looked for 
.RE
.PP
\fBReturns:\fP
.RS 4
all the protocol names in a list. The first is the 'proper' name. 
.RE
.PP

.PP
Definition at line 608 of file kresolver.cpp.
.SS "\fBQStrList\fP KResolver::protocolName (const char * protoname)\fC [static]\fP"
.PP
Finds all aliases for a given protocol name. 
.PP
\fBParameters:\fP
.RS 4
\fIprotoname\fP the protocol name to be looked for 
.RE
.PP
\fBReturns:\fP
.RS 4
all the protocol names in a list. The first is the 'proper' name. 
.RE
.PP

.PP
Definition at line 654 of file kresolver.cpp.
.SS "int KResolver::protocolNumber (const char * protoname)\fC [static]\fP"
.PP
Resolves a protocol name to its number. 
.PP
\fBParameters:\fP
.RS 4
\fIprotoname\fP the protocol name to be looked for 
.RE
.PP
\fBReturns:\fP
.RS 4
the protocol number or -1 if we couldn't locate it 
.RE
.PP

.PP
Definition at line 700 of file kresolver.cpp.
.SS "int KResolver::servicePort (const char * servname, const char * protoname)\fC [static]\fP"
.PP
Resolves a service name to its port number. 
.PP
\fBParameters:\fP
.RS 4
\fIservname\fP the service name to be looked for 
.br
\fIprotoname\fP the protocol it is associated with 
.RE
.PP
\fBReturns:\fP
.RS 4
the port number in host byte-order or -1 in case of error 
.RE
.PP

.PP
Definition at line 742 of file kresolver.cpp.
.SS "\fBQStrList\fP KResolver::serviceName (const char * servname, const char * protoname)\fC [static]\fP"
.PP
Finds all the aliases for a given service name. 
.PP
Note: the returned \fBQStrList\fP operates on deep-copies.
.PP
\fBParameters:\fP
.RS 4
\fIservname\fP the service alias to be looked for 
.br
\fIprotoname\fP the protocol it is associated with 
.RE
.PP
\fBReturns:\fP
.RS 4
all the service names in a list. The first is the 'proper' name. 
.RE
.PP

.PP
Definition at line 784 of file kresolver.cpp.
.SS "\fBQStrList\fP KResolver::serviceName (int port, const char * protoname)\fC [static]\fP"
.PP
Resolves a port number to its names. 
.PP
Note: the returned \fBQStrList\fP operates on deep copies.
.PP
\fBParameters:\fP
.RS 4
\fIport\fP the port number, in host byte-order 
.br
\fIprotoname\fP the protocol it is associated with 
.RE
.PP
\fBReturns:\fP
.RS 4
all the service names in a list. The first is the 'proper' name. 
.RE
.PP

.PP
Definition at line 830 of file kresolver.cpp.
.SS "void KNetwork::KResolver::setError (int errorcode, int systemerror = \fC0\fP)\fC [protected]\fP"
.PP
Sets the error codes. 
.PP


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