Lots of changes. In no particular order:
[distributedratelimiting.git] / drl / config.c
index 1c56ce8..65d8eb9 100644 (file)
@@ -105,7 +105,8 @@ static int parse_common(xmlDocPtr doc, xmlNodePtr ident, ident_config *common) {
     xmlChar *branch;
     xmlChar *accounting;
     xmlChar *ewma;
-    xmlChar *intervals;
+    xmlChar *mainloop_intervals;
+    xmlChar *communication_intervals;
     xmlNodePtr fields = ident->children;
     ident_peer *current = NULL;
 
@@ -168,6 +169,8 @@ static int parse_common(xmlDocPtr doc, xmlNodePtr ident, ident_config *common) {
             common->accounting = ACT_SAMPLEHOLD;
         } else if (!xmlStrcmp(accounting, (const xmlChar *) "SIMPLE")) {
             common->accounting = ACT_SIMPLE;
+        } else if (!xmlStrcmp(accounting, (const xmlChar *) "MULTIPLEINTERVAL")) {
+            common->accounting = ACT_MULTIPLE;
         } else {
             printlog(LOG_CRITICAL, "Unknown/invalid accounting table.\n");
             xmlFree(accounting);
@@ -185,13 +188,22 @@ static int parse_common(xmlDocPtr doc, xmlNodePtr ident, ident_config *common) {
         xmlFree(ewma);
     }
 
-    intervals = xmlGetProp(ident, (const xmlChar *) "intervals");
-    if (intervals == NULL) {
-        printlog(LOG_CRITICAL, "Ident missing interval count.\n");
-        return EINVAL;
+    mainloop_intervals = xmlGetProp(ident, (const xmlChar *) "loop_intervals");
+    if (mainloop_intervals == NULL) {
+        printlog(LOG_WARN, "Ident id: %d missing loop_intervals, assuming 1.\n", common->id);
+        common->mainloop_intervals = 1;
+    } else {
+        common->mainloop_intervals = atoi((const char *) mainloop_intervals);
+        xmlFree(mainloop_intervals);
+    }
+
+    communication_intervals = xmlGetProp(ident, (const xmlChar *) "comm_intervals");
+    if (communication_intervals == NULL) {
+        printlog(LOG_WARN, "Ident id: %d missing comm_intervals, assuming 1.\n", common->id);
+        common->communication_intervals = 1;
     } else {
-        common->intervals = atoi((const char *) intervals);
-        xmlFree(intervals);
+        common->communication_intervals = atoi((const char *) communication_intervals);
+        xmlFree(communication_intervals);
     }
 
     while (fields != NULL) {