[comp.os.minix] V1.3 posting #36, introduction to MINIX networking

ast@cs.vu.nl (Andy Tanenbaum) (07/18/88)

I am now going to start posting the MINIX Ethernet code.  It has been tested
on a net using the Western Digital Etherplus card, and seems to work fine.
MINIX networking is based on remote procedure call, not stream protocols such
as TCP/OSI/X.25, which I consider obsolete.  If you claim that something as
widely used as TCP/OSI/X.25 can't be obsolete, I'll ask for your opinion about
the Big Three programming languages: Basic/Fortran/Cobol.  Anyway, for better
or for worse, the MINIX networking is not stream based.  I posted the manual
previously.  If there are points in it that are not clear, try to query me 
before I go away for a month on July 23.

The MINIX networking code was lifted bodily from the Amoeba code.  There are
things in it that are probably not appropriate for MINIX (like support for
Pronet), but the advantage of incorporating the whole thing bodily means that
it actually works pretty well.  Amoeba has been very well tested.  Furthermore,
we have drivers for Suns and VAXes that use the Amoeba protocols.  At our
site, Suns, VAXes, and ATs all speak to each other using the Amoeba protocols.
The performance is excellent.  

The device-dependent part (for the WD Etherplus card) is contained in the
files *8390* and *etherplus*.  To adapt the code to work with some other board,
study these files carefully, and then write new ones for your board that have
the same interface to the rest of the system.  The files amoeba.c and trans.c
should be entirely device independent.  They should work with token rings or
token buses, or PBXes, or anything other network.

The Amoeba code for MINIX goes in a new top level directory, minix/amoeba, just
like minix/kernel, minix/fs, etc.  It has subdirectories kernel, fs, mm, and
others.  Below is a listing make by typing ls -l * in the amoeba directory.
I have also provided two helpful files, install and makefile.  First run install
to move things where they belong, then just type make.

The protocol number used by Amoeba is actually an officially registered protocoll
so don't change this number.  If you stick to it, MINIX machines will not
conflict with any other officially registered protocol, and you can run MINIX
on a network also containing TCP and other machines.  

-rwxr-xr-x  1 ast           303 Jul 14 21:22 install
-rw-r--r--  1 ast            77 Jul 14 21:22 makefile

examples:
total 21
-rw-r--r--  1 ast          3080 Jul 14 19:38 READ_ME
-rw-r--r--  1 ast          1370 Jul 14 19:38 client1.c
-rw-r--r--  1 ast          1746 Jul 14 19:38 client2.c
-rw-r--r--  1 ast          5810 Jul 15 22:58 client3.c
-rw-r--r--  1 ast           199 Jul 14 19:38 header.h
-rw-r--r--  1 ast           458 Jul 14 19:38 makefile
-rw-r--r--  1 ast           852 Jul 14 19:38 server1.c
-rw-r--r--  1 ast           741 Jul 14 19:38 server2.c
-rw-r--r--  1 ast          2090 Jul 14 19:38 server3.c

fs:
total 6
-rw-r--r--  1 ast          5281 Jul 14 21:28 makefile

h:
total 7
-rw-r--r--  1 ast          2445 Jul 14 21:29 amoeba.h
-rw-r--r--  1 ast           327 Jul 14 21:29 amparam.h
-rw-r--r--  1 ast          2893 Jul 14 21:29 host_os.h

kernel:
total 132
-rw-r--r--  1 ast         27724 Jul 14 19:37 amoeba.c
-rw-r--r--  1 ast           215 Jul 14 19:37 amstat.h
-rw-r--r--  1 ast          1621 Jul 14 19:37 assert.h
-rw-r--r--  1 ast           654 Jul 14 19:37 byteorder.h
-rw-r--r--  1 ast           902 Jul 14 19:37 conf.c
-rw-r--r--  1 ast           610 Jul 14 19:37 conf.h
-rw-r--r--  1 ast          8277 Jul 15 19:39 dp8390.c
-rw-r--r--  1 ast          8035 Jul 14 19:37 dp8390.h
-rw-r--r--  1 ast           402 Jul 14 19:37 dp8390info.h
-rw-r--r--  1 ast           821 Jul 14 19:37 dp8390stat.h
-rw-r--r--  1 ast           181 Jul 14 19:37 eplinfo.h
-rw-r--r--  1 ast           404 Jul 15 20:18 etherformat.h
-rw-r--r--  1 ast          1390 Jul 14 19:37 etherplus.c
-rw-r--r--  1 ast           826 Jul 14 19:37 etherplus.h
-rw-r--r--  1 ast            32 Jul 14 19:37 exception.h
-rw-r--r--  1 ast          1354 Jul 14 19:37 global.h
-rw-r--r--  1 ast          1958 Jul 14 19:37 internet.h
-rw-r--r--  1 ast          6567 Jul 14 19:37 makefile
-rw-r--r--  1 ast          1427 Jul 14 19:37 mpx.H
-rw-r--r--  1 ast          1139 Jul 14 19:37 portcache.H
-rw-r--r--  1 ast         12260 Jul 14 19:37 portcache.c
-rw-r--r--  1 ast           255 Jul 14 19:37 portstat.h
-rw-r--r--  1 ast          1259 Jul 14 19:37 task.h
-rw-r--r--  1 ast          4005 Jul 14 19:37 trans.H
-rw-r--r--  1 ast         35869 Jul 14 19:37 trans.c
-rw-r--r--  1 ast          2063 Jul 14 19:37 util.c

mm:
total 19
-rw-r--r--  1 ast          4344 Jul 14 21:29 amoeba.c
-rw-r--r--  1 ast          2565 Jul 14 21:29 makefile
-rwxr-xr-x  1 ast         10820 Jul 14 21:29 mm

util:
total 26
-rw-r--r--  1 ast           767 Jul 14 19:39 READ_ME
-rw-r--r--  1 ast          1312 Jul 14 19:39 from.c
-rw-r--r--  1 ast           358 Jul 14 19:39 makefile
-rw-r--r--  1 ast          1108 Jul 14 19:39 master.c
-rw-r--r--  1 ast          1465 Jul 14 19:39 prot.c
-rwxr-xr-x  1 ast          1437 Jul 14 19:39 rcp
-rw-r--r--  1 ast          4628 Jul 14 19:39 rsh.c
-rw-r--r--  1 ast          8478 Jul 14 19:39 sherver.c
-rw-r--r--  1 ast           421 Jul 14 19:39 sherver.h
-rw-r--r--  1 ast           938 Jul 14 19:39 to.c

: This is a shar archive.  Extract with sh, not csh.
: This archive ends with exit, so do not worry about trailing junk.
: --------------------------- cut here --------------------------
PATH=/bin:/usr/bin:/usr/ucb
echo Extracting 'install'
sed 's/^X//' > 'install' << '+ END-OF-FILE ''install'
X# This shell script copies the few files required for amoeba transactions
X# to the appropriate directories.
X#
Xcp mm/IBM_PC/makefile mm/makefile
Xcp fs/IBM_PC/makefile fs/makefile
Xcp kernel/IBM_PC/makefile kernel/makefile
Xcp h/amoeba.h /usr/include
Xcp h/host_os.h /usr/include
Xcp h/amparam.h /usr/include
+ END-OF-FILE install
chmod 'u=rwx,g=rx,o=rx' 'install'
set `wc -c 'install'`
count=$1
case $count in
303)	:;;
*)	echo 'Bad character count in ''install' >&2
		echo 'Count should be 303' >&2
esac
echo Extracting 'makefile'
sed 's/^X//' > 'makefile' << '+ END-OF-FILE ''makefile'
Xall:	
X	cd kernel; 	make
X	cd fs;		make
X	cd mm;		make	
X	cd ../tools;	make net
X
+ END-OF-FILE makefile
chmod 'u=rw,g=r,o=r' 'makefile'
set `wc -c 'makefile'`
count=$1
case $count in
77)	:;;
*)	echo 'Bad character count in ''makefile' >&2
		echo 'Count should be 77' >&2
esac
exit 0