wps.h File Reference

#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.

Classes

struct  oob_conf_data
struct  oob_device_data
struct  oob_nfc_device_data
struct  upnp_pending_message
struct  wps_config
struct  wps_context
struct  wps_credential
struct  wps_device_data
union  wps_event_data
struct  wps_event_data::wps_event_er_ap
struct  wps_event_data::wps_event_er_enrollee
struct  wps_event_data::wps_event_fail
struct  wps_event_data::wps_event_m2d
struct  wps_event_data::wps_event_pwd_auth_fail
struct  wps_registrar_config

Defines

#define WPS_DEV_TYPE_BUFSIZE   21
#define WPS_DEV_TYPE_LEN   8

Enumerations

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
}
enum  wps_process_res { WPS_DONE, WPS_CONTINUE, WPS_FAILURE, WPS_PENDING }
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
}

Functions

void uuid_gen_mac_addr (const u8 *mac_addr, u8 *uuid)
int wps_attr_text (struct wpabuf *data, char *buf, char *end)
struct wpabufwps_build_assoc_req_ie (enum wps_request_type req_type)
struct wpabufwps_build_probe_req_ie (int pbc, struct wps_device_data *dev, const u8 *uuid, enum wps_request_type req_type)
u16 wps_config_methods_str2bin (const char *str)
void wps_deinit (struct wps_data *data)
char * wps_dev_type_bin2str (const u8 dev_type[WPS_DEV_TYPE_LEN], char *buf, size_t buf_len)
int wps_dev_type_str2bin (const char *str, u8 dev_type[WPS_DEV_TYPE_LEN])
void wps_er_deinit (struct wps_er *er, void(*cb)(void *ctx), void *ctx)
struct wps_erwps_er_init (struct wps_context *wps, const char *ifname)
int wps_er_learn (struct wps_er *er, const u8 *uuid, const u8 *pin, size_t pin_len)
int wps_er_pbc (struct wps_er *er, const u8 *uuid)
void wps_er_refresh (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)
void wps_free_pending_msgs (struct upnp_pending_message *msgs)
unsigned int wps_generate_pin (void)
struct wpabufwps_get_msg (struct wps_data *wps, enum wsc_op_code *op_code)
struct oob_device_datawps_get_oob_device (char *device_type)
int wps_get_oob_method (char *method)
struct oob_nfc_device_datawps_get_oob_nfc_device (char *device_name)
const u8wps_get_uuid_e (const struct wpabuf *msg)
struct wps_datawps_init (const struct wps_config *cfg)
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)
unsigned int wps_pin_valid (unsigned int pin)
enum wps_process_res wps_process_msg (struct wps_data *wps, enum wsc_op_code op_code, const struct wpabuf *msg)
int wps_process_oob (struct wps_context *wps, struct oob_device_data *oob_dev, int registrar)
int wps_registrar_add_pin (struct wps_registrar *reg, const u8 *uuid, const u8 *pin, size_t pin_len, int timeout)
int wps_registrar_button_pushed (struct wps_registrar *reg)
void wps_registrar_deinit (struct wps_registrar *reg)
int wps_registrar_get_info (struct wps_registrar *reg, const u8 *addr, char *buf, size_t buflen)
struct wps_registrarwps_registrar_init (struct wps_context *wps, const struct wps_registrar_config *cfg)
int wps_registrar_invalidate_pin (struct wps_registrar *reg, const u8 *uuid)
void wps_registrar_probe_req_rx (struct wps_registrar *reg, const u8 *addr, const struct wpabuf *wps_data)
int wps_registrar_unlock_pin (struct wps_registrar *reg, const u8 *uuid)
int wps_registrar_update_ie (struct wps_registrar *reg)

Define Documentation

#define WPS_DEV_TYPE_BUFSIZE   21

Definition at line 65 of file wps.h.

#define WPS_DEV_TYPE_LEN   8

Definition at line 64 of file wps.h.


Enumeration Type Documentation

enum wps_event

enum wps_event - WPS event types

Enumerator:
WPS_EV_M2D 

WPS_EV_M2D - M2D received (Registrar did not know us)

WPS_EV_FAIL 

WPS_EV_FAIL - Registration failed

WPS_EV_SUCCESS 

WPS_EV_SUCCESS - Registration succeeded

WPS_EV_PWD_AUTH_FAIL 

WPS_EV_PWD_AUTH_FAIL - Password authentication failed

