• 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 #include <securec.h>
16 #include <hdf_base.h>
17 #include <hdf_log.h>
18 #include <osal_time.h>
19 #include <osal_mem.h>
20 #include "v1_0/ihostapd_callback.h"
21 #include "v1_0/ihostapd_callback.h"
22 #include "hostapd_common_cmd.h"
23 #include "hostapd_impl.h"
24 
25 struct HostapdInterfaceService {
26     struct IHostapdInterface interface;
27 };
28 
HostapdInterfaceImplGetInstance(void)29 struct IHostapdInterface *HostapdInterfaceImplGetInstance(void)
30 {
31     struct HostapdInterfaceService *service = (struct HostapdInterfaceService *)OsalMemCalloc(
32         sizeof(struct HostapdInterfaceService));
33     if (service == NULL) {
34         HDF_LOGE("%{public}s: malloc HostapdInterfaceService obj failed!", __func__);
35         return NULL;
36     }
37     service->interface.StartAp = HostapdInterfaceStartAp;
38     service->interface.StartApWithCmd = HostapdInterfaceStartApWithCmd;
39     service->interface.StopAp = HostapdInterfaceStopAp;
40     service->interface.EnableAp = HostapdInterfaceEnableAp;
41     service->interface.DisableAp = HostapdInterfaceDisableAp;
42     service->interface.SetApPasswd = HostapdInterfaceSetApPasswd;
43     service->interface.SetApName = HostapdInterfaceSetApName;
44     service->interface.SetApWpaValue = HostapdInterfaceSetApWpaValue;
45     service->interface.SetApBand = HostapdInterfaceSetApBand;
46     service->interface.SetAp80211n = HostapdInterfaceSetAp80211n;
47     service->interface.SetApWmm = HostapdInterfaceSetApWmm;
48     service->interface.SetApChannel = HostapdInterfaceSetApChannel;
49     service->interface.SetApMaxConn = HostapdInterfaceSetApMaxConn;
50     service->interface.SetMacFilter = HostapdInterfaceSetMacFilter;
51     service->interface.DelMacFilter = HostapdInterfaceDelMacFilter;
52     service->interface.ReloadApConfigInfo = HostapdInterfaceReloadApConfigInfo;
53     service->interface.GetStaInfos = HostapdInterfaceGetStaInfos;
54     service->interface.DisassociateSta = HostapdInterfaceDisassociateSta;
55     service->interface.RegisterEventCallback = HostapdInterfaceRegisterEventCallback;
56     service->interface.UnregisterEventCallback = HostapdInterfaceUnregisterEventCallback;
57     service->interface.HostApdShellCmd = HostApdInterfaceShellCmd;
58     return &service->interface;
59 }
60 
HostapdInterfaceImplRelease(struct IHostapdInterface * instance)61 void HostapdInterfaceImplRelease(struct IHostapdInterface *instance)
62 {
63     if (instance == NULL) {
64         return;
65     }
66     OsalMemFree(instance);
67 }
68