Wi-Fi Protected Setup. More...
#include "wps_defs.h"
Go to the source code of this file.
Data Structures | |
struct | wps_credential |
WPS Credential. More... | |
struct | wps_device_data |
WPS Device Data. More... | |
struct | oob_conf_data |
struct | wps_config |
WPS configuration for a single registration protocol run. More... | |
struct | wps_registrar_config |
WPS Registrar configuration. More... | |
union | wps_event_data |
struct | wps_event_data::wps_event_m2d |
M2D event data. More... | |
struct | wps_event_data::wps_event_fail |
Registration failure information. More... | |
struct | wps_event_data::wps_event_pwd_auth_fail |
struct | wps_event_data::wps_event_er_ap |
struct | wps_event_data::wps_event_er_enrollee |
struct | upnp_pending_message |
Pending PutWLANResponse messages. More... | |
struct | wps_context |
Long term WPS context data. More... | |
struct | oob_device_data |
struct | oob_nfc_device_data |
Enumerations | |
enum | wsc_op_code { WSC_UPnP = 0, WSC_Start = 0x01, WSC_ACK = 0x02, WSC_NACK = 0x03, WSC_MSG = 0x04, WSC_Done = 0x05, WSC_FRAG_ACK = 0x06 } |
enum | wps_process_res { WPS_DONE, WPS_CONTINUE, WPS_FAILURE, WPS_PENDING } |
enum | wps_event { WPS_EV_M2D, WPS_EV_FAIL, WPS_EV_SUCCESS, WPS_EV_PWD_AUTH_FAIL, WPS_EV_PBC_OVERLAP, WPS_EV_PBC_TIMEOUT, WPS_EV_ER_AP_ADD, WPS_EV_ER_AP_REMOVE, WPS_EV_ER_ENROLLEE_ADD, WPS_EV_ER_ENROLLEE_REMOVE } |
Functions | |
struct wps_data * | wps_init (const struct wps_config *cfg) |
Initialize WPS Registration protocol data. | |
void | wps_deinit (struct wps_data *data) |
Deinitialize WPS Registration protocol data. | |
enum wps_process_res | wps_process_msg (struct wps_data *wps, enum wsc_op_code op_code, const struct wpabuf *msg) |
Process a WPS message. | |
struct wpabuf * | wps_get_msg (struct wps_data *wps, enum wsc_op_code *op_code) |
Build a WPS message. | |
int | wps_is_selected_pbc_registrar (const struct wpabuf *msg) |
Check whether WPS IE indicates active PBC. | |
int | wps_is_selected_pin_registrar (const struct wpabuf *msg) |
Check whether WPS IE indicates active PIN. | |
const u8 * | wps_get_uuid_e (const struct wpabuf *msg) |
Get UUID-E from WPS IE. | |
struct wpabuf * | wps_build_assoc_req_ie (enum wps_request_type req_type) |
Build WPS IE for (Re)Association Request. | |
struct wpabuf * | wps_build_probe_req_ie (int pbc, struct wps_device_data *dev, const u8 *uuid, enum wps_request_type req_type) |
Build WPS IE for Probe Request. | |
struct wps_registrar * | wps_registrar_init (struct wps_context *wps, const struct wps_registrar_config *cfg) |
Initialize WPS Registrar data. | |
void | wps_registrar_deinit (struct wps_registrar *reg) |
Deinitialize WPS Registrar data. | |
int | wps_registrar_add_pin (struct wps_registrar *reg, const u8 *uuid, const u8 *pin, size_t pin_len, int timeout) |
Configure a new PIN for Registrar. | |
int | wps_registrar_invalidate_pin (struct wps_registrar *reg, const u8 *uuid) |
Invalidate a PIN for a specific UUID-E. | |
int | wps_registrar_unlock_pin (struct wps_registrar *reg, const u8 *uuid) |
Unlock a PIN for a specific UUID-E. | |
int | wps_registrar_button_pushed (struct wps_registrar *reg) |
Notify Registrar that AP button was pushed. | |
void | wps_registrar_probe_req_rx (struct wps_registrar *reg, const u8 *addr, const struct wpabuf *wps_data) |
Notify Registrar of Probe Request. | |
int | wps_registrar_update_ie (struct wps_registrar *reg) |
int | wps_registrar_set_selected_registrar (struct wps_registrar *reg, const struct wpabuf *msg) |
Notification of SetSelectedRegistrar. | |
int | wps_registrar_get_info (struct wps_registrar *reg, const u8 *addr, char *buf, size_t buflen) |
unsigned int | wps_pin_checksum (unsigned int pin) |
Compute PIN checksum. | |
unsigned int | wps_pin_valid (unsigned int pin) |
Check whether a PIN has a valid checksum. | |
unsigned int | wps_generate_pin (void) |
Generate a random PIN. | |
void | wps_free_pending_msgs (struct upnp_pending_message *msgs) |
struct oob_device_data * | wps_get_oob_device (char *device_type) |
struct oob_nfc_device_data * | wps_get_oob_nfc_device (char *device_name) |
int | wps_get_oob_method (char *method) |
int | wps_process_oob (struct wps_context *wps, struct oob_device_data *oob_dev, int registrar) |
int | wps_attr_text (struct wpabuf *data, char *buf, char *end) |
struct wps_er * | wps_er_init (struct wps_context *wps, const char *ifname) |
void | wps_er_refresh (struct wps_er *er) |
void | wps_er_deinit (struct wps_er *er) |
void | wps_er_set_sel_reg (struct wps_er *er, int sel_reg, u16 dev_passwd_id, u16 sel_reg_config_methods) |
int | wps_er_pbc (struct wps_er *er, const u8 *uuid) |
int | wps_er_learn (struct wps_er *er, const u8 *uuid, const u8 *pin, size_t pin_len) |
Wi-Fi Protected Setup.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
Alternatively, this software may be distributed under the terms of BSD license.
See README and COPYING for more details.
Definition in file wps.h.
enum wps_event |
enum wps_event - WPS event types
enum wps_process_res |
enum wsc_op_code |
struct wpabuf* wps_build_assoc_req_ie | ( | enum wps_request_type | req_type | ) | [read] |
struct wpabuf* wps_build_probe_req_ie | ( | int | pbc, | |
struct wps_device_data * | dev, | |||
const u8 * | uuid, | |||
enum wps_request_type | req_type | |||
) | [read] |
Build WPS IE for Probe Request.
pbc | Whether searching for PBC mode APs | |
dev | Device attributes | |
uuid | Own UUID | |
req_type | Value for Request Type attribute |
The caller is responsible for freeing the buffer.
Definition at line 309 of file wps.c.
void wps_deinit | ( | struct wps_data * | data | ) |
Deinitialize WPS Registration protocol data.
data | WPS Registration protocol data from wps_init() |
Definition at line 118 of file wps.c.
unsigned int wps_generate_pin | ( | void | ) |
Generate a random PIN.
Definition at line 242 of file wps_common.c.
struct wpabuf* wps_get_msg | ( | struct wps_data * | wps, | |
enum wsc_op_code * | op_code | |||
) | [read] |
Build a WPS message.
wps | WPS Registration protocol data from wps_init() | |
op_code | Buffer for returning message OP Code |
This function is used to build a response to a message processed by calling wps_process_msg(). The caller is responsible for freeing the buffer.
const u8* wps_get_uuid_e | ( | const struct wpabuf * | msg | ) |
struct wps_data* wps_init | ( | const struct wps_config * | cfg | ) | [read] |
Initialize WPS Registration protocol data.
cfg | WPS configuration |
This function is used to initialize WPS data for a registration protocol instance (i.e., each run of registration protocol as a Registrar of Enrollee. The caller is responsible for freeing this data after the registration run has been completed by calling wps_deinit().
Definition at line 36 of file wps.c.
int wps_is_selected_pbc_registrar | ( | const struct wpabuf * | msg | ) |
int wps_is_selected_pin_registrar | ( | const struct wpabuf * | msg | ) |
unsigned int wps_pin_checksum | ( | unsigned int | pin | ) |
Compute PIN checksum.
pin | Seven digit PIN (i.e., eight digit PIN without the checksum digit) |
Definition at line 211 of file wps_common.c.
unsigned int wps_pin_valid | ( | unsigned int | pin | ) |
Check whether a PIN has a valid checksum.
pin | Eight digit PIN (i.e., including the checksum digit) |
Definition at line 231 of file wps_common.c.
enum wps_process_res wps_process_msg | ( | struct wps_data * | wps, | |
enum wsc_op_code | op_code, | |||
const struct wpabuf * | msg | |||
) |
Process a WPS message.
wps | WPS Registration protocol data from wps_init() | |
op_code | Message OP Code | |
msg | Message data |
This function is used to process WPS messages with OP Codes WSC_ACK, WSC_NACK, WSC_MSG, and WSC_Done. The caller (e.g., EAP server/peer) is responsible for reassembling the messages before calling this function. Response to this message is built by calling wps_get_msg().
int wps_registrar_add_pin | ( | struct wps_registrar * | reg, | |
const u8 * | uuid, | |||
const u8 * | pin, | |||
size_t | pin_len, | |||
int | timeout | |||
) |
Configure a new PIN for Registrar.
reg | Registrar data from wps_registrar_init() | |
uuid | UUID-E or NULL for wildcard (any UUID) | |
pin | PIN (Device Password) | |
pin_len | Length of pin in octets | |
timeout | Time (in seconds) when the PIN will be invalidated; 0 = no timeout |
Definition at line 511 of file wps_registrar.c.
int wps_registrar_button_pushed | ( | struct wps_registrar * | reg | ) |
Notify Registrar that AP button was pushed.
reg | Registrar data from wps_registrar_init() |
This function is called on an AP when a push button is pushed to activate PBC mode. The PBC mode will be stopped after walk time (2 minutes) timeout or when a PBC registration is completed.
Definition at line 728 of file wps_registrar.c.
void wps_registrar_deinit | ( | struct wps_registrar * | reg | ) |
Deinitialize WPS Registrar data.
reg | Registrar data from wps_registrar_init() |
Definition at line 487 of file wps_registrar.c.
struct wps_registrar* wps_registrar_init | ( | struct wps_context * | wps, | |
const struct wps_registrar_config * | cfg | |||
) | [read] |
Initialize WPS Registrar data.
wps | Pointer to longterm WPS context | |
cfg | Registrar configuration |
This function is used to initialize WPS Registrar functionality. It can be used for a single Registrar run (e.g., when run in a supplicant) or multiple runs (e.g., when run as an internal Registrar in an AP). Caller is responsible for freeing the returned data with wps_registrar_deinit() when Registrar functionality is not needed anymore.
Definition at line 445 of file wps_registrar.c.
int wps_registrar_invalidate_pin | ( | struct wps_registrar * | reg, | |
const u8 * | uuid | |||
) |
Invalidate a PIN for a specific UUID-E.
reg | Registrar data from wps_registrar_init() | |
uuid | UUID-E |
Definition at line 592 of file wps_registrar.c.
void wps_registrar_probe_req_rx | ( | struct wps_registrar * | reg, | |
const u8 * | addr, | |||
const struct wpabuf * | wps_data | |||
) |
Notify Registrar of Probe Request.
reg | Registrar data from wps_registrar_init() | |
addr | MAC address of the Probe Request sender | |
wps_data | WPS IE contents |
This function is called on an AP when a Probe Request with WPS IE is received. This is used to track PBC mode use and to detect possible overlap situation with other WPS APs.
Definition at line 778 of file wps_registrar.c.
int wps_registrar_set_selected_registrar | ( | struct wps_registrar * | reg, | |
const struct wpabuf * | msg | |||
) |
Notification of SetSelectedRegistrar.
reg | Registrar data from wps_registrar_init() | |
msg | Received message from SetSelectedRegistrar |
This function is called when an AP receives a SetSelectedRegistrar UPnP message.
Definition at line 2765 of file wps_registrar.c.
int wps_registrar_unlock_pin | ( | struct wps_registrar * | reg, | |
const u8 * | uuid | |||
) |
Unlock a PIN for a specific UUID-E.
reg | Registrar data from wps_registrar_init() | |
uuid | UUID-E |
PINs are locked to enforce only one concurrent use. This function unlocks a PIN to allow it to be used again. If the specified PIN was configured using a wildcard UUID, it will be removed instead of allowing multiple uses.
Definition at line 677 of file wps_registrar.c.