summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNélio Laranjeiro2011-04-15 16:46:45 +0200
committerNélio Laranjeiro2011-04-20 18:05:53 +0200
commit75222b5d11f8e99859b976834ea4ac223a5393c8 (patch)
treecd9b04abb07d89c064d48a067778a13e09287f16
parent1b04860048fd7cb6a56bdb969558a9509785d255 (diff)
cesar/cp/sta/mgr: change last_seen_ms to expired_date_ms, refs #2196
This renames last_seen_ms of cp_sta_t to expired_date_ms. This date is the date of last Beacon/MME reception from the station + Discovered_List_Expire_Time.
-rw-r--r--cesar/common/defs/homeplugAV.h3
-rw-r--r--cesar/cp/defs.h3
-rw-r--r--cesar/cp/sta/mgr/doc/sta_mgr.xmi2
-rw-r--r--cesar/cp/sta/mgr/src/net.c8
-rw-r--r--cesar/cp/sta/mgr/src/sta_mgr.c3
-rw-r--r--cesar/cp/sta/mgr/sta.h6
-rw-r--r--cesar/cp/sta/mgr/test/src/sta_mgr.c19
-rw-r--r--cesar/maximus/python/lib/cesar/sta_mgr.py4
-rw-r--r--cesar/test_general/station/fcall/src/sta_mgr.c8
9 files changed, 25 insertions, 31 deletions
diff --git a/cesar/common/defs/homeplugAV.h b/cesar/common/defs/homeplugAV.h
index ef15f43cb5..0a06f7da7c 100644
--- a/cesar/common/defs/homeplugAV.h
+++ b/cesar/common/defs/homeplugAV.h
@@ -102,4 +102,7 @@ typedef enum hpav_access_t hpav_access_t;
/** SNID bound value (bound value is excluded). */
#define HPAV_SNID_NB 16
+/** Discovered_List_Expire_Time */
+#define HPAV_DISCOVERED_LIST_EXPIRE_TIME_MS 180000
+
#endif /* common_defs_homeplugAV_h */
diff --git a/cesar/cp/defs.h b/cesar/cp/defs.h
index 8e94fc878e..f6ee325939 100644
--- a/cesar/cp/defs.h
+++ b/cesar/cp/defs.h
@@ -83,9 +83,6 @@
/** Hash key size. */
#define CP_HASH_KEY_SIZE 384
-/** Expiration delay for the station in seconds. */
-#define CP_STA_EXPIRATION_DELAY_S 60
-
/** Expiration delay for the networks. */
#define CP_NET_EXPIRATION_DELAY_S 70
diff --git a/cesar/cp/sta/mgr/doc/sta_mgr.xmi b/cesar/cp/sta/mgr/doc/sta_mgr.xmi
index 000727a5bc..6454d31635 100644
--- a/cesar/cp/sta/mgr/doc/sta_mgr.xmi
+++ b/cesar/cp/sta/mgr/doc/sta_mgr.xmi
@@ -460,7 +460,7 @@ If no station found, NULL value returned." isSpecification="false" isLeaf="false
<UML:Attribute comment="Indicate the state of the station." isSpecification="false" visibility="private" xmi.id="njbBHkqZRmmB" type="pBzpcllJMdsq" name="station_state" />
<UML:Attribute comment="The network whithin the station is associatied." isSpecification="false" visibility="private" xmi.id="30115" type="TRzc3eNXqLr1" name="net" />
<UML:Attribute comment="Indicate if the station is Backup CCo." isSpecification="false" visibility="public" xmi.id="15VSrGbyiZbv" type="BsXuVmQldfSS" name="is_backup_cco" />
- <UML:Attribute comment="Last date seen in the AVLN." isSpecification="false" visibility="public" xmi.id="7SdojrmkwHBl" type="oZHHg64PKBaq" name="last_seen_ms" />
+ <UML:Attribute comment="Date at the one the station is evicted from the AVLN." isSpecification="false" visibility="public" xmi.id="7SdojrmkwHBl" type="oZHHg64PKBaq" name="expired_date_ms" />
<UML:Attribute comment="The Reassembly context for the cl_interf." isSpecification="false" visibility="public" xmi.id="61vH7gnD8O1s" type="RTeIWtKTDaZV" name="reassembly_ctx" />
<UML:Attribute comment="The tei expiration date." isSpecification="false" visibility="public" xmi.id="O3jgPKW1znfn" type="oZHHg64PKBaq" name="tei_lease_ms" />
<UML:Attribute comment="The station CCo capability." isSpecification="false" visibility="public" xmi.id="uZ2PRCIQqOal" type="nnvOyvzkSE17" name="cco_cap" />
diff --git a/cesar/cp/sta/mgr/src/net.c b/cesar/cp/sta/mgr/src/net.c
index 1c0bd279e0..a2480423de 100644
--- a/cesar/cp/sta/mgr/src/net.c
+++ b/cesar/cp/sta/mgr/src/net.c
@@ -108,14 +108,8 @@ cp_net_garbage_station_list (cp_t *ctx, cp_net_t *net, u32 date_ms,
{
slab_addref (sta);
sta_next = cp_net_sta_get_next (ctx, net, sta);
-
- if (less_mod2p32(sta->last_seen_ms
- + MAC_SEC_TO_MS(CP_STA_EXPIRATION_DELAY_S),
- date_ms))
- {
+ if (less_mod2p32(sta->expired_date_ms, date_ms))
cp_sta_mgr_sta_remove (ctx, sta);
- }
-
slab_release (sta);
}
}
diff --git a/cesar/cp/sta/mgr/src/sta_mgr.c b/cesar/cp/sta/mgr/src/sta_mgr.c
index 5b5142599f..241eaea5a2 100644
--- a/cesar/cp/sta/mgr/src/sta_mgr.c
+++ b/cesar/cp/sta/mgr/src/sta_mgr.c
@@ -719,7 +719,8 @@ cp_sta_mgr_sta_add (cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address)
}
}
/* Update the last seen value. */
- sta->last_seen_ms = cp_sta_core_get_date_ms (ctx);
+ sta->expired_date_ms = cp_sta_core_get_date_ms (ctx)
+ + HPAV_DISCOVERED_LIST_EXPIRE_TIME_MS;
return sta;
}
diff --git a/cesar/cp/sta/mgr/sta.h b/cesar/cp/sta/mgr/sta.h
index ffdc8fc5b9..648db088ea 100644
--- a/cesar/cp/sta/mgr/sta.h
+++ b/cesar/cp/sta/mgr/sta.h
@@ -68,9 +68,11 @@ struct cp_sta_t
bool is_backup_cco;
/**
- * Last date seen in the AVLN.
+ * The date in ms at the one the station is considered removed from the
+ * AVLN. This is adjusted each time a beacon or a MME is received from
+ * this STA.
*/
- uint last_seen_ms;
+ u32 expired_date_ms;
/**
* The Reassembly context for the cl_interf.
diff --git a/cesar/cp/sta/mgr/test/src/sta_mgr.c b/cesar/cp/sta/mgr/test/src/sta_mgr.c
index f9ed17c66b..458f5c46c4 100644
--- a/cesar/cp/sta/mgr/test/src/sta_mgr.c
+++ b/cesar/cp/sta/mgr/test/src/sta_mgr.c
@@ -656,23 +656,20 @@ test_case__cp_sta_manager_garbage (test_t test)
for (i = 0; i < 10; i++)
{
sta = cp_sta_mgr_sta_add (&cp, net1, i + 1, i + 1);
- sta->last_seen_ms = cp_sta_core_get_date_ms (&cp)
- - MAC_SEC_TO_MS(CP_STA_EXPIRATION_DELAY_S) ;
+ sta->expired_date_ms = cp_sta_core_get_date_ms (&cp)
+ - HPAV_DISCOVERED_LIST_EXPIRE_TIME_MS;
slab_release (sta);
sta = cp_sta_mgr_sta_add (&cp, net2, i + 1, (i + 1) * 20);
- sta->last_seen_ms = cp_sta_core_get_date_ms (&cp)
- - MAC_SEC_TO_MS(CP_STA_EXPIRATION_DELAY_S) ;
+ sta->expired_date_ms = cp_sta_core_get_date_ms (&cp)
+ - HPAV_DISCOVERED_LIST_EXPIRE_TIME_MS;
slab_release (sta);
}
/* Release the stations. */
cp_sta_mgr_garbage (&cp);
- test_fail_if (set_empty (&net1->associated_stas));
- test_fail_if (set_empty (&net2->associated_stas));
- test_fail_if (set_empty(&cp.sta_mgr.stas));
-
- test_sta_mgr_uninit (&cp);
+ test_fail_unless (cp_sta_mgr_net_list_is_empty (&cp));
+ cp_sta_mgr_uninit (&cp);
}
test_end;
@@ -739,8 +736,8 @@ test_case__cp_sta_manager_garbage (test_t test)
net = cp_sta_mgr_add_avln (&cp, 1, 1);
/* Add some stations in the first AVLN. */
sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
- sta->last_seen_ms = cp_sta_core_get_date_ms (&cp)
- - MAC_SEC_TO_MS(CP_STA_EXPIRATION_DELAY_S) - 10;
+ sta->expired_date_ms = cp_sta_core_get_date_ms (&cp)
+ - HPAV_DISCOVERED_LIST_EXPIRE_TIME_MS - 10;
slab_release (sta);
/* Set our AVLN. */
cp_sta_mgr_set_our_avln (&cp, net);
diff --git a/cesar/maximus/python/lib/cesar/sta_mgr.py b/cesar/maximus/python/lib/cesar/sta_mgr.py
index 966a10d64c..99071a3275 100644
--- a/cesar/maximus/python/lib/cesar/sta_mgr.py
+++ b/cesar/maximus/python/lib/cesar/sta_mgr.py
@@ -7,7 +7,7 @@ from maximus import *
class Sta_mgr:
def __init__(self):
self.is_backup_cco = 0
- self.last_seen_ms = 0
+ self.expired_date_ms = 0
self.tei_lease_ms = 0
self.cco_cap = 0
self.pco_cap = 0
@@ -26,7 +26,7 @@ class Sta_mgr:
fcall.send()
self.is_backup_cco = fcall.bind_param_ushort ("is_backup_cco")
- self.last_seen_ms = fcall.bind_param_ulong ("last_seen_ms")
+ self.expired_date_ms = fcall.bind_param_ulong ("expired_date_ms")
self.tei_lease_ms = fcall.bind_param_ulong ("tei_lease_ms")
self.cco_cap = fcall.bind_param_ushort ("cco_cap")
self.pco_cap = fcall.bind_param_ushort ("pco_cap")
diff --git a/cesar/test_general/station/fcall/src/sta_mgr.c b/cesar/test_general/station/fcall/src/sta_mgr.c
index e4b35927bd..8078ea479e 100644
--- a/cesar/test_general/station/fcall/src/sta_mgr.c
+++ b/cesar/test_general/station/fcall/src/sta_mgr.c
@@ -32,7 +32,7 @@ fc_sta_mgr_get_unassoc_sta (fcall_ctx_t *fcall, fcall_param_t **param,
cesar_t *cesar = data;
uint is_backup_cco;
- uint last_seen_ms;
+ u32 expired_date_ms;
uint tei_lease_ms;
uint cco_cap;
uint pco_cap;
@@ -57,7 +57,7 @@ fc_sta_mgr_get_unassoc_sta (fcall_ctx_t *fcall, fcall_param_t **param,
return false;
is_backup_cco = sta->is_backup_cco;
- last_seen_ms = sta->last_seen_ms;
+ expired_data_ms = sta->expired_date_ms;
tei_lease_ms = sta->tei_lease_date_ms;
cco_cap = sta->cco_cap;
pco_cap = sta->pco_cap;
@@ -71,8 +71,8 @@ fc_sta_mgr_get_unassoc_sta (fcall_ctx_t *fcall, fcall_param_t **param,
fcall_param_add_short (*param, *msg, "is_backup_cco", &is_backup_cco);
- fcall_param_add (*param, *msg, "last_seen_ms", sizeof(last_seen_ms),
- &last_seen_ms);
+ fcall_param_add (*param, *msg, "expired_date_ms", sizeof(expired_date_ms),
+ &expired_date_ms);
fcall_param_add (*param, *msg, "tei_lease_ms", sizeof (tei_lease_ms),
&tei_lease_ms);
fcall_param_add_short (*param, *msg, "cco_cap", &cco_cap);