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