wps.h File Reference

Wi-Fi Protected Setup. More...

#include "wps_defs.h"
Include dependency graph for wps.h:
This graph shows which files directly or indirectly include this file:

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_datawps_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 wpabufwps_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 wpabufwps_build_assoc_req_ie (enum wps_request_type req_type)
 Build WPS IE for (Re)Association Request.
struct wpabufwps_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_registrarwps_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_datawps_get_oob_device (char *device_type)
struct oob_nfc_device_datawps_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_erwps_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)

Detailed Description

Wi-Fi Protected Setup.

Copyright
Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi>

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.


Enumeration Type Documentation

enum wps_event

enum wps_event - WPS event types

Enumerator:
WPS_EV_M2D 

M2D received (Registrar did not know us).

WPS_EV_FAIL 

Registration failed.

WPS_EV_SUCCESS 

Registration succeeded.

WPS_EV_PWD_AUTH_FAIL 

Password authentication failed.

WPS_EV_PBC_OVERLAP 

PBC session overlap detected.

WPS_EV_PBC_TIMEOUT 

PBC walktime expired before protocol run start.

WPS_EV_ER_AP_ADD 

ER: AP added.

WPS_EV_ER_AP_REMOVE 

ER: AP removed.

WPS_EV_ER_ENROLLEE_ADD 

ER: Enrollee added.

WPS_EV_ER_ENROLLEE_REMOVE 

ER: Enrollee removed.

Definition at line 347 of file wps.h.

enum wps_process_res - WPS message processing result

Enumerator:
WPS_DONE 

Processing done.

WPS_CONTINUE 

Processing continues.

WPS_FAILURE 

Processing failed.

WPS_PENDING 

Processing continues, but waiting for an external.

event (e.g., UPnP message from an external Registrar)

Definition at line 170 of file wps.h.

enum wsc_op_code - EAP-WSC OP-Code values

Definition at line 24 of file wps.h.


Function Documentation

struct wpabuf* wps_build_assoc_req_ie ( enum wps_request_type  req_type  )  [read]

Build WPS IE for (Re)Association Request.

Parameters:
req_type Value for Request Type attribute
Returns:
WPS IE or NULL on failure

The caller is responsible for freeing the buffer.

Definition at line 271 of file wps.c.

Here is the call graph for this function:

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.

Parameters:
pbc Whether searching for PBC mode APs
dev Device attributes
uuid Own UUID
req_type Value for Request Type attribute
Returns:
WPS IE or NULL on failure

The caller is responsible for freeing the buffer.

Definition at line 309 of file wps.c.

Here is the call graph for this function:

void wps_deinit ( struct wps_data data  ) 

Deinitialize WPS Registration protocol data.

Parameters:
data WPS Registration protocol data from wps_init()

Definition at line 118 of file wps.c.

Here is the call graph for this function:

unsigned int wps_generate_pin ( void   ) 

Generate a random PIN.

Returns:
Eight digit PIN (i.e., including the checksum digit)

Definition at line 242 of file wps_common.c.

Here is the call graph for this function:

struct wpabuf* wps_get_msg ( struct wps_data wps,
enum wsc_op_code op_code 
) [read]

Build a WPS message.

Parameters:
wps WPS Registration protocol data from wps_init()
op_code Buffer for returning message OP Code
Returns:
The generated WPS message or NULL on failure

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.

Definition at line 176 of file wps.c.

const u8* wps_get_uuid_e ( const struct wpabuf msg  ) 

Get UUID-E from WPS IE.

Parameters:
msg WPS IE contents from Beacon or Probe Response frame
Returns:
Pointer to UUID-E or NULL if not included

The returned pointer is to the msg contents and it remains valid only as long as the msg buffer is valid.

Definition at line 253 of file wps.c.

struct wps_data* wps_init ( const struct wps_config cfg  )  [read]

Initialize WPS Registration protocol data.

Parameters:
cfg WPS configuration
Returns:
Pointer to allocated data or NULL on failure

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.

Here is the call graph for this function:

int wps_is_selected_pbc_registrar ( const struct wpabuf msg  ) 

Check whether WPS IE indicates active PBC.

Parameters:
msg WPS IE contents from Beacon or Probe Response frame
Returns:
1 if PBC Registrar is active, 0 if not

Definition at line 191 of file wps.c.

int wps_is_selected_pin_registrar ( const struct wpabuf msg  ) 

Check whether WPS IE indicates active PIN.

Parameters:
msg WPS IE contents from Beacon or Probe Response frame
Returns:
1 if PIN Registrar is active, 0 if not

Definition at line 218 of file wps.c.

unsigned int wps_pin_checksum ( unsigned int  pin  ) 

Compute PIN checksum.

Parameters:
pin Seven digit PIN (i.e., eight digit PIN without the checksum digit)
Returns:
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.

Parameters:
pin Eight digit PIN (i.e., including the checksum digit)
Returns:
1 if checksum digit is valid, or 0 if not

Definition at line 231 of file wps_common.c.

Here is the call graph for this function:

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.

Parameters:
wps WPS Registration protocol data from wps_init()
op_code Message OP Code
msg Message data
Returns:
Processing result

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().

Definition at line 155 of file wps.c.

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.

Parameters:
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
Returns:
0 on success, -1 on failure

Definition at line 511 of file wps_registrar.c.

Here is the call graph for this function:

int wps_registrar_button_pushed ( struct wps_registrar reg  ) 

Notify Registrar that AP button was pushed.

Parameters:
reg Registrar data from wps_registrar_init()
Returns:
0 on success, -1 on failure

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.

Here is the call graph for this function:

void wps_registrar_deinit ( struct wps_registrar reg  ) 

Deinitialize WPS Registrar data.

Parameters:
reg Registrar data from wps_registrar_init()

Definition at line 487 of file wps_registrar.c.

Here is the call graph for this function:

struct wps_registrar* wps_registrar_init ( struct wps_context wps,
const struct wps_registrar_config cfg 
) [read]

Initialize WPS Registrar data.

Parameters:
wps Pointer to longterm WPS context
cfg Registrar configuration
Returns:
Pointer to allocated Registrar data or NULL on failure

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.

Here is the call graph for this function:

int wps_registrar_invalidate_pin ( struct wps_registrar reg,
const u8 *  uuid 
)

Invalidate a PIN for a specific UUID-E.

Parameters:
reg Registrar data from wps_registrar_init()
uuid UUID-E
Returns:
0 on success, -1 on failure (e.g., PIN not found)

Definition at line 592 of file wps_registrar.c.

Here is the call graph for this function:

void wps_registrar_probe_req_rx ( struct wps_registrar reg,
const u8 *  addr,
const struct wpabuf wps_data 
)

Notify Registrar of Probe Request.

Parameters:
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.

Here is the call graph for this function:

int wps_registrar_set_selected_registrar ( struct wps_registrar reg,
const struct wpabuf msg 
)

Notification of SetSelectedRegistrar.

Parameters:
reg Registrar data from wps_registrar_init()
msg Received message from SetSelectedRegistrar
Returns:
0 on success, -1 on failure

This function is called when an AP receives a SetSelectedRegistrar UPnP message.

Definition at line 2765 of file wps_registrar.c.

Here is the call graph for this function:

int wps_registrar_unlock_pin ( struct wps_registrar reg,
const u8 *  uuid 
)

Unlock a PIN for a specific UUID-E.

Parameters:
reg Registrar data from wps_registrar_init()
uuid UUID-E
Returns:
0 on success, -1 on failure

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.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Sat Nov 21 23:24:19 2009 for hostapd by  doxygen 1.6.1