Network Protocol/HANDSHAKE

From Custom Mario Kart
Jump to navigation Jump to search

Overview

This article describes the record type HANDSHAKE of the Network Protocol. This record is the same as NATNEG with the servers, but only describes the packet CONNECT_PING, which is sent peer-to-peer.

typedef struct udp_connect_t
{
  /*00*/    u8[6]	natneg_magic;	// always 0xfdfc1e666ab2 (be)
  /*06*/    u8		version;	// always 0x03
  /*07*/    u8		type;		//   type of data: 0x05: CONNECT
					//   0x07: CONNECT_PING
  /*08*/    u32		client_id;	// client ID. Last two bytes of ID are last two bytes of Friendcode
  /*0c*/    u32		ip4;		// IP4 of client
  /*10*/    u16		port;		// UDP port of client
  /*12*/    u8		counter;	// CONNECT_PING: sequence counter: 0|1
					// CONNECT: x42
  /*13*/    u8		error;		// 0x00: no error, 0x01: client timeout, 0x02: INIT timeout
  /*14*/
}
__attribute__ ((packed)) udp_connect_t;