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 typedef struct {
171     /**
172      * Specifies a particular PDP context definition. The parameter is local to
173      * the TE-MT interface and is used in other PDP context-related commands.
174      */
175     int32_t cid;
176 
177     /** Reason for the data request. */
178     int32_t reason;
179 
180     /** Radio Access Technology */
181     int32_t rat;
182 
183     /** Roaming Enable. eg: 1--enable, 0--disnable */
184     int32_t roamingEnable;
185 
186     /**
187      * Authentication protocol used for this PDP context.
188      * 0: None. Used to indicate that no authentication protocol is used for this
189      *    PDP context. Username and password are removed if previously specified.
190      * 1: PAP
191      * 2: CHAP
192      */
193     int32_t verType;
194 
195     /** User name for access to the IP network. */
196     char *userName;
197 
198     /** Password for access to the IP network. */
199     char *password;
200 
201     /** Access Point Name */
202     char *apn;
203 
204     /**
205      * PDP_type values from 3GPP TS 27.007 section 10.1.1.
206      * Specifies the type of packet data protocol. The default value is
207      * manufacturer specific.
208      */
209     char *type;
210 
211     /**
212      * PDP_type values from 3GPP TS 27.007 section 10.1.1.
213      * Specifies the type of packet data protocol. The default value is
214      * manufacturer specific.
215      */
216     char *roamingType;
217 
218     /**
219      * Supported apn types bitmap
220      */
221     int32_t supportedApnTypesBitmap;
222 } HRilDataInfoWithApnTypes;
223 
224 /**
225  * @brief Defines the band width information.
226  */
227 typedef struct {
228     /**
229      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
230      * integer type; specifies a particular QoS flow definition, Traffic Flows
231      * definition and a PDP Context definition (see the +CGDCONT and +CGDSCONT
232      * commands).
233      */
234     int32_t cid;
235 
236     /**
237      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
238      * 0 5QI is selected by network
239      * [1 - 4] value range for guaranteed bit rate QoS flows
240      * 65, 66, 67 values for guaranteed bit rate QoS flows
241      * [71 - 76] value range for guaranteed bit rate QoS flows
242      * [5 - 9] value range for non-guaranteed bit rate QoS flows
243      * 69, 70, 79, 80 values for non-guaranteed bit rate QoS flows
244      * [82 - 85] value range for delay critical guaranteed bit rate QoS flows
245      * [128 - 254] value range for Operator-specific 5QIs
246      */
247     int32_t qi;
248 
249     /**
250      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
251      * integer type; indicates DL GFBR in case of GBR 5QI. The value is in
252      * kbit/s. This parameter is omitted for a non-GBR 5QI (see 3GPP TS 24.501
253      * [161])
254      */
255     int32_t dlGfbr;
256 
257     /**
258      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
259      * integer type; indicates UL GFBR in case of GBR 5QI. The value is in
260      * kbit/s. This parameter is omitted for a non-GBR 5QI (see 3GPP TS 24.501
261      * [161]).
262      */
263     int32_t ulGfbr;
264 
265     /**
266      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
267      * integer type; indicates DL MFBR in case of GBR 5QI. The value is in
268      * kbit/s. This parameter is omitted for a non-GBR 5QI (see 3GPP TS 24.501
269      * [161]).
270      */
271     int32_t dlMfbr;
272 
273     /**
274      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
275      * integer type; indicates UL MFBR in case of GBR 5QI. The value is in
276      * kbit/s. This parameter is omitted for a non-GBR 5QI (see 3GPP TS 24.501
277      * [161]).
278      */
279     int32_t ulMfbr;
280 
281     /**
282      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
283      * integer type; indicates the UL session AMBR(see 3GPP TS 24.501 [161]).
284      * The value is in kbit/s.
285      */
286     int32_t ulSambr;
287 
288     /**
289      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
290      * integer type; indicates the DL session AMBR(see 3GPP TS 24.501 [161]).
291      * The value is in kbit/s.
292      */
293     int32_t dlSambr;
294 
295     /**
296      * From 3GPP TS 27.007 10.1.50 V4.3.0 (2021-10)
297      * integer type; indicates the averaging window(see 3GPP TS 24.501 [161]).
298      * The value is in milliseconds.
299      */
300     int32_t averagingWindow;
301 } HRilLinkBandwidthInfo;
302 
303 /**
304  * @brief Defines the network bandwidth reporting rule.
305  */
306 typedef struct {
307     /** Radio Access Technology*/
308     RatType rat;
309 
310     /**
311      * integer type; (0,1,2,…) indicates the targeted time between request to
312      * transfer an SDU at one SAP to its delivery at the other SAP, in
313      * milliseconds. If the parameter is set to '0' the subscribed value will
314      * be requested (refer 3GPP TS 24.008 [8] clause 10.5.6.5).
315      */
316     int32_t delayMs;
317 
318     /** Uplink delay. */
319     int32_t delayUplinkKbps;
320 
321     /** Downlink delay. */
322     int32_t delayDownlinkKbps;
323 
324     /** Maximum number of uplink parameters. */
325     int32_t maximumUplinkKbpsSize;
326 
327     /** Maximum number of downlink parameters. */
328     int32_t maximumDownlinkKbpsSize;
329 
330     /** Maximum uplink parameter list. */
331     int32_t *maximumUplinkKbps;
332 
333     /** Maximum downlink parameter list. */
334     int32_t *maximumDownlinkKbps;
335 } HRilLinkBandwidthReportingRule;
336 
337 /**
338  * @brief Defines the data service performance mode.
339  */
340 typedef struct {
341     /** Performance Enable. eg: 1-enable, 0-disable */
342     int32_t performanceEnable;
343 
344     /** Whether Enforce Data Performance. eg: 1-enable, 0-disable */
345     int32_t enforce;
346 } HRilDataPerformanceInfo;
347 
348 /**
349  * @brief Defines the sleep mode for data services.
350  */
351 typedef struct {
352     /** Sleep Mode Enable. eg: 1-enable, 0-disable */
353     int32_t sleepEnable;
354 } HRilDataSleepInfo;
355 
356 /**
357  * @brief Defines the data link capability.
358  */
359 typedef struct {
360     /** Primary downlink capability in kbps. */
361     int32_t primaryDownlinkKbps;
362 
363     /** Primary uplink capability in kbps. */
364     int32_t primaryUplinkKbps;
365 
366     /** Secondary downlink capability in kbps. */
367     int32_t secondaryDownlinkKbps;
368 
369     /** Secondary uplink capability in kbps. */
370     int32_t secondaryUplinkKbps;
371 } HRilDataLinkCapability;
372 
373 /**
374  * @brief Defines the data request method.
375  */
376 typedef struct {
377     /**
378      * @brief Sets the initial default network access technology (APN).
379      *
380      * @param requestInfo Request data info, for details, see {@link
381      * ReqDataInfo}.
382      * @see ReqDataInfo
383      */
384     void (*SetInitApnInfo)(const ReqDataInfo *requestInfo, const HRilDataInfo *data);
385 
386     /**
387      * @brief Activates the packet data protocol (PDP) context.
388      *
389      * @param requestInfo Request data info, for details, see {@link
390      * ReqDataInfo}.
391      * @param data Indicates the data information.
392      * @see ReqDataInfo | HRilDataInfo
393      */
394     void (*ActivatePdpContext)(const ReqDataInfo *requestInfo, const HRilDataInfo *data);
395 
396     /**
397      * @brief Deactivates the PDP context.
398      *
399      * @param requestInfo Request data info, for details, see {@link
400      * ReqDataInfo}.
401      * @param data Indicates the data information.
402      * @see ReqDataInfo | HRilDataInfo
403      */
404     void (*DeactivatePdpContext)(const ReqDataInfo *requestInfo, const HRilDataInfo *data);
405 
406     /**
407      * @brief Obtains the PDP context list.
408      *
409      * @param requestInfo Request data info, for details, see {@link
410      * ReqDataInfo}.
411      * @see ReqDataInfo
412      */
413     void (*GetPdpContextList)(const ReqDataInfo *requestInfo);
414 
415     /**
416      * @brief Obtains the current link information.
417      *
418      * @param requestInfo Request data info, for details, see {@link
419      * ReqDataInfo}.
420      * @param cid Indicates a particular PDP context definition.
421      * @see ReqDataInfo
422      */
423     void (*GetLinkBandwidthInfo)(const ReqDataInfo *requestInfo, int32_t cid);
424 
425     /**
426      * @brief Sets the rule for reporting the data link bandwidth information.
427      *
428      * @param requestInfo Request data info, for details, see {@link
429      * ReqDataInfo}.
430      * @param data Indicates the network bandwidth reporting rule.
431      * @see ReqDataInfo | HRilLinkBandwidthReportingRule
432      */
433     void (*SetLinkBandwidthReportingRule)(const ReqDataInfo *requestInfo, const HRilLinkBandwidthReportingRule *data);
434 
435     /**
436      * @brief Sets the PDP context information for the data service.
437      *
438      * @param requestInfo Request data info, for details, see {@link
439      * ReqDataInfo}.
440      * @param data Indicates the data information.
441      * @param len Indicates the length of data.
442      * @see ReqDataInfo | HRilDataInfo
443      */
444     void (*SetDataProfileInfo)(const ReqDataInfo *requestInfo, const HRilDataInfo *data, int32_t len);
445 
446     /**
447      * @brief Sends the data service performance mode.
448      *
449      * @param requestInfo Request data info, for details, see {@link
450      * ReqDataInfo}.
451      * @param data Indicates the data service performance mode.
452      * @see ReqDataInfo | HRilDataPerformanceInfo
453      */
454     void (*SendDataPerformanceMode)(const ReqDataInfo *requestInfo, const HRilDataPerformanceInfo *data);
455 
456     /**
457      * @brief Sends the data service sleep mode.
458      *
459      * @param requestInfo Request data info, for details, see {@link
460      * ReqDataInfo}.
461      * @param data Indicates the sleep mode for data services.
462      * @see ReqDataInfo | HRilDataSleepInfo
463      */
464     void (*SendDataSleepMode)(const ReqDataInfo *requestInfo, const HRilDataSleepInfo *data);
465 
466     /**
467      * @brief Enables the data service of a SIM card slot.
468      *
469      * @param requestInfo Request data info, for details, see {@link
470      * ReqDataInfo}.
471      * @param enabled Whether to enable the data service.
472      * @see ReqDataInfo
473      */
474     void (*SetDataPermitted)(const ReqDataInfo *requestInfo, int32_t enabled);
475 
476     /**
477      * @brief Get link capability.
478      *
479      * @param requestInfo Request data info, for details, see {@link
480      * ReqDataInfo}.
481      * @see ReqDataInfo
482      */
483     void (*GetLinkCapability)(const ReqDataInfo *requestInfo);
484 
485     /**
486      * @brief Clean all data connections.
487      *
488      * @param requestInfo Request data info, for details, see {@link
489      * ReqDataInfo}.
490      * @see ReqDataInfo
491      */
492     void (*CleanAllConnections)(const ReqDataInfo *requestInfo);
493 
494     /**
495      * @brief Activates the packet data protocol (PDP) context with apnTypes.
496      *
497      * @param requestInfo Request data info, for details, see {@link
498      * ReqDataInfo}.
499      * @param data Indicates the data information.
500      * @see ReqDataInfo | HRilDataInfoWithApnTypes
501      */
502     void (*ActivatePdpContextWithApnTypes)(const ReqDataInfo *requestInfo, const HRilDataInfoWithApnTypes *data);
503 } HRilDataReq;
504 #ifdef __cplusplus
505 }
506 #endif
507 #endif // OHOS_RIL_VENDOR_DATA_DEFS_H
508