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