E-MailRelay

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

gresolver_dns_disabled.cpp
Go to the documentation of this file.
1 //
2 // Copyright (C) 2001-2018 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 // ===
17 //
18 // gresolver_dns_disabled.cpp
19 //
20
21 #include "gdef.h"
22 #include "gresolver.h"
23 #include "gstr.h"
24 #include "gaddress.h"
25 #include "glocation.h"
26
27 class GNet::ResolverImp
28 {
29 } ;
30
31 // ==
32
33 GNet::Resolver::Resolver( Resolver::Callback & callback , EventHandler & exception_handler ) :
34 m_callback(callback) ,
35 m_exception_handler(exception_handler) ,
36 m_busy(false)
37 {
38 }
39
40 GNet::Resolver::~Resolver()
41 {
42 }
43
44 std::string GNet::Resolver::resolve( Location & location , bool )
45 {
46 try
47 {
48 Address address( location.host() , G::Str::toUInt(location.service()) ) ;
49 location.update( address , std::string() ) ;
50 return std::string() ;
51 }
52 catch( std::exception & e )
53 {
54 return "invalid address" ;
55 }
56 }
57
58 void GNet::Resolver::start( const Location & , bool )
59 {
60 // never gets here
61 throw std::runtime_error( "not implemented" ) ;
62 }
63
64 bool GNet::Resolver::busy() const
65 {
66 return false ;
67 }
68
69 bool GNet::Resolver::async()
70 {
71 return false ;
72 }
73
74 /// \file gresolver_dns_disabled.cpp
GNet::Resolver::~Resolver
~Resolver()
Destructor.
Definition: gresolver.cpp:165
GNet::Resolver::start
void start(const Location &)
Starts asynchronous name-to-address resolution.
Definition: gresolver.cpp:210
glocation.h
G::Str::toUInt
static unsigned int toUInt(const std::string &s)
Converts string 's' to an unsigned int.
Definition: gstr.cpp:488
gstr.h
GNet::Resolver::async
static bool async()
Returns true if the resolver supports asynchronous operation.
Definition: gresolver.cpp:232
GNet::Resolver::busy
bool busy() const
Returns true if there is a pending resolve request.
Definition: gresolver.cpp:227
GNet::Resolver::resolve
static std::string resolve(Location &)
Does synchronous name resolution.
Definition: gresolver.cpp:177
GNet::Resolver::Resolver
Resolver(Callback &, ExceptionHandler &)
Constructor taking a callback interface reference.
Definition: gresolver.cpp:158
gaddress.h
GNet::ResolverImp
A private "pimple" implementation class used by GNet::Resolver to do asynchronous name resolution...
Definition: gresolver.cpp:38
gresolver.h