• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025-2025 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 APPSPAWN_ENCAPS_CPP
17 #define APPSPAWN_ENCAPS_CPP
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #define OH_ENCAPS_KEY_MAX_LEN 64
24 
25 typedef enum {
26     ENCAPS_PROC_TYPE_MODE,        // enable the encaps attribute of a process
27     ENCAPS_PERMISSION_TYPE_MODE,  // set the encaps permission of a process
28     ENCAPS_MAX_TYPE_MODE
29 } AppSpawnEncapsBaseType;
30 
31 typedef enum {
32     ENCAPS_BOOL = 1,
33     ENCAPS_INT,
34     ENCAPS_AS_ARRAY = 10,
35     ENCAPS_BOOL_ARRAY,
36     ENCAPS_INT_ARRAY,
37     ENCAPS_CHAR_ARRAY
38 } EncapsType;
39 
40 typedef struct {
41     char key[OH_ENCAPS_KEY_MAX_LEN];
42     EncapsType type;
43     union {
44         uint64_t intValue;
45         void *ptrValue;
46     } value;
47     uint32_t valueLen;  // valueLen < 512
48 } UserEncap;
49 
50 typedef struct {
51     UserEncap *encap;
52     uint32_t encapsCount;
53 } UserEncaps;
54 
55 #ifdef __cplusplus
56 }
57 #endif
58 #endif
59