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 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 (*send_mgmt_frame)(void *priv, const void *msg, size_t len,
54 int (*set_assoc_ap)(void *priv, u8 *addr);
55 int (*sta_add)(void *priv, u8 *addr, u16 aid, u16 capability,
57 int (*get_inact_sec)(void *priv, u8 *addr);
58 int (*sta_clear_stats)(void *priv, u8 *addr);
62 hostapd_driver_init(struct hostapd_data *hapd)
64 if (hapd->driver == NULL || hapd->driver->init == NULL)
66 return hapd->driver->init(hapd);
70 hostapd_driver_deinit(struct hostapd_data *hapd)
72 if (hapd->driver == NULL || hapd->driver->deinit == NULL)
74 hapd->driver->deinit(hapd->driver);
78 hostapd_wireless_event_init(struct hostapd_data *hapd)
80 if (hapd->driver == NULL ||
81 hapd->driver->wireless_event_init == NULL)
83 return hapd->driver->wireless_event_init(hapd->driver);
87 hostapd_wireless_event_deinit(struct hostapd_data *hapd)
89 if (hapd->driver == NULL ||
90 hapd->driver->wireless_event_deinit == NULL)
92 hapd->driver->wireless_event_deinit(hapd->driver);
96 hostapd_set_ieee8021x(struct hostapd_data *hapd, int enabled)
98 if (hapd->driver == NULL || hapd->driver->set_ieee8021x == NULL)
100 return hapd->driver->set_ieee8021x(hapd->driver, enabled);
104 hostapd_set_privacy(struct hostapd_data *hapd, int enabled)
106 if (hapd->driver == NULL || hapd->driver->set_privacy == NULL)
108 return hapd->driver->set_privacy(hapd->driver, enabled);
112 hostapd_set_encryption(struct hostapd_data *hapd, const char *alg, u8 *addr,
113 int idx, u8 *key, size_t key_len)
115 if (hapd->driver == NULL || hapd->driver->set_encryption == NULL)
117 return hapd->driver->set_encryption(hapd->driver, alg, addr, idx, key,
122 hostapd_get_seqnum(struct hostapd_data *hapd, u8 *addr, int idx, u8 *seq)
124 if (hapd->driver == NULL || hapd->driver->get_seqnum == NULL)
126 return hapd->driver->get_seqnum(hapd->driver, addr, idx, seq);
130 hostapd_flush(struct hostapd_data *hapd)
132 if (hapd->driver == NULL || hapd->driver->flush == NULL)
134 return hapd->driver->flush(hapd->driver);
138 hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
141 if (hapd->driver == NULL || hapd->driver->set_generic_elem == NULL)
143 return hapd->driver->set_generic_elem(hapd->driver, elem, elem_len);
147 hostapd_read_sta_data(struct hostapd_data *hapd,
148 struct hostap_sta_driver_data *data, u8 *addr)
150 if (hapd->driver == NULL || hapd->driver->read_sta_data == NULL)
152 return hapd->driver->read_sta_data(hapd->driver, data, addr);
156 hostapd_send_eapol(struct hostapd_data *hapd, u8 *addr, u8 *data,
157 size_t data_len, int encrypt)
159 if (hapd->driver == NULL || hapd->driver->send_eapol == NULL)
161 return hapd->driver->send_eapol(hapd->driver, addr, data, data_len,
166 hostapd_set_sta_authorized(struct hostapd_data *hapd, u8 *addr, int authorized)
168 if (hapd->driver == NULL || hapd->driver->set_sta_authorized == NULL)
170 return hapd->driver->set_sta_authorized(hapd->driver, addr,
175 hostapd_sta_deauth(struct hostapd_data *hapd, u8 *addr, int reason)
177 if (hapd->driver == NULL || hapd->driver->sta_deauth == NULL)
179 return hapd->driver->sta_deauth(hapd->driver, addr, reason);
183 hostapd_sta_disassoc(struct hostapd_data *hapd, u8 *addr, int reason)
185 if (hapd->driver == NULL || hapd->driver->sta_disassoc == NULL)
187 return hapd->driver->sta_disassoc(hapd->driver, addr, reason);
191 hostapd_sta_remove(struct hostapd_data *hapd, u8 *addr)
193 if (hapd->driver == NULL || hapd->driver->sta_remove == NULL)
195 return hapd->driver->sta_remove(hapd->driver, addr);
199 hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len)
201 if (hapd->driver == NULL || hapd->driver->get_ssid == NULL)
203 return hapd->driver->get_ssid(hapd->driver, buf, len);
207 hostapd_set_ssid(struct hostapd_data *hapd, u8 *buf, size_t len)
209 if (hapd->driver == NULL || hapd->driver->set_ssid == NULL)
211 return hapd->driver->set_ssid(hapd->driver, buf, len);
215 hostapd_send_mgmt_frame(struct hostapd_data *hapd, const void *msg, size_t len,
218 if (hapd->driver == NULL || hapd->driver->send_mgmt_frame == NULL)
220 return hapd->driver->send_mgmt_frame(hapd->driver, msg, len, flags);
224 hostapd_set_assoc_ap(struct hostapd_data *hapd, u8 *addr)
226 if (hapd->driver == NULL || hapd->driver->set_assoc_ap == NULL)
228 return hapd->driver->set_assoc_ap(hapd->driver, addr);
232 hostapd_sta_add(struct hostapd_data *hapd, u8 *addr, u16 aid, u16 capability,
235 if (hapd->driver == NULL || hapd->driver->sta_add == NULL)
237 return hapd->driver->sta_add(hapd->driver, addr, aid, capability,
242 hostapd_get_inact_sec(struct hostapd_data *hapd, u8 *addr)
244 if (hapd->driver == NULL || hapd->driver->get_inact_sec == NULL)
246 return hapd->driver->get_inact_sec(hapd->driver, addr);
250 void driver_register(const char *name, const struct driver_ops *ops);
251 void driver_unregister(const char *name);
252 const struct driver_ops *driver_lookup(const char *name);
255 hostapd_sta_clear_stats(struct hostapd_data *hapd, u8 *addr)
257 if (hapd->driver == NULL || hapd->driver->sta_clear_stats == NULL)
259 return hapd->driver->sta_clear_stats(hapd->driver, addr);
262 #endif /* DRIVER_H */