PUD: add gateway hysteresis configuration parameters
authorFerry Huberts <ferry.huberts@pelagic.nl>
Mon, 12 Mar 2012 09:09:58 +0000 (10:09 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 14 Mar 2012 13:28:43 +0000 (14:28 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/doc/olsrd.conf.default.pud
lib/pud/src/configuration.c
lib/pud/src/configuration.h
lib/pud/src/pudOlsrdPlugin.h

index be0d872..b55e0f5 100644 (file)
@@ -714,6 +714,24 @@ LoadPlugin "./lib/pud/olsrd_pud.so.1.1.0"
     #
     #PlParam     "hysteresisCountToMoving"      "5"
 
+    # gatewayHysteresisCountToStationary is the number of times the gateway
+    #                             must be the same that effectuate a state transition from
+    #                             moving to stationary that must be received
+    #                             before the actual transition is taken
+    #
+    # Default: 17
+    #
+    #PlParam     "gatewayHysteresisCountToStationary"  "17"
+
+    # gatewayHysteresisCountToMoving is the number of gateway updates that
+    #                         effectuate a state transition from stationary to
+    #                         moving that must be received before the actual
+    #                         transition is taken
+    #
+    # Default: 5
+    #
+    #PlParam     "gatewayHysteresisCountToMoving"      "5"
+
 
     #
     # Other Plugin Parameters
index 30c183d..bc65f2d 100644 (file)
@@ -1972,6 +1972,96 @@ int setHysteresisCountToMoving(const char *value, void *data __attribute__ ((unu
 }
 
 /*
+ * gatewayHysteresisCountToStationary
+ */
+
+/** The hysteresis count for changing state from moving to stationary */
+static unsigned long long gatewayHysteresisCountToStationary = PUD_GAT_HYSTERESIS_COUNT_2STAT_DEFAULT;
+
+/**
+ @return
+ The hysteresis count for changing state from moving to stationary
+ */
+unsigned long long getGatewayHysteresisCountToStationary(void) {
+       return gatewayHysteresisCountToStationary;
+}
+
+/**
+ Set hysteresis count plugin parameter
+
+ @param value
+ The hysteresis count plugin parameter
+ @param data
+ Unused
+ @param addon
+ Unused
+
+ @return
+ - true when an error is detected
+ - false otherwise
+ */
+int setGatewayHysteresisCountToStationary(const char *value, void *data __attribute__ ((unused)),
+               set_plugin_parameter_addon addon __attribute__ ((unused))) {
+       static const char * valueName = PUD_GAT_HYSTERESIS_COUNT_2STAT_NAME;
+       unsigned long long hysteresisCountNew;
+
+       assert (value != NULL);
+
+       if (!readULL(valueName, value, &hysteresisCountNew)) {
+               return true;
+       }
+
+       gatewayHysteresisCountToStationary = hysteresisCountNew;
+
+       return false;
+}
+
+/*
+ * gatewayHysteresisCountToMoving
+ */
+
+/** The hysteresis count for changing state from stationary to moving */
+static unsigned long long gatewayHysteresisCountToMoving = PUD_GAT_HYSTERESIS_COUNT_2MOV_DEFAULT;
+
+/**
+ @return
+ The hysteresis count for changing state from stationary to moving
+ */
+unsigned long long getGatewayHysteresisCountToMoving(void) {
+       return gatewayHysteresisCountToMoving;
+}
+
+/**
+ Set hysteresis count plugin parameter
+
+ @param value
+ The hysteresis count plugin parameter
+ @param data
+ Unused
+ @param addon
+ Unused
+
+ @return
+ - true when an error is detected
+ - false otherwise
+ */
+int setGatewayHysteresisCountToMoving(const char *value, void *data __attribute__ ((unused)),
+               set_plugin_parameter_addon addon __attribute__ ((unused))) {
+       static const char * valueName = PUD_GAT_HYSTERESIS_COUNT_2MOV_NAME;
+       unsigned long long hysteresisCountNew;
+
+       assert (value != NULL);
+
+       if (!readULL(valueName, value, &hysteresisCountNew)) {
+               return true;
+       }
+
+       gatewayHysteresisCountToMoving = hysteresisCountNew;
+
+       return false;
+}
+
+/*
  * useDeDup
  */
 
index 9524add..bc17d2f 100644 (file)
@@ -316,6 +316,26 @@ unsigned long long getHysteresisCountToMoving(void);
 int setHysteresisCountToMoving(const char *value, void *data,
                set_plugin_parameter_addon addon);
 
+/** The name of the hysteresis count to stationary plugin parameter */
+#define PUD_GAT_HYSTERESIS_COUNT_2STAT_NAME                    "gatewayHysteresisCountToStationary"
+
+/** The default value of the hysteresis count to stationary plugin parameter */
+#define PUD_GAT_HYSTERESIS_COUNT_2STAT_DEFAULT         17
+
+unsigned long long getGatewayHysteresisCountToStationary(void);
+int setGatewayHysteresisCountToStationary(const char *value, void *data,
+               set_plugin_parameter_addon addon);
+
+/** The name of the hysteresis count to moving plugin parameter */
+#define PUD_GAT_HYSTERESIS_COUNT_2MOV_NAME                     "GatewayHysteresisCountToMoving"
+
+/** The default value of the hysteresis count to moving plugin parameter */
+#define PUD_GAT_HYSTERESIS_COUNT_2MOV_DEFAULT          5
+
+unsigned long long getGatewayHysteresisCountToMoving(void);
+int setGatewayHysteresisCountToMoving(const char *value, void *data,
+               set_plugin_parameter_addon addon);
+
 /*
  * Other Plugin Settings
  */
index e6a262a..0e8304d 100644 (file)
@@ -56,6 +56,8 @@ static const struct olsrd_plugin_parameters plugin_parameters[] = {
        {       .name = PUD_DOP_MULTIPLIER_NAME, .set_plugin_parameter = &setDopMultiplier, .data = NULL},
        {       .name = PUD_HYSTERESIS_COUNT_2STAT_NAME, .set_plugin_parameter = &setHysteresisCountToStationary, .data = NULL},
        {       .name = PUD_HYSTERESIS_COUNT_2MOV_NAME, .set_plugin_parameter = &setHysteresisCountToMoving, .data = NULL},
+       {       .name = PUD_GAT_HYSTERESIS_COUNT_2STAT_NAME, .set_plugin_parameter = &setGatewayHysteresisCountToStationary, .data = NULL},
+       {       .name = PUD_GAT_HYSTERESIS_COUNT_2MOV_NAME, .set_plugin_parameter = &setGatewayHysteresisCountToMoving, .data = NULL},
 
        /* DEFAULTS */
        {       .name = PUD_DEFAULT_HDOP_NAME, .set_plugin_parameter = &setDefaultHdop, .data = NULL},