WPS_EV_PBC_OVERLAP 

WPS_EV_PBC_OVERLAP - PBC session overlap detected

WPS_EV_PBC_TIMEOUT 

WPS_EV_PBC_TIMEOUT - PBC walktime expired before protocol run start

WPS_EV_ER_AP_ADD 

WPS_EV_ER_AP_ADD - ER: AP added

WPS_EV_ER_AP_REMOVE 

WPS_EV_ER_AP_REMOVE - ER: AP removed

WPS_EV_ER_ENROLLEE_ADD 

WPS_EV_ER_ENROLLEE_ADD - ER: Enrollee added

WPS_EV_ER_ENROLLEE_REMOVE 

WPS_EV_ER_ENROLLEE_REMOVE - ER: Enrollee removed

Definition at line 348 of file wps.h.

enum wps_process_res - WPS message processing result

Enumerator:
WPS_DONE 

WPS_DONE - Processing done

WPS_CONTINUE 

WPS_CONTINUE - Processing continues

WPS_FAILURE 

WPS_FAILURE - Processing failed

WPS_PENDING 

WPS_PENDING - Processing continues, but waiting for an external event (e.g., UPnP message from an external Registrar)

Definition at line 168 of file wps.h.

enum wsc_op_code - EAP-WSC OP-Code values

Enumerator:
WSC_UPnP 
WSC_Start 
WSC_ACK 
WSC_NACK 
WSC_MSG 
WSC_Done 
WSC_FRAG_ACK 

Definition at line 23 of file wps.h.


Function Documentation

void uuid_gen_mac_addr ( const u8 mac_addr,
u8 uuid 
)

Definition at line 572 of file wps_common.c.

int wps_attr_text ( struct wpabuf data,
char *  buf,
char *  end 
)

Definition at line 365 of file wps.c.

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

wps_build_assoc_req_ie - Build WPS IE for (Re)Association Request : Value for Request Type attribute Returns: WPS IE or NULL on failure

The caller is responsible for freeing the buffer.

Definition at line 264 of file wps.c.

struct wpabuf* wps_build_probe_req_ie ( int  pbc,
struct wps_device_data dev,
const u8 uuid,
enum wps_request_type  req_type 
) [read]

wps_build_probe_req_ie - Build WPS IE for Probe Request : Whether searching for PBC mode APs : Device attributes : Own UUID : Value for Request Type attribute Returns: WPS IE or NULL on failure

The caller is responsible for freeing the buffer.

Definition at line 301 of file wps.c.

u16 wps_config_methods_str2bin ( const char *  str  ) 

Definition at line 600 of file wps_common.c.

void wps_deinit ( struct wps_data data  ) 

wps_deinit - Deinitialize WPS Registration protocol data : WPS Registration protocol data from wps_init()

Definition at line 117 of file wps.c.

char* wps_dev_type_bin2str ( const u8  dev_type[WPS_DEV_TYPE_LEN],
char *  buf,
size_t  buf_len 
)

Definition at line 557 of file wps_common.c.

int wps_dev_type_str2bin ( const char *  str,
u8  dev_type[WPS_DEV_TYPE_LEN] 
)

Definition at line 534 of file wps_common.c.

void wps_er_deinit ( struct wps_er er,
void(*)(void *ctx)  cb,
void *  ctx 
)

Definition at line 1225 of file wps_er.c.

struct wps_er* wps_er_init ( struct wps_context wps,
const char *  ifname 
) [read]

Definition at line 1142 of file wps_er.c.

int wps_er_learn ( struct wps_er er,
const u8 uuid,
const u8 pin,
size_t  pin_len 
)

Definition at line 1622 of file wps_er.c.

int wps_er_pbc ( struct wps_er er,
const u8 uuid 
)

Definition at line 1353 of file wps_er.c.

void wps_er_refresh ( struct wps_er er  ) 

Definition at line 1192 of file wps_er.c.

void wps_er_set_sel_reg ( struct wps_er er,
int  sel_reg,
u16  dev_passwd_id,
u16  sel_reg_config_methods 
)

Definition at line 1328 of file wps_er.c.

void wps_free_pending_msgs ( struct upnp_pending_message msgs  ) 

Definition at line 352 of file wps.c.

unsigned int wps_generate_pin ( void   ) 

wps_generate_pin - Generate a random PIN Returns: Eight digit PIN (i.e., including the checksum digit)

