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 SOFTBUS_SERVER_STUB_H_ 17 #define SOFTBUS_SERVER_STUB_H_ 18 19 #include <map> 20 #include "if_softbus_server.h" 21 #include "iremote_object.h" 22 #include "iremote_stub.h" 23 #include "bus_center_manager.h" 24 25 namespace OHOS { 26 class SoftBusServerStub : public IRemoteStub<ISoftBusServer> { 27 public: 28 SoftBusServerStub(); 29 virtual ~SoftBusServerStub() = default; 30 int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 31 32 private: 33 int32_t GetNodeKeyInfoLen(int32_t key); 34 int32_t SoftbusRegisterServiceInner(MessageParcel &data, MessageParcel &reply); 35 36 int32_t CreateSessionServerInner(MessageParcel &data, MessageParcel &reply); 37 int32_t RemoveSessionServerInner(MessageParcel &data, MessageParcel &reply); 38 int32_t OpenSessionInner(MessageParcel &data, MessageParcel &reply); 39 int32_t OpenAuthSessionInner(MessageParcel &data, MessageParcel &reply); 40 int32_t NotifyAuthSuccessInner(MessageParcel &data, MessageParcel &reply); 41 int32_t ReleaseResourcesInner(MessageParcel &data, MessageParcel &reply); 42 int32_t CloseChannelInner(MessageParcel &data, MessageParcel &reply); 43 int32_t CloseChannelWithStatisticsInner(MessageParcel &data, MessageParcel &reply); 44 int32_t SendMessageInner(MessageParcel &data, MessageParcel &reply); 45 int32_t CheckOpenSessionPermission(const SessionParam *param); 46 int32_t CheckChannelPermission(int32_t channelId, int32_t channelType); 47 int32_t EvaluateQosInner(MessageParcel &data, MessageParcel &reply); 48 49 int32_t JoinLNNInner(MessageParcel &data, MessageParcel &reply); 50 int32_t LeaveLNNInner(MessageParcel &data, MessageParcel &reply); 51 int32_t GetAllOnlineNodeInfoInner(MessageParcel &data, MessageParcel &reply); 52 int32_t GetLocalDeviceInfoInner(MessageParcel &data, MessageParcel &reply); 53 int32_t GetNodeKeyInfoInner(MessageParcel &data, MessageParcel &reply); 54 int32_t SetNodeDataChangeFlagInner(MessageParcel &data, MessageParcel &reply); 55 int32_t RegDataLevelChangeCbInner(MessageParcel &data, MessageParcel &reply); 56 int32_t UnregDataLevelChangeCbInner(MessageParcel &data, MessageParcel &reply); 57 int32_t SetDataLevelInner(MessageParcel &data, MessageParcel &reply); 58 int32_t StartTimeSyncInner(MessageParcel &data, MessageParcel &reply); 59 int32_t StopTimeSyncInner(MessageParcel &data, MessageParcel &reply); 60 int32_t QosReportInner(MessageParcel &data, MessageParcel &reply); 61 int32_t StreamStatsInner(MessageParcel &data, MessageParcel &reply); 62 int32_t RippleStatsInner(MessageParcel &data, MessageParcel &reply); 63 int32_t GrantPermissionInner(MessageParcel &data, MessageParcel &reply); 64 int32_t RemovePermissionInner(MessageParcel &data, MessageParcel &reply); 65 int32_t PublishLNNInner(MessageParcel &data, MessageParcel &reply); 66 int32_t StopPublishLNNInner(MessageParcel &data, MessageParcel &reply); 67 int32_t RefreshLNNInner(MessageParcel &data, MessageParcel &reply); 68 int32_t StopRefreshLNNInner(MessageParcel &data, MessageParcel &reply); 69 int32_t ActiveMetaNodeInner(MessageParcel &data, MessageParcel &reply); 70 int32_t DeactiveMetaNodeInner(MessageParcel &data, MessageParcel &reply); 71 int32_t GetAllMetaNodeInfoInner(MessageParcel &data, MessageParcel &reply); 72 int32_t ShiftLNNGearInner(MessageParcel &data, MessageParcel &reply); 73 int32_t GetSoftbusSpecObjectInner(MessageParcel &data, MessageParcel &reply); 74 int32_t GetBusCenterExObjInner(MessageParcel &data, MessageParcel &reply); 75 76 void InitMemberFuncMap(); 77 void InitMemberPermissionMap(); 78 79 using SoftbusServerStubFunc = 80 int32_t (SoftBusServerStub::*)(MessageParcel &data, MessageParcel &reply); 81 std::map<uint32_t, SoftbusServerStubFunc> memberFuncMap_; 82 std::map<uint32_t, const char*> memberPermissionMap_; 83 }; 84 } // namespace OHOS 85 86 #endif // SOFTBUS_SERVER_STUB_H_