summaryrefslogtreecommitdiff
path: root/cesar/bsu/beacon
diff options
context:
space:
mode:
authorlaranjeiro2010-07-26 15:43:56 +0000
committerlaranjeiro2010-07-26 15:43:56 +0000
commit90002ead05ae6aa9126cd726e5fc88f9d00fa6c4 (patch)
tree7d772b7ea7a25d485b96bef14d5eac3e1f529cfc /cesar/bsu/beacon
parente7b1bf0ff7517ce30507b267cc771bef39819b8f (diff)
cesar/bsu: fix beacon entry countdown change, closes #1758
Change the behavior of countdown handling for STA and CCo. BSU is now able to loose some central beacons and stay synchronized (nek, snid, hm) with the AVLN is tracks. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7313 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/bsu/beacon')
-rw-r--r--cesar/bsu/beacon/beacon.h20
-rw-r--r--cesar/bsu/beacon/src/beacon.c25
2 files changed, 20 insertions, 25 deletions
diff --git a/cesar/bsu/beacon/beacon.h b/cesar/bsu/beacon/beacon.h
index dedafb3711..df0d038adf 100644
--- a/cesar/bsu/beacon/beacon.h
+++ b/cesar/bsu/beacon/beacon.h
@@ -136,12 +136,6 @@ typedef struct bsu_beacon_t bsu_beacon_t;
/** Schedule description for the AVLN. */
struct bsu_beacon_schedules_t
{
- /** Hybrid mode. */
- mac_coexistence_mode_t hm[BSU_BEACON_SCHEDULES_MAX];
- /** SNID. */
- u8 snid[BSU_BEACON_SCHEDULES_MAX];
- /** NEK switch. */
- uint nek_switch[BSU_BEACON_SCHEDULES_MAX];
/** Network mode. */
bsu_beacon_nm_t nm;
/** Persistent schedule. */
@@ -150,6 +144,12 @@ struct bsu_beacon_schedules_t
bsu_beacon_bmi_non_persistent_schedule_t nps;
/** Beacon period start time offset. */
bsu_beacon_bmi_bpsto_t bpsto;
+ /** SNID change beacon entry. */
+ bsu_beacon_bmi_change_snid_t snid;
+ /** EKS change beacon entry. */
+ bsu_beacon_bmi_eks_t eks;
+ /** Change hybrid mode. */
+ bsu_beacon_bmi_change_hybrid_mode_t hm;
};
typedef struct bsu_beacon_schedules_t bsu_beacon_schedules_t;
@@ -162,6 +162,10 @@ struct bsu_beacon_avln_t
u8 snid;
/** CCo's TEI. */
u8 tei;
+ /** Hybrid mode. */
+ mac_coexistence_mode_t hm;
+ /** NEK switch. */
+ uint nek_switch;
/** Schedule description. */
bsu_beacon_schedules_t schedules;
};
@@ -200,11 +204,13 @@ bsu_beacon_write (bsu_beacon_t *beacon, bsu_beacon_type_t type,
* \param beacon the beacon received from the medium.
* \param schedules schedules structure to store the data.
* \param discover the discover structure to store discover data.
+ * \param hm the coexistence mode the AVLN is currently using.
*/
void
bsu_beacon_read_schedules (pb_beacon_t *beacon,
bsu_beacon_schedules_t *schedules,
- bsu_beacon_bmi_discover_t *discover);
+ bsu_beacon_bmi_discover_t *discover,
+ mac_coexistence_mode_t *hm);
/**
* Read the whole beacon and store the data into the beacon structure.
diff --git a/cesar/bsu/beacon/src/beacon.c b/cesar/bsu/beacon/src/beacon.c
index adadc99070..d1b7256ecd 100644
--- a/cesar/bsu/beacon/src/beacon.c
+++ b/cesar/bsu/beacon/src/beacon.c
@@ -1018,14 +1018,12 @@ bsu_beacon_countdown (bsu_beacon_t *beacon)
void
bsu_beacon_read_schedules (pb_beacon_t *beacon,
bsu_beacon_schedules_t *schedules,
- bsu_beacon_bmi_discover_t *discover)
+ bsu_beacon_bmi_discover_t *discover,
+ mac_coexistence_mode_t *hm)
{
bitstream_t stream;
- uint i, j, nbe, nb_persistent = 0;
+ uint i, nbe, nb_persistent = 0;
bsu_beacon_entry_header_t header;
- bsu_beacon_bmi_change_snid_t snid;
- bsu_beacon_bmi_eks_t eks;
- bsu_beacon_bmi_change_hybrid_mode_t hm;
uint length;
dbg_assert (beacon);
dbg_assert (schedules);
@@ -1033,7 +1031,7 @@ bsu_beacon_read_schedules (pb_beacon_t *beacon,
bitstream_read_init (&stream, beacon->data, BSU_BEACON_SIZE);
/* Skip the NID. */
bitstream_skip (&stream, 22);
- schedules->hm[0] = bitstream_read (&stream, 2);
+ *hm = bitstream_read (&stream, 2);
/* Skip the variant fields until network mode. */
bitstream_skip (&stream, 32);
schedules->nm = bitstream_read (&stream, 2);
@@ -1060,22 +1058,13 @@ bsu_beacon_read_schedules (pb_beacon_t *beacon,
bsu_beacon_read_bmi_bpsto (&stream, &schedules->bpsto);
break;
case BSU_BEACON_ENTRY_HEADER_ENCRYPTION_KEY_CHANGE:
- bsu_beacon_read_bmi_eks (&stream, &eks);
- if (eks.kbc == BSU_BEACON_EKS_KBC_NEK)
- {
- for (j = eks.kccd; j < COUNT (schedules->nek_switch); j++)
- schedules->nek_switch [j] = eks.new_eks;
- }
+ bsu_beacon_read_bmi_eks (&stream, &schedules->eks);
break;
case BSU_BEACON_ENTRY_HEADER_CHANGE_SNID:
- bsu_beacon_read_bmi_change_snid (&stream, &snid);
- for (j = snid.snidccd; j < COUNT (schedules->snid); j++)
- schedules->snid [j] = snid.new_snid;
+ bsu_beacon_read_bmi_change_snid (&stream, &schedules->snid);
break;
case BSU_BEACON_ENTRY_HEADER_CHANGE_HM:
- bsu_beacon_read_bmi_change_hm (&stream, &hm);
- for (j = hm.hmccd; j < COUNT (schedules->hm); j++)
- schedules->hm[j] = hm.newhm;
+ bsu_beacon_read_bmi_change_hm (&stream, &schedules->hm);
break;
case BSU_BEACON_ENTRY_HEADER_DISCOVER:
bsu_beacon_read_bmi_discover (&stream, discover);