p2p.h revision 700a137ab366edc72e371da68ba187b4717ee660
18d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* 28d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Wi-Fi Direct - 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_H 108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_H 118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * P2P_MAX_REG_CLASSES - Maximum number of regulatory classes 148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_MAX_REG_CLASSES 10 168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * P2P_MAX_REG_CLASS_CHANNELS - Maximum number of channels per regulatory class 198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_MAX_REG_CLASS_CHANNELS 20 218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_channels - List of supported channels 248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_channels { 268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_reg_class - Supported regulatory class 288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct p2p_reg_class { 308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * reg_class - Regulatory class (IEEE 802.11-2007, Annex J) 328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 reg_class; 348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * channel - Supported channels 378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 channel[P2P_MAX_REG_CLASS_CHANNELS]; 398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * channels - Number of channel entries in use 428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t channels; 448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } reg_class[P2P_MAX_REG_CLASSES]; 458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * reg_classes - Number of reg_class entries in use 488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t reg_classes; 508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_wps_method { 531f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt WPS_NOT_READY, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC 548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 56b5e8f06e18446918f6d801566e5709a8c87f1780Dmitry Shmidtenum p2p_sd_action { 57b5e8f06e18446918f6d801566e5709a8c87f1780Dmitry Shmidt SRV_UPDATE, SRV_ADD, SRV_DEL, SRV_FLUSH 58b5e8f06e18446918f6d801566e5709a8c87f1780Dmitry Shmidt}; 59b5e8f06e18446918f6d801566e5709a8c87f1780Dmitry Shmidt 608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_go_neg_results - P2P Group Owner Negotiation results 628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_go_neg_results { 648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * status - Negotiation result (Status Code) 668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 0 (P2P_SC_SUCCESS) indicates success. Non-zero values indicate 688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * failed negotiation. 698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int status; 718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * role_go - Whether local end is Group Owner 748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int role_go; 768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * freq - Frequency of the group operational channel in MHz 798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int freq; 818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8261d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt int ht40; 8361d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt 848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ssid - SSID of the group 868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 ssid[32]; 888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ssid_len - Length of SSID in octets 918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t ssid_len; 938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 95d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * psk - WPA pre-shared key (256 bits) (GO only) 96d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt */ 97d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt u8 psk[32]; 98d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt 99d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt /** 100d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * psk_set - Whether PSK field is configured (GO only) 101d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt */ 102d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt int psk_set; 103d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt 104d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt /** 1058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * passphrase - WPA2-Personal passphrase for the group (GO only) 1068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char passphrase[64]; 1088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * peer_device_addr - P2P Device Address of the peer 1118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 peer_device_addr[ETH_ALEN]; 1138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * peer_interface_addr - P2P Interface Address of the peer 1168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 peer_interface_addr[ETH_ALEN]; 1188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wps_method - WPS method to be used during provisioning 1218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_wps_method wps_method; 1238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_MAX_CHANNELS 50 1258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * freq_list - Zero-terminated list of possible operational channels 1288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int freq_list[P2P_MAX_CHANNELS]; 1308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * persistent_group - Whether the group should be made persistent 1331f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 0 = not persistent 1341f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 1 = persistent group without persistent reconnect 1351f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 2 = persistent group with persistent reconnect 1368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int persistent_group; 1388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * peer_config_timeout - Peer configuration timeout (in 10 msec units) 1418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int peer_config_timeout; 1438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 1448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_data; 1468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_scan_type { 1488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SCAN_SOCIAL, 1498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SCAN_FULL, 150b5e8f06e18446918f6d801566e5709a8c87f1780Dmitry Shmidt P2P_SCAN_SPECIFIC, 1518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SCAN_SOCIAL_PLUS_ONE 1528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 1538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_MAX_WPS_VENDOR_EXT 10 1558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_peer_info - P2P peer information 1588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_peer_info { 1608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_device_addr - P2P Device Address of the peer 1628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 p2p_device_addr[ETH_ALEN]; 1648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * pri_dev_type - Primary Device Type 1678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 pri_dev_type[8]; 1698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * device_name - Device Name (0..32 octets encoded in UTF-8) 1728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char device_name[33]; 1748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * manufacturer - Manufacturer (0..64 octets encoded in UTF-8) 1778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char manufacturer[65]; 1798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * model_name - Model Name (0..32 octets encoded in UTF-8) 1828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char model_name[33]; 1848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * model_number - Model Number (0..32 octets encoded in UTF-8) 1878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char model_number[33]; 1898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * serial_number - Serial Number (0..32 octets encoded in UTF-8) 1928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char serial_number[33]; 1948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 19675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * level - Signal level 19775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 19875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int level; 19975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 20075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /** 2018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * config_methods - WPS Configuration Methods 2028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u16 config_methods; 2048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_capab - Device Capabilities 2078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 dev_capab; 2098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * group_capab - Group Capabilities 2128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 group_capab; 2148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wps_sec_dev_type_list - WPS secondary device type list 2178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 2188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This list includes from 0 to 16 Secondary Device Types as indicated 2198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * by wps_sec_dev_type_list_len (8 * number of types). 2208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 wps_sec_dev_type_list[128]; 2228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wps_sec_dev_type_list_len - Length of secondary device type list 2258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t wps_sec_dev_type_list_len; 2278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT]; 22961d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt 23061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt /** 23161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt * wfd_subelems - Wi-Fi Display subelements from WFD IE(s) 23261d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt */ 23361d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt struct wpabuf *wfd_subelems; 2348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 2358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenenum p2p_prov_disc_status { 23775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen P2P_PROV_DISC_SUCCESS, 23875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen P2P_PROV_DISC_TIMEOUT, 23975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen P2P_PROV_DISC_REJECTED, 240d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt P2P_PROV_DISC_TIMEOUT_JOIN, 24175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 24275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 24304949598a23f501be6eec21697465fd46a28840aDmitry Shmidtstruct p2p_channel { 24404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt u8 op_class; 24504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt u8 chan; 24604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt}; 24704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 2488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 2498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_config - P2P configuration 2508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 2518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This configuration is provided to the P2P module during initialization with 2528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_init(). 2538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_config { 2558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * country - Country code to use in P2P operations 2578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char country[3]; 2598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * reg_class - Regulatory class for own listen channel 2628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 reg_class; 2648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * channel - Own listen channel 2678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 channel; 2698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Regulatory class for own operational channel 2728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 op_reg_class; 2748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * op_channel - Own operational channel 2778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 op_channel; 2798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * cfg_op_channel - Whether op_channel is hardcoded in configuration 2828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 cfg_op_channel; 2848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * channels - Own supported regulatory classes and channels 2878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 2888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * List of supposerted channels per regulatory class. The regulatory 2898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * classes are defined in IEEE Std 802.11-2007 Annex J and the 2908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * numbering of the clases depends on the configured country code. 2918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct p2p_channels channels; 2938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 29504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * num_pref_chan - Number of pref_chan entries 29604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 29704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt unsigned int num_pref_chan; 29804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 29904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt /** 30004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * pref_chan - Preferred channels for GO Negotiation 30104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 30204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt struct p2p_channel *pref_chan; 30304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 30404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt /** 3058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * pri_dev_type - Primary Device Type (see WPS) 3068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 pri_dev_type[8]; 3088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * P2P_SEC_DEVICE_TYPES - Maximum number of secondary device types 3118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_SEC_DEVICE_TYPES 5 3138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * sec_dev_type - Optional secondary device types 3168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 sec_dev_type[P2P_SEC_DEVICE_TYPES][8]; 3188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * num_sec_dev_types - Number of sec_dev_type entries 3218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t num_sec_dev_types; 3238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_addr - P2P Device Address 3268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 dev_addr[ETH_ALEN]; 3288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_name - Device Name 3318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *dev_name; 3338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *manufacturer; 3358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *model_name; 3368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *model_number; 3378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *serial_number; 3388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 uuid[16]; 3408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u16 config_methods; 3418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * concurrent_operations - Whether concurrent operations are supported 3448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int concurrent_operations; 3468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * max_peers - Maximum number of discovered peers to remember 3498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * If more peers are discovered, older entries will be removed to make 3518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * room for the new ones. 3528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t max_peers; 3548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_intra_bss - Intra BSS communication is supported 3578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int p2p_intra_bss; 3598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ssid_postfix - Postfix data to add to the SSID 3628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This data will be added to the end of the SSID after the 3648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * DIRECT-<random two octets> prefix. 3658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 ssid_postfix[32 - 9]; 3678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ssid_postfix_len - Length of the ssid_postfix data 3708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t ssid_postfix_len; 3728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 373d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt /** 374d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * max_listen - Maximum listen duration in ms 375d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt */ 376d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt unsigned int max_listen; 377d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt 37804abaa93653bcee36d59576c90f283d4efdb0a64Dmitry Shmidt#ifdef ANDROID_P2P 37904abaa93653bcee36d59576c90f283d4efdb0a64Dmitry Shmidt enum p2p_concurrency_type { 38004abaa93653bcee36d59576c90f283d4efdb0a64Dmitry Shmidt P2P_NON_CONCURRENT, 38104abaa93653bcee36d59576c90f283d4efdb0a64Dmitry Shmidt P2P_SINGLE_CHANNEL_CONCURRENT, 38204abaa93653bcee36d59576c90f283d4efdb0a64Dmitry Shmidt P2P_MULTI_CHANNEL_CONCURRENT, 38304abaa93653bcee36d59576c90f283d4efdb0a64Dmitry Shmidt } p2p_concurrency; 38404abaa93653bcee36d59576c90f283d4efdb0a64Dmitry Shmidt#endif 38504abaa93653bcee36d59576c90f283d4efdb0a64Dmitry Shmidt 3868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * msg_ctx - Context to use with wpa_msg() calls 3888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void *msg_ctx; 3908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * cb_ctx - Context to use with callback functions 3938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void *cb_ctx; 3958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Callbacks to request lower layer driver operations */ 3988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan - Request a P2P scan/search 4018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 4028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @type: Scan type 4038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Specific frequency (MHz) to scan or 0 for no restriction 4048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @num_req_dev_types: Number of requested device types 4058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @req_dev_types: Array containing requested device types 406c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_id: Device ID to search for or %NULL to find all devices 40704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @pw_id: Device Password ID 4088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 4098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback function is used to request a P2P scan or search 4118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * operation to be completed. Type type argument specifies which type 4128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * of scan is to be done. @P2P_SCAN_SOCIAL indicates that only the 4138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * social channels (1, 6, 11) should be scanned. @P2P_SCAN_FULL 41404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * indicates that all channels are to be scanned. 4158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @P2P_SCAN_SOCIAL_PLUS_ONE request scan of all the social channels 4168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * plus one extra channel specified by freq. 4178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The full scan is used for the initial scan to find group owners from 4198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * all. The other types are used during search phase scan of the social 4208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * channels (with potential variation if the Listen channel of the 4218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * target peer is known or if other channels are scanned in steps). 4228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The scan results are returned after this call by calling 4248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_res_handler() for each scan result that has a P2P IE and 4258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * then calling p2p_scan_res_handled() to indicate that all scan 4268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * results have been indicated. 4278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int (*p2p_scan)(void *ctx, enum p2p_scan_type type, int freq, 4298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int num_req_dev_types, 43004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt const u8 *req_dev_types, const u8 *dev_id, u16 pw_id); 4318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * send_probe_resp - Transmit a Probe Response frame 4348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 4358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Probe Response frame (including the header and body) 4368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 4378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to reply to Probe Request frames that were 4398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * indicated with a call to p2p_probe_req_rx(). The response is to be 4408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * sent on the same channel or to be dropped if the driver is not 4418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * anymore listening to Probe Request frames. 4428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Alternatively, the responsibility for building the Probe Response 4448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * frames in Listen state may be in another system component in which 4458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * case this function need to be implemented (i.e., the function 4468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * pointer can be %NULL). The WPS and P2P IEs to be added for Probe 4478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Response frames in such a case are available from the 4488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * start_listen() callback. It should be noted that the received Probe 4498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Request frames must be indicated by calling p2p_probe_req_rx() even 4508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * if this send_probe_resp() is not used. 4518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int (*send_probe_resp)(void *ctx, const struct wpabuf *buf); 4538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * send_action - Transmit an Action frame 4568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 4578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency in MHz for the channel on which to transmit 4588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dst: Destination MAC address (Address 1) 4598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @src: Source MAC address (Address 2) 4608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: BSSID (Address 3) 4618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Frame body (starting from Category field) 4628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @len: Length of buf in octets 4638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wait_time: How many msec to wait for a response frame 4648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 4658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The Action frame may not be transmitted immediately and the status 4678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * of the transmission must be reported by calling 4688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_send_action_cb() once the frame has either been transmitted or 4698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * it has been dropped due to excessive retries or other failure to 4708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * transmit. 4718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int (*send_action)(void *ctx, unsigned int freq, const u8 *dst, 4738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *src, const u8 *bssid, const u8 *buf, 4748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t len, unsigned int wait_time); 4758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * send_action_done - Notify that Action frame sequence was completed 4788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 4798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is called when the Action frame sequence that was 4818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * started with send_action() has been completed, i.e., when there is 4828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * no need to wait for a response from the destination peer anymore. 4838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*send_action_done)(void *ctx); 4858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * start_listen - Start Listen state 4888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 4898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency of the listen channel in MHz 4908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @duration: Duration for the Listen state in milliseconds 4918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @probe_resp_ie: IE(s) to be added to Probe Response frames 4928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 4938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This Listen state may not start immediately since the driver may 4958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * have other pending operations to complete first. Once the Listen 4968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * state has started, p2p_listen_cb() must be called to notify the P2P 4978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * module. Once the Listen state is stopped, p2p_listen_end() must be 4988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * called to notify the P2P module that the driver is not in the Listen 4998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * state anymore. 5008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * If the send_probe_resp() is not used for generating the response, 5028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the IEs from probe_resp_ie need to be added to the end of the Probe 5038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Response frame body. If send_probe_resp() is used, the probe_resp_ie 5048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * information can be ignored. 5058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int (*start_listen)(void *ctx, unsigned int freq, 5078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int duration, 5088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const struct wpabuf *probe_resp_ie); 5098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * stop_listen - Stop Listen state 5118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback can be used to stop a Listen state operation that was 5148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * previously requested with start_listen(). 5158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*stop_listen)(void *ctx); 5178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * get_noa - Get current Notice of Absence attribute payload 5208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @interface_addr: P2P Interface Address of the GO 5228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for returning NoA 5238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf_len: Buffer length in octets 5248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets used in buf, 0 to indicate no NoA is being 5258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * advertized, or -1 on failure 5268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to fetch the current Notice of Absence 5288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * attribute value from GO. 5298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int (*get_noa)(void *ctx, const u8 *interface_addr, u8 *buf, 5318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t buf_len); 5328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Callbacks to notify events to upper layer management entity */ 5348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_found - Notification of a found P2P Device 5378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: Source address of the message triggering this notification 5398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @info: P2P peer information 5408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @new_device: Inform if the peer is newly found 5418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to notify that a new P2P Device has been 5438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * found. This may happen, e.g., during Search state based on scan 5448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * results or during Listen state based on receive Probe Request and 5458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Group Owner Negotiation Request. 5468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*dev_found)(void *ctx, const u8 *addr, 5488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const struct p2p_peer_info *info, 5498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int new_device); 5508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_lost - Notification of a lost P2P Device 5538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_addr: P2P Device Address of the lost P2P Device 5558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to notify that a P2P Device has been deleted. 5578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*dev_lost)(void *ctx, const u8 *dev_addr); 5598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * go_neg_req_rx - Notification of a receive GO Negotiation Request 5628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @src: Source address of the message triggering this notification 5648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_passwd_id: WPS Device Password ID 5658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to notify that a P2P Device is requesting 5678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * group owner negotiation with us, but we do not have all the 5688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * necessary information to start GO Negotiation. This indicates that 5698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the local user has not authorized the connection yet by providing a 5708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * PIN or PBC button press. This information can be provided with a 5718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * call to p2p_connect(). 5728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*go_neg_req_rx)(void *ctx, const u8 *src, u16 dev_passwd_id); 5748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * go_neg_completed - Notification of GO Negotiation results 5778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @res: GO Negotiation results 5798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to notify that Group Owner Negotiation has 5818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * been completed. Non-zero struct p2p_go_neg_results::status indicates 5828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * failed negotiation. In case of success, this function is responsible 5838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * for creating a new group interface (or using the existing interface 5848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * depending on driver features), setting up the group interface in 5858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * proper mode based on struct p2p_go_neg_results::role_go and 5868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * initializing WPS provisioning either as a Registrar (if GO) or as an 5878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Enrollee. Successful WPS provisioning must be indicated by calling 5888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_wps_success_cb(). The callee is responsible for timing out group 5898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * formation if WPS provisioning cannot be completed successfully 5908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * within 15 seconds. 5918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*go_neg_completed)(void *ctx, struct p2p_go_neg_results *res); 5938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * sd_request - Callback on Service Discovery Request 5968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency (in MHz) of the channel 5988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the request 5998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dialog_token: Dialog token 6008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @update_indic: Service Update Indicator from the source of request 6018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs: P2P Service Request TLV(s) 6028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs_len: Length of tlvs buffer in octets 6038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate reception of a service discovery 6058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * request. Response to the query must be indicated by calling 6068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_response() with the context information from the arguments to 6078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * this callback function. 6088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback handler can be set to %NULL to indicate that service 6108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * discovery is not supported. 6118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*sd_request)(void *ctx, int freq, const u8 *sa, u8 dialog_token, 6138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u16 update_indic, const u8 *tlvs, size_t tlvs_len); 6148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 6168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * sd_response - Callback on Service Discovery Response 6178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 6188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the request 6198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @update_indic: Service Update Indicator from the source of response 6208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs: P2P Service Response TLV(s) 6218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs_len: Length of tlvs buffer in octets 6228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate reception of a service discovery 6248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * response. This callback handler can be set to %NULL if no service 6258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * discovery requests are used. The information provided with this call 6268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * is replies to the queries scheduled with p2p_sd_request(). 6278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*sd_response)(void *ctx, const u8 *sa, u16 update_indic, 6298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *tlvs, size_t tlvs_len); 6308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 6328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * prov_disc_req - Callback on Provisiong Discovery Request 6338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 6348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer: Source address of the request 6358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @config_methods: Requested WPS Config Method 6368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_addr: P2P Device Address of the found P2P Device 6378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @pri_dev_type: Primary Device Type 6388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_name: Device Name 6398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @supp_config_methods: Supported configuration Methods 6408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_capab: Device Capabilities 6418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group_capab: Group Capabilities 6421f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @group_id: P2P Group ID (or %NULL if not included) 6431f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @group_id_len: Length of P2P Group ID 6448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate reception of a Provision Discovery 6468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Request frame that the P2P module accepted. 6478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*prov_disc_req)(void *ctx, const u8 *peer, u16 config_methods, 6498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *dev_addr, const u8 *pri_dev_type, 6508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *dev_name, u16 supp_config_methods, 6511f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt u8 dev_capab, u8 group_capab, 6521f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt const u8 *group_id, size_t group_id_len); 6538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 6558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * prov_disc_resp - Callback on Provisiong Discovery Response 6568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 6578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer: Source address of the response 6588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @config_methods: Value from p2p_prov_disc_req() or 0 on failure 6598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate reception of a Provision Discovery 6618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Response frame for a pending request scheduled with 6628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_prov_disc_req(). This callback handler can be set to %NULL if 6638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * provision discovery is not used. 6648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*prov_disc_resp)(void *ctx, const u8 *peer, u16 config_methods); 6668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 66875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * prov_disc_fail - Callback on Provision Discovery failure 66975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @ctx: Callback context from cb_ctx 67075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @peer: Source address of the response 67175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @status: Cause of failure, will not be %P2P_PROV_DISC_SUCCESS 67275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 67375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * This callback is used to indicate either a failure or no response 67475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * to an earlier provision discovery request. 67575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 67675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * This callback handler can be set to %NULL if provision discovery 67775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * is not used or failures do not need to be indicated. 67875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 67975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen void (*prov_disc_fail)(void *ctx, const u8 *peer, 68075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen enum p2p_prov_disc_status status); 68175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 68275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /** 6838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_process - Optional callback for processing Invitations 6848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 6858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the Invitation Request 6868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: P2P Group BSSID from the request or %NULL if not included 6878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_dev_addr: GO Device Address from P2P Group ID 6888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid: SSID from P2P Group ID 6898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid_len: Length of ssid buffer in octets 6908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go: Variable for returning whether the local end is GO in the group 6918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group_bssid: Buffer for returning P2P Group BSSID (if local end GO) 6928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @force_freq: Variable for returning forced frequency for the group 6938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @persistent_group: Whether this is an invitation to reinvoke a 6948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * persistent group (instead of invitation to join an active 6958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * group) 6968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Status code (P2P_SC_*) 6978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This optional callback can be used to implement persistent reconnect 6998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * by allowing automatic restarting of persistent groups without user 7008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * interaction. If this callback is not implemented (i.e., is %NULL), 7018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the received Invitation Request frames are replied with 7028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * %P2P_SC_REQ_RECEIVED status and indicated to upper layer with the 7038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_result() callback. 7048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * If the requested parameters are acceptable and the group is known, 7068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * %P2P_SC_SUCCESS may be returned. If the requested group is unknown, 7078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * %P2P_SC_FAIL_UNKNOWN_GROUP should be returned. %P2P_SC_REQ_RECEIVED 7088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * can be returned if there is not enough data to provide immediate 7098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * response, i.e., if some sort of user interaction is needed. The 7108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_received() callback will be called in that case 7118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * immediately after this call. 7128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 (*invitation_process)(void *ctx, const u8 *sa, const u8 *bssid, 7148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *go_dev_addr, const u8 *ssid, 7158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t ssid_len, int *go, u8 *group_bssid, 7168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int *force_freq, int persistent_group); 7178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 7198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_received - Callback on Invitation Request RX 7208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 7218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the Invitation Request 7228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: P2P Group BSSID or %NULL if not received 7238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid: SSID of the group 7248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid_len: Length of ssid in octets 7258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_dev_addr: GO Device Address 7268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @status: Response Status 7278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @op_freq: Operational frequency for the group 7288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate sending of an Invitation Response 7308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * for a received Invitation Request. If status == 0 (success), the 7318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * upper layer code is responsible for starting the group. status == 1 7328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * indicates need to get user authorization for the group. Other status 7338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * values indicate that the invitation request was rejected. 7348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*invitation_received)(void *ctx, const u8 *sa, const u8 *bssid, 7368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *ssid, size_t ssid_len, 7378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *go_dev_addr, u8 status, 7388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int op_freq); 7398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 7418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_result - Callback on Invitation result 7428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 7438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @status: Negotiation result (Status Code) 7448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: P2P Group BSSID or %NULL if not received 7457a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidt * @channels: Available operating channels for the group 746700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * @addr: Peer address 7478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate result of an Invitation procedure 7498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * started with a call to p2p_invite(). The indicated status code is 7508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the value received from the peer in Invitation Response with 0 7518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * (P2P_SC_SUCCESS) indicating success or -1 to indicate a timeout or a 7528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * local failure in transmitting the Invitation Request. 7538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7547a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidt void (*invitation_result)(void *ctx, int status, const u8 *bssid, 755700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt const struct p2p_channels *channels, 756700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt const u8 *addr); 757c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt 758c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt /** 759c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * go_connected - Check whether we are connected to a GO 760c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @ctx: Callback context from cb_ctx 761c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_addr: P2P Device Address of a GO 762c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * Returns: 1 if we are connected as a P2P client to the specified GO 763c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * or 0 if not. 764c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt */ 765c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt int (*go_connected)(void *ctx, const u8 *dev_addr); 7668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 7678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* P2P module initialization/deinitialization */ 7708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 7728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_init - Initialize P2P module 7738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @cfg: P2P module configuration 7748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Pointer to private data or %NULL on failure 7758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to initialize global P2P module context (one per 7778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * device). The P2P module will keep a copy of the configuration data, so the 7788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * caller does not need to maintain this structure. However, the callback 7798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * functions and the context parameters to them must be kept available until 7808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the P2P module is deinitialized with p2p_deinit(). 7818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_data * p2p_init(const struct p2p_config *cfg); 7838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 7858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_deinit - Deinitialize P2P module 7868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 7878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_deinit(struct p2p_data *p2p); 7898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 7918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_flush - Flush P2P module state 7928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 7938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This command removes the P2P module state like peer device entries. 7958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_flush(struct p2p_data *p2p); 7978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 7998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_unauthorize - Unauthorize the specified peer device 8008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: P2P peer entry to be unauthorized 8028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 8038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 8048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This command removes any connection authorization from the specified P2P 8058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * peer device address. This can be used, e.g., to cancel effect of a previous 8068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_authorize() or p2p_connect() call that has not yet resulted in completed 8078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * GO Negotiation. 8088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_unauthorize(struct p2p_data *p2p, const u8 *addr); 8108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 8128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_dev_name - Set device name 8138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 8158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 8168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to update the P2P module configuration with 8178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * information that was not available at the time of the p2p_init() call. 8188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_dev_name(struct p2p_data *p2p, const char *dev_name); 8208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_manufacturer(struct p2p_data *p2p, const char *manufacturer); 8228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_model_name(struct p2p_data *p2p, const char *model_name); 8238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_model_number(struct p2p_data *p2p, const char *model_number); 8248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_serial_number(struct p2p_data *p2p, const char *serial_number); 8258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_config_methods(struct p2p_data *p2p, u16 config_methods); 8278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_uuid(struct p2p_data *p2p, const u8 *uuid); 8288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 8308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_pri_dev_type - Set primary device type 8318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 8338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 8348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to update the P2P module configuration with 8358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * information that was not available at the time of the p2p_init() call. 8368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_pri_dev_type(struct p2p_data *p2p, const u8 *pri_dev_type); 8388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 8408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_sec_dev_types - Set secondary device types 8418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 8438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 8448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to update the P2P module configuration with 8458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * information that was not available at the time of the p2p_init() call. 8468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_sec_dev_types(struct p2p_data *p2p, const u8 dev_types[][8], 8488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t num_dev_types); 8498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_country(struct p2p_data *p2p, const char *country); 8518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Commands from upper layer management entity */ 8548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_discovery_type { 8568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_FIND_START_WITH_FULL, 8578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_FIND_ONLY_SOCIAL, 8588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_FIND_PROGRESSIVE 8598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 8608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 8628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_find - Start P2P Find (Device Discovery) 8638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @timeout: Timeout for find operation in seconds or 0 for no timeout 8658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @type: Device Discovery type 8668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @num_req_dev_types: Number of requested device types 8678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @req_dev_types: Requested device types array, must be an array 8688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * containing num_req_dev_types * WPS_DEV_TYPE_LEN bytes; %NULL if no 8698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * requested device types. 870c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_id: Device ID to search for or %NULL to find all devices 87161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt * @search_delay: Extra delay in milliseconds between search iterations 8728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 8738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_find(struct p2p_data *p2p, unsigned int timeout, 8758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_discovery_type type, 876c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt unsigned int num_req_dev_types, const u8 *req_dev_types, 87761d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt const u8 *dev_id, unsigned int search_delay); 8788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 8808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_stop_find - Stop P2P Find (Device Discovery) 8818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_stop_find(struct p2p_data *p2p); 8848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 8868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_stop_find_for_freq - Stop P2P Find for next oper on specific freq 8878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency in MHz for next operation 8898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 8908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This is like p2p_stop_find(), but Listen state is not stopped if we are 8918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * already on the same frequency. 8928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_stop_find_for_freq(struct p2p_data *p2p, int freq); 8948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 8968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_listen - Start P2P Listen state for specified duration 8978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @timeout: Listen state duration in milliseconds 8998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 9008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 9018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to request the P2P module to keep the device 9028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * discoverable on the listen channel for an extended set of time. At least in 9038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * its current form, this is mainly used for testing purposes and may not be of 9048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * much use for normal P2P operations. 9058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 9068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_listen(struct p2p_data *p2p, unsigned int timeout); 9078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 9098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_connect - Start P2P group formation (GO negotiation) 9108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 9118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer_addr: MAC address of the peer P2P client 9128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wps_method: WPS method to be used in provisioning 9138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_intent: Local GO intent value (1..15) 9148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @own_interface_addr: Intended interface address to use with the group 9158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @force_freq: The only allowed channel frequency in MHz or 0 9161f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @persistent_group: Whether to create a persistent group (0 = no, 1 = 9171f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * persistent group without persistent reconnect, 2 = persistent group with 9181f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * persistent reconnect) 91904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @force_ssid: Forced SSID for the group if we become GO or %NULL to generate 92004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * a new SSID 92104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @force_ssid_len: Length of $force_ssid buffer 92204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @pd_before_go_neg: Whether to send Provision Discovery prior to GO 92304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * Negotiation as an interoperability workaround when initiating group 92404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * formation 925d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * @pref_freq: Preferred operating frequency in MHz or 0 (this is only used if 926d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * force_freq == 0) 9278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 9288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 9298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_connect(struct p2p_data *p2p, const u8 *peer_addr, 9308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_wps_method wps_method, 9318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int go_intent, const u8 *own_interface_addr, 93204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt unsigned int force_freq, int persistent_group, 93304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt const u8 *force_ssid, size_t force_ssid_len, 934d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt int pd_before_go_neg, unsigned int pref_freq); 9358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 9378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_authorize - Authorize P2P group formation (GO negotiation) 9388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 9398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer_addr: MAC address of the peer P2P client 9408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wps_method: WPS method to be used in provisioning 9418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_intent: Local GO intent value (1..15) 9428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @own_interface_addr: Intended interface address to use with the group 9438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @force_freq: The only allowed channel frequency in MHz or 0 9441f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @persistent_group: Whether to create a persistent group (0 = no, 1 = 9451f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * persistent group without persistent reconnect, 2 = persistent group with 9461f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * persistent reconnect) 94704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @force_ssid: Forced SSID for the group if we become GO or %NULL to generate 94804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * a new SSID 94904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @force_ssid_len: Length of $force_ssid buffer 950d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * @pref_freq: Preferred operating frequency in MHz or 0 (this is only used if 951d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * force_freq == 0) 9528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 9538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 9548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This is like p2p_connect(), but the actual group negotiation is not 9558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * initiated automatically, i.e., the other end is expected to do that. 9568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 9578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_authorize(struct p2p_data *p2p, const u8 *peer_addr, 9588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_wps_method wps_method, 9598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int go_intent, const u8 *own_interface_addr, 96004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt unsigned int force_freq, int persistent_group, 961d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt const u8 *force_ssid, size_t force_ssid_len, 962d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt unsigned int pref_freq); 9638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 9658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_reject - Reject peer device (explicitly block connection attempts) 9668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 9678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer_addr: MAC address of the peer P2P client 9688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 9698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 9708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_reject(struct p2p_data *p2p, const u8 *peer_addr); 9718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 9738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_prov_disc_req - Send Provision Discovery Request 9748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 9758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer_addr: MAC address of the peer P2P client 9768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @config_methods: WPS Config Methods value (only one bit set) 9778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @join: Whether this is used by a client joining an active group 9781f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @force_freq: Forced TX frequency for the frame (mainly for the join case) 979d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * @user_initiated_pd: Flag to indicate if initiated by user or not 9808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 9818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 9828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to request a discovered P2P peer to display a PIN 9838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * (config_methods = WPS_CONFIG_DISPLAY) or be prepared to enter a PIN from us 9848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * (config_methods = WPS_CONFIG_KEYPAD). The Provision Discovery Request frame 9858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * is transmitted once immediately and if no response is received, the frame 9868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * will be sent again whenever the target device is discovered during device 9878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dsicovery (start with a p2p_find() call). Response from the peer is 9888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * indicated with the p2p_config::prov_disc_resp() callback. 9898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 9908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr, 991d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt u16 config_methods, int join, int force_freq, 992d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt int user_initiated_pd); 9938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 9958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_request - Schedule a service discovery query 9968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 9978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dst: Destination peer or %NULL to apply for all peers 9988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs: P2P Service Query TLV(s) 9998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Reference to the query or %NULL on failure 10008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 10018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Response to the query is indicated with the p2p_config::sd_response() 10028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * callback. 10038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid * p2p_sd_request(struct p2p_data *p2p, const u8 *dst, 10058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const struct wpabuf *tlvs); 10068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 100761d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt#ifdef CONFIG_WIFI_DISPLAY 100861d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtvoid * p2p_sd_request_wfd(struct p2p_data *p2p, const u8 *dst, 100961d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt const struct wpabuf *tlvs); 101061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt#endif /* CONFIG_WIFI_DISPLAY */ 101161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt 10128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_cancel_request - Cancel a pending service discovery query 10148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @req: Query reference from p2p_sd_request() 10168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 if request for cancelled; -1 if not found 10178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_sd_cancel_request(struct p2p_data *p2p, void *req); 10198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_response - Send response to a service discovery query 10228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency from p2p_config::sd_request() callback 10248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dst: Destination address from p2p_config::sd_request() callback 10258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dialog_token: Dialog token from p2p_config::sd_request() callback 10268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @resp_tlvs: P2P Service Response TLV(s) 10278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 10288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is called as a response to the request indicated with 10298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_config::sd_request() callback. 10308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_sd_response(struct p2p_data *p2p, int freq, const u8 *dst, 10328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 dialog_token, const struct wpabuf *resp_tlvs); 10338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_service_update - Indicate a change in local services 10368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 10388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function needs to be called whenever there is a change in availability 10398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * of the local services. This will increment the Service Update Indicator 10408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * value which will be used in SD Request and Response frames. 10418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1042b5e8f06e18446918f6d801566e5709a8c87f1780Dmitry Shmidt#ifdef ANDROID_P2P 1043b5e8f06e18446918f6d801566e5709a8c87f1780Dmitry Shmidtvoid p2p_sd_service_update(struct p2p_data *p2p, int action); 1044b5e8f06e18446918f6d801566e5709a8c87f1780Dmitry Shmidt#else 10458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_sd_service_update(struct p2p_data *p2p); 1046b5e8f06e18446918f6d801566e5709a8c87f1780Dmitry Shmidt#endif 10478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_invite_role { 10508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_INVITE_ROLE_GO, 10518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_INVITE_ROLE_ACTIVE_GO, 10528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_INVITE_ROLE_CLIENT 10538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 10548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_invite - Invite a P2P Device into a group 10578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer: Device Address of the peer P2P Device 10598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @role: Local role in the group 10608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: Group BSSID or %NULL if not known 10618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid: Group SSID 10628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid_len: Length of ssid in octets 10638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @force_freq: The only allowed channel frequency in MHz or 0 10648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_dev_addr: Forced GO Device Address or %NULL if none 10658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @persistent_group: Whether this is to reinvoke a persistent group 10667a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidt * @pref_freq: Preferred operating frequency in MHz or 0 (this is only used if 10677a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidt * force_freq == 0) 10688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 10698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role, 10718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *bssid, const u8 *ssid, size_t ssid_len, 10728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int force_freq, const u8 *go_dev_addr, 10737a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidt int persistent_group, unsigned int pref_freq); 10748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_presence_req - Request GO presence 10778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_interface_addr: GO P2P Interface Address 10798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @own_interface_addr: Own P2P Interface Address for this group 10808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Group operating frequence (in MHz) 10818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @duration1: Preferred presence duration in microseconds 10828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @interval1: Preferred presence interval in microseconds 10838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @duration2: Acceptable presence duration in microseconds 10848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @interval2: Acceptable presence interval in microseconds 10858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 10868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 10878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * If both duration and interval values are zero, the parameter pair is not 10888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * specified (i.e., to remove Presence Request, use duration1 = interval1 = 0). 10898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_presence_req(struct p2p_data *p2p, const u8 *go_interface_addr, 10918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *own_interface_addr, unsigned int freq, 10928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u32 duration1, u32 interval1, u32 duration2, 10938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u32 interval2); 10948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_ext_listen - Set Extended Listen Timing 10978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Group operating frequence (in MHz) 10998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @period: Availability period in milliseconds (1-65535; 0 to disable) 11008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @interval: Availability interval in milliseconds (1-65535; 0 to disable) 11018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 11028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 11038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to enable or disable (period = interval = 0) 11048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Extended Listen Timing. When enabled, the P2P Device will become 11058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * discoverable (go into Listen State) every @interval milliseconds for at 11068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * least @period milliseconds. 11078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 11088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_ext_listen(struct p2p_data *p2p, unsigned int period, 11098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int interval); 11108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Event notifications from upper layer management operations */ 11128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 11148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_wps_success_cb - Report successfully completed WPS provisioning 11158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @mac_addr: Peer address 11178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 11188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to report successfully completed WPS provisioning 11198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * during group formation in both GO/Registrar and client/Enrollee roles. 11208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 11218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_wps_success_cb(struct p2p_data *p2p, const u8 *mac_addr); 11228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 11248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_formation_failed - Report failed WPS provisioning 11258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 11278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to report failed group formation. This can happen 11288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * either due to failed WPS provisioning or due to 15 second timeout during 11298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the provisioning phase. 11308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 11318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_group_formation_failed(struct p2p_data *p2p); 11328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11331f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 11341f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_get_provisioning_info - Get any stored provisioning info 11351f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 11361f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @addr: Peer P2P Device Address 11371f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: WPS provisioning information (WPS config method) or 0 if no 11381f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * information is available 11391f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 11401f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * This function is used to retrieve stored WPS provisioning info for the given 11411f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * peer. 11421f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 11431f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtu16 p2p_get_provisioning_info(struct p2p_data *p2p, const u8 *addr); 11441f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 11451f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 11461f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_clear_provisioning_info - Clear any stored provisioning info 11471f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 114804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @iface_addr: Peer P2P Device Address 11491f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 11501f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * This function is used to clear stored WPS provisioning info for the given 11511f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * peer. 11521f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 115304949598a23f501be6eec21697465fd46a28840aDmitry Shmidtvoid p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *addr); 11541f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 11558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Event notifications from lower layer driver operations */ 11578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 115904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * enum p2p_probe_req_status 116004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * 116104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @P2P_PREQ_MALFORMED: frame was not well-formed 116204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @P2P_PREQ_NOT_LISTEN: device isn't in listen state, frame ignored 116304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @P2P_PREQ_NOT_P2P: frame was not a P2P probe request 116404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @P2P_PREQ_P2P_NOT_PROCESSED: frame was P2P but wasn't processed 116504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @P2P_PREQ_P2P_PROCESSED: frame has been processed by P2P 116604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 116704949598a23f501be6eec21697465fd46a28840aDmitry Shmidtenum p2p_probe_req_status { 116804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt P2P_PREQ_MALFORMED, 116904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt P2P_PREQ_NOT_LISTEN, 117004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt P2P_PREQ_NOT_P2P, 117104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt P2P_PREQ_NOT_PROCESSED, 117204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt P2P_PREQ_PROCESSED 117304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt}; 117404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 117504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt/** 11768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_probe_req_rx - Report reception of a Probe Request frame 11778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: Source MAC address 11791f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @dst: Destination MAC address if available or %NULL 11801f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @bssid: BSSID if available or %NULL 11818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ie: Information elements from the Probe Request frame body 11828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ie_len: Length of ie buffer in octets 118304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * Returns: value indicating the type and status of the probe request 11848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 118504949598a23f501be6eec21697465fd46a28840aDmitry Shmidtenum p2p_probe_req_status 118604949598a23f501be6eec21697465fd46a28840aDmitry Shmidtp2p_probe_req_rx(struct p2p_data *p2p, const u8 *addr, const u8 *dst, 118704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt const u8 *bssid, const u8 *ie, size_t ie_len); 11888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 11908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_rx_action - Report received Action frame 11918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @da: Destination address of the received Action frame 11938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the received Action frame 11948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: Address 3 of the received Action frame 11958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @category: Category of the received Action frame 11968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @data: Action frame body after the Category field 11978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @len: Length of the data buffer in octets 11988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency (in MHz) on which the frame was received 11998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_rx_action(struct p2p_data *p2p, const u8 *da, const u8 *sa, 12018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *bssid, u8 category, 12028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *data, size_t len, int freq); 12038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_res_handler - Indicate a P2P scan results 12068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 12078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: BSSID of the scan result 12088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency of the channel on which the device was found in MHz 1209f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt * @rx_time: Time when the result was received 12108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @level: Signal level (signal strength of the received Beacon/Probe Response 12118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * frame) 12128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies: Pointer to IEs from the scan result 12138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies_len: Length of the ies buffer 12148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 to continue or 1 to stop scan result indication 12158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 12168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is called to indicate a scan result entry with P2P IE from a 12178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * scan requested with struct p2p_config::p2p_scan(). This can be called during 12188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the actual scan process (i.e., whenever a new device is found) or as a 12198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * sequence of calls after the full scan has been completed. The former option 12208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * can result in optimized operations, but may not be supported by all 12218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * driver/firmware designs. The ies buffer need to include at least the P2P IE, 12228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * but it is recommended to include all IEs received from the device. The 12238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * caller does not need to check that the IEs contain a P2P IE before calling 12248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * this function since frames will be filtered internally if needed. 12258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 12268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function will return 1 if it wants to stop scan result iteration (and 12278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * scan in general if it is still in progress). This is used to allow faster 12288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * start of a pending operation, e.g., to start a pending GO negotiation. 12298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_scan_res_handler(struct p2p_data *p2p, const u8 *bssid, int freq, 1231f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt struct os_time *rx_time, int level, const u8 *ies, 1232a54fa5fb807eaeff45464139b5a7759f060cec68Dmitry Shmidt size_t ies_len); 12338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_res_handled - Indicate end of scan results 12368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 12378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 12388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is called to indicate that all P2P scan results from a scan 12398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * have been reported with zero or more calls to p2p_scan_res_handler(). This 12408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * function must be called as a response to successful 12418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_config::p2p_scan() call if none of the p2p_scan_res_handler() 12428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * calls stopped iteration. 12438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_scan_res_handled(struct p2p_data *p2p); 12458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_send_action_result { 12478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SEND_ACTION_SUCCESS /* Frame was send and acknowledged */, 12488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SEND_ACTION_NO_ACK /* Frame was sent, but not acknowledged */, 12498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SEND_ACTION_FAILED /* Frame was not sent due to a failure */ 12508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 12518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_send_action_cb - Notify TX status of an Action frame 12548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 12558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Channel frequency in MHz 12568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dst: Destination MAC address (Address 1) 12578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @src: Source MAC address (Address 2) 12588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: BSSID (Address 3) 12598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @result: Result of the transmission attempt 12608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 12618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to indicate the result of an Action frame transmission 12628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * that was requested with struct p2p_config::send_action() callback. 12638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst, 12658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *src, const u8 *bssid, 12668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_send_action_result result); 12678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_listen_cb - Indicate the start of a requested Listen state 12708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 12718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Listen channel frequency in MHz 12728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @duration: Duration for the Listen state in milliseconds 12738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 12748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to indicate that a Listen state requested with 12758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_config::start_listen() callback has started. 12768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_listen_cb(struct p2p_data *p2p, unsigned int freq, 12788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int duration); 12798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_listen_end - Indicate the end of a requested Listen state 12828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 12838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Listen channel frequency in MHz 12848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 if no operations were started, 1 if an operation was started 12858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 12868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to indicate that a Listen state requested with 12878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_config::start_listen() callback has ended. 12888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_listen_end(struct p2p_data *p2p, unsigned int freq); 12908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_deauth_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code, 12928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *ie, size_t ie_len); 12938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_disassoc_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code, 12958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *ie, size_t ie_len); 12968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Per-group P2P state for GO */ 12998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_group; 13018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_group_config - P2P group configuration 13048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 13058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This configuration is provided to the P2P module during initialization of 13068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the per-group information with p2p_group_init(). 13078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_group_config { 13098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 13108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * persistent_group - Whether the group is persistent 13111f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 0 = not a persistent group 13121f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 1 = persistent group without persistent reconnect 13131f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 2 = persistent group with persistent reconnect 13148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int persistent_group; 13168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 13188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * interface_addr - P2P Interface Address of the group 13198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 interface_addr[ETH_ALEN]; 13218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 13238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * max_clients - Maximum number of clients in the group 13248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int max_clients; 13268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 132804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * ssid - Group SSID 132904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 133004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt u8 ssid[32]; 133104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 133204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt /** 133304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * ssid_len - Length of SSID 133404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 133504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt size_t ssid_len; 133604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 133704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt /** 13388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * cb_ctx - Context to use with callback functions 13398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void *cb_ctx; 13418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 13438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ie_update - Notification of IE update 13448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 13458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @beacon_ies: P2P IE for Beacon frames or %NULL if no change 13468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @proberesp_ies: P2P Ie for Probe Response frames 13478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 13488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * P2P module uses this callback function to notify whenever the P2P IE 13498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * in Beacon or Probe Response frames should be updated based on group 13508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * events. 13518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 13528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The callee is responsible for freeing the returned buffer(s) with 13538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpabuf_free(). 13548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*ie_update)(void *ctx, struct wpabuf *beacon_ies, 13568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpabuf *proberesp_ies); 13578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 13598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * idle_update - Notification of changes in group idle state 13608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 13618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @idle: Whether the group is idle (no associated stations) 13628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*idle_update)(void *ctx, int idle); 13648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 13658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_init - Initialize P2P group 13688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 13698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @config: P2P group configuration (will be freed by p2p_group_deinit()) 13708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Pointer to private data or %NULL on failure 13718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 13728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to initialize per-group P2P module context. Currently, 13738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * this is only used to manage GO functionality and P2P clients do not need to 13748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * create an instance of this per-group information. 13758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_group * p2p_group_init(struct p2p_data *p2p, 13778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct p2p_group_config *config); 13788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_deinit - Deinitialize P2P group 13818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 13828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_group_deinit(struct p2p_group *group); 13848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_notif_assoc - Notification of P2P client association with GO 13878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 13888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: Interface address of the P2P client 13898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ie: IEs from the (Re)association Request frame 13908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @len: Length of the ie buffer in octets 13918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 13928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_group_notif_assoc(struct p2p_group *group, const u8 *addr, 13948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *ie, size_t len); 13958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_assoc_resp_ie - Build P2P IE for (re)association response 13988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 13998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @status: Status value (P2P_SC_SUCCESS if association succeeded) 14008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: P2P IE for (Re)association Response or %NULL on failure 14018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 14028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The caller is responsible for freeing the returned buffer with 14038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpabuf_free(). 14048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wpabuf * p2p_group_assoc_resp_ie(struct p2p_group *group, u8 status); 14068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_notif_disassoc - Notification of P2P client disassociation from GO 14098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 14108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: Interface address of the P2P client 14118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_group_notif_disassoc(struct p2p_group *group, const u8 *addr); 14138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_notif_formation_done - Notification of completed group formation 14168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 14178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_group_notif_formation_done(struct p2p_group *group); 14198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_notif_noa - Notification of NoA change 14228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 14238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @noa: Notice of Absence attribute payload, %NULL if none 14248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @noa_len: Length of noa buffer in octets 14258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 14268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 14278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify the P2P group management about a new NoA contents. This will be 14288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * inserted into the P2P IEs in Beacon and Probe Response frames with rest of 14298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the group information. 14308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_group_notif_noa(struct p2p_group *group, const u8 *noa, 14328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t noa_len); 14338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_match_dev_type - Match device types in group with requested type 14368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 14378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wps: WPS TLVs from Probe Request frame (concatenated WPS IEs) 14388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 1 on match, 0 on mismatch 14398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 14408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to match the Requested Device Type attribute in 14418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * WPS IE with the device types of a group member for deciding whether a GO 14428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * should reply to a Probe Request frame. Match will be reported if the WPS IE 14438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * is not requested any specific device type. 14448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_group_match_dev_type(struct p2p_group *group, struct wpabuf *wps); 14468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1448c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * p2p_group_match_dev_id - Match P2P Device Address in group with requested device id 1449c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt */ 1450c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidtint p2p_group_match_dev_id(struct p2p_group *group, struct wpabuf *p2p); 1451c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt 1452c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt/** 14538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_go_discover - Send GO Discoverability Request to a group client 14548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 14558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success (frame scheduled); -1 if client was not found 14568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_group_go_discover(struct p2p_group *group, const u8 *dev_id, 14588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *searching_dev, int rx_freq); 14598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Generic helper functions */ 14628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_ie_text - Build text format description of P2P IE 14658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: P2P IE 14668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for returning text 14678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @end: Pointer to the end of the buf area 14688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets written to the buffer or -1 on failure 14698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 14708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to parse P2P IE contents into text format 14718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * field=value lines. 14728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_ie_text(struct wpabuf *p2p_ie, char *buf, char *end); 14748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_result_text - Build text format description of P2P IE 14778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies: Information elements from scan results 14788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies_len: ies buffer length in octets 14798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for returning text 14808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @end: Pointer to the end of the buf area 14818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets written to the buffer or -1 on failure 14828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 14838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to parse P2P IE contents into text format 14848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * field=value lines. 14858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_scan_result_text(const u8 *ies, size_t ies_len, char *buf, char *end); 14878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 148904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * p2p_parse_dev_addr_in_p2p_ie - Parse P2P Device Address from a concatenated 149004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * P2P IE 149104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @p2p_ie: P2P IE 149204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @dev_addr: Buffer for returning P2P Device Address 149304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * Returns: 0 on success or -1 if P2P Device Address could not be parsed 149404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 149504949598a23f501be6eec21697465fd46a28840aDmitry Shmidtint p2p_parse_dev_addr_in_p2p_ie(struct wpabuf *p2p_ie, u8 *dev_addr); 149604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 149704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt/** 1498c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * p2p_parse_dev_addr - Parse P2P Device Address from P2P IE(s) 1499c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @ies: Information elements from scan results 1500c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @ies_len: ies buffer length in octets 1501c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_addr: Buffer for returning P2P Device Address 1502c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * Returns: 0 on success or -1 if P2P Device Address could not be parsed 1503c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt */ 1504c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidtint p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr); 1505c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt 1506c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt/** 15078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_assoc_req_ie - Build P2P IE for (Re)Association Request frame 15088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: BSSID 15108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for writing the P2P IE 15118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @len: Maximum buf length in octets 15128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_group: Whether this is for association with a P2P GO 15138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: Reassembled P2P IE data from scan results or %NULL if none 15148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets written into buf or -1 on failure 15158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_assoc_req_ie(struct p2p_data *p2p, const u8 *bssid, u8 *buf, 15178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t len, int p2p_group, struct wpabuf *p2p_ie); 15188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_ie - Build P2P IE for Probe Request 15218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies: Buffer for writing P2P IE 1523c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_id: Device ID to search for or %NULL for any 15248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1525c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidtvoid p2p_scan_ie(struct p2p_data *p2p, struct wpabuf *ies, const u8 *dev_id); 15268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15281f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_scan_ie_buf_len - Get maximum buffer length needed for p2p_scan_ie 15291f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 15301f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: Number of octets that p2p_scan_ie() may add to the buffer 15311f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 15321f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtsize_t p2p_scan_ie_buf_len(struct p2p_data *p2p); 15331f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 15341f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 15358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_go_params - Generate random P2P group parameters 15368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @params: Buffer for parameters 15388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 15398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_go_params(struct p2p_data *p2p, struct p2p_go_neg_results *params); 15418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_group_capab - Get Group Capability from P2P IE data 15448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: P2P IE(s) contents 15458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Group Capability 15468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtu8 p2p_get_group_capab(const struct wpabuf *p2p_ie); 15488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_cross_connect_disallowed - Does WLAN AP disallows cross connection 15518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: P2P IE(s) contents 15528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 if cross connection is allow, 1 if not 15538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_get_cross_connect_disallowed(const struct wpabuf *p2p_ie); 15558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_go_dev_addr - Get P2P Device Address from P2P IE data 15588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: P2P IE(s) contents 15598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Pointer to P2P Device Address or %NULL if not included 15608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtconst u8 * p2p_get_go_dev_addr(const struct wpabuf *p2p_ie); 15628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15641f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_get_peer_info - Get P2P peer information 15658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: P2P Device Address of the peer or %NULL to indicate the first peer 15678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @next: Whether to select the peer entry following the one indicated by addr 15681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: Pointer to peer info or %NULL if not found 15691f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 15701f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtconst struct p2p_peer_info * p2p_get_peer_info(struct p2p_data *p2p, 15711f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt const u8 *addr, int next); 15721f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 15731f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 15741f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_get_peer_info_txt - Get internal P2P peer information in text format 15751f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @info: Pointer to P2P peer info from p2p_get_peer_info() 15768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for returning text 15778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buflen: Maximum buffer length 15788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets written to the buffer or -1 on failure 15791f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 15801f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Note: This information is internal to the P2P module and subject to change. 15811f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * As such, this should not really be used by external programs for purposes 15821f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * other than debugging. 15831f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 15841f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint p2p_get_peer_info_txt(const struct p2p_peer_info *info, 15851f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt char *buf, size_t buflen); 15861f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 15871f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 15881f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_peer_known - Check whether P2P peer is known 15891f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 15901f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @addr: P2P Device Address of the peer 15911f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: 1 if the specified device is in the P2P peer table or 0 if not 15928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15931f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint p2p_peer_known(struct p2p_data *p2p, const u8 *addr); 15948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_client_discoverability - Set client discoverability capability 15978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @enabled: Whether client discoverability will be enabled 15998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 16008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to disable (and re-enable) client discoverability. 16018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This capability is enabled by default and should not be disabled in normal 16028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * use cases, i.e., this is mainly for testing purposes. 16038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_client_discoverability(struct p2p_data *p2p, int enabled); 16058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 16071f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_set_managed_oper - Set managed P2P Device operations capability 16088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 16098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @enabled: Whether managed P2P Device operations will be enabled 16108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_managed_oper(struct p2p_data *p2p, int enabled); 16128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_listen_channel(struct p2p_data *p2p, u8 reg_class, u8 channel); 16148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_ssid_postfix(struct p2p_data *p2p, const u8 *postfix, size_t len); 16168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_get_interface_addr(struct p2p_data *p2p, const u8 *dev_addr, 16188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 *iface_addr); 16198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_get_dev_addr(struct p2p_data *p2p, const u8 *iface_addr, 16208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 *dev_addr); 16218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_peer_filter(struct p2p_data *p2p, const u8 *addr); 16238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 16258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_cross_connect - Set cross connection capability 16268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 16278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @enabled: Whether cross connection will be enabled 16288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_cross_connect(struct p2p_data *p2p, int enabled); 16308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_get_oper_freq(struct p2p_data *p2p, const u8 *iface_addr); 16328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 16348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_intra_bss_dist - Set intra BSS distribution 16358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 16368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @enabled: Whether intra BSS distribution will be enabled 16378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_intra_bss_dist(struct p2p_data *p2p, int enabled); 16398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16407a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidtint p2p_channels_includes_freq(const struct p2p_channels *channels, 16417a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidt unsigned int freq); 16427a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidt 16438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 16448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_supported_freq - Check whether channel is supported for P2P 16458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 16468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Channel frequency in MHz 16478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 if channel not usable for P2P, 1 if usable for P2P 16488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_supported_freq(struct p2p_data *p2p, unsigned int freq); 16508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_update_channel_list(struct p2p_data *p2p, struct p2p_channels *chan); 16528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 16548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_best_channels - Update best channel information 16558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 16568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq_24: Frequency (MHz) of best channel in 2.4 GHz band 16578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq_5: Frequency (MHz) of best channel in 5 GHz band 16588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq_overall: Frequency (MHz) of best channel overall 16598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_best_channels(struct p2p_data *p2p, int freq_24, int freq_5, 16618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int freq_overall); 16628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1663700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt/** 1664700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * p2p_set_own_freq_preference - Set own preference for channel 1665700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * @p2p: P2P module context from p2p_init() 1666700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * @freq: Frequency (MHz) of the preferred channel or 0 if no preference 1667700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * 1668700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * This function can be used to set a preference on the operating channel based 1669700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * on frequencies used on the other virtual interfaces that share the same 1670700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * radio. If non-zero, this is used to try to avoid multi-channel concurrency. 1671700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt */ 1672700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidtvoid p2p_set_own_freq_preference(struct p2p_data *p2p, int freq); 1673700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt 16748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtconst u8 * p2p_get_go_neg_peer(struct p2p_data *p2p); 16758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 16778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_group_num_members - Get number of members in group 16788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 16798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of members in the group 16808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtunsigned int p2p_get_group_num_members(struct p2p_group *group); 16828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 16848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_iterate_group_members - Iterate group members 16858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 16868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @next: iteration pointer, must be a pointer to a void * that is set to %NULL 16878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * on the first call and not modified later 16888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: A P2P Interface Address for each call and %NULL for no more members 16898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtconst u8 * p2p_iterate_group_members(struct p2p_group *group, void **next); 16918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 16931f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_group_get_dev_addr - Get a P2P Device Address of a client in a group 16941f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @group: P2P group context from p2p_group_init() 16951f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @addr: P2P Interface Address of the client 16961f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: P2P Device Address of the client if found or %NULL if no match 16971f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * found 16981f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 16991f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtconst u8 * p2p_group_get_dev_addr(struct p2p_group *group, const u8 *addr); 17001f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 17011f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 1702c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * p2p_group_is_client_connected - Check whether a specific client is connected 1703c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @group: P2P group context from p2p_group_init() 1704c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @addr: P2P Device Address of the client 1705c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * Returns: 1 if client is connected or 0 if not 1706c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt */ 1707c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidtint p2p_group_is_client_connected(struct p2p_group *group, const u8 *dev_addr); 1708c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt 1709c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt/** 17108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_peer_found - Get P2P peer info structure of a found peer 17118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 17128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: P2P Device Address of the peer or %NULL to indicate the first peer 17138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @next: Whether to select the peer entry following the one indicated by addr 17148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: The first P2P peer info available or %NULL if no such peer exists 17158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 17168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtconst struct p2p_peer_info * 17178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtp2p_get_peer_found(struct p2p_data *p2p, const u8 *addr, int next); 17188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 17198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 17208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_remove_wps_vendor_extensions - Remove WPS vendor extensions 17218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 17228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 17238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_remove_wps_vendor_extensions(struct p2p_data *p2p); 17248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 17258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 17268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_add_wps_vendor_extension - Add a WPS vendor extension 17278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 17288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @vendor_ext: The vendor extensions to add 17298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 17308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 17318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The wpabuf structures in the array are owned by the P2P 17328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * module after this call. 17338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 17348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_add_wps_vendor_extension(struct p2p_data *p2p, 17358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const struct wpabuf *vendor_ext); 17368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 173775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 173875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * p2p_set_oper_channel - Set the P2P operating channel 173975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @p2p: P2P module context from p2p_init() 174075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @op_reg_class: Operating regulatory class to set 174175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @op_channel: operating channel to set 174275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @cfg_op_channel : Whether op_channel is hardcoded in configuration 174375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Returns: 0 on success, -1 on failure 174475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 174575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint p2p_set_oper_channel(struct p2p_data *p2p, u8 op_reg_class, u8 op_channel, 174675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int cfg_op_channel); 174775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 17481f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 174904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * p2p_set_pref_chan - Set P2P preferred channel list 175004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @p2p: P2P module context from p2p_init() 175104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @num_pref_chan: Number of entries in pref_chan list 175204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @pref_chan: Preferred channels or %NULL to remove preferences 175304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * Returns: 0 on success, -1 on failure 175404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 175504949598a23f501be6eec21697465fd46a28840aDmitry Shmidtint p2p_set_pref_chan(struct p2p_data *p2p, unsigned int num_pref_chan, 175604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt const struct p2p_channel *pref_chan); 175704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 175804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt/** 17591f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_in_progress - Check whether a P2P operation is progress 17601f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 17611f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: 0 if P2P module is idle or 1 if an operation is in progress 17621f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 17631f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint p2p_in_progress(struct p2p_data *p2p); 17641f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 17651f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt#ifdef ANDROID_P2P 17661f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 17672fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidt * p2p_search_in_progress - Check whether a P2P SEARCH is in progress 17681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 17691f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: 0 if P2P module is idle or 1 if an operation is in progress 17701f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 17711f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint p2p_search_in_progress(struct p2p_data *p2p); 17722fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidt 17732fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidt/** 17742fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidt * p2p_search_pending - Check whether there is a deferred P2P SEARCH 17752fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidt * @p2p: P2P module context from p2p_init() 17762fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidt * Returns: 0 if there is no deferred P2P search or 1 if there is one 17772fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidt */ 17782fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidtint p2p_search_pending(struct p2p_data *p2p); 17791f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt#endif 17801f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 17811f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 17821f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_other_scan_completed - Notify completion of non-P2P scan 17831f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 17841f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: 0 if P2P module is idle or 1 if an operation was started 17851f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 17861f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint p2p_other_scan_completed(struct p2p_data *p2p); 17871f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 17881f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtconst char * p2p_wps_method_text(enum p2p_wps_method method); 17891f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 179061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt/** 179161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt * p2p_set_config_timeout - Set local config timeouts 179261d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt * @p2p: P2P module context from p2p_init() 179361d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt * @go_timeout: Time in 10 ms units it takes to start the GO mode 179461d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt * @client_timeout: Time in 10 ms units it takes to start the client mode 179561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt */ 179661d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtvoid p2p_set_config_timeout(struct p2p_data *p2p, u8 go_timeout, 179761d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt u8 client_timeout); 179861d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt 179961d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtvoid p2p_increase_search_delay(struct p2p_data *p2p, unsigned int delay); 180061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt 180161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_beacon(struct p2p_data *p2p, struct wpabuf *ie); 180261d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_probe_req(struct p2p_data *p2p, struct wpabuf *ie); 180361d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_probe_resp(struct p2p_data *p2p, struct wpabuf *ie); 180461d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_assoc_req(struct p2p_data *p2p, struct wpabuf *ie); 180561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_invitation(struct p2p_data *p2p, struct wpabuf *ie); 180661d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_prov_disc_req(struct p2p_data *p2p, struct wpabuf *ie); 180761d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_prov_disc_resp(struct p2p_data *p2p, struct wpabuf *ie); 180861d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_go_neg(struct p2p_data *p2p, struct wpabuf *ie); 180961d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_dev_info(struct p2p_data *p2p, const struct wpabuf *elem); 181061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_assoc_bssid(struct p2p_data *p2p, const struct wpabuf *elem); 181161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_coupled_sink_info(struct p2p_data *p2p, 181261d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt const struct wpabuf *elem); 181361d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtstruct wpabuf * wifi_display_encaps(struct wpabuf *subelems); 181461d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt 1815d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt/** 1816d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * p2p_set_disc_int - Set min/max discoverable interval for p2p_find 1817d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * @p2p: P2P module context from p2p_init() 1818d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * @min_disc_int: minDiscoverableInterval (in units of 100 TU); default 1 1819d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * @max_disc_int: maxDiscoverableInterval (in units of 100 TU); default 3 1820d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * @max_disc_tu: Maximum number of TUs (1.024 ms) for discoverable interval; or 1821d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * -1 not to limit 1822d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * Returns: 0 on success, or -1 on failure 1823d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * 1824d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * This function can be used to configure minDiscoverableInterval and 1825d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * maxDiscoverableInterval parameters for the Listen state during device 1826d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * discovery (p2p_find). A random number of 100 TU units is picked for each 1827d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * Listen state iteration from [min_disc_int,max_disc_int] range. 1828d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * 1829d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * max_disc_tu can be used to futher limit the discoverable duration. However, 1830d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * it should be noted that use of this parameter is not recommended since it 1831d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * would not be compliant with the P2P specification. 1832d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt */ 1833d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidtint p2p_set_disc_int(struct p2p_data *p2p, int min_disc_int, int max_disc_int, 1834d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt int max_disc_tu); 1835d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt 18368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* P2P_H */ 1837