KHL

From Gnutella2
Revision as of 18:36, 19 March 2005 by Dcat (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

/KHL

The known hub list packet is used to exchange a list of known Gnutella2 hubs with neighbouring nodes. It is exchanged regularly over all TCP connections, between hubs and between hubs and leaves (and vice versa). It enables a completely up to date picture of the local hub cluster, and the gradual propagation of cached hub records.

Sending

This packet should be sent through TCP links at regular intervals. One minute is suggested for busy links, leaves may send to hubs less often. Note that unlike /LNI, /KHL must be sent regularly even if the information does not change in order to refresh timestamps and keep time-sorted caches in the correct order.

Receiving

Upon receiving a known hub list, the detailed hubs should be stored in appropriate data structures. Neighbouring hubs must be retained in the hub cluster records, while cached hubs should be merged with the local accessible hub cache.

Payload

This packet has no payload at the current time.

Children

This packet has several child packet types defined at the current time:

  • /KHL/TS - Timestamp
  • /KHL/NH - Neighbouring Hub
  • /KHL/CH - Cached Hub

/KHL/TS - Timestamp

The /KHL/TS child provides a timestamp representing the current universal time at the sending node. This can be used as a reference when considering other timestamps in the packet, allowing them to be adjusted to eliminate differences between the time setting on the local and remote node.

Sending

This child is optional but recommended.

Payload

A 32-bit integer representing the current UNIX time, or time (NULL).

Children

This packet has no known children at the current time.

/KHL/NH - Neighbouring Hub

This child packet represents a neighbouring hub.

Sending

One should be included for each Gnutella2 neighbour hub, with the possible exception of the one to which this packet is being sent.

Payload

The node address of the hub. See datatypes for more information.

Children

This packet has several child packet types defined at the current time:

  • /KHL/NH/GU - GUID
  • /KHL/NH/V - Vendor Code
  • /KHL/NH/LS - Library Statistics
  • /KHL/NH/HS - Hub Status

/KHL/NH/GU - GUID

The /KHL/NH/GU child packet specifies the globally unique identifier of the hub.

Sending

This child is optional.

Payload

The 16 byte globally unique node identifier of the hub.

Children

This packet has no known children at the current time.

/KHL/NH/V - Vendor Code

The /KHL/NH/V child packet specifies the vendor code of the software operating the hub.

Sending

This child is optional.

Payload

A four byte vendor code.

Children

This packet has no known children at the current time.

/KHL/NH/LS - Library Statistics

The /KHL/NH/LS packet provides information about the content library of the hub and its connected leaves.

Sending

This child is optional.

Payload

Two 32-bit integers representing the number of files, and the total KB of available content in the hub's own library and the libraries of its connected leaves. The payload may grow beyond 8 bytes in the future.

Children

This packet has no known children at the current time.

/KHL/NH/HS - Hub Status

The /KHL/NH/HS packet contains the status of the hub.

Sending

This child is optional.

Payload

Two 16-bit integers representing the current leaf count and the maximum leaf count respectively. This packet may grow beyond 4 bytes in the future.

Children

This packet has no known children at the current time.

/KHL/CH - Cached Hub

This child packet represents a hub from the hub cache.

Sending

An arbitrary number of these children should be included, constrained by space and the number of available cached hubs. A selection of freshly time stamped but previously unknown hubs should be included, and the list should not include hubs in the local cluster.

Payload

The node address of the hub, followed by the time this hub was last seen as a 32-bit timestamp. The last seen time can be adjusted based on the difference between the /KHL/TS timestamp and the local time. Note that the node address is of variable length, so it is important to consider the last 4 bytes as the timestamp rather than assuming a fixed length node address.

Children

This packet has several child packet types defined at the current time:

  • /KHL/CH/GU - GUID
  • /KHL/CH/V - Vendor Code
  • /KHL/CH/LS - Library Statistics
  • /KHL/CH/HS - Hub Status

This extra information is considered less relevant for a cached hub because it is unlikely to be up to date enough to be useful.

/KHL/CH/GU - GUID

The /KHL/CH/GU child packet specifies the globally unique identifier of the hub.

Sending

This child is optional.

Payload

The 16 byte globally unique node identifier of the hub.

Children

This packet has no known children at the current time.

/KHL/CH/V - Vendor Code

The /KHL/CH/V child packet specifies the vendor code of the software operating the hub.

Sending

This child is optional.

Payload

A four byte vendor code.

Children

This packet has no known children at the current time.

/KHL/CH/LS - Library Statistics

The /KHL/NH/LS packet provides information about the content library of the hub and its connected leaves.

Sending

This child is optional.

Payload

Two 32-bit integers representing the number of files, and the total KB of available content in the hub's own library and the libraries of its connected leaves. The payload may grow beyond 8 bytes in the future.

Children

This packet has no known children at the current time.

/KHL/CH/HS - Hub Status

The /KHL/CH/HS packet contains the status of the hub.

Sending

This child is optional.

Payload

Two 16-bit integers representing the current leaf count and the maximum leaf count respectively. This packet may grow beyond 4 bytes in the future.

Children

This packet has no known children at the current time.