xref: /freebsd/contrib/wpa/src/wps/wps_er.h (revision d22c735e033e47d58878a9c00aa09e90e6e83f06)
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 	u8 mac_addr[ETH_ALEN]; /* mac addr of network i.f. we use */
80 	char *ip_addr_text; /* IP address of network i.f. we use */
81 	unsigned ip_addr; /* IP address of network i.f. we use (host order) */
82 	int multicast_sd;
83 	int ssdp_sd;
84 	struct dl_list ap;
85 	struct dl_list ap_unsubscribing;
86 	struct dl_list ap_settings;
87 	struct http_server *http_srv;
88 	int http_port;
89 	unsigned int next_ap_id;
90 	unsigned int event_id;
91 	int deinitializing;
92 	void (*deinit_done_cb)(void *ctx);
93 	void *deinit_done_ctx;
94 	struct in_addr filter_addr;
95 	int skip_set_sel_reg;
96 	const u8 *set_sel_reg_uuid_filter;
97 };
98 
99 
100 /* wps_er.c */
101 void wps_er_ap_add(struct wps_er *er, const u8 *uuid, struct in_addr *addr,
102 		   const char *location, int max_age);
103 void wps_er_ap_remove(struct wps_er *er, struct in_addr *addr);
104 int wps_er_ap_cache_settings(struct wps_er *er, struct in_addr *addr);
105 
106 /* wps_er_ssdp.c */
107 int wps_er_ssdp_init(struct wps_er *er);
108 void wps_er_ssdp_deinit(struct wps_er *er);
109 void wps_er_send_ssdp_msearch(struct wps_er *er);
110 
111 #endif /* WPS_ER_H */
112