ap_list.h revision 214501
1/*
2 * hostapd / AP table
3 * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi>
4 * Copyright (c) 2003-2004, Instant802 Networks, Inc.
5 * Copyright (c) 2006, Devicescape Software, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Alternatively, this software may be distributed under the terms of BSD
12 * license.
13 *
14 * See README and COPYING for more details.
15 */
16
17#ifndef AP_LIST_H
18#define AP_LIST_H
19
20struct ap_info {
21	/* Note: next/prev pointers are updated whenever a new beacon is
22	 * received because these are used to find the least recently used
23	 * entries. iter_next/iter_prev are updated only when adding new BSSes
24	 * and when removing old ones. These should be used when iterating
25	 * through the table in a manner that allows beacons to be received
26	 * during the iteration. */
27	struct ap_info *next; /* next entry in AP list */
28	struct ap_info *prev; /* previous entry in AP list */
29	struct ap_info *hnext; /* next entry in hash table list */
30	struct ap_info *iter_next; /* next entry in AP iteration list */
31	struct ap_info *iter_prev; /* previous entry in AP iteration list */
32	u8 addr[6];
33	u16 beacon_int;
34	u16 capability;
35	u8 supported_rates[WLAN_SUPP_RATES_MAX];
36	u8 ssid[33];
37	size_t ssid_len;
38	int wpa;
39	int erp; /* ERP Info or -1 if ERP info element not present */
40
41	int channel;
42	int datarate; /* in 100 kbps */
43	int ssi_signal;
44
45	int ht_support;
46
47	unsigned int num_beacons; /* number of beacon frames received */
48	time_t last_beacon;
49
50	int already_seen; /* whether API call AP-NEW has already fetched
51			   * information about this AP */
52};
53
54struct ieee802_11_elems;
55struct hostapd_frame_info;
56
57struct ap_info * ap_get_ap(struct hostapd_iface *iface, const u8 *sta);
58int ap_ap_for_each(struct hostapd_iface *iface,
59		   int (*func)(struct ap_info *s, void *data), void *data);
60void ap_list_process_beacon(struct hostapd_iface *iface,
61			    const struct ieee80211_mgmt *mgmt,
62			    struct ieee802_11_elems *elems,
63			    struct hostapd_frame_info *fi);
64#ifdef NEED_AP_MLME
65int ap_list_init(struct hostapd_iface *iface);
66void ap_list_deinit(struct hostapd_iface *iface);
67#else /* NEED_AP_MLME */
68static inline int ap_list_init(struct hostapd_iface *iface)
69{
70	return 0;
71}
72
73static inline void ap_list_deinit(struct hostapd_iface *iface)
74{
75}
76#endif /* NEED_AP_MLME */
77
78#endif /* AP_LIST_H */
79