summaryrefslogtreecommitdiff
path: root/cesar/cp/beacon/src/beacon.c
diff options
context:
space:
mode:
authorlaranjeiro2010-07-07 15:24:07 +0000
committerlaranjeiro2010-07-07 15:24:07 +0000
commitbe4769cdeb9167fff7885d1ea5a9f7bcca2929a0 (patch)
tree03460fee6536b07195350d86b6db239aad509ba9 /cesar/cp/beacon/src/beacon.c
parent9bb91d38efd0bff3b3eb2b11290cf45e6cc9b496 (diff)
cesar/{bsu, cp/beacon}: fix updated flag in discover info bentry, closes #1711
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7277 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp/beacon/src/beacon.c')
-rw-r--r--cesar/cp/beacon/src/beacon.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/cesar/cp/beacon/src/beacon.c b/cesar/cp/beacon/src/beacon.c
index c3a07859ad..ed29f37c01 100644
--- a/cesar/cp/beacon/src/beacon.c
+++ b/cesar/cp/beacon/src/beacon.c
@@ -74,25 +74,27 @@ cp_beacon_fill_discover_info (cp_t *ctx,
bsu_beacon_bmi_discover_info_t *discover)
{
cp_sta_own_data_t *sta = cp_sta_mgr_get_sta_own_data (ctx);
- cp_beacon_discover_info_t discover_info;
- discover_info.updated = ctx->beacon.discover_info_last.updated;
- discover_info.cco_cap = CP_CCO_LEVEL;
- discover_info.proxy_net_cap = CP_PCO_CAP;
- discover_info.backup_cco_cap = CP_BACKUP_CCO_CAP;
- discover_info.cco_status = cp_sta_own_data_get_cco_status (ctx);
- discover_info.pco_status = cp_sta_own_data_get_pco_status (ctx);
- discover_info.backup_cco_status = false;
- discover_info.num_dis_sta = cp_sta_mgr_get_num_discovered_stas (ctx);
- discover_info.num_dis_net = cp_sta_mgr_get_num_discovered_net (ctx);
- discover_info.authentication =
- cp_sta_own_data_get_authenticated_status (ctx);
- discover_info.status_user_ap_cco = sta->cco_prefered;
- discover_info.rsvd = 0;
- discover_info.updated = (*((u32*)(char*)&ctx->beacon.discover_info_last)
- != *((u32*)(char*)&discover_info));
- discover->info_data = *((u32*)(char*)&discover_info);
- *((u32*)(char*)&ctx->beacon.discover_info_last) =
- *((u32*)(char*)&discover_info);
+ bitstream_t stream;
+ bitstream_write_init (&stream, &discover->info_data, 4);
+ bitstream_write (&stream, 0, 1);
+ bitstream_write (&stream, CP_CCO_LEVEL, 2);
+ bitstream_write (&stream, CP_PCO_CAP, 1);
+ bitstream_write (&stream, CP_BACKUP_CCO_CAP, 1);
+ bitstream_write (&stream, cp_sta_own_data_get_cco_status (ctx), 1);
+ bitstream_write (&stream, cp_sta_own_data_get_pco_status (ctx), 1);
+ bitstream_write (&stream, false, 1);
+ bitstream_write (&stream, cp_sta_mgr_get_num_discovered_stas (ctx), 8);
+ bitstream_write (&stream, cp_sta_mgr_get_num_discovered_net (ctx), 8);
+ bitstream_write (&stream, cp_sta_own_data_get_authenticated_status (ctx),
+ 1);
+ bitstream_write (&stream, sta->cco_prefered, 1);
+ bitstream_write (&stream, 0, 6);
+ bitstream_finalise (&stream);
+ u32 last = bitstream_direct_read (&ctx->beacon.discover_info_last, 1, 31);
+ u32 new = bitstream_direct_read (&discover->info_data, 1, 31);
+ /* Updated ? */
+ bitstream_direct_write (&discover->info_data, 0, new != last, 1);
+ ctx->beacon.discover_info_last = discover->info_data;
discover->present = true;
}