Date: Fri, 28 Nov 86 13:24:05 est From: David Krowitz Subject: software for Apollo workstations Below the dashed line you will find the bundled files for the START_FTP package, a set of small programs which will startup the TCP/IP FTP, RIP, and TELNET servers on the Apollos after a suitable delay to allow the TCP/IP server to get initialized. I understand that these programs will become unecessary when SR9.5 is released, but until then they are useful little kludges. -- David Krowitz ---------------------------------------------------------------- # To unbundle, sh this file echo start_ftp.bld 1>&2 cat >start_ftp.bld <<'End of start_ftp.bld' von pas start_ftp.pas bind -b start_ftp start_ftp.bin voff End of start_ftp.bld echo start_ftp.doc 1>&2 cat >start_ftp.doc <<'End of start_ftp.doc' ******************************************************************************* ***** ***** ***** START_FTP.DOC ***** ***** Version 1 ***** ***** ***** ***** Programming Notes for the START_FTP, START_TELNET, and ***** ***** START_RIP programs for starting up the TCP/IP server ***** ***** programs in the proper sequence. ***** ***** ***** ***** Copyright (c) 1986 ***** ***** David M. Krowitz ***** ***** Massachusetts Institute of Technology ***** ***** Department of Earth, Atmospheric, and Planetary Sciences ***** ******************************************************************************* Starting up the SR9.2 TCP/IP Internet Server Programs ----------------------------------------------------- If you read through the release notes for the SR9.2 version of the TCP/IP software, you will find the following notice: "It takes a finite amount of time for the tcp_server to start running, and the telnet_server and ftp_server can not initialize correctly before the tcp_server is running ..." What this means is that your node's DM startup file (the file /SYS/NODE_DATA/STARTUP.) can not simply startup the TCP_SERVER program followed by the FTP_SERVER and TELNET_SERVER programs. The TCP_SERVER must be started a few seconds prior to the other servers or else they will die. The release notes suggest seperating the CPS command which starts the TCP_SERVER from the CPS commands which startup the other server. I have tried this by putting the command: cps /sys/tcp/tcp_server -n tcp_server as the first command in the DM startup file and the commands: cps /sys/tcp/ftp_server -nowait -n tcp_server cps /sys/tcp/telnet_server -n telnet_server as the last lines in the startup file. This does not work - the servers still die because the DM tries to start them too soon. The TCP/IP release notes also suggest putting extra commands and comments into the DM startup file for the sole purpose of slowing down the DM and giving the TCP_SERVER enough time to get initialized. This is a classic inelegant 'kludge', but I went ahead and gave it a try. I put up to 20 lines of CPS commands into our DM startup files and the servers still died. The DM is just too fast unless you put a *LOT* of extra commands in the startup file. Since I'm not willing to clutter up our startup files with a lot of extraneous garbage I went and did the 'right thing' ... I wrote some short programs which would sleep for 5 seconds and then invoke the appropiate server programs. START_FTP starts up a File Transfer Program server after waiting 10 seconds, START_TELNET starts up a remote terminal login server in a similar manner, and START_RIP starts up a routing server. Once these three programs have been compiled and place in the node's /SYS/TCP directory, the following sequence of DM command lines can be placed in the node's DM startup file to start the necessary TCP/IP servers: ### ### To startup the ethernet TCP server for TELNET services ### cps /sys/tcp/tcp_server -n tcp_server ### ### To startup the ethernet routing server (gateway only) ### after a suitable wait to let the TCP_SERVER get initialized ### #cps /sys/tcp/start_rip ### ### To startup the ethernet FTP server for file transfer services ### after a suitable wait to let the TCP_SERVER get initialized ### cps /sys/tcp/start_ftp ### ### To startup the ethernet TELNET server for remote login services ### after a suitable wait to let the TCP_SERVER get initialized ### cps /sys/tcp/start_telnet Note that the TCP_SERVER is started directly to let it get a 10 second head start on the other servers. Also note that the RIP_SERVER is only run on the gateway node and is usually commented out on most nodes. Why the FTP, TELNET, and RIP servers couldn't have the necessary delay built into them is one of the numerous mysteries of Apollo, but the enclosed startup programs will make life just a little bit easier. Files Needed to Build START_FTP ------------------------------- The files which are provided with the START_FTP package are: START_FTP.DOC - This file. START_FTP.PAS - The Pascal sources for the program to startup the FTP_SERVER. START_FTP.BLD - A shell script file for compiling and binding the START_FTP program. START_FTP - A ready to run START_FTP. Just in case you don't have a Pascal compiler. START_TELNET.PAS - The Pascal sources for the program to startup the TELNET_SERVER. START_TELNET.BLD - A shell script file for compiling and binding the START_TELNET program. START_TELNET - A ready to run START_TELNET. Just in case you don't have a Pascal compiler. START_RIP.PAS - The Pascal sources for the program to startup the RIP_SERVER. START_RIP.BLD - A shell script file for compiling and binding the START_RIP program. START_RIP - A ready to run START_RIP. Just in case you don't have a Pascal compiler. You will also need the following standard Apollo-supplied files: /SYS/INS/BASE.INS.PAS - These are all standard insert files which /SYS/INS/CAL.INS.PAS are used by the programs above. /SYS/INS/PGM.INS.PAS /SYS/INS/TIME.INS.PAS Bugs, Questions, and Improvements --------------------------------- If you find a bugs in any of the programs, have questions on how to install or use it, or have a good idea for improving the program please feel free to contact me at the address below. David M. Krowitz MIT dept. of Earth, Atmospheric, and Planetary Sciences Room 54-527 Cambridge, MA 02139 (617) 253-6180 network mailing address: mit-erl!mit-kermit!krowitz@eddie.mit.edu mit-erl!mit-kermit!krowitz@mit-eddie.arpa david@mit-mc.arpa (in order of decreasing preference) End of start_ftp.doc echo start_ftp.pas 1>&2 cat >start_ftp.pas <<'End of start_ftp.pas' {***************************************************************************** ***** ***** ***** START_FTP.PAS ***** ***** ***** ***** Program to sleep for 10 seconds before starting the ***** ***** FTP server program in order to allow the TCP server ***** ***** enough time to get initialized. ***** ***** Version 3 ***** ***** David M. Krowitz November 14, 1986. ***** ***** ***** ***** Copyright (c) 1986 ***** ***** David M. Krowitz ***** ***** Massachusetts Institute of Technology ***** ***** Department of Earth, Atmospheric, and Planetary Sciences ***** ***************************************************************************** } PROGRAM START_FTP; %NOLIST; %INCLUDE '/sys/ins/base.ins.pas'; %INCLUDE '/sys/ins/cal.ins.pas'; %INCLUDE '/sys/ins/pgm.ins.pas'; %INCLUDE '/sys/ins/time.ins.pas'; %LIST; VAR wait_time: TIME_$CLOCK_T; {Number of 4 usec. intervals to sleep} args: array[1..2] of ^PGM_$ARG; {Arguments to invoked program} conn_vec: array[0..3] of STREAM_$ID_T; {Stream connection vector} mode: PGM_$MODE; {Program mode} reserved: array[1..8] of char; {Reserved for future use} status: STATUS_$T; {Status returned by PGM calls} BEGIN {Convert 10 seconds into system clock format (4 usec. intervals) and then put the process to sleep in order to allow the TCP server to get initialized before starting.} CAL_$SEC_TO_CLOCK (10,wait_time); TIME_$WAIT (TIME_$RELATIVE,wait_time,status); IF (status.all <> 0) THEN BEGIN writeln ('**** START_FTP: Error - TIME_$WAIT called failed ****'); PGM_$EXIT; END; {Invoke the FTP_SERVER program in another process.} conn_vec[0] := STREAM_$STDIN; conn_vec[1] := STREAM_$STDOUT; conn_vec[2] := STREAM_$ERRIN; conn_vec[3] := STREAM_$ERROUT; NEW (args[1]); NEW (args[2]); args[1]^.len := 19; {Length of argument} args[1]^.chars := '/sys/tcp/ftp_server'; {1st arg. is the program name} args[2]^.len := 7; {Length of 2nd argument} args[2]^.chars := '-nowait'; {2nd arg. is the arg to the program} mode := [PGM_$BACK_GROUND]; PGM_$INVOKE ('/sys/tcp/ftp_server',19,2,args,4,conn_vec,mode,reserved,status); IF (status.all <> 0) THEN BEGIN writeln ('**** START_FTP: Error - failed to invoke FTP_SERVER ****'); PGM_$EXIT; END; END. End of start_ftp.pas echo start_rip.bld 1>&2 cat >start_rip.bld <<'End of start_rip.bld' von pas start_rip.pas bind -b start_rip start_rip.bin voff End of start_rip.bld echo start_rip.pas 1>&2 cat >start_rip.pas <<'End of start_rip.pas' {***************************************************************************** ***** ***** ***** START_RIP.PAS ***** ***** ***** ***** Program to sleep for 10 seconds before starting the ***** ***** RIP server program in order to allow the TCP server ***** ***** enough time to get initialized. ***** ***** Version 3 ***** ***** David M. Krowitz November 14, 1986. ***** ***** ***** ***** Copyright (c) 1986 ***** ***** David M. Krowitz ***** ***** Massachusetts Institute of Technology ***** ***** Department of Earth, Atmospheric, and Planetary Sciences ***** ***************************************************************************** } PROGRAM START_RIP; %NOLIST; %INCLUDE '/sys/ins/base.ins.pas'; %INCLUDE '/sys/ins/cal.ins.pas'; %INCLUDE '/sys/ins/pgm.ins.pas'; %INCLUDE '/sys/ins/time.ins.pas'; %LIST; VAR wait_time: TIME_$CLOCK_T; {Number of 4 usec. intervals to sleep} args: array[1..1] of ^PGM_$ARG; {Arguments to invoked program} conn_vec: array[0..3] of STREAM_$ID_T; {Stream connection vector} mode: PGM_$MODE; {Program mode} reserved: array[1..8] of char; {Reserved for future use} status: STATUS_$T; {Status returned by PGM calls} BEGIN {Convert 10 seconds into system clock format (4 usec. intervals) and then put the process to sleep in order to allow the TCP server to get initialized before starting.} CAL_$SEC_TO_CLOCK (10,wait_time); TIME_$WAIT (TIME_$RELATIVE,wait_time,status); IF (status.all <> 0) THEN BEGIN writeln ('**** START_RIP: Error - TIME_$WAIT called failed ****'); PGM_$EXIT; END; {Invoke the RIP_SERVER program in another process.} conn_vec[0] := STREAM_$STDIN; conn_vec[1] := STREAM_$STDOUT; conn_vec[2] := STREAM_$ERRIN; conn_vec[3] := STREAM_$ERROUT; NEW (args[1]); args[1]^.len := 19; {Length of argument} args[1]^.chars := '/sys/tcp/rip_server'; {1st arg. is the program name} mode := [PGM_$BACK_GROUND]; PGM_$INVOKE ('/sys/tcp/rip_server',19,1,args,4,conn_vec,mode,reserved,status); IF (status.all <> 0) THEN BEGIN writeln ('**** START_RIP: Error - failed to invoke RIP_SERVER ****'); PGM_$EXIT; END; END. End of start_rip.pas echo start_telnet.bld 1>&2 cat >start_telnet.bld <<'End of start_telnet.bld' von pas start_telnet.pas bind -b start_telnet start_telnet.bin voff End of start_telnet.bld echo start_telnet.pas 1>&2 cat >start_telnet.pas <<'End of start_telnet.pas' {***************************************************************************** ***** ***** ***** START_TELNET.PAS ***** ***** ***** ***** Program to sleep for 10 seconds before starting the ***** ***** TELNET server program in order to allow the TCP server ***** ***** enough time to get initialized. ***** ***** Version 3 ***** ***** David M. Krowitz November 14, 1986. ***** ***** ***** ***** Copyright (c) 1986 ***** ***** David M. Krowitz ***** ***** Massachusetts Institute of Technology ***** ***** Department of Earth, Atmospheric, and Planetary Sciences ***** ***************************************************************************** } PROGRAM START_TELNET; %NOLIST; %INCLUDE '/sys/ins/base.ins.pas'; %INCLUDE '/sys/ins/cal.ins.pas'; %INCLUDE '/sys/ins/pgm.ins.pas'; %INCLUDE '/sys/ins/time.ins.pas'; %LIST; VAR wait_time: TIME_$CLOCK_T; {Number of 4 usec. intervals to sleep} args: array[1..1] of ^PGM_$ARG; {Arguments to invoked program} conn_vec: array[0..3] of STREAM_$ID_T; {Stream connection vector} mode: PGM_$MODE; {Program mode} reserved: array[1..8] of char; {Reserved for future use} status: STATUS_$T; {Status returned by PGM calls} BEGIN {Convert 10 seconds into system clock format (4 usec. intervals) and then put the process to sleep in order to allow the TCP server to get initialized before starting.} CAL_$SEC_TO_CLOCK (10,wait_time); TIME_$WAIT (TIME_$RELATIVE,wait_time,status); IF (status.all <> 0) THEN BEGIN writeln ('**** START_TELNET: Error - TIME_$WAIT called failed ****'); PGM_$EXIT; END; {Invoke the TELNET_SERVER program in another process.} conn_vec[0] := STREAM_$STDIN; conn_vec[1] := STREAM_$STDOUT; conn_vec[2] := STREAM_$ERRIN; conn_vec[3] := STREAM_$ERROUT; NEW (args[1]); args[1]^.len := 22; {Length of argument} args[1]^.chars := '/sys/tcp/telnet_server'; {1st arg. is the program name} mode := [PGM_$BACK_GROUND]; PGM_$INVOKE ('/sys/tcp/telnet_server',22,1,args,4,conn_vec,mode,reserved,status); IF (status.all <> 0) THEN BEGIN writeln ('**** START_TELNET: Error - failed to invoke TELNET_SERVER ****'); PGM_$EXIT; END; END. End of start_telnet.pas