MKWii Network Protocol/HANDSHAKE

From Custom Mario Kart
Jump to: navigation, search

This pages is related to MKWii Network Protocol and describes the record type NATNEG in GNU C notation.

This record NATNEG is the same as the NAT negotiation 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
__attribute__ ((packed)) udp_connect_t;