The Genny Distributed Networking Protocol

Introduction Material:

Copyright:

Copyright (c) 2000 Tom Goulet.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is in the file GNU-FDL in this directory.

Introduction:

Genny was designed a replacement to Gnutella. It is a small, versatile broadcast/reply based network implemented over UDP/IP.

Messages are Broadcasted throughout the network with the help of propogating Servants. Servants may then Reply to the Broadcasts, which are routed in the reverse paths of their Broadcasts, thus returning information. Replies to Replies are also possible.

This document specifies version 0.8 of the Genny protocol.

Genny also supports user-defined Services. Anyone can conceive of, code, and use their own Genny Service.

Lingo:

Here are a bunch of terms I use in the document below and brief explanations (which are hopefully all that is needed). You may want to only refer to this section on demand.

Connecting and Disconnecting:

Connecting:

The initiator sends a simple handshake string, 'GENNY CONNECT/0.8\n\n'. The acceptor returns a simple welcome string, 'GENNY OK\n\n'. After that it's all Packets. There must not be any Packets sent until the the Welcome has been received.

Disconnecting:

The disconnector sends: 'GENNY DISCONNECT\n\n' or 'GENNY DISCONNECT\nOptional Reason Goes here\n\n'. The disconnected does not acknowledge. Packets must no longer be sent.

Packet Description:

Packets are made of a Header and an optional Payload.

Header Description:

Bytes 0-3: Client Identifier
This is the Node Identifier of the Broadcasting Servant. With the Broadcast Identifier the Client Identifier can be used to distinguish between different Broadcasts. The Client Identifier can also be used to distinguish between different ReReplies. It is also used by each Servant to remember the Interface the Packet was received on.

Bytes 4-7: Server Identifier
This is the Node Identifier of the Replying Servant. The Server Identifier can be to distinguish between different Replies. It is also used by each Servant to remember the Interface the Packet was received on.

Byte 8: Broadcast Identifier
This is a number decided by the Broadcasting Servant. The Broadcast Identifier must be different for each Broadcast the Servant Broadcasts (the Broadcast Identifiers have a timeout). The Broadcast Identifier can be used with the Client Identifier to distinguish between different Broadcasts.

Byte 9: Time To Live/(Re)Reply Indicator
This byte does double duty. A Time To Live of 255 indicates the Packet is a Reply, a Time To Live of 254 indicates the Packet is a ReReply. All other Time To Lives indicator Broadcast Packets. The Time To Live of Broadcasts are decremented on each hop to prevent eternal propogation.

Bytes 10-11: Service Number
The Service Number shows which Service the Packet is of. It is an unsigned integer in network byte order.

Payload description:

The content and length of a Payload are different according to the Service. See below for possible Services and their Payloads.

Packet Routing:

Packets are routed using their Client Identifer, Server Identifier, Broadcast Identifier and Time To Live/(Re)Reply Indicator.

A Broadcast:
A Servant puts its Node Identifier in the Client Identifier bytes of the Header then Broadcasts the Packet. A Broadcast Packet is reBroadcasted by each Node until there are no more places to Broadcast to or until the Time To Live is zero. All Servants that see the Broadcast associate the Client Identifer with the Interface the Packet was received on.

A Reply:
A Servant takes the Client Identifier from a Broadcast it previously received and puts that in the Client Identifier of the Packet. The Servant also puts its Node Identifier in the Server Identifier bytes of the Packet. A Reply Packet is sent through the Interface that is associated with the Client Identifier by each Servant on the route until it gets to the Servant whose Node Identifier matches the Client Identifier (the Servant that sent the Broadcast). The Client Identifier of a Packet is a to for Reply Packets.

A ReReply:
A Servant puts its own Node Identifier in the Client Identifier bytes of the Packet. The Servant also takes the Server Identifier from a Reply it previously received and puts that in the Server Identifier bytes of the Packet. A ReReply Packet is sent through the Interface that is associated with the Server Identifier by each Servant on the route until it gets to the Servant whose Node Identifier matches the Server Identifier (the Servant that sent the Reply). The Server Identifier of a Packet is a to for ReReply Packets.

Notes:
Any number of Replies may be sent once the Client Identifier is known, and order relative to other Packets is irrelevant. The same for ReReplies and Server Identifiers. Packets of the Control Service are not routed at all. Services that a Servant does not recognise should not be routed.

Handling Services:

A Service is a protocol of its own that uses the Genny protocol. Any Service that is feasible within the limitations of the Genny protocol can be written, coded and used.

A Genny Servant must support the Control and Info Services. All others are voluntary.

A Servant will typically hand the packet and the remote address off to a subfunction or possibly another process to be handled there. that a Servant does not recognise should not be routed.

All Services are described in separate documents.

Ending Material:

Credits:

Discussion:

If you made it this far and you're still interested, see GnutellaDev: Discuss for chat and a mailing list, or e-mail tomg@nova.yi.org.