mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-11-01 19:07:47 +00:00
opensync: client events supported
-assoc/disassoc type client events now supported Signed-off-by: Ammad Rehmat <ammad.rehmat@connectus.ai>
This commit is contained in:
committed by
John Crispin
parent
b3d692100c
commit
8454cdb271
207
feeds/wlan-ap/opensync/patches/12-client-connection-events
Normal file
207
feeds/wlan-ap/opensync/patches/12-client-connection-events
Normal file
@@ -0,0 +1,207 @@
|
||||
Index: opensync-2.0.5.0/src/lib/datapipeline/inc/dpp_client.h
|
||||
===================================================================
|
||||
--- opensync-2.0.5.0.orig/src/lib/datapipeline/inc/dpp_client.h
|
||||
+++ opensync-2.0.5.0/src/lib/datapipeline/inc/dpp_client.h
|
||||
@@ -32,6 +32,27 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
|
||||
|
||||
#include "dpp_types.h"
|
||||
|
||||
+// proto: ConnectionEventType
|
||||
+typedef enum
|
||||
+{
|
||||
+ CLIENT_ASSOC = 0,
|
||||
+ CLIENT_AUTH,
|
||||
+ CLIENT_DISCONNECT,
|
||||
+ CLIENT_FAILURE,
|
||||
+ CLIENT_FIRST_DATA,
|
||||
+ CLIEND_ID,
|
||||
+ CLIENT_IP,
|
||||
+ CLIENT_TIMEOUT
|
||||
+} dpp_client_connection_event_type_t;
|
||||
+
|
||||
+// proto: AssocType
|
||||
+typedef enum
|
||||
+{
|
||||
+ ASSOC = 0,
|
||||
+ REASSOC,
|
||||
+ MAX_ASSOC_TYPES
|
||||
+} dpp_client_assoc_type_t;
|
||||
+
|
||||
/* MCS/NSS/BW rate table and indexes that should be used for supported rates
|
||||
----------------------------------------------
|
||||
| type | bw | nss | mcs
|
||||
@@ -188,6 +209,42 @@ typedef struct
|
||||
int32_t rssi;
|
||||
} dpp_client_stats_t;
|
||||
|
||||
+typedef struct
|
||||
+{
|
||||
+ dpp_client_connection_event_type_t type;
|
||||
+ mac_address_t sta_mac;
|
||||
+ uint64_t session_id;
|
||||
+ radio_essid_t ssid;
|
||||
+ radio_type_t band;
|
||||
+ dpp_client_assoc_type_t assoc;
|
||||
+ uint32_t status;
|
||||
+ int32_t rssi;
|
||||
+ uint32_t internal_sc;
|
||||
+ bool using_11k;
|
||||
+ bool using_11r;
|
||||
+ bool using_11v;
|
||||
+ ds_dlist_node_t node;
|
||||
+} dpp_client_connection_events_t;
|
||||
+
|
||||
+static inline dpp_client_connection_events_t * dpp_client_connection_events_record_alloc()
|
||||
+{
|
||||
+ dpp_client_connection_events_t *record = NULL;
|
||||
+
|
||||
+ record = malloc(sizeof(dpp_client_connection_events_t));
|
||||
+ if (record) {
|
||||
+ memset(record, 0, sizeof(dpp_client_connection_events_t));
|
||||
+ }
|
||||
+
|
||||
+ return record;
|
||||
+}
|
||||
+
|
||||
+static inline void dpp_client_connection_events_record_free(dpp_client_connection_events_t *record)
|
||||
+{
|
||||
+ if (NULL != record) {
|
||||
+ free(record);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
typedef void (*dpp_client_report_cb_t)(
|
||||
radio_type_t radio_type);
|
||||
|
||||
@@ -216,6 +273,7 @@ typedef struct
|
||||
ds_dlist_t stats_rx; /* dpp_client_stats_rx_t */
|
||||
ds_dlist_t stats_tx; /* dpp_client_stats_tx_t */
|
||||
ds_dlist_t tid_record_list;/* dpp_client_tid_record_list_t */
|
||||
+ ds_dlist_t connection_events;/* dpp_client_connection_events_t */
|
||||
|
||||
/* Connectivity client data */
|
||||
uint32_t is_connected;
|
||||
Index: opensync-2.0.5.0/src/lib/datapipeline/src/dppline.c
|
||||
===================================================================
|
||||
--- opensync-2.0.5.0.orig/src/lib/datapipeline/src/dppline.c
|
||||
+++ opensync-2.0.5.0/src/lib/datapipeline/src/dppline.c
|
||||
@@ -77,6 +77,8 @@ typedef struct
|
||||
int32_t tx_qty;
|
||||
dpp_client_tid_record_list_t *tid;
|
||||
int32_t tid_qty;
|
||||
+ dpp_client_connection_events_t *events;
|
||||
+ int32_t events_qty;
|
||||
} dppline_client_rec_t;
|
||||
|
||||
typedef struct
|
||||
@@ -366,6 +368,8 @@ static bool dppline_copysts(dppline_stat
|
||||
ds_dlist_iter_t tx_iter;
|
||||
dpp_client_tid_record_list_t *tid = NULL;
|
||||
ds_dlist_iter_t tid_iter;
|
||||
+ dpp_client_connection_events_t *events = NULL;
|
||||
+ ds_dlist_iter_t events_iter;
|
||||
|
||||
/* Loop through linked list of results and copy them to dppline buffer */
|
||||
dst->u.client.qty = 0;
|
||||
@@ -458,6 +462,29 @@ static bool dppline_copysts(dppline_stat
|
||||
|
||||
dst->u.client.list[dst->u.client.qty].tid_qty++;
|
||||
}
|
||||
+
|
||||
+ /* Add client connection events records */
|
||||
+ for ( events = ds_dlist_ifirst(&events_iter, &result_entry->connection_events);
|
||||
+ events != NULL;
|
||||
+ events = ds_dlist_inext(&events_iter))
|
||||
+ {
|
||||
+ size = (dst->u.client.list[dst->u.client.qty].events_qty + 1) * sizeof(dpp_client_connection_events_t);
|
||||
+ if (!dst->u.client.list[dst->u.client.qty].events_qty) {
|
||||
+ dst->u.client.list[dst->u.client.qty].events = calloc(1, size);
|
||||
+ }
|
||||
+ else {
|
||||
+ dst->u.client.list[dst->u.client.qty].events =
|
||||
+ realloc(dst->u.client.list[dst->u.client.qty].events, size);
|
||||
+ memset(&dst->u.client.list[dst->u.client.qty].events[dst->u.client.list[dst->u.client.qty].events_qty],
|
||||
+ 0,
|
||||
+ sizeof(dpp_client_connection_events_t));
|
||||
+ }
|
||||
+ memcpy(&dst->u.client.list[dst->u.client.qty].events[dst->u.client.list[dst->u.client.qty].events_qty],
|
||||
+ events,
|
||||
+ sizeof(dpp_client_connection_events_t));
|
||||
+
|
||||
+ dst->u.client.list[dst->u.client.qty].events_qty++;
|
||||
+ }
|
||||
dst->u.client.qty++;
|
||||
}
|
||||
}
|
||||
@@ -1214,6 +1241,62 @@ static void dppline_add_stat_client(Sts_
|
||||
dtid->sojourn = realloc(dtid->sojourn, n * sizeof(*dtid->sojourn));
|
||||
size += n * sizeof(*dtid->sojourn);
|
||||
}
|
||||
+
|
||||
+ dr->event_list = malloc(client->list[i].events_qty * sizeof(*dr->event_list));
|
||||
+ size += client->list[i].events_qty * sizeof(*dr->event_list);
|
||||
+ assert(dr->event_list);
|
||||
+ dr->n_event_list = client->list[i].events_qty;
|
||||
+ for (j = 0; j < client->list[i].events_qty; j++)
|
||||
+ {
|
||||
+ Sts__Client__ConnectionEvent *devents;
|
||||
+ dpp_client_connection_events_t *sevents = &client->list[i].events[j];
|
||||
+
|
||||
+ devents = dr->event_list[j] = malloc(sizeof(**dr->event_list));
|
||||
+ sts__client__connection_event__init(devents);
|
||||
+
|
||||
+ devents->type = sevents->type;
|
||||
+ devents->sta_mac = malloc(MACADDR_STR_LEN);
|
||||
+ dpp_mac_to_str(sevents->sta_mac, devents->sta_mac);
|
||||
+ size += MACADDR_STR_LEN;
|
||||
+
|
||||
+ if (sevents->session_id) {
|
||||
+ devents->session_id = sevents->session_id;
|
||||
+ devents->has_session_id = true;
|
||||
+ }
|
||||
+ devents->ssid = sevents->ssid;
|
||||
+ if (sevents->band) {
|
||||
+ devents->band = sevents->band;
|
||||
+ devents->has_band = true;
|
||||
+ }
|
||||
+ if (sevents->assoc) {
|
||||
+ devents->assoc_type = sevents->assoc;
|
||||
+ devents->has_assoc_type = true;
|
||||
+ }
|
||||
+ if (sevents->status) {
|
||||
+ devents->status = sevents->status;
|
||||
+ devents->has_status = true;
|
||||
+ }
|
||||
+ if (sevents->rssi) {
|
||||
+ devents->rssi = sevents->rssi;
|
||||
+ devents->has_rssi = true;
|
||||
+ }
|
||||
+ if (sevents->internal_sc) {
|
||||
+ devents->internal_sc = sevents->internal_sc;
|
||||
+ devents->has_internal_sc = true;
|
||||
+ }
|
||||
+ if (sevents->using_11k) {
|
||||
+ devents->using11k = sevents->using_11k;
|
||||
+ devents->has_using11k = true;
|
||||
+ }
|
||||
+ if (sevents->using_11r) {
|
||||
+ devents->using11r = sevents->using_11r;
|
||||
+ devents->has_using11r = true;
|
||||
+ }
|
||||
+ if (sevents->using_11v) {
|
||||
+ devents->using11v = sevents->using_11v;
|
||||
+ devents->has_using11v = true;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
/*LOG(DEBUG, "============= %s size raw: %d alloc: %d proto struct: %d", __FUNCTION__,
|
||||
sizeof(*s->u.device), s->size, size);*/
|
||||
@@ -2272,6 +2355,9 @@ dpp_client_record_t* dpp_client_record_a
|
||||
// init tid_record_list dlist
|
||||
ds_dlist_init(&record->tid_record_list, dpp_client_tid_record_list_t, node);
|
||||
|
||||
+ // init connection_events dlist
|
||||
+ ds_dlist_init(&record->connection_events, dpp_client_connection_events_t, node);
|
||||
+
|
||||
return record;
|
||||
}
|
||||
Reference in New Issue
Block a user