WIFI P2P Architecture

definition

Wi-Fi Peer-to-Peer (P2P) Technical Specification
Purpose: Multiple devices can form a network to connect and communicate with each other without an AP .
P2p is also the basis of display, which is used for multi-screen sharing of smart terminals

architecture

Multiple devces become one GO+multiple clients through p2p protocol negotiation
insert image description here

3 components

p2p device: wifi device
p2p group owner (GO): similar to AP
p2p client: similar to STA

organizational structure

Before forming a p2p group, all smart terminals are p2p devices.
After multiple p2p devices are negotiated through the p2p protocol, one of the devices is used as GO, and the other devices are used as clients.
Among them, devices that do not support p2p functions are called legacy clients.

technical standard

Protocol version: 802.11g and above
Security requirements: WPA2, WSC
shared media data: WMM
P2P protocol:
P2P Discovery (build a group);
P2P Group Operation (manage a group);
P2P PowerManagerment;
Managed P2P Device Operation

P2P Discovery

Purpose: To enable multiple devices to discover each other and form a group

4 technical items :
Device Discovery: Scan, search for surrounding P2P-enabled devices
Service Discovery: Search for specified services
Group Formation: Networking, used to determine who is GO and who is client
P2P Invitation: Activate a Persistent Group and invite a Client to join A currently existing Group

insert image description here

Device Discovery (scanning)

Two devices, in the discovery phase, use the same channel at the same time, one is in the search state to send probe req, and the other is in the listen state to receive probe resp,
insert image description here

Management frame: use probe req and probe resp

State: There are two states of search and listen. Search state : Send Probe Request frames on the 1, 6, and 11 frequency bands of
2.4GHz . Reply to the Probe Response frame ( once the Listen Channel is selected, it cannot be changed during the entire P2P Discovery phase )

Stage: There are two stages of scan and find.
Scan Phase: In the scanning stage, Probe Request frames are sent on each frequency band (active scanning)
Find Phase: Switch back and forth between Search State and Listen State

process

P2P Discovery starts and enters the Scan phase, which sends probe req in each frequency band;
after the Scan phase is completed, one Listen Channel is determined and enters the Find phase;
the Find phase switches back and forth between the listen and search phases;
in order to avoid being in the same state at the same time, it is stipulated The time of the Listen State specifies a random integer multiple of 100TU (1-3);
as shown in the figure, when one end sends a probe req in the search state, and the other end receives and replies to the probe resp in the listen state, the device scans successfully.

p2p probe management frame

Key information fields: SSID, WSC IE, P2P IE
insert image description here
insert image description here
insert image description here

log key points

Scan entry function "wpas_p2p_find"
scans three types:
P2P_FIND_START_WITH_FULL: default setting. Indicates to scan all frequency bands first, and then scan social channels
P2P_FIND_ONLY_SOCIAL: only scan social channels
P2P_FIND_PROGRESSIVE: it is similar to P2P_FIND_START_WITH_FULL, except that all frequency bands will be scanned one by one in the SearchState stage

type=0, use default full scan  //使用默认全频段扫描方式
starting search    //启动search
starting short listen state  //启动listen
NL80211_CMD_REMAIN_ON_CHANNEL   //wifi驱动固定在一个频段一段时间,listen
NL80211_CMD_FRAME //接收到req
NL80211_CMD_FRAME_TX_STATUS. //本机发送resp上报
**P2P-DEVICE-FOUND   //发现p2p设备,SSID为“DIRECT-”**
NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL  //取消频段固定

Group Formation (networking)

After the device is discovered, start to construct a P2P Group

GO Negotiation (GON) process

insert image description here
The GON process includes three frame exchanges of GON Request, GON Response and GON Confirmation . The two sides exchange some information to confirm who will play GO. It mainly includes GO Intent eagerness and so on.

P2P Public Action management frame

Key information field: P2P IE
insert image description here

Provision Discovery (PD) process

Purpose: Use WSC to exchange security configuration information

PD frame

If the PD Request receiver supports the WSC configuration method set by the sender, it will set the same Config Method attribute value in the PD Response frame , otherwise set the Config Method value to 0
Key information field: Config Method attribute of WSC IE
insert image description here

P2P state machine

insert image description here
scan
insert image description here
find listen
insert image description here

find search
insert image description here

Group Formation Procedure GON
insert image description here

Operational Phase P2P GO
insert image description here

Operational Phase P2P Client
insert image description here

Guess you like

Origin blog.csdn.net/htt789/article/details/129443033