FlightGear next
MPServerResolver.hxx
Go to the documentation of this file.
1/*
2 MPServerResolver.hxx - mpserver names lookup via DNS
3 Written and copyright by Torsten Dreyer - November 2016
4
5 This file is part of FlightGear.
6
7 FlightGear is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
11
12 FlightGear is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with FlightGear. If not, see <http://www.gnu.org/licenses/>.
19 */
20#ifndef __FG_MPSERVERRESOLVER_HXX
21#define __FG_MPSERVERRESOLVER_HXX
22
23#include <string>
24#include <simgear/props/props.hxx>
25
27public:
29 virtual ~MPServerResolver();
30 void run();
31
37 void setTarget( SGPropertyNode_ptr value ) { _targetNode = value; }
38
46 void setDnsName( const std::string & value ) { _dnsName = value; }
47
54 void setService( const std::string & value ) { _service = value; }
55
62 void setProtocol( const std::string & value ) { _protocol = value; }
63
67 virtual void onSuccess() {};
68
72 virtual void onFailure() {};
73
74private:
75 class MPServerResolver_priv;
76 std::string _dnsName;
77 std::string _service;
78 std::string _protocol;
79 SGPropertyNode_ptr _targetNode;
80 MPServerResolver_priv * _priv;
81};
82
83#endif // __FG_MPSERVERRESOLVER_HXX
void setTarget(SGPropertyNode_ptr value)
Set the target property where the server-list gets stored.
void setService(const std::string &value)
Set the service name to use for the query.
void setDnsName(const std::string &value)
Set the dns domain name to query.
virtual void onSuccess()
Handler to be called if the resolver process finishes with success.
void setProtocol(const std::string &value)
Set the protocol name to use for the query.
virtual void onFailure()
Handler to be called if the resolver process terminates with an error.