Difference between revisions of "Network Protocol/STATUS"
m (→Message Types) |
|||
Line 67: | Line 67: | ||
|- | |- | ||
| [[#S06|0x06]] || 0x08 || GPCM90vMAT | | [[#S06|0x06]] || 0x08 || GPCM90vMAT | ||
− | | | + | | Local IP/port |
|- | |- | ||
| [[#S07|0x07]] || 0x08 || client to client | | [[#S07|0x07]] || 0x08 || client to client |
Revision as of 07:04, 29 May 2015
This pages is related to MKWii Network Protocol and describes the record type STATUS.
The status packages are from one client to another in 3 different ways:
- Direct client to client communication
- Client to Server MS to Server MASTER to client communication. Server MASTER itself prefixes the message by a master message of type 06.
- Client to Server GPCM to client communication using a GPCM90vMAT message. The message header is omitted. This is used for known friends.
The used data structure is identical for all 3 communication ways, only the header is different. The members itself are mainly stored as little endian data.
Basic Message Header
All status records start with a 20 bytes long message header:
Offset | Size | Endian | Description |
---|---|---|---|
0x00 | 4 | ? | The magic, always 0xbb49cc4d (big endian) = 0x4dcc49bb (little endian) |
0x04 | 4 | little | Always 90, maybe the »dwc_mver«. |
0x08 | 1 | — | The status type. |
0x09 | 1 | — | The length of the extent (=ELEN). |
0x0a | 2 | little | The public port of the sender client. |
0x0c | 4 | 4 bytes | The public IPv4 of the sender client, byte by byte (similar to big endian). |
0x10 | 4 | little | The profile id of the sender client. |
0x14 | ELEN | — | The status type dependent extent. |
The total record length is the length of the header plus extent (20+ELEN). For GPCM90vMAT messages this header is omitted.
Type | Size | Transport | Description |
---|---|---|---|
0x01 | 0x24 | GPCM90vMAT MS+MASTER |
A player is asking for entrance |
0x02 | 0x34 | GPCM90vMAT MS+MASTER |
The host allows the player to enter (answer to 0x01) |
0x03 | 0x04 | GPCM90vMAT MS+MASTER |
The host denies the entrance request because the room is full |
0x04 | 0x00 | GPCM90vMAT MS+MASTER |
? |
0x05 | 0x00 | GPCM90vMAT MS+MASTER |
? |
0x06 | 0x08 | GPCM90vMAT | Local IP/port |
0x07 | 0x08 | client to client | Host sends information about a new player to all clients |
0x0d | 0x04 | client to client | ? |
0x0e | 0x00 | client to client | ? |
0x0f | 0x00 | client to client | ? |
0x10 | 0x00 | GPCM90vMAT client to client |
? |
0x04 | GPCM90vMAT client to client |
? | |
0x08 | GPCM90vMAT client to client |
? | |
0x52 | 0x04 | client to client | ? |
0x53 | 0x00 | client to client | ? |
0x54 | 0x00 | client to client | ? |
0x55 | 0x04 | client to client | ? |
0x82 | 0x10 | MS+MASTER client to client |
Type 82.A: Ready for event start |
0x08 | MS+MASTER client to client |
Type 82.B: Acknowledge for 82.A/82.D | |
0x10 | MS+MASTER client to client |
Type 82.C: Event start | |
0x10 | MS+MASTER client to client |
Type 82.D: Ready for event end | |
0x10 | MS+MASTER client to client |
Type 82.E: Event end | |
0x83 | 0x0c | MS+MASTER client to client |
Contains a slot usage list. Sent by the host every 15 seconds |
Naming
- knocker
- A player who wants to enter a room.
- (room) player
- A player of a room.
- host
- The host of a room. Exact one room player is host, all others are guests.
- guest
- All room players except the host.
Protocol
New Player enters room
If a knocker will enter a room, the following handshaking (only status packages reflected) is done with each room player that is already in the room:
- Status 01 is send by room player.
- Status 04 is send by knocker.
- Status 05 is send by room player.
- Some seconds of silence.
- Status 01 is send by knocker.
- Status 02 is send by room player.
Traceable public IP
The value "traceable public IP" means the last reachable host on the route to the client. Do a traceroute on publicip and put the farthest reachable host here. This is the behaviour of the official server, but probably it'd be enough to simply put the public IP here.
Message Types
Type 01: Ask for entrance
This status packet is send from a knocker to each room player, when the knocker will enter the room or group. There are 2 ways to transmit the message:
- For known friends, the message is send as a GPCM90vMAT message of type 0x01 using Server GPCM. In this case, the message header is omitted.
- For all others, Server MS and Server MASTER are used for transmission.
Offset | Size | Endian | Description |
---|---|---|---|
0x00 | 4 | little | Unknown, 0 (80%) or 3 (20%) |
0x04 | 4 | 4 bytes | Traceable public IPv4 of the sender, byte by byte (similar to big endian). |
0x08 | 4 | little | Public port of the sender. Always the same value as the public port of the header. |
0x0c | 4 | 4 bytes | Local IPv4 of the sender, byte by byte (similar to big endian). |
0x10 | 4 | little | Local port of the sender. |
0x14 | 4 | little | Unknown, always 1 |
0x18 | 4 | little | Unknown, 1 or 0 |
0x1c | 4 | little | Number of players at the knocker's console (1 or 2) |
0x20 | 4 | little | An unique identfication number of this status packet. The reply of the player (status type 0x02) use the same ID. |
0x24 | End of the packet, 36 bytes total. |
Type 02: Allow entrance
This status packet is send from the room player to the knocker as reply of a type 0x01 message to confirm the entrance of the guest. There are 2 ways to transmit the message:
- For known friends, the message is send as a GPCM90vMAT message of type 0x02 using Server GPCM. In this case, the message header is omitted.
- For all others, Server MS and Server MASTER are used for transmission.
Offset | Size | Endian | Description |
---|---|---|---|
0x00 | 4 | little | Parameter »maxplayers« (not 100% sure) = Number of possible guests. Always 11. |
0x04 | 4 | little | Most likely the client slot index of the sender (zero based, not player count). |
0x08 | 4 | little | Parameter »dwc_pid«. It is the same as the profile id of the header. |
0x0c | 4 | 4 bytes | Traceable public IPv4 of the sender, byte by byte (similar to big endian). |
0x10 | 4 | little | Public port of the sender. Always the same value as the public port of the header. |
0x14 | 4 | 4 bytes | Local IPv4 of the sender, byte by byte (similar to big endian). |
0x18 | 4 | little | Local port of the sender. |
0x1c | 4 | little | Unknown, always 1 |
0x20 | 4 | little | Number of players at the room player's console. |
0x24 | 4 | little | Parameter »dwc_groupid« (not 100% sure). |
0x28 | 4 | little | Most likely the client slot index of the receiver (zero based, not player count). |
0x2c | 4 | little | Most likely the client/console count already in the room. |
0x30 | 4 | little | The identfication number send by the guest (status type 0x01). |
0x34 | End of the packet, 52 bytes total. |
Type 03: Room full
This status packet is sent from the room player to the knocker when access is denied because the room is full. Packet contains information about the player count (mostly 12, may be 11 when joining with a 2nd player on the same console).
Offset | Size | Endian | Description |
---|---|---|---|
0x00 | 4 | little | BCD-value with current player count (0x11 for 11 players and 0x12 for 12 players). |
0x04 | End of the packet, 4 bytes total. |
Type 04: Unknown
Status packet without additional data.
Type 05: Unknown
Status packet without additional data.
Type 06: Local IP
This packet contains the local IP of the player.
Offset | Size | Endian | Description |
---|---|---|---|
0x00 | 4 | 4-byte | Local IP. |
0x04 | 4 | little | Local port. |
0x08 | End of the packet, 8 bytes total. |
Type 07: New client
Send by host when there joins a new player.
Offset | Size | Endian | Description |
---|---|---|---|
0x00 | 4 | little | PID of new guest |
0x04 | 4 | little | slot ID of new guest |
0x08 | End of the packet, 8 bytes total. |
Type 0D: ?
Type 0E: ?
Type 0F: ?
Type 10: ?
Offset | Size | Endian | Description |
---|---|---|---|
0x00 | 4 | little? | unknown; optional |
0x04 | 4 | little? | unknown; optional |
0x00,0x04,0x08 | End of the packet, 0 or 4 or 8 bytes total. |
Type 52: ?
Type 53: ?
Type 54: ?
Type 55: ?
Type 82: Event start / event end
Type 82 has five variants with different meanings.
82.A is sent by the guest at event start, 82.B is an acknowledge for 82.A or 82.D sent by the host, 82.C is sent when every guest sent 82.A.
82.D is sent when the guest finished the event and is ready for the next one and 82.E is an acknowledge for all 82.D messages.
In friend rooms, 82.A indicates the beginning of an GP (send at "EVENT XXXX") and 82.D indicates the ending of an GP (send at "ALL END").
In global races, every race is its own event and begins with 82.A (send at "Please wait..." in the end of the previous race).
The parameter "Host" indicates the sender of the message - mode 0 means the guest sent the message, mode 1 means the host sent it. Can be used to distinguish the five variants.
The parameter "Begin" indicates if the message is related to en event beginning or an event end - submode 0 means the event is going to end, submode 1 means the event is going to start. Can be used to distinguish the five variants.
Type 82.A: Ready for event (READY)
Type 82.A is sent by every guest at event start.
Offset | Size | Endian | Description |
---|---|---|---|
0x00 | 4 | little | PID of host. |
0x04 | 4 | little | Host (always 0 for 82.A) |
0x08 | 4 | little | Begin (always 1 for 82.A) |
0x0c | 4 | little | Slot of guest |
0x10 | End of the packet, 16 bytes total. |
Type 82.B: Acknowledge for 82.A/82.D (ACK)
Type 82.B is an acknowledge for 82.A and 82.D, sent by the host.
Offset | Size | Endian | Description |
---|---|---|---|
0x00 | 4 | little | PID of host. |
0x04 | 4 | little | Host (always 1 for 82.B) |
0x08 | End of the packet, 8 bytes total. |
Type 82.C: Begin of event (START)
Type 82.C is sent by the host when every guest sent 82.A and received 82.B - every player is ready for the event.
Offset | Size | Endian | Description |
---|---|---|---|
0x00 | 4 | little | PID of host. |
0x04 | 4 | little | Host (always 1 for 82.C) |
0x08 | 4 | little | Begin (always 1 for 82.C) |
0x0c | 4 | little | slot usage mask. bit 1 for used slot, bit 0 for empty slot |
0x10 | End of the packet, 16 bytes total. |
Type 82.D: Ready to finish event (DONE)
82.D is sent by the guest when he is ready to re-enter the room (after a room event).
Offset | Size | Endian | Description |
---|---|---|---|
0x00 | 4 | little | PID of host. |
0x04 | 4 | little | Host (always 0 for 82.D) |
0x08 | 4 | little | Begin (always 0 for 82.D) |
0x0c | 4 | little | Client slot |
0x10 | End of the packet, 16 bytes total. |
Type 82.E: Event finished (FINISH)
82.E is sent by the host when every player is ready for the next event.
Offset | Size | Endian | Description |
---|---|---|---|
0x00 | 4 | little | PID of host. |
0x04 | 4 | little | Host (always 1 for 82.E) |
0x08 | 4 | little | Begin (always 0 for 82.E) |
0x0c | 4 | little | slot usage mask. bit 1 for used slot, bit 0 for empty slot |
0x10 | End of the packet, 16 bytes total. |
Type 83: Current players
This packet is sent by the host to every other player every 15 seconds. It contains a list of used slots.
Offset | Size | Endian | Description |
---|---|---|---|
0x00 | 4 | little | PID of player. |
0x04 | 4 | little | Slot usage mask (12 bit data, 20 bit padding) |
0x08 | 4 | ? | unknown ID, changes when new client joins |
0x0c | End of the packet, 12 bytes total. |
Statistics
This is a summary of all status packages of 286 dumps (mostly private room versus races).
---------------------------------- msg status count type type+size ---------------------------------- 9126 GPCM90 01 24 by-server 704 STATUS 01 24 by-server 3669 GPCM90 02 34 by-server 327 STATUS 02 34 by-server 195 GPCM90 03 04 by-server 41 STATUS 03 04 by-server 4887 GPCM90 04 00 by-server 376 STATUS 04 00 by-server 3203 GPCM90 05 00 by-server 503 STATUS 05 00 by-server 4 GPCM90 06 08 by-server 7105 STATUS 07 08 peer-to-peer 1151 STATUS 0d 04 peer-to-peer 1191 STATUS 0e 00 peer-to-peer 1169 STATUS 0f 00 peer-to-peer 3 GPCM90 10 00 by-server 13 STATUS 10 00 peer-to-peer 7 GPCM90 10 04 by-server 22 STATUS 10 04 peer-to-peer 1 GPCM90 10 08 by-server 3 STATUS 10 08 peer-to-peer 262 STATUS 52 04 peer-to-peer 436 STATUS 53 00 peer-to-peer 31 STATUS 54 00 peer-to-peer 23 STATUS 55 04 peer-to-peer 13 STATUS 82 08 by-server 19987 STATUS 82 08 peer-to-peer 20 STATUS 82 10 by-server 29343 STATUS 82 10 peer-to-peer 237 STATUS 83 0c by-server 320349 STATUS 83 0c peer-to-peer
Old data structures
This is the old data structure in GNU C notation used by mkw-ana from the beginning. It is deprecated and will be removed later.
typedef struct udp_status_t { /*00*/ u32 record_id; // always 0xbb49cc4d (be) /*04*/ u32 unknown_04; // always 0x5a000000 (be) /*08*/ u8 subtype_id; // indicating the record sub type /*09*/ u8 ext_len; // length of record extension // total_record_len := '0x14 + ext_len' /*0a*/ u16 user_id[3]; // unique user id for this session ? /*10*/ u32 cid; // client id: // last 4 bytes of FC in reverse order /*14*/ union { struct // send by host, any anouncement? { /*14*/ u32 obj_cid; // client id of object /*18*/ } s04; struct // assign slot // => exception 'x x 7100 0514' found in 2013-01-24-ct-24h { /*14*/ u32 obj_cid; // client id of object /*18*/ u8 slot; // assign slot to 'obj_cid' /*19*/ u8 padding_19[3]; // always 0 /*1c*/ } s08; struct // send by host, client mask { /*14*/ u32 copy_of_cid; // copy of 'cid' above /*18*/ u16 slot_mask; // slot usage mask in little endian // each 1-bit represents one active client /*1a*/ u16 unknown_1a; // always 0 /*1e*/ u32 unknown_1c; // any checksum or random token? /*20*/ } s0c; struct // to host, verify assigned slot? { /*14*/ u32 obj_cid; // copy of 'cid' above /*18*/ u16 unknown_18; // always 0x0000|0x0100 (be) /*1a*/ u16 unknown_1a; // always 0 /*1c*/ u16 unknown_1c; // always 0x0000|0x0100 (be) /*1e*/ u16 unknown_1e; // always 0 /*20*/ u8 slot; // assigned slot of 'obj_cid' // or 0x1f or 0xff /*21*/ u8 padding_21[3]; // always 0 /*22*/ } s10; }; } __attribute__ ((packed)) udp_status_t;