1
0
mirror of https://github.com/ShadowKatStudios/OC-Minitel.git synced 2024-12-27 02:38:07 +11:00
OC-Minitel/OpenOS
2018-08-10 20:03:39 +10:00
..
etc/rc.d made minitel use the right config write function 2018-07-28 05:54:27 +10:00
usr added the API docs to the minitel man page 2018-08-10 20:03:39 +10:00
README.md clarification on settings changing methods 2018-08-08 09:37:29 +10:00

Minitel for OpenOS

This package includes the Minitel daemon, in etc/rc.d/minitel.lua, and the net library for using minitel, in usr/lib/net.lua.

Minitel daemon

Installation

With OPPM

  1. Run oppm install minitel-util - this will install both the Minitel utilities and pull in the Minitel daemon as a dependency.
  2. Run mtcfg

This will walk you through setting up Minitel.

Manual

  1. Place minitel.lua into /etc/rc.d
  2. Place your hostname into /etc/hostname
  3. Run rc minitel enable; rc minitel start

Configuration

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>

Available settings

  • port: the physical port the protocol runs over
  • pctime: the amount of time packets are kept in the packet cache
  • retry: how many seconds between resend attempts of reliable packets
  • rctime: How long items are kept in the routing cache
  • retrycount: how many attempts to resend should be made
  • route: whether to forward packets
  • debug: whether to output debugging info to the display

In addition, one can invoke to get large amounts of debug output, rc minitel set_route <local_modem> <remote_modem> to add a static route, and rc minitel del_route to delete a static route.

Net library

The net library provides an easy way of interacting with the minitel daemon, and implements higher-level features of the stack.

API

Layer 3

net.genPacketID() - returns a string of random data

net.usend(host, port, data, pid) - Sends an unreliable packet to host on port containing data, optionally with the packet ID pid.

net.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.

Layer 4

net.send(host, port, data) - Sends data reliably and in order to host on port.

Layer 5

net.open(to,port) - Establishes a stream to host on port and returns a stream object

net.listen(port) - Waits for another node to establish a stream, and returns the stream object.

Stream objects

stream:write(data) - Sends data to the node at the other end of the stream

stream:read(length) - Reads data from the stream, up to length bytes.

stream:close() - Ends the stream and prevents further writing.

Variables

net.mtu = 4096 - The maximum length of the data portion of a packet for net.send

net.streamdelay = 60 - The time, in seconds, net.open will wait for a response while trying to establish a connection.

net.minport = 32768 - The lowest port net.listen will allocate to a new connection.

net.maxport = 65535 - The highest port net.listen will allocate to a new connection.