Trailing-Edge
-
PDP-10 Archives
-
bb-ev83b-bm_longer
-
tcpip-sources/ftsctt.mac
There are 2 other files named ftsctt.mac in the archive. Click here to see a list.
; UPD ID= 5, SNARK:<6.ARPA-UTILITIES>FTSCTT.MAC.2, 10-Jun-84 16:04:39 by PAETZOLD
;get rid of loop waiting for primary net to come up.
;GIDNEY::<TCPIP.FTP>FTSCTT.MAC.8, 2-Jun-84 11:03:26, Edit by PAETZOLD
;GIDNEY::<TCPIP.FTP>FTSCTT.MAC.7, 2-Jun-84 11:01:30, Edit by PAETZOLD
;Use "%"s in some symbols.
;GIDNEY::<TCPIP.FTP>FTSCTT.MAC.6, 2-Jun-84 10:54:33, Edit by PAETZOLD
;Get rid of TCPSYM. No TENEX support.
;CWL:<INET-SW>FTSCTT.MAC.3 12-May-82 21:01:13, Edit by CLYNN
TITLE FTSCTT Control job for TCP based FTP service using CRJOB
SUBTTL Definitions
SEARCH MONSYM,MACSYM
SALL
VWHO==0 ; Last edited by SWE
VMAJOR==1 ; Major version #
VMINOR==0 ; Revision #
VEDIT==5 ; Remove unused RCUSR, disown job in TENEX version
LOC <.JBVER==137>
<VWHO>B2+<VMAJOR>B11+<VMINOR>B17+VEDIT ;VERSION NUMBER
RELOC
T1=1 ; Temp ACs
T2=2
T3=3
T4=4
T5=5
MSG=6
P=17
PDLL==40 ; Size of PDL
FTPORT: ^D21 ; FTP Listening Port number
OPNARG: TCP%WT+CDB ; TCP Flags & connection block adr
TIMOUT: ^D30 ; Give up after 30 seconds
RXPARS: 0 ; OPEN retransmission parameters
SUBTTL Variables
; Job related
PDL: BLOCK PDLL ; Push down list
; Sub-job related ...
ACBLK: BLOCK 20 ; ACs stuffed in subjob
LSNJCN: BLOCK 1 ; TCP JCN of listening connection
PNDJOB: BLOCK 1 ; Created sub-job job number
TTYDSC: BLOCK 1 ; TTY descriptor for TVT
; Block for TENEX CRJOB
1B1+1B3+1B5+1B6+1B7+1B8+1B10+1B12
CRJB10: [ASCIZ /OPERATOR/],,[0] ; Name,,Passwd
0 ; Account
[ASCIZ/<SYSTEM>FTPSRT.SAV/] ; File to get
.NULIO ; Initial terminal (i.e. detached)
0 ; CPU time limit
0 ; Connect time limit
ACBLK ; ACs to stuff into fork
BLOCK 12 ; No Flags for EXEC, nor Primary JFNs,
; Plus space for new and futre args
; Block for TOPS-20 CRJOB ; CREATE job
; Put FTPSRT in top fork but don't start it until Attached
CJ%NAM!CJ%FIL!CJ%ACS!CJ%OWN!CJ%WTA!CJ%NPW!CJ%NUD!CJ%CAP
CRJB20: POINT 7,[ASCIZ /OPERATOR/] ; User name
POINT 7,[0] ; Password
0 ; Account
POINT 7,[ASCIZ /SYSTEM:FTPSRT.EXE/] ; File to run
0 ; Entry vector offset
.NULIO ; Initial TTY (i.e. detached)
0 ; Pre-login time limit
ACBLK ; AC block
BLOCK 13 ; No EXEC, nor Primary JFNs,
; Nor runtime limit, nor Capability mask, nor PID for ICPF on logout,
; Plus space for new and future args
CDB: BLOCK .TCPCS ; Connection block
; Blocks to SEND error message
SBFH: BLOCK .TCPBS ; SEND buffer header
SBF: BLOCK <^D<200+3>/4> ; 8-bit error message (or GTJFN string)
BF2: BLOCK <^D<200+4>/5> ; 7-bit error message
SUBTTL STATUS Blocks
STAD: -STADL,,STADSY ; STAT T2 for following info
STADSY: ASCII /TFH/ ; Foreign Host
ASCII /TLH/ ; Local Host
ASCII /TFP/ ; Foreign Port
ASCII /TLP/ ; Local Port
ASCII /TERR/ ; Error Code
STADL==.-STADSY
STST: -STSTL,,STSTSY ; STAT T2 for following info
STSTSY: ASCII /TERR/ ; Error Code
ASCII /TSSYN/ ; Send state
STSTL==.-STSTSY
SYNCED==7 ; Connection synchronized (useable)
SUBTTL Once-only Initialization
FTSCTT: RESET
SETZM PNDJOB ; No pending job yet
SETZM LSNJCN ; No listen JCN yet
SETZM TTYDSC ; No TVT assigned yet
MOVEI T1,.FHSLF
SETOB T2,T3
EPCAP ; Enable all our capabilities
; Initialize TCP control blocks
MOVE T1,FTPORT ; Listen port
MOVEM T1,CDB+.TCPLP
MOVX T1,TCP%PU ; Push error message
MOVEM T1,SBFH+.TCPBF
MOVEI T1,SBF ; Error message buffer
MOVEM T1,SBFH+.TCPBA
SUBTTL Respond to connection by creating an FTP server job
REGO: MOVE P,[IOWD PDLL,PDL] ; Set up push down list
MOVE T1,OPNARG ; Arguments for OPEN
MOVE T2,TIMOUT ; Wait for a minute to synchronize
MOVE T3,RXPARS ; Retransmission parameters
OPEN%
JRST EROPN ; Error
MOVEM T1,LSNJCN ; Have listening JCN
TXO T1,TCP%SY ; Giving symbols
MOVE T2,STAD ; Address & error
MOVX T3,<-STADL,,ACBLK+1> ; To AC block 1-5
STAT%
JRST ERSTS
MOVE T4,ACBLK+STADL ; Error code
JUMPN T4,ERSTX ; Exit on error
MOVEI T2,CRJB20 ; Get TOPS20 CRJOB block
MOVE T1,-1(T2) ; Flag word
CRJOB ; Create detached job
JRST ERCJ
MOVEM T1,PNDJOB ; Save pending job #
MOVE T1,LSNJCN ; Attach TVT to connection
TXO T1,<TCP%JS+AN%NTP> ; JCN, not JFN
ATNVT
JRST ERTV
SETZM LSNJCN ; JCN is exchanged for
MOVEM T1,TTYDSC ; TTY descriptor
MOVE T1,PNDJOB ; Pending Job #
SETZ T2, ; Job wasn't logged in
SETZ T3, ; No password required
MOVE T4,TTYDSC ; TTY Descriptor
ANDI T4,377777 ; TTY unit number
TXO T1,<AT%TRM> ; Attach to terminal in T4
ATACH
JRST ERAT
SETZM PNDJOB ; Job gone
SETZM TTYDSC ; Terminal gone
JRST REGO ; Go for another
SUBTTL Error routines
ERSTX: MOVE T1,T4 ; Move error code to T1
JSP MSG,FATAL ; STAT reported OPEN error
ASCIZ /
% FTSCTT: Connection STATUS error /
EROPN: HLRZ T2,T1 ; Possible JCN
SKIPE T2 ; Didn't get that far
TXO T2,TCP%JS
MOVEM T2,LSNJCN ; For ABORT
HRRZS T1
CAIE T1,<TCP%ER+TCP%LE+FLD(^D31,TCP%EC)>B<35+36-8>
JRST EROPN1
MOVX T4,<^D<5*60*1000>> ; Wait 5 minutes if TCP not available
JSP MSG,FATALT ; OPEN of listening connection failed
ASCIZ /
% FTSCTT: TCP not initialized error /
EROPN1: JSP MSG,FATAL ; OPEN of listening connection failed
ASCIZ /
% FTSCTT: Connection OPEN error / ; Maybe too many TCP connections
FATAL: MOVX T4,<^D15000> ; Usual wait time
FATALT: PUSH P,T1 ; Save error code
HRROI T1,(MSG) ; Get error text pointer
PSOUT
ERJMP .+1
MOVX T1,<.PRIOU>
POP P,T2 ; Get error code
MOVX T3,^D8
NOUT
JFCL
HRROI T1,[ASCIZ /
/]
PSOUT ; End line
ERJMP .+1
SKIPE T1,LSNJCN ; Have a JCN?
ABORT% ; Yes
JFCL ; No, or error
SETZM LSNJCN
MOVE T1,T4 ; Wait time
DISMS
JRST FTSCTT
ERSTS: JSP MSG,TCPEMS ; STAT of OPEN connection failed
ASCIZ /Status error was / ; Maybe connection was reset
ERCJ: JSP MSG,TTYEMS ; CRJOB failed to create a new job
ASCIZ /Unable to create job because / ; Maybe FULL
ERTV: JSP MSG,TCPEMS ; ATNVT failed to attach TVT to connection
ASCIZ /Unable to attach NVT to connection - / ; Maybe no free TVTs
ERAT: JSP MSG,TTYEMS ; ATACH failed to attach TVT to created job
ASCIZ /Unable to attach NVT to job because / ; ??
SUBTTL Format Error Messages
; From TCP Error Code
TCPEMS: PUSH P,T1 ; Save TCP error code
HRROI T1,BF2
HRROI T2,[ASCIZ /
421 /]
SETZ T3,
SOUT
ERJMP .+1
HRROI T2,(MSG)
SOUT
ERJMP .+1
POP P,T2
MOVX T3,^D8
NOUT
JFCL
JRST SNDMSG
; From System Error String
TTYEMS: HRROI T1,BF2
HRROI T2,[ASCIZ /
421 /]
SETZ T3,
SOUT
ERJMP .+1
HRROI T2,(MSG)
SOUT
ERJMP .+1
HRLOI T2,.FHSLF
ERSTR
JFCL
JFCL
SKIPG PNDJOB
JRST NOJOB
HRROI T2,[ASCIZ/, Job /]
SOUT
ERJMP .+1
MOVE T2,PNDJOB
MOVX T3,^D10
NOUT
JFCL
NOJOB: JRST SNDMSG
SUBTTL Send error message to user (via TCP)
SNDMSG: HRROI T2,[ASCIZ/
/]
SETZ T3,
SOUT
ERJMP .+1
SKIPE T2,TTYDSC ; Have a TTY descriptor (& no JCN)?
JRST TRYTTY ; Yes, try it
MOVX T1,<POINT 8,SBF> ; Convert 7-bit message to 8-bit
MOVX T2,<POINT 7,BF2>
MOVX T3,<^D200>
SETZ T4, ; Count message length
SOUT
ERJMP .+1
MOVNS T3
ADDI T3,<^D200>
MOVEM T3,SBFH+.TCPBC
SKIPN T1,LSNJCN ; See if connection looks usable
JRST LOSE ; No
TXO T1,TCP%SY ; Giving symbols
MOVE T2,STST ; TERR into T4
MOVX T3,<-STSTL,,T4> ; & TSSYN into T5
STAT%
JRST LOSE ; STAT Error
JUMPN T4,LOSE ; Connection Error
CAIE T5,<SYNCED> ; Send side SYNCED?
JRST LOSE ; No
MOVE T1,LSNJCN
MOVEI T2,SBFH
MOVE T3,TIMOUT
MOVE T4,RXPARS
SEND%
JRST LOSE
JRST DELAY
SUBTTL Send error message to user (via TVT TTY)
TRYTTY: HRROI T1,SBF ; BF2 has error message
DEVST ; T2 has tty descriptor
JRST LOSE
MOVX T2,":" ; End device name with colon
BOUT
SETZ T2, ; End string with NUL
BOUT
MOVX T1,<GJ%FOU+GJ%SHT>
HRROI T2,SBF
GTJFN ; Get JFN for TVT TTY
JRST LOSE
MOVE T4,T1 ; Save JFN for cleanup
MOVX T2,<FLD(7,OF%BSZ)+OF%APP>
OPENF ; Open TTY for message
JRST DELJFN
HRROI T2,BF2
SETZ T3, ; Send error message by TTY
SOUT
ERJMP DELJFN
MOVE T1,T4
CLOSF ; Close TTY
CAIA
SETZ T4, ; JFN was released by CLOSF
SKIPE T1,T4 ; If still have JFN
RLJFN ; Release it
JFCL
DELAY: MOVX T1,<^D5000> ; Wait for error message
DISMS ; to be delivered
JRST CLEAN
SUBTTL Cleanup Garbage
DELJFN: SKIPE T1,T4 ; If still have JFN
RLJFN ; Release it
JFCL
LOSE: HRROI T1,[ASCIZ /
% FTSCTT: Cannot report error to user:/]
PSOUT
HRROI T1,BF2
PSOUT
CLEAN: SKIPE T1,PNDJOB ; Get job #, if any
LGOUT ; Log it out
JFCL ; One error is enough
SETZM PNDJOB
SKIPE T1,TTYDSC ; Get TTY descriptor, if any
RELD ; Release it
JFCL ; One error is enough
SETZM TTYDSC
SKIPE T1,LSNJCN ; Get JCN, if any
CLOSE% ; Finished sending
JFCL
MOVX T1,<^D5000> ; Wait a few seconds
DISMS
SKIPE T1,LSNJCN ; Get JCN, if any
ABORT% ; Get rid of it
JFCL
SETZM LSNJCN
JRST REGO ; Try again
END FTSCTT