EMULE Agreement Specification Appendix A - Message Coded Client Server TCP Message

xiaoxiao2021-03-19  203

Translated from Yoram Kulbak and Danny Bickson "The Emule Protocol Specification" Translation: LZCX QQ: 402722857 Email: LZCX_CN@yahoo.com.cn For learning, please specify

6.2

Client server

TCP

news

This chapter describes messages transmitted with TCP between servers and clients.

6.2.1

log in

After the TCP connection is established, the first message sent to the server is a login message. The length of this message varies because it is based on the user's configuration, such as a user nickname. Why is the client's TCP port appears in the head of TCP, or is sent (2 times), which is not very clear.

name

Byte size

Defaults

Comment

Protocol (protocol)

1

0xe3

Size

(size)

4

Message size is in bytes, not including heads and sizes

Type

1

0x01

The value of the OP_LoginRequest operation code

User hash

(User Hash)

16

About the details of the user hash can be found in 1.4 knots

Client ID

(User ID)

4

0

The user ID sent in the first connection is usually zero. About the details of the user ID can be found in version 1.3

TCP Port

2

4662

The TCP port used by the client, configurable

Tag count

4

4

Number of tags followed in the message

Name tag

Variable

NA

The user's nickname (configurable in the software). This tag is a string tag, the tag name is an integer value 0x1

Version tag

8

0x3c

The EDONKEY version supported by the client. This label is an integer tag, the tag name is an integer value of 0x11

Port tag

8

4662

The TCP port used by the client. This tag is an integer label, the tag name is an integer value of 0x0F

Flags tag

8

0x01

This label is an integer label, the tag name is an integer value of 0x20

6.2.2

Server message

The server message is a variable length message. In different occasions, the first client login request is sent immediately by the server to the client. One server message can contain several messages, separated by a wrap operator ('/ R', '/ n' or both). With "Server Version", "Warning", "Error", and "[Emdynip:", there is a specific meaning of the client. Other messages are simply displayed to the user.

name

Byte size

Defaults

Comment

Protocol

1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x38

OP_SERVERMESSAGE operation code value

Size

2

NA

The number of messages remaining bytes, does not include the currently described domain

Message

Variable

NA

A server message, separating

Special news

1,

Version - usually in successful connection I sent

2,

Error-

3,

WARNING - I usually send it when the server rejects the connection or the client is low ID

4,

Emdynip -

6.2.3 ID

change

The server sends an ID change message as a response to the login request message and the connection to the client has received the client. Message size is 14 or 10 bytes, depending on the selection of optional TCP connection bitmaps (TCP Connection Bitmap).

name

Byte size

Defaults

Comment

Protocol

1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x40

OP_IDCHANGE operation code value

Client ID

4

NA

Description of the client ID can be found in version 1.3

TCP Connection Bitmap

4

0x000000001

There is only 1 (LSB) meaningful and set it to identify the server support compression.

6.2.4

File provided

This message is used by the client to describe the available local files, allowing other clients to download. If the client is available, the file provides message immediately after the connection is established. This message is also sent when the client shared file list changes. Another usage of this message is to periodically send to the server and maintain the active state. If the server supports compression, the file provides (message) will be compressed. This message is not compressed when used as holding a status (no file compression and message size).

name

Byte size

Defaults

Comment

Protocol

1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x15

Op_offerfiles operate value

File count

4

NA

The number of documents described in it. No matter what is not more than 200. The server can also set a relatively low limit for this number.

Files

Variable

NA

Optional file list, a single entry format as follows

Single file entry format

The following table describes a single file entry. There can be a series of entries in a file providing message.

name

Byte size

Defaults

Comment

Hash Code

16

NA

The hash result (TBD specification) is performed on the file content. This hash uses the only identifier file, ignores the difference between the different clients.

Client ID

4

NA

Client ID, if the client has high ID, otherwise zero

Client port

2

0x15

The client TCP port number, if the client is low ID, zero

Tag count

4

NA

Number of labels below this domain

FILE Name Tag

Variable

NA

(The reference) file name. This tag is a string tag, the tag name is an integer value 0x1

FILE SIZE TAG

8

NA

(The required) file size, byte unit. This label is an integer tag, the label name is an integer value 0x2

File Type Tag

Variable

NA

(Optional) file type. One of the following: "Audio", "Video", "Image", "PRO" or "DOC". This tag is a string label, the tag name is an integer value 0x3

File Format Tag

Variable

NA

(Optional) File extension, lowercase. For example, "ZIP", "EXE". This tag is a string tag, the tag name is an integer value of 0x4

Media Length Tag

Variable

NA

(Optional) If the file is MP3, the song play time is played. The label is a string tag, the tag name is a string of "Length"

Media Bitrate Tag

TBD

NA

(Optional) If the file is MP3, the encoding bit rate is encoded. This tag is a whole tag, the tag name is "bitrate" string

Media Codec Tag

Variable

NA

(Optional, never send) If the file is a movie, the codec is encoded. This tag is a string tag, the label name is a string of "CODEC"

6.2.5

Get a list of servers

This message is sent from the client to the server immediately after successfully shaking hands. When the client is configured by requesting its current server to expand its EMULE server list, send the message. The message size is 6 bytes. name

Byte size

Defaults

Comment

Protocol

1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x14

OP_SERVERSTATUS value of the opcode

6.2.6

Server status

Send it from the server to the client. This message contains information about the current number of users and files on the server. The information in the message is not only stored on the client, but also shows it to the user. This message is 14 bytes.

name

Byte size

Defaults

Comment

Protocol

1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x34

User count

4

NA

The number of users currently logged in to the server

File count

4

NA

The number of files know the server

6.2.7

server list

Send it from the server to the client. This message contains information about expanding the list of client servers with additional EMULE servers. Message size varies (the number of servers sent).

name

Byte size

Defaults

Comment

Protocol

1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x32

The value of the OP_SERVERLIST operation code

ENTRY COUNT

1

NA

The number of servers described in this message

Server Entries

(Entry count) * 6

NA

Server descriptor entry, each entry size is 6 bytes, including 4 bytes IP addresses and 2 bytes TCP ports

6.2.8

Server identification

Send it from the server to the client. Contains Server Hash (TBD), server IP address, and TCP port (it is useful when connecting through a proxy), and servers describes information. Message size varies.

name

Byte size

Defaults

Comment

Protocol

1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x41

OP_SERRERIDENT value

Hash

16

NA

The server's GUID (like to be used to debug)

Server IP

4

NA

Server IP address

Server port

4

NA

Server listening TCP port

Tag count

4

NA

Number of labels at the end of the message

Server Name Tag

Variable

NA

name of server. This tag is a string tag, the label name is an integer value of 0x1

Server Description Tag

Variable

NA

Server description strings. This tag is a string tag, the tag name is an integer value of 0xB

6.2.9

Search request

Send it from the client to the server. This message is used to search files through the user's search string. The message size is variable. Search strings can include Boolean conditions "and", "or", "not". The user can specify the type and size of the required files, or set a valid threshold (eg, display at least five other client valid results).

name

Byte size

Defaults

Comment

Protocol

1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x16

OP_SearchRequest operation code value

PARSED SEARCH STRING

Variable

NA

Analyze search string format, below

FILE TYPE CONSTRAINT

Variable

NA

Optional. String condition. The string value is "Audio", "Video", "Pro", or "Image". Type domain is 3 bytes: 0x1 0x0 0x3

MIN SIZE CONSTRAINT

Variable

NA

Optional. Integer conditions. The file size unit is M. Type domain is 4 bytes: 0x1 0x1 0x0 0x2

Max Size Constraint

Variable

NA

Optional. Integer conditions. The file size unit is M. Type domain is 4 bytes: 0x2 0x1 0x0 0x2

Availability Constraint

Variable

NA

Optional. Integer conditions. Set a lower limit on the number of clients that provide the search file. Type domain is 4 bytes: 0x1 0x1 0x0 0x15

Filename Extension Constrain

Variable

NA

Optional. String condition. Type domain is 3 bytes: 0x1 0x0 0x3

Resolution search string format

The parsed search string encodes a binary tree with a Boolean operator 'and', 'or' NOT 'and the string operand. The tree is encoded in advance. The operator encodes 2 bytes integer, 0x0 corresponds to 'and',

