… | |
… | |
20 | Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 | Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | --> |
21 | --> |
22 | </head> |
22 | </head> |
23 | <body> |
23 | <body> |
24 | |
24 | |
25 | <h1>$Revision: 1.22 $</h1> |
25 | <h1>$Revision: 1.23 $</h1> |
26 | |
26 | |
27 | <h1>KGS Protocol Description</h1> |
27 | <h1>KGS Protocol Description</h1> |
28 | |
28 | |
29 | <p>This XML document describes the KGS protocol. It is also used |
29 | <p>This XML document describes the KGS protocol. It is also used |
30 | to automatically generate the perl parser for all the messages and |
30 | to automatically generate the perl parser for all the messages and |
… | |
… | |
47 | <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/kgsueme/kgsueme/doc/protocol.xml?rev=HEAD&content-type=text/xml">here</a>, while |
47 | <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/kgsueme/kgsueme/doc/protocol.xml?rev=HEAD&content-type=text/xml">here</a>, while |
48 | the HTML version of it can be found |
48 | the HTML version of it can be found |
49 | <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/kgsueme/kgsueme/doc/protocol.html?rev=HEAD&content-type=text/html">here</a>. |
49 | <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/kgsueme/kgsueme/doc/protocol.html?rev=HEAD&content-type=text/html">here</a>. |
50 | </p> |
50 | </p> |
51 | |
51 | |
|
|
52 | <h2>Changes for protocol version 2.5.0</h2> |
|
|
53 | |
|
|
54 | <p>Sorry - I have little time to dissect the protocol, but as far |
|
|
55 | as I can see, there was no deeper need for the protocol change, as |
|
|
56 | the protocol itself didn't change in a significant way. The only |
|
|
57 | significant change was the addition of a linear congruence generator |
|
|
58 | that is xor'ed into the packet length. This makes the protocol less |
|
|
59 | robust and doesn't help much, so the only big effect of that is to make |
|
|
60 | it more difficult to analyze the protocol. It seems that wms prefers |
|
|
61 | to lock out users than to have a few people write their own client. I |
|
|
62 | didn't really expect that from him, but instead expected real changes |
|
|
63 | for the good, as he is claiming all the time.</p> |
|
|
64 | |
|
|
65 | <p>Well, that's what he wrote to me, after all, so he just did what he |
|
|
66 | said...</p> |
|
|
67 | |
|
|
68 | <p>Anything I know about changes in 2.5.x are reflected in this |
|
|
69 | document already.</p> |
|
|
70 | |
52 | <h2>Structure and conventions of this document and the protocol</h2> |
71 | <h2>Structure and conventions of this document and the protocol</h2> |
53 | |
72 | |
54 | <p>"Send" means messages send from the client to the server, while |
73 | <p>"Send" means messages send from the client to the server, while |
55 | "received" means messages send by the server to the client.</p> |
74 | "received" means messages send by the server to the client.</p> |
56 | |
75 | |
… | |
… | |
85 | <p>All messages have the same header:</p> |
104 | <p>All messages have the same header:</p> |
86 | |
105 | |
87 | <struct name="message_header" send="yes" recv="yes"> |
106 | <struct name="message_header" send="yes" recv="yes"> |
88 | <member name="_unknown" type="U16"/> |
107 | <member name="_unknown" type="U16"/> |
89 | <member name="length" type="U16"/> |
108 | <member name="length" type="U16"/> |
|
|
109 | |
90 | <p>The length is the length of the full message including the header.</p> |
110 | <p>The length is the length of the full message including the header.</p> |
|
|
111 | |
|
|
112 | <p>Beginning with version 2.5.x, a number is xored into the low byte |
|
|
113 | of the length, as given by the following recurrence: <code>rand[0] |
|
|
114 | = 0; rand[i+1] = msg[i].length + (rand[i] * 0x04c2af9b + 0xfffffffb); xorbyte = |
|
|
115 | rand >> 24</code>, all in 32 bit unsigned iso-c arithmetic.</p> |
|
|
116 | |
91 | <member name="type" type="U16"/> |
117 | <member name="type" type="U16"/> |
92 | <p>If the type is >= 0x4000 this is a message for a specific channel. The channel |
118 | <p>If the type is >= 0x4000 this is a message for a specific channel. The channel |
93 | number is always the next U16.</p> |
119 | number is always the next U16.</p> |
94 | </struct> |
120 | </struct> |
95 | |
121 | |
… | |
… | |
98 | <p>Apart from the basic types, I need to define some extra types to |
124 | <p>Apart from the basic types, I need to define some extra types to |
99 | deal with fixed-point values (based on integer types) or fixed-length |
125 | deal with fixed-point values (based on integer types) or fixed-length |
100 | strings (either 7-bit-ascii or more limited (<code>A</code>), or UCS-2 |
126 | strings (either 7-bit-ascii or more limited (<code>A</code>), or UCS-2 |
101 | based (<code>S</code>)).</p> |
127 | based (<code>S</code>)).</p> |
102 | |
128 | |
103 | <type name="username" type="A" length="12"/> |
129 | <type name="username" type="A" length="10"/> |
104 | |
130 | |
105 | <p>The basic user or login name, used throughout the protocol |
131 | <p>The basic user or login name, used throughout the protocol |
106 | as a handle to the user.</p> |
132 | as a handle to the user.</p> |
107 | |
133 | |
108 | <type name="roomname" type="S" length="25"/><!-- argh, how horribly broken --> |
134 | <type name="roomname" type="S" length="25"/><!-- argh, how horribly broken --> |
… | |
… | |
209 | guest flag is true. |
235 | guest flag is true. |
210 | Possible replies: <ref reply="login"/>. Followed by: <ref reply="timewarning_default"/> <ref reply="chal_defaults"/> |
236 | Possible replies: <ref reply="login"/>. Followed by: <ref reply="timewarning_default"/> <ref reply="chal_defaults"/> |
211 | </p> |
237 | </p> |
212 | |
238 | |
213 | <member name="ver_major" type="U32" default="2"/> |
239 | <member name="ver_major" type="U32" default="2"/> |
214 | <member name="ver_minor" type="U32" default="4"/> |
240 | <member name="ver_minor" type="U32" default="5"/> |
215 | <member name="ver_micro" type="U32" default="67"/> |
241 | <member name="ver_micro" type="U32" default="1"/> |
216 | <member name="name" type="username"/> |
242 | <member name="name" type="username"/> |
217 | <member name="password" type="password" default="0"/> |
243 | <member name="password" type="password" default="0"/> |
218 | <member name="guest" type="flag" default="1"/> |
244 | <member name="guest" type="flag" default="1"/> |
219 | <member name="_unknown3" type="U16" default="0"/> |
245 | <member name="_unknown3" type="U16" default="0"/> |
220 | <member name="locale" type="locale" default='"en_US"'/> |
246 | <member name="locale" type="locale" default='"en_US"'/> |