#include "includes.h"
#include <assert.h>
#include <net/if.h>
#include <netdb.h>
#include <sys/ioctl.h>
#include "common.h"
#include "uuid.h"
#include "base64.h"
#include "wps.h"
#include "wps_i.h"
#include "wps_upnp.h"
#include "wps_upnp_i.h"
Go to the source code of this file.
Defines | |
#define | MAX_ADDR_PER_SUBSCRIPTION 8 |
#define | MAX_SUBSCRIPTIONS 4 /* how many subscribing clients we handle */ |
#define | NO_DOMAIN_NAME_RESOLUTION 1 /* 1 to allow only dotted ip addresses */ |
Functions | |
static struct wpabuf * | build_fake_wsc_ack (void) |
void | format_date (struct wpabuf *buf) |
int | get_netif_info (const char *net_if, unsigned *ip_addr, char **ip_addr_text, u8 mac[ETH_ALEN]) |
int | send_wpabuf (int fd, struct wpabuf *buf) |
static void | subscr_addr_add_url (struct subscription *s, const char *url) |
static void | subscr_addr_delete (struct subscr_addr *a) |
static void | subscr_addr_free_all (struct subscription *s) |
static void | subscr_addr_list_create (struct subscription *s, const char *url_list) |
void | subscription_destroy (struct subscription *s) |
struct subscription * | subscription_find (struct upnp_wps_device_sm *sm, const u8 uuid[UUID_LEN]) |
static int | subscription_first_event (struct subscription *s) |
static void | subscription_list_age (struct upnp_wps_device_sm *sm, time_t now) |
struct subscription * | subscription_renew (struct upnp_wps_device_sm *sm, const u8 uuid[UUID_LEN]) |
struct subscription * | subscription_start (struct upnp_wps_device_sm *sm, const char *callback_urls) |
void | upnp_wps_device_deinit (struct upnp_wps_device_sm *sm) |
struct upnp_wps_device_sm * | upnp_wps_device_init (struct upnp_wps_device_ctx *ctx, struct wps_context *wps, void *priv) |
static void | upnp_wps_device_send_event (struct upnp_wps_device_sm *sm) |
int | upnp_wps_device_send_wlan_event (struct upnp_wps_device_sm *sm, const u8 from_mac_addr[ETH_ALEN], enum upnp_wps_wlanevent_type ev_type, const struct wpabuf *msg) |
int | upnp_wps_device_start (struct upnp_wps_device_sm *sm, char *net_if) |
void | upnp_wps_device_stop (struct upnp_wps_device_sm *sm) |
static void | upnp_wps_free_msearchreply (struct dl_list *head) |
static void | upnp_wps_free_subscriptions (struct dl_list *head) |
int | upnp_wps_subscribers (struct upnp_wps_device_sm *sm) |
static void | uuid_make (u8 uuid[UUID_LEN]) |
static void | wpabuf_put_property (struct wpabuf *buf, const char *name, const char *value) |
#define MAX_ADDR_PER_SUBSCRIPTION 8 |
Definition at line 210 of file wps_upnp.c.
#define MAX_SUBSCRIPTIONS 4 /* how many subscribing clients we handle */ |
Definition at line 209 of file wps_upnp.c.
#define NO_DOMAIN_NAME_RESOLUTION 1 /* 1 to allow only dotted ip addresses */ |
Definition at line 200 of file wps_upnp.c.
static struct wpabuf* build_fake_wsc_ack | ( | void | ) | [static, read] |
Definition at line 561 of file wps_upnp.c.
void format_date | ( | struct wpabuf * | buf | ) |
Definition at line 214 of file wps_upnp.c.
int get_netif_info | ( | const char * | net_if, |
unsigned * | ip_addr, | ||
char ** | ip_addr_text, | ||
u8 | mac[ETH_ALEN] | ||
) |
get_netif_info - Get hw and IP addresses for network device : Selected network interface name : Buffer for returning IP address in network byte order : Buffer for returning a pointer to allocated IP address text : Buffer for returning MAC address Returns: 0 on success, -1 on failure
Definition at line 852 of file wps_upnp.c.
int send_wpabuf | ( | int | fd, |
struct wpabuf * | buf | ||
) |
Definition at line 427 of file wps_upnp.c.
static void subscr_addr_add_url | ( | struct subscription * | s, |
const char * | url | ||
) | [static] |
Definition at line 296 of file wps_upnp.c.
static void subscr_addr_delete | ( | struct subscr_addr * | a | ) | [static] |
Definition at line 273 of file wps_upnp.c.
static void subscr_addr_free_all | ( | struct subscription * | s | ) | [static] |
Definition at line 284 of file wps_upnp.c.
static void subscr_addr_list_create | ( | struct subscription * | s, |
const char * | url_list | ||
) | [static] |
Definition at line 407 of file wps_upnp.c.
void subscription_destroy | ( | struct subscription * | s | ) |
Definition at line 521 of file wps_upnp.c.
struct subscription* subscription_find | ( | struct upnp_wps_device_sm * | sm, |
const u8 | uuid[UUID_LEN] | ||
) | [read] |
Definition at line 549 of file wps_upnp.c.
static int subscription_first_event | ( | struct subscription * | s | ) | [static] |
Definition at line 588 of file wps_upnp.c.
static void subscription_list_age | ( | struct upnp_wps_device_sm * | sm, |
time_t | now | ||
) | [static] |
Definition at line 532 of file wps_upnp.c.
struct subscription* subscription_renew | ( | struct upnp_wps_device_sm * | sm, |
const u8 | uuid[UUID_LEN] | ||
) | [read] |
Definition at line 716 of file wps_upnp.c.
struct subscription* subscription_start | ( | struct upnp_wps_device_sm * | sm, |
const char * | callback_urls | ||
) | [read] |
subscription_start - Remember a UPnP control point to send events to. : WPS UPnP state machine from upnp_wps_device_init() : Callback URLs Returns: NULL on error, or pointer to new subscription structure.
Definition at line 665 of file wps_upnp.c.
void upnp_wps_device_deinit | ( | struct upnp_wps_device_sm * | sm | ) |
upnp_wps_device_deinit - Deinitialize WPS UPnP : WPS UPnP state machine from upnp_wps_device_init()
Definition at line 1022 of file wps_upnp.c.
struct upnp_wps_device_sm* upnp_wps_device_init | ( | struct upnp_wps_device_ctx * | ctx, |
struct wps_context * | wps, | ||
void * | priv | ||
) | [read] |
upnp_wps_device_init - Initialize WPS UPnP : callback table; we must eventually free it : Pointer to longterm WPS context : External context data that will be used in callbacks Returns: WPS UPnP state or NULL on failure
Definition at line 1047 of file wps_upnp.c.
static void upnp_wps_device_send_event | ( | struct upnp_wps_device_sm * | sm | ) | [static] |
upnp_wps_device_send_event - Queue event messages for subscribers : WPS UPnP state machine from upnp_wps_device_init()
This function queues the last WLANEvent to be sent for all currently subscribed UPnP control points. sm->wlanevent must have been set with the encoded data before calling this function.
Definition at line 464 of file wps_upnp.c.
int upnp_wps_device_send_wlan_event | ( | struct upnp_wps_device_sm * | sm, |
const u8 | from_mac_addr[ETH_ALEN], | ||
enum upnp_wps_wlanevent_type | ev_type, | ||
const struct wpabuf * | msg | ||
) |
upnp_wps_device_send_wlan_event - Event notification : WPS UPnP state machine from upnp_wps_device_init() : Source (Enrollee) MAC address for the event : Event type : Event data Returns: 0 on success, -1 on failure
Tell external Registrars (UPnP control points) that something happened. In particular, events include WPS messages from clients that are proxied to external Registrars.
Definition at line 745 of file wps_upnp.c.
int upnp_wps_device_start | ( | struct upnp_wps_device_sm * | sm, |
char * | net_if | ||
) |
upnp_wps_device_start - Start WPS UPnP operations on an interface : WPS UPnP state machine from upnp_wps_device_init() : Selected network interface name Returns: 0 on success, -1 on failure
Definition at line 963 of file wps_upnp.c.
void upnp_wps_device_stop | ( | struct upnp_wps_device_sm * | sm | ) |
upnp_wps_device_stop - Stop WPS UPnP operations on an interface : WPS UPnP state machine from upnp_wps_device_init()
Definition at line 931 of file wps_upnp.c.
static void upnp_wps_free_msearchreply | ( | struct dl_list * | head | ) | [static] |
Definition at line 908 of file wps_upnp.c.
static void upnp_wps_free_subscriptions | ( | struct dl_list * | head | ) | [static] |
Definition at line 917 of file wps_upnp.c.
int upnp_wps_subscribers | ( | struct upnp_wps_device_sm * | sm | ) |
upnp_wps_subscribers - Check whether there are any event subscribers : WPS UPnP state machine from upnp_wps_device_init() Returns: 0 if no subscribers, 1 if subscribers
Definition at line 1073 of file wps_upnp.c.
static void uuid_make | ( | u8 | uuid[UUID_LEN] | ) | [static] |
Definition at line 246 of file wps_upnp.c.
static void wpabuf_put_property | ( | struct wpabuf * | buf, |
const char * | name, | ||
const char * | value | ||
) | [static] |
Definition at line 444 of file wps_upnp.c.