mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
add expected throughput
This commit is contained in:
parent
f1bb5413e1
commit
d141721db2
3 changed files with 57 additions and 0 deletions
|
@ -8,8 +8,12 @@
|
||||||
|
|
||||||
int get_rssi_iwinfo(__uint8_t *client_addr);
|
int get_rssi_iwinfo(__uint8_t *client_addr);
|
||||||
|
|
||||||
|
int get_expected_throughput_iwinfo(uint8_t *client_addr);
|
||||||
|
|
||||||
int get_bandwidth_iwinfo(__uint8_t *client_addr, float *rx_rate, float *tx_rate);
|
int get_bandwidth_iwinfo(__uint8_t *client_addr, float *rx_rate, float *tx_rate);
|
||||||
|
|
||||||
int compare_essid_iwinfo(__uint8_t *bssid_addr, __uint8_t *bssid_addr_to_compare);
|
int compare_essid_iwinfo(__uint8_t *bssid_addr, __uint8_t *bssid_addr_to_compare);
|
||||||
|
|
||||||
|
int get_expected_throughput(const char *ifname, uint8_t *client_addr);
|
||||||
|
|
||||||
#endif //DAWN_RSSI_H
|
#endif //DAWN_RSSI_H
|
||||||
|
|
|
@ -418,6 +418,9 @@ void kick_clients(uint8_t bssid[], uint32_t id) {
|
||||||
|
|
||||||
// update rssi
|
// update rssi
|
||||||
int rssi = get_rssi_iwinfo(client_array[j].client_addr);
|
int rssi = get_rssi_iwinfo(client_array[j].client_addr);
|
||||||
|
int exp_thr = get_expected_throughput_iwinfo(client_array[j].client_addr);
|
||||||
|
printf("Expectd throughput %d\n", exp_thr);
|
||||||
|
|
||||||
if (rssi != INT_MIN) {
|
if (rssi != INT_MIN) {
|
||||||
pthread_mutex_unlock(&probe_array_mutex);
|
pthread_mutex_unlock(&probe_array_mutex);
|
||||||
if (!probe_array_update_rssi(client_array[j].bssid_addr, client_array[j].client_addr, rssi)) {
|
if (!probe_array_update_rssi(client_array[j].bssid_addr, client_array[j].client_addr, rssi)) {
|
||||||
|
|
|
@ -183,5 +183,55 @@ int get_rssi(const char *ifname, uint8_t *client_addr) {
|
||||||
return e->signal;
|
return e->signal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return INT_MIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_expected_throughput_iwinfo(__uint8_t *client_addr) {
|
||||||
|
|
||||||
|
DIR *dirp;
|
||||||
|
struct dirent *entry;
|
||||||
|
dirp = opendir(hostapd_dir_glob); // error handling?
|
||||||
|
if (!dirp) {
|
||||||
|
fprintf(stderr, "[RSSI INFO] No hostapd sockets!\n");
|
||||||
|
return INT_MIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
int exp_thr = INT_MIN;
|
||||||
|
|
||||||
|
while ((entry = readdir(dirp)) != NULL) {
|
||||||
|
if (entry->d_type == DT_SOCK) {
|
||||||
|
exp_thr = get_rssi(entry->d_name, client_addr);
|
||||||
|
if (exp_thr != INT_MIN)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir(dirp);
|
||||||
|
return exp_thr;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_expected_throughput(const char *ifname, uint8_t *client_addr) {
|
||||||
|
|
||||||
|
int i, len;
|
||||||
|
char buf[IWINFO_BUFSIZE];
|
||||||
|
struct iwinfo_assoclist_entry *e;
|
||||||
|
const struct iwinfo_ops *iw;
|
||||||
|
|
||||||
|
iw = iwinfo_backend(ifname);
|
||||||
|
|
||||||
|
if (iw->assoclist(ifname, buf, &len)) {
|
||||||
|
printf("No information available\n");
|
||||||
|
return INT_MIN;
|
||||||
|
} else if (len <= 0) {
|
||||||
|
printf("No station connected\n");
|
||||||
|
return INT_MIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < len; i += sizeof(struct iwinfo_assoclist_entry)) {
|
||||||
|
e = (struct iwinfo_assoclist_entry *) &buf[i];
|
||||||
|
|
||||||
|
if (mac_is_equal(client_addr, e->mac))
|
||||||
|
return e->thr;
|
||||||
|
}
|
||||||
|
|
||||||
return INT_MIN;
|
return INT_MIN;
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue