18d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* 28d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Wi-Fi Direct - P2P module 38d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Copyright (c) 2009-2010, Atheros Communications 48d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * This software may be distributed under the terms of the BSD license. 6c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * See README for more details. 78d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 88d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 98d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifndef P2P_H 108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_H 118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 129d9e60286e05ae45025b672636490bd12586138dDmitry Shmidt#include "common/ieee802_11_defs.h" 139d9e60286e05ae45025b672636490bd12586138dDmitry Shmidt#include "wps/wps.h" 14cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt 15216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt/* P2P ASP Setup Capability */ 16216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt#define P2PS_SETUP_NONE 0 17216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt#define P2PS_SETUP_NEW BIT(0) 18216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt#define P2PS_SETUP_CLIENT BIT(1) 19216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt#define P2PS_SETUP_GROUP_OWNER BIT(2) 20216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 21216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt#define P2PS_WILD_HASH_STR "org.wi-fi.wfds" 22216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt#define P2PS_HASH_LEN 6 23216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt#define P2P_MAX_QUERY_HASH 6 24216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * P2P_MAX_REG_CLASSES - Maximum number of regulatory classes 278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_MAX_REG_CLASSES 10 298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * P2P_MAX_REG_CLASS_CHANNELS - Maximum number of channels per regulatory class 328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_MAX_REG_CLASS_CHANNELS 20 348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_channels - List of supported channels 378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_channels { 398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_reg_class - Supported regulatory class 418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct p2p_reg_class { 438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * reg_class - Regulatory class (IEEE 802.11-2007, Annex J) 458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 reg_class; 478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * channel - Supported channels 508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 channel[P2P_MAX_REG_CLASS_CHANNELS]; 528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * channels - Number of channel entries in use 558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t channels; 578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } reg_class[P2P_MAX_REG_CLASSES]; 588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * reg_classes - Number of reg_class entries in use 618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t reg_classes; 638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_wps_method { 66216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt WPS_NOT_READY, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC, WPS_NFC, 67216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt WPS_P2PS 688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_go_neg_results - P2P Group Owner Negotiation results 728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_go_neg_results { 748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * status - Negotiation result (Status Code) 768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 0 (P2P_SC_SUCCESS) indicates success. Non-zero values indicate 788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * failed negotiation. 798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int status; 818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * role_go - Whether local end is Group Owner 848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int role_go; 868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * freq - Frequency of the group operational channel in MHz 898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int freq; 918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9261d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt int ht40; 9361d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt 9468d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt int vht; 9568d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt 968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ssid - SSID of the group 988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 999d9e60286e05ae45025b672636490bd12586138dDmitry Shmidt u8 ssid[SSID_MAX_LEN]; 1008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ssid_len - Length of SSID in octets 1038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t ssid_len; 1058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 107d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * psk - WPA pre-shared key (256 bits) (GO only) 108d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt */ 109d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt u8 psk[32]; 110d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt 111d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt /** 112d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * psk_set - Whether PSK field is configured (GO only) 113d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt */ 114d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt int psk_set; 115d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt 116d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt /** 1178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * passphrase - WPA2-Personal passphrase for the group (GO only) 1188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char passphrase[64]; 1208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * peer_device_addr - P2P Device Address of the peer 1238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 peer_device_addr[ETH_ALEN]; 1258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * peer_interface_addr - P2P Interface Address of the peer 1288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 peer_interface_addr[ETH_ALEN]; 1308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wps_method - WPS method to be used during provisioning 1338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_wps_method wps_method; 1358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_MAX_CHANNELS 50 1378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * freq_list - Zero-terminated list of possible operational channels 1408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int freq_list[P2P_MAX_CHANNELS]; 1428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * persistent_group - Whether the group should be made persistent 1451f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 0 = not persistent 1461f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 1 = persistent group without persistent reconnect 1471f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 2 = persistent group with persistent reconnect 1488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int persistent_group; 1508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 1528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * peer_config_timeout - Peer configuration timeout (in 10 msec units) 1538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int peer_config_timeout; 1558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 1568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 157216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidtstruct p2ps_provision { 158216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 159216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * status - Remote returned provisioning status code 160216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 161216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt int status; 162216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 163216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 164216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * adv_id - P2PS Advertisement ID 165216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 166216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u32 adv_id; 167216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 168216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 169216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * session_id - P2PS Session ID 170216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 171216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u32 session_id; 172216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 173216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 174216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * method - WPS Method (to be) used to establish session 175216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 176216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u16 method; 177216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 178216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 179216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * conncap - Connection Capabilities negotiated between P2P peers 180216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 181216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u8 conncap; 182216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 183216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 184216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * role - Info about the roles to be used for this connection 185216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 186216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u8 role; 187216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 188216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 189216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * session_mac - MAC address of the peer that started the session 190216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 191216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u8 session_mac[ETH_ALEN]; 192216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 193216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 194216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * adv_mac - MAC address of the peer advertised the service 195216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 196216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u8 adv_mac[ETH_ALEN]; 197216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 198216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 199216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * info - Vendor defined extra Provisioning information 200216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 201216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt char info[0]; 202216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt}; 203216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 204216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidtstruct p2ps_advertisement { 205216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt struct p2ps_advertisement *next; 206216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 207216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 208216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * svc_info - Pointer to (internal) Service defined information 209216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 210216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt char *svc_info; 211216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 212216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 213216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * id - P2PS Advertisement ID 214216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 215216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u32 id; 216216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 217216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 218216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * config_methods - WPS Methods which are allowed for this service 219216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 220216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u16 config_methods; 221216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 222216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 223216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * state - Current state of the service: 0 - Out Of Service, 1-255 Vendor defined 224216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 225216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u8 state; 226216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 227216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 228216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * auto_accept - Automatically Accept provisioning request if possible. 229216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 230216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u8 auto_accept; 231216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 232216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 233216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * hash - 6 octet Service Name has to match against incoming Probe Requests 234216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 235216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u8 hash[P2PS_HASH_LEN]; 236216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 237216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 238216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * svc_name - NULL Terminated UTF-8 Service Name, and svc_info storage 239216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 240216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt char svc_name[0]; 241216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt}; 242216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 243216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 2448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_data; 2458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_scan_type { 2478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SCAN_SOCIAL, 2488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SCAN_FULL, 249203eadb9eda41a1dde4a583edb4684319e3f399eDmitry Shmidt P2P_SCAN_SPECIFIC, 2508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SCAN_SOCIAL_PLUS_ONE 2518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 2528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_MAX_WPS_VENDOR_EXT 10 2548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 2568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_peer_info - P2P peer information 2578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_peer_info { 2598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_device_addr - P2P Device Address of the peer 2618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 p2p_device_addr[ETH_ALEN]; 2638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * pri_dev_type - Primary Device Type 2668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 pri_dev_type[8]; 2688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * device_name - Device Name (0..32 octets encoded in UTF-8) 2718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2729d9e60286e05ae45025b672636490bd12586138dDmitry Shmidt char device_name[WPS_DEV_NAME_MAX_LEN + 1]; 2738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * manufacturer - Manufacturer (0..64 octets encoded in UTF-8) 2768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2779d9e60286e05ae45025b672636490bd12586138dDmitry Shmidt char manufacturer[WPS_MANUFACTURER_MAX_LEN + 1]; 2788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * model_name - Model Name (0..32 octets encoded in UTF-8) 2818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2829d9e60286e05ae45025b672636490bd12586138dDmitry Shmidt char model_name[WPS_MODEL_NAME_MAX_LEN + 1]; 2838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * model_number - Model Number (0..32 octets encoded in UTF-8) 2868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2879d9e60286e05ae45025b672636490bd12586138dDmitry Shmidt char model_number[WPS_MODEL_NUMBER_MAX_LEN + 1]; 2888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 2908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * serial_number - Serial Number (0..32 octets encoded in UTF-8) 2918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2929d9e60286e05ae45025b672636490bd12586138dDmitry Shmidt char serial_number[WPS_SERIAL_NUMBER_MAX_LEN + 1]; 2938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 29575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * level - Signal level 29675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 29775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int level; 29875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 29975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /** 3008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * config_methods - WPS Configuration Methods 3018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u16 config_methods; 3038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_capab - Device Capabilities 3068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 dev_capab; 3088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * group_capab - Group Capabilities 3118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 group_capab; 3138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wps_sec_dev_type_list - WPS secondary device type list 3168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This list includes from 0 to 16 Secondary Device Types as indicated 3188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * by wps_sec_dev_type_list_len (8 * number of types). 3198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3209d9e60286e05ae45025b672636490bd12586138dDmitry Shmidt u8 wps_sec_dev_type_list[WPS_SEC_DEV_TYPE_MAX_LEN]; 3218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wps_sec_dev_type_list_len - Length of secondary device type list 3248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t wps_sec_dev_type_list_len; 3268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT]; 32861d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt 32961d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt /** 33061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt * wfd_subelems - Wi-Fi Display subelements from WFD IE(s) 33161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt */ 33261d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt struct wpabuf *wfd_subelems; 3332e67f06149ff649fb6f8782bad041d3d9124685eDmitry Shmidt 3342e67f06149ff649fb6f8782bad041d3d9124685eDmitry Shmidt /** 3352e67f06149ff649fb6f8782bad041d3d9124685eDmitry Shmidt * vendor_elems - Unrecognized vendor elements 3362e67f06149ff649fb6f8782bad041d3d9124685eDmitry Shmidt * 3372e67f06149ff649fb6f8782bad041d3d9124685eDmitry Shmidt * This buffer includes any other vendor element than P2P, WPS, and WFD 3382e67f06149ff649fb6f8782bad041d3d9124685eDmitry Shmidt * IE(s) from the frame that was used to discover the peer. 3392e67f06149ff649fb6f8782bad041d3d9124685eDmitry Shmidt */ 3402e67f06149ff649fb6f8782bad041d3d9124685eDmitry Shmidt struct wpabuf *vendor_elems; 341216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 342216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 343216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * p2ps_instance - P2PS Application Service Info 344216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 345216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt struct wpabuf *p2ps_instance; 3468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 3478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 34875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenenum p2p_prov_disc_status { 34975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen P2P_PROV_DISC_SUCCESS, 35075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen P2P_PROV_DISC_TIMEOUT, 35175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen P2P_PROV_DISC_REJECTED, 352d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt P2P_PROV_DISC_TIMEOUT_JOIN, 353216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt P2P_PROV_DISC_INFO_UNAVAILABLE, 35475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 35575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 35604949598a23f501be6eec21697465fd46a28840aDmitry Shmidtstruct p2p_channel { 35704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt u8 op_class; 35804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt u8 chan; 35904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt}; 36004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 3618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 3628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_config - P2P configuration 3638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This configuration is provided to the P2P module during initialization with 3658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_init(). 3668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_config { 3688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * country - Country code to use in P2P operations 3708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char country[3]; 3728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * reg_class - Regulatory class for own listen channel 3758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 reg_class; 3778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * channel - Own listen channel 3808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 channel; 3828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 38443cb578dfe2c492257636f6234a24178ed27789eDmitry Shmidt * channel_forced - the listen channel was forced by configuration 38543cb578dfe2c492257636f6234a24178ed27789eDmitry Shmidt * or by control interface and cannot be overridden 38643cb578dfe2c492257636f6234a24178ed27789eDmitry Shmidt */ 38743cb578dfe2c492257636f6234a24178ed27789eDmitry Shmidt u8 channel_forced; 38843cb578dfe2c492257636f6234a24178ed27789eDmitry Shmidt 38943cb578dfe2c492257636f6234a24178ed27789eDmitry Shmidt /** 3908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Regulatory class for own operational channel 3918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 op_reg_class; 3938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 3958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * op_channel - Own operational channel 3968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 op_channel; 3988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * cfg_op_channel - Whether op_channel is hardcoded in configuration 4018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 cfg_op_channel; 4038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * channels - Own supported regulatory classes and channels 4068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * List of supposerted channels per regulatory class. The regulatory 4088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * classes are defined in IEEE Std 802.11-2007 Annex J and the 4098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * numbering of the clases depends on the configured country code. 4108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct p2p_channels channels; 4128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 41468d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * cli_channels - Additional client channels 41568d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * 41668d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * This list of channels (if any) will be used when advertising local 41768d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * channels during GO Negotiation or Invitation for the cases where the 41868d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * local end may become the client. This may allow the peer to become a 41968d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * GO on additional channels if it supports these options. The main use 42068d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * case for this is to include passive-scan channels on devices that may 42168d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * not know their current location and have configured most channels to 42268d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * not allow initiation of radition (i.e., another device needs to take 42368d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * master responsibilities). 42468d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt */ 42568d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt struct p2p_channels cli_channels; 42668d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt 42768d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt /** 42804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * num_pref_chan - Number of pref_chan entries 42904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 43004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt unsigned int num_pref_chan; 43104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 43204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt /** 43304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * pref_chan - Preferred channels for GO Negotiation 43404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 43504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt struct p2p_channel *pref_chan; 43604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 43704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt /** 4388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * pri_dev_type - Primary Device Type (see WPS) 4398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 pri_dev_type[8]; 4418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * P2P_SEC_DEVICE_TYPES - Maximum number of secondary device types 4448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_SEC_DEVICE_TYPES 5 4468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * sec_dev_type - Optional secondary device types 4498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 sec_dev_type[P2P_SEC_DEVICE_TYPES][8]; 4518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * num_sec_dev_types - Number of sec_dev_type entries 4548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t num_sec_dev_types; 4568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_addr - P2P Device Address 4598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 dev_addr[ETH_ALEN]; 4618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_name - Device Name 4648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *dev_name; 4668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *manufacturer; 4688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *model_name; 4698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *model_number; 4708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *serial_number; 4718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 uuid[16]; 4738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u16 config_methods; 4748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * concurrent_operations - Whether concurrent operations are supported 4778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int concurrent_operations; 4798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * max_peers - Maximum number of discovered peers to remember 4828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * If more peers are discovered, older entries will be removed to make 4848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * room for the new ones. 4858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t max_peers; 4878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_intra_bss - Intra BSS communication is supported 4908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int p2p_intra_bss; 4928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 4948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ssid_postfix - Postfix data to add to the SSID 4958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This data will be added to the end of the SSID after the 4978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * DIRECT-<random two octets> prefix. 4988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4999d9e60286e05ae45025b672636490bd12586138dDmitry Shmidt u8 ssid_postfix[SSID_MAX_LEN - 9]; 5008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ssid_postfix_len - Length of the ssid_postfix data 5038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t ssid_postfix_len; 5058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 506d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt /** 507d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * max_listen - Maximum listen duration in ms 508d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt */ 509d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt unsigned int max_listen; 510d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt 5118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5122271d3fdd5982d0e5e81cf9999a861bba933eacbDmitry Shmidt * passphrase_len - Passphrase length (8..63) 5132271d3fdd5982d0e5e81cf9999a861bba933eacbDmitry Shmidt * 5142271d3fdd5982d0e5e81cf9999a861bba933eacbDmitry Shmidt * This parameter controls the length of the random passphrase that is 5152271d3fdd5982d0e5e81cf9999a861bba933eacbDmitry Shmidt * generated at the GO. 5162271d3fdd5982d0e5e81cf9999a861bba933eacbDmitry Shmidt */ 5172271d3fdd5982d0e5e81cf9999a861bba933eacbDmitry Shmidt unsigned int passphrase_len; 5182271d3fdd5982d0e5e81cf9999a861bba933eacbDmitry Shmidt 5192271d3fdd5982d0e5e81cf9999a861bba933eacbDmitry Shmidt /** 520b6e9aaf735990dc64cdb6efccc03d076768eabf3Dmitry Shmidt * cb_ctx - Context to use with callback functions 5218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 522b6e9aaf735990dc64cdb6efccc03d076768eabf3Dmitry Shmidt void *cb_ctx; 5238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 525b6e9aaf735990dc64cdb6efccc03d076768eabf3Dmitry Shmidt * debug_print - Debug print 526b6e9aaf735990dc64cdb6efccc03d076768eabf3Dmitry Shmidt * @ctx: Callback context from cb_ctx 527b6e9aaf735990dc64cdb6efccc03d076768eabf3Dmitry Shmidt * @level: Debug verbosity level (MSG_*) 528b6e9aaf735990dc64cdb6efccc03d076768eabf3Dmitry Shmidt * @msg: Debug message 5298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 530b6e9aaf735990dc64cdb6efccc03d076768eabf3Dmitry Shmidt void (*debug_print)(void *ctx, int level, const char *msg); 5318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Callbacks to request lower layer driver operations */ 5348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan - Request a P2P scan/search 5378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @type: Scan type 5398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Specific frequency (MHz) to scan or 0 for no restriction 5408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @num_req_dev_types: Number of requested device types 5418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @req_dev_types: Array containing requested device types 542c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_id: Device ID to search for or %NULL to find all devices 54304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @pw_id: Device Password ID 5448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 5458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback function is used to request a P2P scan or search 5478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * operation to be completed. Type type argument specifies which type 5488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * of scan is to be done. @P2P_SCAN_SOCIAL indicates that only the 5498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * social channels (1, 6, 11) should be scanned. @P2P_SCAN_FULL 550203eadb9eda41a1dde4a583edb4684319e3f399eDmitry Shmidt * indicates that all channels are to be scanned. @P2P_SCAN_SPECIFIC 551203eadb9eda41a1dde4a583edb4684319e3f399eDmitry Shmidt * request a scan of a single channel specified by freq. 5528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @P2P_SCAN_SOCIAL_PLUS_ONE request scan of all the social channels 5538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * plus one extra channel specified by freq. 5548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The full scan is used for the initial scan to find group owners from 5568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * all. The other types are used during search phase scan of the social 5578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * channels (with potential variation if the Listen channel of the 5588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * target peer is known or if other channels are scanned in steps). 5598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The scan results are returned after this call by calling 5618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_res_handler() for each scan result that has a P2P IE and 5628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * then calling p2p_scan_res_handled() to indicate that all scan 5638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * results have been indicated. 5648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int (*p2p_scan)(void *ctx, enum p2p_scan_type type, int freq, 5668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int num_req_dev_types, 56704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt const u8 *req_dev_types, const u8 *dev_id, u16 pw_id); 5688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * send_probe_resp - Transmit a Probe Response frame 5718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Probe Response frame (including the header and body) 573a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * @freq: Forced frequency (in MHz) to use or 0. 5748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 5758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to reply to Probe Request frames that were 5778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * indicated with a call to p2p_probe_req_rx(). The response is to be 578a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * sent on the same channel, unless otherwise specified, or to be 579a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * dropped if the driver is not listening to Probe Request frames 580a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * anymore. 5818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Alternatively, the responsibility for building the Probe Response 5838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * frames in Listen state may be in another system component in which 5848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * case this function need to be implemented (i.e., the function 5858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * pointer can be %NULL). The WPS and P2P IEs to be added for Probe 5868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Response frames in such a case are available from the 5878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * start_listen() callback. It should be noted that the received Probe 5888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Request frames must be indicated by calling p2p_probe_req_rx() even 5898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * if this send_probe_resp() is not used. 5908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 591a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt int (*send_probe_resp)(void *ctx, const struct wpabuf *buf, 592a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt unsigned int freq); 5938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 5958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * send_action - Transmit an Action frame 5968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 5978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency in MHz for the channel on which to transmit 5988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dst: Destination MAC address (Address 1) 5998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @src: Source MAC address (Address 2) 6008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: BSSID (Address 3) 6018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Frame body (starting from Category field) 6028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @len: Length of buf in octets 6038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wait_time: How many msec to wait for a response frame 6048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 6058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The Action frame may not be transmitted immediately and the status 6078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * of the transmission must be reported by calling 6088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_send_action_cb() once the frame has either been transmitted or 6098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * it has been dropped due to excessive retries or other failure to 6108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * transmit. 6118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int (*send_action)(void *ctx, unsigned int freq, const u8 *dst, 6138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *src, const u8 *bssid, const u8 *buf, 6148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t len, unsigned int wait_time); 6158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 6178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * send_action_done - Notify that Action frame sequence was completed 6188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 6198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is called when the Action frame sequence that was 6218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * started with send_action() has been completed, i.e., when there is 6228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * no need to wait for a response from the destination peer anymore. 6238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*send_action_done)(void *ctx); 6258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 6278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * start_listen - Start Listen state 6288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 6298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency of the listen channel in MHz 6308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @duration: Duration for the Listen state in milliseconds 6318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @probe_resp_ie: IE(s) to be added to Probe Response frames 6328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 6338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This Listen state may not start immediately since the driver may 6358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * have other pending operations to complete first. Once the Listen 6368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * state has started, p2p_listen_cb() must be called to notify the P2P 6378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * module. Once the Listen state is stopped, p2p_listen_end() must be 6388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * called to notify the P2P module that the driver is not in the Listen 6398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * state anymore. 6408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * If the send_probe_resp() is not used for generating the response, 6428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the IEs from probe_resp_ie need to be added to the end of the Probe 6438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Response frame body. If send_probe_resp() is used, the probe_resp_ie 6448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * information can be ignored. 6458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int (*start_listen)(void *ctx, unsigned int freq, 6478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int duration, 6488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const struct wpabuf *probe_resp_ie); 6498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 6508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * stop_listen - Stop Listen state 6518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 6528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback can be used to stop a Listen state operation that was 6548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * previously requested with start_listen(). 6558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*stop_listen)(void *ctx); 6578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 6598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * get_noa - Get current Notice of Absence attribute payload 6608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 6618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @interface_addr: P2P Interface Address of the GO 6628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for returning NoA 6638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf_len: Buffer length in octets 6648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets used in buf, 0 to indicate no NoA is being 6658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * advertized, or -1 on failure 6668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to fetch the current Notice of Absence 6688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * attribute value from GO. 6698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int (*get_noa)(void *ctx, const u8 *interface_addr, u8 *buf, 6718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t buf_len); 6728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Callbacks to notify events to upper layer management entity */ 6748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 6768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_found - Notification of a found P2P Device 6778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 6788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: Source address of the message triggering this notification 6798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @info: P2P peer information 6808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @new_device: Inform if the peer is newly found 6818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to notify that a new P2P Device has been 6838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * found. This may happen, e.g., during Search state based on scan 6848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * results or during Listen state based on receive Probe Request and 6858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Group Owner Negotiation Request. 6868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*dev_found)(void *ctx, const u8 *addr, 6888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const struct p2p_peer_info *info, 6898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int new_device); 6908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 6928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dev_lost - Notification of a lost P2P Device 6938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 6948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_addr: P2P Device Address of the lost P2P Device 6958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to notify that a P2P Device has been deleted. 6978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*dev_lost)(void *ctx, const u8 *dev_addr); 6998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 701b6e9aaf735990dc64cdb6efccc03d076768eabf3Dmitry Shmidt * find_stopped - Notification of a p2p_find operation stopping 702b6e9aaf735990dc64cdb6efccc03d076768eabf3Dmitry Shmidt * @ctx: Callback context from cb_ctx 703b6e9aaf735990dc64cdb6efccc03d076768eabf3Dmitry Shmidt */ 704b6e9aaf735990dc64cdb6efccc03d076768eabf3Dmitry Shmidt void (*find_stopped)(void *ctx); 705b6e9aaf735990dc64cdb6efccc03d076768eabf3Dmitry Shmidt 706b6e9aaf735990dc64cdb6efccc03d076768eabf3Dmitry Shmidt /** 7078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * go_neg_req_rx - Notification of a receive GO Negotiation Request 7088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 7098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @src: Source address of the message triggering this notification 7108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_passwd_id: WPS Device Password ID 7117a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt * @go_intent: Peer's GO Intent 7128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to notify that a P2P Device is requesting 7148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * group owner negotiation with us, but we do not have all the 7158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * necessary information to start GO Negotiation. This indicates that 7168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the local user has not authorized the connection yet by providing a 7178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * PIN or PBC button press. This information can be provided with a 7188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * call to p2p_connect(). 7198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7207a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt void (*go_neg_req_rx)(void *ctx, const u8 *src, u16 dev_passwd_id, 7217a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt u8 go_intent); 7228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 7248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * go_neg_completed - Notification of GO Negotiation results 7258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 7268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @res: GO Negotiation results 7278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to notify that Group Owner Negotiation has 7298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * been completed. Non-zero struct p2p_go_neg_results::status indicates 7308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * failed negotiation. In case of success, this function is responsible 7318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * for creating a new group interface (or using the existing interface 7328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * depending on driver features), setting up the group interface in 7338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * proper mode based on struct p2p_go_neg_results::role_go and 7348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * initializing WPS provisioning either as a Registrar (if GO) or as an 7358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Enrollee. Successful WPS provisioning must be indicated by calling 7368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_wps_success_cb(). The callee is responsible for timing out group 7378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * formation if WPS provisioning cannot be completed successfully 7388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * within 15 seconds. 7398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*go_neg_completed)(void *ctx, struct p2p_go_neg_results *res); 7418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 7438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * sd_request - Callback on Service Discovery Request 7448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 7458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency (in MHz) of the channel 7468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the request 7478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dialog_token: Dialog token 7488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @update_indic: Service Update Indicator from the source of request 7498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs: P2P Service Request TLV(s) 7508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs_len: Length of tlvs buffer in octets 7518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate reception of a service discovery 7538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * request. Response to the query must be indicated by calling 7548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_response() with the context information from the arguments to 7558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * this callback function. 7568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback handler can be set to %NULL to indicate that service 7588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * discovery is not supported. 7598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*sd_request)(void *ctx, int freq, const u8 *sa, u8 dialog_token, 7618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u16 update_indic, const u8 *tlvs, size_t tlvs_len); 7628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 7648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * sd_response - Callback on Service Discovery Response 7658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 7668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the request 7678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @update_indic: Service Update Indicator from the source of response 7688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs: P2P Service Response TLV(s) 7698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs_len: Length of tlvs buffer in octets 7708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate reception of a service discovery 7728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * response. This callback handler can be set to %NULL if no service 7738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * discovery requests are used. The information provided with this call 7748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * is replies to the queries scheduled with p2p_sd_request(). 7758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*sd_response)(void *ctx, const u8 *sa, u16 update_indic, 7778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *tlvs, size_t tlvs_len); 7788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 7808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * prov_disc_req - Callback on Provisiong Discovery Request 7818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 7828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer: Source address of the request 7838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @config_methods: Requested WPS Config Method 7848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_addr: P2P Device Address of the found P2P Device 7858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @pri_dev_type: Primary Device Type 7868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_name: Device Name 7878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @supp_config_methods: Supported configuration Methods 7888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dev_capab: Device Capabilities 7898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group_capab: Group Capabilities 7901f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @group_id: P2P Group ID (or %NULL if not included) 7911f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @group_id_len: Length of P2P Group ID 7928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate reception of a Provision Discovery 7948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Request frame that the P2P module accepted. 7958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*prov_disc_req)(void *ctx, const u8 *peer, u16 config_methods, 7978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *dev_addr, const u8 *pri_dev_type, 7988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *dev_name, u16 supp_config_methods, 7991f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt u8 dev_capab, u8 group_capab, 8001f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt const u8 *group_id, size_t group_id_len); 8018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 8038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * prov_disc_resp - Callback on Provisiong Discovery Response 8048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 8058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer: Source address of the response 8068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @config_methods: Value from p2p_prov_disc_req() or 0 on failure 8078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 8088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate reception of a Provision Discovery 8098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Response frame for a pending request scheduled with 8108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_prov_disc_req(). This callback handler can be set to %NULL if 8118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * provision discovery is not used. 8128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*prov_disc_resp)(void *ctx, const u8 *peer, u16 config_methods); 8148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 81675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * prov_disc_fail - Callback on Provision Discovery failure 81775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @ctx: Callback context from cb_ctx 81875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @peer: Source address of the response 81975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @status: Cause of failure, will not be %P2P_PROV_DISC_SUCCESS 820216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @adv_id: If non-zero, then the adv_id of the PD Request 821216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @adv_mac: P2P Device Address of the advertizer 822216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @deferred_session_resp: Deferred session response sent by advertizer 82375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 82475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * This callback is used to indicate either a failure or no response 82575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * to an earlier provision discovery request. 82675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 82775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * This callback handler can be set to %NULL if provision discovery 82875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * is not used or failures do not need to be indicated. 82975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 83075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen void (*prov_disc_fail)(void *ctx, const u8 *peer, 831216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt enum p2p_prov_disc_status status, 832216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u32 adv_id, const u8 *adv_mac, 833216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt const char *deferred_session_resp); 83475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 83575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /** 8368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_process - Optional callback for processing Invitations 8378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 8388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the Invitation Request 8398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: P2P Group BSSID from the request or %NULL if not included 8408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_dev_addr: GO Device Address from P2P Group ID 8418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid: SSID from P2P Group ID 8428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid_len: Length of ssid buffer in octets 8438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go: Variable for returning whether the local end is GO in the group 8448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group_bssid: Buffer for returning P2P Group BSSID (if local end GO) 8458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @force_freq: Variable for returning forced frequency for the group 8468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @persistent_group: Whether this is an invitation to reinvoke a 8478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * persistent group (instead of invitation to join an active 8488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * group) 849f7e0a9905988e62e4f70fed8b795722abeab719bDmitry Shmidt * @channels: Available operating channels for the group 850cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt * @dev_pw_id: Device Password ID for NFC static handover or -1 if not 851cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt * used 8528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Status code (P2P_SC_*) 8538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 8548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This optional callback can be used to implement persistent reconnect 8558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * by allowing automatic restarting of persistent groups without user 8568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * interaction. If this callback is not implemented (i.e., is %NULL), 8578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the received Invitation Request frames are replied with 8588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * %P2P_SC_REQ_RECEIVED status and indicated to upper layer with the 8598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_result() callback. 8608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 8618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * If the requested parameters are acceptable and the group is known, 8628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * %P2P_SC_SUCCESS may be returned. If the requested group is unknown, 8638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * %P2P_SC_FAIL_UNKNOWN_GROUP should be returned. %P2P_SC_REQ_RECEIVED 8648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * can be returned if there is not enough data to provide immediate 8658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * response, i.e., if some sort of user interaction is needed. The 8668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_received() callback will be called in that case 8678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * immediately after this call. 8688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 (*invitation_process)(void *ctx, const u8 *sa, const u8 *bssid, 8708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *go_dev_addr, const u8 *ssid, 8718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t ssid_len, int *go, u8 *group_bssid, 872f7e0a9905988e62e4f70fed8b795722abeab719bDmitry Shmidt int *force_freq, int persistent_group, 873cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt const struct p2p_channels *channels, 874cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt int dev_pw_id); 8758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 8778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_received - Callback on Invitation Request RX 8788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 8798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the Invitation Request 8808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: P2P Group BSSID or %NULL if not received 8818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid: SSID of the group 8828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid_len: Length of ssid in octets 8838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_dev_addr: GO Device Address 8848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @status: Response Status 8858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @op_freq: Operational frequency for the group 8868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 8878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate sending of an Invitation Response 8888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * for a received Invitation Request. If status == 0 (success), the 8898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * upper layer code is responsible for starting the group. status == 1 8908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * indicates need to get user authorization for the group. Other status 8918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * values indicate that the invitation request was rejected. 8928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 8938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*invitation_received)(void *ctx, const u8 *sa, const u8 *bssid, 8948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *ssid, size_t ssid_len, 8958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *go_dev_addr, u8 status, 8968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int op_freq); 8978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 8988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 8998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * invitation_result - Callback on Invitation result 9008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 9018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @status: Negotiation result (Status Code) 9028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: P2P Group BSSID or %NULL if not received 9037a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidt * @channels: Available operating channels for the group 904700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * @addr: Peer address 905e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt * @freq: Frequency (in MHz) indicated during invitation or 0 90615907098d1f67c24bb000e593e279af173cf57d7Dmitry Shmidt * @peer_oper_freq: Operating frequency (in MHz) advertized by the peer 90715907098d1f67c24bb000e593e279af173cf57d7Dmitry Shmidt * during invitation or 0 9088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 9098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This callback is used to indicate result of an Invitation procedure 9108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * started with a call to p2p_invite(). The indicated status code is 9118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the value received from the peer in Invitation Response with 0 9128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * (P2P_SC_SUCCESS) indicating success or -1 to indicate a timeout or a 9138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * local failure in transmitting the Invitation Request. 9148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 9157a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidt void (*invitation_result)(void *ctx, int status, const u8 *bssid, 916700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt const struct p2p_channels *channels, 91715907098d1f67c24bb000e593e279af173cf57d7Dmitry Shmidt const u8 *addr, int freq, int peer_oper_freq); 918c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt 919c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt /** 920c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * go_connected - Check whether we are connected to a GO 921c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @ctx: Callback context from cb_ctx 922c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_addr: P2P Device Address of a GO 923c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * Returns: 1 if we are connected as a P2P client to the specified GO 924c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * or 0 if not. 925c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt */ 926c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt int (*go_connected)(void *ctx, const u8 *dev_addr); 927fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt 928fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt /** 929fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt * presence_resp - Callback on Presence Response 930fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt * @ctx: Callback context from cb_ctx 931fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt * @src: Source address (GO's P2P Interface Address) 932fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt * @status: Result of the request (P2P_SC_*) 933fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt * @noa: Returned NoA value 934fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt * @noa_len: Length of the NoA buffer in octets 935fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt */ 936fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt void (*presence_resp)(void *ctx, const u8 *src, u8 status, 937fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt const u8 *noa, size_t noa_len); 9381846323989242844f0e857458a8939fa5836429cDmitry Shmidt 9391846323989242844f0e857458a8939fa5836429cDmitry Shmidt /** 9401846323989242844f0e857458a8939fa5836429cDmitry Shmidt * is_concurrent_session_active - Check whether concurrent session is 9411846323989242844f0e857458a8939fa5836429cDmitry Shmidt * active on other virtual interfaces 9421846323989242844f0e857458a8939fa5836429cDmitry Shmidt * @ctx: Callback context from cb_ctx 9431846323989242844f0e857458a8939fa5836429cDmitry Shmidt * Returns: 1 if concurrent session is active on other virtual interface 9441846323989242844f0e857458a8939fa5836429cDmitry Shmidt * or 0 if not. 9451846323989242844f0e857458a8939fa5836429cDmitry Shmidt */ 9461846323989242844f0e857458a8939fa5836429cDmitry Shmidt int (*is_concurrent_session_active)(void *ctx); 9475a1480c7c46c4236d93bfd303dde32062bee04acDmitry Shmidt 9485a1480c7c46c4236d93bfd303dde32062bee04acDmitry Shmidt /** 9495a1480c7c46c4236d93bfd303dde32062bee04acDmitry Shmidt * is_p2p_in_progress - Check whether P2P operation is in progress 9505a1480c7c46c4236d93bfd303dde32062bee04acDmitry Shmidt * @ctx: Callback context from cb_ctx 9515a1480c7c46c4236d93bfd303dde32062bee04acDmitry Shmidt * Returns: 1 if P2P operation (e.g., group formation) is in progress 9525a1480c7c46c4236d93bfd303dde32062bee04acDmitry Shmidt * or 0 if not. 9535a1480c7c46c4236d93bfd303dde32062bee04acDmitry Shmidt */ 9545a1480c7c46c4236d93bfd303dde32062bee04acDmitry Shmidt int (*is_p2p_in_progress)(void *ctx); 955216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 956216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 957216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * Determine if we have a persistent group we share with remote peer 958216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @ctx: Callback context from cb_ctx 959216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @addr: Peer device address to search for 960216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @ssid: Persistent group SSID or %NULL if any 961216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @ssid_len: Length of @ssid 962216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @go_dev_addr: Buffer for returning intended GO P2P Device Address 963216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @ret_ssid: Buffer for returning group SSID 964216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @ret_ssid_len: Buffer for returning length of @ssid 965216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * Returns: 1 if a matching persistent group was found, 0 otherwise 966216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 967216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt int (*get_persistent_group)(void *ctx, const u8 *addr, const u8 *ssid, 968216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt size_t ssid_len, u8 *go_dev_addr, 969216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u8 *ret_ssid, size_t *ret_ssid_len); 970216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 971216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 972216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * Get information about a possible local GO role 973216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @ctx: Callback context from cb_ctx 974216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @intended_addr: Buffer for returning intended GO interface address 975216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @ssid: Buffer for returning group SSID 976216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @ssid_len: Buffer for returning length of @ssid 977216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @group_iface: Buffer for returning whether a separate group interface 978216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * would be used 979216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * Returns: 1 if GO info found, 0 otherwise 980216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * 981216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * This is used to compose New Group settings (SSID, and intended 982216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * address) during P2PS provisioning if results of provisioning *might* 983216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * result in our being an autonomous GO. 984216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 985216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt int (*get_go_info)(void *ctx, u8 *intended_addr, 986216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u8 *ssid, size_t *ssid_len, int *group_iface); 987216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 988216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 989216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * remove_stale_groups - Remove stale P2PS groups 990216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * 991216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * Because P2PS stages *potential* GOs, and remote devices can remove 992216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * credentials unilaterally, we need to make sure we don't let stale 993216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * unusable groups build up. 994216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 995216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt int (*remove_stale_groups)(void *ctx, const u8 *peer, const u8 *go, 996216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt const u8 *ssid, size_t ssid_len); 997216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 998216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 999216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * p2ps_prov_complete - P2PS provisioning complete 1000216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * 1001216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * When P2PS provisioning completes (successfully or not) we must 1002216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * transmit all of the results to the upper layers. 1003216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 1004216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt void (*p2ps_prov_complete)(void *ctx, u8 status, const u8 *dev, 1005216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt const u8 *adv_mac, const u8 *ses_mac, 1006216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt const u8 *grp_mac, u32 adv_id, u32 ses_id, 1007216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u8 conncap, int passwd_id, 1008216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt const u8 *persist_ssid, 1009216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt size_t persist_ssid_size, int response_done, 1010216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt int prov_start, const char *session_info); 1011216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 1012216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 1013216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * prov_disc_resp_cb - Callback for indicating completion of PD Response 1014216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @ctx: Callback context from cb_ctx 1015216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * Returns: 1 if operation was started, 0 otherwise 1016216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * 1017216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * This callback can be used to perform any pending actions after 1018216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * provisioning. It is mainly used for P2PS pending group creation. 1019216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 1020216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt int (*prov_disc_resp_cb)(void *ctx); 1021216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 1022216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt /** 1023216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * p2ps_group_capability - Determine group capability 1024216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * 1025216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * This function can be used to determine group capability based on 1026216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * information from P2PS PD exchange and the current state of ongoing 1027216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * groups and driver capabilities. 1028216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * 1029216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * P2PS_SETUP_* bitmap is used as the parameters and return value. 1030216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 1031216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u8 (*p2ps_group_capability)(void *ctx, u8 incoming, u8 role); 10328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 10338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* P2P module initialization/deinitialization */ 10368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_init - Initialize P2P module 10398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @cfg: P2P module configuration 10408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Pointer to private data or %NULL on failure 10418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 10428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to initialize global P2P module context (one per 10438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * device). The P2P module will keep a copy of the configuration data, so the 10448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * caller does not need to maintain this structure. However, the callback 10458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * functions and the context parameters to them must be kept available until 10468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the P2P module is deinitialized with p2p_deinit(). 10478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_data * p2p_init(const struct p2p_config *cfg); 10498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_deinit - Deinitialize P2P module 10528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_deinit(struct p2p_data *p2p); 10558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_flush - Flush P2P module state 10588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 10608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This command removes the P2P module state like peer device entries. 10618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_flush(struct p2p_data *p2p); 10638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_unauthorize - Unauthorize the specified peer device 10668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: P2P peer entry to be unauthorized 10688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 10698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 10708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This command removes any connection authorization from the specified P2P 10718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * peer device address. This can be used, e.g., to cancel effect of a previous 10728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_authorize() or p2p_connect() call that has not yet resulted in completed 10738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * GO Negotiation. 10748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_unauthorize(struct p2p_data *p2p, const u8 *addr); 10768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_dev_name - Set device name 10798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 10818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 10828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to update the P2P module configuration with 10838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * information that was not available at the time of the p2p_init() call. 10848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 10858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_dev_name(struct p2p_data *p2p, const char *dev_name); 10868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_manufacturer(struct p2p_data *p2p, const char *manufacturer); 10888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_model_name(struct p2p_data *p2p, const char *model_name); 10898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_model_number(struct p2p_data *p2p, const char *model_number); 10908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_serial_number(struct p2p_data *p2p, const char *serial_number); 10918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_config_methods(struct p2p_data *p2p, u16 config_methods); 10938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_uuid(struct p2p_data *p2p, const u8 *uuid); 10948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 10958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 10968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_pri_dev_type - Set primary device type 10978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 10988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 10998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 11008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to update the P2P module configuration with 11018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * information that was not available at the time of the p2p_init() call. 11028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 11038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_pri_dev_type(struct p2p_data *p2p, const u8 *pri_dev_type); 11048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 11068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_sec_dev_types - Set secondary device types 11078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 11098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 11108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to update the P2P module configuration with 11118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * information that was not available at the time of the p2p_init() call. 11128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 11138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_sec_dev_types(struct p2p_data *p2p, const u8 dev_types[][8], 11148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t num_dev_types); 11158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_country(struct p2p_data *p2p, const char *country); 11178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Commands from upper layer management entity */ 11208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_discovery_type { 11228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_FIND_START_WITH_FULL, 11238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_FIND_ONLY_SOCIAL, 11248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_FIND_PROGRESSIVE 11258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 11268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 11288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_find - Start P2P Find (Device Discovery) 11298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @timeout: Timeout for find operation in seconds or 0 for no timeout 11318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @type: Device Discovery type 11328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @num_req_dev_types: Number of requested device types 11338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @req_dev_types: Requested device types array, must be an array 11348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * containing num_req_dev_types * WPS_DEV_TYPE_LEN bytes; %NULL if no 11358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * requested device types. 1136c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_id: Device ID to search for or %NULL to find all devices 113761d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt * @search_delay: Extra delay in milliseconds between search iterations 1138216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @seek_count: Number of ASP Service Strings in the seek_string array 1139216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @seek_string: ASP Service Strings to query for in Probe Requests 1140203eadb9eda41a1dde4a583edb4684319e3f399eDmitry Shmidt * @freq: Requested first scan frequency (in MHz) to modify type == 1141203eadb9eda41a1dde4a583edb4684319e3f399eDmitry Shmidt * P2P_FIND_START_WITH_FULL behavior. 0 = Use normal full scan. 1142203eadb9eda41a1dde4a583edb4684319e3f399eDmitry Shmidt * If p2p_find is already in progress, this parameter is ignored and full 1143203eadb9eda41a1dde4a583edb4684319e3f399eDmitry Shmidt * scan will be executed. 11448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 11458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 11468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_find(struct p2p_data *p2p, unsigned int timeout, 11478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_discovery_type type, 1148c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt unsigned int num_req_dev_types, const u8 *req_dev_types, 1149216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt const u8 *dev_id, unsigned int search_delay, 1150203eadb9eda41a1dde4a583edb4684319e3f399eDmitry Shmidt u8 seek_count, const char **seek_string, int freq); 11518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 11536c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt * p2p_notify_scan_trigger_status - Indicate scan trigger status 11546c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt * @p2p: P2P module context from p2p_init() 11556c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt * @status: 0 on success, -1 on failure 11566c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt */ 11576c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidtvoid p2p_notify_scan_trigger_status(struct p2p_data *p2p, int status); 11586c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt 11596c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt/** 11608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_stop_find - Stop P2P Find (Device Discovery) 11618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 11638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_stop_find(struct p2p_data *p2p); 11648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 11668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_stop_find_for_freq - Stop P2P Find for next oper on specific freq 11678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency in MHz for next operation 11698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 11708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This is like p2p_stop_find(), but Listen state is not stopped if we are 11718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * already on the same frequency. 11728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 11738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_stop_find_for_freq(struct p2p_data *p2p, int freq); 11748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 11768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_listen - Start P2P Listen state for specified duration 11778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @timeout: Listen state duration in milliseconds 11798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 11808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 11818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to request the P2P module to keep the device 11828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * discoverable on the listen channel for an extended set of time. At least in 11838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * its current form, this is mainly used for testing purposes and may not be of 11848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * much use for normal P2P operations. 11858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 11868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_listen(struct p2p_data *p2p, unsigned int timeout); 11878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1189391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt * p2p_stop_listen - Stop P2P Listen 1190391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt * @p2p: P2P module context from p2p_init() 1191391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt */ 1192391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidtvoid p2p_stop_listen(struct p2p_data *p2p); 1193391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt 1194391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt/** 11958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_connect - Start P2P group formation (GO negotiation) 11968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 11978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer_addr: MAC address of the peer P2P client 11988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wps_method: WPS method to be used in provisioning 11998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_intent: Local GO intent value (1..15) 12008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @own_interface_addr: Intended interface address to use with the group 12018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @force_freq: The only allowed channel frequency in MHz or 0 12021f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @persistent_group: Whether to create a persistent group (0 = no, 1 = 12031f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * persistent group without persistent reconnect, 2 = persistent group with 12041f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * persistent reconnect) 120504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @force_ssid: Forced SSID for the group if we become GO or %NULL to generate 120604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * a new SSID 120704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @force_ssid_len: Length of $force_ssid buffer 120804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @pd_before_go_neg: Whether to send Provision Discovery prior to GO 120904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * Negotiation as an interoperability workaround when initiating group 121004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * formation 1211d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * @pref_freq: Preferred operating frequency in MHz or 0 (this is only used if 1212d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * force_freq == 0) 12138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 12148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_connect(struct p2p_data *p2p, const u8 *peer_addr, 12168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_wps_method wps_method, 12178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int go_intent, const u8 *own_interface_addr, 121804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt unsigned int force_freq, int persistent_group, 121904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt const u8 *force_ssid, size_t force_ssid_len, 1220cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt int pd_before_go_neg, unsigned int pref_freq, u16 oob_pw_id); 12218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_authorize - Authorize P2P group formation (GO negotiation) 12248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 12258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer_addr: MAC address of the peer P2P client 12268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wps_method: WPS method to be used in provisioning 12278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_intent: Local GO intent value (1..15) 12288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @own_interface_addr: Intended interface address to use with the group 12298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @force_freq: The only allowed channel frequency in MHz or 0 12301f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @persistent_group: Whether to create a persistent group (0 = no, 1 = 12311f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * persistent group without persistent reconnect, 2 = persistent group with 12321f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * persistent reconnect) 123304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @force_ssid: Forced SSID for the group if we become GO or %NULL to generate 123404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * a new SSID 123504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @force_ssid_len: Length of $force_ssid buffer 1236d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * @pref_freq: Preferred operating frequency in MHz or 0 (this is only used if 1237d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * force_freq == 0) 12388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 12398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 12408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This is like p2p_connect(), but the actual group negotiation is not 12418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * initiated automatically, i.e., the other end is expected to do that. 12428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_authorize(struct p2p_data *p2p, const u8 *peer_addr, 12448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_wps_method wps_method, 12458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int go_intent, const u8 *own_interface_addr, 124604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt unsigned int force_freq, int persistent_group, 1247d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt const u8 *force_ssid, size_t force_ssid_len, 1248cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt unsigned int pref_freq, u16 oob_pw_id); 12498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_reject - Reject peer device (explicitly block connection attempts) 12528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 12538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer_addr: MAC address of the peer P2P client 12548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 12558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_reject(struct p2p_data *p2p, const u8 *peer_addr); 12578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_prov_disc_req - Send Provision Discovery Request 12608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 12618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer_addr: MAC address of the peer P2P client 1262216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @p2ps_prov: Provisioning info for P2PS 12638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @config_methods: WPS Config Methods value (only one bit set) 12648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @join: Whether this is used by a client joining an active group 12651f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @force_freq: Forced TX frequency for the frame (mainly for the join case) 1266d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * @user_initiated_pd: Flag to indicate if initiated by user or not 12678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 12688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 12698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to request a discovered P2P peer to display a PIN 12708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * (config_methods = WPS_CONFIG_DISPLAY) or be prepared to enter a PIN from us 12718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * (config_methods = WPS_CONFIG_KEYPAD). The Provision Discovery Request frame 12728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * is transmitted once immediately and if no response is received, the frame 12738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * will be sent again whenever the target device is discovered during device 12748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * dsicovery (start with a p2p_find() call). Response from the peer is 12758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * indicated with the p2p_config::prov_disc_resp() callback. 12768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr, 1278216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt struct p2ps_provision *p2ps_prov, u16 config_methods, 1279216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt int join, int force_freq, 1280d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt int user_initiated_pd); 12818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_request - Schedule a service discovery query 12848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 12858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dst: Destination peer or %NULL to apply for all peers 12868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tlvs: P2P Service Query TLV(s) 12878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Reference to the query or %NULL on failure 12888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 12898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Response to the query is indicated with the p2p_config::sd_response() 12908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * callback. 12918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 12928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid * p2p_sd_request(struct p2p_data *p2p, const u8 *dst, 12938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const struct wpabuf *tlvs); 12948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 129561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt#ifdef CONFIG_WIFI_DISPLAY 129661d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtvoid * p2p_sd_request_wfd(struct p2p_data *p2p, const u8 *dst, 129761d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt const struct wpabuf *tlvs); 129861d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt#endif /* CONFIG_WIFI_DISPLAY */ 129961d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt 13008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_cancel_request - Cancel a pending service discovery query 13028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 13038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @req: Query reference from p2p_sd_request() 13048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 if request for cancelled; -1 if not found 13058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_sd_cancel_request(struct p2p_data *p2p, void *req); 13078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_response - Send response to a service discovery query 13108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 13118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency from p2p_config::sd_request() callback 13128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dst: Destination address from p2p_config::sd_request() callback 13138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dialog_token: Dialog token from p2p_config::sd_request() callback 13148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @resp_tlvs: P2P Service Response TLV(s) 13158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 13168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is called as a response to the request indicated with 13178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_config::sd_request() callback. 13188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_sd_response(struct p2p_data *p2p, int freq, const u8 *dst, 13208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 dialog_token, const struct wpabuf *resp_tlvs); 13218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_sd_service_update - Indicate a change in local services 13248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 13258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 13268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function needs to be called whenever there is a change in availability 13278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * of the local services. This will increment the Service Update Indicator 13288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * value which will be used in SD Request and Response frames. 13298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_sd_service_update(struct p2p_data *p2p); 13318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_invite_role { 13348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_INVITE_ROLE_GO, 13358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_INVITE_ROLE_ACTIVE_GO, 13368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_INVITE_ROLE_CLIENT 13378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 13388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_invite - Invite a P2P Device into a group 13418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 13428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @peer: Device Address of the peer P2P Device 13438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @role: Local role in the group 13448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: Group BSSID or %NULL if not known 13458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid: Group SSID 13468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid_len: Length of ssid in octets 13478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @force_freq: The only allowed channel frequency in MHz or 0 13488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_dev_addr: Forced GO Device Address or %NULL if none 13498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @persistent_group: Whether this is to reinvoke a persistent group 13507a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidt * @pref_freq: Preferred operating frequency in MHz or 0 (this is only used if 13517a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidt * force_freq == 0) 1352cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt * @dev_pw_id: Device Password ID from OOB Device Password (NFC) static handover 1353cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt * case or -1 if not used 13548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 13558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role, 13578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *bssid, const u8 *ssid, size_t ssid_len, 13588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int force_freq, const u8 *go_dev_addr, 1359cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt int persistent_group, unsigned int pref_freq, int dev_pw_id); 13608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_presence_req - Request GO presence 13638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 13648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @go_interface_addr: GO P2P Interface Address 13658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @own_interface_addr: Own P2P Interface Address for this group 13668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Group operating frequence (in MHz) 13678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @duration1: Preferred presence duration in microseconds 13688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @interval1: Preferred presence interval in microseconds 13698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @duration2: Acceptable presence duration in microseconds 13708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @interval2: Acceptable presence interval in microseconds 13718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 13728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 13738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * If both duration and interval values are zero, the parameter pair is not 13748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * specified (i.e., to remove Presence Request, use duration1 = interval1 = 0). 13758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_presence_req(struct p2p_data *p2p, const u8 *go_interface_addr, 13778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *own_interface_addr, unsigned int freq, 13788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u32 duration1, u32 interval1, u32 duration2, 13798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u32 interval2); 13808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 13828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_ext_listen - Set Extended Listen Timing 13838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 13848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Group operating frequence (in MHz) 13858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @period: Availability period in milliseconds (1-65535; 0 to disable) 13868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @interval: Availability interval in milliseconds (1-65535; 0 to disable) 13878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 13888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 13898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to enable or disable (period = interval = 0) 13908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Extended Listen Timing. When enabled, the P2P Device will become 13918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * discoverable (go into Listen State) every @interval milliseconds for at 13928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * least @period milliseconds. 13938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_ext_listen(struct p2p_data *p2p, unsigned int period, 13958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int interval); 13968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Event notifications from upper layer management operations */ 13988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_wps_success_cb - Report successfully completed WPS provisioning 14018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 14028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @mac_addr: Peer address 14038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 14048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to report successfully completed WPS provisioning 14058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * during group formation in both GO/Registrar and client/Enrollee roles. 14068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_wps_success_cb(struct p2p_data *p2p, const u8 *mac_addr); 14088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_formation_failed - Report failed WPS provisioning 14118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 14128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 14138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to report failed group formation. This can happen 14148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * either due to failed WPS provisioning or due to 15 second timeout during 14158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the provisioning phase. 14168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_group_formation_failed(struct p2p_data *p2p); 14188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14191f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 14201f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_get_provisioning_info - Get any stored provisioning info 14211f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 14221f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @addr: Peer P2P Device Address 14231f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: WPS provisioning information (WPS config method) or 0 if no 14241f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * information is available 14251f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 14261f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * This function is used to retrieve stored WPS provisioning info for the given 14271f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * peer. 14281f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 14291f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtu16 p2p_get_provisioning_info(struct p2p_data *p2p, const u8 *addr); 14301f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 14311f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 14321f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_clear_provisioning_info - Clear any stored provisioning info 14331f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 143404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @iface_addr: Peer P2P Device Address 14351f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 14361f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * This function is used to clear stored WPS provisioning info for the given 14371f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * peer. 14381f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 143904949598a23f501be6eec21697465fd46a28840aDmitry Shmidtvoid p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *addr); 14401f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 14418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Event notifications from lower layer driver operations */ 14438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 144504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * enum p2p_probe_req_status 144604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * 144704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @P2P_PREQ_MALFORMED: frame was not well-formed 144804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @P2P_PREQ_NOT_LISTEN: device isn't in listen state, frame ignored 144904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @P2P_PREQ_NOT_P2P: frame was not a P2P probe request 145004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @P2P_PREQ_P2P_NOT_PROCESSED: frame was P2P but wasn't processed 145104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @P2P_PREQ_P2P_PROCESSED: frame has been processed by P2P 145204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 145304949598a23f501be6eec21697465fd46a28840aDmitry Shmidtenum p2p_probe_req_status { 145404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt P2P_PREQ_MALFORMED, 145504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt P2P_PREQ_NOT_LISTEN, 145604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt P2P_PREQ_NOT_P2P, 145704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt P2P_PREQ_NOT_PROCESSED, 145804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt P2P_PREQ_PROCESSED 145904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt}; 146004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 146104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt/** 14628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_probe_req_rx - Report reception of a Probe Request frame 14638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 14648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: Source MAC address 14651f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @dst: Destination MAC address if available or %NULL 14661f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @bssid: BSSID if available or %NULL 14678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ie: Information elements from the Probe Request frame body 14688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ie_len: Length of ie buffer in octets 1469a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * @rx_freq: Probe Request frame RX frequency 147004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * Returns: value indicating the type and status of the probe request 14718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 147204949598a23f501be6eec21697465fd46a28840aDmitry Shmidtenum p2p_probe_req_status 147304949598a23f501be6eec21697465fd46a28840aDmitry Shmidtp2p_probe_req_rx(struct p2p_data *p2p, const u8 *addr, const u8 *dst, 1474a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt const u8 *bssid, const u8 *ie, size_t ie_len, 1475a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt unsigned int rx_freq); 14768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_rx_action - Report received Action frame 14798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 14808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @da: Destination address of the received Action frame 14818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sa: Source address of the received Action frame 14828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: Address 3 of the received Action frame 14838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @category: Category of the received Action frame 14848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @data: Action frame body after the Category field 14858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @len: Length of the data buffer in octets 14868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency (in MHz) on which the frame was received 14878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 14888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_rx_action(struct p2p_data *p2p, const u8 *da, const u8 *sa, 14898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *bssid, u8 category, 14908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *data, size_t len, int freq); 14918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 14938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_res_handler - Indicate a P2P scan results 14948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 14958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: BSSID of the scan result 14968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Frequency of the channel on which the device was found in MHz 1497f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt * @rx_time: Time when the result was received 14988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @level: Signal level (signal strength of the received Beacon/Probe Response 14998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * frame) 15008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies: Pointer to IEs from the scan result 15018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies_len: Length of the ies buffer 15028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 to continue or 1 to stop scan result indication 15038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 15048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is called to indicate a scan result entry with P2P IE from a 15058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * scan requested with struct p2p_config::p2p_scan(). This can be called during 15068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the actual scan process (i.e., whenever a new device is found) or as a 15078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * sequence of calls after the full scan has been completed. The former option 15088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * can result in optimized operations, but may not be supported by all 15098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * driver/firmware designs. The ies buffer need to include at least the P2P IE, 15108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * but it is recommended to include all IEs received from the device. The 15118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * caller does not need to check that the IEs contain a P2P IE before calling 15128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * this function since frames will be filtered internally if needed. 15138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 15148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function will return 1 if it wants to stop scan result iteration (and 15158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * scan in general if it is still in progress). This is used to allow faster 15168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * start of a pending operation, e.g., to start a pending GO negotiation. 15178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_scan_res_handler(struct p2p_data *p2p, const u8 *bssid, int freq, 1519fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt struct os_reltime *rx_time, int level, const u8 *ies, 1520a54fa5fb807eaeff45464139b5a7759f060cec68Dmitry Shmidt size_t ies_len); 15218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_res_handled - Indicate end of scan results 15248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 15268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is called to indicate that all P2P scan results from a scan 15278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * have been reported with zero or more calls to p2p_scan_res_handler(). This 15288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * function must be called as a response to successful 15298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_config::p2p_scan() call if none of the p2p_scan_res_handler() 15308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * calls stopped iteration. 15318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_scan_res_handled(struct p2p_data *p2p); 15338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum p2p_send_action_result { 15358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SEND_ACTION_SUCCESS /* Frame was send and acknowledged */, 15368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SEND_ACTION_NO_ACK /* Frame was sent, but not acknowledged */, 15378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt P2P_SEND_ACTION_FAILED /* Frame was not sent due to a failure */ 15388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 15398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_send_action_cb - Notify TX status of an Action frame 15428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Channel frequency in MHz 15448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @dst: Destination MAC address (Address 1) 15458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @src: Source MAC address (Address 2) 15468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: BSSID (Address 3) 15478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @result: Result of the transmission attempt 15488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 15498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to indicate the result of an Action frame transmission 15508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * that was requested with struct p2p_config::send_action() callback. 15518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst, 15538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *src, const u8 *bssid, 15548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt enum p2p_send_action_result result); 15558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_listen_cb - Indicate the start of a requested Listen state 15588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Listen channel frequency in MHz 15608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @duration: Duration for the Listen state in milliseconds 15618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 15628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to indicate that a Listen state requested with 15638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_config::start_listen() callback has started. 15648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_listen_cb(struct p2p_data *p2p, unsigned int freq, 15668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int duration); 15678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_listen_end - Indicate the end of a requested Listen state 15708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 15718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Listen channel frequency in MHz 15728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 if no operations were started, 1 if an operation was started 15738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 15748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to indicate that a Listen state requested with 15758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_config::start_listen() callback has ended. 15768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_listen_end(struct p2p_data *p2p, unsigned int freq); 15788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_deauth_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code, 15808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *ie, size_t ie_len); 15818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_disassoc_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code, 15838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *ie, size_t ie_len); 15848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Per-group P2P state for GO */ 15878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_group; 15898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 15908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 15918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct p2p_group_config - P2P group configuration 15928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 15938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This configuration is provided to the P2P module during initialization of 15948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the per-group information with p2p_group_init(). 15958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 15968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_group_config { 15978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 15988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * persistent_group - Whether the group is persistent 15991f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 0 = not a persistent group 16001f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 1 = persistent group without persistent reconnect 16011f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 2 = persistent group with persistent reconnect 16028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int persistent_group; 16048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 16068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * interface_addr - P2P Interface Address of the group 16078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 interface_addr[ETH_ALEN]; 16098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 16118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * max_clients - Maximum number of clients in the group 16128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt unsigned int max_clients; 16148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 161604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * ssid - Group SSID 161704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 16189d9e60286e05ae45025b672636490bd12586138dDmitry Shmidt u8 ssid[SSID_MAX_LEN]; 161904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 162004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt /** 162104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * ssid_len - Length of SSID 162204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 162304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt size_t ssid_len; 162404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 162504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt /** 1626cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt * freq - Operating channel of the group 1627cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt */ 1628cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt int freq; 1629cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt 1630cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt /** 16318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * cb_ctx - Context to use with callback functions 16328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void *cb_ctx; 16348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 16368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ie_update - Notification of IE update 16378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 16388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @beacon_ies: P2P IE for Beacon frames or %NULL if no change 16398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @proberesp_ies: P2P Ie for Probe Response frames 16408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 16418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * P2P module uses this callback function to notify whenever the P2P IE 16428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * in Beacon or Probe Response frames should be updated based on group 16438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * events. 16448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 16458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The callee is responsible for freeing the returned buffer(s) with 16468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpabuf_free(). 16478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*ie_update)(void *ctx, struct wpabuf *beacon_ies, 16498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpabuf *proberesp_ies); 16508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /** 16528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * idle_update - Notification of changes in group idle state 16538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctx: Callback context from cb_ctx 16548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @idle: Whether the group is idle (no associated stations) 16558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt void (*idle_update)(void *ctx, int idle); 16578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 16588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 16608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_init - Initialize P2P group 16618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 16628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @config: P2P group configuration (will be freed by p2p_group_deinit()) 16638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Pointer to private data or %NULL on failure 16648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 16658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to initialize per-group P2P module context. Currently, 16668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * this is only used to manage GO functionality and P2P clients do not need to 16678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * create an instance of this per-group information. 16688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct p2p_group * p2p_group_init(struct p2p_data *p2p, 16708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct p2p_group_config *config); 16718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 16738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_deinit - Deinitialize P2P group 16748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 16758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_group_deinit(struct p2p_group *group); 16778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 16798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_notif_assoc - Notification of P2P client association with GO 16808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 16818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: Interface address of the P2P client 16828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ie: IEs from the (Re)association Request frame 16838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @len: Length of the ie buffer in octets 16848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 16858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_group_notif_assoc(struct p2p_group *group, const u8 *addr, 16878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *ie, size_t len); 16888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 16898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 16908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_assoc_resp_ie - Build P2P IE for (re)association response 16918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 16928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @status: Status value (P2P_SC_SUCCESS if association succeeded) 16938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: P2P IE for (Re)association Response or %NULL on failure 16948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 16958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The caller is responsible for freeing the returned buffer with 16968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpabuf_free(). 16978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 16988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wpabuf * p2p_group_assoc_resp_ie(struct p2p_group *group, u8 status); 16998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 17008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 17018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_notif_disassoc - Notification of P2P client disassociation from GO 17028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 17038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: Interface address of the P2P client 17048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 17058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_group_notif_disassoc(struct p2p_group *group, const u8 *addr); 17068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 17078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 17088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_notif_formation_done - Notification of completed group formation 17098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 17108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 17118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_group_notif_formation_done(struct p2p_group *group); 17128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 17138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 17148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_notif_noa - Notification of NoA change 17158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 17168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @noa: Notice of Absence attribute payload, %NULL if none 17178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @noa_len: Length of noa buffer in octets 17188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 17198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 17208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify the P2P group management about a new NoA contents. This will be 17218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * inserted into the P2P IEs in Beacon and Probe Response frames with rest of 17228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the group information. 17238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 17248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_group_notif_noa(struct p2p_group *group, const u8 *noa, 17258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t noa_len); 17268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 17278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 17288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_match_dev_type - Match device types in group with requested type 17298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 17308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wps: WPS TLVs from Probe Request frame (concatenated WPS IEs) 17318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 1 on match, 0 on mismatch 17328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 17338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to match the Requested Device Type attribute in 17348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * WPS IE with the device types of a group member for deciding whether a GO 17358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * should reply to a Probe Request frame. Match will be reported if the WPS IE 17368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * is not requested any specific device type. 17378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 17388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_group_match_dev_type(struct p2p_group *group, struct wpabuf *wps); 17398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 17408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1741c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * p2p_group_match_dev_id - Match P2P Device Address in group with requested device id 1742c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt */ 1743c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidtint p2p_group_match_dev_id(struct p2p_group *group, struct wpabuf *p2p); 1744c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt 1745c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt/** 17468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_group_go_discover - Send GO Discoverability Request to a group client 17478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 17488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success (frame scheduled); -1 if client was not found 17498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 17508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_group_go_discover(struct p2p_group *group, const u8 *dev_id, 17518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const u8 *searching_dev, int rx_freq); 17528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 17538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 17548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Generic helper functions */ 17558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 17568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 17578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_ie_text - Build text format description of P2P IE 17588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: P2P IE 17598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for returning text 17608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @end: Pointer to the end of the buf area 17618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets written to the buffer or -1 on failure 17628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 17638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to parse P2P IE contents into text format 17648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * field=value lines. 17658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 17668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_ie_text(struct wpabuf *p2p_ie, char *buf, char *end); 17678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 17688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 17698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_result_text - Build text format description of P2P IE 17708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies: Information elements from scan results 17718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies_len: ies buffer length in octets 17728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for returning text 17738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @end: Pointer to the end of the buf area 17748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets written to the buffer or -1 on failure 17758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 17768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to parse P2P IE contents into text format 17778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * field=value lines. 17788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 17798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_scan_result_text(const u8 *ies, size_t ies_len, char *buf, char *end); 17808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 17818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 178204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * p2p_parse_dev_addr_in_p2p_ie - Parse P2P Device Address from a concatenated 178304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * P2P IE 178404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @p2p_ie: P2P IE 178504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @dev_addr: Buffer for returning P2P Device Address 178604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * Returns: 0 on success or -1 if P2P Device Address could not be parsed 178704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 178804949598a23f501be6eec21697465fd46a28840aDmitry Shmidtint p2p_parse_dev_addr_in_p2p_ie(struct wpabuf *p2p_ie, u8 *dev_addr); 178904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 179004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt/** 1791c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * p2p_parse_dev_addr - Parse P2P Device Address from P2P IE(s) 1792c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @ies: Information elements from scan results 1793c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @ies_len: ies buffer length in octets 1794c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_addr: Buffer for returning P2P Device Address 1795c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * Returns: 0 on success or -1 if P2P Device Address could not be parsed 1796c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt */ 1797c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidtint p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr); 1798c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt 1799c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt/** 18008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_assoc_req_ie - Build P2P IE for (Re)Association Request frame 18018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 18028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: BSSID 18038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for writing the P2P IE 18048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @len: Maximum buf length in octets 18058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_group: Whether this is for association with a P2P GO 18068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: Reassembled P2P IE data from scan results or %NULL if none 18078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets written into buf or -1 on failure 18088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 18098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_assoc_req_ie(struct p2p_data *p2p, const u8 *bssid, u8 *buf, 18108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt size_t len, int p2p_group, struct wpabuf *p2p_ie); 18118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 18128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 18138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_scan_ie - Build P2P IE for Probe Request 18148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 18158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ies: Buffer for writing P2P IE 1816c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @dev_id: Device ID to search for or %NULL for any 18178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1818c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidtvoid p2p_scan_ie(struct p2p_data *p2p, struct wpabuf *ies, const u8 *dev_id); 18198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 18208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 18211f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_scan_ie_buf_len - Get maximum buffer length needed for p2p_scan_ie 18221f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 18231f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: Number of octets that p2p_scan_ie() may add to the buffer 18241f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 18251f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtsize_t p2p_scan_ie_buf_len(struct p2p_data *p2p); 18261f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 18271f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 18288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_go_params - Generate random P2P group parameters 18298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 18308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @params: Buffer for parameters 18318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 18328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 18338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_go_params(struct p2p_data *p2p, struct p2p_go_neg_results *params); 18348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 18358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 18368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_group_capab - Get Group Capability from P2P IE data 18378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: P2P IE(s) contents 18388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Group Capability 18398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 18408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtu8 p2p_get_group_capab(const struct wpabuf *p2p_ie); 18418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 18428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 18438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_cross_connect_disallowed - Does WLAN AP disallows cross connection 18448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: P2P IE(s) contents 18458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 if cross connection is allow, 1 if not 18468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 18478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_get_cross_connect_disallowed(const struct wpabuf *p2p_ie); 18488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 18498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 18508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_go_dev_addr - Get P2P Device Address from P2P IE data 18518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p_ie: P2P IE(s) contents 18528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Pointer to P2P Device Address or %NULL if not included 18538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 18548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtconst u8 * p2p_get_go_dev_addr(const struct wpabuf *p2p_ie); 18558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 18568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 18571f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_get_peer_info - Get P2P peer information 18588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 18598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: P2P Device Address of the peer or %NULL to indicate the first peer 18608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @next: Whether to select the peer entry following the one indicated by addr 18611f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: Pointer to peer info or %NULL if not found 18621f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 18631f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtconst struct p2p_peer_info * p2p_get_peer_info(struct p2p_data *p2p, 18641f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt const u8 *addr, int next); 18651f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 18661f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 18671f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_get_peer_info_txt - Get internal P2P peer information in text format 18681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @info: Pointer to P2P peer info from p2p_get_peer_info() 18698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buf: Buffer for returning text 18708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @buflen: Maximum buffer length 18718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of octets written to the buffer or -1 on failure 18721f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 18731f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Note: This information is internal to the P2P module and subject to change. 18741f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * As such, this should not really be used by external programs for purposes 18751f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * other than debugging. 18761f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 18771f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint p2p_get_peer_info_txt(const struct p2p_peer_info *info, 18781f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt char *buf, size_t buflen); 18791f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 18801f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 18811f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_peer_known - Check whether P2P peer is known 18821f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 18831f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @addr: P2P Device Address of the peer 18841f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: 1 if the specified device is in the P2P peer table or 0 if not 18858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 18861f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint p2p_peer_known(struct p2p_data *p2p, const u8 *addr); 18878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 18888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 18898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_client_discoverability - Set client discoverability capability 18908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 18918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @enabled: Whether client discoverability will be enabled 18928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 18938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to disable (and re-enable) client discoverability. 18948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This capability is enabled by default and should not be disabled in normal 18958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * use cases, i.e., this is mainly for testing purposes. 18968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 18978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_client_discoverability(struct p2p_data *p2p, int enabled); 18988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 18998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 19001f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_set_managed_oper - Set managed P2P Device operations capability 19018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 19028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @enabled: Whether managed P2P Device operations will be enabled 19038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 19048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_managed_oper(struct p2p_data *p2p, int enabled); 19058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1906661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt/** 1907661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt * p2p_config_get_random_social - Return a random social channel 1908661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt * @p2p: P2P config 1909661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt * @op_class: Selected operating class 1910661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt * @op_channel: Selected social channel 1911661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt * Returns: 0 on success, -1 on failure 1912661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt * 1913661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt * This function is used before p2p_init is called. A random social channel 1914661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt * from supports bands 2.4 GHz (channels 1,6,11) and 60 GHz (channel 2) is 1915661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt * returned on success. 1916661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt */ 1917661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidtint p2p_config_get_random_social(struct p2p_config *p2p, u8 *op_class, 1918661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt u8 *op_channel); 1919661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt 192043cb578dfe2c492257636f6234a24178ed27789eDmitry Shmidtint p2p_set_listen_channel(struct p2p_data *p2p, u8 reg_class, u8 channel, 192143cb578dfe2c492257636f6234a24178ed27789eDmitry Shmidt u8 forced); 192243cb578dfe2c492257636f6234a24178ed27789eDmitry Shmidt 192343cb578dfe2c492257636f6234a24178ed27789eDmitry Shmidtu8 p2p_get_listen_channel(struct p2p_data *p2p); 19248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 19258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_set_ssid_postfix(struct p2p_data *p2p, const u8 *postfix, size_t len); 19268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 19278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_get_interface_addr(struct p2p_data *p2p, const u8 *dev_addr, 19288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 *iface_addr); 19298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_get_dev_addr(struct p2p_data *p2p, const u8 *iface_addr, 19308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 *dev_addr); 19318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 19328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_peer_filter(struct p2p_data *p2p, const u8 *addr); 19338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 19348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 19358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_cross_connect - Set cross connection capability 19368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 19378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @enabled: Whether cross connection will be enabled 19388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 19398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_cross_connect(struct p2p_data *p2p, int enabled); 19408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 19418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_get_oper_freq(struct p2p_data *p2p, const u8 *iface_addr); 19428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 19438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 19448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_intra_bss_dist - Set intra BSS distribution 19458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 19468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @enabled: Whether intra BSS distribution will be enabled 19478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 19488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_intra_bss_dist(struct p2p_data *p2p, int enabled); 19498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 19507a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidtint p2p_channels_includes_freq(const struct p2p_channels *channels, 19517a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidt unsigned int freq); 19527a5e50a0554bee77a9da492ea3d86f46147f1671Dmitry Shmidt 19536c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidtint p2p_channels_to_freqs(const struct p2p_channels *channels, 19546c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt int *freq_list, unsigned int max_len); 19556c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt 19568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 19578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_supported_freq - Check whether channel is supported for P2P 19588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 19598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: Channel frequency in MHz 19608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 if channel not usable for P2P, 1 if usable for P2P 19618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 19628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_supported_freq(struct p2p_data *p2p, unsigned int freq); 19638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 196444c957860ca714a86357591f39aff0bfa904c743Dmitry Shmidt/** 196568d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * p2p_supported_freq_go - Check whether channel is supported for P2P GO operation 196668d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * @p2p: P2P module context from p2p_init() 196768d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * @freq: Channel frequency in MHz 196868d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * Returns: 0 if channel not usable for P2P, 1 if usable for P2P 196968d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt */ 197068d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidtint p2p_supported_freq_go(struct p2p_data *p2p, unsigned int freq); 197168d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt 197268d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt/** 197368d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * p2p_supported_freq_cli - Check whether channel is supported for P2P client operation 197468d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * @p2p: P2P module context from p2p_init() 197568d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * @freq: Channel frequency in MHz 197668d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * Returns: 0 if channel not usable for P2P, 1 if usable for P2P 197768d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt */ 197868d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidtint p2p_supported_freq_cli(struct p2p_data *p2p, unsigned int freq); 197968d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt 198068d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt/** 198144c957860ca714a86357591f39aff0bfa904c743Dmitry Shmidt * p2p_get_pref_freq - Get channel from preferred channel list 198244c957860ca714a86357591f39aff0bfa904c743Dmitry Shmidt * @p2p: P2P module context from p2p_init() 198344c957860ca714a86357591f39aff0bfa904c743Dmitry Shmidt * @channels: List of channels 198444c957860ca714a86357591f39aff0bfa904c743Dmitry Shmidt * Returns: Preferred channel 198544c957860ca714a86357591f39aff0bfa904c743Dmitry Shmidt */ 198644c957860ca714a86357591f39aff0bfa904c743Dmitry Shmidtunsigned int p2p_get_pref_freq(struct p2p_data *p2p, 198744c957860ca714a86357591f39aff0bfa904c743Dmitry Shmidt const struct p2p_channels *channels); 198844c957860ca714a86357591f39aff0bfa904c743Dmitry Shmidt 198968d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidtvoid p2p_update_channel_list(struct p2p_data *p2p, 199068d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt const struct p2p_channels *chan, 199168d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt const struct p2p_channels *cli_chan); 19928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 19938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 19948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_set_best_channels - Update best channel information 19958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 19968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq_24: Frequency (MHz) of best channel in 2.4 GHz band 19978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq_5: Frequency (MHz) of best channel in 5 GHz band 19988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq_overall: Frequency (MHz) of best channel overall 19998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 20008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_set_best_channels(struct p2p_data *p2p, int freq_24, int freq_5, 20018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int freq_overall); 20028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2003700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt/** 2004700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * p2p_set_own_freq_preference - Set own preference for channel 2005700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * @p2p: P2P module context from p2p_init() 2006700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * @freq: Frequency (MHz) of the preferred channel or 0 if no preference 2007700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * 2008700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * This function can be used to set a preference on the operating channel based 2009700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * on frequencies used on the other virtual interfaces that share the same 2010700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt * radio. If non-zero, this is used to try to avoid multi-channel concurrency. 2011700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt */ 2012700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidtvoid p2p_set_own_freq_preference(struct p2p_data *p2p, int freq); 2013700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt 20148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtconst u8 * p2p_get_go_neg_peer(struct p2p_data *p2p); 20158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 20168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 20178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_group_num_members - Get number of members in group 20188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 20198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Number of members in the group 20208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 20218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtunsigned int p2p_get_group_num_members(struct p2p_group *group); 20228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 20238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 2024216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * p2p_client_limit_reached - Check if client limit is reached 2025216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * @group: P2P group context from p2p_group_init() 2026216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt * Returns: 1 if no of clients limit reached 2027216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt */ 2028216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidtint p2p_client_limit_reached(struct p2p_group *group); 2029216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 2030216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt/** 20318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_iterate_group_members - Iterate group members 20328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @group: P2P group context from p2p_group_init() 20338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @next: iteration pointer, must be a pointer to a void * that is set to %NULL 20348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * on the first call and not modified later 2035d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * Returns: A P2P Device Address for each call and %NULL for no more members 20368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 20378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtconst u8 * p2p_iterate_group_members(struct p2p_group *group, void **next); 20388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 20398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 20401f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_group_get_dev_addr - Get a P2P Device Address of a client in a group 20411f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @group: P2P group context from p2p_group_init() 20421f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @addr: P2P Interface Address of the client 20431f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Returns: P2P Device Address of the client if found or %NULL if no match 20441f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * found 20451f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 20461f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtconst u8 * p2p_group_get_dev_addr(struct p2p_group *group, const u8 *addr); 20471f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 20481f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 2049c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * p2p_group_is_client_connected - Check whether a specific client is connected 2050c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @group: P2P group context from p2p_group_init() 2051c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * @addr: P2P Device Address of the client 2052c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * Returns: 1 if client is connected or 0 if not 2053c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt */ 2054c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidtint p2p_group_is_client_connected(struct p2p_group *group, const u8 *dev_addr); 2055c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt 2056c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt/** 2057d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * p2p_group_get_config - Get the group configuration 2058d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * @group: P2P group context from p2p_group_init() 2059d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * Returns: The group configuration pointer 2060d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt */ 2061d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidtconst struct p2p_group_config * p2p_group_get_config(struct p2p_group *group); 2062d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 2063d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt/** 2064d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * p2p_loop_on_all_groups - Run the given callback on all groups 2065d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * @p2p: P2P module context from p2p_init() 2066d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * @group_callback: The callback function pointer 2067d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * @user_data: Some user data pointer which can be %NULL 2068d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * 2069d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * The group_callback function can stop the iteration by returning 0. 2070d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt */ 2071d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidtvoid p2p_loop_on_all_groups(struct p2p_data *p2p, 2072d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt int (*group_callback)(struct p2p_group *group, 2073d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt void *user_data), 2074d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt void *user_data); 2075d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 2076d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt/** 20778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_get_peer_found - Get P2P peer info structure of a found peer 20788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 20798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @addr: P2P Device Address of the peer or %NULL to indicate the first peer 20808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @next: Whether to select the peer entry following the one indicated by addr 20818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: The first P2P peer info available or %NULL if no such peer exists 20828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 20838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtconst struct p2p_peer_info * 20848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtp2p_get_peer_found(struct p2p_data *p2p, const u8 *addr, int next); 20858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 20868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 20878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_remove_wps_vendor_extensions - Remove WPS vendor extensions 20888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 20898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 20908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid p2p_remove_wps_vendor_extensions(struct p2p_data *p2p); 20918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 20928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 20938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * p2p_add_wps_vendor_extension - Add a WPS vendor extension 20948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @p2p: P2P module context from p2p_init() 20958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @vendor_ext: The vendor extensions to add 20968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 20978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 20988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The wpabuf structures in the array are owned by the P2P 20998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * module after this call. 21008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 21018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint p2p_add_wps_vendor_extension(struct p2p_data *p2p, 21028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const struct wpabuf *vendor_ext); 21038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 210475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 210575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * p2p_set_oper_channel - Set the P2P operating channel 210675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @p2p: P2P module context from p2p_init() 210775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @op_reg_class: Operating regulatory class to set 210875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @op_channel: operating channel to set 210975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @cfg_op_channel : Whether op_channel is hardcoded in configuration 211075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Returns: 0 on success, -1 on failure 211175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 211275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint p2p_set_oper_channel(struct p2p_data *p2p, u8 op_reg_class, u8 op_channel, 211375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int cfg_op_channel); 211475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 21151f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 211604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * p2p_set_pref_chan - Set P2P preferred channel list 211704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @p2p: P2P module context from p2p_init() 211804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @num_pref_chan: Number of entries in pref_chan list 211904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * @pref_chan: Preferred channels or %NULL to remove preferences 212004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * Returns: 0 on success, -1 on failure 212104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 212204949598a23f501be6eec21697465fd46a28840aDmitry Shmidtint p2p_set_pref_chan(struct p2p_data *p2p, unsigned int num_pref_chan, 212304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt const struct p2p_channel *pref_chan); 212404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 212504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt/** 212668d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * p2p_set_no_go_freq - Set no GO channel ranges 212768d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * @p2p: P2P module context from p2p_init() 212868d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * @list: Channel ranges or %NULL to remove restriction 212968d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt * Returns: 0 on success, -1 on failure 213068d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt */ 213168d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidtint p2p_set_no_go_freq(struct p2p_data *p2p, 213268d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt const struct wpa_freq_range_list *list); 213368d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt 213468d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt/** 21351f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * p2p_in_progress - Check whether a P2P operation is progress 21361f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @p2p: P2P module context from p2p_init() 21376c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt * Returns: 0 if P2P module is idle, 1 if an operation is in progress but not 21386c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt * in search state, or 2 if search state operation is in progress 21391f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 21401f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint p2p_in_progress(struct p2p_data *p2p); 21411f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 21421f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtconst char * p2p_wps_method_text(enum p2p_wps_method method); 21431f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 214461d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt/** 214561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt * p2p_set_config_timeout - Set local config timeouts 214661d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt * @p2p: P2P module context from p2p_init() 214761d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt * @go_timeout: Time in 10 ms units it takes to start the GO mode 214861d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt * @client_timeout: Time in 10 ms units it takes to start the client mode 214961d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt */ 215061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtvoid p2p_set_config_timeout(struct p2p_data *p2p, u8 go_timeout, 215161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt u8 client_timeout); 215261d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt 215361d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_beacon(struct p2p_data *p2p, struct wpabuf *ie); 215461d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_probe_req(struct p2p_data *p2p, struct wpabuf *ie); 215561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_probe_resp(struct p2p_data *p2p, struct wpabuf *ie); 215661d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_assoc_req(struct p2p_data *p2p, struct wpabuf *ie); 215761d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_invitation(struct p2p_data *p2p, struct wpabuf *ie); 215861d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_prov_disc_req(struct p2p_data *p2p, struct wpabuf *ie); 215961d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_prov_disc_resp(struct p2p_data *p2p, struct wpabuf *ie); 216061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_ie_go_neg(struct p2p_data *p2p, struct wpabuf *ie); 216161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_dev_info(struct p2p_data *p2p, const struct wpabuf *elem); 216261d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_assoc_bssid(struct p2p_data *p2p, const struct wpabuf *elem); 216361d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint p2p_set_wfd_coupled_sink_info(struct p2p_data *p2p, 216461d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt const struct wpabuf *elem); 216561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtstruct wpabuf * wifi_display_encaps(struct wpabuf *subelems); 216661d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt 2167d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt/** 2168d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * p2p_set_disc_int - Set min/max discoverable interval for p2p_find 2169d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * @p2p: P2P module context from p2p_init() 2170d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * @min_disc_int: minDiscoverableInterval (in units of 100 TU); default 1 2171d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * @max_disc_int: maxDiscoverableInterval (in units of 100 TU); default 3 2172d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * @max_disc_tu: Maximum number of TUs (1.024 ms) for discoverable interval; or 2173d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * -1 not to limit 2174d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * Returns: 0 on success, or -1 on failure 2175d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * 2176d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * This function can be used to configure minDiscoverableInterval and 2177d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * maxDiscoverableInterval parameters for the Listen state during device 2178d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * discovery (p2p_find). A random number of 100 TU units is picked for each 2179d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * Listen state iteration from [min_disc_int,max_disc_int] range. 2180d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * 2181d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * max_disc_tu can be used to futher limit the discoverable duration. However, 2182d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * it should be noted that use of this parameter is not recommended since it 2183d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt * would not be compliant with the P2P specification. 2184d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt */ 2185d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidtint p2p_set_disc_int(struct p2p_data *p2p, int min_disc_int, int max_disc_int, 2186d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt int max_disc_tu); 2187d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt 2188b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt/** 2189b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt * p2p_get_state_txt - Get current P2P state for debug purposes 2190b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt * @p2p: P2P module context from p2p_init() 2191b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt * Returns: Name of the current P2P module state 2192b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt * 2193b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt * It should be noted that the P2P module state names are internal information 2194b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt * and subject to change at any point, i.e., this information should be used 2195b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt * mainly for debugging purposes. 2196b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt */ 2197b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidtconst char * p2p_get_state_txt(struct p2p_data *p2p); 2198b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt 2199cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidtstruct wpabuf * p2p_build_nfc_handover_req(struct p2p_data *p2p, 2200cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt int client_freq, 2201cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt const u8 *go_dev_addr, 2202cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt const u8 *ssid, size_t ssid_len); 2203cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidtstruct wpabuf * p2p_build_nfc_handover_sel(struct p2p_data *p2p, 2204cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt int client_freq, 2205cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt const u8 *go_dev_addr, 2206cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt const u8 *ssid, size_t ssid_len); 2207cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt 2208cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidtstruct p2p_nfc_params { 2209cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt int sel; 2210cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt const u8 *wsc_attr; 2211cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt size_t wsc_len; 2212cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt const u8 *p2p_attr; 2213cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt size_t p2p_len; 2214cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt 2215cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt enum { 2216cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt NO_ACTION, JOIN_GROUP, AUTH_JOIN, INIT_GO_NEG, RESP_GO_NEG, 2217cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt BOTH_GO, PEER_CLIENT 2218cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt } next_step; 2219cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt struct p2p_peer_info *peer; 2220cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt u8 oob_dev_pw[WPS_OOB_PUBKEY_HASH_LEN + 2 + 2221cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt WPS_OOB_DEVICE_PASSWORD_LEN]; 2222cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt size_t oob_dev_pw_len; 2223cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt int go_freq; 2224cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt u8 go_dev_addr[ETH_ALEN]; 22259d9e60286e05ae45025b672636490bd12586138dDmitry Shmidt u8 go_ssid[SSID_MAX_LEN]; 2226cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt size_t go_ssid_len; 2227cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt}; 2228cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt 2229cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidtint p2p_process_nfc_connection_handover(struct p2p_data *p2p, 2230cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt struct p2p_nfc_params *params); 2231cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt 2232cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidtvoid p2p_set_authorized_oob_dev_pw_id(struct p2p_data *p2p, u16 dev_pw_id, 2233cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt int go_intent, 2234cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt const u8 *own_interface_addr); 2235cf32e60fa7e0d33fe1551a6dba8dcbbec47ea50eDmitry Shmidt 22362271d3fdd5982d0e5e81cf9999a861bba933eacbDmitry Shmidtint p2p_set_passphrase_len(struct p2p_data *p2p, unsigned int len); 22372271d3fdd5982d0e5e81cf9999a861bba933eacbDmitry Shmidt 2238d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidtvoid p2p_loop_on_known_peers(struct p2p_data *p2p, 2239d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt void (*peer_callback)(struct p2p_peer_info *peer, 2240d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt void *user_data), 2241d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt void *user_data); 2242d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 22432e67f06149ff649fb6f8782bad041d3d9124685eDmitry Shmidtvoid p2p_set_vendor_elems(struct p2p_data *p2p, struct wpabuf **vendor_elem); 22442e67f06149ff649fb6f8782bad041d3d9124685eDmitry Shmidt 2245216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidtvoid p2p_set_intended_addr(struct p2p_data *p2p, const u8 *intended_addr); 2246216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 2247216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidtstruct p2ps_advertisement * 2248216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidtp2p_service_p2ps_id(struct p2p_data *p2p, u32 adv_id); 2249216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidtint p2p_service_add_asp(struct p2p_data *p2p, int auto_accept, u32 adv_id, 2250216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt const char *adv_str, u8 svc_state, 2251216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt u16 config_methods, const char *svc_info); 2252216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidtint p2p_service_del_asp(struct p2p_data *p2p, u32 adv_id); 2253dda10c2afb8378747491ea5d329a1de635d6d58eDmitry Shmidtvoid p2p_service_flush_asp(struct p2p_data *p2p); 2254216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidtstruct p2ps_advertisement * p2p_get_p2ps_adv_list(struct p2p_data *p2p); 2255216983bceec7c450951e2fbcd076b5c75d432e57Dmitry Shmidt 22568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* P2P_H */ 2257