Debian Codegraph @

src/Network/DNSClient.cxx

raw symbols SCIP
1 // HDNSClient.cxx -- Singleton DNS client object
2 //
3 // Written by James Turner, started April 2012.
4 // Based on HTTPClient from James Turner
5 // Copyright (C) 2012 James Turner
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
21 #include "config.h"
22
23 #include "DNSClient.hxx"
24
25 #include <cassert>
26
27 #include <Main/fg_props.hxx>
28
29 #include <simgear/sg_inlines.h>
30
31
32 using namespace simgear;
33
34 FGDNSClient::FGDNSClient() :
35 _inited(false)
36 {
37 }
38
39 FGDNSClient::~FGDNSClient()
40 {
41 }
42
43 void FGDNSClient::init()
44 {
45 if (_inited) {
46 return;
47 }
48
49 _dns.reset( new simgear::DNS::Client() );
50
51 _inited = true;
52 }
53
54 void FGDNSClient::postinit()
55 {
56 }
57
58 void FGDNSClient::shutdown()
59 {
60 _dns.reset();
61 _inited = false;
62 }
63
64 void FGDNSClient::update(double)
65 {
66 _dns->update();
67 }
68
69 void FGDNSClient::makeRequest(const simgear::DNS::Request_ptr& req)
70 {
71 _dns->makeRequest(req);
72 }
73
74
75 // Register the subsystem.
76 SGSubsystemMgr::Registrant<FGDNSClient> registrantFGDNSClient;