add supp rates

This commit is contained in:
PolynomialDivision 2018-02-06 23:39:31 +01:00
parent 5a128beb75
commit 80199e244f
5 changed files with 48 additions and 1 deletions

View file

@ -39,7 +39,7 @@ SET(SOURCES
network/tcpsocket.c
include/dawn_iwinfo.h
utils/dawn_iwinfo.c)
utils/dawn_iwinfo.c utils/ieee80211_utils.c include/ieee80211_utils.h)
SET(LIBS
ubox ubus json-c blobmsg_json config uci gcrypt iwinfo)

View file

@ -106,6 +106,7 @@ typedef struct probe_entry_s {
time_t time;
int counter;
int deny_counter;
uint8_t max_supp_datarate;
} probe_entry;
typedef struct auth_entry_s {

View file

@ -0,0 +1,12 @@
//
// Created by nick on 06.02.18.
//
#ifndef DAWN_IEEE80211_UTILS_H
#define DAWN_IEEE80211_UTILS_H
#include <stdint.h>
double iee80211_calculate_bitrate(uint8_t supp_rate_val);
#endif //DAWN_IEEE80211_UTILS_H

View file

@ -0,0 +1,11 @@
//
// Created by nick on 06.02.18.
//
#include "ieee80211_utils.h"
#include <stdint.h>
double iee80211_calculate_bitrate(uint8_t supp_rate_val)
{
return ((double) supp_rate_val) / 2;
}

View file

@ -97,6 +97,8 @@ enum {
PROB_FREQ,
PROB_HT_SUPPORT,
PROB_VHT_SUPPORT,
PROB_SUPP_RATES,
PROB_EXT_SUPP_RATES,
__PROB_MAX,
};
@ -108,6 +110,8 @@ static const struct blobmsg_policy prob_policy[__PROB_MAX] = {
[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_SUPP_RATES] = {.name = "supp_rates", .type = BLOBMSG_TYPE_ARRAY},
[PROB_EXT_SUPP_RATES] = {.name = "ext_supp_rates", .type = BLOBMSG_TYPE_ARRAY},
};
enum {
@ -403,6 +407,25 @@ int parse_to_probe_req(struct blob_attr *msg, probe_entry *prob_req) {
prob_req->vht_support = blobmsg_get_u8(tb[PROB_VHT_SUPPORT]);
}
if (tb[PROB_EXT_SUPP_RATES]) {
struct blob_attr *attr;
int len = blobmsg_data_len(tb[PROB_EXT_SUPP_RATES]);
struct blob_attr *data = blobmsg_data(tb[PROB_EXT_SUPP_RATES]);
__blob_for_each_attr(attr, data, len)
{
printf("EXT Supp Rates: %d\n", blobmsg_get_u8(attr));
}
}
if (tb[PROB_SUPP_RATES]) {
struct blob_attr *attr;
//struct blobmsg_hdr *hdr;
int len = blobmsg_data_len(tb[PROB_SUPP_RATES]);
blobmsg_for_each_attr(attr, blobmsg_data(tb[PROB_SUPP_RATES]), len)
{
printf("Supp Rates: %d\n", blobmsg_get_u8(attr));
}
}
return 0;
}