2 * This file is part of PowerDNS or dnsdist.
3 * Copyright -- PowerDNS.COM B.V. and its contributors
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * In addition, for the avoidance of any doubt, permission is granted to
10 * link this program with OpenSSL and to (re)distribute the binaries
11 * produced as the result of such linking.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef PDNS_REC_CHANNEL
23 #define PDNS_REC_CHANNEL
34 /** this class is used both to send and answer channel commands to the PowerDNS Recursor */
35 class RecursorControlChannel
38 RecursorControlChannel();
40 ~RecursorControlChannel();
42 int listen(const std::string& filename);
43 void connect(const std::string& path, const std::string& filename);
45 uint64_t getStat(const std::string& name);
47 void send(const std::string& msg, const std::string* remote=0);
48 std::string recv(std::string* remote=0, unsigned int timeout=5);
52 struct sockaddr_un d_local;
55 class RecursorControlParser
58 RecursorControlParser();
59 static void nop(void){}
60 typedef void func_t(void);
61 std::string getAnswer(const std::string& question, func_t** func);
66 std::map<std::string, std::string> getAllStatsMap();
67 extern pthread_mutex_t g_carbon_config_lock;
68 void sortPublicSuffixList();
69 std::vector<std::pair<DNSName, uint16_t> >* pleaseGetQueryRing();
70 std::vector<std::pair<DNSName, uint16_t> >* pleaseGetServfailQueryRing();
71 std::vector<ComboAddress>* pleaseGetRemotes();
72 std::vector<ComboAddress>* pleaseGetServfailRemotes();
73 std::vector<ComboAddress>* pleaseGetLargeAnswerRemotes();
74 DNSName getRegisteredName(const DNSName& dom);
75 std::atomic<unsigned long>* getDynMetric(const std::string& str);