KISS has sat between packet radio software and its modems since the 1980s. The host hands over a frame, the TNC sends it when it can, and received frames come back the other way. It is about as small as a protocol can be, which is why everything speaks it.
I am building a modem it cannot serve. The adaptive OFDM-FM modem for pdn-soundmodem is one waveform with 256 named formats, from 0.25 kbit/s up to tens of kbit/s over an ordinary FM radio. Every burst says in its header who it is for and which format it uses, receivers measure every burst they hear, and stations tell each other what their path will carry. The rate to each neighbour is the modem’s own business, and it changes while the link is up.
That modem has to be told where each frame is going. The protocol above it has to be told things only the modem knows: when a frame really went, how long it was on the air, how much fits in the next burst. KISS has nowhere to put any of that.
This post sets out the interface that goes there instead. It is written loosely in the manner of an RFC, because I would like it picked apart before it sets.
1. Status
The shape is agreed and the decisions are written down. It exists in one form: in process, as the Station class of a C# library, M0LTE.OfdmFm, with no release yet. The library has been run with two and three stations on a simulated FM channel. The waveform and rate rules beneath it ran between two real radios as a prototype; the library’s live station has not been on air. The addressing in section 3 is the newest part and is being built as I write.
Not built: any form that crosses a process boundary, the KISS adapter, and the wiring into an AX.25 engine, which will be the first host. It has no name. Every name below may change.
2. Where KISS runs out
KISS carries a frame each way and a handful of settings. Once the modem adapts, this is missing:
- Where the frame is going. The modem picks a rate for each station.
- When it went. A timer should start when the frame leaves the transmitter, and a frame can wait a long time for a busy channel. ACKMODE answers this one question, where it is implemented.
- How long it took, and how much fits. The rate moves by a factor of a few hundred. A timer or a window sized for one end of that is wrong at the other.
- Priority. An acknowledgement belongs in the first slot after the frame it answers. KISS has one queue.
- Taking a frame back. After a link reset the TNC still sends whatever it was holding.
- Push-back. A slow link fills the TNC’s buffer and the host finds out when a timer expires.
- Anything coming back about the path, the channel or the modem’s own transmissions.
3. The idea: the modem is a LAN
There are two parties, a host and a modem. The host hands the modem datagrams: bytes the modem carries and never interprets. For an AX.25 host a datagram is a frame. For an IP host it is a packet.
The modem is a link layer with addresses of its own, as Ethernet is.
- A link address is an opaque string of bytes the host chooses. The modem compares addresses and never reads them. An AX.25 host uses its callsigns and SSIDs. An IP host picks one, as it would have a MAC address.
- Every datagram has an address it is going to and one it comes from.
- The modem learns where an address lives from the “from” on each burst it hears, the way an Ethernet switch learns. Until it knows, it sends to everyone, at the slowest format. The reply teaches it, and from then on bursts are addressed and adapt.
- Station numbers are the modem’s private business. On the air it speaks of stations by a 6-bit number. It picks its own at random and sorts it out with the other modems if two clash. No host ever sees one.
Each datagram also carries two small things. A protocol byte says what it is, so that AX.25, IP and anything else can share a channel, as the PID byte does in AX.25 and the EtherType on a LAN. And a tag the host chooses comes back in every later event about it.
The modem owns the channel: when to key, at what rate, how many datagrams go in a burst, and identification. The host owns delivery: acknowledging, repeating and ordering.
I arrived here by trying not to. An AX.25 frame already says where it is going, and having the modem read that looked cheaper than a second set of addresses. It does not survive IP: a routed packet names its final destination and not the neighbour it must be handed to. Only the host knows that, so the host has to say, and then the modem has addresses whether I like it or not. For AX.25 the cost is saying a few bytes twice. AX.25 already pays it wherever it runs over another addressed link, AXUDP for one.
4. What the host asks
| Request | What it does |
|---|---|
| Set identity(callsign) | The callsign the transmitter identifies with. The modem does not key until it has one. |
| Send(datagram, to, from, protocol, tag, priority, report wanted) | Queues a datagram. Answered at once: accepted, too large for one burst to that address at present, queue full, or no identity yet. |
| Cancel(tag) or Cancel(address) | Takes back what has not yet gone into a burst. |
| Snapshot() | The link state of every address the host has sent to, for a host that joins late. |
Priority is ordinary or expedited. Ordinary traffic waits for a clear channel and then a random number of slots. Expedited traffic goes in the first slot after the channel clears, the slot AX.25 reserves for acknowledgements.
“Report wanted” asks the far modem to say what the path supports. It is for hosts with no acknowledgements of their own. A link with traffic both ways gets reports for nothing, riding on the data.
The modem never splits a datagram. One that does not fit a burst is refused and the host decides what to do.
5. What the modem tells the host
| Event | Meaning |
|---|---|
| Transmitted(tag, format, rate, airtime, time) | The burst carrying this datagram has left the audio device. |
| Dropped(tag, reason) | Cancelled, expired in the queue, no longer fits since the rate fell, or the station was forgotten. |
| Received(datagram, from, protocol, how addressed, quality) | A datagram for this station, for everyone, or for an address nobody has located yet, with the address it was sent from. |
| Overheard(datagram, from, protocol, quality) | A datagram in a burst for another station. Separate from Received, so a host that wants only its own traffic never sees it and a monitor sees the whole channel. |
| LinkState(address) | On change: located or not, the rate each way, bytes that fit in one burst, how old that knowledge is, or “gone”. |
| PathReport(address, recommended format, failed) | The far station said what the path supports. |
| BurstNotDecoded(address, tags) | The far station heard the burst carrying these datagrams and could not decode it. |
| ChannelBusy(busy) | Carrier state as the modem judges it. |
| Occupancy(busy share, split) | How busy the channel has been over the last minute and the last ten: this station’s own transmissions, other stations it could read, and the rest. |
| Congestion(address, writable) | The queue for an address filled, or has room again. Queues are bounded in seconds of airtime, not bytes. |
| ModemSent(kind) | The modem sent something the host never asked for: a report or an identification. |
| Identified(callsign) | Another station’s identification was heard. |
6. Three things the modem holds to
It never says “delivered”. A burst that decoded is known only to its receiver, and a path report is about the path. BurstNotDecoded is a hint that lets a link layer resend early instead of waiting for its timer. The modem itself resends nothing.
It never loses a datagram quietly. Every datagram accepted ends in Transmitted or Dropped.
It identifies by itself. The host gives it a callsign once and it will not key without one. After that, whenever it transmits and ten minutes have passed since it last identified, it identifies straight afterwards, in a burst of its own and in Morse, whether or not the host’s traffic already does. An idle station never keys to identify.
That callsign is the transmitter’s, and it is not an address. A host may send as many callsigns and SSIDs, several transmitters may share one identifier, and it cannot be read out of the traffic: a node that connects onward on a user’s behalf transmits frames whose source is the user’s callsign.
7. Hosts
AX.25
AX.25 v2.2 already draws this boundary, and the v2.3 draft keeps it. A link multiplexer talks to a physical state machine through eight primitives (section 5.5 and appendix C2a), and the physical machine owns carrier sense and the timers T100 to T108.
| Specification | Here |
|---|---|
| PH-SEIZE.Request, PH-DATA.Request, PH-RELEASE.Request | Send, ordinary. The modem seizes and releases by itself. One burst carries datagrams for one station, which is what PH-RELEASE exists to arrange. |
| PH-EXPEDITED-DATA.Request | Send, expedited |
| PH-DATA.Indication | Received |
| PH-BUSY.Indication, PH-QUIET.Indication | ChannelBusy. The specification uses these to suspend the link timers while the channel is busy. |
| PH-SEIZE.Confirm | Nothing exact. Transmitted comes later and says more. |
| T101 priority window, T102 slot time, T103 TXDELAY, T106 and T107 transmission limits | The modem’s own |
| Nothing | Link addresses, tag, LinkState, Congestion, PathReport, BurstNotDecoded, ModemSent |
So this is the specification’s physical layer with a real modem’s knowledge added. One thing goes beyond it on the air: the modem’s own reports use the priority window, which the specification reserves for acknowledgements and digipeated frames. That is something to raise with the v2.3 working group once a real link has run over it.
Most stacks I know of were written against KISS and not against those appendices. To use the interface natively such a stack does six things:
- Gives the modem the station’s callsign at start.
- Passes two addresses with each frame: where it goes next (the destination, or the first digipeater that has not yet repeated) and the address it is being transmitted as. Beacons and node broadcasts go to everyone.
- Marks acknowledgements and responses expedited: RR, RNR, REJ, SREJ, UA, DM.
- Starts T1 from Transmitted. Stacks that support ACKMODE have this seam already.
- Sizes T1 and the window from LinkState.
- Stops doing its own channel access, if it did any.
Frame size does not have to move. At the slowest format one burst carries a datagram of a little over 330 bytes, so a frame with the default 256 bytes of data fits. It just takes about 11 seconds.
IP
An IP host picks a link address for itself and does what it does on any LAN: it asks everyone who has an address, and the reply comes back to it alone. None of that is the modem’s code.
The slowest burst is far smaller than IPv6’s 1280-byte minimum, and the modem never splits, so IP needs a fragmenting layer of its own at the slow end, as 6LoWPAN is for small radios. LinkState says how much fits at present, so that layer can stand aside when the link is fast.
Anything else
Nothing in sections 3 to 6 is about AX.25, and the library does not mention it. A protocol can be a host if it brings an address for itself and for each neighbour, a protocol number, a tag for each datagram, a view on what is urgent, and its own answer to loss.
A network layer whose headers are too small to say who sent a packet is told by the modem, as on a LAN. A routing layer gets a rate for each neighbour in both directions, with an age, which such layers usually have to guess from lost packets. It also gets how busy the channel is, and how much of that is traffic it could join and how much is interference, so it can prefer a quiet channel to a busy one at the same rate. One-way traffic works: the far modem answers for its host’s address, so the link still adapts when nothing comes back. A protocol that lives by broadcasts is the hard case, since a broadcast can only be as fast as the weakest neighbour.
8. The same interface over a plain modem
Most modems have no notion of stations and one fixed rate: AFSK at 1200, G3RUH at 9600, IL2P. The interface should sit over those too, or hosts need two code paths for ever. Most of it goes quiet:
- Send takes its addresses and the modem ignores them.
- Expedited still means the first slot. This alone is worth having on a plain modem.
- Transmitted is exact, and carries airtime.
- LinkState is one fixed answer.
- ChannelBusy is the carrier detect it already has.
- PathReport, BurstNotDecoded and “report wanted” never happen.
For that a host must be able to ask what a modem offers. That capability statement is not designed yet, since so far there is one modem behind the interface.
Modems that carry a whole connected link layer of their own, the HF ARQ modes, are a different animal. They want a session interface, and this is not one.
9. Who provides it
An adaptive modem provides all of it. Nothing in the interface is about OFDM.
A plain modem provides the short list above. Everything needed is already inside a KISS TNC: it runs p-persistence itself, it knows when its transmitter dropped, it has carrier detect. The new work is a second queue, tags, and saying what it knows.
A shim over an existing KISS TNC can offer a reduced form to hosts, for a modem nobody is going to change. With ACKMODE the tag is the ACKMODE id and Transmitted is its echo. It has no ChannelBusy and cannot cancel. It lets a host be written once.
A KISS adapter above the interface serves hosts nobody is going to change. It reads the two addresses out of each AX.25 frame, reads the control field to mark responses expedited, and echoes ACKMODE from Transmitted. The transmitter’s callsign it must be given in something that is never sent, since it must not guess that from traffic. An adapter is written for one protocol: KISS carries anything, but a frame the adapter cannot read can only go to everyone.
10. Transports
The interface is a set of messages each way, so it needs an ordered, reliable transport that keeps message boundaries or can be framed to.
- In process. Method calls and events. This is the form that exists. The library has no threads or clock of its own: the host pushes audio in and is called back.
- A local socket, Unix or TCP, with length-prefixed messages.
- WebSocket, for a browser or a monitor.
- Serial, for a hardware TNC. One way is to ride inside KISS framing under an unused command code, so the byte-stuffing is the one every TNC already has and a single port can offer both.
The encoding is not chosen. Whichever it is, a version and the capability statement come first on the connection.
Two things constrain the transport. Events carry the modem’s clock, so delay in delivery does not corrupt timing that matters. And a reply to a received frame must be back at the modem inside the priority window, which is under a second, so any local transport will do and a slow serial line with long frames may not.
11. Compared with KISS
For KISS:
- It is tiny. An 8-bit microcontroller can implement it.
- Everything speaks it, and has for forty years.
- The host needs to know nothing about the modem.
- It has no state to get out of step.
For this interface:
- The modem can adapt per station, which is the point.
- Timers start when the frame leaves and are sized to the airtime it took.
- Acknowledgements get the first slot.
- Stale frames can be taken back, and a slow link pushes back.
- Channel access values stop being numbers a human types into a host config.
- The host hears about failure a timer early.
- What the modem knows about each link and about the channel goes up to whatever is routing.
- A host that wants the whole channel still gets it, as with KISS, and one that does not is never shown traffic that is not its own.
- It carries IP, or anything else, as readily as AX.25.
Against it:
- It is much bigger, on both sides, and nobody else implements it.
- It has addresses of its own, so a protocol that already has them says them twice.
- A host must change to benefit, and hand over channel access.
- Broadcasts are slower than everything else. A burst for everyone goes at the slowest format today. The fix is to send it at the best rate every known neighbour can take (#907), and even then it can only be as fast as the weakest of them.
- It needs versioning and a capability statement, which KISS never did.
12. Open questions
- Push or pull for acknowledgements. The specification’s link layer chooses its acknowledgement when the transmit opportunity arrives. Here the host queues a frame and it may be a little stale when it goes. Cancel and resend covers it. A “the channel is yours, what do you want to send” call would be exact in process and costs a round trip over a socket.
- The cost of “from”. Every burst says which addresses it was sent from, about a fifth of a second at the slowest format. The plan is to send it in full only now and then, and as a short number between, which needs a way to recover when a receiver has missed the full one (#908).
- The capability statement and the plain-modem profile.
- The encoding over a socket and over serial.
- Which burst failed. A failed report cannot yet say which burst it means, so the hint can name the wrong one if two went close together (#903).
- Broadcast rate. A burst for everyone will go at the best rate every known neighbour can take (#907). What that does to a station nobody has heard yet, which can only follow the slowest format, is not settled.
13. Comments
The issue for this is packet-net/pdn-soundmodem#822. If you write a modem, a TNC, a link layer or anything else that sits on a modem, and something here would not fit yours, that is exactly what I want to hear before the socket form is built.
The detail is in four documents: the host interface decisions, the addressing design, the station design, and the adaptation protocol the modem speaks on the air.