mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
add network overview
This commit is contained in:
parent
940e06e8ed
commit
1be4ca829c
3 changed files with 52 additions and 2 deletions
|
@ -193,6 +193,8 @@ ap ap_array_get_ap(uint8_t bssid_addr[]);
|
|||
|
||||
int build_hearing_map_sort_client(struct blob_buf *b);
|
||||
|
||||
int build_network_overview(struct blob_buf *b);
|
||||
|
||||
/* Utils */
|
||||
|
||||
// ---------------- Defines -------------------
|
||||
|
|
|
@ -114,6 +114,39 @@ int build_hearing_map_sort_client(struct blob_buf *b)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int build_network_overview(struct blob_buf *b)
|
||||
{
|
||||
pthread_mutex_lock(&probe_array_mutex);
|
||||
|
||||
void *client_list, *ap_list;
|
||||
char ap_mac_buf[20];
|
||||
char client_mac_buf[20];
|
||||
|
||||
blob_buf_init(b, 0);
|
||||
int i;
|
||||
for (i = 0; i <= client_entry_last; i++) {
|
||||
int k;
|
||||
sprintf(ap_mac_buf, MACSTR, MAC2STR(client_array[i].bssid_addr));
|
||||
ap_list = blobmsg_open_table(b, ap_mac_buf);
|
||||
for (k = i; i <= client_entry_last; k++){
|
||||
if(!mac_is_equal(client_array[k].bssid_addr, client_array[i].bssid_addr))
|
||||
{
|
||||
i = k - 1;
|
||||
break;
|
||||
}
|
||||
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_close_table(b, client_list);
|
||||
}
|
||||
blobmsg_close_table(b, ap_list);
|
||||
}
|
||||
pthread_mutex_unlock(&probe_array_mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int eval_probe_metric(struct probe_entry_s probe_entry) {
|
||||
|
||||
int score = 0;
|
||||
|
|
|
@ -146,6 +146,10 @@ static int get_hearing_map(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
struct ubus_request_data *req, const char *method,
|
||||
struct blob_attr *msg);
|
||||
|
||||
static int get_network(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
struct blob_attr *msg);
|
||||
|
||||
int hostapd_array_check_id(uint32_t id);
|
||||
|
||||
void hostapd_array_insert(uint32_t id);
|
||||
|
@ -719,7 +723,8 @@ static const struct blobmsg_policy add_del_policy[__ADD_DEL_MAC_MAX] = {
|
|||
|
||||
static const struct ubus_method dawn_methods[] = {
|
||||
UBUS_METHOD("add_mac", add_mac, add_del_policy),
|
||||
UBUS_METHOD_NOARG("get_hearing_map", get_hearing_map)
|
||||
UBUS_METHOD_NOARG("get_hearing_map", get_hearing_map),
|
||||
UBUS_METHOD_NOARG("get_network", get_network)
|
||||
//UBUS_METHOD_NOARG("get_aps");
|
||||
//UBUS_METHOD_NOARG("get_clients");
|
||||
};
|
||||
|
@ -766,6 +771,16 @@ static int get_hearing_map(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int get_network(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
struct blob_attr *msg) {
|
||||
|
||||
build_network_overview(&b);
|
||||
ubus_send_reply(ctx, req, b.head);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ubus_add_oject()
|
||||
{
|
||||
int ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue