• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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 HDI_WPA_HAL_H
17 #define HDI_WPA_HAL_H
18 
19 #include <sys/types.h>
20 #include <stdlib.h>
21 #include <string.h>
22 #include <malloc.h>
23 #include <stdint.h>
24 
25 #include "wpa_hdi_util.h"
26 #include "v1_0/iethernet.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 typedef struct WpaCtrl {
33     struct wpa_ctrl *pSend;
34     struct wpa_ctrl *pRecv;
35 } WpaCtrl;
36 
37 typedef struct EthWpaInstance EthWpaInstance;
38 struct EthWpaInstance {
39     WpaCtrl staCtrl;
40     pthread_t tid;
41     int (*wpaCliConnect)(EthWpaInstance *p);
42     void (*wpaCliClose)(EthWpaInstance *p);
43     int (*wpaCliTerminate)();
44     int (*wpaCliCmdSetNetwork)(EthWpaInstance *p, const char *ifName, const char *name, const char *value);
45     int (*wpaCliCmdStaShellCmd)(EthWpaInstance *p, const char *ifName, const char *params);
46 };
47 
48 int InitWpaCtrl(WpaCtrl *pCtrl, const char *ctrlPath);
49 void ReleaseWpaCtrl(WpaCtrl *pCtrl);
50 int WpaCliCmd(const char *cmd, char *buf, size_t bufLen);
51 
52 void InitEthWpaGlobalInstance(void);
53 void ReleaseEthWpaGlobalInstance(void);
54 EthWpaInstance *GetEthWpaGlobalInstance(void);
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 #endif
60