18d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* 28d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Wi-Fi Protected Setup - External Registrar 38d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Copyright (c) 2009, Jouni Malinen <j@w1.fi> 48d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * This software may be distributed under the terms of the BSD license. 6c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * See README for more details. 78d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 88d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 98d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifndef WPS_ER_H 108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_ER_H 118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "utils/list.h" 138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wps_er_sta { 158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct dl_list list; 168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wps_er_ap *ap; 178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 addr[ETH_ALEN]; 188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u16 config_methods; 198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 uuid[WPS_UUID_LEN]; 208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 pri_dev_type[8]; 218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u16 dev_passwd_id; 228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int m1_received; 238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *manufacturer; 248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *model_name; 258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *model_number; 268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *serial_number; 278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *dev_name; 288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wps_data *wps; 298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct http_client *http; 308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wps_credential *cred; 318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wps_er_ap { 348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct dl_list list; 358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wps_er *er; 368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct dl_list sta; /* list of STAs/Enrollees using this AP */ 378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct in_addr addr; 388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *location; 398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct http_client *http; 408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wps_data *wps; 418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 uuid[WPS_UUID_LEN]; 438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 pri_dev_type[8]; 448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 wps_state; 458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 mac_addr[ETH_ALEN]; 468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *friendly_name; 478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *manufacturer; 488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *manufacturer_url; 498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *model_description; 508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *model_name; 518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *model_number; 528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *model_url; 538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *serial_number; 548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *udn; 558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *upc; 568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *scpd_url; 588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *control_url; 598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *event_sub_url; 608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int subscribed; 628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 sid[WPS_UUID_LEN]; 638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int id; 648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wps_credential *ap_settings; 668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*m1_handler)(struct wps_er_ap *ap, struct wpabuf *m1); 688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wps_er_ap_settings { 718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct dl_list list; 728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 uuid[WPS_UUID_LEN]; 738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wps_credential ap_settings; 748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wps_er { 778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wps_context *wps; 788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char ifname[17]; 794b06059785b935dd1f4f09314e4e12c417d2c6a4Dmitry Shmidt int forced_ifname; 808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 mac_addr[ETH_ALEN]; /* mac addr of network i.f. we use */ 818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *ip_addr_text; /* IP address of network i.f. we use */ 828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned ip_addr; /* IP address of network i.f. we use (host order) */ 838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int multicast_sd; 848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int ssdp_sd; 858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct dl_list ap; 868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct dl_list ap_unsubscribing; 878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct dl_list ap_settings; 888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct http_server *http_srv; 898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int http_port; 908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int next_ap_id; 918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int event_id; 928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int deinitializing; 938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*deinit_done_cb)(void *ctx); 948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void *deinit_done_ctx; 958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct in_addr filter_addr; 968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int skip_set_sel_reg; 978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *set_sel_reg_uuid_filter; 988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* wps_er.c */ 1028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wps_er_ap_add(struct wps_er *er, const u8 *uuid, struct in_addr *addr, 1038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *location, int max_age); 1048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wps_er_ap_remove(struct wps_er *er, struct in_addr *addr); 1058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wps_er_ap_cache_settings(struct wps_er *er, struct in_addr *addr); 1068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* wps_er_ssdp.c */ 1088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wps_er_ssdp_init(struct wps_er *er); 1098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wps_er_ssdp_deinit(struct wps_er *er); 1108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wps_er_send_ssdp_msearch(struct wps_er *er); 1118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* WPS_ER_H */ 113