diff --git a/src/include/datastorage.h b/src/include/datastorage.h index e709915..24778b6 100644 --- a/src/include/datastorage.h +++ b/src/include/datastorage.h @@ -34,8 +34,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_support; + uint8_t vht_support; time_t time; int counter; } probe_entry; diff --git a/src/include/ubus.h b/src/include/ubus.h index 629b8a4..eb5cd27 100644 --- a/src/include/ubus.h +++ b/src/include/ubus.h @@ -22,18 +22,4 @@ void *kick_clients_thread(void *arg); char *hostapd_dir_glob; -/* Metrik - -* RSSI : >= Threshold -* FREQ : >= 5GHZ - -*/ - -/* - -* if(client >=) -* - -*/ - #endif diff --git a/src/storage/datastorage.c b/src/storage/datastorage.c index f88d3ff..a5328da 100644 --- a/src/storage/datastorage.c +++ b/src/storage/datastorage.c @@ -35,33 +35,23 @@ int client_entry_last = -1; int eval_probe_metric(struct client_s client_entry, struct probe_entry_s probe_entry) { - /*struct probe_metric_s metric = { - .ht_support = 0, - .vht_support = 0, - .n_ht_support = 0, - .n_ht_support = 0, - .rssi = 0, - .freq = 100}; // this is for testing - - */ - int score = 0; uint8_t client_supports_ht; uint8_t client_supports_vht; - + /* uint8_t ap_supports_ht; uint8_t ap_supports_vht; ap_supports_ht = client_entry.ht_supported; ap_supports_vht = client_entry.vht_supported; - printf("AP Supports HT: %d\n", ap_supports_ht); - printf("AP Supports VHT: %d\n", ap_supports_vht); - + //printf("AP Supports HT: %d\n", ap_supports_ht); + //printf("AP Supports VHT: %d\n", ap_supports_vht); + */ client_supports_ht = client_entry.ht; client_supports_vht = client_entry.vht; - + /* printf("Clients Supports HT: %d\n", client_supports_ht); printf("Clients Supports VHT: %d\n", client_supports_vht); @@ -69,7 +59,7 @@ int eval_probe_metric(struct client_s client_entry, struct probe_entry_s probe_e printf("Checking if client supports: AP_VHT: %d, CL_VHT: %d\n", ap_supports_vht, client_supports_vht); if (ap_supports_vht && client_supports_vht) { printf("AAAHHHHHHHHHHH IDEAL!!!\n"); - } + }*/ score += client_supports_vht ? dawn_metric.vht_support : dawn_metric.n_vht_support; score += client_supports_ht ? dawn_metric.ht_support : dawn_metric.n_ht_support; @@ -89,7 +79,7 @@ int eval_probe_metric(struct client_s client_entry, struct probe_entry_s probe_e //int kick_client(uint8_t bssid[], uint8_t client[]) { int kick_client(struct client_s client_entry) { - print_array(); + //print_array(); int own_score = 0; diff --git a/src/utils/ubus.c b/src/utils/ubus.c index bbc5b48..62bdf23 100644 --- a/src/utils/ubus.c +++ b/src/utils/ubus.c @@ -36,8 +36,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_SUPPORT] = {.name = "ht_support", .type = BLOBMSG_TYPE_INT8}, + [PROB_VHT_SUPPORT] = {.name = "vht_support", .type = BLOBMSG_TYPE_INT8}, }; enum { @@ -160,7 +160,7 @@ int parse_to_probe_req(struct blob_attr *msg, probe_entry *prob_req) { if (tb[PROB_FREQ]) { 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]); } @@ -168,7 +168,7 @@ int parse_to_probe_req(struct blob_attr *msg, probe_entry *prob_req) { if (tb[PROB_VHT_SUPPORT]) { prob_req->vht_support = blobmsg_get_u8(tb[PROB_VHT_SUPPORT]); } -*/ + return 0; }