Easy-to-implement networking protocol for OpenComputers
Node - a device of some description on a Minitel network, ie a computer, server, microcontroller or drone.
Upon a node receiving a message addressed to itself, it should:
If the packet is, for some reason invalid, simply drop the packet.
In order to prevent unnecessary network traffic, each node must keep a packet ID cache. This is used to decide whether to ignore received packets. A node should drop items from this cache, in order to not waste memory, though the minimum recommended time to keep items is 30 seconds.
If a message is not addressed to a node, and the node has not seen the packet ID before, the node should repeat it. Whether via the address in the cache or by broadcast, it should be passed on, and the hardware address added to the cache as the sender.
Broadcast packets MUST NOT be repeated, in order to keep them within the same layer 2 network, unless special precautions are taken. If a packet is multicast and you don’t support multicast, then you SHOULD NOT repeat the packet.
Each machine should keep a last known route cache. The exact format is up to the implementation, but it will need:
It is recommended to keep the data in the cache for 30 seconds or so, then drop it, though being user-configurable is ideal.
When sending a message, check the cache for the given destination. If there is a hardware address in the cache for the destination, send the message straight to that address. Otherwise, broadcast the message.
Packets addressed to the broadcast address, an address beginning with the tilde character, ~
, ASCII 126, can optionally be received by all nodes of the same layer 2 network. While a node MAY forward a broadcast packet to other nodes, it SHOULD NOT, unless both sides of the forward are prepared to handle such a packet, to avoid it going around the entire layer 3 network.
Currently undecided on specifics and taking input.
Network status messages could be used to notify other nodes that a node has come online or is going offline, and other similar information.
Requesting what nodes another node can talk to may also be an option.
Packets are made up of separated parts, as allowed by OpenComputers modems.
Strings in Minitel packets, with the exception of the data portion, have the following restrictions:
The address part of the packet has a furthur limitatation, the tidle character ~
, ASCII 126, may not be used as an address of a node, but is allowed in the address part as a seperator for multicast.
An address of 0 length (an empty address) MUST be considered invalid and dropped.
The data part of the packet can contain any characters.
Node bob sends a reliable packet to node alice, on port 44:
“asdsfghjkqwertyu”, 1, “alice”, “bob”, 44, “Hello!”
Node alice acknowledges node bob’s packet:
“1234567890asdfgh”, 2, “bob”, “alice”, 44, “asdsfghjkqwertyu”