1 /*
2  * Copyright (C) 2021-2022 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 OHOS_DHCP_SERVER_CALLBACK_PROXY_H
16 #define OHOS_DHCP_SERVER_CALLBACK_PROXY_H
17 
18 #include "i_dhcp_server_callback.h"
19 #ifdef OHOS_ARCH_LITE
20 #include "serializer.h"
21 #else
22 #include "iremote_proxy.h"
23 #endif
24 
25 namespace OHOS {
26 namespace DHCP {
27 
28 #ifdef OHOS_ARCH_LITE
29 class DhcpServerCallbackProxy : public IDhcpServerCallBack {
30 public:
31     explicit DhcpServerCallbackProxy(SvcIdentity *sid);
32 #else
33 class DhcpServerCallbackProxy : public IRemoteProxy<IDhcpServerCallBack> {
34 public:
35     explicit DhcpServerCallbackProxy(const sptr<IRemoteObject> &impl);
36 #endif
37     virtual ~DhcpServerCallbackProxy();
38 
39     void OnServerStatusChanged(int status) override;
40     void OnServerLeasesChanged(const std::string& ifname, std::vector<std::string>& leases) override;
41     void OnServerSerExitChanged(const std::string& ifname) override;
42     void OnServerSuccess(const std::string& ifname, std::vector<DhcpStationInfo>& stationInfos) override;
43 
44 private:
45 #ifdef OHOS_ARCH_LITE
46     SvcIdentity sid_;
47     static const int DEFAULT_IPC_SIZE = 256;
48 #else
49     static inline BrokerDelegator<DhcpServerCallbackProxy> g_delegator;
50 #endif
51 };
52 }  // namespace DHCP
53 }  // namespace OHOS
54 #endif