FlightGear next
DNSClient.hxx
Go to the documentation of this file.
1// DNSClient.hxx -- Singleton DNS client object
2//
3// Written by Torsten Dreyer, started November 2016.
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#ifndef FG_DNS_CLIENT_HXX
22#define FG_DNS_CLIENT_HXX
23
24#include <simgear/structure/subsystem_mgr.hxx>
25#include <simgear/io/DNSClient.hxx>
26#include <memory>
27
28class FGDNSClient : public SGSubsystem
29{
30public:
32 virtual ~FGDNSClient();
33
34 // Subsystem API.
35 void init() override;
36 void postinit() override;
37 void shutdown() override;
38 void update(double) override;
39
40 // Subsystem identification.
41 static const char* staticSubsystemClassId() { return "dns"; }
42
43 void makeRequest(const simgear::DNS::Request_ptr& req);
44
45// simgear::HTTP::Client* client() { return _http.get(); }
46// simgear::HTTP::Client const* client() const { return _http.get(); }
47
48private:
49 bool _inited;
50 std::unique_ptr<simgear::DNS::Client> _dns;
51};
52
53#endif // FG_DNS_CLIENT_HXX
54
55
void init() override
Definition DNSClient.cxx:43
void update(double) override
Definition DNSClient.cxx:64
static const char * staticSubsystemClassId()
Definition DNSClient.hxx:41
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