Subject: TCP/IP as separate UNIX programs

I have modified Phils NOS code to work as separate programs under UNIX
System V and SunOS 4.0.
The idea behind this is simple: NOS has its own multitasking operating
system. This is great when you run it on PC's, but UNIX is already
multitasking. So what I have done is that I have removed the operating
system from NOS, and I am running the protocol machine in NOS as a server
process on my UNIX box. The applications are compiled and run as separate
programs. All you need to do is to link them with a library that includes
the socket interface code.

The application programs call the socket routines, and they in turn make
remote procedure calls to the protocol server. The remote procedure calls
are implemented with System V shared memory and semaphores. There is also
a large shared memory buffer space that keeps data that is common to
both the server and the clients, like the socket table, protocol control
blocks and packet queues.

The server spawns a special reader process for each asynchronous interface
you are using. (Most sites would just have one.) Since this reader process
is just doing one single thing, it can block on the tty. This eliminates
the nasty problem with previous NET and NOS ports to System V, namely that
you had to keep polling the tty for data all the time.
So except for the timer interrupts, the server sits completely idle when
there is no traffic, even on System V machines.

Current status of the implementation:
I have a very preliminary implementation running. And I would be most
pleased if some people would give it a try and give me some feedback.
Except for the server, I provide the following programs:
	telnet, ftp, finger, ping and connect
The "connect" program is used for AX.25 and NET/ROM connections.
The server will talk SLIP and KISS on the serial lines, no NRS yet.
What I would really like to see is "netstat", "arp" and "route" programs.
Currently you have to restart the server to modify the tables, but
obviously, that is easily changed.
It would also be fun to have some server programs, e.g. a login server,
an ftp server, etc. If somebody wants to help me with this, it would be
appreciated.

There are some problems with the current implementation that need to be
solved. There is no select() function. Although a restricted version
that does not use timeouts could easily be implemented. The main problem
is what to do when you need to select on both KA9Q sockets and normal UNIX
filedescriptors at the same time. I see no direct way of implementing this.
If you have any ideas, please let me know.
 
The way I am working around this problem in the "telnet" and "connect"
programs is to fork a child process. The parent process can then dedicate
itself to the keyboard while the child reads data from the network socket.
Both processes need a way to share data, but that is easily done with the
shared memory segment that is already attached. However, the usage of shared
memory was something that was supposed to be hidden in the socket library.
Application programs should not assume that shared memory is available,
at least not the same shared memory that is used by the server, so this
solution is not very aesthetical.

Some of the Berkeley library routines are missing, e.g. gethostbyname(),
getservbyname() and all those. You are welcome to implement those yourself
if you need them.

Since I had to change quite a few of the KA9Q NOS files, I am distributing
all the files you need to compile. It would probably be too complicated for
me to distribute just a patch kit to the NOS source.
You can get the archive with ftp from   sics.se   ([192.16.123.90], but the
nameservers should be known by now.)
The filename is: 	archive/packet/ka9q/nos/netnix.tar.Z
It includes source that works on at least SunOS 4.0 and System V rel 3.2.
The source archive may be updated daily during some time to come, and it
is distributed under the same conditions as the original KA9Q Internet
Package.

Good luck,
	  Anders
--
klemets@sics.se
