OSDN Git Service

Remove obsolete parameter from p2p_sd_service_update()
[android-x86/external-wpa_supplicant_8.git] / src / p2p / p2p_i.h
index afb891e..d28aae9 100644 (file)
@@ -2,14 +2,8 @@
  * P2P - Internal definitions for P2P module
  * Copyright (c) 2009-2010, Atheros Communications
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
  */
 
 #ifndef P2P_I_H
@@ -18,8 +12,6 @@
 #include "utils/list.h"
 #include "p2p.h"
 
-/* TODO: add removal of expired P2P device entries */
-
 enum p2p_go_state {
        UNKNOWN_GO,
        LOCAL_GO,
@@ -60,6 +52,7 @@ struct p2p_device {
        int go_neg_req_sent;
        enum p2p_go_state go_state;
        u8 dialog_token;
+       u8 tie_breaker;
        u8 intended_addr[ETH_ALEN];
 
        char country[3];
@@ -69,10 +62,18 @@ struct p2p_device {
        size_t oper_ssid_len;
 
        /**
-        * req_config_methods - Pending provisioning discovery methods
+        * req_config_methods - Pending provision discovery methods
         */
        u16 req_config_methods;
 
+       /**
+        * wps_prov_info - Stored provisioning WPS config method
+        *
+        * This is used to store pending WPS config method between Provisioning
+        * Discovery and connection to a running group.
+        */
+       u16 wps_prov_info;
+
 #define P2P_DEV_PROBE_REQ_ONLY BIT(0)
 #define P2P_DEV_REPORTED BIT(1)
 #define P2P_DEV_NOT_YET_READY BIT(2)
@@ -89,6 +90,9 @@ struct p2p_device {
 #define P2P_DEV_FORCE_FREQ BIT(13)
 #define P2P_DEV_PD_FOR_JOIN BIT(14)
 #define P2P_DEV_REPORTED_ONCE BIT(15)
+#define P2P_DEV_PREFER_PERSISTENT_RECONN BIT(16)
+#define P2P_DEV_PD_BEFORE_GO_NEG BIT(17)
+#define P2P_DEV_NO_PREF_CHAN BIT(18)
        unsigned int flags;
 
        int status; /* enum p2p_status_code */
@@ -107,6 +111,7 @@ struct p2p_sd_query {
        struct p2p_sd_query *next;
        u8 peer[ETH_ALEN];
        int for_all_peers;
+       int wsd; /* Wi-Fi Display Service Discovery Request */
        struct wpabuf *tlvs;
 };
 
@@ -200,6 +205,16 @@ struct p2p_data {
                 * P2P_INVITE_LISTEN - Listen during Invite
                 */
                P2P_INVITE_LISTEN,
+
+               /**
+                * P2P_SEARCH_WHEN_READY - Waiting to start Search
+                */
+               P2P_SEARCH_WHEN_READY,
+
+               /**
+                * P2P_CONTINUE_SEARCH_WHEN_READY - Waiting to continue Search
+                */
+               P2P_CONTINUE_SEARCH_WHEN_READY,
        } state;
 
        /**
@@ -213,10 +228,23 @@ struct p2p_data {
        int max_disc_int;
 
        /**
+        * max_disc_tu - Maximum number of TUs for discoverable interval
+        */
+       int max_disc_tu;
+
+       /**
         * devices - List of known P2P Device peers
         */
        struct dl_list devices;
 
+#ifdef ANDROID_P2P
+       /**
+        * sd_dev_list - device pointer to be serviced next
+        * for service discovery
+        */
+       struct dl_list *sd_dev_list;
+#endif
+
        /**
         * go_neg_peer - Pointer to GO Negotiation peer
         */
@@ -273,6 +301,11 @@ struct p2p_data {
        size_t ssid_len;
 
        /**
+        * ssid_set - Whether SSID is already set for GO Negotiation
+        */
+       int ssid_set;
+
+       /**
         * Regulatory class for own operational channel
         */
        u8 op_reg_class;
@@ -349,6 +382,7 @@ struct p2p_data {
        int inv_persistent;
 
        enum p2p_discovery_type find_type;
+       unsigned int last_p2p_find_timeout;
        u8 last_prog_scan_class;
        u8 last_prog_scan_chan;
        int p2p_scan_running;
@@ -359,10 +393,15 @@ struct p2p_data {
        } start_after_scan;
        u8 after_scan_peer[ETH_ALEN];
        struct p2p_pending_action_tx *after_scan_tx;
+       unsigned int after_scan_tx_in_progress:1;
 
        /* Requested device types for find/search */
        unsigned int num_req_dev_types;
        u8 *req_dev_types;
+       u8 *find_dev_id;
+       u8 find_dev_id_buf[ETH_ALEN];
+
+       struct os_time find_start; /* time of last p2p_find start */
 
        struct p2p_group **groups;
        size_t num_groups;
@@ -387,6 +426,7 @@ struct p2p_data {
        int best_freq_24;
        int best_freq_5;
        int best_freq_overall;
+       int own_freq_preference;
 
        /**
         * wps_vendor_ext - WPS Vendor Extensions to add
@@ -409,6 +449,27 @@ struct p2p_data {
         * in IDLE state.
         */
        int pd_retries;
+
+       u8 go_timeout;
+       u8 client_timeout;
+
+       /* Extra delay in milliseconds between search iterations */
+       unsigned int search_delay;
+       int in_search_delay;
+
+#ifdef CONFIG_WIFI_DISPLAY
+       struct wpabuf *wfd_ie_beacon;
+       struct wpabuf *wfd_ie_probe_req;
+       struct wpabuf *wfd_ie_probe_resp;
+       struct wpabuf *wfd_ie_assoc_req;
+       struct wpabuf *wfd_ie_invitation;
+       struct wpabuf *wfd_ie_prov_disc_req;
+       struct wpabuf *wfd_ie_prov_disc_resp;
+       struct wpabuf *wfd_ie_go_neg;
+       struct wpabuf *wfd_dev_info;
+       struct wpabuf *wfd_assoc_bssid;
+       struct wpabuf *wfd_coupled_sink_info;
+#endif /* CONFIG_WIFI_DISPLAY */
 };
 
 /**
@@ -417,6 +478,7 @@ struct p2p_data {
 struct p2p_message {
        struct wpabuf *p2p_attributes;
        struct wpabuf *wps_attributes;
+       struct wpabuf *wfd_subelems;
 
        u8 dialog_token;
 
@@ -503,9 +565,8 @@ struct p2p_group_info {
 
 /* p2p_utils.c */
 int p2p_random(char *buf, size_t len);
-int p2p_channel_to_freq(const char *country, int reg_class, int channel);
-int p2p_freq_to_channel(const char *country, unsigned int freq, u8 *reg_class,
-                       u8 *channel);
+int p2p_channel_to_freq(int op_class, int channel);
+int p2p_freq_to_channel(unsigned int freq, u8 *op_class, u8 *channel);
 void p2p_channels_intersect(const struct p2p_channels *a,
                            const struct p2p_channels *b,
                            struct p2p_channels *res);
@@ -532,14 +593,13 @@ struct p2p_noa_desc {
 
 /* p2p_group.c */
 const u8 * p2p_group_get_interface_addr(struct p2p_group *group);
-
-#ifdef ANDROID_BRCM_P2P_PATCH
-void p2p_get_group_noa(struct p2p_group *group, u8 *noa, size_t* noa_len);
-#endif
-
 u8 p2p_group_presence_req(struct p2p_group *group,
                          const u8 *client_interface_addr,
                          const u8 *noa, size_t noa_len);
+int p2p_group_is_group_id_match(struct p2p_group *group, const u8 *group_id,
+                               size_t group_id_len);
+void p2p_group_update_ies(struct p2p_group *group);
+struct wpabuf * p2p_group_get_wfd_ie(struct p2p_group *g);
 
 
 void p2p_buf_add_action_hdr(struct wpabuf *buf, u8 subtype, u8 dialog_token);
@@ -571,7 +631,7 @@ void p2p_buf_add_noa(struct wpabuf *buf, u8 noa_index, u8 opp_ps, u8 ctwindow,
 void p2p_buf_add_ext_listen_timing(struct wpabuf *buf, u16 period,
                                   u16 interval);
 void p2p_buf_add_p2p_interface(struct wpabuf *buf, struct p2p_data *p2p);
-void p2p_build_wps_ie(struct p2p_data *p2p, struct wpabuf *buf, u16 pw_id,
+void p2p_build_wps_ie(struct p2p_data *p2p, struct wpabuf *buf, int pw_id,
                      int all_attr);
 
 /* p2p_sd.c */
@@ -599,6 +659,9 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
 void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
                             const u8 *data, size_t len);
 int p2p_connect_send(struct p2p_data *p2p, struct p2p_device *dev);
+u16 p2p_wps_method_pw_id(enum p2p_wps_method wps_method);
+void p2p_reselect_channel(struct p2p_data *p2p,
+                         struct p2p_channels *intersection);
 
 /* p2p_pd.c */
 void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
@@ -606,7 +669,7 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
 void p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa,
                                const u8 *data, size_t len);
 int p2p_send_prov_disc_req(struct p2p_data *p2p, struct p2p_device *dev,
-                          int join);
+                          int join, int force_freq);
 void p2p_reset_pending_pd(struct p2p_data *p2p);
 
 /* p2p_invitation.c */
@@ -642,6 +705,9 @@ struct p2p_device * p2p_add_dev_from_go_neg_req(struct p2p_data *p2p,
                                                struct p2p_message *msg);
 void p2p_add_dev_info(struct p2p_data *p2p, const u8 *addr,
                      struct p2p_device *dev, struct p2p_message *msg);
+int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
+                  struct os_time *rx_time, int level, const u8 *ies,
+                  size_t ies_len, int scan_res);
 struct p2p_device * p2p_get_device(struct p2p_data *p2p, const u8 *addr);
 struct p2p_device * p2p_get_device_interface(struct p2p_data *p2p,
                                             const u8 *addr);
@@ -656,5 +722,14 @@ void p2p_build_ssid(struct p2p_data *p2p, u8 *ssid, size_t *ssid_len);
 int p2p_send_action(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
                    const u8 *src, const u8 *bssid, const u8 *buf,
                    size_t len, unsigned int wait_time);
+void p2p_stop_listen_for_freq(struct p2p_data *p2p, int freq);
+int p2p_prepare_channel(struct p2p_data *p2p, struct p2p_device *dev,
+                       unsigned int force_freq, unsigned int pref_freq);
+void p2p_dbg(struct p2p_data *p2p, const char *fmt, ...)
+PRINTF_FORMAT(2, 3);
+void p2p_info(struct p2p_data *p2p, const char *fmt, ...)
+PRINTF_FORMAT(2, 3);
+void p2p_err(struct p2p_data *p2p, const char *fmt, ...)
+PRINTF_FORMAT(2, 3);
 
 #endif /* P2P_I_H */