• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-2022 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 PERM_DEFINE_H
17 #define PERM_DEFINE_H
18 
19 #include "pms_types.h"
20 
21 #ifdef __cplusplus
22 #if __cplusplus
23 extern "C" {
24 #endif
25 #endif
26 
27 #define PKG_NAME_LEN 64
28 #define CAP_NOT_BINDED (-1)
29 
30 enum GrantTime {
31     INUSE = 0,
32     ALWAYS,
33 };
34 
35 enum GrantType {
36     USER_GRANT = 0,
37     SYSTEM_GRANT,
38 };
39 
40 enum IsUpdate {
41     FIRST_INSTALL = 0,
42     UPDATE,
43 };
44 
45 enum IsRestricted {
46     RESTRICTED = 0,
47     NOT_RESTRICTED,
48 };
49 
50 typedef struct {
51     char name[PERM_NAME_LEN];
52     enum GrantType type;
53     enum IsRestricted isRestricted;
54     unsigned int cap;
55 } PermissionDef;
56 
57 typedef struct {
58     char name[PERM_NAME_LEN];
59     char desc[PERM_DESC_LEN];
60     enum GrantTime when;
61 } PermissionTrans;
62 
63 typedef struct TaskNode {
64     int uid;
65     char pkgName[PKG_NAME_LEN];
66     PermissionSaved *permList;
67     int permNum;
68     struct TaskNode *next;
69 } TNode;
70 
71 typedef struct TaskList {
72     TNode *head;
73 } TList;
74 
75 #ifdef __cplusplus
76 #if __cplusplus
77 }
78 #endif
79 #endif
80 #endif // PERM_DEFINE_H
81