1 /*
2  * Copyright (c) 2023 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 #ifndef QOS_COMMON_H
16 #define QOS_COMMON_H
17 
18 namespace OHOS {
19 namespace QosCommon {
20 
21 constexpr int AF_RTG_ALL = 0x1fff;
22 
23 struct AuthCtrlData {
24     int pid;
25     unsigned int type;
26     unsigned int rtgFlag;
27     unsigned int qosFlag;
28     unsigned int status;
29 };
30 
31 enum AuthOperationType {
32     AUTH_ENABLE = 1,
33     AUTH_DELETE,
34     AUTH_GET,
35     AUTH_SWITCH,
36     AUTH_MAX_NR,
37 };
38 
39 enum AuthStatus {
40     AUTH_STATUS_DISABLED = 1,
41     AUTH_STATUS_SYSTEM_SERVER = 2,
42     AUTH_STATUS_FOREGROUND,
43     AUTH_STATUS_BACKGROUND,
44     AUTH_STATUS_DEAD,
45 };
46 
47 #define BASIC_AUTH_CTRL_OPERATION \
48     _IOWR(0xCD, 1, struct AuthCtrlData)
49 
50 int AuthEnable(int pid, unsigned int flag, unsigned int status);
51 int AuthPause(int pid);
52 int AuthDelete(int pid);
53 
54 } // namespace QosCommon
55 } // namespace OHOS
56 #endif // QOS_COMMON_H