1e28a4053SRui Paulo /*
2e28a4053SRui Paulo * WPA Supplicant - Basic AP mode support routines
3e28a4053SRui Paulo * Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
4e28a4053SRui Paulo * Copyright (c) 2009, Atheros Communications
5e28a4053SRui Paulo *
6f05cddf9SRui Paulo * This software may be distributed under the terms of the BSD license.
7f05cddf9SRui Paulo * See README for more details.
8e28a4053SRui Paulo */
9e28a4053SRui Paulo
10e28a4053SRui Paulo #ifndef AP_H
11e28a4053SRui Paulo #define AP_H
12e28a4053SRui Paulo
13*a90b9d01SCy Schubert enum macaddr_acl;
14*a90b9d01SCy Schubert
15e28a4053SRui Paulo int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
16e28a4053SRui Paulo struct wpa_ssid *ssid);
17e28a4053SRui Paulo void wpa_supplicant_ap_deinit(struct wpa_supplicant *wpa_s);
18e28a4053SRui Paulo void wpa_supplicant_ap_rx_eapol(struct wpa_supplicant *wpa_s,
19*a90b9d01SCy Schubert const u8 *src_addr, const u8 *buf, size_t len,
20*a90b9d01SCy Schubert enum frame_encryption encrypted);
21f05cddf9SRui Paulo int wpa_supplicant_ap_wps_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid,
22f05cddf9SRui Paulo const u8 *p2p_dev_addr);
23e28a4053SRui Paulo int wpa_supplicant_ap_wps_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
24f05cddf9SRui Paulo const char *pin, char *buf, size_t buflen,
25f05cddf9SRui Paulo int timeout);
26f05cddf9SRui Paulo int wpa_supplicant_ap_wps_cancel(struct wpa_supplicant *wpa_s);
27f05cddf9SRui Paulo void wpas_wps_ap_pin_disable(struct wpa_supplicant *wpa_s);
28f05cddf9SRui Paulo const char * wpas_wps_ap_pin_random(struct wpa_supplicant *wpa_s, int timeout);
29f05cddf9SRui Paulo const char * wpas_wps_ap_pin_get(struct wpa_supplicant *wpa_s);
30f05cddf9SRui Paulo int wpas_wps_ap_pin_set(struct wpa_supplicant *wpa_s, const char *pin,
31f05cddf9SRui Paulo int timeout);
32e28a4053SRui Paulo int ap_ctrl_iface_sta_first(struct wpa_supplicant *wpa_s,
33e28a4053SRui Paulo char *buf, size_t buflen);
34e28a4053SRui Paulo int ap_ctrl_iface_sta(struct wpa_supplicant *wpa_s, const char *txtaddr,
35e28a4053SRui Paulo char *buf, size_t buflen);
36e28a4053SRui Paulo int ap_ctrl_iface_sta_next(struct wpa_supplicant *wpa_s, const char *txtaddr,
37e28a4053SRui Paulo char *buf, size_t buflen);
38f05cddf9SRui Paulo int ap_ctrl_iface_sta_deauthenticate(struct wpa_supplicant *wpa_s,
39f05cddf9SRui Paulo const char *txtaddr);
40f05cddf9SRui Paulo int ap_ctrl_iface_sta_disassociate(struct wpa_supplicant *wpa_s,
41f05cddf9SRui Paulo const char *txtaddr);
42e28a4053SRui Paulo int ap_ctrl_iface_wpa_get_status(struct wpa_supplicant *wpa_s, char *buf,
43e28a4053SRui Paulo size_t buflen, int verbose);
44*a90b9d01SCy Schubert int ap_ctrl_iface_disassoc_imminent(struct wpa_supplicant *wpa_s,
45*a90b9d01SCy Schubert const char *buf);
46*a90b9d01SCy Schubert int ap_ctrl_iface_ess_disassoc(struct wpa_supplicant *wpa_s, const char *buf);
47*a90b9d01SCy Schubert int ap_ctrl_iface_bss_tm_req(struct wpa_supplicant *wpa_s, const char *buf);
48*a90b9d01SCy Schubert int ap_ctrl_iface_acl_add_mac(struct wpa_supplicant *wpa_s,
49*a90b9d01SCy Schubert enum macaddr_acl acl_type, const char *buf);
50*a90b9d01SCy Schubert int ap_ctrl_iface_acl_del_mac(struct wpa_supplicant *wpa_s,
51*a90b9d01SCy Schubert enum macaddr_acl acl_type, const char *buf);
52*a90b9d01SCy Schubert int ap_ctrl_iface_acl_show_mac(struct wpa_supplicant *wpa_s,
53*a90b9d01SCy Schubert enum macaddr_acl acl_type, char *buf,
54*a90b9d01SCy Schubert size_t buflen);
55*a90b9d01SCy Schubert void ap_ctrl_iface_acl_clear_list(struct wpa_supplicant *wpa_s,
56*a90b9d01SCy Schubert enum macaddr_acl acl_type);
57*a90b9d01SCy Schubert int ap_ctrl_iface_disassoc_deny_mac(struct wpa_supplicant *wpa_s);
58*a90b9d01SCy Schubert int ap_ctrl_iface_disassoc_accept_mac(struct wpa_supplicant *wpa_s);
59*a90b9d01SCy Schubert int ap_ctrl_iface_set_acl(struct wpa_supplicant *wpa_s);
60e28a4053SRui Paulo void ap_tx_status(void *ctx, const u8 *addr,
61e28a4053SRui Paulo const u8 *buf, size_t len, int ack);
62f05cddf9SRui Paulo void ap_eapol_tx_status(void *ctx, const u8 *dst,
63f05cddf9SRui Paulo const u8 *data, size_t len, int ack);
64f05cddf9SRui Paulo void ap_client_poll_ok(void *ctx, const u8 *addr);
65f05cddf9SRui Paulo void ap_rx_from_unknown_sta(void *ctx, const u8 *addr, int wds);
66e28a4053SRui Paulo void ap_mgmt_rx(void *ctx, struct rx_mgmt *rx_mgmt);
67e28a4053SRui Paulo void ap_mgmt_tx_cb(void *ctx, const u8 *buf, size_t len, u16 stype, int ok);
68f05cddf9SRui Paulo int wpa_supplicant_ap_update_beacon(struct wpa_supplicant *wpa_s);
69e28a4053SRui Paulo int wpa_supplicant_ap_mac_addr_filter(struct wpa_supplicant *wpa_s,
70e28a4053SRui Paulo const u8 *addr);
71f05cddf9SRui Paulo void wpa_supplicant_ap_pwd_auth_fail(struct wpa_supplicant *wpa_s);
725b9c547cSRui Paulo int ap_switch_channel(struct wpa_supplicant *wpa_s,
735b9c547cSRui Paulo struct csa_settings *settings);
745b9c547cSRui Paulo int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *txtaddr);
75f05cddf9SRui Paulo void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
76*a90b9d01SCy Schubert int offset, int width, int cf1, int cf2,
77*a90b9d01SCy Schubert u16 punct_bitmap, int finished);
785b9c547cSRui Paulo struct wpabuf * wpas_ap_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
795b9c547cSRui Paulo int ndef);
805b9c547cSRui Paulo #ifdef CONFIG_AP
815b9c547cSRui Paulo struct wpabuf * wpas_ap_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
825b9c547cSRui Paulo int ndef);
835b9c547cSRui Paulo #else /* CONFIG_AP */
845b9c547cSRui Paulo static inline struct wpabuf *
wpas_ap_wps_nfc_handover_sel(struct wpa_supplicant * wpa_s,int ndef)855b9c547cSRui Paulo wpas_ap_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
865b9c547cSRui Paulo int ndef)
875b9c547cSRui Paulo {
885b9c547cSRui Paulo return NULL;
895b9c547cSRui Paulo }
905b9c547cSRui Paulo #endif /* CONFIG_AP */
915b9c547cSRui Paulo
925b9c547cSRui Paulo int wpas_ap_wps_nfc_report_handover(struct wpa_supplicant *wpa_s,
935b9c547cSRui Paulo const struct wpabuf *req,
945b9c547cSRui Paulo const struct wpabuf *sel);
955b9c547cSRui Paulo int wpas_ap_wps_add_nfc_pw(struct wpa_supplicant *wpa_s, u16 pw_id,
965b9c547cSRui Paulo const struct wpabuf *pw, const u8 *pubkey_hash);
975b9c547cSRui Paulo
985b9c547cSRui Paulo struct hostapd_config;
99780fb4a2SCy Schubert int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s,
1005b9c547cSRui Paulo struct wpa_ssid *ssid,
1015b9c547cSRui Paulo struct hostapd_config *conf);
1025b9c547cSRui Paulo
1035b9c547cSRui Paulo int wpas_ap_stop_ap(struct wpa_supplicant *wpa_s);
1045b9c547cSRui Paulo
105780fb4a2SCy Schubert int wpas_ap_pmksa_cache_list(struct wpa_supplicant *wpa_s, char *buf,
106780fb4a2SCy Schubert size_t len);
107780fb4a2SCy Schubert void wpas_ap_pmksa_cache_flush(struct wpa_supplicant *wpa_s);
10885732ac8SCy Schubert int wpas_ap_pmksa_cache_list_mesh(struct wpa_supplicant *wpa_s, const u8 *addr,
10985732ac8SCy Schubert char *buf, size_t len);
11085732ac8SCy Schubert int wpas_ap_pmksa_cache_add_external(struct wpa_supplicant *wpa_s, char *cmd);
1114b72b91aSCy Schubert int wpas_ap_update_beacon(struct wpa_supplicant *wpa_s);
112780fb4a2SCy Schubert
11385732ac8SCy Schubert void wpas_ap_event_dfs_radar_detected(struct wpa_supplicant *wpa_s,
1145b9c547cSRui Paulo struct dfs_event *radar);
11585732ac8SCy Schubert void wpas_ap_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
1165b9c547cSRui Paulo struct dfs_event *radar);
11785732ac8SCy Schubert void wpas_ap_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
1185b9c547cSRui Paulo struct dfs_event *radar);
11985732ac8SCy Schubert void wpas_ap_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
1205b9c547cSRui Paulo struct dfs_event *radar);
12185732ac8SCy Schubert void wpas_ap_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s,
1225b9c547cSRui Paulo struct dfs_event *radar);
123e28a4053SRui Paulo
124325151a3SRui Paulo void ap_periodic(struct wpa_supplicant *wpa_s);
125325151a3SRui Paulo
126e28a4053SRui Paulo #endif /* AP_H */
127