p2p.h revision 2fb777c379ad560c309c54b96c2c13291da23f54
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 568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_go_neg_results - P2P Group Owner Negotiation results 588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_go_neg_results { 608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * status - Negotiation result (Status Code) 628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 0 (P2P_SC_SUCCESS) indicates success. Non-zero values indicate 648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * failed negotiation. 658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int status; 678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * role_go - Whether local end is Group Owner 708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int role_go; 728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * freq - Frequency of the group operational channel in MHz 758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int freq; 778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ssid - SSID of the group 808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 ssid[32]; 828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ssid_len - Length of SSID in octets 858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t ssid_len; 878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * passphrase - WPA2-Personal passphrase for the group (GO only) 908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char passphrase[64]; 928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * peer_device_addr - P2P Device Address of the peer 958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 peer_device_addr[ETH_ALEN]; 978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * peer_interface_addr - P2P Interface Address of the peer 1008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 peer_interface_addr[ETH_ALEN]; 1028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wps_method - WPS method to be used during provisioning 1058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_wps_method wps_method; 1078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_MAX_CHANNELS 50 1098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * freq_list - Zero-terminated list of possible operational channels 1128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int freq_list[P2P_MAX_CHANNELS]; 1148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * persistent_group - Whether the group should be made persistent 1171f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 0 = not persistent 1181f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 1 = persistent group without persistent reconnect 1191f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 2 = persistent group with persistent reconnect 1208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int persistent_group; 1228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * peer_config_timeout - Peer configuration timeout (in 10 msec units) 1258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int peer_config_timeout; 1278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 1288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_data; 1308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_scan_type { 1328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SCAN_SOCIAL, 1338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SCAN_FULL, 1348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SCAN_SPECIFIC, 1358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SCAN_SOCIAL_PLUS_ONE 1368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 1378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_MAX_WPS_VENDOR_EXT 10 1398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_peer_info - P2P peer information 1428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_peer_info { 1448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_device_addr - P2P Device Address of the peer 1468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 p2p_device_addr[ETH_ALEN]; 1488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * pri_dev_type - Primary Device Type 1518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 pri_dev_type[8]; 1538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * device_name - Device Name (0..32 octets encoded in UTF-8) 1568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char device_name[33]; 1588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * manufacturer - Manufacturer (0..64 octets encoded in UTF-8) 1618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char manufacturer[65]; 1638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * model_name - Model Name (0..32 octets encoded in UTF-8) 1668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char model_name[33]; 1688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * model_number - Model Number (0..32 octets encoded in UTF-8) 1718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char model_number[33]; 1738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * serial_number - Serial Number (0..32 octets encoded in UTF-8) 1768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char serial_number[33]; 1788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 18075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * level - Signal level 18175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 18275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int level; 18375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 18475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /** 1858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * config_methods - WPS Configuration Methods 1868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u16 config_methods; 1888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_capab - Device Capabilities 1918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 dev_capab; 1938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * group_capab - Group Capabilities 1968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 group_capab; 1988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wps_sec_dev_type_list - WPS secondary device type list 2018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 2028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This list includes from 0 to 16 Secondary Device Types as indicated 2038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * by wps_sec_dev_type_list_len (8 * number of types). 2048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 wps_sec_dev_type_list[128]; 2068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wps_sec_dev_type_list_len - Length of secondary device type list 2098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t wps_sec_dev_type_list_len; 2118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT]; 2138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 2148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 21575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenenum p2p_prov_disc_status { 21675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen P2P_PROV_DISC_SUCCESS, 21775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen P2P_PROV_DISC_TIMEOUT, 21875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen P2P_PROV_DISC_REJECTED, 21975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 22075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 2218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 2228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_config - P2P configuration 2238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 2248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This configuration is provided to the P2P module during initialization with 2258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_init(). 2268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_config { 2288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * country - Country code to use in P2P operations 2308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char country[3]; 2328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * reg_class - Regulatory class for own listen channel 2358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 reg_class; 2378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * channel - Own listen channel 2408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 channel; 2428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Regulatory class for own operational channel 2458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 op_reg_class; 2478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * op_channel - Own operational channel 2508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 op_channel; 2528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * cfg_op_channel - Whether op_channel is hardcoded in configuration 2558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 cfg_op_channel; 2578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * channels - Own supported regulatory classes and channels 2608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 2618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * List of supposerted channels per regulatory class. The regulatory 2628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * classes are defined in IEEE Std 802.11-2007 Annex J and the 2638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * numbering of the clases depends on the configured country code. 2648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct p2p_channels channels; 2668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * pri_dev_type - Primary Device Type (see WPS) 2698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 pri_dev_type[8]; 2718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * P2P_SEC_DEVICE_TYPES - Maximum number of secondary device types 2748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_SEC_DEVICE_TYPES 5 2768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * sec_dev_type - Optional secondary device types 2798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 sec_dev_type[P2P_SEC_DEVICE_TYPES][8]; 2818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * num_sec_dev_types - Number of sec_dev_type entries 2848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t num_sec_dev_types; 2868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_addr - P2P Device Address 2898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 dev_addr[ETH_ALEN]; 2918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_name - Device Name 2948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *dev_name; 2968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *manufacturer; 2988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *model_name; 2998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *model_number; 3008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *serial_number; 3018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 uuid[16]; 3038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u16 config_methods; 3048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * concurrent_operations - Whether concurrent operations are supported 3078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int concurrent_operations; 3098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * max_peers - Maximum number of discovered peers to remember 3128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * If more peers are discovered, older entries will be removed to make 3148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * room for the new ones. 3158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t max_peers; 3178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_intra_bss - Intra BSS communication is supported 3208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int p2p_intra_bss; 3228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ssid_postfix - Postfix data to add to the SSID 3258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This data will be added to the end of the SSID after the 3278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * DIRECT-<random two octets> prefix. 3288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 ssid_postfix[32 - 9]; 3308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ssid_postfix_len - Length of the ssid_postfix data 3338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t ssid_postfix_len; 3358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * msg_ctx - Context to use with wpa_msg() calls 3388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void *msg_ctx; 3408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * cb_ctx - Context to use with callback functions 3438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void *cb_ctx; 3458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Callbacks to request lower layer driver operations */ 3488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan - Request a P2P scan/search 3518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 3528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @type: Scan type 3538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Specific frequency (MHz) to scan or 0 for no restriction 3548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @num_req_dev_types: Number of requested device types 3558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @req_dev_types: Array containing requested device types 356c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_id: Device ID to search for or %NULL to find all devices 3578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 3588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback function is used to request a P2P scan or search 3608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * operation to be completed. Type type argument specifies which type 3618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * of scan is to be done. @P2P_SCAN_SOCIAL indicates that only the 3628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * social channels (1, 6, 11) should be scanned. @P2P_SCAN_FULL 3638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * indicates that all channels are to be scanned. @P2P_SCAN_SPECIFIC 3648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * request a scan of a single channel specified by freq. 3658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @P2P_SCAN_SOCIAL_PLUS_ONE request scan of all the social channels 3668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * plus one extra channel specified by freq. 3678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The full scan is used for the initial scan to find group owners from 3698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * all. The other types are used during search phase scan of the social 3708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * channels (with potential variation if the Listen channel of the 3718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * target peer is known or if other channels are scanned in steps). 3728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The scan results are returned after this call by calling 3748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_res_handler() for each scan result that has a P2P IE and 3758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * then calling p2p_scan_res_handled() to indicate that all scan 3768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * results have been indicated. 3778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int (*p2p_scan)(void *ctx, enum p2p_scan_type type, int freq, 3798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int num_req_dev_types, 380c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt const u8 *req_dev_types, const u8 *dev_id); 3818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * send_probe_resp - Transmit a Probe Response frame 3848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 3858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Probe Response frame (including the header and body) 3868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 3878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to reply to Probe Request frames that were 3898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * indicated with a call to p2p_probe_req_rx(). The response is to be 3908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * sent on the same channel or to be dropped if the driver is not 3918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * anymore listening to Probe Request frames. 3928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Alternatively, the responsibility for building the Probe Response 3948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * frames in Listen state may be in another system component in which 3958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * case this function need to be implemented (i.e., the function 3968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * pointer can be %NULL). The WPS and P2P IEs to be added for Probe 3978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Response frames in such a case are available from the 3988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * start_listen() callback. It should be noted that the received Probe 3998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Request frames must be indicated by calling p2p_probe_req_rx() even 4008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * if this send_probe_resp() is not used. 4018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int (*send_probe_resp)(void *ctx, const struct wpabuf *buf); 4038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * send_action - Transmit an Action frame 4068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 4078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency in MHz for the channel on which to transmit 4088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dst: Destination MAC address (Address 1) 4098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @src: Source MAC address (Address 2) 4108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: BSSID (Address 3) 4118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Frame body (starting from Category field) 4128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @len: Length of buf in octets 4138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wait_time: How many msec to wait for a response frame 4148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 4158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The Action frame may not be transmitted immediately and the status 4178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * of the transmission must be reported by calling 4188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_send_action_cb() once the frame has either been transmitted or 4198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * it has been dropped due to excessive retries or other failure to 4208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * transmit. 4218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int (*send_action)(void *ctx, unsigned int freq, const u8 *dst, 4238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *src, const u8 *bssid, const u8 *buf, 4248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t len, unsigned int wait_time); 4258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * send_action_done - Notify that Action frame sequence was completed 4288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 4298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is called when the Action frame sequence that was 4318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * started with send_action() has been completed, i.e., when there is 4328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * no need to wait for a response from the destination peer anymore. 4338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*send_action_done)(void *ctx); 4358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * start_listen - Start Listen state 4388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 4398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency of the listen channel in MHz 4408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @duration: Duration for the Listen state in milliseconds 4418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @probe_resp_ie: IE(s) to be added to Probe Response frames 4428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 4438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This Listen state may not start immediately since the driver may 4458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * have other pending operations to complete first. Once the Listen 4468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * state has started, p2p_listen_cb() must be called to notify the P2P 4478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * module. Once the Listen state is stopped, p2p_listen_end() must be 4488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * called to notify the P2P module that the driver is not in the Listen 4498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * state anymore. 4508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * If the send_probe_resp() is not used for generating the response, 4528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the IEs from probe_resp_ie need to be added to the end of the Probe 4538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Response frame body. If send_probe_resp() is used, the probe_resp_ie 4548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * information can be ignored. 4558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int (*start_listen)(void *ctx, unsigned int freq, 4578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int duration, 4588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const struct wpabuf *probe_resp_ie); 4598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * stop_listen - Stop Listen state 4618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 4628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback can be used to stop a Listen state operation that was 4648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * previously requested with start_listen(). 4658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*stop_listen)(void *ctx); 4678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * get_noa - Get current Notice of Absence attribute payload 4708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 4718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @interface_addr: P2P Interface Address of the GO 4728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for returning NoA 4738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf_len: Buffer length in octets 4748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets used in buf, 0 to indicate no NoA is being 4758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * advertized, or -1 on failure 4768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to fetch the current Notice of Absence 4788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * attribute value from GO. 4798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int (*get_noa)(void *ctx, const u8 *interface_addr, u8 *buf, 4818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t buf_len); 4828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Callbacks to notify events to upper layer management entity */ 4848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_found - Notification of a found P2P Device 4878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 4888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: Source address of the message triggering this notification 4898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @info: P2P peer information 4908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @new_device: Inform if the peer is newly found 4918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to notify that a new P2P Device has been 4938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * found. This may happen, e.g., during Search state based on scan 4948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * results or during Listen state based on receive Probe Request and 4958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Group Owner Negotiation Request. 4968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*dev_found)(void *ctx, const u8 *addr, 4988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const struct p2p_peer_info *info, 4998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int new_device); 5008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_lost - Notification of a lost P2P Device 5038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_addr: P2P Device Address of the lost P2P Device 5058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to notify that a P2P Device has been deleted. 5078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*dev_lost)(void *ctx, const u8 *dev_addr); 5098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * go_neg_req_rx - Notification of a receive GO Negotiation Request 5128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @src: Source address of the message triggering this notification 5148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_passwd_id: WPS Device Password ID 5158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to notify that a P2P Device is requesting 5178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * group owner negotiation with us, but we do not have all the 5188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * necessary information to start GO Negotiation. This indicates that 5198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the local user has not authorized the connection yet by providing a 5208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * PIN or PBC button press. This information can be provided with a 5218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * call to p2p_connect(). 5228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*go_neg_req_rx)(void *ctx, const u8 *src, u16 dev_passwd_id); 5248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * go_neg_completed - Notification of GO Negotiation results 5278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @res: GO Negotiation results 5298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to notify that Group Owner Negotiation has 5318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * been completed. Non-zero struct p2p_go_neg_results::status indicates 5328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * failed negotiation. In case of success, this function is responsible 5338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * for creating a new group interface (or using the existing interface 5348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * depending on driver features), setting up the group interface in 5358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * proper mode based on struct p2p_go_neg_results::role_go and 5368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * initializing WPS provisioning either as a Registrar (if GO) or as an 5378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Enrollee. Successful WPS provisioning must be indicated by calling 5388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_wps_success_cb(). The callee is responsible for timing out group 5398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * formation if WPS provisioning cannot be completed successfully 5408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * within 15 seconds. 5418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*go_neg_completed)(void *ctx, struct p2p_go_neg_results *res); 5438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * sd_request - Callback on Service Discovery Request 5468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency (in MHz) of the channel 5488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the request 5498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dialog_token: Dialog token 5508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @update_indic: Service Update Indicator from the source of request 5518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs: P2P Service Request TLV(s) 5528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs_len: Length of tlvs buffer in octets 5538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate reception of a service discovery 5558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * request. Response to the query must be indicated by calling 5568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_response() with the context information from the arguments to 5578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * this callback function. 5588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback handler can be set to %NULL to indicate that service 5608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * discovery is not supported. 5618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*sd_request)(void *ctx, int freq, const u8 *sa, u8 dialog_token, 5638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u16 update_indic, const u8 *tlvs, size_t tlvs_len); 5648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * sd_response - Callback on Service Discovery Response 5678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the request 5698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @update_indic: Service Update Indicator from the source of response 5708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs: P2P Service Response TLV(s) 5718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs_len: Length of tlvs buffer in octets 5728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate reception of a service discovery 5748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * response. This callback handler can be set to %NULL if no service 5758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * discovery requests are used. The information provided with this call 5768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * is replies to the queries scheduled with p2p_sd_request(). 5778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*sd_response)(void *ctx, const u8 *sa, u16 update_indic, 5798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *tlvs, size_t tlvs_len); 5808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * prov_disc_req - Callback on Provisiong Discovery Request 5838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer: Source address of the request 5858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @config_methods: Requested WPS Config Method 5868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_addr: P2P Device Address of the found P2P Device 5878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @pri_dev_type: Primary Device Type 5888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_name: Device Name 5898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @supp_config_methods: Supported configuration Methods 5908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_capab: Device Capabilities 5918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group_capab: Group Capabilities 5921f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @group_id: P2P Group ID (or %NULL if not included) 5931f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @group_id_len: Length of P2P Group ID 5948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate reception of a Provision Discovery 5968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Request frame that the P2P module accepted. 5978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*prov_disc_req)(void *ctx, const u8 *peer, u16 config_methods, 5998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *dev_addr, const u8 *pri_dev_type, 6008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *dev_name, u16 supp_config_methods, 6011f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt u8 dev_capab, u8 group_capab, 6021f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt const u8 *group_id, size_t group_id_len); 6038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 6058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * prov_disc_resp - Callback on Provisiong Discovery Response 6068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 6078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer: Source address of the response 6088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @config_methods: Value from p2p_prov_disc_req() or 0 on failure 6098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate reception of a Provision Discovery 6118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Response frame for a pending request scheduled with 6128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_prov_disc_req(). This callback handler can be set to %NULL if 6138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * provision discovery is not used. 6148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*prov_disc_resp)(void *ctx, const u8 *peer, u16 config_methods); 6168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 61875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * prov_disc_fail - Callback on Provision Discovery failure 61975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @ctx: Callback context from cb_ctx 62075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @peer: Source address of the response 62175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @status: Cause of failure, will not be %P2P_PROV_DISC_SUCCESS 62275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 62375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * This callback is used to indicate either a failure or no response 62475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * to an earlier provision discovery request. 62575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 62675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * This callback handler can be set to %NULL if provision discovery 62775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * is not used or failures do not need to be indicated. 62875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 62975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen void (*prov_disc_fail)(void *ctx, const u8 *peer, 63075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen enum p2p_prov_disc_status status); 63175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 63275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /** 6338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_process - Optional callback for processing Invitations 6348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 6358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the Invitation Request 6368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: P2P Group BSSID from the request or %NULL if not included 6378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_dev_addr: GO Device Address from P2P Group ID 6388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid: SSID from P2P Group ID 6398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid_len: Length of ssid buffer in octets 6408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go: Variable for returning whether the local end is GO in the group 6418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group_bssid: Buffer for returning P2P Group BSSID (if local end GO) 6428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @force_freq: Variable for returning forced frequency for the group 6438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @persistent_group: Whether this is an invitation to reinvoke a 6448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * persistent group (instead of invitation to join an active 6458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * group) 6468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Status code (P2P_SC_*) 6478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This optional callback can be used to implement persistent reconnect 6498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * by allowing automatic restarting of persistent groups without user 6508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * interaction. If this callback is not implemented (i.e., is %NULL), 6518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the received Invitation Request frames are replied with 6528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * %P2P_SC_REQ_RECEIVED status and indicated to upper layer with the 6538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_result() callback. 6548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * If the requested parameters are acceptable and the group is known, 6568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * %P2P_SC_SUCCESS may be returned. If the requested group is unknown, 6578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * %P2P_SC_FAIL_UNKNOWN_GROUP should be returned. %P2P_SC_REQ_RECEIVED 6588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * can be returned if there is not enough data to provide immediate 6598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * response, i.e., if some sort of user interaction is needed. The 6608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_received() callback will be called in that case 6618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * immediately after this call. 6628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 (*invitation_process)(void *ctx, const u8 *sa, const u8 *bssid, 6648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *go_dev_addr, const u8 *ssid, 6658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t ssid_len, int *go, u8 *group_bssid, 6668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int *force_freq, int persistent_group); 6678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 6698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_received - Callback on Invitation Request RX 6708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 6718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the Invitation Request 6728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: P2P Group BSSID or %NULL if not received 6738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid: SSID of the group 6748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid_len: Length of ssid in octets 6758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_dev_addr: GO Device Address 6768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @status: Response Status 6778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @op_freq: Operational frequency for the group 6788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate sending of an Invitation Response 6808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * for a received Invitation Request. If status == 0 (success), the 6818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * upper layer code is responsible for starting the group. status == 1 6828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * indicates need to get user authorization for the group. Other status 6838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * values indicate that the invitation request was rejected. 6848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*invitation_received)(void *ctx, const u8 *sa, const u8 *bssid, 6868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *ssid, size_t ssid_len, 6878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *go_dev_addr, u8 status, 6888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int op_freq); 6898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 6918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_result - Callback on Invitation result 6928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 6938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @status: Negotiation result (Status Code) 6948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: P2P Group BSSID or %NULL if not received 6958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate result of an Invitation procedure 6978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * started with a call to p2p_invite(). The indicated status code is 6988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the value received from the peer in Invitation Response with 0 6998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * (P2P_SC_SUCCESS) indicating success or -1 to indicate a timeout or a 7008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * local failure in transmitting the Invitation Request. 7018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*invitation_result)(void *ctx, int status, const u8 *bssid); 703c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt 704c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt /** 705c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * go_connected - Check whether we are connected to a GO 706c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @ctx: Callback context from cb_ctx 707c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_addr: P2P Device Address of a GO 708c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * Returns: 1 if we are connected as a P2P client to the specified GO 709c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * or 0 if not. 710c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt */ 711c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt int (*go_connected)(void *ctx, const u8 *dev_addr); 7128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 7138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* P2P module initialization/deinitialization */ 7168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 7188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_init - Initialize P2P module 7198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @cfg: P2P module configuration 7208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Pointer to private data or %NULL on failure 7218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to initialize global P2P module context (one per 7238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * device). The P2P module will keep a copy of the configuration data, so the 7248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * caller does not need to maintain this structure. However, the callback 7258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * functions and the context parameters to them must be kept available until 7268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the P2P module is deinitialized with p2p_deinit(). 7278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_data * p2p_init(const struct p2p_config *cfg); 7298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 7318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_deinit - Deinitialize P2P module 7328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 7338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_deinit(struct p2p_data *p2p); 7358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 7378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_flush - Flush P2P module state 7388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 7398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This command removes the P2P module state like peer device entries. 7418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_flush(struct p2p_data *p2p); 7438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 7458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_unauthorize - Unauthorize the specified peer device 7468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 7478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: P2P peer entry to be unauthorized 7488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 7498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This command removes any connection authorization from the specified P2P 7518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * peer device address. This can be used, e.g., to cancel effect of a previous 7528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_authorize() or p2p_connect() call that has not yet resulted in completed 7538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * GO Negotiation. 7548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_unauthorize(struct p2p_data *p2p, const u8 *addr); 7568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 7588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_dev_name - Set device name 7598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 7608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 7618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to update the P2P module configuration with 7638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * information that was not available at the time of the p2p_init() call. 7648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_dev_name(struct p2p_data *p2p, const char *dev_name); 7668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_manufacturer(struct p2p_data *p2p, const char *manufacturer); 7688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_model_name(struct p2p_data *p2p, const char *model_name); 7698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_model_number(struct p2p_data *p2p, const char *model_number); 7708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_serial_number(struct p2p_data *p2p, const char *serial_number); 7718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_config_methods(struct p2p_data *p2p, u16 config_methods); 7738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_uuid(struct p2p_data *p2p, const u8 *uuid); 7748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 7768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_pri_dev_type - Set primary device type 7778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 7788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 7798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to update the P2P module configuration with 7818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * information that was not available at the time of the p2p_init() call. 7828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_pri_dev_type(struct p2p_data *p2p, const u8 *pri_dev_type); 7848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 7868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_sec_dev_types - Set secondary device types 7878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 7888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 7898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to update the P2P module configuration with 7918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * information that was not available at the time of the p2p_init() call. 7928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_sec_dev_types(struct p2p_data *p2p, const u8 dev_types[][8], 7948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t num_dev_types); 7958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_country(struct p2p_data *p2p, const char *country); 7978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Commands from upper layer management entity */ 8008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_discovery_type { 8028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_FIND_START_WITH_FULL, 8038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_FIND_ONLY_SOCIAL, 8048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_FIND_PROGRESSIVE 8058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 8068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 8088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_find - Start P2P Find (Device Discovery) 8098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @timeout: Timeout for find operation in seconds or 0 for no timeout 8118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @type: Device Discovery type 8128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @num_req_dev_types: Number of requested device types 8138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @req_dev_types: Requested device types array, must be an array 8148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * containing num_req_dev_types * WPS_DEV_TYPE_LEN bytes; %NULL if no 8158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * requested device types. 816c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_id: Device ID to search for or %NULL to find all devices 8178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 8188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_find(struct p2p_data *p2p, unsigned int timeout, 8208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_discovery_type type, 821c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt unsigned int num_req_dev_types, const u8 *req_dev_types, 822c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt const u8 *dev_id); 8238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 8258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_stop_find - Stop P2P Find (Device Discovery) 8268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_stop_find(struct p2p_data *p2p); 8298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 8318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_stop_find_for_freq - Stop P2P Find for next oper on specific freq 8328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency in MHz for next operation 8348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 8358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This is like p2p_stop_find(), but Listen state is not stopped if we are 8368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * already on the same frequency. 8378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_stop_find_for_freq(struct p2p_data *p2p, int freq); 8398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 8418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_listen - Start P2P Listen state for specified duration 8428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @timeout: Listen state duration in milliseconds 8448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 8458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 8468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to request the P2P module to keep the device 8478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * discoverable on the listen channel for an extended set of time. At least in 8488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * its current form, this is mainly used for testing purposes and may not be of 8498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * much use for normal P2P operations. 8508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_listen(struct p2p_data *p2p, unsigned int timeout); 8528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 8548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_connect - Start P2P group formation (GO negotiation) 8558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer_addr: MAC address of the peer P2P client 8578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wps_method: WPS method to be used in provisioning 8588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_intent: Local GO intent value (1..15) 8598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @own_interface_addr: Intended interface address to use with the group 8608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @force_freq: The only allowed channel frequency in MHz or 0 8611f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @persistent_group: Whether to create a persistent group (0 = no, 1 = 8621f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * persistent group without persistent reconnect, 2 = persistent group with 8631f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * persistent reconnect) 8648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 8658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_connect(struct p2p_data *p2p, const u8 *peer_addr, 8678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_wps_method wps_method, 8688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int go_intent, const u8 *own_interface_addr, 8698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int force_freq, int persistent_group); 8708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 8728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_authorize - Authorize P2P group formation (GO negotiation) 8738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer_addr: MAC address of the peer P2P client 8758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wps_method: WPS method to be used in provisioning 8768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_intent: Local GO intent value (1..15) 8778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @own_interface_addr: Intended interface address to use with the group 8788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @force_freq: The only allowed channel frequency in MHz or 0 8791f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @persistent_group: Whether to create a persistent group (0 = no, 1 = 8801f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * persistent group without persistent reconnect, 2 = persistent group with 8811f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * persistent reconnect) 8828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 8838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 8848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This is like p2p_connect(), but the actual group negotiation is not 8858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * initiated automatically, i.e., the other end is expected to do that. 8868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_authorize(struct p2p_data *p2p, const u8 *peer_addr, 8888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_wps_method wps_method, 8898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int go_intent, const u8 *own_interface_addr, 8908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int force_freq, int persistent_group); 8918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 8938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_reject - Reject peer device (explicitly block connection attempts) 8948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 8958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer_addr: MAC address of the peer P2P client 8968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 8978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_reject(struct p2p_data *p2p, const u8 *peer_addr); 8998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 9018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_prov_disc_req - Send Provision Discovery Request 9028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 9038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer_addr: MAC address of the peer P2P client 9048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @config_methods: WPS Config Methods value (only one bit set) 9058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @join: Whether this is used by a client joining an active group 9061f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @force_freq: Forced TX frequency for the frame (mainly for the join case) 9078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 9088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 9098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to request a discovered P2P peer to display a PIN 9108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * (config_methods = WPS_CONFIG_DISPLAY) or be prepared to enter a PIN from us 9118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * (config_methods = WPS_CONFIG_KEYPAD). The Provision Discovery Request frame 9128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * is transmitted once immediately and if no response is received, the frame 9138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * will be sent again whenever the target device is discovered during device 9148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dsicovery (start with a p2p_find() call). Response from the peer is 9158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * indicated with the p2p_config::prov_disc_resp() callback. 9168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 9178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr, 9181f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt u16 config_methods, int join, int force_freq); 9198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 9218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_request - Schedule a service discovery query 9228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 9238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dst: Destination peer or %NULL to apply for all peers 9248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs: P2P Service Query TLV(s) 9258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Reference to the query or %NULL on failure 9268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 9278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Response to the query is indicated with the p2p_config::sd_response() 9288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * callback. 9298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 9308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid * p2p_sd_request(struct p2p_data *p2p, const u8 *dst, 9318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const struct wpabuf *tlvs); 9328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 9348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_cancel_request - Cancel a pending service discovery query 9358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 9368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @req: Query reference from p2p_sd_request() 9378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 if request for cancelled; -1 if not found 9388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 9398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_sd_cancel_request(struct p2p_data *p2p, void *req); 9408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 9428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_response - Send response to a service discovery query 9438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 9448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency from p2p_config::sd_request() callback 9458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dst: Destination address from p2p_config::sd_request() callback 9468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dialog_token: Dialog token from p2p_config::sd_request() callback 9478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @resp_tlvs: P2P Service Response TLV(s) 9488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 9498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is called as a response to the request indicated with 9508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_config::sd_request() callback. 9518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 9528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_sd_response(struct p2p_data *p2p, int freq, const u8 *dst, 9538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 dialog_token, const struct wpabuf *resp_tlvs); 9548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 9568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_service_update - Indicate a change in local services 9578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 9588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 9598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function needs to be called whenever there is a change in availability 9608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * of the local services. This will increment the Service Update Indicator 9618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * value which will be used in SD Request and Response frames. 9628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 9638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_sd_service_update(struct p2p_data *p2p); 9648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_invite_role { 9678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_INVITE_ROLE_GO, 9688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_INVITE_ROLE_ACTIVE_GO, 9698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_INVITE_ROLE_CLIENT 9708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 9718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 9738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_invite - Invite a P2P Device into a group 9748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 9758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer: Device Address of the peer P2P Device 9768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @role: Local role in the group 9778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: Group BSSID or %NULL if not known 9788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid: Group SSID 9798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid_len: Length of ssid in octets 9808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @force_freq: The only allowed channel frequency in MHz or 0 9818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_dev_addr: Forced GO Device Address or %NULL if none 9828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @persistent_group: Whether this is to reinvoke a persistent group 9838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 9848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 9858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role, 9868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *bssid, const u8 *ssid, size_t ssid_len, 9878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int force_freq, const u8 *go_dev_addr, 9888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int persistent_group); 9898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 9918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_presence_req - Request GO presence 9928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 9938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_interface_addr: GO P2P Interface Address 9948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @own_interface_addr: Own P2P Interface Address for this group 9958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Group operating frequence (in MHz) 9968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @duration1: Preferred presence duration in microseconds 9978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @interval1: Preferred presence interval in microseconds 9988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @duration2: Acceptable presence duration in microseconds 9998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @interval2: Acceptable presence interval in microseconds 10008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 10018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 10028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * If both duration and interval values are zero, the parameter pair is not 10038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * specified (i.e., to remove Presence Request, use duration1 = interval1 = 0). 10048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_presence_req(struct p2p_data *p2p, const u8 *go_interface_addr, 10068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *own_interface_addr, unsigned int freq, 10078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u32 duration1, u32 interval1, u32 duration2, 10088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u32 interval2); 10098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_ext_listen - Set Extended Listen Timing 10128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Group operating frequence (in MHz) 10148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @period: Availability period in milliseconds (1-65535; 0 to disable) 10158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @interval: Availability interval in milliseconds (1-65535; 0 to disable) 10168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 10178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 10188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to enable or disable (period = interval = 0) 10198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Extended Listen Timing. When enabled, the P2P Device will become 10208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * discoverable (go into Listen State) every @interval milliseconds for at 10218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * least @period milliseconds. 10228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_ext_listen(struct p2p_data *p2p, unsigned int period, 10248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int interval); 10258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Event notifications from upper layer management operations */ 10278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_wps_success_cb - Report successfully completed WPS provisioning 10308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @mac_addr: Peer address 10328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 10338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to report successfully completed WPS provisioning 10348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * during group formation in both GO/Registrar and client/Enrollee roles. 10358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_wps_success_cb(struct p2p_data *p2p, const u8 *mac_addr); 10378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_formation_failed - Report failed WPS provisioning 10408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 10428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to report failed group formation. This can happen 10438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * either due to failed WPS provisioning or due to 15 second timeout during 10448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the provisioning phase. 10458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_group_formation_failed(struct p2p_data *p2p); 10478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10481f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 10491f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_get_provisioning_info - Get any stored provisioning info 10501f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 10511f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @addr: Peer P2P Device Address 10521f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: WPS provisioning information (WPS config method) or 0 if no 10531f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * information is available 10541f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 10551f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * This function is used to retrieve stored WPS provisioning info for the given 10561f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * peer. 10571f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 10581f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtu16 p2p_get_provisioning_info(struct p2p_data *p2p, const u8 *addr); 10591f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 10601f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 10611f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_clear_provisioning_info - Clear any stored provisioning info 10621f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 10631f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @iface_addr: Peer P2P Interface Address 10641f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 10651f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * This function is used to clear stored WPS provisioning info for the given 10661f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * peer. 10671f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 10681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtvoid p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *iface_addr); 10691f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 10708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Event notifications from lower layer driver operations */ 10728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_probe_req_rx - Report reception of a Probe Request frame 10758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: Source MAC address 10771f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @dst: Destination MAC address if available or %NULL 10781f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @bssid: BSSID if available or %NULL 10798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ie: Information elements from the Probe Request frame body 10808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ie_len: Length of ie buffer in octets 10818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 to indicate the frame was not processed or 1 if it was 10828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10831f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint p2p_probe_req_rx(struct p2p_data *p2p, const u8 *addr, const u8 *dst, 10841f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt const u8 *bssid, const u8 *ie, size_t ie_len); 10858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_rx_action - Report received Action frame 10888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @da: Destination address of the received Action frame 10908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the received Action frame 10918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: Address 3 of the received Action frame 10928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @category: Category of the received Action frame 10938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @data: Action frame body after the Category field 10948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @len: Length of the data buffer in octets 10958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency (in MHz) on which the frame was received 10968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_rx_action(struct p2p_data *p2p, const u8 *da, const u8 *sa, 10988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *bssid, u8 category, 10998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *data, size_t len, int freq); 11008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 11028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_res_handler - Indicate a P2P scan results 11038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: BSSID of the scan result 11058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency of the channel on which the device was found in MHz 11068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @level: Signal level (signal strength of the received Beacon/Probe Response 11078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * frame) 11088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies: Pointer to IEs from the scan result 11098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies_len: Length of the ies buffer 11108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 to continue or 1 to stop scan result indication 11118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 11128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is called to indicate a scan result entry with P2P IE from a 11138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * scan requested with struct p2p_config::p2p_scan(). This can be called during 11148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the actual scan process (i.e., whenever a new device is found) or as a 11158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * sequence of calls after the full scan has been completed. The former option 11168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * can result in optimized operations, but may not be supported by all 11178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * driver/firmware designs. The ies buffer need to include at least the P2P IE, 11188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * but it is recommended to include all IEs received from the device. The 11198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * caller does not need to check that the IEs contain a P2P IE before calling 11208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * this function since frames will be filtered internally if needed. 11218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 11228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function will return 1 if it wants to stop scan result iteration (and 11238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * scan in general if it is still in progress). This is used to allow faster 11248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * start of a pending operation, e.g., to start a pending GO negotiation. 11258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 11268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_scan_res_handler(struct p2p_data *p2p, const u8 *bssid, int freq, 11278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int level, const u8 *ies, size_t ies_len); 11288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 11308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_res_handled - Indicate end of scan results 11318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 11338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is called to indicate that all P2P scan results from a scan 11348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * have been reported with zero or more calls to p2p_scan_res_handler(). This 11358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * function must be called as a response to successful 11368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_config::p2p_scan() call if none of the p2p_scan_res_handler() 11378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * calls stopped iteration. 11388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 11398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_scan_res_handled(struct p2p_data *p2p); 11408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_send_action_result { 11428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SEND_ACTION_SUCCESS /* Frame was send and acknowledged */, 11438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SEND_ACTION_NO_ACK /* Frame was sent, but not acknowledged */, 11448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SEND_ACTION_FAILED /* Frame was not sent due to a failure */ 11458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 11468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 11488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_send_action_cb - Notify TX status of an Action frame 11498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Channel frequency in MHz 11518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dst: Destination MAC address (Address 1) 11528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @src: Source MAC address (Address 2) 11538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: BSSID (Address 3) 11548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @result: Result of the transmission attempt 11558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 11568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to indicate the result of an Action frame transmission 11578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * that was requested with struct p2p_config::send_action() callback. 11588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 11598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst, 11608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *src, const u8 *bssid, 11618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_send_action_result result); 11628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 11648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_listen_cb - Indicate the start of a requested Listen state 11658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Listen channel frequency in MHz 11678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @duration: Duration for the Listen state in milliseconds 11688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 11698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to indicate that a Listen state requested with 11708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_config::start_listen() callback has started. 11718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 11728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_listen_cb(struct p2p_data *p2p, unsigned int freq, 11738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int duration); 11748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 11768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_listen_end - Indicate the end of a requested Listen state 11778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Listen channel frequency in MHz 11798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 if no operations were started, 1 if an operation was started 11808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 11818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to indicate that a Listen state requested with 11828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_config::start_listen() callback has ended. 11838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 11848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_listen_end(struct p2p_data *p2p, unsigned int freq); 11858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_deauth_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code, 11878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *ie, size_t ie_len); 11888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_disassoc_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code, 11908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *ie, size_t ie_len); 11918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Per-group P2P state for GO */ 11948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_group; 11968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 11988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_group_config - P2P group configuration 11998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 12008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This configuration is provided to the P2P module during initialization of 12018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the per-group information with p2p_group_init(). 12028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_group_config { 12048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 12058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * persistent_group - Whether the group is persistent 12061f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 0 = not a persistent group 12071f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 1 = persistent group without persistent reconnect 12081f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 2 = persistent group with persistent reconnect 12098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int persistent_group; 12118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 12138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * interface_addr - P2P Interface Address of the group 12148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 interface_addr[ETH_ALEN]; 12168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 12188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * max_clients - Maximum number of clients in the group 12198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int max_clients; 12218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 12238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * cb_ctx - Context to use with callback functions 12248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void *cb_ctx; 12268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 12288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ie_update - Notification of IE update 12298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 12308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @beacon_ies: P2P IE for Beacon frames or %NULL if no change 12318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @proberesp_ies: P2P Ie for Probe Response frames 12328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 12338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * P2P module uses this callback function to notify whenever the P2P IE 12348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * in Beacon or Probe Response frames should be updated based on group 12358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * events. 12368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 12378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The callee is responsible for freeing the returned buffer(s) with 12388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpabuf_free(). 12398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*ie_update)(void *ctx, struct wpabuf *beacon_ies, 12418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpabuf *proberesp_ies); 12428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 12448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * idle_update - Notification of changes in group idle state 12458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 12468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @idle: Whether the group is idle (no associated stations) 12478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*idle_update)(void *ctx, int idle); 12498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 12508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_init - Initialize P2P group 12538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 12548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @config: P2P group configuration (will be freed by p2p_group_deinit()) 12558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Pointer to private data or %NULL on failure 12568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 12578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to initialize per-group P2P module context. Currently, 12588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * this is only used to manage GO functionality and P2P clients do not need to 12598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * create an instance of this per-group information. 12608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_group * p2p_group_init(struct p2p_data *p2p, 12628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct p2p_group_config *config); 12638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_deinit - Deinitialize P2P group 12668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 12678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_group_deinit(struct p2p_group *group); 12698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_notif_assoc - Notification of P2P client association with GO 12728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 12738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: Interface address of the P2P client 12748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ie: IEs from the (Re)association Request frame 12758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @len: Length of the ie buffer in octets 12768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 12778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_group_notif_assoc(struct p2p_group *group, const u8 *addr, 12798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *ie, size_t len); 12808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_assoc_resp_ie - Build P2P IE for (re)association response 12838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 12848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @status: Status value (P2P_SC_SUCCESS if association succeeded) 12858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: P2P IE for (Re)association Response or %NULL on failure 12868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 12878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The caller is responsible for freeing the returned buffer with 12888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpabuf_free(). 12898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wpabuf * p2p_group_assoc_resp_ie(struct p2p_group *group, u8 status); 12918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_notif_disassoc - Notification of P2P client disassociation from GO 12948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 12958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: Interface address of the P2P client 12968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_group_notif_disassoc(struct p2p_group *group, const u8 *addr); 12988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_notif_formation_done - Notification of completed group formation 13018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 13028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_group_notif_formation_done(struct p2p_group *group); 13048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_notif_noa - Notification of NoA change 13078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 13088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @noa: Notice of Absence attribute payload, %NULL if none 13098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @noa_len: Length of noa buffer in octets 13108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 13118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 13128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify the P2P group management about a new NoA contents. This will be 13138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * inserted into the P2P IEs in Beacon and Probe Response frames with rest of 13148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the group information. 13158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_group_notif_noa(struct p2p_group *group, const u8 *noa, 13178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t noa_len); 13188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_match_dev_type - Match device types in group with requested type 13218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 13228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wps: WPS TLVs from Probe Request frame (concatenated WPS IEs) 13238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 1 on match, 0 on mismatch 13248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 13258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to match the Requested Device Type attribute in 13268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * WPS IE with the device types of a group member for deciding whether a GO 13278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * should reply to a Probe Request frame. Match will be reported if the WPS IE 13288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * is not requested any specific device type. 13298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_group_match_dev_type(struct p2p_group *group, struct wpabuf *wps); 13318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1333c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * p2p_group_match_dev_id - Match P2P Device Address in group with requested device id 1334c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt */ 1335c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidtint p2p_group_match_dev_id(struct p2p_group *group, struct wpabuf *p2p); 1336c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt 1337c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt/** 13388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_go_discover - Send GO Discoverability Request to a group client 13398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 13408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success (frame scheduled); -1 if client was not found 13418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_group_go_discover(struct p2p_group *group, const u8 *dev_id, 13438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *searching_dev, int rx_freq); 13448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Generic helper functions */ 13478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_ie_text - Build text format description of P2P IE 13508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: P2P IE 13518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for returning text 13528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @end: Pointer to the end of the buf area 13538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets written to the buffer or -1 on failure 13548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 13558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to parse P2P IE contents into text format 13568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * field=value lines. 13578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_ie_text(struct wpabuf *p2p_ie, char *buf, char *end); 13598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_result_text - Build text format description of P2P IE 13628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies: Information elements from scan results 13638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies_len: ies buffer length in octets 13648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for returning text 13658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @end: Pointer to the end of the buf area 13668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets written to the buffer or -1 on failure 13678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 13688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to parse P2P IE contents into text format 13698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * field=value lines. 13708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_scan_result_text(const u8 *ies, size_t ies_len, char *buf, char *end); 13728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1374c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * p2p_parse_dev_addr - Parse P2P Device Address from P2P IE(s) 1375c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @ies: Information elements from scan results 1376c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @ies_len: ies buffer length in octets 1377c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_addr: Buffer for returning P2P Device Address 1378c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * Returns: 0 on success or -1 if P2P Device Address could not be parsed 1379c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt */ 1380c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidtint p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr); 1381c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt 1382c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt/** 13838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_assoc_req_ie - Build P2P IE for (Re)Association Request frame 13848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 13858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: BSSID 13868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for writing the P2P IE 13878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @len: Maximum buf length in octets 13888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_group: Whether this is for association with a P2P GO 13898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: Reassembled P2P IE data from scan results or %NULL if none 13908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets written into buf or -1 on failure 13918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_assoc_req_ie(struct p2p_data *p2p, const u8 *bssid, u8 *buf, 13938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t len, int p2p_group, struct wpabuf *p2p_ie); 13948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_ie - Build P2P IE for Probe Request 13978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 13988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies: Buffer for writing P2P IE 1399c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_id: Device ID to search for or %NULL for any 14008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1401c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidtvoid p2p_scan_ie(struct p2p_data *p2p, struct wpabuf *ies, const u8 *dev_id); 14028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14041f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_scan_ie_buf_len - Get maximum buffer length needed for p2p_scan_ie 14051f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 14061f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: Number of octets that p2p_scan_ie() may add to the buffer 14071f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 14081f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtsize_t p2p_scan_ie_buf_len(struct p2p_data *p2p); 14091f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 14101f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 14118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_go_params - Generate random P2P group parameters 14128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 14138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @params: Buffer for parameters 14148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 14158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_go_params(struct p2p_data *p2p, struct p2p_go_neg_results *params); 14178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_group_capab - Get Group Capability from P2P IE data 14208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: P2P IE(s) contents 14218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Group Capability 14228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtu8 p2p_get_group_capab(const struct wpabuf *p2p_ie); 14248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_cross_connect_disallowed - Does WLAN AP disallows cross connection 14278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: P2P IE(s) contents 14288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 if cross connection is allow, 1 if not 14298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_get_cross_connect_disallowed(const struct wpabuf *p2p_ie); 14318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_go_dev_addr - Get P2P Device Address from P2P IE data 14348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: P2P IE(s) contents 14358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Pointer to P2P Device Address or %NULL if not included 14368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtconst u8 * p2p_get_go_dev_addr(const struct wpabuf *p2p_ie); 14388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14401f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_get_peer_info - Get P2P peer information 14418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 14428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: P2P Device Address of the peer or %NULL to indicate the first peer 14438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @next: Whether to select the peer entry following the one indicated by addr 14441f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: Pointer to peer info or %NULL if not found 14451f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 14461f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtconst struct p2p_peer_info * p2p_get_peer_info(struct p2p_data *p2p, 14471f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt const u8 *addr, int next); 14481f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 14491f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 14501f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_get_peer_info_txt - Get internal P2P peer information in text format 14511f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @info: Pointer to P2P peer info from p2p_get_peer_info() 14528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for returning text 14538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buflen: Maximum buffer length 14548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets written to the buffer or -1 on failure 14551f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 14561f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Note: This information is internal to the P2P module and subject to change. 14571f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * As such, this should not really be used by external programs for purposes 14581f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * other than debugging. 14591f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 14601f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint p2p_get_peer_info_txt(const struct p2p_peer_info *info, 14611f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt char *buf, size_t buflen); 14621f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 14631f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 14641f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_peer_known - Check whether P2P peer is known 14651f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 14661f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @addr: P2P Device Address of the peer 14671f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: 1 if the specified device is in the P2P peer table or 0 if not 14688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14691f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint p2p_peer_known(struct p2p_data *p2p, const u8 *addr); 14708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_client_discoverability - Set client discoverability capability 14738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 14748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @enabled: Whether client discoverability will be enabled 14758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 14768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to disable (and re-enable) client discoverability. 14778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This capability is enabled by default and should not be disabled in normal 14788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * use cases, i.e., this is mainly for testing purposes. 14798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_client_discoverability(struct p2p_data *p2p, int enabled); 14818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14831f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_set_managed_oper - Set managed P2P Device operations capability 14848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 14858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @enabled: Whether managed P2P Device operations will be enabled 14868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_managed_oper(struct p2p_data *p2p, int enabled); 14888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_listen_channel(struct p2p_data *p2p, u8 reg_class, u8 channel); 14908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_ssid_postfix(struct p2p_data *p2p, const u8 *postfix, size_t len); 14928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_get_interface_addr(struct p2p_data *p2p, const u8 *dev_addr, 14948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 *iface_addr); 14958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_get_dev_addr(struct p2p_data *p2p, const u8 *iface_addr, 14968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 *dev_addr); 14978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_peer_filter(struct p2p_data *p2p, const u8 *addr); 14998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_cross_connect - Set cross connection capability 15028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @enabled: Whether cross connection will be enabled 15048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_cross_connect(struct p2p_data *p2p, int enabled); 15068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_get_oper_freq(struct p2p_data *p2p, const u8 *iface_addr); 15088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_intra_bss_dist - Set intra BSS distribution 15118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @enabled: Whether intra BSS distribution will be enabled 15138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_intra_bss_dist(struct p2p_data *p2p, int enabled); 15158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_supported_freq - Check whether channel is supported for P2P 15188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Channel frequency in MHz 15208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 if channel not usable for P2P, 1 if usable for P2P 15218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_supported_freq(struct p2p_data *p2p, unsigned int freq); 15238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_update_channel_list(struct p2p_data *p2p, struct p2p_channels *chan); 15258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_best_channels - Update best channel information 15288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq_24: Frequency (MHz) of best channel in 2.4 GHz band 15308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq_5: Frequency (MHz) of best channel in 5 GHz band 15318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq_overall: Frequency (MHz) of best channel overall 15328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_best_channels(struct p2p_data *p2p, int freq_24, int freq_5, 15348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int freq_overall); 15358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtconst u8 * p2p_get_go_neg_peer(struct p2p_data *p2p); 15378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_group_num_members - Get number of members in group 15408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 15418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of members in the group 15428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtunsigned int p2p_get_group_num_members(struct p2p_group *group); 15448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_iterate_group_members - Iterate group members 15478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 15488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @next: iteration pointer, must be a pointer to a void * that is set to %NULL 15498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * on the first call and not modified later 15508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: A P2P Interface Address for each call and %NULL for no more members 15518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtconst u8 * p2p_iterate_group_members(struct p2p_group *group, void **next); 15538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15551f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_group_get_dev_addr - Get a P2P Device Address of a client in a group 15561f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @group: P2P group context from p2p_group_init() 15571f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @addr: P2P Interface Address of the client 15581f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: P2P Device Address of the client if found or %NULL if no match 15591f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * found 15601f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 15611f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtconst u8 * p2p_group_get_dev_addr(struct p2p_group *group, const u8 *addr); 15621f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 15631f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 1564c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * p2p_group_is_client_connected - Check whether a specific client is connected 1565c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @group: P2P group context from p2p_group_init() 1566c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @addr: P2P Device Address of the client 1567c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * Returns: 1 if client is connected or 0 if not 1568c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt */ 1569c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidtint p2p_group_is_client_connected(struct p2p_group *group, const u8 *dev_addr); 1570c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt 1571c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt/** 15728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_peer_found - Get P2P peer info structure of a found peer 15738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: P2P Device Address of the peer or %NULL to indicate the first peer 15758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @next: Whether to select the peer entry following the one indicated by addr 15768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: The first P2P peer info available or %NULL if no such peer exists 15778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtconst struct p2p_peer_info * 15798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtp2p_get_peer_found(struct p2p_data *p2p, const u8 *addr, int next); 15808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_remove_wps_vendor_extensions - Remove WPS vendor extensions 15838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_remove_wps_vendor_extensions(struct p2p_data *p2p); 15868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_add_wps_vendor_extension - Add a WPS vendor extension 15898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @vendor_ext: The vendor extensions to add 15918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 15928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 15938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The wpabuf structures in the array are owned by the P2P 15948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * module after this call. 15958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_add_wps_vendor_extension(struct p2p_data *p2p, 15978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const struct wpabuf *vendor_ext); 15988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 159975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 160075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * p2p_set_oper_channel - Set the P2P operating channel 160175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @p2p: P2P module context from p2p_init() 160275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @op_reg_class: Operating regulatory class to set 160375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @op_channel: operating channel to set 160475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @cfg_op_channel : Whether op_channel is hardcoded in configuration 160575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Returns: 0 on success, -1 on failure 160675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 160775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint p2p_set_oper_channel(struct p2p_data *p2p, u8 op_reg_class, u8 op_channel, 160875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int cfg_op_channel); 160975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 16101f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 16111f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_in_progress - Check whether a P2P operation is progress 16121f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 16131f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: 0 if P2P module is idle or 1 if an operation is in progress 16141f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 16151f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint p2p_in_progress(struct p2p_data *p2p); 16161f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 16171f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt#ifdef ANDROID_P2P 16181f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 16192fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidt * p2p_search_in_progress - Check whether a P2P SEARCH is in progress 16201f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 16211f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: 0 if P2P module is idle or 1 if an operation is in progress 16221f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 16231f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint p2p_search_in_progress(struct p2p_data *p2p); 16242fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidt 16252fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidt/** 16262fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidt * p2p_search_pending - Check whether there is a deferred P2P SEARCH 16272fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidt * @p2p: P2P module context from p2p_init() 16282fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidt * Returns: 0 if there is no deferred P2P search or 1 if there is one 16292fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidt */ 16302fb777c379ad560c309c54b96c2c13291da23f54Dmitry Shmidtint p2p_search_pending(struct p2p_data *p2p); 16311f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt#endif 16321f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 16331f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 16341f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_other_scan_completed - Notify completion of non-P2P scan 16351f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 16361f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: 0 if P2P module is idle or 1 if an operation was started 16371f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 16381f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint p2p_other_scan_completed(struct p2p_data *p2p); 16391f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 16401f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtconst char * p2p_wps_method_text(enum p2p_wps_method method); 16411f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 16428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* P2P_H */ 1643