12dc7c57fSopenharmony_ci/* 22dc7c57fSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 32dc7c57fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 42dc7c57fSopenharmony_ci * you may not use this file except in compliance with the License. 52dc7c57fSopenharmony_ci * You may obtain a copy of the License at 62dc7c57fSopenharmony_ci * 72dc7c57fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 82dc7c57fSopenharmony_ci * 92dc7c57fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 102dc7c57fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 112dc7c57fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 122dc7c57fSopenharmony_ci * See the License for the specific language governing permissions and 132dc7c57fSopenharmony_ci * limitations under the License. 142dc7c57fSopenharmony_ci */ 152dc7c57fSopenharmony_ci 162dc7c57fSopenharmony_ci#include "mock_ipc_skeleton.h" 172dc7c57fSopenharmony_ci 182dc7c57fSopenharmony_cinamespace OHOS { 192dc7c57fSopenharmony_ci#ifdef CONFIG_IPC_SINGLE 202dc7c57fSopenharmony_ciusing namespace IPC_SINGLE; 212dc7c57fSopenharmony_ci#endif 222dc7c57fSopenharmony_ci 232dc7c57fSopenharmony_cipid_t uid_ = 1000; 242dc7c57fSopenharmony_ciSecurity::AccessToken::AccessTokenID callerToken_ = 0; 252dc7c57fSopenharmony_ci 262dc7c57fSopenharmony_cipid_t IPCSkeleton::GetCallingUid() 272dc7c57fSopenharmony_ci{ 282dc7c57fSopenharmony_ci return uid_; 292dc7c57fSopenharmony_ci} 302dc7c57fSopenharmony_ci 312dc7c57fSopenharmony_cipid_t IPCSkeleton::GetCallingPid() 322dc7c57fSopenharmony_ci{ 332dc7c57fSopenharmony_ci return 1; 342dc7c57fSopenharmony_ci} 352dc7c57fSopenharmony_ci 362dc7c57fSopenharmony_civoid IPCSkeleton::SetCallingUid(pid_t uid) 372dc7c57fSopenharmony_ci{ 382dc7c57fSopenharmony_ci uid_ = uid; 392dc7c57fSopenharmony_ci} 402dc7c57fSopenharmony_ci 412dc7c57fSopenharmony_ciSecurity::AccessToken::AccessTokenID IPCSkeleton::GetCallingTokenID() 422dc7c57fSopenharmony_ci{ 432dc7c57fSopenharmony_ci return callerToken_; 442dc7c57fSopenharmony_ci} 452dc7c57fSopenharmony_ci 462dc7c57fSopenharmony_civoid IPCSkeleton::SetCallingTokenID(Security::AccessToken::AccessTokenID callerToken) 472dc7c57fSopenharmony_ci{ 482dc7c57fSopenharmony_ci callerToken_ = callerToken; 492dc7c57fSopenharmony_ci} 502dc7c57fSopenharmony_ci} // namespace OHOS 51