P2P: Set Device Password ID in WPS M1/M2 per new rules
[libeap.git] / wpa_supplicant / wps_supplicant.h
1 /*
2  * wpa_supplicant / WPS integration
3  * Copyright (c) 2008-2009, Jouni Malinen <j@w1.fi>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  * Alternatively, this software may be distributed under the terms of BSD
10  * license.
11  *
12  * See README and COPYING for more details.
13  */
14
15 #ifndef WPS_SUPPLICANT_H
16 #define WPS_SUPPLICANT_H
17
18 struct wpa_scan_res;
19
20 #ifdef CONFIG_WPS
21
22 #include "wps/wps.h"
23 #include "wps/wps_defs.h"
24
25 struct wpa_bss;
26
27 struct wps_new_ap_settings {
28         const char *ssid_hex;
29         const char *auth;
30         const char *encr;
31         const char *key_hex;
32 };
33
34 int wpas_wps_init(struct wpa_supplicant *wpa_s);
35 void wpas_wps_deinit(struct wpa_supplicant *wpa_s);
36 int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s);
37 enum wps_request_type wpas_wps_get_req_type(struct wpa_ssid *ssid);
38 int wpas_wps_start_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid,
39                        int p2p_group);
40 int wpas_wps_start_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
41                        const char *pin, int p2p_group, u16 dev_pw_id);
42 int wpas_wps_start_oob(struct wpa_supplicant *wpa_s, char *device_type,
43                        char *path, char *method, char *name);
44 int wpas_wps_start_reg(struct wpa_supplicant *wpa_s, const u8 *bssid,
45                        const char *pin, struct wps_new_ap_settings *settings);
46 int wpas_wps_ssid_bss_match(struct wpa_supplicant *wpa_s,
47                             struct wpa_ssid *ssid, struct wpa_scan_res *bss);
48 int wpas_wps_ssid_wildcard_ok(struct wpa_supplicant *wpa_s,
49                               struct wpa_ssid *ssid, struct wpa_scan_res *bss);
50 int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
51                               struct wpa_bss *selected, struct wpa_ssid *ssid);
52 void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s);
53 int wpas_wps_searching(struct wpa_supplicant *wpa_s);
54 int wpas_wps_scan_result_text(const u8 *ies, size_t ies_len, char *pos,
55                               char *end);
56 int wpas_wps_er_start(struct wpa_supplicant *wpa_s, const char *filter);
57 int wpas_wps_er_stop(struct wpa_supplicant *wpa_s);
58 int wpas_wps_er_add_pin(struct wpa_supplicant *wpa_s, const u8 *addr,
59                         const char *uuid, const char *pin);
60 int wpas_wps_er_pbc(struct wpa_supplicant *wpa_s, const char *uuid);
61 int wpas_wps_er_learn(struct wpa_supplicant *wpa_s, const char *uuid,
62                       const char *pin);
63 int wpas_wps_er_config(struct wpa_supplicant *wpa_s, const char *uuid,
64                        const char *pin, struct wps_new_ap_settings *settings);
65 int wpas_wps_terminate_pending(struct wpa_supplicant *wpa_s);
66 int wpas_wps_in_progress(struct wpa_supplicant *wpa_s);
67 void wpas_wps_update_config(struct wpa_supplicant *wpa_s);
68
69 #else /* CONFIG_WPS */
70
71 static inline int wpas_wps_init(struct wpa_supplicant *wpa_s)
72 {
73         return 0;
74 }
75
76 static inline void wpas_wps_deinit(struct wpa_supplicant *wpa_s)
77 {
78 }
79
80 static inline int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s)
81 {
82         return 0;
83 }
84
85 static inline u8 wpas_wps_get_req_type(struct wpa_ssid *ssid)
86 {
87         return 0;
88 }
89
90 static inline int wpas_wps_ssid_bss_match(struct wpa_supplicant *wpa_s,
91                                           struct wpa_ssid *ssid,
92                                           struct wpa_scan_res *bss)
93 {
94         return -1;
95 }
96
97 static inline int wpas_wps_ssid_wildcard_ok(struct wpa_supplicant *wpa_s,
98                                             struct wpa_ssid *ssid,
99                                             struct wpa_scan_res *bss)
100 {
101         return 0;
102 }
103
104 static inline int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
105                                             struct wpa_bss *selected,
106                                             struct wpa_ssid *ssid)
107 {
108         return 0;
109 }
110
111 static inline void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s)
112 {
113 }
114
115 static inline int wpas_wps_searching(struct wpa_supplicant *wpa_s)
116 {
117         return 0;
118 }
119
120 #endif /* CONFIG_WPS */
121
122 #endif /* WPS_SUPPLICANT_H */