1 /*
2  * Copyright (C) 2021 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 OHOS_RIL_VENDOR_DATA_DEFS_H
17 #define OHOS_RIL_VENDOR_DATA_DEFS_H
18 
19 #include "hril_public_struct.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /**
26  * @brief Defines the data call response.
27  */
28 typedef struct {
29     /** Data call fail reason. success is 0 */
30     int32_t reason;
31 
32     /** If errorCode != 0, suggested retry time */
33     int32_t retryTime;
34 
35     /**
36      * From 3GPP TS 27.007 V17.3.0 (2021-09)
37      * Specifies a particular PDP context definition. The parameter is local to
38      * the TE-MT interface and is used in other PDP context-related commands.
39      */
40     int32_t cid;
41 
42     /**
43      * From 3GPP TS 27.007 V17.3.0 (2021-09)
44      * Indicates the state of PDP context activation
45      * 0: deactivated
46      * 1: activated
47      */
48     int32_t active;
49 
50     /**
51      * PDP_type values from 3GPP TS 27.007 V17.3.0 (2021-09)
52      * Specifies the type of packet data protocol. The default value is
53      * manufacturer specific.
54      */
55     char *type;
56 
57     /**
58      * Network interface name
59      */
60     char *netPortName;
61 
62     /**
63      * From 3GPP TS 27.007 V17.3.0 (2021-09)
64      * <local_addr and subnet_mask>: string type;
65      * shows the IP address and subnet mask of the MT. The string is given as
66      * dot-separated numeric (0-255) parameters on the form:
67      * "a1.a2.a3.a4.m1.m2.m3.m4" for IPv4 or
68      * "a1.a2.a3.a4.a5.a6.a7.a8.a9.a10.a11.a12.a13.a14.a15.a16.
69      * m1.m2.m3.m4.m5.m6.m7.m8.m9.m10.m11.m12.m13.m14.m15.m16" for IPv6.
70      * When +CGPIAF is supported, its settings can influence the format of this
71      * parameter returned with the execute form of +CGCONTRDP
72      */
73     char *address;
74 
75     /** Shows the IP address of the primary DNS server. */
76     char *dns;
77 
78     /**
79      * From 3GPP TS 27.007 V17.3.0 (2021-09)
80      * string type; shows the IP address of the secondary DNS server.When
81      * +CGPIAF is supported, its settings can influence the format of this
82      * parameter returned with the execute form of +CGCONTRDP.
83      */
84     char *dnsSec;
85 
86     /**
87      * Shows the Gateway Address of the MT. The string is given as
88      * dot-separated numeric (0- 255) parameters.
89      */
90     char *gateway;
91 
92     /** Maximum Transfer Unit. shows the IPv4 MTU size in octets. */
93     int32_t maxTransferUnit;
94 
95     /**
96      * From 3GPP TS 27.007 V17.3.0 (2021-09)
97      * string type; shows the IP address of the primary P-CSCF server.When
98      * +CGPIAF is supported, its settings can 	 influence the format of this
99      * parameter returned with the execute form of +CGCONTRDP.
100      */
101     char *pCscfPrimAddr;
102 
103     /**
104      * From 3GPP TS 27.007 V17.3.0 (2021-09)
105      * string type; shows the IP address of the secondary P-CSCF server. When
106      * +CGPIAF is supported, its settings can influence the format of this
107      * parameter returned with the execute form of +CGCONTRDP.
108      */
109     char *pCscfSecAddr;
110 
111     /**
112      * From 3GPP TS 27.007 V17.3.0 (2021-09)
113      * integer type; identifies the PDU session, see 3GPP TS 24.501 [161].
114      */
115     int32_t pduSessionId;
116 } HRilDataCallResponse;
117 
118 /**
119  * @brief Defines the data information. from 3GPP TS 27.007 V17.3.0 (2021-09)
120  */
121 typedef struct {
122     /**
123      * Specifies a particular PDP context definition. The parameter is local to
124      * the TE-MT interface and is used in other PDP context-related commands.
125      */
126     int32_t cid;
127 
128     /** Reason for the data request. */
129     int32_t reason;
130 
131     /** Radio Access Technology */
132     int32_t rat;
133 
134     /** Roaming Enable. eg: 1--enable, 0--disnable */
135     int32_t roamingEnable;
136 
137     /**
138      * Authentication protocol used for this PDP context.
139      * 0: None. Used to indicate that no authentication protocol is used for this
140      *    PDP context. Username and password are removed if previously specified.
141      * 1: PAP
142      * 2: CHAP
143      */
144     int32_t verType;
145 
146     /** User name for access to the IP network. */
147     char *userName;
148 
149     /** Password for access to the IP network. */
150     char *password;
151 
152     /** Access Point Name */
153     char *apn;
154 
155     /**
156      * PDP_type values from 3GPP TS 27.007 section 10.1.1.
157      * Specifies the type of packet data protocol. The default value is
158      * manufacturer specific.
159      */
160     char *type;
161 
162     /**
163      * PDP_type values from 3GPP TS 27.007 section 10.1.1.
164      * Specifies the type of packet data protocol. The default value is
165      * manufacturer specific.
166      */
167     char *roamingType;
168 } HRilDataInfo;
169 
170 /**
171  * @brief Defines the band width information.
172  */
173 typedef struct {
174     /**
175      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
176      * integer type; specifies a particular QoS flow definition, Traffic Flows
177      * definition and a PDP Context definition (see the +CGDCONT and +CGDSCONT
178      * commands).
179      */
180     int32_t cid;
181 
182     /**
183      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
184      * 0 5QI is selected by network
185      * [1 - 4] value range for guaranteed bit rate QoS flows
186      * 65, 66, 67 values for guaranteed bit rate QoS flows
187      * [71 - 76] value range for guaranteed bit rate QoS flows
188      * [5 - 9] value range for non-guaranteed bit rate QoS flows
189      * 69, 70, 79, 80 values for non-guaranteed bit rate QoS flows
190      * [82 - 85] value range for delay critical guaranteed bit rate QoS flows
191      * [128 - 254] value range for Operator-specific 5QIs
192      */
193     int32_t qi;
194 
195     /**
196      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
197      * integer type; indicates DL GFBR in case of GBR 5QI. The value is in
198      * kbit/s. This parameter is omitted for a non-GBR 5QI (see 3GPP TS 24.501
199      * [161])
200      */
201     int32_t dlGfbr;
202 
203     /**
204      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
205      * integer type; indicates UL GFBR in case of GBR 5QI. The value is in
206      * kbit/s. This parameter is omitted for a non-GBR 5QI (see 3GPP TS 24.501
207      * [161]).
208      */
209     int32_t ulGfbr;
210 
211     /**
212      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
213      * integer type; indicates DL MFBR in case of GBR 5QI. The value is in
214      * kbit/s. This parameter is omitted for a non-GBR 5QI (see 3GPP TS 24.501
215      * [161]).
216      */
217     int32_t dlMfbr;
218 
219     /**
220      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
221      * integer type; indicates UL MFBR in case of GBR 5QI. The value is in
222      * kbit/s. This parameter is omitted for a non-GBR 5QI (see 3GPP TS 24.501
223      * [161]).
224      */
225     int32_t ulMfbr;
226 
227     /**
228      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
229      * integer type; indicates the UL session AMBR(see 3GPP TS 24.501 [161]).
230      * The value is in kbit/s.
231      */
232     int32_t ulSambr;
233 
234     /**
235      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
236      * integer type; indicates the DL session AMBR(see 3GPP TS 24.501 [161]).
237      * The value is in kbit/s.
238      */
239     int32_t dlSambr;
240 
241     /**
242      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
243      * integer type; indicates the averaging window(see 3GPP TS 24.501 [161]).
244      * The value is in milliseconds.
245      */
246     int32_t averagingWindow;
247 } HRilLinkBandwidthInfo;
248 
249 /**
250  * @brief Defines the network bandwidth reporting rule.
251  */
252 typedef struct {
253     /** Radio Access Technology*/
254     RatType rat;
255 
256     /**
257      * integer type; (0,1,2,…) indicates the targeted time between request to
258      * transfer an SDU at one SAP to its delivery at the other SAP, in
259      * milliseconds. If the parameter is set to '0' the subscribed value will
260      * be requested (refer 3GPP TS 24.008 [8] clause 10.5.6.5).
261      */
262     int32_t delayMs;
263 
264     /** Uplink delay. */
265     int32_t delayUplinkKbps;
266 
267     /** Downlink delay. */
268     int32_t delayDownlinkKbps;
269 
270     /** Maximum number of uplink parameters. */
271     int32_t maximumUplinkKbpsSize;
272 
273     /** Maximum number of downlink parameters. */
274     int32_t maximumDownlinkKbpsSize;
275 
276     /** Maximum uplink parameter list. */
277     int32_t *maximumUplinkKbps;
278 
279     /** Maximum downlink parameter list. */
280     int32_t *maximumDownlinkKbps;
281 } HRilLinkBandwidthReportingRule;
282 
283 /**
284  * @brief Defines the data service performance mode.
285  */
286 typedef struct {
287     /** Performance Enable. eg: 1-enable, 0-disable */
288     int32_t performanceEnable;
289 
290     /** Whether Enforce Data Performance. eg: 1-enable, 0-disable */
291     int32_t enforce;
292 } HRilDataPerformanceInfo;
293 
294 /**
295  * @brief Defines the sleep mode for data services.
296  */
297 typedef struct {
298     /** Sleep Mode Enable. eg: 1-enable, 0-disable */
299     int32_t sleepEnable;
300 } HRilDataSleepInfo;
301 
302 /**
303  * @brief Defines the data link capability.
304  */
305 typedef struct {
306     /** Primary downlink capability in kbps. */
307     int32_t primaryDownlinkKbps;
308 
309     /** Primary uplink capability in kbps. */
310     int32_t primaryUplinkKbps;
311 
312     /** Secondary downlink capability in kbps. */
313     int32_t secondaryDownlinkKbps;
314 
315     /** Secondary uplink capability in kbps. */
316     int32_t secondaryUplinkKbps;
317 } HRilDataLinkCapability;
318 
319 /**
320  * @brief Defines the data request method.
321  */
322 typedef struct {
323     /**
324      * @brief Sets the initial default network access technology (APN).
325      *
326      * @param requestInfo Request data info, for details, see {@link
327      * ReqDataInfo}.
328      * @see ReqDataInfo
329      */
330     void (*SetInitApnInfo)(const ReqDataInfo *requestInfo, const HRilDataInfo *data);
331 
332     /**
333      * @brief Activates the packet data protocol (PDP) context.
334      *
335      * @param requestInfo Request data info, for details, see {@link
336      * ReqDataInfo}.
337      * @param data Indicates the data information.
338      * @see ReqDataInfo | HRilDataInfo
339      */
340     void (*ActivatePdpContext)(const ReqDataInfo *requestInfo, const HRilDataInfo *data);
341 
342     /**
343      * @brief Deactivates the PDP context.
344      *
345      * @param requestInfo Request data info, for details, see {@link
346      * ReqDataInfo}.
347      * @param data Indicates the data information.
348      * @see ReqDataInfo | HRilDataInfo
349      */
350     void (*DeactivatePdpContext)(const ReqDataInfo *requestInfo, const HRilDataInfo *data);
351 
352     /**
353      * @brief Obtains the PDP context list.
354      *
355      * @param requestInfo Request data info, for details, see {@link
356      * ReqDataInfo}.
357      * @see ReqDataInfo
358      */
359     void (*GetPdpContextList)(const ReqDataInfo *requestInfo);
360 
361     /**
362      * @brief Obtains the current link information.
363      *
364      * @param requestInfo Request data info, for details, see {@link
365      * ReqDataInfo}.
366      * @param cid Indicates a particular PDP context definition.
367      * @see ReqDataInfo
368      */
369     void (*GetLinkBandwidthInfo)(const ReqDataInfo *requestInfo, int32_t cid);
370 
371     /**
372      * @brief Sets the rule for reporting the data link bandwidth information.
373      *
374      * @param requestInfo Request data info, for details, see {@link
375      * ReqDataInfo}.
376      * @param data Indicates the network bandwidth reporting rule.
377      * @see ReqDataInfo | HRilLinkBandwidthReportingRule
378      */
379     void (*SetLinkBandwidthReportingRule)(const ReqDataInfo *requestInfo, const HRilLinkBandwidthReportingRule *data);
380 
381     /**
382      * @brief Sets the PDP context information for the data service.
383      *
384      * @param requestInfo Request data info, for details, see {@link
385      * ReqDataInfo}.
386      * @param data Indicates the data information.
387      * @param len Indicates the length of data.
388      * @see ReqDataInfo | HRilDataInfo
389      */
390     void (*SetDataProfileInfo)(const ReqDataInfo *requestInfo, const HRilDataInfo *data, int32_t len);
391 
392     /**
393      * @brief Sends the data service performance mode.
394      *
395      * @param requestInfo Request data info, for details, see {@link
396      * ReqDataInfo}.
397      * @param data Indicates the data service performance mode.
398      * @see ReqDataInfo | HRilDataPerformanceInfo
399      */
400     void (*SendDataPerformanceMode)(const ReqDataInfo *requestInfo, const HRilDataPerformanceInfo *data);
401 
402     /**
403      * @brief Sends the data service sleep mode.
404      *
405      * @param requestInfo Request data info, for details, see {@link
406      * ReqDataInfo}.
407      * @param data Indicates the sleep mode for data services.
408      * @see ReqDataInfo | HRilDataSleepInfo
409      */
410     void (*SendDataSleepMode)(const ReqDataInfo *requestInfo, const HRilDataSleepInfo *data);
411 
412     /**
413      * @brief Enables the data service of a SIM card slot.
414      *
415      * @param requestInfo Request data info, for details, see {@link
416      * ReqDataInfo}.
417      * @param enabled Whether to enable the data service.
418      * @see ReqDataInfo
419      */
420     void (*SetDataPermitted)(const ReqDataInfo *requestInfo, int32_t enabled);
421 
422     /**
423      * @brief Get link capability.
424      *
425      * @param requestInfo Request data info, for details, see {@link
426      * ReqDataInfo}.
427      * @see ReqDataInfo
428      */
429     void (*GetLinkCapability)(const ReqDataInfo *requestInfo);
430 
431     /**
432      * @brief Clean all data connections.
433      *
434      * @param requestInfo Request data info, for details, see {@link
435      * ReqDataInfo}.
436      * @see ReqDataInfo
437      */
438     void (*CleanAllConnections)(const ReqDataInfo *requestInfo);
439 } HRilDataReq;
440 #ifdef __cplusplus
441 }
442 #endif
443 #endif // OHOS_RIL_VENDOR_DATA_DEFS_H
444