xref: /freebsd/contrib/wpa/src/wps/wps_er.h (revision 9a14aa017b21c292740c00ee098195cd46642730)
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 	struct wps_credential *cred;
37 };
38 
39 struct 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 
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 http_server *http_srv;
87 	int http_port;
88 	unsigned int next_ap_id;
89 	unsigned int event_id;
90 	int deinitializing;
91 	void (*deinit_done_cb)(void *ctx);
92 	void *deinit_done_ctx;
93 };
94 
95 
96 /* wps_er.c */
97 void wps_er_ap_add(struct wps_er *er, const u8 *uuid, struct in_addr *addr,
98 		   const char *location, int max_age);
99 void wps_er_ap_remove(struct wps_er *er, struct in_addr *addr);
100 
101 /* wps_er_ssdp.c */
102 int wps_er_ssdp_init(struct wps_er *er);
103 void wps_er_ssdp_deinit(struct wps_er *er);
104 void wps_er_send_ssdp_msearch(struct wps_er *er);
105 
106 #endif /* WPS_ER_H */
107