]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/hostapd/hostapd.h
This commit was generated by cvs2svn to compensate for changes in r155364,
[FreeBSD/FreeBSD.git] / contrib / hostapd / hostapd.h
1 #ifndef HOSTAPD_H
2 #define HOSTAPD_H
3
4 #include "common.h"
5 #include "ap.h"
6
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
17 #include "hostap_common.h"
18 #include "config.h"
19
20 struct ieee8023_hdr {
21         u8 dest[6];
22         u8 src[6];
23         u16 ethertype;
24 } __attribute__ ((packed));
25
26
27 struct ieee80211_hdr {
28         u16 frame_control;
29         u16 duration_id;
30         u8 addr1[6];
31         u8 addr2[6];
32         u8 addr3[6];
33         u16 seq_ctrl;
34         /* followed by 'u8 addr4[6];' if ToDS and FromDS is set in data frame
35          */
36 } __attribute__ ((packed));
37
38 #define IEEE80211_DA_FROMDS addr1
39 #define IEEE80211_BSSID_FROMDS addr2
40 #define IEEE80211_SA_FROMDS addr3
41
42 #define IEEE80211_HDRLEN (sizeof(struct ieee80211_hdr))
43
44 #define IEEE80211_FC(type, stype) host_to_le16((type << 2) | (stype << 4))
45
46 /* MTU to be set for the wlan#ap device; this is mainly needed for IEEE 802.1X
47  * frames that might be longer than normal default MTU and they are not
48  * fragmented */
49 #define HOSTAPD_MTU 2290
50
51 extern unsigned char rfc1042_header[6];
52
53 typedef struct hostapd_data hostapd;
54
55 struct hostap_sta_driver_data {
56         unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
57 };
58
59 struct driver_ops;
60 struct wpa_ctrl_dst;
61 struct radius_server_data;
62
63 struct hostapd_data {
64         struct hostapd_config *conf;
65         char *config_fname;
66
67         u8 own_addr[6];
68
69         int num_sta; /* number of entries in sta_list */
70         struct sta_info *sta_list; /* STA info list head */
71         struct sta_info *sta_hash[STA_HASH_SIZE];
72
73         /* pointers to STA info; based on allocated AID or NULL if AID free
74          * AID is in the range 1-2007, so sta_aid[0] corresponders to AID 1
75          * and so on
76          */
77         struct sta_info *sta_aid[MAX_AID_TABLE_SIZE];
78
79         struct driver_ops *driver;
80
81         u8 *default_wep_key;
82         u8 default_wep_key_idx;
83
84         struct radius_client_data *radius;
85         u32 acct_session_id_hi, acct_session_id_lo;
86
87         struct iapp_data *iapp;
88
89         enum { DO_NOT_ASSOC = 0, WAIT_BEACON, AUTHENTICATE, ASSOCIATE,
90                ASSOCIATED } assoc_ap_state;
91         char assoc_ap_ssid[33];
92         int assoc_ap_ssid_len;
93         u16 assoc_ap_aid;
94
95         struct hostapd_cached_radius_acl *acl_cache;
96         struct hostapd_acl_query_data *acl_queries;
97
98         u8 *wpa_ie;
99         size_t wpa_ie_len;
100         struct wpa_authenticator *wpa_auth;
101
102 #define PMKID_HASH_SIZE 128
103 #define PMKID_HASH(pmkid) (unsigned int) ((pmkid)[0] & 0x7f)
104         struct rsn_pmksa_cache *pmkid[PMKID_HASH_SIZE];
105         struct rsn_pmksa_cache *pmksa;
106         int pmksa_count;
107
108         struct rsn_preauth_interface *preauth_iface;
109         time_t michael_mic_failure;
110         int michael_mic_failures;
111         int tkip_countermeasures;
112
113         int ctrl_sock;
114         struct wpa_ctrl_dst *ctrl_dst;
115
116         void *ssl_ctx;
117         void *eap_sim_db_priv;
118         struct radius_server_data *radius_srv;
119 };
120
121 void hostapd_new_assoc_sta(hostapd *hapd, struct sta_info *sta);
122 void hostapd_logger(hostapd *hapd, u8 *addr, unsigned int module, int level,
123                     char *fmt, ...) __attribute__ ((format (printf, 5, 6)));
124
125
126 #define HOSTAPD_DEBUG(level, args...) \
127 do { \
128         if (hapd->conf == NULL || hapd->conf->debug >= (level)) \
129                 printf(args); \
130 } while (0)
131
132 #define HOSTAPD_DEBUG_COND(level) (hapd->conf->debug >= (level))
133
134 #endif /* HOSTAPD_H */