Commit 85ba2945 authored by Saurabh Verma's avatar Saurabh Verma

wfadatad : [WIP] Populate neighbor device data

parent 385434e7
......@@ -54,22 +54,22 @@ static int delm_func_1(void *priv)
struct wifi_network *net = &dm->network;
struct wifi_network_device *dev = &net->device[0];
struct wifi_radio_element *radio = &dev->radiolist[0];
struct wifi_bss_element *bss = &radio->bsslist[0];
//Add one more BSS element
radio->num_bss += 1;
radio = (struct wifi_radio_element *)realloc(radio, (radio->num_bss)*(sizeof(struct wifi_bss_element)));
radio->bsslist = (struct wifi_bss_element *)realloc(radio->bsslist, (radio->num_bss)*(sizeof(struct wifi_bss_element)));
struct wifi_bss_element *bss = &radio->bsslist[0];
struct wifi_bss_element *bss1 = &radio->bsslist[1];
memcpy(bss1, bss, sizeof(struct wifi_bss_element));
//memcpy(bss1, bss, sizeof(struct wifi_bss_element));
memcpy(bss1->bssid, bss->bssid, 6);
memcpy(bss1->ssid, bss->ssid, 32);
bss1->enabled = bss->enabled;
bss1->tx_ucast_bytes = bss->tx_ucast_bytes; //100;
bss1->rx_ucast_bytes = bss->rx_ucast_bytes; //200;
bss1->tx_mcast_bytes = bss->tx_mcast_bytes; //300;
bss1->rx_mcast_bytes = bss->rx_mcast_bytes; //400;
bss1->tx_bcast_bytes = bss->tx_bcast_bytes; //500;
bss1->rx_bcast_bytes = bss->rx_bcast_bytes; //600;
bss1->tx_ucast_bytes = 1001; //bss->tx_ucast_bytes;
bss1->rx_ucast_bytes = 2002; //bss->rx_ucast_bytes;
bss1->tx_mcast_bytes = 3003; //bss->tx_mcast_bytes;
bss1->rx_mcast_bytes = 4004; //bss->rx_mcast_bytes;
bss1->tx_bcast_bytes = 5005; //bss->tx_bcast_bytes;
bss1->rx_bcast_bytes = 6006; //bss->rx_bcast_bytes;
bss1->num_stations = 0;
bss1->stalist = NULL;
is_set = 1;
......@@ -101,8 +101,16 @@ static int delm_func_2(void *priv)
net->num_devices += 1;
dm = (struct wifi_data_element *)realloc(dm, sizeof(struct wifi_data_element) + (net->num_devices)*(sizeof(struct wifi_network_device)));
// Add remote device data at index = net->num_devices
delm_add_device(remote_net, &net->device[net->num_devices]);
// As of now, for testing pass the existing wifi_network_device
#if 1
net = &dm->network;
dev = &net->device[0];
remote_net = (struct wifi_network_device *)dev;
struct wifi_network_device *dev1 = &net->device[net->num_devices-1];
#endif
delm_add_device(remote_net, &net->device[net->num_devices-1]);
is_set = 1;
p->dm = dm;
pthread_mutex_unlock(&p->lock);
}
return 0;
......
......@@ -208,21 +208,22 @@ int delm_add_bss(struct wifi_bss_element *remote_bss, struct wifi_bss_element *b
int ret;
//wl_dump_capabilities(&bb, &bss->caps, bss->cbitmap);
memcpy(b->bssid, remote_bss->bssid, 6);
memcpy(b->ssid, remote_bss->ssid, 32);
//b->num_stations = ap.bss.load.sta_count;
get_timestamp(NULL, b->tsp);
b->enabled = remote_bss->enabled;
b->tx_ucast_bytes = remote_bss->tx_ucast_bytes;
b->rx_ucast_bytes = remote_bss->rx_ucast_bytes;
b->tx_mcast_bytes = remote_bss->tx_mcast_bytes;
b->rx_mcast_bytes = remote_bss->rx_mcast_bytes;
b->tx_bcast_bytes = remote_bss->tx_bcast_bytes;
b->rx_bcast_bytes = remote_bss->rx_bcast_bytes;
ret = delm_add_sta_all(&remote_bss->stalist, remote_bss->num_stations, &b->stalist, &b->num_stations);
if(remote_bss) {
memcpy(b->bssid, remote_bss->bssid, 6);
memcpy(b->ssid, remote_bss->ssid, 32);
//b->num_stations = ap.bss.load.sta_count;
get_timestamp(NULL, b->tsp);
b->enabled = remote_bss->enabled;
b->tx_ucast_bytes = remote_bss->tx_ucast_bytes;
b->rx_ucast_bytes = remote_bss->rx_ucast_bytes;
b->tx_mcast_bytes = remote_bss->tx_mcast_bytes;
b->rx_mcast_bytes = remote_bss->rx_mcast_bytes;
b->tx_bcast_bytes = remote_bss->tx_bcast_bytes;
b->rx_bcast_bytes = remote_bss->rx_bcast_bytes;
ret = delm_add_sta_all(&remote_bss->stalist, remote_bss->num_stations, &b->stalist, &b->num_stations);
}
return ret;
}
......@@ -358,7 +359,7 @@ int delm_get_scanresults(const char *ifname,
return 0;
}
int delm_add_scanresults(struct wifi_scanres_element **remote_scanlist, uint32_t remote_num_scanresult,
int delm_add_scanresults(struct wifi_scanres_element **remote_scanlist, uint32_t *remote_num_scanresult,
struct wifi_scanres_element **scanlist, uint32_t *num_scanresult)
{
struct wifi_scanres_element *out;
......@@ -376,6 +377,10 @@ int delm_add_scanresults(struct wifi_scanres_element **remote_scanlist, uint32_t
if (!bsss)
return -1;
*num_scanresult = 0;
for(i=0; i<*num_scanresult; i++) {
scanlist[i] = NULL;
}
#if 0
ret = wifi_get_scan_results(ifname, bsss, &num);
if (ret) {
......@@ -398,6 +403,7 @@ int delm_add_scanresults(struct wifi_scanres_element **remote_scanlist, uint32_t
}
#endif
#if 0
out = calloc(1, sizeof(struct wifi_scanres_element));
if (!out) {
free(bsss);
......@@ -484,6 +490,7 @@ int delm_add_scanresults(struct wifi_scanres_element **remote_scanlist, uint32_t
*scanlist = out;
*num_scanresult = remote_num_scanresult;
#endif
return 0;
}
......@@ -496,7 +503,9 @@ int delm_get_bksta(const char *ifname, struct wifi_backhaul_element *bksta)
int delm_add_bksta(struct wifi_backhaul_element *remote_bksta, struct wifi_backhaul_element *bksta)
{
memcpy(remote_bksta->macaddr, bksta->macaddr, 6);
if(remote_bksta->macaddr) {
memcpy(bksta->macaddr, remote_bksta->macaddr, 6);
}
return 0;
}
......@@ -622,6 +631,9 @@ int delm_add_radio(struct wifi_radio_element *remote_radio,
int i, j;
int ret;
if(!remote_radio || !r) {
return -1;
}
r->enabled = remote_radio->enabled;
r->anpi = remote_radio->anpi;
......@@ -632,8 +644,9 @@ int delm_add_radio(struct wifi_radio_element *remote_radio,
r->num_curr_opclass = remote_radio->num_curr_opclass;
r->curr_opclass = calloc(r->num_curr_opclass,
sizeof(struct wifi_opclass_current_element));
if (!r->curr_opclass)
if (!r->curr_opclass) {
return -1;
}
for (i = 0; i < r->num_curr_opclass; i++) {
get_timestamp(NULL, r->curr_opclass[i].tsp);
r->curr_opclass[i].id = remote_radio->curr_opclass[i].id;
......@@ -650,7 +663,9 @@ int delm_add_radio(struct wifi_radio_element *remote_radio,
r->supp_opclass[i].id = remote_radio->supp_opclass[i].id;
r->supp_opclass[i].max_txpower = remote_radio->supp_opclass[i].max_txpower;
r->supp_opclass[i].num_exclude_channels = remote_radio->supp_opclass[i].num_exclude_channels;
strcpy(r->supp_opclass[i].exclude_chanlist, remote_radio->supp_opclass[i].exclude_chanlist);
if(remote_radio->supp_opclass[i].exclude_chanlist) {
strcpy(r->supp_opclass[i].exclude_chanlist, remote_radio->supp_opclass[i].exclude_chanlist);
}
}
}
......@@ -658,6 +673,7 @@ int delm_add_radio(struct wifi_radio_element *remote_radio,
ret = delm_add_scanresults(&remote_radio->scanlist, &remote_radio->num_scanresult, &r->scanlist, &r->num_scanresult);
r->num_bss = remote_radio->num_bss;
r->bsslist = calloc(r->num_bss, sizeof(struct wifi_bss_element));
if (!r->bsslist)
return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment