Home docs pia protocols Monitoring Data
Post

Monitoring Data

This protocol is used for the P2P monitoring server on the Switch. The messages are wrapped in unencrypted Pia packets and sent to g<game server id>-%.p.srv.nintendo.net through UDP port 34343.

Wii U games send the monitoring data to the NEX server instead, through the SendReport method of the secure connection protocol.

The message payload is encoded as follows:

Up to 5.6:

OffsetSizeDescription
0x016Monitoring data header
0x10 Payload, first zlib compressed, then encrypted with AES-ECB. The key is always: 901edf193dc5ef3c5290647bff20c385.

5.7 and later:

OffsetSizeDescription
0x016Monitoring data header
0x10 Payload, first zlib compressed, then encrypted with AES-GCM. See AES-GCM encryption below.
  AES-GCM authentication tag

The content of the payload depends on the version number and data type in the monitoring data header.

AES-GCM Encryption

The key is chosen by the lower nybble of the encryption key id in the monitoring data header:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 0: c1d494af4a0a956c545d2e41fc1ceb24
 1: caf247fb40aa9655e58c2b02bff89e14
 2: bc6da24db8c7e22d2e3fdd97a2b5e3d2
 3: 3ef3a41d8a2e78518974679562afe5fa
 4: c0a02f90a2642ea6a64b199e01f46a57
 5: 9eb9c98fc889495c7056f2cd8015aac0
 6: 632acbe8c6c77246475b577b6b2d8c76
 7: 8dafd0578b2d3ff285e0292ce08d25a2
 8: cc082ad011d3c38c7b5ed28637f37c1c
 9: 6cd46046c71362116e36cb96c0098912
10: 54598618dc2a24474a9d5e80f783a145
11: f35eaa5cc8ebc1dc42ada6c3f4130556
12: 127d237973e98688548b5dac5eb6cc7b
13: f677ccf32241122aeeece3df23aaa736
14: d7cb0683d251030fc7613b4b2461224b
15: c587a79cbac8a2ddcee27409242a8702

The nonce is constructed as follows:

OffsetSizeDescription
0x08Nonce from monitoring data header
0x84Always 5bd085fa

Version Number

Monitoring was added to Pia in version 3.4.

Pia versionMonitoring version
3.41
3.52
3.63
3.74
3.85
3.96
3.107
4.59
4.610
4.911
4.1012
5.2 - 5.415
5.516
5.617
5.7 - 5.918
5.10 - 5.1219
5.1420
5.17 - 5.1922
5.2023
5.21 - 5.3124
5.3225

Monitoring Data Header

As described above, the message payload starts with a monitoring data header. Each monitoring data structure starts with a monitoring data header as well. The flags field is always 0xFC in the first monitoring data header, and 0xFF in all other monitoring data headers.

In the first monitoring data header, the payload size indicates the size of the compressed payload. In all other monitoring data headers, the payload size indicates the size of the structure, including the monitoring data header itself.

OffsetSizeDescription
0x01Version number
0x11Data type
0x21Flags
0x31Always 0xFF
0x42Payload size

Up to 5.6:

OffsetSizeDescription
0x610Padding (filled with 0xFF)

5.7 and later:

This part is only relevant in the first monitoring data header. In all other monitoring data headers, it is filled with 0xFF.

OffsetSizeDescription
0x68AES-GCM nonce (random number)
0xE1Encryption key id (random number)
0xF1Always 0xFF

Session Begin Monitoring Content

All fields are initialized to 0xFF.

Version 18:

