QKA

From Gnutella2
Jump to navigation Jump to search

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

/QKA - Query Key Answer

The query key answer packet is sent in response to a query key request or in the event that a query with an incorrect or omitted query key is received. It advises the receiver of the correct query key to be used when contacting the sending hub to execute a remote cluster query.

Sending

The query key answer packet should be sent by a hub when a query key has been requested. It should contain a key unique to the local hub and the requesting node address supplied in the request, and should be sent to that address only. The query key answer packet may also be sent upon receiving a query with a missing or invalid query key. In this case no query should be performed.

Receiving

Upon receiving a query key answer packet, the supplied query key should be stored for later use. If the answer packet contains a sending node address (/QKA/SNA) child which does not match the local node address, it may be forwarded to a connected leaf node via TCP with a matching address. In the forwarding case, a query node address (/QKA/QNA) child is added prior to forwarding to retain the remote (queried) hub's address.

Payload

This packet has no payload at the current time.

Note from Raphael Manfredi: there is a protocol design mistake here: when the /QKA message is sent back by a hub because the /Q2 did not contain a valid query key, the MUID of the faulty /Q2 should be inserted here as payload, in order to let the querying party know which /Q2 was rejected.

It is OK however to have an empty payload when replying to a /QKR.

Children

The QKA packet has these child packets defined at the current time:

  • /QKA/QK
  • /QKA/SNA
  • /QKA/QNA
  • /QKA/CACHED

/QKA/QK - Query Key

The /QKA/QK child contains the query key that was requested.

Sending

This child is required if a key is being issued. Sending a /QKA without a /QKA/QK indicates that the hub does not wish to authorise the requesting node to query it or its cluster.

Payload

A 32-bit query key which is unique to the hub and the sending node address.

Children

This packet has no known children at the current time.

/QKA/SNA - Sending Node Address

This child specifies the node address for which the key has been issued. This is not necessarily the node that physically transmitted the key request or the query.

Sending

This child is required.

Payload

The node address (with port number optional) of the node which requested the query key.

Children

This packet has no known children at the current time.

/QKA/QNA - Queried Node Address

If this query key answer packet has been forwarded to a firewalled leaf from a connected hub, a /QKA/QNA child will have been added to indicate the address of the remote hub from which the query key has been issued.

Sending

This child should be added by a hub when relaying a received query key answer on to a leaf via TCP.

Receiving

If this child is present, the query key answer should be treated as if it originated from the stored address rather than the TCP neighbour.

Payload

The node address (with port number optional) of the remote hub.

Children

This packet has no known children at the current time.

/QKA/CACHED - Query Key Cached

Indicates that the query key returned was retrieved from cache.

Sending

This packet should be added by a hub in response to a /QKR/QNA over TCP from a leaf.

Receiving

Indicates to the leaf that the query key in the response was retrieved from cache.

Payload

This packet has no payload at the current time.

Children

This packet has no known children at the current time.