blob: 5388ed15c8ec9a1ed8331362cb2b8b8011ad8414 [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * Wi-Fi Protected Setup - External Registrar
3 * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
11 *
12 * See README and COPYING for more details.
13 */
14
15#ifndef WPS_ER_H
16#define WPS_ER_H
17
18#include "utils/list.h"
19
20struct wps_er_sta {
21 struct dl_list list;
22 struct wps_er_ap *ap;
23 u8 addr[ETH_ALEN];
24 u16 config_methods;
25 u8 uuid[WPS_UUID_LEN];
26 u8 pri_dev_type[8];
27 u16 dev_passwd_id;
28 int m1_received;
29 char *manufacturer;
30 char *model_name;
31 char *model_number;
32 char *serial_number;
33 char *dev_name;
34 struct wps_data *wps;
35 struct http_client *http;
36 struct wps_credential *cred;
37};
38
39struct wps_er_ap {
40 struct dl_list list;
41 struct wps_er *er;
42 struct dl_list sta; /* list of STAs/Enrollees using this AP */
43 struct in_addr addr;
44 char *location;
45 struct http_client *http;
46 struct wps_data *wps;
47
48 u8 uuid[WPS_UUID_LEN];
49 u8 pri_dev_type[8];
50 u8 wps_state;
51 u8 mac_addr[ETH_ALEN];
52 char *friendly_name;
53 char *manufacturer;
54 char *manufacturer_url;
55 char *model_description;
56 char *model_name;
57 char *model_number;
58 char *model_url;
59 char *serial_number;
60 char *udn;
61 char *upc;
62
63 char *scpd_url;
64 char *control_url;
65 char *event_sub_url;
66
67 int subscribed;
68 u8 sid[WPS_UUID_LEN];
69 unsigned int id;
70
71 struct wps_credential *ap_settings;
72
73 void (*m1_handler)(struct wps_er_ap *ap, struct wpabuf *m1);
74};
75
76struct wps_er_ap_settings {
77 struct dl_list list;
78 u8 uuid[WPS_UUID_LEN];
79 struct wps_credential ap_settings;
80};
81
82struct wps_er {
83 struct wps_context *wps;
84 char ifname[17];
85 u8 mac_addr[ETH_ALEN]; /* mac addr of network i.f. we use */
86 char *ip_addr_text; /* IP address of network i.f. we use */
87 unsigned ip_addr; /* IP address of network i.f. we use (host order) */
88 int multicast_sd;
89 int ssdp_sd;
90 struct dl_list ap;
91 struct dl_list ap_unsubscribing;
92 struct dl_list ap_settings;
93 struct http_server *http_srv;
94 int http_port;
95 unsigned int next_ap_id;
96 unsigned int event_id;
97 int deinitializing;
98 void (*deinit_done_cb)(void *ctx);
99 void *deinit_done_ctx;
100 struct in_addr filter_addr;
101 int skip_set_sel_reg;
102 const u8 *set_sel_reg_uuid_filter;
103};
104
105
106/* wps_er.c */
107void wps_er_ap_add(struct wps_er *er, const u8 *uuid, struct in_addr *addr,
108 const char *location, int max_age);
109void wps_er_ap_remove(struct wps_er *er, struct in_addr *addr);
110int wps_er_ap_cache_settings(struct wps_er *er, struct in_addr *addr);
111
112/* wps_er_ssdp.c */
113int wps_er_ssdp_init(struct wps_er *er);
114void wps_er_ssdp_deinit(struct wps_er *er);
115void wps_er_send_ssdp_msearch(struct wps_er *er);
116
117#endif /* WPS_ER_H */