From 66e42b7ea35e795e2b839732b356f6b3ac1591a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tom=C3=A1=C5=A1=20Brada?= Date: Thu, 29 Oct 2015 19:39:06 +0100 Subject: [PATCH] interface for dht --- brodnetd.pas | 1 + dht.pas | 19 +++++++++++++++++++ opcode.pas | 1 + 3 files changed, 21 insertions(+) create mode 100644 dht.pas diff --git a/brodnetd.pas b/brodnetd.pas index b5a792d..9dc4df0 100644 --- a/brodnetd.pas +++ b/brodnetd.pas @@ -8,6 +8,7 @@ uses cthreads,ServerLoop ,Upload ,Download ,TestFS + ,dht ; BEGIN diff --git a/dht.pas b/dht.pas new file mode 100644 index 0000000..a30772b --- /dev/null +++ b/dht.pas @@ -0,0 +1,19 @@ +unit DHT; +{ + implementation of custom dht, based on pastry and kademlia. + keyspace is divided into buckets of limited capacity + node belongs to bucket, where at least 'depth' bits match 'prefix' +} + +{used by: messages, fileshare} + +INTERFACE +uses NetAddr; +type tPID=array [0..19] of byte; +var MyID:tPID; +procedure AddNode(const contact:tNetAddr); +procedure Get(const id:tPID; out result:array of tNetAddr); + +IMPLEMENTATION + +END. \ No newline at end of file diff --git a/opcode.pas b/opcode.pas index 673b1f4..ec2f3b1 100644 --- a/opcode.pas +++ b/opcode.pas @@ -7,6 +7,7 @@ const {dgram opcode} tccont=5; tceack=7; tcdata_no_report=8 unimplemented; + {10-16 reserver for dht} const {chat init} upFileServer=2; const {FS opcodes} -- 2.11.4.GIT