[comp.sys.amiga.datacomm] Dnet??

aru@mentor.cc.purdue.edu (Sriram Ramkrishna) (01/13/91)

Hi!  I'm rather new to these newsgroups, (and new to amigas)..I heard of
a program called Dnet.  What kind of features does it have that differentiates
from your run-of-the-mill type of terminal program.  I know this is all old
stuff, so bear with me, eh?  Now, if that loan comes through, I might get that
Amiga 3000 yet. :)

	Sri

proff@phoenix.pub.uu.oz.au (F. Soldius [proff]) (01/17/91)

In <3648@mentor.cc.purdue.edu> aru@mentor.cc.purdue.edu (Sriram Ramkrishna) writes:

>Hi!  I'm rather new to these newsgroups, (and new to amigas)..I heard of
>a program called Dnet.  What kind of features does it have that differentiates
>from your run-of-the-mill type of terminal program.  I know this is all old
>stuff, so bear with me, eh?  Now, if that loan comes through, I might get that
>Amiga 3000 yet. :)

>	Sri


Find inclosed stuff about dnet!

  If you still want it, then just tell me, or matt dillon.



::::::::
dnet
::::::::

UNIX/DNET

	DNET [debug] [-m0]

NEW Nov 89:  DNet for both UNIX and AMIGA sides default to 7 bit packet
	     mode.  If you are running on an 8 bit network use the
	     -m0 option to defeat 6 bit encoding used to send binary on
	     a 7 bit network.

	Run the DNET protocol on descriptor 0.  If the enviroment variable
	DNETDIR exists, DNET will create the rendezvous sockets in the
	specified directory (DNETDIR must have a hanging slash on it),
	otherwise the current directory is used.

	DNET also opens a log file (DNET.LOG) in the directory.  If the debug
	option is given, DNET writes gobs of debugging information to the log.

	Descriptor 0 may be a tty or socket.

	To allow DNET to startup servers on demand, the file "dnet.servers"
	must exist in the rendezvous directory.

					-Matt



			   DNET V2.10 UNIX SIDE

			   BSD4.2/4.3 compatible

	Special note this release: default is to run in 7 bit mode (which
	uses a special 6 bit encoding to encode binary data).  The -m0
	option has been added for those who can run over full 8 bit nets.

	DNET (c)Copyright 1987-1989 Matthew Dillon, All Rights Reserved

	Matthew Dillon
	891 Regal Rd
	Berkeley, Ca. 94708
	USA

	...!ihnp4!ucbvax!dillon 	USENET
	dillon@ucbvax.Berkeley.edu	ARPANET
	ucbvax.berkeley.edu pub/amiga	ARPANET-FTP

				UNIX SETUP

	The directory structure must remain intact.  simply say MAKE
	in the main directory and it ought to compile.	There might be
	minor problems depending on how compatible your UNIX is with
	BSD4.3 UNIX ..	I have successfully compiled DNet on the following
	machines:

		    Dec Vax 7xx
		    Sun 3
		    Sequent

	(1) Create a directory.  For example, ~/.DNET   WARNING!  This
	    directory must be on a local partition.  DNET uses a unix
	    domain socket and these do not work over network fileservers.

	(2) Modify your .cshrc to add the following line:

	    setenv DNETDIR  ~/.DNET/

	    (or wherever you put it.  NOTE! You MUST HAVE THE TRAILING
	     SLASH!)

	(3) All binaries are usually kept in dnet.unix/bin, add this
	    directory to your path (in your .cshrc) so DNet can find
	    the clients.

	(4) Place the file 'dnet.servers' in $DNETDIR.  Modify the file
	    according to your home directory and where you have put the
	    servers (usually in dnet.unix/bin).  USE ABSOLUTE PATHS,
	    DNET.SERVERS DOES NOT UNDERSTAND ~.

	NOTE: You may want to chmod $DNETDIR 700 to disallow any
	unauthorized access to the network.


			     DIALING UP FROM AN AMIGA

	Follow the installation instructions for the Amiga side.  When
	you dial up the UNIX system you will eventually get a prompt.
	NOTE!  DNET normally uses 7 bit - even parity for dialing up,
	then switches to 8 bit no parity for the protocol.  Sometimes
	the modem or port selector will switch into 7 bit + parity mode
	and NOT SWITCH OUT.  For this reason, you might want to use the
	-8 option for the Amiga side of DNET (read the docs in the Amiga
	section).

	You may have to force parity before running DNet.  To force parity
	to even use (and do this only if running the -Z2 option from the
	Amiga side dnet):	      THIS IS NOT NORMALLY DONE.

	% stty -odd

	From the DNET window's CSH prompt, start the protocol with:

	% dnet

	That was easy.	The DNet window should go away and an FTERM window
	should open.  This does not mean success!  If the FTERM window
	closes again with the message "unable to connect", it was unable
	to connect.  There are several possibilities:

	(a) You do not have an 8 bit connection from your amiga to the
	    UNIX host (DNet must be able to send and receive all 256
	    character codes).

	(b) You did not setup the DNETDIR enviroment variable properly

	(c) You did not copy dnet.servers into $DNETIDR

	(d) The absolute file path in dnet.servers for server #8192 (that
	    FTerm tires to connect to) is not correct.

				    KILLING DNET

	In most cases simply turning off the modem will suffice.  You can
	kill dnet more cleanly with the following sequence:

	(1) From an Amiga CLI, run the QuitDnet command.  This will kill
	    the packet protocol and cause the remote DNet to exit.  It
	    will then break the local DNet.

	    You should get the original (small) DNet window and the
	    original login shell. If you get the DNet window but not the
	    shell (you can't type), the protocol may still be running on
	    the other end, in which case it didn't work for some unknown
	    reason.  Restart the protocol w/ the appropriate menu option
	    and try 'quitdnet' again.

	(3) logout normally and close the DNet window.  Turn off your
	    modem.

	    If the kill sequence in (2) does not work, you can simply
	    hangup the line.

			     HANGING SERVER PROCESSES

	The UNIX side servers are normally left running when the protocol
	dies.  These are very very very small and take 0 CPU (they are
	simply waiting for connections).  These servers will still be
	there when you log in again and DNet will use them.

	You can kill UNIX side servers at any time.

	Many of the same clients and servers exist on the UNIX end as
	on the Amiga end.  The UNIX end is missing several.  The UNIX
	end implements two commands called dsoc and draw which can be
	used to connect to (in cooked or raw tty mode) specific servers
	(by port #) on the Amiga side.  For example, to connect to the
	printer server on the amiga side:

	% dsoc 8198
	This is a test
	^D
	%

	Dumps to PRT: on the Amiga "This is a test"  Gee Wiz!

				SECURITY W/ UNIX

	DNet will be as secure as your account, assuming you chmod DNETDIR
	700 (so nobody else has access to the unix domain sockets).  From
	Home (on the Amiga), I usually RUN DNET -X , login, start the
	protocol, and leave it running all day.

	The -X option turns of security (sets all security levels to 9),
	thus allowing me to drive to the university and at any time from
	my UNIX account do a getfiles or putfiles from and to my Amiga.

	Refer to the amiga side documentation for more information.



::::::::
dnet_at_phoenix
::::::::
File:dnet_at_phoenix.doc                                      Date:30-12-1990

By: The Mad Proffessor/The Force
At: proff@phoenix.pub.uu.oz.au


Where is what:

DNET programs/servers Unix :     -    /usr/local/dnet/
                      Amiga:     -    dnet:amiga/bin/
                       
DNET configs          Unix :     -    $HOME/.dnet/
                      Amiga:     -    dnet:s/

dnet.device           Amiga:     -    dnet:devs/

dpipe-handler         Amiga:     -    dnet:l/

jrcomm                Amiga:     -    dnet:jrcomm/

csh shell             Unix :     -    /bin/
                      Amiga:     -    dnet:c/

snap                  Amiga:     -    dnet:c/

txed                  Amiga:     -    dnet:c/

more                  Unix :     -    /usr/ucb/
                      Amiga:     -    dnet:c/

documentation         Unix :     -    /usr/docs
                      Amiga:     -    dnet:docs/


                        ---------------------


   I (proff) assume you have ran the "/home/files/autoinstalls/dnet" script,
succesfully downloaded and unlhwarped "dnet_meg_wb.lhw". Your phoenix account
should now have had various assignments added to your ~/.login file and
the ~/.dnet directory will have been created and "dnet.servers" copied into
it. If this is not the case, do a "chmod 733 ~/./" in your unix account,
and MAIL me.


  The following alias have been created:

Unix : ft     -   Set up unix terminal parameters for a 77 x 30 fterm window.
       relog  -   Relog to phoenix, so that talk, write, etc is possible.
       call   -   Telnet to phoenix.
       dn     -   Run unix dnet, suited to Phoenix to Amiga comunications.
       dlog   -   Display the dnet log of your current dnet session. 

Amiga: dn     -   Run dnet suitable for an Amiga to Phoenix connection.
       dncts  -   Run as, above, but with RTS/CTS/7wire (for MNP etc).
       rft    -   Open another fterm window/shell.
       rjr    -   Open another jrcomm, using dnet.device, unit number 4.


                        -  Running DNET on phoenix -


    After everything has been unwarped (succesfully), boot the dnet disk.
the startup sequence has finished, you will be givin the prompt "dnet:> ".
 This is c shell (csh, get it?), for a breif list of csh commands type
"help". If you are not familar with csh, then I suggest you download the
documentation from phoenix.

   At this point, open dnet with the command "dn". This is a standed terminal
window, through which you can call phoenix (hayes) (DNET is auto-bauding,
which means when dnet gets a CONNECT message from the modem, it will look
up the table in s:dnet.config and adjust the baud rate accordingly. You
will need to change this, if your Amiga-modem baud rate is different to
your modem-modem baud rate (i.e MNP)). Now, login, and when you get to
shell level, execute the command "dn" to the unix. Your Amiga DNET window
should dissapear (DNET is now waiting for connections).

   Opening connections:
 
  Assuming all of the above worked ok, (and I wrote the above, in idiot speak,
so if it doesn't, you really have problems) you may now start new connections.
This may be uploading/downloading, terminal (shell) connections, printer
connections, or what ever - refer to the documentation.

  To open another terminal "rft" (amiga) this will open an fterm window. Or,
"rjr" to open another jrcomm. The only reason you would want to open another
fterm, instead of another jrcomm, is that fterm takes up a lot less resorces.
I.e this is how a byte travels from the unix to you, if an fterm has been
invoked.

(unix)  shell         to
        dnet          to
        modem         to

(amiga) modem         to
        serial.device to
        dnet          to
        fterm


Where as a jrcomm shell connection is:-

(unix)  shell         to
        rlogin        to
        dnet          to
        modem         to

(amiga) modem         to
        serial.device to
        dnet          to
        dnet.device   to
        jrcomm

                       -    Killing dnet    -

    Assuming nothing has gone wrong, FIRST exit all non-fterm terminals, using
what ever procedure is standed to that terminal, DO NOT exit the shell
on the unix (i.e DO NOT type "exit") the sshell sever will do that
automaticly. Then use the "quitdnet" (amiga) command. You will be taken
back to the original DNET (ascii) window. And from there, you can type
"logout".

   If something does go wrong and for some reason you have to reboot the 
Amiga, then run DNET as normal. When its window opens, select the 
"start DNET" option. Then run "quitdnet" and you SHOULD be taken back to
the standed unix shell prompt.


If you have problems, then mail proff@phoenix.pub.uu.oz.au, or just "proff"
from phoenix.


- Proff

::::::::
dnet_device
::::::::
Copy dnet.device to devs: or any place else you feel like putting it.

Start up dnet in the normal fasion. After a connection has been made any program
that allows you to select your seral devie can be used to make another dnet
connection. The unit number that you use should be the dnet channel number that
you want to use (i.e. use 8195 for an fterm type connection).

So far I have used it with vlt, but I don't see why it could not be used with other
program.

This is a beta test version of dnet.device, if you have any trouble with it let me
know so that I can fix it.

You can email me at
hakimian@yoda.eecs.wsu.edu

or you can snail mail me at
Karl Hakimian
3386 Blaine Rd.
Moscow Id. 83843
::::::::
dnethistory
::::::::

    V1.00   sometime in 1987
	    First release

    V1.20   sometime in 1988
	    Fixes to the first release

    V2.00   1 March 1989

	    Major fixes, additions, and other items.



::::::::
dnetlib
::::::::

UNIX/DNETLIB

	UNIX END DNET LIBRARY INTERFACE

	See the server source for good examples of usage.

long	private;
uword	port
char 	*buf;
int 	fd;
int	res1..5, bytes
char	pri;
long	val68, valvax;

private	= DListen(port)				listen on a port (server)
     fd = DAccept(private)			accept a connection (server)
	  DNAAccept(private)			don't accept a conn.(server)
     fd = DOpen(host, port, txpri, rxpri)	open a remote connection (client)
   res1 = read(fd, buf, bytes)			standard unix read()
   res2 = gread(fd, buf, bytes)			(see below)
   res3 = ggread(fd, buf, bytes)		(see below)
   res4 = write(fd, buf, bytes)			standard unix write()
   res5 = gwrite(fd, buf, bytes)		(see below)
	  close(fd);

   val68 = ntohl68(valvax)	convert to and from MC68000 longword format.
   valvax= htonl68(val68)


DListen()	sets up a UNIX domain socket in the current directory unless
		another is specified by the DNETDIR enviroment variable.
		Returns a private structure pointer or NULL on error.

		This call will override any existing server for the port in
		the directory permanently.  It does not cause an existing
		server to exit, however, and you should be careful to kill
		old servers before starting new ones.  See the source for a
		template of correct server code.

DAccept()	Accepts a new connection on the port.  Returns a file 
		descriptor or a negative value.  This call will block.

DOpen()		Attempt to connect to a port on the remote machine.  Returns
		a file descriptor or a negative value.  The error is either
		due to not finding DNET's master port (DNET must be running),
		or the remote server not running.

		This call looks in the current directory for the master
		socket unless another is specified by the DNETDIR enviroment 
		variable.

		Two priorities are specified.  One for sending, and one for
		receiving data.  A priority is a value -127 to 126 inclusive,
		with 126 the highest priority.  Normally, priorities range
		from -80 (file transfers) to +20 (terminal window).

DEof()		Send an EOF without closing the connection.  Currently doesn't
		work worth shit, so don't use it.

write()		Standard UNIX write call.  But we are dealing with a socket
		here, so one must be careful of the return value.  (1) WRITE()
		may not return the # bytes requested to write, but less,
		(2) WRITE() may return a negative value indicating an error or
		that it was interrupted or that it would have blocked (if you
		have got non-blocking IO setup).  (3) WRITE() returns 0 on 
		socket EOF.

gwrite()	This call will write all the bytes specified, whether the
		socket is non-blocking or not.  It handles restarting the
		WRITE() call on EINTR and properly handles EWOULDBLOCK.

		It returns the number bytes requested or fewer on error.  If
		fewer bytes are returned you should close the socket and exit.

read()		Standard UNIX read call.  But we are still dealing with a 
		socket here and anything might happen.  READ() can return fewer
		than the number of bytes requested, 0 on EOF, or a negative
		number indicating various errors.

gread()		GREAD() handles retrying if the EINTR error occurs.  GREAD()
		blocks until at least one character is received (or EOF), and
		does this even if the socket is marked non-blocking.  GREAD()
		returns 0 on EOF/ERROR.

ggread()	GGREAD() not only retries on EINTR, but will block until ALL
		the requested bytes are read in, even if the socket is marked
		non-blocking.  GGREAD() returns -1 on EOF/ERROR.  You can also
		tell if an EOF/ERROR occured if fewer than the requested 
		number of bytes are read.

::::::::
draw
::::::::

UNIX/DRAW


DRAW [port#]

	(default: 8195 = AMIGTERM (talk window))

	Connect to the remote port and place the TTY in RAW mode.  The
	connection can only be terminated by the remote end, or by killing
	the process on the UNIX end.

	The default port brings up a 'talk' window on the Amiga.  AMIGATERM
	will recognize a ^C sent from DRAW and close the connection.

::::::::
draw
::::::::

UNIX/DRAW


DRAW [port#]

	(default: 8195 = AMIGTERM (talk window))

	Connect to the remote port and place the TTY in RAW mode.  The
	connection can only be terminated by the remote end, or by killing
	the process on the UNIX end.

	The default port brings up a 'talk' window on the Amiga.  AMIGATERM
	will recognize a ^C sent from DRAW and close the connection.

::::::::
dsoc
::::::::


UNIX/DSOC


DSOC [port#]

	(default: 8196 = AMIGSHELL (CLI window))

	Connect to the remote port but keep the TTY in COOKED mode (normal).
	The connection will be terminated by killing the process on the UNIX
	end or typing ^C.  NOTE THAT ^C KILLS DSOC AND IS NOT SENT THROUGH TO
	THE REMOTE CLI.

	The default port accesses the SCLI server on the Amiga end, which
	starts up a CLI.  Things work properly only if *MY* PIPE: device is
	installed on the Amiga.  Things close down properly only if you
	have a CLI prompt when you exit DSOC.

	The SCLI server currently handles only one connection at a time.

-- 
The Mad Proffessor/The Force           |When the stars threw down their spears,
"The Tiger" by W. Blake, stanza five - |And watered heaven with their tears,
SMART:proff@phoenix.pub.uu.oz.au       |Did he smile his work to see?
DUMB:..uunet!phoenix.pub.uu.oz.au!proff|Did he who made the Lamb make thee?
-- 
The Mad Proffessor/The Force           |When the stars threw down their spears,
"The Tiger" by W. Blake, stanza five - |And watered heaven with their tears,
SMART:proff@phoenix.pub.uu.oz.au       |Did he smile his work to see?
DUMB:..uunet!phoenix.pub.uu.oz.au!proff|Did he who made the Lamb make thee?