<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://g2.doxu.org/index.php?action=history&amp;feed=atom&amp;title=Packet_Structure</id>
	<title>Packet Structure - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://g2.doxu.org/index.php?action=history&amp;feed=atom&amp;title=Packet_Structure"/>
	<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=Packet_Structure&amp;action=history"/>
	<updated>2026-05-25T01:33:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://g2.doxu.org/index.php?title=Packet_Structure&amp;diff=1636&amp;oldid=prev</id>
		<title>Dcat: /* The Control Byte */ better visual bit format</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=Packet_Structure&amp;diff=1636&amp;oldid=prev"/>
		<updated>2005-05-01T02:52:26Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;The Control Byte: &lt;/span&gt; better visual bit format&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 02:52, 1 May 2005&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l110&quot;&gt;Line 110:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 110:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;nowiki&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;nowiki&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Bit &lt;/del&gt;7 Bit &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;0&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;+----+----+----+----+----+----+----+----+&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| &lt;/ins&gt;7 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;   6  | 5    4    3  | 2  | 1  | 0  | &lt;/ins&gt;Bit&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;+----+----+----+----+----+----+----+----+&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| Len_Len | Name_Len - 1 | CF | BE | // |&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| Len_Len | Name_Len - 1 | CF | BE | // |&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;+----+----+----+----+----+----+----+----+&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/nowiki&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/nowiki&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Dcat</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=Packet_Structure&amp;diff=831&amp;oldid=prev</id>
		<title>Spooky at 22:25, 2 April 2005</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=Packet_Structure&amp;diff=831&amp;oldid=prev"/>
		<updated>2005-04-02T22:25:21Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:25, 2 April 2005&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[UDP_Transceiver |&amp;lt;&amp;lt; UDP Transceiver]] | [[Datatypes|Datatypes &gt;&gt;]] | [[Main_Page|Main Page]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Introduction ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Introduction ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Spooky</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=Packet_Structure&amp;diff=75&amp;oldid=prev</id>
		<title>Kath: /* Introduction */</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=Packet_Structure&amp;diff=75&amp;oldid=prev"/>
		<updated>2005-03-27T16:48:55Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Introduction&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:48, 27 March 2005&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l10&quot;&gt;Line 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The concept can be compared to an XML document tree. The &amp;quot;packets&amp;quot; are&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The concept can be compared to an XML document tree. The &amp;quot;packets&amp;quot; are&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;elements, which can in turn contain zero or more child elements (packets). The&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;elements, which can in turn contain zero or more child elements (packets). The&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;payload of a packet is like the attributes of an XML element. However serializing XML&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;payload of a packet is like the attributes of an XML element. However&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;serializing XML&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;has a lot of overhead due to all the naming, even in a compact binary form. The&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;has a lot of overhead due to all the naming, even in a compact binary form. The&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Gnutella2 packet structure makes a compromise: it names elements (packets),&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Gnutella2 packet structure makes a compromise: it names elements (packets),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;allowing them to be globally recognized and understood without knowledge of their&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;allowing them to be globally recognized and understood&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;without knowledge of their&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;format - and stores attributes as binary payloads, requiring knowledge of their&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;format - and stores attributes as binary payloads, requiring knowledge of their&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;content to parse them.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;content to parse them.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Kath</name></author>
	</entry>
	<entry>
		<id>https://g2.doxu.org/index.php?title=Packet_Structure&amp;diff=36&amp;oldid=prev</id>
		<title>Dcat at 17:20, 19 March 2005</title>
		<link rel="alternate" type="text/html" href="https://g2.doxu.org/index.php?title=Packet_Structure&amp;diff=36&amp;oldid=prev"/>
		<updated>2005-03-19T17:20:57Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
All Gnutella2 communications are represented with Gnutella2 lightweight tree&lt;br /&gt;
packets. This applies everywhere from TCP stream communications to reliable UDP&lt;br /&gt;
transmissions to HTTP packet exchanges (where protocol data has been negotiated).&lt;br /&gt;
Each tree packet may contain meaningful payload data and/or one or more child&lt;br /&gt;
packets, allowing complex document structures to be created and extended in a&lt;br /&gt;
backward compatible manner.&lt;br /&gt;
&lt;br /&gt;
The concept can be compared to an XML document tree. The &amp;quot;packets&amp;quot; are&lt;br /&gt;
elements, which can in turn contain zero or more child elements (packets). The&lt;br /&gt;
payload of a packet is like the attributes of an XML element. However serializing XML&lt;br /&gt;
has a lot of overhead due to all the naming, even in a compact binary form. The&lt;br /&gt;
Gnutella2 packet structure makes a compromise: it names elements (packets),&lt;br /&gt;
allowing them to be globally recognized and understood without knowledge of their&lt;br /&gt;
format - and stores attributes as binary payloads, requiring knowledge of their&lt;br /&gt;
content to parse them.&lt;br /&gt;
&lt;br /&gt;
Thus the element (packet or child packet) is the finite unit of comprehension. This&lt;br /&gt;
system provides an excellent trade-off between format transparency and&lt;br /&gt;
compactness.&lt;br /&gt;
&lt;br /&gt;
== Fictitious Visual Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
+ Query Hit Packet&lt;br /&gt;
|&lt;br /&gt;
|-+ Node ID (standard)&lt;br /&gt;
|&lt;br /&gt;
|-+ Server Status (standard)&lt;br /&gt;
| \-+ Shareaza Server Status (private extension)&lt;br /&gt;
|&lt;br /&gt;
|-+ Hit Object&lt;br /&gt;
| |-+ URN (standard)&lt;br /&gt;
| |-+ Descriptive name (standard)&lt;br /&gt;
| | \-+ Alternate name list (extension)&lt;br /&gt;
| |-+ URL (standard)&lt;br /&gt;
| |-+ Priority indicator (private extension)&lt;br /&gt;
| | \-+ Digital signature (private)&lt;br /&gt;
| |-+ Alternate source summary (standard)&lt;br /&gt;
| \-+ Available ranges (standard)&lt;br /&gt;
| . \-+ Estimated completion time (private extension)&lt;br /&gt;
|&lt;br /&gt;
|-+ Selective digital signature (private)&lt;br /&gt;
|&lt;br /&gt;
\-+ Routing tags&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contents ==&lt;br /&gt;
&lt;br /&gt;
Each Gnutella2 packet contains:&lt;br /&gt;
&lt;br /&gt;
* Control flags&lt;br /&gt;
* A type name meaningful in the namespace of the packet's parent or context&lt;br /&gt;
* A length (or implied length)&lt;br /&gt;
* Payload data of a format specific to the packet type name and namespace&lt;br /&gt;
* Child packets existing in the namespace of this packet&lt;br /&gt;
&lt;br /&gt;
== Namespace Considerations ==&lt;br /&gt;
&lt;br /&gt;
Each packet contains a relative type name of up to 8 bytes in length, which are case&lt;br /&gt;
sensitive. The packet type name is meaningful only in the namespace of the packet's&lt;br /&gt;
parent, or in the absence of a parent, the context of the packet (e.g. root level TCP&lt;br /&gt;
stream).&lt;br /&gt;
&lt;br /&gt;
This means that, for example a packet &amp;quot;A&amp;quot; inside packet &amp;quot;X&amp;quot; is different to a packet&lt;br /&gt;
&amp;quot;A&amp;quot; inside packet &amp;quot;Y&amp;quot;. Packets are of the same type only if their fully qualified&lt;br /&gt;
absolute type names are equal.&lt;br /&gt;
&lt;br /&gt;
As a convention, when discussing packet type names, they will be noted in their&lt;br /&gt;
absolute form with a URL style slash (/) separating each level. In the above example,&lt;br /&gt;
the first packet is &amp;quot;/X/A&amp;quot; while the second is &amp;quot;/Y/A&amp;quot;. It is clear now that the packets&lt;br /&gt;
are of different types.&lt;br /&gt;
&lt;br /&gt;
Packet type names can contain from 1 to 8 bytes inclusive, and none of these bytes&lt;br /&gt;
may be a null (0). Community approved packets are by convention named with&lt;br /&gt;
uppercase characters and digits, for example &amp;quot;PUSH&amp;quot;. Private packet types are by&lt;br /&gt;
convention named with lowercase characters and digits, prefixed with the vendor&lt;br /&gt;
code of the owner, for example &amp;quot;RAZAclr2&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Framing ==&lt;br /&gt;
&lt;br /&gt;
Packets are encoded with a single leading control byte, followed by one or more&lt;br /&gt;
bytes of packet length, followed by one or more bytes of packet name/ID, followed&lt;br /&gt;
by zero or more child packets (framed the same way), followed by zero or more&lt;br /&gt;
bytes of payload:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
| Control | Length_| Name___ | children and/or payload |&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All packets can contain a payload only, children and a payload, children only, or&lt;br /&gt;
nothing at all. The total length of the packet header (control, length and type name)&lt;br /&gt;
cannot exceed 12 bytes and cannot be less than 2 bytes.&lt;br /&gt;
&lt;br /&gt;
=== The Control Byte ===&lt;br /&gt;
&lt;br /&gt;
The control byte is always non-zero. A zero control byte identifies the end of a&lt;br /&gt;
stream of packets, and thus has special meaning. It should not be used in root&lt;br /&gt;
packet streams (which do not end).&lt;br /&gt;
Control bytes have the following format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Bit 7 Bit 0&lt;br /&gt;
| Len_Len | Name_Len - 1 | CF | BE | // |&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Len_Len is the number of bytes in the length field of the packet, which immediately follows the control byte. There are two bits here which means the length field can be up to 3 bytes long. Len_Len? can be zero if the packet has zero length (no children and no payload), in which case there is no need to encode the length.&lt;br /&gt;
* Name_Len is the number of bytes in the packet name field MINUS ONE, which follows the packet length field. There are three bits here which means that packet names can be 1 to 8 bytes long inclusive. Because a 0 here equates to one byte of name, unnamed packets are not possible.&lt;br /&gt;
* The three least significant bits of the control byte are reserved for flags. They have the following meanings:&lt;br /&gt;
* CF is the compound packet flag. If this bit is set, the packet contains one or more child packets. If not set, the packet does not contain any child packets. If the packet is of zero length, this flag is ignored.&lt;br /&gt;
* BE is the big-endian packet flag. If set, all multi-byte values encoded in the packet and its children are encoded in big-endian byte order - including the length in the packet header.&lt;br /&gt;
* Other bits are reserved.&lt;br /&gt;
&lt;br /&gt;
=== The Length Field ===&lt;br /&gt;
&lt;br /&gt;
The length field immediately follows the control byte, and can be 0 to 3 bytes long.&lt;br /&gt;
Length bytes are stored in the byte order of the packet.&lt;br /&gt;
&lt;br /&gt;
The length value includes the payload of this packet AND any child packets in their&lt;br /&gt;
entirety. This is obviously needed so that the entire packet can be detected and&lt;br /&gt;
acquired from a stream. The length does not include the header (control byte,&lt;br /&gt;
length, and name). The length field precedes the name field to allow it to be read&lt;br /&gt;
faster from a stream when acquiring packets.&lt;br /&gt;
&lt;br /&gt;
The length field is in the byte order of the root packet.&lt;br /&gt;
&lt;br /&gt;
=== The Type Name Field ===&lt;br /&gt;
&lt;br /&gt;
The type name field immediately follows the length bytes, and can be from 1 to 8&lt;br /&gt;
bytes long. Its format is detailed in the previous section entitled &amp;quot;Namespace&lt;br /&gt;
Considerations&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Child Packets ===&lt;br /&gt;
&lt;br /&gt;
Child packets are only present if the &amp;quot;compound packet bit&amp;quot; is set in the control byte.&lt;br /&gt;
If set, there is one or more child packet immediately following the end of the header.&lt;br /&gt;
These child packets are included in the total length of their parent (along with the&lt;br /&gt;
payload, which follows the child packets after a packet stream terminator).&lt;br /&gt;
&lt;br /&gt;
Child packets are framed exactly the same way, with a control byte, length, name,&lt;br /&gt;
children and/or payload. When the compound bit is set and the packet is not of zero&lt;br /&gt;
length, the first child packet must exist. Subsequent child packets may also exist, and&lt;br /&gt;
are read in sequentially in the same way that they are read from a root packet&lt;br /&gt;
stream. The end of the child packet stream is signalled by the presence of a zero&lt;br /&gt;
control byte, OR the end of the parent packet's length (in which case there is no&lt;br /&gt;
payload). Including a terminating zero control byte when there is no payload is still&lt;br /&gt;
valid, but unnecessary.&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
&lt;br /&gt;
Payload may exist whenever the length field is non-zero. However, if the compound&lt;br /&gt;
bit is set, one or more child packets must be read before the payload is reached. If&lt;br /&gt;
there is no packet left after the end of the last child, there is no payload.&lt;br /&gt;
&lt;br /&gt;
=== Notes on the Control Byte ===&lt;br /&gt;
Note that there are a number of &amp;quot;marker packet types&amp;quot;, which have no children or&lt;br /&gt;
payload. It is desirable to encode these in as small a space as possible, which means&lt;br /&gt;
omitting the length field and setting the len_len bits to zero in the control byte. This&lt;br /&gt;
creates a potential conflict, as the control byte itself may be zero if the type name is&lt;br /&gt;
one byte long - and as noted above, a zero control byte has special meaning (end of&lt;br /&gt;
packet stream). This must be avoided; luckily it is perfectly legal to set the&lt;br /&gt;
compound packet flag (CF) on zero length packets, thus producing a non-zero&lt;br /&gt;
control byte and the most compact packet possible.&lt;br /&gt;
&lt;br /&gt;
The compound packet bit MUST be checked when decoding every packet. It should&lt;br /&gt;
be done in low-level decoding code to avoid accidental omission. Do not assume that&lt;br /&gt;
a packet will not have children - it might not now, but no packets are sterile.&lt;br /&gt;
Anything could be augmented or extended in some unknown way in the future. If&lt;br /&gt;
you are not interested in children, skip them (which is easy, you don't even need to&lt;br /&gt;
recurs through their children).&lt;br /&gt;
&lt;br /&gt;
=== Simple Packet Decoder in C ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
BYTE nInput = ReadNextByte();&lt;br /&gt;
&lt;br /&gt;
if ( nInput == 0 ) return S_NO_MORE_CHILDREN;&lt;br /&gt;
&lt;br /&gt;
BYTE nLenLen = ( nInput &amp;amp; 0xC0 ) &amp;gt;&amp;gt; 6;&lt;br /&gt;
BYTE nTypeLen = ( nInput &amp;amp; 0x38 ) &amp;gt;&amp;gt; 3;&lt;br /&gt;
BYTE nFlags = ( nInput &amp;amp; 0x07 );&lt;br /&gt;
&lt;br /&gt;
BOOL bBigEndian = ( nFlags &amp;amp; 0x02 ) ? TRUE : FALSE;&lt;br /&gt;
BOOL bIsCompound = ( nFlags &amp;amp; 0x04 ) ? TRUE : FALSE;&lt;br /&gt;
&lt;br /&gt;
ASSERT( ! bBigEndian );&lt;br /&gt;
&lt;br /&gt;
DWORD nPacketLength = 0;&lt;br /&gt;
&lt;br /&gt;
ReadBytes( (BYTE*)&amp;amp;nPacketLength, nLenLen );&lt;br /&gt;
&lt;br /&gt;
CHAR szType[9];&lt;br /&gt;
ReadBytes( (BYTE*)szType, nTypeLen + 1 );&lt;br /&gt;
szType[ nTypeLen + 1 ] = 0;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dcat</name></author>
	</entry>
</feed>