]> git.lizzy.rs Git - dragonfireclient.git/blob - doc/protocol.txt
Fixed typo in protocol.txt
[dragonfireclient.git] / doc / protocol.txt
1 Minetest-c55 protocol (incomplete, early draft):
2 Updated 2011-06-18
3
4 A custom protocol over UDP.
5
6 Initialization:
7 - A dummy reliable packet with peer_id=PEER_ID_INEXISTENT=0 is sent to the server:
8         - Actually this can be sent without the reliable packet header, too, i guess,
9           but the sequence number in the header allows the sender to re-send the
10           packet without accidentally getting a double initialization.
11         - Packet content:
12                 # Basic header
13                 u32 protocol_id = PROTOCOL_ID = 0x4f457403
14                 u16 sender_peer_id = PEER_ID_INEXISTENT = 0
15                 u8 channel = 0
16                 # Reliable packet header
17                 u8 type = TYPE_RELIABLE = 3
18                 u16 seqnum = SEQNUM_INITIAL = 65500
19                 # Original packet header
20                 u8 type = TYPE_ORIGINAL = 1
21                 # And no actual payload.
22 - Server responds with something like this:
23         - Packet content:
24                 # Basic header
25                 u32 protocol_id = PROTOCOL_ID = 0x4f457403
26                 u16 sender_peer_id = PEER_ID_INEXISTENT = 0
27                 u8 channel = 0
28                 # Reliable packet header
29                 u8 type = TYPE_RELIABLE = 3
30                 u16 seqnum = SEQNUM_INITIAL = 65500
31                 # Control packet header
32                 u8 type = TYPE_CONTROL = 0
33                 u8 controltype = CONTROLTYPE_SET_PEER_ID = 1
34                 u16 peer_id_new = assigned peer id to client (other than 0 or 1)
35 - Then the connection can be disconnected by sending:
36         - Packet content:
37                 # Basic header
38                 u32 protocol_id = PROTOCOL_ID = 0x4f457403
39                 u16 sender_peer_id = whatever was gotten in CONTROLTYPE_SET_PEER_ID
40                 u8 channel = 0
41                 # Control packet header
42                 u8 type = TYPE_CONTROL = 0
43                 u8 controltype = CONTROLTYPE_DISCO = 2
44