1 Minetest-c55 protocol (incomplete, early draft):
4 A custom protocol over UDP.
5 Integers are big endian.
6 Refer to connection.{h,cpp} for further reference.
9 - A dummy reliable packet with peer_id=PEER_ID_INEXISTENT=0 is sent to the server:
10 - Actually this can be sent without the reliable packet header, too, i guess,
11 but the sequence number in the header allows the sender to re-send the
12 packet without accidentally getting a double initialization.
15 u32 protocol_id = PROTOCOL_ID = 0x4f457403
16 u16 sender_peer_id = PEER_ID_INEXISTENT = 0
18 # Reliable packet header
19 u8 type = TYPE_RELIABLE = 3
20 u16 seqnum = SEQNUM_INITIAL = 65500
21 # Original packet header
22 u8 type = TYPE_ORIGINAL = 1
23 # And no actual payload.
24 - Server responds with something like this:
27 u32 protocol_id = PROTOCOL_ID = 0x4f457403
28 u16 sender_peer_id = PEER_ID_INEXISTENT = 0
30 # Reliable packet header
31 u8 type = TYPE_RELIABLE = 3
32 u16 seqnum = SEQNUM_INITIAL = 65500
33 # Control packet header
34 u8 type = TYPE_CONTROL = 0
35 u8 controltype = CONTROLTYPE_SET_PEER_ID = 1
36 u16 peer_id_new = assigned peer id to client (other than 0 or 1)
37 - Then the connection can be disconnected by sending:
40 u32 protocol_id = PROTOCOL_ID = 0x4f457403
41 u16 sender_peer_id = whatever was gotten in CONTROLTYPE_SET_PEER_ID
43 # Control packet header
44 u8 type = TYPE_CONTROL = 0
45 u8 controltype = CONTROLTYPE_DISCO = 2