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