xref: /freebsd/contrib/wpa/wpa_supplicant/ap.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
1 /*
2  * WPA Supplicant - Basic AP mode support routines
3  * Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
4  * Copyright (c) 2009, Atheros Communications
5  *
6  * This software may be distributed under the terms of the BSD license.
7  * See README for more details.
8  */
9 
10 #ifndef AP_H
11 #define AP_H
12 
13 enum macaddr_acl;
14 
15 int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
16 			     struct wpa_ssid *ssid);
17 void wpa_supplicant_ap_deinit(struct wpa_supplicant *wpa_s);
18 void wpa_supplicant_ap_rx_eapol(struct wpa_supplicant *wpa_s,
19 				const u8 *src_addr, const u8 *buf, size_t len,
20 				enum frame_encryption encrypted);
21 int wpa_supplicant_ap_wps_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid,
22 			      const u8 *p2p_dev_addr);
23 int wpa_supplicant_ap_wps_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
24 			      const char *pin, char *buf, size_t buflen,
25 			      int timeout);
26 int wpa_supplicant_ap_wps_cancel(struct wpa_supplicant *wpa_s);
27 void wpas_wps_ap_pin_disable(struct wpa_supplicant *wpa_s);
28 const char * wpas_wps_ap_pin_random(struct wpa_supplicant *wpa_s, int timeout);
29 const char * wpas_wps_ap_pin_get(struct wpa_supplicant *wpa_s);
30 int wpas_wps_ap_pin_set(struct wpa_supplicant *wpa_s, const char *pin,
31 			int timeout);
32 int ap_ctrl_iface_sta_first(struct wpa_supplicant *wpa_s,
33 			    char *buf, size_t buflen);
34 int ap_ctrl_iface_sta(struct wpa_supplicant *wpa_s, const char *txtaddr,
35 		      char *buf, size_t buflen);
36 int ap_ctrl_iface_sta_next(struct wpa_supplicant *wpa_s, const char *txtaddr,
37 			   char *buf, size_t buflen);
38 int ap_ctrl_iface_sta_deauthenticate(struct wpa_supplicant *wpa_s,
39 				     const char *txtaddr);
40 int ap_ctrl_iface_sta_disassociate(struct wpa_supplicant *wpa_s,
41 				   const char *txtaddr);
42 int ap_ctrl_iface_wpa_get_status(struct wpa_supplicant *wpa_s, char *buf,
43 				 size_t buflen, int verbose);
44 int ap_ctrl_iface_disassoc_imminent(struct wpa_supplicant *wpa_s,
45 				    const char *buf);
46 int ap_ctrl_iface_ess_disassoc(struct wpa_supplicant *wpa_s, const char *buf);
47 int ap_ctrl_iface_bss_tm_req(struct wpa_supplicant *wpa_s, const char *buf);
48 int ap_ctrl_iface_acl_add_mac(struct wpa_supplicant *wpa_s,
49 			      enum macaddr_acl acl_type, const char *buf);
50 int ap_ctrl_iface_acl_del_mac(struct wpa_supplicant *wpa_s,
51 			      enum macaddr_acl acl_type, const char *buf);
52 int ap_ctrl_iface_acl_show_mac(struct wpa_supplicant *wpa_s,
53 			       enum macaddr_acl acl_type, char *buf,
54 			       size_t buflen);
55 void ap_ctrl_iface_acl_clear_list(struct wpa_supplicant *wpa_s,
56 				  enum macaddr_acl acl_type);
57 int ap_ctrl_iface_disassoc_deny_mac(struct wpa_supplicant *wpa_s);
58 int ap_ctrl_iface_disassoc_accept_mac(struct wpa_supplicant *wpa_s);
59 int ap_ctrl_iface_set_acl(struct wpa_supplicant *wpa_s);
60 void ap_tx_status(void *ctx, const u8 *addr,
61 		  const u8 *buf, size_t len, int ack);
62 void ap_eapol_tx_status(void *ctx, const u8 *dst,
63 			const u8 *data, size_t len, int ack);
64 void ap_client_poll_ok(void *ctx, const u8 *addr);
65 void ap_rx_from_unknown_sta(void *ctx, const u8 *addr, int wds);
66 void ap_mgmt_rx(void *ctx, struct rx_mgmt *rx_mgmt);
67 void ap_mgmt_tx_cb(void *ctx, const u8 *buf, size_t len, u16 stype, int ok);
68 int wpa_supplicant_ap_update_beacon(struct wpa_supplicant *wpa_s);
69 int wpa_supplicant_ap_mac_addr_filter(struct wpa_supplicant *wpa_s,
70 				      const u8 *addr);
71 void wpa_supplicant_ap_pwd_auth_fail(struct wpa_supplicant *wpa_s);
72 int ap_switch_channel(struct wpa_supplicant *wpa_s,
73 		      struct csa_settings *settings);
74 int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *txtaddr);
75 void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
76 		       int offset, int width, int cf1, int cf2,
77 		       u16 punct_bitmap, int finished);
78 struct wpabuf * wpas_ap_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
79 					     int ndef);
80 #ifdef CONFIG_AP
81 struct wpabuf * wpas_ap_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
82 					     int ndef);
83 #else /* CONFIG_AP */
84 static inline struct wpabuf *
wpas_ap_wps_nfc_handover_sel(struct wpa_supplicant * wpa_s,int ndef)85 wpas_ap_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
86 			     int ndef)
87 {
88 	return NULL;
89 }
90 #endif /* CONFIG_AP */
91 
92 int wpas_ap_wps_nfc_report_handover(struct wpa_supplicant *wpa_s,
93 				    const struct wpabuf *req,
94 				    const struct wpabuf *sel);
95 int wpas_ap_wps_add_nfc_pw(struct wpa_supplicant *wpa_s, u16 pw_id,
96 			   const struct wpabuf *pw, const u8 *pubkey_hash);
97 
98 struct hostapd_config;
99 int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s,
100 			      struct wpa_ssid *ssid,
101 			      struct hostapd_config *conf);
102 
103 int wpas_ap_stop_ap(struct wpa_supplicant *wpa_s);
104 
105 int wpas_ap_pmksa_cache_list(struct wpa_supplicant *wpa_s, char *buf,
106 			     size_t len);
107 void wpas_ap_pmksa_cache_flush(struct wpa_supplicant *wpa_s);
108 int wpas_ap_pmksa_cache_list_mesh(struct wpa_supplicant *wpa_s, const u8 *addr,
109 				  char *buf, size_t len);
110 int wpas_ap_pmksa_cache_add_external(struct wpa_supplicant *wpa_s, char *cmd);
111 int wpas_ap_update_beacon(struct wpa_supplicant *wpa_s);
112 
113 void wpas_ap_event_dfs_radar_detected(struct wpa_supplicant *wpa_s,
114 				      struct dfs_event *radar);
115 void wpas_ap_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
116 				   struct dfs_event *radar);
117 void wpas_ap_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
118 				    struct dfs_event *radar);
119 void wpas_ap_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
120 				   struct dfs_event *radar);
121 void wpas_ap_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s,
122 					struct dfs_event *radar);
123 
124 void ap_periodic(struct wpa_supplicant *wpa_s);
125 
126 #endif /* AP_H */
127