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