1f5921b11Sopenharmony_ci/*
2f5921b11Sopenharmony_ci * Copyright (c) 2020-2022 Huawei Device Co., Ltd.
3f5921b11Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4f5921b11Sopenharmony_ci * you may not use this file except in compliance with the License.
5f5921b11Sopenharmony_ci * You may obtain a copy of the License at
6f5921b11Sopenharmony_ci *
7f5921b11Sopenharmony_ci *    http://www.apache.org/licenses/LICENSE-2.0
8f5921b11Sopenharmony_ci *
9f5921b11Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10f5921b11Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11f5921b11Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12f5921b11Sopenharmony_ci * See the License for the specific language governing permissions and
13f5921b11Sopenharmony_ci * limitations under the License.
14f5921b11Sopenharmony_ci */
15f5921b11Sopenharmony_ci
16f5921b11Sopenharmony_ci#ifndef POLICY_DEFINE_H
17f5921b11Sopenharmony_ci#define POLICY_DEFINE_H
18f5921b11Sopenharmony_ci
19f5921b11Sopenharmony_ci#define UID_SIZE 8
20f5921b11Sopenharmony_ci#define POLICY_SIZE 8
21f5921b11Sopenharmony_ci
22f5921b11Sopenharmony_ci#ifdef __cplusplus
23f5921b11Sopenharmony_ci#if __cplusplus
24f5921b11Sopenharmony_ciextern "C" {
25f5921b11Sopenharmony_ci#endif
26f5921b11Sopenharmony_ci#endif
27f5921b11Sopenharmony_ci
28f5921b11Sopenharmony_citypedef struct RegParams {
29f5921b11Sopenharmony_ci    char *service;
30f5921b11Sopenharmony_ci    char *feature;
31f5921b11Sopenharmony_ci    unsigned int uid;
32f5921b11Sopenharmony_ci    unsigned int pid;
33f5921b11Sopenharmony_ci} RegParams;
34f5921b11Sopenharmony_ci
35f5921b11Sopenharmony_citypedef struct AuthParams {
36f5921b11Sopenharmony_ci    char *providerService;
37f5921b11Sopenharmony_ci    char *providerfeature;
38f5921b11Sopenharmony_ci    unsigned int providerUid;
39f5921b11Sopenharmony_ci    unsigned int providerPid;
40f5921b11Sopenharmony_ci    unsigned int consumerUid;
41f5921b11Sopenharmony_ci    unsigned int consumerPid;
42f5921b11Sopenharmony_ci} AuthParams;
43f5921b11Sopenharmony_ci
44f5921b11Sopenharmony_cienum PolicyType {
45f5921b11Sopenharmony_ci    RANGE = 1,
46f5921b11Sopenharmony_ci    FIXED = 2,
47f5921b11Sopenharmony_ci    BUNDLENAME = 3
48f5921b11Sopenharmony_ci};
49f5921b11Sopenharmony_ci
50f5921b11Sopenharmony_citypedef struct PolicyTrans {
51f5921b11Sopenharmony_ci    enum PolicyType type;
52f5921b11Sopenharmony_ci    int fixedUid[UID_SIZE];
53f5921b11Sopenharmony_ci    int uidMin;
54f5921b11Sopenharmony_ci    int uidMax;
55f5921b11Sopenharmony_ci} PolicyTrans;
56f5921b11Sopenharmony_ci
57f5921b11Sopenharmony_citypedef struct IpcPolicy {
58f5921b11Sopenharmony_ci    enum PolicyType type;
59f5921b11Sopenharmony_ci    int fixedUid[UID_SIZE];
60f5921b11Sopenharmony_ci    int uidMin;
61f5921b11Sopenharmony_ci    int uidMax;
62f5921b11Sopenharmony_ci    char *bundleName;
63f5921b11Sopenharmony_ci} IpcPolicy;
64f5921b11Sopenharmony_ci
65f5921b11Sopenharmony_citypedef struct FeaturePolicy {
66f5921b11Sopenharmony_ci    char *feature;
67f5921b11Sopenharmony_ci    IpcPolicy policies[POLICY_SIZE];
68f5921b11Sopenharmony_ci} FeaturePolicy;
69f5921b11Sopenharmony_ci
70f5921b11Sopenharmony_citypedef struct PolicySetting {
71f5921b11Sopenharmony_ci    char *service;
72f5921b11Sopenharmony_ci    FeaturePolicy *features;
73f5921b11Sopenharmony_ci    int featureNum;
74f5921b11Sopenharmony_ci} PolicySetting;
75f5921b11Sopenharmony_ci
76f5921b11Sopenharmony_ci#ifdef __cplusplus
77f5921b11Sopenharmony_ci#if __cplusplus
78f5921b11Sopenharmony_ci}
79f5921b11Sopenharmony_ci#endif
80f5921b11Sopenharmony_ci#endif
81f5921b11Sopenharmony_ci#endif // POLICY_DEFINE_H
82