perm filename CACDAT.TCP[IP,NET] blob sn#702330 filedate 1983-03-11 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00007 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00003 00002	Interrupt-level stuff
C00005 00003	Pages 4-7 of this file will replace pages 72-75 of CACDAT.
C00006 00004	IMPDDB INL TIMES IMPTIM BAL MAL NHBA NHMA NHBA2 NHMA2 HBA HMA BIIL MIIL STB A ..XX A A A ..XX IMPDLS IMPDLN
C00020 00005	IMPDIE LOGGER OURHST DIFHST SVRNAM SVRPRV IMPST IMPINF IMPDEA IMPOAC IMPOBK IMPOCU OLIST IMPOFC IMPOFM IMPOCT IMPOPD IMPOPL IMPBKO IMPICU IMPITO ILIST IMPIFM IMPHLP IMPHCN IMPINW IMPIMS IN8HAK IMPIPD IMPIPL IMPAC1 IMPAC2 IMPAC3 IMPPID IMPIDS IMPODS IMPERF IMPTAC I32BUF I32BF2 I32BKI I36SAV I36BKI I36OSV I36BKO
C00025 00006	IMPCLW IMPPDP IMPFP IMPSAV TIMCNT TIMWAI IMPFSL IMPSPN HCLTIM HCLCNT IMPDWY IMPTDN IMPTUP NOPCNT RFNCNT UPWCNT NIMMSS IMERCN IQUIET
C00028 00007	LSTLNK MAXNLK L0BTBL L0BTAB L0CWTL LNKTAB LNKDDB IMPLS IMPFS IMPBS IMPSTB IMPRFQ FFLNK FLNOPS TRACES ERWOMI NIMPDN IIREST GNILL ERWMI INCMTR ILLMT BDRFNM NODDBS UNKLNK NRFNL NILLOP BSILL BCMM RERRM NILLLD N2RFCS NHOST0 SLNOPS NHANGS NRSETS NMESIN NMESOU NNOLNK NSCLSS OPTMO SLUNLK RWNOSS NIWCNO NSSC NALWNC IMPEND
C00032 ENDMK
C⊗;
;Interrupt-level stuff

;Define symbols for TOPS-10 code in IMPINT.MAC

FOR @' DEV IN (MPI,MPE,MPP)<
DEV'CHL←←IMPCHL
DEV'SAV←←IMPSAV
>;FOR
IFN FTF2,<
MPIPI←←IMPCHN
MPEPI←←IMPCHN⊗8
MPPPI←←IMPCHN⊗4
>;IFN FTF2
IFE FTF2,<
MPIPI←←IMPCHN
MPEPI←←IMPCHN
MPPPI←←IMPCHN
>;IFN FTF2

;** Put IMPSAV:: as a synonym for CH4SAV or CH5SAV (whatever we use).

;** New CONSZ chain code (note error check only done at IMPCHK now):

IFN IMPNUM,<
	CONSZ IMP,FULL↑		;INPUT DONE?
	JRST MPIINT↑
IMPETS:	CONSZ IMP,ENDIN↑	;INPUT END?
	JRST MPEINT↑
IMPOTS:	CONSZ IMP,EMPTY↑	;OUTPUT DONE?
	JRST MPPINT↑		;YES
IMPCTS:
>;IFN IMPNUM
;Pages 4-7 of this file will replace pages 72-75 of CACDAT.
;IMPDDB INL TIMES IMPTIM BAL MAL NHBA NHMA NHBA2 NHMA2 HBA HMA BIIL MIIL STB A ..XX A A A ..XX IMPDLS IMPDLN

IFN IMPNUM,<	;Whole page

BEGIN IMPDDB ↔ SUBTTL IMPDDB IMP Device Data Block and data area

;JAM	September '71
;MRC	May '78 for extended leaders
;ME,JJW	February '83 for IP/TCP

; Model DDB for IMP connections

	REPEAT DDBSKW-2,<0>	; new words not used
	IMPDDB+DEVIOS		; DEVSPT
	DEVSHR,,0		; DEVCMR
