mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
parse from ubus call
This commit is contained in:
parent
fe5e6849b8
commit
5e6c0ed78f
3 changed files with 8 additions and 3 deletions
|
@ -109,6 +109,8 @@ typedef struct auth_entry_s assoc_entry;
|
||||||
// ---------------- Defines ----------------
|
// ---------------- Defines ----------------
|
||||||
#define PROBE_ARRAY_LEN 1000
|
#define PROBE_ARRAY_LEN 1000
|
||||||
|
|
||||||
|
#define SSID_MAX_LEN 32
|
||||||
|
|
||||||
// ---------------- Global variables ----------------
|
// ---------------- Global variables ----------------
|
||||||
struct probe_entry_s probe_array[PROBE_ARRAY_LEN];
|
struct probe_entry_s probe_array[PROBE_ARRAY_LEN];
|
||||||
pthread_mutex_t probe_array_mutex;
|
pthread_mutex_t probe_array_mutex;
|
||||||
|
@ -161,7 +163,7 @@ typedef struct ap_s {
|
||||||
uint32_t channel_utilization;
|
uint32_t channel_utilization;
|
||||||
time_t time;
|
time_t time;
|
||||||
uint32_t station_count;
|
uint32_t station_count;
|
||||||
// essid
|
uint8_t ssid[SSID_MAX_LEN];
|
||||||
} ap;
|
} ap;
|
||||||
|
|
||||||
// ---------------- Defines ----------------
|
// ---------------- Defines ----------------
|
||||||
|
|
|
@ -1189,8 +1189,8 @@ void print_ap_entry(ap entry) {
|
||||||
char mac_buf_ap[20];
|
char mac_buf_ap[20];
|
||||||
|
|
||||||
sprintf(mac_buf_ap, MACSTR, MAC2STR(entry.bssid_addr));
|
sprintf(mac_buf_ap, MACSTR, MAC2STR(entry.bssid_addr));
|
||||||
printf("bssid_addr: %s, freq: %d, ht: %d, vht: %d, chan_utilz: %d\n",
|
printf("ssid: %s, bssid_addr: %s, freq: %d, ht: %d, vht: %d, chan_utilz: %d\n",
|
||||||
mac_buf_ap, entry.freq, entry.ht, entry.vht, entry.channel_utilization);
|
entry.ssid, mac_buf_ap, entry.freq, entry.ht, entry.vht, entry.channel_utilization);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_ap_array() {
|
void print_ap_array() {
|
||||||
|
|
|
@ -105,6 +105,7 @@ static const struct blobmsg_policy prob_policy[__PROB_MAX] = {
|
||||||
enum {
|
enum {
|
||||||
CLIENT_TABLE,
|
CLIENT_TABLE,
|
||||||
CLIENT_TABLE_BSSID,
|
CLIENT_TABLE_BSSID,
|
||||||
|
CLIENT_TABLE_SSID,
|
||||||
CLIENT_TABLE_FREQ,
|
CLIENT_TABLE_FREQ,
|
||||||
CLIENT_TABLE_HT,
|
CLIENT_TABLE_HT,
|
||||||
CLIENT_TABLE_VHT,
|
CLIENT_TABLE_VHT,
|
||||||
|
@ -116,6 +117,7 @@ enum {
|
||||||
static const struct blobmsg_policy client_table_policy[__CLIENT_TABLE_MAX] = {
|
static const struct blobmsg_policy client_table_policy[__CLIENT_TABLE_MAX] = {
|
||||||
[CLIENT_TABLE] = {.name = "clients", .type = BLOBMSG_TYPE_TABLE},
|
[CLIENT_TABLE] = {.name = "clients", .type = BLOBMSG_TYPE_TABLE},
|
||||||
[CLIENT_TABLE_BSSID] = {.name = "bssid", .type = BLOBMSG_TYPE_STRING},
|
[CLIENT_TABLE_BSSID] = {.name = "bssid", .type = BLOBMSG_TYPE_STRING},
|
||||||
|
[CLIENT_TABLE_SSID] = {.name = "ssid", .type = BLOBMSG_TYPE_STRING},
|
||||||
[CLIENT_TABLE_FREQ] = {.name = "freq", .type = BLOBMSG_TYPE_INT32},
|
[CLIENT_TABLE_FREQ] = {.name = "freq", .type = BLOBMSG_TYPE_INT32},
|
||||||
[CLIENT_TABLE_HT] = {.name = "ht_supported", .type = BLOBMSG_TYPE_INT8},
|
[CLIENT_TABLE_HT] = {.name = "ht_supported", .type = BLOBMSG_TYPE_INT8},
|
||||||
[CLIENT_TABLE_VHT] = {.name = "vht_supported", .type = BLOBMSG_TYPE_INT8},
|
[CLIENT_TABLE_VHT] = {.name = "vht_supported", .type = BLOBMSG_TYPE_INT8},
|
||||||
|
@ -766,6 +768,7 @@ int parse_to_clients(struct blob_attr *msg, int do_kick, uint32_t id) {
|
||||||
ap_entry.ht = blobmsg_get_u8(tb[CLIENT_TABLE_HT]);
|
ap_entry.ht = blobmsg_get_u8(tb[CLIENT_TABLE_HT]);
|
||||||
ap_entry.vht = blobmsg_get_u8(tb[CLIENT_TABLE_VHT]);
|
ap_entry.vht = blobmsg_get_u8(tb[CLIENT_TABLE_VHT]);
|
||||||
ap_entry.channel_utilization = blobmsg_get_u32(tb[CLIENT_TABLE_CHAN_UTIL]);
|
ap_entry.channel_utilization = blobmsg_get_u32(tb[CLIENT_TABLE_CHAN_UTIL]);
|
||||||
|
strcpy((char*)ap_entry.ssid, blobmsg_get_string(tb[CLIENT_TABLE_SSID]));
|
||||||
|
|
||||||
if (tb[CLIENT_TABLE_NUM_STA]) {
|
if (tb[CLIENT_TABLE_NUM_STA]) {
|
||||||
ap_entry.station_count = blobmsg_get_u32(tb[CLIENT_TABLE_NUM_STA]);
|
ap_entry.station_count = blobmsg_get_u32(tb[CLIENT_TABLE_NUM_STA]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue