HAW

From Gnutella2
Jump to: navigation, search

Root Packets
CRAWLA - CRAWLR
HAW - LNI
KHL - KHLA - KHLR
PI - PO - PUSH
QKA - QKR
Q2 - QA - QH2 - QHT
UPROC - UPROD

Contents

/HAW - Hub Advertising Walker

The HAW packet is used to spread hub addresses to the far edges of the network to ensure that the network stays well connected. Each hub periodically creates a HAW packet with its own address in the packet and then sends it to a neighboring hub. That neighboring hub stores the address in its host cache and forwards it to one of its neighbors. The neighbor also stores the address in its host cache and forwards it to the next neighbor. The packet continues to be forwarded until its TTL reaches 0.

Sending

The /HAW packet should only be sent by a hub to another hub. A timer should be maintained for each neighbor that tracks when a HAW packet was last sent to that neighbor. Approximately every 5 minutes a new HAW packet should be created and sent to the neighbor.

A new HAW packet should have a TTL of 100 and hops set to 0. The GUID must be randomly generated for each HAW packet. The GUID should be recorded as having been sent to that particular neighbor. In this way if the same HAW packet is received again it can be forwarded to a neighbor that hasn't seen it before. There must be an NA child packet that contains the address of the hub that originated the HAW packet.

Receiving

Upon receiving HAW packet, store the hub address from the NA child packet into the host cache and then forward the packet to another neighbour with the following rules:

  • If the TTL is 0 then do not forward the packet
  • Otherwise, reduce the TTL by 1 and increase the hops by 1
  • Then, select a random neighbour hub that has not already seen this HAW packet

The GUID for this HAW should be recorded along with the hub that sent it so that it won't be forwarded to that hub if the same HAW packet is received again.

Payload

  • 1 byte TTL
  • 1 byte Hops
  • 16 byte GUID

When a new HAW packet is created the TTL should be 100 and Hops should be set to 0. The GUID is not the node ID, instead it is packet ID to identify where the packet has already been routed. So it should be uniquely generated for every new HAW.

Children

The /HAW packet has the following child packets defined:

  • /HAW/NA - Network Address
  • /HAW/HS - Hub Status
  • /HAW/V - Vendor Code
Retrieved from "http://g2.doxu.org/index.php?title=HAW&oldid=2962" (GetEnvy.com mirror)