summaryrefslogtreecommitdiff
path: root/draft-schanzen-r5n.xml
diff options
context:
space:
mode:
Diffstat (limited to 'draft-schanzen-r5n.xml')
-rw-r--r--draft-schanzen-r5n.xml65
1 files changed, 28 insertions, 37 deletions
diff --git a/draft-schanzen-r5n.xml b/draft-schanzen-r5n.xml
index 822be85..9616638 100644
--- a/draft-schanzen-r5n.xml
+++ b/draft-schanzen-r5n.xml
@@ -489,7 +489,7 @@ see how we can offer even the most minimal protections against peer
489 R5N stores the information of all connected peers in a a set of lists 489 R5N stores the information of all connected peers in a a set of lists
490 similar to the k-buckets data structure of <xref target="Kademlia"/>. 490 similar to the k-buckets data structure of <xref target="Kademlia"/>.
491 The index which determines in which of the k lists to add a given peer 491 The index which determines in which of the k lists to add a given peer
492 is calculated using the FIND-BUCKET procedure (see <xref target="find-bucket"/>. 492 is calculated using the <tt>FindBucket</tt> procedure.
493 </t> 493 </t>
494 <t> 494 <t>
495 The buckets serve implicitly as a routing table for messages: 495 The buckets serve implicitly as a routing table for messages:
@@ -515,42 +515,33 @@ PEER-SELECT(key, bloomfilter)
515END 515END
516 ]]></artwork> 516 ]]></artwork>
517 </figure> 517 </figure>
518 <t> 518 <t>
519 The procedure to determine if we are the closest know peer for a given 519 R5N requires the following procedures for its routing table:
520 message key and bloomfilter is defined as follows: 520 </t>
521 </t> 521 <dl>
522 <figure anchor="find-bucket"> 522 <dt><tt>FindBucket(PeerID, Key) -> k-bucket</tt></dt>
523 <artwork name="" type="" align="left" alt=""><![CDATA[ 523 <dd>
524FIND-BUCKET(peerID, key, kbuckets) 524 The <tt>FindBucket</tt> procedure determines how many low
525 N := MATCHING-BITS (peerID, key) 525 order bits succesively match between a <tt>PeerID</tt> and a
526 return Nth bucket FROM kbuckets 526 <tt>Key</tt> starting from the first bit. The procedure returns
527END 527 the k-bucket for this index. It contains all connected nodes which
528 ]]></artwork> 528 share the same prefix length with <tt>PeerID</tt>.
529 </figure> 529 </dd>
530 <t>The FIND-BUCKET Procedure.</t> 530 <dt><tt>GetDistance(NodeKey_A, NodeKey_B)</tt></dt>
531 <figure> 531 <dd>
532 <artwork name="" type="" align="left" alt=""><![CDATA[ 532 FIXME: We do NOT do XOR here. We do some kind of
533AM-CLOSEST-PEER(key, peerID, bloomfilter, buckets) 533 fancy calculation. See get_distance()
534 closestPeersBucket := FIND-BUCKET (myPeerID, key, buckets) 534 </dd>
535 IF key == myPeerID 535 <dt><tt>AmClosestNode(NodeID, Key, Bloom) -> true | false</tt></dt>
536 return TRUE 536 <dd>
537 END 537 This procedure first determines which k-bucket contains the
538 myDistance := XOR(peerID, key) 538 closest node IDs to <tt>Key</tt>.
539 FOR EACH p IN closestPeersBucket 539 Any node IDs which match the bloom filter are not considered.
540 IF XOR(p, key) < myDistance 540 If there is a node ID <tt>NodeID'</tt> in the k-bucket where
541 return FALSE 541 <tt>GetDistance(NodeID, Key) > GetDistance(NodeID', Key)</tt>,
542 END 542 then <tt>false</tt> is returned, otherwise <tt>true</tt>.
543 XOR(p, key) == myDistance 543 </dd>
544 return TRUE 544 </dl>
545 END
546 END
547 return TRUE
548END
549 ]]></artwork>
550 </figure>
551 <t>The AM-CLOSEST-PEER Procedure.</t>
552
553
554 </section> 545 </section>
555 </section> 546 </section>
556 <section anchor="p2p_messages" numbered="true" toc="default"> 547 <section anchor="p2p_messages" numbered="true" toc="default">