<?xml version="1.0"?>
<!DOCTYPE content [ <!ENTITY nbsp " "> ]>
<rdf:RDF xml:base="http://snarfed.org/rdf"
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/dc/elements/1.1/">

<rdf:Description rdf:about="http://snarfed.org">
  <dc:title> snarfed.org  </dc:title>
  <dc:description> draw group stream of consciousness </dc:description>
  <dc:creator> Ryan Barrett &lt;snarfed at ryanb dot org&gt; </dc:creator>
  <dc:language> en </dc:language>
  <dc:format> text/html </dc:format>
  <dc:rights> Copyright 2002-2007 Ryan Barrett </dc:rights>
</rdf:Description>

<rdf:Description rdf:about="http://snarfed.org/space/windows%20p2p">
  <dc:title> windows p2p </dc:title>
  <dc:creator> Ryan Barrett &lt;snarfed at ryanb dot org&gt; </dc:creator>
  <dc:date> 2003-01-01T05:00:00Z </dc:date>
  <dc:language> en </dc:language>
  <dc:format> text/html </dc:format>
  <dc:rights> Copyright 2002-2007 Ryan Barrett </dc:rights>

  <content>
    <p>Disclaimers: these images are taken from a <a href="http://www.microsoft.com/technet/prodtechnol/winxppro/deploy/p2pintro.mspx">Microsoft
article</a>,
so they're probably copyrighted by Microsoft. They're <em>not</em> mine.
:P</p>

<p><a href="http://www.microsoft.com/technet/prodtechnol/winxppro/deploy/p2pintro.mspx"><img src="/space/p2p.png" alt="/space/p2p.png" title="" /></a></p>

<p>About a year ago, Microsoft quietly announced that they were developing a
peer-to-peer networking protocol. It's not a file sharing program, mind you;
it's a network routing protocol. It's called, unimaginatively, <a href="http://www.microsoft.com/windowsxp/p2p/">Windows Peer to
Peer Networking</a>. Since late March
2004, I've been working on implementing this protocol. I'd like to create an
interoperable library for use on other operating systems, such as Mac OS X and
Linux, as well as Windows.</p>

<p>The proof-of-concept app for this protocol is
<a href="http://www.threedegrees.com/">Threedegrees</a>, a social interaction program that
lets people send instant messages, share a browser and a music player, and
interact in various other ways. More importantly, this protocol will be a
fundamental part of
<a href="http://msdn.microsoft.com/Longhorn/understanding/pillars/Indigo/default.aspx">Indigo</a>,
the networking infrastructure in the
<a href="http://www.microsoft.com/windowsvista/">Vista</a> platform.</p>

<p><a href="http://www.microsoft.com/technet/prodtechnol/winxppro/deploy/p2pintro.mspx"><img src="/space/stack.png" alt="/space/stack.png" title="" /></a></p>

<p>In a nutshell, Windows P2P uses a <a href="http://www.infoanarchy.org/wiki/wiki.pl?Distributed_Hash_Table">distributed hash
table</a> for name
resolution, with some interesting quirks. It includes decent mechanisms for
creating, maintaining, and broadcasting to small groups of peers. It uses
<a href="http://www.ipv6.org/">IPv6</a> as its underlying transport, with
<a href="http://www.6bone.net/6bone_6to4.html">6to4</a> and
<a href="http://www.microsoft.com/technet/prodtechnol/winxppro/maintain/teredo.mspx">Teredo</a>
for traversing NATs and the IPv4 Internet. It also includes security and
authentication. Compared to other related work, all of these are solidly
designed. Specifically, most of the new ideas are in the DHT implementation,
which they call a Peer Name Resolution Protocol (PNRP).</p>

<p>There are lots of technical details in the <a href="http://www.microsoft.com/technet/prodtechnol/winxppro/deploy/p2pintro.mspx">white
paper</a>,
the <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/p2psdk/p2p/portal.asp">API
docs</a>,
and the
<a href="http://download.microsoft.com/download/8/C/1/8C1A2CB7-5F1C-4A66-9044-AAE94FCC25FC/P2P_SDK_FAQ.htm">FAQ</a>.
(These pictures are taken from the white paper; they're Microsoft's, not mine.)
Amusingly, there's also a lot of deep technical information in Microsoft's
<a href="http://swpat.ffii.org/pikta/txt/ep/1248/441/">patent filing</a> for PNRP,
including some details that aren't published anywhere else. Unfortunately, the
network protocol itself is proprietary, so I need to reverse engineer it from
network traces obtained with a sniffer.</p>

<p>This is where I am right now. I've written a decent amount of code before, but
I've done more or less zero reverse engineering of network protocols.
Furthermore, there aren't a lot of resources. It's definitely been done before -
examples include instant messaging protocols such as
<a href="http://www.venkydude.com/articles/yahoo.htm">Yahoo</a>,
<a href="http://www.kingant.net/oscar/">Oscar</a> (which AIM and ICQ now use), and
<a href="http://www.hypothetic.org/docs/msn/index.php">MSN</a>. However, these focus on
describing the protocols themselves, not the methodologies used to reverse
engineer them. If you know of good resources on reverse engineering network
protocols, or you'd like to help, <a href="/space/about">let me
know</a>!</p>

<p><a href="http://www.microsoft.com/technet/prodtechnol/winxppro/deploy/p2pintro.mspx"><img src="/space/cache.png" alt="/space/cache.png" title="" /></a></p>

<p>As an aside, I got sidetracked from the reverse engineering one day, and wrote
an implementation of the PNRP multi-level cache. You can download the
<a href="/space/pnrp.py">code</a> and a <a href="/space/pnrp_unittest.py">unit
test</a>. (The multi-level cache is
specifically covered by their patent, but this code isn't in the context of name
resolution, so I'm not too worried. :P)</p>

<p>Finally, this usually is (and should be) legal. Reverse engineering is expressly
permitted under the right of "fair use" established by copyright law. <a href="http://www.eff.org/IP/Emulation/">Recent
rulings</a> have eroded this right with respect
to software; specifically, they have held that software publishers can withhold
this right in "shrinkwrap" or click-through licenses. I don't know if
Microsoft's license for Windows P2P forbids reverse engineering, but I'm not
inclined to find out.</p>

<p>See also:</p>

<ul>
<li><a href="/space/p4">p4</a></li>
<li><a href="/space/synchronizing mp3 playback">synchronizing mp3 playback</a></li>
<li><a href="/space/libmsntp">libmsntp</a></li>
</ul>

  </content>

  <rdf:Seq>

<rdf:li>
<rdf:Description rdf:about="#1169663370.28">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> windows p2p </dc:title>
  <dc:creator> Radi0ShacK </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Hey,<br />
I was just wondering have you found any info on how to reverse engineer a proprietary network protocol?<br />
Thanks in advance
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1169748872.15">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> windows p2p </dc:title>
  <dc:creator> Ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    hi radioshack! sorry, no, i haven't worked on this in a long time.
  </content>
</rdf:Description>
</rdf:li>

  </rdf:Seq>
</rdf:Description>
</rdf:RDF>
