xref: /netbsd-src/external/bsd/wpa/dist/src/wps/wps_er.h (revision 179b12252ecaf3553d9c2b7458ce62b6a2203d0c)
1 /*
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 
20 struct 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 };
37 
38 struct wps_er_ap {
39 	struct dl_list list;
40 	struct wps_er *er;
41 	struct dl_list sta; /* list of STAs/Enrollees using this AP */
42 	struct in_addr addr;
43 	char *location;
44 	struct http_client *http;
45 	struct wps_data *wps;
46 
47 	u8 uuid[WPS_UUID_LEN];
48 	u8 pri_dev_type[8];
49 	u8 wps_state;
50 	u8 mac_addr[ETH_ALEN];
51 	char *friendly_name;
52 	char *manufacturer;
53 	char *manufacturer_url;
54 	char *model_description;
55 	char *model_name;
56 	char *model_number;
57 	char *model_url;
58 	char *serial_number;
59 	char *udn;
60 	char *upc;
61 
62 	char *scpd_url;
63 	char *control_url;
64 	char *event_sub_url;
65 
66 	int subscribed;
67 	u8 sid[WPS_UUID_LEN];
68 	unsigned int id;
69 
70 	struct wps_credential *ap_settings;
71 
72 	void (*m1_handler)(struct wps_er_ap *ap, struct wpabuf *m1);
73 };
74 
75 struct wps_er {
76 	struct wps_context *wps;
77 	char ifname[17];
78 	u8 mac_addr[ETH_ALEN]; /* mac addr of network i.f. we use */
79 	char *ip_addr_text; /* IP address of network i.f. we use */
80 	unsigned ip_addr; /* IP address of network i.f. we use (host order) */
81 	int multicast_sd;
82 	int ssdp_sd;
83 	struct dl_list ap;
84 	struct dl_list ap_unsubscribing;
85 	struct http_server *http_srv;
86 	int http_port;
87 	unsigned int next_ap_id;
88 	unsigned int event_id;
89 	int deinitializing;
90 	void (*deinit_done_cb)(void *ctx);
91 	void *deinit_done_ctx;
92 };
93 
94 
95 /* wps_er.c */
96 void wps_er_ap_add(struct wps_er *er, const u8 *uuid, struct in_addr *addr,
97 		   const char *location, int max_age);
98 void wps_er_ap_remove(struct wps_er *er, struct in_addr *addr);
99 
100 /* wps_er_ssdp.c */
101 int wps_er_ssdp_init(struct wps_er *er);
102 void wps_er_ssdp_deinit(struct wps_er *er);
103 void wps_er_send_ssdp_msearch(struct wps_er *er);
104 
105 #endif /* WPS_ER_H */
106