blob: 3c25ca86dc65e7d757b85d22e69e931107f75aae [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * wpa_supplicant / WPS integration
Dmitry Shmidt04949592012-07-19 12:16:46 -07003 * Copyright (c) 2008-2012, Jouni Malinen <j@w1.fi>
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
8
9#ifndef WPS_SUPPLICANT_H
10#define WPS_SUPPLICANT_H
11
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070012struct wpa_scan_results;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070013
14#ifdef CONFIG_WPS
15
16#include "wps/wps.h"
17#include "wps/wps_defs.h"
18
19struct wpa_bss;
20
21struct wps_new_ap_settings {
22 const char *ssid_hex;
23 const char *auth;
24 const char *encr;
25 const char *key_hex;
26};
27
28int wpas_wps_init(struct wpa_supplicant *wpa_s);
29void wpas_wps_deinit(struct wpa_supplicant *wpa_s);
30int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s);
31enum wps_request_type wpas_wps_get_req_type(struct wpa_ssid *ssid);
32int wpas_wps_start_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid,
33 int p2p_group);
34int wpas_wps_start_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
35 const char *pin, int p2p_group, u16 dev_pw_id);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -080036void wpas_wps_pbc_overlap(struct wpa_supplicant *wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070037int wpas_wps_cancel(struct wpa_supplicant *wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070038int wpas_wps_start_reg(struct wpa_supplicant *wpa_s, const u8 *bssid,
39 const char *pin, struct wps_new_ap_settings *settings);
40int wpas_wps_ssid_bss_match(struct wpa_supplicant *wpa_s,
Dmitry Shmidt9bce59c2012-09-11 15:06:38 -070041 struct wpa_ssid *ssid, struct wpa_bss *bss);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070042int wpas_wps_ssid_wildcard_ok(struct wpa_supplicant *wpa_s,
Dmitry Shmidt9bce59c2012-09-11 15:06:38 -070043 struct wpa_ssid *ssid, struct wpa_bss *bss);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070044int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
45 struct wpa_bss *selected, struct wpa_ssid *ssid);
46void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s);
47int wpas_wps_searching(struct wpa_supplicant *wpa_s);
48int wpas_wps_scan_result_text(const u8 *ies, size_t ies_len, char *pos,
49 char *end);
50int wpas_wps_er_start(struct wpa_supplicant *wpa_s, const char *filter);
Dmitry Shmidtfb45fd52015-01-05 13:08:17 -080051void wpas_wps_er_stop(struct wpa_supplicant *wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070052int wpas_wps_er_add_pin(struct wpa_supplicant *wpa_s, const u8 *addr,
53 const char *uuid, const char *pin);
54int wpas_wps_er_pbc(struct wpa_supplicant *wpa_s, const char *uuid);
55int wpas_wps_er_learn(struct wpa_supplicant *wpa_s, const char *uuid,
56 const char *pin);
57int wpas_wps_er_set_config(struct wpa_supplicant *wpa_s, const char *uuid,
58 int id);
59int wpas_wps_er_config(struct wpa_supplicant *wpa_s, const char *uuid,
60 const char *pin, struct wps_new_ap_settings *settings);
Dmitry Shmidt04949592012-07-19 12:16:46 -070061struct wpabuf * wpas_wps_er_nfc_config_token(struct wpa_supplicant *wpa_s,
62 int ndef, const char *uuid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070063int wpas_wps_terminate_pending(struct wpa_supplicant *wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070064void wpas_wps_update_config(struct wpa_supplicant *wpa_s);
Dmitry Shmidtf8623282013-02-20 14:34:59 -080065struct wpabuf * wpas_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1e78e762013-04-02 11:05:36 -070066 int ndef, const char *id_str);
Dmitry Shmidt04949592012-07-19 12:16:46 -070067struct wpabuf * wpas_wps_nfc_token(struct wpa_supplicant *wpa_s, int ndef);
Dmitry Shmidtcf32e602014-01-28 10:57:39 -080068int wpas_wps_start_nfc(struct wpa_supplicant *wpa_s, const u8 *dev_addr,
69 const u8 *bssid,
70 const struct wpabuf *dev_pw, u16 dev_pw_id,
71 int p2p_group, const u8 *peer_pubkey_hash,
72 const u8 *ssid, size_t ssid_len, int freq);
Dmitry Shmidt04949592012-07-19 12:16:46 -070073int wpas_wps_nfc_tag_read(struct wpa_supplicant *wpa_s,
Dmitry Shmidtcf32e602014-01-28 10:57:39 -080074 const struct wpabuf *data, int forced_freq);
75struct wpabuf * wpas_wps_nfc_handover_req(struct wpa_supplicant *wpa_s,
76 int ndef);
Dmitry Shmidtf8623282013-02-20 14:34:59 -080077struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
Dmitry Shmidt33e38bf2013-02-27 12:56:00 -080078 int ndef, int cr, const char *uuid);
Dmitry Shmidtf8623282013-02-20 14:34:59 -080079int wpas_wps_nfc_report_handover(struct wpa_supplicant *wpa_s,
80 const struct wpabuf *req,
81 const struct wpabuf *sel);
Dmitry Shmidtcf32e602014-01-28 10:57:39 -080082int wpas_er_wps_nfc_report_handover(struct wpa_supplicant *wpa_s,
83 const struct wpabuf *req,
84 const struct wpabuf *sel);
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070085void wpas_wps_update_ap_info(struct wpa_supplicant *wpa_s,
86 struct wpa_scan_results *scan_res);
87void wpas_wps_notify_assoc(struct wpa_supplicant *wpa_s, const u8 *bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070088
89#else /* CONFIG_WPS */
90
91static inline int wpas_wps_init(struct wpa_supplicant *wpa_s)
92{
93 return 0;
94}
95
96static inline void wpas_wps_deinit(struct wpa_supplicant *wpa_s)
97{
98}
99
100static inline int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s)
101{
102 return 0;
103}
104
105static inline u8 wpas_wps_get_req_type(struct wpa_ssid *ssid)
106{
107 return 0;
108}
109
110static inline int wpas_wps_ssid_bss_match(struct wpa_supplicant *wpa_s,
111 struct wpa_ssid *ssid,
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800112 struct wpa_bss *bss)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700113{
114 return -1;
115}
116
117static inline int wpas_wps_ssid_wildcard_ok(struct wpa_supplicant *wpa_s,
118 struct wpa_ssid *ssid,
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800119 struct wpa_bss *bss)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700120{
121 return 0;
122}
123
124static inline int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
125 struct wpa_bss *selected,
126 struct wpa_ssid *ssid)
127{
128 return 0;
129}
130
131static inline void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s)
132{
133}
134
135static inline int wpas_wps_searching(struct wpa_supplicant *wpa_s)
136{
137 return 0;
138}
139
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700140static inline void wpas_wps_update_ap_info(struct wpa_supplicant *wpa_s,
141 struct wpa_scan_results *scan_res)
142{
143}
144
145static inline void wpas_wps_notify_assoc(struct wpa_supplicant *wpa_s,
146 const u8 *bssid)
147{
148}
149
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700150#endif /* CONFIG_WPS */
151
152#endif /* WPS_SUPPLICANT_H */