blob: 5cb605d9168aad7baa296d4ebc72fcf14b400003 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001CONCEPT
2 mccp - The Mud Client Compression Protocol
3
4DESCRIPTION
Zesstra7ea4a032019-11-26 20:11:40 +01005 Information and code taken from the MCCP Homepage
MG Mud User88f12472016-06-24 23:31:02 +02006 http://www.randomly.org/projects/MCCP/
7
8 MCCP is implemented as a Telnet option [RFC854, RFC855]. The server
9 and client negotiate the use of MCCP as they would any other telnet
10 option. Once agreement has been reached on the use of the option,
11 option subnegotiation is used to determine acceptable compression
Zesstra7ea4a032019-11-26 20:11:40 +010012 methods to use, and to indicate the start of a compressed data stream.
MG Mud User88f12472016-06-24 23:31:02 +020013
14 If the driver is compiled with MCCP Support there is a
15 define __MCCP__.
16
17 The driver currently supports both versions of mccp. If your mud
18 has a H_NOECHO hook you have to find out if the client supports
19 mccp. Without this hook you still have to start neogotiation.
20
21 All sub-negotiation is done by the efuns start_mccp_compress() and
22 end_mccp_compress() whether you have this hook or not.
23
24 Notice: when the client uses compressions all binary_message calls
25 are executed with flag=3. This is because writing to the
26 socket would disturb zlib stream.
Zesstra7ea4a032019-11-26 20:11:40 +010027
MG Mud User88f12472016-06-24 23:31:02 +020028 mccp-efuns:
29
30 start_mccp_compress(int telopt) (only needed with H_NOECHO)
31 end_mccp_compress(int telopt) (only needed with H_NOECHO)
32 query_mccp(object player)
33 query_mccp_stats(object player)
34
Zesstra7ea4a032019-11-26 20:11:40 +010035 Initiating MCCP without H_NOECHO hook:
MG Mud User88f12472016-06-24 23:31:02 +020036
37 if(!query_mccp()){
38 binary_message(({ IAC, WILL, TELOPT_COMPRESS2 }),1)
39 binary_message(({ IAC, WILL, TELOPT_COMPRESS }),1)
40 }
41
42 the driver will parse the clients answers and start compression.
43 (The connection might already be compressed, because although the
Zesstra7ea4a032019-11-26 20:11:40 +010044 documentation says clients should not negotiate from themselves,
MG Mud User88f12472016-06-24 23:31:02 +020045 zmud e.g. does.)
46
47 You can start and stop compression manually by efuns
48 when you are sure client supports compression :)
49
50
Zesstra7ea4a032019-11-26 20:11:40 +010051 Initiating MCCP compression with H_NOECHO hook:
MG Mud User88f12472016-06-24 23:31:02 +020052
53 If your mudlib uses the H_NOECHO driver-hook you decided to do
54 all the negotiation by yourself:
55
56 Server Commands
Zesstra7ea4a032019-11-26 20:11:40 +010057 IAC WILL COMPRESS indicates the sender supports version 1 of the
58 protocol, and is willing to compress data it sends.
MG Mud User88f12472016-06-24 23:31:02 +020059
60 IAC WILL COMPRESS2 indicates the sender supports version 2, and is
Zesstra7ea4a032019-11-26 20:11:40 +010061 willing to compress data it sends.
MG Mud User88f12472016-06-24 23:31:02 +020062
Zesstra7ea4a032019-11-26 20:11:40 +010063 IAC WONT COMPRESS indicates the sender refuses to compress data using
64 version 1.
MG Mud User88f12472016-06-24 23:31:02 +020065
66 IAC WONT COMPRESS2 indicates the sender refuses to compress data
Zesstra7ea4a032019-11-26 20:11:40 +010067 using version 2.
MG Mud User88f12472016-06-24 23:31:02 +020068
69 Client Commands
Zesstra7ea4a032019-11-26 20:11:40 +010070 IAC DO COMPRESS indicates the sender supports version 1 of the
71 protocol, and is willing to decompress data
72 received.
MG Mud User88f12472016-06-24 23:31:02 +020073
Zesstra7ea4a032019-11-26 20:11:40 +010074 IAC DO COMPRESS2 indicates the sender supports version 2 or above,
75 and is willing to decompress data received.
MG Mud User88f12472016-06-24 23:31:02 +020076
Zesstra7ea4a032019-11-26 20:11:40 +010077 IAC DONT COMPRESS indicates the sender refuses to support version 1.
78 If compression was previously negotiated and is
79 currently being used, the server should terminate
80 compression.
MG Mud User88f12472016-06-24 23:31:02 +020081
82 IAC DONT COMPRESS2 indicates the sender refuses to support version 2.
83 If compression was previously negotiated and is
84 currently being used, the server should terminate
85 compression
86
87 After you found out whether the client supports mccp or not you can
88 start compression with start_mccp_compress(TELOPT_COMPRESS2) or
89 start_mccp_compress(TELOPT_COMPRESS). ( you could start it without
90 checking but some players would protest :) )
91
92AUTHOR
93 Bastian Hoyer (dafire@ff.mud.de) (some text taken from project page)
94
95HISTORY
96 Added in LDMud 3.3.447, backported to LDMud 3.2.10.
97
98SEE ALSO
99 start_mccp_compress(E), end_mccp_compress(E), query_mccp(E),
Zesstra7ea4a032019-11-26 20:11:40 +0100100 query_mccp_stats(E)