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 32 #define WPA_HOSTAPD_NAME "hostapd" 33 #define HOSTAPD_START_CMD "hostapd -g /data/service/el1/public/wifi/sockets/wpa/hostapd" 34 #define WPA_SLEEP_TIME (100 * 1000) /* 100ms */ 35 36 int32_t HostapdInterfaceStartAp(struct IHostapdInterface *self); 37 38 int32_t HostapdInterfaceStartApWithCmd(struct IHostapdInterface *self, const char *ifName, int id); 39 40 int32_t HostapdInterfaceStopAp(struct IHostapdInterface *self); 41 42 int32_t HostapdInterfaceEnableAp(struct IHostapdInterface *self, 43 const char *ifName, int32_t id); 44 45 int32_t HostapdInterfaceDisableAp(struct IHostapdInterface *self, 46 const char *ifName, int32_t id); 47 48 int32_t HostapdInterfaceSetApPasswd(struct IHostapdInterface *self, 49 const char *ifName, const char *pass, int32_t id); 50 51 int32_t HostapdInterfaceSetApName(struct IHostapdInterface *self, 52 const char *ifName, const char *name, int32_t id); 53 54 int32_t HostapdInterfaceSetApWpaValue(struct IHostapdInterface *self, 55 const char *ifName, int32_t securityType, int32_t id); 56 57 int32_t HostapdInterfaceSetApBand(struct IHostapdInterface *self, 58 const char *ifName, int32_t band, int32_t id); 59 60 int32_t HostapdInterfaceSetAp80211n(struct IHostapdInterface *self, 61 const char *ifName, int32_t value, int32_t id); 62 63 int32_t HostapdInterfaceSetApWmm(struct IHostapdInterface *self, 64 const char *ifName, int32_t value, int32_t id); 65 66 int32_t HostapdInterfaceSetApChannel(struct IHostapdInterface *self, 67 const char *ifName, int32_t channel, int32_t id); 68 69 int32_t HostapdInterfaceSetApMaxConn(struct IHostapdInterface *self, 70 const char *ifName, int32_t maxConn, int32_t id); 71 72 int32_t HostapdInterfaceSetMacFilter(struct IHostapdInterface *self, 73 const char *ifName, const char *mac, int32_t id); 74 75 int32_t HostapdInterfaceDelMacFilter(struct IHostapdInterface *self, 76 const char *ifName, const char *mac, int32_t id); 77 78 int32_t HostapdInterfaceReloadApConfigInfo(struct IHostapdInterface *self, 79 const char *ifName, int32_t id); 80 81 int32_t HostapdInterfaceGetStaInfos(struct IHostapdInterface *self, 82 const char *ifName, char *buf, uint32_t bufLen, int32_t size, int32_t id); 83 84 int32_t HostapdInterfaceDisassociateSta(struct IHostapdInterface *self, 85 const char *ifName, const char *mac, int32_t id); 86 87 int32_t HostapdInterfaceRegisterEventCallback(struct IHostapdInterface *self, 88 struct IHostapdCallback *cbFunc, const char *ifName); 89 90 int32_t HostapdInterfaceUnregisterEventCallback(struct IHostapdInterface *self, 91 struct IHostapdCallback *cbFunc, const char *ifName); 92 93 void HostapdEventReport(const char *ifName, uint32_t event, void *data); 94 95 int32_t HostApdInterfaceShellCmd(struct IHostapdInterface *self, const char *ifName, const char *cmd); 96 97 struct StApMainParam { 98 int argc; 99 char argv[MAX_WPA_MAIN_ARGC_NUM][MAX_WPA_MAIN_ARGV_LEN]; 100 }; 101 102 struct RemoteServiceDeathRecipient { 103 struct HdfDeathRecipient recipient; 104 }; 105 #endif 106