ap_list.h revision 214501
1214501Srpaulo/*
2214501Srpaulo * hostapd / AP table
3214501Srpaulo * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi>
4214501Srpaulo * Copyright (c) 2003-2004, Instant802 Networks, Inc.
5214501Srpaulo * Copyright (c) 2006, Devicescape Software, Inc.
6214501Srpaulo *
7214501Srpaulo * This program is free software; you can redistribute it and/or modify
8214501Srpaulo * it under the terms of the GNU General Public License version 2 as
9214501Srpaulo * published by the Free Software Foundation.
10214501Srpaulo *
11214501Srpaulo * Alternatively, this software may be distributed under the terms of BSD
12214501Srpaulo * license.
13214501Srpaulo *
14214501Srpaulo * See README and COPYING for more details.
15214501Srpaulo */
16214501Srpaulo
17214501Srpaulo#ifndef AP_LIST_H
18214501Srpaulo#define AP_LIST_H
19214501Srpaulo
20214501Srpaulostruct ap_info {
21214501Srpaulo	/* Note: next/prev pointers are updated whenever a new beacon is
22214501Srpaulo	 * received because these are used to find the least recently used
23214501Srpaulo	 * entries. iter_next/iter_prev are updated only when adding new BSSes
24214501Srpaulo	 * and when removing old ones. These should be used when iterating
25214501Srpaulo	 * through the table in a manner that allows beacons to be received
26214501Srpaulo	 * during the iteration. */
27214501Srpaulo	struct ap_info *next; /* next entry in AP list */
28214501Srpaulo	struct ap_info *prev; /* previous entry in AP list */
29214501Srpaulo	struct ap_info *hnext; /* next entry in hash table list */
30214501Srpaulo	struct ap_info *iter_next; /* next entry in AP iteration list */
31214501Srpaulo	struct ap_info *iter_prev; /* previous entry in AP iteration list */
32214501Srpaulo	u8 addr[6];
33214501Srpaulo	u16 beacon_int;
34214501Srpaulo	u16 capability;
35214501Srpaulo	u8 supported_rates[WLAN_SUPP_RATES_MAX];
36214501Srpaulo	u8 ssid[33];
37214501Srpaulo	size_t ssid_len;
38214501Srpaulo	int wpa;
39214501Srpaulo	int erp; /* ERP Info or -1 if ERP info element not present */
40214501Srpaulo
41214501Srpaulo	int channel;
42214501Srpaulo	int datarate; /* in 100 kbps */
43214501Srpaulo	int ssi_signal;
44214501Srpaulo
45214501Srpaulo	int ht_support;
46214501Srpaulo
47214501Srpaulo	unsigned int num_beacons; /* number of beacon frames received */
48214501Srpaulo	time_t last_beacon;
49214501Srpaulo
50214501Srpaulo	int already_seen; /* whether API call AP-NEW has already fetched
51214501Srpaulo			   * information about this AP */
52214501Srpaulo};
53214501Srpaulo
54214501Srpaulostruct ieee802_11_elems;
55214501Srpaulostruct hostapd_frame_info;
56214501Srpaulo
57214501Srpaulostruct ap_info * ap_get_ap(struct hostapd_iface *iface, const u8 *sta);
58214501Srpauloint ap_ap_for_each(struct hostapd_iface *iface,
59214501Srpaulo		   int (*func)(struct ap_info *s, void *data), void *data);
60214501Srpaulovoid ap_list_process_beacon(struct hostapd_iface *iface,
61214501Srpaulo			    const struct ieee80211_mgmt *mgmt,
62214501Srpaulo			    struct ieee802_11_elems *elems,
63214501Srpaulo			    struct hostapd_frame_info *fi);
64214501Srpaulo#ifdef NEED_AP_MLME
65214501Srpauloint ap_list_init(struct hostapd_iface *iface);
66214501Srpaulovoid ap_list_deinit(struct hostapd_iface *iface);
67214501Srpaulo#else /* NEED_AP_MLME */
68214501Srpaulostatic inline int ap_list_init(struct hostapd_iface *iface)
69214501Srpaulo{
70214501Srpaulo	return 0;
71214501Srpaulo}
72214501Srpaulo
73214501Srpaulostatic inline void ap_list_deinit(struct hostapd_iface *iface)
74214501Srpaulo{
75214501Srpaulo}
76214501Srpaulo#endif /* NEED_AP_MLME */
77214501Srpaulo
78214501Srpaulo#endif /* AP_LIST_H */
79