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 are sent to g<game server id>-%.p.srv.nintendo.net through UDP port 34343.

If no game server id is specified (e.g. when the game uses NPLN), then g2122d301 is used as a default.

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

Packet Format

Every packet consists of:

Monitoring Data Header

This structure appears at the start of the packet, but also at the start of the decrypted and decompressed payload.

Up to 5.6:

OffsetSizeDescription
0x01Version number
0x11Data type
0x21Flags
0x31Always 0xFF
0x42Payload size
0x610Padding (filled with 0xFF)

5.7 and later:

OffsetSizeDescription
0x01Version number
0x11Data type
0x21Flags
0x31Unknown
0x42Payload size
0x68AES-GCM nonce (random number)
0xE1Encryption key id (random number)
0xF1Always 0xFF

Version Numbers

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.32 - 5.4025
5.4126
5.42 - 5.4527
6.1630
6.20 - 6.2332
6.2533
6.2634
6.2935
6.3036
6.3137
6.32 - 6.3338
6.3439
6.40 - 6.4143

Data Types

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

Payload Encoding

The payload is first zlib compressed and then encrypted.

Up to 5.6:

The payload is encrypted with AES-ECB with the key 901edf193dc5ef3c5290647bff20c385.

5.7 and later:

The payload is encrypted with AES-GCM. The AES-GCM tag is appended to the encrypted payload.

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

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

Version 34:

OffsetSizeModuleDescription
0x016CommonHeader
0x104CommonPia version
0x144CommonPia SDK version
0x184CommonGame SDK version
0x1C4CommonNPLN version
0x204CommonApplication matchmake version
0x241CommonBuild bit
0x251CommonBuild type
0x261CommonPlatform type
0x2720CommonEngine version
0x3B32CommonAndroid board
0x5B32CommonAndroid model
0x7B32CommonAndroid brand
0x9B1CommonCountry code
0x9C4CommonDevice location name hash
0xA04CommonPia revision
0xA44CommonHeap size
0xA81CommonNetwork type
0xA94CommonAverage dispatch time
0xAD4CommonMaximum dispatch time
0xB14CommonDispatch count
0xB52CommonMonitoring server dns resolution time
0xB73CommonSmart device system version
0xBA1CommonReachability
0xBB16CommonCarrier name
0xCB8CommonCarrier type
0xD316CommonLocal address IPv4 (1)
0xE316CommonLocal address IPv4 (2)
0xF316CommonLocal address IPv4 (3)
0x10316CommonLocal address IPv4 (4)
0x11316CommonLocal address IPv4 (used)
0x12316CommonLocal address IPv6 (1)
0x13316CommonLocal address IPv6 (2)
0x14316CommonLocal address IPv6 (3)
0x15316CommonLocal address IPv6 (4)
0x16316CommonLocal address IPv6 (used)
0x1738LocalLocal communication id
0x17B1LocalMaximum number of stations
0x17C1LocalApplication communication version
0x17D1LocalFunction enable flags
0x17E1LocalSystem communication version
0x17F1NATIs NAT 64
0x1801NATNAT mapping
0x1811NATNAT filtering
0x1822NATNAT port increment
0x184??
0x3842CloneNumber of buffers per station for event clone protocol
0x3864CloneMaximum id for atomic clone protocol
0x38A??
0x434End

Version 43:

OffsetSizeModuleDescription
0x016CommonHeader
0x104CommonPia version
0x144CommonPia SDK version
0x184CommonGame SDK version
0x1C4CommonNPLN version
0x204CommonApplication matchmake version
0x241CommonBuild bit
0x251CommonBuild type
0x261CommonPlatform type
0x2720CommonEngine version
0x3B32CommonAndroid board
0x5B32CommonAndroid model
0x7B32CommonAndroid brand
0x9B1CommonCountry code
0x9C4CommonDevice location name hash
0xA04CommonPia revision
0xA44CommonHeap size
0xA81CommonNetwork type
0xA94CommonAverage dispatch time
0xAD4CommonMaximum dispatch time
0xB14CommonDispatch count
0xB52CommonMonitoring server dns resolution time
0xB73CommonSmart device system version
0xBA1CommonReachability
0xBB16CommonCarrier name
0xCB8CommonCarrier type
0xD316CommonLocal address IPv4 (1)
0xE316CommonLocal address IPv4 (2)
0xF316CommonLocal address IPv4 (3)
0x10316CommonLocal address IPv4 (4)
0x11316CommonLocal address IPv4 (used)
0x12316CommonLocal address IPv6 (1)
0x13316CommonLocal address IPv6 (2)
0x14316CommonLocal address IPv6 (3)
0x15316CommonLocal address IPv6 (4)
0x16316CommonLocal address IPv6 (used)
0x1738LocalLocal communication id
0x17B1LocalMaximum number of stations
0x17C1LocalApplication communication version
0x17D1LocalFunction enable flags
0x17E1LocalSystem communication version
0x17F1NATIs NAT 64
0x1801NATNAT mapping
0x1811NATNAT filtering
0x1822NATNAT port increment
0x1841NATNAT attribute
0x1854NATPublic IP address
0x1894NATPrivate IP address
0x18D2NATPublic port
0x18F2NATInterface port
0x1912NATNAT check server DNS resolution time
0x1932NATNAT property detection time
0x1952NATNAT port detection time
0x1971NATNAT property detection count
0x1981NATNAT TTL
0x1992NETMaximum number of stations
0x19B4NETCreate network processing time
0x19F4NETConnect network processing time
0x1A34NETSearch network processing time
0x1A74NETAuto connect network processing time
0x1AB4NETDestroy network processing time
0x1AF4NETDisconnect network processing time
0x1B38NETMatchmake key
0x1BB40WANNAT traversal results (?)
0x1E34WANNAT traversal success time (milliseconds)
0x1E74WANRelay server address
0x1EB2WANRelay server port
0x1ED1WANSignaling failure count
0x1EE4WANGame unique id
0x1F21WANUnknown
0x1F396WANAttribute filtering query
0x2534WANJoin random room server response time
0x2574WANJoin room server response time
0x25B4WANLeave room server response time
0x25F4WANFind room server response time
0x2634WANFind user server response time
0x2674WANSearch member list size
0x26B4IzumoCreate search index attribute id
0x26F4IzumoSearch index attribute id
0x2734TransportProtocol usage flag
0x2774TransportKeep alive interval
0x27B2TransportBest RTT in all stations
0x27D2TransportBest RTT variable id
0x27F4TransportWorst RTT in all stations
0x2832TransportWorst RTT variable id
0x2854TransportMedian RTT in all stations
0x2892TransportMaximum number of stations
0x28B2TransportNumber of send thread buffers per station
0x28D2TransportNumber of receive thread buffers per station
0x28F2TransportNumber of unreliable receive buffers per station
0x2912TransportNumber of reliable send buffers per station
0x2932TransportNumber of reliable receive buffers per station
0x2952TransportNumber of broadcast reliable send buffers per station
0x2972TransportNumber of broadcast reliable receive buffers per station
0x2992TransportNumber of stream broadcast reliable send buffers per station
0x29B2TransportNumber of stream broadcast reliable receive buffers per station
0x29D4 x 18??
0x2E51??
0x2E61??
0x2E71??
0x2E81??
0x2E91??
0x2EA4SessionJoin result
0x2EE4SessionJoin error code
0x2F24SessionJoin result filename hash
0x2F64SessionJoin result line number
0x2FA4SessionJoin processing time
0x2FE4SessionJoin processing dispatch count
0x3024SessionJoin mesh processing time
0x3064SessionJoin mesh processing dispatch count
0x30A8SessionJoin session id
0x3121SessionJoin order
0x3132SessionJoin variable id
0x3151??
0x3161??
0x3171??
0x3184??
0x31C1??
0x31D1??
0x31E1??
0x31F2 x 15??
0x33D1??
0x33E2??
0x3401??
0x3412??
0x3434??
0x3474??
0x34B4??
0x34F1 x 6??
0x3552EvolutionEvolution version
0x3572EvolutionWAN waiting probe response via server timeout
0x3591EvolutionWAN waiting probe response via server timeout result
0x35A2EvolutionWAN waiting probe 1 timeout
0x35C1EvolutionWAN waiting probe 1 timeout result
0x35D2EvolutionWAN resolve IPv4 to IPv6 timeout
0x35F4EvolutionWAN resolve IPv4 to IPv6 time
0x3632Evolution?
0x3651Evolution?
0x3662Evolution?
0x3681Evolution?
0x3692Evolution?
0x36B1Evolution?
0x36C2Evolution?
0x36E1Evolution?
0x36F1Evolution?
0x3702EvolutionPhoton wait event timeout search room
0x3721EvolutionPhoton wait event timeout search room result
0x3732EvolutionPhoton wait event timeout create room
0x3751EvolutionPhoton wait event timeout create room result
0x3762EvolutionPhoton wait event timeout join room
0x3781EvolutionPhoton wait event timeout join room result
0x3792EvolutionPhoton wait event timeout join random room
0x37B1EvolutionPhoton wait event timeout join random room result
0x37C2EvolutionPhoton wait event timeout leave room
0x37E1EvolutionPhoton wait event timeout leave room result
0x37F2EvolutionPhoton wait event timeout leave room action
0x3811EvolutionNET wait disconnected timeout result
0x3822EvolutionPhoton wait event timeout local info
0x3841EvolutionPhoton wait event timeout local info result
0x3852EvolutionSession join request send timeout
0x3871EvolutionSession join request send timeout result
0x3881EvolutionSession join mesh retry count max
0x3891EvolutionSession join mesh retry count max result
0x38A4EvolutionSession Izumo host migration timeout
0x38E2EvolutionSession LAN host migration timeout
0x3902EvolutionSession local host migration timeout
0x3924EvolutionSession NPLN host migration timeout
0x3962EvolutionSession Photon host migration timeout
0x3981EvolutionSession host migration timeout result
0x3992??
0x39B1??
0x39CEnd

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

Country Code

IDCountry
0Japan
1US
2France
3Germany
4Italy
5Spain
6China
7Korea
8Netherlands
9Portugal
10Russia
11Taiwan
12UK
13Canada
14Latin America
15China (simplified)
16China (traditional)
17Brazil

Device Location Name Hash

This is calculated over the time zone name, from nn::time::GetDeviceLocationName.

1
2
3
4
5
6
7
8
import hashlib
import struct

def hash(timezone):
    hash = hashlib.md5(timezone.encode()).digest()
    parts = struct.unpack(">4I", hash)
    value = parts[0] ^ parts[1] ^ parts[2] ^ parts[3]
    return struct.pack(">I", value)

Session End Monitoring Data

OffsetSizeDescription
0x016Monitoring data header
Contents