• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef C_TASK_CONFIG_H
17 #define C_TASK_CONFIG_H
18 
19 #include <cstdint>
20 #include <map>
21 #include <string>
22 #include <vector>
23 
24 #include "c_form_item.h"
25 #include "c_string_wrapper.h"
26 
27 struct CommonTaskConfig {
28     uint32_t taskId;
29     uint64_t uid;
30     uint64_t tokenId;
31     uint8_t action;
32     uint8_t mode;
33     bool cover;
34     uint8_t network;
35     bool metered;
36     bool roaming;
37     bool retry;
38     bool redirect;
39     uint32_t index;
40     uint64_t begins;
41     int64_t ends;
42     bool gauge;
43     bool precise;
44     uint32_t priority;
45     bool background;
46 };
47 
48 struct CStringMap {
49     CStringWrapper key;
50     CStringWrapper value;
51 };
52 
53 struct CTaskConfig {
54     CStringWrapper bundle;
55     uint8_t bundleType;
56     CStringWrapper atomicAccount;
57     CStringWrapper url;
58     CStringWrapper title;
59     CStringWrapper description;
60     CStringWrapper method;
61     CStringWrapper headers;
62     CStringWrapper data;
63     CStringWrapper token;
64     CStringWrapper proxy;
65     CStringWrapper certificatePins;
66     CStringWrapper extras;
67     uint8_t version;
68     CFormItem *formItemsPtr;
69     uint32_t formItemsLen;
70     CFileSpec *fileSpecsPtr;
71     uint32_t fileSpecsLen;
72     CStringWrapper *bodyFileNamesPtr;
73     uint32_t bodyFileNamesLen;
74     CStringWrapper *certsPathPtr;
75     uint32_t certsPathLen;
76     CommonTaskConfig commonData;
77 };
78 
79 struct TaskConfig {
80     std::string bundle;
81     uint8_t bundleType;
82     std::string atomicAccount;
83     std::string url;
84     std::string title;
85     std::string description;
86     std::string method;
87     std::string headers;
88     std::string data;
89     std::string token;
90     std::string proxy;
91     std::string certificatePins;
92     std::string extras;
93     uint8_t version;
94     std::vector<FormItem> formItems;
95     std::vector<FileSpec> fileSpecs;
96     std::vector<std::string> bodyFileNames;
97     std::vector<std::string> certsPath;
98     CommonTaskConfig commonData;
99 };
100 
101 #ifdef __cplusplus
102 extern "C" {
103 #endif
104 
105 void DeleteCTaskConfig(CTaskConfig *ptr);
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 #endif // C_TASK_CONFIG_H