/* FIXME: Enabled by default for backwards compatibility. */
/* TODO: Remove time parsing code. */
-static _Bool config_parse_time = 1;
+static bool config_parse_time = true;
-static char *url = NULL;
+static char *url;
static int global_opcodes = 1;
static int global_qtypes = 1;
static int global_server_stats = 1;
static int global_zone_maint_stats = 1;
-static int global_resolver_stats = 0;
+static int global_resolver_stats;
static int global_memory_stats = 1;
static int timeout = -1;
-static cb_view_t *views = NULL;
-static size_t views_num = 0;
+static cb_view_t *views;
+static size_t views_num;
-static CURL *curl = NULL;
+static CURL *curl;
-static char *bind_buffer = NULL;
-static size_t bind_buffer_size = 0;
-static size_t bind_buffer_fill = 0;
+static char *bind_buffer;
+static size_t bind_buffer_size;
+static size_t bind_buffer_fill;
static char bind_curl_error[CURL_ERROR_SIZE];
/* Translation table for the `nsstats' values. */
static int bind_xml_read_timestamp(const char *xpath_expression, /* {{{ */
xmlDoc *doc, xmlXPathContext *xpathCtx,
time_t *ret_value) {
- xmlXPathObject *xpathObj = xmlXPathEvalExpression(BAD_CAST xpath_expression, xpathCtx);
+ xmlXPathObject *xpathObj =
+ xmlXPathEvalExpression(BAD_CAST xpath_expression, xpathCtx);
if (xpathObj == NULL) {
ERROR("bind plugin: Unable to evaluate XPath expression `%s'.",
xpath_expression);
return -1;
}
-
char *str_ptr = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
if (str_ptr == NULL) {
ERROR("bind plugin: bind_xml_read_timestamp: xmlNodeListGetString failed.");
void *user_data, xmlDoc *doc,
xmlXPathContext *xpathCtx,
time_t current_time, int ds_type) {
- xmlXPathObject *xpathObj = xmlXPathEvalExpression(BAD_CAST xpath_expression, xpathCtx);
+ xmlXPathObject *xpathObj =
+ xmlXPathEvalExpression(BAD_CAST xpath_expression, xpathCtx);
if (xpathObj == NULL) {
ERROR("bind plugin: Unable to evaluate XPath expression `%s'.",
xpath_expression);
void *user_data, xmlDoc *doc,
xmlXPathContext *xpathCtx,
time_t current_time, int ds_type) {
- xmlXPathObject *xpathObj = xmlXPathEvalExpression(BAD_CAST xpath_expression, xpathCtx);
+ xmlXPathObject *xpathObj =
+ xmlXPathEvalExpression(BAD_CAST xpath_expression, xpathCtx);
if (xpathObj == NULL) {
ERROR("bind plugin: Unable to evaluate XPath expression `%s'.",
xpath_expression);
list_callback_t list_callback, void *user_data, xmlDoc *doc,
xmlXPathContext *xpathCtx, time_t current_time, int ds_type) {
- xmlXPathObject *xpathObj = xmlXPathEvalExpression(BAD_CAST xpath_expression, xpathCtx);
+ xmlXPathObject *xpathObj =
+ xmlXPathEvalExpression(BAD_CAST xpath_expression, xpathCtx);
if (xpathObj == NULL) {
ERROR("bind plugin: Unable to evaluate XPath expression `%s'.",
xpath_expression);
xmlFree(n);
xmlFree(c);
} else {
- xmlXPathObject *path_obj = xmlXPathEvalExpression(BAD_CAST "name", path_ctx);
+ xmlXPathObject *path_obj =
+ xmlXPathEvalExpression(BAD_CAST "name", path_ctx);
if (path_obj == NULL) {
ERROR("bind plugin: xmlXPathEvalExpression failed.");
return -1;
return -1;
}
- xmlXPathObject *zone_nodes = xmlXPathEvalExpression(BAD_CAST "zones/zone", path_ctx);
+ xmlXPathObject *zone_nodes =
+ xmlXPathEvalExpression(BAD_CAST "zones/zone", path_ctx);
if (zone_nodes == NULL) {
ERROR("bind plugin: Cannot find any <view> tags.");
xmlXPathFreeContext(zone_path_context);
xmlFree(view_name);
view_name = NULL;
} else {
- xmlXPathObject *path_obj = xmlXPathEvalExpression(BAD_CAST "name", path_ctx);
+ xmlXPathObject *path_obj =
+ xmlXPathEvalExpression(BAD_CAST "name", path_ctx);
if (path_obj == NULL) {
ERROR("bind plugin: xmlXPathEvalExpression failed.");
return -1;
static int bind_xml_stats_search_views(int version, xmlDoc *doc, /* {{{ */
xmlXPathContext *xpathCtx,
- xmlNode *statsnode,
time_t current_time) {
xmlXPathContext *view_path_context = xmlXPathNewContext(doc);
if (view_path_context == NULL) {
return -1;
}
- xmlXPathObject *view_nodes = xmlXPathEvalExpression(BAD_CAST "views/view", xpathCtx);
+ xmlXPathObject *view_nodes =
+ xmlXPathEvalExpression(BAD_CAST "views/view", xpathCtx);
if (view_nodes == NULL) {
ERROR("bind plugin: Cannot find any <view> tags.");
xmlXPathFreeContext(view_path_context);
} /* }}} int bind_xml_stats_search_views */
static void bind_xml_stats_v3(xmlDoc *doc, /* {{{ */
- xmlXPathContext *xpathCtx, xmlNode *statsnode,
- time_t current_time) {
+ xmlXPathContext *xpathCtx, time_t current_time) {
/* XPath: server/counters[@type='opcode']
* Variables: QUERY, IQUERY, NOTIFY, UPDATE, ...
* Layout v3:
} /* }}} bind_xml_stats_v3 */
static void bind_xml_stats_v1_v2(int version, xmlDoc *doc, /* {{{ */
- xmlXPathContext *xpathCtx, xmlNode *statsnode,
+ xmlXPathContext *xpathCtx,
time_t current_time) {
/* XPath: server/requests/opcode, server/counters[@type='opcode']
* Variables: QUERY, IQUERY, NOTIFY, UPDATE, ...
/* TODO: Check `server/boot-time' to recognize server restarts. */
int status = bind_xml_read_timestamp("server/current-time", doc, xpathCtx,
- ¤t_time);
+ ¤t_time);
if (status != 0) {
ERROR("bind plugin: Reading `server/current-time' failed.");
return -1;
DEBUG("bind plugin: Current server time is %i.", (int)current_time);
if (version == 3) {
- bind_xml_stats_v3(doc, xpathCtx, statsnode, current_time);
+ bind_xml_stats_v3(doc, xpathCtx, current_time);
} else {
- bind_xml_stats_v1_v2(version, doc, xpathCtx, statsnode, current_time);
+ bind_xml_stats_v1_v2(version, doc, xpathCtx, current_time);
}
/* XPath: memory/summary
}
if (views_num > 0)
- bind_xml_stats_search_views(version, doc, xpathCtx, statsnode,
- current_time);
+ bind_xml_stats_search_views(version, doc, xpathCtx, current_time);
return 0;
} /* }}} int bind_xml_stats */
// version 3.* of statistics XML (since BIND9.9)
//
- xmlXPathObject *xpathObj = xmlXPathEvalExpression(BAD_CAST "/statistics", xpathCtx);
+ xmlXPathObject *xpathObj =
+ xmlXPathEvalExpression(BAD_CAST "/statistics", xpathCtx);
if (xpathObj == NULL || xpathObj->nodesetval == NULL ||
xpathObj->nodesetval->nodeNr == 0) {
DEBUG("bind plugin: Statistics appears not to be v3");