mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
msghandler: fix rrm array parsing
dump_rrm_table was called from dump_client with the pointer to the table data, not the table itself. Since only the first byte is needed, it can be fetched right away without looping through the table values, so we can just call dump_rrm_data passing the table data pointer. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
This commit is contained in:
parent
1e4871d70a
commit
276ca169a7
1 changed files with 7 additions and 23 deletions
|
@ -328,30 +328,14 @@ int handle_network_msg(char* msg) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t dump_rrm_data(void* data, int len, int type) //modify from examples/blobmsg-example.c in libubox
|
|
||||||
{
|
|
||||||
uint32_t ret = 0;
|
|
||||||
switch (type) {
|
|
||||||
case BLOBMSG_TYPE_INT32:
|
|
||||||
ret = *(uint32_t*)data;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, "wrong type of rrm array\n");
|
|
||||||
}
|
|
||||||
return (uint8_t)ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint8_t
|
static uint8_t
|
||||||
dump_rrm_table(struct blob_attr* head, int len) //modify from examples/blobmsg-example.c in libubox
|
dump_rrm_data(struct blob_attr* head)
|
||||||
{
|
{
|
||||||
struct blob_attr* attr;
|
if (blob_id(head) != BLOBMSG_TYPE_INT32) {
|
||||||
uint8_t ret = 0;
|
fprintf(stderr, "wrong type of rrm array.\n");
|
||||||
|
return 0;
|
||||||
__blob_for_each_attr(attr, head, len) {
|
|
||||||
ret = dump_rrm_data(blobmsg_data(attr), blobmsg_data_len(attr), blob_id(attr));
|
|
||||||
return ret;// get the first rrm byte
|
|
||||||
}
|
}
|
||||||
return ret;
|
return (uint8_t)blobmsg_get_u32(head);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TOOD: Refactor this!
|
// TOOD: Refactor this!
|
||||||
|
@ -406,8 +390,8 @@ dump_client(struct blob_attr** tb, struct dawn_mac client_addr, const char* bssi
|
||||||
}
|
}
|
||||||
/* RRM Caps */
|
/* RRM Caps */
|
||||||
if (tb[CLIENT_RRM]) {
|
if (tb[CLIENT_RRM]) {
|
||||||
client_entry->rrm_enabled_capa = dump_rrm_table(blobmsg_data(tb[CLIENT_RRM]),
|
// get the first byte from rrm array
|
||||||
blobmsg_data_len(tb[CLIENT_RRM]));// get the first byte from rrm array
|
client_entry->rrm_enabled_capa = dump_rrm_data(blobmsg_data(tb[CLIENT_RRM]));
|
||||||
//ap_entry.ap_weight = blobmsg_get_u32(tb[CLIENT_TABLE_RRM]);
|
//ap_entry.ap_weight = blobmsg_get_u32(tb[CLIENT_TABLE_RRM]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue