tashtari
PIC Whisperer
I've been working on this for a bit, ever since reaching an inflection point with TashRouter, and I'd like to throw a rough design out there for comments...
So, the basic idea here is to realize the dream of a userspace AppleTalk stack in an incremental and modular way (that way I don't necessarily have to write all of it myself). The design takes a measure of inspiration from inetd, but necessarily deviates from it in some important ways. Here's what I'm thinking:
Layer A
The outermost component is the root of the AppleTalk stack, a daemon that connects to a LocalTalk network via LToUDP, representing a single node on the AppleTalk network. I chose LToUDP for its simplicity and flexibility - it can be used on its own with Mini vMac 37 or connected to other networks using MultiTalk, tashtalkd, or TashRouter.
This component will contain the essential functionality of an AppleTalk node, plus maybe a bit more. It will:
This component will communicate with its subprocesses via a JSONL-based protocol, allowing the passage of datagrams in either direction, as well as other functions such as registering other listening sockets and sending ATP requests.
Layer B and Layer C
The next components in are the subprocesses spawned by layer A. These will handle the next protocols up the AppleTalk stack, namely Printer Access Protocol (PAP), AppleTalk Session Protocol (ASP), and AppleTalk Data Stream Protocol (ADSP). These components will themselves spawn layer C subprocesses to handle traffic at a higher level than provided by layer A:
Clear as mud? =) I'd be very interested to hear anyone's questions, critiques, thoughts, comments, &c.
(Also, if anyone has any information on the Apple Events/PPCToolBox protocol, I'd be extremely interested to hear about that...)
So, the basic idea here is to realize the dream of a userspace AppleTalk stack in an incremental and modular way (that way I don't necessarily have to write all of it myself). The design takes a measure of inspiration from inetd, but necessarily deviates from it in some important ways. Here's what I'm thinking:
Layer A
The outermost component is the root of the AppleTalk stack, a daemon that connects to a LocalTalk network via LToUDP, representing a single node on the AppleTalk network. I chose LToUDP for its simplicity and flexibility - it can be used on its own with Mini vMac 37 or connected to other networks using MultiTalk, tashtalkd, or TashRouter.
This component will contain the essential functionality of an AppleTalk node, plus maybe a bit more. It will:
- probe for and choose a LocalTalk node address
- listen for a router to announce its presence and use it to reach other networks
- respond to AppleTalk Echo Protocol (AEP) requests
- respond to Name Binding Protocol (NBP) LkUp requests for network-visible entities it contains
- make and listen for responses to AppleTalk Transaction Protocol (ATP) requests
- spawn subprocesses in response to datagrams coming in on configured sockets
This component will communicate with its subprocesses via a JSONL-based protocol, allowing the passage of datagrams in either direction, as well as other functions such as registering other listening sockets and sending ATP requests.
Layer B and Layer C
The next components in are the subprocesses spawned by layer A. These will handle the next protocols up the AppleTalk stack, namely Printer Access Protocol (PAP), AppleTalk Session Protocol (ASP), and AppleTalk Data Stream Protocol (ADSP). These components will themselves spawn layer C subprocesses to handle traffic at a higher level than provided by layer A:
- PAP will spawn a subprocess for each print job sent to it, sending and receiving data streams directly over standard in/out. This way, it is possible to connect it directly to lpr to send jobs to a printer connected to the machine running the stack, or alternatively, to an emulator for a printer protocol such as that of the ImageWriter II.
- ASP will spawn a subprocess for each session created under it, communicating using a JSONL-based protocol over standard in/out. This allows, for example, an implementation of AppleTalk Filing Protocol (AFP) to be created that need not handle anything below the ASP layer.
- ADSP will spawn a subprocess for each stream opened under it, communicating using either a JSONL-based protocol or direct streams of data over standard in/out (depending on whether the subprocess needs to use ADSP features such as the end-of-message marker). This allows, for example, an implementation of the PPCToolBox service to be created that need not handle anything below the ADSP layer.
- Layer A is started, configured with a PAP service advertised as Screechy:ImageWriter.
- A user opens the Chooser and looks for AppleTalk ImageWriters.
- Layer A answers the NBP LkUp, advertising Screechy on socket 253 of its network/node address.
- The user selects Screechy as their default printer.
- The user sends a print job to Screechy, sending a PAP OpenConn datagram to socket 253.
- Layer A receives the packet, spawns a Layer B PAP subprocess, and delivers the datagram over JSONL.
- The Layer B PAP subprocess sends a PAP SendData datagram to the user's workstation, requesting print data, by sending the datagram to Layer A, and spawns a Layer C lpr subprocess.
- The user's workstation responds with print data which Layer A relays to the Layer B PAP subprocess, which in turn de-packetizes the data and sends it to the Layer C lpr subprocess.
- The cycle continues, and eventually the print job is completed. The user's workstation sends a PAP CloseConn datagram to Layer A, which relays it to the Layer B PAP subprocess, which closes the streams to the Layer C lpr subprocess, causing it to terminate. The Layer B PAP subprocess notices that it has no more open print jobs and terminates.
Clear as mud? =) I'd be very interested to hear anyone's questions, critiques, thoughts, comments, &c.
(Also, if anyone has any information on the Apple Events/PPCToolBox protocol, I'd be extremely interested to hear about that...)