wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
p2p_i.h
Go to the documentation of this file.
1 
5 #ifndef P2P_I_H
6 #define P2P_I_H
7 
8 #include "utils/list.h"
9 #include "p2p.h"
10 
11 #define P2P_GO_NEG_CNF_MAX_RETRY_COUNT 1
12 
13 /*
14  * A threshold (in seconds) to prefer a direct Probe Response frame from a P2P
15  * Device over the P2P Client Info received from a GO.
16  */
17 #define P2P_DEV_GROUP_CLIENT_RESP_THRESHOLD 1
18 
19 enum p2p_role_indication;
20 
21 /*
22  * To force Service Instances to fit within a single P2P Tag, MAX_SVC_ADV_LEN
23  * must equal 248 or less. Must have a minimum size of 19.
24  */
25 #define MAX_SVC_ADV_LEN 600
26 #define MAX_SVC_ADV_IE_LEN (9 + MAX_SVC_ADV_LEN + (5 * (MAX_SVC_ADV_LEN / 240)))
27 
28 enum p2p_go_state {
29  UNKNOWN_GO,
30  LOCAL_GO,
31  REMOTE_GO
32 };
33 
38 struct p2p_device {
39  struct dl_list list;
40  struct os_reltime last_seen;
41  int listen_freq;
42  int oob_go_neg_freq;
43  enum p2p_wps_method wps_method;
44  u16 oob_pw_id;
45 
46  struct p2p_peer_info info;
47 
48  /*
49  * If the peer was discovered based on an interface address (e.g., GO
50  * from Beacon/Probe Response), the interface address is stored here.
51  * p2p_device_addr must still be set in such a case to the unique
52  * identifier for the P2P Device.
53  *
54  * This field is also used during P2PS PD to store the intended GO
55  * address of the peer.
56  */
57  u8 interface_addr[ETH_ALEN];
58 
59  /*
60  * P2P Device Address of the GO in whose group this P2P Device is a
61  * client.
62  */
63  u8 member_in_go_dev[ETH_ALEN];
64 
65  /*
66  * P2P Interface Address of the GO in whose group this P2P Device is a
67  * client.
68  */
69  u8 member_in_go_iface[ETH_ALEN];
70 
71  int go_neg_req_sent;
72  enum p2p_go_state go_state;
73  u8 dialog_token;
74  u8 tie_breaker;
75  u8 intended_addr[ETH_ALEN];
76 
77  char country[3];
78  struct p2p_channels channels;
79  int oper_freq;
80  u8 oper_ssid[SSID_MAX_LEN];
81  size_t oper_ssid_len;
82 
88 
97 
98 #define P2P_DEV_PROBE_REQ_ONLY BIT(0)
99 #define P2P_DEV_REPORTED BIT(1)
100 #define P2P_DEV_NOT_YET_READY BIT(2)
101 #define P2P_DEV_PD_PEER_DISPLAY BIT(5)
102 #define P2P_DEV_PD_PEER_KEYPAD BIT(6)
103 #define P2P_DEV_USER_REJECTED BIT(7)
104 #define P2P_DEV_PEER_WAITING_RESPONSE BIT(8)
105 #define P2P_DEV_PREFER_PERSISTENT_GROUP BIT(9)
106 #define P2P_DEV_WAIT_GO_NEG_RESPONSE BIT(10)
107 #define P2P_DEV_WAIT_GO_NEG_CONFIRM BIT(11)
108 #define P2P_DEV_GROUP_CLIENT_ONLY BIT(12)
109 #define P2P_DEV_FORCE_FREQ BIT(13)
110 #define P2P_DEV_PD_FOR_JOIN BIT(14)
111 #define P2P_DEV_REPORTED_ONCE BIT(15)
112 #define P2P_DEV_PREFER_PERSISTENT_RECONN BIT(16)
113 #define P2P_DEV_PD_BEFORE_GO_NEG BIT(17)
114 #define P2P_DEV_NO_PREF_CHAN BIT(18)
115 #define P2P_DEV_WAIT_INV_REQ_ACK BIT(19)
116 #define P2P_DEV_P2PS_REPORTED BIT(20)
117 #define P2P_DEV_PD_PEER_P2PS BIT(21)
118 #define P2P_DEV_LAST_SEEN_AS_GROUP_CLIENT BIT(22)
119 
120  unsigned int flags;
121 
122  int status; /* enum p2p_status_code */
123  unsigned int wait_count;
124  unsigned int connect_reqs;
125  unsigned int invitation_reqs;
126  unsigned int sd_reqs;
127 
128  u16 ext_listen_period;
129  u16 ext_listen_interval;
130 
131  u8 go_timeout;
132  u8 client_timeout;
133 
139 
145 
151 
152  int sd_pending_bcast_queries;
153 };
154 
155 struct p2p_sd_query {
156  struct p2p_sd_query *next;
157  u8 peer[ETH_ALEN];
158  int for_all_peers;
159  int wsd; /* Wi-Fi Display Service Discovery Request */
160  struct wpabuf *tlvs;
161 };
162 
164  unsigned int freq;
165  u8 dst[ETH_ALEN];
166  u8 src[ETH_ALEN];
167  u8 bssid[ETH_ALEN];
168  size_t len;
169  unsigned int wait_time;
170  /* Followed by len octets of the frame */
171 };
172 
177 struct p2p_data {
185  struct p2p_config *cfg;
186 
191  enum p2p_state {
197 
203 
209 
215 
221 
227 
233 
239 
245 
251 
257 
263 
269  } state;
270 
276 
282 
288 
293  struct dl_list devices;
294 
300 
306 
312 
313  const u8 *invite_go_dev_addr;
314  u8 invite_go_dev_addr_buf[ETH_ALEN];
315  int invite_dev_pw_id;
316 
317  unsigned int retry_invite_req:1;
318  unsigned int retry_invite_req_sent:1;
319 
325 
331 
337 
338  /* GO Negotiation data */
339 
349  u8 intended_addr[ETH_ALEN];
350 
356 
362 
367  u8 ssid[SSID_MAX_LEN];
368 
373  size_t ssid_len;
374 
379  int ssid_set;
380 
383 
389 
399 
400  struct wpa_freq_range_list no_go_freq;
401 
402  enum p2p_pending_action_state {
403  P2P_NO_PENDING_ACTION,
404  P2P_PENDING_GO_NEG_REQUEST,
405  P2P_PENDING_GO_NEG_RESPONSE,
406  P2P_PENDING_GO_NEG_RESPONSE_FAILURE,
407  P2P_PENDING_GO_NEG_CONFIRM,
408  P2P_PENDING_SD,
409  P2P_PENDING_PD,
410  P2P_PENDING_PD_RESPONSE,
411  P2P_PENDING_INVITATION_REQUEST,
412  P2P_PENDING_INVITATION_RESPONSE,
413  P2P_PENDING_DEV_DISC_REQUEST,
414  P2P_PENDING_DEV_DISC_RESPONSE,
415  P2P_PENDING_GO_DISC_REQ
416  } pending_action_state;
417 
418  unsigned int pending_listen_freq;
419  unsigned int pending_listen_sec;
420  unsigned int pending_listen_usec;
421 
422  u8 dev_capab;
423 
424  int in_listen;
425  int drv_in_listen;
426 
432 
438 
439  struct wpabuf *sd_resp; /* Fragmented SD response */
440  u8 sd_resp_addr[ETH_ALEN];
441  u8 sd_resp_dialog_token;
442  size_t sd_resp_pos; /* Offset in sd_resp */
443  u8 sd_frag_id;
444 
445  struct wpabuf *sd_rx_resp; /* Reassembled SD response */
446  u16 sd_rx_update_indic;
447 
448  /* P2P Invitation data */
449  enum p2p_invite_role inv_role;
450  u8 inv_bssid[ETH_ALEN];
451  int inv_bssid_set;
452  u8 inv_ssid[SSID_MAX_LEN];
453  size_t inv_ssid_len;
454  u8 inv_sa[ETH_ALEN];
455  u8 inv_group_bssid[ETH_ALEN];
456  u8 *inv_group_bssid_ptr;
457  u8 inv_go_dev_addr[ETH_ALEN];
458  u8 inv_status;
459  int inv_op_freq;
460  int inv_persistent;
461 
462  enum p2p_discovery_type find_type;
463  unsigned int last_p2p_find_timeout;
464  u8 last_prog_scan_class;
465  u8 last_prog_scan_chan;
466  int p2p_scan_running;
467  enum p2p_after_scan {
468  P2P_AFTER_SCAN_NOTHING,
469  P2P_AFTER_SCAN_LISTEN,
470  P2P_AFTER_SCAN_CONNECT
471  } start_after_scan;
472  u8 after_scan_peer[ETH_ALEN];
473  struct p2p_pending_action_tx *after_scan_tx;
474  unsigned int after_scan_tx_in_progress:1;
475  unsigned int send_action_in_progress:1;
476 
477  /* Requested device types for find/search */
478  unsigned int num_req_dev_types;
479  u8 *req_dev_types;
480  u8 *find_dev_id;
481  u8 find_dev_id_buf[ETH_ALEN];
482 
483  struct os_reltime find_start; /* time of last p2p_find start */
484 
485  struct p2p_group **groups;
486  size_t num_groups;
487 
488  struct p2p_device *pending_client_disc_go;
489  u8 pending_client_disc_addr[ETH_ALEN];
490  u8 pending_dev_disc_dialog_token;
491  u8 pending_dev_disc_addr[ETH_ALEN];
492  int pending_dev_disc_freq;
493  unsigned int pending_client_disc_freq;
494 
495  int ext_listen_only;
496  unsigned int ext_listen_period;
497  unsigned int ext_listen_interval;
498  unsigned int ext_listen_interval_sec;
499  unsigned int ext_listen_interval_usec;
500 
501  u8 peer_filter[ETH_ALEN];
502 
503  int cross_connect;
504 
505  int best_freq_24;
506  int best_freq_5;
507  int best_freq_overall;
508  int own_freq_preference;
509 
514  struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT];
515 
516  /*
517  * user_initiated_pd - Whether a PD request is user initiated or not.
518  */
519  u8 user_initiated_pd;
520 
521  /*
522  * Keep track of which peer a given PD request was sent to.
523  * Used to raise a timeout alert in case there is no response.
524  */
525  u8 pending_pd_devaddr[ETH_ALEN];
526 
527  /*
528  * Retry counter for provision discovery requests when issued
529  * in IDLE state.
530  */
531  int pd_retries;
532 
541 
542  u8 go_timeout;
543  u8 client_timeout;
544 
545  /* Extra delay in milliseconds between search iterations */
546  unsigned int search_delay;
547  int in_search_delay;
548 
549  u8 pending_reg_class;
550  u8 pending_channel;
551  u8 pending_channel_forced;
552 
553  /* ASP Support */
554  struct p2ps_advertisement *p2ps_adv_list;
555  struct p2ps_provision *p2ps_prov;
556  u8 wild_card_hash[P2PS_HASH_LEN];
557  u8 p2ps_seek;
558  u8 p2ps_seek_hash[P2P_MAX_QUERY_HASH * P2PS_HASH_LEN];
559  u8 p2ps_seek_count;
560 
561 #ifdef CONFIG_WIFI_DISPLAY
562  struct wpabuf *wfd_ie_beacon;
563  struct wpabuf *wfd_ie_probe_req;
564  struct wpabuf *wfd_ie_probe_resp;
565  struct wpabuf *wfd_ie_assoc_req;
566  struct wpabuf *wfd_ie_invitation;
567  struct wpabuf *wfd_ie_prov_disc_req;
568  struct wpabuf *wfd_ie_prov_disc_resp;
569  struct wpabuf *wfd_ie_go_neg;
570  struct wpabuf *wfd_dev_info;
571  struct wpabuf *wfd_assoc_bssid;
572  struct wpabuf *wfd_coupled_sink_info;
573 #endif /* CONFIG_WIFI_DISPLAY */
574 
575  u16 authorized_oob_dev_pw_id;
576 
577  struct wpabuf **vendor_elem;
578 
579  unsigned int pref_freq_list[P2P_MAX_PREF_CHANNELS];
580  unsigned int num_pref_freq;
581 };
582 
587 struct p2p_message {
588  struct wpabuf *p2p_attributes;
589  struct wpabuf *wps_attributes;
590  struct wpabuf *wfd_subelems;
591 
592  u8 dialog_token;
593 
594  const u8 *capability;
595  const u8 *go_intent;
596  const u8 *status;
597  const u8 *listen_channel;
598  const u8 *operating_channel;
599  const u8 *channel_list;
600  u8 channel_list_len;
601  const u8 *config_timeout;
602  const u8 *intended_addr;
603  const u8 *group_bssid;
604  const u8 *invitation_flags;
605 
606  const u8 *group_info;
607  size_t group_info_len;
608 
609  const u8 *group_id;
610  size_t group_id_len;
611 
612  const u8 *device_id;
613 
614  const u8 *manageability;
615 
616  const u8 *noa;
617  size_t noa_len;
618 
619  const u8 *ext_listen_timing;
620 
621  const u8 *minor_reason_code;
622 
623  const u8 *oob_go_neg_channel;
624 
625  /* P2P Device Info */
626  const u8 *p2p_device_info;
627  size_t p2p_device_info_len;
628  const u8 *p2p_device_addr;
629  const u8 *pri_dev_type;
630  u8 num_sec_dev_types;
631  char device_name[WPS_DEV_NAME_MAX_LEN + 1];
632  u16 config_methods;
633 
634  /* WPS IE */
635  u16 dev_password_id;
636  int dev_password_id_present;
637  u16 wps_config_methods;
638  const u8 *wps_pri_dev_type;
639  const u8 *wps_sec_dev_type_list;
640  size_t wps_sec_dev_type_list_len;
641  const u8 *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT];
642  size_t wps_vendor_ext_len[P2P_MAX_WPS_VENDOR_EXT];
643  const u8 *manufacturer;
644  size_t manufacturer_len;
645  const u8 *model_name;
646  size_t model_name_len;
647  const u8 *model_number;
648  size_t model_number_len;
649  const u8 *serial_number;
650  size_t serial_number_len;
651  const u8 *oob_dev_password;
652  size_t oob_dev_password_len;
653 
654  /* DS Parameter Set IE */
655  const u8 *ds_params;
656 
657  /* SSID IE */
658  const u8 *ssid;
659 
660  /* P2PS */
661  u8 service_hash_count;
662  const u8 *service_hash;
663 
664  const u8 *session_info;
665  size_t session_info_len;
666 
667  const u8 *conn_cap;
668 
669  const u8 *adv_id;
670  const u8 *adv_mac;
671 
672  const u8 *adv_service_instance;
673  size_t adv_service_instance_len;
674 
675  const u8 *session_id;
676  const u8 *session_mac;
677 
678  const u8 *feature_cap;
679  size_t feature_cap_len;
680 
681  const u8 *persistent_dev;
682  const u8 *persistent_ssid;
683  size_t persistent_ssid_len;
684 
685  const u8 *pref_freq_list;
686  size_t pref_freq_list_len;
687 };
688 
689 
690 #define P2P_MAX_GROUP_ENTRIES 50
691 
693  unsigned int num_clients;
695  const u8 *p2p_device_addr;
696  const u8 *p2p_interface_addr;
697  u8 dev_capab;
698  u16 config_methods;
699  const u8 *pri_dev_type;
700  u8 num_sec_dev_types;
701  const u8 *sec_dev_types;
702  const char *dev_name;
703  size_t dev_name_len;
704  } client[P2P_MAX_GROUP_ENTRIES];
705 };
706 
707 
708 /* p2p_utils.c */
709 int p2p_random(char *buf, size_t len);
710 int p2p_channel_to_freq(int op_class, int channel);
711 int p2p_freq_to_channel(unsigned int freq, u8 *op_class, u8 *channel);
712 void p2p_channels_intersect(const struct p2p_channels *a,
713  const struct p2p_channels *b,
714  struct p2p_channels *res);
716  const struct p2p_channels *b);
717 void p2p_channels_union(const struct p2p_channels *a,
718  const struct p2p_channels *b,
719  struct p2p_channels *res);
720 void p2p_channels_remove_freqs(struct p2p_channels *chan,
721  const struct wpa_freq_range_list *list);
722 int p2p_channels_includes(const struct p2p_channels *channels, u8 reg_class,
723  u8 channel);
724 void p2p_channels_dump(struct p2p_data *p2p, const char *title,
725  const struct p2p_channels *chan);
726 int p2p_channel_select(struct p2p_channels *chans, const int *classes,
727  u8 *op_class, u8 *op_channel);
728 int p2p_channel_random_social(struct p2p_channels *chans, u8 *op_class,
729  u8 *op_channel);
730 
731 /* p2p_parse.c */
732 int p2p_parse_p2p_ie(const struct wpabuf *buf, struct p2p_message *msg);
733 int p2p_parse_ies(const u8 *data, size_t len, struct p2p_message *msg);
734 int p2p_parse(const u8 *data, size_t len, struct p2p_message *msg);
735 int p2p_parse_ies_separate(const u8 *wsc, size_t wsc_len, const u8 *p2p,
736  size_t p2p_len, struct p2p_message *msg);
737 void p2p_parse_free(struct p2p_message *msg);
738 int p2p_attr_text(struct wpabuf *data, char *buf, char *end);
739 int p2p_group_info_parse(const u8 *gi, size_t gi_len,
740  struct p2p_group_info *info);
741 
742 /* p2p_build.c */
743 
744 struct p2p_noa_desc {
745  u8 count_type;
746  u32 duration;
747  u32 interval;
748  u32 start_time;
749 };
750 
751 /* p2p_group.c */
752 const u8 * p2p_group_get_interface_addr(struct p2p_group *group);
753 u8 p2p_group_presence_req(struct p2p_group *group,
754  const u8 *client_interface_addr,
755  const u8 *noa, size_t noa_len);
756 int p2p_group_is_group_id_match(struct p2p_group *group, const u8 *group_id,
757  size_t group_id_len);
758 void p2p_group_update_ies(struct p2p_group *group);
759 void p2p_group_force_beacon_update_ies(struct p2p_group *group);
760 struct wpabuf * p2p_group_get_wfd_ie(struct p2p_group *g);
761 void p2p_buf_add_group_info(struct p2p_group *group, struct wpabuf *buf,
762  int max_clients);
763 void p2p_group_buf_add_id(struct p2p_group *group, struct wpabuf *buf);
764 int p2p_group_get_freq(struct p2p_group *group);
765 
766 
767 void p2p_buf_add_action_hdr(struct wpabuf *buf, u8 subtype, u8 dialog_token);
768 void p2p_buf_add_public_action_hdr(struct wpabuf *buf, u8 subtype,
769  u8 dialog_token);
770 u8 * p2p_buf_add_ie_hdr(struct wpabuf *buf);
771 void p2p_buf_add_status(struct wpabuf *buf, u8 status);
772 void p2p_buf_add_device_info(struct wpabuf *buf, struct p2p_data *p2p,
773  struct p2p_device *peer);
774 void p2p_buf_add_device_id(struct wpabuf *buf, const u8 *dev_addr);
775 void p2p_buf_update_ie_hdr(struct wpabuf *buf, u8 *len);
776 void p2p_buf_add_capability(struct wpabuf *buf, u8 dev_capab, u8 group_capab);
777 void p2p_buf_add_go_intent(struct wpabuf *buf, u8 go_intent);
778 void p2p_buf_add_listen_channel(struct wpabuf *buf, const char *country,
779  u8 reg_class, u8 channel);
780 void p2p_buf_add_operating_channel(struct wpabuf *buf, const char *country,
781  u8 reg_class, u8 channel);
782 void p2p_buf_add_channel_list(struct wpabuf *buf, const char *country,
783  struct p2p_channels *chan);
784 void p2p_buf_add_config_timeout(struct wpabuf *buf, u8 go_timeout,
785  u8 client_timeout);
786 void p2p_buf_add_intended_addr(struct wpabuf *buf, const u8 *interface_addr);
787 void p2p_buf_add_group_bssid(struct wpabuf *buf, const u8 *bssid);
788 void p2p_buf_add_group_id(struct wpabuf *buf, const u8 *dev_addr,
789  const u8 *ssid, size_t ssid_len);
790 void p2p_buf_add_invitation_flags(struct wpabuf *buf, u8 flags);
791 void p2p_buf_add_noa(struct wpabuf *buf, u8 noa_index, u8 opp_ps, u8 ctwindow,
792  struct p2p_noa_desc *desc1, struct p2p_noa_desc *desc2);
793 void p2p_buf_add_ext_listen_timing(struct wpabuf *buf, u16 period,
794  u16 interval);
795 void p2p_buf_add_p2p_interface(struct wpabuf *buf, struct p2p_data *p2p);
796 void p2p_buf_add_oob_go_neg_channel(struct wpabuf *buf, const char *country,
797  u8 oper_class, u8 channel,
798  enum p2p_role_indication role);
799 void p2p_buf_add_service_hash(struct wpabuf *buf, struct p2p_data *p2p);
800 void p2p_buf_add_session_info(struct wpabuf *buf, const char *info);
801 void p2p_buf_add_connection_capability(struct wpabuf *buf, u8 connection_cap);
802 void p2p_buf_add_advertisement_id(struct wpabuf *buf, u32 id, const u8 *mac);
803 void p2p_buf_add_service_instance(struct wpabuf *buf, struct p2p_data *p2p,
804  u8 count, const u8 *hash,
805  struct p2ps_advertisement *adv_list);
806 void p2p_buf_add_session_id(struct wpabuf *buf, u32 id, const u8 *mac);
807 void p2p_buf_add_feature_capability(struct wpabuf *buf, u16 len,
808  const u8 *mask);
809 void p2p_buf_add_persistent_group_info(struct wpabuf *buf, const u8 *dev_addr,
810  const u8 *ssid, size_t ssid_len);
811 int p2p_build_wps_ie(struct p2p_data *p2p, struct wpabuf *buf, int pw_id,
812  int all_attr);
813 void p2p_buf_add_pref_channel_list(struct wpabuf *buf,
814  const u32 *preferred_freq_list, u32 size);
815 
816 /* p2p_sd.c */
817 struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
818  struct p2p_device *dev);
819 void p2p_free_sd_queries(struct p2p_data *p2p);
820 void p2p_rx_gas_initial_req(struct p2p_data *p2p, const u8 *sa,
821  const u8 *data, size_t len, int rx_freq);
822 void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
823  const u8 *data, size_t len, int rx_freq);
824 void p2p_rx_gas_comeback_req(struct p2p_data *p2p, const u8 *sa,
825  const u8 *data, size_t len, int rx_freq);
826 void p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
827  const u8 *data, size_t len, int rx_freq);
828 int p2p_start_sd(struct p2p_data *p2p, struct p2p_device *dev);
829 
830 /* p2p_go_neg.c */
831 int p2p_peer_channels_check(struct p2p_data *p2p, struct p2p_channels *own,
832  struct p2p_device *dev,
833  const u8 *channel_list, size_t channel_list_len);
834 void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
835  const u8 *data, size_t len, int rx_freq);
836 void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
837  const u8 *data, size_t len, int rx_freq);
838 void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
839  const u8 *data, size_t len);
840 int p2p_connect_send(struct p2p_data *p2p, struct p2p_device *dev);
841 u16 p2p_wps_method_pw_id(enum p2p_wps_method wps_method);
842 void p2p_reselect_channel(struct p2p_data *p2p,
843  struct p2p_channels *intersection);
844 void p2p_check_pref_chan(struct p2p_data *p2p, int go,
845  struct p2p_device *dev, struct p2p_message *msg);
846 
847 /* p2p_pd.c */
848 void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
849  const u8 *data, size_t len, int rx_freq);
850 void p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa,
851  const u8 *data, size_t len);
852 int p2p_send_prov_disc_req(struct p2p_data *p2p, struct p2p_device *dev,
853  int join, int force_freq);
854 void p2p_reset_pending_pd(struct p2p_data *p2p);
855 void p2ps_prov_free(struct p2p_data *p2p);
856 
857 /* p2p_invitation.c */
858 void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
859  const u8 *data, size_t len, int rx_freq);
860 void p2p_process_invitation_resp(struct p2p_data *p2p, const u8 *sa,
861  const u8 *data, size_t len);
862 int p2p_invite_send(struct p2p_data *p2p, struct p2p_device *dev,
863  const u8 *go_dev_addr, int dev_pw_id);
864 void p2p_invitation_req_cb(struct p2p_data *p2p, int success);
865 void p2p_invitation_resp_cb(struct p2p_data *p2p, int success);
866 
867 /* p2p_dev_disc.c */
868 void p2p_process_dev_disc_req(struct p2p_data *p2p, const u8 *sa,
869  const u8 *data, size_t len, int rx_freq);
870 void p2p_dev_disc_req_cb(struct p2p_data *p2p, int success);
871 int p2p_send_dev_disc_req(struct p2p_data *p2p, struct p2p_device *dev);
872 void p2p_dev_disc_resp_cb(struct p2p_data *p2p, int success);
873 void p2p_process_dev_disc_resp(struct p2p_data *p2p, const u8 *sa,
874  const u8 *data, size_t len);
875 void p2p_go_disc_req_cb(struct p2p_data *p2p, int success);
876 void p2p_process_go_disc_req(struct p2p_data *p2p, const u8 *da, const u8 *sa,
877  const u8 *data, size_t len, int rx_freq);
878 
879 /* p2p.c */
880 void p2p_set_state(struct p2p_data *p2p, int new_state);
881 void p2p_set_timeout(struct p2p_data *p2p, unsigned int sec,
882  unsigned int usec);
883 void p2p_clear_timeout(struct p2p_data *p2p);
884 void p2p_continue_find(struct p2p_data *p2p);
885 struct p2p_device * p2p_add_dev_from_go_neg_req(struct p2p_data *p2p,
886  const u8 *addr,
887  struct p2p_message *msg);
888 void p2p_add_dev_info(struct p2p_data *p2p, const u8 *addr,
889  struct p2p_device *dev, struct p2p_message *msg);
890 int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
891  struct os_reltime *rx_time, int level, const u8 *ies,
892  size_t ies_len, int scan_res);
893 struct p2p_device * p2p_get_device(struct p2p_data *p2p, const u8 *addr);
894 struct p2p_device * p2p_get_device_interface(struct p2p_data *p2p,
895  const u8 *addr);
896 void p2p_go_neg_failed(struct p2p_data *p2p, int status);
897 void p2p_go_complete(struct p2p_data *p2p, struct p2p_device *peer);
898 int p2p_match_dev_type(struct p2p_data *p2p, struct wpabuf *wps);
899 int dev_type_list_match(const u8 *dev_type, const u8 *req_dev_type[],
900  size_t num_req_dev_type);
901 struct wpabuf * p2p_build_probe_resp_ies(struct p2p_data *p2p,
902  const u8 *query_hash,
903  u8 query_count);
904 void p2p_build_ssid(struct p2p_data *p2p, u8 *ssid, size_t *ssid_len);
905 int p2p_send_action(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
906  const u8 *src, const u8 *bssid, const u8 *buf,
907  size_t len, unsigned int wait_time);
908 void p2p_stop_listen_for_freq(struct p2p_data *p2p, int freq);
909 int p2p_prepare_channel(struct p2p_data *p2p, struct p2p_device *dev,
910  unsigned int force_freq, unsigned int pref_freq,
911  int go);
912 void p2p_go_neg_wait_timeout(void *eloop_ctx, void *timeout_ctx);
913 int p2p_go_select_channel(struct p2p_data *p2p, struct p2p_device *dev,
914  u8 *status);
915 void p2p_dbg(struct p2p_data *p2p, const char *fmt, ...)
916 PRINTF_FORMAT(2, 3);
917 void p2p_info(struct p2p_data *p2p, const char *fmt, ...)
918 PRINTF_FORMAT(2, 3);
919 void p2p_err(struct p2p_data *p2p, const char *fmt, ...)
920 PRINTF_FORMAT(2, 3);
921 
922 #endif /* P2P_I_H */
struct p2p_device * go_neg_peer
Pointer to GO Negotiation peer.
Definition: p2p_i.h:299
int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, struct os_reltime *rx_time, int level, const u8 *ies, size_t ies_len, int scan_res)
Add peer entries based on scan results or P2P frames.
Definition: p2p.c:700
Definition: p2p_i.h:163
int p2p_attr_text(struct wpabuf *data, char *buf, char *end)
Build text format description of P2P IE attributes.
Definition: p2p_parse.c:769
int max_disc_tu
Maximum number of TUs for discoverable interval.
Definition: p2p_i.h:287
Waiting peer in List for GO Neg.
Definition: p2p_i.h:232
Provisioning (during group formation)
Definition: p2p_i.h:250
Parsed P2P message (or P2P IE)
Definition: p2p_i.h:587
struct wpabuf * wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT]
WPS Vendor Extensions to add.
Definition: p2p_i.h:514
struct p2p_device * invite_peer
Pointer to Invite peer.
Definition: p2p_i.h:305
void p2p_parse_free(struct p2p_message *msg)
Free temporary data from P2P parsing.
Definition: p2p_parse.c:610
struct p2p_sd_query * sd_query
Pointer to Service Discovery query.
Definition: p2p_i.h:330
int p2p_channels_includes(const struct p2p_channels *channels, u8 reg_class, u8 channel)
Check whether a channel is included in the list.
Definition: p2p_utils.c:250
size_t ssid_len
ssid length in octets
Definition: p2p_i.h:373
int p2p_match_dev_type(struct p2p_data *p2p, struct wpabuf *wps)
Match local device type with requested type.
Definition: p2p.c:2122
P2P configuration.
Definition: p2p.h:470
int p2p_random(char *buf, size_t len)
Generate random string for SSID and passphrase.
Definition: p2p_utils.c:22
u8 go_neg_conf_sent
Number of GO Negotiation Confirmation retries.
Definition: p2p_i.h:138
Trying to start GO Negotiation.
Definition: p2p_i.h:208
P2P peer information.
Definition: p2p.h:344
void p2p_reselect_channel(struct p2p_data *p2p, struct p2p_channels *intersection)
Re-select operating channel based on peer information.
Definition: p2p_go_neg.c:374
u8 op_reg_class
Regulatory class for own operational channel.
Definition: p2p_i.h:382
Search (Device Discovery)
Definition: p2p_i.h:202
Provision Discovery during find.
Definition: p2p_i.h:256
void p2p_channels_union(const struct p2p_channels *a, const struct p2p_channels *b, struct p2p_channels *res)
Union of channel lists.
Definition: p2p_utils.c:198
int go_neg_conf_freq
Frquency on which the GO Negotiation Confirmation is sent.
Definition: p2p_i.h:144
void p2p_channels_intersect(const struct p2p_channels *a, const struct p2p_channels *b, struct p2p_channels *res)
Intersection of supported channel lists.
Definition: p2p_utils.c:107
Definition: wpabuf.h:16
struct p2p_channels channels
Own supported regulatory classes and channels.
Definition: p2p_i.h:398
u8 op_channel
Own operational channel.
Definition: p2p_i.h:388
int p2p_prepare_channel(struct p2p_data *p2p, struct p2p_device *dev, unsigned int force_freq, unsigned int pref_freq, int go)
Select operating channel for GO Negotiation.
Definition: p2p.c:1471
int min_disc_int
minDiscoverableInterval
Definition: p2p_i.h:275
Wi-Fi Direct - P2P module.
struct p2p_device * p2p_get_device_interface(struct p2p_data *p2p, const u8 *addr)
Fetch a peer entry based on P2P Interface Address.
Definition: p2p.c:388
struct p2p_device * p2p_get_device(struct p2p_data *p2p, const u8 *addr)
Fetch a peer entry.
Definition: p2p.c:371
struct p2p_device * sd_peer
Pointer to Service Discovery peer.
Definition: p2p_i.h:324
Trying to start Invite.
Definition: p2p_i.h:262
Definition: common.h:501
struct p2p_config * cfg
P2P module configuration.
Definition: p2p_i.h:185
void p2p_channels_union_inplace(struct p2p_channels *res, const struct p2p_channels *b)
Inplace union of channel lists.
Definition: p2p_utils.c:158
Listen during Invite.
Definition: p2p_i.h:268
Definition: p2p.h:182
struct p2p_device * last_p2p_find_oper
Pointer to last pre-find operation peer.
Definition: p2p_i.h:311
Definition: os.h:22
P2P Device data (internal to P2P module)
Definition: p2p_i.h:38
List of supported channels.
Definition: p2p.h:44
Idle.
Definition: p2p_i.h:196
Doubly-linked list.
u8 intended_addr[ETH_ALEN]
Local Intended P2P Interface Address.
Definition: p2p_i.h:349
P2P module data (internal to P2P module)
Definition: p2p_i.h:177
Waiting peer idle for GO Neg.
Definition: p2p_i.h:238
In GO Negotiation.
Definition: p2p_i.h:220
p2p_state
The current P2P state.
Definition: p2p_i.h:191
Listen during GO Negotiation start.
Definition: p2p_i.h:214
Doubly-linked list.
Definition: list.h:12
int max_disc_int
maxDiscoverableInterval
Definition: p2p_i.h:281
u8 ssid[SSID_MAX_LEN]
Selected SSID for GO Negotiation (if local end will be GO)
Definition: p2p_i.h:367
Definition: p2p_i.h:155
#define P2P_MAX_PREF_CHANNELS
Maximum number of preferred channels.
Definition: p2p.h:26
Definition: p2p.h:263
int p2p_parse_p2p_ie(const struct wpabuf *buf, struct p2p_message *msg)
Parse P2P IE.
Definition: p2p_parse.c:405
int ssid_set
Whether SSID is already set for GO Negotiation.
Definition: p2p_i.h:379
int p2p_freq_to_channel(unsigned int freq, u8 *op_class, u8 *channel)
Convert frequency into channel info.
Definition: p2p_utils.c:65
u8 next_tie_breaker
Next tie-breaker value to use in GO Negotiation.
Definition: p2p_i.h:361
u16 srv_update_indic
Service Update Indicator for local services.
Definition: p2p_i.h:437
Definition: p2p_i.h:694
Service Discovery during find.
Definition: p2p_i.h:244
struct p2p_sd_query * sd_queries
Pending service discovery queries.
Definition: p2p_i.h:431
int p2p_channel_to_freq(int op_class, int channel)
Convert channel info to frequency.
Definition: p2p_utils.c:53
u16 req_config_methods
Pending provision discovery methods.
Definition: p2p_i.h:87
struct wpabuf * go_neg_conf
GO Negotiation Confirmation frame.
Definition: p2p_i.h:150
int p2p_parse(const u8 *data, size_t len, struct p2p_message *msg)
Parse a P2P Action frame contents.
Definition: p2p_parse.c:564
Internal P2P module per-group data.
Definition: p2p_group.c:31
int pd_force_freq
Forced frequency for PD retries or 0 to auto-select.
Definition: p2p_i.h:540
u16 wps_prov_info
Stored provisioning WPS config method.
Definition: p2p_i.h:96
Definition: p2p_i.h:692
u8 go_intent
Local GO Intent to be used during GO Negotiation.
Definition: p2p_i.h:355
int num_p2p_sd_queries
Total number of broadcast SD queries present in the list.
Definition: p2p_i.h:336
struct dl_list devices
List of known P2P Device peers.
Definition: p2p_i.h:293
Definition: p2p_i.h:744
int p2p_parse_ies(const u8 *data, size_t len, struct p2p_message *msg)
Parse P2P message IEs (both WPS and P2P IE)
Definition: p2p_parse.c:510
Listen only.
Definition: p2p_i.h:226