wpa_supplicant / hostapd 2.0
Data Structures | Defines | Enumerations | Functions

wps_upnp_i.h File Reference

UPnP for WPS / internal definitions. More...

#include "utils/list.h"
#include "http.h"

Go to the source code of this file.

Data Structures

struct  advertisement_state_machine
struct  subscr_addr
struct  subscription
struct  upnp_wps_device_interface
struct  upnp_wps_device_sm

Defines

#define UPNP_MULTICAST_ADDRESS   "239.255.255.250"
#define UPNP_MULTICAST_PORT   1900
#define UPNP_SUBSCRIBE_SEC_MIN   1800
#define UPNP_SUBSCRIBE_SEC   (UPNP_SUBSCRIBE_SEC_MIN + 1)
#define UPNP_WPS_DEVICE_XML_FILE   "wps_device.xml"
#define UPNP_WPS_SCPD_XML_FILE   "wps_scpd.xml"
#define UPNP_WPS_DEVICE_CONTROL_FILE   "wps_control"
#define UPNP_WPS_DEVICE_EVENT_FILE   "wps_event"
#define MULTICAST_MAX_READ   1600

Enumerations

enum  advertisement_type_enum { ADVERTISE_UP = 0, ADVERTISE_DOWN = 1, MSEARCH_REPLY = 2 }

Functions

void format_date (struct wpabuf *buf)
struct subscriptionsubscription_start (struct upnp_wps_device_sm *sm, const char *callback_urls)
 Remember a UPnP control point to send events to.
struct subscriptionsubscription_renew (struct upnp_wps_device_sm *sm, const u8 uuid[UUID_LEN])
void subscription_destroy (struct subscription *s)
struct subscriptionsubscription_find (struct upnp_wps_device_sm *sm, const u8 uuid[UUID_LEN])
void subscr_addr_delete (struct subscr_addr *a)
int send_wpabuf (int fd, struct wpabuf *buf)
int get_netif_info (const char *net_if, unsigned *ip_addr, char **ip_addr_text, u8 mac[ETH_ALEN])
 Get hw and IP addresses for network device.
void msearchreply_state_machine_stop (struct advertisement_state_machine *a)
 Stop M-SEARCH reply state machine.
int advertisement_state_machine_start (struct upnp_wps_device_sm *sm)
 Start SSDP advertisements.
void advertisement_state_machine_stop (struct upnp_wps_device_sm *sm, int send_byebye)
 Stop SSDP advertisements.
void ssdp_listener_stop (struct upnp_wps_device_sm *sm)
 Stop SSDP listered.
int ssdp_listener_start (struct upnp_wps_device_sm *sm)
 Set up for receiving discovery (UDP) packets.
int ssdp_listener_open (void)
int add_ssdp_network (const char *net_if)
 Add routing entry for SSDP.
int ssdp_open_multicast_sock (u32 ip_addr)
int ssdp_open_multicast (struct upnp_wps_device_sm *sm)
 Open socket for sending multicast SSDP messages.
int web_listener_start (struct upnp_wps_device_sm *sm)
void web_listener_stop (struct upnp_wps_device_sm *sm)
int event_add (struct subscription *s, const struct wpabuf *data, int probereq)
 Add a new event to a queue.
void event_delete_all (struct subscription *s)
void event_send_all_later (struct upnp_wps_device_sm *sm)
void event_send_stop_all (struct upnp_wps_device_sm *sm)
int upnp_er_set_selected_registrar (struct wps_registrar *reg, struct subscription *s, const struct wpabuf *msg)
void upnp_er_remove_notification (struct wps_registrar *reg, struct subscription *s)

Detailed Description

UPnP for WPS / internal definitions.

Copyright
Copyright (c) 2000-2003 Intel Corporation Copyright (c) 2006-2007 Sony Corporation Copyright (c) 2008-2009 Atheros Communications Copyright (c) 2009, Jouni Malinen <j@w1.fi>

See wps_upnp.c for more details on licensing and code history.


Function Documentation

int add_ssdp_network ( const char *  net_if)

Add routing entry for SSDP.

Parameters:
net_ifSelected network interface name
Returns:
0 on success, -1 on failure

This function assures that the multicast address will be properly handled by Linux networking code (by a modification to routing tables). This must be done per network interface. It really only needs to be done once after booting up, but it does not hurt to call this more frequently "to be safe".

int advertisement_state_machine_start ( struct upnp_wps_device_sm sm)

Start SSDP advertisements.

Parameters:
smWPS UPnP state machine from upnp_wps_device_init()
Returns:
0 on success, -1 on failure
void advertisement_state_machine_stop ( struct upnp_wps_device_sm sm,
int  send_byebye 
)

Stop SSDP advertisements.

Parameters:
smWPS UPnP state machine from upnp_wps_device_init()
send_byebyeSend byebye advertisement messages immediately
int event_add ( struct subscription s,
const struct wpabuf data,
int  probereq 
)

Add a new event to a queue.

Parameters:
sSubscription
dataEvent data (is copied; caller retains ownership)
probereqWhether this is a Probe Request event
Returns:
0 on success, -1 on error, 1 on max event queue limit reached
int get_netif_info ( const char *  net_if,
unsigned *  ip_addr,
char **  ip_addr_text,
u8  mac[ETH_ALEN] 
)

Get hw and IP addresses for network device.

Parameters:
net_ifSelected network interface name
ip_addrBuffer for returning IP address in network byte order
ip_addr_textBuffer for returning a pointer to allocated IP address text
macBuffer for returning MAC address
Returns:
0 on success, -1 on failure
void msearchreply_state_machine_stop ( struct advertisement_state_machine a)

Stop M-SEARCH reply state machine.

Parameters:
aSelected advertisement/reply state
int ssdp_listener_start ( struct upnp_wps_device_sm sm)

Set up for receiving discovery (UDP) packets.

Parameters:
smWPS UPnP state machine from upnp_wps_device_init()
Returns:
0 on success, -1 on failure

The SSDP listener is stopped by calling ssdp_listener_stop().

void ssdp_listener_stop ( struct upnp_wps_device_sm sm)

Stop SSDP listered.

Parameters:
smWPS UPnP state machine from upnp_wps_device_init()

This function stops the SSDP listener that was started by calling ssdp_listener_start().

int ssdp_open_multicast ( struct upnp_wps_device_sm sm)

Open socket for sending multicast SSDP messages.

Parameters:
smWPS UPnP state machine from upnp_wps_device_init()
Returns:
0 on success, -1 on failure
struct subscription* subscription_start ( struct upnp_wps_device_sm sm,
const char *  callback_urls 
) [read]

Remember a UPnP control point to send events to.

Parameters:
smWPS UPnP state machine from upnp_wps_device_init()
callback_urlsCallback URLs
Returns:
NULL on error, or pointer to new subscription structure.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines