Emfriends.met file

From AMule Project FAQ
Revision as of 14:37, 11 November 2005 by Jacobo221 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

File

Name: emfriends.met

Location: ~/.aMule/

Description

This file contains a list of friends and the necessary data to identify and locate them.

Format

The contents of this file goes as follows:

  • First byte is 0x0E to identify the file as a valid emfriends.met file.
  • Next four bytes form a 32 bits unsigned number which tells how many friends the file will list.
  • Now for each friend listed:
    • Friend's hash (16 bytes)
    • Last known IP (32 bits unsigned number)
    • Last known port (16 bits unsigned number)
    • Last time the friend was seen (32 bits unsigned number, Unix Epoch date)
    • Last time you chatted with the friend (32 bits unsigned number, Unix Epoch date)
    • Amount of aditional tags about this friend (32 bits unsigned number). aMule only supports user names as aditional friends tags.
    • Now for each tag:
      • Type of field (1 byte). In emfriends.met files, only type 0x02 (arrays) are supported.
      • Tag type length (16 bits unsigned number). Since only user names are supported, only tag type length 0x0001 is supported in this files.
      • Tag meaning (8 bits unsigned number). What does the tag stand for. Since emfriends.met files support one single additional tag, this will always be 0x01 (user name).
      • Amount of bytes the string needs (16 bytes unsigned number)
      • String (amount of bytes reported by the previous field)

All fields, except the IP and username fields, are stored in little endian. The IP and username fields are stored in big endian.

If in aMule is compile dto support Unicode, it will write the strings twice: First in Unicode, then with no Unicode.

Example

Let's see this file:

0E 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 50 18 4C 36 EA 00 00 00 00 00 00
00 00 00 02 00 00 00 02 01 00 01 09 00 EF BB BF
64 73 61 64 73 61 02 01 00 01 06 00 64 73 61 64
73 61

What the file shows is:

  • 0x0E <- File identification.
  • 0x02 0x00 0x00 0x00 <- It is in little endian. So, it is 00000002 = 2. There's one friend listed in this file
    • 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 <- No hash has been set.
    • 0x50 0x18 0x4C 0x36 <- IP is 80.24.76.54
    • 0xEA 0x00 <- Port 234
    • 0x00 0x00 0x00 0x00 <- Last time the friend was seen is unknown
    • 0x00 0x00 0x00 0x00 <- Last time the friend was chatted is unknown
    • 0x02 0x00 0x00 0x00 <- Two tags have to be read
      • 0x02 Tag type
      • 0x01 0x00 <- Tag type length is 1 byte.
      • 0x01 <- Tag is a username
      • 0x09 0x00 <- It is in little endian. So, it is 0009 = 9. The string is 9 bytes long.
      • 0xEF 0xBB 0xBF 0x64 0x73 0x61 0x64 0x73 0x61 <- This is the Unicode string. It stands for dsadsa as the friend's user name.
      • 0x02 Tag type
      • 0x01 0x00 <- Tag type length is 1 byte.
      • 0x01 <- Tag is a username
      • 0x06 0x00 <- It is in little endian. So, it is 0006 = 6. The string is 9 bytes long.
      • 0x64 0x73 0x61 0x64 0x73 0x61 <- This is the non-Unicode string. It stands for dsadsa also as the friend's user name.
    • 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 <- No hash has been set.
    • 0x55 0x28 0x50 0x36 <- IP is 85.40.80.54
    • 0xEA 0x00 <- Port 234
    • 0x00 0x00 0x00 0x00 <- Last time the friend was seen is unknown
    • 0x00 0x00 0x00 0x00 <- Last time the friend was chatted is unknown
    • 0x00 0x00 0x00 0x00 <- No additional tags about this friend.

Notes

  • If the last time a friend was seen is set to 0 it is because that friend was added manually by the user.
  • Since the amount of friends field is a 32 bits unsigned number, the maximum amount of friends that can be stored is 4294967296.
  • Since user name length in bytes are stored in 16 bits unsigned numbers, that makes maximum user name length 65536 characters (in the best cases. Some Unicoded usernames will even be less characters since some characters may take more than one byte).