X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drl%2Fconfig.c;h=86d1ec4e023baa74a2bd68f989aa5ec4f336772b;hb=8675c0b77ad3e361f4255ce61881a79061c5238d;hp=d9d9ede441815d09b7d8d0356bfe5d1059c9e039;hpb=c9d6255f0c06ee41eb2c06a5f74a957ec7be3223;p=distributedratelimiting.git diff --git a/drl/config.c b/drl/config.c index d9d9ede..86d1ec4 100644 --- a/drl/config.c +++ b/drl/config.c @@ -113,11 +113,15 @@ static int parse_common(xmlDocPtr doc, xmlNodePtr ident, ident_config *common) { xmlChar *mainloop_intervals; xmlChar *communication_intervals; xmlChar *independent; + xmlChar *htb_node; + xmlChar *htb_parent; xmlNodePtr fields = ident->children; ident_peer *current = NULL; /* The struct has been memsetted to 0, this is just to be safe. */ +#ifdef BUILD_ZOOKEEPER common->zk_host = NULL; +#endif common->peers = NULL; common->members = NULL; common->next = NULL; @@ -266,6 +270,21 @@ static int parse_common(xmlDocPtr doc, xmlNodePtr ident, ident_config *common) { xmlFree(independent); } + htb_node = xmlGetProp(ident, (const xmlChar *) "htb_node"); + htb_parent = xmlGetProp(ident, (const xmlChar *) "htb_parent"); + if (htb_node == NULL) { + common->htb_node = -1; + } else { + sscanf((const char *)htb_node, "%x", &common->htb_node); + xmlFree(htb_node); + } + if (htb_parent == NULL) { + common->htb_parent = -1; + } else { + sscanf((const char *)htb_parent, "%x", &common->htb_parent); + xmlFree(htb_parent); + } + while (fields != NULL) { if((!xmlStrcmp(fields->name, (const xmlChar *) "peer"))) { xmlChar *ip = xmlNodeListGetString(doc, fields->children, 1); @@ -294,11 +313,12 @@ static int parse_common(xmlDocPtr doc, xmlNodePtr ident, ident_config *common) { } else if ((!xmlStrcmp(fields->name, (const xmlChar *) "zkhost"))) { xmlChar *host = xmlNodeListGetString(doc, fields->children, 1); +#ifdef BUILD_ZOOKEEPER common->zk_host = strdup((const char *) host); if (common->zk_host == NULL) { return ENOMEM; } - +#endif xmlFree(host); } fields = fields->next; @@ -309,11 +329,12 @@ static int parse_common(xmlDocPtr doc, xmlNodePtr ident, ident_config *common) { return EINVAL; } +#ifdef BUILD_ZOOKEEPER if (common->membership == ZOOKEEPER && common->zk_host == NULL) { printlog(LOG_CRITICAL, "Group membership protocol ZOOKEEPER requires a zkhost field.\n"); return EINVAL; } - +#endif /* No errors. */ return 0; }