mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
rename ht_support to ht_capabilities
This commit is contained in:
parent
9a166814fd
commit
debc3ecaa2
3 changed files with 52 additions and 36 deletions
|
@ -105,8 +105,8 @@ typedef struct probe_entry_s {
|
|||
uint8_t target_addr[ETH_ALEN];
|
||||
uint32_t signal;
|
||||
uint32_t freq;
|
||||
uint8_t ht_support;
|
||||
uint8_t vht_support;
|
||||
uint8_t ht_capabilities;
|
||||
uint8_t vht_capabilities;
|
||||
time_t time;
|
||||
int counter;
|
||||
int deny_counter;
|
||||
|
@ -190,8 +190,8 @@ typedef struct client_s {
|
|||
typedef struct ap_s {
|
||||
uint8_t bssid_addr[ETH_ALEN];
|
||||
uint32_t freq;
|
||||
uint8_t ht;
|
||||
uint8_t vht;
|
||||
uint8_t ht_support;
|
||||
uint8_t vht_support;
|
||||
uint32_t channel_utilization;
|
||||
time_t time;
|
||||
uint32_t station_count;
|
||||
|
|
|
@ -151,15 +151,15 @@ int build_hearing_map_sort_client(struct blob_buf *b) {
|
|||
ap_list = blobmsg_open_table(b, ap_mac_buf);
|
||||
blobmsg_add_u32(b, "signal", probe_array[k].signal);
|
||||
blobmsg_add_u32(b, "freq", probe_array[k].freq);
|
||||
blobmsg_add_u8(b, "ht_support", probe_array[k].ht_support);
|
||||
blobmsg_add_u8(b, "vht_support", probe_array[k].vht_support);
|
||||
blobmsg_add_u8(b, "ht_capabilities", probe_array[k].ht_capabilities);
|
||||
blobmsg_add_u8(b, "vht_capabilities", probe_array[k].vht_capabilities);
|
||||
|
||||
|
||||
// check if ap entry is available
|
||||
blobmsg_add_u32(b, "channel_utilization", ap_entry.channel_utilization);
|
||||
blobmsg_add_u32(b, "num_sta", ap_entry.station_count);
|
||||
blobmsg_add_u32(b, "ht", ap_entry.ht);
|
||||
blobmsg_add_u32(b, "vht", ap_entry.vht);
|
||||
blobmsg_add_u8(b, "ht_support", ap_entry.ht_support);
|
||||
blobmsg_add_u8(b, "vht_support", ap_entry.vht_support);
|
||||
|
||||
blobmsg_add_u32(b, "score", eval_probe_metric(probe_array[k]));
|
||||
blobmsg_close_table(b, ap_list);
|
||||
|
@ -211,8 +211,8 @@ int build_network_overview(struct blob_buf *b) {
|
|||
sprintf(client_mac_buf, MACSTR, MAC2STR(client_array[k].client_addr));
|
||||
client_list = blobmsg_open_table(b, client_mac_buf);
|
||||
blobmsg_add_u32(b, "freq", client_array[k].freq);
|
||||
blobmsg_add_u32(b, "ht", client_array[k].ht);
|
||||
blobmsg_add_u32(b, "vht", client_array[k].vht);
|
||||
blobmsg_add_u8(b, "ht", client_array[k].ht);
|
||||
blobmsg_add_u8(b, "vht", client_array[k].vht);
|
||||
blobmsg_add_u32(b, "collision_count", ap_get_collision_count(ap_array[m].collision_domain));
|
||||
blobmsg_close_table(b, client_list);
|
||||
}
|
||||
|
@ -231,15 +231,15 @@ int eval_probe_metric(struct probe_entry_s probe_entry) {
|
|||
|
||||
// check if ap entry is available
|
||||
if (mac_is_equal(ap_entry.bssid_addr, probe_entry.bssid_addr)) {
|
||||
score += probe_entry.ht_support && ap_entry.ht ? dawn_metric.ht_support : 0;
|
||||
score += !probe_entry.ht_support && !ap_entry.ht ? dawn_metric.no_ht_support : 0;
|
||||
score += probe_entry.ht_capabilities && ap_entry.ht_support ? dawn_metric.ht_support : 0;
|
||||
score += !probe_entry.ht_capabilities && !ap_entry.ht_support ? dawn_metric.no_ht_support : 0;
|
||||
|
||||
// performance anomaly?
|
||||
if (network_config.bandwidth >= 1000 || network_config.bandwidth == -1) {
|
||||
score += probe_entry.vht_support && ap_entry.vht ? dawn_metric.vht_support : 0;
|
||||
score += probe_entry.vht_capabilities && ap_entry.vht_support ? dawn_metric.vht_support : 0;
|
||||
}
|
||||
|
||||
score += !probe_entry.vht_support && !ap_entry.vht ? dawn_metric.no_vht_support : 0;
|
||||
score += !probe_entry.vht_capabilities && !ap_entry.vht_support ? dawn_metric.no_vht_support : 0;
|
||||
score += ap_entry.channel_utilization <= dawn_metric.chan_util_val ? dawn_metric.chan_util : 0;
|
||||
score += ap_entry.channel_utilization > dawn_metric.max_chan_util_val ? dawn_metric.max_chan_util : 0;
|
||||
}
|
||||
|
@ -1207,7 +1207,7 @@ void print_probe_entry(probe_entry entry) {
|
|||
printf(
|
||||
"bssid_addr: %s, client_addr: %s, signal: %d, freq: "
|
||||
"%d, counter: %d, vht: %d, min_rate: %d, max_rate: %d\n",
|
||||
mac_buf_ap, mac_buf_client, entry.signal, entry.freq, entry.counter, entry.vht_support,
|
||||
mac_buf_ap, mac_buf_client, entry.signal, entry.freq, entry.counter, entry.vht_capabilities,
|
||||
entry.min_supp_datarate, entry.max_supp_datarate);
|
||||
}
|
||||
|
||||
|
@ -1252,7 +1252,7 @@ void print_ap_entry(ap entry) {
|
|||
|
||||
sprintf(mac_buf_ap, MACSTR, MAC2STR(entry.bssid_addr));
|
||||
printf("ssid: %s, bssid_addr: %s, freq: %d, ht: %d, vht: %d, chan_utilz: %d, col_d: %d, bandwidth: %d, col_count: %d\n",
|
||||
entry.ssid, mac_buf_ap, entry.freq, entry.ht, entry.vht,
|
||||
entry.ssid, mac_buf_ap, entry.freq, entry.ht_support, entry.vht_support,
|
||||
entry.channel_utilization, entry.collision_domain, entry.bandwidth,
|
||||
ap_get_collision_count(entry.collision_domain)
|
||||
);
|
||||
|
|
|
@ -63,8 +63,8 @@ struct hostapd_sock_entry{
|
|||
char iface_name[MAX_INTERFACE_NAME];
|
||||
uint8_t bssid_addr[ETH_ALEN];
|
||||
char ssid[SSID_MAX_LEN];
|
||||
uint8_t ht;
|
||||
uint8_t vht;
|
||||
uint8_t ht_support;
|
||||
uint8_t vht_support;
|
||||
uint64_t last_channel_time;
|
||||
uint64_t last_channel_time_busy;
|
||||
int chan_util_samples_sum;
|
||||
|
@ -121,8 +121,8 @@ enum {
|
|||
PROB_TARGET_ADDR,
|
||||
PROB_SIGNAL,
|
||||
PROB_FREQ,
|
||||
PROB_HT_SUPPORT,
|
||||
PROB_VHT_SUPPORT,
|
||||
PROB_HT_CAPABILITIES,
|
||||
PROB_VHT_CAPABILITIES,
|
||||
__PROB_MAX,
|
||||
};
|
||||
|
||||
|
@ -132,8 +132,8 @@ static const struct blobmsg_policy prob_policy[__PROB_MAX] = {
|
|||
[PROB_TARGET_ADDR] = {.name = "target", .type = BLOBMSG_TYPE_STRING},
|
||||
[PROB_SIGNAL] = {.name = "signal", .type = BLOBMSG_TYPE_INT32},
|
||||
[PROB_FREQ] = {.name = "freq", .type = BLOBMSG_TYPE_INT32},
|
||||
[PROB_HT_SUPPORT] = {.name = "ht_support", .type = BLOBMSG_TYPE_INT8},
|
||||
[PROB_VHT_SUPPORT] = {.name = "vht_support", .type = BLOBMSG_TYPE_INT8},
|
||||
[PROB_HT_CAPABILITIES] = {.name = "ht_capabilities", .type = BLOBMSG_TYPE_TABLE},
|
||||
[PROB_VHT_CAPABILITIES] = {.name = "vht_capabilities", .type = BLOBMSG_TYPE_TABLE},
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -438,12 +438,18 @@ int parse_to_probe_req(struct blob_attr *msg, probe_entry *prob_req) {
|
|||
prob_req->freq = blobmsg_get_u32(tb[PROB_FREQ]);
|
||||
}
|
||||
|
||||
if (tb[PROB_HT_SUPPORT]) {
|
||||
prob_req->ht_support = blobmsg_get_u8(tb[PROB_HT_SUPPORT]);
|
||||
if (tb[PROB_HT_CAPABILITIES]) {
|
||||
prob_req->ht_capabilities = true;
|
||||
} else
|
||||
{
|
||||
prob_req->ht_capabilities = false;
|
||||
}
|
||||
|
||||
if (tb[PROB_VHT_SUPPORT]) {
|
||||
prob_req->vht_support = blobmsg_get_u8(tb[PROB_VHT_SUPPORT]);
|
||||
if (tb[PROB_VHT_CAPABILITIES]) {
|
||||
prob_req->vht_capabilities = true;
|
||||
} else
|
||||
{
|
||||
prob_req->vht_capabilities = false;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -726,8 +732,8 @@ static int add_subscriber(char *name) {
|
|||
|
||||
// TODO: here we need to add ht and vht supported!!!
|
||||
// actually we wanted to use an ubus call but for now we can use libiwinfo
|
||||
hostapd_entry->ht = (uint8_t) support_ht(name);
|
||||
hostapd_entry->vht = (uint8_t) support_vht(name);
|
||||
hostapd_entry->ht_support = (uint8_t) support_ht(name);
|
||||
hostapd_entry->vht_support = (uint8_t) support_vht(name);
|
||||
|
||||
ret = ubus_register_subscriber(ctx, &hostapd_entry->subscriber);
|
||||
ret = ubus_subscribe( ctx, &hostapd_entry->subscriber, id);
|
||||
|
@ -912,16 +918,16 @@ int parse_to_clients(struct blob_attr *msg, int do_kick, uint32_t id) {
|
|||
ap_entry.freq = blobmsg_get_u32(tb[CLIENT_TABLE_FREQ]);
|
||||
|
||||
if(tb[CLIENT_TABLE_HT]){
|
||||
ap_entry.ht = blobmsg_get_u8(tb[CLIENT_TABLE_HT]);
|
||||
ap_entry.ht_support = blobmsg_get_u8(tb[CLIENT_TABLE_HT]);
|
||||
} else {
|
||||
ap_entry.ht = false;
|
||||
ap_entry.ht_support = false;
|
||||
}
|
||||
|
||||
if(tb[CLIENT_TABLE_VHT]){
|
||||
ap_entry.vht = blobmsg_get_u8(tb[CLIENT_TABLE_VHT]);
|
||||
ap_entry.vht_support = blobmsg_get_u8(tb[CLIENT_TABLE_VHT]);
|
||||
} else
|
||||
{
|
||||
ap_entry.vht = false;
|
||||
ap_entry.vht_support = false;
|
||||
}
|
||||
|
||||
if(tb[CLIENT_TABLE_CHAN_UTIL]) {
|
||||
|
@ -978,8 +984,8 @@ static void ubus_get_clients_cb(struct ubus_request *req, int type, struct blob_
|
|||
|
||||
blobmsg_add_macaddr(&b_domain, "bssid", entry->bssid_addr);
|
||||
blobmsg_add_string(&b_domain, "ssid", entry->ssid);
|
||||
blobmsg_add_u8(&b_domain, "ht_supported", entry->ht);
|
||||
blobmsg_add_u8(&b_domain, "vht_supported", entry->vht);
|
||||
blobmsg_add_u8(&b_domain, "ht_supported", entry->ht_support);
|
||||
blobmsg_add_u8(&b_domain, "vht_supported", entry->vht_support);
|
||||
|
||||
//int channel_util = get_channel_utilization(entry->iface_name, &entry->last_channel_time, &entry->last_channel_time_busy);
|
||||
blobmsg_add_u32(&b_domain, "channel_utilization", entry->chan_util_average);
|
||||
|
@ -1113,6 +1119,7 @@ int ubus_call_umdns() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
//TODO: ADD STUFF HERE!!!!
|
||||
int ubus_send_probe_via_network(struct probe_entry_s probe_entry) {
|
||||
blob_buf_init(&b_probe, 0);
|
||||
blobmsg_add_macaddr(&b_probe, "bssid", probe_entry.bssid_addr);
|
||||
|
@ -1120,8 +1127,17 @@ int ubus_send_probe_via_network(struct probe_entry_s probe_entry) {
|
|||
blobmsg_add_macaddr(&b_probe, "target", probe_entry.target_addr);
|
||||
blobmsg_add_u32(&b_probe, "signal", probe_entry.signal);
|
||||
blobmsg_add_u32(&b_probe, "freq", probe_entry.freq);
|
||||
blobmsg_add_u8(&b_probe, "ht_support", probe_entry.ht_support);
|
||||
blobmsg_add_u8(&b_probe, "vht_support", probe_entry.vht_support);
|
||||
|
||||
if(probe_entry.ht_capabilities)
|
||||
{
|
||||
void *ht_cap = blobmsg_open_table(&b, "ht_capabilities");
|
||||
blobmsg_close_table(&b, ht_cap);
|
||||
}
|
||||
|
||||
if(probe_entry.vht_capabilities) {
|
||||
void *vht_cap = blobmsg_open_table(&b, "vht_capabilities");
|
||||
blobmsg_close_table(&b, vht_cap);
|
||||
}
|
||||
|
||||
send_blob_attr_via_network(b_probe.head, "probe");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue