Difference between revisions of "PreferencesKad.dat file"

From AMule Project FAQ
Jump to: navigation, search
m (Removed Version Tag)
(Fixed decoding issues)
Line 10: Line 10:
 
The file format is as follows:
 
The file format is as follows:
  
*''IP'': Stores the [client]]'s IP (4 bytes)
+
*''IP'': Stores the [client]]'s IP (4 bytes, LSB first)
 
*''Deprecated field'': This field is no more used, so it's filled with 0s (2 bytes)
 
*''Deprecated field'': This field is no more used, so it's filled with 0s (2 bytes)
 
*''ClientID'': The client's ClientID (16 bytes)
 
*''ClientID'': The client's ClientID (16 bytes)
 
*''End of tags signal'': Old [[eMule]] clients expected more info to be read on this file. To remain compatible with those clients, this field is set to 0 (1 byte)
 
*''End of tags signal'': Old [[eMule]] clients expected more info to be read on this file. To remain compatible with those clients, this field is set to 0 (1 byte)
  
Once this data is put together, it is stored in little-endian.
+
Reading and writing the ''ClientID'' is somewhat tricky. It is stored as four 32bit little-endian integers, which themselves represent the 128bit value in big-endian order. See the example below.
  
 
== Example ==
 
== Example ==
 
The following is a hex dump of an hypothetic ''preferencesKad.dat'' file:
 
The following is a hex dump of an hypothetic ''preferencesKad.dat'' file:
  
''000000000000C1A3CBE82BBD354A398A7B623E100EBF00''
+
''01 40 52 5B 00 00 B4 F1 52 14 18 17 9A 80 44 57 29 8A B9 3A 2B 6F 00''
  
 
In the above example, the following data can be seen:
 
In the above example, the following data can be seen:
  
*IP: ''0.0.0.0'', which means it's not yet set (In hex: ''0x00000000'')
+
*IP: ''91.82.64.1'' (In hex: ''0x5B524001'')
 
*Deprecated field: ''0'' (In hex: ''0x0000'')
 
*Deprecated field: ''0'' (In hex: ''0x0000'')
*ClientID: ''C1A3CBE82BBD354A398A7B623E100EBF''
+
*ClientID: ''1452F1B4809A17188A2957446F2B3AB9''
 
*End of tags signal: ''0'' (In hex: ''0x00'')
 
*End of tags signal: ''0'' (In hex: ''0x00'')
  
 
== Extra ==
 
== Extra ==
 
[[aMule]] ignores the ''End of tags signal'' when reading this file, so it is optional to use it. Anyway, [[aMule]] does write it to keep compatibility with old [[eMule]] clients.
 
[[aMule]] ignores the ''End of tags signal'' when reading this file, so it is optional to use it. Anyway, [[aMule]] does write it to keep compatibility with old [[eMule]] clients.

Revision as of 10:59, 25 September 2008

File

Name: preferencesKad.dat

Location: ~/.aMule/

Description

This file stores the IP and Kademlia ClientID.

Format

The file format is as follows:

  • IP: Stores the [client]]'s IP (4 bytes, LSB first)
  • Deprecated field: This field is no more used, so it's filled with 0s (2 bytes)
  • ClientID: The client's ClientID (16 bytes)
  • End of tags signal: Old eMule clients expected more info to be read on this file. To remain compatible with those clients, this field is set to 0 (1 byte)

Reading and writing the ClientID is somewhat tricky. It is stored as four 32bit little-endian integers, which themselves represent the 128bit value in big-endian order. See the example below.

Example

The following is a hex dump of an hypothetic preferencesKad.dat file:

01 40 52 5B 00 00 B4 F1 52 14 18 17 9A 80 44 57 29 8A B9 3A 2B 6F 00

In the above example, the following data can be seen:

  • IP: 91.82.64.1 (In hex: 0x5B524001)
  • Deprecated field: 0 (In hex: 0x0000)
  • ClientID: 1452F1B4809A17188A2957446F2B3AB9
  • End of tags signal: 0 (In hex: 0x00)

Extra

aMule ignores the End of tags signal when reading this file, so it is optional to use it. Anyway, aMule does write it to keep compatibility with old eMule clients.