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