1 /*
2  * Copyright (C) 2021-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 OHOS_I_DHCP_SERVICE_H
16 #define OHOS_I_DHCP_SERVICE_H
17 
18 #include <string>
19 #ifndef OHOS_ARCH_LITE
20 #include "iremote_broker.h"
21 #include "message_parcel.h"
22 #include "message_option.h"
23 #endif
24 #include "i_dhcp_server_callback.h"
25 #include "inner_api/include/dhcp_define.h"
26 #include "dhcp_errcode.h"
27 
28 namespace OHOS {
29 namespace DHCP {
30 #ifdef OHOS_ARCH_LITE
31 class IDhcpServer {
32 #else
33 class IDhcpServer : public IRemoteBroker {
34 #endif
35 public:
~IDhcpServer()36     virtual ~IDhcpServer() {}
37 #ifdef OHOS_ARCH_LITE
38     virtual ErrCode RegisterDhcpServerCallBack(const std::string& ifname,
39         const std::shared_ptr<IDhcpServerCallBack> &callback) = 0;
40 #else
41     virtual ErrCode RegisterDhcpServerCallBack(const std::string& ifname,
42         const sptr<IDhcpServerCallBack> &callback) = 0;
43 #endif
44     virtual ErrCode StartDhcpServer(const std::string& ifname) = 0;
45     virtual ErrCode StopDhcpServer(const std::string& ifname) = 0;
46     virtual ErrCode PutDhcpRange(const std::string& tagName, const DhcpRange& range) = 0;
47     virtual ErrCode RemoveDhcpRange(const std::string& tagName, const DhcpRange& range) = 0;
48     virtual ErrCode RemoveAllDhcpRange(const std::string& tagName) = 0;
49     virtual ErrCode SetDhcpRange(const std::string& ifname, const DhcpRange& range) = 0;
50     virtual ErrCode SetDhcpName(const std::string& ifname, const std::string& tagName) = 0;
51     virtual ErrCode GetDhcpClientInfos(const std::string& ifname, std::vector<std::string>& dhcpClientInfo) = 0;
52     virtual ErrCode UpdateLeasesTime(const std::string& leaseTime) = 0;
53     virtual bool IsRemoteDied() = 0;
54 #ifndef OHOS_ARCH_LITE
55 public:
56     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.wifi.IDhcpServer");
57 #endif
58 };
59 }  // namespace DHCP
60 }  // namespace OHOS
61 #endif