PHY ids for Broadcom 5755/5787
[dragonfly/vkernel-mp.git] / contrib / hostapd-0.4.9 / hostapd.h
blobfdcb420ee27e7b4f74a6bcd3c0470a2d2d5ad8b1
1 #ifndef HOSTAPD_H
2 #define HOSTAPD_H
4 #include "common.h"
5 #include "ap.h"
7 #ifndef ETH_ALEN
8 #define ETH_ALEN 6
9 #endif
10 #ifndef IFNAMSIZ
11 #define IFNAMSIZ 16
12 #endif
13 #ifndef ETH_P_ALL
14 #define ETH_P_ALL 0x0003
15 #endif
16 #ifndef ETH_P_PAE
17 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
18 #endif /* ETH_P_PAE */
20 #ifndef BIT
21 #define BIT(x) (1 << (x))
22 #endif
24 #ifndef MAC2STR
25 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
26 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
27 #endif
29 #include "config.h"
31 struct ieee8023_hdr {
32 u8 dest[6];
33 u8 src[6];
34 u16 ethertype;
35 } __attribute__ ((packed));
38 struct ieee80211_hdr {
39 u16 frame_control;
40 u16 duration_id;
41 u8 addr1[6];
42 u8 addr2[6];
43 u8 addr3[6];
44 u16 seq_ctrl;
45 /* followed by 'u8 addr4[6];' if ToDS and FromDS is set in data frame
47 } __attribute__ ((packed));
49 #define IEEE80211_DA_FROMDS addr1
50 #define IEEE80211_BSSID_FROMDS addr2
51 #define IEEE80211_SA_FROMDS addr3
53 #define IEEE80211_HDRLEN (sizeof(struct ieee80211_hdr))
55 #define IEEE80211_FC(type, stype) host_to_le16((type << 2) | (stype << 4))
57 /* MTU to be set for the wlan#ap device; this is mainly needed for IEEE 802.1X
58 * frames that might be longer than normal default MTU and they are not
59 * fragmented */
60 #define HOSTAPD_MTU 2290
62 extern unsigned char rfc1042_header[6];
64 typedef struct hostapd_data hostapd;
66 struct hostap_sta_driver_data {
67 unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
70 struct driver_ops;
71 struct wpa_ctrl_dst;
72 struct radius_server_data;
74 struct hostapd_data {
75 struct hostapd_config *conf;
76 char *config_fname;
78 u8 own_addr[6];
80 int num_sta; /* number of entries in sta_list */
81 struct sta_info *sta_list; /* STA info list head */
82 struct sta_info *sta_hash[STA_HASH_SIZE];
84 /* pointers to STA info; based on allocated AID or NULL if AID free
85 * AID is in the range 1-2007, so sta_aid[0] corresponders to AID 1
86 * and so on
88 struct sta_info *sta_aid[MAX_AID_TABLE_SIZE];
90 struct driver_ops *driver;
92 u8 *default_wep_key;
93 u8 default_wep_key_idx;
95 struct radius_client_data *radius;
96 u32 acct_session_id_hi, acct_session_id_lo;
98 struct iapp_data *iapp;
100 enum { DO_NOT_ASSOC = 0, WAIT_BEACON, AUTHENTICATE, ASSOCIATE,
101 ASSOCIATED } assoc_ap_state;
102 char assoc_ap_ssid[33];
103 int assoc_ap_ssid_len;
104 u16 assoc_ap_aid;
106 struct hostapd_cached_radius_acl *acl_cache;
107 struct hostapd_acl_query_data *acl_queries;
109 u8 *wpa_ie;
110 size_t wpa_ie_len;
111 struct wpa_authenticator *wpa_auth;
113 #define PMKID_HASH_SIZE 128
114 #define PMKID_HASH(pmkid) (unsigned int) ((pmkid)[0] & 0x7f)
115 struct rsn_pmksa_cache *pmkid[PMKID_HASH_SIZE];
116 struct rsn_pmksa_cache *pmksa;
117 int pmksa_count;
119 struct rsn_preauth_interface *preauth_iface;
120 time_t michael_mic_failure;
121 int michael_mic_failures;
122 int tkip_countermeasures;
124 int ctrl_sock;
125 struct wpa_ctrl_dst *ctrl_dst;
127 void *ssl_ctx;
128 void *eap_sim_db_priv;
129 struct radius_server_data *radius_srv;
132 void hostapd_new_assoc_sta(hostapd *hapd, struct sta_info *sta, int reassoc);
133 void hostapd_logger(struct hostapd_data *hapd, const u8 *addr,
134 unsigned int module, int level, const char *fmt,
135 ...) __attribute__ ((format (printf, 5, 6)));
138 #define HOSTAPD_DEBUG(level, args...) \
139 do { \
140 if (hapd->conf == NULL || hapd->conf->debug >= (level)) \
141 printf(args); \
142 } while (0)
144 #define HOSTAPD_DEBUG_COND(level) (hapd->conf->debug >= (level))
146 const char * hostapd_ip_txt(const struct hostapd_ip_addr *addr, char *buf,
147 size_t buflen);
149 #endif /* HOSTAPD_H */