1 /*
2  * Copyright (c) 2021-2024 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 ETHERNET_SERVICE_STUB_H
17 #define ETHERNET_SERVICE_STUB_H
18 
19 #include <cstdint>
20 #include <map>
21 
22 #include <functional>
23 #include "i_ethernet_service.h"
24 #include "iremote_stub.h"
25 #include "refbase.h"
26 
27 namespace OHOS {
28 namespace NetManagerStandard {
29 class EthernetServiceStub : public IRemoteStub<IEthernetService> {
30     using EthernetServiceFunc = int32_t (EthernetServiceStub::*)(MessageParcel &, MessageParcel &);
31 
32 public:
33     EthernetServiceStub();
34     ~EthernetServiceStub() = default;
35     int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
36 
37 private:
38     int32_t OnGetMacAddress(MessageParcel &data, MessageParcel &reply);
39     int32_t OnSetIfaceConfig(MessageParcel &data, MessageParcel &reply);
40     int32_t OnGetIfaceConfig(MessageParcel &data, MessageParcel &reply);
41     int32_t OnIsIfaceActive(MessageParcel &data, MessageParcel &reply);
42     int32_t OnGetAllActiveIfaces(MessageParcel &data, MessageParcel &reply);
43     int32_t OnResetFactory(MessageParcel &data, MessageParcel &reply);
44     int32_t OnRegisterIfacesStateChanged(MessageParcel &data, MessageParcel &reply);
45     int32_t OnUnregisterIfacesStateChanged(MessageParcel &data, MessageParcel &reply);
46     int32_t OnSetInterfaceUp(MessageParcel &data, MessageParcel &reply);
47     int32_t OnSetInterfaceDown(MessageParcel &data, MessageParcel &reply);
48     int32_t OnGetInterfaceConfig(MessageParcel &data, MessageParcel &reply);
49     int32_t OnSetInterfaceConfig(MessageParcel &data, MessageParcel &reply);
50 
51 private:
52     std::map<uint32_t, EthernetServiceFunc> memberFuncMap_;
53 };
54 } // namespace NetManagerStandard
55 } // namespace OHOS
56 #endif // ETHERNET_SERVICE_STUB_H
57