FlightGear next
DNSClient.cxx
Go to the documentation of this file.
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
32using namespace simgear;
33
35 _inited(false)
36{
37}
38
42
44{
45 if (_inited) {
46 return;
47 }
48
49 _dns.reset( new simgear::DNS::Client() );
50
51 _inited = true;
52}
53
55{
56}
57
59{
60 _dns.reset();
61 _inited = false;
62}
63
65{
66 _dns->update();
67}
68
69void FGDNSClient::makeRequest(const simgear::DNS::Request_ptr& req)
70{
71 _dns->makeRequest(req);
72}
73
74
75// Register the subsystem.
76SGSubsystemMgr::Registrant<FGDNSClient> registrantFGDNSClient;
SGSubsystemMgr::Registrant< FGDNSClient > registrantFGDNSClient
Definition DNSClient.cxx:76
void init() override
Definition DNSClient.cxx:43
void update(double) override
Definition DNSClient.cxx:64
virtual ~FGDNSClient()
Definition DNSClient.cxx:39
void shutdown() override
Definition DNSClient.cxx:58
void postinit() override
Definition DNSClient.cxx:54
void makeRequest(const simgear::DNS::Request_ptr &req)
Definition DNSClient.cxx:69