GuiProtocol
This page and its links are copied from http://www.g2gui.net/wiki/index.php/GuiProtocol Its still work-in-progress --Spiralvoice 06:47, 8 February 2006 (PST)
Contents |
Connection Phase
As of MLDonkey 2.5-4+2 (possibly earlier), the connection phase runs like so:
Once you've connected the socket to the server :
- The Core sends a CoreProtocol message
- The GUI sends a ProtocolVersion message with its protocol version
- The GUI sends a Extensions message if it wants poll mode (optional)
- The GUI sends a PassWord message
- The Core replies with (these series of messages appear to come through twice)
- For every plugin, a NetworkInfo message
- A ConsoleMessage, containing the motd
- The connection is established. If not in poll mode, the core sends many messages with the current state.
- The Core will send periodic ClientStats messages, even in poll mode
The earlier connection phase looked like this:
- The GUI sends a ProtocolVersion message with its protocol version
- The Core replies with
- A CoreProtocol message containing its maximal protocol version
- For every plugin, a NetworkInfo message
- A ConsoleMessage, containing the motd
- The GUI sends a Extensions message if it wants poll mode
- The GUI sends a PassWord message
- The connection is established. If not in poll mode, the core sends many messages with the current state.
Basic Message Format
All integers are encoded in LittleEndian (least significant byte first).
Size of Content (Header) | Opcode | Payload |
variable-size |
Opcodes Received from core
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 |
Opcodes sent to core
Get information from source
To get information about the gui protocol from mldonkey's source code take a look at following files:
- ./src/daemon/common/guiDeconding.ml
- receive opcode -> action
- ./src/daemon/common/guiEnconding.ml
- action -> send opcode
- ./src/daemon/common/guiProto.ml
MLDonkeyDemo
MLDonkeyDemo is a simple implementation of the GUIProtocol (in python), which is used to comunicate with an instance of mldonkey-server.
To access the MLDonkeyDemo code, please visit svn://ccsl.ime.usp.br/DonkeySurvey/mldonkeydemo/