↑IMPDDB:PHASE 0
	SIXBIT/IMP/		; DEVNAM
	TDLEN-3			; DEVCHR (block size + 1 - 4 leader words)
	0			; DEVIOS
	IMP.NX,,IMPDSP		; DEVSER
	DVIMP!DVLNG!DVIN!DVOUT,,154403 ; DEVMOD
	0			; DEVLOG
	0			; DEVBUF
	0			; DEVIAD
	0			; DEVOAD

; Do not change the order of these words.  Must be same as PUPDDB
;JJW - most of these not used in IP/TCP.

↑INL::	0			; input list
↑TIMES::BYTE (6)5,5,0,40,0	; CLS, RFNM, ALL, RFC, input wait timeouts
↑IMPTIM::-1			; timeout count

↑BAL::	0			; bit allocation
↑MAL::	0			; message allocation

↑NHBA::	0			; nominal bit allocation
↑NHMA::	0			; nominal message allocation

; These two words are NOT compatable with PUP

↑NHBA2::0			; 1/2 of the nominal bit allocation
↑NHMA2::0			; 1/2 of the nominal message allocation

; These four words should be the same as PUPDDB
↑HBA::	0			; foreign bit allocation
↑HMA::	0			; foreign message allocation
↑BIIL::	0			; number of bits in input list
↑MIIL::	0			; number of messages in input list

;JJW - added the following word:
↑STB::	0			; status bits for MTAPE return

