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 #include "comm_auth_info.h"
17 
18 namespace OHOS {
CommAuthInfo(IRemoteObject * stub,int pid,int uid,uint32_t tokenId,const std::string & deviceId,int32_t socketId)19 CommAuthInfo::CommAuthInfo(IRemoteObject *stub, int pid, int uid, uint32_t tokenId,
20     const std::string &deviceId, int32_t socketId)
21     : stub_(stub), remotePid_(pid), remoteUid_(uid),
22       tokenId_(tokenId), deviceId_(deviceId), socketId_(socketId)
23 {}
24 
~CommAuthInfo()25 CommAuthInfo::~CommAuthInfo()
26 {
27     stub_ = nullptr;
28 }
29 
GetStubObject() const30 IRemoteObject *CommAuthInfo::GetStubObject() const
31 {
32     return stub_;
33 }
34 
GetRemotePid() const35 int CommAuthInfo::GetRemotePid() const
36 {
37     return remotePid_;
38 }
39 
GetRemoteUid() const40 int CommAuthInfo::GetRemoteUid() const
41 {
42     return remoteUid_;
43 }
44 
GetRemoteTokenId() const45 uint32_t CommAuthInfo::GetRemoteTokenId() const
46 {
47     return tokenId_;
48 }
49 
GetRemoteDeviceId() const50 std::string CommAuthInfo::GetRemoteDeviceId() const
51 {
52     return deviceId_;
53 }
54 
GetRemoteSocketId() const55 int32_t CommAuthInfo::GetRemoteSocketId() const
56 {
57     return socketId_;
58 }
59 
SetRemoteSocketId(int32_t socketId)60 void CommAuthInfo::SetRemoteSocketId(int32_t socketId)
61 {
62     socketId_ = socketId;
63 }
64 } // namespace OHOS
65