Subject: Localtalk interface design ideas
To: None <tech-net@NetBSD.ORG>
From: Bill Studenmund <wrstuden@loki.stanford.edu>
List: tech-net
Date: 02/13/1997 10:39:55
Howdy!

Netatalk looks like it's getting stable for NetBSD (it now compiles on an
Alpha, as of this morning. Thanks Chris!), it's time to start thinking
about adding LocalTalk support. I'm asking for advice as I've never built
a network interface before. Certainly not a new type. :-)

The main requirement is that the interface needs to support sending and
receiving packets through a wide variety of interfaces. Three come to
mind: built-in serial port interfaces (mac68k, powerpc's w/ MacIO support,
atari's w/ a little extra hardware, and the ISA card with an 8530 on
it I have lying in lab), dedicated LocalTalk cards (these ones have an
on-board CPU's and can just initialize, send a packet, and receive one),
and parallel port adaptors.

My thought is to steal insparation from both net/ifethersubr.c and from
net/if_ppp.c.

So how does this sound:

1) the top layer of support would live in something like net/if_llapsubr.c
	providing:
	    ddp <-> LLAP packet conversion (basically add a 3 byte header)
	    the socket level support for the whole adventure
	This layer would
	    a) initialize the lower layer (tell it to take over hardware
		and get an address)
	    b) send packets to the lower layer
	    c) get packets from the lower layer (?)
	I guess "llap" should be a pseudo-device?
2) For dedicated cards, then next layer is terminal, and just passes
	commands on to the cards. It also will download firmware to the
	cards during boot.
   For serial or parallel interfaces, I think this layer should be a
	llap line discipline on a tty, which would mainly just be a
	way for something like llapd to take over the tty line (ensuring
	that no one else can use it since we will put it in a different
	hardware mode on a serial port). Oh, I guess it will also be
	useful as a common way to get an llap interface initialized,
	a la the ppp l.d. Hmm. So I guess that means that all the dedicated
	cards need to be character devices which support the llap line
	discipline.
3) For serial and parallel devices, there's a lower layer which actually
	deals w/ the hardware. On a mac68k, this layer would
	re-configure the hardware and install its interrupt servicers
	instead of the M.I. zstty code. It also would be responsable for
	actually transmitting and receiving packets. I have no clue how
	this layer would work on a parallel interface. But it needs
	to be here as my next mac will be a powerpc w/ a parallel port,
	so there could be two simultaneous localtalk interfaces, each with
	different behaviors.

Does anyone have suggestions? It's all kinda vague as I've not started
coding. Anyone interested in mentoring such an effort?

Thanks!

Take care,

Bill