mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
add channel util
This commit is contained in:
parent
058690f10f
commit
db5a9c88b2
3 changed files with 13 additions and 0 deletions
|
@ -59,4 +59,6 @@ int get_bssid(const char *ifname, uint8_t *bssid_addr);
|
|||
|
||||
int get_ssid(const char *ifname, char *ssid);
|
||||
|
||||
int get_channel_utilization(const char *ifname);
|
||||
|
||||
#endif //DAWN_RSSI_H
|
||||
|
|
|
@ -21,6 +21,8 @@ int get_bandwidth(const char *ifname, uint8_t *client_addr, float *rx_rate, floa
|
|||
|
||||
#define IWINFO_ESSID_MAX_SIZE 32
|
||||
|
||||
uint64_t last_channel_time = 0;
|
||||
uint64_t last_channel_time_busy = 0;
|
||||
|
||||
int compare_essid_iwinfo(__uint8_t *bssid_addr, __uint8_t *bssid_addr_to_compare) {
|
||||
const struct iwinfo_ops *iw;
|
||||
|
@ -283,7 +285,12 @@ int get_channel_utilization(const char *ifname) {
|
|||
iw = iwinfo_backend(ifname);
|
||||
if (iw->survey(ifname, &survey_entry))
|
||||
{
|
||||
uint64_t dividend = survey_entry.channel_time_busy - last_channel_time_busy;
|
||||
uint64_t divisor = survey_entry.channel_time - last_channel_time;
|
||||
last_channel_time = survey_entry.channel_time;
|
||||
last_channel_time_busy = survey_entry.channel_time_busy;
|
||||
printf("GOT SURVEY INFO!\n");
|
||||
return (dividend * 255 / divisor);
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -717,6 +717,7 @@ static int add_subscriber(char *name) {
|
|||
hostapd_entry->subscriber.remove_cb = hostapd_handle_remove;
|
||||
hostapd_entry->subscriber.cb = hostapd_notify;
|
||||
|
||||
strcpy(hostapd_entry->iface_name, name);
|
||||
get_bssid(name, hostapd_entry->bssid_addr);
|
||||
get_ssid(name, hostapd_entry->ssid);
|
||||
|
||||
|
@ -976,6 +977,9 @@ static void ubus_get_clients_cb(struct ubus_request *req, int type, struct blob_
|
|||
blobmsg_add_u8(&b_domain, "ht_supported", entry->ht);
|
||||
blobmsg_add_u8(&b_domain, "vht_supported", entry->vht);
|
||||
|
||||
int channel_util = get_channel_utilization(entry->iface_name);
|
||||
printf("CHANNEL UTILIZATION!!!: %d\n", channel_util);
|
||||
|
||||
char* collision_string = blobmsg_format_json(b_domain.head, 1);
|
||||
printf("COLLISION STRING: %s\n", collision_string);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue