developer | 9037957 | 2024-05-29 17:23:20 +0800 | [diff] [blame^] | 1 | From 68113170930788e52f8fa6089a2882dc28f5693f Mon Sep 17 00:00:00 2001 |
| 2 | From: Simon Chung <simon.c.chung@accenture.com> |
| 3 | Date: Thu, 2 Sep 2021 15:44:57 +0100 |
| 4 | Subject: [PATCH] sta-network |
| 5 | |
| 6 | Change-Id: Idaae3038a352e94d1f2810a8d73b7f77c8e47309 |
| 7 | --- |
| 8 | wifi_hal.h | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 9 | 1 file changed, 91 insertions(+) |
| 10 | |
| 11 | diff --git a/wifi_hal.h b/wifi_hal.h |
| 12 | index 579418e..d284af4 100644 |
| 13 | --- a/wifi_hal.h |
| 14 | +++ b/wifi_hal.h |
| 15 | @@ -110,4 +110,95 @@ |
| 16 | * APIs to be deprecated. Not add new function or structure! |
| 17 | */ |
| 18 | #include "wifi_hal_deprecated.h" |
| 19 | + |
| 20 | +/* DRAFT FOR CLIENT API */ |
| 21 | + |
| 22 | + |
| 23 | +/* APPROACH 1*/ |
| 24 | +typedef enum wifi_sta_network_flags { |
| 25 | + WIFI_STA_NET_F_OPEN, |
| 26 | + WIFI_STA_NET_F_PSK1, |
| 27 | + WIFI_STA_NET_F_PSK2,WIFI_STA_NET_F_PSK_FT, |
| 28 | + WIFI_STA_NET_F_AES, |
| 29 | + WIFI_STA_NET_F_TKIP, |
| 30 | + WIFI_STA_NET_F_4ADDR_MULTI_AP, /* future: easymesh's wds */ |
| 31 | + WIFI_STA_NET_F_OWE, /* future: opportunistic wireless encryption */ |
| 32 | + WIFI_STA_NET_F_SAE, /* future: wpa3 */ |
| 33 | +} wifi_sta_network_flags_t; |
| 34 | +typedef enum wifi_sta_multi_ap_flag { |
| 35 | + WIFI_STA_MULTI_AP_NOT_SUPPORTED, |
| 36 | + WIFI_STA_MULTI_AP_NONE, |
| 37 | + WIFI_STA_MULTI_AP_BHAUL_STA, |
| 38 | +} wifi_sta_multi_ap_flag_t; |
| 39 | + |
| 40 | + |
| 41 | +typedef struct wifi_sta_network { |
| 42 | + int id; |
| 43 | + char bridge[16]; /* valid for 4addr_multi_ap */ |
| 44 | + char ssid[32]; |
| 45 | + char psk[128]; |
| 46 | + char bssid[6]; /* 00:00:00:00:00:00 means any */ |
| 47 | + size_t ssid_len; |
| 48 | + size_t psk_len; |
| 49 | + int multi_ap; |
| 50 | + char pairwise[64]; |
| 51 | + char proto[64]; |
| 52 | + char key_mgmt[64]; |
| 53 | + unsigned long flags; /* enum wifi_sta_network_flags */ |
| 54 | +} wifi_sta_network_t; |
| 55 | + |
| 56 | +typedef struct wifi_sta_network_state { |
| 57 | + struct wifi_sta_network desired_network; |
| 58 | + char current_bssid[6]; /* 00:00:00:00:00:00 means disconnected */ |
| 59 | + int last_deauth_reason; |
| 60 | + int last_disassoc_reason; |
| 61 | +} wifi_sta_network_state_t; |
| 62 | + |
| 63 | +typedef void (*wifi_sta_network_cb)(INT radioIndex, void *ctx); |
| 64 | +INT wifi_setStaNetwork(INT radioIndex, const wifi_sta_network_t *network); |
| 65 | +INT wifi_setStaNetworkSetEventCallback(INT radioIndex, wifi_sta_network_cb *cb, void *ctx); |
| 66 | +INT wifi_getStaNetworkState(INT radioIndex, wifi_sta_network_state_t *state); |
| 67 | +INT wifi_getStaNetworkCapabilities(INT radioIndex, INT *flags); |
| 68 | + |
| 69 | +/* APPROACH 2 */ |
| 70 | +typedef struct { |
| 71 | + CHAR ssid[33]; |
| 72 | + CHAR bssid[17]; |
| 73 | + CHAR passphrase[65]; |
| 74 | +} wifi_staNetwork_t; |
| 75 | + |
| 76 | +INT wifi_getSTANetworks(INT apIndex, wifi_sta_network_t **out_staNetworks_array, INT out_array_size, BOOL *out_scan_cur_freq); |
| 77 | + |
| 78 | +INT wifi_setSTANetworks(INT apIndex, wifi_sta_network_t **staNetworks_array, INT array_size, BOOL scan_cur_freq); |
| 79 | + |
| 80 | +INT wifi_delSTANetworks(INT apIndex); |
| 81 | + |
| 82 | + |
| 83 | +/* notdefined approach */ |
| 84 | +INT wifi_getSTANumberOfEntries(ULONG *output); |
| 85 | +INT wifi_getSTARadioIndex(INT ssidIndex, INT *radioIndex); |
| 86 | +INT wifi_getSTAName(INT apIndex, CHAR *output_string); |
| 87 | +INT wifi_getSTABSSID(INT ssidIndex, CHAR *output_string); |
| 88 | +INT wifi_getSTASSID(INT ssidIndex, CHAR *output_string); |
| 89 | +INT wifi_getSTAMAC(INT ssidIndex, CHAR *output_string); |
| 90 | +INT wifi_getSTAEnabled(INT ssidIndex, BOOL *enabled); |
| 91 | +INT wifi_setSTAEnabled(INT ssidIndex, BOOL enabled); |
| 92 | + |
| 93 | +typedef struct _wifi_client_associated_dev |
| 94 | +{ |
| 95 | + UCHAR MACAddress[6]; /**< The MAC address of an associated device. */ |
| 96 | + INT NetworkID; /**< Network ID */ |
| 97 | + INT connected; /**< If network is connected */ |
| 98 | + INT reason; |
| 99 | + INT locally_generated; |
| 100 | +} wifi_client_associated_dev_t; |
| 101 | + |
| 102 | +typedef INT ( * wifi_client_event_callback)(INT apIndex, wifi_client_associated_dev_t *state); |
| 103 | + |
| 104 | +void wifi_client_event_callback_register(wifi_client_event_callback callback_proc); |
| 105 | +INT wifi_getApChannel(INT radioIndex,ULONG *output_ulong); //RDKB |
| 106 | + |
| 107 | +INT wifi_setApChannel(INT radioIndex, ULONG channel); //RDKB //AP only |
| 108 | + |
| 109 | + |
| 110 | #endif |
| 111 | -- |
| 112 | 2.28.0 |
| 113 | |