• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #ifndef HOSTAPD_COMMON_CMD_H
16 #define HOSTAPD_COMMON_CMD_H
17 
18 #include "../hostapd_impl.h"
19 #include "hdi_hostapd_hal.h"
20 #include <pthread.h>
21 #include <hdf_remote_service.h>
22 
23 #define WIFI_MULTI_CMD_MAX_LEN 1024
24 #define BUFFSIZE_REQUEST 4096
25 #define CMD_SIZE 100
26 #define REPLY_SIZE 1024
27 #define MAX_WPA_MAIN_ARGC_NUM 20
28 #define MAX_WPA_MAIN_ARGV_LEN 128
29 #define PATH_NUM 2
30 #define BUFF_SIZE 256
31 #define HOSTAPD_MAJOR_VER 1
32 #define HOSTAPD_MINOR_VER 0
33 
34 #define WPA_HOSTAPD_NAME "hostapd"
35 #define HOSTAPD_START_CMD "hostapd -g /data/service/el1/public/wifi/sockets/wpa/hostapd"
36 #define WPA_SLEEP_TIME (100 * 1000) /* 100ms */
37 
38 int32_t HostapdInterfaceStartAp(struct IHostapdInterface *self);
39 
40 int32_t HostapdInterfaceStartApWithCmd(struct IHostapdInterface *self, const char *ifName, int id);
41 
42 int32_t HostapdInterfaceStopAp(struct IHostapdInterface *self);
43 
44 int32_t HostapdInterfaceEnableAp(struct IHostapdInterface *self,
45     const char *ifName, int32_t id);
46 
47 int32_t HostapdInterfaceDisableAp(struct IHostapdInterface *self,
48     const char *ifName, int32_t id);
49 
50 int32_t HostapdInterfaceSetApPasswd(struct IHostapdInterface *self,
51     const char *ifName, const char *pass, int32_t id);
52 
53 int32_t HostapdInterfaceSetApName(struct IHostapdInterface *self,
54     const char *ifName, const char *name, int32_t id);
55 
56 int32_t HostapdInterfaceSetApWpaValue(struct IHostapdInterface *self,
57     const char *ifName, int32_t securityType, int32_t id);
58 
59 int32_t HostapdInterfaceSetApBand(struct IHostapdInterface *self,
60     const char *ifName, int32_t band, int32_t id);
61 
62 int32_t HostapdInterfaceSetAp80211n(struct IHostapdInterface *self,
63     const char *ifName, int32_t value, int32_t id);
64 
65 int32_t HostapdInterfaceSetApWmm(struct IHostapdInterface *self,
66     const char *ifName, int32_t value, int32_t id);
67 
68 int32_t HostapdInterfaceSetApChannel(struct IHostapdInterface *self,
69     const char *ifName, int32_t channel, int32_t id);
70 
71 int32_t HostapdInterfaceSetApMaxConn(struct IHostapdInterface *self,
72     const char *ifName, int32_t maxConn, int32_t id);
73 
74 int32_t HostapdInterfaceSetMacFilter(struct IHostapdInterface *self,
75     const char *ifName, const char *mac, int32_t id);
76 
77 int32_t HostapdInterfaceDelMacFilter(struct IHostapdInterface *self,
78     const char *ifName, const char *mac, int32_t id);
79 
80 int32_t HostapdInterfaceReloadApConfigInfo(struct IHostapdInterface *self,
81     const char *ifName, int32_t id);
82 
83 int32_t HostapdInterfaceGetStaInfos(struct IHostapdInterface *self,
84     const char *ifName, char *buf, uint32_t bufLen, int32_t size, int32_t id);
85 
86 int32_t HostapdInterfaceDisassociateSta(struct IHostapdInterface *self,
87     const char *ifName, const char *mac, int32_t id);
88 
89 int32_t HostapdInterfaceRegisterEventCallback(struct IHostapdInterface *self,
90     struct IHostapdCallback *cbFunc, const char *ifName);
91 
92 int32_t HostapdInterfaceUnregisterEventCallback(struct IHostapdInterface *self,
93     struct IHostapdCallback *cbFunc, const char *ifName);
94 
95 void HostapdEventReport(const char *ifName, uint32_t event, void *data);
96 
97 int32_t HostApdInterfaceShellCmd(struct IHostapdInterface *self, const char *ifName, const char *cmd);
98 
99 int32_t HostapdGetVersion(struct IHostapdInterface *self, uint32_t *majorVer, uint32_t *minorVer);
100 
101 struct StApMainParam {
102     int argc;
103     char argv[MAX_WPA_MAIN_ARGC_NUM][MAX_WPA_MAIN_ARGV_LEN];
104 };
105 
106 struct RemoteServiceDeathRecipient {
107     struct HdfDeathRecipient recipient;
108 };
109 #endif
110