5 const char *name
; /* as appears in the config file */
7 int (*init
)(struct hostapd_data
*hapd
);
8 void (*deinit
)(void *priv
);
10 int (*wireless_event_init
)(void *priv
);
11 void (*wireless_event_deinit
)(void *priv
);
14 * set_8021x - enable/disable IEEE 802.1X support
15 * @priv: driver private data
16 * @enabled: 1 = enable, 0 = disable
18 * Returns: 0 on success, -1 on failure
20 * Configure the kernel driver to enable/disable 802.1X support.
21 * This may be an empty function if 802.1X support is always enabled.
23 int (*set_ieee8021x
)(void *priv
, int enabled
);
26 * set_privacy - enable/disable privacy
27 * @priv: driver private data
28 * @enabled: 1 = privacy enabled, 0 = disabled
30 * Return: 0 on success, -1 on failure
34 int (*set_privacy
)(void *priv
, int enabled
);
36 int (*set_encryption
)(void *priv
, const char *alg
, u8
*addr
,
37 int idx
, u8
*key
, size_t key_len
);
38 int (*get_seqnum
)(void *priv
, u8
*addr
, int idx
, u8
*seq
);
39 int (*flush
)(void *priv
);
40 int (*set_generic_elem
)(void *priv
, const u8
*elem
, size_t elem_len
);
42 int (*read_sta_data
)(void *priv
, struct hostap_sta_driver_data
*data
,
44 int (*send_eapol
)(void *priv
, u8
*addr
, u8
*data
, size_t data_len
,
46 int (*set_sta_authorized
)(void *driver
, u8
*addr
, int authorized
);
47 int (*sta_deauth
)(void *priv
, u8
*addr
, int reason
);
48 int (*sta_disassoc
)(void *priv
, u8
*addr
, int reason
);
49 int (*sta_remove
)(void *priv
, u8
*addr
);
50 int (*get_ssid
)(void *priv
, u8
*buf
, int len
);
51 int (*set_ssid
)(void *priv
, u8
*buf
, int len
);
52 int (*set_countermeasures
)(void *priv
, int enabled
);
53 int (*send_mgmt_frame
)(void *priv
, const void *msg
, size_t len
,
55 int (*set_assoc_ap
)(void *priv
, u8
*addr
);
56 int (*sta_add
)(void *priv
, u8
*addr
, u16 aid
, u16 capability
,
58 int (*get_inact_sec
)(void *priv
, u8
*addr
);
59 int (*sta_clear_stats
)(void *priv
, u8
*addr
);
63 hostapd_driver_init(struct hostapd_data
*hapd
)
65 if (hapd
->driver
== NULL
|| hapd
->driver
->init
== NULL
)
67 return hapd
->driver
->init(hapd
);
71 hostapd_driver_deinit(struct hostapd_data
*hapd
)
73 if (hapd
->driver
== NULL
|| hapd
->driver
->deinit
== NULL
)
75 hapd
->driver
->deinit(hapd
->driver
);
79 hostapd_wireless_event_init(struct hostapd_data
*hapd
)
81 if (hapd
->driver
== NULL
||
82 hapd
->driver
->wireless_event_init
== NULL
)
84 return hapd
->driver
->wireless_event_init(hapd
->driver
);
88 hostapd_wireless_event_deinit(struct hostapd_data
*hapd
)
90 if (hapd
->driver
== NULL
||
91 hapd
->driver
->wireless_event_deinit
== NULL
)
93 hapd
->driver
->wireless_event_deinit(hapd
->driver
);
97 hostapd_set_ieee8021x(struct hostapd_data
*hapd
, int enabled
)
99 if (hapd
->driver
== NULL
|| hapd
->driver
->set_ieee8021x
== NULL
)
101 return hapd
->driver
->set_ieee8021x(hapd
->driver
, enabled
);
105 hostapd_set_privacy(struct hostapd_data
*hapd
, int enabled
)
107 if (hapd
->driver
== NULL
|| hapd
->driver
->set_privacy
== NULL
)
109 return hapd
->driver
->set_privacy(hapd
->driver
, enabled
);
113 hostapd_set_encryption(struct hostapd_data
*hapd
, const char *alg
, u8
*addr
,
114 int idx
, u8
*key
, size_t key_len
)
116 if (hapd
->driver
== NULL
|| hapd
->driver
->set_encryption
== NULL
)
118 return hapd
->driver
->set_encryption(hapd
->driver
, alg
, addr
, idx
, key
,
123 hostapd_get_seqnum(struct hostapd_data
*hapd
, u8
*addr
, int idx
, u8
*seq
)
125 if (hapd
->driver
== NULL
|| hapd
->driver
->get_seqnum
== NULL
)
127 return hapd
->driver
->get_seqnum(hapd
->driver
, addr
, idx
, seq
);
131 hostapd_flush(struct hostapd_data
*hapd
)
133 if (hapd
->driver
== NULL
|| hapd
->driver
->flush
== NULL
)
135 return hapd
->driver
->flush(hapd
->driver
);
139 hostapd_set_generic_elem(struct hostapd_data
*hapd
, const u8
*elem
,
142 if (hapd
->driver
== NULL
|| hapd
->driver
->set_generic_elem
== NULL
)
144 return hapd
->driver
->set_generic_elem(hapd
->driver
, elem
, elem_len
);
148 hostapd_read_sta_data(struct hostapd_data
*hapd
,
149 struct hostap_sta_driver_data
*data
, u8
*addr
)
151 if (hapd
->driver
== NULL
|| hapd
->driver
->read_sta_data
== NULL
)
153 return hapd
->driver
->read_sta_data(hapd
->driver
, data
, addr
);
157 hostapd_send_eapol(struct hostapd_data
*hapd
, u8
*addr
, u8
*data
,
158 size_t data_len
, int encrypt
)
160 if (hapd
->driver
== NULL
|| hapd
->driver
->send_eapol
== NULL
)
162 return hapd
->driver
->send_eapol(hapd
->driver
, addr
, data
, data_len
,
167 hostapd_set_sta_authorized(struct hostapd_data
*hapd
, u8
*addr
, int authorized
)
169 if (hapd
->driver
== NULL
|| hapd
->driver
->set_sta_authorized
== NULL
)
171 return hapd
->driver
->set_sta_authorized(hapd
->driver
, addr
,
176 hostapd_sta_deauth(struct hostapd_data
*hapd
, u8
*addr
, int reason
)
178 if (hapd
->driver
== NULL
|| hapd
->driver
->sta_deauth
== NULL
)
180 return hapd
->driver
->sta_deauth(hapd
->driver
, addr
, reason
);
184 hostapd_sta_disassoc(struct hostapd_data
*hapd
, u8
*addr
, int reason
)
186 if (hapd
->driver
== NULL
|| hapd
->driver
->sta_disassoc
== NULL
)
188 return hapd
->driver
->sta_disassoc(hapd
->driver
, addr
, reason
);
192 hostapd_sta_remove(struct hostapd_data
*hapd
, u8
*addr
)
194 if (hapd
->driver
== NULL
|| hapd
->driver
->sta_remove
== NULL
)
196 return hapd
->driver
->sta_remove(hapd
->driver
, addr
);
200 hostapd_get_ssid(struct hostapd_data
*hapd
, u8
*buf
, size_t len
)
202 if (hapd
->driver
== NULL
|| hapd
->driver
->get_ssid
== NULL
)
204 return hapd
->driver
->get_ssid(hapd
->driver
, buf
, len
);
208 hostapd_set_ssid(struct hostapd_data
*hapd
, u8
*buf
, size_t len
)
210 if (hapd
->driver
== NULL
|| hapd
->driver
->set_ssid
== NULL
)
212 return hapd
->driver
->set_ssid(hapd
->driver
, buf
, len
);
216 hostapd_send_mgmt_frame(struct hostapd_data
*hapd
, const void *msg
, size_t len
,
219 if (hapd
->driver
== NULL
|| hapd
->driver
->send_mgmt_frame
== NULL
)
221 return hapd
->driver
->send_mgmt_frame(hapd
->driver
, msg
, len
, flags
);
225 hostapd_set_assoc_ap(struct hostapd_data
*hapd
, u8
*addr
)
227 if (hapd
->driver
== NULL
|| hapd
->driver
->set_assoc_ap
== NULL
)
229 return hapd
->driver
->set_assoc_ap(hapd
->driver
, addr
);
233 hostapd_set_countermeasures(struct hostapd_data
*hapd
, int enabled
)
235 if (hapd
->driver
== NULL
|| hapd
->driver
->set_countermeasures
== NULL
)
237 return hapd
->driver
->set_countermeasures(hapd
->driver
, enabled
);
241 hostapd_sta_add(struct hostapd_data
*hapd
, u8
*addr
, u16 aid
, u16 capability
,
244 if (hapd
->driver
== NULL
|| hapd
->driver
->sta_add
== NULL
)
246 return hapd
->driver
->sta_add(hapd
->driver
, addr
, aid
, capability
,
251 hostapd_get_inact_sec(struct hostapd_data
*hapd
, u8
*addr
)
253 if (hapd
->driver
== NULL
|| hapd
->driver
->get_inact_sec
== NULL
)
255 return hapd
->driver
->get_inact_sec(hapd
->driver
, addr
);
259 void driver_register(const char *name
, const struct driver_ops
*ops
);
260 void driver_unregister(const char *name
);
261 const struct driver_ops
*driver_lookup(const char *name
);
264 hostapd_sta_clear_stats(struct hostapd_data
*hapd
, u8
*addr
)
266 if (hapd
->driver
== NULL
|| hapd
->driver
->sta_clear_stats
== NULL
)
268 return hapd
->driver
->sta_clear_stats(hapd
->driver
, addr
);
271 #endif /* DRIVER_H */