• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #pragma once
2 /*
3  * Copyright (C) 2016 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #include <guest/libs/platform_support/api_level_fixes.h>
18 
19 #include <memory.h>
20 #include <stddef.h>
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include "common.h"
25 #include "linux_ioctl.h"
26 #include "wpa_supplicant_i.h"
27 #include <linux/if_ether.h>
28 
29 #define VSOC_WPA_SUPPLICANT_DEBUG 0
30 
31 #if VSOC_WPA_SUPPLICANT_DEBUG
32 #  define D(...) ALOGD(__VA_ARGS__)
33 #else
34 #  define D(...) ((void)0)
35 #endif
36 
37 
38 typedef struct android_wifi_priv_cmd {
39   char* buf;
40   int used_len;
41   int total_len;
42 } android_wifi_priv_cmd;
43 
44 #if VSOC_PLATFORM_SDK_BEFORE(K)
45 
46 #include "driver.h"
47 
48 struct i802_bss {
49   struct wpa_driver_nl80211_data* drv;
50   struct i802_bss* next;
51   int ifindex;
52   char ifname[IFNAMSIZ + 1];
53   char brname[IFNAMSIZ];
54 
55   unsigned int beacon_set:1;
56   unsigned int added_if_into_bridge:1;
57   unsigned int added_bridge:1;
58   unsigned int in_deinit:1;
59 
60   u8 addr[ETH_ALEN];
61 
62   int freq;
63 
64   void* ctx;
65   struct nl_handle* nl_preq;
66   struct nl_handle* nl_mgmt;
67   struct nl_cb* nl_cb;
68 
69   struct nl80211_wiphy_data *wiphy_data;
70   struct dl_list wiphy_list;
71 };
72 
73 struct nl80211_global {
74   struct dl_list interfaces;
75   int if_add_ifindex;
76   struct netlink_data *netlink;
77   struct nl_cb* nl_cb;
78   struct nl_handle* nl;
79   int nl80211_id;
80   int ioctl_sock;  // socket for ioctl() use
81 
82   struct nl_handle* nl_event;
83 };
84 
85 struct wpa_driver_nl80211_data {
86   struct nl80211_global* global;
87   struct dl_list list;
88   struct dl_list wiphy_list;
89   char phyname[32];
90   void* ctx;
91   int ifindex;
92   int if_removed;
93   int if_disabled;
94   int ignore_if_down_event;
95   struct rfkill_data* rfkill;
96   struct wpa_driver_capa capa;
97   u8* extended_capa;
98   u8* extended_capa_mask;
99   unsigned int extended_capa_len;
100   int has_capability;
101   // More internal data follows.
102 };
103 
104 #endif  // VSOC_PLATFORM_SDK_AFTER(J)
105