wps_registrar.c File Reference

Wi-Fi Protected Setup - Registrar. More...

#include "includes.h"
#include "common.h"
#include "sha256.h"
#include "base64.h"
#include "ieee802_11_defs.h"
#include "eloop.h"
#include "wps_i.h"
#include "wps_dev_attr.h"
#include "wps_upnp.h"
#include "crypto.h"
#include "uuid.h"
Include dependency graph for wps_registrar.c:

Go to the source code of this file.

Data Structures

struct  wps_uuid_pin
struct  wps_pbc_session
struct  wps_registrar_device
struct  wps_registrar

Defines

#define WPS_WORKAROUNDS
#define PIN_LOCKED   BIT(0)
#define PIN_EXPIRES   BIT(1)
#define WPS_STRDUP(n)

Functions

int wps_device_store (struct wps_registrar *reg, struct wps_device_data *dev, const u8 *uuid)
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_build_cred (struct wps_data *wps, struct wpabuf *msg)
struct wpabufwps_registrar_get_msg (struct wps_data *wps, enum wsc_op_code *op_code)
enum wps_process_res wps_registrar_process_msg (struct wps_data *wps, enum wsc_op_code op_code, const struct wpabuf *msg)
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)

Detailed Description

Wi-Fi Protected Setup - Registrar.

Copyright
Copyright (c) 2008-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_registrar.c.


Define Documentation

#define WPS_STRDUP (  ) 
Value:
os_free(dst->n); \
        dst->n = src->n ? os_strdup(src->n) : NULL

Function Documentation

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:35 2009 for hostapd by  doxygen 1.6.1