summaryrefslogtreecommitdiff
path: root/cesar/mac/common
diff options
context:
space:
mode:
authorNicolas Schodet2010-09-01 17:58:44 +0200
committerNicolas Schodet2010-09-02 09:11:57 +0200
commite012bc39c486eb41632cb81fa2ebe7e6e126bcce (patch)
treeecb0ae56057827a17bf2408a5166feb40dc35725 /cesar/mac/common
parent58b711fbb2943b0b83e9088a2b1fb6ca6108a5ea (diff)
cesar/mac: add beacon LID test, refs #1848
Diffstat (limited to 'cesar/mac/common')
-rw-r--r--cesar/mac/common/defs.h5
-rw-r--r--cesar/mac/common/src/mfs.c3
-rw-r--r--cesar/mac/common/src/store.c6
3 files changed, 8 insertions, 6 deletions
diff --git a/cesar/mac/common/defs.h b/cesar/mac/common/defs.h
index d606fd7a33..2e4c12a3eb 100644
--- a/cesar/mac/common/defs.h
+++ b/cesar/mac/common/defs.h
@@ -73,6 +73,11 @@ enum mac_lid_t
* \warning This is a macro, the argument may be evaluated several time. */
#define MAC_LID_IS_XLID(lid) ((lid) < MAC_LID_NB)
+/** Test if a LID is a beacon LID (vendor specific LID).
+ * \warning This is a macro, the argument may be evaluated several time. */
+#define MAC_LID_IS_BEACON(lid) ((lid) >= MAC_LID_BEACON_MIN \
+ && (lid) <= MAC_LID_BEACON_MAX)
+
/** Terminal Equipment Identifier. */
enum mac_tei_t
{
diff --git a/cesar/mac/common/src/mfs.c b/cesar/mac/common/src/mfs.c
index 44107d8f5c..a684e8949e 100644
--- a/cesar/mac/common/src/mfs.c
+++ b/cesar/mac/common/src/mfs.c
@@ -74,8 +74,7 @@ mfs_tx_init (mfs_tx_t *mfs, bool bcast, bool mme, uint lid, uint tei)
dbg_assert_ptr (mfs);
dbg_assert ((mme && lid == MAC_LID_NONE)
|| (!mme && (MAC_LID_IS_XLID (lid)
- || lid == MAC_LID_SPC_CENTRAL
- || lid == MAC_LID_DISCOVER)));
+ || MAC_LID_IS_BEACON (lid))));
dbg_assert ((bcast && tei == MAC_TEI_BCAST)
|| (!bcast && MAC_TEI_IS_STA (tei))
|| (!bcast && mme && tei == MAC_TEI_UNASSOCIATED));
diff --git a/cesar/mac/common/src/store.c b/cesar/mac/common/src/store.c
index aeff48d438..9ed93a6157 100644
--- a/cesar/mac/common/src/store.c
+++ b/cesar/mac/common/src/store.c
@@ -119,11 +119,9 @@ mac_store_mfs_slot_get (mac_store_t *ctx, bool tx, bool bcast, bool mme,
dbg_assert (ctx);
dbg_blame ((mme && lid == MAC_LID_NONE)
|| (!mme && (MAC_LID_IS_XLID (lid)
- || lid == MAC_LID_DISCOVER
- || lid == MAC_LID_SPC_CENTRAL)));
+ || MAC_LID_IS_BEACON (lid))));
dbg_blame (((MAC_LID_IS_GLID (lid) /* Needed when tei is unknown. */
- || lid == MAC_LID_DISCOVER
- || lid == MAC_LID_SPC_CENTRAL) && tei == 0)
+ || MAC_LID_IS_BEACON (lid)) && tei == 0)
|| (bcast && tx && tei == MAC_TEI_BCAST)
|| (!(bcast && tx) && MAC_TEI_IS_STA (tei)));
if (!mme && (lid >= MAC_GLID_MIN))