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.
'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.
'GENNY DISCONNECT\n\n'
or
'GENNY DISCONNECT\nOptional Reason Goes here\n\n'
. The
disconnected does not acknowledge. Packets must no longer be sent.
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.
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.
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.