Easy-to-implement networking protocol for OpenComputers
This package includes the Minitel daemon, in etc/rc.d/minitel.lua, and the minitel library for using minitel, in usr/lib/minitel.lua.
oppm install minitel-util
- this will install both the Minitel utilities and pull in the Minitel daemon as a dependency.mtcfg
This will walk you through setting up Minitel.
The minitel daemon keeps a settings file in /etc/minitel.cfg, which is loaded on start. This can be edited directly and the daemon restarted, or settings can be changed from the command line.
To change a setting, one invokes:
rc minitel set <option> <value>
In addition, one can invoke to get large amounts of debug output, *rc minitel set_route
The Minitel daemon handles both sending and receiving packets, via events. There are four types of events used:.
This event is triggered when the Minitel daemon receives a data (type 0 or 1) packet.
This event is triggered when the Minitel daemon receives an acknowledgement (type 2) packet.
This event is triggered when the Minitel daemon receives a broadcast (addressed to ‘~’) packet of type 1 or 2.
This event can be queued (with computer.pushSignal) to manually build packets. While you should never need to use this, it may be useful for certain edge cases.
The minitel library provides an easy way of interacting with the minitel daemon, and implements higher-level features of the stack.
minitel.genPacketID() - returns a string of random data
minitel.usend(host, port, data, pid) - Sends an unreliable packet to host on port containing data, optionally with the packet ID pid.
minitel.rsend(host, port, data, block) - Sends a reliable packet to host on port containing data. If block is true, don’t wait for a reply.
minitel.send(host, port, data) - Sends data reliably and in order to host on port.
minitel.open(to,port) - Establishes a stream to host on port and returns a stream object
minitel.listen(port) - Waits for another node to establish a stream, and returns the stream object.
stream:write(data) - Sends data to the node at the other end of the stream
stream:read(length) - Reads data from the stream, in several modes:
stream:close() - Ends the stream and prevents further writing.
minitel.mtu = 4096 - The maximum length of the data portion of a packet for minitel.send
minitel.streamdelay = 60 - The time, in seconds, minitel.open will wait for a response while trying to establish a connection.
minitel.minport = 32768 - The lowest port minitel.listen will allocate to a new connection.
minitel.maxport = 65535 - The highest port minitel.listen will allocate to a new connection.