1 /* 2 * Copyright (C) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef WIFI_WPA_HAL_H 17 #define WIFI_WPA_HAL_H 18 19 #include <stdbool.h> 20 #include <stdlib.h> 21 #include <string.h> 22 #include <stdint.h> 23 #include <pthread.h> 24 #include "wifi_wpa_common.h" 25 #include "wifi_hal_define.h" 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 #define WIFI_CONF_FILE_PATH_LEN 256 32 33 typedef struct AddInterfaceArgv { 34 char name[WIFI_IFACE_NAME_MAXLEN]; 35 char confName[WIFI_CONF_FILE_PATH_LEN]; 36 } AddInterfaceArgv; 37 38 typedef struct stWpaIfaceInfo { 39 char name[WIFI_IFACE_NAME_MAXLEN]; 40 int num; 41 struct stWpaIfaceInfo *next; 42 } WpaIfaceInfo; 43 44 typedef struct stWifiWpaInterface WifiWpaInterface; 45 struct stWifiWpaInterface { 46 WpaCtrl wpaCtrl; 47 pthread_t tid; 48 int threadRunFlag; 49 WpaIfaceInfo *ifaces; 50 51 int (*wpaCliConnect)(WifiWpaInterface *p); 52 void (*wpaCliClose)(WifiWpaInterface *p); 53 int (*wpaCliAddIface)(WifiWpaInterface *p, const AddInterfaceArgv *argv, bool isWpaAdd); 54 int (*wpaCliRemoveIface)(WifiWpaInterface *p, const char *name); 55 int (*wpaCliTerminate)(void); 56 }; 57 58 WifiWpaInterface *GetWifiWapGlobalInterface(void); 59 void ReleaseWpaGlobalInterface(void); 60 WpaCtrl *GetWpaCtrl(void); 61 #ifdef __cplusplus 62 } 63 #endif 64 #endif 65