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 16#ifndef OHOS_HDI_WLAN_HOSTAPD_V1_0_IHOSTAPDCALLBACK_H 17#define OHOS_HDI_WLAN_HOSTAPD_V1_0_IHOSTAPDCALLBACK_H 18 19#include <stdbool.h> 20#include <stdint.h> 21#include <hdf_base.h> 22#include "wlan/hostapd/v1_0/hostapd_types.h" 23 24#ifdef __cplusplus 25extern "C" { 26#endif /* __cplusplus */ 27 28struct HdfRemoteService; 29 30#define IHOSTAPDCALLBACK_INTERFACE_DESC "ohos.hdi.wlan.hostapd.v1_0.IHostapdCallback" 31 32#define IHOSTAPD_CALLBACK_MAJOR_VERSION 1 33#define IHOSTAPD_CALLBACK_MINOR_VERSION 0 34 35#ifndef HDI_BUFF_MAX_SIZE 36#define HDI_BUFF_MAX_SIZE (1024 * 200) 37#endif 38 39#ifndef HDI_CHECK_VALUE_RETURN 40#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ 41 if ((lv) compare (rv)) { \ 42 return ret; \ 43 } \ 44} while (false) 45#endif 46 47#ifndef HDI_CHECK_VALUE_RET_GOTO 48#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ 49 if ((lv) compare (rv)) { \ 50 ret = value; \ 51 goto table; \ 52 } \ 53} while (false) 54#endif 55 56enum { 57 CMD_HOSTAPD_CALLBACK_GET_VERSION = 0, 58 CMD_HOSTAPD_CALLBACK_ON_EVENT_STA_JOIN = 1, 59 CMD_HOSTAPD_CALLBACK_ON_EVENT_AP_STATE = 2, 60 CMD_HOSTAPD_CALLBACK_ON_EVENT_HOST_APD_NOTIFY = 3, 61}; 62 63struct IHostapdCallback { 64 int32_t (*OnEventStaJoin)(struct IHostapdCallback *self, const struct HdiApCbParm* apCbParm, const char* ifName); 65 66 int32_t (*OnEventApState)(struct IHostapdCallback *self, const struct HdiApCbParm* apCbParm, const char* ifName); 67 68 int32_t (*OnEventHostApdNotify)(struct IHostapdCallback *self, const char* notifyParam, const char* ifName); 69 70 int32_t (*GetVersion)(struct IHostapdCallback *self, uint32_t* majorVer, uint32_t* minorVer); 71 72 struct HdfRemoteService* (*AsObject)(struct IHostapdCallback *self); 73}; 74 75// no external method used to create client object, it only support ipc mode 76struct IHostapdCallback *IHostapdCallbackGet(struct HdfRemoteService *remote); 77 78// external method used to release client object, it support ipc and passthrought mode 79void IHostapdCallbackRelease(struct IHostapdCallback *instance); 80#ifdef __cplusplus 81} 82#endif /* __cplusplus */ 83 84#endif // OHOS_HDI_WLAN_HOSTAPD_V1_0_IHOSTAPDCALLBACK_H