A presentation by Dr. Robin Upton (2008-11-02).
Available for download at www.altruists.org/ff1
Attribution – NonCommercial - ShareAlikewww.altruists.org
FF1: Friend2Friend Technical Overview
What is a Friend2Friend Network?
v1.0.1
What is a Friend2Friend (F2F) Network?
. Friend2Friend.net?
In Client-Server networks (Websites), unprivileged clients connect to more powerful servers.
C C C C C C C
S
In Peer2Peer networks (Napster, BitTorrent ...) users connect, sometimes via a central server, to random individuals (peers).
P
S P
PP
PP
P
P
In Friend2Friend networks, you connect yourself directly to known individuals (friends).
F
F F
F FF
Friend2Friend.net
. F2F Network
Home of an F2F system that ...
is XML-based;
has a GUI/SDK for FireFox;
is Free & Open Source;
is not yet working ;-)
is Extensible/scriptable in XSLT;
F2F Network
F2F Structure
f2f.RobinUpton.com
f2f.ekushey.org
f2f.honesty.org f2f.gifteconomy.org
f2f.re-cycle.org
Connections
Server-Server
Client-Server
f2f.emni.com.bd
Like WWW servers, F2F servers both send and receive data.
Unlike WWW, traffic is digitally signed, & packets travel between F2F servers in multiple hops.
F2F Structure
Client Structure
The F2F network is built from 2 sorts of node
'Client' Node
'Server' Node
Interaction with users
JS + Java Intermittent (on demand)
Data storage and communication
PHP + Java24/7
PurposeCodingAvailability
Client Structure
Server Structure
Human-readable
DOM
Machine- readable
DOM
Display
XMLJAVA
Decryption
Handle Events, clipboard etc.
The F2F client runs in a browser, managing traffic, making the HTML to show the user & responding to user interaction.
OutJAVA
Encryption
p9;45p[54t[po'kljh67O:M SEESuDETB6ED7iEuho DEDE ^Teu#'[hEB B GE& E7Unun KDUCe IunKDE{OccsdcscdK OKDEJ JLKJE LKDEED'@sdf 45r;oki4IOiJKkujYT-0345
p9;45p[54t[po'kljh:M0 SEESuDETB6ED7iEuhoEDE ^Teu#'[hEB B GE& E7Un emni09wd;lkjIU£'jk3e
In
<window:window> <section location=”top”> <icon:icon/> <f2f:tagline/> <f2f:login-box/> </section> <section location=”left”> <link id=”3”/> ... <link id=”5”/> </section> </window:window>
Server Structure
Soft Nodes
The F2F server is a tree of
nodes, called soft nodes.
/f2f
/f2f/users
/f2f/users/jim
/f2f/lib
/f2f/lib/demo
/f2f/users/tom
/f2f/lib/etc
/f2f/users/jim .../public
<f2f:message> 'bubble' around
the tree...
JAVA Decryption
p9;45p[54t[po'kljh67O:M SEESuDETB6ED7iEuho DEDE ^Teu#'[hEB B GE& E7Unu IunKDE{OccsdcscOKDELKJE LKDEED'@sdfKkujYT-0345;Incoming Outgoing
p9;45p[54t[po'kljh:M0 SEESuDETB6ED7iEuhoEDE ^Teu#'[hEB B GE& E7Un emni09wd;lkjIU£'jk3eJAVA
Encryption
...transformed by sets of XSD/XSLT
filters between nodes as they
do so.
Soft Nodes
Modules
Each soft node has...
(1) a namespace, identifying its type
http://friend2friend.net/modules/user
(3) a store of user data
(2) a unique path on that server
/f2f/users/jim
(4) the system's record of ongoing transactions
Soft nodes are installed from F2F modules. They are analagous to installed software.
/f2f/users/jim
default.xml
dynamic.xml
Modules
Message Structure
An F2F module has...
F2F Modules add extra functionality; they are analagous to software installers.
(5) An XSLT script for each service, display or filter
(3) A list of any services & displays it provides
(4) A list of filters it uses
(2) A schema to define its datatypes
(1) A unique namespace and matching digital signaturehttp://friend2friend.net/modules/user
Message Structure
Bubbling Messages
<f2f:message type=“down”>
<f2f:message>
<f2f:to node= “/f2f/users/tom”>
<f2f:from node= “/f2f/users/jim” thread= ”2” sreq=”6” >
<f2f:data>
... Any XML, (typically <f2f:servicereq... >)
</f2f:data>
/f2f/users
/f2f/users/jim
/f2f/users/tom
Thread #2
XX MM
LL
Between F2F servers, <f2f:messages> are encrypted and signed.
Bubbling Messages
Receiving Messages
On receipt of data from the outside...
1) The F2F server uses its private key to produce a decrypted <f2f:message>
2) If this does not have a valid <f2f:to> address, discard it.
Else bubble the <f2f:message> from root
To bubble <f2f:message> from a softnode:
1) If it is at the node specified in <f2f:to>, receive the <f2f:message> here. Else:
2) Execute any filters which apply to the message.
3) If <f2f:to> is an external address, and here is root, send out the message
Else move the resulting message one node towards <f2f:to> and bubble
Receiving Messages
Crunching Threads
1) Create a new <f2f:thread>, setting
<f2f:from> = the <f2f:from> item of the <f2f:message><f2f:data> = the <f2f:data> item of the <f2f:message>
2) Crunch this thread.
To receive <f2f:message> at a soft node:
Crunching Threads
Finishing Threads
1) If <f2f:data> contains no active <f2f:servicereq> items, finish <f2f:thread> here.
Else execute the next active <f2f:servicereq> in <f2f:thread> here,
then crunch <f2f:thread> here...
To crunch <f2f:thread> at a soft node:
Finishing Threads
To finish <f2f:thread> at a soft node:
1) Create a new <f2f:message>, setting
@type = “term”<f2f:to> = the
<f2f:from> of this <f2f:thread><f2f:from> = this node's address
<f2f:data> = the <f2f:data> of this <f2f:thread>
2) Remove this <f2f:thread>
3) Bubble this <f2f:message>
Executing <f2f:servicereq>
Executing <f2f:servicereq>
Rerouting <f2f:servicereq>
To execute <f2f:servicereq> in <f2f:thread> at a soft node:
1) Look up @function in this node's table of addresses
2) If it is not present, fail.
Elseif this address is elsewhere, reroute <f2f:servicereq> to that address
Else process <f2f:servicereq> in <f2f:thread> here
Rerouting <f2f:servicereq>
Processing <f2f:servicereq>
To reroute <f2f:servicereq> at a soft node to another soft node:
1) Create a new <f2f:message> item, setting
@type = “down” <f2f:to> = the other node's address<f2f:from> = this node's address<f2f:data> = the <f2f:servicereq>
2) Bubble this <f2f:message>
Processing <f2f:servicereq>
To process <f2f:servicereq> in <f2f:thread> at a soft node:
1) Carry out any pre-processing directives on <f2f:servicereq>
2) If @function is a core service, pass <f2f:servicereq> to the appropriate PHP() call
Else apply the appropriate .XSLT to <f2f:servicereq>
3) Carry out any post-processing directives on the data returned by 2)
4) Remove <f2f:servicereq> from <f2f:thread> and replace it by the output of 3)
. All you need to know to start coding...
All you need to know to start coding...
Key Aspects
<random-xml-parent included="for clarity's sake"><f2f:servicereq name=”http://example.org/f2f”>
... optional XML children here ...</f2f:servicereq>
</random-xml-parent>
<random-xml-parent included="for clarity's sake"><example:result xmlns:example=”http://example.org/f2f”>
... some block of XML data here, maybe ...</example:result>
</random-xml-parent>
Key Aspects
XML for all data exchange.
Strong Cryptography secures all internet traffic.
Non-hierarchical system architecture.
XSLT-based scripting language.
FF F
F FF
Volunteers please contact http://friend2friend.net