GuiProtocol ZH
From MLDonkey
这个网页和连接都来源于:http://www.g2gui.net/wiki/index.php/GuiProtocol 一直被维护者维护 --Spiralvoice 06:47, 8 February 2006 (PST)
Contents |
连接过程
从MLDonkey2.5-4+2(也可能更早),连接的过程规则:
一旦你从socket连接到server:
- Core发送一个CoreProtocol信息
- GUI发送一个ProtocolVersion带有协议版本的信息
- 如果想poll模式,GUI发送一个Extensions消息(可选的)
- GUI发送一个PassWord消息
- Core回应(一系列消息,出现2次)
- 为每个插件的NetworkInfo消息
- 一个ConsoleMessage,包括motd
- 连接被确定.如果不是poll模式,core发送许多当前状态信息
- Core将周期性的发送ClientStats消息,即使poll模式也是一样的
更早的连接过程:
- GUI发送一个ProtocolVersion带有协议版本的信息
- Core回应:
- CoreProtocol 包括最大协议版本的消息
- 为每个插件的NetworkInfo消息
- 一个ConsoleMessage,包括motd
- 果想poll模式,GUI发送一个Extensions消息
- GUI发送一个PassWord消息
- 连接被确定.如果不是poll模式,core发送许多当前状态信息
消息基本格式
所有的整型都被小端的方式解码小端 (least significant byte first).
Size of Content (Header) | Opcode | Payload |
variable-size |
从core收到的Opcodes
GuiOpcode | Name | Notes |
00 | CoreProtocol | |
01 | OptionsInfo | |
03 | DefineSearches | |
04 | ResultInfo | |
05 | SearchResult | |
09 | FileUpdateAvailability | |
10 | FileAddSource | |
12 | ServerUser | |
13 | ServerState | |
15 | ClientInfo | |
16 | ClientState | only the state of the client has changed |
19 | ConsoleMessage | |
20 | NetworkInfo | |
21 | UserInfo | |
22 | RoomInfo | for protocol version <=3 |
23 | RoomMessage | |
24 | RoomAddUser | |
26 | ServerInfo | |
27 | MessageFromClient | |
28 | ConnectedServers | |
31 | RoomInfo | for protocol version >3 |
34 | SharedFileUpload | |
35 | SharedFileUnshared | |
36 | AddSectionOption | define a new option to appear in the Settings panel |
38 | AddPluginOption | define a new option to appear in the Settings panel |
46 | FileDownloadUpdate | |
47 | BadPassword | |
48 | SharedFileInfo | also opcodes 33 for old protocol versions |
49 | ClientStats | also opcodes 25,37,39 for old protocol versions |
50 | FileRemoveSource | |
51 | CleanTables | |
52 | FileInfo | also opcodes 7,40, 43 for old protocol versions |
53 | DownloadingFiles | also old opcodes 29, 41, 44 for old protocol versions |
54 | DownloadedFiles | also opcodes 30, 42, 45 for old protocol versions |
55 | Uploaders | |
56 | Pending | |
57 | Search | |
58 | Version | |
59 | Stats | protocol > 40 |
发给core的Opcodes
从源码的到相关的信息
从mldonkey源码中得到gui协议信息可以参考以下文件:
- ./src/daemon/common/guiDeconding.ml
- receive opcode -> action
- ./src/daemon/common/guiEnconding.ml
- action -> send opcode
- ./src/daemon/common/guiProto.ml