• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef OHOS_DHCP_SERVER_STUB_LITE_H
17 #define OHOS_DHCP_SERVER_STUB_LITE_H
18 
19 #include <map>
20 #include "i_dhcp_server.h"
21 #include "serializer.h"
22 namespace OHOS {
23 namespace Wifi {
24 
25 #define MAX_READ_EVENT_SIZE     512
26 
27 class DhcpServerStub : public IDhcpServer {
28 public:
29     DhcpServerStub();
30     virtual ~DhcpServerStub();
31     virtual int OnRemoteRequest(uint32_t code, IpcIo *req, IpcIo *reply);
32 public:
33     const int MAC_ADDR_MAX_LEN = 17;
34     const int DHCP_LEASE_FORMAT_SIZE = 5;
35     const int DHCP_LEASE_MAC_ADDR_POS = 0;
36     const int DHCP_LEASE_IP_ADDR_POS = 1;
37     const int DHCP_LEASE_HOSTNAME_POS = 2;
38 
39 private:
40     int CheckInterfaceToken(uint32_t code, IpcIo *req);
41     int OnRegisterCallBack(uint32_t code, IpcIo *req, IpcIo *reply);
42     int OnStartDhcpServer(uint32_t code, IpcIo *req, IpcIo *reply);
43     int OnStopDhcpServer(uint32_t code, IpcIo *req, IpcIo *reply);
44     int OnSetDhcpName(uint32_t code, IpcIo *req, IpcIo *reply);
45     int OnSetDhcpRange(uint32_t code, IpcIo *req, IpcIo *reply);
46     int OnRemoveAllDhcpRange(uint32_t code, IpcIo *req, IpcIo *reply);
47     int OnRemoveDhcpRange(uint32_t code, IpcIo *req, IpcIo *reply);
48     int OnGetDhcpClientInfos(uint32_t code, IpcIo *req, IpcIo *reply);
49     int OnUpdateLeasesTime(uint32_t code, IpcIo *req, IpcIo *reply);
50     int OnPutDhcpRange(uint32_t code, IpcIo *req, IpcIo *reply);
51 private:
52     //sptr<IRemoteObject::DeathRecipient> deathRecipient_;
53 };
54 }  // namespace Wifi
55 }  // namespace OHOS
56 #endif