WPS: Limit Probe Request event queuing if subscriber may have left
[libeap.git] / src / wps / wps_upnp_i.h
index fd26797..4143eca 100644 (file)
@@ -31,7 +31,6 @@
 #define MULTICAST_MAX_READ 1600 /* max bytes we'll read for UPD request */
 
 
-struct subscription;
 struct upnp_wps_device_sm;
 struct wps_registrar;
 
@@ -50,10 +49,7 @@ enum advertisement_type_enum {
  * separate packets and spread out in time to avoid congestion.
  */
 struct advertisement_state_machine {
-       /* double-linked list */
-       struct advertisement_state_machine *next;
-       struct advertisement_state_machine *prev;
-       struct upnp_wps_device_sm *sm; /* parent */
+       struct dl_list list;
        enum advertisement_type_enum type;
        int state;
        int nerrors;
@@ -68,10 +64,10 @@ struct advertisement_state_machine {
  */
 struct subscr_addr {
        struct dl_list list;
-       struct subscription *s; /* parent */
        char *domain_and_port; /* domain and port part of url */
        char *path; /* "filepath" part of url (from "mem") */
        struct sockaddr_in saddr; /* address for doing connect */
+       unsigned num_failures;
 };
 
 
@@ -96,11 +92,13 @@ struct subscription {
        struct dl_list event_queue; /* Queued event messages. */
        struct wps_event_ *current_event; /* non-NULL if being sent (not in q)
                                           */
+       int last_event_failed; /* Whether delivery of last event failed */
 
        /* Information from SetSelectedRegistrar action */
        u8 selected_registrar;
        u16 dev_password_id;
        u16 config_methods;
+       u8 authorized_macs[WPS_MAX_AUTHORIZED_MACS][ETH_ALEN];
        struct wps_registrar *reg;
 };
 
@@ -118,8 +116,6 @@ struct upnp_wps_device_sm {
        char *root_dir;
        char *desc_url;
        int started; /* nonzero if we are active */
-       char *net_if; /* network interface we use */
-       char *mac_addr_text; /* mac addr of network i.f. we use */
        u8 mac_addr[ETH_ALEN]; /* mac addr of network i.f. we use */
        char *ip_addr_text; /* IP address of network i.f. we use */
        unsigned ip_addr; /* IP address of network i.f. we use (host order) */
@@ -128,8 +124,7 @@ struct upnp_wps_device_sm {
        int ssdp_sd_registered; /* nonzero if we must unregister */
        unsigned advertise_count; /* how many advertisements done */
        struct advertisement_state_machine advertisement;
-       struct advertisement_state_machine *msearch_replies;
-       int n_msearch_replies; /* no. of pending M-SEARCH replies */
+       struct dl_list msearch_replies;
        int web_port; /* our port that others get xml files from */
        struct http_server *web_srv;
        /* Note: subscriptions are kept in expiry order */
@@ -138,6 +133,7 @@ struct upnp_wps_device_sm {
                                    */
 
        char *wlanevent; /* the last WLANEvent data */
+       enum upnp_wps_wlanevent_type wlanevent_type;
 
        /* FIX: maintain separate structures for each UPnP peer */
        struct upnp_wps_peer peer;
@@ -152,9 +148,10 @@ struct subscription * subscription_renew(struct upnp_wps_device_sm *sm,
 void subscription_destroy(struct subscription *s);
 struct subscription * subscription_find(struct upnp_wps_device_sm *sm,
                                        const u8 uuid[UUID_LEN]);
+void subscr_addr_delete(struct subscr_addr *a);
 int send_wpabuf(int fd, struct wpabuf *buf);
 int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text,
-                  u8 mac[ETH_ALEN], char **mac_addr_text);
+                  u8 mac[ETH_ALEN]);
 
 /* wps_upnp_ssdp.c */
 void msearchreply_state_machine_stop(struct advertisement_state_machine *a);
@@ -173,7 +170,7 @@ int web_listener_start(struct upnp_wps_device_sm *sm);
 void web_listener_stop(struct upnp_wps_device_sm *sm);
 
 /* wps_upnp_event.c */
-int event_add(struct subscription *s, const struct wpabuf *data);
+int event_add(struct subscription *s, const struct wpabuf *data, int probereq);
 void event_delete_all(struct subscription *s);
 void event_send_all_later(struct upnp_wps_device_sm *sm);
 void event_send_stop_all(struct upnp_wps_device_sm *sm);