MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | CONCEPT |
| 2 | mccp - The Mud Client Compression Protocol |
| 3 | |
| 4 | DESCRIPTION |
| 5 | Informations and code taken from the MCCP Homepage |
| 6 | 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 |
| 12 | methods to use, and to indicate the start of a compressed data stream. |
| 13 | |
| 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. |
| 27 | |
| 28 | 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 | |
| 35 | Initiating MCCP without H_NOECHO hook: |
| 36 | |
| 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 |
| 44 | documentation says clients should not negotiate from themselfes, |
| 45 | 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 | |
| 51 | Initiating MCCP compression with H_NOECHO hook: |
| 52 | |
| 53 | If your mudlib uses the H_NOECHO driver-hook you decided to do |
| 54 | all the negotiation by yourself: |
| 55 | |
| 56 | Server Commands |
| 57 | IAC WILL COMPRESS indicates the sender supports version 1 of the |
| 58 | protocol, and is willing to compress data it sends. |
| 59 | |
| 60 | IAC WILL COMPRESS2 indicates the sender supports version 2, and is |
| 61 | willing to compress data it sends. |
| 62 | |
| 63 | IAC WONT COMPRESS indicates the sender refuses to compress data using |
| 64 | version 1. |
| 65 | |
| 66 | IAC WONT COMPRESS2 indicates the sender refuses to compress data |
| 67 | using version 2. |
| 68 | |
| 69 | Client Commands |
| 70 | IAC DO COMPRESS indicates the sender supports version 1 of the |
| 71 | protocol, and is willing to decompress data received. |
| 72 | |
| 73 | IAC DO COMPRESS2 indicates the sender supports version 2 or above, |
| 74 | and is willing to decompress data received. |
| 75 | |
| 76 | IAC DONT COMPRESS indicates the sender refuses to support version 1. |
| 77 | If compression was previously negotiated and is |
| 78 | currently being used, the server should terminate |
| 79 | compression. |
| 80 | |
| 81 | IAC DONT COMPRESS2 indicates the sender refuses to support version 2. |
| 82 | If compression was previously negotiated and is |
| 83 | currently being used, the server should terminate |
| 84 | compression |
| 85 | |
| 86 | After you found out whether the client supports mccp or not you can |
| 87 | start compression with start_mccp_compress(TELOPT_COMPRESS2) or |
| 88 | start_mccp_compress(TELOPT_COMPRESS). ( you could start it without |
| 89 | checking but some players would protest :) ) |
| 90 | |
| 91 | AUTHOR |
| 92 | Bastian Hoyer (dafire@ff.mud.de) (some text taken from project page) |
| 93 | |
| 94 | HISTORY |
| 95 | Added in LDMud 3.3.447, backported to LDMud 3.2.10. |
| 96 | |
| 97 | SEE ALSO |
| 98 | start_mccp_compress(E), end_mccp_compress(E), query_mccp(E), |
| 99 | query_mccp_stats(object player) |
| 100 | |