<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://g2.doxu.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ram</id>
	<title>Gnutella2 - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://g2.doxu.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ram"/>
	<link rel="alternate" type="text/html" href="https://g2.doxu.org/wiki/Special:Contributions/Ram"/>
	<updated>2026-04-28T06:21:19Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QH2&amp;diff=85152</id>
		<title>QH2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QH2&amp;diff=85152"/>
		<updated>2014-03-12T08:00:53Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* /QH2/G1 - Gnutella Relaying */ Documented this new extension that will be at least supported by gtk-gnutella&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QH2 - Query Hit =&lt;br /&gt;
&lt;br /&gt;
The /QH2 Gnutella2 query hit packet contains one or more search result descriptors,&lt;br /&gt;
along with information about the node generating the result set. A single node may&lt;br /&gt;
generate several /QH2 packets in response to a /[[Q2]] query. Like all Gnutella2&lt;br /&gt;
packets, the /QH2 packet is highly extensible.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
Send a /QH2 packet when processing a /[[Q2]] query packet reveals one or more&lt;br /&gt;
matching objects. Query hits can be returned directly to the /Q2/UDP return address&lt;br /&gt;
in the query, or routed back along the delivery chain. Firewalled leaf nodes are&lt;br /&gt;
advised to return /QH2 packets to their connected hub for dispatch, as the hub will&lt;br /&gt;
be able to make a reliable delivery.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QH2 query hit packet, check the query GUID against locally&lt;br /&gt;
initiated queries. If it originated elsewhere, increment the route-back hop counter&lt;br /&gt;
and forward it to the most appropriate link or UDP endpoint. If it matches a locally&lt;br /&gt;
generated query, process the search results.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
A single byte representing the hop count, followed by a 16 byte GUID identifying the&lt;br /&gt;
search that produced these results.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* FW - Firewalled Servent&lt;br /&gt;
* H - Hit Descriptor&lt;br /&gt;
* HG - Hit Group Descriptor&lt;br /&gt;
* GU - Node GUID&lt;br /&gt;
* NA - Node Address&lt;br /&gt;
* NH - Neighbouring Hub&lt;br /&gt;
* V - Vendor Code&lt;br /&gt;
* MD - Unified Metadata Block&lt;br /&gt;
* UPRO - User Profile&lt;br /&gt;
* BUP - Browse User Profile Tag&lt;br /&gt;
* PCH - Peer Chat Tag&lt;br /&gt;
* HN - DNS Host Name of Servent (e.g. &amp;quot;g2.example.com&amp;quot;)&lt;br /&gt;
* TLS - TLS Support&lt;br /&gt;
* BH - Browsable Host&lt;br /&gt;
* G1 - Synthetized /QH2 message from Gnutella Query Hit&lt;br /&gt;
&lt;br /&gt;
== /QH2/FW - Firewalled Servent ==&lt;br /&gt;
&lt;br /&gt;
Specifies that the sending node is ''firewalled'' and cannot accept incoming connections.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is sent only when the servent issuing the hit is firewalled.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
There is no payload defined.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/GU - Node GUID ==&lt;br /&gt;
&lt;br /&gt;
Specifies the GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
Specifies the node / network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional but recommended.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of the sending node. See datatypes for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NH - Neighbouring Hub ==&lt;br /&gt;
&lt;br /&gt;
Lists a hub to which the sending node (a leaf) is connected. This provides a contact&lt;br /&gt;
point for routing communications to a possibly firewalled leaf node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional, and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of a hub to which the sending node is connected.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
Identifies the software operating the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four character vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BUP - Browse User Profile Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports browsing the local user profile.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/PCH - Peer Chat Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports person to person private message chat.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HG - Hit Group Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a group of search results.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A single byte, the group ID number.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type currently defined:&lt;br /&gt;
&lt;br /&gt;
* SS - Server State&lt;br /&gt;
&lt;br /&gt;
=== /QH2/HG/SS - Server State ===&lt;br /&gt;
&lt;br /&gt;
Provides a status snapshot of the upload server that applies to search results in the&lt;br /&gt;
current hit group.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Add this child to the hit group descriptor to provide server state information.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this information when interpreting hits linked with this hit group.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
* A 16-bit integer : the current queue length including any active transfers (number waiting plus number transferring)&lt;br /&gt;
* An 8-bit integer : the maximum number of concurrent transfers (capacity)&lt;br /&gt;
* A 32-bit integer : the speed in kilobits per second for uploads on this server module&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/H - Hit Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a single object which matched the original query.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QH2/H child for each matching object to be included in this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time, and is often&lt;br /&gt;
extended:&lt;br /&gt;
&lt;br /&gt;
* URN - Universal Resource Name&lt;br /&gt;
* URL - Universal Resource Location&lt;br /&gt;
* DN - Descriptive Name&lt;br /&gt;
* MD - Metadata&lt;br /&gt;
* SZ - Object Size&lt;br /&gt;
* G - Group Identifier&lt;br /&gt;
* ID - Object Identifier&lt;br /&gt;
* CSC - Cached Source Count&lt;br /&gt;
* PART - Partial Availability Marker&lt;br /&gt;
* COM - User Comment&lt;br /&gt;
* PVU - Preview URL&lt;br /&gt;
* ALT - Alternate Locations&lt;br /&gt;
* CT - Creation time&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URN - Universal Resource Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies a universal resource name which can be used to identify the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
At least one instance of this child is required. Multiple instances are optional.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* '''bitprint''' or '''bp''' - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* '''sha1''' - 20 bytes of SHA1&lt;br /&gt;
* '''tree:tiger/''' or '''ttr''' - 24 bytes of tiger-tree root&lt;br /&gt;
* '''md5''' - 16 bytes of MD5&lt;br /&gt;
* '''ed2k''' - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URL - Universal Resource Location ===&lt;br /&gt;
&lt;br /&gt;
This child specifies a location where the object being described can be acquired.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and a URL is available.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If a /QH2/H/URL child was requested but is not present, the sending node may not&lt;br /&gt;
have the object. It is valid to advertise information about objects that are not&lt;br /&gt;
available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or a string which represents an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to an instance of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has the object available&lt;br /&gt;
locally. It can be retrieved with an HTTP request using the &amp;quot;uri-res&amp;quot; resolver.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== QH2/H/DN - Descriptive Name (Generic) Criteria ===&lt;br /&gt;
&lt;br /&gt;
The descriptive name for the object, and the object's size.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer indicating the object's size, followed by a string describing it. If a&lt;br /&gt;
/QH2/H/SZ child is present, the 32-bit size prefix is omitted here (allowing a larger&lt;br /&gt;
64 bit file size).&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/MD - Metadata ===&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The xml header is optional. Standard plural/singular&lt;br /&gt;
Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/SZ - Object Size ===&lt;br /&gt;
&lt;br /&gt;
Specifies the size of the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if DN was requested, and if the size is not to be packed into&lt;br /&gt;
the /QH2/H/DN child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit or 64-bit integer representing the object size.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/G - Group Identifier ===&lt;br /&gt;
&lt;br /&gt;
Indicates which hit group (/QH2/HG) this hit belongs to. If this child is not present,&lt;br /&gt;
the hit belongs to group zero.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Send this child if this hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If this child is present, the hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A single byte, the hit group ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ID - Object Identifier ===&lt;br /&gt;
&lt;br /&gt;
Specifies a 32-bit integer which uniquely identifies the object on the sender's system.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is not normally sent for search results. It is used in browse-user responses&lt;br /&gt;
to allow objects to be referenced by virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this ID to link objects to virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CSC - Cached Source Count ===&lt;br /&gt;
&lt;br /&gt;
Indicates the number of external cached sources known to the sending node.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if cached sources are available and interest in URLs was expressed&lt;br /&gt;
in the query.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 16-bit integer.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PART - Partial Content Tag ===&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node has only part of the object, and how much it has.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a /QH2/H/URL child is present and the URL contains only part of&lt;br /&gt;
the object.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer, the number of bytes available.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* MT - Modification Time (payload = 32-bit timestamp)&lt;br /&gt;
&lt;br /&gt;
The ''MT'' child carries the last modification time (UNIX timestamp) of the partial file and can be used to determine whether there has been recent updates made (''hot'' file) or if the file is ''cold'' (not undergoing any downloading activity on the remote side).&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/COM - User Comment ===&lt;br /&gt;
&lt;br /&gt;
Provides a user review and/or rating for the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a user comment is available, and comments were requested.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
An XML string, of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;comment rating=&amp;quot;n&amp;quot;&amp;gt;&lt;br /&gt;
The comment goes here.&lt;br /&gt;
&amp;lt;/comment&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rating is an integer 0 &amp;lt;= n &amp;lt;= 5, indicating the number of &amp;quot;stars&amp;quot;. The text&lt;br /&gt;
may not include HTML, but may include forum-style block codes and emoticon&lt;br /&gt;
notation.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PVU - Preview URL ===&lt;br /&gt;
&lt;br /&gt;
Indicates that a preview URL is available for the object. A preview URL will serve a&lt;br /&gt;
miniature version of the content.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a preview is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to a preview of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has a preview of the object&lt;br /&gt;
available locally. It can be retrieved with an HTTP request to the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
/gnutella/preview/v1?urn:xyz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ALT - Alternate Locations ===&lt;br /&gt;
&lt;br /&gt;
Supplies alternate download sources for the hit.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent when the query indicated that it wanted alternate locations, via the &amp;quot;A&amp;quot; string in its /Q2/I child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
The payload contains a vector of alternate locations, listing IPv4 addresses followed by 16-bit ports, as usual (e.g. the same format used to serialize an &amp;quot;NA&amp;quot; payload), but all the entries are concatenated.  Hence, a payload of 24 bytes will indicate that there are 4 entries of 6 bytes each.&lt;br /&gt;
&lt;br /&gt;
These alternate locations are the IP:port addresses of known hosts that can serve the file.  These can be G2 hosts or G1 hosts, but there are no differences since the file transfer protocol is identical for both networks.&lt;br /&gt;
&lt;br /&gt;
None of the addresses listed there are for firewalled hosts, so anyone should be able to contact them at their uri-res address, supplying the urn:sha1: value suitable for the resource.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CT - Creation Time ===&lt;br /&gt;
&lt;br /&gt;
Supplies the creation time of the resource.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent to indicate the creation time of the resource being returned.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
The payload contains a UNIX timestamp, supplying the time when the resource was created.  It is encoded using a '''variable-length''' encoding, which will ususally use 4 bytes, until 2038 is reached...&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/MD - Unified Metadata Block ==&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing one or more objects in the packet. This is an&lt;br /&gt;
alternative method of delivering metadata, which allows metadata for similar objects&lt;br /&gt;
to be grouped together. It is compatible with the unified metadata block format in&lt;br /&gt;
Gnutella1.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing one or more XML documents, each beginning with a header.&lt;br /&gt;
Standard plural/singular Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application index=&amp;quot;0&amp;quot; title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;images xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/image.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;1&amp;quot; description=&amp;quot;Shareaza Logo&amp;quot; width=&amp;quot;128&amp;quot; height=&amp;quot;128&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;2&amp;quot; description=&amp;quot;Shareaza Screen Shot&amp;quot; width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/images&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An additional attribute, &amp;quot;index&amp;quot; is added to each singular entry. The index is a zerobased&lt;br /&gt;
integer identifying the Nth /QH2/H child within this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/UPRO - User Profile ==&lt;br /&gt;
&lt;br /&gt;
Delivers a user profile or user profile summary, describing the user operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a version of this child if the operating user wishes to list their screen name in&lt;br /&gt;
search results.&lt;br /&gt;
&lt;br /&gt;
The current version of this packet contains a summary only, consisting of the&lt;br /&gt;
screen/nick name. Future versions may include a more comprehensive XML text&lt;br /&gt;
block in the payload.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
One child packet type is defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QH2/UPRO/NICK - Nick/screen Name&lt;br /&gt;
&lt;br /&gt;
=== /QH2/UPRO/NICK - Nick/Screen Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies the nick/screen name of the user.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HN - DNS Host Name ==&lt;br /&gt;
&lt;br /&gt;
This child conveys the DNS host name of the servent.  This is useful when the host has a dynamic IP address that can change over time, letting others know how they can recompute your IP address through a DNS lookup when the connection to the specified address (IP and port) is no longer working properly.  The port is not present here, since that is not supposed to change.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this child if you have a dynamic IP address and you know your DNS host name.  This cannot be automatically computed and requires user input.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The host name of the host, as a string, with no trailing NUL (since the payload only contains the name).  For instance, &amp;quot;g2host.example.com&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/TLS - TLS Support ==&lt;br /&gt;
&lt;br /&gt;
When present, this child indicates that the servent supports TLS connections.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this child if you are capable of initiating and receiving TLS connections.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BH - Browsable Host ==&lt;br /&gt;
&lt;br /&gt;
When present, this child indicates that the servent supports Browsing.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this children if you are capable of serving browsing requests using the &amp;lt;code&amp;gt;application/x-gnutella2&amp;lt;/code&amp;gt; Content-Type.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/G1 - Gnutella-Relayed Query Hit ==&lt;br /&gt;
&lt;br /&gt;
When present, this child indicates that the /QH2 has been synthetized from a Gnutella Query Hit by the relaying Ultrapeer.&lt;br /&gt;
&lt;br /&gt;
Some Ultrapeers on Gnutella which connect as leaves to G2 can act as a '''hub-leaf''': the Query Hash Table (QHT) that they send to their G2 hubs are actually the concatenation of all the leaves they have + their own.  Each /Q2 they receive are translated as a Gnutella query, then forwarded to all the Gnutella leaves.  Query Hits that come back are then translated into a /QH2 to be processed correctly by the querying node.  This hit can be delivered directly by UDP or relayed back to the sending hub.&lt;br /&gt;
&lt;br /&gt;
The presence of /QH2/G1 indicates to the receiving G2 node that this hit was relayed from Gnutella.  Therefore, one of the /QH2/NH children will point back to the Gnutella Ultrapeer which acted as the gateway.  Other /QH2/NH, if present, are the Gnutella push-proxies that were possibly present in the Gnutella hit.&lt;br /&gt;
&lt;br /&gt;
The hop count is set to '''1''' by the relaying Gnutella node to further indicate the relaying activity that took place.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is included by the relaying Gnutella Ultrapeer to indicate that the message was synthetized from a corresponding Gnutella hit, and that some of the original information may have been lost.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
When this child is present, the processing node can determine that the node serving the resources is a Gnutella host.&lt;br /&gt;
&lt;br /&gt;
All the /QH2/NH children refer to Gnutella nodes, and therefore should not be sent a /PUSH message but rather a Gnutella PUSH to be on the safe side (although the nodes may also understand /PUSH because they support G2, this is not guaranteed, whereas Gnutella support is implied by the presence of this G1 child).&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has one child defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* V - the vendor code of the relaying Gnutella node&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QH2&amp;diff=85151</id>
		<title>QH2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QH2&amp;diff=85151"/>
		<updated>2014-03-12T07:39:48Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Children */ Documented /QH2/G1 for G2 &amp;amp; Gnutella bridging&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QH2 - Query Hit =&lt;br /&gt;
&lt;br /&gt;
The /QH2 Gnutella2 query hit packet contains one or more search result descriptors,&lt;br /&gt;
along with information about the node generating the result set. A single node may&lt;br /&gt;
generate several /QH2 packets in response to a /[[Q2]] query. Like all Gnutella2&lt;br /&gt;
packets, the /QH2 packet is highly extensible.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
Send a /QH2 packet when processing a /[[Q2]] query packet reveals one or more&lt;br /&gt;
matching objects. Query hits can be returned directly to the /Q2/UDP return address&lt;br /&gt;
in the query, or routed back along the delivery chain. Firewalled leaf nodes are&lt;br /&gt;
advised to return /QH2 packets to their connected hub for dispatch, as the hub will&lt;br /&gt;
be able to make a reliable delivery.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QH2 query hit packet, check the query GUID against locally&lt;br /&gt;
initiated queries. If it originated elsewhere, increment the route-back hop counter&lt;br /&gt;
and forward it to the most appropriate link or UDP endpoint. If it matches a locally&lt;br /&gt;
generated query, process the search results.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
A single byte representing the hop count, followed by a 16 byte GUID identifying the&lt;br /&gt;
search that produced these results.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* FW - Firewalled Servent&lt;br /&gt;
* H - Hit Descriptor&lt;br /&gt;
* HG - Hit Group Descriptor&lt;br /&gt;
* GU - Node GUID&lt;br /&gt;
* NA - Node Address&lt;br /&gt;
* NH - Neighbouring Hub&lt;br /&gt;
* V - Vendor Code&lt;br /&gt;
* MD - Unified Metadata Block&lt;br /&gt;
* UPRO - User Profile&lt;br /&gt;
* BUP - Browse User Profile Tag&lt;br /&gt;
* PCH - Peer Chat Tag&lt;br /&gt;
* HN - DNS Host Name of Servent (e.g. &amp;quot;g2.example.com&amp;quot;)&lt;br /&gt;
* TLS - TLS Support&lt;br /&gt;
* BH - Browsable Host&lt;br /&gt;
* G1 - Synthetized /QH2 message from Gnutella Query Hit&lt;br /&gt;
&lt;br /&gt;
== /QH2/FW - Firewalled Servent ==&lt;br /&gt;
&lt;br /&gt;
Specifies that the sending node is ''firewalled'' and cannot accept incoming connections.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is sent only when the servent issuing the hit is firewalled.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
There is no payload defined.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/GU - Node GUID ==&lt;br /&gt;
&lt;br /&gt;
Specifies the GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
Specifies the node / network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional but recommended.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of the sending node. See datatypes for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NH - Neighbouring Hub ==&lt;br /&gt;
&lt;br /&gt;
Lists a hub to which the sending node (a leaf) is connected. This provides a contact&lt;br /&gt;
point for routing communications to a possibly firewalled leaf node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional, and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of a hub to which the sending node is connected.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
Identifies the software operating the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four character vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BUP - Browse User Profile Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports browsing the local user profile.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/PCH - Peer Chat Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports person to person private message chat.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HG - Hit Group Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a group of search results.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A single byte, the group ID number.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type currently defined:&lt;br /&gt;
&lt;br /&gt;
* SS - Server State&lt;br /&gt;
&lt;br /&gt;
=== /QH2/HG/SS - Server State ===&lt;br /&gt;
&lt;br /&gt;
Provides a status snapshot of the upload server that applies to search results in the&lt;br /&gt;
current hit group.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Add this child to the hit group descriptor to provide server state information.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this information when interpreting hits linked with this hit group.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
* A 16-bit integer : the current queue length including any active transfers (number waiting plus number transferring)&lt;br /&gt;
* An 8-bit integer : the maximum number of concurrent transfers (capacity)&lt;br /&gt;
* A 32-bit integer : the speed in kilobits per second for uploads on this server module&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/H - Hit Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a single object which matched the original query.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QH2/H child for each matching object to be included in this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time, and is often&lt;br /&gt;
extended:&lt;br /&gt;
&lt;br /&gt;
* URN - Universal Resource Name&lt;br /&gt;
* URL - Universal Resource Location&lt;br /&gt;
* DN - Descriptive Name&lt;br /&gt;
* MD - Metadata&lt;br /&gt;
* SZ - Object Size&lt;br /&gt;
* G - Group Identifier&lt;br /&gt;
* ID - Object Identifier&lt;br /&gt;
* CSC - Cached Source Count&lt;br /&gt;
* PART - Partial Availability Marker&lt;br /&gt;
* COM - User Comment&lt;br /&gt;
* PVU - Preview URL&lt;br /&gt;
* ALT - Alternate Locations&lt;br /&gt;
* CT - Creation time&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URN - Universal Resource Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies a universal resource name which can be used to identify the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
At least one instance of this child is required. Multiple instances are optional.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* '''bitprint''' or '''bp''' - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* '''sha1''' - 20 bytes of SHA1&lt;br /&gt;
* '''tree:tiger/''' or '''ttr''' - 24 bytes of tiger-tree root&lt;br /&gt;
* '''md5''' - 16 bytes of MD5&lt;br /&gt;
* '''ed2k''' - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URL - Universal Resource Location ===&lt;br /&gt;
&lt;br /&gt;
This child specifies a location where the object being described can be acquired.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and a URL is available.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If a /QH2/H/URL child was requested but is not present, the sending node may not&lt;br /&gt;
have the object. It is valid to advertise information about objects that are not&lt;br /&gt;
available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or a string which represents an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to an instance of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has the object available&lt;br /&gt;
locally. It can be retrieved with an HTTP request using the &amp;quot;uri-res&amp;quot; resolver.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== QH2/H/DN - Descriptive Name (Generic) Criteria ===&lt;br /&gt;
&lt;br /&gt;
The descriptive name for the object, and the object's size.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer indicating the object's size, followed by a string describing it. If a&lt;br /&gt;
/QH2/H/SZ child is present, the 32-bit size prefix is omitted here (allowing a larger&lt;br /&gt;
64 bit file size).&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/MD - Metadata ===&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The xml header is optional. Standard plural/singular&lt;br /&gt;
Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/SZ - Object Size ===&lt;br /&gt;
&lt;br /&gt;
Specifies the size of the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if DN was requested, and if the size is not to be packed into&lt;br /&gt;
the /QH2/H/DN child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit or 64-bit integer representing the object size.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/G - Group Identifier ===&lt;br /&gt;
&lt;br /&gt;
Indicates which hit group (/QH2/HG) this hit belongs to. If this child is not present,&lt;br /&gt;
the hit belongs to group zero.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Send this child if this hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If this child is present, the hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A single byte, the hit group ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ID - Object Identifier ===&lt;br /&gt;
&lt;br /&gt;
Specifies a 32-bit integer which uniquely identifies the object on the sender's system.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is not normally sent for search results. It is used in browse-user responses&lt;br /&gt;
to allow objects to be referenced by virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this ID to link objects to virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CSC - Cached Source Count ===&lt;br /&gt;
&lt;br /&gt;
Indicates the number of external cached sources known to the sending node.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if cached sources are available and interest in URLs was expressed&lt;br /&gt;
in the query.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 16-bit integer.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PART - Partial Content Tag ===&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node has only part of the object, and how much it has.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a /QH2/H/URL child is present and the URL contains only part of&lt;br /&gt;
the object.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer, the number of bytes available.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* MT - Modification Time (payload = 32-bit timestamp)&lt;br /&gt;
&lt;br /&gt;
The ''MT'' child carries the last modification time (UNIX timestamp) of the partial file and can be used to determine whether there has been recent updates made (''hot'' file) or if the file is ''cold'' (not undergoing any downloading activity on the remote side).&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/COM - User Comment ===&lt;br /&gt;
&lt;br /&gt;
Provides a user review and/or rating for the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a user comment is available, and comments were requested.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
An XML string, of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;comment rating=&amp;quot;n&amp;quot;&amp;gt;&lt;br /&gt;
The comment goes here.&lt;br /&gt;
&amp;lt;/comment&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rating is an integer 0 &amp;lt;= n &amp;lt;= 5, indicating the number of &amp;quot;stars&amp;quot;. The text&lt;br /&gt;
may not include HTML, but may include forum-style block codes and emoticon&lt;br /&gt;
notation.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PVU - Preview URL ===&lt;br /&gt;
&lt;br /&gt;
Indicates that a preview URL is available for the object. A preview URL will serve a&lt;br /&gt;
miniature version of the content.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a preview is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to a preview of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has a preview of the object&lt;br /&gt;
available locally. It can be retrieved with an HTTP request to the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
/gnutella/preview/v1?urn:xyz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ALT - Alternate Locations ===&lt;br /&gt;
&lt;br /&gt;
Supplies alternate download sources for the hit.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent when the query indicated that it wanted alternate locations, via the &amp;quot;A&amp;quot; string in its /Q2/I child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
The payload contains a vector of alternate locations, listing IPv4 addresses followed by 16-bit ports, as usual (e.g. the same format used to serialize an &amp;quot;NA&amp;quot; payload), but all the entries are concatenated.  Hence, a payload of 24 bytes will indicate that there are 4 entries of 6 bytes each.&lt;br /&gt;
&lt;br /&gt;
These alternate locations are the IP:port addresses of known hosts that can serve the file.  These can be G2 hosts or G1 hosts, but there are no differences since the file transfer protocol is identical for both networks.&lt;br /&gt;
&lt;br /&gt;
None of the addresses listed there are for firewalled hosts, so anyone should be able to contact them at their uri-res address, supplying the urn:sha1: value suitable for the resource.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CT - Creation Time ===&lt;br /&gt;
&lt;br /&gt;
Supplies the creation time of the resource.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent to indicate the creation time of the resource being returned.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
The payload contains a UNIX timestamp, supplying the time when the resource was created.  It is encoded using a '''variable-length''' encoding, which will ususally use 4 bytes, until 2038 is reached...&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/MD - Unified Metadata Block ==&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing one or more objects in the packet. This is an&lt;br /&gt;
alternative method of delivering metadata, which allows metadata for similar objects&lt;br /&gt;
to be grouped together. It is compatible with the unified metadata block format in&lt;br /&gt;
Gnutella1.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing one or more XML documents, each beginning with a header.&lt;br /&gt;
Standard plural/singular Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application index=&amp;quot;0&amp;quot; title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;images xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/image.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;1&amp;quot; description=&amp;quot;Shareaza Logo&amp;quot; width=&amp;quot;128&amp;quot; height=&amp;quot;128&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;2&amp;quot; description=&amp;quot;Shareaza Screen Shot&amp;quot; width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/images&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An additional attribute, &amp;quot;index&amp;quot; is added to each singular entry. The index is a zerobased&lt;br /&gt;
integer identifying the Nth /QH2/H child within this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/UPRO - User Profile ==&lt;br /&gt;
&lt;br /&gt;
Delivers a user profile or user profile summary, describing the user operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a version of this child if the operating user wishes to list their screen name in&lt;br /&gt;
search results.&lt;br /&gt;
&lt;br /&gt;
The current version of this packet contains a summary only, consisting of the&lt;br /&gt;
screen/nick name. Future versions may include a more comprehensive XML text&lt;br /&gt;
block in the payload.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
One child packet type is defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QH2/UPRO/NICK - Nick/screen Name&lt;br /&gt;
&lt;br /&gt;
=== /QH2/UPRO/NICK - Nick/Screen Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies the nick/screen name of the user.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HN - DNS Host Name ==&lt;br /&gt;
&lt;br /&gt;
This child conveys the DNS host name of the servent.  This is useful when the host has a dynamic IP address that can change over time, letting others know how they can recompute your IP address through a DNS lookup when the connection to the specified address (IP and port) is no longer working properly.  The port is not present here, since that is not supposed to change.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this child if you have a dynamic IP address and you know your DNS host name.  This cannot be automatically computed and requires user input.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The host name of the host, as a string, with no trailing NUL (since the payload only contains the name).  For instance, &amp;quot;g2host.example.com&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/TLS - TLS Support ==&lt;br /&gt;
&lt;br /&gt;
When present, this child indicates that the servent supports TLS connections.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this child if you are capable of initiating and receiving TLS connections.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BH - Browsable Host ==&lt;br /&gt;
&lt;br /&gt;
When present, this child indicates that the servent supports Browsing.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this children if you are capable of serving browsing requests using the &amp;lt;code&amp;gt;application/x-gnutella2&amp;lt;/code&amp;gt; Content-Type.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=PUSH&amp;diff=85150</id>
		<title>PUSH</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=PUSH&amp;diff=85150"/>
		<updated>2014-02-28T23:06:38Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Children */ Added the /PUSH/TLS child&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /PUSH =&lt;br /&gt;
&lt;br /&gt;
The push packet is used to request that a node initiate a TCP connection to a&lt;br /&gt;
specified node address. It is useful where the receiving node is unable to accept TCP&lt;br /&gt;
connections naturally.&lt;br /&gt;
&lt;br /&gt;
For more information about when to use PUSH packets: [[Node_Route_Cache_and_Addressed_Packet_Forwarding#Reverse_Connection_.28Push.29_Requests|Reverse Connection (Push) Requests]]&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
An addressed /PUSH packet should be sent to a hub with direct or proxy access to&lt;br /&gt;
the destination leaf node. It can be sent directly by a hub to one of its leaves without&lt;br /&gt;
the need for addressing.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /PUSH packet, the local node should initiate a TCP connection to&lt;br /&gt;
the elected node address and issue a &amp;quot;push handshake&amp;quot;, documented below.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
The network address of the node to contact, including of course the port number.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet only one known children at the current time, however it is often used with the generic addressing child packet &amp;quot;/?/TO&amp;quot; to indicate that it should be forwarded to a destination:&lt;br /&gt;
&lt;br /&gt;
* TLS - sending host supports TLS connections&lt;br /&gt;
&lt;br /&gt;
== /PUSH/TLS - TLS support indication ==&lt;br /&gt;
&lt;br /&gt;
If a /PUSH packet contains a /PUSH/TLS child marker, the sending host can accept TLS connections.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
This packet has no payload at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=Q2&amp;diff=85149</id>
		<title>Q2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=Q2&amp;diff=85149"/>
		<updated>2014-02-25T22:02:41Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* /Q2/NAT - Firewalled indication */ Documented /Q2/NAT semantics&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /Q2 - Gnutella2 Query =&lt;br /&gt;
&lt;br /&gt;
The /Q2 packet is the generic Gnutella2 object query descriptor. It contains search&lt;br /&gt;
criteria, identification, authentication, return addressing and the type of information&lt;br /&gt;
the search client is interested in.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
A node should send a /Q2 packet to another node when it wishes to execute a query&lt;br /&gt;
on that node (and its searchable relations).&lt;br /&gt;
/Q2 packets should always be filtered against a query hash table if one is available&lt;br /&gt;
for the outbound link.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a query, a node should:&lt;br /&gt;
&lt;br /&gt;
* Verify its authentication&lt;br /&gt;
* Send an acknowledgment if it was not received from a hub&lt;br /&gt;
* Forward it to connected nodes if necessary (detailed below)&lt;br /&gt;
* Process it locally and dispatch results&lt;br /&gt;
&lt;br /&gt;
== Forwarding ==&lt;br /&gt;
&lt;br /&gt;
Forwarding of /Q2 packets is achieved based on fixed rules:&lt;br /&gt;
&lt;br /&gt;
* A query received from a leaf or via UDP is forwarded to all connected nodes&lt;br /&gt;
* A query received from a hub is forwarded to connected leaves only&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
The payload of a /Q2 packet consists of a GUID which uniquely identifies the search&lt;br /&gt;
operation.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many defined child packet types at the current time:&lt;br /&gt;
* /Q2/UDP - Return Address and Authentication&lt;br /&gt;
* /Q2/URN - Universal Resource Name&lt;br /&gt;
* /Q2/DN - Descriptive Name (Generic) Criteria&lt;br /&gt;
* /Q2/MD - Metadata Criteria&lt;br /&gt;
* /Q2/SZR - Object Size Restriction Criteria&lt;br /&gt;
* /Q2/NAT - Network Address Translation - Indicates querying node is firewalled&lt;br /&gt;
* /Q2/I - Interest&lt;br /&gt;
&lt;br /&gt;
== /Q2/UDP - Return Address and Authentication ==&lt;br /&gt;
&lt;br /&gt;
The /Q2/UDP child packet specifies the return address to be used for all direct&lt;br /&gt;
replies, and the query key authentication which authorises transmissions to this&lt;br /&gt;
address. If the query key is invalid, the query should be discarded and a valid query&lt;br /&gt;
key issued to the nominated address (if desired).&lt;br /&gt;
&lt;br /&gt;
The query key is only checked by hubs receiving the query via UDP. Leaf nodes '''must ignore''' any query key held here.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required if the query is to be delivered via UDP. It is optional if delivered&lt;br /&gt;
via TCP: if not included, replies will be reverse forwarded via TCP.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
If this child is present, all replies should be directed to the nominated address. The&lt;br /&gt;
query key should be verified (by hubs only) before replying.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A network address (variable length) followed by a query key (fixed length of 32 bits).&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/URN - Universal Resource Name ==&lt;br /&gt;
&lt;br /&gt;
The /Q2/URN child specifies an exact universal resource name which will match the&lt;br /&gt;
query. Rules:&lt;br /&gt;
&lt;br /&gt;
* If one or more URNs are present in a query, whether or not they are understood, matching must occur on URN only and other criteria should be ignored.&lt;br /&gt;
* If multiple URNs are present, only one need match an object for it to be considered a match for the query.&lt;br /&gt;
* Following from the above, multiple URNs of the same family may be specified and match multiple objects (this allows a compound query for several known objects to be executed in one packet).&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child should be added if a specific URN is being sought.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* bitprint or bp - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* sha1 - 20 bytes of SHA1&lt;br /&gt;
* tree:tiger/ or ttr - 24 bytes of tiger-tree root&lt;br /&gt;
* md5 - 16 bytes of MD5&lt;br /&gt;
* ed2k - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/DN - Descriptive Name (Generic) Criteria ==&lt;br /&gt;
&lt;br /&gt;
The descriptive name child provides generic query text to be used in matching&lt;br /&gt;
objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string in the simple query language.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/MD - Metadata Criteria ==&lt;br /&gt;
&lt;br /&gt;
The metadata child provides an XML document containing rich query information.&lt;br /&gt;
The schema identified in the XML must match a metadata schema of prospective&lt;br /&gt;
matching objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The header is optional. Standard plural/singular Gnutella&lt;br /&gt;
metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All string values are in simple query language, including XML attribute and element&lt;br /&gt;
values.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/SZR - Size Restriction Criteria ==&lt;br /&gt;
&lt;br /&gt;
The size restriction criteria specify a minimum and maximum size for matching&lt;br /&gt;
objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A minimum size followed by a maximum size, both quoted in bytes. These two&lt;br /&gt;
numbers may be expressed as two 32 bit integers or two 64 bit integers.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/NAT - Firewalled indication ==&lt;br /&gt;
&lt;br /&gt;
This child indicates that the querying node is firewalled (cannot receive incoming UDP or TCP traffic).&lt;br /&gt;
&lt;br /&gt;
This means a firewalled node receiving a query with this child present '''should not''' reply to it, since there will be no way to establish a TCP connection between the querying party and the source to transmit the resource content.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
This packet has no payload.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/I - Interest ==&lt;br /&gt;
&lt;br /&gt;
The Interest packet advertises an interest in certain information classes, effectively&lt;br /&gt;
filtering the information that will be returned about matching objects.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send an interest packet to restrict the type of information that will be returned about&lt;br /&gt;
matching objects. For example if querying only to find instances of a known object,&lt;br /&gt;
advertise interest for &amp;quot;URL&amp;quot; only. Omitting the interest packet produces a default set&lt;br /&gt;
of response information.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
If an interest packet is received, only return the requested information types. If no&lt;br /&gt;
interest packet is present, return all available information that is feasible. Extensions&lt;br /&gt;
may be withheld.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
An array of strings identifying information classes. The following are defined:&lt;br /&gt;
&lt;br /&gt;
* URL - Locations where matching objects can be found&lt;br /&gt;
* DN - Descriptive names of matching objects&lt;br /&gt;
* MD - Full metadata of matching objects&lt;br /&gt;
* COM - User comments, ratings and reviews of matching objects&lt;br /&gt;
* PFS - Partially available objects&lt;br /&gt;
* A - Requests alternate download sources, returned in /QH2/H/ALT.&lt;br /&gt;
&lt;br /&gt;
Note that default URNs are always supplied and need not be requested.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=Q2&amp;diff=85148</id>
		<title>Q2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=Q2&amp;diff=85148"/>
		<updated>2014-02-25T21:57:02Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Children */ Documented /Q2/NAT, which seems to be used by Shareaza&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /Q2 - Gnutella2 Query =&lt;br /&gt;
&lt;br /&gt;
The /Q2 packet is the generic Gnutella2 object query descriptor. It contains search&lt;br /&gt;
criteria, identification, authentication, return addressing and the type of information&lt;br /&gt;
the search client is interested in.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
A node should send a /Q2 packet to another node when it wishes to execute a query&lt;br /&gt;
on that node (and its searchable relations).&lt;br /&gt;
/Q2 packets should always be filtered against a query hash table if one is available&lt;br /&gt;
for the outbound link.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a query, a node should:&lt;br /&gt;
&lt;br /&gt;
* Verify its authentication&lt;br /&gt;
* Send an acknowledgment if it was not received from a hub&lt;br /&gt;
* Forward it to connected nodes if necessary (detailed below)&lt;br /&gt;
* Process it locally and dispatch results&lt;br /&gt;
&lt;br /&gt;
== Forwarding ==&lt;br /&gt;
&lt;br /&gt;
Forwarding of /Q2 packets is achieved based on fixed rules:&lt;br /&gt;
&lt;br /&gt;
* A query received from a leaf or via UDP is forwarded to all connected nodes&lt;br /&gt;
* A query received from a hub is forwarded to connected leaves only&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
The payload of a /Q2 packet consists of a GUID which uniquely identifies the search&lt;br /&gt;
operation.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many defined child packet types at the current time:&lt;br /&gt;
* /Q2/UDP - Return Address and Authentication&lt;br /&gt;
* /Q2/URN - Universal Resource Name&lt;br /&gt;
* /Q2/DN - Descriptive Name (Generic) Criteria&lt;br /&gt;
* /Q2/MD - Metadata Criteria&lt;br /&gt;
* /Q2/SZR - Object Size Restriction Criteria&lt;br /&gt;
* /Q2/NAT - Network Address Translation - Indicates querying node is firewalled&lt;br /&gt;
* /Q2/I - Interest&lt;br /&gt;
&lt;br /&gt;
== /Q2/UDP - Return Address and Authentication ==&lt;br /&gt;
&lt;br /&gt;
The /Q2/UDP child packet specifies the return address to be used for all direct&lt;br /&gt;
replies, and the query key authentication which authorises transmissions to this&lt;br /&gt;
address. If the query key is invalid, the query should be discarded and a valid query&lt;br /&gt;
key issued to the nominated address (if desired).&lt;br /&gt;
&lt;br /&gt;
The query key is only checked by hubs receiving the query via UDP. Leaf nodes '''must ignore''' any query key held here.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required if the query is to be delivered via UDP. It is optional if delivered&lt;br /&gt;
via TCP: if not included, replies will be reverse forwarded via TCP.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
If this child is present, all replies should be directed to the nominated address. The&lt;br /&gt;
query key should be verified (by hubs only) before replying.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A network address (variable length) followed by a query key (fixed length of 32 bits).&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/URN - Universal Resource Name ==&lt;br /&gt;
&lt;br /&gt;
The /Q2/URN child specifies an exact universal resource name which will match the&lt;br /&gt;
query. Rules:&lt;br /&gt;
&lt;br /&gt;
* If one or more URNs are present in a query, whether or not they are understood, matching must occur on URN only and other criteria should be ignored.&lt;br /&gt;
* If multiple URNs are present, only one need match an object for it to be considered a match for the query.&lt;br /&gt;
* Following from the above, multiple URNs of the same family may be specified and match multiple objects (this allows a compound query for several known objects to be executed in one packet).&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child should be added if a specific URN is being sought.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* bitprint or bp - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* sha1 - 20 bytes of SHA1&lt;br /&gt;
* tree:tiger/ or ttr - 24 bytes of tiger-tree root&lt;br /&gt;
* md5 - 16 bytes of MD5&lt;br /&gt;
* ed2k - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/DN - Descriptive Name (Generic) Criteria ==&lt;br /&gt;
&lt;br /&gt;
The descriptive name child provides generic query text to be used in matching&lt;br /&gt;
objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string in the simple query language.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/MD - Metadata Criteria ==&lt;br /&gt;
&lt;br /&gt;
The metadata child provides an XML document containing rich query information.&lt;br /&gt;
The schema identified in the XML must match a metadata schema of prospective&lt;br /&gt;
matching objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The header is optional. Standard plural/singular Gnutella&lt;br /&gt;
metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All string values are in simple query language, including XML attribute and element&lt;br /&gt;
values.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/SZR - Size Restriction Criteria ==&lt;br /&gt;
&lt;br /&gt;
The size restriction criteria specify a minimum and maximum size for matching&lt;br /&gt;
objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A minimum size followed by a maximum size, both quoted in bytes. These two&lt;br /&gt;
numbers may be expressed as two 32 bit integers or two 64 bit integers.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/I - Interest ==&lt;br /&gt;
&lt;br /&gt;
The Interest packet advertises an interest in certain information classes, effectively&lt;br /&gt;
filtering the information that will be returned about matching objects.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send an interest packet to restrict the type of information that will be returned about&lt;br /&gt;
matching objects. For example if querying only to find instances of a known object,&lt;br /&gt;
advertise interest for &amp;quot;URL&amp;quot; only. Omitting the interest packet produces a default set&lt;br /&gt;
of response information.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
If an interest packet is received, only return the requested information types. If no&lt;br /&gt;
interest packet is present, return all available information that is feasible. Extensions&lt;br /&gt;
may be withheld.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
An array of strings identifying information classes. The following are defined:&lt;br /&gt;
&lt;br /&gt;
* URL - Locations where matching objects can be found&lt;br /&gt;
* DN - Descriptive names of matching objects&lt;br /&gt;
* MD - Full metadata of matching objects&lt;br /&gt;
* COM - User comments, ratings and reviews of matching objects&lt;br /&gt;
* PFS - Partially available objects&lt;br /&gt;
* A - Requests alternate download sources, returned in /QH2/H/ALT.&lt;br /&gt;
&lt;br /&gt;
Note that default URNs are always supplied and need not be requested.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=Object_Search_Mechanism&amp;diff=85147</id>
		<title>Object Search Mechanism</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=Object_Search_Mechanism&amp;diff=85147"/>
		<updated>2014-02-16T21:53:26Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Performance Considerations */ Fixed typo &amp;quot;sending&amp;quot; -&amp;gt; &amp;quot;receiving&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The distributed object search mechanism is a very important component of the&lt;br /&gt;
Gnutella2 architecture. It allows objects distributed throughout the network to be&lt;br /&gt;
located by a search client in an optimal fashion, requesting and receiving a subset of&lt;br /&gt;
the total information known about that object.&lt;br /&gt;
&lt;br /&gt;
== Model ==&lt;br /&gt;
&lt;br /&gt;
The Gnutella2 object search mechanism is best described as an &amp;quot;iterative crawl&amp;quot; of&lt;br /&gt;
the network, with a series of important optimisations derived from the network&lt;br /&gt;
topology and components:&lt;br /&gt;
&lt;br /&gt;
* A search client iteratively contacts known hubs with its query&lt;br /&gt;
* Hubs match the query against the cached hash tables of their neighbours&lt;br /&gt;
* Where a table hit occurs, the query is forwarded once only&lt;br /&gt;
* The single injected query thus effectively covers the logical hub cluster, which is the basic searchable unit&lt;br /&gt;
* Nodes which actually receive the filtered query process it and send results to the search client directly&lt;br /&gt;
&lt;br /&gt;
This model has a number of important advantages:&lt;br /&gt;
&lt;br /&gt;
* Wide network coverage is provided by iterative query injection&lt;br /&gt;
* Effective leaf density is increased by querying hub clusters rather than single hubs or even single nodes&lt;br /&gt;
* Mutual and two-level filtering and static link compression are leveraged&lt;br /&gt;
* The load on each hub cluster is spread equally between its member hubs, providing a larger search base with a lower cost on the aggregation points&lt;br /&gt;
* Hubs need a greater inbound bandwidth capacity than outbound bandwidth capacity, which ideally suits asymmetric Internet connections&lt;br /&gt;
&lt;br /&gt;
== Search Process Walkthrough ==&lt;br /&gt;
&lt;br /&gt;
When a search client wishes to execute a new search, the following events happen:&lt;br /&gt;
&lt;br /&gt;
* The search client selects an eligible hub from its global hub cache which has a recent timestamp, has not been contacted more recently than it allows, and has not yet been queried in this search.&lt;br /&gt;
* If a query key is not yet available for this hub, a query key request is dispatched.&lt;br /&gt;
* Once a query key is available, the search client sends a keyed query to the hub.&lt;br /&gt;
* Upon receiving the query, the hub checks the query key for validity.&lt;br /&gt;
* The hub then responds with a query acknowledgement packet, containing a list of neighbouring hubs which have now been searched and a list of 2-hop hubs which have not yet been searched.&lt;br /&gt;
* The search client adds the list of searched hubs to its &amp;quot;don't try again&amp;quot; list, and adds the list of &amp;quot;try hubs&amp;quot; to the global hub cache for future selection.&lt;br /&gt;
* Meanwhile, the hub examines the query to make sure that it has not received it before. Duplicate queries are dropped.&lt;br /&gt;
* The hub then matches the query against the query hash table of all connected nodes, and sends it to those nodes which may be able to field a match.&lt;br /&gt;
* While this is occurring, the hub processes the query locally and returns any results it may have.&lt;br /&gt;
* Leaves directly attached to the hub which have a potential match will have received the query, and process it locally. They may elect to return results directly to the search client, or may return their results to their hub for dispatch.&lt;br /&gt;
* Other hubs in the hub cluster which received the query now examine it to ensure they have not processed it before. They do not send an acknowledgement.&lt;br /&gt;
* Assuming it is new, the hubs match the query against the query hash tables of their leaves but not their neighbouring hubs. Potential leaves receive a copy of the query, and the hub processes it locally.&lt;br /&gt;
* Once again, the hub returns its own results and may forward results for its leaves if they do not wish to dispatch them directly.&lt;br /&gt;
* Meanwhile, the search client receives any search results generated by the hub cluster.&lt;br /&gt;
* The search client makes a decision on whether it should continue its search. If so, the process starts again.&lt;br /&gt;
* The search client will not requery any of the hubs in the hub cluster, but it has a list of nearby hubs so that the crawl can continue.&lt;br /&gt;
&lt;br /&gt;
== Performance Considerations ==&lt;br /&gt;
&lt;br /&gt;
Hubs should acknowledge /Q2 messages as quickly as possible with a /QA and not wait 5 or 10 minutes to reply.  Why?  Because the querying host is probably going to timeout, assuming the remote hub is off or too busy, and will start querying other hosts... which may already have been queried by the hub.  This creates a nasty ''avalanche effect'' whereby busy hubs get extra traffic to acknowledge, causing them to further delay responses and therefore cause more useless querying.&lt;br /&gt;
&lt;br /&gt;
The '''more delay''' there is between receiving of a /Q2 and acknowledging it via a /QA, the '''less effective''' the hub clustering topology will be.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=LNI&amp;diff=85146</id>
		<title>LNI</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=LNI&amp;diff=85146"/>
		<updated>2014-02-09T10:36:24Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* /LNI/TLS - TLS Support */ Documented &amp;quot;TLS&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /LNI - Local Node Information =&lt;br /&gt;
&lt;br /&gt;
The local node information packet is used to convey essential information about the&lt;br /&gt;
node on either end of a TCP stream connection.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
The /LNI packet should be sent to a TCP neighbour upon connection, and at regular&lt;br /&gt;
intervals following that if the information within it has changed. A minimum update&lt;br /&gt;
time of one minute is recommended.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /LNI packet, the information within should be stored for subsequent&lt;br /&gt;
use.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
This packet has no payload at the current time.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
The /LNI packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /LNI/NA - Node Address&lt;br /&gt;
* /LNI/GU - GUID&lt;br /&gt;
* /LNI/V - Vendor Code&lt;br /&gt;
* /LNI/LS - Library Statistics&lt;br /&gt;
* /LNI/HS - Hub Status&lt;br /&gt;
* /LNI/FW - Firewalled&lt;br /&gt;
* /LNI/QK - Query Key Caching&lt;br /&gt;
* /LNI/HA - Hub Able&lt;br /&gt;
* /LNI/RTR - Router&lt;br /&gt;
* /LNI/UP - Uptime&lt;br /&gt;
* /LNI/TLS - TLS Support&lt;br /&gt;
&lt;br /&gt;
== /LNI/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/NA child packet specifies the node or network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The physical network address of the sending node. See [[datatypes]] for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/GU - GUID ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/GU child packet specifies the globally unique identifier of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The 16 byte globally unique node identifier of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/V child packet specifies the vendor code of the software operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four byte vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/LS - Library Statistics ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/LS packet provides information about the content library of the sending&lt;br /&gt;
node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
Two 32-bit integers representing the number of files in the local library, and the total&lt;br /&gt;
KB in the local library respectively. If the sending node is a hub these statistics are&lt;br /&gt;
combined with the known statistics from all connected leaves. The payload may grow&lt;br /&gt;
beyond 8 bytes in the future.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/HS - Hub Status ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/HS packet is included only if the sending node is a hub, and contains the&lt;br /&gt;
status of the hub.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child packet should only be sent by hub nodes. Leaf nodes should not transmit&lt;br /&gt;
it, and if it is received from a leaf node, it should be ignored.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
Two 16-bit integers representing the current leaf count and the maximum leaf count&lt;br /&gt;
respectively. This packet may grow beyond 4 bytes in the future.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/UP - Uptime ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/UP packet contains the node uptime, measured in seconds.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child packet can be sent by any node (hub or leaf)&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A variable-length quantity: an uptime of less than 256 seconds will be transmitted using one single byte, less than 65536 will require only 2 bytes, etc...&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/TLS - TLS Support ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/TLS packet presence indicates that the node can initiate and receive TLS connections.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child packet can be sent by any node (hub or leaf) supporting TLS.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=LNI&amp;diff=85145</id>
		<title>LNI</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=LNI&amp;diff=85145"/>
		<updated>2014-02-09T10:34:15Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* /LNI Children */ Added &amp;quot;TLS&amp;quot; to indicate TLS Support&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /LNI - Local Node Information =&lt;br /&gt;
&lt;br /&gt;
The local node information packet is used to convey essential information about the&lt;br /&gt;
node on either end of a TCP stream connection.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
The /LNI packet should be sent to a TCP neighbour upon connection, and at regular&lt;br /&gt;
intervals following that if the information within it has changed. A minimum update&lt;br /&gt;
time of one minute is recommended.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /LNI packet, the information within should be stored for subsequent&lt;br /&gt;
use.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
This packet has no payload at the current time.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
The /LNI packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /LNI/NA - Node Address&lt;br /&gt;
* /LNI/GU - GUID&lt;br /&gt;
* /LNI/V - Vendor Code&lt;br /&gt;
* /LNI/LS - Library Statistics&lt;br /&gt;
* /LNI/HS - Hub Status&lt;br /&gt;
* /LNI/FW - Firewalled&lt;br /&gt;
* /LNI/QK - Query Key Caching&lt;br /&gt;
* /LNI/HA - Hub Able&lt;br /&gt;
* /LNI/RTR - Router&lt;br /&gt;
* /LNI/UP - Uptime&lt;br /&gt;
* /LNI/TLS - TLS Support&lt;br /&gt;
&lt;br /&gt;
== /LNI/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/NA child packet specifies the node or network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The physical network address of the sending node. See [[datatypes]] for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/GU - GUID ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/GU child packet specifies the globally unique identifier of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The 16 byte globally unique node identifier of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/V child packet specifies the vendor code of the software operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four byte vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/LS - Library Statistics ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/LS packet provides information about the content library of the sending&lt;br /&gt;
node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
Two 32-bit integers representing the number of files in the local library, and the total&lt;br /&gt;
KB in the local library respectively. If the sending node is a hub these statistics are&lt;br /&gt;
combined with the known statistics from all connected leaves. The payload may grow&lt;br /&gt;
beyond 8 bytes in the future.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/HS - Hub Status ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/HS packet is included only if the sending node is a hub, and contains the&lt;br /&gt;
status of the hub.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child packet should only be sent by hub nodes. Leaf nodes should not transmit&lt;br /&gt;
it, and if it is received from a leaf node, it should be ignored.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
Two 16-bit integers representing the current leaf count and the maximum leaf count&lt;br /&gt;
respectively. This packet may grow beyond 4 bytes in the future.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/UP - Uptime ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/UP packet contains the node uptime, measured in seconds.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child packet can be sent by any node (hub or leaf)&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A variable-length quantity: an uptime of less than 256 seconds will be transmitted using one single byte, less than 65536 will require only 2 bytes, etc...&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QH2&amp;diff=85144</id>
		<title>QH2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QH2&amp;diff=85144"/>
		<updated>2014-02-09T10:05:37Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* /QH2/H/ - Hit Descriptor */ Documented &amp;quot;CT&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QH2 - Query Hit =&lt;br /&gt;
&lt;br /&gt;
The /QH2 Gnutella2 query hit packet contains one or more search result descriptors,&lt;br /&gt;
along with information about the node generating the result set. A single node may&lt;br /&gt;
generate several /QH2 packets in response to a /[[Q2]] query. Like all Gnutella2&lt;br /&gt;
packets, the /QH2 packet is highly extensible.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
Send a /QH2 packet when processing a /[[Q2]] query packet reveals one or more&lt;br /&gt;
matching objects. Query hits can be returned directly to the /Q2/UDP return address&lt;br /&gt;
in the query, or routed back along the delivery chain. Firewalled leaf nodes are&lt;br /&gt;
advised to return /QH2 packets to their connected hub for dispatch, as the hub will&lt;br /&gt;
be able to make a reliable delivery.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QH2 query hit packet, check the query GUID against locally&lt;br /&gt;
initiated queries. If it originated elsewhere, increment the route-back hop counter&lt;br /&gt;
and forward it to the most appropriate link or UDP endpoint. If it matches a locally&lt;br /&gt;
generated query, process the search results.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
A single byte representing the hop count, followed by a 16 byte GUID identifying the&lt;br /&gt;
search that produced these results.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* FW - Firewalled Servent&lt;br /&gt;
* H - Hit Descriptor&lt;br /&gt;
* HG - Hit Group Descriptor&lt;br /&gt;
* GU - Node GUID&lt;br /&gt;
* NA - Node Address&lt;br /&gt;
* NH - Neighbouring Hub&lt;br /&gt;
* V - Vendor Code&lt;br /&gt;
* MD - Unified Metadata Block&lt;br /&gt;
* UPRO - User Profile&lt;br /&gt;
* BUP - Browse User Profile Tag&lt;br /&gt;
* PCH - Peer Chat Tag&lt;br /&gt;
* HN - DNS Host Name of Servent (e.g. &amp;quot;g2.example.com&amp;quot;)&lt;br /&gt;
* TLS - TLS Support&lt;br /&gt;
* BH - Browsable Host&lt;br /&gt;
&lt;br /&gt;
== /QH2/FW - Firewalled Servent ==&lt;br /&gt;
&lt;br /&gt;
Specifies that the sending node is ''firewalled'' and cannot accept incoming connections.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is sent only when the servent issuing the hit is firewalled.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
There is no payload defined.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/GU - Node GUID ==&lt;br /&gt;
&lt;br /&gt;
Specifies the GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
Specifies the node / network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional but recommended.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of the sending node. See datatypes for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NH - Neighbouring Hub ==&lt;br /&gt;
&lt;br /&gt;
Lists a hub to which the sending node (a leaf) is connected. This provides a contact&lt;br /&gt;
point for routing communications to a possibly firewalled leaf node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional, and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of a hub to which the sending node is connected.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
Identifies the software operating the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four character vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BUP - Browse User Profile Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports browsing the local user profile.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/PCH - Peer Chat Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports person to person private message chat.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HG - Hit Group Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a group of search results.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A single byte, the group ID number.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type currently defined:&lt;br /&gt;
&lt;br /&gt;
* SS - Server State&lt;br /&gt;
&lt;br /&gt;
=== /QH2/HG/SS - Server State ===&lt;br /&gt;
&lt;br /&gt;
Provides a status snapshot of the upload server that applies to search results in the&lt;br /&gt;
current hit group.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Add this child to the hit group descriptor to provide server state information.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this information when interpreting hits linked with this hit group.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
* A 16-bit integer : the current queue length including any active transfers (number waiting plus number transferring)&lt;br /&gt;
* An 8-bit integer : the maximum number of concurrent transfers (capacity)&lt;br /&gt;
* A 32-bit integer : the speed in kilobits per second for uploads on this server module&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/H - Hit Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a single object which matched the original query.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QH2/H child for each matching object to be included in this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time, and is often&lt;br /&gt;
extended:&lt;br /&gt;
&lt;br /&gt;
* URN - Universal Resource Name&lt;br /&gt;
* URL - Universal Resource Location&lt;br /&gt;
* DN - Descriptive Name&lt;br /&gt;
* MD - Metadata&lt;br /&gt;
* SZ - Object Size&lt;br /&gt;
* G - Group Identifier&lt;br /&gt;
* ID - Object Identifier&lt;br /&gt;
* CSC - Cached Source Count&lt;br /&gt;
* PART - Partial Availability Marker&lt;br /&gt;
* COM - User Comment&lt;br /&gt;
* PVU - Preview URL&lt;br /&gt;
* ALT - Alternate Locations&lt;br /&gt;
* CT - Creation time&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URN - Universal Resource Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies a universal resource name which can be used to identify the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
At least one instance of this child is required. Multiple instances are optional.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* '''bitprint''' or '''bp''' - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* '''sha1''' - 20 bytes of SHA1&lt;br /&gt;
* '''tree:tiger/''' or '''ttr''' - 24 bytes of tiger-tree root&lt;br /&gt;
* '''md5''' - 16 bytes of MD5&lt;br /&gt;
* '''ed2k''' - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URL - Universal Resource Location ===&lt;br /&gt;
&lt;br /&gt;
This child specifies a location where the object being described can be acquired.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and a URL is available.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If a /QH2/H/URL child was requested but is not present, the sending node may not&lt;br /&gt;
have the object. It is valid to advertise information about objects that are not&lt;br /&gt;
available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or a string which represents an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to an instance of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has the object available&lt;br /&gt;
locally. It can be retrieved with an HTTP request using the &amp;quot;uri-res&amp;quot; resolver.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== QH2/H/DN - Descriptive Name (Generic) Criteria ===&lt;br /&gt;
&lt;br /&gt;
The descriptive name for the object, and the object's size.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer indicating the object's size, followed by a string describing it. If a&lt;br /&gt;
/QH2/H/SZ child is present, the 32-bit size prefix is omitted here (allowing a larger&lt;br /&gt;
64 bit file size).&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/MD - Metadata ===&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The xml header is optional. Standard plural/singular&lt;br /&gt;
Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/SZ - Object Size ===&lt;br /&gt;
&lt;br /&gt;
Specifies the size of the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if DN was requested, and if the size is not to be packed into&lt;br /&gt;
the /QH2/H/DN child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit or 64-bit integer representing the object size.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/G - Group Identifier ===&lt;br /&gt;
&lt;br /&gt;
Indicates which hit group (/QH2/HG) this hit belongs to. If this child is not present,&lt;br /&gt;
the hit belongs to group zero.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Send this child if this hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If this child is present, the hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A single byte, the hit group ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ID - Object Identifier ===&lt;br /&gt;
&lt;br /&gt;
Specifies a 32-bit integer which uniquely identifies the object on the sender's system.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is not normally sent for search results. It is used in browse-user responses&lt;br /&gt;
to allow objects to be referenced by virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this ID to link objects to virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CSC - Cached Source Count ===&lt;br /&gt;
&lt;br /&gt;
Indicates the number of external cached sources known to the sending node.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if cached sources are available and interest in URLs was expressed&lt;br /&gt;
in the query.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 16-bit integer.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PART - Partial Content Tag ===&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node has only part of the object, and how much it has.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a /QH2/H/URL child is present and the URL contains only part of&lt;br /&gt;
the object.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer, the number of bytes available.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* MT - Modification Time (payload = 32-bit timestamp)&lt;br /&gt;
&lt;br /&gt;
The ''MT'' child carries the last modification time (UNIX timestamp) of the partial file and can be used to determine whether there has been recent updates made (''hot'' file) or if the file is ''cold'' (not undergoing any downloading activity on the remote side).&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/COM - User Comment ===&lt;br /&gt;
&lt;br /&gt;
Provides a user review and/or rating for the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a user comment is available, and comments were requested.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
An XML string, of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;comment rating=&amp;quot;n&amp;quot;&amp;gt;&lt;br /&gt;
The comment goes here.&lt;br /&gt;
&amp;lt;/comment&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rating is an integer 0 &amp;lt;= n &amp;lt;= 5, indicating the number of &amp;quot;stars&amp;quot;. The text&lt;br /&gt;
may not include HTML, but may include forum-style block codes and emoticon&lt;br /&gt;
notation.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PVU - Preview URL ===&lt;br /&gt;
&lt;br /&gt;
Indicates that a preview URL is available for the object. A preview URL will serve a&lt;br /&gt;
miniature version of the content.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a preview is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to a preview of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has a preview of the object&lt;br /&gt;
available locally. It can be retrieved with an HTTP request to the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
/gnutella/preview/v1?urn:xyz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ALT - Alternate Locations ===&lt;br /&gt;
&lt;br /&gt;
Supplies alternate download sources for the hit.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent when the query indicated that it wanted alternate locations, via the &amp;quot;A&amp;quot; string in its /Q2/I child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
The payload contains a vector of alternate locations, listing IPv4 addresses followed by 16-bit ports, as usual (e.g. the same format used to serialize an &amp;quot;NA&amp;quot; payload), but all the entries are concatenated.  Hence, a payload of 24 bytes will indicate that there are 4 entries of 6 bytes each.&lt;br /&gt;
&lt;br /&gt;
These alternate locations are the IP:port addresses of known hosts that can serve the file.  These can be G2 hosts or G1 hosts, but there are no differences since the file transfer protocol is identical for both networks.&lt;br /&gt;
&lt;br /&gt;
None of the addresses listed there are for firewalled hosts, so anyone should be able to contact them at their uri-res address, supplying the urn:sha1: value suitable for the resource.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CT - Creation Time ===&lt;br /&gt;
&lt;br /&gt;
Supplies the creation time of the resource.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent to indicate the creation time of the resource being returned.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
The payload contains a UNIX timestamp, supplying the time when the resource was created.  It is encoded using a '''variable-length''' encoding, which will ususally use 4 bytes, until 2038 is reached...&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/MD - Unified Metadata Block ==&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing one or more objects in the packet. This is an&lt;br /&gt;
alternative method of delivering metadata, which allows metadata for similar objects&lt;br /&gt;
to be grouped together. It is compatible with the unified metadata block format in&lt;br /&gt;
Gnutella1.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing one or more XML documents, each beginning with a header.&lt;br /&gt;
Standard plural/singular Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application index=&amp;quot;0&amp;quot; title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;images xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/image.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;1&amp;quot; description=&amp;quot;Shareaza Logo&amp;quot; width=&amp;quot;128&amp;quot; height=&amp;quot;128&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;2&amp;quot; description=&amp;quot;Shareaza Screen Shot&amp;quot; width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/images&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An additional attribute, &amp;quot;index&amp;quot; is added to each singular entry. The index is a zerobased&lt;br /&gt;
integer identifying the Nth /QH2/H child within this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/UPRO - User Profile ==&lt;br /&gt;
&lt;br /&gt;
Delivers a user profile or user profile summary, describing the user operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a version of this child if the operating user wishes to list their screen name in&lt;br /&gt;
search results.&lt;br /&gt;
&lt;br /&gt;
The current version of this packet contains a summary only, consisting of the&lt;br /&gt;
screen/nick name. Future versions may include a more comprehensive XML text&lt;br /&gt;
block in the payload.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
One child packet type is defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QH2/UPRO/NICK - Nick/screen Name&lt;br /&gt;
&lt;br /&gt;
=== /QH2/UPRO/NICK - Nick/Screen Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies the nick/screen name of the user.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HN - DNS Host Name ==&lt;br /&gt;
&lt;br /&gt;
This child conveys the DNS host name of the servent.  This is useful when the host has a dynamic IP address that can change over time, letting others know how they can recompute your IP address through a DNS lookup when the connection to the specified address (IP and port) is no longer working properly.  The port is not present here, since that is not supposed to change.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this child if you have a dynamic IP address and you know your DNS host name.  This cannot be automatically computed and requires user input.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The host name of the host, as a string, with no trailing NUL (since the payload only contains the name).  For instance, &amp;quot;g2host.example.com&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/TLS - TLS Support ==&lt;br /&gt;
&lt;br /&gt;
When present, this child indicates that the servent supports TLS connections.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this child if you are capable of initiating and receiving TLS connections.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BH - Browsable Host ==&lt;br /&gt;
&lt;br /&gt;
When present, this child indicates that the servent supports Browsing.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this children if you are capable of serving browsing requests using the &amp;lt;code&amp;gt;application/x-gnutella2&amp;lt;/code&amp;gt; Content-Type.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QH2&amp;diff=85143</id>
		<title>QH2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QH2&amp;diff=85143"/>
		<updated>2014-02-09T09:58:52Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Children */ Added &amp;quot;CT&amp;quot;, the Creation Time&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QH2 - Query Hit =&lt;br /&gt;
&lt;br /&gt;
The /QH2 Gnutella2 query hit packet contains one or more search result descriptors,&lt;br /&gt;
along with information about the node generating the result set. A single node may&lt;br /&gt;
generate several /QH2 packets in response to a /[[Q2]] query. Like all Gnutella2&lt;br /&gt;
packets, the /QH2 packet is highly extensible.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
Send a /QH2 packet when processing a /[[Q2]] query packet reveals one or more&lt;br /&gt;
matching objects. Query hits can be returned directly to the /Q2/UDP return address&lt;br /&gt;
in the query, or routed back along the delivery chain. Firewalled leaf nodes are&lt;br /&gt;
advised to return /QH2 packets to their connected hub for dispatch, as the hub will&lt;br /&gt;
be able to make a reliable delivery.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QH2 query hit packet, check the query GUID against locally&lt;br /&gt;
initiated queries. If it originated elsewhere, increment the route-back hop counter&lt;br /&gt;
and forward it to the most appropriate link or UDP endpoint. If it matches a locally&lt;br /&gt;
generated query, process the search results.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
A single byte representing the hop count, followed by a 16 byte GUID identifying the&lt;br /&gt;
search that produced these results.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* FW - Firewalled Servent&lt;br /&gt;
* H - Hit Descriptor&lt;br /&gt;
* HG - Hit Group Descriptor&lt;br /&gt;
* GU - Node GUID&lt;br /&gt;
* NA - Node Address&lt;br /&gt;
* NH - Neighbouring Hub&lt;br /&gt;
* V - Vendor Code&lt;br /&gt;
* MD - Unified Metadata Block&lt;br /&gt;
* UPRO - User Profile&lt;br /&gt;
* BUP - Browse User Profile Tag&lt;br /&gt;
* PCH - Peer Chat Tag&lt;br /&gt;
* HN - DNS Host Name of Servent (e.g. &amp;quot;g2.example.com&amp;quot;)&lt;br /&gt;
* TLS - TLS Support&lt;br /&gt;
* BH - Browsable Host&lt;br /&gt;
&lt;br /&gt;
== /QH2/FW - Firewalled Servent ==&lt;br /&gt;
&lt;br /&gt;
Specifies that the sending node is ''firewalled'' and cannot accept incoming connections.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is sent only when the servent issuing the hit is firewalled.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
There is no payload defined.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/GU - Node GUID ==&lt;br /&gt;
&lt;br /&gt;
Specifies the GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
Specifies the node / network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional but recommended.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of the sending node. See datatypes for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NH - Neighbouring Hub ==&lt;br /&gt;
&lt;br /&gt;
Lists a hub to which the sending node (a leaf) is connected. This provides a contact&lt;br /&gt;
point for routing communications to a possibly firewalled leaf node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional, and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of a hub to which the sending node is connected.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
Identifies the software operating the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four character vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BUP - Browse User Profile Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports browsing the local user profile.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/PCH - Peer Chat Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports person to person private message chat.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HG - Hit Group Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a group of search results.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A single byte, the group ID number.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type currently defined:&lt;br /&gt;
&lt;br /&gt;
* SS - Server State&lt;br /&gt;
&lt;br /&gt;
=== /QH2/HG/SS - Server State ===&lt;br /&gt;
&lt;br /&gt;
Provides a status snapshot of the upload server that applies to search results in the&lt;br /&gt;
current hit group.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Add this child to the hit group descriptor to provide server state information.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this information when interpreting hits linked with this hit group.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
* A 16-bit integer : the current queue length including any active transfers (number waiting plus number transferring)&lt;br /&gt;
* An 8-bit integer : the maximum number of concurrent transfers (capacity)&lt;br /&gt;
* A 32-bit integer : the speed in kilobits per second for uploads on this server module&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/H - Hit Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a single object which matched the original query.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QH2/H child for each matching object to be included in this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time, and is often&lt;br /&gt;
extended:&lt;br /&gt;
&lt;br /&gt;
* URN - Universal Resource Name&lt;br /&gt;
* URL - Universal Resource Location&lt;br /&gt;
* DN - Descriptive Name&lt;br /&gt;
* MD - Metadata&lt;br /&gt;
* SZ - Object Size&lt;br /&gt;
* G - Group Identifier&lt;br /&gt;
* ID - Object Identifier&lt;br /&gt;
* CSC - Cached Source Count&lt;br /&gt;
* PART - Partial Availability Marker&lt;br /&gt;
* COM - User Comment&lt;br /&gt;
* PVU - Preview URL&lt;br /&gt;
* ALT - Alternate Locations&lt;br /&gt;
* CT - Creation time&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URN - Universal Resource Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies a universal resource name which can be used to identify the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
At least one instance of this child is required. Multiple instances are optional.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* '''bitprint''' or '''bp''' - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* '''sha1''' - 20 bytes of SHA1&lt;br /&gt;
* '''tree:tiger/''' or '''ttr''' - 24 bytes of tiger-tree root&lt;br /&gt;
* '''md5''' - 16 bytes of MD5&lt;br /&gt;
* '''ed2k''' - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URL - Universal Resource Location ===&lt;br /&gt;
&lt;br /&gt;
This child specifies a location where the object being described can be acquired.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and a URL is available.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If a /QH2/H/URL child was requested but is not present, the sending node may not&lt;br /&gt;
have the object. It is valid to advertise information about objects that are not&lt;br /&gt;
available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or a string which represents an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to an instance of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has the object available&lt;br /&gt;
locally. It can be retrieved with an HTTP request using the &amp;quot;uri-res&amp;quot; resolver.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== QH2/H/DN - Descriptive Name (Generic) Criteria ===&lt;br /&gt;
&lt;br /&gt;
The descriptive name for the object, and the object's size.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer indicating the object's size, followed by a string describing it. If a&lt;br /&gt;
/QH2/H/SZ child is present, the 32-bit size prefix is omitted here (allowing a larger&lt;br /&gt;
64 bit file size).&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/MD - Metadata ===&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The xml header is optional. Standard plural/singular&lt;br /&gt;
Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/SZ - Object Size ===&lt;br /&gt;
&lt;br /&gt;
Specifies the size of the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if DN was requested, and if the size is not to be packed into&lt;br /&gt;
the /QH2/H/DN child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit or 64-bit integer representing the object size.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/G - Group Identifier ===&lt;br /&gt;
&lt;br /&gt;
Indicates which hit group (/QH2/HG) this hit belongs to. If this child is not present,&lt;br /&gt;
the hit belongs to group zero.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Send this child if this hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If this child is present, the hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A single byte, the hit group ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ID - Object Identifier ===&lt;br /&gt;
&lt;br /&gt;
Specifies a 32-bit integer which uniquely identifies the object on the sender's system.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is not normally sent for search results. It is used in browse-user responses&lt;br /&gt;
to allow objects to be referenced by virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this ID to link objects to virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CSC - Cached Source Count ===&lt;br /&gt;
&lt;br /&gt;
Indicates the number of external cached sources known to the sending node.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if cached sources are available and interest in URLs was expressed&lt;br /&gt;
in the query.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 16-bit integer.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PART - Partial Content Tag ===&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node has only part of the object, and how much it has.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a /QH2/H/URL child is present and the URL contains only part of&lt;br /&gt;
the object.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer, the number of bytes available.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* MT - Modification Time (payload = 32-bit timestamp)&lt;br /&gt;
&lt;br /&gt;
The ''MT'' child carries the last modification time (UNIX timestamp) of the partial file and can be used to determine whether there has been recent updates made (''hot'' file) or if the file is ''cold'' (not undergoing any downloading activity on the remote side).&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/COM - User Comment ===&lt;br /&gt;
&lt;br /&gt;
Provides a user review and/or rating for the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a user comment is available, and comments were requested.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
An XML string, of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;comment rating=&amp;quot;n&amp;quot;&amp;gt;&lt;br /&gt;
The comment goes here.&lt;br /&gt;
&amp;lt;/comment&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rating is an integer 0 &amp;lt;= n &amp;lt;= 5, indicating the number of &amp;quot;stars&amp;quot;. The text&lt;br /&gt;
may not include HTML, but may include forum-style block codes and emoticon&lt;br /&gt;
notation.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PVU - Preview URL ===&lt;br /&gt;
&lt;br /&gt;
Indicates that a preview URL is available for the object. A preview URL will serve a&lt;br /&gt;
miniature version of the content.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a preview is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to a preview of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has a preview of the object&lt;br /&gt;
available locally. It can be retrieved with an HTTP request to the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
/gnutella/preview/v1?urn:xyz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ALT - Alternate Locations ===&lt;br /&gt;
&lt;br /&gt;
Supplies alternate download sources for the hit.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent when the query indicated that it wanted alternate locations, via the &amp;quot;A&amp;quot; string in its /Q2/I child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
The payload contains a vector of alternate locations, listing IPv4 addresses followed by 16-bit ports, as usual (e.g. the same format used to serialize an &amp;quot;NA&amp;quot; payload), but all the entries are concatenated.  Hence, a payload of 24 bytes will indicate that there are 4 entries of 6 bytes each.&lt;br /&gt;
&lt;br /&gt;
These alternate locations are the IP:port addresses of known hosts that can serve the file.  These can be G2 hosts or G1 hosts, but there are no differences since the file transfer protocol is identical for both networks.&lt;br /&gt;
&lt;br /&gt;
None of the addresses listed there are for firewalled hosts, so anyone should be able to contact them at their uri-res address, supplying the urn:sha1: value suitable for the resource.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/MD - Unified Metadata Block ==&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing one or more objects in the packet. This is an&lt;br /&gt;
alternative method of delivering metadata, which allows metadata for similar objects&lt;br /&gt;
to be grouped together. It is compatible with the unified metadata block format in&lt;br /&gt;
Gnutella1.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing one or more XML documents, each beginning with a header.&lt;br /&gt;
Standard plural/singular Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application index=&amp;quot;0&amp;quot; title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;images xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/image.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;1&amp;quot; description=&amp;quot;Shareaza Logo&amp;quot; width=&amp;quot;128&amp;quot; height=&amp;quot;128&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;2&amp;quot; description=&amp;quot;Shareaza Screen Shot&amp;quot; width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/images&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An additional attribute, &amp;quot;index&amp;quot; is added to each singular entry. The index is a zerobased&lt;br /&gt;
integer identifying the Nth /QH2/H child within this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/UPRO - User Profile ==&lt;br /&gt;
&lt;br /&gt;
Delivers a user profile or user profile summary, describing the user operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a version of this child if the operating user wishes to list their screen name in&lt;br /&gt;
search results.&lt;br /&gt;
&lt;br /&gt;
The current version of this packet contains a summary only, consisting of the&lt;br /&gt;
screen/nick name. Future versions may include a more comprehensive XML text&lt;br /&gt;
block in the payload.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
One child packet type is defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QH2/UPRO/NICK - Nick/screen Name&lt;br /&gt;
&lt;br /&gt;
=== /QH2/UPRO/NICK - Nick/Screen Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies the nick/screen name of the user.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HN - DNS Host Name ==&lt;br /&gt;
&lt;br /&gt;
This child conveys the DNS host name of the servent.  This is useful when the host has a dynamic IP address that can change over time, letting others know how they can recompute your IP address through a DNS lookup when the connection to the specified address (IP and port) is no longer working properly.  The port is not present here, since that is not supposed to change.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this child if you have a dynamic IP address and you know your DNS host name.  This cannot be automatically computed and requires user input.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The host name of the host, as a string, with no trailing NUL (since the payload only contains the name).  For instance, &amp;quot;g2host.example.com&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/TLS - TLS Support ==&lt;br /&gt;
&lt;br /&gt;
When present, this child indicates that the servent supports TLS connections.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this child if you are capable of initiating and receiving TLS connections.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BH - Browsable Host ==&lt;br /&gt;
&lt;br /&gt;
When present, this child indicates that the servent supports Browsing.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this children if you are capable of serving browsing requests using the &amp;lt;code&amp;gt;application/x-gnutella2&amp;lt;/code&amp;gt; Content-Type.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QH2&amp;diff=85142</id>
		<title>QH2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QH2&amp;diff=85142"/>
		<updated>2014-02-09T09:56:48Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* /QH2 */ Documented &amp;quot;HN&amp;quot;, &amp;quot;TLS&amp;quot; and &amp;quot;BH&amp;quot; children.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QH2 - Query Hit =&lt;br /&gt;
&lt;br /&gt;
The /QH2 Gnutella2 query hit packet contains one or more search result descriptors,&lt;br /&gt;
along with information about the node generating the result set. A single node may&lt;br /&gt;
generate several /QH2 packets in response to a /[[Q2]] query. Like all Gnutella2&lt;br /&gt;
packets, the /QH2 packet is highly extensible.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
Send a /QH2 packet when processing a /[[Q2]] query packet reveals one or more&lt;br /&gt;
matching objects. Query hits can be returned directly to the /Q2/UDP return address&lt;br /&gt;
in the query, or routed back along the delivery chain. Firewalled leaf nodes are&lt;br /&gt;
advised to return /QH2 packets to their connected hub for dispatch, as the hub will&lt;br /&gt;
be able to make a reliable delivery.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QH2 query hit packet, check the query GUID against locally&lt;br /&gt;
initiated queries. If it originated elsewhere, increment the route-back hop counter&lt;br /&gt;
and forward it to the most appropriate link or UDP endpoint. If it matches a locally&lt;br /&gt;
generated query, process the search results.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
A single byte representing the hop count, followed by a 16 byte GUID identifying the&lt;br /&gt;
search that produced these results.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* FW - Firewalled Servent&lt;br /&gt;
* H - Hit Descriptor&lt;br /&gt;
* HG - Hit Group Descriptor&lt;br /&gt;
* GU - Node GUID&lt;br /&gt;
* NA - Node Address&lt;br /&gt;
* NH - Neighbouring Hub&lt;br /&gt;
* V - Vendor Code&lt;br /&gt;
* MD - Unified Metadata Block&lt;br /&gt;
* UPRO - User Profile&lt;br /&gt;
* BUP - Browse User Profile Tag&lt;br /&gt;
* PCH - Peer Chat Tag&lt;br /&gt;
* HN - DNS Host Name of Servent (e.g. &amp;quot;g2.example.com&amp;quot;)&lt;br /&gt;
* TLS - TLS Support&lt;br /&gt;
* BH - Browsable Host&lt;br /&gt;
&lt;br /&gt;
== /QH2/FW - Firewalled Servent ==&lt;br /&gt;
&lt;br /&gt;
Specifies that the sending node is ''firewalled'' and cannot accept incoming connections.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is sent only when the servent issuing the hit is firewalled.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
There is no payload defined.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/GU - Node GUID ==&lt;br /&gt;
&lt;br /&gt;
Specifies the GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
Specifies the node / network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional but recommended.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of the sending node. See datatypes for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NH - Neighbouring Hub ==&lt;br /&gt;
&lt;br /&gt;
Lists a hub to which the sending node (a leaf) is connected. This provides a contact&lt;br /&gt;
point for routing communications to a possibly firewalled leaf node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional, and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of a hub to which the sending node is connected.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
Identifies the software operating the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four character vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BUP - Browse User Profile Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports browsing the local user profile.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/PCH - Peer Chat Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports person to person private message chat.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HG - Hit Group Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a group of search results.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A single byte, the group ID number.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type currently defined:&lt;br /&gt;
&lt;br /&gt;
* SS - Server State&lt;br /&gt;
&lt;br /&gt;
=== /QH2/HG/SS - Server State ===&lt;br /&gt;
&lt;br /&gt;
Provides a status snapshot of the upload server that applies to search results in the&lt;br /&gt;
current hit group.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Add this child to the hit group descriptor to provide server state information.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this information when interpreting hits linked with this hit group.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
* A 16-bit integer : the current queue length including any active transfers (number waiting plus number transferring)&lt;br /&gt;
* An 8-bit integer : the maximum number of concurrent transfers (capacity)&lt;br /&gt;
* A 32-bit integer : the speed in kilobits per second for uploads on this server module&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/H - Hit Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a single object which matched the original query.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QH2/H child for each matching object to be included in this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time, and is often&lt;br /&gt;
extended:&lt;br /&gt;
&lt;br /&gt;
* URN - Universal Resource Name&lt;br /&gt;
* URL - Universal Resource Location&lt;br /&gt;
* DN - Descriptive Name&lt;br /&gt;
* MD - Metadata&lt;br /&gt;
* SZ - Object Size&lt;br /&gt;
* G - Group Identifier&lt;br /&gt;
* ID - Object Identifier&lt;br /&gt;
* CSC - Cached Source Count&lt;br /&gt;
* PART - Partial Availability Marker&lt;br /&gt;
* COM - User Comment&lt;br /&gt;
* PVU - Preview URL&lt;br /&gt;
* ALT - Alternate Locations&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URN - Universal Resource Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies a universal resource name which can be used to identify the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
At least one instance of this child is required. Multiple instances are optional.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* '''bitprint''' or '''bp''' - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* '''sha1''' - 20 bytes of SHA1&lt;br /&gt;
* '''tree:tiger/''' or '''ttr''' - 24 bytes of tiger-tree root&lt;br /&gt;
* '''md5''' - 16 bytes of MD5&lt;br /&gt;
* '''ed2k''' - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URL - Universal Resource Location ===&lt;br /&gt;
&lt;br /&gt;
This child specifies a location where the object being described can be acquired.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and a URL is available.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If a /QH2/H/URL child was requested but is not present, the sending node may not&lt;br /&gt;
have the object. It is valid to advertise information about objects that are not&lt;br /&gt;
available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or a string which represents an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to an instance of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has the object available&lt;br /&gt;
locally. It can be retrieved with an HTTP request using the &amp;quot;uri-res&amp;quot; resolver.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== QH2/H/DN - Descriptive Name (Generic) Criteria ===&lt;br /&gt;
&lt;br /&gt;
The descriptive name for the object, and the object's size.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer indicating the object's size, followed by a string describing it. If a&lt;br /&gt;
/QH2/H/SZ child is present, the 32-bit size prefix is omitted here (allowing a larger&lt;br /&gt;
64 bit file size).&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/MD - Metadata ===&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The xml header is optional. Standard plural/singular&lt;br /&gt;
Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/SZ - Object Size ===&lt;br /&gt;
&lt;br /&gt;
Specifies the size of the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if DN was requested, and if the size is not to be packed into&lt;br /&gt;
the /QH2/H/DN child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit or 64-bit integer representing the object size.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/G - Group Identifier ===&lt;br /&gt;
&lt;br /&gt;
Indicates which hit group (/QH2/HG) this hit belongs to. If this child is not present,&lt;br /&gt;
the hit belongs to group zero.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Send this child if this hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If this child is present, the hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A single byte, the hit group ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ID - Object Identifier ===&lt;br /&gt;
&lt;br /&gt;
Specifies a 32-bit integer which uniquely identifies the object on the sender's system.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is not normally sent for search results. It is used in browse-user responses&lt;br /&gt;
to allow objects to be referenced by virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this ID to link objects to virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CSC - Cached Source Count ===&lt;br /&gt;
&lt;br /&gt;
Indicates the number of external cached sources known to the sending node.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if cached sources are available and interest in URLs was expressed&lt;br /&gt;
in the query.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 16-bit integer.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PART - Partial Content Tag ===&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node has only part of the object, and how much it has.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a /QH2/H/URL child is present and the URL contains only part of&lt;br /&gt;
the object.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer, the number of bytes available.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* MT - Modification Time (payload = 32-bit timestamp)&lt;br /&gt;
&lt;br /&gt;
The ''MT'' child carries the last modification time (UNIX timestamp) of the partial file and can be used to determine whether there has been recent updates made (''hot'' file) or if the file is ''cold'' (not undergoing any downloading activity on the remote side).&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/COM - User Comment ===&lt;br /&gt;
&lt;br /&gt;
Provides a user review and/or rating for the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a user comment is available, and comments were requested.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
An XML string, of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;comment rating=&amp;quot;n&amp;quot;&amp;gt;&lt;br /&gt;
The comment goes here.&lt;br /&gt;
&amp;lt;/comment&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rating is an integer 0 &amp;lt;= n &amp;lt;= 5, indicating the number of &amp;quot;stars&amp;quot;. The text&lt;br /&gt;
may not include HTML, but may include forum-style block codes and emoticon&lt;br /&gt;
notation.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PVU - Preview URL ===&lt;br /&gt;
&lt;br /&gt;
Indicates that a preview URL is available for the object. A preview URL will serve a&lt;br /&gt;
miniature version of the content.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a preview is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to a preview of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has a preview of the object&lt;br /&gt;
available locally. It can be retrieved with an HTTP request to the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
/gnutella/preview/v1?urn:xyz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ALT - Alternate Locations ===&lt;br /&gt;
&lt;br /&gt;
Supplies alternate download sources for the hit.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent when the query indicated that it wanted alternate locations, via the &amp;quot;A&amp;quot; string in its /Q2/I child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
The payload contains a vector of alternate locations, listing IPv4 addresses followed by 16-bit ports, as usual (e.g. the same format used to serialize an &amp;quot;NA&amp;quot; payload), but all the entries are concatenated.  Hence, a payload of 24 bytes will indicate that there are 4 entries of 6 bytes each.&lt;br /&gt;
&lt;br /&gt;
These alternate locations are the IP:port addresses of known hosts that can serve the file.  These can be G2 hosts or G1 hosts, but there are no differences since the file transfer protocol is identical for both networks.&lt;br /&gt;
&lt;br /&gt;
None of the addresses listed there are for firewalled hosts, so anyone should be able to contact them at their uri-res address, supplying the urn:sha1: value suitable for the resource.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/MD - Unified Metadata Block ==&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing one or more objects in the packet. This is an&lt;br /&gt;
alternative method of delivering metadata, which allows metadata for similar objects&lt;br /&gt;
to be grouped together. It is compatible with the unified metadata block format in&lt;br /&gt;
Gnutella1.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing one or more XML documents, each beginning with a header.&lt;br /&gt;
Standard plural/singular Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application index=&amp;quot;0&amp;quot; title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;images xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/image.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;1&amp;quot; description=&amp;quot;Shareaza Logo&amp;quot; width=&amp;quot;128&amp;quot; height=&amp;quot;128&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;2&amp;quot; description=&amp;quot;Shareaza Screen Shot&amp;quot; width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/images&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An additional attribute, &amp;quot;index&amp;quot; is added to each singular entry. The index is a zerobased&lt;br /&gt;
integer identifying the Nth /QH2/H child within this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/UPRO - User Profile ==&lt;br /&gt;
&lt;br /&gt;
Delivers a user profile or user profile summary, describing the user operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a version of this child if the operating user wishes to list their screen name in&lt;br /&gt;
search results.&lt;br /&gt;
&lt;br /&gt;
The current version of this packet contains a summary only, consisting of the&lt;br /&gt;
screen/nick name. Future versions may include a more comprehensive XML text&lt;br /&gt;
block in the payload.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
One child packet type is defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QH2/UPRO/NICK - Nick/screen Name&lt;br /&gt;
&lt;br /&gt;
=== /QH2/UPRO/NICK - Nick/Screen Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies the nick/screen name of the user.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HN - DNS Host Name ==&lt;br /&gt;
&lt;br /&gt;
This child conveys the DNS host name of the servent.  This is useful when the host has a dynamic IP address that can change over time, letting others know how they can recompute your IP address through a DNS lookup when the connection to the specified address (IP and port) is no longer working properly.  The port is not present here, since that is not supposed to change.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this child if you have a dynamic IP address and you know your DNS host name.  This cannot be automatically computed and requires user input.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The host name of the host, as a string, with no trailing NUL (since the payload only contains the name).  For instance, &amp;quot;g2host.example.com&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/TLS - TLS Support ==&lt;br /&gt;
&lt;br /&gt;
When present, this child indicates that the servent supports TLS connections.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this child if you are capable of initiating and receiving TLS connections.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BH - Browsable Host ==&lt;br /&gt;
&lt;br /&gt;
When present, this child indicates that the servent supports Browsing.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this children if you are capable of serving browsing requests using the &amp;lt;code&amp;gt;application/x-gnutella2&amp;lt;/code&amp;gt; Content-Type.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QH2&amp;diff=85141</id>
		<title>QH2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QH2&amp;diff=85141"/>
		<updated>2014-02-09T09:42:59Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Children */ Added &amp;quot;HN&amp;quot;, &amp;quot;TLS&amp;quot; and &amp;quot;BH&amp;quot; children&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QH2 - Query Hit =&lt;br /&gt;
&lt;br /&gt;
The /QH2 Gnutella2 query hit packet contains one or more search result descriptors,&lt;br /&gt;
along with information about the node generating the result set. A single node may&lt;br /&gt;
generate several /QH2 packets in response to a /[[Q2]] query. Like all Gnutella2&lt;br /&gt;
packets, the /QH2 packet is highly extensible.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
Send a /QH2 packet when processing a /[[Q2]] query packet reveals one or more&lt;br /&gt;
matching objects. Query hits can be returned directly to the /Q2/UDP return address&lt;br /&gt;
in the query, or routed back along the delivery chain. Firewalled leaf nodes are&lt;br /&gt;
advised to return /QH2 packets to their connected hub for dispatch, as the hub will&lt;br /&gt;
be able to make a reliable delivery.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QH2 query hit packet, check the query GUID against locally&lt;br /&gt;
initiated queries. If it originated elsewhere, increment the route-back hop counter&lt;br /&gt;
and forward it to the most appropriate link or UDP endpoint. If it matches a locally&lt;br /&gt;
generated query, process the search results.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
A single byte representing the hop count, followed by a 16 byte GUID identifying the&lt;br /&gt;
search that produced these results.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* FW - Firewalled Servent&lt;br /&gt;
* H - Hit Descriptor&lt;br /&gt;
* HG - Hit Group Descriptor&lt;br /&gt;
* GU - Node GUID&lt;br /&gt;
* NA - Node Address&lt;br /&gt;
* NH - Neighbouring Hub&lt;br /&gt;
* V - Vendor Code&lt;br /&gt;
* MD - Unified Metadata Block&lt;br /&gt;
* UPRO - User Profile&lt;br /&gt;
* BUP - Browse User Profile Tag&lt;br /&gt;
* PCH - Peer Chat Tag&lt;br /&gt;
* HN - DNS Host Name of Servent (e.g. &amp;quot;g2.example.com&amp;quot;)&lt;br /&gt;
* TLS - TLS Support&lt;br /&gt;
* BH - Browsable Host&lt;br /&gt;
&lt;br /&gt;
== /QH2/FW - Firewalled Servent ==&lt;br /&gt;
&lt;br /&gt;
Specifies that the sending node is ''firewalled'' and cannot accept incoming connections.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is sent only when the servent issuing the hit is firewalled.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
There is no payload defined.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/GU - Node GUID ==&lt;br /&gt;
&lt;br /&gt;
Specifies the GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
Specifies the node / network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional but recommended.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of the sending node. See datatypes for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NH - Neighbouring Hub ==&lt;br /&gt;
&lt;br /&gt;
Lists a hub to which the sending node (a leaf) is connected. This provides a contact&lt;br /&gt;
point for routing communications to a possibly firewalled leaf node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional, and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of a hub to which the sending node is connected.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
Identifies the software operating the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four character vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BUP - Browse User Profile Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports browsing the local user profile.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/PCH - Peer Chat Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports person to person private message chat.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HG - Hit Group Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a group of search results.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A single byte, the group ID number.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type currently defined:&lt;br /&gt;
&lt;br /&gt;
* SS - Server State&lt;br /&gt;
&lt;br /&gt;
=== /QH2/HG/SS - Server State ===&lt;br /&gt;
&lt;br /&gt;
Provides a status snapshot of the upload server that applies to search results in the&lt;br /&gt;
current hit group.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Add this child to the hit group descriptor to provide server state information.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this information when interpreting hits linked with this hit group.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
* A 16-bit integer : the current queue length including any active transfers (number waiting plus number transferring)&lt;br /&gt;
* An 8-bit integer : the maximum number of concurrent transfers (capacity)&lt;br /&gt;
* A 32-bit integer : the speed in kilobits per second for uploads on this server module&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/H - Hit Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a single object which matched the original query.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QH2/H child for each matching object to be included in this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time, and is often&lt;br /&gt;
extended:&lt;br /&gt;
&lt;br /&gt;
* URN - Universal Resource Name&lt;br /&gt;
* URL - Universal Resource Location&lt;br /&gt;
* DN - Descriptive Name&lt;br /&gt;
* MD - Metadata&lt;br /&gt;
* SZ - Object Size&lt;br /&gt;
* G - Group Identifier&lt;br /&gt;
* ID - Object Identifier&lt;br /&gt;
* CSC - Cached Source Count&lt;br /&gt;
* PART - Partial Availability Marker&lt;br /&gt;
* COM - User Comment&lt;br /&gt;
* PVU - Preview URL&lt;br /&gt;
* ALT - Alternate Locations&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URN - Universal Resource Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies a universal resource name which can be used to identify the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
At least one instance of this child is required. Multiple instances are optional.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* '''bitprint''' or '''bp''' - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* '''sha1''' - 20 bytes of SHA1&lt;br /&gt;
* '''tree:tiger/''' or '''ttr''' - 24 bytes of tiger-tree root&lt;br /&gt;
* '''md5''' - 16 bytes of MD5&lt;br /&gt;
* '''ed2k''' - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URL - Universal Resource Location ===&lt;br /&gt;
&lt;br /&gt;
This child specifies a location where the object being described can be acquired.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and a URL is available.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If a /QH2/H/URL child was requested but is not present, the sending node may not&lt;br /&gt;
have the object. It is valid to advertise information about objects that are not&lt;br /&gt;
available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or a string which represents an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to an instance of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has the object available&lt;br /&gt;
locally. It can be retrieved with an HTTP request using the &amp;quot;uri-res&amp;quot; resolver.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== QH2/H/DN - Descriptive Name (Generic) Criteria ===&lt;br /&gt;
&lt;br /&gt;
The descriptive name for the object, and the object's size.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer indicating the object's size, followed by a string describing it. If a&lt;br /&gt;
/QH2/H/SZ child is present, the 32-bit size prefix is omitted here (allowing a larger&lt;br /&gt;
64 bit file size).&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/MD - Metadata ===&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The xml header is optional. Standard plural/singular&lt;br /&gt;
Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/SZ - Object Size ===&lt;br /&gt;
&lt;br /&gt;
Specifies the size of the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if DN was requested, and if the size is not to be packed into&lt;br /&gt;
the /QH2/H/DN child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit or 64-bit integer representing the object size.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/G - Group Identifier ===&lt;br /&gt;
&lt;br /&gt;
Indicates which hit group (/QH2/HG) this hit belongs to. If this child is not present,&lt;br /&gt;
the hit belongs to group zero.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Send this child if this hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If this child is present, the hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A single byte, the hit group ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ID - Object Identifier ===&lt;br /&gt;
&lt;br /&gt;
Specifies a 32-bit integer which uniquely identifies the object on the sender's system.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is not normally sent for search results. It is used in browse-user responses&lt;br /&gt;
to allow objects to be referenced by virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this ID to link objects to virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CSC - Cached Source Count ===&lt;br /&gt;
&lt;br /&gt;
Indicates the number of external cached sources known to the sending node.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if cached sources are available and interest in URLs was expressed&lt;br /&gt;
in the query.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 16-bit integer.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PART - Partial Content Tag ===&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node has only part of the object, and how much it has.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a /QH2/H/URL child is present and the URL contains only part of&lt;br /&gt;
the object.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer, the number of bytes available.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* MT - Modification Time (payload = 32-bit timestamp)&lt;br /&gt;
&lt;br /&gt;
The ''MT'' child carries the last modification time (UNIX timestamp) of the partial file and can be used to determine whether there has been recent updates made (''hot'' file) or if the file is ''cold'' (not undergoing any downloading activity on the remote side).&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/COM - User Comment ===&lt;br /&gt;
&lt;br /&gt;
Provides a user review and/or rating for the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a user comment is available, and comments were requested.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
An XML string, of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;comment rating=&amp;quot;n&amp;quot;&amp;gt;&lt;br /&gt;
The comment goes here.&lt;br /&gt;
&amp;lt;/comment&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rating is an integer 0 &amp;lt;= n &amp;lt;= 5, indicating the number of &amp;quot;stars&amp;quot;. The text&lt;br /&gt;
may not include HTML, but may include forum-style block codes and emoticon&lt;br /&gt;
notation.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PVU - Preview URL ===&lt;br /&gt;
&lt;br /&gt;
Indicates that a preview URL is available for the object. A preview URL will serve a&lt;br /&gt;
miniature version of the content.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a preview is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to a preview of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has a preview of the object&lt;br /&gt;
available locally. It can be retrieved with an HTTP request to the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
/gnutella/preview/v1?urn:xyz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ALT - Alternate Locations ===&lt;br /&gt;
&lt;br /&gt;
Supplies alternate download sources for the hit.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent when the query indicated that it wanted alternate locations, via the &amp;quot;A&amp;quot; string in its /Q2/I child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
The payload contains a vector of alternate locations, listing IPv4 addresses followed by 16-bit ports, as usual (e.g. the same format used to serialize an &amp;quot;NA&amp;quot; payload), but all the entries are concatenated.  Hence, a payload of 24 bytes will indicate that there are 4 entries of 6 bytes each.&lt;br /&gt;
&lt;br /&gt;
These alternate locations are the IP:port addresses of known hosts that can serve the file.  These can be G2 hosts or G1 hosts, but there are no differences since the file transfer protocol is identical for both networks.&lt;br /&gt;
&lt;br /&gt;
None of the addresses listed there are for firewalled hosts, so anyone should be able to contact them at their uri-res address, supplying the urn:sha1: value suitable for the resource.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/MD - Unified Metadata Block ==&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing one or more objects in the packet. This is an&lt;br /&gt;
alternative method of delivering metadata, which allows metadata for similar objects&lt;br /&gt;
to be grouped together. It is compatible with the unified metadata block format in&lt;br /&gt;
Gnutella1.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing one or more XML documents, each beginning with a header.&lt;br /&gt;
Standard plural/singular Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application index=&amp;quot;0&amp;quot; title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;images xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/image.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;1&amp;quot; description=&amp;quot;Shareaza Logo&amp;quot; width=&amp;quot;128&amp;quot; height=&amp;quot;128&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;2&amp;quot; description=&amp;quot;Shareaza Screen Shot&amp;quot; width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/images&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An additional attribute, &amp;quot;index&amp;quot; is added to each singular entry. The index is a zerobased&lt;br /&gt;
integer identifying the Nth /QH2/H child within this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/UPRO - User Profile ==&lt;br /&gt;
&lt;br /&gt;
Delivers a user profile or user profile summary, describing the user operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a version of this child if the operating user wishes to list their screen name in&lt;br /&gt;
search results.&lt;br /&gt;
&lt;br /&gt;
The current version of this packet contains a summary only, consisting of the&lt;br /&gt;
screen/nick name. Future versions may include a more comprehensive XML text&lt;br /&gt;
block in the payload.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
One child packet type is defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QH2/UPRO/NICK - Nick/screen Name&lt;br /&gt;
&lt;br /&gt;
=== /QH2/UPRO/NICK - Nick/Screen Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies the nick/screen name of the user.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QH2&amp;diff=85140</id>
		<title>QH2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QH2&amp;diff=85140"/>
		<updated>2014-02-04T23:45:59Z</updated>

		<summary type="html">&lt;p&gt;Ram: Added /QH2/FW description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QH2 - Query Hit =&lt;br /&gt;
&lt;br /&gt;
The /QH2 Gnutella2 query hit packet contains one or more search result descriptors,&lt;br /&gt;
along with information about the node generating the result set. A single node may&lt;br /&gt;
generate several /QH2 packets in response to a /[[Q2]] query. Like all Gnutella2&lt;br /&gt;
packets, the /QH2 packet is highly extensible.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
Send a /QH2 packet when processing a /[[Q2]] query packet reveals one or more&lt;br /&gt;
matching objects. Query hits can be returned directly to the /Q2/UDP return address&lt;br /&gt;
in the query, or routed back along the delivery chain. Firewalled leaf nodes are&lt;br /&gt;
advised to return /QH2 packets to their connected hub for dispatch, as the hub will&lt;br /&gt;
be able to make a reliable delivery.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QH2 query hit packet, check the query GUID against locally&lt;br /&gt;
initiated queries. If it originated elsewhere, increment the route-back hop counter&lt;br /&gt;
and forward it to the most appropriate link or UDP endpoint. If it matches a locally&lt;br /&gt;
generated query, process the search results.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
A single byte representing the hop count, followed by a 16 byte GUID identifying the&lt;br /&gt;
search that produced these results.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* FW - Firewalled Servent&lt;br /&gt;
* H - Hit Descriptor&lt;br /&gt;
* HG - Hit Group Descriptor&lt;br /&gt;
* GU - Node GUID&lt;br /&gt;
* NA - Node Address&lt;br /&gt;
* NH - Neighbouring Hub&lt;br /&gt;
* V - Vendor Code&lt;br /&gt;
* MD - Unified Metadata Block&lt;br /&gt;
* UPRO - User Profile&lt;br /&gt;
* BUP - Browse User Profile Tag&lt;br /&gt;
* PCH - Peer Chat Tag&lt;br /&gt;
&lt;br /&gt;
== /QH2/FW - Firewalled Servent ==&lt;br /&gt;
&lt;br /&gt;
Specifies that the sending node is ''firewalled'' and cannot accept incoming connections.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is sent only when the servent issuing the hit is firewalled.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
There is no payload defined.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/GU - Node GUID ==&lt;br /&gt;
&lt;br /&gt;
Specifies the GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
Specifies the node / network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional but recommended.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of the sending node. See datatypes for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NH - Neighbouring Hub ==&lt;br /&gt;
&lt;br /&gt;
Lists a hub to which the sending node (a leaf) is connected. This provides a contact&lt;br /&gt;
point for routing communications to a possibly firewalled leaf node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional, and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of a hub to which the sending node is connected.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
Identifies the software operating the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four character vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BUP - Browse User Profile Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports browsing the local user profile.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/PCH - Peer Chat Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports person to person private message chat.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HG - Hit Group Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a group of search results.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A single byte, the group ID number.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type currently defined:&lt;br /&gt;
&lt;br /&gt;
* SS - Server State&lt;br /&gt;
&lt;br /&gt;
=== /QH2/HG/SS - Server State ===&lt;br /&gt;
&lt;br /&gt;
Provides a status snapshot of the upload server that applies to search results in the&lt;br /&gt;
current hit group.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Add this child to the hit group descriptor to provide server state information.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this information when interpreting hits linked with this hit group.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
* A 16-bit integer : the current queue length including any active transfers (number waiting plus number transferring)&lt;br /&gt;
* An 8-bit integer : the maximum number of concurrent transfers (capacity)&lt;br /&gt;
* A 32-bit integer : the speed in kilobits per second for uploads on this server module&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/H - Hit Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a single object which matched the original query.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QH2/H child for each matching object to be included in this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time, and is often&lt;br /&gt;
extended:&lt;br /&gt;
&lt;br /&gt;
* URN - Universal Resource Name&lt;br /&gt;
* URL - Universal Resource Location&lt;br /&gt;
* DN - Descriptive Name&lt;br /&gt;
* MD - Metadata&lt;br /&gt;
* SZ - Object Size&lt;br /&gt;
* G - Group Identifier&lt;br /&gt;
* ID - Object Identifier&lt;br /&gt;
* CSC - Cached Source Count&lt;br /&gt;
* PART - Partial Availability Marker&lt;br /&gt;
* COM - User Comment&lt;br /&gt;
* PVU - Preview URL&lt;br /&gt;
* ALT - Alternate Locations&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URN - Universal Resource Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies a universal resource name which can be used to identify the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
At least one instance of this child is required. Multiple instances are optional.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* '''bitprint''' or '''bp''' - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* '''sha1''' - 20 bytes of SHA1&lt;br /&gt;
* '''tree:tiger/''' or '''ttr''' - 24 bytes of tiger-tree root&lt;br /&gt;
* '''md5''' - 16 bytes of MD5&lt;br /&gt;
* '''ed2k''' - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URL - Universal Resource Location ===&lt;br /&gt;
&lt;br /&gt;
This child specifies a location where the object being described can be acquired.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and a URL is available.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If a /QH2/H/URL child was requested but is not present, the sending node may not&lt;br /&gt;
have the object. It is valid to advertise information about objects that are not&lt;br /&gt;
available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or a string which represents an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to an instance of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has the object available&lt;br /&gt;
locally. It can be retrieved with an HTTP request using the &amp;quot;uri-res&amp;quot; resolver.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== QH2/H/DN - Descriptive Name (Generic) Criteria ===&lt;br /&gt;
&lt;br /&gt;
The descriptive name for the object, and the object's size.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer indicating the object's size, followed by a string describing it. If a&lt;br /&gt;
/QH2/H/SZ child is present, the 32-bit size prefix is omitted here (allowing a larger&lt;br /&gt;
64 bit file size).&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/MD - Metadata ===&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The xml header is optional. Standard plural/singular&lt;br /&gt;
Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/SZ - Object Size ===&lt;br /&gt;
&lt;br /&gt;
Specifies the size of the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if DN was requested, and if the size is not to be packed into&lt;br /&gt;
the /QH2/H/DN child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit or 64-bit integer representing the object size.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/G - Group Identifier ===&lt;br /&gt;
&lt;br /&gt;
Indicates which hit group (/QH2/HG) this hit belongs to. If this child is not present,&lt;br /&gt;
the hit belongs to group zero.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Send this child if this hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If this child is present, the hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A single byte, the hit group ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ID - Object Identifier ===&lt;br /&gt;
&lt;br /&gt;
Specifies a 32-bit integer which uniquely identifies the object on the sender's system.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is not normally sent for search results. It is used in browse-user responses&lt;br /&gt;
to allow objects to be referenced by virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this ID to link objects to virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CSC - Cached Source Count ===&lt;br /&gt;
&lt;br /&gt;
Indicates the number of external cached sources known to the sending node.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if cached sources are available and interest in URLs was expressed&lt;br /&gt;
in the query.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 16-bit integer.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PART - Partial Content Tag ===&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node has only part of the object, and how much it has.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a /QH2/H/URL child is present and the URL contains only part of&lt;br /&gt;
the object.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer, the number of bytes available.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* MT - Modification Time (payload = 32-bit timestamp)&lt;br /&gt;
&lt;br /&gt;
The ''MT'' child carries the last modification time (UNIX timestamp) of the partial file and can be used to determine whether there has been recent updates made (''hot'' file) or if the file is ''cold'' (not undergoing any downloading activity on the remote side).&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/COM - User Comment ===&lt;br /&gt;
&lt;br /&gt;
Provides a user review and/or rating for the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a user comment is available, and comments were requested.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
An XML string, of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;comment rating=&amp;quot;n&amp;quot;&amp;gt;&lt;br /&gt;
The comment goes here.&lt;br /&gt;
&amp;lt;/comment&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rating is an integer 0 &amp;lt;= n &amp;lt;= 5, indicating the number of &amp;quot;stars&amp;quot;. The text&lt;br /&gt;
may not include HTML, but may include forum-style block codes and emoticon&lt;br /&gt;
notation.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PVU - Preview URL ===&lt;br /&gt;
&lt;br /&gt;
Indicates that a preview URL is available for the object. A preview URL will serve a&lt;br /&gt;
miniature version of the content.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a preview is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to a preview of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has a preview of the object&lt;br /&gt;
available locally. It can be retrieved with an HTTP request to the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
/gnutella/preview/v1?urn:xyz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ALT - Alternate Locations ===&lt;br /&gt;
&lt;br /&gt;
Supplies alternate download sources for the hit.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent when the query indicated that it wanted alternate locations, via the &amp;quot;A&amp;quot; string in its /Q2/I child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
The payload contains a vector of alternate locations, listing IPv4 addresses followed by 16-bit ports, as usual (e.g. the same format used to serialize an &amp;quot;NA&amp;quot; payload), but all the entries are concatenated.  Hence, a payload of 24 bytes will indicate that there are 4 entries of 6 bytes each.&lt;br /&gt;
&lt;br /&gt;
These alternate locations are the IP:port addresses of known hosts that can serve the file.  These can be G2 hosts or G1 hosts, but there are no differences since the file transfer protocol is identical for both networks.&lt;br /&gt;
&lt;br /&gt;
None of the addresses listed there are for firewalled hosts, so anyone should be able to contact them at their uri-res address, supplying the urn:sha1: value suitable for the resource.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/MD - Unified Metadata Block ==&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing one or more objects in the packet. This is an&lt;br /&gt;
alternative method of delivering metadata, which allows metadata for similar objects&lt;br /&gt;
to be grouped together. It is compatible with the unified metadata block format in&lt;br /&gt;
Gnutella1.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing one or more XML documents, each beginning with a header.&lt;br /&gt;
Standard plural/singular Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application index=&amp;quot;0&amp;quot; title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;images xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/image.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;1&amp;quot; description=&amp;quot;Shareaza Logo&amp;quot; width=&amp;quot;128&amp;quot; height=&amp;quot;128&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;2&amp;quot; description=&amp;quot;Shareaza Screen Shot&amp;quot; width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/images&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An additional attribute, &amp;quot;index&amp;quot; is added to each singular entry. The index is a zerobased&lt;br /&gt;
integer identifying the Nth /QH2/H child within this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/UPRO - User Profile ==&lt;br /&gt;
&lt;br /&gt;
Delivers a user profile or user profile summary, describing the user operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a version of this child if the operating user wishes to list their screen name in&lt;br /&gt;
search results.&lt;br /&gt;
&lt;br /&gt;
The current version of this packet contains a summary only, consisting of the&lt;br /&gt;
screen/nick name. Future versions may include a more comprehensive XML text&lt;br /&gt;
block in the payload.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
One child packet type is defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QH2/UPRO/NICK - Nick/screen Name&lt;br /&gt;
&lt;br /&gt;
=== /QH2/UPRO/NICK - Nick/Screen Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies the nick/screen name of the user.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QH2&amp;diff=85139</id>
		<title>QH2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QH2&amp;diff=85139"/>
		<updated>2014-02-04T23:43:26Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Children */ Added missing &amp;quot;FW&amp;quot; child&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QH2 - Query Hit =&lt;br /&gt;
&lt;br /&gt;
The /QH2 Gnutella2 query hit packet contains one or more search result descriptors,&lt;br /&gt;
along with information about the node generating the result set. A single node may&lt;br /&gt;
generate several /QH2 packets in response to a /[[Q2]] query. Like all Gnutella2&lt;br /&gt;
packets, the /QH2 packet is highly extensible.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
Send a /QH2 packet when processing a /[[Q2]] query packet reveals one or more&lt;br /&gt;
matching objects. Query hits can be returned directly to the /Q2/UDP return address&lt;br /&gt;
in the query, or routed back along the delivery chain. Firewalled leaf nodes are&lt;br /&gt;
advised to return /QH2 packets to their connected hub for dispatch, as the hub will&lt;br /&gt;
be able to make a reliable delivery.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QH2 query hit packet, check the query GUID against locally&lt;br /&gt;
initiated queries. If it originated elsewhere, increment the route-back hop counter&lt;br /&gt;
and forward it to the most appropriate link or UDP endpoint. If it matches a locally&lt;br /&gt;
generated query, process the search results.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
A single byte representing the hop count, followed by a 16 byte GUID identifying the&lt;br /&gt;
search that produced these results.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* FW - Firewalled Servent&lt;br /&gt;
* H - Hit Descriptor&lt;br /&gt;
* HG - Hit Group Descriptor&lt;br /&gt;
* GU - Node GUID&lt;br /&gt;
* NA - Node Address&lt;br /&gt;
* NH - Neighbouring Hub&lt;br /&gt;
* V - Vendor Code&lt;br /&gt;
* MD - Unified Metadata Block&lt;br /&gt;
* UPRO - User Profile&lt;br /&gt;
* BUP - Browse User Profile Tag&lt;br /&gt;
* PCH - Peer Chat Tag&lt;br /&gt;
&lt;br /&gt;
== /QH2/GU - Node GUID ==&lt;br /&gt;
&lt;br /&gt;
Specifies the GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
Specifies the node / network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional but recommended.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of the sending node. See datatypes for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NH - Neighbouring Hub ==&lt;br /&gt;
&lt;br /&gt;
Lists a hub to which the sending node (a leaf) is connected. This provides a contact&lt;br /&gt;
point for routing communications to a possibly firewalled leaf node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional, and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of a hub to which the sending node is connected.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
Identifies the software operating the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four character vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BUP - Browse User Profile Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports browsing the local user profile.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/PCH - Peer Chat Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports person to person private message chat.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HG - Hit Group Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a group of search results.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A single byte, the group ID number.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type currently defined:&lt;br /&gt;
&lt;br /&gt;
* SS - Server State&lt;br /&gt;
&lt;br /&gt;
=== /QH2/HG/SS - Server State ===&lt;br /&gt;
&lt;br /&gt;
Provides a status snapshot of the upload server that applies to search results in the&lt;br /&gt;
current hit group.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Add this child to the hit group descriptor to provide server state information.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this information when interpreting hits linked with this hit group.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
* A 16-bit integer : the current queue length including any active transfers (number waiting plus number transferring)&lt;br /&gt;
* An 8-bit integer : the maximum number of concurrent transfers (capacity)&lt;br /&gt;
* A 32-bit integer : the speed in kilobits per second for uploads on this server module&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/H - Hit Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a single object which matched the original query.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QH2/H child for each matching object to be included in this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time, and is often&lt;br /&gt;
extended:&lt;br /&gt;
&lt;br /&gt;
* URN - Universal Resource Name&lt;br /&gt;
* URL - Universal Resource Location&lt;br /&gt;
* DN - Descriptive Name&lt;br /&gt;
* MD - Metadata&lt;br /&gt;
* SZ - Object Size&lt;br /&gt;
* G - Group Identifier&lt;br /&gt;
* ID - Object Identifier&lt;br /&gt;
* CSC - Cached Source Count&lt;br /&gt;
* PART - Partial Availability Marker&lt;br /&gt;
* COM - User Comment&lt;br /&gt;
* PVU - Preview URL&lt;br /&gt;
* ALT - Alternate Locations&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URN - Universal Resource Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies a universal resource name which can be used to identify the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
At least one instance of this child is required. Multiple instances are optional.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* '''bitprint''' or '''bp''' - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* '''sha1''' - 20 bytes of SHA1&lt;br /&gt;
* '''tree:tiger/''' or '''ttr''' - 24 bytes of tiger-tree root&lt;br /&gt;
* '''md5''' - 16 bytes of MD5&lt;br /&gt;
* '''ed2k''' - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URL - Universal Resource Location ===&lt;br /&gt;
&lt;br /&gt;
This child specifies a location where the object being described can be acquired.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and a URL is available.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If a /QH2/H/URL child was requested but is not present, the sending node may not&lt;br /&gt;
have the object. It is valid to advertise information about objects that are not&lt;br /&gt;
available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or a string which represents an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to an instance of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has the object available&lt;br /&gt;
locally. It can be retrieved with an HTTP request using the &amp;quot;uri-res&amp;quot; resolver.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== QH2/H/DN - Descriptive Name (Generic) Criteria ===&lt;br /&gt;
&lt;br /&gt;
The descriptive name for the object, and the object's size.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer indicating the object's size, followed by a string describing it. If a&lt;br /&gt;
/QH2/H/SZ child is present, the 32-bit size prefix is omitted here (allowing a larger&lt;br /&gt;
64 bit file size).&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/MD - Metadata ===&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The xml header is optional. Standard plural/singular&lt;br /&gt;
Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/SZ - Object Size ===&lt;br /&gt;
&lt;br /&gt;
Specifies the size of the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if DN was requested, and if the size is not to be packed into&lt;br /&gt;
the /QH2/H/DN child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit or 64-bit integer representing the object size.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/G - Group Identifier ===&lt;br /&gt;
&lt;br /&gt;
Indicates which hit group (/QH2/HG) this hit belongs to. If this child is not present,&lt;br /&gt;
the hit belongs to group zero.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Send this child if this hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If this child is present, the hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A single byte, the hit group ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ID - Object Identifier ===&lt;br /&gt;
&lt;br /&gt;
Specifies a 32-bit integer which uniquely identifies the object on the sender's system.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is not normally sent for search results. It is used in browse-user responses&lt;br /&gt;
to allow objects to be referenced by virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this ID to link objects to virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CSC - Cached Source Count ===&lt;br /&gt;
&lt;br /&gt;
Indicates the number of external cached sources known to the sending node.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if cached sources are available and interest in URLs was expressed&lt;br /&gt;
in the query.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 16-bit integer.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PART - Partial Content Tag ===&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node has only part of the object, and how much it has.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a /QH2/H/URL child is present and the URL contains only part of&lt;br /&gt;
the object.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer, the number of bytes available.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* MT - Modification Time (payload = 32-bit timestamp)&lt;br /&gt;
&lt;br /&gt;
The ''MT'' child carries the last modification time (UNIX timestamp) of the partial file and can be used to determine whether there has been recent updates made (''hot'' file) or if the file is ''cold'' (not undergoing any downloading activity on the remote side).&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/COM - User Comment ===&lt;br /&gt;
&lt;br /&gt;
Provides a user review and/or rating for the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a user comment is available, and comments were requested.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
An XML string, of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;comment rating=&amp;quot;n&amp;quot;&amp;gt;&lt;br /&gt;
The comment goes here.&lt;br /&gt;
&amp;lt;/comment&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rating is an integer 0 &amp;lt;= n &amp;lt;= 5, indicating the number of &amp;quot;stars&amp;quot;. The text&lt;br /&gt;
may not include HTML, but may include forum-style block codes and emoticon&lt;br /&gt;
notation.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PVU - Preview URL ===&lt;br /&gt;
&lt;br /&gt;
Indicates that a preview URL is available for the object. A preview URL will serve a&lt;br /&gt;
miniature version of the content.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a preview is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to a preview of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has a preview of the object&lt;br /&gt;
available locally. It can be retrieved with an HTTP request to the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
/gnutella/preview/v1?urn:xyz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ALT - Alternate Locations ===&lt;br /&gt;
&lt;br /&gt;
Supplies alternate download sources for the hit.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent when the query indicated that it wanted alternate locations, via the &amp;quot;A&amp;quot; string in its /Q2/I child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
The payload contains a vector of alternate locations, listing IPv4 addresses followed by 16-bit ports, as usual (e.g. the same format used to serialize an &amp;quot;NA&amp;quot; payload), but all the entries are concatenated.  Hence, a payload of 24 bytes will indicate that there are 4 entries of 6 bytes each.&lt;br /&gt;
&lt;br /&gt;
These alternate locations are the IP:port addresses of known hosts that can serve the file.  These can be G2 hosts or G1 hosts, but there are no differences since the file transfer protocol is identical for both networks.&lt;br /&gt;
&lt;br /&gt;
None of the addresses listed there are for firewalled hosts, so anyone should be able to contact them at their uri-res address, supplying the urn:sha1: value suitable for the resource.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/MD - Unified Metadata Block ==&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing one or more objects in the packet. This is an&lt;br /&gt;
alternative method of delivering metadata, which allows metadata for similar objects&lt;br /&gt;
to be grouped together. It is compatible with the unified metadata block format in&lt;br /&gt;
Gnutella1.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing one or more XML documents, each beginning with a header.&lt;br /&gt;
Standard plural/singular Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application index=&amp;quot;0&amp;quot; title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;images xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/image.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;1&amp;quot; description=&amp;quot;Shareaza Logo&amp;quot; width=&amp;quot;128&amp;quot; height=&amp;quot;128&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;2&amp;quot; description=&amp;quot;Shareaza Screen Shot&amp;quot; width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/images&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An additional attribute, &amp;quot;index&amp;quot; is added to each singular entry. The index is a zerobased&lt;br /&gt;
integer identifying the Nth /QH2/H child within this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/UPRO - User Profile ==&lt;br /&gt;
&lt;br /&gt;
Delivers a user profile or user profile summary, describing the user operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a version of this child if the operating user wishes to list their screen name in&lt;br /&gt;
search results.&lt;br /&gt;
&lt;br /&gt;
The current version of this packet contains a summary only, consisting of the&lt;br /&gt;
screen/nick name. Future versions may include a more comprehensive XML text&lt;br /&gt;
block in the payload.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
One child packet type is defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QH2/UPRO/NICK - Nick/screen Name&lt;br /&gt;
&lt;br /&gt;
=== /QH2/UPRO/NICK - Nick/Screen Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies the nick/screen name of the user.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=Object_Search_Mechanism&amp;diff=85138</id>
		<title>Object Search Mechanism</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=Object_Search_Mechanism&amp;diff=85138"/>
		<updated>2014-01-31T22:23:12Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Search Process Walkthrough */ Adding section on performance of searches&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The distributed object search mechanism is a very important component of the&lt;br /&gt;
Gnutella2 architecture. It allows objects distributed throughout the network to be&lt;br /&gt;
located by a search client in an optimal fashion, requesting and receiving a subset of&lt;br /&gt;
the total information known about that object.&lt;br /&gt;
&lt;br /&gt;
== Model ==&lt;br /&gt;
&lt;br /&gt;
The Gnutella2 object search mechanism is best described as an &amp;quot;iterative crawl&amp;quot; of&lt;br /&gt;
the network, with a series of important optimisations derived from the network&lt;br /&gt;
topology and components:&lt;br /&gt;
&lt;br /&gt;
* A search client iteratively contacts known hubs with its query&lt;br /&gt;
* Hubs match the query against the cached hash tables of their neighbours&lt;br /&gt;
* Where a table hit occurs, the query is forwarded once only&lt;br /&gt;
* The single injected query thus effectively covers the logical hub cluster, which is the basic searchable unit&lt;br /&gt;
* Nodes which actually receive the filtered query process it and send results to the search client directly&lt;br /&gt;
&lt;br /&gt;
This model has a number of important advantages:&lt;br /&gt;
&lt;br /&gt;
* Wide network coverage is provided by iterative query injection&lt;br /&gt;
* Effective leaf density is increased by querying hub clusters rather than single hubs or even single nodes&lt;br /&gt;
* Mutual and two-level filtering and static link compression are leveraged&lt;br /&gt;
* The load on each hub cluster is spread equally between its member hubs, providing a larger search base with a lower cost on the aggregation points&lt;br /&gt;
* Hubs need a greater inbound bandwidth capacity than outbound bandwidth capacity, which ideally suits asymmetric Internet connections&lt;br /&gt;
&lt;br /&gt;
== Search Process Walkthrough ==&lt;br /&gt;
&lt;br /&gt;
When a search client wishes to execute a new search, the following events happen:&lt;br /&gt;
&lt;br /&gt;
* The search client selects an eligible hub from its global hub cache which has a recent timestamp, has not been contacted more recently than it allows, and has not yet been queried in this search.&lt;br /&gt;
* If a query key is not yet available for this hub, a query key request is dispatched.&lt;br /&gt;
* Once a query key is available, the search client sends a keyed query to the hub.&lt;br /&gt;
* Upon receiving the query, the hub checks the query key for validity.&lt;br /&gt;
* The hub then responds with a query acknowledgement packet, containing a list of neighbouring hubs which have now been searched and a list of 2-hop hubs which have not yet been searched.&lt;br /&gt;
* The search client adds the list of searched hubs to its &amp;quot;don't try again&amp;quot; list, and adds the list of &amp;quot;try hubs&amp;quot; to the global hub cache for future selection.&lt;br /&gt;
* Meanwhile, the hub examines the query to make sure that it has not received it before. Duplicate queries are dropped.&lt;br /&gt;
* The hub then matches the query against the query hash table of all connected nodes, and sends it to those nodes which may be able to field a match.&lt;br /&gt;
* While this is occurring, the hub processes the query locally and returns any results it may have.&lt;br /&gt;
* Leaves directly attached to the hub which have a potential match will have received the query, and process it locally. They may elect to return results directly to the search client, or may return their results to their hub for dispatch.&lt;br /&gt;
* Other hubs in the hub cluster which received the query now examine it to ensure they have not processed it before. They do not send an acknowledgement.&lt;br /&gt;
* Assuming it is new, the hubs match the query against the query hash tables of their leaves but not their neighbouring hubs. Potential leaves receive a copy of the query, and the hub processes it locally.&lt;br /&gt;
* Once again, the hub returns its own results and may forward results for its leaves if they do not wish to dispatch them directly.&lt;br /&gt;
* Meanwhile, the search client receives any search results generated by the hub cluster.&lt;br /&gt;
* The search client makes a decision on whether it should continue its search. If so, the process starts again.&lt;br /&gt;
* The search client will not requery any of the hubs in the hub cluster, but it has a list of nearby hubs so that the crawl can continue.&lt;br /&gt;
&lt;br /&gt;
== Performance Considerations ==&lt;br /&gt;
&lt;br /&gt;
Hubs should acknowledge /Q2 messages as quickly as possible with a /QA and not wait 5 or 10 minutes to reply.  Why?  Because the querying host is probably going to timeout, assuming the remote hub is off or too busy, and will start querying other hosts... which may already have been queried by the hub.  This creates a nasty ''avalanche effect'' whereby busy hubs get extra traffic to acknowledge, causing them to further delay responses and therefore cause more useless querying.&lt;br /&gt;
&lt;br /&gt;
The '''more delay''' there is between sending of a /Q2 and acknowledging it via a /QA, the '''less effective''' the hub clustering topology will be.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QKA&amp;diff=85137</id>
		<title>QKA</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QKA&amp;diff=85137"/>
		<updated>2014-01-27T22:12:42Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Payload */ Pinpoint a G2 protocol design mistake&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QKA - Query Key Answer =&lt;br /&gt;
&lt;br /&gt;
The query key answer packet is sent in response to a [[QKR|query key request]] or in the&lt;br /&gt;
event that a query with an incorrect or omitted query key is received. It advises the&lt;br /&gt;
receiver of the correct query key to be used when contacting the sending hub to&lt;br /&gt;
execute a remote cluster query.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
The query key answer packet should be sent by a hub when a query key has been&lt;br /&gt;
requested. It should contain a key unique to the local hub and the requesting node&lt;br /&gt;
address supplied in the request, and should be sent to that address only.&lt;br /&gt;
The query key answer packet may also be sent upon receiving a query with a&lt;br /&gt;
missing or invalid query key. In this case no query should be performed.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a query key answer packet, the supplied query key should be stored&lt;br /&gt;
for later use. If the answer packet contains a sending node address (/QKA/SNA) child&lt;br /&gt;
which does not match the local node address, it may be forwarded to a connected&lt;br /&gt;
leaf node via TCP with a matching address. In the forwarding case, a query node&lt;br /&gt;
address (/QKA/QNA) child is added prior to forwarding to retain the remote (queried)&lt;br /&gt;
hub's address.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
This packet has no payload at the current time.&lt;br /&gt;
&lt;br /&gt;
'''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.&lt;br /&gt;
&lt;br /&gt;
It is OK however to have an empty payload when replying to a /QKR.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
The QKA packet has these child packets defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QKA/QK&lt;br /&gt;
* /QKA/SNA&lt;br /&gt;
* /QKA/QNA&lt;br /&gt;
* /QKA/CACHED&lt;br /&gt;
&lt;br /&gt;
== /QKA/QK - Query Key ==&lt;br /&gt;
&lt;br /&gt;
The /QKA/QK child contains the query key that was requested.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required if a key is being issued. Sending a /QKA without a /QKA/QK&lt;br /&gt;
indicates that the hub does not wish to authorise the requesting node to query it or&lt;br /&gt;
its cluster.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A 32-bit query key which is unique to the hub and the sending node address.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QKA/SNA - Sending Node Address ==&lt;br /&gt;
&lt;br /&gt;
This child specifies the node address for which the key has been issued. This is not&lt;br /&gt;
necessarily the node that physically transmitted the key request or the query.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node address (with port number optional) of the node which requested the&lt;br /&gt;
query key.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QKA/QNA - Queried Node Address ==&lt;br /&gt;
&lt;br /&gt;
If this query key answer packet has been forwarded to a firewalled leaf from a&lt;br /&gt;
connected hub, a /QKA/QNA child will have been added to indicate the address of&lt;br /&gt;
the remote hub from which the query key has been issued.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child should be added by a hub when relaying a received query key answer on&lt;br /&gt;
to a leaf via TCP.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
If this child is present, the query key answer should be treated as if it originated&lt;br /&gt;
from the stored address rather than the TCP neighbour.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node address (with port number optional) of the remote hub.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QKA/CACHED - Query Key Cached ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the query key returned was retrieved from cache.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This packet should be added by a hub in response to a /QKR/QNA over TCP from a leaf.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
Indicates to the leaf that the query key in the response was retrieved from cache.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
This packet has no payload at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=Q2&amp;diff=85136</id>
		<title>Q2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=Q2&amp;diff=85136"/>
		<updated>2014-01-27T15:45:24Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* /Q2/UDP - Return Address and Authentication */ Make it clear that leaf nodes must ignore query keys in /Q2/UDP.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /Q2 - Gnutella2 Query =&lt;br /&gt;
&lt;br /&gt;
The /Q2 packet is the generic Gnutella2 object query descriptor. It contains search&lt;br /&gt;
criteria, identification, authentication, return addressing and the type of information&lt;br /&gt;
the search client is interested in.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
A node should send a /Q2 packet to another node when it wishes to execute a query&lt;br /&gt;
on that node (and its searchable relations).&lt;br /&gt;
/Q2 packets should always be filtered against a query hash table if one is available&lt;br /&gt;
for the outbound link.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a query, a node should:&lt;br /&gt;
&lt;br /&gt;
* Verify its authentication&lt;br /&gt;
* Send an acknowledgment if it was not received from a hub&lt;br /&gt;
* Forward it to connected nodes if necessary (detailed below)&lt;br /&gt;
* Process it locally and dispatch results&lt;br /&gt;
&lt;br /&gt;
== Forwarding ==&lt;br /&gt;
&lt;br /&gt;
Forwarding of /Q2 packets is achieved based on fixed rules:&lt;br /&gt;
&lt;br /&gt;
* A query received from a leaf or via UDP is forwarded to all connected nodes&lt;br /&gt;
* A query received from a hub is forwarded to connected leaves only&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
The payload of a /Q2 packet consists of a GUID which uniquely identifies the search&lt;br /&gt;
operation.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many defined child packet types at the current time:&lt;br /&gt;
* /Q2/UDP - Return Address and Authentication&lt;br /&gt;
* /Q2/URN - Universal Resource Name&lt;br /&gt;
* /Q2/DN - Descriptive Name (Generic) Criteria&lt;br /&gt;
* /Q2/MD - Metadata Criteria&lt;br /&gt;
* /Q2/SZR - Object Size Restriction Criteria&lt;br /&gt;
* /Q2/I - Interest&lt;br /&gt;
&lt;br /&gt;
== /Q2/UDP - Return Address and Authentication ==&lt;br /&gt;
&lt;br /&gt;
The /Q2/UDP child packet specifies the return address to be used for all direct&lt;br /&gt;
replies, and the query key authentication which authorises transmissions to this&lt;br /&gt;
address. If the query key is invalid, the query should be discarded and a valid query&lt;br /&gt;
key issued to the nominated address (if desired).&lt;br /&gt;
&lt;br /&gt;
The query key is only checked by hubs receiving the query via UDP. Leaf nodes '''must ignore''' any query key held here.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required if the query is to be delivered via UDP. It is optional if delivered&lt;br /&gt;
via TCP: if not included, replies will be reverse forwarded via TCP.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
If this child is present, all replies should be directed to the nominated address. The&lt;br /&gt;
query key should be verified (by hubs only) before replying.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A network address (variable length) followed by a query key (fixed length of 32 bits).&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/URN - Universal Resource Name ==&lt;br /&gt;
&lt;br /&gt;
The /Q2/URN child specifies an exact universal resource name which will match the&lt;br /&gt;
query. Rules:&lt;br /&gt;
&lt;br /&gt;
* If one or more URNs are present in a query, whether or not they are understood, matching must occur on URN only and other criteria should be ignored.&lt;br /&gt;
* If multiple URNs are present, only one need match an object for it to be considered a match for the query.&lt;br /&gt;
* Following from the above, multiple URNs of the same family may be specified and match multiple objects (this allows a compound query for several known objects to be executed in one packet).&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child should be added if a specific URN is being sought.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* bitprint or bp - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* sha1 - 20 bytes of SHA1&lt;br /&gt;
* tree:tiger/ or ttr - 24 bytes of tiger-tree root&lt;br /&gt;
* md5 - 16 bytes of MD5&lt;br /&gt;
* ed2k - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/DN - Descriptive Name (Generic) Criteria ==&lt;br /&gt;
&lt;br /&gt;
The descriptive name child provides generic query text to be used in matching&lt;br /&gt;
objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string in the simple query language.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/MD - Metadata Criteria ==&lt;br /&gt;
&lt;br /&gt;
The metadata child provides an XML document containing rich query information.&lt;br /&gt;
The schema identified in the XML must match a metadata schema of prospective&lt;br /&gt;
matching objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The header is optional. Standard plural/singular Gnutella&lt;br /&gt;
metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All string values are in simple query language, including XML attribute and element&lt;br /&gt;
values.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/SZR - Size Restriction Criteria ==&lt;br /&gt;
&lt;br /&gt;
The size restriction criteria specify a minimum and maximum size for matching&lt;br /&gt;
objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A minimum size followed by a maximum size, both quoted in bytes. These two&lt;br /&gt;
numbers may be expressed as two 32 bit integers or two 64 bit integers.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/I - Interest ==&lt;br /&gt;
&lt;br /&gt;
The Interest packet advertises an interest in certain information classes, effectively&lt;br /&gt;
filtering the information that will be returned about matching objects.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send an interest packet to restrict the type of information that will be returned about&lt;br /&gt;
matching objects. For example if querying only to find instances of a known object,&lt;br /&gt;
advertise interest for &amp;quot;URL&amp;quot; only. Omitting the interest packet produces a default set&lt;br /&gt;
of response information.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
If an interest packet is received, only return the requested information types. If no&lt;br /&gt;
interest packet is present, return all available information that is feasible. Extensions&lt;br /&gt;
may be withheld.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
An array of strings identifying information classes. The following are defined:&lt;br /&gt;
&lt;br /&gt;
* URL - Locations where matching objects can be found&lt;br /&gt;
* DN - Descriptive names of matching objects&lt;br /&gt;
* MD - Full metadata of matching objects&lt;br /&gt;
* COM - User comments, ratings and reviews of matching objects&lt;br /&gt;
* PFS - Partially available objects&lt;br /&gt;
* A - Requests alternate download sources, returned in /QH2/H/ALT.&lt;br /&gt;
&lt;br /&gt;
Note that default URNs are always supplied and need not be requested.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QA&amp;diff=85135</id>
		<title>QA</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QA&amp;diff=85135"/>
		<updated>2014-01-26T11:20:03Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Sending */ Typo fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QA - Query Acknowledgement =&lt;br /&gt;
&lt;br /&gt;
The query acknowledgement packet is used to inform a search client that a target&lt;br /&gt;
hub has received its [[Q2|query]] and is processing it. It also provides information for the&lt;br /&gt;
search client's hub cache, expanding knowledge of the network and ensuring hubs&lt;br /&gt;
are not searched more than once in a given query.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
Send a query acknowledgement packet only when operating in hub mode, and only&lt;br /&gt;
when the query was not received from a hub via a TCP link. Acknowledgements&lt;br /&gt;
should only be sent after verifying the query key authentication.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
When a query acknowledgement is received, update the local hub cache as&lt;br /&gt;
necessary:&lt;br /&gt;
&lt;br /&gt;
* Hubs which have been searched should not be sent this query again&lt;br /&gt;
* New suggested hubs should be added and refreshed&lt;br /&gt;
* Any &amp;quot;back-off&amp;quot; time should be recorded and honoured.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
A GUID identifying the query being acknowledged.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has several child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QA/TS - Timestamp&lt;br /&gt;
* /QA/D - &amp;quot;Done&amp;quot; or Completed Hub&lt;br /&gt;
* /QA/S - &amp;quot;Search&amp;quot; or New Hub&lt;br /&gt;
* /QA/RA - Retry After&lt;br /&gt;
* /QA/FR - From Address&lt;br /&gt;
&lt;br /&gt;
== /QA/TS - Timestamp ==&lt;br /&gt;
&lt;br /&gt;
The /QA/TS child provides a timestamp representing the current universal time at the&lt;br /&gt;
sending node. This can be used as a reference when considering other timestamps in&lt;br /&gt;
the packet, allowing them to be adjusted to eliminate differences between the time&lt;br /&gt;
setting on the local and remote node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional but recommended.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer representing the current UNIX time, or time(NULL).&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QA/D - Done Hub ==&lt;br /&gt;
&lt;br /&gt;
References a hub which has now been queried, and should not be queried again.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QA/D child for the local hub and each neighbouring hub, whether or not the&lt;br /&gt;
hub has actually forwarded the query. If a hub has not forwarded the query, it was&lt;br /&gt;
still effectively searched as the QHT indicated it could not find a matching object.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QA/D child, add the hub to the cache, freshen its timestamp and&lt;br /&gt;
mark it as queried in this search. Do not query this node again for several minutes.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A network/node address followed by a 16-bit leaf count.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QA/S - Search Hub ==&lt;br /&gt;
&lt;br /&gt;
References a hub which was not searched in this operation, but could be searched&lt;br /&gt;
later if it has not already been touched.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QA/S child for every unique hub in the local hub cluster which is not a direct&lt;br /&gt;
neighbour. Optionally select some recent cached hubs and send /QA/S children for&lt;br /&gt;
them also, to make up at least 10 in total.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QA/S child, add the hub to the cache and/or freshen its&lt;br /&gt;
timestamp.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A network/node address, optionally followed by a 32-bit last-seen timestamp. This&lt;br /&gt;
makes detecting the address family slightly harder, but the compactness is&lt;br /&gt;
worthwhile. Timestamps are omitted for hubs in the local hub cluster, which should&lt;br /&gt;
make up the majority.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QA/RA - Retry After ==&lt;br /&gt;
&lt;br /&gt;
Advises the search client that the hub does not wish to be contacted again for a&lt;br /&gt;
specified period of time. Queries earlier than this time may result in a longer-term&lt;br /&gt;
ban.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send this child, with or without executing the search if the hub's resources are&lt;br /&gt;
becoming saturated. It provides an indirect means of flow control.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QA/RA child, record the retry after interval and do not send any&lt;br /&gt;
requests to the hub until the period has expired.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A 16 bit or 32 bit integer specifying the delay in seconds until the hub may be&lt;br /&gt;
contacted again.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QA/FR - From Address ==&lt;br /&gt;
&lt;br /&gt;
This child is used when a query acknowledgement is forwarded from a proxy hub to&lt;br /&gt;
a firewalled leaf node. It advises the leaf of the original sender.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
When a hub receives a /QA packet for a search originated by one of its leaves, it&lt;br /&gt;
should forward the /QA to the appropriate leaf after adding a /QA/FR child with the&lt;br /&gt;
remote hub's network address.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
If this child is present and the /QA packet was received via TCP from a local hub, the&lt;br /&gt;
node address within should be used as the remote hub's node address. This&lt;br /&gt;
information is often reflected in the first /QA/D child, however this is not always&lt;br /&gt;
present.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A network address which may omit the port number.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=Q2&amp;diff=85134</id>
		<title>Q2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=Q2&amp;diff=85134"/>
		<updated>2014-01-18T16:49:22Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Payload */ Documented &amp;quot;A&amp;quot; in the /Q2/I child&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /Q2 - Gnutella2 Query =&lt;br /&gt;
&lt;br /&gt;
The /Q2 packet is the generic Gnutella2 object query descriptor. It contains search&lt;br /&gt;
criteria, identification, authentication, return addressing and the type of information&lt;br /&gt;
the search client is interested in.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
A node should send a /Q2 packet to another node when it wishes to execute a query&lt;br /&gt;
on that node (and its searchable relations).&lt;br /&gt;
/Q2 packets should always be filtered against a query hash table if one is available&lt;br /&gt;
for the outbound link.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a query, a node should:&lt;br /&gt;
&lt;br /&gt;
* Verify its authentication&lt;br /&gt;
* Send an acknowledgment if it was not received from a hub&lt;br /&gt;
* Forward it to connected nodes if necessary (detailed below)&lt;br /&gt;
* Process it locally and dispatch results&lt;br /&gt;
&lt;br /&gt;
== Forwarding ==&lt;br /&gt;
&lt;br /&gt;
Forwarding of /Q2 packets is achieved based on fixed rules:&lt;br /&gt;
&lt;br /&gt;
* A query received from a leaf or via UDP is forwarded to all connected nodes&lt;br /&gt;
* A query received from a hub is forwarded to connected leaves only&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
The payload of a /Q2 packet consists of a GUID which uniquely identifies the search&lt;br /&gt;
operation.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many defined child packet types at the current time:&lt;br /&gt;
* /Q2/UDP - Return Address and Authentication&lt;br /&gt;
* /Q2/URN - Universal Resource Name&lt;br /&gt;
* /Q2/DN - Descriptive Name (Generic) Criteria&lt;br /&gt;
* /Q2/MD - Metadata Criteria&lt;br /&gt;
* /Q2/SZR - Object Size Restriction Criteria&lt;br /&gt;
* /Q2/I - Interest&lt;br /&gt;
&lt;br /&gt;
== /Q2/UDP - Return Address and Authentication ==&lt;br /&gt;
&lt;br /&gt;
The /Q2/UDP child packet specifies the return address to be used for all direct&lt;br /&gt;
replies, and the query key authentication which authorises transmissions to this&lt;br /&gt;
address. If the query key is invalid, the query should be discarded and a valid query&lt;br /&gt;
key issued to the nominated address (if desired).&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required if the query is to be delivered via UDP. It is optional if delivered&lt;br /&gt;
via TCP: if not included, replies will be reverse forwarded via TCP.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
If this child is present, all replies should be directed to the nominated address. The&lt;br /&gt;
query key should be verified before replying.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A network address (variable length) followed by a query key (fixed length of 32 bits).&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/URN - Universal Resource Name ==&lt;br /&gt;
&lt;br /&gt;
The /Q2/URN child specifies an exact universal resource name which will match the&lt;br /&gt;
query. Rules:&lt;br /&gt;
&lt;br /&gt;
* If one or more URNs are present in a query, whether or not they are understood, matching must occur on URN only and other criteria should be ignored.&lt;br /&gt;
* If multiple URNs are present, only one need match an object for it to be considered a match for the query.&lt;br /&gt;
* Following from the above, multiple URNs of the same family may be specified and match multiple objects (this allows a compound query for several known objects to be executed in one packet).&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child should be added if a specific URN is being sought.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* bitprint or bp - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* sha1 - 20 bytes of SHA1&lt;br /&gt;
* tree:tiger/ or ttr - 24 bytes of tiger-tree root&lt;br /&gt;
* md5 - 16 bytes of MD5&lt;br /&gt;
* ed2k - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/DN - Descriptive Name (Generic) Criteria ==&lt;br /&gt;
&lt;br /&gt;
The descriptive name child provides generic query text to be used in matching&lt;br /&gt;
objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string in the simple query language.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/MD - Metadata Criteria ==&lt;br /&gt;
&lt;br /&gt;
The metadata child provides an XML document containing rich query information.&lt;br /&gt;
The schema identified in the XML must match a metadata schema of prospective&lt;br /&gt;
matching objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The header is optional. Standard plural/singular Gnutella&lt;br /&gt;
metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All string values are in simple query language, including XML attribute and element&lt;br /&gt;
values.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/SZR - Size Restriction Criteria ==&lt;br /&gt;
&lt;br /&gt;
The size restriction criteria specify a minimum and maximum size for matching&lt;br /&gt;
objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A minimum size followed by a maximum size, both quoted in bytes. These two&lt;br /&gt;
numbers may be expressed as two 32 bit integers or two 64 bit integers.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/I - Interest ==&lt;br /&gt;
&lt;br /&gt;
The Interest packet advertises an interest in certain information classes, effectively&lt;br /&gt;
filtering the information that will be returned about matching objects.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send an interest packet to restrict the type of information that will be returned about&lt;br /&gt;
matching objects. For example if querying only to find instances of a known object,&lt;br /&gt;
advertise interest for &amp;quot;URL&amp;quot; only. Omitting the interest packet produces a default set&lt;br /&gt;
of response information.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
If an interest packet is received, only return the requested information types. If no&lt;br /&gt;
interest packet is present, return all available information that is feasible. Extensions&lt;br /&gt;
may be withheld.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
An array of strings identifying information classes. The following are defined:&lt;br /&gt;
&lt;br /&gt;
* URL - Locations where matching objects can be found&lt;br /&gt;
* DN - Descriptive names of matching objects&lt;br /&gt;
* MD - Full metadata of matching objects&lt;br /&gt;
* COM - User comments, ratings and reviews of matching objects&lt;br /&gt;
* PFS - Partially available objects&lt;br /&gt;
* A - Requests alternate download sources, returned in /QH2/H/ALT.&lt;br /&gt;
&lt;br /&gt;
Note that default URNs are always supplied and need not be requested.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QH2&amp;diff=85133</id>
		<title>QH2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QH2&amp;diff=85133"/>
		<updated>2014-01-18T16:47:29Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* /QH2/H - Hit Descriptor */ Documented /QH2/H/ALT&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QH2 - Query Hit =&lt;br /&gt;
&lt;br /&gt;
The /QH2 Gnutella2 query hit packet contains one or more search result descriptors,&lt;br /&gt;
along with information about the node generating the result set. A single node may&lt;br /&gt;
generate several /QH2 packets in response to a /[[Q2]] query. Like all Gnutella2&lt;br /&gt;
packets, the /QH2 packet is highly extensible.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
Send a /QH2 packet when processing a /[[Q2]] query packet reveals one or more&lt;br /&gt;
matching objects. Query hits can be returned directly to the /Q2/UDP return address&lt;br /&gt;
in the query, or routed back along the delivery chain. Firewalled leaf nodes are&lt;br /&gt;
advised to return /QH2 packets to their connected hub for dispatch, as the hub will&lt;br /&gt;
be able to make a reliable delivery.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QH2 query hit packet, check the query GUID against locally&lt;br /&gt;
initiated queries. If it originated elsewhere, increment the route-back hop counter&lt;br /&gt;
and forward it to the most appropriate link or UDP endpoint. If it matches a locally&lt;br /&gt;
generated query, process the search results.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
A single byte representing the hop count, followed by a 16 byte GUID identifying the&lt;br /&gt;
search that produced these results.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* H - Hit Descriptor&lt;br /&gt;
* HG - Hit Group Descriptor&lt;br /&gt;
* GU - Node GUID&lt;br /&gt;
* NA - Node Address&lt;br /&gt;
* NH - Neighbouring Hub&lt;br /&gt;
* V - Vendor Code&lt;br /&gt;
* MD - Unified Metadata Block&lt;br /&gt;
* UPRO - User Profile&lt;br /&gt;
* BUP - Browse User Profile Tag&lt;br /&gt;
* PCH - Peer Chat Tag&lt;br /&gt;
&lt;br /&gt;
== /QH2/GU - Node GUID ==&lt;br /&gt;
&lt;br /&gt;
Specifies the GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
Specifies the node / network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional but recommended.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of the sending node. See datatypes for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NH - Neighbouring Hub ==&lt;br /&gt;
&lt;br /&gt;
Lists a hub to which the sending node (a leaf) is connected. This provides a contact&lt;br /&gt;
point for routing communications to a possibly firewalled leaf node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional, and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of a hub to which the sending node is connected.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
Identifies the software operating the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four character vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BUP - Browse User Profile Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports browsing the local user profile.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/PCH - Peer Chat Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports person to person private message chat.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HG - Hit Group Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a group of search results.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A single byte, the group ID number.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type currently defined:&lt;br /&gt;
&lt;br /&gt;
* SS - Server State&lt;br /&gt;
&lt;br /&gt;
=== /QH2/HG/SS - Server State ===&lt;br /&gt;
&lt;br /&gt;
Provides a status snapshot of the upload server that applies to search results in the&lt;br /&gt;
current hit group.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Add this child to the hit group descriptor to provide server state information.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this information when interpreting hits linked with this hit group.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
* A 16-bit integer : the current queue length including any active transfers (number waiting plus number transferring)&lt;br /&gt;
* An 8-bit integer : the maximum number of concurrent transfers (capacity)&lt;br /&gt;
* A 32-bit integer : the speed in kilobits per second for uploads on this server module&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/H - Hit Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a single object which matched the original query.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QH2/H child for each matching object to be included in this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time, and is often&lt;br /&gt;
extended:&lt;br /&gt;
&lt;br /&gt;
* URN - Universal Resource Name&lt;br /&gt;
* URL - Universal Resource Location&lt;br /&gt;
* DN - Descriptive Name&lt;br /&gt;
* MD - Metadata&lt;br /&gt;
* SZ - Object Size&lt;br /&gt;
* G - Group Identifier&lt;br /&gt;
* ID - Object Identifier&lt;br /&gt;
* CSC - Cached Source Count&lt;br /&gt;
* PART - Partial Availability Marker&lt;br /&gt;
* COM - User Comment&lt;br /&gt;
* PVU - Preview URL&lt;br /&gt;
* ALT - Alternate Locations&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URN - Universal Resource Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies a universal resource name which can be used to identify the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
At least one instance of this child is required. Multiple instances are optional.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* '''bitprint''' or '''bp''' - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* '''sha1''' - 20 bytes of SHA1&lt;br /&gt;
* '''tree:tiger/''' or '''ttr''' - 24 bytes of tiger-tree root&lt;br /&gt;
* '''md5''' - 16 bytes of MD5&lt;br /&gt;
* '''ed2k''' - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URL - Universal Resource Location ===&lt;br /&gt;
&lt;br /&gt;
This child specifies a location where the object being described can be acquired.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and a URL is available.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If a /QH2/H/URL child was requested but is not present, the sending node may not&lt;br /&gt;
have the object. It is valid to advertise information about objects that are not&lt;br /&gt;
available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or a string which represents an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to an instance of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has the object available&lt;br /&gt;
locally. It can be retrieved with an HTTP request using the &amp;quot;uri-res&amp;quot; resolver.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== QH2/H/DN - Descriptive Name (Generic) Criteria ===&lt;br /&gt;
&lt;br /&gt;
The descriptive name for the object, and the object's size.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer indicating the object's size, followed by a string describing it. If a&lt;br /&gt;
/QH2/H/SZ child is present, the 32-bit size prefix is omitted here (allowing a larger&lt;br /&gt;
64 bit file size).&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/MD - Metadata ===&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The xml header is optional. Standard plural/singular&lt;br /&gt;
Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/SZ - Object Size ===&lt;br /&gt;
&lt;br /&gt;
Specifies the size of the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if DN was requested, and if the size is not to be packed into&lt;br /&gt;
the /QH2/H/DN child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit or 64-bit integer representing the object size.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/G - Group Identifier ===&lt;br /&gt;
&lt;br /&gt;
Indicates which hit group (/QH2/HG) this hit belongs to. If this child is not present,&lt;br /&gt;
the hit belongs to group zero.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Send this child if this hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If this child is present, the hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A single byte, the hit group ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ID - Object Identifier ===&lt;br /&gt;
&lt;br /&gt;
Specifies a 32-bit integer which uniquely identifies the object on the sender's system.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is not normally sent for search results. It is used in browse-user responses&lt;br /&gt;
to allow objects to be referenced by virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this ID to link objects to virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CSC - Cached Source Count ===&lt;br /&gt;
&lt;br /&gt;
Indicates the number of external cached sources known to the sending node.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if cached sources are available and interest in URLs was expressed&lt;br /&gt;
in the query.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 16-bit integer.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PART - Partial Content Tag ===&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node has only part of the object, and how much it has.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a /QH2/H/URL child is present and the URL contains only part of&lt;br /&gt;
the object.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer, the number of bytes available.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* MT - Modification Time (payload = 32-bit timestamp)&lt;br /&gt;
&lt;br /&gt;
The ''MT'' child carries the last modification time (UNIX timestamp) of the partial file and can be used to determine whether there has been recent updates made (''hot'' file) or if the file is ''cold'' (not undergoing any downloading activity on the remote side).&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/COM - User Comment ===&lt;br /&gt;
&lt;br /&gt;
Provides a user review and/or rating for the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a user comment is available, and comments were requested.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
An XML string, of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;comment rating=&amp;quot;n&amp;quot;&amp;gt;&lt;br /&gt;
The comment goes here.&lt;br /&gt;
&amp;lt;/comment&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rating is an integer 0 &amp;lt;= n &amp;lt;= 5, indicating the number of &amp;quot;stars&amp;quot;. The text&lt;br /&gt;
may not include HTML, but may include forum-style block codes and emoticon&lt;br /&gt;
notation.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PVU - Preview URL ===&lt;br /&gt;
&lt;br /&gt;
Indicates that a preview URL is available for the object. A preview URL will serve a&lt;br /&gt;
miniature version of the content.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a preview is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to a preview of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has a preview of the object&lt;br /&gt;
available locally. It can be retrieved with an HTTP request to the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
/gnutella/preview/v1?urn:xyz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ALT - Alternate Locations ===&lt;br /&gt;
&lt;br /&gt;
Supplies alternate download sources for the hit.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent when the query indicated that it wanted alternate locations, via the &amp;quot;A&amp;quot; string in its /Q2/I child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
The payload contains a vector of alternate locations, listing IPv4 addresses followed by 16-bit ports, as usual (e.g. the same format used to serialize an &amp;quot;NA&amp;quot; payload), but all the entries are concatenated.  Hence, a payload of 24 bytes will indicate that there are 4 entries of 6 bytes each.&lt;br /&gt;
&lt;br /&gt;
These alternate locations are the IP:port addresses of known hosts that can serve the file.  These can be G2 hosts or G1 hosts, but there are no differences since the file transfer protocol is identical for both networks.&lt;br /&gt;
&lt;br /&gt;
None of the addresses listed there are for firewalled hosts, so anyone should be able to contact them at their uri-res address, supplying the urn:sha1: value suitable for the resource.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/MD - Unified Metadata Block ==&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing one or more objects in the packet. This is an&lt;br /&gt;
alternative method of delivering metadata, which allows metadata for similar objects&lt;br /&gt;
to be grouped together. It is compatible with the unified metadata block format in&lt;br /&gt;
Gnutella1.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing one or more XML documents, each beginning with a header.&lt;br /&gt;
Standard plural/singular Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application index=&amp;quot;0&amp;quot; title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;images xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/image.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;1&amp;quot; description=&amp;quot;Shareaza Logo&amp;quot; width=&amp;quot;128&amp;quot; height=&amp;quot;128&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;2&amp;quot; description=&amp;quot;Shareaza Screen Shot&amp;quot; width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/images&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An additional attribute, &amp;quot;index&amp;quot; is added to each singular entry. The index is a zerobased&lt;br /&gt;
integer identifying the Nth /QH2/H child within this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/UPRO - User Profile ==&lt;br /&gt;
&lt;br /&gt;
Delivers a user profile or user profile summary, describing the user operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a version of this child if the operating user wishes to list their screen name in&lt;br /&gt;
search results.&lt;br /&gt;
&lt;br /&gt;
The current version of this packet contains a summary only, consisting of the&lt;br /&gt;
screen/nick name. Future versions may include a more comprehensive XML text&lt;br /&gt;
block in the payload.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
One child packet type is defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QH2/UPRO/NICK - Nick/screen Name&lt;br /&gt;
&lt;br /&gt;
=== /QH2/UPRO/NICK - Nick/Screen Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies the nick/screen name of the user.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QH2&amp;diff=85132</id>
		<title>QH2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QH2&amp;diff=85132"/>
		<updated>2014-01-18T16:36:44Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Children */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QH2 - Query Hit =&lt;br /&gt;
&lt;br /&gt;
The /QH2 Gnutella2 query hit packet contains one or more search result descriptors,&lt;br /&gt;
along with information about the node generating the result set. A single node may&lt;br /&gt;
generate several /QH2 packets in response to a /[[Q2]] query. Like all Gnutella2&lt;br /&gt;
packets, the /QH2 packet is highly extensible.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
Send a /QH2 packet when processing a /[[Q2]] query packet reveals one or more&lt;br /&gt;
matching objects. Query hits can be returned directly to the /Q2/UDP return address&lt;br /&gt;
in the query, or routed back along the delivery chain. Firewalled leaf nodes are&lt;br /&gt;
advised to return /QH2 packets to their connected hub for dispatch, as the hub will&lt;br /&gt;
be able to make a reliable delivery.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QH2 query hit packet, check the query GUID against locally&lt;br /&gt;
initiated queries. If it originated elsewhere, increment the route-back hop counter&lt;br /&gt;
and forward it to the most appropriate link or UDP endpoint. If it matches a locally&lt;br /&gt;
generated query, process the search results.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
A single byte representing the hop count, followed by a 16 byte GUID identifying the&lt;br /&gt;
search that produced these results.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* H - Hit Descriptor&lt;br /&gt;
* HG - Hit Group Descriptor&lt;br /&gt;
* GU - Node GUID&lt;br /&gt;
* NA - Node Address&lt;br /&gt;
* NH - Neighbouring Hub&lt;br /&gt;
* V - Vendor Code&lt;br /&gt;
* MD - Unified Metadata Block&lt;br /&gt;
* UPRO - User Profile&lt;br /&gt;
* BUP - Browse User Profile Tag&lt;br /&gt;
* PCH - Peer Chat Tag&lt;br /&gt;
&lt;br /&gt;
== /QH2/GU - Node GUID ==&lt;br /&gt;
&lt;br /&gt;
Specifies the GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
Specifies the node / network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional but recommended.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of the sending node. See datatypes for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NH - Neighbouring Hub ==&lt;br /&gt;
&lt;br /&gt;
Lists a hub to which the sending node (a leaf) is connected. This provides a contact&lt;br /&gt;
point for routing communications to a possibly firewalled leaf node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional, and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of a hub to which the sending node is connected.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
Identifies the software operating the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four character vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BUP - Browse User Profile Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports browsing the local user profile.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/PCH - Peer Chat Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports person to person private message chat.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HG - Hit Group Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a group of search results.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A single byte, the group ID number.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type currently defined:&lt;br /&gt;
&lt;br /&gt;
* SS - Server State&lt;br /&gt;
&lt;br /&gt;
=== /QH2/HG/SS - Server State ===&lt;br /&gt;
&lt;br /&gt;
Provides a status snapshot of the upload server that applies to search results in the&lt;br /&gt;
current hit group.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Add this child to the hit group descriptor to provide server state information.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this information when interpreting hits linked with this hit group.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
* A 16-bit integer : the current queue length including any active transfers (number waiting plus number transferring)&lt;br /&gt;
* An 8-bit integer : the maximum number of concurrent transfers (capacity)&lt;br /&gt;
* A 32-bit integer : the speed in kilobits per second for uploads on this server module&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/H - Hit Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a single object which matched the original query.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QH2/H child for each matching object to be included in this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time, and is often&lt;br /&gt;
extended:&lt;br /&gt;
&lt;br /&gt;
* URN - Universal Resource Name&lt;br /&gt;
* URL - Universal Resource Location&lt;br /&gt;
* DN - Descriptive Name&lt;br /&gt;
* MD - Metadata&lt;br /&gt;
* SZ - Object Size&lt;br /&gt;
* G - Group Identifier&lt;br /&gt;
* ID - Object Identifier&lt;br /&gt;
* CSC - Cached Source Count&lt;br /&gt;
* PART - Partial Availability Marker&lt;br /&gt;
* COM - User Comment&lt;br /&gt;
* PVU - Preview URL&lt;br /&gt;
* ALT - Alternate Locations&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URN - Universal Resource Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies a universal resource name which can be used to identify the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
At least one instance of this child is required. Multiple instances are optional.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* '''bitprint''' or '''bp''' - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* '''sha1''' - 20 bytes of SHA1&lt;br /&gt;
* '''tree:tiger/''' or '''ttr''' - 24 bytes of tiger-tree root&lt;br /&gt;
* '''md5''' - 16 bytes of MD5&lt;br /&gt;
* '''ed2k''' - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URL - Universal Resource Location ===&lt;br /&gt;
&lt;br /&gt;
This child specifies a location where the object being described can be acquired.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and a URL is available.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If a /QH2/H/URL child was requested but is not present, the sending node may not&lt;br /&gt;
have the object. It is valid to advertise information about objects that are not&lt;br /&gt;
available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or a string which represents an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to an instance of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has the object available&lt;br /&gt;
locally. It can be retrieved with an HTTP request using the &amp;quot;uri-res&amp;quot; resolver.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== QH2/H/DN - Descriptive Name (Generic) Criteria ===&lt;br /&gt;
&lt;br /&gt;
The descriptive name for the object, and the object's size.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer indicating the object's size, followed by a string describing it. If a&lt;br /&gt;
/QH2/H/SZ child is present, the 32-bit size prefix is omitted here (allowing a larger&lt;br /&gt;
64 bit file size).&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/MD - Metadata ===&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The xml header is optional. Standard plural/singular&lt;br /&gt;
Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/SZ - Object Size ===&lt;br /&gt;
&lt;br /&gt;
Specifies the size of the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if DN was requested, and if the size is not to be packed into&lt;br /&gt;
the /QH2/H/DN child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit or 64-bit integer representing the object size.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/G - Group Identifier ===&lt;br /&gt;
&lt;br /&gt;
Indicates which hit group (/QH2/HG) this hit belongs to. If this child is not present,&lt;br /&gt;
the hit belongs to group zero.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Send this child if this hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If this child is present, the hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A single byte, the hit group ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ID - Object Identifier ===&lt;br /&gt;
&lt;br /&gt;
Specifies a 32-bit integer which uniquely identifies the object on the sender's system.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is not normally sent for search results. It is used in browse-user responses&lt;br /&gt;
to allow objects to be referenced by virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this ID to link objects to virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CSC - Cached Source Count ===&lt;br /&gt;
&lt;br /&gt;
Indicates the number of external cached sources known to the sending node.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if cached sources are available and interest in URLs was expressed&lt;br /&gt;
in the query.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 16-bit integer.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PART - Partial Content Tag ===&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node has only part of the object, and how much it has.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a /QH2/H/URL child is present and the URL contains only part of&lt;br /&gt;
the object.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer, the number of bytes available.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* MT - Modification Time (payload = 32-bit timestamp)&lt;br /&gt;
&lt;br /&gt;
The ''MT'' child carries the last modification time (UNIX timestamp) of the partial file and can be used to determine whether there has been recent updates made (''hot'' file) or if the file is ''cold'' (not undergoing any downloading activity on the remote side).&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/COM - User Comment ===&lt;br /&gt;
&lt;br /&gt;
Provides a user review and/or rating for the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a user comment is available, and comments were requested.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
An XML string, of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;comment rating=&amp;quot;n&amp;quot;&amp;gt;&lt;br /&gt;
The comment goes here.&lt;br /&gt;
&amp;lt;/comment&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rating is an integer 0 &amp;lt;= n &amp;lt;= 5, indicating the number of &amp;quot;stars&amp;quot;. The text&lt;br /&gt;
may not include HTML, but may include forum-style block codes and emoticon&lt;br /&gt;
notation.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PVU - Preview URL ===&lt;br /&gt;
&lt;br /&gt;
Indicates that a preview URL is available for the object. A preview URL will serve a&lt;br /&gt;
miniature version of the content.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a preview is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to a preview of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has a preview of the object&lt;br /&gt;
available locally. It can be retrieved with an HTTP request to the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
/gnutella/preview/v1?urn:xyz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/MD - Unified Metadata Block ==&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing one or more objects in the packet. This is an&lt;br /&gt;
alternative method of delivering metadata, which allows metadata for similar objects&lt;br /&gt;
to be grouped together. It is compatible with the unified metadata block format in&lt;br /&gt;
Gnutella1.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing one or more XML documents, each beginning with a header.&lt;br /&gt;
Standard plural/singular Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application index=&amp;quot;0&amp;quot; title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;images xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/image.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;1&amp;quot; description=&amp;quot;Shareaza Logo&amp;quot; width=&amp;quot;128&amp;quot; height=&amp;quot;128&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;2&amp;quot; description=&amp;quot;Shareaza Screen Shot&amp;quot; width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/images&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An additional attribute, &amp;quot;index&amp;quot; is added to each singular entry. The index is a zerobased&lt;br /&gt;
integer identifying the Nth /QH2/H child within this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/UPRO - User Profile ==&lt;br /&gt;
&lt;br /&gt;
Delivers a user profile or user profile summary, describing the user operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a version of this child if the operating user wishes to list their screen name in&lt;br /&gt;
search results.&lt;br /&gt;
&lt;br /&gt;
The current version of this packet contains a summary only, consisting of the&lt;br /&gt;
screen/nick name. Future versions may include a more comprehensive XML text&lt;br /&gt;
block in the payload.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
One child packet type is defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QH2/UPRO/NICK - Nick/screen Name&lt;br /&gt;
&lt;br /&gt;
=== /QH2/UPRO/NICK - Nick/Screen Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies the nick/screen name of the user.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QH2&amp;diff=85131</id>
		<title>QH2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QH2&amp;diff=85131"/>
		<updated>2014-01-18T16:36:15Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Children */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QH2 - Query Hit =&lt;br /&gt;
&lt;br /&gt;
The /QH2 Gnutella2 query hit packet contains one or more search result descriptors,&lt;br /&gt;
along with information about the node generating the result set. A single node may&lt;br /&gt;
generate several /QH2 packets in response to a /[[Q2]] query. Like all Gnutella2&lt;br /&gt;
packets, the /QH2 packet is highly extensible.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
Send a /QH2 packet when processing a /[[Q2]] query packet reveals one or more&lt;br /&gt;
matching objects. Query hits can be returned directly to the /Q2/UDP return address&lt;br /&gt;
in the query, or routed back along the delivery chain. Firewalled leaf nodes are&lt;br /&gt;
advised to return /QH2 packets to their connected hub for dispatch, as the hub will&lt;br /&gt;
be able to make a reliable delivery.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QH2 query hit packet, check the query GUID against locally&lt;br /&gt;
initiated queries. If it originated elsewhere, increment the route-back hop counter&lt;br /&gt;
and forward it to the most appropriate link or UDP endpoint. If it matches a locally&lt;br /&gt;
generated query, process the search results.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
A single byte representing the hop count, followed by a 16 byte GUID identifying the&lt;br /&gt;
search that produced these results.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* H - Hit Descriptor&lt;br /&gt;
* HG - Hit Group Descriptor&lt;br /&gt;
* GU - Node GUID&lt;br /&gt;
* NA - Node Address&lt;br /&gt;
* NH - Neighbouring Hub&lt;br /&gt;
* V - Vendor Code&lt;br /&gt;
* MD - Unified Metadata Block&lt;br /&gt;
* UPRO - User Profile&lt;br /&gt;
* BUP - Browse User Profile Tag&lt;br /&gt;
* PCH - Peer Chat Tag&lt;br /&gt;
&lt;br /&gt;
== /QH2/GU - Node GUID ==&lt;br /&gt;
&lt;br /&gt;
Specifies the GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
Specifies the node / network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional but recommended.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of the sending node. See datatypes for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NH - Neighbouring Hub ==&lt;br /&gt;
&lt;br /&gt;
Lists a hub to which the sending node (a leaf) is connected. This provides a contact&lt;br /&gt;
point for routing communications to a possibly firewalled leaf node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional, and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of a hub to which the sending node is connected.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
Identifies the software operating the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four character vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BUP - Browse User Profile Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports browsing the local user profile.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/PCH - Peer Chat Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports person to person private message chat.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HG - Hit Group Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a group of search results.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A single byte, the group ID number.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type currently defined:&lt;br /&gt;
&lt;br /&gt;
* SS - Server State&lt;br /&gt;
&lt;br /&gt;
=== /QH2/HG/SS - Server State ===&lt;br /&gt;
&lt;br /&gt;
Provides a status snapshot of the upload server that applies to search results in the&lt;br /&gt;
current hit group.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Add this child to the hit group descriptor to provide server state information.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this information when interpreting hits linked with this hit group.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
* A 16-bit integer : the current queue length including any active transfers (number waiting plus number transferring)&lt;br /&gt;
* An 8-bit integer : the maximum number of concurrent transfers (capacity)&lt;br /&gt;
* A 32-bit integer : the speed in kilobits per second for uploads on this server module&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/H - Hit Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a single object which matched the original query.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QH2/H child for each matching object to be included in this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time, and is often&lt;br /&gt;
extended:&lt;br /&gt;
&lt;br /&gt;
* URN - Universal Resource Name&lt;br /&gt;
* URL - Universal Resource Location&lt;br /&gt;
* DN - Descriptive Name&lt;br /&gt;
* MD - Metadata&lt;br /&gt;
* SZ - Object Size&lt;br /&gt;
* G - Group Identifier&lt;br /&gt;
* ID - Object Identifier&lt;br /&gt;
* CSC - Cached Source Count&lt;br /&gt;
* PART - Partial Availability Marker&lt;br /&gt;
* COM - User Comment&lt;br /&gt;
* PVU - Preview URL&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URN - Universal Resource Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies a universal resource name which can be used to identify the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
At least one instance of this child is required. Multiple instances are optional.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* '''bitprint''' or '''bp''' - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* '''sha1''' - 20 bytes of SHA1&lt;br /&gt;
* '''tree:tiger/''' or '''ttr''' - 24 bytes of tiger-tree root&lt;br /&gt;
* '''md5''' - 16 bytes of MD5&lt;br /&gt;
* '''ed2k''' - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URL - Universal Resource Location ===&lt;br /&gt;
&lt;br /&gt;
This child specifies a location where the object being described can be acquired.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and a URL is available.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If a /QH2/H/URL child was requested but is not present, the sending node may not&lt;br /&gt;
have the object. It is valid to advertise information about objects that are not&lt;br /&gt;
available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or a string which represents an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to an instance of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has the object available&lt;br /&gt;
locally. It can be retrieved with an HTTP request using the &amp;quot;uri-res&amp;quot; resolver.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== QH2/H/DN - Descriptive Name (Generic) Criteria ===&lt;br /&gt;
&lt;br /&gt;
The descriptive name for the object, and the object's size.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer indicating the object's size, followed by a string describing it. If a&lt;br /&gt;
/QH2/H/SZ child is present, the 32-bit size prefix is omitted here (allowing a larger&lt;br /&gt;
64 bit file size).&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/MD - Metadata ===&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The xml header is optional. Standard plural/singular&lt;br /&gt;
Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/SZ - Object Size ===&lt;br /&gt;
&lt;br /&gt;
Specifies the size of the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if DN was requested, and if the size is not to be packed into&lt;br /&gt;
the /QH2/H/DN child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit or 64-bit integer representing the object size.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/G - Group Identifier ===&lt;br /&gt;
&lt;br /&gt;
Indicates which hit group (/QH2/HG) this hit belongs to. If this child is not present,&lt;br /&gt;
the hit belongs to group zero.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Send this child if this hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If this child is present, the hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A single byte, the hit group ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ID - Object Identifier ===&lt;br /&gt;
&lt;br /&gt;
Specifies a 32-bit integer which uniquely identifies the object on the sender's system.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is not normally sent for search results. It is used in browse-user responses&lt;br /&gt;
to allow objects to be referenced by virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this ID to link objects to virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CSC - Cached Source Count ===&lt;br /&gt;
&lt;br /&gt;
Indicates the number of external cached sources known to the sending node.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if cached sources are available and interest in URLs was expressed&lt;br /&gt;
in the query.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 16-bit integer.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PART - Partial Content Tag ===&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node has only part of the object, and how much it has.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a /QH2/H/URL child is present and the URL contains only part of&lt;br /&gt;
the object.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer, the number of bytes available.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* MT - Modification Time (payload = 32-bit timestamp)&lt;br /&gt;
&lt;br /&gt;
The ''MT'' child carries the last modification time (UNIX timestamp) of the partial file and can be used to determine whether there has been recent updates made (''hot'' file) or if the file is ''cold'' (not undergoing any downloading activity on the remote side).&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/COM - User Comment ===&lt;br /&gt;
&lt;br /&gt;
Provides a user review and/or rating for the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a user comment is available, and comments were requested.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
An XML string, of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;comment rating=&amp;quot;n&amp;quot;&amp;gt;&lt;br /&gt;
The comment goes here.&lt;br /&gt;
&amp;lt;/comment&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rating is an integer 0 &amp;lt;= n &amp;lt;= 5, indicating the number of &amp;quot;stars&amp;quot;. The text&lt;br /&gt;
may not include HTML, but may include forum-style block codes and emoticon&lt;br /&gt;
notation.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PVU - Preview URL ===&lt;br /&gt;
&lt;br /&gt;
Indicates that a preview URL is available for the object. A preview URL will serve a&lt;br /&gt;
miniature version of the content.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a preview is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to a preview of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has a preview of the object&lt;br /&gt;
available locally. It can be retrieved with an HTTP request to the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
/gnutella/preview/v1?urn:xyz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/MD - Unified Metadata Block ==&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing one or more objects in the packet. This is an&lt;br /&gt;
alternative method of delivering metadata, which allows metadata for similar objects&lt;br /&gt;
to be grouped together. It is compatible with the unified metadata block format in&lt;br /&gt;
Gnutella1.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing one or more XML documents, each beginning with a header.&lt;br /&gt;
Standard plural/singular Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application index=&amp;quot;0&amp;quot; title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;images xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/image.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;1&amp;quot; description=&amp;quot;Shareaza Logo&amp;quot; width=&amp;quot;128&amp;quot; height=&amp;quot;128&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;2&amp;quot; description=&amp;quot;Shareaza Screen Shot&amp;quot; width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/images&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An additional attribute, &amp;quot;index&amp;quot; is added to each singular entry. The index is a zerobased&lt;br /&gt;
integer identifying the Nth /QH2/H child within this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/UPRO - User Profile ==&lt;br /&gt;
&lt;br /&gt;
Delivers a user profile or user profile summary, describing the user operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a version of this child if the operating user wishes to list their screen name in&lt;br /&gt;
search results.&lt;br /&gt;
&lt;br /&gt;
The current version of this packet contains a summary only, consisting of the&lt;br /&gt;
screen/nick name. Future versions may include a more comprehensive XML text&lt;br /&gt;
block in the payload.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
One child packet type is defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QH2/UPRO/NICK - Nick/screen Name&lt;br /&gt;
&lt;br /&gt;
=== /QH2/UPRO/NICK - Nick/Screen Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies the nick/screen name of the user.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QH2&amp;diff=85130</id>
		<title>QH2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QH2&amp;diff=85130"/>
		<updated>2014-01-18T16:35:18Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Children */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QH2 - Query Hit =&lt;br /&gt;
&lt;br /&gt;
The /QH2 Gnutella2 query hit packet contains one or more search result descriptors,&lt;br /&gt;
along with information about the node generating the result set. A single node may&lt;br /&gt;
generate several /QH2 packets in response to a /[[Q2]] query. Like all Gnutella2&lt;br /&gt;
packets, the /QH2 packet is highly extensible.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
Send a /QH2 packet when processing a /[[Q2]] query packet reveals one or more&lt;br /&gt;
matching objects. Query hits can be returned directly to the /Q2/UDP return address&lt;br /&gt;
in the query, or routed back along the delivery chain. Firewalled leaf nodes are&lt;br /&gt;
advised to return /QH2 packets to their connected hub for dispatch, as the hub will&lt;br /&gt;
be able to make a reliable delivery.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QH2 query hit packet, check the query GUID against locally&lt;br /&gt;
initiated queries. If it originated elsewhere, increment the route-back hop counter&lt;br /&gt;
and forward it to the most appropriate link or UDP endpoint. If it matches a locally&lt;br /&gt;
generated query, process the search results.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
A single byte representing the hop count, followed by a 16 byte GUID identifying the&lt;br /&gt;
search that produced these results.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* H - Hit Descriptor&lt;br /&gt;
* HG - Hit Group Descriptor&lt;br /&gt;
* GU - Node GUID&lt;br /&gt;
* NA - Node Address&lt;br /&gt;
* NH - Neighbouring Hub&lt;br /&gt;
* V - Vendor Code&lt;br /&gt;
* MD - Unified Metadata Block&lt;br /&gt;
* UPRO - User Profile&lt;br /&gt;
* BUP - Browse User Profile Tag&lt;br /&gt;
* PCH - Peer Chat Tag&lt;br /&gt;
* ALT - Alternate Locations&lt;br /&gt;
&lt;br /&gt;
== /QH2/GU - Node GUID ==&lt;br /&gt;
&lt;br /&gt;
Specifies the GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
Specifies the node / network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional but recommended.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of the sending node. See datatypes for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NH - Neighbouring Hub ==&lt;br /&gt;
&lt;br /&gt;
Lists a hub to which the sending node (a leaf) is connected. This provides a contact&lt;br /&gt;
point for routing communications to a possibly firewalled leaf node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional, and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of a hub to which the sending node is connected.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
Identifies the software operating the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four character vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BUP - Browse User Profile Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports browsing the local user profile.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/PCH - Peer Chat Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports person to person private message chat.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HG - Hit Group Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a group of search results.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A single byte, the group ID number.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type currently defined:&lt;br /&gt;
&lt;br /&gt;
* SS - Server State&lt;br /&gt;
&lt;br /&gt;
=== /QH2/HG/SS - Server State ===&lt;br /&gt;
&lt;br /&gt;
Provides a status snapshot of the upload server that applies to search results in the&lt;br /&gt;
current hit group.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Add this child to the hit group descriptor to provide server state information.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this information when interpreting hits linked with this hit group.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
* A 16-bit integer : the current queue length including any active transfers (number waiting plus number transferring)&lt;br /&gt;
* An 8-bit integer : the maximum number of concurrent transfers (capacity)&lt;br /&gt;
* A 32-bit integer : the speed in kilobits per second for uploads on this server module&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/H - Hit Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a single object which matched the original query.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QH2/H child for each matching object to be included in this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time, and is often&lt;br /&gt;
extended:&lt;br /&gt;
&lt;br /&gt;
* URN - Universal Resource Name&lt;br /&gt;
* URL - Universal Resource Location&lt;br /&gt;
* DN - Descriptive Name&lt;br /&gt;
* MD - Metadata&lt;br /&gt;
* SZ - Object Size&lt;br /&gt;
* G - Group Identifier&lt;br /&gt;
* ID - Object Identifier&lt;br /&gt;
* CSC - Cached Source Count&lt;br /&gt;
* PART - Partial Availability Marker&lt;br /&gt;
* COM - User Comment&lt;br /&gt;
* PVU - Preview URL&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URN - Universal Resource Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies a universal resource name which can be used to identify the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
At least one instance of this child is required. Multiple instances are optional.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* '''bitprint''' or '''bp''' - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* '''sha1''' - 20 bytes of SHA1&lt;br /&gt;
* '''tree:tiger/''' or '''ttr''' - 24 bytes of tiger-tree root&lt;br /&gt;
* '''md5''' - 16 bytes of MD5&lt;br /&gt;
* '''ed2k''' - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URL - Universal Resource Location ===&lt;br /&gt;
&lt;br /&gt;
This child specifies a location where the object being described can be acquired.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and a URL is available.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If a /QH2/H/URL child was requested but is not present, the sending node may not&lt;br /&gt;
have the object. It is valid to advertise information about objects that are not&lt;br /&gt;
available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or a string which represents an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to an instance of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has the object available&lt;br /&gt;
locally. It can be retrieved with an HTTP request using the &amp;quot;uri-res&amp;quot; resolver.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== QH2/H/DN - Descriptive Name (Generic) Criteria ===&lt;br /&gt;
&lt;br /&gt;
The descriptive name for the object, and the object's size.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer indicating the object's size, followed by a string describing it. If a&lt;br /&gt;
/QH2/H/SZ child is present, the 32-bit size prefix is omitted here (allowing a larger&lt;br /&gt;
64 bit file size).&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/MD - Metadata ===&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The xml header is optional. Standard plural/singular&lt;br /&gt;
Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/SZ - Object Size ===&lt;br /&gt;
&lt;br /&gt;
Specifies the size of the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if DN was requested, and if the size is not to be packed into&lt;br /&gt;
the /QH2/H/DN child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit or 64-bit integer representing the object size.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/G - Group Identifier ===&lt;br /&gt;
&lt;br /&gt;
Indicates which hit group (/QH2/HG) this hit belongs to. If this child is not present,&lt;br /&gt;
the hit belongs to group zero.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Send this child if this hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If this child is present, the hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A single byte, the hit group ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ID - Object Identifier ===&lt;br /&gt;
&lt;br /&gt;
Specifies a 32-bit integer which uniquely identifies the object on the sender's system.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is not normally sent for search results. It is used in browse-user responses&lt;br /&gt;
to allow objects to be referenced by virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this ID to link objects to virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CSC - Cached Source Count ===&lt;br /&gt;
&lt;br /&gt;
Indicates the number of external cached sources known to the sending node.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if cached sources are available and interest in URLs was expressed&lt;br /&gt;
in the query.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 16-bit integer.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PART - Partial Content Tag ===&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node has only part of the object, and how much it has.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a /QH2/H/URL child is present and the URL contains only part of&lt;br /&gt;
the object.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer, the number of bytes available.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* MT - Modification Time (payload = 32-bit timestamp)&lt;br /&gt;
&lt;br /&gt;
The ''MT'' child carries the last modification time (UNIX timestamp) of the partial file and can be used to determine whether there has been recent updates made (''hot'' file) or if the file is ''cold'' (not undergoing any downloading activity on the remote side).&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/COM - User Comment ===&lt;br /&gt;
&lt;br /&gt;
Provides a user review and/or rating for the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a user comment is available, and comments were requested.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
An XML string, of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;comment rating=&amp;quot;n&amp;quot;&amp;gt;&lt;br /&gt;
The comment goes here.&lt;br /&gt;
&amp;lt;/comment&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rating is an integer 0 &amp;lt;= n &amp;lt;= 5, indicating the number of &amp;quot;stars&amp;quot;. The text&lt;br /&gt;
may not include HTML, but may include forum-style block codes and emoticon&lt;br /&gt;
notation.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PVU - Preview URL ===&lt;br /&gt;
&lt;br /&gt;
Indicates that a preview URL is available for the object. A preview URL will serve a&lt;br /&gt;
miniature version of the content.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a preview is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to a preview of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has a preview of the object&lt;br /&gt;
available locally. It can be retrieved with an HTTP request to the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
/gnutella/preview/v1?urn:xyz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/MD - Unified Metadata Block ==&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing one or more objects in the packet. This is an&lt;br /&gt;
alternative method of delivering metadata, which allows metadata for similar objects&lt;br /&gt;
to be grouped together. It is compatible with the unified metadata block format in&lt;br /&gt;
Gnutella1.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing one or more XML documents, each beginning with a header.&lt;br /&gt;
Standard plural/singular Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application index=&amp;quot;0&amp;quot; title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;images xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/image.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;1&amp;quot; description=&amp;quot;Shareaza Logo&amp;quot; width=&amp;quot;128&amp;quot; height=&amp;quot;128&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;2&amp;quot; description=&amp;quot;Shareaza Screen Shot&amp;quot; width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/images&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An additional attribute, &amp;quot;index&amp;quot; is added to each singular entry. The index is a zerobased&lt;br /&gt;
integer identifying the Nth /QH2/H child within this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/UPRO - User Profile ==&lt;br /&gt;
&lt;br /&gt;
Delivers a user profile or user profile summary, describing the user operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a version of this child if the operating user wishes to list their screen name in&lt;br /&gt;
search results.&lt;br /&gt;
&lt;br /&gt;
The current version of this packet contains a summary only, consisting of the&lt;br /&gt;
screen/nick name. Future versions may include a more comprehensive XML text&lt;br /&gt;
block in the payload.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
One child packet type is defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QH2/UPRO/NICK - Nick/screen Name&lt;br /&gt;
&lt;br /&gt;
=== /QH2/UPRO/NICK - Nick/Screen Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies the nick/screen name of the user.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=QH2&amp;diff=85129</id>
		<title>QH2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=QH2&amp;diff=85129"/>
		<updated>2014-01-18T16:33:07Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Children */ Documented the /QH2/H/PART/MT child&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /QH2 - Query Hit =&lt;br /&gt;
&lt;br /&gt;
The /QH2 Gnutella2 query hit packet contains one or more search result descriptors,&lt;br /&gt;
along with information about the node generating the result set. A single node may&lt;br /&gt;
generate several /QH2 packets in response to a /[[Q2]] query. Like all Gnutella2&lt;br /&gt;
packets, the /QH2 packet is highly extensible.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
Send a /QH2 packet when processing a /[[Q2]] query packet reveals one or more&lt;br /&gt;
matching objects. Query hits can be returned directly to the /Q2/UDP return address&lt;br /&gt;
in the query, or routed back along the delivery chain. Firewalled leaf nodes are&lt;br /&gt;
advised to return /QH2 packets to their connected hub for dispatch, as the hub will&lt;br /&gt;
be able to make a reliable delivery.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /QH2 query hit packet, check the query GUID against locally&lt;br /&gt;
initiated queries. If it originated elsewhere, increment the route-back hop counter&lt;br /&gt;
and forward it to the most appropriate link or UDP endpoint. If it matches a locally&lt;br /&gt;
generated query, process the search results.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
A single byte representing the hop count, followed by a 16 byte GUID identifying the&lt;br /&gt;
search that produced these results.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* H - Hit Descriptor&lt;br /&gt;
* HG - Hit Group Descriptor&lt;br /&gt;
* GU - Node GUID&lt;br /&gt;
* NA - Node Address&lt;br /&gt;
* NH - Neighbouring Hub&lt;br /&gt;
* V - Vendor Code&lt;br /&gt;
* MD - Unified Metadata Block&lt;br /&gt;
* UPRO - User Profile&lt;br /&gt;
* BUP - Browse User Profile Tag&lt;br /&gt;
* PCH - Peer Chat Tag&lt;br /&gt;
&lt;br /&gt;
== /QH2/GU - Node GUID ==&lt;br /&gt;
&lt;br /&gt;
Specifies the GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The GUID of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
Specifies the node / network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional but recommended.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of the sending node. See datatypes for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/NH - Neighbouring Hub ==&lt;br /&gt;
&lt;br /&gt;
Lists a hub to which the sending node (a leaf) is connected. This provides a contact&lt;br /&gt;
point for routing communications to a possibly firewalled leaf node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional, and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The node / network address of a hub to which the sending node is connected.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
Identifies the software operating the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four character vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/BUP - Browse User Profile Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports browsing the local user profile.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/PCH - Peer Chat Tag ==&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node supports person to person private message chat.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/HG - Hit Group Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a group of search results.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional and may appear more than once.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A single byte, the group ID number.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type currently defined:&lt;br /&gt;
&lt;br /&gt;
* SS - Server State&lt;br /&gt;
&lt;br /&gt;
=== /QH2/HG/SS - Server State ===&lt;br /&gt;
&lt;br /&gt;
Provides a status snapshot of the upload server that applies to search results in the&lt;br /&gt;
current hit group.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Add this child to the hit group descriptor to provide server state information.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this information when interpreting hits linked with this hit group.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
* A 16-bit integer : the current queue length including any active transfers (number waiting plus number transferring)&lt;br /&gt;
* An 8-bit integer : the maximum number of concurrent transfers (capacity)&lt;br /&gt;
* A 32-bit integer : the speed in kilobits per second for uploads on this server module&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/H - Hit Descriptor ==&lt;br /&gt;
&lt;br /&gt;
Describes a single object which matched the original query.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a /QH2/H child for each matching object to be included in this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has many child packet types defined at the current time, and is often&lt;br /&gt;
extended:&lt;br /&gt;
&lt;br /&gt;
* URN - Universal Resource Name&lt;br /&gt;
* URL - Universal Resource Location&lt;br /&gt;
* DN - Descriptive Name&lt;br /&gt;
* MD - Metadata&lt;br /&gt;
* SZ - Object Size&lt;br /&gt;
* G - Group Identifier&lt;br /&gt;
* ID - Object Identifier&lt;br /&gt;
* CSC - Cached Source Count&lt;br /&gt;
* PART - Partial Availability Marker&lt;br /&gt;
* COM - User Comment&lt;br /&gt;
* PVU - Preview URL&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URN - Universal Resource Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies a universal resource name which can be used to identify the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
At least one instance of this child is required. Multiple instances are optional.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* '''bitprint''' or '''bp''' - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* '''sha1''' - 20 bytes of SHA1&lt;br /&gt;
* '''tree:tiger/''' or '''ttr''' - 24 bytes of tiger-tree root&lt;br /&gt;
* '''md5''' - 16 bytes of MD5&lt;br /&gt;
* '''ed2k''' - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/URL - Universal Resource Location ===&lt;br /&gt;
&lt;br /&gt;
This child specifies a location where the object being described can be acquired.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and a URL is available.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If a /QH2/H/URL child was requested but is not present, the sending node may not&lt;br /&gt;
have the object. It is valid to advertise information about objects that are not&lt;br /&gt;
available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or a string which represents an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to an instance of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has the object available&lt;br /&gt;
locally. It can be retrieved with an HTTP request using the &amp;quot;uri-res&amp;quot; resolver.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== QH2/H/DN - Descriptive Name (Generic) Criteria ===&lt;br /&gt;
&lt;br /&gt;
The descriptive name for the object, and the object's size.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer indicating the object's size, followed by a string describing it. If a&lt;br /&gt;
/QH2/H/SZ child is present, the 32-bit size prefix is omitted here (allowing a larger&lt;br /&gt;
64 bit file size).&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/MD - Metadata ===&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The xml header is optional. Standard plural/singular&lt;br /&gt;
Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/SZ - Object Size ===&lt;br /&gt;
&lt;br /&gt;
Specifies the size of the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child should be sent if DN was requested, and if the size is not to be packed into&lt;br /&gt;
the /QH2/H/DN child.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit or 64-bit integer representing the object size.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/G - Group Identifier ===&lt;br /&gt;
&lt;br /&gt;
Indicates which hit group (/QH2/HG) this hit belongs to. If this child is not present,&lt;br /&gt;
the hit belongs to group zero.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
Send this child if this hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
If this child is present, the hit belongs to a hit group other than group zero.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A single byte, the hit group ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/ID - Object Identifier ===&lt;br /&gt;
&lt;br /&gt;
Specifies a 32-bit integer which uniquely identifies the object on the sender's system.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is not normally sent for search results. It is used in browse-user responses&lt;br /&gt;
to allow objects to be referenced by virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Receiving ====&lt;br /&gt;
&lt;br /&gt;
Use this ID to link objects to virtual folder structures.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer ID.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/CSC - Cached Source Count ===&lt;br /&gt;
&lt;br /&gt;
Indicates the number of external cached sources known to the sending node.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if cached sources are available and interest in URLs was expressed&lt;br /&gt;
in the query.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 16-bit integer.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PART - Partial Content Tag ===&lt;br /&gt;
&lt;br /&gt;
Indicates that the sending node has only part of the object, and how much it has.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a /QH2/H/URL child is present and the URL contains only part of&lt;br /&gt;
the object.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A 32-bit integer, the number of bytes available.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has one child packet type defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* MT - Modification Time (payload = 32-bit timestamp)&lt;br /&gt;
&lt;br /&gt;
The ''MT'' child carries the last modification time (UNIX timestamp) of the partial file and can be used to determine whether there has been recent updates made (''hot'' file) or if the file is ''cold'' (not undergoing any downloading activity on the remote side).&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/COM - User Comment ===&lt;br /&gt;
&lt;br /&gt;
Provides a user review and/or rating for the object.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a user comment is available, and comments were requested.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
An XML string, of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;comment rating=&amp;quot;n&amp;quot;&amp;gt;&lt;br /&gt;
The comment goes here.&lt;br /&gt;
&amp;lt;/comment&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rating is an integer 0 &amp;lt;= n &amp;lt;= 5, indicating the number of &amp;quot;stars&amp;quot;. The text&lt;br /&gt;
may not include HTML, but may include forum-style block codes and emoticon&lt;br /&gt;
notation.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
=== /QH2/H/PVU - Preview URL ===&lt;br /&gt;
&lt;br /&gt;
Indicates that a preview URL is available for the object. A preview URL will serve a&lt;br /&gt;
miniature version of the content.&lt;br /&gt;
&lt;br /&gt;
==== Sending ====&lt;br /&gt;
&lt;br /&gt;
This child is sent if a preview is available.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
Empty, or an absolute URL.&lt;br /&gt;
&lt;br /&gt;
If a URL is provided, that URL should be considered to point to a preview of the&lt;br /&gt;
object being described.&lt;br /&gt;
&lt;br /&gt;
If the payload is empty, the sender is indicating that it has a preview of the object&lt;br /&gt;
available locally. It can be retrieved with an HTTP request to the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
/gnutella/preview/v1?urn:xyz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/MD - Unified Metadata Block ==&lt;br /&gt;
&lt;br /&gt;
Provides metadata describing one or more objects in the packet. This is an&lt;br /&gt;
alternative method of delivering metadata, which allows metadata for similar objects&lt;br /&gt;
to be grouped together. It is compatible with the unified metadata block format in&lt;br /&gt;
Gnutella1.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This chid should be sent if it was requested and is available.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing one or more XML documents, each beginning with a header.&lt;br /&gt;
Standard plural/singular Gnutella metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application index=&amp;quot;0&amp;quot; title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;images xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/image.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;1&amp;quot; description=&amp;quot;Shareaza Logo&amp;quot; width=&amp;quot;128&amp;quot; height=&amp;quot;128&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;image index=&amp;quot;2&amp;quot; description=&amp;quot;Shareaza Screen Shot&amp;quot; width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/images&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An additional attribute, &amp;quot;index&amp;quot; is added to each singular entry. The index is a zerobased&lt;br /&gt;
integer identifying the Nth /QH2/H child within this /QH2 packet.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /QH2/UPRO - User Profile ==&lt;br /&gt;
&lt;br /&gt;
Delivers a user profile or user profile summary, describing the user operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send a version of this child if the operating user wishes to list their screen name in&lt;br /&gt;
search results.&lt;br /&gt;
&lt;br /&gt;
The current version of this packet contains a summary only, consisting of the&lt;br /&gt;
screen/nick name. Future versions may include a more comprehensive XML text&lt;br /&gt;
block in the payload.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
No payload is defined at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
One child packet type is defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /QH2/UPRO/NICK - Nick/screen Name&lt;br /&gt;
&lt;br /&gt;
=== /QH2/UPRO/NICK - Nick/Screen Name ===&lt;br /&gt;
&lt;br /&gt;
Specifies the nick/screen name of the user.&lt;br /&gt;
&lt;br /&gt;
==== Payload ====&lt;br /&gt;
&lt;br /&gt;
A string.&lt;br /&gt;
&lt;br /&gt;
==== Children ====&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=Datatypes&amp;diff=85128</id>
		<title>Datatypes</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=Datatypes&amp;diff=85128"/>
		<updated>2014-01-18T16:19:37Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Multi-Byte Integers */ Added blurb about variable-length encoding&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Packet_Structure|&amp;lt;&amp;lt; Packet Structure]] | [[Basic_Network_Maintenance|Basic Network Maintenance &amp;gt;&amp;gt;]] | [[Main_Page|Main Page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The format of a packet payload is defined by the packet type and can consist of any&lt;br /&gt;
binary data; however, there are a number of conventions in place for serializing&lt;br /&gt;
common datatypes.&lt;br /&gt;
&lt;br /&gt;
== Multi-Byte Integers ==&lt;br /&gt;
&lt;br /&gt;
Multi-byte integers are serialized in the byte-order of the topmost packet. Little endian&lt;br /&gt;
is the default byte-order; however, big-endian byte order can be selected for&lt;br /&gt;
those who want it.&lt;br /&gt;
&lt;br /&gt;
Some values can also be serialized with spurious zeroes stripped-off, which is called '''variable-length''' encoding.  This is suitable for values that are usually small, because it avoids transmitting extra zero bytes over the network.&lt;br /&gt;
&lt;br /&gt;
A ''variable-length'' encoding of values less than 256 requires 1 single byte, values up to 65536 will require 2 bytes, and so on and so forth.  This is the type of encoding used for serializing the length of each G2 packet, for instance.&lt;br /&gt;
&lt;br /&gt;
== Network/Node Addresses ==&lt;br /&gt;
&lt;br /&gt;
A network or node address consists of a physical address and a port number, and are&lt;br /&gt;
of variable length, depending on the address family.&lt;br /&gt;
In IPv4, a network/node address is six bytes long: 4 bytes for an IP address and 2&lt;br /&gt;
bytes for a port number as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
BYTE ip[4];&lt;br /&gt;
SHORT port;&lt;br /&gt;
} IPV4_ENDPOINT;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is considered an array of 4 8-bit integers (bytes), followed by a 16-bit&lt;br /&gt;
integer (short). Byte order does not affect bytes, but it will affect the 16-bit port&lt;br /&gt;
number.&lt;br /&gt;
&lt;br /&gt;
IPv6 addresses are longer and are not yet defined within the scope of Gnutella2,&lt;br /&gt;
however, applications should be aware that if the node address is not 6 bytes, it is of&lt;br /&gt;
a different address family.&lt;br /&gt;
&lt;br /&gt;
== GUIDs ==&lt;br /&gt;
&lt;br /&gt;
Globally unique identifiers (GUIDs) are used to identify nodes on the network. GUIDs&lt;br /&gt;
are serialized as an array of 16 bytes.&lt;br /&gt;
&lt;br /&gt;
== Strings ==&lt;br /&gt;
&lt;br /&gt;
Strings are encoded with UTF-8 encoding and serialized as a zero-terminated&lt;br /&gt;
sequence of 8 bit integers.&lt;br /&gt;
&lt;br /&gt;
A zero character (0x00) marks the end of the string, however, if the string data meets&lt;br /&gt;
the end of the packet (or child packet) payload, the terminator is not required. This&lt;br /&gt;
means that packets whose payload consists of a string, do not need to include a zero&lt;br /&gt;
string terminator and their payload length will be the byte length of the encoded&lt;br /&gt;
string exactly.&lt;br /&gt;
&lt;br /&gt;
UTF-8 encoding is required for all strings present in the packet payload. This means&lt;br /&gt;
that 7-bit characters may be passed as-is, while extended characters are encoded&lt;br /&gt;
with multi-byte sequences.&lt;br /&gt;
&lt;br /&gt;
All applications must be able to parse UTF-8 encoded strings, however, it is up to the&lt;br /&gt;
individual application whether to store the string in Unicode, or convert it to the&lt;br /&gt;
local code page for processing. In situations where a packet must be processed ''and''&lt;br /&gt;
forwarded, the original packet must be forwarded rather than a regenerated version.&lt;br /&gt;
This ensures that both locally unsupported encodings and packet extensions are&lt;br /&gt;
preserved.&lt;br /&gt;
&lt;br /&gt;
Applications should never send ANSI strings directly if they contain extended&lt;br /&gt;
characters with the MSB set. These should be encoded with UTF-8. If this is not&lt;br /&gt;
done, the decoding process may fail and the packet will be discarded or contain&lt;br /&gt;
bogus information.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=LNI&amp;diff=85127</id>
		<title>LNI</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=LNI&amp;diff=85127"/>
		<updated>2014-01-18T13:00:13Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* /LNI - Local Node Information */ Added documentation for /LNI/UP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /LNI - Local Node Information =&lt;br /&gt;
&lt;br /&gt;
The local node information packet is used to convey essential information about the&lt;br /&gt;
node on either end of a TCP stream connection.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
The /LNI packet should be sent to a TCP neighbour upon connection, and at regular&lt;br /&gt;
intervals following that if the information within it has changed. A minimum update&lt;br /&gt;
time of one minute is recommended.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /LNI packet, the information within should be stored for subsequent&lt;br /&gt;
use.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
This packet has no payload at the current time.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
The /LNI packet has many child packet types defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /LNI/NA - Node Address&lt;br /&gt;
* /LNI/GU - GUID&lt;br /&gt;
* /LNI/V - Vendor Code&lt;br /&gt;
* /LNI/LS - Library Statistics&lt;br /&gt;
* /LNI/HS - Hub Status&lt;br /&gt;
* /LNI/FW - Firewalled&lt;br /&gt;
* /LNI/QK - Query Key Caching&lt;br /&gt;
* /LNI/HA - Hub Able&lt;br /&gt;
* /LNI/RTR - Router&lt;br /&gt;
* /LNI/UP - Uptime&lt;br /&gt;
&lt;br /&gt;
== /LNI/NA - Node Address ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/NA child packet specifies the node or network address of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The physical network address of the sending node. See [[datatypes]] for more&lt;br /&gt;
information.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/GU - GUID ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/GU child packet specifies the globally unique identifier of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The 16 byte globally unique node identifier of the sending node.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/V - Vendor Code ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/V child packet specifies the vendor code of the software operating the&lt;br /&gt;
sending node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A four byte vendor code.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/LS - Library Statistics ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/LS packet provides information about the content library of the sending&lt;br /&gt;
node.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is optional.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
Two 32-bit integers representing the number of files in the local library, and the total&lt;br /&gt;
KB in the local library respectively. If the sending node is a hub these statistics are&lt;br /&gt;
combined with the known statistics from all connected leaves. The payload may grow&lt;br /&gt;
beyond 8 bytes in the future.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/HS - Hub Status ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/HS packet is included only if the sending node is a hub, and contains the&lt;br /&gt;
status of the hub.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child packet should only be sent by hub nodes. Leaf nodes should not transmit&lt;br /&gt;
it, and if it is received from a leaf node, it should be ignored.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
Two 16-bit integers representing the current leaf count and the maximum leaf count&lt;br /&gt;
respectively. This packet may grow beyond 4 bytes in the future.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /LNI/UP - Uptime ==&lt;br /&gt;
&lt;br /&gt;
The /LNI/UP packet contains the node uptime, measured in seconds.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child packet can be sent by any node (hub or leaf)&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A variable-length quantity: an uptime of less than 256 seconds will be transmitted using one single byte, less than 65536 will require only 2 bytes, etc...&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=PI&amp;diff=85126</id>
		<title>PI</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=PI&amp;diff=85126"/>
		<updated>2014-01-15T22:41:31Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Receiving */ Clarified that leaves should never be forwarded /PI/UDP messages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /PI - Ping =&lt;br /&gt;
&lt;br /&gt;
The ping packet is used to verify the presence of the addressed node, testing that:&lt;br /&gt;
&lt;br /&gt;
* The destination node is online&lt;br /&gt;
* The destination node can receive the transmission&lt;br /&gt;
* The local node can receive the reply&lt;br /&gt;
&lt;br /&gt;
Aside from performing a &amp;quot;keep-alive&amp;quot; function on TCP links, pings can be used to&lt;br /&gt;
solicit inbound UDP datagrams to test the local node's ability to receive UDP. Many&lt;br /&gt;
NAT systems will route UDP traffic from nodes with whom a persistent TCP stream&lt;br /&gt;
has been established, so it is necessary to test inbound traffic from nodes with which&lt;br /&gt;
there is no TCP connection. This is achieved by sending a ping with a /PI/UDP packet&lt;br /&gt;
to a connected hub via TCP, which will forward the request to its neighbours who&lt;br /&gt;
then reply to the originator via UDP.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
On a TCP stream connection, if one end has not received a valid packet from the&lt;br /&gt;
other after an internally determined period of time, it has the option of sending a&lt;br /&gt;
keep-alive ping to verify the other end's presence. If a pong is not received in a&lt;br /&gt;
timeout period it may close the connection.&lt;br /&gt;
&lt;br /&gt;
If a node needs to verify that it is able to receive UDP datagrams from nodes with&lt;br /&gt;
which it does not have a TCP stream connection, it may send a ping packet with a&lt;br /&gt;
/PI/UDP child packet. If it then receives a /PO (pong) packet with a /PO/RELAY child&lt;br /&gt;
tag and there is no TCP connection to the sender, it can assume it is able to receive&lt;br /&gt;
UDP.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a keep-alive ping, a node should respond with a keep-alive pong&lt;br /&gt;
immediately.&lt;br /&gt;
&lt;br /&gt;
If the ping was received by a hub from a TCP neighbour and contains a /PI/UDP child packet,&lt;br /&gt;
but no /PI/RELAY tag, a /PI/RELAY tag should be added and the packet forwarded to&lt;br /&gt;
all neighbouring hubs. If a /PI/RELAY tag was present, the node should send a /PO&lt;br /&gt;
packet with a /PO/RELAY tag to the UDP address identified in the /PI/UDP child&lt;br /&gt;
packet.&lt;br /&gt;
&lt;br /&gt;
Note that leaf nodes should '''never''' be forwarded /PI packets with a /PI/UDP child: these need to be handled by hubs only.&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
This packet has no payload at the current time.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
The ping packet has two child packets defined at the current time:&lt;br /&gt;
&lt;br /&gt;
* /PI/RELAY&lt;br /&gt;
* /PI/UDP&lt;br /&gt;
&lt;br /&gt;
== /PI/RELAY - Relayed Ping Marker ==&lt;br /&gt;
&lt;br /&gt;
If a /PI packet contains a /PI/RELAY child marker, the ping has been relayed for a&lt;br /&gt;
third party. The receiving node should reply to the original party rather than the&lt;br /&gt;
sender. The original party should be contacted via UDP with the address contained in&lt;br /&gt;
the /PI/UDP child. If the /PI/UDP child is absent, the packet is invalid.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
The /PI/RELAY child should be added to a /PI packet when relaying a ping to hub&lt;br /&gt;
neighbours at the request of a leaf.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
Upon receiving a /PI packet with a /PI/RELAY tag, a /PO (pong) packet should be&lt;br /&gt;
sent via UDP to the node identified in the /PI/UDP child.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
This packet has no payload at the current time.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== /PI/UDP - Ping Response Address ==&lt;br /&gt;
&lt;br /&gt;
The /PI/UDP child packet specifies the return address for a relay able or relayed&lt;br /&gt;
ping.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Add a /PI/UDP child packet to a /PI packet to request a relayed &amp;quot;two hop&amp;quot; ping.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
The /PI/UDP child packet indicates that a /PI packet needs to be relayed.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
The /PI/UDP packet contains an endpoint address.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=Q2&amp;diff=85125</id>
		<title>Q2</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=Q2&amp;diff=85125"/>
		<updated>2014-01-15T22:32:39Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Payload */ Fixed typo: it stated &amp;quot;FS&amp;quot;, it's actually &amp;quot;PFS&amp;quot; that is used out there&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Packets}}&lt;br /&gt;
&lt;br /&gt;
= /Q2 - Gnutella2 Query =&lt;br /&gt;
&lt;br /&gt;
The /Q2 packet is the generic Gnutella2 object query descriptor. It contains search&lt;br /&gt;
criteria, identification, authentication, return addressing and the type of information&lt;br /&gt;
the search client is interested in.&lt;br /&gt;
&lt;br /&gt;
== Sending ==&lt;br /&gt;
&lt;br /&gt;
A node should send a /Q2 packet to another node when it wishes to execute a query&lt;br /&gt;
on that node (and its searchable relations).&lt;br /&gt;
/Q2 packets should always be filtered against a query hash table if one is available&lt;br /&gt;
for the outbound link.&lt;br /&gt;
&lt;br /&gt;
== Receiving ==&lt;br /&gt;
&lt;br /&gt;
Upon receiving a query, a node should:&lt;br /&gt;
&lt;br /&gt;
* Verify its authentication&lt;br /&gt;
* Send an acknowledgment if it was not received from a hub&lt;br /&gt;
* Forward it to connected nodes if necessary (detailed below)&lt;br /&gt;
* Process it locally and dispatch results&lt;br /&gt;
&lt;br /&gt;
== Forwarding ==&lt;br /&gt;
&lt;br /&gt;
Forwarding of /Q2 packets is achieved based on fixed rules:&lt;br /&gt;
&lt;br /&gt;
* A query received from a leaf or via UDP is forwarded to all connected nodes&lt;br /&gt;
* A query received from a hub is forwarded to connected leaves only&lt;br /&gt;
&lt;br /&gt;
== Payload ==&lt;br /&gt;
&lt;br /&gt;
The payload of a /Q2 packet consists of a GUID which uniquely identifies the search&lt;br /&gt;
operation.&lt;br /&gt;
&lt;br /&gt;
== Children ==&lt;br /&gt;
&lt;br /&gt;
This packet has many defined child packet types at the current time:&lt;br /&gt;
* /Q2/UDP - Return Address and Authentication&lt;br /&gt;
* /Q2/URN - Universal Resource Name&lt;br /&gt;
* /Q2/DN - Descriptive Name (Generic) Criteria&lt;br /&gt;
* /Q2/MD - Metadata Criteria&lt;br /&gt;
* /Q2/SZR - Object Size Restriction Criteria&lt;br /&gt;
* /Q2/I - Interest&lt;br /&gt;
&lt;br /&gt;
== /Q2/UDP - Return Address and Authentication ==&lt;br /&gt;
&lt;br /&gt;
The /Q2/UDP child packet specifies the return address to be used for all direct&lt;br /&gt;
replies, and the query key authentication which authorises transmissions to this&lt;br /&gt;
address. If the query key is invalid, the query should be discarded and a valid query&lt;br /&gt;
key issued to the nominated address (if desired).&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child is required if the query is to be delivered via UDP. It is optional if delivered&lt;br /&gt;
via TCP: if not included, replies will be reverse forwarded via TCP.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
If this child is present, all replies should be directed to the nominated address. The&lt;br /&gt;
query key should be verified before replying.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A network address (variable length) followed by a query key (fixed length of 32 bits).&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/URN - Universal Resource Name ==&lt;br /&gt;
&lt;br /&gt;
The /Q2/URN child specifies an exact universal resource name which will match the&lt;br /&gt;
query. Rules:&lt;br /&gt;
&lt;br /&gt;
* If one or more URNs are present in a query, whether or not they are understood, matching must occur on URN only and other criteria should be ignored.&lt;br /&gt;
* If multiple URNs are present, only one need match an object for it to be considered a match for the query.&lt;br /&gt;
* Following from the above, multiple URNs of the same family may be specified and match multiple objects (this allows a compound query for several known objects to be executed in one packet).&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
This child should be added if a specific URN is being sought.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string identifying the URN families followed by the URN in either text or binary&lt;br /&gt;
representation. Text representations should always be 8-bit so that they can be&lt;br /&gt;
considered binary.&lt;br /&gt;
&lt;br /&gt;
The following compact URN families are recognised:&lt;br /&gt;
&lt;br /&gt;
* bitprint or bp - 20 bytes of SHA1 followed by 24 bytes of tiger-tree root&lt;br /&gt;
* sha1 - 20 bytes of SHA1&lt;br /&gt;
* tree:tiger/ or ttr - 24 bytes of tiger-tree root&lt;br /&gt;
* md5 - 16 bytes of MD5&lt;br /&gt;
* ed2k - 16 bytes of compound MD4 (ed2k style root hash)&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/DN - Descriptive Name (Generic) Criteria ==&lt;br /&gt;
&lt;br /&gt;
The descriptive name child provides generic query text to be used in matching&lt;br /&gt;
objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string in the simple query language.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/MD - Metadata Criteria ==&lt;br /&gt;
&lt;br /&gt;
The metadata child provides an XML document containing rich query information.&lt;br /&gt;
The schema identified in the XML must match a metadata schema of prospective&lt;br /&gt;
matching objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A string containing XML. The header is optional. Standard plural/singular Gnutella&lt;br /&gt;
metadata schemas are used, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;applications xsi:noNamespaceSchemaLocation=&amp;quot;http://www.shareaza.com/schemas/application.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;application title=&amp;quot;Shareaza&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/applications&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All string values are in simple query language, including XML attribute and element&lt;br /&gt;
values.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/SZR - Size Restriction Criteria ==&lt;br /&gt;
&lt;br /&gt;
The size restriction criteria specify a minimum and maximum size for matching&lt;br /&gt;
objects.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
A minimum size followed by a maximum size, both quoted in bytes. These two&lt;br /&gt;
numbers may be expressed as two 32 bit integers or two 64 bit integers.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;br /&gt;
&lt;br /&gt;
== /Q2/I - Interest ==&lt;br /&gt;
&lt;br /&gt;
The Interest packet advertises an interest in certain information classes, effectively&lt;br /&gt;
filtering the information that will be returned about matching objects.&lt;br /&gt;
&lt;br /&gt;
=== Sending ===&lt;br /&gt;
&lt;br /&gt;
Send an interest packet to restrict the type of information that will be returned about&lt;br /&gt;
matching objects. For example if querying only to find instances of a known object,&lt;br /&gt;
advertise interest for &amp;quot;URL&amp;quot; only. Omitting the interest packet produces a default set&lt;br /&gt;
of response information.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
If an interest packet is received, only return the requested information types. If no&lt;br /&gt;
interest packet is present, return all available information that is feasible. Extensions&lt;br /&gt;
may be withheld.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
An array of strings identifying information classes. The following are defined:&lt;br /&gt;
&lt;br /&gt;
* URL - Locations where matching objects can be found&lt;br /&gt;
* DN - Descriptive names of matching objects&lt;br /&gt;
* MD - Full metadata of matching objects&lt;br /&gt;
* COM - User comments, ratings and reviews of matching objects&lt;br /&gt;
* PFS - Partially available objects&lt;br /&gt;
&lt;br /&gt;
Note that default URNs are always supplied and need not be requested.&lt;br /&gt;
&lt;br /&gt;
=== Children ===&lt;br /&gt;
&lt;br /&gt;
This packet has no known children at the current time.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=71424</id>
		<title>UDP Transceiver</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=71424"/>
		<updated>2012-09-29T15:58:22Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Negotiation */ Clarified processing contract for improved acknowledgments&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[TCP_Stream_Connection_and_Handshaking|&amp;lt;&amp;lt; TCP Stream Connection and Handshaking]] | [[Packet_Structure|Packet Structure &amp;gt;&amp;gt;]] | [[Main_Page|Main Page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The User Datagram Protocol (UDP) is invaluable in peer to peer systems because it&lt;br /&gt;
provides a relatively low-cost (low-overhead) method of sending short, irregular&lt;br /&gt;
messages to a very large number of peers on demand. Establishing a TCP stream&lt;br /&gt;
connection to a peer simply to deliver a single packet of information is wasteful in&lt;br /&gt;
data volume and time for the peers involved and state-aware network devices along&lt;br /&gt;
the route, for example, network address translation facilities. When dealing with a&lt;br /&gt;
large number of peers quickly, these costs become unbearable. UDP provides a&lt;br /&gt;
solution and makes this kind of interaction possible.&lt;br /&gt;
&lt;br /&gt;
However, the delivery of UDP packets is not reliable: packets may be lost en-route for&lt;br /&gt;
a number of reasons. Often this behaviour is desirable, for example when the&lt;br /&gt;
destination node's connection is highly congested, UDP packets are likely to be&lt;br /&gt;
discarded. If the content was not critical, this loss is appropriate as the host's&lt;br /&gt;
resources are effectively unavailable. In other scenarios involving critical payloads,&lt;br /&gt;
UDP's lack of reliability is a problem: either the sender needs to make sure the&lt;br /&gt;
receiver gets the payload, or it needs to know definitively that the receiver was&lt;br /&gt;
unavailable.&lt;br /&gt;
&lt;br /&gt;
The Gnutella2 network solves this problem by implementing a selectively engaged&lt;br /&gt;
reliability layer on top of the basic UDP protocol. This reliability layer shares some&lt;br /&gt;
common functionality with TCP, but importantly does not provide any connection&lt;br /&gt;
state and thus retains the efficiency originally sought in UDP.&lt;br /&gt;
&lt;br /&gt;
This allows Gnutella2 to select the most optimal communication medium for each&lt;br /&gt;
and every transmission it needs to perform:&lt;br /&gt;
&lt;br /&gt;
* If a significant volume of data is to be exchanged, or subsequent data will be exchanged with the same destination, a TCP connection is established&lt;br /&gt;
* If a small volume of important data is to be exchanged in a once-off operation or irregularly, reliable UDP is used&lt;br /&gt;
* If a small volume of unimportant data is to be exchanged in a once-off operation or irregularly, unreliable UDP is used&lt;br /&gt;
&lt;br /&gt;
== UDP ==&lt;br /&gt;
&lt;br /&gt;
Gnutella2 semi-reliable communication is transported using the UDP protocol. The&lt;br /&gt;
port number for receiving UDP is the same as the port number listening for TCP&lt;br /&gt;
connections.&lt;br /&gt;
&lt;br /&gt;
== Encoding ==&lt;br /&gt;
&lt;br /&gt;
Implementing an additional reliable protocol within UDP requires a small control&lt;br /&gt;
header before the payload itself. This header is put to good use:&lt;br /&gt;
&lt;br /&gt;
A small signature identifies the packet as a Gnutella2 semi-reliable UDP datagram.&lt;br /&gt;
This allows the same port to be used for receiving UDP traffic for other protocols if&lt;br /&gt;
desired, and offers some simple protection against random, unexpected traffic.&lt;br /&gt;
A content code identifies the payload as a Gnutella2 packet stream, allowing future&lt;br /&gt;
protocols to be added within the same reliability layer if desired. &lt;br /&gt;
Flags allow additional attributes to be specified, such as inline stateless compression&lt;br /&gt;
of the payload (which is a required feature).&lt;br /&gt;
The header has a fixed size of 8 bytes, and is represented by the following C&lt;br /&gt;
structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#pragma pack(1)&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
   CHAR szTag[3];&lt;br /&gt;
   BYTE nFlags;&lt;br /&gt;
   WORD nSequence;&lt;br /&gt;
   BYTE nPart;&lt;br /&gt;
   BYTE nCount;&lt;br /&gt;
} GND_HEADER;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Byte format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|                      szTag                    |    nFlags     | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|           nSequence           |    nPart      |    nCount     | 4-7&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The members of the structure are detailed below:&lt;br /&gt;
&lt;br /&gt;
* '''szTag''' - contains a three byte encoding protocol identifier, in this case &amp;quot;GND&amp;quot; for &amp;quot;GNutella Datagram&amp;quot;. If this signature is not present the packet should not be decoded as a Gnutella2 reliability layer transmission.&lt;br /&gt;
* '''nFlags''' - contains flags which modify the content of the packet. The low-order nibble is reserved for critical flags: if one of these bits is set but the decoding software does not understand the meaning, the packet must be discarded. The high-order nibble is reserved for non-critical flags: when set these bits may be interpreted, but an inability to interpret a bit does not cause the packet to be discarded. Currently defined flags are:&lt;br /&gt;
:* '''0x01''' - Deflate&lt;br /&gt;
::  When the deflate bit is set, the entire payload is compressed with the deflate algorithm. The compression method used is the Deflate Compression Data Format (RFC 1951). On top of this compression a ZLIB ‘wrapper’ is applied (RFC 1950, ZLIB Compressed Data Format). The ZLIB wrapper ensures packet integrity, among other things. Note that the entire payload must be reassembled in the correct order before it can be deflated if the packet was fragmented. Fragments are not compressed separately!&lt;br /&gt;
:* '''0x02''' - Acknowledge Me&lt;br /&gt;
:: When the acknowledge me bit is set, the sender is expecting an acknowledgement for this packet.&lt;br /&gt;
&lt;br /&gt;
* '''nSequence''' - contains the sequence number of the packet. This sequence number is unique to the sending host only. It is not unique to the pair of the sending host and receiving host as in TCP, as there is no concept of connection state. Sequence numbers on consecutive packets need not be increasing (although that is convenient) â€“ they must only be different. If a packet is fragmented, all of its fragments will have the same sequence number. Byte order is unimportant here.&lt;br /&gt;
* '''nPart''' - contains the fragment part number (1 &amp;lt;= nPart &amp;lt;= nCount)&lt;br /&gt;
* '''nCount''' - contains the number of fragment parts in this packet. On a transmission, this value will be non-zero (all packets must have at least one fragment). If nCount is zero, this is an acknowledgement (see below).&lt;br /&gt;
&lt;br /&gt;
== Fragmentation ==&lt;br /&gt;
&lt;br /&gt;
Large packets must be fragmented before they can be sent through most network&lt;br /&gt;
interfaces. Different network media have different MTUs, and it is difficult to predict&lt;br /&gt;
what the lowest common size will be. Fragmentation and reassembly is performed by&lt;br /&gt;
the existing Internet protocols, however, there are two important reasons why the&lt;br /&gt;
reliability layer performs its own fragmentation:&lt;br /&gt;
&lt;br /&gt;
* Sockets implementations specify a maximum datagram size. This is adequate for the vast majority of transmissions, but it is desirable to have the transparent ability to send larger packets without worrying about the host implementation.&lt;br /&gt;
* When the Internet protocols fragment, a packet and one or more fragments are lost, it may decide to discard the whole packet in an unreliable datagram protocol. The Gnutella2 reliability layer can compensate by retransmitting the whole packet, which would then be re-fragmented and each fragment resent - however, this wastes the fragments that were successfully received before. Managing fragmentation natively allows this optimisation.&lt;br /&gt;
&lt;br /&gt;
Each node determines its own MTU, often based on a best guess combined with&lt;br /&gt;
information from the host's sockets implementation. Packets exceeding this size are&lt;br /&gt;
fragmented into multiple datagrams of the appropriate size. Each datagram has the&lt;br /&gt;
same sequence number and the same fragment count (nCount), but a different&lt;br /&gt;
fragment number (nPart).&lt;br /&gt;
&lt;br /&gt;
== Transmission Process ==&lt;br /&gt;
&lt;br /&gt;
When a packet is to be transmitted, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* Cache the payload&lt;br /&gt;
* Allocate a new locally and temporally unique sequence number&lt;br /&gt;
* Derive the appropriate number of fragments&lt;br /&gt;
* Queue the fragments for dispatch&lt;br /&gt;
* If the fragments do not need to be acknowledged, the packet can be flushed now&lt;br /&gt;
&lt;br /&gt;
The payload will generally be cached for an appropriate timeout period, or until the&lt;br /&gt;
data cache becomes full, at which time older payloads can be discarded. Fragments&lt;br /&gt;
are dispatched according to the dispatch algorithm of choice, and the sender listens&lt;br /&gt;
for acknowledgements. When an acknowledgement is received:&lt;br /&gt;
&lt;br /&gt;
* Lookup the sent packet by sequence number&lt;br /&gt;
* Mark the nPart fragment as received and cancel any retransmissions of this part&lt;br /&gt;
* If all fragments have been acknowledged, flush this packet from the cache&lt;br /&gt;
&lt;br /&gt;
If a fragment has been transmitted but has not been acknowledged within the&lt;br /&gt;
timeout, it should be retransmitted. A finite number of retransmissions are allowed&lt;br /&gt;
before the packet as a whole expires, at which time it is assumed that the packet&lt;br /&gt;
was not received.&lt;br /&gt;
&lt;br /&gt;
== Receive Process ==&lt;br /&gt;
&lt;br /&gt;
When a new datagram is received, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* If the acknowledge bit was set, send an acknowledge packet for this sequence number and part number, with nCount set to zero (ack)&lt;br /&gt;
* Lookup any existing packet by the sending IP and sequence number &lt;br /&gt;
* If there is no existing packet, create a new packet entry with the IP, sequence number, fragment count and flags&lt;br /&gt;
* If there was an existing packet, make sure it is not marked as done - if so, abort&lt;br /&gt;
* Add the transmitted fragment to the (new or old) packet entry&lt;br /&gt;
* If the packet now has all fragments, mark it as done and decode it and pass it up to the application layer&lt;br /&gt;
* Leave the packet on the cache even if it was finished, in case any parts are retransmitted&lt;br /&gt;
* Expire old packets from the receive buffer after a timeout, or if the buffer is full&lt;br /&gt;
&lt;br /&gt;
== Dispatch Algorithm ==&lt;br /&gt;
&lt;br /&gt;
Fragment datagrams need to be dispatched intelligently, to spread the load on&lt;br /&gt;
network resources and maximise the chance that the receiver will get the message.&lt;br /&gt;
To do this, the dispatch algorithm should take into account several points:&lt;br /&gt;
&lt;br /&gt;
* Prioritize acknowledgements.&lt;br /&gt;
* If fragments are waiting to be sent to a number of hosts, do not send to the same host twice in a row. Alternating, or looping through the target hosts achieves the same data rate locally, but spreads out the load over downstream links.&lt;br /&gt;
* Do not exceed or approach the capacity of the local network connection. If a host has a 128 kb/s outbound bandwidth, dispatching 32 KB of data in one second will likely cause massive packet loss, leading to a retransmission.&lt;br /&gt;
* After considering the above points, prefer fragments that were queued recently to older packets. A LIFO or stack type approach means that even if a transmitter is becoming backed up, some fragments will get there on time, while others will be delayed. A FIFO approach would mean that a backed up host delivers every fragment late.&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
The recommended parameters for the reliability layer are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
MTU = 500 bytes&lt;br /&gt;
Transmit Retransmit Interval = 10 seconds&lt;br /&gt;
Transmit Packet Timeout / Expire = 26 seconds (allows for two retransmissions before expiry)&lt;br /&gt;
Receive Packet Expiry = 30 seconds (allows 10 seconds beyond final retransmission)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UDP/IP header being typically 28 bytes, it is best to limit the payload of the messages to '''476 bytes'''.  That way, with the 8-byte header we're topping plus the UDP/IP header, the whole message will not be greater than 512 bytes. The recommended MTU should therefore be 476 rather than the legacy 500. --RAM, 05:19, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
== Performance Considerations ==&lt;br /&gt;
&lt;br /&gt;
Relatively low-level network implementations such as this are reasonably&lt;br /&gt;
complicated, but must operate fast. It is desirable to avoid runtime memory&lt;br /&gt;
allocations in network code as much as possible, and particularly at this level.&lt;br /&gt;
&lt;br /&gt;
It should be noted that in almost all cases, transmissions to &amp;quot;untested&amp;quot; nodes are&lt;br /&gt;
single fragment. Replies on the other hand are often larger, and may be deflated in&lt;br /&gt;
many fragments. This is optimal, because attempting to contact a node which may be&lt;br /&gt;
unavailable, involves a retransmission of only a single fragment.&lt;br /&gt;
&lt;br /&gt;
Flow control is an important topic, however, it is handled at a higher layer. The UDP&lt;br /&gt;
reliability layer is only responsible for guaranteeing delivery of selected datagrams.&lt;br /&gt;
&lt;br /&gt;
Only critical transmissions whose reception cannot otherwise be inferred, should have&lt;br /&gt;
the acknowledge request bit set.&lt;br /&gt;
&lt;br /&gt;
== Extension Proposal ==&lt;br /&gt;
&lt;br /&gt;
The following is still a proposoal, but since there is no G2 Development Forum where this can be discussed, I thought I would document it here. 05:07, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
This extension ''should'' be '''totally backward compatible''' with existing implementations provided the above page specifications were strictly adhered to. Here it goes:&lt;br /&gt;
&lt;br /&gt;
=== Improved Acknowledgments ===&lt;br /&gt;
&lt;br /&gt;
Because acknowledgment messages can be lost in the way or arrive out of order, it is best to include as much of the reception state as possible so that the sending party can optimize retransmissions.&lt;br /&gt;
       &lt;br /&gt;
In order to do that, the following extensions to the original specifications has been added by gtk-gnutella:&lt;br /&gt;
       &lt;br /&gt;
* '''Cumulative Acknowledgements''': when the flag '''0x10''' is set, it tells the other party that '''all''' the fragments up to '''nPart''' have been received.&lt;br /&gt;
       &lt;br /&gt;
* '''Extended Acknowledgments''': when the flag '''0x20''' is set, it tells the other party that an acknowledgment payload is present.  It immediately follows the header and is architected thusly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;          &lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|   nReceived   |                  missingBits                  | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
'''nReceived''' is the total amount of parts successfully received so far.&lt;br /&gt;
          &lt;br /&gt;
'''missingBits''' is a bitfield that is read as a '''big-endian number''' and which contains set bits for the parts still missing.  The ''base'' part number is normally 0, unless flag '''0x10''' was set, in which case the '''nPart''' value indicates the base.  The rule is then that if bit ''b'' is set, then the fragment number ''b'' + ''base'' + 1 is still missing.&lt;br /&gt;
          &lt;br /&gt;
In the unlikely case where missingBits is too small to hold all the missing parts, only the ones that can be represented are included, the '''nReceived''' field being there to provide additional information.&lt;br /&gt;
          &lt;br /&gt;
Proper generation and parsing of the '''missingBits''' field is crucial, so to remove any ambiguity, it is best to interpret missingBits as a number. Then bit 0 is the bit corresponding to 2^0, bit ''n'' is the bit corresponding to 2^n. In the above framing pictogram, bit 0 is the 7th bit of the 3rd byte (because the number in '''missingBits''' is encoded in ''big-endian'').&lt;br /&gt;
          &lt;br /&gt;
Bit 0 corresponds to fragment #1, unless the '''0x10''' flag was set.  In that case, if for instance '''nPart''' is 3, then it means fragments #1, #2 and #3 were already received.  The base is therefore 3, and if bit 0 is set in '''missingBits''', it means fragment #4 (0 + 3 + 1) is still missing.&lt;br /&gt;
&lt;br /&gt;
This extended acknowledgment lets the sending party optimize its retransmissions even when some acknowledgments are lost.&lt;br /&gt;
&lt;br /&gt;
''Extended Acknowledgments'' are only useful when the total amount of fragments&lt;br /&gt;
is 3 or above.  Indeed, with only 2 fragments, the ''Cumulative Acknowledgment''&lt;br /&gt;
lets the receiving party know about the whole reception state.&lt;br /&gt;
&lt;br /&gt;
When the amount of fragments is 3 or more and only a ''Cumulative Acknowledgment'' is sent out, it '''implicitly denies reception''' of any other fragments.  This optimizes bandwidth since the 4 extra bytes sent out will only be required for large messages (more than 2 fragments) in case fragments are received out-of-order.&lt;br /&gt;
&lt;br /&gt;
=== Negotiation ===&lt;br /&gt;
&lt;br /&gt;
Before the recipient can use this extension, it must be certain that the sender will understand its semantics.  Indeed, imagine the case where a 3-fragment message is sent and completely received, and therefore the recipient only sends a ''Cumulative Acknowledge'' for fragment #3.  A legacy sender would think fragments #1 and #2 are still missing.&lt;br /&gt;
&lt;br /&gt;
To signify to the recipient that the sender will understand the new acknowledgments, it '''must set the flag 0x10''' in all the fragments it sends. This new flag is therefore defined as:&lt;br /&gt;
&lt;br /&gt;
* '''Improved Acknowledgements''': when the flag '''0x10''' is set in emitted fragments, it tells the other party that it can reply with the ''Cumulative Acknowledgments'' or the ''Extended Acknowledgment'' bits in its acknowledgment messages.&lt;br /&gt;
&lt;br /&gt;
When the ''Improved Acknowledgments'' flag is '''missing''', the receiver '''must fall back''' to the ''legacy'' acknowledgment protocol. Since '''0x10''' is in the high-nibble part of the flag field, no legacy implementation will choke upon seeing it, and they can safely ignore it.  This guarantees the sender that the message will be processed correctly by legacy implementations.&lt;br /&gt;
&lt;br /&gt;
When the ''Improved Acknowledgment'' bit is seen, the receiver is naturally free to ignore it altogether (as legacy servents will do) or chose to reply only with ''Cumulative Acknowledgements'' and never send ''Extended Acknowledgments'', for instance.&lt;br /&gt;
&lt;br /&gt;
However, when the sender sets the ''Improved Acknowledgment'' bit, it '''must''' be prepared to receive both ''Cumulative Acknowledgments'' '''and''' ''Extended Acknowledgments''. It is safe to ignore the extension part of the latter though, but the former must be fully handled.&lt;br /&gt;
&lt;br /&gt;
=== Delayed Acknowledgments ===&lt;br /&gt;
&lt;br /&gt;
To maximize the usefulness of ''Cumulative Acknowledgments'', the receiver can delay its acknowledgments for a small period of time (100 ms, say) in the hope that more fragments of the message will arrive meanwhile, provided the message has more than 1 fragment naturally.  When the 100 ms delay is expired, it can then acknowledge everything it got so far.  Performance will not be impacted by this small delaying, but it can save a few acknowledgments for larger messages.&lt;br /&gt;
&lt;br /&gt;
This means a sender must use a transmission policy whereby it first sends '''all the fragments''' of each message at once, then waits for acknowledgments or timeouts before retransmitting the um-acknowledged fragments.  In other words, the sender should not send a fragment, wait for its acknowledgement before sending the next one: this would delay the reception of the entire message and it would prevent using the optimizations that this extension proposal wants to promote!&lt;br /&gt;
&lt;br /&gt;
=== Author ===&lt;br /&gt;
&lt;br /&gt;
This proposal was created by Raphael Manfredi, last modified on 01:03, 26 September 2012 (PDT).&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=69094</id>
		<title>UDP Transceiver</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=69094"/>
		<updated>2012-09-28T10:28:46Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Negotiation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[TCP_Stream_Connection_and_Handshaking|&amp;lt;&amp;lt; TCP Stream Connection and Handshaking]] | [[Packet_Structure|Packet Structure &amp;gt;&amp;gt;]] | [[Main_Page|Main Page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The User Datagram Protocol (UDP) is invaluable in peer to peer systems because it&lt;br /&gt;
provides a relatively low-cost (low-overhead) method of sending short, irregular&lt;br /&gt;
messages to a very large number of peers on demand. Establishing a TCP stream&lt;br /&gt;
connection to a peer simply to deliver a single packet of information is wasteful in&lt;br /&gt;
data volume and time for the peers involved and state-aware network devices along&lt;br /&gt;
the route, for example, network address translation facilities. When dealing with a&lt;br /&gt;
large number of peers quickly, these costs become unbearable. UDP provides a&lt;br /&gt;
solution and makes this kind of interaction possible.&lt;br /&gt;
&lt;br /&gt;
However, the delivery of UDP packets is not reliable: packets may be lost en-route for&lt;br /&gt;
a number of reasons. Often this behaviour is desirable, for example when the&lt;br /&gt;
destination node's connection is highly congested, UDP packets are likely to be&lt;br /&gt;
discarded. If the content was not critical, this loss is appropriate as the host's&lt;br /&gt;
resources are effectively unavailable. In other scenarios involving critical payloads,&lt;br /&gt;
UDP's lack of reliability is a problem: either the sender needs to make sure the&lt;br /&gt;
receiver gets the payload, or it needs to know definitively that the receiver was&lt;br /&gt;
unavailable.&lt;br /&gt;
&lt;br /&gt;
The Gnutella2 network solves this problem by implementing a selectively engaged&lt;br /&gt;
reliability layer on top of the basic UDP protocol. This reliability layer shares some&lt;br /&gt;
common functionality with TCP, but importantly does not provide any connection&lt;br /&gt;
state and thus retains the efficiency originally sought in UDP.&lt;br /&gt;
&lt;br /&gt;
This allows Gnutella2 to select the most optimal communication medium for each&lt;br /&gt;
and every transmission it needs to perform:&lt;br /&gt;
&lt;br /&gt;
* If a significant volume of data is to be exchanged, or subsequent data will be exchanged with the same destination, a TCP connection is established&lt;br /&gt;
* If a small volume of important data is to be exchanged in a once-off operation or irregularly, reliable UDP is used&lt;br /&gt;
* If a small volume of unimportant data is to be exchanged in a once-off operation or irregularly, unreliable UDP is used&lt;br /&gt;
&lt;br /&gt;
== UDP ==&lt;br /&gt;
&lt;br /&gt;
Gnutella2 semi-reliable communication is transported using the UDP protocol. The&lt;br /&gt;
port number for receiving UDP is the same as the port number listening for TCP&lt;br /&gt;
connections.&lt;br /&gt;
&lt;br /&gt;
== Encoding ==&lt;br /&gt;
&lt;br /&gt;
Implementing an additional reliable protocol within UDP requires a small control&lt;br /&gt;
header before the payload itself. This header is put to good use:&lt;br /&gt;
&lt;br /&gt;
A small signature identifies the packet as a Gnutella2 semi-reliable UDP datagram.&lt;br /&gt;
This allows the same port to be used for receiving UDP traffic for other protocols if&lt;br /&gt;
desired, and offers some simple protection against random, unexpected traffic.&lt;br /&gt;
A content code identifies the payload as a Gnutella2 packet stream, allowing future&lt;br /&gt;
protocols to be added within the same reliability layer if desired. &lt;br /&gt;
Flags allow additional attributes to be specified, such as inline stateless compression&lt;br /&gt;
of the payload (which is a required feature).&lt;br /&gt;
The header has a fixed size of 8 bytes, and is represented by the following C&lt;br /&gt;
structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#pragma pack(1)&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
   CHAR szTag[3];&lt;br /&gt;
   BYTE nFlags;&lt;br /&gt;
   WORD nSequence;&lt;br /&gt;
   BYTE nPart;&lt;br /&gt;
   BYTE nCount;&lt;br /&gt;
} GND_HEADER;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Byte format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|                      szTag                    |    nFlags     | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|           nSequence           |    nPart      |    nCount     | 4-7&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The members of the structure are detailed below:&lt;br /&gt;
&lt;br /&gt;
* '''szTag''' - contains a three byte encoding protocol identifier, in this case &amp;quot;GND&amp;quot; for &amp;quot;GNutella Datagram&amp;quot;. If this signature is not present the packet should not be decoded as a Gnutella2 reliability layer transmission.&lt;br /&gt;
* '''nFlags''' - contains flags which modify the content of the packet. The low-order nibble is reserved for critical flags: if one of these bits is set but the decoding software does not understand the meaning, the packet must be discarded. The high-order nibble is reserved for non-critical flags: when set these bits may be interpreted, but an inability to interpret a bit does not cause the packet to be discarded. Currently defined flags are:&lt;br /&gt;
:* '''0x01''' - Deflate&lt;br /&gt;
::  When the deflate bit is set, the entire payload is compressed with the deflate algorithm. The compression method used is the Deflate Compression Data Format (RFC 1951). On top of this compression a ZLIB ‘wrapper’ is applied (RFC 1950, ZLIB Compressed Data Format). The ZLIB wrapper ensures packet integrity, among other things. Note that the entire payload must be reassembled in the correct order before it can be deflated if the packet was fragmented. Fragments are not compressed separately!&lt;br /&gt;
:* '''0x02''' - Acknowledge Me&lt;br /&gt;
:: When the acknowledge me bit is set, the sender is expecting an acknowledgement for this packet.&lt;br /&gt;
&lt;br /&gt;
* '''nSequence''' - contains the sequence number of the packet. This sequence number is unique to the sending host only. It is not unique to the pair of the sending host and receiving host as in TCP, as there is no concept of connection state. Sequence numbers on consecutive packets need not be increasing (although that is convenient) â€“ they must only be different. If a packet is fragmented, all of its fragments will have the same sequence number. Byte order is unimportant here.&lt;br /&gt;
* '''nPart''' - contains the fragment part number (1 &amp;lt;= nPart &amp;lt;= nCount)&lt;br /&gt;
* '''nCount''' - contains the number of fragment parts in this packet. On a transmission, this value will be non-zero (all packets must have at least one fragment). If nCount is zero, this is an acknowledgement (see below).&lt;br /&gt;
&lt;br /&gt;
== Fragmentation ==&lt;br /&gt;
&lt;br /&gt;
Large packets must be fragmented before they can be sent through most network&lt;br /&gt;
interfaces. Different network media have different MTUs, and it is difficult to predict&lt;br /&gt;
what the lowest common size will be. Fragmentation and reassembly is performed by&lt;br /&gt;
the existing Internet protocols, however, there are two important reasons why the&lt;br /&gt;
reliability layer performs its own fragmentation:&lt;br /&gt;
&lt;br /&gt;
* Sockets implementations specify a maximum datagram size. This is adequate for the vast majority of transmissions, but it is desirable to have the transparent ability to send larger packets without worrying about the host implementation.&lt;br /&gt;
* When the Internet protocols fragment, a packet and one or more fragments are lost, it may decide to discard the whole packet in an unreliable datagram protocol. The Gnutella2 reliability layer can compensate by retransmitting the whole packet, which would then be re-fragmented and each fragment resent - however, this wastes the fragments that were successfully received before. Managing fragmentation natively allows this optimisation.&lt;br /&gt;
&lt;br /&gt;
Each node determines its own MTU, often based on a best guess combined with&lt;br /&gt;
information from the host's sockets implementation. Packets exceeding this size are&lt;br /&gt;
fragmented into multiple datagrams of the appropriate size. Each datagram has the&lt;br /&gt;
same sequence number and the same fragment count (nCount), but a different&lt;br /&gt;
fragment number (nPart).&lt;br /&gt;
&lt;br /&gt;
== Transmission Process ==&lt;br /&gt;
&lt;br /&gt;
When a packet is to be transmitted, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* Cache the payload&lt;br /&gt;
* Allocate a new locally and temporally unique sequence number&lt;br /&gt;
* Derive the appropriate number of fragments&lt;br /&gt;
* Queue the fragments for dispatch&lt;br /&gt;
* If the fragments do not need to be acknowledged, the packet can be flushed now&lt;br /&gt;
&lt;br /&gt;
The payload will generally be cached for an appropriate timeout period, or until the&lt;br /&gt;
data cache becomes full, at which time older payloads can be discarded. Fragments&lt;br /&gt;
are dispatched according to the dispatch algorithm of choice, and the sender listens&lt;br /&gt;
for acknowledgements. When an acknowledgement is received:&lt;br /&gt;
&lt;br /&gt;
* Lookup the sent packet by sequence number&lt;br /&gt;
* Mark the nPart fragment as received and cancel any retransmissions of this part&lt;br /&gt;
* If all fragments have been acknowledged, flush this packet from the cache&lt;br /&gt;
&lt;br /&gt;
If a fragment has been transmitted but has not been acknowledged within the&lt;br /&gt;
timeout, it should be retransmitted. A finite number of retransmissions are allowed&lt;br /&gt;
before the packet as a whole expires, at which time it is assumed that the packet&lt;br /&gt;
was not received.&lt;br /&gt;
&lt;br /&gt;
== Receive Process ==&lt;br /&gt;
&lt;br /&gt;
When a new datagram is received, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* If the acknowledge bit was set, send an acknowledge packet for this sequence number and part number, with nCount set to zero (ack)&lt;br /&gt;
* Lookup any existing packet by the sending IP and sequence number &lt;br /&gt;
* If there is no existing packet, create a new packet entry with the IP, sequence number, fragment count and flags&lt;br /&gt;
* If there was an existing packet, make sure it is not marked as done - if so, abort&lt;br /&gt;
* Add the transmitted fragment to the (new or old) packet entry&lt;br /&gt;
* If the packet now has all fragments, mark it as done and decode it and pass it up to the application layer&lt;br /&gt;
* Leave the packet on the cache even if it was finished, in case any parts are retransmitted&lt;br /&gt;
* Expire old packets from the receive buffer after a timeout, or if the buffer is full&lt;br /&gt;
&lt;br /&gt;
== Dispatch Algorithm ==&lt;br /&gt;
&lt;br /&gt;
Fragment datagrams need to be dispatched intelligently, to spread the load on&lt;br /&gt;
network resources and maximise the chance that the receiver will get the message.&lt;br /&gt;
To do this, the dispatch algorithm should take into account several points:&lt;br /&gt;
&lt;br /&gt;
* Prioritize acknowledgements.&lt;br /&gt;
* If fragments are waiting to be sent to a number of hosts, do not send to the same host twice in a row. Alternating, or looping through the target hosts achieves the same data rate locally, but spreads out the load over downstream links.&lt;br /&gt;
* Do not exceed or approach the capacity of the local network connection. If a host has a 128 kb/s outbound bandwidth, dispatching 32 KB of data in one second will likely cause massive packet loss, leading to a retransmission.&lt;br /&gt;
* After considering the above points, prefer fragments that were queued recently to older packets. A LIFO or stack type approach means that even if a transmitter is becoming backed up, some fragments will get there on time, while others will be delayed. A FIFO approach would mean that a backed up host delivers every fragment late.&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
The recommended parameters for the reliability layer are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
MTU = 500 bytes&lt;br /&gt;
Transmit Retransmit Interval = 10 seconds&lt;br /&gt;
Transmit Packet Timeout / Expire = 26 seconds (allows for two retransmissions before expiry)&lt;br /&gt;
Receive Packet Expiry = 30 seconds (allows 10 seconds beyond final retransmission)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UDP/IP header being typically 28 bytes, it is best to limit the payload of the messages to '''476 bytes'''.  That way, with the 8-byte header we're topping plus the UDP/IP header, the whole message will not be greater than 512 bytes. The recommended MTU should therefore be 476 rather than the legacy 500. --RAM, 05:19, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
== Performance Considerations ==&lt;br /&gt;
&lt;br /&gt;
Relatively low-level network implementations such as this are reasonably&lt;br /&gt;
complicated, but must operate fast. It is desirable to avoid runtime memory&lt;br /&gt;
allocations in network code as much as possible, and particularly at this level.&lt;br /&gt;
&lt;br /&gt;
It should be noted that in almost all cases, transmissions to &amp;quot;untested&amp;quot; nodes are&lt;br /&gt;
single fragment. Replies on the other hand are often larger, and may be deflated in&lt;br /&gt;
many fragments. This is optimal, because attempting to contact a node which may be&lt;br /&gt;
unavailable, involves a retransmission of only a single fragment.&lt;br /&gt;
&lt;br /&gt;
Flow control is an important topic, however, it is handled at a higher layer. The UDP&lt;br /&gt;
reliability layer is only responsible for guaranteeing delivery of selected datagrams.&lt;br /&gt;
&lt;br /&gt;
Only critical transmissions whose reception cannot otherwise be inferred, should have&lt;br /&gt;
the acknowledge request bit set.&lt;br /&gt;
&lt;br /&gt;
== Extension Proposal ==&lt;br /&gt;
&lt;br /&gt;
The following is still a proposoal, but since there is no G2 Development Forum where this can be discussed, I thought I would document it here. 05:07, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
This extension ''should'' be '''totally backward compatible''' with existing implementations provided the above page specifications were strictly adhered to. Here it goes:&lt;br /&gt;
&lt;br /&gt;
=== Improved Acknowledgments ===&lt;br /&gt;
&lt;br /&gt;
Because acknowledgment messages can be lost in the way or arrive out of order, it is best to include as much of the reception state as possible so that the sending party can optimize retransmissions.&lt;br /&gt;
       &lt;br /&gt;
In order to do that, the following extensions to the original specifications has been added by gtk-gnutella:&lt;br /&gt;
       &lt;br /&gt;
* '''Cumulative Acknowledgements''': when the flag '''0x10''' is set, it tells the other party that '''all''' the fragments up to '''nPart''' have been received.&lt;br /&gt;
       &lt;br /&gt;
* '''Extended Acknowledgments''': when the flag '''0x20''' is set, it tells the other party that an acknowledgment payload is present.  It immediately follows the header and is architected thusly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;          &lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|   nReceived   |                  missingBits                  | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
'''nReceived''' is the total amount of parts successfully received so far.&lt;br /&gt;
          &lt;br /&gt;
'''missingBits''' is a bitfield that is read as a '''big-endian number''' and which contains set bits for the parts still missing.  The ''base'' part number is normally 0, unless flag '''0x10''' was set, in which case the '''nPart''' value indicates the base.  The rule is then that if bit ''b'' is set, then the fragment number ''b'' + ''base'' + 1 is still missing.&lt;br /&gt;
          &lt;br /&gt;
In the unlikely case where missingBits is too small to hold all the missing parts, only the ones that can be represented are included, the '''nReceived''' field being there to provide additional information.&lt;br /&gt;
          &lt;br /&gt;
Proper generation and parsing of the '''missingBits''' field is crucial, so to remove any ambiguity, it is best to interpret missingBits as a number. Then bit 0 is the bit corresponding to 2^0, bit ''n'' is the bit corresponding to 2^n. In the above framing pictogram, bit 0 is the 7th bit of the 3rd byte (because the number in '''missingBits''' is encoded in ''big-endian'').&lt;br /&gt;
          &lt;br /&gt;
Bit 0 corresponds to fragment #1, unless the '''0x10''' flag was set.  In that case, if for instance '''nPart''' is 3, then it means fragments #1, #2 and #3 were already received.  The base is therefore 3, and if bit 0 is set in '''missingBits''', it means fragment #4 (0 + 3 + 1) is still missing.&lt;br /&gt;
&lt;br /&gt;
This extended acknowledgment lets the sending party optimize its retransmissions even when some acknowledgments are lost.&lt;br /&gt;
&lt;br /&gt;
''Extended Acknowledgments'' are only useful when the total amount of fragments&lt;br /&gt;
is 3 or above.  Indeed, with only 2 fragments, the ''Cumulative Acknowledgment''&lt;br /&gt;
lets the receiving party know about the whole reception state.&lt;br /&gt;
&lt;br /&gt;
When the amount of fragments is 3 or more and only a ''Cumulative Acknowledgment'' is sent out, it '''implicitly denies reception''' of any other fragments.  This optimizes bandwidth since the 4 extra bytes sent out will only be required for large messages (more than 2 fragments) in case fragments are received out-of-order.&lt;br /&gt;
&lt;br /&gt;
=== Negotiation ===&lt;br /&gt;
&lt;br /&gt;
Before the recipient can use this extension, it must be certain that the sender will understand its semantics.  Indeed, imagine the case where a 3-fragment message is sent and completely received, and therefore the recipient only sends a ''Cumulative Acknowledge'' for fragment #3.  A legacy sender would think fragments #1 and #2 are still missing.&lt;br /&gt;
&lt;br /&gt;
To signify to the recipient that the sender will understand the new acknowledgments, it '''must set the flag 0x10''' in all the fragments it sends. This new flag is therefore defined as:&lt;br /&gt;
&lt;br /&gt;
* '''Improved Acknowledgements''': when the flag '''0x10''' is set in emitted fragments, it tells the other party that it can reply with the ''Cumulative Acknowledgments'' or the ''Extended Acknowledgment'' bits in its acknowledgment messages.&lt;br /&gt;
&lt;br /&gt;
When the ''Improved Acknowledgments'' flag is '''missing''', the receiver '''must fall back''' to the ''legacy'' acknowledgment protocol. Since '''0x10''' is in the high-nibble part of the flag field, no legacy implementation will choke upon seeing it, and they can safely ignore it.  This guarantees the sender that the message will be processed correctly by legacy implementations.&lt;br /&gt;
&lt;br /&gt;
=== Delayed Acknowledgments ===&lt;br /&gt;
&lt;br /&gt;
To maximize the usefulness of ''Cumulative Acknowledgments'', the receiver can delay its acknowledgments for a small period of time (100 ms, say) in the hope that more fragments of the message will arrive meanwhile, provided the message has more than 1 fragment naturally.  When the 100 ms delay is expired, it can then acknowledge everything it got so far.  Performance will not be impacted by this small delaying, but it can save a few acknowledgments for larger messages.&lt;br /&gt;
&lt;br /&gt;
This means a sender must use a transmission policy whereby it first sends '''all the fragments''' of each message at once, then waits for acknowledgments or timeouts before retransmitting the um-acknowledged fragments.  In other words, the sender should not send a fragment, wait for its acknowledgement before sending the next one: this would delay the reception of the entire message and it would prevent using the optimizations that this extension proposal wants to promote!&lt;br /&gt;
&lt;br /&gt;
=== Author ===&lt;br /&gt;
&lt;br /&gt;
This proposal was created by Raphael Manfredi, last modified on 01:03, 26 September 2012 (PDT).&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=66980</id>
		<title>UDP Transceiver</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=66980"/>
		<updated>2012-09-27T07:11:05Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Delayed Acknowledgments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[TCP_Stream_Connection_and_Handshaking|&amp;lt;&amp;lt; TCP Stream Connection and Handshaking]] | [[Packet_Structure|Packet Structure &amp;gt;&amp;gt;]] | [[Main_Page|Main Page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The User Datagram Protocol (UDP) is invaluable in peer to peer systems because it&lt;br /&gt;
provides a relatively low-cost (low-overhead) method of sending short, irregular&lt;br /&gt;
messages to a very large number of peers on demand. Establishing a TCP stream&lt;br /&gt;
connection to a peer simply to deliver a single packet of information is wasteful in&lt;br /&gt;
data volume and time for the peers involved and state-aware network devices along&lt;br /&gt;
the route, for example, network address translation facilities. When dealing with a&lt;br /&gt;
large number of peers quickly, these costs become unbearable. UDP provides a&lt;br /&gt;
solution and makes this kind of interaction possible.&lt;br /&gt;
&lt;br /&gt;
However, the delivery of UDP packets is not reliable: packets may be lost en-route for&lt;br /&gt;
a number of reasons. Often this behaviour is desirable, for example when the&lt;br /&gt;
destination node's connection is highly congested, UDP packets are likely to be&lt;br /&gt;
discarded. If the content was not critical, this loss is appropriate as the host's&lt;br /&gt;
resources are effectively unavailable. In other scenarios involving critical payloads,&lt;br /&gt;
UDP's lack of reliability is a problem: either the sender needs to make sure the&lt;br /&gt;
receiver gets the payload, or it needs to know definitively that the receiver was&lt;br /&gt;
unavailable.&lt;br /&gt;
&lt;br /&gt;
The Gnutella2 network solves this problem by implementing a selectively engaged&lt;br /&gt;
reliability layer on top of the basic UDP protocol. This reliability layer shares some&lt;br /&gt;
common functionality with TCP, but importantly does not provide any connection&lt;br /&gt;
state and thus retains the efficiency originally sought in UDP.&lt;br /&gt;
&lt;br /&gt;
This allows Gnutella2 to select the most optimal communication medium for each&lt;br /&gt;
and every transmission it needs to perform:&lt;br /&gt;
&lt;br /&gt;
* If a significant volume of data is to be exchanged, or subsequent data will be exchanged with the same destination, a TCP connection is established&lt;br /&gt;
* If a small volume of important data is to be exchanged in a once-off operation or irregularly, reliable UDP is used&lt;br /&gt;
* If a small volume of unimportant data is to be exchanged in a once-off operation or irregularly, unreliable UDP is used&lt;br /&gt;
&lt;br /&gt;
== UDP ==&lt;br /&gt;
&lt;br /&gt;
Gnutella2 semi-reliable communication is transported using the UDP protocol. The&lt;br /&gt;
port number for receiving UDP is the same as the port number listening for TCP&lt;br /&gt;
connections.&lt;br /&gt;
&lt;br /&gt;
== Encoding ==&lt;br /&gt;
&lt;br /&gt;
Implementing an additional reliable protocol within UDP requires a small control&lt;br /&gt;
header before the payload itself. This header is put to good use:&lt;br /&gt;
&lt;br /&gt;
A small signature identifies the packet as a Gnutella2 semi-reliable UDP datagram.&lt;br /&gt;
This allows the same port to be used for receiving UDP traffic for other protocols if&lt;br /&gt;
desired, and offers some simple protection against random, unexpected traffic.&lt;br /&gt;
A content code identifies the payload as a Gnutella2 packet stream, allowing future&lt;br /&gt;
protocols to be added within the same reliability layer if desired. &lt;br /&gt;
Flags allow additional attributes to be specified, such as inline stateless compression&lt;br /&gt;
of the payload (which is a required feature).&lt;br /&gt;
The header has a fixed size of 8 bytes, and is represented by the following C&lt;br /&gt;
structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#pragma pack(1)&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
   CHAR szTag[3];&lt;br /&gt;
   BYTE nFlags;&lt;br /&gt;
   WORD nSequence;&lt;br /&gt;
   BYTE nPart;&lt;br /&gt;
   BYTE nCount;&lt;br /&gt;
} GND_HEADER;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Byte format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|                      szTag                    |    nFlags     | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|           nSequence           |    nPart      |    nCount     | 4-7&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The members of the structure are detailed below:&lt;br /&gt;
&lt;br /&gt;
* '''szTag''' - contains a three byte encoding protocol identifier, in this case &amp;quot;GND&amp;quot; for &amp;quot;GNutella Datagram&amp;quot;. If this signature is not present the packet should not be decoded as a Gnutella2 reliability layer transmission.&lt;br /&gt;
* '''nFlags''' - contains flags which modify the content of the packet. The low-order nibble is reserved for critical flags: if one of these bits is set but the decoding software does not understand the meaning, the packet must be discarded. The high-order nibble is reserved for non-critical flags: when set these bits may be interpreted, but an inability to interpret a bit does not cause the packet to be discarded. Currently defined flags are:&lt;br /&gt;
:* '''0x01''' - Deflate&lt;br /&gt;
::  When the deflate bit is set, the entire payload is compressed with the deflate algorithm. The compression method used is the Deflate Compression Data Format (RFC 1951). On top of this compression a ZLIB ‘wrapper’ is applied (RFC 1950, ZLIB Compressed Data Format). The ZLIB wrapper ensures packet integrity, among other things. Note that the entire payload must be reassembled in the correct order before it can be deflated if the packet was fragmented. Fragments are not compressed separately!&lt;br /&gt;
:* '''0x02''' - Acknowledge Me&lt;br /&gt;
:: When the acknowledge me bit is set, the sender is expecting an acknowledgement for this packet.&lt;br /&gt;
&lt;br /&gt;
* '''nSequence''' - contains the sequence number of the packet. This sequence number is unique to the sending host only. It is not unique to the pair of the sending host and receiving host as in TCP, as there is no concept of connection state. Sequence numbers on consecutive packets need not be increasing (although that is convenient) â€“ they must only be different. If a packet is fragmented, all of its fragments will have the same sequence number. Byte order is unimportant here.&lt;br /&gt;
* '''nPart''' - contains the fragment part number (1 &amp;lt;= nPart &amp;lt;= nCount)&lt;br /&gt;
* '''nCount''' - contains the number of fragment parts in this packet. On a transmission, this value will be non-zero (all packets must have at least one fragment). If nCount is zero, this is an acknowledgement (see below).&lt;br /&gt;
&lt;br /&gt;
== Fragmentation ==&lt;br /&gt;
&lt;br /&gt;
Large packets must be fragmented before they can be sent through most network&lt;br /&gt;
interfaces. Different network media have different MTUs, and it is difficult to predict&lt;br /&gt;
what the lowest common size will be. Fragmentation and reassembly is performed by&lt;br /&gt;
the existing Internet protocols, however, there are two important reasons why the&lt;br /&gt;
reliability layer performs its own fragmentation:&lt;br /&gt;
&lt;br /&gt;
* Sockets implementations specify a maximum datagram size. This is adequate for the vast majority of transmissions, but it is desirable to have the transparent ability to send larger packets without worrying about the host implementation.&lt;br /&gt;
* When the Internet protocols fragment, a packet and one or more fragments are lost, it may decide to discard the whole packet in an unreliable datagram protocol. The Gnutella2 reliability layer can compensate by retransmitting the whole packet, which would then be re-fragmented and each fragment resent - however, this wastes the fragments that were successfully received before. Managing fragmentation natively allows this optimisation.&lt;br /&gt;
&lt;br /&gt;
Each node determines its own MTU, often based on a best guess combined with&lt;br /&gt;
information from the host's sockets implementation. Packets exceeding this size are&lt;br /&gt;
fragmented into multiple datagrams of the appropriate size. Each datagram has the&lt;br /&gt;
same sequence number and the same fragment count (nCount), but a different&lt;br /&gt;
fragment number (nPart).&lt;br /&gt;
&lt;br /&gt;
== Transmission Process ==&lt;br /&gt;
&lt;br /&gt;
When a packet is to be transmitted, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* Cache the payload&lt;br /&gt;
* Allocate a new locally and temporally unique sequence number&lt;br /&gt;
* Derive the appropriate number of fragments&lt;br /&gt;
* Queue the fragments for dispatch&lt;br /&gt;
* If the fragments do not need to be acknowledged, the packet can be flushed now&lt;br /&gt;
&lt;br /&gt;
The payload will generally be cached for an appropriate timeout period, or until the&lt;br /&gt;
data cache becomes full, at which time older payloads can be discarded. Fragments&lt;br /&gt;
are dispatched according to the dispatch algorithm of choice, and the sender listens&lt;br /&gt;
for acknowledgements. When an acknowledgement is received:&lt;br /&gt;
&lt;br /&gt;
* Lookup the sent packet by sequence number&lt;br /&gt;
* Mark the nPart fragment as received and cancel any retransmissions of this part&lt;br /&gt;
* If all fragments have been acknowledged, flush this packet from the cache&lt;br /&gt;
&lt;br /&gt;
If a fragment has been transmitted but has not been acknowledged within the&lt;br /&gt;
timeout, it should be retransmitted. A finite number of retransmissions are allowed&lt;br /&gt;
before the packet as a whole expires, at which time it is assumed that the packet&lt;br /&gt;
was not received.&lt;br /&gt;
&lt;br /&gt;
== Receive Process ==&lt;br /&gt;
&lt;br /&gt;
When a new datagram is received, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* If the acknowledge bit was set, send an acknowledge packet for this sequence number and part number, with nCount set to zero (ack)&lt;br /&gt;
* Lookup any existing packet by the sending IP and sequence number &lt;br /&gt;
* If there is no existing packet, create a new packet entry with the IP, sequence number, fragment count and flags&lt;br /&gt;
* If there was an existing packet, make sure it is not marked as done - if so, abort&lt;br /&gt;
* Add the transmitted fragment to the (new or old) packet entry&lt;br /&gt;
* If the packet now has all fragments, mark it as done and decode it and pass it up to the application layer&lt;br /&gt;
* Leave the packet on the cache even if it was finished, in case any parts are retransmitted&lt;br /&gt;
* Expire old packets from the receive buffer after a timeout, or if the buffer is full&lt;br /&gt;
&lt;br /&gt;
== Dispatch Algorithm ==&lt;br /&gt;
&lt;br /&gt;
Fragment datagrams need to be dispatched intelligently, to spread the load on&lt;br /&gt;
network resources and maximise the chance that the receiver will get the message.&lt;br /&gt;
To do this, the dispatch algorithm should take into account several points:&lt;br /&gt;
&lt;br /&gt;
* Prioritize acknowledgements.&lt;br /&gt;
* If fragments are waiting to be sent to a number of hosts, do not send to the same host twice in a row. Alternating, or looping through the target hosts achieves the same data rate locally, but spreads out the load over downstream links.&lt;br /&gt;
* Do not exceed or approach the capacity of the local network connection. If a host has a 128 kb/s outbound bandwidth, dispatching 32 KB of data in one second will likely cause massive packet loss, leading to a retransmission.&lt;br /&gt;
* After considering the above points, prefer fragments that were queued recently to older packets. A LIFO or stack type approach means that even if a transmitter is becoming backed up, some fragments will get there on time, while others will be delayed. A FIFO approach would mean that a backed up host delivers every fragment late.&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
The recommended parameters for the reliability layer are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
MTU = 500 bytes&lt;br /&gt;
Transmit Retransmit Interval = 10 seconds&lt;br /&gt;
Transmit Packet Timeout / Expire = 26 seconds (allows for two retransmissions before expiry)&lt;br /&gt;
Receive Packet Expiry = 30 seconds (allows 10 seconds beyond final retransmission)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UDP/IP header being typically 28 bytes, it is best to limit the payload of the messages to '''476 bytes'''.  That way, with the 8-byte header we're topping plus the UDP/IP header, the whole message will not be greater than 512 bytes. The recommended MTU should therefore be 476 rather than the legacy 500. --RAM, 05:19, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
== Performance Considerations ==&lt;br /&gt;
&lt;br /&gt;
Relatively low-level network implementations such as this are reasonably&lt;br /&gt;
complicated, but must operate fast. It is desirable to avoid runtime memory&lt;br /&gt;
allocations in network code as much as possible, and particularly at this level.&lt;br /&gt;
&lt;br /&gt;
It should be noted that in almost all cases, transmissions to &amp;quot;untested&amp;quot; nodes are&lt;br /&gt;
single fragment. Replies on the other hand are often larger, and may be deflated in&lt;br /&gt;
many fragments. This is optimal, because attempting to contact a node which may be&lt;br /&gt;
unavailable, involves a retransmission of only a single fragment.&lt;br /&gt;
&lt;br /&gt;
Flow control is an important topic, however, it is handled at a higher layer. The UDP&lt;br /&gt;
reliability layer is only responsible for guaranteeing delivery of selected datagrams.&lt;br /&gt;
&lt;br /&gt;
Only critical transmissions whose reception cannot otherwise be inferred, should have&lt;br /&gt;
the acknowledge request bit set.&lt;br /&gt;
&lt;br /&gt;
== Extension Proposal ==&lt;br /&gt;
&lt;br /&gt;
The following is still a proposoal, but since there is no G2 Development Forum where this can be discussed, I thought I would document it here. 05:07, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
This extension ''should'' be '''totally backward compatible''' with existing implementations provided the above page specifications were strictly adhered to. Here it goes:&lt;br /&gt;
&lt;br /&gt;
=== Improved Acknowledgments ===&lt;br /&gt;
&lt;br /&gt;
Because acknowledgment messages can be lost in the way or arrive out of order, it is best to include as much of the reception state as possible so that the sending party can optimize retransmissions.&lt;br /&gt;
       &lt;br /&gt;
In order to do that, the following extensions to the original specifications has been added by gtk-gnutella:&lt;br /&gt;
       &lt;br /&gt;
* '''Cumulative Acknowledgements''': when the flag '''0x10''' is set, it tells the other party that '''all''' the fragments up to '''nPart''' have been received.&lt;br /&gt;
       &lt;br /&gt;
* '''Extended Acknowledgments''': when the flag '''0x20''' is set, it tells the other party that an acknowledgment payload is present.  It immediately follows the header and is architected thusly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;          &lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|   nReceived   |                  missingBits                  | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
'''nReceived''' is the total amount of parts successfully received so far.&lt;br /&gt;
          &lt;br /&gt;
'''missingBits''' is a bitfield that is read as a '''big-endian number''' and which contains set bits for the parts still missing.  The ''base'' part number is normally 0, unless flag '''0x10''' was set, in which case the '''nPart''' value indicates the base.  The rule is then that if bit ''b'' is set, then the fragment number ''b'' + ''base'' + 1 is still missing.&lt;br /&gt;
          &lt;br /&gt;
In the unlikely case where missingBits is too small to hold all the missing parts, only the ones that can be represented are included, the '''nReceived''' field being there to provide additional information.&lt;br /&gt;
          &lt;br /&gt;
Proper generation and parsing of the '''missingBits''' field is crucial, so to remove any ambiguity, it is best to interpret missingBits as a number. Then bit 0 is the bit corresponding to 2^0, bit ''n'' is the bit corresponding to 2^n. In the above framing pictogram, bit 0 is the 7th bit of the 3rd byte (because the number in '''missingBits''' is encoded in ''big-endian'').&lt;br /&gt;
          &lt;br /&gt;
Bit 0 corresponds to fragment #1, unless the '''0x10''' flag was set.  In that case, if for instance '''nPart''' is 3, then it means fragments #1, #2 and #3 were already received.  The base is therefore 3, and if bit 0 is set in '''missingBits''', it means fragment #4 (0 + 3 + 1) is still missing.&lt;br /&gt;
&lt;br /&gt;
This extended acknowledgment lets the sending party optimize its retransmissions even when some acknowledgments are lost.&lt;br /&gt;
&lt;br /&gt;
''Extended Acknowledgments'' are only useful when the total amount of fragments&lt;br /&gt;
is 3 or above.  Indeed, with only 2 fragments, the ''Cumulative Acknowledgment''&lt;br /&gt;
lets the receiving party know about the whole reception state.&lt;br /&gt;
&lt;br /&gt;
When the amount of fragments is 3 or more and only a ''Cumulative Acknowledgment'' is sent out, it '''implicitly denies reception''' of any other fragments.  This optimizes bandwidth since the 4 extra bytes sent out will only be required for large messages (more than 2 fragments) in case fragments are received out-of-order.&lt;br /&gt;
&lt;br /&gt;
=== Negotiation ===&lt;br /&gt;
&lt;br /&gt;
Before the recipient can use this extension, it must be certain that the sender will understand its semantics.  Indeed, imagine the case where a 3-fragment message is sent and completely received, and therefore the recipient only sends a ''Cumulative Acknowledge'' for fragment #3.  A legacy sender would think fragments #1 and #2 are still missing.&lt;br /&gt;
&lt;br /&gt;
To signify to the recipient that the sender will understand the new acknowledgments, it '''must set the flag 0x10''' in all the fragments it sends. This new flag is therefore defined as:&lt;br /&gt;
&lt;br /&gt;
* '''Improved Acknowledgements''': when the flag '''0x10''' is set in emitted fragments, it tells the other party that it can reply with the ''Cumulative Acknowledgments'' or the ''Extended Acknowledgment'' bits in its acknowledgment messages.&lt;br /&gt;
&lt;br /&gt;
When the ''Improved Acknowledgments'' flag is '''missing''', the receiver '''must fall back''' to the ''legacy'' acknowledgment protocol. Since '''0x10''' is in the high-nibble part of the flag field, no legacy implementation will choke upon seeing it, and can safely ignore it.  This guarantees the sender that the message will be processed correctly by legacy implementations.&lt;br /&gt;
&lt;br /&gt;
=== Delayed Acknowledgments ===&lt;br /&gt;
&lt;br /&gt;
To maximize the usefulness of ''Cumulative Acknowledgments'', the receiver can delay its acknowledgments for a small period of time (100 ms, say) in the hope that more fragments of the message will arrive meanwhile, provided the message has more than 1 fragment naturally.  When the 100 ms delay is expired, it can then acknowledge everything it got so far.  Performance will not be impacted by this small delaying, but it can save a few acknowledgments for larger messages.&lt;br /&gt;
&lt;br /&gt;
This means a sender must use a transmission policy whereby it first sends '''all the fragments''' of each message at once, then waits for acknowledgments or timeouts before retransmitting the um-acknowledged fragments.  In other words, the sender should not send a fragment, wait for its acknowledgement before sending the next one: this would delay the reception of the entire message and it would prevent using the optimizations that this extension proposal wants to promote!&lt;br /&gt;
&lt;br /&gt;
=== Author ===&lt;br /&gt;
&lt;br /&gt;
This proposal was created by Raphael Manfredi, last modified on 01:03, 26 September 2012 (PDT).&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=66347</id>
		<title>UDP Transceiver</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=66347"/>
		<updated>2012-09-26T21:45:21Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Improved Acknowledgments */ Really emphasize  that missingBits is big-endian&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[TCP_Stream_Connection_and_Handshaking|&amp;lt;&amp;lt; TCP Stream Connection and Handshaking]] | [[Packet_Structure|Packet Structure &amp;gt;&amp;gt;]] | [[Main_Page|Main Page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The User Datagram Protocol (UDP) is invaluable in peer to peer systems because it&lt;br /&gt;
provides a relatively low-cost (low-overhead) method of sending short, irregular&lt;br /&gt;
messages to a very large number of peers on demand. Establishing a TCP stream&lt;br /&gt;
connection to a peer simply to deliver a single packet of information is wasteful in&lt;br /&gt;
data volume and time for the peers involved and state-aware network devices along&lt;br /&gt;
the route, for example, network address translation facilities. When dealing with a&lt;br /&gt;
large number of peers quickly, these costs become unbearable. UDP provides a&lt;br /&gt;
solution and makes this kind of interaction possible.&lt;br /&gt;
&lt;br /&gt;
However, the delivery of UDP packets is not reliable: packets may be lost en-route for&lt;br /&gt;
a number of reasons. Often this behaviour is desirable, for example when the&lt;br /&gt;
destination node's connection is highly congested, UDP packets are likely to be&lt;br /&gt;
discarded. If the content was not critical, this loss is appropriate as the host's&lt;br /&gt;
resources are effectively unavailable. In other scenarios involving critical payloads,&lt;br /&gt;
UDP's lack of reliability is a problem: either the sender needs to make sure the&lt;br /&gt;
receiver gets the payload, or it needs to know definitively that the receiver was&lt;br /&gt;
unavailable.&lt;br /&gt;
&lt;br /&gt;
The Gnutella2 network solves this problem by implementing a selectively engaged&lt;br /&gt;
reliability layer on top of the basic UDP protocol. This reliability layer shares some&lt;br /&gt;
common functionality with TCP, but importantly does not provide any connection&lt;br /&gt;
state and thus retains the efficiency originally sought in UDP.&lt;br /&gt;
&lt;br /&gt;
This allows Gnutella2 to select the most optimal communication medium for each&lt;br /&gt;
and every transmission it needs to perform:&lt;br /&gt;
&lt;br /&gt;
* If a significant volume of data is to be exchanged, or subsequent data will be exchanged with the same destination, a TCP connection is established&lt;br /&gt;
* If a small volume of important data is to be exchanged in a once-off operation or irregularly, reliable UDP is used&lt;br /&gt;
* If a small volume of unimportant data is to be exchanged in a once-off operation or irregularly, unreliable UDP is used&lt;br /&gt;
&lt;br /&gt;
== UDP ==&lt;br /&gt;
&lt;br /&gt;
Gnutella2 semi-reliable communication is transported using the UDP protocol. The&lt;br /&gt;
port number for receiving UDP is the same as the port number listening for TCP&lt;br /&gt;
connections.&lt;br /&gt;
&lt;br /&gt;
== Encoding ==&lt;br /&gt;
&lt;br /&gt;
Implementing an additional reliable protocol within UDP requires a small control&lt;br /&gt;
header before the payload itself. This header is put to good use:&lt;br /&gt;
&lt;br /&gt;
A small signature identifies the packet as a Gnutella2 semi-reliable UDP datagram.&lt;br /&gt;
This allows the same port to be used for receiving UDP traffic for other protocols if&lt;br /&gt;
desired, and offers some simple protection against random, unexpected traffic.&lt;br /&gt;
A content code identifies the payload as a Gnutella2 packet stream, allowing future&lt;br /&gt;
protocols to be added within the same reliability layer if desired. &lt;br /&gt;
Flags allow additional attributes to be specified, such as inline stateless compression&lt;br /&gt;
of the payload (which is a required feature).&lt;br /&gt;
The header has a fixed size of 8 bytes, and is represented by the following C&lt;br /&gt;
structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#pragma pack(1)&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
   CHAR szTag[3];&lt;br /&gt;
   BYTE nFlags;&lt;br /&gt;
   WORD nSequence;&lt;br /&gt;
   BYTE nPart;&lt;br /&gt;
   BYTE nCount;&lt;br /&gt;
} GND_HEADER;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Byte format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|                      szTag                    |    nFlags     | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|           nSequence           |    nPart      |    nCount     | 4-7&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The members of the structure are detailed below:&lt;br /&gt;
&lt;br /&gt;
* '''szTag''' - contains a three byte encoding protocol identifier, in this case &amp;quot;GND&amp;quot; for &amp;quot;GNutella Datagram&amp;quot;. If this signature is not present the packet should not be decoded as a Gnutella2 reliability layer transmission.&lt;br /&gt;
* '''nFlags''' - contains flags which modify the content of the packet. The low-order nibble is reserved for critical flags: if one of these bits is set but the decoding software does not understand the meaning, the packet must be discarded. The high-order nibble is reserved for non-critical flags: when set these bits may be interpreted, but an inability to interpret a bit does not cause the packet to be discarded. Currently defined flags are:&lt;br /&gt;
:* '''0x01''' - Deflate&lt;br /&gt;
::  When the deflate bit is set, the entire payload is compressed with the deflate algorithm. The compression method used is the Deflate Compression Data Format (RFC 1951). On top of this compression a ZLIB ‘wrapper’ is applied (RFC 1950, ZLIB Compressed Data Format). The ZLIB wrapper ensures packet integrity, among other things. Note that the entire payload must be reassembled in the correct order before it can be deflated if the packet was fragmented. Fragments are not compressed separately!&lt;br /&gt;
:* '''0x02''' - Acknowledge Me&lt;br /&gt;
:: When the acknowledge me bit is set, the sender is expecting an acknowledgement for this packet.&lt;br /&gt;
&lt;br /&gt;
* '''nSequence''' - contains the sequence number of the packet. This sequence number is unique to the sending host only. It is not unique to the pair of the sending host and receiving host as in TCP, as there is no concept of connection state. Sequence numbers on consecutive packets need not be increasing (although that is convenient) â€“ they must only be different. If a packet is fragmented, all of its fragments will have the same sequence number. Byte order is unimportant here.&lt;br /&gt;
* '''nPart''' - contains the fragment part number (1 &amp;lt;= nPart &amp;lt;= nCount)&lt;br /&gt;
* '''nCount''' - contains the number of fragment parts in this packet. On a transmission, this value will be non-zero (all packets must have at least one fragment). If nCount is zero, this is an acknowledgement (see below).&lt;br /&gt;
&lt;br /&gt;
== Fragmentation ==&lt;br /&gt;
&lt;br /&gt;
Large packets must be fragmented before they can be sent through most network&lt;br /&gt;
interfaces. Different network media have different MTUs, and it is difficult to predict&lt;br /&gt;
what the lowest common size will be. Fragmentation and reassembly is performed by&lt;br /&gt;
the existing Internet protocols, however, there are two important reasons why the&lt;br /&gt;
reliability layer performs its own fragmentation:&lt;br /&gt;
&lt;br /&gt;
* Sockets implementations specify a maximum datagram size. This is adequate for the vast majority of transmissions, but it is desirable to have the transparent ability to send larger packets without worrying about the host implementation.&lt;br /&gt;
* When the Internet protocols fragment, a packet and one or more fragments are lost, it may decide to discard the whole packet in an unreliable datagram protocol. The Gnutella2 reliability layer can compensate by retransmitting the whole packet, which would then be re-fragmented and each fragment resent - however, this wastes the fragments that were successfully received before. Managing fragmentation natively allows this optimisation.&lt;br /&gt;
&lt;br /&gt;
Each node determines its own MTU, often based on a best guess combined with&lt;br /&gt;
information from the host's sockets implementation. Packets exceeding this size are&lt;br /&gt;
fragmented into multiple datagrams of the appropriate size. Each datagram has the&lt;br /&gt;
same sequence number and the same fragment count (nCount), but a different&lt;br /&gt;
fragment number (nPart).&lt;br /&gt;
&lt;br /&gt;
== Transmission Process ==&lt;br /&gt;
&lt;br /&gt;
When a packet is to be transmitted, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* Cache the payload&lt;br /&gt;
* Allocate a new locally and temporally unique sequence number&lt;br /&gt;
* Derive the appropriate number of fragments&lt;br /&gt;
* Queue the fragments for dispatch&lt;br /&gt;
* If the fragments do not need to be acknowledged, the packet can be flushed now&lt;br /&gt;
&lt;br /&gt;
The payload will generally be cached for an appropriate timeout period, or until the&lt;br /&gt;
data cache becomes full, at which time older payloads can be discarded. Fragments&lt;br /&gt;
are dispatched according to the dispatch algorithm of choice, and the sender listens&lt;br /&gt;
for acknowledgements. When an acknowledgement is received:&lt;br /&gt;
&lt;br /&gt;
* Lookup the sent packet by sequence number&lt;br /&gt;
* Mark the nPart fragment as received and cancel any retransmissions of this part&lt;br /&gt;
* If all fragments have been acknowledged, flush this packet from the cache&lt;br /&gt;
&lt;br /&gt;
If a fragment has been transmitted but has not been acknowledged within the&lt;br /&gt;
timeout, it should be retransmitted. A finite number of retransmissions are allowed&lt;br /&gt;
before the packet as a whole expires, at which time it is assumed that the packet&lt;br /&gt;
was not received.&lt;br /&gt;
&lt;br /&gt;
== Receive Process ==&lt;br /&gt;
&lt;br /&gt;
When a new datagram is received, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* If the acknowledge bit was set, send an acknowledge packet for this sequence number and part number, with nCount set to zero (ack)&lt;br /&gt;
* Lookup any existing packet by the sending IP and sequence number &lt;br /&gt;
* If there is no existing packet, create a new packet entry with the IP, sequence number, fragment count and flags&lt;br /&gt;
* If there was an existing packet, make sure it is not marked as done - if so, abort&lt;br /&gt;
* Add the transmitted fragment to the (new or old) packet entry&lt;br /&gt;
* If the packet now has all fragments, mark it as done and decode it and pass it up to the application layer&lt;br /&gt;
* Leave the packet on the cache even if it was finished, in case any parts are retransmitted&lt;br /&gt;
* Expire old packets from the receive buffer after a timeout, or if the buffer is full&lt;br /&gt;
&lt;br /&gt;
== Dispatch Algorithm ==&lt;br /&gt;
&lt;br /&gt;
Fragment datagrams need to be dispatched intelligently, to spread the load on&lt;br /&gt;
network resources and maximise the chance that the receiver will get the message.&lt;br /&gt;
To do this, the dispatch algorithm should take into account several points:&lt;br /&gt;
&lt;br /&gt;
* Prioritize acknowledgements.&lt;br /&gt;
* If fragments are waiting to be sent to a number of hosts, do not send to the same host twice in a row. Alternating, or looping through the target hosts achieves the same data rate locally, but spreads out the load over downstream links.&lt;br /&gt;
* Do not exceed or approach the capacity of the local network connection. If a host has a 128 kb/s outbound bandwidth, dispatching 32 KB of data in one second will likely cause massive packet loss, leading to a retransmission.&lt;br /&gt;
* After considering the above points, prefer fragments that were queued recently to older packets. A LIFO or stack type approach means that even if a transmitter is becoming backed up, some fragments will get there on time, while others will be delayed. A FIFO approach would mean that a backed up host delivers every fragment late.&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
The recommended parameters for the reliability layer are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
MTU = 500 bytes&lt;br /&gt;
Transmit Retransmit Interval = 10 seconds&lt;br /&gt;
Transmit Packet Timeout / Expire = 26 seconds (allows for two retransmissions before expiry)&lt;br /&gt;
Receive Packet Expiry = 30 seconds (allows 10 seconds beyond final retransmission)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UDP/IP header being typically 28 bytes, it is best to limit the payload of the messages to '''476 bytes'''.  That way, with the 8-byte header we're topping plus the UDP/IP header, the whole message will not be greater than 512 bytes. The recommended MTU should therefore be 476 rather than the legacy 500. --RAM, 05:19, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
== Performance Considerations ==&lt;br /&gt;
&lt;br /&gt;
Relatively low-level network implementations such as this are reasonably&lt;br /&gt;
complicated, but must operate fast. It is desirable to avoid runtime memory&lt;br /&gt;
allocations in network code as much as possible, and particularly at this level.&lt;br /&gt;
&lt;br /&gt;
It should be noted that in almost all cases, transmissions to &amp;quot;untested&amp;quot; nodes are&lt;br /&gt;
single fragment. Replies on the other hand are often larger, and may be deflated in&lt;br /&gt;
many fragments. This is optimal, because attempting to contact a node which may be&lt;br /&gt;
unavailable, involves a retransmission of only a single fragment.&lt;br /&gt;
&lt;br /&gt;
Flow control is an important topic, however, it is handled at a higher layer. The UDP&lt;br /&gt;
reliability layer is only responsible for guaranteeing delivery of selected datagrams.&lt;br /&gt;
&lt;br /&gt;
Only critical transmissions whose reception cannot otherwise be inferred, should have&lt;br /&gt;
the acknowledge request bit set.&lt;br /&gt;
&lt;br /&gt;
== Extension Proposal ==&lt;br /&gt;
&lt;br /&gt;
The following is still a proposoal, but since there is no G2 Development Forum where this can be discussed, I thought I would document it here. 05:07, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
This extension ''should'' be '''totally backward compatible''' with existing implementations provided the above page specifications were strictly adhered to. Here it goes:&lt;br /&gt;
&lt;br /&gt;
=== Improved Acknowledgments ===&lt;br /&gt;
&lt;br /&gt;
Because acknowledgment messages can be lost in the way or arrive out of order, it is best to include as much of the reception state as possible so that the sending party can optimize retransmissions.&lt;br /&gt;
       &lt;br /&gt;
In order to do that, the following extensions to the original specifications has been added by gtk-gnutella:&lt;br /&gt;
       &lt;br /&gt;
* '''Cumulative Acknowledgements''': when the flag '''0x10''' is set, it tells the other party that '''all''' the fragments up to '''nPart''' have been received.&lt;br /&gt;
       &lt;br /&gt;
* '''Extended Acknowledgments''': when the flag '''0x20''' is set, it tells the other party that an acknowledgment payload is present.  It immediately follows the header and is architected thusly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;          &lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|   nReceived   |                  missingBits                  | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
'''nReceived''' is the total amount of parts successfully received so far.&lt;br /&gt;
          &lt;br /&gt;
'''missingBits''' is a bitfield that is read as a '''big-endian number''' and which contains set bits for the parts still missing.  The ''base'' part number is normally 0, unless flag '''0x10''' was set, in which case the '''nPart''' value indicates the base.  The rule is then that if bit ''b'' is set, then the fragment number ''b'' + ''base'' + 1 is still missing.&lt;br /&gt;
          &lt;br /&gt;
In the unlikely case where missingBits is too small to hold all the missing parts, only the ones that can be represented are included, the '''nReceived''' field being there to provide additional information.&lt;br /&gt;
          &lt;br /&gt;
Proper generation and parsing of the '''missingBits''' field is crucial, so to remove any ambiguity, it is best to interpret missingBits as a number. Then bit 0 is the bit corresponding to 2^0, bit ''n'' is the bit corresponding to 2^n. In the above framing pictogram, bit 0 is the 7th bit of the 3rd byte (because the number in '''missingBits''' is encoded in ''big-endian'').&lt;br /&gt;
          &lt;br /&gt;
Bit 0 corresponds to fragment #1, unless the '''0x10''' flag was set.  In that case, if for instance '''nPart''' is 3, then it means fragments #1, #2 and #3 were already received.  The base is therefore 3, and if bit 0 is set in '''missingBits''', it means fragment #4 (0 + 3 + 1) is still missing.&lt;br /&gt;
&lt;br /&gt;
This extended acknowledgment lets the sending party optimize its retransmissions even when some acknowledgments are lost.&lt;br /&gt;
&lt;br /&gt;
''Extended Acknowledgments'' are only useful when the total amount of fragments&lt;br /&gt;
is 3 or above.  Indeed, with only 2 fragments, the ''Cumulative Acknowledgment''&lt;br /&gt;
lets the receiving party know about the whole reception state.&lt;br /&gt;
&lt;br /&gt;
When the amount of fragments is 3 or more and only a ''Cumulative Acknowledgment'' is sent out, it '''implicitly denies reception''' of any other fragments.  This optimizes bandwidth since the 4 extra bytes sent out will only be required for large messages (more than 2 fragments) in case fragments are received out-of-order.&lt;br /&gt;
&lt;br /&gt;
=== Negotiation ===&lt;br /&gt;
&lt;br /&gt;
Before the recipient can use this extension, it must be certain that the sender will understand its semantics.  Indeed, imagine the case where a 3-fragment message is sent and completely received, and therefore the recipient only sends a ''Cumulative Acknowledge'' for fragment #3.  A legacy sender would think fragments #1 and #2 are still missing.&lt;br /&gt;
&lt;br /&gt;
To signify to the recipient that the sender will understand the new acknowledgments, it '''must set the flag 0x10''' in all the fragments it sends. This new flag is therefore defined as:&lt;br /&gt;
&lt;br /&gt;
* '''Improved Acknowledgements''': when the flag '''0x10''' is set in emitted fragments, it tells the other party that it can reply with the ''Cumulative Acknowledgments'' or the ''Extended Acknowledgment'' bits in its acknowledgment messages.&lt;br /&gt;
&lt;br /&gt;
When the ''Improved Acknowledgments'' flag is '''missing''', the receiver '''must fall back''' to the ''legacy'' acknowledgment protocol. Since '''0x10''' is in the high-nibble part of the flag field, no legacy implementation will choke upon seeing it, and can safely ignore it.  This guarantees the sender that the message will be processed correctly by legacy implementations.&lt;br /&gt;
&lt;br /&gt;
=== Delayed Acknowledgments ===&lt;br /&gt;
&lt;br /&gt;
To maximize the usefulness of ''Cumulative Acknowledgments'', the receiver can delay its acknowledgments for a small period of time (100 ms, say) in the hope that more fragments of the message will arrive meanwhile, provided the message has more than 1 fragment naturally.  When the 100 ms delay is expired, it can then acknowledge everything it got so far.  Performance will not be impacted by this small delaying, but it can save a few acknowledgments for larger messages.&lt;br /&gt;
&lt;br /&gt;
This means a sender must use a transmission policy whereby it first sends '''all the fragments''' of each message at once the first time, then wait for acknowledgments or timeouts before retransmitting the missing fragments.  In other words, the sender should not send a fragment, wait for its acknowledge before sending the next one: this delays the reception of the entire message and it prevents using the optimizations that this extension proposal wants to promote!&lt;br /&gt;
&lt;br /&gt;
=== Author ===&lt;br /&gt;
&lt;br /&gt;
This proposal was created by Raphael Manfredi, last modified on 01:03, 26 September 2012 (PDT).&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=66340</id>
		<title>UDP Transceiver</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=66340"/>
		<updated>2012-09-26T21:42:04Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Improved Acknowledgments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[TCP_Stream_Connection_and_Handshaking|&amp;lt;&amp;lt; TCP Stream Connection and Handshaking]] | [[Packet_Structure|Packet Structure &amp;gt;&amp;gt;]] | [[Main_Page|Main Page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The User Datagram Protocol (UDP) is invaluable in peer to peer systems because it&lt;br /&gt;
provides a relatively low-cost (low-overhead) method of sending short, irregular&lt;br /&gt;
messages to a very large number of peers on demand. Establishing a TCP stream&lt;br /&gt;
connection to a peer simply to deliver a single packet of information is wasteful in&lt;br /&gt;
data volume and time for the peers involved and state-aware network devices along&lt;br /&gt;
the route, for example, network address translation facilities. When dealing with a&lt;br /&gt;
large number of peers quickly, these costs become unbearable. UDP provides a&lt;br /&gt;
solution and makes this kind of interaction possible.&lt;br /&gt;
&lt;br /&gt;
However, the delivery of UDP packets is not reliable: packets may be lost en-route for&lt;br /&gt;
a number of reasons. Often this behaviour is desirable, for example when the&lt;br /&gt;
destination node's connection is highly congested, UDP packets are likely to be&lt;br /&gt;
discarded. If the content was not critical, this loss is appropriate as the host's&lt;br /&gt;
resources are effectively unavailable. In other scenarios involving critical payloads,&lt;br /&gt;
UDP's lack of reliability is a problem: either the sender needs to make sure the&lt;br /&gt;
receiver gets the payload, or it needs to know definitively that the receiver was&lt;br /&gt;
unavailable.&lt;br /&gt;
&lt;br /&gt;
The Gnutella2 network solves this problem by implementing a selectively engaged&lt;br /&gt;
reliability layer on top of the basic UDP protocol. This reliability layer shares some&lt;br /&gt;
common functionality with TCP, but importantly does not provide any connection&lt;br /&gt;
state and thus retains the efficiency originally sought in UDP.&lt;br /&gt;
&lt;br /&gt;
This allows Gnutella2 to select the most optimal communication medium for each&lt;br /&gt;
and every transmission it needs to perform:&lt;br /&gt;
&lt;br /&gt;
* If a significant volume of data is to be exchanged, or subsequent data will be exchanged with the same destination, a TCP connection is established&lt;br /&gt;
* If a small volume of important data is to be exchanged in a once-off operation or irregularly, reliable UDP is used&lt;br /&gt;
* If a small volume of unimportant data is to be exchanged in a once-off operation or irregularly, unreliable UDP is used&lt;br /&gt;
&lt;br /&gt;
== UDP ==&lt;br /&gt;
&lt;br /&gt;
Gnutella2 semi-reliable communication is transported using the UDP protocol. The&lt;br /&gt;
port number for receiving UDP is the same as the port number listening for TCP&lt;br /&gt;
connections.&lt;br /&gt;
&lt;br /&gt;
== Encoding ==&lt;br /&gt;
&lt;br /&gt;
Implementing an additional reliable protocol within UDP requires a small control&lt;br /&gt;
header before the payload itself. This header is put to good use:&lt;br /&gt;
&lt;br /&gt;
A small signature identifies the packet as a Gnutella2 semi-reliable UDP datagram.&lt;br /&gt;
This allows the same port to be used for receiving UDP traffic for other protocols if&lt;br /&gt;
desired, and offers some simple protection against random, unexpected traffic.&lt;br /&gt;
A content code identifies the payload as a Gnutella2 packet stream, allowing future&lt;br /&gt;
protocols to be added within the same reliability layer if desired. &lt;br /&gt;
Flags allow additional attributes to be specified, such as inline stateless compression&lt;br /&gt;
of the payload (which is a required feature).&lt;br /&gt;
The header has a fixed size of 8 bytes, and is represented by the following C&lt;br /&gt;
structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#pragma pack(1)&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
   CHAR szTag[3];&lt;br /&gt;
   BYTE nFlags;&lt;br /&gt;
   WORD nSequence;&lt;br /&gt;
   BYTE nPart;&lt;br /&gt;
   BYTE nCount;&lt;br /&gt;
} GND_HEADER;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Byte format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|                      szTag                    |    nFlags     | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|           nSequence           |    nPart      |    nCount     | 4-7&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The members of the structure are detailed below:&lt;br /&gt;
&lt;br /&gt;
* '''szTag''' - contains a three byte encoding protocol identifier, in this case &amp;quot;GND&amp;quot; for &amp;quot;GNutella Datagram&amp;quot;. If this signature is not present the packet should not be decoded as a Gnutella2 reliability layer transmission.&lt;br /&gt;
* '''nFlags''' - contains flags which modify the content of the packet. The low-order nibble is reserved for critical flags: if one of these bits is set but the decoding software does not understand the meaning, the packet must be discarded. The high-order nibble is reserved for non-critical flags: when set these bits may be interpreted, but an inability to interpret a bit does not cause the packet to be discarded. Currently defined flags are:&lt;br /&gt;
:* '''0x01''' - Deflate&lt;br /&gt;
::  When the deflate bit is set, the entire payload is compressed with the deflate algorithm. The compression method used is the Deflate Compression Data Format (RFC 1951). On top of this compression a ZLIB ‘wrapper’ is applied (RFC 1950, ZLIB Compressed Data Format). The ZLIB wrapper ensures packet integrity, among other things. Note that the entire payload must be reassembled in the correct order before it can be deflated if the packet was fragmented. Fragments are not compressed separately!&lt;br /&gt;
:* '''0x02''' - Acknowledge Me&lt;br /&gt;
:: When the acknowledge me bit is set, the sender is expecting an acknowledgement for this packet.&lt;br /&gt;
&lt;br /&gt;
* '''nSequence''' - contains the sequence number of the packet. This sequence number is unique to the sending host only. It is not unique to the pair of the sending host and receiving host as in TCP, as there is no concept of connection state. Sequence numbers on consecutive packets need not be increasing (although that is convenient) â€“ they must only be different. If a packet is fragmented, all of its fragments will have the same sequence number. Byte order is unimportant here.&lt;br /&gt;
* '''nPart''' - contains the fragment part number (1 &amp;lt;= nPart &amp;lt;= nCount)&lt;br /&gt;
* '''nCount''' - contains the number of fragment parts in this packet. On a transmission, this value will be non-zero (all packets must have at least one fragment). If nCount is zero, this is an acknowledgement (see below).&lt;br /&gt;
&lt;br /&gt;
== Fragmentation ==&lt;br /&gt;
&lt;br /&gt;
Large packets must be fragmented before they can be sent through most network&lt;br /&gt;
interfaces. Different network media have different MTUs, and it is difficult to predict&lt;br /&gt;
what the lowest common size will be. Fragmentation and reassembly is performed by&lt;br /&gt;
the existing Internet protocols, however, there are two important reasons why the&lt;br /&gt;
reliability layer performs its own fragmentation:&lt;br /&gt;
&lt;br /&gt;
* Sockets implementations specify a maximum datagram size. This is adequate for the vast majority of transmissions, but it is desirable to have the transparent ability to send larger packets without worrying about the host implementation.&lt;br /&gt;
* When the Internet protocols fragment, a packet and one or more fragments are lost, it may decide to discard the whole packet in an unreliable datagram protocol. The Gnutella2 reliability layer can compensate by retransmitting the whole packet, which would then be re-fragmented and each fragment resent - however, this wastes the fragments that were successfully received before. Managing fragmentation natively allows this optimisation.&lt;br /&gt;
&lt;br /&gt;
Each node determines its own MTU, often based on a best guess combined with&lt;br /&gt;
information from the host's sockets implementation. Packets exceeding this size are&lt;br /&gt;
fragmented into multiple datagrams of the appropriate size. Each datagram has the&lt;br /&gt;
same sequence number and the same fragment count (nCount), but a different&lt;br /&gt;
fragment number (nPart).&lt;br /&gt;
&lt;br /&gt;
== Transmission Process ==&lt;br /&gt;
&lt;br /&gt;
When a packet is to be transmitted, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* Cache the payload&lt;br /&gt;
* Allocate a new locally and temporally unique sequence number&lt;br /&gt;
* Derive the appropriate number of fragments&lt;br /&gt;
* Queue the fragments for dispatch&lt;br /&gt;
* If the fragments do not need to be acknowledged, the packet can be flushed now&lt;br /&gt;
&lt;br /&gt;
The payload will generally be cached for an appropriate timeout period, or until the&lt;br /&gt;
data cache becomes full, at which time older payloads can be discarded. Fragments&lt;br /&gt;
are dispatched according to the dispatch algorithm of choice, and the sender listens&lt;br /&gt;
for acknowledgements. When an acknowledgement is received:&lt;br /&gt;
&lt;br /&gt;
* Lookup the sent packet by sequence number&lt;br /&gt;
* Mark the nPart fragment as received and cancel any retransmissions of this part&lt;br /&gt;
* If all fragments have been acknowledged, flush this packet from the cache&lt;br /&gt;
&lt;br /&gt;
If a fragment has been transmitted but has not been acknowledged within the&lt;br /&gt;
timeout, it should be retransmitted. A finite number of retransmissions are allowed&lt;br /&gt;
before the packet as a whole expires, at which time it is assumed that the packet&lt;br /&gt;
was not received.&lt;br /&gt;
&lt;br /&gt;
== Receive Process ==&lt;br /&gt;
&lt;br /&gt;
When a new datagram is received, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* If the acknowledge bit was set, send an acknowledge packet for this sequence number and part number, with nCount set to zero (ack)&lt;br /&gt;
* Lookup any existing packet by the sending IP and sequence number &lt;br /&gt;
* If there is no existing packet, create a new packet entry with the IP, sequence number, fragment count and flags&lt;br /&gt;
* If there was an existing packet, make sure it is not marked as done - if so, abort&lt;br /&gt;
* Add the transmitted fragment to the (new or old) packet entry&lt;br /&gt;
* If the packet now has all fragments, mark it as done and decode it and pass it up to the application layer&lt;br /&gt;
* Leave the packet on the cache even if it was finished, in case any parts are retransmitted&lt;br /&gt;
* Expire old packets from the receive buffer after a timeout, or if the buffer is full&lt;br /&gt;
&lt;br /&gt;
== Dispatch Algorithm ==&lt;br /&gt;
&lt;br /&gt;
Fragment datagrams need to be dispatched intelligently, to spread the load on&lt;br /&gt;
network resources and maximise the chance that the receiver will get the message.&lt;br /&gt;
To do this, the dispatch algorithm should take into account several points:&lt;br /&gt;
&lt;br /&gt;
* Prioritize acknowledgements.&lt;br /&gt;
* If fragments are waiting to be sent to a number of hosts, do not send to the same host twice in a row. Alternating, or looping through the target hosts achieves the same data rate locally, but spreads out the load over downstream links.&lt;br /&gt;
* Do not exceed or approach the capacity of the local network connection. If a host has a 128 kb/s outbound bandwidth, dispatching 32 KB of data in one second will likely cause massive packet loss, leading to a retransmission.&lt;br /&gt;
* After considering the above points, prefer fragments that were queued recently to older packets. A LIFO or stack type approach means that even if a transmitter is becoming backed up, some fragments will get there on time, while others will be delayed. A FIFO approach would mean that a backed up host delivers every fragment late.&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
The recommended parameters for the reliability layer are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
MTU = 500 bytes&lt;br /&gt;
Transmit Retransmit Interval = 10 seconds&lt;br /&gt;
Transmit Packet Timeout / Expire = 26 seconds (allows for two retransmissions before expiry)&lt;br /&gt;
Receive Packet Expiry = 30 seconds (allows 10 seconds beyond final retransmission)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UDP/IP header being typically 28 bytes, it is best to limit the payload of the messages to '''476 bytes'''.  That way, with the 8-byte header we're topping plus the UDP/IP header, the whole message will not be greater than 512 bytes. The recommended MTU should therefore be 476 rather than the legacy 500. --RAM, 05:19, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
== Performance Considerations ==&lt;br /&gt;
&lt;br /&gt;
Relatively low-level network implementations such as this are reasonably&lt;br /&gt;
complicated, but must operate fast. It is desirable to avoid runtime memory&lt;br /&gt;
allocations in network code as much as possible, and particularly at this level.&lt;br /&gt;
&lt;br /&gt;
It should be noted that in almost all cases, transmissions to &amp;quot;untested&amp;quot; nodes are&lt;br /&gt;
single fragment. Replies on the other hand are often larger, and may be deflated in&lt;br /&gt;
many fragments. This is optimal, because attempting to contact a node which may be&lt;br /&gt;
unavailable, involves a retransmission of only a single fragment.&lt;br /&gt;
&lt;br /&gt;
Flow control is an important topic, however, it is handled at a higher layer. The UDP&lt;br /&gt;
reliability layer is only responsible for guaranteeing delivery of selected datagrams.&lt;br /&gt;
&lt;br /&gt;
Only critical transmissions whose reception cannot otherwise be inferred, should have&lt;br /&gt;
the acknowledge request bit set.&lt;br /&gt;
&lt;br /&gt;
== Extension Proposal ==&lt;br /&gt;
&lt;br /&gt;
The following is still a proposoal, but since there is no G2 Development Forum where this can be discussed, I thought I would document it here. 05:07, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
This extension ''should'' be '''totally backward compatible''' with existing implementations provided the above page specifications were strictly adhered to. Here it goes:&lt;br /&gt;
&lt;br /&gt;
=== Improved Acknowledgments ===&lt;br /&gt;
&lt;br /&gt;
Because acknowledgment messages can be lost in the way or arrive out of order, it is best to include as much of the reception state as possible so that the sending party can optimize retransmissions.&lt;br /&gt;
       &lt;br /&gt;
In order to do that, the following extensions to the original specifications has been added by gtk-gnutella:&lt;br /&gt;
       &lt;br /&gt;
* '''Cumulative Acknowledgements''': when the flag '''0x10''' is set, it tells the other party that '''all''' the fragments up to '''nPart''' have been received.&lt;br /&gt;
       &lt;br /&gt;
* '''Extended Acknowledgments''': when the flag '''0x20''' is set, it tells the other party that an acknowledgment payload is present.  It immediately follows the header and is architected thusly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;          &lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|   nReceived   |                  missingBits                  | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
'''nReceived''' is the total amount of parts successfully received so far.&lt;br /&gt;
          &lt;br /&gt;
'''missingBits''' is a bitfield that is read as a '''big-endian number''' and which contains set bits for the parts still missing.  The ''base'' part number is normally 0, unless flag '''0x10''' was set, in which case the '''nPart''' value indicates the base.  The rule is then that if bit ''b'' is set, then the fragment number ''b'' + ''base'' + 1 is still missing.&lt;br /&gt;
          &lt;br /&gt;
In the unlikely case where missingBits is too small to hold all the missing parts, only the ones that can be represented are included, the '''nReceived''' field being there to provide additional information.&lt;br /&gt;
          &lt;br /&gt;
Proper generation and parsing of the missingBits field is crucial, so to remove any ambiguity, it is best to interpret missingBits as a number. Then bit 0 is the bit corresponding to 2^0, bit ''n'' is the bit corresponding to 2^n.&lt;br /&gt;
          &lt;br /&gt;
Bit 0 corresponds to fragment #1, unless the '''0x10''' flag was set.  In that case, if for instance '''nPart''' is 3, then it means fragments #1, #2 and #3 were already received.  The base is therefore 3, and if bit 0 is set in '''missingBits''', it means fragment #4 (0 + 3 + 1) is still missing.&lt;br /&gt;
&lt;br /&gt;
This extended acknowledgment lets the sending party optimize its retransmissions even when some acknowledgments are lost.&lt;br /&gt;
&lt;br /&gt;
''Extended Acknowledgments'' are only useful when the total amount of fragments&lt;br /&gt;
is 3 or above.  Indeed, with only 2 fragments, the ''Cumulative Acknowledgment''&lt;br /&gt;
lets the receiving party know about the whole reception state.&lt;br /&gt;
&lt;br /&gt;
When the amount of fragments is 3 or more and only a ''Cumulative Acknowledgment'' is sent out, it '''implicitly denies reception''' of any other fragments.  This optimizes bandwidth since the 4 extra bytes sent out will only be required for large messages (more than 2 fragments) in case fragments are received out-of-order.&lt;br /&gt;
&lt;br /&gt;
=== Negotiation ===&lt;br /&gt;
&lt;br /&gt;
Before the recipient can use this extension, it must be certain that the sender will understand its semantics.  Indeed, imagine the case where a 3-fragment message is sent and completely received, and therefore the recipient only sends a ''Cumulative Acknowledge'' for fragment #3.  A legacy sender would think fragments #1 and #2 are still missing.&lt;br /&gt;
&lt;br /&gt;
To signify to the recipient that the sender will understand the new acknowledgments, it '''must set the flag 0x10''' in all the fragments it sends. This new flag is therefore defined as:&lt;br /&gt;
&lt;br /&gt;
* '''Improved Acknowledgements''': when the flag '''0x10''' is set in emitted fragments, it tells the other party that it can reply with the ''Cumulative Acknowledgments'' or the ''Extended Acknowledgment'' bits in its acknowledgment messages.&lt;br /&gt;
&lt;br /&gt;
When the ''Improved Acknowledgments'' flag is '''missing''', the receiver '''must fall back''' to the ''legacy'' acknowledgment protocol. Since '''0x10''' is in the high-nibble part of the flag field, no legacy implementation will choke upon seeing it, and can safely ignore it.  This guarantees the sender that the message will be processed correctly by legacy implementations.&lt;br /&gt;
&lt;br /&gt;
=== Delayed Acknowledgments ===&lt;br /&gt;
&lt;br /&gt;
To maximize the usefulness of ''Cumulative Acknowledgments'', the receiver can delay its acknowledgments for a small period of time (100 ms, say) in the hope that more fragments of the message will arrive meanwhile, provided the message has more than 1 fragment naturally.  When the 100 ms delay is expired, it can then acknowledge everything it got so far.  Performance will not be impacted by this small delaying, but it can save a few acknowledgments for larger messages.&lt;br /&gt;
&lt;br /&gt;
This means a sender must use a transmission policy whereby it first sends '''all the fragments''' of each message at once the first time, then wait for acknowledgments or timeouts before retransmitting the missing fragments.  In other words, the sender should not send a fragment, wait for its acknowledge before sending the next one: this delays the reception of the entire message and it prevents using the optimizations that this extension proposal wants to promote!&lt;br /&gt;
&lt;br /&gt;
=== Author ===&lt;br /&gt;
&lt;br /&gt;
This proposal was created by Raphael Manfredi, last modified on 01:03, 26 September 2012 (PDT).&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=65102</id>
		<title>UDP Transceiver</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=65102"/>
		<updated>2012-09-26T08:03:22Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Extension Proposal */ Added delayed acknowledgments + negotiation sub-sections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[TCP_Stream_Connection_and_Handshaking|&amp;lt;&amp;lt; TCP Stream Connection and Handshaking]] | [[Packet_Structure|Packet Structure &amp;gt;&amp;gt;]] | [[Main_Page|Main Page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The User Datagram Protocol (UDP) is invaluable in peer to peer systems because it&lt;br /&gt;
provides a relatively low-cost (low-overhead) method of sending short, irregular&lt;br /&gt;
messages to a very large number of peers on demand. Establishing a TCP stream&lt;br /&gt;
connection to a peer simply to deliver a single packet of information is wasteful in&lt;br /&gt;
data volume and time for the peers involved and state-aware network devices along&lt;br /&gt;
the route, for example, network address translation facilities. When dealing with a&lt;br /&gt;
large number of peers quickly, these costs become unbearable. UDP provides a&lt;br /&gt;
solution and makes this kind of interaction possible.&lt;br /&gt;
&lt;br /&gt;
However, the delivery of UDP packets is not reliable: packets may be lost en-route for&lt;br /&gt;
a number of reasons. Often this behaviour is desirable, for example when the&lt;br /&gt;
destination node's connection is highly congested, UDP packets are likely to be&lt;br /&gt;
discarded. If the content was not critical, this loss is appropriate as the host's&lt;br /&gt;
resources are effectively unavailable. In other scenarios involving critical payloads,&lt;br /&gt;
UDP's lack of reliability is a problem: either the sender needs to make sure the&lt;br /&gt;
receiver gets the payload, or it needs to know definitively that the receiver was&lt;br /&gt;
unavailable.&lt;br /&gt;
&lt;br /&gt;
The Gnutella2 network solves this problem by implementing a selectively engaged&lt;br /&gt;
reliability layer on top of the basic UDP protocol. This reliability layer shares some&lt;br /&gt;
common functionality with TCP, but importantly does not provide any connection&lt;br /&gt;
state and thus retains the efficiency originally sought in UDP.&lt;br /&gt;
&lt;br /&gt;
This allows Gnutella2 to select the most optimal communication medium for each&lt;br /&gt;
and every transmission it needs to perform:&lt;br /&gt;
&lt;br /&gt;
* If a significant volume of data is to be exchanged, or subsequent data will be exchanged with the same destination, a TCP connection is established&lt;br /&gt;
* If a small volume of important data is to be exchanged in a once-off operation or irregularly, reliable UDP is used&lt;br /&gt;
* If a small volume of unimportant data is to be exchanged in a once-off operation or irregularly, unreliable UDP is used&lt;br /&gt;
&lt;br /&gt;
== UDP ==&lt;br /&gt;
&lt;br /&gt;
Gnutella2 semi-reliable communication is transported using the UDP protocol. The&lt;br /&gt;
port number for receiving UDP is the same as the port number listening for TCP&lt;br /&gt;
connections.&lt;br /&gt;
&lt;br /&gt;
== Encoding ==&lt;br /&gt;
&lt;br /&gt;
Implementing an additional reliable protocol within UDP requires a small control&lt;br /&gt;
header before the payload itself. This header is put to good use:&lt;br /&gt;
&lt;br /&gt;
A small signature identifies the packet as a Gnutella2 semi-reliable UDP datagram.&lt;br /&gt;
This allows the same port to be used for receiving UDP traffic for other protocols if&lt;br /&gt;
desired, and offers some simple protection against random, unexpected traffic.&lt;br /&gt;
A content code identifies the payload as a Gnutella2 packet stream, allowing future&lt;br /&gt;
protocols to be added within the same reliability layer if desired. &lt;br /&gt;
Flags allow additional attributes to be specified, such as inline stateless compression&lt;br /&gt;
of the payload (which is a required feature).&lt;br /&gt;
The header has a fixed size of 8 bytes, and is represented by the following C&lt;br /&gt;
structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#pragma pack(1)&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
   CHAR szTag[3];&lt;br /&gt;
   BYTE nFlags;&lt;br /&gt;
   WORD nSequence;&lt;br /&gt;
   BYTE nPart;&lt;br /&gt;
   BYTE nCount;&lt;br /&gt;
} GND_HEADER;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Byte format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|                      szTag                    |    nFlags     | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|           nSequence           |    nPart      |    nCount     | 4-7&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The members of the structure are detailed below:&lt;br /&gt;
&lt;br /&gt;
* '''szTag''' - contains a three byte encoding protocol identifier, in this case &amp;quot;GND&amp;quot; for &amp;quot;GNutella Datagram&amp;quot;. If this signature is not present the packet should not be decoded as a Gnutella2 reliability layer transmission.&lt;br /&gt;
* '''nFlags''' - contains flags which modify the content of the packet. The low-order nibble is reserved for critical flags: if one of these bits is set but the decoding software does not understand the meaning, the packet must be discarded. The high-order nibble is reserved for non-critical flags: when set these bits may be interpreted, but an inability to interpret a bit does not cause the packet to be discarded. Currently defined flags are:&lt;br /&gt;
:* '''0x01''' - Deflate&lt;br /&gt;
::  When the deflate bit is set, the entire payload is compressed with the deflate algorithm. The compression method used is the Deflate Compression Data Format (RFC 1951). On top of this compression a ZLIB ‘wrapper’ is applied (RFC 1950, ZLIB Compressed Data Format). The ZLIB wrapper ensures packet integrity, among other things. Note that the entire payload must be reassembled in the correct order before it can be deflated if the packet was fragmented. Fragments are not compressed separately!&lt;br /&gt;
:* '''0x02''' - Acknowledge Me&lt;br /&gt;
:: When the acknowledge me bit is set, the sender is expecting an acknowledgement for this packet.&lt;br /&gt;
&lt;br /&gt;
* '''nSequence''' - contains the sequence number of the packet. This sequence number is unique to the sending host only. It is not unique to the pair of the sending host and receiving host as in TCP, as there is no concept of connection state. Sequence numbers on consecutive packets need not be increasing (although that is convenient) â€“ they must only be different. If a packet is fragmented, all of its fragments will have the same sequence number. Byte order is unimportant here.&lt;br /&gt;
* '''nPart''' - contains the fragment part number (1 &amp;lt;= nPart &amp;lt;= nCount)&lt;br /&gt;
* '''nCount''' - contains the number of fragment parts in this packet. On a transmission, this value will be non-zero (all packets must have at least one fragment). If nCount is zero, this is an acknowledgement (see below).&lt;br /&gt;
&lt;br /&gt;
== Fragmentation ==&lt;br /&gt;
&lt;br /&gt;
Large packets must be fragmented before they can be sent through most network&lt;br /&gt;
interfaces. Different network media have different MTUs, and it is difficult to predict&lt;br /&gt;
what the lowest common size will be. Fragmentation and reassembly is performed by&lt;br /&gt;
the existing Internet protocols, however, there are two important reasons why the&lt;br /&gt;
reliability layer performs its own fragmentation:&lt;br /&gt;
&lt;br /&gt;
* Sockets implementations specify a maximum datagram size. This is adequate for the vast majority of transmissions, but it is desirable to have the transparent ability to send larger packets without worrying about the host implementation.&lt;br /&gt;
* When the Internet protocols fragment, a packet and one or more fragments are lost, it may decide to discard the whole packet in an unreliable datagram protocol. The Gnutella2 reliability layer can compensate by retransmitting the whole packet, which would then be re-fragmented and each fragment resent - however, this wastes the fragments that were successfully received before. Managing fragmentation natively allows this optimisation.&lt;br /&gt;
&lt;br /&gt;
Each node determines its own MTU, often based on a best guess combined with&lt;br /&gt;
information from the host's sockets implementation. Packets exceeding this size are&lt;br /&gt;
fragmented into multiple datagrams of the appropriate size. Each datagram has the&lt;br /&gt;
same sequence number and the same fragment count (nCount), but a different&lt;br /&gt;
fragment number (nPart).&lt;br /&gt;
&lt;br /&gt;
== Transmission Process ==&lt;br /&gt;
&lt;br /&gt;
When a packet is to be transmitted, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* Cache the payload&lt;br /&gt;
* Allocate a new locally and temporally unique sequence number&lt;br /&gt;
* Derive the appropriate number of fragments&lt;br /&gt;
* Queue the fragments for dispatch&lt;br /&gt;
* If the fragments do not need to be acknowledged, the packet can be flushed now&lt;br /&gt;
&lt;br /&gt;
The payload will generally be cached for an appropriate timeout period, or until the&lt;br /&gt;
data cache becomes full, at which time older payloads can be discarded. Fragments&lt;br /&gt;
are dispatched according to the dispatch algorithm of choice, and the sender listens&lt;br /&gt;
for acknowledgements. When an acknowledgement is received:&lt;br /&gt;
&lt;br /&gt;
* Lookup the sent packet by sequence number&lt;br /&gt;
* Mark the nPart fragment as received and cancel any retransmissions of this part&lt;br /&gt;
* If all fragments have been acknowledged, flush this packet from the cache&lt;br /&gt;
&lt;br /&gt;
If a fragment has been transmitted but has not been acknowledged within the&lt;br /&gt;
timeout, it should be retransmitted. A finite number of retransmissions are allowed&lt;br /&gt;
before the packet as a whole expires, at which time it is assumed that the packet&lt;br /&gt;
was not received.&lt;br /&gt;
&lt;br /&gt;
== Receive Process ==&lt;br /&gt;
&lt;br /&gt;
When a new datagram is received, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* If the acknowledge bit was set, send an acknowledge packet for this sequence number and part number, with nCount set to zero (ack)&lt;br /&gt;
* Lookup any existing packet by the sending IP and sequence number &lt;br /&gt;
* If there is no existing packet, create a new packet entry with the IP, sequence number, fragment count and flags&lt;br /&gt;
* If there was an existing packet, make sure it is not marked as done - if so, abort&lt;br /&gt;
* Add the transmitted fragment to the (new or old) packet entry&lt;br /&gt;
* If the packet now has all fragments, mark it as done and decode it and pass it up to the application layer&lt;br /&gt;
* Leave the packet on the cache even if it was finished, in case any parts are retransmitted&lt;br /&gt;
* Expire old packets from the receive buffer after a timeout, or if the buffer is full&lt;br /&gt;
&lt;br /&gt;
== Dispatch Algorithm ==&lt;br /&gt;
&lt;br /&gt;
Fragment datagrams need to be dispatched intelligently, to spread the load on&lt;br /&gt;
network resources and maximise the chance that the receiver will get the message.&lt;br /&gt;
To do this, the dispatch algorithm should take into account several points:&lt;br /&gt;
&lt;br /&gt;
* Prioritize acknowledgements.&lt;br /&gt;
* If fragments are waiting to be sent to a number of hosts, do not send to the same host twice in a row. Alternating, or looping through the target hosts achieves the same data rate locally, but spreads out the load over downstream links.&lt;br /&gt;
* Do not exceed or approach the capacity of the local network connection. If a host has a 128 kb/s outbound bandwidth, dispatching 32 KB of data in one second will likely cause massive packet loss, leading to a retransmission.&lt;br /&gt;
* After considering the above points, prefer fragments that were queued recently to older packets. A LIFO or stack type approach means that even if a transmitter is becoming backed up, some fragments will get there on time, while others will be delayed. A FIFO approach would mean that a backed up host delivers every fragment late.&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
The recommended parameters for the reliability layer are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
MTU = 500 bytes&lt;br /&gt;
Transmit Retransmit Interval = 10 seconds&lt;br /&gt;
Transmit Packet Timeout / Expire = 26 seconds (allows for two retransmissions before expiry)&lt;br /&gt;
Receive Packet Expiry = 30 seconds (allows 10 seconds beyond final retransmission)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UDP/IP header being typically 28 bytes, it is best to limit the payload of the messages to '''476 bytes'''.  That way, with the 8-byte header we're topping plus the UDP/IP header, the whole message will not be greater than 512 bytes. The recommended MTU should therefore be 476 rather than the legacy 500. --RAM, 05:19, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
== Performance Considerations ==&lt;br /&gt;
&lt;br /&gt;
Relatively low-level network implementations such as this are reasonably&lt;br /&gt;
complicated, but must operate fast. It is desirable to avoid runtime memory&lt;br /&gt;
allocations in network code as much as possible, and particularly at this level.&lt;br /&gt;
&lt;br /&gt;
It should be noted that in almost all cases, transmissions to &amp;quot;untested&amp;quot; nodes are&lt;br /&gt;
single fragment. Replies on the other hand are often larger, and may be deflated in&lt;br /&gt;
many fragments. This is optimal, because attempting to contact a node which may be&lt;br /&gt;
unavailable, involves a retransmission of only a single fragment.&lt;br /&gt;
&lt;br /&gt;
Flow control is an important topic, however, it is handled at a higher layer. The UDP&lt;br /&gt;
reliability layer is only responsible for guaranteeing delivery of selected datagrams.&lt;br /&gt;
&lt;br /&gt;
Only critical transmissions whose reception cannot otherwise be inferred, should have&lt;br /&gt;
the acknowledge request bit set.&lt;br /&gt;
&lt;br /&gt;
== Extension Proposal ==&lt;br /&gt;
&lt;br /&gt;
The following is still a proposoal, but since there is no G2 Development Forum where this can be discussed, I thought I would document it here. 05:07, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
This extension ''should'' be '''totally backward compatible''' with existing implementations provided the above page specifications were strictly adhered to. Here it goes:&lt;br /&gt;
&lt;br /&gt;
=== Improved Acknowledgments ===&lt;br /&gt;
&lt;br /&gt;
Because acknowledgment messages can be lost in the way or arrive out of order, it is best to include as much of the reception state as possible so that the sending party can optimize retransmissions.&lt;br /&gt;
       &lt;br /&gt;
In order to do that, the following extensions to the original specifications has been added by gtk-gnutella:&lt;br /&gt;
       &lt;br /&gt;
* '''Cumulative Acknowledgements''': when the flag '''0x10''' is set, it tells the other party that '''all''' the fragments up to '''nPart''' have been received.&lt;br /&gt;
       &lt;br /&gt;
* '''Extended Acknowledgments''': when the flag '''0x20''' is set, it tells the other party that an acknowledgment payload is present.  It immediately follows the header and is architected thusly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;          &lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|   nReceived   |                  missingBits                  | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
'''nReceived''' is the total amount of parts successfully received so far.&lt;br /&gt;
          &lt;br /&gt;
'''missingBits''' is a bitfield that is read as a big-endian number and which contains set bits for the parts still missing.  The ''base'' part number is normally 0, unless flag '''0x10''' was set, in which case the '''nPart''' value indicates the base.  The rule is then that if bit ''b'' is set, then the fragment number ''b'' + ''base'' + 1 is still missing.&lt;br /&gt;
          &lt;br /&gt;
In the unlikely case where missingBits is too small to hold all the missing parts, only the ones that can be represented are included, the '''nReceived''' field being there to provide additional information.&lt;br /&gt;
          &lt;br /&gt;
Proper generation and parsing of the missingBits field is crucial, so to remove any ambiguity, it is best to interpret missingBits as a number. Then bit 0 is the bit corresponding to 2^0, bit ''n'' is the bit corresponding to 2^n.&lt;br /&gt;
          &lt;br /&gt;
Bit 0 corresponds to fragment #1, unless the '''0x10''' flag was set.  In that case, if for instance '''nPart''' is 3, then it means fragments #1, #2 and #3 were already received.  The base is therefore 3, and if bit 0 is set in '''missingBits''', it means fragment #4 (0 + 3 + 1) is still missing.&lt;br /&gt;
&lt;br /&gt;
This extended acknowledgment lets the sending party optimize its retransmissions even when some acknowledgments are lost.&lt;br /&gt;
&lt;br /&gt;
''Extended Acknowledgments'' are only useful when the total amount of fragments&lt;br /&gt;
is 3 or above.  Indeed, with only 2 fragments, the ''Cumulative Acknowledgment''&lt;br /&gt;
lets the receiving party know about the whole reception state.&lt;br /&gt;
&lt;br /&gt;
When the amount of fragments is 3 or more and only a ''Cumulative Acknowledgment'' is sent out, it '''implicitly denies reception''' of any other fragments.  This optimizes bandwidth since the 4 extra bytes sent out will only be required for large messages (more than 2 fragments) in case fragments are received out-of-order.&lt;br /&gt;
&lt;br /&gt;
=== Negotiation ===&lt;br /&gt;
&lt;br /&gt;
Before the recipient can use this extension, it must be certain that the sender will understand its semantics.  Indeed, imagine the case where a 3-fragment message is sent and completely received, and therefore the recipient only sends a ''Cumulative Acknowledge'' for fragment #3.  A legacy sender would think fragments #1 and #2 are still missing.&lt;br /&gt;
&lt;br /&gt;
To signify to the recipient that the sender will understand the new acknowledgments, it '''must set the flag 0x10''' in all the fragments it sends. This new flag is therefore defined as:&lt;br /&gt;
&lt;br /&gt;
* '''Improved Acknowledgements''': when the flag '''0x10''' is set in emitted fragments, it tells the other party that it can reply with the ''Cumulative Acknowledgments'' or the ''Extended Acknowledgment'' bits in its acknowledgment messages.&lt;br /&gt;
&lt;br /&gt;
When the ''Improved Acknowledgments'' flag is '''missing''', the receiver '''must fall back''' to the ''legacy'' acknowledgment protocol. Since '''0x10''' is in the high-nibble part of the flag field, no legacy implementation will choke upon seeing it, and can safely ignore it.  This guarantees the sender that the message will be processed correctly by legacy implementations.&lt;br /&gt;
&lt;br /&gt;
=== Delayed Acknowledgments ===&lt;br /&gt;
&lt;br /&gt;
To maximize the usefulness of ''Cumulative Acknowledgments'', the receiver can delay its acknowledgments for a small period of time (100 ms, say) in the hope that more fragments of the message will arrive meanwhile, provided the message has more than 1 fragment naturally.  When the 100 ms delay is expired, it can then acknowledge everything it got so far.  Performance will not be impacted by this small delaying, but it can save a few acknowledgments for larger messages.&lt;br /&gt;
&lt;br /&gt;
This means a sender must use a transmission policy whereby it first sends '''all the fragments''' of each message at once the first time, then wait for acknowledgments or timeouts before retransmitting the missing fragments.  In other words, the sender should not send a fragment, wait for its acknowledge before sending the next one: this delays the reception of the entire message and it prevents using the optimizations that this extension proposal wants to promote!&lt;br /&gt;
&lt;br /&gt;
=== Author ===&lt;br /&gt;
&lt;br /&gt;
This proposal was created by Raphael Manfredi, last modified on 01:03, 26 September 2012 (PDT).&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=60468</id>
		<title>UDP Transceiver</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=60468"/>
		<updated>2012-09-23T12:55:35Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Encoding */  Fixed szTag item in structure (was missing [])&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[TCP_Stream_Connection_and_Handshaking|&amp;lt;&amp;lt; TCP Stream Connection and Handshaking]] | [[Packet_Structure|Packet Structure &amp;gt;&amp;gt;]] | [[Main_Page|Main Page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The User Datagram Protocol (UDP) is invaluable in peer to peer systems because it&lt;br /&gt;
provides a relatively low-cost (low-overhead) method of sending short, irregular&lt;br /&gt;
messages to a very large number of peers on demand. Establishing a TCP stream&lt;br /&gt;
connection to a peer simply to deliver a single packet of information is wasteful in&lt;br /&gt;
data volume and time for the peers involved and state-aware network devices along&lt;br /&gt;
the route, for example, network address translation facilities. When dealing with a&lt;br /&gt;
large number of peers quickly, these costs become unbearable. UDP provides a&lt;br /&gt;
solution and makes this kind of interaction possible.&lt;br /&gt;
&lt;br /&gt;
However, the delivery of UDP packets is not reliable: packets may be lost en-route for&lt;br /&gt;
a number of reasons. Often this behaviour is desirable, for example when the&lt;br /&gt;
destination node's connection is highly congested, UDP packets are likely to be&lt;br /&gt;
discarded. If the content was not critical, this loss is appropriate as the host's&lt;br /&gt;
resources are effectively unavailable. In other scenarios involving critical payloads,&lt;br /&gt;
UDP's lack of reliability is a problem: either the sender needs to make sure the&lt;br /&gt;
receiver gets the payload, or it needs to know definitively that the receiver was&lt;br /&gt;
unavailable.&lt;br /&gt;
&lt;br /&gt;
The Gnutella2 network solves this problem by implementing a selectively engaged&lt;br /&gt;
reliability layer on top of the basic UDP protocol. This reliability layer shares some&lt;br /&gt;
common functionality with TCP, but importantly does not provide any connection&lt;br /&gt;
state and thus retains the efficiency originally sought in UDP.&lt;br /&gt;
&lt;br /&gt;
This allows Gnutella2 to select the most optimal communication medium for each&lt;br /&gt;
and every transmission it needs to perform:&lt;br /&gt;
&lt;br /&gt;
* If a significant volume of data is to be exchanged, or subsequent data will be exchanged with the same destination, a TCP connection is established&lt;br /&gt;
* If a small volume of important data is to be exchanged in a once-off operation or irregularly, reliable UDP is used&lt;br /&gt;
* If a small volume of unimportant data is to be exchanged in a once-off operation or irregularly, unreliable UDP is used&lt;br /&gt;
&lt;br /&gt;
== UDP ==&lt;br /&gt;
&lt;br /&gt;
Gnutella2 semi-reliable communication is transported using the UDP protocol. The&lt;br /&gt;
port number for receiving UDP is the same as the port number listening for TCP&lt;br /&gt;
connections.&lt;br /&gt;
&lt;br /&gt;
== Encoding ==&lt;br /&gt;
&lt;br /&gt;
Implementing an additional reliable protocol within UDP requires a small control&lt;br /&gt;
header before the payload itself. This header is put to good use:&lt;br /&gt;
&lt;br /&gt;
A small signature identifies the packet as a Gnutella2 semi-reliable UDP datagram.&lt;br /&gt;
This allows the same port to be used for receiving UDP traffic for other protocols if&lt;br /&gt;
desired, and offers some simple protection against random, unexpected traffic.&lt;br /&gt;
A content code identifies the payload as a Gnutella2 packet stream, allowing future&lt;br /&gt;
protocols to be added within the same reliability layer if desired. &lt;br /&gt;
Flags allow additional attributes to be specified, such as inline stateless compression&lt;br /&gt;
of the payload (which is a required feature).&lt;br /&gt;
The header has a fixed size of 8 bytes, and is represented by the following C&lt;br /&gt;
structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#pragma pack(1)&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
   CHAR szTag[3];&lt;br /&gt;
   BYTE nFlags;&lt;br /&gt;
   WORD nSequence;&lt;br /&gt;
   BYTE nPart;&lt;br /&gt;
   BYTE nCount;&lt;br /&gt;
} GND_HEADER;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Byte format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|                      szTag                    |    nFlags     | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|           nSequence           |    nPart      |    nCount     | 4-7&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The members of the structure are detailed below:&lt;br /&gt;
&lt;br /&gt;
* '''szTag''' - contains a three byte encoding protocol identifier, in this case &amp;quot;GND&amp;quot; for &amp;quot;GNutella Datagram&amp;quot;. If this signature is not present the packet should not be decoded as a Gnutella2 reliability layer transmission.&lt;br /&gt;
* '''nFlags''' - contains flags which modify the content of the packet. The low-order nibble is reserved for critical flags: if one of these bits is set but the decoding software does not understand the meaning, the packet must be discarded. The high-order nibble is reserved for non-critical flags: when set these bits may be interpreted, but an inability to interpret a bit does not cause the packet to be discarded. Currently defined flags are:&lt;br /&gt;
:* '''0x01''' - Deflate&lt;br /&gt;
::  When the deflate bit is set, the entire payload is compressed with the deflate algorithm. The compression method used is the Deflate Compression Data Format (RFC 1951). On top of this compression a ZLIB ‘wrapper’ is applied (RFC 1950, ZLIB Compressed Data Format). The ZLIB wrapper ensures packet integrity, among other things. Note that the entire payload must be reassembled in the correct order before it can be deflated if the packet was fragmented. Fragments are not compressed separately!&lt;br /&gt;
:* '''0x02''' - Acknowledge Me&lt;br /&gt;
:: When the acknowledge me bit is set, the sender is expecting an acknowledgement for this packet.&lt;br /&gt;
&lt;br /&gt;
* '''nSequence''' - contains the sequence number of the packet. This sequence number is unique to the sending host only. It is not unique to the pair of the sending host and receiving host as in TCP, as there is no concept of connection state. Sequence numbers on consecutive packets need not be increasing (although that is convenient) â€“ they must only be different. If a packet is fragmented, all of its fragments will have the same sequence number. Byte order is unimportant here.&lt;br /&gt;
* '''nPart''' - contains the fragment part number (1 &amp;lt;= nPart &amp;lt;= nCount)&lt;br /&gt;
* '''nCount''' - contains the number of fragment parts in this packet. On a transmission, this value will be non-zero (all packets must have at least one fragment). If nCount is zero, this is an acknowledgement (see below).&lt;br /&gt;
&lt;br /&gt;
== Fragmentation ==&lt;br /&gt;
&lt;br /&gt;
Large packets must be fragmented before they can be sent through most network&lt;br /&gt;
interfaces. Different network media have different MTUs, and it is difficult to predict&lt;br /&gt;
what the lowest common size will be. Fragmentation and reassembly is performed by&lt;br /&gt;
the existing Internet protocols, however, there are two important reasons why the&lt;br /&gt;
reliability layer performs its own fragmentation:&lt;br /&gt;
&lt;br /&gt;
* Sockets implementations specify a maximum datagram size. This is adequate for the vast majority of transmissions, but it is desirable to have the transparent ability to send larger packets without worrying about the host implementation.&lt;br /&gt;
* When the Internet protocols fragment, a packet and one or more fragments are lost, it may decide to discard the whole packet in an unreliable datagram protocol. The Gnutella2 reliability layer can compensate by retransmitting the whole packet, which would then be re-fragmented and each fragment resent - however, this wastes the fragments that were successfully received before. Managing fragmentation natively allows this optimisation.&lt;br /&gt;
&lt;br /&gt;
Each node determines its own MTU, often based on a best guess combined with&lt;br /&gt;
information from the host's sockets implementation. Packets exceeding this size are&lt;br /&gt;
fragmented into multiple datagrams of the appropriate size. Each datagram has the&lt;br /&gt;
same sequence number and the same fragment count (nCount), but a different&lt;br /&gt;
fragment number (nPart).&lt;br /&gt;
&lt;br /&gt;
== Transmission Process ==&lt;br /&gt;
&lt;br /&gt;
When a packet is to be transmitted, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* Cache the payload&lt;br /&gt;
* Allocate a new locally and temporally unique sequence number&lt;br /&gt;
* Derive the appropriate number of fragments&lt;br /&gt;
* Queue the fragments for dispatch&lt;br /&gt;
* If the fragments do not need to be acknowledged, the packet can be flushed now&lt;br /&gt;
&lt;br /&gt;
The payload will generally be cached for an appropriate timeout period, or until the&lt;br /&gt;
data cache becomes full, at which time older payloads can be discarded. Fragments&lt;br /&gt;
are dispatched according to the dispatch algorithm of choice, and the sender listens&lt;br /&gt;
for acknowledgements. When an acknowledgement is received:&lt;br /&gt;
&lt;br /&gt;
* Lookup the sent packet by sequence number&lt;br /&gt;
* Mark the nPart fragment as received and cancel any retransmissions of this part&lt;br /&gt;
* If all fragments have been acknowledged, flush this packet from the cache&lt;br /&gt;
&lt;br /&gt;
If a fragment has been transmitted but has not been acknowledged within the&lt;br /&gt;
timeout, it should be retransmitted. A finite number of retransmissions are allowed&lt;br /&gt;
before the packet as a whole expires, at which time it is assumed that the packet&lt;br /&gt;
was not received.&lt;br /&gt;
&lt;br /&gt;
== Receive Process ==&lt;br /&gt;
&lt;br /&gt;
When a new datagram is received, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* If the acknowledge bit was set, send an acknowledge packet for this sequence number and part number, with nCount set to zero (ack)&lt;br /&gt;
* Lookup any existing packet by the sending IP and sequence number &lt;br /&gt;
* If there is no existing packet, create a new packet entry with the IP, sequence number, fragment count and flags&lt;br /&gt;
* If there was an existing packet, make sure it is not marked as done - if so, abort&lt;br /&gt;
* Add the transmitted fragment to the (new or old) packet entry&lt;br /&gt;
* If the packet now has all fragments, mark it as done and decode it and pass it up to the application layer&lt;br /&gt;
* Leave the packet on the cache even if it was finished, in case any parts are retransmitted&lt;br /&gt;
* Expire old packets from the receive buffer after a timeout, or if the buffer is full&lt;br /&gt;
&lt;br /&gt;
== Dispatch Algorithm ==&lt;br /&gt;
&lt;br /&gt;
Fragment datagrams need to be dispatched intelligently, to spread the load on&lt;br /&gt;
network resources and maximise the chance that the receiver will get the message.&lt;br /&gt;
To do this, the dispatch algorithm should take into account several points:&lt;br /&gt;
&lt;br /&gt;
* Prioritize acknowledgements.&lt;br /&gt;
* If fragments are waiting to be sent to a number of hosts, do not send to the same host twice in a row. Alternating, or looping through the target hosts achieves the same data rate locally, but spreads out the load over downstream links.&lt;br /&gt;
* Do not exceed or approach the capacity of the local network connection. If a host has a 128 kb/s outbound bandwidth, dispatching 32 KB of data in one second will likely cause massive packet loss, leading to a retransmission.&lt;br /&gt;
* After considering the above points, prefer fragments that were queued recently to older packets. A LIFO or stack type approach means that even if a transmitter is becoming backed up, some fragments will get there on time, while others will be delayed. A FIFO approach would mean that a backed up host delivers every fragment late.&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
The recommended parameters for the reliability layer are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
MTU = 500 bytes&lt;br /&gt;
Transmit Retransmit Interval = 10 seconds&lt;br /&gt;
Transmit Packet Timeout / Expire = 26 seconds (allows for two retransmissions before expiry)&lt;br /&gt;
Receive Packet Expiry = 30 seconds (allows 10 seconds beyond final retransmission)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UDP/IP header being typically 28 bytes, it is best to limit the payload of the messages to '''476 bytes'''.  That way, with the 8-byte header we're topping plus the UDP/IP header, the whole message will not be greater than 512 bytes. The recommended MTU should therefore be 476 rather than the legacy 500. --RAM, 05:19, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
== Performance Considerations ==&lt;br /&gt;
&lt;br /&gt;
Relatively low-level network implementations such as this are reasonably&lt;br /&gt;
complicated, but must operate fast. It is desirable to avoid runtime memory&lt;br /&gt;
allocations in network code as much as possible, and particularly at this level.&lt;br /&gt;
&lt;br /&gt;
It should be noted that in almost all cases, transmissions to &amp;quot;untested&amp;quot; nodes are&lt;br /&gt;
single fragment. Replies on the other hand are often larger, and may be deflated in&lt;br /&gt;
many fragments. This is optimal, because attempting to contact a node which may be&lt;br /&gt;
unavailable, involves a retransmission of only a single fragment.&lt;br /&gt;
&lt;br /&gt;
Flow control is an important topic, however, it is handled at a higher layer. The UDP&lt;br /&gt;
reliability layer is only responsible for guaranteeing delivery of selected datagrams.&lt;br /&gt;
&lt;br /&gt;
Only critical transmissions whose reception cannot otherwise be inferred, should have&lt;br /&gt;
the acknowledge request bit set.&lt;br /&gt;
&lt;br /&gt;
== Extension Proposal ==&lt;br /&gt;
&lt;br /&gt;
The following is still a proposoal, but since there is no G2 Development Forum where this can be discussed, I thought I would document it here. 05:07, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
This extension ''should'' be '''totally backward compatible''' with existing implementations provided the above page specifications were strictly adhered to. Here it goes:&lt;br /&gt;
&lt;br /&gt;
Because acknowledgment messages can be lost in the way or arrive out of&lt;br /&gt;
order, it is best to include as much of the reception state as possible&lt;br /&gt;
so that the sending party can optimize retransmissions.&lt;br /&gt;
       &lt;br /&gt;
In order to do that, the following extensions to the original specifications&lt;br /&gt;
has been added by gtk-gnutella:&lt;br /&gt;
       &lt;br /&gt;
* '''Cumulative Acknowledgements''': when the flag '''0x10''' is set, it tells the other party that '''all''' the fragments up to '''nPart''' have been received.&lt;br /&gt;
       &lt;br /&gt;
* '''Extended Acknowledgments''': when the flag '''0x20''' is set, it tells the other party that an acknowledgment payload is present.  It immediately follows the header and is architected thusly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;          &lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|   nReceived   |                  missingBits                  | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
'''nReceived''' is the total amount of parts successfully received so far.&lt;br /&gt;
          &lt;br /&gt;
'''missingBits''' is a bitfield that is read as a big-endian number and&lt;br /&gt;
which contains set bits for the parts still missing.  The ''base'' part number&lt;br /&gt;
is normally 0, unless flag '''0x10''' was set, in which case the '''nPart'''&lt;br /&gt;
value indicates the base.  The rule is then that if bit ''b'' is set,&lt;br /&gt;
then the fragment number ''b'' + ''base'' + 1 is still missing.&lt;br /&gt;
          &lt;br /&gt;
In the unlikely case where missingBits is too small to hold all the&lt;br /&gt;
missing parts, only the ones that can be represented are included, the&lt;br /&gt;
'''nReceived''' field being there to provide additional information.&lt;br /&gt;
          &lt;br /&gt;
Proper generation and parsing of the missingBits field is crucial, so to&lt;br /&gt;
remove any ambiguity, it is best to interpret missingBits as a number.&lt;br /&gt;
Then bit 0 is the bit corresponding to 2^0, bit ''n'' is the bit&lt;br /&gt;
corresponding to 2^n.&lt;br /&gt;
          &lt;br /&gt;
Bit 0 corresponds to fragment #1, unless the '''0x10''' flag was set.  In that&lt;br /&gt;
case, if for instance '''nPart''' is 3, then it means fragments #1, #2 and #3&lt;br /&gt;
were already received.  The base is therefore 3, and if bit 0 is set&lt;br /&gt;
in '''missingBits''', it means fragment #4 (0 + 3 + 1) is still missing.&lt;br /&gt;
&lt;br /&gt;
This extended acknowledgment lets the sending party optimize its&lt;br /&gt;
retransmissions even when some acknowledgments are lost.&lt;br /&gt;
&lt;br /&gt;
''Extended Acknowlegments'' are only useful when the total amount of fragments&lt;br /&gt;
is 3 or above.  Indeed, with only 2 fragments, the ''Cumulative Acknowledgment''&lt;br /&gt;
lets the receiving party know about the whole reception state.&lt;br /&gt;
&lt;br /&gt;
When the amount of fragments is 3 or more and only a&lt;br /&gt;
''Cumulative Acknowledgment'' &lt;br /&gt;
is sent out, it '''implicitly denies reception''' of any other&lt;br /&gt;
fragments.  This optimizes bandwidth since the 4 extra bytes sent out will&lt;br /&gt;
only be required for large messages (more than 2 fragments) in case fragments&lt;br /&gt;
are received out-of-order.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=60434</id>
		<title>UDP Transceiver</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=60434"/>
		<updated>2012-09-23T12:19:25Z</updated>

		<summary type="html">&lt;p&gt;Ram: /* Parameters */ MTU should really be 476 bytes, not 500&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[TCP_Stream_Connection_and_Handshaking|&amp;lt;&amp;lt; TCP Stream Connection and Handshaking]] | [[Packet_Structure|Packet Structure &amp;gt;&amp;gt;]] | [[Main_Page|Main Page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The User Datagram Protocol (UDP) is invaluable in peer to peer systems because it&lt;br /&gt;
provides a relatively low-cost (low-overhead) method of sending short, irregular&lt;br /&gt;
messages to a very large number of peers on demand. Establishing a TCP stream&lt;br /&gt;
connection to a peer simply to deliver a single packet of information is wasteful in&lt;br /&gt;
data volume and time for the peers involved and state-aware network devices along&lt;br /&gt;
the route, for example, network address translation facilities. When dealing with a&lt;br /&gt;
large number of peers quickly, these costs become unbearable. UDP provides a&lt;br /&gt;
solution and makes this kind of interaction possible.&lt;br /&gt;
&lt;br /&gt;
However, the delivery of UDP packets is not reliable: packets may be lost en-route for&lt;br /&gt;
a number of reasons. Often this behaviour is desirable, for example when the&lt;br /&gt;
destination node's connection is highly congested, UDP packets are likely to be&lt;br /&gt;
discarded. If the content was not critical, this loss is appropriate as the host's&lt;br /&gt;
resources are effectively unavailable. In other scenarios involving critical payloads,&lt;br /&gt;
UDP's lack of reliability is a problem: either the sender needs to make sure the&lt;br /&gt;
receiver gets the payload, or it needs to know definitively that the receiver was&lt;br /&gt;
unavailable.&lt;br /&gt;
&lt;br /&gt;
The Gnutella2 network solves this problem by implementing a selectively engaged&lt;br /&gt;
reliability layer on top of the basic UDP protocol. This reliability layer shares some&lt;br /&gt;
common functionality with TCP, but importantly does not provide any connection&lt;br /&gt;
state and thus retains the efficiency originally sought in UDP.&lt;br /&gt;
&lt;br /&gt;
This allows Gnutella2 to select the most optimal communication medium for each&lt;br /&gt;
and every transmission it needs to perform:&lt;br /&gt;
&lt;br /&gt;
* If a significant volume of data is to be exchanged, or subsequent data will be exchanged with the same destination, a TCP connection is established&lt;br /&gt;
* If a small volume of important data is to be exchanged in a once-off operation or irregularly, reliable UDP is used&lt;br /&gt;
* If a small volume of unimportant data is to be exchanged in a once-off operation or irregularly, unreliable UDP is used&lt;br /&gt;
&lt;br /&gt;
== UDP ==&lt;br /&gt;
&lt;br /&gt;
Gnutella2 semi-reliable communication is transported using the UDP protocol. The&lt;br /&gt;
port number for receiving UDP is the same as the port number listening for TCP&lt;br /&gt;
connections.&lt;br /&gt;
&lt;br /&gt;
== Encoding ==&lt;br /&gt;
&lt;br /&gt;
Implementing an additional reliable protocol within UDP requires a small control&lt;br /&gt;
header before the payload itself. This header is put to good use:&lt;br /&gt;
&lt;br /&gt;
A small signature identifies the packet as a Gnutella2 semi-reliable UDP datagram.&lt;br /&gt;
This allows the same port to be used for receiving UDP traffic for other protocols if&lt;br /&gt;
desired, and offers some simple protection against random, unexpected traffic.&lt;br /&gt;
A content code identifies the payload as a Gnutella2 packet stream, allowing future&lt;br /&gt;
protocols to be added within the same reliability layer if desired. &lt;br /&gt;
Flags allow additional attributes to be specified, such as inline stateless compression&lt;br /&gt;
of the payload (which is a required feature).&lt;br /&gt;
The header has a fixed size of 8 bytes, and is represented by the following C&lt;br /&gt;
structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#pragma pack(1)&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
   CHAR szTag3;&lt;br /&gt;
   BYTE nFlags;&lt;br /&gt;
   WORD nSequence;&lt;br /&gt;
   BYTE nPart;&lt;br /&gt;
   BYTE nCount;&lt;br /&gt;
} GND_HEADER;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Byte format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|                      szTag                    |    nFlags     | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|           nSequence           |    nPart      |    nCount     | 4-7&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The members of the structure are detailed below:&lt;br /&gt;
&lt;br /&gt;
* '''szTag''' - contains a three byte encoding protocol identifier, in this case &amp;quot;GND&amp;quot; for &amp;quot;GNutella Datagram&amp;quot;. If this signature is not present the packet should not be decoded as a Gnutella2 reliability layer transmission.&lt;br /&gt;
* '''nFlags''' - contains flags which modify the content of the packet. The low-order nibble is reserved for critical flags: if one of these bits is set but the decoding software does not understand the meaning, the packet must be discarded. The high-order nibble is reserved for non-critical flags: when set these bits may be interpreted, but an inability to interpret a bit does not cause the packet to be discarded. Currently defined flags are:&lt;br /&gt;
:* '''0x01''' - Deflate&lt;br /&gt;
::  When the deflate bit is set, the entire payload is compressed with the deflate algorithm. The compression method used is the Deflate Compression Data Format (RFC 1951). On top of this compression a ZLIB ‘wrapper’ is applied (RFC 1950, ZLIB Compressed Data Format). The ZLIB wrapper ensures packet integrity, among other things. Note that the entire payload must be reassembled in the correct order before it can be deflated if the packet was fragmented. Fragments are not compressed separately!&lt;br /&gt;
:* '''0x02''' - Acknowledge Me&lt;br /&gt;
:: When the acknowledge me bit is set, the sender is expecting an acknowledgement for this packet.&lt;br /&gt;
&lt;br /&gt;
* '''nSequence''' - contains the sequence number of the packet. This sequence number is unique to the sending host only. It is not unique to the pair of the sending host and receiving host as in TCP, as there is no concept of connection state. Sequence numbers on consecutive packets need not be increasing (although that is convenient) â€“ they must only be different. If a packet is fragmented, all of its fragments will have the same sequence number. Byte order is unimportant here.&lt;br /&gt;
* '''nPart''' - contains the fragment part number (1 &amp;lt;= nPart &amp;lt;= nCount)&lt;br /&gt;
* '''nCount''' - contains the number of fragment parts in this packet. On a transmission, this value will be non-zero (all packets must have at least one fragment). If nCount is zero, this is an acknowledgement (see below).&lt;br /&gt;
&lt;br /&gt;
== Fragmentation ==&lt;br /&gt;
&lt;br /&gt;
Large packets must be fragmented before they can be sent through most network&lt;br /&gt;
interfaces. Different network media have different MTUs, and it is difficult to predict&lt;br /&gt;
what the lowest common size will be. Fragmentation and reassembly is performed by&lt;br /&gt;
the existing Internet protocols, however, there are two important reasons why the&lt;br /&gt;
reliability layer performs its own fragmentation:&lt;br /&gt;
&lt;br /&gt;
* Sockets implementations specify a maximum datagram size. This is adequate for the vast majority of transmissions, but it is desirable to have the transparent ability to send larger packets without worrying about the host implementation.&lt;br /&gt;
* When the Internet protocols fragment, a packet and one or more fragments are lost, it may decide to discard the whole packet in an unreliable datagram protocol. The Gnutella2 reliability layer can compensate by retransmitting the whole packet, which would then be re-fragmented and each fragment resent - however, this wastes the fragments that were successfully received before. Managing fragmentation natively allows this optimisation.&lt;br /&gt;
&lt;br /&gt;
Each node determines its own MTU, often based on a best guess combined with&lt;br /&gt;
information from the host's sockets implementation. Packets exceeding this size are&lt;br /&gt;
fragmented into multiple datagrams of the appropriate size. Each datagram has the&lt;br /&gt;
same sequence number and the same fragment count (nCount), but a different&lt;br /&gt;
fragment number (nPart).&lt;br /&gt;
&lt;br /&gt;
== Transmission Process ==&lt;br /&gt;
&lt;br /&gt;
When a packet is to be transmitted, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* Cache the payload&lt;br /&gt;
* Allocate a new locally and temporally unique sequence number&lt;br /&gt;
* Derive the appropriate number of fragments&lt;br /&gt;
* Queue the fragments for dispatch&lt;br /&gt;
* If the fragments do not need to be acknowledged, the packet can be flushed now&lt;br /&gt;
&lt;br /&gt;
The payload will generally be cached for an appropriate timeout period, or until the&lt;br /&gt;
data cache becomes full, at which time older payloads can be discarded. Fragments&lt;br /&gt;
are dispatched according to the dispatch algorithm of choice, and the sender listens&lt;br /&gt;
for acknowledgements. When an acknowledgement is received:&lt;br /&gt;
&lt;br /&gt;
* Lookup the sent packet by sequence number&lt;br /&gt;
* Mark the nPart fragment as received and cancel any retransmissions of this part&lt;br /&gt;
* If all fragments have been acknowledged, flush this packet from the cache&lt;br /&gt;
&lt;br /&gt;
If a fragment has been transmitted but has not been acknowledged within the&lt;br /&gt;
timeout, it should be retransmitted. A finite number of retransmissions are allowed&lt;br /&gt;
before the packet as a whole expires, at which time it is assumed that the packet&lt;br /&gt;
was not received.&lt;br /&gt;
&lt;br /&gt;
== Receive Process ==&lt;br /&gt;
&lt;br /&gt;
When a new datagram is received, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* If the acknowledge bit was set, send an acknowledge packet for this sequence number and part number, with nCount set to zero (ack)&lt;br /&gt;
* Lookup any existing packet by the sending IP and sequence number &lt;br /&gt;
* If there is no existing packet, create a new packet entry with the IP, sequence number, fragment count and flags&lt;br /&gt;
* If there was an existing packet, make sure it is not marked as done - if so, abort&lt;br /&gt;
* Add the transmitted fragment to the (new or old) packet entry&lt;br /&gt;
* If the packet now has all fragments, mark it as done and decode it and pass it up to the application layer&lt;br /&gt;
* Leave the packet on the cache even if it was finished, in case any parts are retransmitted&lt;br /&gt;
* Expire old packets from the receive buffer after a timeout, or if the buffer is full&lt;br /&gt;
&lt;br /&gt;
== Dispatch Algorithm ==&lt;br /&gt;
&lt;br /&gt;
Fragment datagrams need to be dispatched intelligently, to spread the load on&lt;br /&gt;
network resources and maximise the chance that the receiver will get the message.&lt;br /&gt;
To do this, the dispatch algorithm should take into account several points:&lt;br /&gt;
&lt;br /&gt;
* Prioritize acknowledgements.&lt;br /&gt;
* If fragments are waiting to be sent to a number of hosts, do not send to the same host twice in a row. Alternating, or looping through the target hosts achieves the same data rate locally, but spreads out the load over downstream links.&lt;br /&gt;
* Do not exceed or approach the capacity of the local network connection. If a host has a 128 kb/s outbound bandwidth, dispatching 32 KB of data in one second will likely cause massive packet loss, leading to a retransmission.&lt;br /&gt;
* After considering the above points, prefer fragments that were queued recently to older packets. A LIFO or stack type approach means that even if a transmitter is becoming backed up, some fragments will get there on time, while others will be delayed. A FIFO approach would mean that a backed up host delivers every fragment late.&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
The recommended parameters for the reliability layer are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
MTU = 500 bytes&lt;br /&gt;
Transmit Retransmit Interval = 10 seconds&lt;br /&gt;
Transmit Packet Timeout / Expire = 26 seconds (allows for two retransmissions before expiry)&lt;br /&gt;
Receive Packet Expiry = 30 seconds (allows 10 seconds beyond final retransmission)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UDP/IP header being typically 28 bytes, it is best to limit the payload of the messages to '''476 bytes'''.  That way, with the 8-byte header we're topping plus the UDP/IP header, the whole message will not be greater than 512 bytes. The recommended MTU should therefore be 476 rather than the legacy 500. --RAM, 05:19, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
== Performance Considerations ==&lt;br /&gt;
&lt;br /&gt;
Relatively low-level network implementations such as this are reasonably&lt;br /&gt;
complicated, but must operate fast. It is desirable to avoid runtime memory&lt;br /&gt;
allocations in network code as much as possible, and particularly at this level.&lt;br /&gt;
&lt;br /&gt;
It should be noted that in almost all cases, transmissions to &amp;quot;untested&amp;quot; nodes are&lt;br /&gt;
single fragment. Replies on the other hand are often larger, and may be deflated in&lt;br /&gt;
many fragments. This is optimal, because attempting to contact a node which may be&lt;br /&gt;
unavailable, involves a retransmission of only a single fragment.&lt;br /&gt;
&lt;br /&gt;
Flow control is an important topic, however, it is handled at a higher layer. The UDP&lt;br /&gt;
reliability layer is only responsible for guaranteeing delivery of selected datagrams.&lt;br /&gt;
&lt;br /&gt;
Only critical transmissions whose reception cannot otherwise be inferred, should have&lt;br /&gt;
the acknowledge request bit set.&lt;br /&gt;
&lt;br /&gt;
== Extension Proposal ==&lt;br /&gt;
&lt;br /&gt;
The following is still a proposoal, but since there is no G2 Development Forum where this can be discussed, I thought I would document it here. 05:07, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
This extension ''should'' be '''totally backward compatible''' with existing implementations provided the above page specifications were strictly adhered to. Here it goes:&lt;br /&gt;
&lt;br /&gt;
Because acknowledgment messages can be lost in the way or arrive out of&lt;br /&gt;
order, it is best to include as much of the reception state as possible&lt;br /&gt;
so that the sending party can optimize retransmissions.&lt;br /&gt;
       &lt;br /&gt;
In order to do that, the following extensions to the original specifications&lt;br /&gt;
has been added by gtk-gnutella:&lt;br /&gt;
       &lt;br /&gt;
* '''Cumulative Acknowledgements''': when the flag '''0x10''' is set, it tells the other party that '''all''' the fragments up to '''nPart''' have been received.&lt;br /&gt;
       &lt;br /&gt;
* '''Extended Acknowledgments''': when the flag '''0x20''' is set, it tells the other party that an acknowledgment payload is present.  It immediately follows the header and is architected thusly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;          &lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|   nReceived   |                  missingBits                  | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
'''nReceived''' is the total amount of parts successfully received so far.&lt;br /&gt;
          &lt;br /&gt;
'''missingBits''' is a bitfield that is read as a big-endian number and&lt;br /&gt;
which contains set bits for the parts still missing.  The ''base'' part number&lt;br /&gt;
is normally 0, unless flag '''0x10''' was set, in which case the '''nPart'''&lt;br /&gt;
value indicates the base.  The rule is then that if bit ''b'' is set,&lt;br /&gt;
then the fragment number ''b'' + ''base'' + 1 is still missing.&lt;br /&gt;
          &lt;br /&gt;
In the unlikely case where missingBits is too small to hold all the&lt;br /&gt;
missing parts, only the ones that can be represented are included, the&lt;br /&gt;
'''nReceived''' field being there to provide additional information.&lt;br /&gt;
          &lt;br /&gt;
Proper generation and parsing of the missingBits field is crucial, so to&lt;br /&gt;
remove any ambiguity, it is best to interpret missingBits as a number.&lt;br /&gt;
Then bit 0 is the bit corresponding to 2^0, bit ''n'' is the bit&lt;br /&gt;
corresponding to 2^n.&lt;br /&gt;
          &lt;br /&gt;
Bit 0 corresponds to fragment #1, unless the '''0x10''' flag was set.  In that&lt;br /&gt;
case, if for instance '''nPart''' is 3, then it means fragments #1, #2 and #3&lt;br /&gt;
were already received.  The base is therefore 3, and if bit 0 is set&lt;br /&gt;
in '''missingBits''', it means fragment #4 (0 + 3 + 1) is still missing.&lt;br /&gt;
&lt;br /&gt;
This extended acknowledgment lets the sending party optimize its&lt;br /&gt;
retransmissions even when some acknowledgments are lost.&lt;br /&gt;
&lt;br /&gt;
''Extended Acknowlegments'' are only useful when the total amount of fragments&lt;br /&gt;
is 3 or above.  Indeed, with only 2 fragments, the ''Cumulative Acknowledgment''&lt;br /&gt;
lets the receiving party know about the whole reception state.&lt;br /&gt;
&lt;br /&gt;
When the amount of fragments is 3 or more and only a&lt;br /&gt;
''Cumulative Acknowledgment'' &lt;br /&gt;
is sent out, it '''implicitly denies reception''' of any other&lt;br /&gt;
fragments.  This optimizes bandwidth since the 4 extra bytes sent out will&lt;br /&gt;
only be required for large messages (more than 2 fragments) in case fragments&lt;br /&gt;
are received out-of-order.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=60416</id>
		<title>UDP Transceiver</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=UDP_Transceiver&amp;diff=60416"/>
		<updated>2012-09-23T12:07:27Z</updated>

		<summary type="html">&lt;p&gt;Ram: Added proposed acknowledgment extension&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[TCP_Stream_Connection_and_Handshaking|&amp;lt;&amp;lt; TCP Stream Connection and Handshaking]] | [[Packet_Structure|Packet Structure &amp;gt;&amp;gt;]] | [[Main_Page|Main Page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The User Datagram Protocol (UDP) is invaluable in peer to peer systems because it&lt;br /&gt;
provides a relatively low-cost (low-overhead) method of sending short, irregular&lt;br /&gt;
messages to a very large number of peers on demand. Establishing a TCP stream&lt;br /&gt;
connection to a peer simply to deliver a single packet of information is wasteful in&lt;br /&gt;
data volume and time for the peers involved and state-aware network devices along&lt;br /&gt;
the route, for example, network address translation facilities. When dealing with a&lt;br /&gt;
large number of peers quickly, these costs become unbearable. UDP provides a&lt;br /&gt;
solution and makes this kind of interaction possible.&lt;br /&gt;
&lt;br /&gt;
However, the delivery of UDP packets is not reliable: packets may be lost en-route for&lt;br /&gt;
a number of reasons. Often this behaviour is desirable, for example when the&lt;br /&gt;
destination node's connection is highly congested, UDP packets are likely to be&lt;br /&gt;
discarded. If the content was not critical, this loss is appropriate as the host's&lt;br /&gt;
resources are effectively unavailable. In other scenarios involving critical payloads,&lt;br /&gt;
UDP's lack of reliability is a problem: either the sender needs to make sure the&lt;br /&gt;
receiver gets the payload, or it needs to know definitively that the receiver was&lt;br /&gt;
unavailable.&lt;br /&gt;
&lt;br /&gt;
The Gnutella2 network solves this problem by implementing a selectively engaged&lt;br /&gt;
reliability layer on top of the basic UDP protocol. This reliability layer shares some&lt;br /&gt;
common functionality with TCP, but importantly does not provide any connection&lt;br /&gt;
state and thus retains the efficiency originally sought in UDP.&lt;br /&gt;
&lt;br /&gt;
This allows Gnutella2 to select the most optimal communication medium for each&lt;br /&gt;
and every transmission it needs to perform:&lt;br /&gt;
&lt;br /&gt;
* If a significant volume of data is to be exchanged, or subsequent data will be exchanged with the same destination, a TCP connection is established&lt;br /&gt;
* If a small volume of important data is to be exchanged in a once-off operation or irregularly, reliable UDP is used&lt;br /&gt;
* If a small volume of unimportant data is to be exchanged in a once-off operation or irregularly, unreliable UDP is used&lt;br /&gt;
&lt;br /&gt;
== UDP ==&lt;br /&gt;
&lt;br /&gt;
Gnutella2 semi-reliable communication is transported using the UDP protocol. The&lt;br /&gt;
port number for receiving UDP is the same as the port number listening for TCP&lt;br /&gt;
connections.&lt;br /&gt;
&lt;br /&gt;
== Encoding ==&lt;br /&gt;
&lt;br /&gt;
Implementing an additional reliable protocol within UDP requires a small control&lt;br /&gt;
header before the payload itself. This header is put to good use:&lt;br /&gt;
&lt;br /&gt;
A small signature identifies the packet as a Gnutella2 semi-reliable UDP datagram.&lt;br /&gt;
This allows the same port to be used for receiving UDP traffic for other protocols if&lt;br /&gt;
desired, and offers some simple protection against random, unexpected traffic.&lt;br /&gt;
A content code identifies the payload as a Gnutella2 packet stream, allowing future&lt;br /&gt;
protocols to be added within the same reliability layer if desired. &lt;br /&gt;
Flags allow additional attributes to be specified, such as inline stateless compression&lt;br /&gt;
of the payload (which is a required feature).&lt;br /&gt;
The header has a fixed size of 8 bytes, and is represented by the following C&lt;br /&gt;
structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#pragma pack(1)&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
   CHAR szTag3;&lt;br /&gt;
   BYTE nFlags;&lt;br /&gt;
   WORD nSequence;&lt;br /&gt;
   BYTE nPart;&lt;br /&gt;
   BYTE nCount;&lt;br /&gt;
} GND_HEADER;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Byte format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|                      szTag                    |    nFlags     | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|           nSequence           |    nPart      |    nCount     | 4-7&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The members of the structure are detailed below:&lt;br /&gt;
&lt;br /&gt;
* '''szTag''' - contains a three byte encoding protocol identifier, in this case &amp;quot;GND&amp;quot; for &amp;quot;GNutella Datagram&amp;quot;. If this signature is not present the packet should not be decoded as a Gnutella2 reliability layer transmission.&lt;br /&gt;
* '''nFlags''' - contains flags which modify the content of the packet. The low-order nibble is reserved for critical flags: if one of these bits is set but the decoding software does not understand the meaning, the packet must be discarded. The high-order nibble is reserved for non-critical flags: when set these bits may be interpreted, but an inability to interpret a bit does not cause the packet to be discarded. Currently defined flags are:&lt;br /&gt;
:* '''0x01''' - Deflate&lt;br /&gt;
::  When the deflate bit is set, the entire payload is compressed with the deflate algorithm. The compression method used is the Deflate Compression Data Format (RFC 1951). On top of this compression a ZLIB ‘wrapper’ is applied (RFC 1950, ZLIB Compressed Data Format). The ZLIB wrapper ensures packet integrity, among other things. Note that the entire payload must be reassembled in the correct order before it can be deflated if the packet was fragmented. Fragments are not compressed separately!&lt;br /&gt;
:* '''0x02''' - Acknowledge Me&lt;br /&gt;
:: When the acknowledge me bit is set, the sender is expecting an acknowledgement for this packet.&lt;br /&gt;
&lt;br /&gt;
* '''nSequence''' - contains the sequence number of the packet. This sequence number is unique to the sending host only. It is not unique to the pair of the sending host and receiving host as in TCP, as there is no concept of connection state. Sequence numbers on consecutive packets need not be increasing (although that is convenient) â€“ they must only be different. If a packet is fragmented, all of its fragments will have the same sequence number. Byte order is unimportant here.&lt;br /&gt;
* '''nPart''' - contains the fragment part number (1 &amp;lt;= nPart &amp;lt;= nCount)&lt;br /&gt;
* '''nCount''' - contains the number of fragment parts in this packet. On a transmission, this value will be non-zero (all packets must have at least one fragment). If nCount is zero, this is an acknowledgement (see below).&lt;br /&gt;
&lt;br /&gt;
== Fragmentation ==&lt;br /&gt;
&lt;br /&gt;
Large packets must be fragmented before they can be sent through most network&lt;br /&gt;
interfaces. Different network media have different MTUs, and it is difficult to predict&lt;br /&gt;
what the lowest common size will be. Fragmentation and reassembly is performed by&lt;br /&gt;
the existing Internet protocols, however, there are two important reasons why the&lt;br /&gt;
reliability layer performs its own fragmentation:&lt;br /&gt;
&lt;br /&gt;
* Sockets implementations specify a maximum datagram size. This is adequate for the vast majority of transmissions, but it is desirable to have the transparent ability to send larger packets without worrying about the host implementation.&lt;br /&gt;
* When the Internet protocols fragment, a packet and one or more fragments are lost, it may decide to discard the whole packet in an unreliable datagram protocol. The Gnutella2 reliability layer can compensate by retransmitting the whole packet, which would then be re-fragmented and each fragment resent - however, this wastes the fragments that were successfully received before. Managing fragmentation natively allows this optimisation.&lt;br /&gt;
&lt;br /&gt;
Each node determines its own MTU, often based on a best guess combined with&lt;br /&gt;
information from the host's sockets implementation. Packets exceeding this size are&lt;br /&gt;
fragmented into multiple datagrams of the appropriate size. Each datagram has the&lt;br /&gt;
same sequence number and the same fragment count (nCount), but a different&lt;br /&gt;
fragment number (nPart).&lt;br /&gt;
&lt;br /&gt;
== Transmission Process ==&lt;br /&gt;
&lt;br /&gt;
When a packet is to be transmitted, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* Cache the payload&lt;br /&gt;
* Allocate a new locally and temporally unique sequence number&lt;br /&gt;
* Derive the appropriate number of fragments&lt;br /&gt;
* Queue the fragments for dispatch&lt;br /&gt;
* If the fragments do not need to be acknowledged, the packet can be flushed now&lt;br /&gt;
&lt;br /&gt;
The payload will generally be cached for an appropriate timeout period, or until the&lt;br /&gt;
data cache becomes full, at which time older payloads can be discarded. Fragments&lt;br /&gt;
are dispatched according to the dispatch algorithm of choice, and the sender listens&lt;br /&gt;
for acknowledgements. When an acknowledgement is received:&lt;br /&gt;
&lt;br /&gt;
* Lookup the sent packet by sequence number&lt;br /&gt;
* Mark the nPart fragment as received and cancel any retransmissions of this part&lt;br /&gt;
* If all fragments have been acknowledged, flush this packet from the cache&lt;br /&gt;
&lt;br /&gt;
If a fragment has been transmitted but has not been acknowledged within the&lt;br /&gt;
timeout, it should be retransmitted. A finite number of retransmissions are allowed&lt;br /&gt;
before the packet as a whole expires, at which time it is assumed that the packet&lt;br /&gt;
was not received.&lt;br /&gt;
&lt;br /&gt;
== Receive Process ==&lt;br /&gt;
&lt;br /&gt;
When a new datagram is received, the network layer must:&lt;br /&gt;
&lt;br /&gt;
* If the acknowledge bit was set, send an acknowledge packet for this sequence number and part number, with nCount set to zero (ack)&lt;br /&gt;
* Lookup any existing packet by the sending IP and sequence number &lt;br /&gt;
* If there is no existing packet, create a new packet entry with the IP, sequence number, fragment count and flags&lt;br /&gt;
* If there was an existing packet, make sure it is not marked as done - if so, abort&lt;br /&gt;
* Add the transmitted fragment to the (new or old) packet entry&lt;br /&gt;
* If the packet now has all fragments, mark it as done and decode it and pass it up to the application layer&lt;br /&gt;
* Leave the packet on the cache even if it was finished, in case any parts are retransmitted&lt;br /&gt;
* Expire old packets from the receive buffer after a timeout, or if the buffer is full&lt;br /&gt;
&lt;br /&gt;
== Dispatch Algorithm ==&lt;br /&gt;
&lt;br /&gt;
Fragment datagrams need to be dispatched intelligently, to spread the load on&lt;br /&gt;
network resources and maximise the chance that the receiver will get the message.&lt;br /&gt;
To do this, the dispatch algorithm should take into account several points:&lt;br /&gt;
&lt;br /&gt;
* Prioritize acknowledgements.&lt;br /&gt;
* If fragments are waiting to be sent to a number of hosts, do not send to the same host twice in a row. Alternating, or looping through the target hosts achieves the same data rate locally, but spreads out the load over downstream links.&lt;br /&gt;
* Do not exceed or approach the capacity of the local network connection. If a host has a 128 kb/s outbound bandwidth, dispatching 32 KB of data in one second will likely cause massive packet loss, leading to a retransmission.&lt;br /&gt;
* After considering the above points, prefer fragments that were queued recently to older packets. A LIFO or stack type approach means that even if a transmitter is becoming backed up, some fragments will get there on time, while others will be delayed. A FIFO approach would mean that a backed up host delivers every fragment late.&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
The recommended parameters for the reliability layer are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
MTU = 500 bytes&lt;br /&gt;
Transmit Retransmit Interval = 10 seconds&lt;br /&gt;
Transmit Packet Timeout / Expire = 26 seconds (allows for two retransmissions before expiry)&lt;br /&gt;
Receive Packet Expiry = 30 seconds (allows 10 seconds beyond final retransmission)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Performance Considerations ==&lt;br /&gt;
&lt;br /&gt;
Relatively low-level network implementations such as this are reasonably&lt;br /&gt;
complicated, but must operate fast. It is desirable to avoid runtime memory&lt;br /&gt;
allocations in network code as much as possible, and particularly at this level.&lt;br /&gt;
&lt;br /&gt;
It should be noted that in almost all cases, transmissions to &amp;quot;untested&amp;quot; nodes are&lt;br /&gt;
single fragment. Replies on the other hand are often larger, and may be deflated in&lt;br /&gt;
many fragments. This is optimal, because attempting to contact a node which may be&lt;br /&gt;
unavailable, involves a retransmission of only a single fragment.&lt;br /&gt;
&lt;br /&gt;
Flow control is an important topic, however, it is handled at a higher layer. The UDP&lt;br /&gt;
reliability layer is only responsible for guaranteeing delivery of selected datagrams.&lt;br /&gt;
&lt;br /&gt;
Only critical transmissions whose reception cannot otherwise be inferred, should have&lt;br /&gt;
the acknowledge request bit set.&lt;br /&gt;
&lt;br /&gt;
== Extension Proposal ==&lt;br /&gt;
&lt;br /&gt;
The following is still a proposoal, but since there is no G2 Development Forum where this can be discussed, I thought I would document it here. 05:07, 23 September 2012 (PDT)&lt;br /&gt;
&lt;br /&gt;
This extension ''should'' be '''totally backward compatible''' with existing implementations provided the above page specifications were strictly adhered to. Here it goes:&lt;br /&gt;
&lt;br /&gt;
Because acknowledgment messages can be lost in the way or arrive out of&lt;br /&gt;
order, it is best to include as much of the reception state as possible&lt;br /&gt;
so that the sending party can optimize retransmissions.&lt;br /&gt;
       &lt;br /&gt;
In order to do that, the following extensions to the original specifications&lt;br /&gt;
has been added by gtk-gnutella:&lt;br /&gt;
       &lt;br /&gt;
* '''Cumulative Acknowledgements''': when the flag '''0x10''' is set, it tells the other party that '''all''' the fragments up to '''nPart''' have been received.&lt;br /&gt;
       &lt;br /&gt;
* '''Extended Acknowledgments''': when the flag '''0x20''' is set, it tells the other party that an acknowledgment payload is present.  It immediately follows the header and is architected thusly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;          &lt;br /&gt;
 0               1               2               3&lt;br /&gt;
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7| Byte&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
|   nReceived   |                  missingBits                  | 0-3&lt;br /&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
'''nReceived''' is the total amount of parts successfully received so far.&lt;br /&gt;
          &lt;br /&gt;
'''missingBits''' is a bitfield that is read as a big-endian number and&lt;br /&gt;
which contains set bits for the parts still missing.  The ''base'' part number&lt;br /&gt;
is normally 0, unless flag '''0x10''' was set, in which case the '''nPart'''&lt;br /&gt;
value indicates the base.  The rule is then that if bit ''b'' is set,&lt;br /&gt;
then the fragment number ''b'' + ''base'' + 1 is still missing.&lt;br /&gt;
          &lt;br /&gt;
In the unlikely case where missingBits is too small to hold all the&lt;br /&gt;
missing parts, only the ones that can be represented are included, the&lt;br /&gt;
'''nReceived''' field being there to provide additional information.&lt;br /&gt;
          &lt;br /&gt;
Proper generation and parsing of the missingBits field is crucial, so to&lt;br /&gt;
remove any ambiguity, it is best to interpret missingBits as a number.&lt;br /&gt;
Then bit 0 is the bit corresponding to 2^0, bit ''n'' is the bit&lt;br /&gt;
corresponding to 2^n.&lt;br /&gt;
          &lt;br /&gt;
Bit 0 corresponds to fragment #1, unless the '''0x10''' flag was set.  In that&lt;br /&gt;
case, if for instance '''nPart''' is 3, then it means fragments #1, #2 and #3&lt;br /&gt;
were already received.  The base is therefore 3, and if bit 0 is set&lt;br /&gt;
in '''missingBits''', it means fragment #4 (0 + 3 + 1) is still missing.&lt;br /&gt;
&lt;br /&gt;
This extended acknowledgment lets the sending party optimize its&lt;br /&gt;
retransmissions even when some acknowledgments are lost.&lt;br /&gt;
&lt;br /&gt;
''Extended Acknowlegments'' are only useful when the total amount of fragments&lt;br /&gt;
is 3 or above.  Indeed, with only 2 fragments, the ''Cumulative Acknowledgment''&lt;br /&gt;
lets the receiving party know about the whole reception state.&lt;br /&gt;
&lt;br /&gt;
When the amount of fragments is 3 or more and only a&lt;br /&gt;
''Cumulative Acknowledgment'' &lt;br /&gt;
is sent out, it '''implicitly denies reception''' of any other&lt;br /&gt;
fragments.  This optimizes bandwidth since the 4 extra bytes sent out will&lt;br /&gt;
only be required for large messages (more than 2 fragments) in case fragments&lt;br /&gt;
are received out-of-order.&lt;/div&gt;</summary>
		<author><name>Ram</name></author>
	</entry>
</feed>