00001 /* 00002 * Wi-Fi Protected Setup - External Registrar 00003 * Copyright (c) 2009, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 00013 */ 00014 00015 #ifndef WPS_ER_H 00016 #define WPS_ER_H 00017 00018 #include "utils/list.h" 00019 00020 struct wps_er_sta { 00021 struct dl_list list; 00022 struct wps_er_ap *ap; 00023 u8 addr[ETH_ALEN]; 00024 u16 config_methods; 00025 u8 uuid[WPS_UUID_LEN]; 00026 u8 pri_dev_type[8]; 00027 u16 dev_passwd_id; 00028 int m1_received; 00029 char *manufacturer; 00030 char *model_name; 00031 char *model_number; 00032 char *serial_number; 00033 char *dev_name; 00034 struct wps_data *wps; 00035 struct http_client *http; 00036 }; 00037 00038 struct wps_er_ap { 00039 struct dl_list list; 00040 struct wps_er *er; 00041 struct dl_list sta; /* list of STAs/Enrollees using this AP */ 00042 struct in_addr addr; 00043 char *location; 00044 struct http_client *http; 00045 struct wps_data *wps; 00046 00047 u8 uuid[WPS_UUID_LEN]; 00048 u8 pri_dev_type[8]; 00049 u8 wps_state; 00050 u8 mac_addr[ETH_ALEN]; 00051 char *friendly_name; 00052 char *manufacturer; 00053 char *manufacturer_url; 00054 char *model_description; 00055 char *model_name; 00056 char *model_number; 00057 char *model_url; 00058 char *serial_number; 00059 char *udn; 00060 char *upc; 00061 00062 char *scpd_url; 00063 char *control_url; 00064 char *event_sub_url; 00065 00066 int subscribed; 00067 u8 sid[WPS_UUID_LEN]; 00068 unsigned int id; 00069 00070 struct wps_credential *ap_settings; 00071 00072 void (*m1_handler)(struct wps_er_ap *ap, struct wpabuf *m1); 00073 }; 00074 00075 struct wps_er { 00076 struct wps_context *wps; 00077 char ifname[17]; 00078 u8 mac_addr[ETH_ALEN]; /* mac addr of network i.f. we use */ 00079 char *ip_addr_text; /* IP address of network i.f. we use */ 00080 unsigned ip_addr; /* IP address of network i.f. we use (host order) */ 00081 int multicast_sd; 00082 int ssdp_sd; 00083 struct dl_list ap; 00084 struct dl_list ap_unsubscribing; 00085 struct http_server *http_srv; 00086 int http_port; 00087 unsigned int next_ap_id; 00088 unsigned int event_id; 00089 int deinitializing; 00090 void (*deinit_done_cb)(void *ctx); 00091 void *deinit_done_ctx; 00092 }; 00093 00094 00095 /* wps_er.c */ 00096 void wps_er_ap_add(struct wps_er *er, const u8 *uuid, struct in_addr *addr, 00097 const char *location, int max_age); 00098 void wps_er_ap_remove(struct wps_er *er, struct in_addr *addr); 00099 00100 /* wps_er_ssdp.c */ 00101 int wps_er_ssdp_init(struct wps_er *er); 00102 void wps_er_ssdp_deinit(struct wps_er *er); 00103 void wps_er_send_ssdp_msearch(struct wps_er *er); 00104 00105 #endif /* WPS_ER_H */