1*03f9172cSAndroid Build Coastguard Worker /* 2*03f9172cSAndroid Build Coastguard Worker * Wi-Fi Direct - P2P module 3*03f9172cSAndroid Build Coastguard Worker * Copyright (c) 2009-2010, Atheros Communications 4*03f9172cSAndroid Build Coastguard Worker * 5*03f9172cSAndroid Build Coastguard Worker * This software may be distributed under the terms of the BSD license. 6*03f9172cSAndroid Build Coastguard Worker * See README for more details. 7*03f9172cSAndroid Build Coastguard Worker */ 8*03f9172cSAndroid Build Coastguard Worker 9*03f9172cSAndroid Build Coastguard Worker #ifndef P2P_H 10*03f9172cSAndroid Build Coastguard Worker #define P2P_H 11*03f9172cSAndroid Build Coastguard Worker 12*03f9172cSAndroid Build Coastguard Worker #include "common/ieee802_11_defs.h" 13*03f9172cSAndroid Build Coastguard Worker #include "wps/wps.h" 14*03f9172cSAndroid Build Coastguard Worker 15*03f9172cSAndroid Build Coastguard Worker #define DEVICE_IDENTITY_KEY_MAX_LEN 64 16*03f9172cSAndroid Build Coastguard Worker #define DEVICE_IDENTITY_KEY_LEN 16 17*03f9172cSAndroid Build Coastguard Worker #define DEVICE_IDENTITY_TAG_LEN 8 18*03f9172cSAndroid Build Coastguard Worker #define DEVICE_IDENTITY_NONCE_LEN 8 19*03f9172cSAndroid Build Coastguard Worker #define DEVICE_MAX_HASH_LEN 32 20*03f9172cSAndroid Build Coastguard Worker #define DIR_STR_LEN 3 21*03f9172cSAndroid Build Coastguard Worker 22*03f9172cSAndroid Build Coastguard Worker /* DIRA Cipher versions */ 23*03f9172cSAndroid Build Coastguard Worker #define DIRA_CIPHER_VERSION_128 0 24*03f9172cSAndroid Build Coastguard Worker 25*03f9172cSAndroid Build Coastguard Worker struct weighted_pcl; 26*03f9172cSAndroid Build Coastguard Worker 27*03f9172cSAndroid Build Coastguard Worker /* P2P ASP Setup Capability */ 28*03f9172cSAndroid Build Coastguard Worker #define P2PS_SETUP_NONE 0 29*03f9172cSAndroid Build Coastguard Worker #define P2PS_SETUP_NEW BIT(0) 30*03f9172cSAndroid Build Coastguard Worker #define P2PS_SETUP_CLIENT BIT(1) 31*03f9172cSAndroid Build Coastguard Worker #define P2PS_SETUP_GROUP_OWNER BIT(2) 32*03f9172cSAndroid Build Coastguard Worker 33*03f9172cSAndroid Build Coastguard Worker #define P2PS_WILD_HASH_STR "org.wi-fi.wfds" 34*03f9172cSAndroid Build Coastguard Worker #define P2PS_HASH_LEN 6 35*03f9172cSAndroid Build Coastguard Worker #define P2P_MAX_QUERY_HASH 6 36*03f9172cSAndroid Build Coastguard Worker #define P2PS_FEATURE_CAPAB_CPT_MAX 2 37*03f9172cSAndroid Build Coastguard Worker 38*03f9172cSAndroid Build Coastguard Worker /** 39*03f9172cSAndroid Build Coastguard Worker * P2P_MAX_PREF_CHANNELS - Maximum number of preferred channels 40*03f9172cSAndroid Build Coastguard Worker */ 41*03f9172cSAndroid Build Coastguard Worker #define P2P_MAX_PREF_CHANNELS 100 42*03f9172cSAndroid Build Coastguard Worker 43*03f9172cSAndroid Build Coastguard Worker /** 44*03f9172cSAndroid Build Coastguard Worker * P2P_MAX_REG_CLASSES - Maximum number of regulatory classes 45*03f9172cSAndroid Build Coastguard Worker */ 46*03f9172cSAndroid Build Coastguard Worker #define P2P_MAX_REG_CLASSES 15 47*03f9172cSAndroid Build Coastguard Worker 48*03f9172cSAndroid Build Coastguard Worker /** 49*03f9172cSAndroid Build Coastguard Worker * P2P_MAX_REG_CLASS_CHANNELS - Maximum number of channels per regulatory class 50*03f9172cSAndroid Build Coastguard Worker */ 51*03f9172cSAndroid Build Coastguard Worker #define P2P_MAX_REG_CLASS_CHANNELS 60 52*03f9172cSAndroid Build Coastguard Worker 53*03f9172cSAndroid Build Coastguard Worker /** 54*03f9172cSAndroid Build Coastguard Worker * struct p2p_channels - List of supported channels 55*03f9172cSAndroid Build Coastguard Worker */ 56*03f9172cSAndroid Build Coastguard Worker struct p2p_channels { 57*03f9172cSAndroid Build Coastguard Worker /** 58*03f9172cSAndroid Build Coastguard Worker * struct p2p_reg_class - Supported regulatory class 59*03f9172cSAndroid Build Coastguard Worker */ 60*03f9172cSAndroid Build Coastguard Worker struct p2p_reg_class { 61*03f9172cSAndroid Build Coastguard Worker /** 62*03f9172cSAndroid Build Coastguard Worker * reg_class - Regulatory class (IEEE 802.11-2007, Annex J) 63*03f9172cSAndroid Build Coastguard Worker */ 64*03f9172cSAndroid Build Coastguard Worker u8 reg_class; 65*03f9172cSAndroid Build Coastguard Worker 66*03f9172cSAndroid Build Coastguard Worker /** 67*03f9172cSAndroid Build Coastguard Worker * channel - Supported channels 68*03f9172cSAndroid Build Coastguard Worker */ 69*03f9172cSAndroid Build Coastguard Worker u8 channel[P2P_MAX_REG_CLASS_CHANNELS]; 70*03f9172cSAndroid Build Coastguard Worker 71*03f9172cSAndroid Build Coastguard Worker /** 72*03f9172cSAndroid Build Coastguard Worker * channels - Number of channel entries in use 73*03f9172cSAndroid Build Coastguard Worker */ 74*03f9172cSAndroid Build Coastguard Worker size_t channels; 75*03f9172cSAndroid Build Coastguard Worker } reg_class[P2P_MAX_REG_CLASSES]; 76*03f9172cSAndroid Build Coastguard Worker 77*03f9172cSAndroid Build Coastguard Worker /** 78*03f9172cSAndroid Build Coastguard Worker * reg_classes - Number of reg_class entries in use 79*03f9172cSAndroid Build Coastguard Worker */ 80*03f9172cSAndroid Build Coastguard Worker size_t reg_classes; 81*03f9172cSAndroid Build Coastguard Worker }; 82*03f9172cSAndroid Build Coastguard Worker 83*03f9172cSAndroid Build Coastguard Worker enum p2p_wps_method { 84*03f9172cSAndroid Build Coastguard Worker WPS_NOT_READY, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC, WPS_NFC, 85*03f9172cSAndroid Build Coastguard Worker WPS_P2PS 86*03f9172cSAndroid Build Coastguard Worker }; 87*03f9172cSAndroid Build Coastguard Worker 88*03f9172cSAndroid Build Coastguard Worker /** 89*03f9172cSAndroid Build Coastguard Worker * struct p2p_go_neg_results - P2P Group Owner Negotiation results 90*03f9172cSAndroid Build Coastguard Worker */ 91*03f9172cSAndroid Build Coastguard Worker struct p2p_go_neg_results { 92*03f9172cSAndroid Build Coastguard Worker /** 93*03f9172cSAndroid Build Coastguard Worker * status - Negotiation result (Status Code) 94*03f9172cSAndroid Build Coastguard Worker * 95*03f9172cSAndroid Build Coastguard Worker * 0 (P2P_SC_SUCCESS) indicates success. Non-zero values indicate 96*03f9172cSAndroid Build Coastguard Worker * failed negotiation. 97*03f9172cSAndroid Build Coastguard Worker */ 98*03f9172cSAndroid Build Coastguard Worker int status; 99*03f9172cSAndroid Build Coastguard Worker 100*03f9172cSAndroid Build Coastguard Worker /** 101*03f9172cSAndroid Build Coastguard Worker * role_go - Whether local end is Group Owner 102*03f9172cSAndroid Build Coastguard Worker */ 103*03f9172cSAndroid Build Coastguard Worker int role_go; 104*03f9172cSAndroid Build Coastguard Worker 105*03f9172cSAndroid Build Coastguard Worker /** 106*03f9172cSAndroid Build Coastguard Worker * freq - Frequency of the group operational channel in MHz 107*03f9172cSAndroid Build Coastguard Worker */ 108*03f9172cSAndroid Build Coastguard Worker int freq; 109*03f9172cSAndroid Build Coastguard Worker 110*03f9172cSAndroid Build Coastguard Worker int ht40; 111*03f9172cSAndroid Build Coastguard Worker 112*03f9172cSAndroid Build Coastguard Worker int vht; 113*03f9172cSAndroid Build Coastguard Worker 114*03f9172cSAndroid Build Coastguard Worker int edmg; 115*03f9172cSAndroid Build Coastguard Worker 116*03f9172cSAndroid Build Coastguard Worker u8 max_oper_chwidth; 117*03f9172cSAndroid Build Coastguard Worker 118*03f9172cSAndroid Build Coastguard Worker unsigned int vht_center_freq2; 119*03f9172cSAndroid Build Coastguard Worker 120*03f9172cSAndroid Build Coastguard Worker /** 121*03f9172cSAndroid Build Coastguard Worker * he - Indicates if IEEE 802.11ax HE is enabled 122*03f9172cSAndroid Build Coastguard Worker */ 123*03f9172cSAndroid Build Coastguard Worker int he; 124*03f9172cSAndroid Build Coastguard Worker 125*03f9172cSAndroid Build Coastguard Worker /** 126*03f9172cSAndroid Build Coastguard Worker * ssid - SSID of the group 127*03f9172cSAndroid Build Coastguard Worker */ 128*03f9172cSAndroid Build Coastguard Worker u8 ssid[SSID_MAX_LEN]; 129*03f9172cSAndroid Build Coastguard Worker 130*03f9172cSAndroid Build Coastguard Worker /** 131*03f9172cSAndroid Build Coastguard Worker * ssid_len - Length of SSID in octets 132*03f9172cSAndroid Build Coastguard Worker */ 133*03f9172cSAndroid Build Coastguard Worker size_t ssid_len; 134*03f9172cSAndroid Build Coastguard Worker 135*03f9172cSAndroid Build Coastguard Worker /** 136*03f9172cSAndroid Build Coastguard Worker * psk - WPA pre-shared key (256 bits) (GO only) 137*03f9172cSAndroid Build Coastguard Worker */ 138*03f9172cSAndroid Build Coastguard Worker u8 psk[32]; 139*03f9172cSAndroid Build Coastguard Worker 140*03f9172cSAndroid Build Coastguard Worker /** 141*03f9172cSAndroid Build Coastguard Worker * psk_set - Whether PSK field is configured (GO only) 142*03f9172cSAndroid Build Coastguard Worker */ 143*03f9172cSAndroid Build Coastguard Worker int psk_set; 144*03f9172cSAndroid Build Coastguard Worker 145*03f9172cSAndroid Build Coastguard Worker /** 146*03f9172cSAndroid Build Coastguard Worker * passphrase - WPA2-Personal passphrase for the group (GO only) 147*03f9172cSAndroid Build Coastguard Worker */ 148*03f9172cSAndroid Build Coastguard Worker char passphrase[64]; 149*03f9172cSAndroid Build Coastguard Worker 150*03f9172cSAndroid Build Coastguard Worker /** 151*03f9172cSAndroid Build Coastguard Worker * peer_device_addr - P2P Device Address of the peer 152*03f9172cSAndroid Build Coastguard Worker */ 153*03f9172cSAndroid Build Coastguard Worker u8 peer_device_addr[ETH_ALEN]; 154*03f9172cSAndroid Build Coastguard Worker 155*03f9172cSAndroid Build Coastguard Worker /** 156*03f9172cSAndroid Build Coastguard Worker * peer_interface_addr - P2P Interface Address of the peer 157*03f9172cSAndroid Build Coastguard Worker */ 158*03f9172cSAndroid Build Coastguard Worker u8 peer_interface_addr[ETH_ALEN]; 159*03f9172cSAndroid Build Coastguard Worker 160*03f9172cSAndroid Build Coastguard Worker /** 161*03f9172cSAndroid Build Coastguard Worker * wps_method - WPS method to be used during provisioning 162*03f9172cSAndroid Build Coastguard Worker */ 163*03f9172cSAndroid Build Coastguard Worker enum p2p_wps_method wps_method; 164*03f9172cSAndroid Build Coastguard Worker 165*03f9172cSAndroid Build Coastguard Worker #define P2P_MAX_CHANNELS 50 166*03f9172cSAndroid Build Coastguard Worker 167*03f9172cSAndroid Build Coastguard Worker /** 168*03f9172cSAndroid Build Coastguard Worker * freq_list - Zero-terminated list of possible operational channels 169*03f9172cSAndroid Build Coastguard Worker */ 170*03f9172cSAndroid Build Coastguard Worker int freq_list[P2P_MAX_CHANNELS]; 171*03f9172cSAndroid Build Coastguard Worker 172*03f9172cSAndroid Build Coastguard Worker /** 173*03f9172cSAndroid Build Coastguard Worker * persistent_group - Whether the group should be made persistent 174*03f9172cSAndroid Build Coastguard Worker * 0 = not persistent 175*03f9172cSAndroid Build Coastguard Worker * 1 = persistent group without persistent reconnect 176*03f9172cSAndroid Build Coastguard Worker * 2 = persistent group with persistent reconnect 177*03f9172cSAndroid Build Coastguard Worker */ 178*03f9172cSAndroid Build Coastguard Worker int persistent_group; 179*03f9172cSAndroid Build Coastguard Worker 180*03f9172cSAndroid Build Coastguard Worker /** 181*03f9172cSAndroid Build Coastguard Worker * peer_config_timeout - Peer configuration timeout (in 10 msec units) 182*03f9172cSAndroid Build Coastguard Worker */ 183*03f9172cSAndroid Build Coastguard Worker unsigned int peer_config_timeout; 184*03f9172cSAndroid Build Coastguard Worker }; 185*03f9172cSAndroid Build Coastguard Worker 186*03f9172cSAndroid Build Coastguard Worker struct p2ps_provision { 187*03f9172cSAndroid Build Coastguard Worker /** 188*03f9172cSAndroid Build Coastguard Worker * pd_seeker - P2PS provision discovery seeker role 189*03f9172cSAndroid Build Coastguard Worker */ 190*03f9172cSAndroid Build Coastguard Worker unsigned int pd_seeker:1; 191*03f9172cSAndroid Build Coastguard Worker 192*03f9172cSAndroid Build Coastguard Worker /** 193*03f9172cSAndroid Build Coastguard Worker * status - Remote returned provisioning status code 194*03f9172cSAndroid Build Coastguard Worker */ 195*03f9172cSAndroid Build Coastguard Worker int status; 196*03f9172cSAndroid Build Coastguard Worker 197*03f9172cSAndroid Build Coastguard Worker /** 198*03f9172cSAndroid Build Coastguard Worker * adv_id - P2PS Advertisement ID 199*03f9172cSAndroid Build Coastguard Worker */ 200*03f9172cSAndroid Build Coastguard Worker u32 adv_id; 201*03f9172cSAndroid Build Coastguard Worker 202*03f9172cSAndroid Build Coastguard Worker /** 203*03f9172cSAndroid Build Coastguard Worker * session_id - P2PS Session ID 204*03f9172cSAndroid Build Coastguard Worker */ 205*03f9172cSAndroid Build Coastguard Worker u32 session_id; 206*03f9172cSAndroid Build Coastguard Worker 207*03f9172cSAndroid Build Coastguard Worker /** 208*03f9172cSAndroid Build Coastguard Worker * method - WPS Method (to be) used to establish session 209*03f9172cSAndroid Build Coastguard Worker */ 210*03f9172cSAndroid Build Coastguard Worker u16 method; 211*03f9172cSAndroid Build Coastguard Worker 212*03f9172cSAndroid Build Coastguard Worker /** 213*03f9172cSAndroid Build Coastguard Worker * conncap - Connection Capabilities negotiated between P2P peers 214*03f9172cSAndroid Build Coastguard Worker */ 215*03f9172cSAndroid Build Coastguard Worker u8 conncap; 216*03f9172cSAndroid Build Coastguard Worker 217*03f9172cSAndroid Build Coastguard Worker /** 218*03f9172cSAndroid Build Coastguard Worker * role - Info about the roles to be used for this connection 219*03f9172cSAndroid Build Coastguard Worker */ 220*03f9172cSAndroid Build Coastguard Worker u8 role; 221*03f9172cSAndroid Build Coastguard Worker 222*03f9172cSAndroid Build Coastguard Worker /** 223*03f9172cSAndroid Build Coastguard Worker * session_mac - MAC address of the peer that started the session 224*03f9172cSAndroid Build Coastguard Worker */ 225*03f9172cSAndroid Build Coastguard Worker u8 session_mac[ETH_ALEN]; 226*03f9172cSAndroid Build Coastguard Worker 227*03f9172cSAndroid Build Coastguard Worker /** 228*03f9172cSAndroid Build Coastguard Worker * adv_mac - MAC address of the peer advertised the service 229*03f9172cSAndroid Build Coastguard Worker */ 230*03f9172cSAndroid Build Coastguard Worker u8 adv_mac[ETH_ALEN]; 231*03f9172cSAndroid Build Coastguard Worker 232*03f9172cSAndroid Build Coastguard Worker /** 233*03f9172cSAndroid Build Coastguard Worker * cpt_mask - Supported Coordination Protocol Transport mask 234*03f9172cSAndroid Build Coastguard Worker * 235*03f9172cSAndroid Build Coastguard Worker * A bitwise mask of supported ASP Coordination Protocol Transports. 236*03f9172cSAndroid Build Coastguard Worker * This property is set together and corresponds with cpt_priority. 237*03f9172cSAndroid Build Coastguard Worker */ 238*03f9172cSAndroid Build Coastguard Worker u8 cpt_mask; 239*03f9172cSAndroid Build Coastguard Worker 240*03f9172cSAndroid Build Coastguard Worker /** 241*03f9172cSAndroid Build Coastguard Worker * cpt_priority - Coordination Protocol Transport priority list 242*03f9172cSAndroid Build Coastguard Worker * 243*03f9172cSAndroid Build Coastguard Worker * Priorities of supported ASP Coordination Protocol Transports. 244*03f9172cSAndroid Build Coastguard Worker * This property is set together and corresponds with cpt_mask. 245*03f9172cSAndroid Build Coastguard Worker * The CPT priority list is 0 terminated. 246*03f9172cSAndroid Build Coastguard Worker */ 247*03f9172cSAndroid Build Coastguard Worker u8 cpt_priority[P2PS_FEATURE_CAPAB_CPT_MAX + 1]; 248*03f9172cSAndroid Build Coastguard Worker 249*03f9172cSAndroid Build Coastguard Worker /** 250*03f9172cSAndroid Build Coastguard Worker * force_freq - The only allowed channel frequency in MHz or 0. 251*03f9172cSAndroid Build Coastguard Worker */ 252*03f9172cSAndroid Build Coastguard Worker unsigned int force_freq; 253*03f9172cSAndroid Build Coastguard Worker 254*03f9172cSAndroid Build Coastguard Worker /** 255*03f9172cSAndroid Build Coastguard Worker * pref_freq - Preferred operating frequency in MHz or 0. 256*03f9172cSAndroid Build Coastguard Worker */ 257*03f9172cSAndroid Build Coastguard Worker unsigned int pref_freq; 258*03f9172cSAndroid Build Coastguard Worker 259*03f9172cSAndroid Build Coastguard Worker /** 260*03f9172cSAndroid Build Coastguard Worker * info - Vendor defined extra Provisioning information 261*03f9172cSAndroid Build Coastguard Worker */ 262*03f9172cSAndroid Build Coastguard Worker char info[0]; 263*03f9172cSAndroid Build Coastguard Worker }; 264*03f9172cSAndroid Build Coastguard Worker 265*03f9172cSAndroid Build Coastguard Worker struct p2ps_advertisement { 266*03f9172cSAndroid Build Coastguard Worker struct p2ps_advertisement *next; 267*03f9172cSAndroid Build Coastguard Worker 268*03f9172cSAndroid Build Coastguard Worker /** 269*03f9172cSAndroid Build Coastguard Worker * svc_info - Pointer to (internal) Service defined information 270*03f9172cSAndroid Build Coastguard Worker */ 271*03f9172cSAndroid Build Coastguard Worker char *svc_info; 272*03f9172cSAndroid Build Coastguard Worker 273*03f9172cSAndroid Build Coastguard Worker /** 274*03f9172cSAndroid Build Coastguard Worker * id - P2PS Advertisement ID 275*03f9172cSAndroid Build Coastguard Worker */ 276*03f9172cSAndroid Build Coastguard Worker u32 id; 277*03f9172cSAndroid Build Coastguard Worker 278*03f9172cSAndroid Build Coastguard Worker /** 279*03f9172cSAndroid Build Coastguard Worker * config_methods - WPS Methods which are allowed for this service 280*03f9172cSAndroid Build Coastguard Worker */ 281*03f9172cSAndroid Build Coastguard Worker u16 config_methods; 282*03f9172cSAndroid Build Coastguard Worker 283*03f9172cSAndroid Build Coastguard Worker /** 284*03f9172cSAndroid Build Coastguard Worker * state - Current state of the service: 0 - Out Of Service, 1-255 Vendor defined 285*03f9172cSAndroid Build Coastguard Worker */ 286*03f9172cSAndroid Build Coastguard Worker u8 state; 287*03f9172cSAndroid Build Coastguard Worker 288*03f9172cSAndroid Build Coastguard Worker /** 289*03f9172cSAndroid Build Coastguard Worker * auto_accept - Automatically Accept provisioning request if possible. 290*03f9172cSAndroid Build Coastguard Worker */ 291*03f9172cSAndroid Build Coastguard Worker u8 auto_accept; 292*03f9172cSAndroid Build Coastguard Worker 293*03f9172cSAndroid Build Coastguard Worker /** 294*03f9172cSAndroid Build Coastguard Worker * hash - 6 octet Service Name has to match against incoming Probe Requests 295*03f9172cSAndroid Build Coastguard Worker */ 296*03f9172cSAndroid Build Coastguard Worker u8 hash[P2PS_HASH_LEN]; 297*03f9172cSAndroid Build Coastguard Worker 298*03f9172cSAndroid Build Coastguard Worker /** 299*03f9172cSAndroid Build Coastguard Worker * cpt_mask - supported Coordination Protocol Transport mask 300*03f9172cSAndroid Build Coastguard Worker * 301*03f9172cSAndroid Build Coastguard Worker * A bitwise mask of supported ASP Coordination Protocol Transports. 302*03f9172cSAndroid Build Coastguard Worker * This property is set together and corresponds with cpt_priority. 303*03f9172cSAndroid Build Coastguard Worker */ 304*03f9172cSAndroid Build Coastguard Worker u8 cpt_mask; 305*03f9172cSAndroid Build Coastguard Worker 306*03f9172cSAndroid Build Coastguard Worker /** 307*03f9172cSAndroid Build Coastguard Worker * cpt_priority - Coordination Protocol Transport priority list 308*03f9172cSAndroid Build Coastguard Worker * 309*03f9172cSAndroid Build Coastguard Worker * Priorities of supported ASP Coordinatin Protocol Transports. 310*03f9172cSAndroid Build Coastguard Worker * This property is set together and corresponds with cpt_mask. 311*03f9172cSAndroid Build Coastguard Worker * The CPT priority list is 0 terminated. 312*03f9172cSAndroid Build Coastguard Worker */ 313*03f9172cSAndroid Build Coastguard Worker u8 cpt_priority[P2PS_FEATURE_CAPAB_CPT_MAX + 1]; 314*03f9172cSAndroid Build Coastguard Worker 315*03f9172cSAndroid Build Coastguard Worker /** 316*03f9172cSAndroid Build Coastguard Worker * svc_name - NULL Terminated UTF-8 Service Name, and svc_info storage 317*03f9172cSAndroid Build Coastguard Worker */ 318*03f9172cSAndroid Build Coastguard Worker char svc_name[0]; 319*03f9172cSAndroid Build Coastguard Worker }; 320*03f9172cSAndroid Build Coastguard Worker 321*03f9172cSAndroid Build Coastguard Worker 322*03f9172cSAndroid Build Coastguard Worker struct p2p_data; 323*03f9172cSAndroid Build Coastguard Worker 324*03f9172cSAndroid Build Coastguard Worker enum p2p_scan_type { 325*03f9172cSAndroid Build Coastguard Worker P2P_SCAN_SOCIAL, 326*03f9172cSAndroid Build Coastguard Worker P2P_SCAN_FULL, 327*03f9172cSAndroid Build Coastguard Worker P2P_SCAN_SPECIFIC, 328*03f9172cSAndroid Build Coastguard Worker P2P_SCAN_SOCIAL_PLUS_ONE 329*03f9172cSAndroid Build Coastguard Worker }; 330*03f9172cSAndroid Build Coastguard Worker 331*03f9172cSAndroid Build Coastguard Worker #define P2P_MAX_WPS_VENDOR_EXT 10 332*03f9172cSAndroid Build Coastguard Worker 333*03f9172cSAndroid Build Coastguard Worker /** 334*03f9172cSAndroid Build Coastguard Worker * struct p2p_pairing_config - P2P pairing configuration 335*03f9172cSAndroid Build Coastguard Worker */ 336*03f9172cSAndroid Build Coastguard Worker struct p2p_pairing_config { 337*03f9172cSAndroid Build Coastguard Worker /** 338*03f9172cSAndroid Build Coastguard Worker * Pairing capable 339*03f9172cSAndroid Build Coastguard Worker */ 340*03f9172cSAndroid Build Coastguard Worker bool pairing_capable; 341*03f9172cSAndroid Build Coastguard Worker 342*03f9172cSAndroid Build Coastguard Worker /** 343*03f9172cSAndroid Build Coastguard Worker * Enable P2P pairing setup 344*03f9172cSAndroid Build Coastguard Worker */ 345*03f9172cSAndroid Build Coastguard Worker bool enable_pairing_setup; 346*03f9172cSAndroid Build Coastguard Worker 347*03f9172cSAndroid Build Coastguard Worker /** 348*03f9172cSAndroid Build Coastguard Worker * Enable pairing cache to allow verification 349*03f9172cSAndroid Build Coastguard Worker */ 350*03f9172cSAndroid Build Coastguard Worker bool enable_pairing_cache; 351*03f9172cSAndroid Build Coastguard Worker 352*03f9172cSAndroid Build Coastguard Worker /** 353*03f9172cSAndroid Build Coastguard Worker * Enable P2P pairing verification with cached NIK/NPK 354*03f9172cSAndroid Build Coastguard Worker */ 355*03f9172cSAndroid Build Coastguard Worker bool enable_pairing_verification; 356*03f9172cSAndroid Build Coastguard Worker 357*03f9172cSAndroid Build Coastguard Worker /** 358*03f9172cSAndroid Build Coastguard Worker * P2P bootstrapping methods supported 359*03f9172cSAndroid Build Coastguard Worker */ 360*03f9172cSAndroid Build Coastguard Worker u16 bootstrap_methods; 361*03f9172cSAndroid Build Coastguard Worker 362*03f9172cSAndroid Build Coastguard Worker /** 363*03f9172cSAndroid Build Coastguard Worker * Bitmap of supported PASN types 364*03f9172cSAndroid Build Coastguard Worker */ 365*03f9172cSAndroid Build Coastguard Worker u8 pasn_type; 366*03f9172cSAndroid Build Coastguard Worker 367*03f9172cSAndroid Build Coastguard Worker /* Cipher version type */ 368*03f9172cSAndroid Build Coastguard Worker int dik_cipher; 369*03f9172cSAndroid Build Coastguard Worker 370*03f9172cSAndroid Build Coastguard Worker /* Buffer to hold the DevIK */ 371*03f9172cSAndroid Build Coastguard Worker u8 dik_data[DEVICE_IDENTITY_KEY_MAX_LEN]; 372*03f9172cSAndroid Build Coastguard Worker 373*03f9172cSAndroid Build Coastguard Worker /* Length of DevIK in octets */ 374*03f9172cSAndroid Build Coastguard Worker size_t dik_len; 375*03f9172cSAndroid Build Coastguard Worker }; 376*03f9172cSAndroid Build Coastguard Worker 377*03f9172cSAndroid Build Coastguard Worker /** 378*03f9172cSAndroid Build Coastguard Worker * struct p2p_peer_info - P2P peer information 379*03f9172cSAndroid Build Coastguard Worker */ 380*03f9172cSAndroid Build Coastguard Worker struct p2p_peer_info { 381*03f9172cSAndroid Build Coastguard Worker /** 382*03f9172cSAndroid Build Coastguard Worker * p2p_device_addr - P2P Device Address of the peer 383*03f9172cSAndroid Build Coastguard Worker */ 384*03f9172cSAndroid Build Coastguard Worker u8 p2p_device_addr[ETH_ALEN]; 385*03f9172cSAndroid Build Coastguard Worker 386*03f9172cSAndroid Build Coastguard Worker /** 387*03f9172cSAndroid Build Coastguard Worker * pri_dev_type - Primary Device Type 388*03f9172cSAndroid Build Coastguard Worker */ 389*03f9172cSAndroid Build Coastguard Worker u8 pri_dev_type[8]; 390*03f9172cSAndroid Build Coastguard Worker 391*03f9172cSAndroid Build Coastguard Worker /** 392*03f9172cSAndroid Build Coastguard Worker * device_name - Device Name (0..32 octets encoded in UTF-8) 393*03f9172cSAndroid Build Coastguard Worker */ 394*03f9172cSAndroid Build Coastguard Worker char device_name[WPS_DEV_NAME_MAX_LEN + 1]; 395*03f9172cSAndroid Build Coastguard Worker 396*03f9172cSAndroid Build Coastguard Worker /** 397*03f9172cSAndroid Build Coastguard Worker * manufacturer - Manufacturer (0..64 octets encoded in UTF-8) 398*03f9172cSAndroid Build Coastguard Worker */ 399*03f9172cSAndroid Build Coastguard Worker char manufacturer[WPS_MANUFACTURER_MAX_LEN + 1]; 400*03f9172cSAndroid Build Coastguard Worker 401*03f9172cSAndroid Build Coastguard Worker /** 402*03f9172cSAndroid Build Coastguard Worker * model_name - Model Name (0..32 octets encoded in UTF-8) 403*03f9172cSAndroid Build Coastguard Worker */ 404*03f9172cSAndroid Build Coastguard Worker char model_name[WPS_MODEL_NAME_MAX_LEN + 1]; 405*03f9172cSAndroid Build Coastguard Worker 406*03f9172cSAndroid Build Coastguard Worker /** 407*03f9172cSAndroid Build Coastguard Worker * model_number - Model Number (0..32 octets encoded in UTF-8) 408*03f9172cSAndroid Build Coastguard Worker */ 409*03f9172cSAndroid Build Coastguard Worker char model_number[WPS_MODEL_NUMBER_MAX_LEN + 1]; 410*03f9172cSAndroid Build Coastguard Worker 411*03f9172cSAndroid Build Coastguard Worker /** 412*03f9172cSAndroid Build Coastguard Worker * serial_number - Serial Number (0..32 octets encoded in UTF-8) 413*03f9172cSAndroid Build Coastguard Worker */ 414*03f9172cSAndroid Build Coastguard Worker char serial_number[WPS_SERIAL_NUMBER_MAX_LEN + 1]; 415*03f9172cSAndroid Build Coastguard Worker 416*03f9172cSAndroid Build Coastguard Worker /** 417*03f9172cSAndroid Build Coastguard Worker * level - Signal level 418*03f9172cSAndroid Build Coastguard Worker */ 419*03f9172cSAndroid Build Coastguard Worker int level; 420*03f9172cSAndroid Build Coastguard Worker 421*03f9172cSAndroid Build Coastguard Worker /** 422*03f9172cSAndroid Build Coastguard Worker * config_methods - WPS Configuration Methods 423*03f9172cSAndroid Build Coastguard Worker */ 424*03f9172cSAndroid Build Coastguard Worker u16 config_methods; 425*03f9172cSAndroid Build Coastguard Worker 426*03f9172cSAndroid Build Coastguard Worker /** 427*03f9172cSAndroid Build Coastguard Worker * dev_capab - Device Capabilities 428*03f9172cSAndroid Build Coastguard Worker */ 429*03f9172cSAndroid Build Coastguard Worker u8 dev_capab; 430*03f9172cSAndroid Build Coastguard Worker 431*03f9172cSAndroid Build Coastguard Worker /** 432*03f9172cSAndroid Build Coastguard Worker * group_capab - Group Capabilities 433*03f9172cSAndroid Build Coastguard Worker */ 434*03f9172cSAndroid Build Coastguard Worker u8 group_capab; 435*03f9172cSAndroid Build Coastguard Worker 436*03f9172cSAndroid Build Coastguard Worker /** 437*03f9172cSAndroid Build Coastguard Worker * wps_sec_dev_type_list - WPS secondary device type list 438*03f9172cSAndroid Build Coastguard Worker * 439*03f9172cSAndroid Build Coastguard Worker * This list includes from 0 to 16 Secondary Device Types as indicated 440*03f9172cSAndroid Build Coastguard Worker * by wps_sec_dev_type_list_len (8 * number of types). 441*03f9172cSAndroid Build Coastguard Worker */ 442*03f9172cSAndroid Build Coastguard Worker u8 wps_sec_dev_type_list[WPS_SEC_DEV_TYPE_MAX_LEN]; 443*03f9172cSAndroid Build Coastguard Worker 444*03f9172cSAndroid Build Coastguard Worker /** 445*03f9172cSAndroid Build Coastguard Worker * wps_sec_dev_type_list_len - Length of secondary device type list 446*03f9172cSAndroid Build Coastguard Worker */ 447*03f9172cSAndroid Build Coastguard Worker size_t wps_sec_dev_type_list_len; 448*03f9172cSAndroid Build Coastguard Worker 449*03f9172cSAndroid Build Coastguard Worker struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT]; 450*03f9172cSAndroid Build Coastguard Worker 451*03f9172cSAndroid Build Coastguard Worker /** 452*03f9172cSAndroid Build Coastguard Worker * wfd_subelems - Wi-Fi Display subelements from WFD IE(s) 453*03f9172cSAndroid Build Coastguard Worker */ 454*03f9172cSAndroid Build Coastguard Worker struct wpabuf *wfd_subelems; 455*03f9172cSAndroid Build Coastguard Worker 456*03f9172cSAndroid Build Coastguard Worker /** 457*03f9172cSAndroid Build Coastguard Worker * vendor_elems - Unrecognized vendor elements 458*03f9172cSAndroid Build Coastguard Worker * 459*03f9172cSAndroid Build Coastguard Worker * This buffer includes any other vendor element than P2P, WPS, and WFD 460*03f9172cSAndroid Build Coastguard Worker * IE(s) from the frame that was used to discover the peer. 461*03f9172cSAndroid Build Coastguard Worker */ 462*03f9172cSAndroid Build Coastguard Worker struct wpabuf *vendor_elems; 463*03f9172cSAndroid Build Coastguard Worker 464*03f9172cSAndroid Build Coastguard Worker /** 465*03f9172cSAndroid Build Coastguard Worker * p2ps_instance - P2PS Application Service Info 466*03f9172cSAndroid Build Coastguard Worker */ 467*03f9172cSAndroid Build Coastguard Worker struct wpabuf *p2ps_instance; 468*03f9172cSAndroid Build Coastguard Worker 469*03f9172cSAndroid Build Coastguard Worker /** 470*03f9172cSAndroid Build Coastguard Worker * pcea_cap_info - Capability info in PCEA 471*03f9172cSAndroid Build Coastguard Worker */ 472*03f9172cSAndroid Build Coastguard Worker u16 pcea_cap_info; 473*03f9172cSAndroid Build Coastguard Worker 474*03f9172cSAndroid Build Coastguard Worker /** 475*03f9172cSAndroid Build Coastguard Worker * The regulatory info encoding for operation in 6 GHz band 476*03f9172cSAndroid Build Coastguard Worker */ 477*03f9172cSAndroid Build Coastguard Worker u8 reg_info; 478*03f9172cSAndroid Build Coastguard Worker 479*03f9172cSAndroid Build Coastguard Worker /** 480*03f9172cSAndroid Build Coastguard Worker * p2p_pairing_config - P2P pairing configuration 481*03f9172cSAndroid Build Coastguard Worker */ 482*03f9172cSAndroid Build Coastguard Worker struct p2p_pairing_config pairing_config; 483*03f9172cSAndroid Build Coastguard Worker }; 484*03f9172cSAndroid Build Coastguard Worker 485*03f9172cSAndroid Build Coastguard Worker enum p2p_prov_disc_status { 486*03f9172cSAndroid Build Coastguard Worker P2P_PROV_DISC_SUCCESS, 487*03f9172cSAndroid Build Coastguard Worker P2P_PROV_DISC_TIMEOUT, 488*03f9172cSAndroid Build Coastguard Worker P2P_PROV_DISC_REJECTED, 489*03f9172cSAndroid Build Coastguard Worker P2P_PROV_DISC_TIMEOUT_JOIN, 490*03f9172cSAndroid Build Coastguard Worker P2P_PROV_DISC_INFO_UNAVAILABLE, 491*03f9172cSAndroid Build Coastguard Worker }; 492*03f9172cSAndroid Build Coastguard Worker 493*03f9172cSAndroid Build Coastguard Worker struct p2p_channel { 494*03f9172cSAndroid Build Coastguard Worker u8 op_class; 495*03f9172cSAndroid Build Coastguard Worker u8 chan; 496*03f9172cSAndroid Build Coastguard Worker }; 497*03f9172cSAndroid Build Coastguard Worker 498*03f9172cSAndroid Build Coastguard Worker /** 499*03f9172cSAndroid Build Coastguard Worker * struct p2p_config - P2P configuration 500*03f9172cSAndroid Build Coastguard Worker * 501*03f9172cSAndroid Build Coastguard Worker * This configuration is provided to the P2P module during initialization with 502*03f9172cSAndroid Build Coastguard Worker * p2p_init(). 503*03f9172cSAndroid Build Coastguard Worker */ 504*03f9172cSAndroid Build Coastguard Worker struct p2p_config { 505*03f9172cSAndroid Build Coastguard Worker /** 506*03f9172cSAndroid Build Coastguard Worker * country - Country code to use in P2P operations 507*03f9172cSAndroid Build Coastguard Worker */ 508*03f9172cSAndroid Build Coastguard Worker char country[3]; 509*03f9172cSAndroid Build Coastguard Worker 510*03f9172cSAndroid Build Coastguard Worker /** 511*03f9172cSAndroid Build Coastguard Worker * reg_class - Regulatory class for own listen channel 512*03f9172cSAndroid Build Coastguard Worker */ 513*03f9172cSAndroid Build Coastguard Worker u8 reg_class; 514*03f9172cSAndroid Build Coastguard Worker 515*03f9172cSAndroid Build Coastguard Worker /** 516*03f9172cSAndroid Build Coastguard Worker * channel - Own listen channel 517*03f9172cSAndroid Build Coastguard Worker */ 518*03f9172cSAndroid Build Coastguard Worker u8 channel; 519*03f9172cSAndroid Build Coastguard Worker 520*03f9172cSAndroid Build Coastguard Worker /** 521*03f9172cSAndroid Build Coastguard Worker * channel_forced - the listen channel was forced by configuration 522*03f9172cSAndroid Build Coastguard Worker * or by control interface and cannot be overridden 523*03f9172cSAndroid Build Coastguard Worker */ 524*03f9172cSAndroid Build Coastguard Worker u8 channel_forced; 525*03f9172cSAndroid Build Coastguard Worker 526*03f9172cSAndroid Build Coastguard Worker /** 527*03f9172cSAndroid Build Coastguard Worker * Regulatory class for own operational channel 528*03f9172cSAndroid Build Coastguard Worker */ 529*03f9172cSAndroid Build Coastguard Worker u8 op_reg_class; 530*03f9172cSAndroid Build Coastguard Worker 531*03f9172cSAndroid Build Coastguard Worker /** 532*03f9172cSAndroid Build Coastguard Worker * op_channel - Own operational channel 533*03f9172cSAndroid Build Coastguard Worker */ 534*03f9172cSAndroid Build Coastguard Worker u8 op_channel; 535*03f9172cSAndroid Build Coastguard Worker 536*03f9172cSAndroid Build Coastguard Worker /** 537*03f9172cSAndroid Build Coastguard Worker * cfg_op_channel - Whether op_channel is hardcoded in configuration 538*03f9172cSAndroid Build Coastguard Worker */ 539*03f9172cSAndroid Build Coastguard Worker u8 cfg_op_channel; 540*03f9172cSAndroid Build Coastguard Worker 541*03f9172cSAndroid Build Coastguard Worker /** 542*03f9172cSAndroid Build Coastguard Worker * channels - Own supported regulatory classes and channels 543*03f9172cSAndroid Build Coastguard Worker * 544*03f9172cSAndroid Build Coastguard Worker * List of supposerted channels per regulatory class. The regulatory 545*03f9172cSAndroid Build Coastguard Worker * classes are defined in IEEE Std 802.11-2007 Annex J and the 546*03f9172cSAndroid Build Coastguard Worker * numbering of the clases depends on the configured country code. 547*03f9172cSAndroid Build Coastguard Worker */ 548*03f9172cSAndroid Build Coastguard Worker struct p2p_channels channels; 549*03f9172cSAndroid Build Coastguard Worker 550*03f9172cSAndroid Build Coastguard Worker /** 551*03f9172cSAndroid Build Coastguard Worker * cli_channels - Additional client channels 552*03f9172cSAndroid Build Coastguard Worker * 553*03f9172cSAndroid Build Coastguard Worker * This list of channels (if any) will be used when advertising local 554*03f9172cSAndroid Build Coastguard Worker * channels during GO Negotiation or Invitation for the cases where the 555*03f9172cSAndroid Build Coastguard Worker * local end may become the client. This may allow the peer to become a 556*03f9172cSAndroid Build Coastguard Worker * GO on additional channels if it supports these options. The main use 557*03f9172cSAndroid Build Coastguard Worker * case for this is to include passive-scan channels on devices that may 558*03f9172cSAndroid Build Coastguard Worker * not know their current location and have configured most channels to 559*03f9172cSAndroid Build Coastguard Worker * not allow initiation of radition (i.e., another device needs to take 560*03f9172cSAndroid Build Coastguard Worker * master responsibilities). 561*03f9172cSAndroid Build Coastguard Worker */ 562*03f9172cSAndroid Build Coastguard Worker struct p2p_channels cli_channels; 563*03f9172cSAndroid Build Coastguard Worker 564*03f9172cSAndroid Build Coastguard Worker /** 565*03f9172cSAndroid Build Coastguard Worker * num_pref_chan - Number of pref_chan entries 566*03f9172cSAndroid Build Coastguard Worker */ 567*03f9172cSAndroid Build Coastguard Worker unsigned int num_pref_chan; 568*03f9172cSAndroid Build Coastguard Worker 569*03f9172cSAndroid Build Coastguard Worker /** 570*03f9172cSAndroid Build Coastguard Worker * pref_chan - Preferred channels for GO Negotiation 571*03f9172cSAndroid Build Coastguard Worker */ 572*03f9172cSAndroid Build Coastguard Worker struct p2p_channel *pref_chan; 573*03f9172cSAndroid Build Coastguard Worker 574*03f9172cSAndroid Build Coastguard Worker /** 575*03f9172cSAndroid Build Coastguard Worker * p2p_6ghz_disable - Disable 6GHz for P2P operations 576*03f9172cSAndroid Build Coastguard Worker */ 577*03f9172cSAndroid Build Coastguard Worker bool p2p_6ghz_disable; 578*03f9172cSAndroid Build Coastguard Worker 579*03f9172cSAndroid Build Coastguard Worker /** 580*03f9172cSAndroid Build Coastguard Worker * p2p_dfs_chan_enable - Enable p2p Go to operate on dfs channel 581*03f9172cSAndroid Build Coastguard Worker */ 582*03f9172cSAndroid Build Coastguard Worker bool p2p_dfs_chan_enable; 583*03f9172cSAndroid Build Coastguard Worker 584*03f9172cSAndroid Build Coastguard Worker /** 585*03f9172cSAndroid Build Coastguard Worker * pri_dev_type - Primary Device Type (see WPS) 586*03f9172cSAndroid Build Coastguard Worker */ 587*03f9172cSAndroid Build Coastguard Worker u8 pri_dev_type[8]; 588*03f9172cSAndroid Build Coastguard Worker 589*03f9172cSAndroid Build Coastguard Worker /** 590*03f9172cSAndroid Build Coastguard Worker * P2P_SEC_DEVICE_TYPES - Maximum number of secondary device types 591*03f9172cSAndroid Build Coastguard Worker */ 592*03f9172cSAndroid Build Coastguard Worker #define P2P_SEC_DEVICE_TYPES 5 593*03f9172cSAndroid Build Coastguard Worker 594*03f9172cSAndroid Build Coastguard Worker /** 595*03f9172cSAndroid Build Coastguard Worker * sec_dev_type - Optional secondary device types 596*03f9172cSAndroid Build Coastguard Worker */ 597*03f9172cSAndroid Build Coastguard Worker u8 sec_dev_type[P2P_SEC_DEVICE_TYPES][8]; 598*03f9172cSAndroid Build Coastguard Worker 599*03f9172cSAndroid Build Coastguard Worker /** 600*03f9172cSAndroid Build Coastguard Worker * num_sec_dev_types - Number of sec_dev_type entries 601*03f9172cSAndroid Build Coastguard Worker */ 602*03f9172cSAndroid Build Coastguard Worker size_t num_sec_dev_types; 603*03f9172cSAndroid Build Coastguard Worker 604*03f9172cSAndroid Build Coastguard Worker /** 605*03f9172cSAndroid Build Coastguard Worker * dev_addr - P2P Device Address 606*03f9172cSAndroid Build Coastguard Worker */ 607*03f9172cSAndroid Build Coastguard Worker u8 dev_addr[ETH_ALEN]; 608*03f9172cSAndroid Build Coastguard Worker 609*03f9172cSAndroid Build Coastguard Worker /** 610*03f9172cSAndroid Build Coastguard Worker * dev_name - Device Name 611*03f9172cSAndroid Build Coastguard Worker */ 612*03f9172cSAndroid Build Coastguard Worker char *dev_name; 613*03f9172cSAndroid Build Coastguard Worker 614*03f9172cSAndroid Build Coastguard Worker char *manufacturer; 615*03f9172cSAndroid Build Coastguard Worker char *model_name; 616*03f9172cSAndroid Build Coastguard Worker char *model_number; 617*03f9172cSAndroid Build Coastguard Worker char *serial_number; 618*03f9172cSAndroid Build Coastguard Worker 619*03f9172cSAndroid Build Coastguard Worker u8 uuid[16]; 620*03f9172cSAndroid Build Coastguard Worker u16 config_methods; 621*03f9172cSAndroid Build Coastguard Worker 622*03f9172cSAndroid Build Coastguard Worker /** 623*03f9172cSAndroid Build Coastguard Worker * concurrent_operations - Whether concurrent operations are supported 624*03f9172cSAndroid Build Coastguard Worker */ 625*03f9172cSAndroid Build Coastguard Worker int concurrent_operations; 626*03f9172cSAndroid Build Coastguard Worker 627*03f9172cSAndroid Build Coastguard Worker /** 628*03f9172cSAndroid Build Coastguard Worker * max_peers - Maximum number of discovered peers to remember 629*03f9172cSAndroid Build Coastguard Worker * 630*03f9172cSAndroid Build Coastguard Worker * If more peers are discovered, older entries will be removed to make 631*03f9172cSAndroid Build Coastguard Worker * room for the new ones. 632*03f9172cSAndroid Build Coastguard Worker */ 633*03f9172cSAndroid Build Coastguard Worker size_t max_peers; 634*03f9172cSAndroid Build Coastguard Worker 635*03f9172cSAndroid Build Coastguard Worker /** 636*03f9172cSAndroid Build Coastguard Worker * p2p_intra_bss - Intra BSS communication is supported 637*03f9172cSAndroid Build Coastguard Worker */ 638*03f9172cSAndroid Build Coastguard Worker int p2p_intra_bss; 639*03f9172cSAndroid Build Coastguard Worker 640*03f9172cSAndroid Build Coastguard Worker /** 641*03f9172cSAndroid Build Coastguard Worker * ssid_postfix - Postfix data to add to the SSID 642*03f9172cSAndroid Build Coastguard Worker * 643*03f9172cSAndroid Build Coastguard Worker * This data will be added to the end of the SSID after the 644*03f9172cSAndroid Build Coastguard Worker * DIRECT-<random two octets> prefix. 645*03f9172cSAndroid Build Coastguard Worker */ 646*03f9172cSAndroid Build Coastguard Worker u8 ssid_postfix[SSID_MAX_LEN - 9]; 647*03f9172cSAndroid Build Coastguard Worker 648*03f9172cSAndroid Build Coastguard Worker /** 649*03f9172cSAndroid Build Coastguard Worker * ssid_postfix_len - Length of the ssid_postfix data 650*03f9172cSAndroid Build Coastguard Worker */ 651*03f9172cSAndroid Build Coastguard Worker size_t ssid_postfix_len; 652*03f9172cSAndroid Build Coastguard Worker 653*03f9172cSAndroid Build Coastguard Worker /** 654*03f9172cSAndroid Build Coastguard Worker * max_listen - Maximum listen duration in ms 655*03f9172cSAndroid Build Coastguard Worker */ 656*03f9172cSAndroid Build Coastguard Worker unsigned int max_listen; 657*03f9172cSAndroid Build Coastguard Worker 658*03f9172cSAndroid Build Coastguard Worker /** 659*03f9172cSAndroid Build Coastguard Worker * passphrase_len - Passphrase length (8..63) 660*03f9172cSAndroid Build Coastguard Worker * 661*03f9172cSAndroid Build Coastguard Worker * This parameter controls the length of the random passphrase that is 662*03f9172cSAndroid Build Coastguard Worker * generated at the GO. 663*03f9172cSAndroid Build Coastguard Worker */ 664*03f9172cSAndroid Build Coastguard Worker unsigned int passphrase_len; 665*03f9172cSAndroid Build Coastguard Worker 666*03f9172cSAndroid Build Coastguard Worker /** 667*03f9172cSAndroid Build Coastguard Worker * p2p_pairing_config - P2P pairing configuration 668*03f9172cSAndroid Build Coastguard Worker */ 669*03f9172cSAndroid Build Coastguard Worker struct p2p_pairing_config pairing_config; 670*03f9172cSAndroid Build Coastguard Worker 671*03f9172cSAndroid Build Coastguard Worker /** 672*03f9172cSAndroid Build Coastguard Worker * reg_info - Regulatory info encoding for operation in 6 GHz band 673*03f9172cSAndroid Build Coastguard Worker */ 674*03f9172cSAndroid Build Coastguard Worker u8 reg_info; 675*03f9172cSAndroid Build Coastguard Worker 676*03f9172cSAndroid Build Coastguard Worker /** 677*03f9172cSAndroid Build Coastguard Worker * dfs_owner - Enable P2P GO to act as DFS Owner 678*03f9172cSAndroid Build Coastguard Worker */ 679*03f9172cSAndroid Build Coastguard Worker bool dfs_owner; 680*03f9172cSAndroid Build Coastguard Worker 681*03f9172cSAndroid Build Coastguard Worker /** 682*03f9172cSAndroid Build Coastguard Worker * twt_power_mgmt - Enable TWT based power management for P2P 683*03f9172cSAndroid Build Coastguard Worker */ 684*03f9172cSAndroid Build Coastguard Worker bool twt_power_mgmt; 685*03f9172cSAndroid Build Coastguard Worker 686*03f9172cSAndroid Build Coastguard Worker /** 687*03f9172cSAndroid Build Coastguard Worker * comeback_after - Bootstrap request unauthorized for peer 688*03f9172cSAndroid Build Coastguard Worker * 689*03f9172cSAndroid Build Coastguard Worker * Ask to come back after this many TUs. 690*03f9172cSAndroid Build Coastguard Worker */ 691*03f9172cSAndroid Build Coastguard Worker u16 comeback_after; 692*03f9172cSAndroid Build Coastguard Worker 693*03f9172cSAndroid Build Coastguard Worker /** 694*03f9172cSAndroid Build Coastguard Worker * cb_ctx - Context to use with callback functions 695*03f9172cSAndroid Build Coastguard Worker */ 696*03f9172cSAndroid Build Coastguard Worker void *cb_ctx; 697*03f9172cSAndroid Build Coastguard Worker 698*03f9172cSAndroid Build Coastguard Worker /** 699*03f9172cSAndroid Build Coastguard Worker * debug_print - Debug print 700*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 701*03f9172cSAndroid Build Coastguard Worker * @level: Debug verbosity level (MSG_*) 702*03f9172cSAndroid Build Coastguard Worker * @msg: Debug message 703*03f9172cSAndroid Build Coastguard Worker */ 704*03f9172cSAndroid Build Coastguard Worker void (*debug_print)(void *ctx, int level, const char *msg); 705*03f9172cSAndroid Build Coastguard Worker 706*03f9172cSAndroid Build Coastguard Worker 707*03f9172cSAndroid Build Coastguard Worker /* Callbacks to request lower layer driver operations */ 708*03f9172cSAndroid Build Coastguard Worker 709*03f9172cSAndroid Build Coastguard Worker /** 710*03f9172cSAndroid Build Coastguard Worker * p2p_scan - Request a P2P scan/search 711*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 712*03f9172cSAndroid Build Coastguard Worker * @type: Scan type 713*03f9172cSAndroid Build Coastguard Worker * @freq: Specific frequency (MHz) to scan or 0 for no restriction 714*03f9172cSAndroid Build Coastguard Worker * @num_req_dev_types: Number of requested device types 715*03f9172cSAndroid Build Coastguard Worker * @req_dev_types: Array containing requested device types 716*03f9172cSAndroid Build Coastguard Worker * @dev_id: Device ID to search for or %NULL to find all devices 717*03f9172cSAndroid Build Coastguard Worker * @pw_id: Device Password ID 718*03f9172cSAndroid Build Coastguard Worker * @include_6ghz: Include 6 GHz channels in P2P scan 719*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 720*03f9172cSAndroid Build Coastguard Worker * 721*03f9172cSAndroid Build Coastguard Worker * This callback function is used to request a P2P scan or search 722*03f9172cSAndroid Build Coastguard Worker * operation to be completed. Type type argument specifies which type 723*03f9172cSAndroid Build Coastguard Worker * of scan is to be done. @P2P_SCAN_SOCIAL indicates that only the 724*03f9172cSAndroid Build Coastguard Worker * social channels (1, 6, 11) should be scanned. @P2P_SCAN_FULL 725*03f9172cSAndroid Build Coastguard Worker * indicates that all channels are to be scanned. @P2P_SCAN_SPECIFIC 726*03f9172cSAndroid Build Coastguard Worker * request a scan of a single channel specified by freq. 727*03f9172cSAndroid Build Coastguard Worker * @P2P_SCAN_SOCIAL_PLUS_ONE request scan of all the social channels 728*03f9172cSAndroid Build Coastguard Worker * plus one extra channel specified by freq. 729*03f9172cSAndroid Build Coastguard Worker * 730*03f9172cSAndroid Build Coastguard Worker * The full scan is used for the initial scan to find group owners from 731*03f9172cSAndroid Build Coastguard Worker * all. The other types are used during search phase scan of the social 732*03f9172cSAndroid Build Coastguard Worker * channels (with potential variation if the Listen channel of the 733*03f9172cSAndroid Build Coastguard Worker * target peer is known or if other channels are scanned in steps). 734*03f9172cSAndroid Build Coastguard Worker * 735*03f9172cSAndroid Build Coastguard Worker * The scan results are returned after this call by calling 736*03f9172cSAndroid Build Coastguard Worker * p2p_scan_res_handler() for each scan result that has a P2P IE and 737*03f9172cSAndroid Build Coastguard Worker * then calling p2p_scan_res_handled() to indicate that all scan 738*03f9172cSAndroid Build Coastguard Worker * results have been indicated. 739*03f9172cSAndroid Build Coastguard Worker */ 740*03f9172cSAndroid Build Coastguard Worker int (*p2p_scan)(void *ctx, enum p2p_scan_type type, int freq, 741*03f9172cSAndroid Build Coastguard Worker unsigned int num_req_dev_types, 742*03f9172cSAndroid Build Coastguard Worker const u8 *req_dev_types, const u8 *dev_id, u16 pw_id, 743*03f9172cSAndroid Build Coastguard Worker bool include_6ghz); 744*03f9172cSAndroid Build Coastguard Worker 745*03f9172cSAndroid Build Coastguard Worker /** 746*03f9172cSAndroid Build Coastguard Worker * send_probe_resp - Transmit a Probe Response frame 747*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 748*03f9172cSAndroid Build Coastguard Worker * @buf: Probe Response frame (including the header and body) 749*03f9172cSAndroid Build Coastguard Worker * @freq: Forced frequency (in MHz) to use or 0. 750*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 751*03f9172cSAndroid Build Coastguard Worker * 752*03f9172cSAndroid Build Coastguard Worker * This function is used to reply to Probe Request frames that were 753*03f9172cSAndroid Build Coastguard Worker * indicated with a call to p2p_probe_req_rx(). The response is to be 754*03f9172cSAndroid Build Coastguard Worker * sent on the same channel, unless otherwise specified, or to be 755*03f9172cSAndroid Build Coastguard Worker * dropped if the driver is not listening to Probe Request frames 756*03f9172cSAndroid Build Coastguard Worker * anymore. 757*03f9172cSAndroid Build Coastguard Worker * 758*03f9172cSAndroid Build Coastguard Worker * Alternatively, the responsibility for building the Probe Response 759*03f9172cSAndroid Build Coastguard Worker * frames in Listen state may be in another system component in which 760*03f9172cSAndroid Build Coastguard Worker * case this function need to be implemented (i.e., the function 761*03f9172cSAndroid Build Coastguard Worker * pointer can be %NULL). The WPS and P2P IEs to be added for Probe 762*03f9172cSAndroid Build Coastguard Worker * Response frames in such a case are available from the 763*03f9172cSAndroid Build Coastguard Worker * start_listen() callback. It should be noted that the received Probe 764*03f9172cSAndroid Build Coastguard Worker * Request frames must be indicated by calling p2p_probe_req_rx() even 765*03f9172cSAndroid Build Coastguard Worker * if this send_probe_resp() is not used. 766*03f9172cSAndroid Build Coastguard Worker */ 767*03f9172cSAndroid Build Coastguard Worker int (*send_probe_resp)(void *ctx, const struct wpabuf *buf, 768*03f9172cSAndroid Build Coastguard Worker unsigned int freq); 769*03f9172cSAndroid Build Coastguard Worker 770*03f9172cSAndroid Build Coastguard Worker /** 771*03f9172cSAndroid Build Coastguard Worker * send_action - Transmit an Action frame 772*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 773*03f9172cSAndroid Build Coastguard Worker * @freq: Frequency in MHz for the channel on which to transmit 774*03f9172cSAndroid Build Coastguard Worker * @dst: Destination MAC address (Address 1) 775*03f9172cSAndroid Build Coastguard Worker * @src: Source MAC address (Address 2) 776*03f9172cSAndroid Build Coastguard Worker * @bssid: BSSID (Address 3) 777*03f9172cSAndroid Build Coastguard Worker * @buf: Frame body (starting from Category field) 778*03f9172cSAndroid Build Coastguard Worker * @len: Length of buf in octets 779*03f9172cSAndroid Build Coastguard Worker * @wait_time: How many msec to wait for a response frame 780*03f9172cSAndroid Build Coastguard Worker * @scheduled: Return value indicating whether the transmissions was 781*03f9172cSAndroid Build Coastguard Worker * scheduled to happen once the radio is available 782*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 783*03f9172cSAndroid Build Coastguard Worker * 784*03f9172cSAndroid Build Coastguard Worker * The Action frame may not be transmitted immediately and the status 785*03f9172cSAndroid Build Coastguard Worker * of the transmission must be reported by calling 786*03f9172cSAndroid Build Coastguard Worker * p2p_send_action_cb() once the frame has either been transmitted or 787*03f9172cSAndroid Build Coastguard Worker * it has been dropped due to excessive retries or other failure to 788*03f9172cSAndroid Build Coastguard Worker * transmit. 789*03f9172cSAndroid Build Coastguard Worker */ 790*03f9172cSAndroid Build Coastguard Worker int (*send_action)(void *ctx, unsigned int freq, const u8 *dst, 791*03f9172cSAndroid Build Coastguard Worker const u8 *src, const u8 *bssid, const u8 *buf, 792*03f9172cSAndroid Build Coastguard Worker size_t len, unsigned int wait_time, int *scheduled); 793*03f9172cSAndroid Build Coastguard Worker 794*03f9172cSAndroid Build Coastguard Worker /** 795*03f9172cSAndroid Build Coastguard Worker * send_action_done - Notify that Action frame sequence was completed 796*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 797*03f9172cSAndroid Build Coastguard Worker * 798*03f9172cSAndroid Build Coastguard Worker * This function is called when the Action frame sequence that was 799*03f9172cSAndroid Build Coastguard Worker * started with send_action() has been completed, i.e., when there is 800*03f9172cSAndroid Build Coastguard Worker * no need to wait for a response from the destination peer anymore. 801*03f9172cSAndroid Build Coastguard Worker */ 802*03f9172cSAndroid Build Coastguard Worker void (*send_action_done)(void *ctx); 803*03f9172cSAndroid Build Coastguard Worker 804*03f9172cSAndroid Build Coastguard Worker /** 805*03f9172cSAndroid Build Coastguard Worker * start_listen - Start Listen state 806*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 807*03f9172cSAndroid Build Coastguard Worker * @freq: Frequency of the listen channel in MHz 808*03f9172cSAndroid Build Coastguard Worker * @duration: Duration for the Listen state in milliseconds 809*03f9172cSAndroid Build Coastguard Worker * @probe_resp_ie: IE(s) to be added to Probe Response frames 810*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 811*03f9172cSAndroid Build Coastguard Worker * 812*03f9172cSAndroid Build Coastguard Worker * This Listen state may not start immediately since the driver may 813*03f9172cSAndroid Build Coastguard Worker * have other pending operations to complete first. Once the Listen 814*03f9172cSAndroid Build Coastguard Worker * state has started, p2p_listen_cb() must be called to notify the P2P 815*03f9172cSAndroid Build Coastguard Worker * module. Once the Listen state is stopped, p2p_listen_end() must be 816*03f9172cSAndroid Build Coastguard Worker * called to notify the P2P module that the driver is not in the Listen 817*03f9172cSAndroid Build Coastguard Worker * state anymore. 818*03f9172cSAndroid Build Coastguard Worker * 819*03f9172cSAndroid Build Coastguard Worker * If the send_probe_resp() is not used for generating the response, 820*03f9172cSAndroid Build Coastguard Worker * the IEs from probe_resp_ie need to be added to the end of the Probe 821*03f9172cSAndroid Build Coastguard Worker * Response frame body. If send_probe_resp() is used, the probe_resp_ie 822*03f9172cSAndroid Build Coastguard Worker * information can be ignored. 823*03f9172cSAndroid Build Coastguard Worker */ 824*03f9172cSAndroid Build Coastguard Worker int (*start_listen)(void *ctx, unsigned int freq, 825*03f9172cSAndroid Build Coastguard Worker unsigned int duration, 826*03f9172cSAndroid Build Coastguard Worker const struct wpabuf *probe_resp_ie); 827*03f9172cSAndroid Build Coastguard Worker /** 828*03f9172cSAndroid Build Coastguard Worker * stop_listen - Stop Listen state 829*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 830*03f9172cSAndroid Build Coastguard Worker * 831*03f9172cSAndroid Build Coastguard Worker * This callback can be used to stop a Listen state operation that was 832*03f9172cSAndroid Build Coastguard Worker * previously requested with start_listen(). 833*03f9172cSAndroid Build Coastguard Worker */ 834*03f9172cSAndroid Build Coastguard Worker void (*stop_listen)(void *ctx); 835*03f9172cSAndroid Build Coastguard Worker 836*03f9172cSAndroid Build Coastguard Worker /** 837*03f9172cSAndroid Build Coastguard Worker * get_noa - Get current Notice of Absence attribute payload 838*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 839*03f9172cSAndroid Build Coastguard Worker * @interface_addr: P2P Interface Address of the GO 840*03f9172cSAndroid Build Coastguard Worker * @buf: Buffer for returning NoA 841*03f9172cSAndroid Build Coastguard Worker * @buf_len: Buffer length in octets 842*03f9172cSAndroid Build Coastguard Worker * Returns: Number of octets used in buf, 0 to indicate no NoA is being 843*03f9172cSAndroid Build Coastguard Worker * advertized, or -1 on failure 844*03f9172cSAndroid Build Coastguard Worker * 845*03f9172cSAndroid Build Coastguard Worker * This function is used to fetch the current Notice of Absence 846*03f9172cSAndroid Build Coastguard Worker * attribute value from GO. 847*03f9172cSAndroid Build Coastguard Worker */ 848*03f9172cSAndroid Build Coastguard Worker int (*get_noa)(void *ctx, const u8 *interface_addr, u8 *buf, 849*03f9172cSAndroid Build Coastguard Worker size_t buf_len); 850*03f9172cSAndroid Build Coastguard Worker 851*03f9172cSAndroid Build Coastguard Worker /* Callbacks to notify events to upper layer management entity */ 852*03f9172cSAndroid Build Coastguard Worker 853*03f9172cSAndroid Build Coastguard Worker /** 854*03f9172cSAndroid Build Coastguard Worker * dev_found - Notification of a found P2P Device 855*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 856*03f9172cSAndroid Build Coastguard Worker * @addr: Source address of the message triggering this notification 857*03f9172cSAndroid Build Coastguard Worker * @info: P2P peer information 858*03f9172cSAndroid Build Coastguard Worker * @new_device: Inform if the peer is newly found 859*03f9172cSAndroid Build Coastguard Worker * 860*03f9172cSAndroid Build Coastguard Worker * This callback is used to notify that a new P2P Device has been 861*03f9172cSAndroid Build Coastguard Worker * found. This may happen, e.g., during Search state based on scan 862*03f9172cSAndroid Build Coastguard Worker * results or during Listen state based on receive Probe Request and 863*03f9172cSAndroid Build Coastguard Worker * Group Owner Negotiation Request. 864*03f9172cSAndroid Build Coastguard Worker */ 865*03f9172cSAndroid Build Coastguard Worker void (*dev_found)(void *ctx, const u8 *addr, 866*03f9172cSAndroid Build Coastguard Worker const struct p2p_peer_info *info, 867*03f9172cSAndroid Build Coastguard Worker int new_device); 868*03f9172cSAndroid Build Coastguard Worker 869*03f9172cSAndroid Build Coastguard Worker /** 870*03f9172cSAndroid Build Coastguard Worker * dev_lost - Notification of a lost P2P Device 871*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 872*03f9172cSAndroid Build Coastguard Worker * @dev_addr: P2P Device Address of the lost P2P Device 873*03f9172cSAndroid Build Coastguard Worker * 874*03f9172cSAndroid Build Coastguard Worker * This callback is used to notify that a P2P Device has been deleted. 875*03f9172cSAndroid Build Coastguard Worker */ 876*03f9172cSAndroid Build Coastguard Worker void (*dev_lost)(void *ctx, const u8 *dev_addr); 877*03f9172cSAndroid Build Coastguard Worker 878*03f9172cSAndroid Build Coastguard Worker /** 879*03f9172cSAndroid Build Coastguard Worker * find_stopped - Notification of a p2p_find operation stopping 880*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 881*03f9172cSAndroid Build Coastguard Worker */ 882*03f9172cSAndroid Build Coastguard Worker void (*find_stopped)(void *ctx); 883*03f9172cSAndroid Build Coastguard Worker 884*03f9172cSAndroid Build Coastguard Worker /** 885*03f9172cSAndroid Build Coastguard Worker * go_neg_req_rx - Notification of a receive GO Negotiation Request 886*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 887*03f9172cSAndroid Build Coastguard Worker * @src: Source address of the message triggering this notification 888*03f9172cSAndroid Build Coastguard Worker * @dev_passwd_id: WPS Device Password ID 889*03f9172cSAndroid Build Coastguard Worker * @go_intent: Peer's GO Intent 890*03f9172cSAndroid Build Coastguard Worker * 891*03f9172cSAndroid Build Coastguard Worker * This callback is used to notify that a P2P Device is requesting 892*03f9172cSAndroid Build Coastguard Worker * group owner negotiation with us, but we do not have all the 893*03f9172cSAndroid Build Coastguard Worker * necessary information to start GO Negotiation. This indicates that 894*03f9172cSAndroid Build Coastguard Worker * the local user has not authorized the connection yet by providing a 895*03f9172cSAndroid Build Coastguard Worker * PIN or PBC button press. This information can be provided with a 896*03f9172cSAndroid Build Coastguard Worker * call to p2p_connect(). 897*03f9172cSAndroid Build Coastguard Worker */ 898*03f9172cSAndroid Build Coastguard Worker void (*go_neg_req_rx)(void *ctx, const u8 *src, u16 dev_passwd_id, 899*03f9172cSAndroid Build Coastguard Worker u8 go_intent); 900*03f9172cSAndroid Build Coastguard Worker 901*03f9172cSAndroid Build Coastguard Worker /** 902*03f9172cSAndroid Build Coastguard Worker * go_neg_completed - Notification of GO Negotiation results 903*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 904*03f9172cSAndroid Build Coastguard Worker * @res: GO Negotiation results 905*03f9172cSAndroid Build Coastguard Worker * 906*03f9172cSAndroid Build Coastguard Worker * This callback is used to notify that Group Owner Negotiation has 907*03f9172cSAndroid Build Coastguard Worker * been completed. Non-zero struct p2p_go_neg_results::status indicates 908*03f9172cSAndroid Build Coastguard Worker * failed negotiation. In case of success, this function is responsible 909*03f9172cSAndroid Build Coastguard Worker * for creating a new group interface (or using the existing interface 910*03f9172cSAndroid Build Coastguard Worker * depending on driver features), setting up the group interface in 911*03f9172cSAndroid Build Coastguard Worker * proper mode based on struct p2p_go_neg_results::role_go and 912*03f9172cSAndroid Build Coastguard Worker * initializing WPS provisioning either as a Registrar (if GO) or as an 913*03f9172cSAndroid Build Coastguard Worker * Enrollee. Successful WPS provisioning must be indicated by calling 914*03f9172cSAndroid Build Coastguard Worker * p2p_wps_success_cb(). The callee is responsible for timing out group 915*03f9172cSAndroid Build Coastguard Worker * formation if WPS provisioning cannot be completed successfully 916*03f9172cSAndroid Build Coastguard Worker * within 15 seconds. 917*03f9172cSAndroid Build Coastguard Worker */ 918*03f9172cSAndroid Build Coastguard Worker void (*go_neg_completed)(void *ctx, struct p2p_go_neg_results *res); 919*03f9172cSAndroid Build Coastguard Worker 920*03f9172cSAndroid Build Coastguard Worker /** 921*03f9172cSAndroid Build Coastguard Worker * sd_request - Callback on Service Discovery Request 922*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 923*03f9172cSAndroid Build Coastguard Worker * @freq: Frequency (in MHz) of the channel 924*03f9172cSAndroid Build Coastguard Worker * @sa: Source address of the request 925*03f9172cSAndroid Build Coastguard Worker * @dialog_token: Dialog token 926*03f9172cSAndroid Build Coastguard Worker * @update_indic: Service Update Indicator from the source of request 927*03f9172cSAndroid Build Coastguard Worker * @tlvs: P2P Service Request TLV(s) 928*03f9172cSAndroid Build Coastguard Worker * @tlvs_len: Length of tlvs buffer in octets 929*03f9172cSAndroid Build Coastguard Worker * 930*03f9172cSAndroid Build Coastguard Worker * This callback is used to indicate reception of a service discovery 931*03f9172cSAndroid Build Coastguard Worker * request. Response to the query must be indicated by calling 932*03f9172cSAndroid Build Coastguard Worker * p2p_sd_response() with the context information from the arguments to 933*03f9172cSAndroid Build Coastguard Worker * this callback function. 934*03f9172cSAndroid Build Coastguard Worker * 935*03f9172cSAndroid Build Coastguard Worker * This callback handler can be set to %NULL to indicate that service 936*03f9172cSAndroid Build Coastguard Worker * discovery is not supported. 937*03f9172cSAndroid Build Coastguard Worker */ 938*03f9172cSAndroid Build Coastguard Worker void (*sd_request)(void *ctx, int freq, const u8 *sa, u8 dialog_token, 939*03f9172cSAndroid Build Coastguard Worker u16 update_indic, const u8 *tlvs, size_t tlvs_len); 940*03f9172cSAndroid Build Coastguard Worker 941*03f9172cSAndroid Build Coastguard Worker /** 942*03f9172cSAndroid Build Coastguard Worker * sd_response - Callback on Service Discovery Response 943*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 944*03f9172cSAndroid Build Coastguard Worker * @sa: Source address of the request 945*03f9172cSAndroid Build Coastguard Worker * @update_indic: Service Update Indicator from the source of response 946*03f9172cSAndroid Build Coastguard Worker * @tlvs: P2P Service Response TLV(s) 947*03f9172cSAndroid Build Coastguard Worker * @tlvs_len: Length of tlvs buffer in octets 948*03f9172cSAndroid Build Coastguard Worker * 949*03f9172cSAndroid Build Coastguard Worker * This callback is used to indicate reception of a service discovery 950*03f9172cSAndroid Build Coastguard Worker * response. This callback handler can be set to %NULL if no service 951*03f9172cSAndroid Build Coastguard Worker * discovery requests are used. The information provided with this call 952*03f9172cSAndroid Build Coastguard Worker * is replies to the queries scheduled with p2p_sd_request(). 953*03f9172cSAndroid Build Coastguard Worker */ 954*03f9172cSAndroid Build Coastguard Worker void (*sd_response)(void *ctx, const u8 *sa, u16 update_indic, 955*03f9172cSAndroid Build Coastguard Worker const u8 *tlvs, size_t tlvs_len); 956*03f9172cSAndroid Build Coastguard Worker 957*03f9172cSAndroid Build Coastguard Worker /** 958*03f9172cSAndroid Build Coastguard Worker * prov_disc_req - Callback on Provisiong Discovery Request 959*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 960*03f9172cSAndroid Build Coastguard Worker * @peer: Source address of the request 961*03f9172cSAndroid Build Coastguard Worker * @config_methods: Requested WPS Config Method 962*03f9172cSAndroid Build Coastguard Worker * @dev_addr: P2P Device Address of the found P2P Device 963*03f9172cSAndroid Build Coastguard Worker * @pri_dev_type: Primary Device Type 964*03f9172cSAndroid Build Coastguard Worker * @dev_name: Device Name 965*03f9172cSAndroid Build Coastguard Worker * @supp_config_methods: Supported configuration Methods 966*03f9172cSAndroid Build Coastguard Worker * @dev_capab: Device Capabilities 967*03f9172cSAndroid Build Coastguard Worker * @group_capab: Group Capabilities 968*03f9172cSAndroid Build Coastguard Worker * @group_id: P2P Group ID (or %NULL if not included) 969*03f9172cSAndroid Build Coastguard Worker * @group_id_len: Length of P2P Group ID 970*03f9172cSAndroid Build Coastguard Worker * 971*03f9172cSAndroid Build Coastguard Worker * This callback is used to indicate reception of a Provision Discovery 972*03f9172cSAndroid Build Coastguard Worker * Request frame that the P2P module accepted. 973*03f9172cSAndroid Build Coastguard Worker */ 974*03f9172cSAndroid Build Coastguard Worker void (*prov_disc_req)(void *ctx, const u8 *peer, u16 config_methods, 975*03f9172cSAndroid Build Coastguard Worker const u8 *dev_addr, const u8 *pri_dev_type, 976*03f9172cSAndroid Build Coastguard Worker const char *dev_name, u16 supp_config_methods, 977*03f9172cSAndroid Build Coastguard Worker u8 dev_capab, u8 group_capab, 978*03f9172cSAndroid Build Coastguard Worker const u8 *group_id, size_t group_id_len); 979*03f9172cSAndroid Build Coastguard Worker 980*03f9172cSAndroid Build Coastguard Worker /** 981*03f9172cSAndroid Build Coastguard Worker * prov_disc_resp - Callback on Provisiong Discovery Response 982*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 983*03f9172cSAndroid Build Coastguard Worker * @peer: Source address of the response 984*03f9172cSAndroid Build Coastguard Worker * @config_methods: Value from p2p_prov_disc_req() or 0 on failure 985*03f9172cSAndroid Build Coastguard Worker * 986*03f9172cSAndroid Build Coastguard Worker * This callback is used to indicate reception of a Provision Discovery 987*03f9172cSAndroid Build Coastguard Worker * Response frame for a pending request scheduled with 988*03f9172cSAndroid Build Coastguard Worker * p2p_prov_disc_req(). This callback handler can be set to %NULL if 989*03f9172cSAndroid Build Coastguard Worker * provision discovery is not used. 990*03f9172cSAndroid Build Coastguard Worker */ 991*03f9172cSAndroid Build Coastguard Worker void (*prov_disc_resp)(void *ctx, const u8 *peer, u16 config_methods); 992*03f9172cSAndroid Build Coastguard Worker 993*03f9172cSAndroid Build Coastguard Worker /** 994*03f9172cSAndroid Build Coastguard Worker * prov_disc_fail - Callback on Provision Discovery failure 995*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 996*03f9172cSAndroid Build Coastguard Worker * @peer: Source address of the response 997*03f9172cSAndroid Build Coastguard Worker * @status: Cause of failure, will not be %P2P_PROV_DISC_SUCCESS 998*03f9172cSAndroid Build Coastguard Worker * @adv_id: If non-zero, then the adv_id of the PD Request 999*03f9172cSAndroid Build Coastguard Worker * @adv_mac: P2P Device Address of the advertizer 1000*03f9172cSAndroid Build Coastguard Worker * @deferred_session_resp: Deferred session response sent by advertizer 1001*03f9172cSAndroid Build Coastguard Worker * 1002*03f9172cSAndroid Build Coastguard Worker * This callback is used to indicate either a failure or no response 1003*03f9172cSAndroid Build Coastguard Worker * to an earlier provision discovery request. 1004*03f9172cSAndroid Build Coastguard Worker * 1005*03f9172cSAndroid Build Coastguard Worker * This callback handler can be set to %NULL if provision discovery 1006*03f9172cSAndroid Build Coastguard Worker * is not used or failures do not need to be indicated. 1007*03f9172cSAndroid Build Coastguard Worker */ 1008*03f9172cSAndroid Build Coastguard Worker void (*prov_disc_fail)(void *ctx, const u8 *peer, 1009*03f9172cSAndroid Build Coastguard Worker enum p2p_prov_disc_status status, 1010*03f9172cSAndroid Build Coastguard Worker u32 adv_id, const u8 *adv_mac, 1011*03f9172cSAndroid Build Coastguard Worker const char *deferred_session_resp); 1012*03f9172cSAndroid Build Coastguard Worker 1013*03f9172cSAndroid Build Coastguard Worker /** 1014*03f9172cSAndroid Build Coastguard Worker * invitation_process - Optional callback for processing Invitations 1015*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1016*03f9172cSAndroid Build Coastguard Worker * @sa: Source address of the Invitation Request 1017*03f9172cSAndroid Build Coastguard Worker * @bssid: P2P Group BSSID from the request or %NULL if not included 1018*03f9172cSAndroid Build Coastguard Worker * @go_dev_addr: GO Device Address from P2P Group ID 1019*03f9172cSAndroid Build Coastguard Worker * @ssid: SSID from P2P Group ID 1020*03f9172cSAndroid Build Coastguard Worker * @ssid_len: Length of ssid buffer in octets 1021*03f9172cSAndroid Build Coastguard Worker * @go: Variable for returning whether the local end is GO in the group 1022*03f9172cSAndroid Build Coastguard Worker * @group_bssid: Buffer for returning P2P Group BSSID (if local end GO) 1023*03f9172cSAndroid Build Coastguard Worker * @force_freq: Variable for returning forced frequency for the group 1024*03f9172cSAndroid Build Coastguard Worker * @persistent_group: Whether this is an invitation to reinvoke a 1025*03f9172cSAndroid Build Coastguard Worker * persistent group (instead of invitation to join an active 1026*03f9172cSAndroid Build Coastguard Worker * group) 1027*03f9172cSAndroid Build Coastguard Worker * @channels: Available operating channels for the group 1028*03f9172cSAndroid Build Coastguard Worker * @dev_pw_id: Device Password ID for NFC static handover or -1 if not 1029*03f9172cSAndroid Build Coastguard Worker * used 1030*03f9172cSAndroid Build Coastguard Worker * Returns: Status code (P2P_SC_*) 1031*03f9172cSAndroid Build Coastguard Worker * 1032*03f9172cSAndroid Build Coastguard Worker * This optional callback can be used to implement persistent reconnect 1033*03f9172cSAndroid Build Coastguard Worker * by allowing automatic restarting of persistent groups without user 1034*03f9172cSAndroid Build Coastguard Worker * interaction. If this callback is not implemented (i.e., is %NULL), 1035*03f9172cSAndroid Build Coastguard Worker * the received Invitation Request frames are replied with 1036*03f9172cSAndroid Build Coastguard Worker * %P2P_SC_REQ_RECEIVED status and indicated to upper layer with the 1037*03f9172cSAndroid Build Coastguard Worker * invitation_result() callback. 1038*03f9172cSAndroid Build Coastguard Worker * 1039*03f9172cSAndroid Build Coastguard Worker * If the requested parameters are acceptable and the group is known, 1040*03f9172cSAndroid Build Coastguard Worker * %P2P_SC_SUCCESS may be returned. If the requested group is unknown, 1041*03f9172cSAndroid Build Coastguard Worker * %P2P_SC_FAIL_UNKNOWN_GROUP should be returned. %P2P_SC_REQ_RECEIVED 1042*03f9172cSAndroid Build Coastguard Worker * can be returned if there is not enough data to provide immediate 1043*03f9172cSAndroid Build Coastguard Worker * response, i.e., if some sort of user interaction is needed. The 1044*03f9172cSAndroid Build Coastguard Worker * invitation_received() callback will be called in that case 1045*03f9172cSAndroid Build Coastguard Worker * immediately after this call. 1046*03f9172cSAndroid Build Coastguard Worker */ 1047*03f9172cSAndroid Build Coastguard Worker u8 (*invitation_process)(void *ctx, const u8 *sa, const u8 *bssid, 1048*03f9172cSAndroid Build Coastguard Worker const u8 *go_dev_addr, const u8 *ssid, 1049*03f9172cSAndroid Build Coastguard Worker size_t ssid_len, int *go, u8 *group_bssid, 1050*03f9172cSAndroid Build Coastguard Worker int *force_freq, int persistent_group, 1051*03f9172cSAndroid Build Coastguard Worker const struct p2p_channels *channels, 1052*03f9172cSAndroid Build Coastguard Worker int dev_pw_id); 1053*03f9172cSAndroid Build Coastguard Worker 1054*03f9172cSAndroid Build Coastguard Worker /** 1055*03f9172cSAndroid Build Coastguard Worker * invitation_received - Callback on Invitation Request RX 1056*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1057*03f9172cSAndroid Build Coastguard Worker * @sa: Source address of the Invitation Request 1058*03f9172cSAndroid Build Coastguard Worker * @bssid: P2P Group BSSID or %NULL if not received 1059*03f9172cSAndroid Build Coastguard Worker * @ssid: SSID of the group 1060*03f9172cSAndroid Build Coastguard Worker * @ssid_len: Length of ssid in octets 1061*03f9172cSAndroid Build Coastguard Worker * @go_dev_addr: GO Device Address 1062*03f9172cSAndroid Build Coastguard Worker * @status: Response Status 1063*03f9172cSAndroid Build Coastguard Worker * @op_freq: Operational frequency for the group 1064*03f9172cSAndroid Build Coastguard Worker * 1065*03f9172cSAndroid Build Coastguard Worker * This callback is used to indicate sending of an Invitation Response 1066*03f9172cSAndroid Build Coastguard Worker * for a received Invitation Request. If status == 0 (success), the 1067*03f9172cSAndroid Build Coastguard Worker * upper layer code is responsible for starting the group. status == 1 1068*03f9172cSAndroid Build Coastguard Worker * indicates need to get user authorization for the group. Other status 1069*03f9172cSAndroid Build Coastguard Worker * values indicate that the invitation request was rejected. 1070*03f9172cSAndroid Build Coastguard Worker */ 1071*03f9172cSAndroid Build Coastguard Worker void (*invitation_received)(void *ctx, const u8 *sa, const u8 *bssid, 1072*03f9172cSAndroid Build Coastguard Worker const u8 *ssid, size_t ssid_len, 1073*03f9172cSAndroid Build Coastguard Worker const u8 *go_dev_addr, u8 status, 1074*03f9172cSAndroid Build Coastguard Worker int op_freq); 1075*03f9172cSAndroid Build Coastguard Worker 1076*03f9172cSAndroid Build Coastguard Worker /** 1077*03f9172cSAndroid Build Coastguard Worker * invitation_result - Callback on Invitation result 1078*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1079*03f9172cSAndroid Build Coastguard Worker * @status: Negotiation result (Status Code) 1080*03f9172cSAndroid Build Coastguard Worker * @bssid: P2P Group BSSID or %NULL if not received 1081*03f9172cSAndroid Build Coastguard Worker * @channels: Available operating channels for the group 1082*03f9172cSAndroid Build Coastguard Worker * @addr: Peer address 1083*03f9172cSAndroid Build Coastguard Worker * @freq: Frequency (in MHz) indicated during invitation or 0 1084*03f9172cSAndroid Build Coastguard Worker * @peer_oper_freq: Operating frequency (in MHz) advertized by the peer 1085*03f9172cSAndroid Build Coastguard Worker * during invitation or 0 1086*03f9172cSAndroid Build Coastguard Worker * 1087*03f9172cSAndroid Build Coastguard Worker * This callback is used to indicate result of an Invitation procedure 1088*03f9172cSAndroid Build Coastguard Worker * started with a call to p2p_invite(). The indicated status code is 1089*03f9172cSAndroid Build Coastguard Worker * the value received from the peer in Invitation Response with 0 1090*03f9172cSAndroid Build Coastguard Worker * (P2P_SC_SUCCESS) indicating success or -1 to indicate a timeout or a 1091*03f9172cSAndroid Build Coastguard Worker * local failure in transmitting the Invitation Request. 1092*03f9172cSAndroid Build Coastguard Worker */ 1093*03f9172cSAndroid Build Coastguard Worker void (*invitation_result)(void *ctx, int status, const u8 *bssid, 1094*03f9172cSAndroid Build Coastguard Worker const struct p2p_channels *channels, 1095*03f9172cSAndroid Build Coastguard Worker const u8 *addr, int freq, int peer_oper_freq); 1096*03f9172cSAndroid Build Coastguard Worker 1097*03f9172cSAndroid Build Coastguard Worker /** 1098*03f9172cSAndroid Build Coastguard Worker * go_connected - Check whether we are connected to a GO 1099*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1100*03f9172cSAndroid Build Coastguard Worker * @dev_addr: P2P Device Address of a GO 1101*03f9172cSAndroid Build Coastguard Worker * Returns: 1 if we are connected as a P2P client to the specified GO 1102*03f9172cSAndroid Build Coastguard Worker * or 0 if not. 1103*03f9172cSAndroid Build Coastguard Worker */ 1104*03f9172cSAndroid Build Coastguard Worker int (*go_connected)(void *ctx, const u8 *dev_addr); 1105*03f9172cSAndroid Build Coastguard Worker 1106*03f9172cSAndroid Build Coastguard Worker /** 1107*03f9172cSAndroid Build Coastguard Worker * presence_resp - Callback on Presence Response 1108*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1109*03f9172cSAndroid Build Coastguard Worker * @src: Source address (GO's P2P Interface Address) 1110*03f9172cSAndroid Build Coastguard Worker * @status: Result of the request (P2P_SC_*) 1111*03f9172cSAndroid Build Coastguard Worker * @noa: Returned NoA value 1112*03f9172cSAndroid Build Coastguard Worker * @noa_len: Length of the NoA buffer in octets 1113*03f9172cSAndroid Build Coastguard Worker */ 1114*03f9172cSAndroid Build Coastguard Worker void (*presence_resp)(void *ctx, const u8 *src, u8 status, 1115*03f9172cSAndroid Build Coastguard Worker const u8 *noa, size_t noa_len); 1116*03f9172cSAndroid Build Coastguard Worker 1117*03f9172cSAndroid Build Coastguard Worker /** 1118*03f9172cSAndroid Build Coastguard Worker * is_concurrent_session_active - Check whether concurrent session is 1119*03f9172cSAndroid Build Coastguard Worker * active on other virtual interfaces 1120*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1121*03f9172cSAndroid Build Coastguard Worker * Returns: 1 if concurrent session is active on other virtual interface 1122*03f9172cSAndroid Build Coastguard Worker * or 0 if not. 1123*03f9172cSAndroid Build Coastguard Worker */ 1124*03f9172cSAndroid Build Coastguard Worker int (*is_concurrent_session_active)(void *ctx); 1125*03f9172cSAndroid Build Coastguard Worker 1126*03f9172cSAndroid Build Coastguard Worker /** 1127*03f9172cSAndroid Build Coastguard Worker * is_p2p_in_progress - Check whether P2P operation is in progress 1128*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1129*03f9172cSAndroid Build Coastguard Worker * Returns: 1 if P2P operation (e.g., group formation) is in progress 1130*03f9172cSAndroid Build Coastguard Worker * or 0 if not. 1131*03f9172cSAndroid Build Coastguard Worker */ 1132*03f9172cSAndroid Build Coastguard Worker int (*is_p2p_in_progress)(void *ctx); 1133*03f9172cSAndroid Build Coastguard Worker 1134*03f9172cSAndroid Build Coastguard Worker /** 1135*03f9172cSAndroid Build Coastguard Worker * Determine if we have a persistent group we share with remote peer 1136*03f9172cSAndroid Build Coastguard Worker * and allocate interface for this group if needed 1137*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1138*03f9172cSAndroid Build Coastguard Worker * @addr: Peer device address to search for 1139*03f9172cSAndroid Build Coastguard Worker * @ssid: Persistent group SSID or %NULL if any 1140*03f9172cSAndroid Build Coastguard Worker * @ssid_len: Length of @ssid 1141*03f9172cSAndroid Build Coastguard Worker * @go_dev_addr: Buffer for returning GO P2P Device Address 1142*03f9172cSAndroid Build Coastguard Worker * @ret_ssid: Buffer for returning group SSID 1143*03f9172cSAndroid Build Coastguard Worker * @ret_ssid_len: Buffer for returning length of @ssid 1144*03f9172cSAndroid Build Coastguard Worker * @intended_iface_addr: Buffer for returning intended iface address 1145*03f9172cSAndroid Build Coastguard Worker * Returns: 1 if a matching persistent group was found, 0 otherwise 1146*03f9172cSAndroid Build Coastguard Worker */ 1147*03f9172cSAndroid Build Coastguard Worker int (*get_persistent_group)(void *ctx, const u8 *addr, const u8 *ssid, 1148*03f9172cSAndroid Build Coastguard Worker size_t ssid_len, u8 *go_dev_addr, 1149*03f9172cSAndroid Build Coastguard Worker u8 *ret_ssid, size_t *ret_ssid_len, 1150*03f9172cSAndroid Build Coastguard Worker u8 *intended_iface_addr); 1151*03f9172cSAndroid Build Coastguard Worker 1152*03f9172cSAndroid Build Coastguard Worker /** 1153*03f9172cSAndroid Build Coastguard Worker * Get information about a possible local GO role 1154*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1155*03f9172cSAndroid Build Coastguard Worker * @intended_addr: Buffer for returning intended GO interface address 1156*03f9172cSAndroid Build Coastguard Worker * @ssid: Buffer for returning group SSID 1157*03f9172cSAndroid Build Coastguard Worker * @ssid_len: Buffer for returning length of @ssid 1158*03f9172cSAndroid Build Coastguard Worker * @group_iface: Buffer for returning whether a separate group interface 1159*03f9172cSAndroid Build Coastguard Worker * would be used 1160*03f9172cSAndroid Build Coastguard Worker * @freq: Variable for returning the current operating frequency of a 1161*03f9172cSAndroid Build Coastguard Worker * currently running P2P GO. 1162*03f9172cSAndroid Build Coastguard Worker * Returns: 1 if GO info found, 0 otherwise 1163*03f9172cSAndroid Build Coastguard Worker * 1164*03f9172cSAndroid Build Coastguard Worker * This is used to compose New Group settings (SSID, and intended 1165*03f9172cSAndroid Build Coastguard Worker * address) during P2PS provisioning if results of provisioning *might* 1166*03f9172cSAndroid Build Coastguard Worker * result in our being an autonomous GO. 1167*03f9172cSAndroid Build Coastguard Worker */ 1168*03f9172cSAndroid Build Coastguard Worker int (*get_go_info)(void *ctx, u8 *intended_addr, 1169*03f9172cSAndroid Build Coastguard Worker u8 *ssid, size_t *ssid_len, int *group_iface, 1170*03f9172cSAndroid Build Coastguard Worker unsigned int *freq); 1171*03f9172cSAndroid Build Coastguard Worker 1172*03f9172cSAndroid Build Coastguard Worker /** 1173*03f9172cSAndroid Build Coastguard Worker * remove_stale_groups - Remove stale P2PS groups 1174*03f9172cSAndroid Build Coastguard Worker * 1175*03f9172cSAndroid Build Coastguard Worker * Because P2PS stages *potential* GOs, and remote devices can remove 1176*03f9172cSAndroid Build Coastguard Worker * credentials unilaterally, we need to make sure we don't let stale 1177*03f9172cSAndroid Build Coastguard Worker * unusable groups build up. 1178*03f9172cSAndroid Build Coastguard Worker */ 1179*03f9172cSAndroid Build Coastguard Worker int (*remove_stale_groups)(void *ctx, const u8 *peer, const u8 *go, 1180*03f9172cSAndroid Build Coastguard Worker const u8 *ssid, size_t ssid_len); 1181*03f9172cSAndroid Build Coastguard Worker 1182*03f9172cSAndroid Build Coastguard Worker /** 1183*03f9172cSAndroid Build Coastguard Worker * p2ps_prov_complete - P2PS provisioning complete 1184*03f9172cSAndroid Build Coastguard Worker * 1185*03f9172cSAndroid Build Coastguard Worker * When P2PS provisioning completes (successfully or not) we must 1186*03f9172cSAndroid Build Coastguard Worker * transmit all of the results to the upper layers. 1187*03f9172cSAndroid Build Coastguard Worker */ 1188*03f9172cSAndroid Build Coastguard Worker void (*p2ps_prov_complete)(void *ctx, enum p2p_status_code status, 1189*03f9172cSAndroid Build Coastguard Worker const u8 *dev, 1190*03f9172cSAndroid Build Coastguard Worker const u8 *adv_mac, const u8 *ses_mac, 1191*03f9172cSAndroid Build Coastguard Worker const u8 *grp_mac, u32 adv_id, u32 ses_id, 1192*03f9172cSAndroid Build Coastguard Worker u8 conncap, int passwd_id, 1193*03f9172cSAndroid Build Coastguard Worker const u8 *persist_ssid, 1194*03f9172cSAndroid Build Coastguard Worker size_t persist_ssid_size, int response_done, 1195*03f9172cSAndroid Build Coastguard Worker int prov_start, const char *session_info, 1196*03f9172cSAndroid Build Coastguard Worker const u8 *feat_cap, size_t feat_cap_len, 1197*03f9172cSAndroid Build Coastguard Worker unsigned int freq, const u8 *group_ssid, 1198*03f9172cSAndroid Build Coastguard Worker size_t group_ssid_len); 1199*03f9172cSAndroid Build Coastguard Worker 1200*03f9172cSAndroid Build Coastguard Worker /** 1201*03f9172cSAndroid Build Coastguard Worker * prov_disc_resp_cb - Callback for indicating completion of PD Response 1202*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1203*03f9172cSAndroid Build Coastguard Worker * Returns: 1 if operation was started, 0 otherwise 1204*03f9172cSAndroid Build Coastguard Worker * 1205*03f9172cSAndroid Build Coastguard Worker * This callback can be used to perform any pending actions after 1206*03f9172cSAndroid Build Coastguard Worker * provisioning. It is mainly used for P2PS pending group creation. 1207*03f9172cSAndroid Build Coastguard Worker */ 1208*03f9172cSAndroid Build Coastguard Worker int (*prov_disc_resp_cb)(void *ctx); 1209*03f9172cSAndroid Build Coastguard Worker 1210*03f9172cSAndroid Build Coastguard Worker /** 1211*03f9172cSAndroid Build Coastguard Worker * p2ps_group_capability - Determine group capability 1212*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1213*03f9172cSAndroid Build Coastguard Worker * @incoming: Peer requested roles, expressed with P2PS_SETUP_* bitmap. 1214*03f9172cSAndroid Build Coastguard Worker * @role: Local roles, expressed with P2PS_SETUP_* bitmap. 1215*03f9172cSAndroid Build Coastguard Worker * @force_freq: Variable for returning forced frequency for the group. 1216*03f9172cSAndroid Build Coastguard Worker * @pref_freq: Variable for returning preferred frequency for the group. 1217*03f9172cSAndroid Build Coastguard Worker * Returns: P2PS_SETUP_* bitmap of group capability result. 1218*03f9172cSAndroid Build Coastguard Worker * 1219*03f9172cSAndroid Build Coastguard Worker * This function can be used to determine group capability and 1220*03f9172cSAndroid Build Coastguard Worker * frequencies based on information from P2PS PD exchange and the 1221*03f9172cSAndroid Build Coastguard Worker * current state of ongoing groups and driver capabilities. 1222*03f9172cSAndroid Build Coastguard Worker */ 1223*03f9172cSAndroid Build Coastguard Worker u8 (*p2ps_group_capability)(void *ctx, u8 incoming, u8 role, 1224*03f9172cSAndroid Build Coastguard Worker unsigned int *force_freq, 1225*03f9172cSAndroid Build Coastguard Worker unsigned int *pref_freq); 1226*03f9172cSAndroid Build Coastguard Worker 1227*03f9172cSAndroid Build Coastguard Worker /** 1228*03f9172cSAndroid Build Coastguard Worker * get_pref_freq_list - Get preferred frequency list for an interface 1229*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1230*03f9172cSAndroid Build Coastguard Worker * @go: Whether the use if for GO role 1231*03f9172cSAndroid Build Coastguard Worker * @len: Length of freq_list in entries (both IN and OUT) 1232*03f9172cSAndroid Build Coastguard Worker * @freq_list: Buffer for returning the preferred frequencies (MHz) 1233*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1234*03f9172cSAndroid Build Coastguard Worker * 1235*03f9172cSAndroid Build Coastguard Worker * This function can be used to query the preferred frequency list from 1236*03f9172cSAndroid Build Coastguard Worker * the driver specific to a particular interface type. 1237*03f9172cSAndroid Build Coastguard Worker */ 1238*03f9172cSAndroid Build Coastguard Worker int (*get_pref_freq_list)(void *ctx, int go, 1239*03f9172cSAndroid Build Coastguard Worker unsigned int *len, 1240*03f9172cSAndroid Build Coastguard Worker struct weighted_pcl *freq_list); 1241*03f9172cSAndroid Build Coastguard Worker 1242*03f9172cSAndroid Build Coastguard Worker /** 1243*03f9172cSAndroid Build Coastguard Worker * register_bootstrap_comeback - Register timeout to initiate bootstrap 1244*03f9172cSAndroid Build Coastguard Worker * comeback request 1245*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1246*03f9172cSAndroid Build Coastguard Worker * @addr: P2P Device Address to which comeback request is to be sent 1247*03f9172cSAndroid Build Coastguard Worker * @comeback_after: Time in TUs after which comeback request is sent 1248*03f9172cSAndroid Build Coastguard Worker * 1249*03f9172cSAndroid Build Coastguard Worker * This function can be used to send comeback request after given 1250*03f9172cSAndroid Build Coastguard Worker * timeout. 1251*03f9172cSAndroid Build Coastguard Worker */ 1252*03f9172cSAndroid Build Coastguard Worker void (*register_bootstrap_comeback)(void *ctx, const u8 *addr, 1253*03f9172cSAndroid Build Coastguard Worker u16 comeback_after); 1254*03f9172cSAndroid Build Coastguard Worker 1255*03f9172cSAndroid Build Coastguard Worker /** 1256*03f9172cSAndroid Build Coastguard Worker * bootstrap_req_rx - Indicate bootstrap request from a P2P peer 1257*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1258*03f9172cSAndroid Build Coastguard Worker * @addr: P2P device address from which bootstrap request was received 1259*03f9172cSAndroid Build Coastguard Worker * @bootstrap_method: Bootstrapping method request by the peer device 1260*03f9172cSAndroid Build Coastguard Worker * 1261*03f9172cSAndroid Build Coastguard Worker * This function can be used to notify that bootstrap request is 1262*03f9172cSAndroid Build Coastguard Worker * received from a P2P peer. 1263*03f9172cSAndroid Build Coastguard Worker */ 1264*03f9172cSAndroid Build Coastguard Worker void (*bootstrap_req_rx)(void *ctx, const u8 *addr, 1265*03f9172cSAndroid Build Coastguard Worker u16 bootstrap_method); 1266*03f9172cSAndroid Build Coastguard Worker 1267*03f9172cSAndroid Build Coastguard Worker /** 1268*03f9172cSAndroid Build Coastguard Worker * bootstrap_completed - Indicate bootstrapping completed with P2P peer 1269*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1270*03f9172cSAndroid Build Coastguard Worker * @addr: P2P device address with which bootstrapping is completed 1271*03f9172cSAndroid Build Coastguard Worker * @status: P2P Status Code of bootstrapping handshake 1272*03f9172cSAndroid Build Coastguard Worker * @freq: Frequency in which bootstrapping is done 1273*03f9172cSAndroid Build Coastguard Worker * 1274*03f9172cSAndroid Build Coastguard Worker * This function can be used to notify the status of bootstrapping 1275*03f9172cSAndroid Build Coastguard Worker * handshake. 1276*03f9172cSAndroid Build Coastguard Worker */ 1277*03f9172cSAndroid Build Coastguard Worker void (*bootstrap_completed)(void *ctx, const u8 *addr, 1278*03f9172cSAndroid Build Coastguard Worker enum p2p_status_code status, int freq); 1279*03f9172cSAndroid Build Coastguard Worker }; 1280*03f9172cSAndroid Build Coastguard Worker 1281*03f9172cSAndroid Build Coastguard Worker 1282*03f9172cSAndroid Build Coastguard Worker /* P2P module initialization/deinitialization */ 1283*03f9172cSAndroid Build Coastguard Worker 1284*03f9172cSAndroid Build Coastguard Worker /** 1285*03f9172cSAndroid Build Coastguard Worker * p2p_init - Initialize P2P module 1286*03f9172cSAndroid Build Coastguard Worker * @cfg: P2P module configuration 1287*03f9172cSAndroid Build Coastguard Worker * Returns: Pointer to private data or %NULL on failure 1288*03f9172cSAndroid Build Coastguard Worker * 1289*03f9172cSAndroid Build Coastguard Worker * This function is used to initialize global P2P module context (one per 1290*03f9172cSAndroid Build Coastguard Worker * device). The P2P module will keep a copy of the configuration data, so the 1291*03f9172cSAndroid Build Coastguard Worker * caller does not need to maintain this structure. However, the callback 1292*03f9172cSAndroid Build Coastguard Worker * functions and the context parameters to them must be kept available until 1293*03f9172cSAndroid Build Coastguard Worker * the P2P module is deinitialized with p2p_deinit(). 1294*03f9172cSAndroid Build Coastguard Worker */ 1295*03f9172cSAndroid Build Coastguard Worker struct p2p_data * p2p_init(const struct p2p_config *cfg); 1296*03f9172cSAndroid Build Coastguard Worker 1297*03f9172cSAndroid Build Coastguard Worker /** 1298*03f9172cSAndroid Build Coastguard Worker * p2p_deinit - Deinitialize P2P module 1299*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1300*03f9172cSAndroid Build Coastguard Worker */ 1301*03f9172cSAndroid Build Coastguard Worker void p2p_deinit(struct p2p_data *p2p); 1302*03f9172cSAndroid Build Coastguard Worker 1303*03f9172cSAndroid Build Coastguard Worker /** 1304*03f9172cSAndroid Build Coastguard Worker * p2p_flush - Flush P2P module state 1305*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1306*03f9172cSAndroid Build Coastguard Worker * 1307*03f9172cSAndroid Build Coastguard Worker * This command removes the P2P module state like peer device entries. 1308*03f9172cSAndroid Build Coastguard Worker */ 1309*03f9172cSAndroid Build Coastguard Worker void p2p_flush(struct p2p_data *p2p); 1310*03f9172cSAndroid Build Coastguard Worker 1311*03f9172cSAndroid Build Coastguard Worker /** 1312*03f9172cSAndroid Build Coastguard Worker * p2p_unauthorize - Unauthorize the specified peer device 1313*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1314*03f9172cSAndroid Build Coastguard Worker * @addr: P2P peer entry to be unauthorized 1315*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1316*03f9172cSAndroid Build Coastguard Worker * 1317*03f9172cSAndroid Build Coastguard Worker * This command removes any connection authorization from the specified P2P 1318*03f9172cSAndroid Build Coastguard Worker * peer device address. This can be used, e.g., to cancel effect of a previous 1319*03f9172cSAndroid Build Coastguard Worker * p2p_authorize() or p2p_connect() call that has not yet resulted in completed 1320*03f9172cSAndroid Build Coastguard Worker * GO Negotiation. 1321*03f9172cSAndroid Build Coastguard Worker */ 1322*03f9172cSAndroid Build Coastguard Worker int p2p_unauthorize(struct p2p_data *p2p, const u8 *addr); 1323*03f9172cSAndroid Build Coastguard Worker 1324*03f9172cSAndroid Build Coastguard Worker /** 1325*03f9172cSAndroid Build Coastguard Worker * p2p_set_dev_name - Set device name 1326*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1327*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1328*03f9172cSAndroid Build Coastguard Worker * 1329*03f9172cSAndroid Build Coastguard Worker * This function can be used to update the P2P module configuration with 1330*03f9172cSAndroid Build Coastguard Worker * information that was not available at the time of the p2p_init() call. 1331*03f9172cSAndroid Build Coastguard Worker */ 1332*03f9172cSAndroid Build Coastguard Worker int p2p_set_dev_name(struct p2p_data *p2p, const char *dev_name); 1333*03f9172cSAndroid Build Coastguard Worker 1334*03f9172cSAndroid Build Coastguard Worker int p2p_set_manufacturer(struct p2p_data *p2p, const char *manufacturer); 1335*03f9172cSAndroid Build Coastguard Worker int p2p_set_model_name(struct p2p_data *p2p, const char *model_name); 1336*03f9172cSAndroid Build Coastguard Worker int p2p_set_model_number(struct p2p_data *p2p, const char *model_number); 1337*03f9172cSAndroid Build Coastguard Worker int p2p_set_serial_number(struct p2p_data *p2p, const char *serial_number); 1338*03f9172cSAndroid Build Coastguard Worker 1339*03f9172cSAndroid Build Coastguard Worker void p2p_set_config_methods(struct p2p_data *p2p, u16 config_methods); 1340*03f9172cSAndroid Build Coastguard Worker void p2p_set_uuid(struct p2p_data *p2p, const u8 *uuid); 1341*03f9172cSAndroid Build Coastguard Worker 1342*03f9172cSAndroid Build Coastguard Worker /** 1343*03f9172cSAndroid Build Coastguard Worker * p2p_set_pri_dev_type - Set primary device type 1344*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1345*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1346*03f9172cSAndroid Build Coastguard Worker * 1347*03f9172cSAndroid Build Coastguard Worker * This function can be used to update the P2P module configuration with 1348*03f9172cSAndroid Build Coastguard Worker * information that was not available at the time of the p2p_init() call. 1349*03f9172cSAndroid Build Coastguard Worker */ 1350*03f9172cSAndroid Build Coastguard Worker int p2p_set_pri_dev_type(struct p2p_data *p2p, const u8 *pri_dev_type); 1351*03f9172cSAndroid Build Coastguard Worker 1352*03f9172cSAndroid Build Coastguard Worker /** 1353*03f9172cSAndroid Build Coastguard Worker * p2p_set_sec_dev_types - Set secondary device types 1354*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1355*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1356*03f9172cSAndroid Build Coastguard Worker * 1357*03f9172cSAndroid Build Coastguard Worker * This function can be used to update the P2P module configuration with 1358*03f9172cSAndroid Build Coastguard Worker * information that was not available at the time of the p2p_init() call. 1359*03f9172cSAndroid Build Coastguard Worker */ 1360*03f9172cSAndroid Build Coastguard Worker int p2p_set_sec_dev_types(struct p2p_data *p2p, const u8 dev_types[][8], 1361*03f9172cSAndroid Build Coastguard Worker size_t num_dev_types); 1362*03f9172cSAndroid Build Coastguard Worker 1363*03f9172cSAndroid Build Coastguard Worker int p2p_set_country(struct p2p_data *p2p, const char *country); 1364*03f9172cSAndroid Build Coastguard Worker 1365*03f9172cSAndroid Build Coastguard Worker 1366*03f9172cSAndroid Build Coastguard Worker /* Commands from upper layer management entity */ 1367*03f9172cSAndroid Build Coastguard Worker 1368*03f9172cSAndroid Build Coastguard Worker enum p2p_discovery_type { 1369*03f9172cSAndroid Build Coastguard Worker P2P_FIND_START_WITH_FULL, 1370*03f9172cSAndroid Build Coastguard Worker P2P_FIND_ONLY_SOCIAL, 1371*03f9172cSAndroid Build Coastguard Worker P2P_FIND_PROGRESSIVE 1372*03f9172cSAndroid Build Coastguard Worker }; 1373*03f9172cSAndroid Build Coastguard Worker 1374*03f9172cSAndroid Build Coastguard Worker /** 1375*03f9172cSAndroid Build Coastguard Worker * p2p_find - Start P2P Find (Device Discovery) 1376*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1377*03f9172cSAndroid Build Coastguard Worker * @timeout: Timeout for find operation in seconds or 0 for no timeout 1378*03f9172cSAndroid Build Coastguard Worker * @type: Device Discovery type 1379*03f9172cSAndroid Build Coastguard Worker * @num_req_dev_types: Number of requested device types 1380*03f9172cSAndroid Build Coastguard Worker * @req_dev_types: Requested device types array, must be an array 1381*03f9172cSAndroid Build Coastguard Worker * containing num_req_dev_types * WPS_DEV_TYPE_LEN bytes; %NULL if no 1382*03f9172cSAndroid Build Coastguard Worker * requested device types. 1383*03f9172cSAndroid Build Coastguard Worker * @dev_id: Device ID to search for or %NULL to find all devices 1384*03f9172cSAndroid Build Coastguard Worker * @search_delay: Extra delay in milliseconds between search iterations 1385*03f9172cSAndroid Build Coastguard Worker * @seek_count: Number of ASP Service Strings in the seek_string array 1386*03f9172cSAndroid Build Coastguard Worker * @seek_string: ASP Service Strings to query for in Probe Requests 1387*03f9172cSAndroid Build Coastguard Worker * @freq: Requested first scan frequency (in MHz) to modify type == 1388*03f9172cSAndroid Build Coastguard Worker * P2P_FIND_START_WITH_FULL behavior. 0 = Use normal full scan. 1389*03f9172cSAndroid Build Coastguard Worker * If p2p_find is already in progress, this parameter is ignored and full 1390*03f9172cSAndroid Build Coastguard Worker * scan will be executed. 1391*03f9172cSAndroid Build Coastguard Worker * @include_6ghz: Include 6 GHz channels in P2P find 1392*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1393*03f9172cSAndroid Build Coastguard Worker */ 1394*03f9172cSAndroid Build Coastguard Worker int p2p_find(struct p2p_data *p2p, unsigned int timeout, 1395*03f9172cSAndroid Build Coastguard Worker enum p2p_discovery_type type, 1396*03f9172cSAndroid Build Coastguard Worker unsigned int num_req_dev_types, const u8 *req_dev_types, 1397*03f9172cSAndroid Build Coastguard Worker const u8 *dev_id, unsigned int search_delay, 1398*03f9172cSAndroid Build Coastguard Worker u8 seek_count, const char **seek_string, int freq, 1399*03f9172cSAndroid Build Coastguard Worker bool include_6ghz); 1400*03f9172cSAndroid Build Coastguard Worker 1401*03f9172cSAndroid Build Coastguard Worker /** 1402*03f9172cSAndroid Build Coastguard Worker * p2p_notify_scan_trigger_status - Indicate scan trigger status 1403*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1404*03f9172cSAndroid Build Coastguard Worker * @status: 0 on success, -1 on failure 1405*03f9172cSAndroid Build Coastguard Worker */ 1406*03f9172cSAndroid Build Coastguard Worker void p2p_notify_scan_trigger_status(struct p2p_data *p2p, int status); 1407*03f9172cSAndroid Build Coastguard Worker 1408*03f9172cSAndroid Build Coastguard Worker /** 1409*03f9172cSAndroid Build Coastguard Worker * p2p_stop_find - Stop P2P Find (Device Discovery) 1410*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1411*03f9172cSAndroid Build Coastguard Worker */ 1412*03f9172cSAndroid Build Coastguard Worker void p2p_stop_find(struct p2p_data *p2p); 1413*03f9172cSAndroid Build Coastguard Worker 1414*03f9172cSAndroid Build Coastguard Worker /** 1415*03f9172cSAndroid Build Coastguard Worker * p2p_stop_find_for_freq - Stop P2P Find for next oper on specific freq 1416*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1417*03f9172cSAndroid Build Coastguard Worker * @freq: Frequency in MHz for next operation 1418*03f9172cSAndroid Build Coastguard Worker * 1419*03f9172cSAndroid Build Coastguard Worker * This is like p2p_stop_find(), but Listen state is not stopped if we are 1420*03f9172cSAndroid Build Coastguard Worker * already on the same frequency. 1421*03f9172cSAndroid Build Coastguard Worker */ 1422*03f9172cSAndroid Build Coastguard Worker void p2p_stop_find_for_freq(struct p2p_data *p2p, int freq); 1423*03f9172cSAndroid Build Coastguard Worker 1424*03f9172cSAndroid Build Coastguard Worker /** 1425*03f9172cSAndroid Build Coastguard Worker * p2p_listen - Start P2P Listen state for specified duration 1426*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1427*03f9172cSAndroid Build Coastguard Worker * @timeout: Listen state duration in milliseconds 1428*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1429*03f9172cSAndroid Build Coastguard Worker * 1430*03f9172cSAndroid Build Coastguard Worker * This function can be used to request the P2P module to keep the device 1431*03f9172cSAndroid Build Coastguard Worker * discoverable on the listen channel for an extended set of time. At least in 1432*03f9172cSAndroid Build Coastguard Worker * its current form, this is mainly used for testing purposes and may not be of 1433*03f9172cSAndroid Build Coastguard Worker * much use for normal P2P operations. 1434*03f9172cSAndroid Build Coastguard Worker */ 1435*03f9172cSAndroid Build Coastguard Worker int p2p_listen(struct p2p_data *p2p, unsigned int timeout); 1436*03f9172cSAndroid Build Coastguard Worker 1437*03f9172cSAndroid Build Coastguard Worker /** 1438*03f9172cSAndroid Build Coastguard Worker * p2p_stop_listen - Stop P2P Listen 1439*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1440*03f9172cSAndroid Build Coastguard Worker */ 1441*03f9172cSAndroid Build Coastguard Worker void p2p_stop_listen(struct p2p_data *p2p); 1442*03f9172cSAndroid Build Coastguard Worker 1443*03f9172cSAndroid Build Coastguard Worker /** 1444*03f9172cSAndroid Build Coastguard Worker * p2p_connect - Start P2P group formation (GO negotiation) 1445*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1446*03f9172cSAndroid Build Coastguard Worker * @peer_addr: MAC address of the peer P2P client 1447*03f9172cSAndroid Build Coastguard Worker * @wps_method: WPS method to be used in provisioning 1448*03f9172cSAndroid Build Coastguard Worker * @go_intent: Local GO intent value (1..15) 1449*03f9172cSAndroid Build Coastguard Worker * @own_interface_addr: Intended interface address to use with the group 1450*03f9172cSAndroid Build Coastguard Worker * @force_freq: The only allowed channel frequency in MHz or 0 1451*03f9172cSAndroid Build Coastguard Worker * @persistent_group: Whether to create a persistent group (0 = no, 1 = 1452*03f9172cSAndroid Build Coastguard Worker * persistent group without persistent reconnect, 2 = persistent group with 1453*03f9172cSAndroid Build Coastguard Worker * persistent reconnect) 1454*03f9172cSAndroid Build Coastguard Worker * @force_ssid: Forced SSID for the group if we become GO or %NULL to generate 1455*03f9172cSAndroid Build Coastguard Worker * a new SSID 1456*03f9172cSAndroid Build Coastguard Worker * @force_ssid_len: Length of $force_ssid buffer 1457*03f9172cSAndroid Build Coastguard Worker * @pd_before_go_neg: Whether to send Provision Discovery prior to GO 1458*03f9172cSAndroid Build Coastguard Worker * Negotiation as an interoperability workaround when initiating group 1459*03f9172cSAndroid Build Coastguard Worker * formation 1460*03f9172cSAndroid Build Coastguard Worker * @pref_freq: Preferred operating frequency in MHz or 0 (this is only used if 1461*03f9172cSAndroid Build Coastguard Worker * force_freq == 0) 1462*03f9172cSAndroid Build Coastguard Worker * @oob_pw_id: OOB password identifier 1463*03f9172cSAndroid Build Coastguard Worker * @p2p2: Device supports P2P2 features 1464*03f9172cSAndroid Build Coastguard Worker * @bootstrap: Bootstrapping method requested for P2P2 provision discovery 1465*03f9172cSAndroid Build Coastguard Worker * @password: P2P2 pairing password or %NULL for opportunistic method 1466*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1467*03f9172cSAndroid Build Coastguard Worker */ 1468*03f9172cSAndroid Build Coastguard Worker int p2p_connect(struct p2p_data *p2p, const u8 *peer_addr, 1469*03f9172cSAndroid Build Coastguard Worker enum p2p_wps_method wps_method, 1470*03f9172cSAndroid Build Coastguard Worker int go_intent, const u8 *own_interface_addr, 1471*03f9172cSAndroid Build Coastguard Worker unsigned int force_freq, int persistent_group, 1472*03f9172cSAndroid Build Coastguard Worker const u8 *force_ssid, size_t force_ssid_len, 1473*03f9172cSAndroid Build Coastguard Worker int pd_before_go_neg, unsigned int pref_freq, u16 oob_pw_id, 1474*03f9172cSAndroid Build Coastguard Worker bool p2p2, u16 bootstrap, const char *password); 1475*03f9172cSAndroid Build Coastguard Worker 1476*03f9172cSAndroid Build Coastguard Worker /** 1477*03f9172cSAndroid Build Coastguard Worker * p2p_authorize - Authorize P2P group formation (GO negotiation) 1478*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1479*03f9172cSAndroid Build Coastguard Worker * @peer_addr: MAC address of the peer P2P client 1480*03f9172cSAndroid Build Coastguard Worker * @wps_method: WPS method to be used in provisioning 1481*03f9172cSAndroid Build Coastguard Worker * @go_intent: Local GO intent value (1..15) 1482*03f9172cSAndroid Build Coastguard Worker * @own_interface_addr: Intended interface address to use with the group 1483*03f9172cSAndroid Build Coastguard Worker * @force_freq: The only allowed channel frequency in MHz or 0 1484*03f9172cSAndroid Build Coastguard Worker * @persistent_group: Whether to create a persistent group (0 = no, 1 = 1485*03f9172cSAndroid Build Coastguard Worker * persistent group without persistent reconnect, 2 = persistent group with 1486*03f9172cSAndroid Build Coastguard Worker * persistent reconnect) 1487*03f9172cSAndroid Build Coastguard Worker * @force_ssid: Forced SSID for the group if we become GO or %NULL to generate 1488*03f9172cSAndroid Build Coastguard Worker * a new SSID 1489*03f9172cSAndroid Build Coastguard Worker * @force_ssid_len: Length of $force_ssid buffer 1490*03f9172cSAndroid Build Coastguard Worker * @pref_freq: Preferred operating frequency in MHz or 0 (this is only used if 1491*03f9172cSAndroid Build Coastguard Worker * force_freq == 0) 1492*03f9172cSAndroid Build Coastguard Worker * @oob_pw_id: OOB password identifier 1493*03f9172cSAndroid Build Coastguard Worker * @bootstrap: Bootstrapping method requested for P2P2 provision discovery 1494*03f9172cSAndroid Build Coastguard Worker * @password: P2P2 pairing password or %NULL for opportunistic method 1495*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1496*03f9172cSAndroid Build Coastguard Worker * 1497*03f9172cSAndroid Build Coastguard Worker * This is like p2p_connect(), but the actual group negotiation is not 1498*03f9172cSAndroid Build Coastguard Worker * initiated automatically, i.e., the other end is expected to do that. 1499*03f9172cSAndroid Build Coastguard Worker */ 1500*03f9172cSAndroid Build Coastguard Worker int p2p_authorize(struct p2p_data *p2p, const u8 *peer_addr, 1501*03f9172cSAndroid Build Coastguard Worker enum p2p_wps_method wps_method, 1502*03f9172cSAndroid Build Coastguard Worker int go_intent, const u8 *own_interface_addr, 1503*03f9172cSAndroid Build Coastguard Worker unsigned int force_freq, int persistent_group, 1504*03f9172cSAndroid Build Coastguard Worker const u8 *force_ssid, size_t force_ssid_len, 1505*03f9172cSAndroid Build Coastguard Worker unsigned int pref_freq, u16 oob_pw_id, u16 bootstrap, 1506*03f9172cSAndroid Build Coastguard Worker const char *password); 1507*03f9172cSAndroid Build Coastguard Worker 1508*03f9172cSAndroid Build Coastguard Worker /** 1509*03f9172cSAndroid Build Coastguard Worker * p2p_reject - Reject peer device (explicitly block connection attempts) 1510*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1511*03f9172cSAndroid Build Coastguard Worker * @peer_addr: MAC address of the peer P2P client 1512*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1513*03f9172cSAndroid Build Coastguard Worker */ 1514*03f9172cSAndroid Build Coastguard Worker int p2p_reject(struct p2p_data *p2p, const u8 *peer_addr); 1515*03f9172cSAndroid Build Coastguard Worker 1516*03f9172cSAndroid Build Coastguard Worker /** 1517*03f9172cSAndroid Build Coastguard Worker * p2p_prov_disc_req - Send Provision Discovery Request 1518*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1519*03f9172cSAndroid Build Coastguard Worker * @peer_addr: MAC address of the peer P2P client 1520*03f9172cSAndroid Build Coastguard Worker * @p2ps_prov: Provisioning info for P2PS 1521*03f9172cSAndroid Build Coastguard Worker * @config_methods: WPS Config Methods value (only one bit set) 1522*03f9172cSAndroid Build Coastguard Worker * @join: Whether this is used by a client joining an active group 1523*03f9172cSAndroid Build Coastguard Worker * @force_freq: Forced TX frequency for the frame (mainly for the join case) 1524*03f9172cSAndroid Build Coastguard Worker * @user_initiated_pd: Flag to indicate if initiated by user or not 1525*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1526*03f9172cSAndroid Build Coastguard Worker * 1527*03f9172cSAndroid Build Coastguard Worker * This function can be used to request a discovered P2P peer to display a PIN 1528*03f9172cSAndroid Build Coastguard Worker * (config_methods = WPS_CONFIG_DISPLAY) or be prepared to enter a PIN from us 1529*03f9172cSAndroid Build Coastguard Worker * (config_methods = WPS_CONFIG_KEYPAD). The Provision Discovery Request frame 1530*03f9172cSAndroid Build Coastguard Worker * is transmitted once immediately and if no response is received, the frame 1531*03f9172cSAndroid Build Coastguard Worker * will be sent again whenever the target device is discovered during device 1532*03f9172cSAndroid Build Coastguard Worker * dsicovery (start with a p2p_find() call). Response from the peer is 1533*03f9172cSAndroid Build Coastguard Worker * indicated with the p2p_config::prov_disc_resp() callback. 1534*03f9172cSAndroid Build Coastguard Worker */ 1535*03f9172cSAndroid Build Coastguard Worker int p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr, 1536*03f9172cSAndroid Build Coastguard Worker struct p2ps_provision *p2ps_prov, u16 config_methods, 1537*03f9172cSAndroid Build Coastguard Worker int join, int force_freq, 1538*03f9172cSAndroid Build Coastguard Worker int user_initiated_pd); 1539*03f9172cSAndroid Build Coastguard Worker 1540*03f9172cSAndroid Build Coastguard Worker /** 1541*03f9172cSAndroid Build Coastguard Worker * p2p_sd_request - Schedule a service discovery query 1542*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1543*03f9172cSAndroid Build Coastguard Worker * @dst: Destination peer or %NULL to apply for all peers 1544*03f9172cSAndroid Build Coastguard Worker * @tlvs: P2P Service Query TLV(s) 1545*03f9172cSAndroid Build Coastguard Worker * Returns: Reference to the query or %NULL on failure 1546*03f9172cSAndroid Build Coastguard Worker * 1547*03f9172cSAndroid Build Coastguard Worker * Response to the query is indicated with the p2p_config::sd_response() 1548*03f9172cSAndroid Build Coastguard Worker * callback. 1549*03f9172cSAndroid Build Coastguard Worker */ 1550*03f9172cSAndroid Build Coastguard Worker void * p2p_sd_request(struct p2p_data *p2p, const u8 *dst, 1551*03f9172cSAndroid Build Coastguard Worker const struct wpabuf *tlvs); 1552*03f9172cSAndroid Build Coastguard Worker 1553*03f9172cSAndroid Build Coastguard Worker #ifdef CONFIG_WIFI_DISPLAY 1554*03f9172cSAndroid Build Coastguard Worker void * p2p_sd_request_wfd(struct p2p_data *p2p, const u8 *dst, 1555*03f9172cSAndroid Build Coastguard Worker const struct wpabuf *tlvs); 1556*03f9172cSAndroid Build Coastguard Worker #endif /* CONFIG_WIFI_DISPLAY */ 1557*03f9172cSAndroid Build Coastguard Worker 1558*03f9172cSAndroid Build Coastguard Worker /** 1559*03f9172cSAndroid Build Coastguard Worker * p2p_sd_cancel_request - Cancel a pending service discovery query 1560*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1561*03f9172cSAndroid Build Coastguard Worker * @req: Query reference from p2p_sd_request() 1562*03f9172cSAndroid Build Coastguard Worker * Returns: 0 if request for cancelled; -1 if not found 1563*03f9172cSAndroid Build Coastguard Worker */ 1564*03f9172cSAndroid Build Coastguard Worker int p2p_sd_cancel_request(struct p2p_data *p2p, void *req); 1565*03f9172cSAndroid Build Coastguard Worker 1566*03f9172cSAndroid Build Coastguard Worker /** 1567*03f9172cSAndroid Build Coastguard Worker * p2p_sd_response - Send response to a service discovery query 1568*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1569*03f9172cSAndroid Build Coastguard Worker * @freq: Frequency from p2p_config::sd_request() callback 1570*03f9172cSAndroid Build Coastguard Worker * @dst: Destination address from p2p_config::sd_request() callback 1571*03f9172cSAndroid Build Coastguard Worker * @dialog_token: Dialog token from p2p_config::sd_request() callback 1572*03f9172cSAndroid Build Coastguard Worker * @resp_tlvs: P2P Service Response TLV(s) 1573*03f9172cSAndroid Build Coastguard Worker * 1574*03f9172cSAndroid Build Coastguard Worker * This function is called as a response to the request indicated with 1575*03f9172cSAndroid Build Coastguard Worker * p2p_config::sd_request() callback. 1576*03f9172cSAndroid Build Coastguard Worker */ 1577*03f9172cSAndroid Build Coastguard Worker void p2p_sd_response(struct p2p_data *p2p, int freq, const u8 *dst, 1578*03f9172cSAndroid Build Coastguard Worker u8 dialog_token, const struct wpabuf *resp_tlvs); 1579*03f9172cSAndroid Build Coastguard Worker 1580*03f9172cSAndroid Build Coastguard Worker /** 1581*03f9172cSAndroid Build Coastguard Worker * p2p_sd_service_update - Indicate a change in local services 1582*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1583*03f9172cSAndroid Build Coastguard Worker * 1584*03f9172cSAndroid Build Coastguard Worker * This function needs to be called whenever there is a change in availability 1585*03f9172cSAndroid Build Coastguard Worker * of the local services. This will increment the Service Update Indicator 1586*03f9172cSAndroid Build Coastguard Worker * value which will be used in SD Request and Response frames. 1587*03f9172cSAndroid Build Coastguard Worker */ 1588*03f9172cSAndroid Build Coastguard Worker void p2p_sd_service_update(struct p2p_data *p2p); 1589*03f9172cSAndroid Build Coastguard Worker 1590*03f9172cSAndroid Build Coastguard Worker 1591*03f9172cSAndroid Build Coastguard Worker enum p2p_invite_role { 1592*03f9172cSAndroid Build Coastguard Worker P2P_INVITE_ROLE_GO, 1593*03f9172cSAndroid Build Coastguard Worker P2P_INVITE_ROLE_ACTIVE_GO, 1594*03f9172cSAndroid Build Coastguard Worker P2P_INVITE_ROLE_CLIENT 1595*03f9172cSAndroid Build Coastguard Worker }; 1596*03f9172cSAndroid Build Coastguard Worker 1597*03f9172cSAndroid Build Coastguard Worker /** 1598*03f9172cSAndroid Build Coastguard Worker * p2p_invite - Invite a P2P Device into a group 1599*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1600*03f9172cSAndroid Build Coastguard Worker * @peer: Device Address of the peer P2P Device 1601*03f9172cSAndroid Build Coastguard Worker * @role: Local role in the group 1602*03f9172cSAndroid Build Coastguard Worker * @bssid: Group BSSID or %NULL if not known 1603*03f9172cSAndroid Build Coastguard Worker * @ssid: Group SSID 1604*03f9172cSAndroid Build Coastguard Worker * @ssid_len: Length of ssid in octets 1605*03f9172cSAndroid Build Coastguard Worker * @force_freq: The only allowed channel frequency in MHz or 0 1606*03f9172cSAndroid Build Coastguard Worker * @go_dev_addr: Forced GO Device Address or %NULL if none 1607*03f9172cSAndroid Build Coastguard Worker * @persistent_group: Whether this is to reinvoke a persistent group 1608*03f9172cSAndroid Build Coastguard Worker * @pref_freq: Preferred operating frequency in MHz or 0 (this is only used if 1609*03f9172cSAndroid Build Coastguard Worker * force_freq == 0) 1610*03f9172cSAndroid Build Coastguard Worker * @dev_pw_id: Device Password ID from OOB Device Password (NFC) static handover 1611*03f9172cSAndroid Build Coastguard Worker * case or -1 if not used 1612*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1613*03f9172cSAndroid Build Coastguard Worker */ 1614*03f9172cSAndroid Build Coastguard Worker int p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role, 1615*03f9172cSAndroid Build Coastguard Worker const u8 *bssid, const u8 *ssid, size_t ssid_len, 1616*03f9172cSAndroid Build Coastguard Worker unsigned int force_freq, const u8 *go_dev_addr, 1617*03f9172cSAndroid Build Coastguard Worker int persistent_group, unsigned int pref_freq, int dev_pw_id); 1618*03f9172cSAndroid Build Coastguard Worker 1619*03f9172cSAndroid Build Coastguard Worker /** 1620*03f9172cSAndroid Build Coastguard Worker * p2p_presence_req - Request GO presence 1621*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1622*03f9172cSAndroid Build Coastguard Worker * @go_interface_addr: GO P2P Interface Address 1623*03f9172cSAndroid Build Coastguard Worker * @own_interface_addr: Own P2P Interface Address for this group 1624*03f9172cSAndroid Build Coastguard Worker * @freq: Group operating frequence (in MHz) 1625*03f9172cSAndroid Build Coastguard Worker * @duration1: Preferred presence duration in microseconds 1626*03f9172cSAndroid Build Coastguard Worker * @interval1: Preferred presence interval in microseconds 1627*03f9172cSAndroid Build Coastguard Worker * @duration2: Acceptable presence duration in microseconds 1628*03f9172cSAndroid Build Coastguard Worker * @interval2: Acceptable presence interval in microseconds 1629*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1630*03f9172cSAndroid Build Coastguard Worker * 1631*03f9172cSAndroid Build Coastguard Worker * If both duration and interval values are zero, the parameter pair is not 1632*03f9172cSAndroid Build Coastguard Worker * specified (i.e., to remove Presence Request, use duration1 = interval1 = 0). 1633*03f9172cSAndroid Build Coastguard Worker */ 1634*03f9172cSAndroid Build Coastguard Worker int p2p_presence_req(struct p2p_data *p2p, const u8 *go_interface_addr, 1635*03f9172cSAndroid Build Coastguard Worker const u8 *own_interface_addr, unsigned int freq, 1636*03f9172cSAndroid Build Coastguard Worker u32 duration1, u32 interval1, u32 duration2, 1637*03f9172cSAndroid Build Coastguard Worker u32 interval2); 1638*03f9172cSAndroid Build Coastguard Worker 1639*03f9172cSAndroid Build Coastguard Worker /** 1640*03f9172cSAndroid Build Coastguard Worker * p2p_ext_listen - Set Extended Listen Timing 1641*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1642*03f9172cSAndroid Build Coastguard Worker * @freq: Group operating frequence (in MHz) 1643*03f9172cSAndroid Build Coastguard Worker * @period: Availability period in milliseconds (1-65535; 0 to disable) 1644*03f9172cSAndroid Build Coastguard Worker * @interval: Availability interval in milliseconds (1-65535; 0 to disable) 1645*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1646*03f9172cSAndroid Build Coastguard Worker * 1647*03f9172cSAndroid Build Coastguard Worker * This function can be used to enable or disable (period = interval = 0) 1648*03f9172cSAndroid Build Coastguard Worker * Extended Listen Timing. When enabled, the P2P Device will become 1649*03f9172cSAndroid Build Coastguard Worker * discoverable (go into Listen State) every @interval milliseconds for at 1650*03f9172cSAndroid Build Coastguard Worker * least @period milliseconds. 1651*03f9172cSAndroid Build Coastguard Worker */ 1652*03f9172cSAndroid Build Coastguard Worker int p2p_ext_listen(struct p2p_data *p2p, unsigned int period, 1653*03f9172cSAndroid Build Coastguard Worker unsigned int interval); 1654*03f9172cSAndroid Build Coastguard Worker 1655*03f9172cSAndroid Build Coastguard Worker /* Event notifications from upper layer management operations */ 1656*03f9172cSAndroid Build Coastguard Worker 1657*03f9172cSAndroid Build Coastguard Worker /** 1658*03f9172cSAndroid Build Coastguard Worker * p2p_wps_success_cb - Report successfully completed WPS provisioning 1659*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1660*03f9172cSAndroid Build Coastguard Worker * @mac_addr: Peer address 1661*03f9172cSAndroid Build Coastguard Worker * 1662*03f9172cSAndroid Build Coastguard Worker * This function is used to report successfully completed WPS provisioning 1663*03f9172cSAndroid Build Coastguard Worker * during group formation in both GO/Registrar and client/Enrollee roles. 1664*03f9172cSAndroid Build Coastguard Worker */ 1665*03f9172cSAndroid Build Coastguard Worker void p2p_wps_success_cb(struct p2p_data *p2p, const u8 *mac_addr); 1666*03f9172cSAndroid Build Coastguard Worker 1667*03f9172cSAndroid Build Coastguard Worker /** 1668*03f9172cSAndroid Build Coastguard Worker * p2p_group_formation_failed - Report failed WPS provisioning 1669*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1670*03f9172cSAndroid Build Coastguard Worker * 1671*03f9172cSAndroid Build Coastguard Worker * This function is used to report failed group formation. This can happen 1672*03f9172cSAndroid Build Coastguard Worker * either due to failed WPS provisioning or due to 15 second timeout during 1673*03f9172cSAndroid Build Coastguard Worker * the provisioning phase. 1674*03f9172cSAndroid Build Coastguard Worker */ 1675*03f9172cSAndroid Build Coastguard Worker void p2p_group_formation_failed(struct p2p_data *p2p); 1676*03f9172cSAndroid Build Coastguard Worker 1677*03f9172cSAndroid Build Coastguard Worker /** 1678*03f9172cSAndroid Build Coastguard Worker * p2p_get_provisioning_info - Get any stored provisioning info 1679*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1680*03f9172cSAndroid Build Coastguard Worker * @addr: Peer P2P Device Address 1681*03f9172cSAndroid Build Coastguard Worker * Returns: WPS provisioning information (WPS config method) or 0 if no 1682*03f9172cSAndroid Build Coastguard Worker * information is available 1683*03f9172cSAndroid Build Coastguard Worker * 1684*03f9172cSAndroid Build Coastguard Worker * This function is used to retrieve stored WPS provisioning info for the given 1685*03f9172cSAndroid Build Coastguard Worker * peer. 1686*03f9172cSAndroid Build Coastguard Worker */ 1687*03f9172cSAndroid Build Coastguard Worker u16 p2p_get_provisioning_info(struct p2p_data *p2p, const u8 *addr); 1688*03f9172cSAndroid Build Coastguard Worker 1689*03f9172cSAndroid Build Coastguard Worker /** 1690*03f9172cSAndroid Build Coastguard Worker * p2p_clear_provisioning_info - Clear any stored provisioning info 1691*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1692*03f9172cSAndroid Build Coastguard Worker * @iface_addr: Peer P2P Device Address 1693*03f9172cSAndroid Build Coastguard Worker * 1694*03f9172cSAndroid Build Coastguard Worker * This function is used to clear stored WPS provisioning info for the given 1695*03f9172cSAndroid Build Coastguard Worker * peer. 1696*03f9172cSAndroid Build Coastguard Worker */ 1697*03f9172cSAndroid Build Coastguard Worker void p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *addr); 1698*03f9172cSAndroid Build Coastguard Worker 1699*03f9172cSAndroid Build Coastguard Worker 1700*03f9172cSAndroid Build Coastguard Worker /* Event notifications from lower layer driver operations */ 1701*03f9172cSAndroid Build Coastguard Worker 1702*03f9172cSAndroid Build Coastguard Worker /** 1703*03f9172cSAndroid Build Coastguard Worker * enum p2p_probe_req_status 1704*03f9172cSAndroid Build Coastguard Worker * 1705*03f9172cSAndroid Build Coastguard Worker * @P2P_PREQ_MALFORMED: frame was not well-formed 1706*03f9172cSAndroid Build Coastguard Worker * @P2P_PREQ_NOT_LISTEN: device isn't in listen state, frame ignored 1707*03f9172cSAndroid Build Coastguard Worker * @P2P_PREQ_NOT_P2P: frame was not a P2P probe request 1708*03f9172cSAndroid Build Coastguard Worker * @P2P_PREQ_P2P_NOT_PROCESSED: frame was P2P but wasn't processed 1709*03f9172cSAndroid Build Coastguard Worker * @P2P_PREQ_P2P_PROCESSED: frame has been processed by P2P 1710*03f9172cSAndroid Build Coastguard Worker */ 1711*03f9172cSAndroid Build Coastguard Worker enum p2p_probe_req_status { 1712*03f9172cSAndroid Build Coastguard Worker P2P_PREQ_MALFORMED, 1713*03f9172cSAndroid Build Coastguard Worker P2P_PREQ_NOT_LISTEN, 1714*03f9172cSAndroid Build Coastguard Worker P2P_PREQ_NOT_P2P, 1715*03f9172cSAndroid Build Coastguard Worker P2P_PREQ_NOT_PROCESSED, 1716*03f9172cSAndroid Build Coastguard Worker P2P_PREQ_PROCESSED 1717*03f9172cSAndroid Build Coastguard Worker }; 1718*03f9172cSAndroid Build Coastguard Worker 1719*03f9172cSAndroid Build Coastguard Worker /** 1720*03f9172cSAndroid Build Coastguard Worker * p2p_probe_req_rx - Report reception of a Probe Request frame 1721*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1722*03f9172cSAndroid Build Coastguard Worker * @addr: Source MAC address 1723*03f9172cSAndroid Build Coastguard Worker * @dst: Destination MAC address if available or %NULL 1724*03f9172cSAndroid Build Coastguard Worker * @bssid: BSSID if available or %NULL 1725*03f9172cSAndroid Build Coastguard Worker * @ie: Information elements from the Probe Request frame body 1726*03f9172cSAndroid Build Coastguard Worker * @ie_len: Length of ie buffer in octets 1727*03f9172cSAndroid Build Coastguard Worker * @rx_freq: Probe Request frame RX frequency 1728*03f9172cSAndroid Build Coastguard Worker * @p2p_lo_started: Whether P2P Listen Offload is started 1729*03f9172cSAndroid Build Coastguard Worker * Returns: value indicating the type and status of the probe request 1730*03f9172cSAndroid Build Coastguard Worker */ 1731*03f9172cSAndroid Build Coastguard Worker enum p2p_probe_req_status 1732*03f9172cSAndroid Build Coastguard Worker p2p_probe_req_rx(struct p2p_data *p2p, const u8 *addr, const u8 *dst, 1733*03f9172cSAndroid Build Coastguard Worker const u8 *bssid, const u8 *ie, size_t ie_len, 1734*03f9172cSAndroid Build Coastguard Worker unsigned int rx_freq, int p2p_lo_started); 1735*03f9172cSAndroid Build Coastguard Worker 1736*03f9172cSAndroid Build Coastguard Worker /** 1737*03f9172cSAndroid Build Coastguard Worker * p2p_rx_action - Report received Action frame 1738*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1739*03f9172cSAndroid Build Coastguard Worker * @da: Destination address of the received Action frame 1740*03f9172cSAndroid Build Coastguard Worker * @sa: Source address of the received Action frame 1741*03f9172cSAndroid Build Coastguard Worker * @bssid: Address 3 of the received Action frame 1742*03f9172cSAndroid Build Coastguard Worker * @category: Category of the received Action frame 1743*03f9172cSAndroid Build Coastguard Worker * @data: Action frame body after the Category field 1744*03f9172cSAndroid Build Coastguard Worker * @len: Length of the data buffer in octets 1745*03f9172cSAndroid Build Coastguard Worker * @freq: Frequency (in MHz) on which the frame was received 1746*03f9172cSAndroid Build Coastguard Worker */ 1747*03f9172cSAndroid Build Coastguard Worker void p2p_rx_action(struct p2p_data *p2p, const u8 *da, const u8 *sa, 1748*03f9172cSAndroid Build Coastguard Worker const u8 *bssid, u8 category, 1749*03f9172cSAndroid Build Coastguard Worker const u8 *data, size_t len, int freq); 1750*03f9172cSAndroid Build Coastguard Worker 1751*03f9172cSAndroid Build Coastguard Worker /** 1752*03f9172cSAndroid Build Coastguard Worker * p2p_scan_res_handler - Indicate a P2P scan results 1753*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1754*03f9172cSAndroid Build Coastguard Worker * @bssid: BSSID of the scan result 1755*03f9172cSAndroid Build Coastguard Worker * @freq: Frequency of the channel on which the device was found in MHz 1756*03f9172cSAndroid Build Coastguard Worker * @rx_time: Time when the result was received 1757*03f9172cSAndroid Build Coastguard Worker * @level: Signal level (signal strength of the received Beacon/Probe Response 1758*03f9172cSAndroid Build Coastguard Worker * frame) 1759*03f9172cSAndroid Build Coastguard Worker * @ies: Pointer to IEs from the scan result 1760*03f9172cSAndroid Build Coastguard Worker * @ies_len: Length of the ies buffer 1761*03f9172cSAndroid Build Coastguard Worker * Returns: 0 to continue or 1 to stop scan result indication 1762*03f9172cSAndroid Build Coastguard Worker * 1763*03f9172cSAndroid Build Coastguard Worker * This function is called to indicate a scan result entry with P2P IE from a 1764*03f9172cSAndroid Build Coastguard Worker * scan requested with struct p2p_config::p2p_scan(). This can be called during 1765*03f9172cSAndroid Build Coastguard Worker * the actual scan process (i.e., whenever a new device is found) or as a 1766*03f9172cSAndroid Build Coastguard Worker * sequence of calls after the full scan has been completed. The former option 1767*03f9172cSAndroid Build Coastguard Worker * can result in optimized operations, but may not be supported by all 1768*03f9172cSAndroid Build Coastguard Worker * driver/firmware designs. The ies buffer need to include at least the P2P IE, 1769*03f9172cSAndroid Build Coastguard Worker * but it is recommended to include all IEs received from the device. The 1770*03f9172cSAndroid Build Coastguard Worker * caller does not need to check that the IEs contain a P2P IE before calling 1771*03f9172cSAndroid Build Coastguard Worker * this function since frames will be filtered internally if needed. 1772*03f9172cSAndroid Build Coastguard Worker * 1773*03f9172cSAndroid Build Coastguard Worker * This function will return 1 if it wants to stop scan result iteration (and 1774*03f9172cSAndroid Build Coastguard Worker * scan in general if it is still in progress). This is used to allow faster 1775*03f9172cSAndroid Build Coastguard Worker * start of a pending operation, e.g., to start a pending GO negotiation. 1776*03f9172cSAndroid Build Coastguard Worker */ 1777*03f9172cSAndroid Build Coastguard Worker int p2p_scan_res_handler(struct p2p_data *p2p, const u8 *bssid, int freq, 1778*03f9172cSAndroid Build Coastguard Worker struct os_reltime *rx_time, int level, const u8 *ies, 1779*03f9172cSAndroid Build Coastguard Worker size_t ies_len); 1780*03f9172cSAndroid Build Coastguard Worker 1781*03f9172cSAndroid Build Coastguard Worker /** 1782*03f9172cSAndroid Build Coastguard Worker * p2p_scan_res_handled - Indicate end of scan results 1783*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1784*03f9172cSAndroid Build Coastguard Worker * @delay: Search delay for next scan in ms 1785*03f9172cSAndroid Build Coastguard Worker * 1786*03f9172cSAndroid Build Coastguard Worker * This function is called to indicate that all P2P scan results from a scan 1787*03f9172cSAndroid Build Coastguard Worker * have been reported with zero or more calls to p2p_scan_res_handler(). This 1788*03f9172cSAndroid Build Coastguard Worker * function must be called as a response to successful 1789*03f9172cSAndroid Build Coastguard Worker * struct p2p_config::p2p_scan() call if none of the p2p_scan_res_handler() 1790*03f9172cSAndroid Build Coastguard Worker * calls stopped iteration. 1791*03f9172cSAndroid Build Coastguard Worker */ 1792*03f9172cSAndroid Build Coastguard Worker void p2p_scan_res_handled(struct p2p_data *p2p, unsigned int delay); 1793*03f9172cSAndroid Build Coastguard Worker 1794*03f9172cSAndroid Build Coastguard Worker enum p2p_send_action_result { 1795*03f9172cSAndroid Build Coastguard Worker P2P_SEND_ACTION_SUCCESS /* Frame was send and acknowledged */, 1796*03f9172cSAndroid Build Coastguard Worker P2P_SEND_ACTION_NO_ACK /* Frame was sent, but not acknowledged */, 1797*03f9172cSAndroid Build Coastguard Worker P2P_SEND_ACTION_FAILED /* Frame was not sent due to a failure */ 1798*03f9172cSAndroid Build Coastguard Worker }; 1799*03f9172cSAndroid Build Coastguard Worker 1800*03f9172cSAndroid Build Coastguard Worker /** 1801*03f9172cSAndroid Build Coastguard Worker * p2p_send_action_cb - Notify TX status of an Action frame 1802*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1803*03f9172cSAndroid Build Coastguard Worker * @freq: Channel frequency in MHz 1804*03f9172cSAndroid Build Coastguard Worker * @dst: Destination MAC address (Address 1) 1805*03f9172cSAndroid Build Coastguard Worker * @src: Source MAC address (Address 2) 1806*03f9172cSAndroid Build Coastguard Worker * @bssid: BSSID (Address 3) 1807*03f9172cSAndroid Build Coastguard Worker * @result: Result of the transmission attempt 1808*03f9172cSAndroid Build Coastguard Worker * 1809*03f9172cSAndroid Build Coastguard Worker * This function is used to indicate the result of an Action frame transmission 1810*03f9172cSAndroid Build Coastguard Worker * that was requested with struct p2p_config::send_action() callback. 1811*03f9172cSAndroid Build Coastguard Worker */ 1812*03f9172cSAndroid Build Coastguard Worker void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst, 1813*03f9172cSAndroid Build Coastguard Worker const u8 *src, const u8 *bssid, 1814*03f9172cSAndroid Build Coastguard Worker enum p2p_send_action_result result); 1815*03f9172cSAndroid Build Coastguard Worker 1816*03f9172cSAndroid Build Coastguard Worker /** 1817*03f9172cSAndroid Build Coastguard Worker * p2p_listen_cb - Indicate the start of a requested Listen state 1818*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1819*03f9172cSAndroid Build Coastguard Worker * @freq: Listen channel frequency in MHz 1820*03f9172cSAndroid Build Coastguard Worker * @duration: Duration for the Listen state in milliseconds 1821*03f9172cSAndroid Build Coastguard Worker * 1822*03f9172cSAndroid Build Coastguard Worker * This function is used to indicate that a Listen state requested with 1823*03f9172cSAndroid Build Coastguard Worker * struct p2p_config::start_listen() callback has started. 1824*03f9172cSAndroid Build Coastguard Worker */ 1825*03f9172cSAndroid Build Coastguard Worker void p2p_listen_cb(struct p2p_data *p2p, unsigned int freq, 1826*03f9172cSAndroid Build Coastguard Worker unsigned int duration); 1827*03f9172cSAndroid Build Coastguard Worker 1828*03f9172cSAndroid Build Coastguard Worker /** 1829*03f9172cSAndroid Build Coastguard Worker * p2p_listen_end - Indicate the end of a requested Listen state 1830*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1831*03f9172cSAndroid Build Coastguard Worker * @freq: Listen channel frequency in MHz 1832*03f9172cSAndroid Build Coastguard Worker * Returns: 0 if no operations were started, 1 if an operation was started 1833*03f9172cSAndroid Build Coastguard Worker * 1834*03f9172cSAndroid Build Coastguard Worker * This function is used to indicate that a Listen state requested with 1835*03f9172cSAndroid Build Coastguard Worker * struct p2p_config::start_listen() callback has ended. 1836*03f9172cSAndroid Build Coastguard Worker */ 1837*03f9172cSAndroid Build Coastguard Worker int p2p_listen_end(struct p2p_data *p2p, unsigned int freq); 1838*03f9172cSAndroid Build Coastguard Worker 1839*03f9172cSAndroid Build Coastguard Worker void p2p_deauth_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code, 1840*03f9172cSAndroid Build Coastguard Worker const u8 *ie, size_t ie_len); 1841*03f9172cSAndroid Build Coastguard Worker 1842*03f9172cSAndroid Build Coastguard Worker void p2p_disassoc_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code, 1843*03f9172cSAndroid Build Coastguard Worker const u8 *ie, size_t ie_len); 1844*03f9172cSAndroid Build Coastguard Worker 1845*03f9172cSAndroid Build Coastguard Worker 1846*03f9172cSAndroid Build Coastguard Worker /* Per-group P2P state for GO */ 1847*03f9172cSAndroid Build Coastguard Worker 1848*03f9172cSAndroid Build Coastguard Worker struct p2p_group; 1849*03f9172cSAndroid Build Coastguard Worker 1850*03f9172cSAndroid Build Coastguard Worker /** 1851*03f9172cSAndroid Build Coastguard Worker * struct p2p_group_config - P2P group configuration 1852*03f9172cSAndroid Build Coastguard Worker * 1853*03f9172cSAndroid Build Coastguard Worker * This configuration is provided to the P2P module during initialization of 1854*03f9172cSAndroid Build Coastguard Worker * the per-group information with p2p_group_init(). 1855*03f9172cSAndroid Build Coastguard Worker */ 1856*03f9172cSAndroid Build Coastguard Worker struct p2p_group_config { 1857*03f9172cSAndroid Build Coastguard Worker /** 1858*03f9172cSAndroid Build Coastguard Worker * persistent_group - Whether the group is persistent 1859*03f9172cSAndroid Build Coastguard Worker * 0 = not a persistent group 1860*03f9172cSAndroid Build Coastguard Worker * 1 = persistent group without persistent reconnect 1861*03f9172cSAndroid Build Coastguard Worker * 2 = persistent group with persistent reconnect 1862*03f9172cSAndroid Build Coastguard Worker */ 1863*03f9172cSAndroid Build Coastguard Worker int persistent_group; 1864*03f9172cSAndroid Build Coastguard Worker 1865*03f9172cSAndroid Build Coastguard Worker /** 1866*03f9172cSAndroid Build Coastguard Worker * interface_addr - P2P Interface Address of the group 1867*03f9172cSAndroid Build Coastguard Worker */ 1868*03f9172cSAndroid Build Coastguard Worker u8 interface_addr[ETH_ALEN]; 1869*03f9172cSAndroid Build Coastguard Worker 1870*03f9172cSAndroid Build Coastguard Worker /** 1871*03f9172cSAndroid Build Coastguard Worker * max_clients - Maximum number of clients in the group 1872*03f9172cSAndroid Build Coastguard Worker */ 1873*03f9172cSAndroid Build Coastguard Worker unsigned int max_clients; 1874*03f9172cSAndroid Build Coastguard Worker 1875*03f9172cSAndroid Build Coastguard Worker /** 1876*03f9172cSAndroid Build Coastguard Worker * ssid - Group SSID 1877*03f9172cSAndroid Build Coastguard Worker */ 1878*03f9172cSAndroid Build Coastguard Worker u8 ssid[SSID_MAX_LEN]; 1879*03f9172cSAndroid Build Coastguard Worker 1880*03f9172cSAndroid Build Coastguard Worker /** 1881*03f9172cSAndroid Build Coastguard Worker * ssid_len - Length of SSID 1882*03f9172cSAndroid Build Coastguard Worker */ 1883*03f9172cSAndroid Build Coastguard Worker size_t ssid_len; 1884*03f9172cSAndroid Build Coastguard Worker 1885*03f9172cSAndroid Build Coastguard Worker /** 1886*03f9172cSAndroid Build Coastguard Worker * freq - Operating channel of the group 1887*03f9172cSAndroid Build Coastguard Worker */ 1888*03f9172cSAndroid Build Coastguard Worker int freq; 1889*03f9172cSAndroid Build Coastguard Worker 1890*03f9172cSAndroid Build Coastguard Worker /** 1891*03f9172cSAndroid Build Coastguard Worker * ip_addr_alloc - Whether IP address allocation within 4-way handshake 1892*03f9172cSAndroid Build Coastguard Worker * is supported 1893*03f9172cSAndroid Build Coastguard Worker */ 1894*03f9172cSAndroid Build Coastguard Worker int ip_addr_alloc; 1895*03f9172cSAndroid Build Coastguard Worker 1896*03f9172cSAndroid Build Coastguard Worker /** 1897*03f9172cSAndroid Build Coastguard Worker * cb_ctx - Context to use with callback functions 1898*03f9172cSAndroid Build Coastguard Worker */ 1899*03f9172cSAndroid Build Coastguard Worker void *cb_ctx; 1900*03f9172cSAndroid Build Coastguard Worker 1901*03f9172cSAndroid Build Coastguard Worker /** 1902*03f9172cSAndroid Build Coastguard Worker * ie_update - Notification of IE update 1903*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1904*03f9172cSAndroid Build Coastguard Worker * @beacon_ies: P2P IE for Beacon frames or %NULL if no change 1905*03f9172cSAndroid Build Coastguard Worker * @proberesp_ies: P2P Ie for Probe Response frames 1906*03f9172cSAndroid Build Coastguard Worker * 1907*03f9172cSAndroid Build Coastguard Worker * P2P module uses this callback function to notify whenever the P2P IE 1908*03f9172cSAndroid Build Coastguard Worker * in Beacon or Probe Response frames should be updated based on group 1909*03f9172cSAndroid Build Coastguard Worker * events. 1910*03f9172cSAndroid Build Coastguard Worker * 1911*03f9172cSAndroid Build Coastguard Worker * The callee is responsible for freeing the returned buffer(s) with 1912*03f9172cSAndroid Build Coastguard Worker * wpabuf_free(). 1913*03f9172cSAndroid Build Coastguard Worker */ 1914*03f9172cSAndroid Build Coastguard Worker void (*ie_update)(void *ctx, struct wpabuf *beacon_ies, 1915*03f9172cSAndroid Build Coastguard Worker struct wpabuf *proberesp_ies); 1916*03f9172cSAndroid Build Coastguard Worker 1917*03f9172cSAndroid Build Coastguard Worker /** 1918*03f9172cSAndroid Build Coastguard Worker * idle_update - Notification of changes in group idle state 1919*03f9172cSAndroid Build Coastguard Worker * @ctx: Callback context from cb_ctx 1920*03f9172cSAndroid Build Coastguard Worker * @idle: Whether the group is idle (no associated stations) 1921*03f9172cSAndroid Build Coastguard Worker */ 1922*03f9172cSAndroid Build Coastguard Worker void (*idle_update)(void *ctx, int idle); 1923*03f9172cSAndroid Build Coastguard Worker }; 1924*03f9172cSAndroid Build Coastguard Worker 1925*03f9172cSAndroid Build Coastguard Worker /** 1926*03f9172cSAndroid Build Coastguard Worker * p2p_group_init - Initialize P2P group 1927*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 1928*03f9172cSAndroid Build Coastguard Worker * @config: P2P group configuration (will be freed by p2p_group_deinit()) 1929*03f9172cSAndroid Build Coastguard Worker * Returns: Pointer to private data or %NULL on failure 1930*03f9172cSAndroid Build Coastguard Worker * 1931*03f9172cSAndroid Build Coastguard Worker * This function is used to initialize per-group P2P module context. Currently, 1932*03f9172cSAndroid Build Coastguard Worker * this is only used to manage GO functionality and P2P clients do not need to 1933*03f9172cSAndroid Build Coastguard Worker * create an instance of this per-group information. 1934*03f9172cSAndroid Build Coastguard Worker */ 1935*03f9172cSAndroid Build Coastguard Worker struct p2p_group * p2p_group_init(struct p2p_data *p2p, 1936*03f9172cSAndroid Build Coastguard Worker struct p2p_group_config *config); 1937*03f9172cSAndroid Build Coastguard Worker 1938*03f9172cSAndroid Build Coastguard Worker /** 1939*03f9172cSAndroid Build Coastguard Worker * p2p_group_deinit - Deinitialize P2P group 1940*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 1941*03f9172cSAndroid Build Coastguard Worker */ 1942*03f9172cSAndroid Build Coastguard Worker void p2p_group_deinit(struct p2p_group *group); 1943*03f9172cSAndroid Build Coastguard Worker 1944*03f9172cSAndroid Build Coastguard Worker /** 1945*03f9172cSAndroid Build Coastguard Worker * p2p_group_notif_assoc - Notification of P2P client association with GO 1946*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 1947*03f9172cSAndroid Build Coastguard Worker * @addr: Interface address of the P2P client 1948*03f9172cSAndroid Build Coastguard Worker * @ie: IEs from the (Re)association Request frame 1949*03f9172cSAndroid Build Coastguard Worker * @len: Length of the ie buffer in octets 1950*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1951*03f9172cSAndroid Build Coastguard Worker */ 1952*03f9172cSAndroid Build Coastguard Worker int p2p_group_notif_assoc(struct p2p_group *group, const u8 *addr, 1953*03f9172cSAndroid Build Coastguard Worker const u8 *ie, size_t len); 1954*03f9172cSAndroid Build Coastguard Worker 1955*03f9172cSAndroid Build Coastguard Worker /** 1956*03f9172cSAndroid Build Coastguard Worker * p2p_group_assoc_resp_ie - Build P2P IE for (re)association response 1957*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 1958*03f9172cSAndroid Build Coastguard Worker * @status: Status value (P2P_SC_SUCCESS if association succeeded) 1959*03f9172cSAndroid Build Coastguard Worker * Returns: P2P IE for (Re)association Response or %NULL on failure 1960*03f9172cSAndroid Build Coastguard Worker * 1961*03f9172cSAndroid Build Coastguard Worker * The caller is responsible for freeing the returned buffer with 1962*03f9172cSAndroid Build Coastguard Worker * wpabuf_free(). 1963*03f9172cSAndroid Build Coastguard Worker */ 1964*03f9172cSAndroid Build Coastguard Worker struct wpabuf * p2p_group_assoc_resp_ie(struct p2p_group *group, u8 status); 1965*03f9172cSAndroid Build Coastguard Worker 1966*03f9172cSAndroid Build Coastguard Worker /** 1967*03f9172cSAndroid Build Coastguard Worker * p2p_group_notif_disassoc - Notification of P2P client disassociation from GO 1968*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 1969*03f9172cSAndroid Build Coastguard Worker * @addr: Interface address of the P2P client 1970*03f9172cSAndroid Build Coastguard Worker */ 1971*03f9172cSAndroid Build Coastguard Worker void p2p_group_notif_disassoc(struct p2p_group *group, const u8 *addr); 1972*03f9172cSAndroid Build Coastguard Worker 1973*03f9172cSAndroid Build Coastguard Worker /** 1974*03f9172cSAndroid Build Coastguard Worker * p2p_group_notif_formation_done - Notification of completed group formation 1975*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 1976*03f9172cSAndroid Build Coastguard Worker */ 1977*03f9172cSAndroid Build Coastguard Worker void p2p_group_notif_formation_done(struct p2p_group *group); 1978*03f9172cSAndroid Build Coastguard Worker 1979*03f9172cSAndroid Build Coastguard Worker /** 1980*03f9172cSAndroid Build Coastguard Worker * p2p_group_notif_noa - Notification of NoA change 1981*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 1982*03f9172cSAndroid Build Coastguard Worker * @noa: Notice of Absence attribute payload, %NULL if none 1983*03f9172cSAndroid Build Coastguard Worker * @noa_len: Length of noa buffer in octets 1984*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 1985*03f9172cSAndroid Build Coastguard Worker * 1986*03f9172cSAndroid Build Coastguard Worker * Notify the P2P group management about a new NoA contents. This will be 1987*03f9172cSAndroid Build Coastguard Worker * inserted into the P2P IEs in Beacon and Probe Response frames with rest of 1988*03f9172cSAndroid Build Coastguard Worker * the group information. 1989*03f9172cSAndroid Build Coastguard Worker */ 1990*03f9172cSAndroid Build Coastguard Worker int p2p_group_notif_noa(struct p2p_group *group, const u8 *noa, 1991*03f9172cSAndroid Build Coastguard Worker size_t noa_len); 1992*03f9172cSAndroid Build Coastguard Worker 1993*03f9172cSAndroid Build Coastguard Worker /** 1994*03f9172cSAndroid Build Coastguard Worker * p2p_group_match_dev_type - Match device types in group with requested type 1995*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 1996*03f9172cSAndroid Build Coastguard Worker * @wps: WPS TLVs from Probe Request frame (concatenated WPS IEs) 1997*03f9172cSAndroid Build Coastguard Worker * Returns: 1 on match, 0 on mismatch 1998*03f9172cSAndroid Build Coastguard Worker * 1999*03f9172cSAndroid Build Coastguard Worker * This function can be used to match the Requested Device Type attribute in 2000*03f9172cSAndroid Build Coastguard Worker * WPS IE with the device types of a group member for deciding whether a GO 2001*03f9172cSAndroid Build Coastguard Worker * should reply to a Probe Request frame. Match will be reported if the WPS IE 2002*03f9172cSAndroid Build Coastguard Worker * is not requested any specific device type. 2003*03f9172cSAndroid Build Coastguard Worker */ 2004*03f9172cSAndroid Build Coastguard Worker int p2p_group_match_dev_type(struct p2p_group *group, struct wpabuf *wps); 2005*03f9172cSAndroid Build Coastguard Worker 2006*03f9172cSAndroid Build Coastguard Worker /** 2007*03f9172cSAndroid Build Coastguard Worker * p2p_group_match_dev_id - Match P2P Device Address in group with requested device id 2008*03f9172cSAndroid Build Coastguard Worker */ 2009*03f9172cSAndroid Build Coastguard Worker int p2p_group_match_dev_id(struct p2p_group *group, struct wpabuf *p2p); 2010*03f9172cSAndroid Build Coastguard Worker 2011*03f9172cSAndroid Build Coastguard Worker /** 2012*03f9172cSAndroid Build Coastguard Worker * p2p_group_go_discover - Send GO Discoverability Request to a group client 2013*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 2014*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success (frame scheduled); -1 if client was not found 2015*03f9172cSAndroid Build Coastguard Worker */ 2016*03f9172cSAndroid Build Coastguard Worker int p2p_group_go_discover(struct p2p_group *group, const u8 *dev_id, 2017*03f9172cSAndroid Build Coastguard Worker const u8 *searching_dev, int rx_freq); 2018*03f9172cSAndroid Build Coastguard Worker 2019*03f9172cSAndroid Build Coastguard Worker 2020*03f9172cSAndroid Build Coastguard Worker /* Generic helper functions */ 2021*03f9172cSAndroid Build Coastguard Worker 2022*03f9172cSAndroid Build Coastguard Worker /** 2023*03f9172cSAndroid Build Coastguard Worker * p2p_ie_text - Build text format description of P2P IE 2024*03f9172cSAndroid Build Coastguard Worker * @p2p_ie: P2P IE 2025*03f9172cSAndroid Build Coastguard Worker * @buf: Buffer for returning text 2026*03f9172cSAndroid Build Coastguard Worker * @end: Pointer to the end of the buf area 2027*03f9172cSAndroid Build Coastguard Worker * Returns: Number of octets written to the buffer or -1 on failure 2028*03f9172cSAndroid Build Coastguard Worker * 2029*03f9172cSAndroid Build Coastguard Worker * This function can be used to parse P2P IE contents into text format 2030*03f9172cSAndroid Build Coastguard Worker * field=value lines. 2031*03f9172cSAndroid Build Coastguard Worker */ 2032*03f9172cSAndroid Build Coastguard Worker int p2p_ie_text(struct wpabuf *p2p_ie, char *buf, char *end); 2033*03f9172cSAndroid Build Coastguard Worker 2034*03f9172cSAndroid Build Coastguard Worker /** 2035*03f9172cSAndroid Build Coastguard Worker * p2p_scan_result_text - Build text format description of P2P IE 2036*03f9172cSAndroid Build Coastguard Worker * @ies: Information elements from scan results 2037*03f9172cSAndroid Build Coastguard Worker * @ies_len: ies buffer length in octets 2038*03f9172cSAndroid Build Coastguard Worker * @buf: Buffer for returning text 2039*03f9172cSAndroid Build Coastguard Worker * @end: Pointer to the end of the buf area 2040*03f9172cSAndroid Build Coastguard Worker * Returns: Number of octets written to the buffer or -1 on failure 2041*03f9172cSAndroid Build Coastguard Worker * 2042*03f9172cSAndroid Build Coastguard Worker * This function can be used to parse P2P IE contents into text format 2043*03f9172cSAndroid Build Coastguard Worker * field=value lines. 2044*03f9172cSAndroid Build Coastguard Worker */ 2045*03f9172cSAndroid Build Coastguard Worker int p2p_scan_result_text(const u8 *ies, size_t ies_len, char *buf, char *end); 2046*03f9172cSAndroid Build Coastguard Worker 2047*03f9172cSAndroid Build Coastguard Worker /** 2048*03f9172cSAndroid Build Coastguard Worker * p2p_parse_dev_addr_in_p2p_ie - Parse P2P Device Address from a concatenated 2049*03f9172cSAndroid Build Coastguard Worker * P2P IE 2050*03f9172cSAndroid Build Coastguard Worker * @p2p_ie: P2P IE 2051*03f9172cSAndroid Build Coastguard Worker * @dev_addr: Buffer for returning P2P Device Address 2052*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success or -1 if P2P Device Address could not be parsed 2053*03f9172cSAndroid Build Coastguard Worker */ 2054*03f9172cSAndroid Build Coastguard Worker int p2p_parse_dev_addr_in_p2p_ie(struct wpabuf *p2p_ie, u8 *dev_addr); 2055*03f9172cSAndroid Build Coastguard Worker 2056*03f9172cSAndroid Build Coastguard Worker /** 2057*03f9172cSAndroid Build Coastguard Worker * p2p_parse_dev_addr - Parse P2P Device Address from P2P IE(s) 2058*03f9172cSAndroid Build Coastguard Worker * @ies: Information elements from scan results 2059*03f9172cSAndroid Build Coastguard Worker * @ies_len: ies buffer length in octets 2060*03f9172cSAndroid Build Coastguard Worker * @dev_addr: Buffer for returning P2P Device Address 2061*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success or -1 if P2P Device Address could not be parsed 2062*03f9172cSAndroid Build Coastguard Worker */ 2063*03f9172cSAndroid Build Coastguard Worker int p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr); 2064*03f9172cSAndroid Build Coastguard Worker 2065*03f9172cSAndroid Build Coastguard Worker /** 2066*03f9172cSAndroid Build Coastguard Worker * p2p_assoc_req_ie - Build P2P IE for (Re)Association Request frame 2067*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2068*03f9172cSAndroid Build Coastguard Worker * @bssid: BSSID 2069*03f9172cSAndroid Build Coastguard Worker * @buf: Buffer for writing the P2P IE 2070*03f9172cSAndroid Build Coastguard Worker * @len: Maximum buf length in octets 2071*03f9172cSAndroid Build Coastguard Worker * @p2p_group: Whether this is for association with a P2P GO 2072*03f9172cSAndroid Build Coastguard Worker * @p2p_ie: Reassembled P2P IE data from scan results or %NULL if none 2073*03f9172cSAndroid Build Coastguard Worker * Returns: Number of octets written into buf or -1 on failure 2074*03f9172cSAndroid Build Coastguard Worker */ 2075*03f9172cSAndroid Build Coastguard Worker int p2p_assoc_req_ie(struct p2p_data *p2p, const u8 *bssid, u8 *buf, 2076*03f9172cSAndroid Build Coastguard Worker size_t len, int p2p_group, struct wpabuf *p2p_ie); 2077*03f9172cSAndroid Build Coastguard Worker 2078*03f9172cSAndroid Build Coastguard Worker /** 2079*03f9172cSAndroid Build Coastguard Worker * p2p_scan_ie - Build P2P IE for Probe Request 2080*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2081*03f9172cSAndroid Build Coastguard Worker * @ies: Buffer for writing P2P IE 2082*03f9172cSAndroid Build Coastguard Worker * @dev_id: Device ID to search for or %NULL for any 2083*03f9172cSAndroid Build Coastguard Worker * @bands: Frequency bands used in the scan (enum wpa_radio_work_band bitmap) 2084*03f9172cSAndroid Build Coastguard Worker */ 2085*03f9172cSAndroid Build Coastguard Worker void p2p_scan_ie(struct p2p_data *p2p, struct wpabuf *ies, const u8 *dev_id, 2086*03f9172cSAndroid Build Coastguard Worker unsigned int bands); 2087*03f9172cSAndroid Build Coastguard Worker 2088*03f9172cSAndroid Build Coastguard Worker /** 2089*03f9172cSAndroid Build Coastguard Worker * p2p_scan_ie_buf_len - Get maximum buffer length needed for p2p_scan_ie 2090*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2091*03f9172cSAndroid Build Coastguard Worker * Returns: Number of octets that p2p_scan_ie() may add to the buffer 2092*03f9172cSAndroid Build Coastguard Worker */ 2093*03f9172cSAndroid Build Coastguard Worker size_t p2p_scan_ie_buf_len(struct p2p_data *p2p); 2094*03f9172cSAndroid Build Coastguard Worker 2095*03f9172cSAndroid Build Coastguard Worker /** 2096*03f9172cSAndroid Build Coastguard Worker * p2p_go_params - Generate random P2P group parameters 2097*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2098*03f9172cSAndroid Build Coastguard Worker * @params: Buffer for parameters 2099*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 2100*03f9172cSAndroid Build Coastguard Worker */ 2101*03f9172cSAndroid Build Coastguard Worker int p2p_go_params(struct p2p_data *p2p, struct p2p_go_neg_results *params); 2102*03f9172cSAndroid Build Coastguard Worker 2103*03f9172cSAndroid Build Coastguard Worker /** 2104*03f9172cSAndroid Build Coastguard Worker * p2p_get_group_capab - Get Group Capability from P2P IE data 2105*03f9172cSAndroid Build Coastguard Worker * @p2p_ie: P2P IE(s) contents 2106*03f9172cSAndroid Build Coastguard Worker * Returns: Group Capability 2107*03f9172cSAndroid Build Coastguard Worker */ 2108*03f9172cSAndroid Build Coastguard Worker u8 p2p_get_group_capab(const struct wpabuf *p2p_ie); 2109*03f9172cSAndroid Build Coastguard Worker 2110*03f9172cSAndroid Build Coastguard Worker /** 2111*03f9172cSAndroid Build Coastguard Worker * p2p_get_cross_connect_disallowed - Does WLAN AP disallows cross connection 2112*03f9172cSAndroid Build Coastguard Worker * @p2p_ie: P2P IE(s) contents 2113*03f9172cSAndroid Build Coastguard Worker * Returns: 0 if cross connection is allow, 1 if not 2114*03f9172cSAndroid Build Coastguard Worker */ 2115*03f9172cSAndroid Build Coastguard Worker int p2p_get_cross_connect_disallowed(const struct wpabuf *p2p_ie); 2116*03f9172cSAndroid Build Coastguard Worker 2117*03f9172cSAndroid Build Coastguard Worker /** 2118*03f9172cSAndroid Build Coastguard Worker * p2p_get_go_dev_addr - Get P2P Device Address from P2P IE data 2119*03f9172cSAndroid Build Coastguard Worker * @p2p_ie: P2P IE(s) contents 2120*03f9172cSAndroid Build Coastguard Worker * Returns: Pointer to P2P Device Address or %NULL if not included 2121*03f9172cSAndroid Build Coastguard Worker */ 2122*03f9172cSAndroid Build Coastguard Worker const u8 * p2p_get_go_dev_addr(const struct wpabuf *p2p_ie); 2123*03f9172cSAndroid Build Coastguard Worker 2124*03f9172cSAndroid Build Coastguard Worker /** 2125*03f9172cSAndroid Build Coastguard Worker * p2p_get_peer_info - Get P2P peer information 2126*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2127*03f9172cSAndroid Build Coastguard Worker * @addr: P2P Device Address of the peer or %NULL to indicate the first peer 2128*03f9172cSAndroid Build Coastguard Worker * @next: Whether to select the peer entry following the one indicated by addr 2129*03f9172cSAndroid Build Coastguard Worker * Returns: Pointer to peer info or %NULL if not found 2130*03f9172cSAndroid Build Coastguard Worker */ 2131*03f9172cSAndroid Build Coastguard Worker const struct p2p_peer_info * p2p_get_peer_info(struct p2p_data *p2p, 2132*03f9172cSAndroid Build Coastguard Worker const u8 *addr, int next); 2133*03f9172cSAndroid Build Coastguard Worker 2134*03f9172cSAndroid Build Coastguard Worker /** 2135*03f9172cSAndroid Build Coastguard Worker * p2p_get_peer_info_txt - Get internal P2P peer information in text format 2136*03f9172cSAndroid Build Coastguard Worker * @info: Pointer to P2P peer info from p2p_get_peer_info() 2137*03f9172cSAndroid Build Coastguard Worker * @buf: Buffer for returning text 2138*03f9172cSAndroid Build Coastguard Worker * @buflen: Maximum buffer length 2139*03f9172cSAndroid Build Coastguard Worker * Returns: Number of octets written to the buffer or -1 on failure 2140*03f9172cSAndroid Build Coastguard Worker * 2141*03f9172cSAndroid Build Coastguard Worker * Note: This information is internal to the P2P module and subject to change. 2142*03f9172cSAndroid Build Coastguard Worker * As such, this should not really be used by external programs for purposes 2143*03f9172cSAndroid Build Coastguard Worker * other than debugging. 2144*03f9172cSAndroid Build Coastguard Worker */ 2145*03f9172cSAndroid Build Coastguard Worker int p2p_get_peer_info_txt(const struct p2p_peer_info *info, 2146*03f9172cSAndroid Build Coastguard Worker char *buf, size_t buflen); 2147*03f9172cSAndroid Build Coastguard Worker 2148*03f9172cSAndroid Build Coastguard Worker /** 2149*03f9172cSAndroid Build Coastguard Worker * p2p_peer_known - Check whether P2P peer is known 2150*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2151*03f9172cSAndroid Build Coastguard Worker * @addr: P2P Device Address of the peer 2152*03f9172cSAndroid Build Coastguard Worker * Returns: 1 if the specified device is in the P2P peer table or 0 if not 2153*03f9172cSAndroid Build Coastguard Worker */ 2154*03f9172cSAndroid Build Coastguard Worker int p2p_peer_known(struct p2p_data *p2p, const u8 *addr); 2155*03f9172cSAndroid Build Coastguard Worker 2156*03f9172cSAndroid Build Coastguard Worker /** 2157*03f9172cSAndroid Build Coastguard Worker * p2p_set_client_discoverability - Set client discoverability capability 2158*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2159*03f9172cSAndroid Build Coastguard Worker * @enabled: Whether client discoverability will be enabled 2160*03f9172cSAndroid Build Coastguard Worker * 2161*03f9172cSAndroid Build Coastguard Worker * This function can be used to disable (and re-enable) client discoverability. 2162*03f9172cSAndroid Build Coastguard Worker * This capability is enabled by default and should not be disabled in normal 2163*03f9172cSAndroid Build Coastguard Worker * use cases, i.e., this is mainly for testing purposes. 2164*03f9172cSAndroid Build Coastguard Worker */ 2165*03f9172cSAndroid Build Coastguard Worker void p2p_set_client_discoverability(struct p2p_data *p2p, int enabled); 2166*03f9172cSAndroid Build Coastguard Worker 2167*03f9172cSAndroid Build Coastguard Worker /** 2168*03f9172cSAndroid Build Coastguard Worker * p2p_set_managed_oper - Set managed P2P Device operations capability 2169*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2170*03f9172cSAndroid Build Coastguard Worker * @enabled: Whether managed P2P Device operations will be enabled 2171*03f9172cSAndroid Build Coastguard Worker */ 2172*03f9172cSAndroid Build Coastguard Worker void p2p_set_managed_oper(struct p2p_data *p2p, int enabled); 2173*03f9172cSAndroid Build Coastguard Worker 2174*03f9172cSAndroid Build Coastguard Worker /** 2175*03f9172cSAndroid Build Coastguard Worker * p2p_config_get_random_social - Return a random social channel 2176*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P config 2177*03f9172cSAndroid Build Coastguard Worker * @op_class: Selected operating class 2178*03f9172cSAndroid Build Coastguard Worker * @op_channel: Selected social channel 2179*03f9172cSAndroid Build Coastguard Worker * @avoid_list: Channel ranges to try to avoid or %NULL 2180*03f9172cSAndroid Build Coastguard Worker * @disallow_list: Channel ranges to discard or %NULL 2181*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 2182*03f9172cSAndroid Build Coastguard Worker * 2183*03f9172cSAndroid Build Coastguard Worker * This function is used before p2p_init is called. A random social channel 2184*03f9172cSAndroid Build Coastguard Worker * from supports bands 2.4 GHz (channels 1,6,11) and 60 GHz (channel 2) is 2185*03f9172cSAndroid Build Coastguard Worker * returned on success. 2186*03f9172cSAndroid Build Coastguard Worker */ 2187*03f9172cSAndroid Build Coastguard Worker int p2p_config_get_random_social(struct p2p_config *p2p, u8 *op_class, 2188*03f9172cSAndroid Build Coastguard Worker u8 *op_channel, 2189*03f9172cSAndroid Build Coastguard Worker struct wpa_freq_range_list *avoid_list, 2190*03f9172cSAndroid Build Coastguard Worker struct wpa_freq_range_list *disallow_list); 2191*03f9172cSAndroid Build Coastguard Worker 2192*03f9172cSAndroid Build Coastguard Worker int p2p_set_listen_channel(struct p2p_data *p2p, u8 reg_class, u8 channel, 2193*03f9172cSAndroid Build Coastguard Worker u8 forced); 2194*03f9172cSAndroid Build Coastguard Worker 2195*03f9172cSAndroid Build Coastguard Worker u8 p2p_get_listen_channel(struct p2p_data *p2p); 2196*03f9172cSAndroid Build Coastguard Worker 2197*03f9172cSAndroid Build Coastguard Worker int p2p_set_ssid_postfix(struct p2p_data *p2p, const u8 *postfix, size_t len); 2198*03f9172cSAndroid Build Coastguard Worker 2199*03f9172cSAndroid Build Coastguard Worker int p2p_get_interface_addr(struct p2p_data *p2p, const u8 *dev_addr, 2200*03f9172cSAndroid Build Coastguard Worker u8 *iface_addr); 2201*03f9172cSAndroid Build Coastguard Worker int p2p_get_dev_addr(struct p2p_data *p2p, const u8 *iface_addr, 2202*03f9172cSAndroid Build Coastguard Worker u8 *dev_addr); 2203*03f9172cSAndroid Build Coastguard Worker 2204*03f9172cSAndroid Build Coastguard Worker void p2p_set_peer_filter(struct p2p_data *p2p, const u8 *addr); 2205*03f9172cSAndroid Build Coastguard Worker 2206*03f9172cSAndroid Build Coastguard Worker /** 2207*03f9172cSAndroid Build Coastguard Worker * p2p_set_cross_connect - Set cross connection capability 2208*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2209*03f9172cSAndroid Build Coastguard Worker * @enabled: Whether cross connection will be enabled 2210*03f9172cSAndroid Build Coastguard Worker */ 2211*03f9172cSAndroid Build Coastguard Worker void p2p_set_cross_connect(struct p2p_data *p2p, int enabled); 2212*03f9172cSAndroid Build Coastguard Worker 2213*03f9172cSAndroid Build Coastguard Worker int p2p_get_oper_freq(struct p2p_data *p2p, const u8 *iface_addr); 2214*03f9172cSAndroid Build Coastguard Worker 2215*03f9172cSAndroid Build Coastguard Worker /** 2216*03f9172cSAndroid Build Coastguard Worker * p2p_set_intra_bss_dist - Set intra BSS distribution 2217*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2218*03f9172cSAndroid Build Coastguard Worker * @enabled: Whether intra BSS distribution will be enabled 2219*03f9172cSAndroid Build Coastguard Worker */ 2220*03f9172cSAndroid Build Coastguard Worker void p2p_set_intra_bss_dist(struct p2p_data *p2p, int enabled); 2221*03f9172cSAndroid Build Coastguard Worker 2222*03f9172cSAndroid Build Coastguard Worker int p2p_channels_includes_freq(const struct p2p_channels *channels, 2223*03f9172cSAndroid Build Coastguard Worker unsigned int freq); 2224*03f9172cSAndroid Build Coastguard Worker 2225*03f9172cSAndroid Build Coastguard Worker int p2p_channels_to_freqs(const struct p2p_channels *channels, 2226*03f9172cSAndroid Build Coastguard Worker int *freq_list, unsigned int max_len); 2227*03f9172cSAndroid Build Coastguard Worker 2228*03f9172cSAndroid Build Coastguard Worker /** 2229*03f9172cSAndroid Build Coastguard Worker * p2p_supported_freq - Check whether channel is supported for P2P 2230*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2231*03f9172cSAndroid Build Coastguard Worker * @freq: Channel frequency in MHz 2232*03f9172cSAndroid Build Coastguard Worker * Returns: 0 if channel not usable for P2P, 1 if usable for P2P 2233*03f9172cSAndroid Build Coastguard Worker */ 2234*03f9172cSAndroid Build Coastguard Worker int p2p_supported_freq(struct p2p_data *p2p, unsigned int freq); 2235*03f9172cSAndroid Build Coastguard Worker 2236*03f9172cSAndroid Build Coastguard Worker /** 2237*03f9172cSAndroid Build Coastguard Worker * p2p_supported_freq_go - Check whether channel is supported for P2P GO operation 2238*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2239*03f9172cSAndroid Build Coastguard Worker * @freq: Channel frequency in MHz 2240*03f9172cSAndroid Build Coastguard Worker * Returns: 0 if channel not usable for P2P, 1 if usable for P2P 2241*03f9172cSAndroid Build Coastguard Worker */ 2242*03f9172cSAndroid Build Coastguard Worker int p2p_supported_freq_go(struct p2p_data *p2p, unsigned int freq); 2243*03f9172cSAndroid Build Coastguard Worker 2244*03f9172cSAndroid Build Coastguard Worker /** 2245*03f9172cSAndroid Build Coastguard Worker * p2p_supported_freq_cli - Check whether channel is supported for P2P client operation 2246*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2247*03f9172cSAndroid Build Coastguard Worker * @freq: Channel frequency in MHz 2248*03f9172cSAndroid Build Coastguard Worker * Returns: 0 if channel not usable for P2P, 1 if usable for P2P 2249*03f9172cSAndroid Build Coastguard Worker */ 2250*03f9172cSAndroid Build Coastguard Worker int p2p_supported_freq_cli(struct p2p_data *p2p, unsigned int freq); 2251*03f9172cSAndroid Build Coastguard Worker 2252*03f9172cSAndroid Build Coastguard Worker /** 2253*03f9172cSAndroid Build Coastguard Worker * p2p_get_pref_freq - Get channel from preferred channel list 2254*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2255*03f9172cSAndroid Build Coastguard Worker * @channels: List of channels 2256*03f9172cSAndroid Build Coastguard Worker * Returns: Preferred channel 2257*03f9172cSAndroid Build Coastguard Worker */ 2258*03f9172cSAndroid Build Coastguard Worker unsigned int p2p_get_pref_freq(struct p2p_data *p2p, 2259*03f9172cSAndroid Build Coastguard Worker const struct p2p_channels *channels); 2260*03f9172cSAndroid Build Coastguard Worker 2261*03f9172cSAndroid Build Coastguard Worker void p2p_update_channel_list(struct p2p_data *p2p, 2262*03f9172cSAndroid Build Coastguard Worker const struct p2p_channels *chan, 2263*03f9172cSAndroid Build Coastguard Worker const struct p2p_channels *cli_chan); 2264*03f9172cSAndroid Build Coastguard Worker 2265*03f9172cSAndroid Build Coastguard Worker bool is_p2p_6ghz_disabled(struct p2p_data *p2p); 2266*03f9172cSAndroid Build Coastguard Worker bool is_p2p_dfs_chan_enabled(struct p2p_data *p2p); 2267*03f9172cSAndroid Build Coastguard Worker 2268*03f9172cSAndroid Build Coastguard Worker /** 2269*03f9172cSAndroid Build Coastguard Worker * p2p_set_best_channels - Update best channel information 2270*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2271*03f9172cSAndroid Build Coastguard Worker * @freq_24: Frequency (MHz) of best channel in 2.4 GHz band 2272*03f9172cSAndroid Build Coastguard Worker * @freq_5: Frequency (MHz) of best channel in 5 GHz band 2273*03f9172cSAndroid Build Coastguard Worker * @freq_overall: Frequency (MHz) of best channel overall 2274*03f9172cSAndroid Build Coastguard Worker */ 2275*03f9172cSAndroid Build Coastguard Worker void p2p_set_best_channels(struct p2p_data *p2p, int freq_24, int freq_5, 2276*03f9172cSAndroid Build Coastguard Worker int freq_overall); 2277*03f9172cSAndroid Build Coastguard Worker 2278*03f9172cSAndroid Build Coastguard Worker /** 2279*03f9172cSAndroid Build Coastguard Worker * p2p_set_own_freq_preference - Set own preference for channel 2280*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2281*03f9172cSAndroid Build Coastguard Worker * @freq: Frequency (MHz) of the preferred channel or 0 if no preference 2282*03f9172cSAndroid Build Coastguard Worker * 2283*03f9172cSAndroid Build Coastguard Worker * This function can be used to set a preference on the operating channel based 2284*03f9172cSAndroid Build Coastguard Worker * on frequencies used on the other virtual interfaces that share the same 2285*03f9172cSAndroid Build Coastguard Worker * radio. If non-zero, this is used to try to avoid multi-channel concurrency. 2286*03f9172cSAndroid Build Coastguard Worker */ 2287*03f9172cSAndroid Build Coastguard Worker void p2p_set_own_freq_preference(struct p2p_data *p2p, int freq); 2288*03f9172cSAndroid Build Coastguard Worker 2289*03f9172cSAndroid Build Coastguard Worker const u8 * p2p_get_go_neg_peer(struct p2p_data *p2p); 2290*03f9172cSAndroid Build Coastguard Worker 2291*03f9172cSAndroid Build Coastguard Worker /** 2292*03f9172cSAndroid Build Coastguard Worker * p2p_get_group_num_members - Get number of members in group 2293*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 2294*03f9172cSAndroid Build Coastguard Worker * Returns: Number of members in the group 2295*03f9172cSAndroid Build Coastguard Worker */ 2296*03f9172cSAndroid Build Coastguard Worker unsigned int p2p_get_group_num_members(struct p2p_group *group); 2297*03f9172cSAndroid Build Coastguard Worker 2298*03f9172cSAndroid Build Coastguard Worker /** 2299*03f9172cSAndroid Build Coastguard Worker * p2p_client_limit_reached - Check if client limit is reached 2300*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 2301*03f9172cSAndroid Build Coastguard Worker * Returns: 1 if no of clients limit reached 2302*03f9172cSAndroid Build Coastguard Worker */ 2303*03f9172cSAndroid Build Coastguard Worker int p2p_client_limit_reached(struct p2p_group *group); 2304*03f9172cSAndroid Build Coastguard Worker 2305*03f9172cSAndroid Build Coastguard Worker /** 2306*03f9172cSAndroid Build Coastguard Worker * p2p_iterate_group_members - Iterate group members 2307*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 2308*03f9172cSAndroid Build Coastguard Worker * @next: iteration pointer, must be a pointer to a void * that is set to %NULL 2309*03f9172cSAndroid Build Coastguard Worker * on the first call and not modified later 2310*03f9172cSAndroid Build Coastguard Worker * Returns: A P2P Device Address for each call and %NULL for no more members 2311*03f9172cSAndroid Build Coastguard Worker */ 2312*03f9172cSAndroid Build Coastguard Worker const u8 * p2p_iterate_group_members(struct p2p_group *group, void **next); 2313*03f9172cSAndroid Build Coastguard Worker 2314*03f9172cSAndroid Build Coastguard Worker /** 2315*03f9172cSAndroid Build Coastguard Worker * p2p_group_get_client_interface_addr - Get P2P Interface Address of a client in a group 2316*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 2317*03f9172cSAndroid Build Coastguard Worker * @dev_addr: P2P Device Address of the client 2318*03f9172cSAndroid Build Coastguard Worker * Returns: P2P Interface Address of the client if found or %NULL if no match 2319*03f9172cSAndroid Build Coastguard Worker * found 2320*03f9172cSAndroid Build Coastguard Worker */ 2321*03f9172cSAndroid Build Coastguard Worker const u8 * p2p_group_get_client_interface_addr(struct p2p_group *group, 2322*03f9172cSAndroid Build Coastguard Worker const u8 *dev_addr); 2323*03f9172cSAndroid Build Coastguard Worker 2324*03f9172cSAndroid Build Coastguard Worker /** 2325*03f9172cSAndroid Build Coastguard Worker * p2p_group_get_dev_addr - Get a P2P Device Address of a client in a group 2326*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 2327*03f9172cSAndroid Build Coastguard Worker * @addr: P2P Interface Address of the client 2328*03f9172cSAndroid Build Coastguard Worker * Returns: P2P Device Address of the client if found or %NULL if no match 2329*03f9172cSAndroid Build Coastguard Worker * found 2330*03f9172cSAndroid Build Coastguard Worker */ 2331*03f9172cSAndroid Build Coastguard Worker const u8 * p2p_group_get_dev_addr(struct p2p_group *group, const u8 *addr); 2332*03f9172cSAndroid Build Coastguard Worker 2333*03f9172cSAndroid Build Coastguard Worker /** 2334*03f9172cSAndroid Build Coastguard Worker * p2p_group_is_client_connected - Check whether a specific client is connected 2335*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 2336*03f9172cSAndroid Build Coastguard Worker * @addr: P2P Device Address of the client 2337*03f9172cSAndroid Build Coastguard Worker * Returns: 1 if client is connected or 0 if not 2338*03f9172cSAndroid Build Coastguard Worker */ 2339*03f9172cSAndroid Build Coastguard Worker int p2p_group_is_client_connected(struct p2p_group *group, const u8 *dev_addr); 2340*03f9172cSAndroid Build Coastguard Worker 2341*03f9172cSAndroid Build Coastguard Worker /** 2342*03f9172cSAndroid Build Coastguard Worker * p2p_group_get_config - Get the group configuration 2343*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 2344*03f9172cSAndroid Build Coastguard Worker * Returns: The group configuration pointer 2345*03f9172cSAndroid Build Coastguard Worker */ 2346*03f9172cSAndroid Build Coastguard Worker const struct p2p_group_config * p2p_group_get_config(struct p2p_group *group); 2347*03f9172cSAndroid Build Coastguard Worker 2348*03f9172cSAndroid Build Coastguard Worker /** 2349*03f9172cSAndroid Build Coastguard Worker * p2p_loop_on_all_groups - Run the given callback on all groups 2350*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2351*03f9172cSAndroid Build Coastguard Worker * @group_callback: The callback function pointer 2352*03f9172cSAndroid Build Coastguard Worker * @user_data: Some user data pointer which can be %NULL 2353*03f9172cSAndroid Build Coastguard Worker * 2354*03f9172cSAndroid Build Coastguard Worker * The group_callback function can stop the iteration by returning 0. 2355*03f9172cSAndroid Build Coastguard Worker */ 2356*03f9172cSAndroid Build Coastguard Worker void p2p_loop_on_all_groups(struct p2p_data *p2p, 2357*03f9172cSAndroid Build Coastguard Worker int (*group_callback)(struct p2p_group *group, 2358*03f9172cSAndroid Build Coastguard Worker void *user_data), 2359*03f9172cSAndroid Build Coastguard Worker void *user_data); 2360*03f9172cSAndroid Build Coastguard Worker 2361*03f9172cSAndroid Build Coastguard Worker /** 2362*03f9172cSAndroid Build Coastguard Worker * p2p_get_peer_found - Get P2P peer info structure of a found peer 2363*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2364*03f9172cSAndroid Build Coastguard Worker * @addr: P2P Device Address of the peer or %NULL to indicate the first peer 2365*03f9172cSAndroid Build Coastguard Worker * @next: Whether to select the peer entry following the one indicated by addr 2366*03f9172cSAndroid Build Coastguard Worker * Returns: The first P2P peer info available or %NULL if no such peer exists 2367*03f9172cSAndroid Build Coastguard Worker */ 2368*03f9172cSAndroid Build Coastguard Worker const struct p2p_peer_info * 2369*03f9172cSAndroid Build Coastguard Worker p2p_get_peer_found(struct p2p_data *p2p, const u8 *addr, int next); 2370*03f9172cSAndroid Build Coastguard Worker 2371*03f9172cSAndroid Build Coastguard Worker /** 2372*03f9172cSAndroid Build Coastguard Worker * p2p_remove_wps_vendor_extensions - Remove WPS vendor extensions 2373*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2374*03f9172cSAndroid Build Coastguard Worker */ 2375*03f9172cSAndroid Build Coastguard Worker void p2p_remove_wps_vendor_extensions(struct p2p_data *p2p); 2376*03f9172cSAndroid Build Coastguard Worker 2377*03f9172cSAndroid Build Coastguard Worker /** 2378*03f9172cSAndroid Build Coastguard Worker * p2p_add_wps_vendor_extension - Add a WPS vendor extension 2379*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2380*03f9172cSAndroid Build Coastguard Worker * @vendor_ext: The vendor extensions to add 2381*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 2382*03f9172cSAndroid Build Coastguard Worker * 2383*03f9172cSAndroid Build Coastguard Worker * The wpabuf structures in the array are owned by the P2P 2384*03f9172cSAndroid Build Coastguard Worker * module after this call. 2385*03f9172cSAndroid Build Coastguard Worker */ 2386*03f9172cSAndroid Build Coastguard Worker int p2p_add_wps_vendor_extension(struct p2p_data *p2p, 2387*03f9172cSAndroid Build Coastguard Worker const struct wpabuf *vendor_ext); 2388*03f9172cSAndroid Build Coastguard Worker 2389*03f9172cSAndroid Build Coastguard Worker /** 2390*03f9172cSAndroid Build Coastguard Worker * p2p_set_oper_channel - Set the P2P operating channel 2391*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2392*03f9172cSAndroid Build Coastguard Worker * @op_reg_class: Operating regulatory class to set 2393*03f9172cSAndroid Build Coastguard Worker * @op_channel: operating channel to set 2394*03f9172cSAndroid Build Coastguard Worker * @cfg_op_channel : Whether op_channel is hardcoded in configuration 2395*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 2396*03f9172cSAndroid Build Coastguard Worker */ 2397*03f9172cSAndroid Build Coastguard Worker int p2p_set_oper_channel(struct p2p_data *p2p, u8 op_reg_class, u8 op_channel, 2398*03f9172cSAndroid Build Coastguard Worker int cfg_op_channel); 2399*03f9172cSAndroid Build Coastguard Worker 2400*03f9172cSAndroid Build Coastguard Worker /** 2401*03f9172cSAndroid Build Coastguard Worker * p2p_set_pref_chan - Set P2P preferred channel list 2402*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2403*03f9172cSAndroid Build Coastguard Worker * @num_pref_chan: Number of entries in pref_chan list 2404*03f9172cSAndroid Build Coastguard Worker * @pref_chan: Preferred channels or %NULL to remove preferences 2405*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 2406*03f9172cSAndroid Build Coastguard Worker */ 2407*03f9172cSAndroid Build Coastguard Worker int p2p_set_pref_chan(struct p2p_data *p2p, unsigned int num_pref_chan, 2408*03f9172cSAndroid Build Coastguard Worker const struct p2p_channel *pref_chan); 2409*03f9172cSAndroid Build Coastguard Worker 2410*03f9172cSAndroid Build Coastguard Worker /** 2411*03f9172cSAndroid Build Coastguard Worker * p2p_set_no_go_freq - Set no GO channel ranges 2412*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2413*03f9172cSAndroid Build Coastguard Worker * @list: Channel ranges or %NULL to remove restriction 2414*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 on failure 2415*03f9172cSAndroid Build Coastguard Worker */ 2416*03f9172cSAndroid Build Coastguard Worker int p2p_set_no_go_freq(struct p2p_data *p2p, 2417*03f9172cSAndroid Build Coastguard Worker const struct wpa_freq_range_list *list); 2418*03f9172cSAndroid Build Coastguard Worker 2419*03f9172cSAndroid Build Coastguard Worker /** 2420*03f9172cSAndroid Build Coastguard Worker * p2p_in_progress - Check whether a P2P operation is progress 2421*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2422*03f9172cSAndroid Build Coastguard Worker * Returns: 0 if P2P module is idle, 1 if an operation is in progress but not 2423*03f9172cSAndroid Build Coastguard Worker * in search state, or 2 if search state operation is in progress 2424*03f9172cSAndroid Build Coastguard Worker */ 2425*03f9172cSAndroid Build Coastguard Worker int p2p_in_progress(struct p2p_data *p2p); 2426*03f9172cSAndroid Build Coastguard Worker 2427*03f9172cSAndroid Build Coastguard Worker const char * p2p_wps_method_text(enum p2p_wps_method method); 2428*03f9172cSAndroid Build Coastguard Worker 2429*03f9172cSAndroid Build Coastguard Worker /** 2430*03f9172cSAndroid Build Coastguard Worker * p2p_set_config_timeout - Set local config timeouts 2431*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2432*03f9172cSAndroid Build Coastguard Worker * @go_timeout: Time in 10 ms units it takes to start the GO mode 2433*03f9172cSAndroid Build Coastguard Worker * @client_timeout: Time in 10 ms units it takes to start the client mode 2434*03f9172cSAndroid Build Coastguard Worker */ 2435*03f9172cSAndroid Build Coastguard Worker void p2p_set_config_timeout(struct p2p_data *p2p, u8 go_timeout, 2436*03f9172cSAndroid Build Coastguard Worker u8 client_timeout); 2437*03f9172cSAndroid Build Coastguard Worker 2438*03f9172cSAndroid Build Coastguard Worker int p2p_set_wfd_ie_beacon(struct p2p_data *p2p, struct wpabuf *ie); 2439*03f9172cSAndroid Build Coastguard Worker int p2p_set_wfd_ie_probe_req(struct p2p_data *p2p, struct wpabuf *ie); 2440*03f9172cSAndroid Build Coastguard Worker int p2p_set_wfd_ie_probe_resp(struct p2p_data *p2p, struct wpabuf *ie); 2441*03f9172cSAndroid Build Coastguard Worker int p2p_set_wfd_ie_assoc_req(struct p2p_data *p2p, struct wpabuf *ie); 2442*03f9172cSAndroid Build Coastguard Worker int p2p_set_wfd_ie_invitation(struct p2p_data *p2p, struct wpabuf *ie); 2443*03f9172cSAndroid Build Coastguard Worker int p2p_set_wfd_ie_prov_disc_req(struct p2p_data *p2p, struct wpabuf *ie); 2444*03f9172cSAndroid Build Coastguard Worker int p2p_set_wfd_ie_prov_disc_resp(struct p2p_data *p2p, struct wpabuf *ie); 2445*03f9172cSAndroid Build Coastguard Worker int p2p_set_wfd_ie_go_neg(struct p2p_data *p2p, struct wpabuf *ie); 2446*03f9172cSAndroid Build Coastguard Worker int p2p_set_wfd_dev_info(struct p2p_data *p2p, const struct wpabuf *elem); 2447*03f9172cSAndroid Build Coastguard Worker int p2p_set_wfd_r2_dev_info(struct p2p_data *p2p, const struct wpabuf *elem); 2448*03f9172cSAndroid Build Coastguard Worker int p2p_set_wfd_assoc_bssid(struct p2p_data *p2p, const struct wpabuf *elem); 2449*03f9172cSAndroid Build Coastguard Worker int p2p_set_wfd_coupled_sink_info(struct p2p_data *p2p, 2450*03f9172cSAndroid Build Coastguard Worker const struct wpabuf *elem); 2451*03f9172cSAndroid Build Coastguard Worker struct wpabuf * wifi_display_encaps(struct wpabuf *subelems); 2452*03f9172cSAndroid Build Coastguard Worker 2453*03f9172cSAndroid Build Coastguard Worker /** 2454*03f9172cSAndroid Build Coastguard Worker * p2p_set_disc_int - Set min/max discoverable interval for p2p_find 2455*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2456*03f9172cSAndroid Build Coastguard Worker * @min_disc_int: minDiscoverableInterval (in units of 100 TU); default 1 2457*03f9172cSAndroid Build Coastguard Worker * @max_disc_int: maxDiscoverableInterval (in units of 100 TU); default 3 2458*03f9172cSAndroid Build Coastguard Worker * @max_disc_tu: Maximum number of TUs (1.024 ms) for discoverable interval; or 2459*03f9172cSAndroid Build Coastguard Worker * -1 not to limit 2460*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, or -1 on failure 2461*03f9172cSAndroid Build Coastguard Worker * 2462*03f9172cSAndroid Build Coastguard Worker * This function can be used to configure minDiscoverableInterval and 2463*03f9172cSAndroid Build Coastguard Worker * maxDiscoverableInterval parameters for the Listen state during device 2464*03f9172cSAndroid Build Coastguard Worker * discovery (p2p_find). A random number of 100 TU units is picked for each 2465*03f9172cSAndroid Build Coastguard Worker * Listen state iteration from [min_disc_int,max_disc_int] range. 2466*03f9172cSAndroid Build Coastguard Worker * 2467*03f9172cSAndroid Build Coastguard Worker * max_disc_tu can be used to further limit the discoverable duration. However, 2468*03f9172cSAndroid Build Coastguard Worker * it should be noted that use of this parameter is not recommended since it 2469*03f9172cSAndroid Build Coastguard Worker * would not be compliant with the P2P specification. 2470*03f9172cSAndroid Build Coastguard Worker */ 2471*03f9172cSAndroid Build Coastguard Worker int p2p_set_disc_int(struct p2p_data *p2p, int min_disc_int, int max_disc_int, 2472*03f9172cSAndroid Build Coastguard Worker int max_disc_tu); 2473*03f9172cSAndroid Build Coastguard Worker 2474*03f9172cSAndroid Build Coastguard Worker /** 2475*03f9172cSAndroid Build Coastguard Worker * p2p_get_state_txt - Get current P2P state for debug purposes 2476*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2477*03f9172cSAndroid Build Coastguard Worker * Returns: Name of the current P2P module state 2478*03f9172cSAndroid Build Coastguard Worker * 2479*03f9172cSAndroid Build Coastguard Worker * It should be noted that the P2P module state names are internal information 2480*03f9172cSAndroid Build Coastguard Worker * and subject to change at any point, i.e., this information should be used 2481*03f9172cSAndroid Build Coastguard Worker * mainly for debugging purposes. 2482*03f9172cSAndroid Build Coastguard Worker */ 2483*03f9172cSAndroid Build Coastguard Worker const char * p2p_get_state_txt(struct p2p_data *p2p); 2484*03f9172cSAndroid Build Coastguard Worker 2485*03f9172cSAndroid Build Coastguard Worker struct wpabuf * p2p_build_nfc_handover_req(struct p2p_data *p2p, 2486*03f9172cSAndroid Build Coastguard Worker int client_freq, 2487*03f9172cSAndroid Build Coastguard Worker const u8 *go_dev_addr, 2488*03f9172cSAndroid Build Coastguard Worker const u8 *ssid, size_t ssid_len); 2489*03f9172cSAndroid Build Coastguard Worker struct wpabuf * p2p_build_nfc_handover_sel(struct p2p_data *p2p, 2490*03f9172cSAndroid Build Coastguard Worker int client_freq, 2491*03f9172cSAndroid Build Coastguard Worker const u8 *go_dev_addr, 2492*03f9172cSAndroid Build Coastguard Worker const u8 *ssid, size_t ssid_len); 2493*03f9172cSAndroid Build Coastguard Worker 2494*03f9172cSAndroid Build Coastguard Worker bool p2p_pref_freq_allowed(const struct weighted_pcl *freq_list, bool go); 2495*03f9172cSAndroid Build Coastguard Worker 2496*03f9172cSAndroid Build Coastguard Worker struct p2p_nfc_params { 2497*03f9172cSAndroid Build Coastguard Worker int sel; 2498*03f9172cSAndroid Build Coastguard Worker const u8 *wsc_attr; 2499*03f9172cSAndroid Build Coastguard Worker size_t wsc_len; 2500*03f9172cSAndroid Build Coastguard Worker const u8 *p2p_attr; 2501*03f9172cSAndroid Build Coastguard Worker size_t p2p_len; 2502*03f9172cSAndroid Build Coastguard Worker 2503*03f9172cSAndroid Build Coastguard Worker enum { 2504*03f9172cSAndroid Build Coastguard Worker NO_ACTION, JOIN_GROUP, AUTH_JOIN, INIT_GO_NEG, RESP_GO_NEG, 2505*03f9172cSAndroid Build Coastguard Worker BOTH_GO, PEER_CLIENT 2506*03f9172cSAndroid Build Coastguard Worker } next_step; 2507*03f9172cSAndroid Build Coastguard Worker struct p2p_peer_info *peer; 2508*03f9172cSAndroid Build Coastguard Worker u8 oob_dev_pw[WPS_OOB_PUBKEY_HASH_LEN + 2 + 2509*03f9172cSAndroid Build Coastguard Worker WPS_OOB_DEVICE_PASSWORD_LEN]; 2510*03f9172cSAndroid Build Coastguard Worker size_t oob_dev_pw_len; 2511*03f9172cSAndroid Build Coastguard Worker int go_freq; 2512*03f9172cSAndroid Build Coastguard Worker u8 go_dev_addr[ETH_ALEN]; 2513*03f9172cSAndroid Build Coastguard Worker u8 go_ssid[SSID_MAX_LEN]; 2514*03f9172cSAndroid Build Coastguard Worker size_t go_ssid_len; 2515*03f9172cSAndroid Build Coastguard Worker }; 2516*03f9172cSAndroid Build Coastguard Worker 2517*03f9172cSAndroid Build Coastguard Worker int p2p_process_nfc_connection_handover(struct p2p_data *p2p, 2518*03f9172cSAndroid Build Coastguard Worker struct p2p_nfc_params *params); 2519*03f9172cSAndroid Build Coastguard Worker 2520*03f9172cSAndroid Build Coastguard Worker void p2p_set_authorized_oob_dev_pw_id(struct p2p_data *p2p, u16 dev_pw_id, 2521*03f9172cSAndroid Build Coastguard Worker int go_intent, 2522*03f9172cSAndroid Build Coastguard Worker const u8 *own_interface_addr); 2523*03f9172cSAndroid Build Coastguard Worker 2524*03f9172cSAndroid Build Coastguard Worker int p2p_set_passphrase_len(struct p2p_data *p2p, unsigned int len); 2525*03f9172cSAndroid Build Coastguard Worker 2526*03f9172cSAndroid Build Coastguard Worker void p2p_loop_on_known_peers(struct p2p_data *p2p, 2527*03f9172cSAndroid Build Coastguard Worker void (*peer_callback)(struct p2p_peer_info *peer, 2528*03f9172cSAndroid Build Coastguard Worker void *user_data), 2529*03f9172cSAndroid Build Coastguard Worker void *user_data); 2530*03f9172cSAndroid Build Coastguard Worker 2531*03f9172cSAndroid Build Coastguard Worker void p2p_set_vendor_elems(struct p2p_data *p2p, struct wpabuf **vendor_elem); 2532*03f9172cSAndroid Build Coastguard Worker 2533*03f9172cSAndroid Build Coastguard Worker void p2p_set_intended_addr(struct p2p_data *p2p, const u8 *intended_addr); 2534*03f9172cSAndroid Build Coastguard Worker 2535*03f9172cSAndroid Build Coastguard Worker struct p2ps_advertisement * 2536*03f9172cSAndroid Build Coastguard Worker p2p_service_p2ps_id(struct p2p_data *p2p, u32 adv_id); 2537*03f9172cSAndroid Build Coastguard Worker int p2p_service_add_asp(struct p2p_data *p2p, int auto_accept, u32 adv_id, 2538*03f9172cSAndroid Build Coastguard Worker const char *adv_str, u8 svc_state, 2539*03f9172cSAndroid Build Coastguard Worker u16 config_methods, const char *svc_info, 2540*03f9172cSAndroid Build Coastguard Worker const u8 *cpt_priority); 2541*03f9172cSAndroid Build Coastguard Worker int p2p_service_del_asp(struct p2p_data *p2p, u32 adv_id); 2542*03f9172cSAndroid Build Coastguard Worker void p2p_service_flush_asp(struct p2p_data *p2p); 2543*03f9172cSAndroid Build Coastguard Worker struct p2ps_advertisement * p2p_get_p2ps_adv_list(struct p2p_data *p2p); 2544*03f9172cSAndroid Build Coastguard Worker 2545*03f9172cSAndroid Build Coastguard Worker /** 2546*03f9172cSAndroid Build Coastguard Worker * p2p_expire_peers - Periodic cleanup function to expire peers 2547*03f9172cSAndroid Build Coastguard Worker * @p2p: P2P module context from p2p_init() 2548*03f9172cSAndroid Build Coastguard Worker * 2549*03f9172cSAndroid Build Coastguard Worker * This is a cleanup function that the entity calling p2p_init() is 2550*03f9172cSAndroid Build Coastguard Worker * expected to call periodically to clean up expired peer entries. 2551*03f9172cSAndroid Build Coastguard Worker */ 2552*03f9172cSAndroid Build Coastguard Worker void p2p_expire_peers(struct p2p_data *p2p); 2553*03f9172cSAndroid Build Coastguard Worker 2554*03f9172cSAndroid Build Coastguard Worker void p2p_set_own_pref_freq_list(struct p2p_data *p2p, 2555*03f9172cSAndroid Build Coastguard Worker const struct weighted_pcl *pref_freq_list, 2556*03f9172cSAndroid Build Coastguard Worker unsigned int size); 2557*03f9172cSAndroid Build Coastguard Worker void p2p_set_override_pref_op_chan(struct p2p_data *p2p, u8 op_class, 2558*03f9172cSAndroid Build Coastguard Worker u8 chan); 2559*03f9172cSAndroid Build Coastguard Worker 2560*03f9172cSAndroid Build Coastguard Worker /** 2561*03f9172cSAndroid Build Coastguard Worker * p2p_group_get_common_freqs - Get the group common frequencies 2562*03f9172cSAndroid Build Coastguard Worker * @group: P2P group context from p2p_group_init() 2563*03f9172cSAndroid Build Coastguard Worker * @common_freqs: On return will hold the group common frequencies 2564*03f9172cSAndroid Build Coastguard Worker * @num: On return will hold the number of group common frequencies 2565*03f9172cSAndroid Build Coastguard Worker * Returns: 0 on success, -1 otherwise 2566*03f9172cSAndroid Build Coastguard Worker */ 2567*03f9172cSAndroid Build Coastguard Worker int p2p_group_get_common_freqs(struct p2p_group *group, int *common_freqs, 2568*03f9172cSAndroid Build Coastguard Worker unsigned int *num); 2569*03f9172cSAndroid Build Coastguard Worker 2570*03f9172cSAndroid Build Coastguard Worker struct wpabuf * p2p_build_probe_resp_template(struct p2p_data *p2p, 2571*03f9172cSAndroid Build Coastguard Worker unsigned int freq); 2572*03f9172cSAndroid Build Coastguard Worker 2573*03f9172cSAndroid Build Coastguard Worker void p2p_set_6ghz_dev_capab(struct p2p_data *p2p, bool allow_6ghz); 2574*03f9172cSAndroid Build Coastguard Worker bool is_p2p_6ghz_capable(struct p2p_data *p2p); 2575*03f9172cSAndroid Build Coastguard Worker bool p2p_is_peer_6ghz_capab(struct p2p_data *p2p, const u8 *addr); 2576*03f9172cSAndroid Build Coastguard Worker bool p2p_peer_wfd_enabled(struct p2p_data *p2p, const u8 *peer_addr); 2577*03f9172cSAndroid Build Coastguard Worker bool p2p_wfd_enabled(struct p2p_data *p2p); 2578*03f9172cSAndroid Build Coastguard Worker bool is_p2p_allow_6ghz(struct p2p_data *p2p); 2579*03f9172cSAndroid Build Coastguard Worker void set_p2p_allow_6ghz(struct p2p_data *p2p, bool value); 2580*03f9172cSAndroid Build Coastguard Worker int p2p_remove_6ghz_channels(struct weighted_pcl *pref_freq_list, int size); 2581*03f9172cSAndroid Build Coastguard Worker int p2p_channel_to_freq(int op_class, int channel); 2582*03f9172cSAndroid Build Coastguard Worker struct wpabuf * p2p_usd_elems(struct p2p_data *p2p); 2583*03f9172cSAndroid Build Coastguard Worker void p2p_process_usd_elems(struct p2p_data *p2p, const u8 *ies, u16 ies_len, 2584*03f9172cSAndroid Build Coastguard Worker const u8 *peer_addr, unsigned int freq); 2585*03f9172cSAndroid Build Coastguard Worker 2586*03f9172cSAndroid Build Coastguard Worker #endif /* P2P_H */ 2587