summaryrefslogtreecommitdiff
path: root/cesar/mac/common/src/store.c
diff options
context:
space:
mode:
authorNicolas Schodet2012-08-27 13:08:04 +0200
committerNicolas Schodet2012-08-27 13:08:04 +0200
commit45494a752e1d2281a1dc136ae4890128817d8cd0 (patch)
tree0cc89f1a69e7a5c340906da597460b317ad721b0 /cesar/mac/common/src/store.c
parent6a4e75cafcb754f8bd11fa8be5d69ab028ce014c (diff)
parent5c37d533c836ce90df9c67b546947fe2200baa2b (diff)
Merge branch 'qos'
Diffstat (limited to 'cesar/mac/common/src/store.c')
-rw-r--r--cesar/mac/common/src/store.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/cesar/mac/common/src/store.c b/cesar/mac/common/src/store.c
index 3675434634..2c1a0a6ad4 100644
--- a/cesar/mac/common/src/store.c
+++ b/cesar/mac/common/src/store.c
@@ -500,6 +500,93 @@ mac_store_mfs_travel_by_tei (mac_store_t *ctx, uint tei,
}
}
+void
+mac_store_mfs_travel_locked (mac_store_t *ctx, mac_store_travel_t travel,
+ void *user)
+{
+ uint i;
+ dbg_assert (ctx);
+ dbg_assert (travel);
+ /* First travel local MFS. */
+ for (i = 0; i < MAC_PLID_NB; i++)
+ {
+ if (ctx->bcast_tx_plid[i])
+ travel (ctx, ctx->bcast_tx_plid[i], user);
+ }
+ if (ctx->bcast_tx_mme)
+ {
+ if (ctx->bcast_tx_mme)
+ travel (ctx, ctx->bcast_tx_mme, user);
+ }
+ for (i = MAC_LLID_MIN; i <= ctx->tx_llid_max; i++)
+ {
+ if (ctx->lglid[i])
+ travel (ctx, ctx->lglid[i], user);
+ }
+ for (i = MAC_GLID_MIN; i <= ctx->glid_max; i++)
+ {
+ if (ctx->lglid[i])
+ travel (ctx, ctx->lglid[i], user);
+ }
+ /* Then unassociated MFS. */
+ list_node_t *u, *uend, *unext;
+ uend = list_end (&ctx->unassociated);
+ for (u = list_begin (&ctx->unassociated); u != uend; u = unext)
+ {
+ unext = list_next (u);
+ travel (ctx, PARENT_OF (mfs_t, common.store_unassociated_link, u),
+ user);
+ }
+ /* Do not forget beacon MFS. */
+ if (ctx->lglid[MAC_LID_DISCOVER])
+ travel (ctx, ctx->lglid[MAC_LID_DISCOVER], user);
+ if (ctx->lglid[MAC_LID_SPC_CENTRAL])
+ travel (ctx, ctx->lglid[MAC_LID_SPC_CENTRAL], user);
+ /* Now travel by TEI. */
+ for (i = MAC_TEI_STA_MIN; i <= MAC_TEI_STA_MAX; i++)
+ if (ctx->sta[i])
+ mac_store_mfs_travel_by_tei_locked (ctx, i, travel, user);
+}
+
+void
+mac_store_mfs_travel_by_tei_locked (mac_store_t *ctx, uint tei,
+ mac_store_travel_t travel, void *user)
+{
+ uint i, j;
+ mac_store_sta_t *sta;
+ dbg_assert (ctx);
+ dbg_assert (MAC_TEI_IS_STA (tei));
+ dbg_assert (travel);
+ sta = ctx->sta[tei];
+ if (sta)
+ {
+ /* Travel MFS. */
+ for (i = 0; i < MAC_STORE_KIND_STA_NB; i++)
+ {
+ for (j = 0; j < MAC_PLID_NB; j++)
+ {
+ if (sta->plid[i][j])
+ travel (ctx, sta->plid[i][j], user);
+ }
+ if (sta->mme[i])
+ travel (ctx, sta->mme[i], user);
+ }
+ if (sta->rx_llid)
+ {
+ mfs_t **rx_llid;
+ rx_llid = sta->rx_llid;
+ if (rx_llid)
+ {
+ for (i = MAC_LLID_MIN; i <= sta->rx_llid_max; i++)
+ {
+ if (rx_llid[i])
+ travel (ctx, rx_llid[i], user);
+ }
+ }
+ }
+ }
+}
+
sta_t *
mac_store_sta_get_ (mac_store_t *ctx, uint tei __FL)
{