;JJW - following from NETDEF.MAC (may have to be changed to store 0's):

DEFINE XXD(A,N,C)<
	A==N
	..XX==N>

DEFINE XXP(A,C)<
	A==<..XX==..XX+1>>

DEFINE XXS(A,C)<
	A↑==<..XX==..XX+1>>

DEFINE XX(A,N,C)<
	IFNDEF A,<A==N>>

DEFINE XXX(A,C)<
	A==..XX>

DEFINE XXM(A,N,C)<
	A==..XX+1
	..XX==..XX+N>

;DEVIOS BITS(RIGHT HALF)
XX	IODATA,2000,		THERE IS DATA READY FOR INPUT

;(LEFT HALF)  BITS 13-17 STANDARD (40, 20,10, 4, 2, 1)
XX	IOBRKF,100,		BREAK CHAR SEEN IN ASCII

;IMP SPECIFIC STUFF
	INTERN IMPCLR		;So TOPS-10 can agree with us
XXD	IMPCLR,.,

XXX	IMPIOS,			IMP NCP STATUS
	;LEFT HALF		COPIED IN DEVIOS LEFT HALF
	XX AllcWt,2000,		ALLOCATION WAIT
	xx StatWt,4000,		waiting for a change of state
	XX IDATWT,10000,	INPUT DATA WAIT
	XX ALLWAT,16600,	ALL WAIT BITS
	; right half
	xx TrgDwn,1b27,		target host went down
	xx TimFlg,1b28,		user timeout flag

repeat 0,<		;JJW - These shouldn't be needed in WAITS
XXP	IMPBYT,			(150) RESIDUAL BYTE COUNT (ASYNCH I/O)
XXP	IMPPTR,			(150) POINTER TO RESIDUAL BYTES
>;repeat 0

xxp	PDBTop,			first address in pseudo DDB

xxx	NetAdr,			address of host on this network to send
				;  messages to to get them to our host.

xxp	OBfTop,			end of output area (used by ImpMak in ImpSer)

XXx	OBFByt,			REMEMBERS Bytes SENT FOR FLOW CONTROL
XXP	OBFLST,			ADDRESS OF LAST BUFFER IN OUTPUT STREAM
XXP	OBFFST,			ADDRESS OF FIRST BUFFER IN OUTPUT STREAM
XXP	OBFTHS,			ADDRESS OF BUFFER CURRENTLY BEING FILLED
XXP	OBFPC,			ADDRESS OF ROUTINE TO GET NEXT BYTE
ifn FtChck,<	; checksumming word
xxp	ObfCsm,			temporary holding place for checksum of
				;  message to this point (accurate copy
				;  is in P3).
>
XXP	OBFBC,			BYTE COUNT REMAINING IN BUFFER
XXP	OBFPNT,			ADDRESS OF LAST WORD FILLED IN BUFFER

xxx	OBfBot,			end of output area (used by ImpMak in ImpSer)

XXP	IBfTop,			top of input area (used by TCPSer)
XXx	IBFTHS,			ADDRESS OF BUFFER CURRENTLY BEING EMPTIED
XXP	IBFLST,			ADDRESS OF LAST BUFFER waiting to be
					;  read by input.
XXP	IBFPNT,			ADDRESS OF LAST WORD PLACED IN BUFFER
XXP	IBFPC,			ADDRESS OF NEXT BYTE INPUT ROUTINE
XXP	IBFBC,			COUNT OF BITS LEFT IN THE BUFFER
XXP	IBFByt,			COUNT OF BITS INPUT BUT NOT REALLOCATED
XXP	ABFLST,			ADDRESS OF LAST BUFFER of assembled 32
					;  bit buffer stream.
xxx	IBfBot,			bottom of input area

; data area for our IP level protocl
xxp	RmtAdr,			address of remote site
xxp	LclAdr,			this should be our address
xxp	SerTyp,			type of service (write only at this point)
xxp	Protcl,			protocol above IP
xxp	MsgLen,			length of the data in the message in bytes



; area for TCP data or similar protocols
xxp	RmtPrt,			remote port number of connection
xxp	LclPrt,			local port number of connection
xxp	State,			TCP connection state
xxp	Future,			queue of messages which arrived out of
				;  sequence.  messages are kept in order
				;  of their ending sequence number.
				;  duplicates are discarded.
xxp	SndBts,			bits to send on next TCP message
xxp	SndISS,			initial send sequence number
xxp	SndNxt,			sequence number of next byte to be sent
xxp	SndLst,			sequence number of last message sent
xxp	SndUna,			sequence number of first byte which is not
				;  yet acknowleged.
xxp	SndWnd,			number of bytes we have permission to send
				;  (accounts for bytes currently queued for
				;   transmission)
xxp	SndLWd,			SndNxt value last time SndWnd was updated.
xxp	SndUrg,			urgent pointer for output
xxp	SndPsh,			if set set PUSH at last packet to go in
				;  the current output buffer
xxp	SndMax,			maximum message size for other TCP (or 0)
xxp	RcvIRS,			initial send sequence number of other site
xxp	RcvNxt,			sequence number we are expecting next
xxp	RcvRed,			sequence number of last byte actually read
				; by "user", set each time RcvWnd is updated.
xxp	RcvWnd,			number of bytes we are prepared to accept.
xxp	RcvHld,			number of bytes we're holding from window
xxp	RcvThr,			threshhold: when RcvHld gets this big it's ok
				; to update RcvWnd: no getting silly window.
xxp	RcvUrg,			incoming urgent pointer.
xxp	RcvFin,			have seen an incoming FIN for this connection

xxx	PDBBot,			end of area needed for pseudo DDB

; timers and such
xxp	RetrnQ,			retransmission queue
xxp	RTTime,			retransmission delay time (in ticks)
xxp	RTTimr,			timer counting down for retransmission
				; time-out (in seconds)
xxp	UTTime,			time to use for user time-out (in seconds)
xxp	UTTimr,			user time-out timer (in seconds)
xxp	GTimer,			general time-out timer for the following:
				; 1. in S%TimW state, times out time-wait.
				; 2. when owning job is 0, times out incoming
				;	connection waiting for a matching
				;	Listen (waiting for server to start).
				; always measures seconds 'till timeout.

; data area for TelNet protocol
XXP	OTTYC,			TEMPORARY TTY CHARACTER STORAGE
XXP	ITTYC,			TEMPORARY CHARACTER SAVE AREA FOR TTY LINK
XXP	TTYLIN,			TTY FLAGS AND LDB ADDRESS
	XX TTYJOB,1B18,		IMP IS CONNECTED TO A TTY CONTROLLING A JOB
	XX TTYPTR,1B19,		TTY PRINTER IS ATTACHED
	XX TTYKBD,1B20,		TTY KEYBOARD IS ATTACHED
	XX TTYCRL,1B21,		LAST CHARACTER WAS CR
	XX TTYXWT,1B22,		JOB WAITING UNTIL CROSSPATCH BROKEN

;THE FOLLOWING ARE THE IMP REQUEST FLAGS, INDICATING WHAT CLOCK-LEVEL
;   SERVICES MUST BE PERFORMED FOR THIS DDB.
	XX IRTIIO,1B23,		TTY INPUT TO CROSSPATCHED IMP OUTPUT
	XX IRIITO,1B24,		IMP INPUT TO CROSSPATCHED TTY OUTPUT
	XX IRTOIO,1B25,		OUTPUT FROM IMP TTY TO IMP
	XX IRIITI,1B26,		INPUT FROM IMP TO TTY LINE

	XX TTYRQF,IRTIIO!IRIITO!IRTOIO!IRIITI, ALL TTY REQUEST FLAGS


XXP	TELWRD,			TELNET CONTROL STUFF
	XX IACFLG,1B0,		CURRENTLY INTERPRETING COMMAND (MUST BE SIGN)
	XX LSGAFG,1B1,		LOCAL SUPPRESS-GA OPTION IN EFFECT
	XX FSGAFG,1B2,		FOREIGN SUPPRESS-GA OPTION IN EFFECT
	XX INSWAT,1B3,		HAVE DATA MARK--WAITING FOR INS
	XX SYNCLR,1B4,		CLEAR TTY OUTPUT BUFFER ON SYNCH
	XX OPTCHR,377B17,	TELNET OPTION CHARACTER BEING PROCESSED
	;BITS 18-35 ARE FOR THE TELNET COROUTINE LINKAGE

XXP	ECPEND,			NO. OF ECHO NEGOTIATION REPLIES PENDING
XXP	TELOWD,			FOR TELNET OUTPUT CODE AND MORE BITS
	XX XPTECH,1B1,		EXPECTING REPLY TO ECHO NEGOTIATION
	XX XPTSGA,1B2,		EXPECTING REPLY TO SUPRESS GA NEGOTIATION
	XX LLCPWN,1B3,		FLAG TO PERMIT TOTAL ECHO SUPRESSION
	XX IECHO,1B4,		BIT SET BY TALK IMPUUO - DISALLOWS SERVER ECHOING
	XX TELOMR,1B5,		TELNET OUTPUT COROUTINE HAS MORE TO SAY
	XX TelFnc,377B17,	TELNET function being output
	;BITS 18-35 ARE TELNET OUTPUT COROUTINE ADDRESS

XXP	ISHREG,			TEMP DATA STORAGE FOR ASSEMBLING A WORD
XXP	USRPAR,			ARBITRARY USER-DEFINED CONNECTION PARAMETERS

XXS	IMPDDS,			LENGTH OF IMP DDB
;JJW - end of code from NETDEF

↑IMPDLS←←.-1			; DDB index of last word in IMP DDB
↑IMPDLN←←IMPDLS+1+DDBSKW	; length of IMP DDB

	DEPHASE

;IMPDIE LOGGER OURHST DIFHST SVRNAM SVRPRV IMPST IMPINF IMPDEA IMPOAC IMPOBK IMPOCU OLIST IMPOFC IMPOFM IMPOCT IMPOPD IMPOPL IMPBKO IMPICU IMPITO ILIST IMPIFM IMPHLP IMPHCN IMPINW IMPIMS IN8HAK IMPIPD IMPIPL IMPAC1 IMPAC2 IMPAC3 IMPPID IMPIDS IMPODS IMPERF IMPTAC I32BUF I32BF2 I32BKI I36SAV I36BKI I36OSV I36BKO

;Whole page IFN IMPNUM

; Protected IMPSER storage

↑IMPDIE:0		; set to non-zero to keep NCP down
↑LOGGER:0		; job number of user mode LOGGER if any
↑OURHST:0		; host/imp number, as extracted from IMP-to-host no-op
↑DIFHST:0		; number of times IMP changed our host/imp number

; Storage for exec mode LOGGER

↑SVRNAM:SIXBIT/RFC000/	; servers are called RFCnnn
	SIXBIT/NETSYS/	; they live on NET,SYS
↑SVRPRV:REAPRV!WRTPRV!LUPPRV,,0 ; and they get REA, WRT, and LUP

; Initialization routine storage

↑IMPST←←.		; IMP data area to be cleared begins here

↑IMPINF:BLOCK 1		; IMP dispatch table sets to call IMPINI at clock level

; Output routine storage

↑IMPDEA:BLOCK 1		; non-zero if NCP is dead
↑IMPOAC:BLOCK 1		; non-zero if output is active
↑IMPOBK:BLOCK 1		; output BLKO pointer
↑IMPOCU:BLOCK 1		; current buffer being output
↑OLIST:	BLOCK 1		; output list: last,,first
↑IMPOFC:BLOCK 1		; count of words to go in 36 bit mode
↑IMPOFM:BLOCK 1		; non-zero for full word (36 bit) mode
↑IMPOCT:BLOCK 1		; output timeout count
↑IMPOPD:BLOCK 1		; output side pushdown list
↑IMPOPL:BLOCK INTPLN

; Input routine storage

↑IMPBKO:BLOCK 1		; input BLKI word
↑IMPICU:BLOCK 1		; current input buffer
↑IMPITO:BLOCK 1		; top of current input list
↑ILIST:	BLOCK 1		; input list: last,,first
↑IMPIFM:BLOCK 1		; non-zero for 36 bit mode
↑IMPHLP:BLOCK 1		; DATAI'd into if no free storage for message
↑IMPHCN:BLOCK 1		; CONI'd into along with IMPHLP
↑IMPINW:BLOCK 1		; number of words of regular message
↑IMPIMS:BLOCK 1		; mask for cleaning out last word of regular message
↑IN8HAK:BLOCK 1		; -1 if ¬ 8-bit bytes else # bytes in partial word
↑IMPIPD:BLOCK 1		; input side pushdown list
↑IMPIPL:BLOCK INTPLN

; I-level general storage

↑IMPAC1:BLOCK 1		; accumulator storage
↑IMPAC2:BLOCK 1
↑IMPAC3:BLOCK 1
↑IMPPID:BLOCK 1		; save of PID for now
↑IMPIDS:BLOCK 1		; input coroutine dispatch
↑IMPODS:BLOCK 1		; output coroutine dispatch
↑IMPERF:BLOCK 1		; non-zero if IMP error came on
IFN FTF2,<
↑IMPTAC:BLOCK 1		; accumulator storage
↑I32BUF:BLOCK 8		; holds 36-bit input words being converted to 32-bit data
↑I32BF2:BLOCK 9		; holds 32-bit input data
↑I32BKI:BLOCK 1		; holds BLKI ptr for reading 36-bit data in 32-bit mode
IFN FTIMPDB,<
↑I36SAV:BLOCK 200	; holds raw IMP 36-bit input data
↑I36BKI:BLOCK 1		; BLKI pointer to I36SAV
↑I36OSV:BLOCK 200	; holds raw IMP 36-bit output
↑I36BKO:BLOCK 1		; BLKO pointer to I36OSV
>;IFN FTIMPDB
>;IFN FTF2
;IMPCLW IMPPDP IMPFP IMPSAV TIMCNT TIMWAI IMPFSL IMPSPN HCLTIM HCLCNT IMPDWY IMPTDN IMPTUP NOPCNT RFNCNT UPWCNT NIMMSS IMERCN IQUIET

;Whole page IFN IMPNUM

; Storage for clock level wait routine

↑IMPCLW:BLOCK 1		; non-zero means we are waiting for free storage
↑IMPPDP:BLOCK 1		; where pushdown pointer is stored while waiting
↑IMPFP:	BLOCK 1		; stack as it looks when we enter at IMPCLK
↑IMPSAV:BLOCK CLKPLN	; where clock level PDL is stored while waiting

; Storage for clock counting system timeouts

↑TIMCNT:BLOCK 1		; count down for checking timed waits
↑TIMWAI:BLOCK 1		; number of people waiting for a timeout

; Storage for free storage mangler

↑IMPFSL:BLOCK 1		; spares list
↑IMPSPN:BLOCK 1		; number of blocks spares list covets

; Storage for socket cleanup routine

↑HCLTIM←←60*JIFSEC	; 60 seconds between cleanups
			; note - if you change this you must also change the
			; way that IMERCN works
↑HCLCNT:BLOCK 1

; IMP going down storage

↑IMPDWY:BLOCK 1		; why IMP going down
↑IMPTDN:BLOCK 1		; when down in jiffie time
↑IMPTUP:BLOCK 1		; when up again

; Other stuff

↑NOPCNT:BLOCK 1		; count of NOPs yet to be sent to IMP
IFN FTRFNM,<
↑RFNCNT:BLOCK 1		; how long to wait before spurious RFNM's get logged
>;IFN FTRFNM
↑UPWCNT:BLOCK 1		; how long to wait before restarting the NCP
			; after the last NCP down
			; also how long to wait for interface reset after NCP up
↑NIMMSS←←=5		; only 5 IMP messages/minute allowed
↑IMERCN:BLOCK 1		; number of errors IMPSER may type this minute
↑IQUIET:BLOCK 1		;Number of minutes till IMP error msgs permitted on CTY
;LSTLNK MAXNLK L0BTBL L0BTAB L0CWTL LNKTAB LNKDDB IMPLS IMPFS IMPBS IMPSTB IMPRFQ FFLNK FLNOPS TRACES ERWOMI NIMPDN IIREST GNILL ERWMI INCMTR ILLMT BDRFNM NODDBS UNKLNK NRFNL NILLOP BSILL BCMM RERRM NILLLD N2RFCS NHOST0 SLNOPS NHANGS NRSETS NMESIN NMESOU NNOLNK NSCLSS OPTMO SLUNLK RWNOSS NIWCNO NSSC NALWNC IMPEND

;Whole page IFN IMPNUM

; Storage for routine that assigns new and unique links

↑LSTLNK:BLOCK 1		; last link number assigned

; Host tables and link table

↑MAXNLK←←100		; current maximum number of connections
↑L0BTBL←←MAXNLK/2	; should be big enough

↑L0BTAB:BLOCK L0BTBL	; list of hosts blocked in control link RFNM wait
↑L0CWTL:BLOCK 1		; list of messages initiated at clock level for link 0
↑FFLNK:	BLOCK 1		; index of first free link

; IMP statistics

↑FLNOPS:BLOCK 1		; NOPs received
↑TRACES:BLOCK 1		; trace messages
↑ERWOMI:BLOCK 1		; errors without message ID
↑NIMPDN:BLOCK 1		; IMP going down messages
↑IIREST:BLOCK 1		; interface reset messages
↑GNILL: BLOCK 1		; homosocketual RFCs
↑ERWMI: BLOCK 1		; error with message identification
↑INCMTR:BLOCK 1		; incomplete transmission
↑ILLMT: BLOCK 1		; illegal message type
↑BDRFNM:BLOCK 1		; RFNM received on unblocked link
↑NODDBS:BLOCK 1		; no DDB when one was expected
↑UNKLNK:BLOCK 1		; message to a non-ex link
↑NRFNL: BLOCK 1		; RFNMs with no links in link table
↑NILLOP:BLOCK 1		; illegal NCP opcode
↑BSILL: BLOCK 1		; illegal byte size
↑BCMM:	BLOCK 1		; illegal byte count
↑RERRM: BLOCK 1		; NCP errors
↑NILLLD:BLOCK 1		; illegal leaders
↑N2RFCS:BLOCK 1		; two RFCs from the same host
↑NHOST0:BLOCK 1		; message from host zero
↑SLNOPS:BLOCK 1		; NCP NOPs
↑NHANGS:BLOCK 1		; input blocked due to no free storage
↑NRSETS:BLOCK 1		; resets
↑NMESIN:BLOCK 1		; messages received
↑NMESOU:BLOCK 1		; messages sent
↑NNOLNK:BLOCK 1		; no link table space
↑NSCLSS:BLOCK 1		; unsolicited CLSs
↑OPTMO: BLOCK 1		; IMP interface timeouts
↑SLUNLK:BLOCK 1		; unknown link in control message
↑RWNOSS:BLOCK 1		; regular message with no socket
↑NIWCNO:BLOCK 1		; regular messages with no connection open
↑NSSC:	BLOCK 1		; regular messages for closed socket
↑NALWNC:BLOCK 1		; allocates to non-ex link

↑IMPEND←←.		; end of area cleared at IMPINI time

BEND IMPDDB

>;IFN IMPNUM	;Last of several whole pages