1 /**
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15 */
16 
17 
18 #define _GNU_SOURCE
19 
20 #include <pthread.h>
21 #include <sys/types.h>
22 #include <sys/wait.h>
23 
24 #include <sys/stat.h>
25 #include <fcntl.h>
26 #include <sys/ioctl.h>
27 #include <string.h>
28 #include "local_poc.h"
29 #include <unistd.h>
30 #include <stdio.h>
31 
32 struct ipa_ioc_query_intf_rx_props_2 {
33         char name[IPA_RESOURCE_NAME_MAX];
34         uint32_t num_rx_props;
35         struct ipa_ioc_rx_intf_prop rx[2];
36 };
main()37 int main() {
38 
39         int fd = open("/dev/ipa", O_RDWR);
40 
41         struct ipa_ioc_query_intf query_intf;
42         strlcpy(&(query_intf.name[0]), "rmnet_data0", IPA_RESOURCE_NAME_MAX);
43 
44         int result = ioctl(fd, IPA_IOC_QUERY_INTF, &query_intf);
45 
46         ipa_ioc_query_intf_rx_props_2 rx_props_2;
47         memset(&rx_props_2, 0, sizeof(rx_props_2));
48         strlcpy(&(rx_props_2.name[0]), "rmnet_data0", IPA_RESOURCE_NAME_MAX);
49         rx_props_2.num_rx_props = 2;
50 
51         int result2 = ioctl(fd, IPA_IOC_QUERY_INTF_RX_PROPS, &rx_props_2);
52 
53         while (true) {
54                 ipa_ioc_query_intf_rx_props rx_props;
55                 memset(&rx_props, 0, sizeof(rx_props));
56                 strlcpy(&(rx_props.name[0]), "rmnet_data0", IPA_RESOURCE_NAME_MAX);
57                 rx_props.num_rx_props = 0;
58 
59                 int result3 = ioctl(fd, IPA_IOC_QUERY_INTF_RX_PROPS, &rx_props);
60 
61                 usleep(10000);
62         }
63         return 0;
64 }
65