• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 #include "session_ipc_adapter.h"
17 
18 #include "ipc_skeleton.h"
19 #include "softbus_error_code.h"
20 #include "trans_log.h"
21 
SoftBusGetSelfTokenId(uint64_t * selfTokenId)22 int32_t SoftBusGetSelfTokenId(uint64_t *selfTokenId)
23 {
24     if (selfTokenId == nullptr) {
25         TRANS_LOGE(TRANS_SDK, "invalid param, selfTokenId is nullptr");
26         return SOFTBUS_INVALID_PARAM;
27     }
28     *selfTokenId = OHOS::IPCSkeleton::GetSelfTokenID();
29     return SOFTBUS_OK;
30 }
31 
SoftBusGetCallingTokenId(uint32_t * callingTokenId)32 int32_t SoftBusGetCallingTokenId(uint32_t *callingTokenId)
33 {
34     if (callingTokenId == nullptr) {
35         TRANS_LOGE(TRANS_SDK, "invalid param, callingTokenId is nullptr");
36         return SOFTBUS_INVALID_PARAM;
37     }
38     *callingTokenId = OHOS::IPCSkeleton::GetCallingTokenID();
39     return SOFTBUS_OK;
40 }
41 
SoftBusGetCallingFullTokenId(uint64_t * callingFullTokenId)42 int32_t SoftBusGetCallingFullTokenId(uint64_t *callingFullTokenId)
43 {
44     if (callingFullTokenId == nullptr) {
45         TRANS_LOGE(TRANS_SDK, "invalid param, callingFullTokenId is nullptr");
46         return SOFTBUS_INVALID_PARAM;
47     }
48     *callingFullTokenId = OHOS::IPCSkeleton::GetCallingFullTokenID();
49     return SOFTBUS_OK;
50 }
51