Disclaimer

This article does not contain any kind of introduction and may not be easy to understand without studying the source code. Please contact me via email (mentioned at the bottom of the page) if you are interested in details.

TBD: add an introduction and describe entity types, packet types and so on.

Brief description of the protocol

  • It's connection oriented, which means that data exchange is reliable, sequenced and non-duplicated. In order to achieve that, TCP is used as a transport protocol. Peers handshake before sending entities, peers send an acknowledgment after successful delivery.
  • It's binary, which means that packets contain binary data structures rather than text strings.
  • Protocol connections are multiplexed - all communication between two peers is performed through one TCP connection.
  • Packet exchange is synchronous - a peer sends one packet and waits for response before sending another packet. The only exception to this rule is the handshaking process, where packet exchange is asynchronous.

Peer states

The image below represents the state diagram of some peer from the local peer view.

peer statechart View in full resolution.

The source of the scheme can be opened and edited in Dia.

Sequence diagrams

Handshaking between two peers :
Handshaking

Publishing new entities :
Publishing

Algorithms

Processing advertisement :
Flowchart
View in full resolution.

Processing incoming entities :
Flowchart
View in full resolution.

Processing list of pending entities :
Flowchart
View in full resolution.

Processing user :
Flowchart

Processing message :
Flowchart
View in full resolution.

Processing operation :
Flowchart
View in full resolution.

Advertising user :
Flowchart
View in full resolution.

Advertising message :
Flowchart
View in full resolution.

Advertising operation :
Flowchart
View in full resolution.

Sources

The sources of the schemes are available here.