CONCEPT
mccp - The Mud Client Compression Protocol
DESCRIPTION
Information and code taken from the MCCP Homepage
http://www.randomly.org/projects/MCCP/
MCCP is implemented as a Telnet option [RFC854, RFC855]. The server
and client negotiate the use of MCCP as they would any other telnet
option. Once agreement has been reached on the use of the option,
option subnegotiation is used to determine acceptable compression
methods to use, and to indicate the start of a compressed data stream.
If the driver is compiled with MCCP Support there is a
define __MCCP__.
The driver currently supports both versions of mccp. If your mud
has a H_NOECHO hook you have to find out if the client supports
mccp. Without this hook you still have to start neogotiation.
All sub-negotiation is done by the efuns start_mccp_compress() and
end_mccp_compress() whether you have this hook or not.
Notice: when the client uses compressions all binary_message calls
are executed with flag=3. This is because writing to the
socket would disturb zlib stream.
mccp-efuns:
start_mccp_compress(int telopt) (only needed with H_NOECHO)
end_mccp_compress(int telopt) (only needed with H_NOECHO)
query_mccp(object player)
query_mccp_stats(object player)
Initiating MCCP without H_NOECHO hook:
if(!query_mccp()){
binary_message(({ IAC, WILL, TELOPT_COMPRESS2 }),1)
binary_message(({ IAC, WILL, TELOPT_COMPRESS }),1)
}
the driver will parse the clients answers and start compression.
(The connection might already be compressed, because although the
documentation says clients should not negotiate from themselves,
zmud e.g. does.)
You can start and stop compression manually by efuns
when you are sure client supports compression :)
Initiating MCCP compression with H_NOECHO hook:
If your mudlib uses the H_NOECHO driver-hook you decided to do
all the negotiation by yourself:
Server Commands
IAC WILL COMPRESS indicates the sender supports version 1 of the
protocol, and is willing to compress data it sends.
IAC WILL COMPRESS2 indicates the sender supports version 2, and is
willing to compress data it sends.
IAC WONT COMPRESS indicates the sender refuses to compress data using
version 1.
IAC WONT COMPRESS2 indicates the sender refuses to compress data
using version 2.
Client Commands
IAC DO COMPRESS indicates the sender supports version 1 of the
protocol, and is willing to decompress data
received.
IAC DO COMPRESS2 indicates the sender supports version 2 or above,
and is willing to decompress data received.
IAC DONT COMPRESS indicates the sender refuses to support version 1.
If compression was previously negotiated and is
currently being used, the server should terminate
compression.
IAC DONT COMPRESS2 indicates the sender refuses to support version 2.
If compression was previously negotiated and is
currently being used, the server should terminate
compression
After you found out whether the client supports mccp or not you can
start compression with start_mccp_compress(TELOPT_COMPRESS2) or
start_mccp_compress(TELOPT_COMPRESS). ( you could start it without
checking but some players would protest :) )
AUTHOR
Bastian Hoyer (dafire@ff.mud.de) (some text taken from project page)
HISTORY
Added in LDMud 3.3.447, backported to LDMud 3.2.10.
SEE ALSO
start_mccp_compress(E), end_mccp_compress(E), query_mccp(E),
query_mccp_stats(E)
|