TypeDescription
MonitoringDataHeaderMonitoring data header
Uint32Pia version
Uint32SDK version
Uint32NEX version
Uint8Unknown
Uint8Unknown
Uint8Platform id (3=Wii U, 4=Switch)
Uint8Language
Uint8Unknown
Uint32Pia heap size
Uint32Bitmask that describes which protocols are created.
Uint64Unknown
Uint8Unknown
Uint32Unknown
Uint32Unknown
Uint8Unknown
Uint8Unknown
Uint32External client address
Uint32Local client address
Uint8NAT mapping
Uint8NAT filtering
Uint8NAT port increment
Uint8NAT mode flags
Uint16Unknown
Uint16Time required to resolve address of NAT check server (milliseconds)
Uint16Unknown
Uint32Unknown
Uint32MD5 hash of pid
Uint32Unknown
Uint32Game server id
Uint8Thread mode
Uint16Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint16Unknown
Uint32Unknown
Uint16Unknown
Uint32Unknown
Uint16Relay route rtt max
Uint16Relay route num max
Uint16Unknown
Uint32Unknown
Uint8Unknown
Uint8Unknown
Uint8Unknown
Uint32Unknown
Uint32Unknown
Uint8Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint8Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint16Unknown
Uint8Unknown
Uint8Unknown
Uint32Unknown
Uint16Unknown
Uint16Unknown
Uint16Unknown
Uint16Unknown
Uint16Unknown
Uint16Unknown
Uint16Unknown
Uint16Unknown
Uint8Unknown
Uint16Unknown
Uint16External client port
Uint16Local client port
Uint8Unknown
Uint32MD5 hash of pid of session host
Uint8Unknown
Uint8Unknown
Uint8Unknown
Uint32Joint session gathering id
Uint32Unknown
Uint32Unknown
Uint8Unknown
Uint8Unknown
Uint32Time required to create or join matchmake session (milliseconds)
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint32Unknown
Uint16Unknown
NexSessionSearchCriteriaSearch criteria 1
NexSessionSearchCriteriaSearch criteria 2
Uint8Number of session join attempts
Uint8Unknown
Uint8Unknown
NexSessionSearchCriteriaExtraExtra search criteria 1
NexSessionSearchCriteriaExtraExtra search criteria 2
Uint8Number of NAT traversal failures
Uint8Number of session join failures because the connection with the host could not be established
Uint8Number of session join failures because of an error receiving the join response
Uint8Number of session join failures because the session started host migration before a connection was established with all clients
Uint8Number of session join failures because the session started host migration before the join was completed
Uint8Number of session join failures because the join request was denied
Uint32Unknown
Uint32Unknown
Uint8Unknown
Uint8Unknown
Uint8Unknown
Uint8Unknown
Uint8Unknown
Uint8Unknown
Uint16Unknown
Uint16Unknown
Uint32Unknown
Uint32Unknown
Uint16Unknown
Uint16Unknown
Uint32[75]Unknown
Uint8[60]Unknown
Uint8Last result of starting NAT traversal
Uint8Last result of completing NAT traversal
Uint16Unknown
Uint16Unknown
Uint16Unknown
Uint16Time required to resolve address of monitoring server (milliseconds)
Uint16Unknown
Uint8[15]Unknown
Uint32NAT relay server address
Uint16NAT relay server port
Uint8[67]Unknown
Uint8[150]Unknown
Uint8[150]Unknown
Uint8[32]Unknown
Uint8[150]Unknown
Uint8[176]Unknown
Uint8[300]Unknown
Uint8Unknown
Uint8Unknown
Uint8Unknown
Uint8Unknown
Uint8Unknown
Uint8Unknown
Uint8Unknown
Uint8Unknown
Uint32Always PiaM

NexSessionSearchCriteria

TypeDescription
Uint32Game mode
Uint8Min participants num range (min)
Uint8Min participants num range (max)
Uint8Max participants num range (min)
Uint8Max participants num range (max)
Uint8 (x6)Attribute array size
Uint32 (x6)Attribute range min
Uint32 (x6)Attribute range max
Uint8Session type
Uint8Flags:
1: exclude user password set
2: exclude non host pid
4: opened only
8: vacant only
Uint8Random session selection method

NexSessionSearchCriteriaExtra

TypeDescription
Uint32Rating value
Uint32Violation rate
Uint32Disconnection rate
Uint8Unknown
Uint8Use geo ip

Thread Mode

ModeDescription
0ThreadModeUndefined
1ThreadModeSafeTransportBuffer
2ThreadModeUnsafeTransportBuffer
3ThreadModeUnsafeUser
4ThreadModeSafeUser
5ThreadModeInternal
6ThreadModeInternalTransportBuffer

NAT Traversal Result

ValueDescription
0Reliable
1Unreliable
2Failure or very unreliable

Session End Monitoring Data

OffsetSizeDescription
0x016Monitoring data header
Contents