Definition at line 239 of file wps_common.c.

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

wps_get_msg - Build a WPS message : WPS Registration protocol data from wps_init() : 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 173 of file wps.c.

struct oob_device_data* wps_get_oob_device ( char *  device_type  )  [read]
int wps_get_oob_method ( char *  method  ) 
struct oob_nfc_device_data* wps_get_oob_nfc_device ( char *  device_name  )  [read]
const u8* wps_get_uuid_e ( const struct wpabuf msg  ) 

wps_get_uuid_e - Get UUID-E from WPS IE : 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 247 of file wps.c.

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

wps_init - Initialize WPS Registration protocol data : 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 34 of file wps.c.

int wps_is_selected_pbc_registrar ( const struct wpabuf msg  ) 

wps_is_selected_pbc_registrar - Check whether WPS IE indicates active PBC : WPS IE contents from Beacon or Probe Response frame Returns: 1 if PBC Registrar is active, 0 if not

Definition at line 187 of file wps.c.

int wps_is_selected_pin_registrar ( const struct wpabuf msg  ) 

wps_is_selected_pin_registrar - Check whether WPS IE indicates active PIN : WPS IE contents from Beacon or Probe Response frame Returns: 1 if PIN Registrar is active, 0 if not

Definition at line 213 of file wps.c.

unsigned int wps_pin_checksum ( unsigned int  pin  ) 

wps_pin_checksum - Compute PIN checksum : Seven digit PIN (i.e., eight digit PIN without the checksum digit) Returns: Checksum digit

Definition at line 210 of file wps_common.c.

unsigned int wps_pin_valid ( unsigned int  pin  ) 

wps_pin_valid - Check whether a PIN has a valid checksum : Eight digit PIN (i.e., including the checksum digit) Returns: 1 if checksum digit is valid, or 0 if not

Definition at line 229 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 
)

wps_process_msg - Process a WPS message : WPS Registration protocol data from wps_init() : Message OP Code : 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 153 of file wps.c.

int wps_process_oob ( struct wps_context wps,
struct oob_device_data oob_dev,
int  registrar 
)
int wps_registrar_add_pin ( struct wps_registrar reg,
const u8 uuid,
const u8 pin,
size_t  pin_len,
int  timeout 
)

wps_registrar_add_pin - Configure a new PIN for Registrar : Registrar data from wps_registrar_init() : UUID-E or NULL for wildcard (any UUID) : PIN (Device Password) : Length of pin in octets : Time (in seconds) when the PIN will be invalidated; 0 = no timeout Returns: 0 on success, -1 on failure

Definition at line 519 of file wps_registrar.c.

int wps_registrar_button_pushed ( struct wps_registrar reg  ) 

wps_registrar_button_pushed - Notify Registrar that AP button was pushed : 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 710 of file wps_registrar.c.

void wps_registrar_deinit ( struct wps_registrar reg  ) 

wps_registrar_deinit - Deinitialize WPS Registrar data : Registrar data from wps_registrar_init()

Definition at line 496 of file wps_registrar.c.

int wps_registrar_get_info ( struct wps_registrar reg,
const u8 addr,
char *  buf,
size_t  buflen 
)

Definition at line 2858 of file wps_registrar.c.

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

wps_registrar_init - Initialize WPS Registrar data : Pointer to longterm WPS context : 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 453 of file wps_registrar.c.

int wps_registrar_invalidate_pin ( struct wps_registrar reg,
const u8 uuid 
)

wps_registrar_invalidate_pin - Invalidate a PIN for a specific UUID-E : Registrar data from wps_registrar_init() : UUID-E Returns: 0 on success, -1 on failure (e.g., PIN not found)

Definition at line 587 of file wps_registrar.c.

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

wps_registrar_probe_req_rx - Notify Registrar of Probe Request : Registrar data from wps_registrar_init() : MAC address of the Probe Request sender : 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 758 of file wps_registrar.c.

int wps_registrar_unlock_pin ( struct wps_registrar reg,
const u8 uuid 
)

wps_registrar_unlock_pin - Unlock a PIN for a specific UUID-E : Registrar data from wps_registrar_init() : 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 663 of file wps_registrar.c.

int wps_registrar_update_ie ( struct wps_registrar reg  ) 

Definition at line 2760 of file wps_registrar.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Fri Jan 11 10:05:11 2013