• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_PERMISSION_H
17 #define SOFTBUS_PERMISSION_H
18 
19 #include <stdbool.h>
20 #include <stdint.h>
21 #include <sys/types.h>
22 
23 #ifdef __cplusplus
24 #if __cplusplus
25 extern "C" {
26 #endif
27 #endif
28 
29 #define ACTION_CREATE 0x1
30 #define ACTION_OPEN 0x2
31 
32 enum {
33     SYSTEM_APP = 0,
34     NATIVE_APP,
35     SELF_APP,
36     NORMAL_APP,
37     GRANTED_APP,
38 };
39 
40 int32_t TransPermissionInit(void);
41 void TransPermissionDeinit(void);
42 int32_t LnnInitPermission(void);
43 void LnnDeinitPermission(void);
44 int32_t CheckTransPermission(pid_t callingUid, pid_t callingPid,
45     const char *pkgName, const char *sessionName, uint32_t actions);
46 int32_t CheckLnnPermission(const char *interfaceName, const char *processName);
47 int32_t CheckTransSecLevel(const char *mySessionName, const char *peerSessionName);
48 bool CheckDiscPermission(pid_t callingUid, const char *pkgName);
49 bool CheckBusCenterPermission(pid_t callingUid, const char *pkgName);
50 int32_t GrantTransPermission(int32_t callingUid, int32_t callingPid, const char *sessionName);
51 int32_t RemoveTransPermission(const char *sessionName);
52 
53 #ifdef __cplusplus
54 #if __cplusplus
55 }
56 #endif /* __cplusplus */
57 #endif /* __cplusplus */
58 
59 #endif /* SOFTBUS_PERMISSION_H */
60