0x100 corresponds to 'or', 0x200 corresponds to 'NOT'. The string is encoded in TLV format, where the type of domain is 0x1, the length of the length is 2 byte integers. Note that when the search string is a word, it is encoded as a single string operand (no operator). The subsequent EMULE version encodes a string search expression of only the "AND" operator, instead of "AND" with spaces, so that the server's search string resolution, divide a statement into a series of "AND" operator separation Words.

Optional conditional format

The condition is a sequence of entries. Each entry begins with the "AND" descriptor (2 bytes 0x00), followed by the encoded condition. Thus, the entire search line format is the <"Search String" AND condition 1 AND condition 2, etc., as shown in the example below. The coding conditions are divided into 3 domains:

1.

Type-single byte, description is a string condition (0x2) or integer conditions (0x3)

2.

Value - either the type length encoded string, or 4-byte integer value

3.

Type - 3 or 4 bytes, description conditions (see the main table above)

6.2.10

search results

The message sent from the server to the client as a response to the search request. This message is usually compressed. Message size varies.

name

Byte size

Defaults

Comment

Protocol

1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x16

OP_SearchResult the value of the opcode

Result Count

4

NA

Number of search results in the message

Result List

Variable

NA

Search results list

Search results list form form

The following table describes a format of a search results list item. Each search result contains a hash, this hash uniquely identifies the file, along with the details of other emule clients with this file. There are also several tags describe file properties. The label list is as follows. Note that most of the labels are optional, and their order is not guaranteed. The label coding rules are described in detail in this chapter.

name

Byte size

Defaults

Comment

File Hash

16

NA

Hash value, the only identity certificate used to file

Client ID

4

NA

Idle of the emule client with the file

Client port

2

NA

TCP port with client client

Tag count

4

NA

The number of descriptors below

Tag List

Variable

NA

Descriptor tag list

6.2.11

Get the source

This message is sent from the client to the server, for the file request source (other client). The message size is 22 bytes.

name

Byte size

Defaults

Comment

Protocol1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x19

Op_getsourcers

File Hash

16

NA

Hash requesting file

6.2.12

Source found

This message is sent from the server to the client with a source of requesting file (other client). Message size varies.

name

Byte size

Defaults

Comment

Protocol

1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x42

Op_foundsourcers operated value

File Hash

16

NA

Hash requesting file

Sources country

1

NA

Number of sides of the message

List of sources

Variable

NA

Source list

Source list item format

The following table describes the format of the source list item. Each source contains details of the EMULE client with the file.

name

Byte size

Defaults

Comment

Client ID

4

NA

Emule client with this file

Client port

2

NA

The TCP port of the EMULE client with this file

6.2.13

Callback request

This message is sent from the client to the server, requiring other client callbacks -, for example, the client connected to the request. With high ID, you want to connect to a low ID client (see Section 2.4) to send the message. The message size is 10 bytes.

name

Byte size

Defaults

Comment

Protocol

1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x1c

OP_CALLBACKREQUEST operation code value

Client ID

4

NA

Request callback customer ID

6.2.14

Request callback

This message is sent from the server to the client, indicating that the client requiring the received client to connect it. When the received client is low ID (see Section 2.4), the message is sent. The message size is 12 bytes. The received client attempts to connect this IP and port specified by the callback request package.

name

Byte size

Defaults

Comment

Protocol

1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x35

Op_callbackRequested operator value

Client IP

4

NA

Request call your client IP

Client TCP Port

2

NA

TCP port listens on the client

6.2.15

Callback failure

This message is sent from the server to the client, indicating that the client's callback request failed. The message size is 6 bytes. The received client puts this message log and discards it.

name

Byte size

Defaults

Comment

Protocol

1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x36

OP_CALLBACK_FAILED value

6.2.16

Message is rejected

This message is sent from the server to the client, indicating the last command that the server rejects the client. The message is 6 bytes. The received client puts this message log and discards it.

name

Byte size

Defaults

Comment

Protocol

1

0xe3

Size

4

Message size is in bytes, not including heads and sizes

Type

1

0x05

OP_REJECT value of the opcode

转载请注明原文地址:https://www.9cbs.com/read-130162.html

New Post(0)