- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

gresolver.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2001-2013 Graeme Walker <graeme_walker@users.sourceforge.net>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // ===
20
21 #ifndef G_RESOLVER_H
22 #define G_RESOLVER_H
23
24 #include "gdef.h"
25 #include "gnet.h"
26 #include "gresolverinfo.h"
27 #include "geventhandler.h"
28 #include "gaddress.h"
29
31 namespace GNet
32 {
33 class Resolver ;
34 class ResolverImp ;
35 }
36
45 class GNet::Resolver
46 {
47 public:
48 explicit Resolver( EventHandler & ) ;
53
54 virtual ~Resolver() ;
56
57 static bool parse( const std::string & in , std::string & host_or_address , std::string & service_or_port ) ;
64
65 bool resolveReq( std::string name , bool udp = false ) ;
72
73 bool resolveReq( std::string host_name, std::string service_name , bool udp = false ) ;
78
79 virtual void resolveCon( bool success, const Address & address ,
80 std::string fqdn_or_failure_reason ) ;
87
88 bool busy() const ;
93
94 static std::string resolve( ResolverInfo & host_and_service , bool udp = false ) ;
99
100 private:
101 void operator=( const Resolver & ) ; // not implemented
102 Resolver( const Resolver & ) ; // not implemented
103 static unsigned int resolveService( const std::string & , bool , std::string & ) ;
104 static std::string resolveHost( const std::string & host_name , unsigned int , ResolverInfo & ) ;
105
106 private:
107 ResolverImp *m_imp ;
108 } ;
109
110 #endif
GNet::Resolver::~Resolver
virtual ~Resolver()
Virtual destructor.
Definition: gresolver_unix.cpp:183
GNet
Network classes.
gresolverinfo.h
GNet::Resolver
A class for asynchronous TCP name-to-address resolution.
Definition: gresolver.h:45
GNet::Address
The Address class encapsulates an IP transport address.
Definition: gaddress.h:48
GNet::ResolverInfo
A class that holds a host/service name pair and optionally the results of a name-to-address lookup...
Definition: gresolverinfo.h:48
GNet::Resolver::resolve
static std::string resolve(ResolverInfo &host_and_service, bool udp=false)
Does syncronous name resolution.
Definition: gresolver.cpp:27
GNet::Resolver::resolveCon
virtual void resolveCon(bool success, const Address &address, std::string fqdn_or_failure_reason)
Called when the resolution process is complete.
Definition: gresolver_unix.cpp:212
GNet::Resolver::parse
static bool parse(const std::string &in, std::string &host_or_address, std::string &service_or_port)
Parses a string that contains a hostname or ip address plus a server name or port number...
Definition: gresolver.cpp:61
geventhandler.h
GNet::EventHandler
A base class for classes that handle asynchronous socket events.
Definition: geventhandler.h:54
GNet::Resolver::busy
bool busy() const
Returns true if there is a pending resolve request.
Definition: gresolver_unix.cpp:217
gaddress.h
GNet::Resolver::resolveReq
bool resolveReq(std::string name, bool udp=false)
Initiates a name-to-address resolution.
Definition: gresolver_unix.cpp:188
GNet::Resolver::Resolver
Resolver(EventHandler &)
Constructor taking an event handler reference.
Definition: gresolver_unix.cpp:178
GNet::ResolverImp
A pimple-pattern implementation class for GNet::Resolver.
Definition: gresolver_unix.cpp:49