Dillsocks: Protocol library for libdill
Principles:
- The goal is to allow for true micro-protocol that can be composed like lego blocks to form full-fledged protocols.
- Currently we have big protocols (hundreds of pages, e.g. 3GPP) and small protocols (tens of pages, e.g. IETF). We want microprotocols (specification one paragraph long).
- To achieve that we need vertical composability (e.g. TCP on top of IP; HTTP on top of TCP)...
- And horizontal composability (e.g. HTTP switches to WebSockets; STARTTLS)
- Protocol initiation and termination is not abstracted; must be done in protocol-specific way.
- Sending data and receiving data is abstracted. Two abstractions are used: bytestream and messages.
- Sending and receiving must not presuppose each other.
- Sending and receiving with metadata (as with sndmsg, recvmsg) is not abstracted and must be done in protocol specific way.
- The system must be able to support purely "structural" protocols, for example one that joins two uni-directional protocols into a single bi-directional one.
Some protocols have to be supplied out of the box, to give people something to play with in the beginning. Options include:
- TCP bytestream
- UNIX domain bytestream
- UDP
- Simple framing (size + data)
- Line protocol (CRLF-terminated lines of text)
- HTTP
- WebSockets
- SMTP
- Version and/or capability negotiation protocol
- SSL
- TCPMUX
- WebSocketMUX
- PGM
- DCCP
Structural protocols:
- Redirecting to/from file.
- Combining two unidirectional protocols into one bi-directional
- Splitting bi-directional protocol into two uni-directional
- Throttler (both for bytestreams and messages)