"(0: all the servers are down, 1: at least one server is up)", /* Documentation string */
0 /* Method signature(s) */
};
+
+void dns_get_server_state_rpc(rpc_t* rpc, void* ctx);
+
+static const char* dns_get_server_state_doc[] = {
+ "prints the state of the DNS servers " \
+ "(0: all the servers are down, 1: at least one server is up)", /* Documentation string */
+ 0 /* Method signature(s) */
+};
+
#endif /* DNS_WATCHDOG_SUPPORT */
#endif /* USE_DNS_CACHE */
#ifdef USE_DST_BLACKLIST
#endif /* USE_DNS_CACHE_STATS */
#ifdef DNS_WATCHDOG_SUPPORT
{"dns.set_server_state", dns_set_server_state_rpc, dns_set_server_state_doc, 0 },
+ {"dns.get_server_state", dns_get_server_state_rpc, dns_get_server_state_doc, 0 },
#endif
#endif
#ifdef USE_DST_BLACKLIST
{
atomic_set(dns_servers_up, state);
}
+
+/* returns the state of the DNS servers */
+int dns_get_server_state(void)
+{
+ return atomic_get(dns_servers_up);
+}
#endif /* DNS_WATCHDOG_SUPPORT */
/* rpc functions */
return;
dns_set_server_state(state);
}
+
+/* prints the DNS server state */
+void dns_get_server_state_rpc(rpc_t* rpc, void* ctx)
+{
+ rpc->add(ctx, "d", dns_get_server_state());
+}
#endif /* DNS_WATCHDOG_SUPPORT */
#endif
* 0: all the servers are down
*/
void dns_set_server_state(int state);
+
+/* returns the state of the DNS servers */
+int dns_get_server_state(void);
#endif /* DNS_WATCHDOG_SUPPORT */
#endif