summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaranjeiro2010-05-17 10:07:57 +0000
committerlaranjeiro2010-05-17 10:07:57 +0000
commite439be08edd46711ed6a2c738c87baac9d09d1f0 (patch)
tree9cc72cab65b385245170324d2ee50b6cdcd2e391
parenteeffd1e258bfb61d9cf8f0b4e7640b1ba65341a6 (diff)
cesar/bsu/beacon: order the bmis as requested by the specification
fix unit tests git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7080 017c9cb6-072f-447c-8318-d5b54f68fe89
-rw-r--r--cesar/bsu/beacon/src/beacon.c13
-rw-r--r--cesar/bsu/beacon/test/utest/src/beacon.c3
-rw-r--r--cesar/bsu/beacon/test/utest/src/test.c6
3 files changed, 13 insertions, 9 deletions
diff --git a/cesar/bsu/beacon/src/beacon.c b/cesar/bsu/beacon/src/beacon.c
index 09abec47d3..eae58a00a1 100644
--- a/cesar/bsu/beacon/src/beacon.c
+++ b/cesar/bsu/beacon/src/beacon.c
@@ -441,8 +441,7 @@ bsu_beacon_write_nbe_nb (bsu_beacon_t *beacon, bsu_beacon_type_t type,
nbe++;
if (beacon->bmis.bpsto.present)
nbe++;
- if (beacon->bmis.discover_info.present
- && type == BSU_BEACON_TYPE_DISCOVER)
+ if (beacon->bmis.discover_info.present)
nbe++;
if (beacon->bmis.eks.present)
nbe++;
@@ -482,16 +481,18 @@ bsu_beacon_write (bsu_beacon_t *beacon, bsu_beacon_type_t type,
uint nbe = bsu_beacon_write_nbe_nb (beacon, type, mac_config);
dbg_assert (nbe);
bitstream_write (&stream, nbe, 8);
- bsu_beacon_write_bmi_region (&stream, &beacon->bmis.region);
bsu_beacon_write_bmi_non_persistent (&stream, &beacon->bmis.nps,
pbbeacon->data);
bsu_beacon_write_bmi_persistent (&stream, &beacon->bmis.ps,
pbbeacon->data);
- offset = bsu_beacon_write_bmi_bpsto (&stream,
- &beacon->bmis.bpsto);
+ bsu_beacon_write_bmi_region (&stream, &beacon->bmis.region);
+ bsu_beacon_write_bmi_mac_address (&stream, mac_config,
+ &beacon->bmis.mac_address_present);
bsu_beacon_write_bmi_discover (&stream, &beacon->bmis.discover);
bsu_beacon_write_bmi_discover_info (&stream,
&beacon->bmis.discover_info);
+ offset = bsu_beacon_write_bmi_bpsto (&stream,
+ &beacon->bmis.bpsto);
bsu_beacon_write_bmi_eks (&stream, &beacon->bmis.eks);
bsu_beacon_write_bmi_handover (&stream, &beacon->bmis.handover);
bsu_beacon_write_bmi_relocation (&stream,
@@ -503,8 +504,6 @@ bsu_beacon_write (bsu_beacon_t *beacon, bsu_beacon_type_t type,
&beacon->bmis.change_hm);
bsu_beacon_write_bmi_change_snid (&stream,
&beacon->bmis.change_snid);
- bsu_beacon_write_bmi_mac_address (&stream, mac_config,
- &beacon->bmis.mac_address_present);
bitstream_finalise (&stream);
params->bpsto = pbbeacon->data + offset;
return pbbeacon;
diff --git a/cesar/bsu/beacon/test/utest/src/beacon.c b/cesar/bsu/beacon/test/utest/src/beacon.c
index fbe930949f..61e39dad50 100644
--- a/cesar/bsu/beacon/test/utest/src/beacon.c
+++ b/cesar/bsu/beacon/test/utest/src/beacon.c
@@ -207,6 +207,7 @@ test_case_beacon_variant_fields_error (test_t test)
test_mac_config_init (&mac_config);
/* Change network mode type. */
bsu_beacon_test_create_beacon (&beacon);
+ beacon.bmis.bpsto.present = false;
beacon.vf.nm = BSU_BEACON_NM_NB;
phy_beacon = bsu_beacon_write (&beacon, BSU_BEACON_TYPE_CENTRAL,
&mac_config, &params);
@@ -278,7 +279,7 @@ test_case_beacon_bmi_vendor_bentry (test_t test)
memset (&beacon, 0, sizeof (bsu_beacon_t));
returned = bsu_beacon_read (phy_beacon, &beacon, &type, &tei,
&mac_addr);
- test_fail_unless (returned == false);
+ test_fail_unless (returned == true);
blk_release_desc ((blk_t*) phy_beacon);
}
test_end;
diff --git a/cesar/bsu/beacon/test/utest/src/test.c b/cesar/bsu/beacon/test/utest/src/test.c
index 8d1f488696..07c19691da 100644
--- a/cesar/bsu/beacon/test/utest/src/test.c
+++ b/cesar/bsu/beacon/test/utest/src/test.c
@@ -80,7 +80,7 @@ bsu_beacon_test_create_beacon (bsu_beacon_t *beacon)
beacon->vf.aclsss = true;
beacon->vf.hoip = false;
beacon->vf.rtsbf = false;
- beacon->vf.nm = false;
+ beacon->vf.nm = BSU_BEACON_NM_CSMA_ONLY;
beacon->vf.ccocap = 0;
beacon->vf.rsvd = 0;
/* Regions. */
@@ -224,6 +224,8 @@ bsu_beacon_test_beacon_check_generation (test_t t,
nb_nsai++;
test_fail_unless (bitstream_read (&stream, 12) ==
beacon->bmis.nps.sais[i].end_time_atu);
+ if (!beacon->bmis.nps.sais[i].stpf)
+ bitstream_skip (&stream, 4);
}
test_fail_unless (length ==
BSU_BEACON_ENTRY_SIZE_NON_PERSISTENT_SCHED
@@ -256,6 +258,8 @@ bsu_beacon_test_beacon_check_generation (test_t t,
nb_nsai++;
test_fail_unless (bitstream_read (&stream, 12) ==
beacon->bmis.ps.ps[nb_ps].sais[i].end_time_atu);
+ if (!beacon->bmis.ps.ps[nb_ps].sais[i].stpf)
+ bitstream_skip (&stream, 4);
}
test_fail_unless (length ==
BSU_BEACON_ENTRY_SIZE_PERSISTENT_SCHED