;[BBN-TENEXD]<135-TENEX>IMPPAR.MAC.10005, 17-Nov-78 14:06:02, Ed: PLUMMER
;<134-TENEX>IMPPAR.MAC.1, 11-Aug-78 17:23:37, EDIT BY JBORCHEK
;CREATE A NEW FILE FOR NETWORK DEFINITIONS

;COPYRIGHT (C) 1977,1978, Bolt, Beranek & Newman, Inc., Cambridge MA 02138

	UNIVERSAL IMPPAR - UNIVERSAL FOR IMPDV AND ASSOCIATED MODULES
	SALL
	SEARCH MACSYM



;DEFINE THE WORDS IN A NET BUFFER

.NBHDR==0	;WORD 0 IS THE BUFFER HEADER (QUEUE POINTER AND SIZE)
.NBLD0==1	;IMP-TO-HOST LEADER, WORD 0
.NBLD1==2	;I-H LEADER, WORD 1
.NBLD2==3	;I-H LEADER, WORD 2
  .NBPTR==3	;While a file buffer, pointer to next byte goes here.
.NBHHL==4	;HOST-TO-HOST LEADER
  .NBCNT==4	;While a file buffer, count of bytes goes here.
.NBDW0==5	;DATA WORD ZERO

;DEFINE THE FIELDS IN THE BUFFER HEADER

DEFSTR NBQUE,.NBHDR,17,18	;LINK FOR QUEUE OF BUFFERS
DEFSTR NBBSZ,.NBHDR,35,18	;SIZE OF THE BUFFER

;FIELDS IN IMP-TO-HOST LEADER

DEFSTR IHFTY,.NBLD0,7,4		;FORMAT TYPE FIELD. MUST BE 17 FOR LONG LDRS
	ITY%LL==17		;Type 17 for long leaders from IMP
DEFSTR IHNET,.NBLD0,15,8	;NETWORK NUMBER MSG GOES TO/FROM
DEFSTR IHLDF,.NBLD0,23,4	;LEADER FLAGS
DEFSTR IHMTY,.NBLD0,31,8	;MESSAGE TYPE
DEFSTR IHHT2,.NBLD0,35,4	;High 4 bits of handling type
DEFSTR IHHTY,.NBLD1,3,4		;Handling type, low 4 bits
	HTY%NP==7		;Number of packets
	HTY%HP==200		;High priority bit
DEFSTR IHADR,.NBLD1,27,24	; Address (Host and IMP)
  ; Substructures for above
  DEFSTR IHHST,.NBLD1,11,8	;HOST (ON IMP)
  DEFSTR IHIMP,.NBLD1,27,16	;IMP NUMBER
DEFSTR IHLNK,.NBLD1,35,8	;LINK (TOP 8 OF MESSAGE ID)
DEFSTR IHMI2,.NBLD2,3,4		;REST OF MESSAGE ID
DEFSTR IHSTY,.NBLD2,7,4		;SUBTYPE
	STY%FC==0		; Normal flow-controlled
	STY%UC==3		; Uncontrolled flow
	STY%NP==5		;Number of Padding words, for H2I NOP
DEFSTR IHLEN,.NBLD2,23,16	;LENGTH OF MESSAGE
DEFSTR IHPD1,.NBLD2,35,12	;Low 12 bits must be moved to flush padding

;NETWRK and IMPDV treat a host address as one 32-bit quantity

HSTMSK==037777777777	; Net b4-b11, Host b12-b19, Imp b20-b35

; For user interface only, old-style Imp message leader bits

IMPHIP==1B0		; Hi priority imp msg leader bit
FRMIMP==1B1		; From imp

;FIELDS IN HOST-TO-HOST LEADER

DEFSTR HHSIZ,.NBHHL,11,8	;CONNECTION BYTE SIZE
DEFSTR HHCNT,.NBHHL,27,16	;NUMBER OF BYTES IN THIS MESSAGE

;Imp-to-Host parameters

FKHOST==^D252		;Fake hosts are 252. thru 255. on each Imp.

;Host-to-Host parameters, NCP defined

CLINK==0		;Control link
FLINK==2		;First connection link, NCP
LLINK==^D71		;Last link usable by NCP.

;Special link numbers required for dispatching

TNTLNK==^D165		;Telenet traffic
INTLNK==^D155		; Internet traffic

;Message types in IHMTY (I2H = Imp to Host, & v.v.)

.IHREG==0		;Regular messages (Host-to-host)
.IHEWO==1		;Error, WithOut message ID (H2I)
.IHEIL==1		;Err in leader (I2H)
.IHHGD==2		;Host Going Down (H2I)
.IHIGD==2		;Imp Going Down (I2H)
.IHNOP==4		;No-op, takes padding request, tells my address.
.IHRFN==5		;Ready For Next message (I2H)
.IHDHS==6		;Dead Host Status (I2H)
.IHDDD==7		;Destination DeaD (I2H)
.IHERW==^D8		;Error, With message ID (H2I)
.IHERD==^D8		;Error in Data (I2H)
.IHINC==^D9		;Incomplete transmission (I2H)
.IHRES==^D10		;Interface reset (I2H)

; Special Internet parameters  -- must agree with TCPDEF.MAC

.INFMT==.NBHHL+2	; Word in H-H leader containing Internet format

DEFSTR INETF,.INFMT,31,8	; Internet format and version field
  .TCPFM==1		; Inertrnet format for TCP messges
    .TCPVR==2		; TCP Protocol version number

  .SCRFM==2		; Secure TCP format number

; Following belongs in NETWRK only, but IMPDV still uses it

DEFSTR LTIDX,NETAWD,35,9	;LINK TABLE INDEX

	END ; OF IMPPAR.MAC
