p2p_i.h revision 04949598a23f501be6eec21697465fd46a28840a
18d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/*
28d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * P2P - Internal definitions for P2P module
38d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Copyright (c) 2009-2010, Atheros Communications
48d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
5c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * This software may be distributed under the terms of the BSD license.
6c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * See README for more details.
78d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
88d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
98d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifndef P2P_I_H
108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_I_H
118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "utils/list.h"
138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "p2p.h"
148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_go_state {
168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	UNKNOWN_GO,
178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	LOCAL_GO,
188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	REMOTE_GO
198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_device - P2P Device data (internal to P2P module)
238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_device {
258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct dl_list list;
268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct os_time last_seen;
278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int listen_freq;
288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	enum p2p_wps_method wps_method;
298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_peer_info info;
318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/*
338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * If the peer was discovered based on an interface address (e.g., GO
348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * from Beacon/Probe Response), the interface address is stored here.
358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * p2p_device_addr must still be set in such a case to the unique
368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * identifier for the P2P Device.
378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 interface_addr[ETH_ALEN];
398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/*
418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * P2P Device Address of the GO in whose group this P2P Device is a
428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * client.
438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 member_in_go_dev[ETH_ALEN];
458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/*
478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * P2P Interface Address of the GO in whose group this P2P Device is a
488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * client.
498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 member_in_go_iface[ETH_ALEN];
518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int go_neg_req_sent;
538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	enum p2p_go_state go_state;
548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 dialog_token;
558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 intended_addr[ETH_ALEN];
568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	char country[3];
588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_channels channels;
598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int oper_freq;
608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 oper_ssid[32];
618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t oper_ssid_len;
628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
641f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 * req_config_methods - Pending provision discovery methods
658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u16 req_config_methods;
678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	/**
691f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 * wps_prov_info - Stored provisioning WPS config method
701f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 *
711f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 * This is used to store pending WPS config method between Provisioning
721f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 * Discovery and connection to a running group.
731f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 */
741f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	u16 wps_prov_info;
751f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt
768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_PROBE_REQ_ONLY BIT(0)
778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_REPORTED BIT(1)
788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_NOT_YET_READY BIT(2)
798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_SD_INFO BIT(3)
808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_SD_SCHEDULE BIT(4)
818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_PD_PEER_DISPLAY BIT(5)
828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_PD_PEER_KEYPAD BIT(6)
838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_USER_REJECTED BIT(7)
848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_PEER_WAITING_RESPONSE BIT(8)
858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_PREFER_PERSISTENT_GROUP BIT(9)
868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_WAIT_GO_NEG_RESPONSE BIT(10)
878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_WAIT_GO_NEG_CONFIRM BIT(11)
888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_GROUP_CLIENT_ONLY BIT(12)
898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_FORCE_FREQ BIT(13)
908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_PD_FOR_JOIN BIT(14)
918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_DEV_REPORTED_ONCE BIT(15)
921f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt#define P2P_DEV_PREFER_PERSISTENT_RECONN BIT(16)
9304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define P2P_DEV_PD_BEFORE_GO_NEG BIT(17)
948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int flags;
958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int status; /* enum p2p_status_code */
978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int wait_count;
988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int connect_reqs;
998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int invitation_reqs;
1008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u16 ext_listen_period;
1028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u16 ext_listen_interval;
1038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 go_timeout;
1058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 client_timeout;
1068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
1078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_sd_query {
1098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_sd_query *next;
1108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 peer[ETH_ALEN];
1118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int for_all_peers;
1128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpabuf *tlvs;
1138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
1148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_pending_action_tx {
1168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int freq;
1178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 dst[ETH_ALEN];
1188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 src[ETH_ALEN];
1198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 bssid[ETH_ALEN];
1208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t len;
1218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int wait_time;
1228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* Followed by len octets of the frame */
1238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
1248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
1268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_data - P2P module data (internal to P2P module)
1278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
1288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_data {
1298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
1308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * cfg - P2P module configuration
1318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 *
1328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * This is included in the same memory allocation with the
1338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * struct p2p_data and as such, must not be freed separately.
1348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
1358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_config *cfg;
1368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
1388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * state - The current P2P state
1398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
1408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	enum p2p_state {
1418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
1428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * P2P_IDLE - Idle
1438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
1448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_IDLE,
1458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
1478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * P2P_SEARCH - Search (Device Discovery)
1488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
1498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_SEARCH,
1508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
1528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * P2P_CONNECT - Trying to start GO Negotiation
1538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
1548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_CONNECT,
1558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
1578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * P2P_CONNECT_LISTEN - Listen during GO Negotiation start
1588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
1598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_CONNECT_LISTEN,
1608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
1628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * P2P_GO_NEG - In GO Negotiation
1638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
1648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_GO_NEG,
1658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
1678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * P2P_LISTEN_ONLY - Listen only
1688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
1698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_LISTEN_ONLY,
1708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
1728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * P2P_WAIT_PEER_CONNECT - Waiting peer in List for GO Neg
1738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
1748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_WAIT_PEER_CONNECT,
1758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
1778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * P2P_WAIT_PEER_IDLE - Waiting peer idle for GO Neg
1788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
1798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_WAIT_PEER_IDLE,
1808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
1828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * P2P_SD_DURING_FIND - Service Discovery during find
1838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
1848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_SD_DURING_FIND,
1858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
1878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * P2P_PROVISIONING - Provisioning (during group formation)
1888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
1898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_PROVISIONING,
1908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
1928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * P2P_PD_DURING_FIND - Provision Discovery during find
1938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
1948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_PD_DURING_FIND,
1958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
1978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * P2P_INVITE - Trying to start Invite
1988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
1998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_INVITE,
2008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
2028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * P2P_INVITE_LISTEN - Listen during Invite
2038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
2048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_INVITE_LISTEN,
2051f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt
2061f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt		/**
2071f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt		 * P2P_SEARCH_WHEN_READY - Waiting to start Search
2081f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt		 */
2091f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt		P2P_SEARCH_WHEN_READY,
2108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	} state;
2118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * min_disc_int - minDiscoverableInterval
2148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int min_disc_int;
2168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * max_disc_int - maxDiscoverableInterval
2198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int max_disc_int;
2218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * devices - List of known P2P Device peers
2248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct dl_list devices;
2268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
227f44b9c4a18d17fbd39901f76a014c32006570fb8Irfan Sheriff#ifdef ANDROID_P2P
228f44b9c4a18d17fbd39901f76a014c32006570fb8Irfan Sheriff	/**
229f44b9c4a18d17fbd39901f76a014c32006570fb8Irfan Sheriff	 * sd_dev_list - device pointer to be serviced next
230f44b9c4a18d17fbd39901f76a014c32006570fb8Irfan Sheriff	 * for service discovery
231f44b9c4a18d17fbd39901f76a014c32006570fb8Irfan Sheriff	 */
232f44b9c4a18d17fbd39901f76a014c32006570fb8Irfan Sheriff	struct dl_list *sd_dev_list;
233f44b9c4a18d17fbd39901f76a014c32006570fb8Irfan Sheriff#endif
234f44b9c4a18d17fbd39901f76a014c32006570fb8Irfan Sheriff
2358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * go_neg_peer - Pointer to GO Negotiation peer
2378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_device *go_neg_peer;
2398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * invite_peer - Pointer to Invite peer
2428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_device *invite_peer;
2448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *invite_go_dev_addr;
2468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 invite_go_dev_addr_buf[ETH_ALEN];
2478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * sd_peer - Pointer to Service Discovery peer
2508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_device *sd_peer;
2528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * sd_query - Pointer to Service Discovery query
2558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_sd_query *sd_query;
2578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* GO Negotiation data */
2598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * intended_addr - Local Intended P2P Interface Address
2628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 *
2638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * This address is used during group owner negotiation as the Intended
2648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * P2P Interface Address and the group interface will be created with
2658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * address as the local address in case of successfully completed
2668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * negotiation.
2678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 intended_addr[ETH_ALEN];
2698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * go_intent - Local GO Intent to be used during GO Negotiation
2728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 go_intent;
2748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * next_tie_breaker - Next tie-breaker value to use in GO Negotiation
2778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 next_tie_breaker;
2798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * ssid - Selected SSID for GO Negotiation (if local end will be GO)
2828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 ssid[32];
2848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * ssid_len - ssid length in octets
2878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t ssid_len;
2898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2911f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 * ssid_set - Whether SSID is already set for GO Negotiation
2921f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 */
2931f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	int ssid_set;
2941f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt
2951f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	/**
2968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * Regulatory class for own operational channel
2978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 op_reg_class;
2998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
3018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * op_channel - Own operational channel
3028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
3038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 op_channel;
3048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
3068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * channels - Own supported regulatory classes and channels
3078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 *
3088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * List of supposerted channels per regulatory class. The regulatory
3098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * classes are defined in IEEE Std 802.11-2007 Annex J and the
3108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * numbering of the clases depends on the configured country code.
3118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
3128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_channels channels;
3138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	enum p2p_pending_action_state {
3158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_NO_PENDING_ACTION,
3168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_PENDING_GO_NEG_REQUEST,
3178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_PENDING_GO_NEG_RESPONSE,
3188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_PENDING_GO_NEG_RESPONSE_FAILURE,
3198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_PENDING_GO_NEG_CONFIRM,
3208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_PENDING_SD,
3218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_PENDING_PD,
3228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_PENDING_INVITATION_REQUEST,
3238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_PENDING_INVITATION_RESPONSE,
3248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_PENDING_DEV_DISC_REQUEST,
3258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_PENDING_DEV_DISC_RESPONSE,
3268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_PENDING_GO_DISC_REQ
3278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	} pending_action_state;
3288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int pending_listen_freq;
3308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int pending_listen_sec;
3318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int pending_listen_usec;
3328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 dev_capab;
3348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int in_listen;
3368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int drv_in_listen;
3378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
3398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * sd_queries - Pending service discovery queries
3408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
3418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_sd_query *sd_queries;
3428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
3448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * srv_update_indic - Service Update Indicator for local services
3458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
3468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u16 srv_update_indic;
3478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpabuf *sd_resp; /* Fragmented SD response */
3498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 sd_resp_addr[ETH_ALEN];
3508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 sd_resp_dialog_token;
3518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t sd_resp_pos; /* Offset in sd_resp */
3528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 sd_frag_id;
3538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpabuf *sd_rx_resp; /* Reassembled SD response */
3558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u16 sd_rx_update_indic;
3568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* P2P Invitation data */
3588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	enum p2p_invite_role inv_role;
3598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 inv_bssid[ETH_ALEN];
3608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int inv_bssid_set;
3618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 inv_ssid[32];
3628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t inv_ssid_len;
3638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 inv_sa[ETH_ALEN];
3648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 inv_group_bssid[ETH_ALEN];
3658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 *inv_group_bssid_ptr;
3668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 inv_go_dev_addr[ETH_ALEN];
3678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 inv_status;
3688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int inv_op_freq;
3698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int inv_persistent;
3708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	enum p2p_discovery_type find_type;
3721f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	unsigned int last_p2p_find_timeout;
3738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 last_prog_scan_class;
3748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 last_prog_scan_chan;
3758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int p2p_scan_running;
3768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	enum p2p_after_scan {
3778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_AFTER_SCAN_NOTHING,
3788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_AFTER_SCAN_LISTEN,
3798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		P2P_AFTER_SCAN_CONNECT
3808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	} start_after_scan;
3818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 after_scan_peer[ETH_ALEN];
3828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_pending_action_tx *after_scan_tx;
3838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* Requested device types for find/search */
3858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int num_req_dev_types;
3868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 *req_dev_types;
387c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt	u8 *find_dev_id;
388c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt	u8 find_dev_id_buf[ETH_ALEN];
3898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_group **groups;
3918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t num_groups;
3928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_device *pending_client_disc_go;
3948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 pending_client_disc_addr[ETH_ALEN];
3958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 pending_dev_disc_dialog_token;
3968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 pending_dev_disc_addr[ETH_ALEN];
3978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int pending_dev_disc_freq;
3988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int pending_client_disc_freq;
3998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int ext_listen_only;
4018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int ext_listen_period;
4028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int ext_listen_interval;
4038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int ext_listen_interval_sec;
4048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int ext_listen_interval_usec;
4058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 peer_filter[ETH_ALEN];
4078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int cross_connect;
4098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int best_freq_24;
4118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int best_freq_5;
4128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int best_freq_overall;
4138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
4158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * wps_vendor_ext - WPS Vendor Extensions to add
4168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
4178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT];
41875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
41975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	/*
42075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * user_initiated_pd - Whether a PD request is user initiated or not.
42175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 */
42275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	u8 user_initiated_pd;
42375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
42475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	/*
42575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * Keep track of which peer a given PD request was sent to.
42675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * Used to raise a timeout alert in case there is no response.
42775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 */
42875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	u8 pending_pd_devaddr[ETH_ALEN];
42975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
43075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	/*
43175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * Retry counter for provision discovery requests when issued
43275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * in IDLE state.
43375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 */
43475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	int pd_retries;
4358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
4368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
4388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_message - Parsed P2P message (or P2P IE)
4398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
4408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_message {
4418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpabuf *p2p_attributes;
4428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpabuf *wps_attributes;
4438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 dialog_token;
4458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *capability;
4478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *go_intent;
4488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *status;
4498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *listen_channel;
4508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *operating_channel;
4518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *channel_list;
4528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 channel_list_len;
4538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *config_timeout;
4548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *intended_addr;
4558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *group_bssid;
4568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *invitation_flags;
4578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *group_info;
4598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t group_info_len;
4608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *group_id;
4628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t group_id_len;
4638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *device_id;
4658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *manageability;
4678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *noa;
4698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t noa_len;
4708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *ext_listen_timing;
4728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *minor_reason_code;
4748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* P2P Device Info */
4768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *p2p_device_info;
4778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t p2p_device_info_len;
4788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *p2p_device_addr;
4798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *pri_dev_type;
4808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 num_sec_dev_types;
4818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	char device_name[33];
4828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u16 config_methods;
4838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* WPS IE */
4858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u16 dev_password_id;
4868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u16 wps_config_methods;
4878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *wps_pri_dev_type;
4888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *wps_sec_dev_type_list;
4898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t wps_sec_dev_type_list_len;
4908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT];
4918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t wps_vendor_ext_len[P2P_MAX_WPS_VENDOR_EXT];
4928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *manufacturer;
4938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t manufacturer_len;
4948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *model_name;
4958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t model_name_len;
4968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *model_number;
4978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t model_number_len;
4988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *serial_number;
4998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t serial_number_len;
5008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* DS Parameter Set IE */
5028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *ds_params;
5038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* SSID IE */
5058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *ssid;
5068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
5078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_MAX_GROUP_ENTRIES 50
5108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_group_info {
5128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int num_clients;
5138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_client_info {
5148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		const u8 *p2p_device_addr;
5158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		const u8 *p2p_interface_addr;
5168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		u8 dev_capab;
5178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		u16 config_methods;
5188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		const u8 *pri_dev_type;
5198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		u8 num_sec_dev_types;
5208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		const u8 *sec_dev_types;
5218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		const char *dev_name;
5228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		size_t dev_name_len;
5238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	} client[P2P_MAX_GROUP_ENTRIES];
5248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
5258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* p2p_utils.c */
5288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_random(char *buf, size_t len);
5298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_channel_to_freq(const char *country, int reg_class, int channel);
5308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_freq_to_channel(const char *country, unsigned int freq, u8 *reg_class,
5318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			u8 *channel);
5328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_channels_intersect(const struct p2p_channels *a,
5338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			    const struct p2p_channels *b,
5348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			    struct p2p_channels *res);
5358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_channels_includes(const struct p2p_channels *channels, u8 reg_class,
5368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			  u8 channel);
5378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* p2p_parse.c */
5398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_parse_p2p_ie(const struct wpabuf *buf, struct p2p_message *msg);
5408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_parse_ies(const u8 *data, size_t len, struct p2p_message *msg);
5418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_parse(const u8 *data, size_t len, struct p2p_message *msg);
5428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_parse_free(struct p2p_message *msg);
5438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_attr_text(struct wpabuf *data, char *buf, char *end);
5448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_group_info_parse(const u8 *gi, size_t gi_len,
5458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			 struct p2p_group_info *info);
5468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* p2p_build.c */
5488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_noa_desc {
5508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 count_type;
5518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u32 duration;
5528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u32 interval;
5538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u32 start_time;
5548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
5558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* p2p_group.c */
5578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtconst u8 * p2p_group_get_interface_addr(struct p2p_group *group);
5588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtu8 p2p_group_presence_req(struct p2p_group *group,
5598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			  const u8 *client_interface_addr,
5608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			  const u8 *noa, size_t noa_len);
56104949598a23f501be6eec21697465fd46a28840aDmitry Shmidtint p2p_group_is_group_id_match(struct p2p_group *group, const u8 *group_id,
56204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt				size_t group_id_len);
5638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_action_hdr(struct wpabuf *buf, u8 subtype, u8 dialog_token);
5668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_public_action_hdr(struct wpabuf *buf, u8 subtype,
5678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				   u8 dialog_token);
5688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtu8 * p2p_buf_add_ie_hdr(struct wpabuf *buf);
5698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_status(struct wpabuf *buf, u8 status);
5708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_device_info(struct wpabuf *buf, struct p2p_data *p2p,
5718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			     struct p2p_device *peer);
5728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_device_id(struct wpabuf *buf, const u8 *dev_addr);
5738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_update_ie_hdr(struct wpabuf *buf, u8 *len);
5748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_capability(struct wpabuf *buf, u8 dev_capab, u8 group_capab);
5758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_go_intent(struct wpabuf *buf, u8 go_intent);
5768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_listen_channel(struct wpabuf *buf, const char *country,
5778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				u8 reg_class, u8 channel);
5788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_operating_channel(struct wpabuf *buf, const char *country,
5798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				   u8 reg_class, u8 channel);
5808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_channel_list(struct wpabuf *buf, const char *country,
5818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			      struct p2p_channels *chan);
5828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_config_timeout(struct wpabuf *buf, u8 go_timeout,
5838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				u8 client_timeout);
5848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_intended_addr(struct wpabuf *buf, const u8 *interface_addr);
5858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_group_bssid(struct wpabuf *buf, const u8 *bssid);
5868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_group_id(struct wpabuf *buf, const u8 *dev_addr,
5878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			  const u8 *ssid, size_t ssid_len);
5888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_invitation_flags(struct wpabuf *buf, u8 flags);
5898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_noa(struct wpabuf *buf, u8 noa_index, u8 opp_ps, u8 ctwindow,
5908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		     struct p2p_noa_desc *desc1, struct p2p_noa_desc *desc2);
5918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_ext_listen_timing(struct wpabuf *buf, u16 period,
5928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				   u16 interval);
5938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_buf_add_p2p_interface(struct wpabuf *buf, struct p2p_data *p2p);
59404949598a23f501be6eec21697465fd46a28840aDmitry Shmidtvoid p2p_build_wps_ie(struct p2p_data *p2p, struct wpabuf *buf, int pw_id,
5958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		      int all_attr);
5968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* p2p_sd.c */
5988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
5998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					 struct p2p_device *dev);
6008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_free_sd_queries(struct p2p_data *p2p);
6018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_rx_gas_initial_req(struct p2p_data *p2p, const u8 *sa,
6028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			    const u8 *data, size_t len, int rx_freq);
6038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
6048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			     const u8 *data, size_t len, int rx_freq);
6058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_rx_gas_comeback_req(struct p2p_data *p2p, const u8 *sa,
6068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			     const u8 *data, size_t len, int rx_freq);
6078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
6088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			      const u8 *data, size_t len, int rx_freq);
6098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_start_sd(struct p2p_data *p2p, struct p2p_device *dev);
6108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
6118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* p2p_go_neg.c */
6128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_peer_channels_check(struct p2p_data *p2p, struct p2p_channels *own,
6138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			    struct p2p_device *dev,
6148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			    const u8 *channel_list, size_t channel_list_len);
6158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
6168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			    const u8 *data, size_t len, int rx_freq);
6178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
6188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			     const u8 *data, size_t len, int rx_freq);
6198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
6208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			     const u8 *data, size_t len);
6218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_connect_send(struct p2p_data *p2p, struct p2p_device *dev);
62204949598a23f501be6eec21697465fd46a28840aDmitry Shmidtu16 p2p_wps_method_pw_id(enum p2p_wps_method wps_method);
6238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
6248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* p2p_pd.c */
6258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
6268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			       const u8 *data, size_t len, int rx_freq);
6278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa,
6288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				const u8 *data, size_t len);
6298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_send_prov_disc_req(struct p2p_data *p2p, struct p2p_device *dev,
6301f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt			   int join, int force_freq);
63175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid p2p_reset_pending_pd(struct p2p_data *p2p);
6328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
6338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* p2p_invitation.c */
6348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
6358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				const u8 *data, size_t len, int rx_freq);
6368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_process_invitation_resp(struct p2p_data *p2p, const u8 *sa,
6378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				 const u8 *data, size_t len);
6388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_invite_send(struct p2p_data *p2p, struct p2p_device *dev,
6398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		    const u8 *go_dev_addr);
6408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_invitation_req_cb(struct p2p_data *p2p, int success);
6418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_invitation_resp_cb(struct p2p_data *p2p, int success);
6428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
6438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* p2p_dev_disc.c */
6448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_process_dev_disc_req(struct p2p_data *p2p, const u8 *sa,
6458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			      const u8 *data, size_t len, int rx_freq);
6468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_dev_disc_req_cb(struct p2p_data *p2p, int success);
6478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_send_dev_disc_req(struct p2p_data *p2p, struct p2p_device *dev);
6488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_dev_disc_resp_cb(struct p2p_data *p2p, int success);
6498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_process_dev_disc_resp(struct p2p_data *p2p, const u8 *sa,
6508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			       const u8 *data, size_t len);
6518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_go_disc_req_cb(struct p2p_data *p2p, int success);
6528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_process_go_disc_req(struct p2p_data *p2p, const u8 *da, const u8 *sa,
6538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			     const u8 *data, size_t len, int rx_freq);
6548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
6558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* p2p.c */
6568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_state(struct p2p_data *p2p, int new_state);
6578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_timeout(struct p2p_data *p2p, unsigned int sec,
6588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		     unsigned int usec);
6598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_clear_timeout(struct p2p_data *p2p);
6608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_continue_find(struct p2p_data *p2p);
6618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_device * p2p_add_dev_from_go_neg_req(struct p2p_data *p2p,
6628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt						const u8 *addr,
6638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt						struct p2p_message *msg);
6648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_add_dev_info(struct p2p_data *p2p, const u8 *addr,
6658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		      struct p2p_device *dev, struct p2p_message *msg);
666c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidtint p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level,
66704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt		   const u8 *ies, size_t ies_len, int scan_res);
6688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_device * p2p_get_device(struct p2p_data *p2p, const u8 *addr);
6698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_device * p2p_get_device_interface(struct p2p_data *p2p,
6708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					     const u8 *addr);
6718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_go_neg_failed(struct p2p_data *p2p, struct p2p_device *peer,
6728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		       int status);
6738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_go_complete(struct p2p_data *p2p, struct p2p_device *peer);
6748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_match_dev_type(struct p2p_data *p2p, struct wpabuf *wps);
6758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint dev_type_list_match(const u8 *dev_type, const u8 *req_dev_type[],
6768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			size_t num_req_dev_type);
6778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wpabuf * p2p_build_probe_resp_ies(struct p2p_data *p2p);
6788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_build_ssid(struct p2p_data *p2p, u8 *ssid, size_t *ssid_len);
6798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_send_action(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
6808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		    const u8 *src, const u8 *bssid, const u8 *buf,
6818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		    size_t len, unsigned int wait_time);
68204949598a23f501be6eec21697465fd46a28840aDmitry Shmidtvoid p2p_stop_listen_for_freq(struct p2p_data *p2p, int freq);
6838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
6848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* P2P_I_H */
685