1 /*
2  * Copyright (C) 2021 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_CLIENT_CALLBACK_PROXY_H
16 #define OHOS_DHCP_CLIENT_CALLBACK_PROXY_H
17 
18 #include "i_dhcp_client_callback.h"
19 #ifdef OHOS_ARCH_LITE
20     #ifndef  OHOS_EUPDATER
21         #include "serializer.h"
22     #endif
23 #else
24 #include "iremote_proxy.h"
25 #endif
26 #include "dhcp_define.h"
27 
28 namespace OHOS {
29 namespace DHCP {
30 
31 #ifdef OHOS_ARCH_LITE
32 class DhcpClientCallbackProxy : public IDhcpClientCallBack {
33 public:
34     #ifndef  OHOS_EUPDATER
35     explicit DhcpClientCallbackProxy(SvcIdentity *sid);
36     #endif
37     virtual ~DhcpClientCallbackProxy();
38 #else
39 class DhcpClientCallbackProxy : public IRemoteProxy<IDhcpClientCallBack> {
40 public:
41     explicit DhcpClientCallbackProxy(const sptr<IRemoteObject> &impl);
42     virtual ~DhcpClientCallbackProxy();
43     void OnDhcpOfferReport(int status, const std::string& ifname, DhcpResult& result) override;
44 #endif
45 
46     void OnIpSuccessChanged(int status, const std::string& ifname, DhcpResult& result) override;
47     void OnIpFailChanged(int status, const std::string& ifname, const std::string& reason) override;
48 private:
49 #ifdef OHOS_ARCH_LITE
50     #ifndef  OHOS_EUPDATER
51     SvcIdentity sid_;
52     #endif
53     static const int DEFAULT_IPC_SIZE = 256;
54 #else
55     static inline BrokerDelegator<DhcpClientCallbackProxy> g_delegator;
56 #endif
57 };
58 }  // namespace DHCP
59 }  // namespace OHOS
60 #endif
61