Google
 

Trailing-Edge - PDP-10 Archives - BB-M080S-SM - monitor-sources/d36par.mac
There are 26 other files named d36par.mac in the archive. Click here to see a list.
; UPD ID= 8676, RIP:<7.MONITOR>D36PAR.MAC.4,   3-Mar-88 14:48:53 by RASPUZZI
;TCO 7.1251 - Bump size of signal queue up to prevent annoying NTMSQFs.
; UPD ID= 8499, RIP:<7.MONITOR>D36PAR.MAC.3,   9-Feb-88 14:51:13 by GSCOTT
;TCO 7.1218 - Update copyright notice.
; *** Edit 7318 to D36PAR.MAC by MCCOLLUM on 11-Jun-86, for SPR #21246
; Alter PARAMETER macro to store values in full words and change some network
; management parameters to accept values in millseconds 
; UPD ID= 2211, SNARK:<6.1.MONITOR>D36PAR.MAC.121,  11-Jun-85 13:51:34 by PALMIERI
;TCO 6.1.1440  Re-instate FIXADJ macro to compensate for bug in negative ADJBP
; UPD ID= 2060, SNARK:<6.1.MONITOR>D36PAR.MAC.120,   3-Jun-85 14:27:26 by MCCOLLUM
;TCO 6.1.1406  - Update copyright notice.
; UPD ID= 1973, SNARK:<6.1.MONITOR>D36PAR.MAC.119,  13-May-85 18:13:53 by GLINDELL
;Add comments to BEGSTR's for documentors of "6.1 monitor tables"
; UPD ID= 1661, SNARK:<6.1.MONITOR>D36PAR.MAC.118,  21-Mar-85 17:53:40 by PALMIERI
;Remove FTPARANOID from MB and EL BEGSTRs so we don't need 2 different DCNSPYs,
;DNSNUPs, and DNTATLs.
; UPD ID= 1650, SNARK:<6.1.MONITOR>D36PAR.MAC.117,  18-Mar-85 16:41:29 by PALMIERI
;Add new circuit state value RCS.RJ (Rejected)
; UPD ID= 1583, SNARK:<6.1.MONITOR>D36PAR.MAC.116,   5-Mar-85 09:46:42 by PALMIERI
;Add SJMXP maximum number of slots in port indirect table
; UPD ID= 1456, SNARK:<6.1.MONITOR>D36PAR.MAC.115,   1-Feb-85 14:51:42 by GLINDELL
;  Add SLPAS - "this SLB belongs to a passive task"
; UPD ID= 1434, SNARK:<6.1.MONITOR>D36PAR.MAC.113,  31-Jan-85 15:04:41 by PALMIERI
;Add "don't range check" flag to PA begstr
; UPD ID= 1371, SNARK:<6.1.MONITOR>D36PAR.MAC.112,  21-Jan-85 12:20:08 by GLINDELL
;Add NF.CWS
; UPD ID= 1358, SNARK:<6.1.MONITOR>D36PAR.MAC.111,  17-Jan-85 16:14:53 by PALMIERI
;Set NMXELN (max # of events on queue) to 10
; UPD ID= 1334, SNARK:<6.1.MONITOR>D36PAR.MAC.110,  15-Jan-85 13:55:22 by GLINDELL
;Remove FIXADJ macro
; UPD ID= 1333, SNARK:<6.1.MONITOR>D36PAR.MAC.109,  15-Jan-85 11:25:34 by GLINDELL
;Remove TSTS6 macro
; UPD ID= 1155, SNARK:<6.1.MONITOR>D36PAR.MAC.108,   5-Dec-84 17:25:31 by GLINDELL
;Add temporary test macro TSTS6
; UPD ID= 1153, SNARK:<6.1.MONITOR>D36PAR.MAC.107,   5-Dec-84 17:12:55 by PALMIERI
;Add SASLT in SA BEGSTR
; UPD ID= 1118, SNARK:<6.1.MONITOR>D36PAR.MAC.106,  20-Nov-84 17:31:13 by GLINDELL
;Add NMDLY, ESDLY and ESDLT for ACK delay.
; UPD ID= 948, SNARK:<6.1.MONITOR>D36PAR.MAC.105,   4-Nov-84 18:10:49 by GLINDELL
;Add MCX (monitor context) bit in the NX begstr
; UPD ID= 938, SNARK:<6.1.MONITOR>D36PAR.MAC.104,  29-Oct-84 11:47:02 by PALMIERI
;Add RCBSX and RCRBS to RC BEGSTR, remove MBVER, MBECO, and MBUEC
; UPD ID= 902, SNARK:<6.1.MONITOR>D36PAR.MAC.103,  19-Oct-84 16:19:33 by PALMIERI
;Add RCDRT field to RC BEGSTR
; UPD ID= 899, SNARK:<6.1.MONITOR>D36PAR.MAC.102,  19-Oct-84 14:40:01 by GLINDELL
;Move definition of BEGSTR NN to LLINKS, and LN to SCLINK
; UPD ID= 885, SNARK:<6.1.MONITOR>D36PAR.MAC.101,  15-Oct-84 16:53:55 by PALMIERI
;Add bit in circuit when set says this router is desiginated router
; UPD ID= 876, SNARK:<6.1.MONITOR>D36PAR.MAC.100,  12-Oct-84 14:09:28 by PALMIERI
;Make line states agree with Network management's warped mind
; UPD ID= 865, SNARK:<6.1.MONITOR>D36PAR.MAC.99,  10-Oct-84 17:58:41 by GLINDELL
;Extended code: include section # in parameter/counter dispatch tables
; UPD ID= 852, SNARK:<6.1.MONITOR>D36PAR.MAC.98,   8-Oct-84 11:15:37 by PALMIERI
;Clean up BEGSTRs DL and RC
; UPD ID= 850, SNARK:<6.1.MONITOR>D36PAR.MAC.97,   5-Oct-84 12:07:58 by GLINDELL
;2 bits is not enough for routing type field any more
; UPD ID= 838, SLICE:<6.1.MONITOR>D36PAR.MAC.93,  28-Sep-84 10:01:28 by PALMIERI
;Remove reference ADJ.NN
; UPD ID= 831, SLICE:<6.1.MONITOR>D36PAR.MAC.92,  26-Sep-84 14:57:32 by NICHOLS
;Change names of SLROB and SLSOB to SLSOB and SLDOB (source & dest obj type)
; UPD ID= 816, SLICE:<6.1.MONITOR>D36PAR.MAC.91,  24-Sep-84 12:11:13 by PALMIERI
;Fix adjacency type values
; UPD ID= 791, SNARK:<6.1.MONITOR>D36PAR.MAC.90,  10-Sep-84 14:36:23 by HALPIN
;Fix Values for Network Management EXECUTOR STATE Parameter, DS.ON and DS.OFF
;
; UPD ID= 783, SNARK:<6.1.MONITOR>D36PAR.MAC.89,   4-Sep-84 13:56:49 by GLINDELL
;Change D36OFF/D36ON to expand to PIOFF/PION
; UPD ID= 773, SNARK:<6.1.MONITOR>D36PAR.MAC.88,  31-Aug-84 13:36:52 by PALMIERI
;Add ability to understand bit mapped counters to COUNTER macro
; UPD ID= 753, SNARK:<6.1.MONITOR>D36PAR.MAC.87,  23-Aug-84 10:13:15 by PALMIERI
;Make RCDSL a halfword
; UPD ID= 724, SNARK:<6.1.MONITOR>D36PAR.MAC.86,   3-Aug-84 14:42:42 by PALMIERI
;Add a mask to get 16 bit node address from adjacency block
; UPD ID= 707, SNARK:<6.1.MONITOR>D36PAR.MAC.85,  25-Jul-84 17:18:26 by GLINDELL
;Add NF.NDP, and change NF.FCS. Add macro RNMXND.
; UPD ID= 701, SNARK:<6.1.MONITOR>D36PAR.MAC.84,  23-Jul-84 09:32:56 by PALMIERI
;Return definitions of KF.SET, KF.CLR, KF.RED until NTMAN is updated
; UPD ID= 700, SNARK:<6.1.MONITOR>D36PAR.MAC.83,  20-Jul-84 15:39:47 by PALMIERI
;Add line in use by circuit bit
; UPD ID= 699, SNARK:<6.1.MONITOR>D36PAR.MAC.82,  20-Jul-84 14:51:48 by PALMIERI
;Add 2 new line states for NMX, remove KI./KF. symbols, add LT pointer to DL
; UPD ID= 688, SNARK:<6.1.MONITOR>D36PAR.MAC.81,  16-Jul-84 16:17:39 by HALPIN
;One more try at fixing PARAMETER Macro...
;
; UPD ID= 684, SNARK:<6.1.MONITOR>D36PAR.MAC.80,  16-Jul-84 10:45:36 by HALPIN
;Fix default values in PARAMETER Macro for the FLAG and DEF fields
;
; UPD ID= 676, SNARK:<6.1.MONITOR>D36PAR.MAC.79,  12-Jul-84 17:37:10 by HALPIN
;Removed all references to the NF.REX function code.
;
; UPD ID= 675, SNARK:<6.1.MONITOR>D36PAR.MAC.78,  12-Jul-84 16:57:19 by PALMIERI
;Add flag RMDRM to resend Router NI hello to endnodes if we are the DR
; UPD ID= 666, SNARK:<6.1.MONITOR>D36PAR.MAC.77,   5-Jul-84 14:04:56 by PALMIERI
;Reorder NTMAN to DLL functions to agree with NTMAN order
; UPD ID= 660, SNARK:<6.1.MONITOR>D36PAR.MAC.75,   2-Jul-84 17:00:29 by PALMIERI
;Move the VISIT count for the message to the public portion RMVST==>MBVST
; UPD ID= 655, SNARK:<6.1.MONITOR>D36PAR.MAC.74,   2-Jul-84 16:51:53 by GLINDELL
;Add SLBYR,SLBYS,SLPKR,SLPKS and remove ELPKR,ELPKS. (For CSSE event)
;Add .NCLCG to be TOPS-10/20 specific event class 96
; UPD ID= 639, SNARK:<6.1.MONITOR>D36PAR.MAC.73,  27-Jun-84 16:30:07 by GLINDELL
;Add RNMXOK macro
; UPD ID= 625, SNARK:<6.1.MONITOR>D36PAR.MAC.72,  14-Jun-84 21:09:13 by PALMIERI
;Move DNADLL data link block to D36PAR
; UPD ID= 618, SNARK:<6.1.MONITOR>D36PAR.MAC.71,  13-Jun-84 09:37:12 by GLINDELL
;Add IBFCM, IBDGL and IBBIP to IB block
;Add ESCWS and ESCDA to ES block
;Add NNPSZ to NN block
; UPD ID= 614, SNARK:<6.1.MONITOR>D36PAR.MAC.70,  11-Jun-84 13:32:21 by GLINDELL
;Add RNMXER macro
; UPD ID= 602, SNARK:<6.1.MONITOR>D36PAR.MAC.69,   6-Jun-84 14:10:59 by GLINDELL
;Add ELCIM and NV.RFR
; UPD ID= 600, SNARK:<6.1.MONITOR>D36PAR.MAC.68,   6-Jun-84 12:23:25 by PALMIERI
;Macro/BEGSTR definitions for new network management interface
; UPD ID= 580, SNARK:<6.1.MONITOR>D36PAR.MAC.67,  31-May-84 15:20:54 by PALMIERI
;Remove AJLRM  from adjacency block - no longer needed
; UPD ID= 554, SNARK:<6.1.MONITOR>D36PAR.MAC.66,  24-May-84 10:48:07 by GLINDELL
;Add BUFFER SIZE field to IBBLK
; UPD ID= 546, SNARK:<6.1.MONITOR>D36PAR.MAC.65,  23-May-84 09:49:43 by PALMIERI
;Add another function to DTE dispatch
; UPD ID= 540, SNARK:<6.1.MONITOR>D36PAR.MAC.64,  22-May-84 14:27:46 by HALPIN
;Changed CB begstr to KB
; UPD ID= 532, SNARK:<6.1.MONITOR>D36PAR.MAC.63,  21-May-84 09:09:21 by DMCDANIEL
;Add ADJ.OL (adjacency offline state) for ROUTER
; UPD ID= 531, SNARK:<6.1.MONITOR>D36PAR.MAC.62,  21-May-84 08:53:01 by HALPIN
; UPD ID= 517, SNARK:<6.1.MONITOR>D36PAR.MAC.61,  11-May-84 10:17:00 by GLINDELL
;Add definition of DECnet-36 initialization block IB
; UPD ID= 508, SNARK:<6.1.MONITOR>D36PAR.MAC.60,   7-May-84 16:05:17 by HALPIN
;Moved VN BEGSTR from NTMAN into D36PAR
;Put NF.MAX symbol in, so the NF Functions coded can be ranged checked
;
; UPD ID= 504, SNARK:<6.1.MONITOR>D36PAR.MAC.59,   7-May-84 12:18:34 by PALMIERI
;Add new circuit state value RCS.FA (Failed)
; UPD ID= 487, SNARK:<6.1.MONITOR>D36PAR.MAC.58,  30-Apr-84 13:56:00 by PALMIERI
;Add PH4 flag in adjacency block
; UPD ID= 468, SNARK:<6.1.MONITOR>D36PAR.MAC.57,  27-Apr-84 14:17:29 by GROSSMAN
;(Re)move definitions for NISRV.  Definitions are now in NIPAR.
; UPD ID= 455, SNARK:<6.1.MONITOR>D36PAR.MAC.56,  25-Apr-84 11:39:53 by PALMIERI
;Add DTESRV functions and add AJNAL to adjacency block
; UPD ID= 443, SNARK:<6.1.MONITOR>D36PAR.MAC.55,  19-Apr-84 14:11:21 by GLINDELL
;Define SYSPIF/SYSPIN to be PIOFF/PION on the 20
;Insert definitions of PA,CT BEGSTRs and PARAMETER,COUNTER macros
; UPD ID= 440, SNARK:<6.1.MONITOR>D36PAR.MAC.54,  17-Apr-84 11:29:18 by GLINDELL
;Back out CB and PB definitions because of multiple definition (SCPAR)
; UPD ID= 431, SNARK:<6.1.MONITOR>D36PAR.MAC.53,   5-Apr-84 17:28:10 by GLINDELL
;Update DECnet/CI port connect states with new substates of CONNECT
; UPD ID= 430, SNARK:<6.1.MONITOR>D36PAR.MAC.52,   5-Apr-84 16:54:46 by GLINDELL
;Move DECnet/CI port connect states here
; UPD ID= 427, SNARK:<6.1.MONITOR>D36PAR.MAC.51,   4-Apr-84 17:21:15 by NICHOLS
;Add FIXADJ macro to compensate for bug in negative ADJBP
; UPD ID= 424, SNARK:<6.1.MONITOR>D36PAR.MAC.50,   3-Apr-84 17:11:41 by GLINDELL
;Add DECnet/CI CB,PB and error definitions
; UPD ID= 415, SNARK:<6.1.MONITOR>D36PAR.MAC.49,   2-Apr-84 17:14:45 by PALMIERI
;Add new DNADLL function codes
; UPD ID= 414, SNARK:<6.1.MONITOR>D36PAR.MAC.48,   2-Apr-84 11:24:49 by HALPIN
;Put NF BEGSTR definitions in here from NTMAN
; UPD ID= 410, SNARK:<6.1.MONITOR>D36PAR.MAC.46,  30-Mar-84 13:45:35 by PALMIERI
;Put FTRTST under FTOPS10
; UPD ID= 400, SNARK:<6.1.MONITOR>D36PAR.MAC.45,  21-Mar-84 13:46:51 by MCINTEE
;Debug flag definitions have moved to PROLOG for TOPS20
; UPD ID= 378, SNARK:<6.1.MONITOR>D36PAR.MAC.44,  11-Mar-84 16:18:36 by GROSSMAN
; Move definitions of CAX, ADDX and friends to MACSYM
; UPD ID= 347, SNARK:<6.1.MONITOR>D36PAR.MAC.43,  24-Feb-84 13:51:44 by PALMIERI
;Update for use with new Router with ethernet support
; UPD ID= 302, SNARK:<6.1.MONITOR>D36PAR.MAC.42,  23-Jan-84 13:41:49 by GLINDELL
;New macros for code and data generation in addition to standard TOPS-20 ones
;Set NMXELN (max # of events on queue) to 6
; UPD ID= 296, SNARK:<6.1.MONITOR>D36PAR.MAC.41,  20-Jan-84 15:49:50 by GLINDELL
;New event logger symbols, BEGSTRs EC, NE, FA and ET (latter for test only)
; UPD ID= 288, SNARK:<6.1.MONITOR>D36PAR.MAC.40,  11-Jan-84 10:08:47 by GUNN
;Change use of NOSKD1 and OKSKD1 to NOSKED and OKSKED, the former pair are
; now obsolete.
; UPD ID= 284, SNARK:<6.1.MONITOR>D36PAR.MAC.39,   3-Jan-84 10:48:42 by NICHOLS
;Fix ordering of CHNOFF and NOSKED in D36OFF and D36ON
; UPD ID= 284, SNARK:<6.1.MONITOR>D36PAR.MAC.39,   3-Jan-84 10:48:42 by NICHOLS
;Fix ordering of CHNOFF and NOSKED in D36OFF and D36ON
; UPD ID= 273, SNARK:<6.1.MONITOR>D36PAR.MAC.38,  7-Dec-83 16:22:52 by GLINDELL
;Inserted FTPARANOID definitions to give more info on "ORC" problem
; UPD ID= 253, SNARK:<6.1.MONITOR>D36PAR.MAC.37, 17-Nov-83 10:32:51 by PALMIERI
;Updates for Phase IV router - BEGSTR AJ and RC
; UPD ID= 249, SNARK:<6.1.MONITOR>D36PAR.MAC.36,  16-Nov-83 15:20:08 by MCINTEE
;Add definition of SAUID, SLUID
; UPD ID= 241, SNARK:<6.1.MONITOR>D36PAR.MAC.35,   8-Nov-83 08:40:04 by MCINTEE
;MERGE FROM -10 Remove FTPH4 conditionals from MBDS1, MDSR1, RMOAP, RMIAP
;DNET:D36PAR.MAC[10,36,MON,NEW], 05-Oct-1983 05:23:09, Edit by TARL
;MCO 10994 - Put MBDS1 and MBSR1 under FTPH4 conditional
;DNET:D36PAR.MAC[10,36,MON,NEW], 27-Sep-1983 18:58:22, Edit by TARL
;MCO 10988 - Add NTMAN interface to KONDSP via KF.xxx functions
;DNET:D36PAR.MAC[10,36,MON,NEW], 22-Sep-1983 21:30:44, Edit by TARL
;MCO 10971 - Grand Re-merge of the -10/-20 sources

;	COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984, 1988.
;	ALL RIGHTS RESERVED.
;
;	THIS SOFTWARE IS FURNISHED UNDER A  LICENSE AND MAY BE USED AND  COPIED
;	ONLY IN  ACCORDANCE  WITH  THE  TERMS OF  SUCH  LICENSE  AND  WITH  THE
;	INCLUSION OF THE ABOVE  COPYRIGHT NOTICE.  THIS  SOFTWARE OR ANY  OTHER
;	COPIES THEREOF MAY NOT BE PROVIDED  OR OTHERWISE MADE AVAILABLE TO  ANY
;	OTHER PERSON.  NO  TITLE TO  AND OWNERSHIP  OF THE  SOFTWARE IS  HEREBY
;	TRANSFERRED.
;
;	THE INFORMATION IN THIS  SOFTWARE IS SUBJECT  TO CHANGE WITHOUT  NOTICE
;	AND SHOULD  NOT  BE CONSTRUED  AS  A COMMITMENT  BY  DIGITAL  EQUIPMENT
;	CORPORATION.
;
;	DIGITAL ASSUMES NO  RESPONSIBILITY FOR  THE USE OR  RELIABILITY OF  ITS
;	SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL.
	UNIVERSAL D36PAR - Parameters for DECnet-36
	SUBTTL V. Brownell & W. Nichols/Tarl

;D36PAR is the universal parameter file for DECnet-36.

	SALL
	Subttl	Table of Contents

;		     Table of Contents for D36PAR
;
;				  Section		      Page
;
;
;    1. Historical notes . . . . . . . . . . . . . . . . . . .   4
;    2. Feature Tests  . . . . . . . . . . . . . . . . . . . .   5
;    3. MISC CONSTANTS . . . . . . . . . . . . . . . . . . . .   8
;    4. Definitions
;        4.1    Operating System Dependent . . . . . . . . . .  11
;    5. Macro Definitions
;        5.1    Queue Management Macros  . . . . . . . . . . .  13
;        5.2    ASSUME - verify symbol values  . . . . . . . .  15
;        5.3    D36SYM - MACSYM fixups . . . . . . . . . . . .  16
;        5.4    Network management
;            5.4.1    Error macro  . . . . . . . . . . . . . .  17
;            5.4.2    Parameters . . . . . . . . . . . . . . .  18
;            5.4.3    Counters . . . . . . . . . . . . . . . .  19
;    6. Structure Definitions
;        6.1    Queue Header . . . . . . . . . . . . . . . . .  20
;        6.2    DECnet-36 Initialization Block . . . . . . . .  21
;        6.3    DECnet-36 Message Descriptor . . . . . . . . .  22
;        6.4    DECnet-36 Message Block  . . . . . . . . . . .  23
;        6.5    Session Control Link Block . . . . . . . . . .  27
;        6.6    Session Control Job Block  . . . . . . . . . .  28
;        6.7    NSP Sublink Block  . . . . . . . . . . . . . .  29
;        6.8    NSP LINK Block . . . . . . . . . . . . . . . .  30
;        6.9    Router Adjacency Block . . . . . . . . . . . .  31
;        6.10   Router Circuit Block . . . . . . . . . . . . .  32
;        6.11   DNADLL data link block . . . . . . . . . . . .  34
;    7. Value Definitions
;        7.1    NSP Port States  . . . . . . . . . . . . . . .  37
;        7.2    DECnet Standard Parameters . . . . . . . . . .  38
;        7.3    DECnet-wide states . . . . . . . . . . . . . .  39
;    8. Inter-Layer Parameters
;        8.1    Overall Argument Conventions . . . . . . . . .  40
;        8.2    Session Control Function Codes . . . . . . . .  41
;        8.3    NSP Function Codes . . . . . . . . . . . . . .  42
;        8.4    Session Control/NSP  . . . . . . . . . . . . .  43
;        8.5    NSP/Router . . . . . . . . . . . . . . . . . .  45
;        8.6    Router/DLL . . . . . . . . . . . . . . . . . .  46
;        8.7    Layer/NMX (Event logger) . . . . . . . . . . .  47
;    9. Network Management
;        9.1    Argument blocks  . . . . . . . . . . . . . . .  48
;        9.2    NSP and ROUTING VERSION Number Formats . . . .  50
;        9.3    Values used by NMX . . . . . . . . . . . . . .  51
;        9.4    NMX Function Block Definition  . . . . . . . .  53
;        9.5    Event Parameters and Argument blocks . . . . .  54
;   10. Test Bed Stuff . . . . . . . . . . . . . . . . . . . .  55
;   11. FIXADJ Macro - Compensate for bug in negative ADJBP  .  56
;   12. End of D36PAR  . . . . . . . . . . . . . . . . . . . .  58
	SUBTTL	Historical notes

COMMENT	|

	The DECnet modules were originally written and tested on a
	user-mode test-bed on TOPS10. The modules at that time were
	named according to current architecture names, and TOPS10
	naming conventions. After getting the DECnet code running in
	the TOPS10 monitor, the DECnet modules were integrated into
	TOPS20 (for Release 6.1). The naming conventions used earlier
	were no longer valid because the architecture group renamed
	several of the DECnet layers. To resolve these problems, the
	DECnet modules were renamed to names which avoided the names
	the architecture group didn't want us using any more. The
	result of all this is that several modules have comments and
	labels which do not correspond with the current module name,
	so we supply a mapping table between old names and new names
	to attempt to relieve the confusion:

	Old name(layer)		New name	New layer name

	D36UNV(Universal)	D36PAR		(Universal file)
	D36COM(Common subrs)	D36COM		(Common subroutines)
	NSPSER(Network service)	LLINKS		End Communication Layer
	XPTSER(Transport)	ROUTER		Routing Layer
	SCTPRM(Session Control)	SCPAR		Session control parameters
	SCTCON(Session Control)	SCLINK		Session Control Layer
	SCTUUO(Session Control)	SCMUUO		Session control uuos
	NMXCON(Network Mngmnt.)	NTMAN		Network Management Layer

	In addition, on the -20, we needed an entirely new module for
	the UUO/JSYS level code which was entirely different between
	the -10 and the -20. This module was given the name SCJSYS,
	and is morally equivalent to SCMUUO.

	| ;End of Comment
	SUBTTL	Feature Tests

;Here are the feature tests for DECnet-36.

	FTOPS10==:0		;ASSEMBLE FOR TOPS10
	FTOPS20==:1		;ASSEMBLE FOR TOPS20
	FTPH4==:0		;ASSEMBLE PHASE IV CODE
IFN FTOPS10,<
	FTTRACE==:0		;NON-ZERO TO ENABLE TRACES
	FTMINTRACE==:0		;MINI TRACE (SUBSET OF ABOVE)
	FTDEBUG==:1		;ASSEMBLE WITH DEBUGGING STUFF
	FTPARANOID==:1		;DO EXTRA CAREFUL CHECKING
	FTCORBUG==:0		;FTPARANOID FOR CORE MANGLER. [EXPENSIVE!]
	FTLSTCOR==:1		;NOTE - TO TURN ON FTLSTCOR, SET TO POSITIVE 1.
                                ; LSTCOR TRIES TO TRACE LOST CORE
	XP FTRTST,0		; Default is no ROUTER looper
>;END IFN FTOPS10
	SEARCH	MACSYM

IFN FTOPS10,<

;We search NETPRM here to check that parallel definitions are
;properly defined

	SEARCH F,S,NETPRM

.CPYRT<
COPYRIGHT (C) 1981,1984 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
>,.

	D36SYM
	XP FTP4R,0	;Enables phase IV code. This will **NOT** work without
			;a phase IV router (which is not supplied with 7.02),
			;and will merely cause bizarre conditions if it runs.
>;End of IFN FTOPS10


IFN FTOPS20,<
	IFN FTOPS10,<IF2, <PRINTX ?Operating system feature tests screwed up>>

	SEARCH PROLOG,MONSYM

	FTMP==:0		;MULTI-PROCESSOR OFF IN TOPS-20
	FTKLP==:1		;KL PAGING
	FTKS10==:SMFLG		;KS FLAG
	FTKL10==:KLFLG		;KL FLAG
	FTNRT==:0		;NO NRT ON TOPS20
>;End of IFN FTOPS20


	IFN FTP4R,FTPHA2==:0	;IF NI DLL, DON'T DO PHASE II NODES
	IFE FTP4R,FTPHA2==:1	;ELSE MIGHT AS WELL
;These are the DECnet-36 TOPS-20 AC definitions.

IFN FTOPS20,<
	DEFINE XP(SYM,VAL),<SYM==:VAL> ;DEFINE SYMBOL GLOBAL SUPRESSED TO DDT
	DEFINE XPP(SYM,VAL),<SYM=:VAL> ;DEFINE SYMBOL GLOBAL NOT SUPRESSED

	FREE0==0		;FREE FOR REDEFINITION
				; FREE0 ONLY APPLIES TO AC 0
	XPP T1,1		;TEMPORARIES
	XPP T2,2		; ..
	XPP T3,3		; ..
	XPP T4,4		; ..
	T5==5			;T5 AND T6 USED MAINLY
	T6==6			; FOR EXTENDED INSTRUCTIONS

	MB==7		 	;MESSAGE BLOCK POINTER

	P1==10			;PRESERVED ACS
	P2==11			; ..

	MS==12			;POINTER TO CURRENT MSD FOR DNxyBY
				;ALSO SEE D36SYM CONCERNING THESE REDEFS
	FREE1==13		;FIRST FREE
	FREE2==14		;FREE1,2,ETC CAN BE ANY NON-ZERO AC
	FREE3==15		; THAT IS NOT OTHERWISE DEFINED HERE

	XPP CX,16		;SCRATCH AC

	XPP P,17		;THE STACK POINTER

>
	OPDEF	TRASH	[HRROI 474747] ;SIMPLE PROCEDURE TO LEAVE JUNK IN AN AC

IFN FTOPS20,<
DEFINE TESTS1,<TSTMS0>
> ;END IFN FTOPS20

IFN FTOPS10,<
  DEFINE TESTS1,<
    IFN FTDEBUG,<
      IFN FTKLP,<
	XMOVEI CX,0
	SKIPN CX
	CALL TESTSB		;;COMMON BUG. FOR ALL SECTION 1 ASSERTION FAILS
      >;;END IFN FTKLP
    >;;END IFN FTDEBUG		;;IN D36COM
 >;END DEFINE TESTS1
>;END IFN FTOPS10

IFN FTOPS10,<
	OPDEF  CALLRET [JRST]	; to be defined with CALL and RET
	.NODDT CALLRET

;HARDWARE INTERLOCK DEFINITIONS

OPDEF	D36OFF [JSP CX,D36PIF##]
OPDEF	D36ON  [JSP CX,D36PIN##]

;MACROS TO CHANGE SECTION (WILL CALL COROUTINES, TO ENSURE RETURNING TO
;	PROPER SECTION WHEN CURRENT ROUTINE POPJ'S)
;

DEFINE	SEC0,<
IFN FTKLP,<PUSHJ P,SSEC0##>
>

DEFINE	SEC1,<
	SE1ENT
>

DEFINE S0CALL(ROUTINE),<
IFN FTKLP,<
	CALL [	SEC0		;;ROUTINE WANTS TO BE IN SECTION 0
		CALLRET ROUTINE] ;;ROUTINE IN SEC 0, HE WILL POPJ TO SEC N
	>; END IFN FTKLP
IFE FTKLP,<CALL ROUTINE>	;;JUST CALL IT (NO SECTION PROBLEMS)
>; END DEFINE S0CALL
	SUBTTL MISC CONSTANTS

;MISC CONSTANTS

.INFIN==:377777,,777777		;PLUS INFINITY
.MINFI==:1B0			;MINUS INFINITY
.LHALF==:777777B17		;LEFT HALF
.RHALF==:777777			;RIGHT HALF
.FWORD==:-1			;FULL WORD

>;END OF IFN FTOPS10


IFN FTOPS20,<
	DEFINE D36OFF <PIOFF>
	DEFINE D36ON <PION>

   Repeat 0,< ;Old defs
	DEFINE D36OFF <
	   CONSO PI,77000	    ;;CHECK TO SEE IF AT PI LEVEL
	   NOSKED		    ;;NO, KEEP SCHEDULER OUT TOO
	   CHNOFF DLSCHN
	>
	DEFINE D36ON <
	   CHNON DLSCHN
	   CONSO PI,77000	    ;;CHECK TO SEE IF AT PI LEVEL
	   OKSKED		    ;;NO, MATCH D36OFF'S NOSKED
	>
   >
	DEFINE SYSPIF <		    ;System PIOFF
	   PIOFF
	>
	DEFINE SYSPIN <		    ;System PION
	   PION
	>
	DEFINE SEC0 <S0.ENT>
	DEFINE SEC1 <EA.ENT>
>;END IFN FTOPS20

;Define a mask to strip off area and node from the Phase IV message

	XP RN%ARE,MASK.(^D6,^D25)  ;MASK TO GET AREA
	XP RN%NOD,MASK.(^D10,^D35) ;MASK TO GET NODE
IFN FTOPS10,<

;The following definition of USRSAV is the default.  Redefine it if
;you want.  The calls to SPCSAV have two arguments: the routine name
;and a list of ACs saved by that routine.  The IFDEFs are not needed
;if you are sure the ACs will be defined.

DEFINE USRSAV,<
  IFDEF .FPAC,<
	SPCSAV(.SAV1,.FPAC)
	SPCSAV(.SAV2,<.FPAC,.FPAC+1>)
	SPCSAV(.SAV3,<.FPAC,.FPAC+1,.FPAC+2>)
	SPCSAV(.SAV4,<.FPAC,.FPAC+1,.FPAC+2,.FPAC+3>)
  >
>

EXT <.SAV1,.SAV2,.SAV3,.SAV4>
;THE FOLLOWING MACRO MAY BE USED TO SUPPRESS CREF ENTRIES FOR
;ALL THE JUNK SYMBOLS USED INTERNALLY WITHIN MACROS IN MACSYM

DEFINE .XCMSY <
	.XCREF
	.XCRF1 <..ACT,..CSC,..CSN,..IFT,..JX1,..MSK,..MX1,..MX2>
	.XCRF1 <..NAC,..NRGS,..NS,..NV,..PST,..STKN,..STKQ,..STKR>
	.XCRF1 <..TRR,..TSA1,..TX1,..TX2,..TXAC,.FP,.FPAC,.NAC,.SAC,.SAV1>
	.XCRF1 <.SAV2,.SAV3,POINTR,POS,..LDE,..FLG,WID,..CAS1,..CNS,..CNS2>
	.XCRF1 <..DPB,..GNCS,..ICNS,..JE,..JN,..LDB,..STR0,..STR1,..STR2>
	.XCRF1 <..STR4,..TMO,..TMZ,..TSAC,..TSIZ,..TX,..TY,.ACV1,.ACV2>
	.XCRF1 <..TX1,..TX2,..TXAC,..TX3,..TYNE,..TYNN>
	.XCRF1 <.ACV3,.CASE,.DECR0,.IF0,.INCR0,.OPST1,.OPST2,.STKV1>
	.XCRF1 <.STKV2,.STKV3,.TRV1,.TRV2,.TRV3>
	.XCRF1 <..OLD,...OLD,..BITS,..OFF,..LOC,.LDBE,..LDBE>
	.XCRF1 <..RELO>
	.CREF
   >
DEFINE .XCRF1 (SYMS)<
	IRP SYMS,<
	 IFDEF SYMS,< .XCREF SYMS>>>

>;END OF IFN FTOPS10
	SUBTTL	Definitions -- Operating System Dependent

;The following are some definitions that must be redefined depending upon
;the operating system being used.

;These are the TOPS-20 specific definitions

IFN FTOPS20,<

; $RELOC is kept for compatibility only

DEFINE	$RELOC <
	IF1,<PRINTX %Warning: $RELOC is being phased out>
	>

DEFINE	$HIGH <
	IF1,<PRINTX %Warning: $HIGH is being phased out>
	RESCD
	>

DEFINE	$LOW <
	IF1,<PRINTX %Warning: $LOW is being phased out>
	RESDT
	>

;For code generation, one of the TOPS-20 macros RESCD, RESCD(INIT),
; RESCD(SEC0) or SWAPCD should be used.

;For data declarations, one of the following macros should be used
;
; RESDT		Move to initialized data psect
; RESVR		Move to zeroed data psect
; SWAPVR	Move to swappable zeroed data psect

;Resident or non-resident variables in extended sections must be
; defined in STG; the macros live only within STG

DEFINE	RESVR <
	.ENDPS
	.PSECT RSVAR
	>

DEFINE	SWAPVR <
	.ENDPS
	.PSECT NRVAR
	>

>
IFN FTOPS10,<

;The TOPS-20 code and data generation macros are turned into $HIGH or $LOW
; on the 10.

DEFINE RESCD <$HIGH>
DEFINE SWAPCD <$HIGH>
DEFINE RESDT <$LOW>
DEFINE RESVR <$LOW>
DEFINE SWAPVR <$LOW>

;THE FOLLOWING OPCODES ARE USED TO REFERENCE DATA IN THE 'PREVIOUS
;CONTEXT'.  THE PREVIOUS CONTEXT IS THE USER ADDRESS SPACE IF
;THE JSYS CALL WAS EXECUTED BY A USER PROGRAM, OR THE
;MONITOR ADDRESS SPACE IF IT WAS EXECUTED BY THE MONITOR.
;WHEN WRITING JSYS CODE HOWEVER, IT IS CONVENIENT TO THINK OF THE
;CURRENT CONTEXT AS 'MONITOR' AND THE PREVIOUS CONTEXT AS
;'USER'.  THESE TERMS SHOULD BE UNDERSTOOD IN THIS WAY IN THE
;FOLLOWING DISCUSSION AND IN THE OPDEF'S.

;XCTU IS THE GENERAL CASE AND IS USED FOR ALL ORDINARY (ONE-ADDRESS)
;INSTRUCTIONS.  IF USED FOR BLT, IT WILL CAUSE BOTH SOURCE AND
;DESTINATION TO BE USER.

;XCTUU ARE USED TO BOTH COMPUTE EFFECTIVE ADDRS IN USER AND FETCH
;FROM USER, I.E. - XCTUU [MOVE T1,@T1]

;XBLTMU AND XBLTUM ARE USED WITH BLT TO DO MONITOR-TO-USER
;AND USER-TO-MONITOR BLT'S RESPECTIVELY.  XBLTUU IS ALSO DEFINED
;FOR CONSISTENCY FOR USER-TO-USER BLT.

;XCTBU IS USED WITH BYTE INSTRUCTIONS WHERE POINTER IS IN MONITOR,
;DATA IN USER.  XCTBUU IS BYTE INSTRUCTION WITH POINTER AND DATA
;IN USER (KI10 DOES NOT SUPPORT).

;XPSHUM AND XPOPMU ARE THE ONLY CASES OF PUSH AND POP CURRENTLY USED.
;XPSHUM MEANS PUSH USER-TO-MONITOR, XPOPMU MEANS POP MONITOR-TO-USER, ETC.
;ADDITIONAL SUCH MNEMONICS WILL BE DEFINED IF NEEDED.

OPDEF	XCTU	[XCT 4,0]	;DATA ONLY IS IN PREVIOUS CONTEXT
OPDEF	XCTUU	[XCT 14,0]	;"E" AND DATA FROM PREV. CONTEXT (INCLUDES AC LOOK-UP)


OPDEF	XBLTMU	[XCT 4,0]	;DATA FROM PREVIOUS CONTEXT
OPDEF	XBLTUM	[XCT 1,0]	;DATA TO PREVIOUS CONTEXT
OPDEF	XBLTUU	[XCT 5,0]	;DATA FROM AND TO PREVIOUS CONTEXT
OPDEF	XCTBU	[XCT 3,0]	;EXTENDED BLT - DATA FROM PREVIOUS CONTEXT
OPDEF	XCTBMU	[XCT 1,0]	;BLT - DATA TO PREVIOUS CONTEXT
OPDEF	XCTBUU	[XCT 7,0]	;POINTER,POINTER E AND DATA FROM PREVIOUS CONTEXT

OPDEF	XPSHUM	[XCT 4,0]	;STACK IN PREVIOUS CONTEXT
OPDEF	XPOPMU	[XCT 4,0]	;STACK IN PREVIOUS CONTEXT

.NODDT XCTU,XCTUU,XBLTMU,XBLTUM,XBLTUU,XCTBU,XCTBMU,XCTBUU,XPSHUM,XPOPMU

>;END IFN FTOPS10
	SUBTTL Macro Definitions -- Queue Management Macros

;These macros depend on the data structures QH and QP in NSPUNV.

;Put the block pointed to by BLKPTR at the end of HEADER's queue
;The arguments:	blkptr:	ac that points to block to be queued
;		header: pointer to QH data structure
;		offset: offset into block of forward pointer for this q
;		ac:	a temp ac other than CX, don't count on value


DEFINE ENDQUE(blkptr,header,offset,tempac),<
	OPSTR <SKIPN tempac,>,QHEND,+header
	STOR blkptr,QHBEG,+header
	SKIPE tempac
	STOR blkptr,QPNXT,+offset(tempac)
	STOR blkptr,QHEND,+header
	SETZRO QPNXT,+offset(blkptr)
	INCRQH(header,tempac)
>;END OF DEFINE ENDQUE



;INCRQH is used in LLINKS by the QSRTMB routine as well as by ENDQUE

DEFINE INCRQH(header,tempac),<

IF1,<IFN <QHCNT!QHMAX>+1 + <QHMAX!777777>+1 + QH.CNT - QH.MAX,<
	PRINTX ?BEGSTR QH is defined wrong for INCRQH(header)
>>
	AOS tempac,QH.CNT+header	;;ONE MORE ENTRY ON Q
	HLRZ CX,tempac			;;ISOLATE OLD MAX
	CAIGE CX,(tempac)		;;GOT A NEW MAX?
	HRLM tempac,QH.MAX+header	;;YES, STORE IT
>;END OF DEFINE INCRQH


;DECRQH is separated for symmetry with INCRQH

DEFINE DECRQH(header),<
	DECR QHCNT,+header
>;END OF DEFINE DECRQH
;These macros depend on the data structures QH and QP in NSPUNV.

;Take the first element off a queue and put pointer in designated AC
;The arguments:	ac:	Return pointer to dequeued block here
;		header: pointer to QH data structure
;		offset: offset into block of forward pointer for this q
;		empty:	JRST EMPTY if queue is empty
;		%label:	default this one, of course


DEFINE DEQUE(ac,header,offset,empty),<
	OPSTR <SKIPN ac,>,QHBEG,+header
	JRST empty
	OPSTR <SKIPN CX,>,QPNXT,+offset(ac)
	STOR CX,QHEND,+header
	STOR CX,QHBEG,+header
	DECRQH header
>
;Remove the block pointed to by BLKPTR from HEADER's queue
;The arguments:	blkptr:	ac that points to block to be queued
;		header: pointer to QH data structure
;		offset: offset into block of forward pointer for this q
;		ac:	a temp ac other than CX, don't count on value


DEFINE RMVQUE(blkptr,header,offset,tempac,%lab1,%lab2,%lab3),<
				;;POINT TO HEAD-OF-QUEUE PTR
IFN QPNXT+1,<PRINTX QPNXT muxt be a full word for RMVQUE>
IFN QHBEG+1,<PRINTX QHBEG muxt be a full word for RMVQUE>
IFN QHEND+1,<PRINTX QHEND muxt be a full word for RMVQUE>
	XMOVEI tempac,QH.BEG-QP.NXT-offset+header
%lab1:!
	OPSTR <CAMN blkptr,>,QPNXT,+offset(tempac)
	JRST %lab2		;;FOUND IT, NOW REMOVE IT
	LOAD tempac,QPNXT,+offset(tempac) ;;GET NEXT POINTER
	JUMPE tempac,%lab3	;;NO MORE, CAN'T REMOVE IF NOT THERE
	JRST %lab1		;;NOW TRY THIS ONE
%lab2:!
	SKIPN CX,QP.NXT+offset(blkptr)	;;GET NEXT POINTER
	STOR tempac,QHEND,+header     	;;IF ITS ZERO, UPDATE END PTR
	STOR CX,QPNXT,+offset(tempac) 	;;STORE IT IN PREVIOUS BLOCK
	SKIPN tempac,QH.BEG+header    	;;IF LIST IS NOW EMPTY
	STOR tempac,QHEND,+header     	;; THEN ZERO END PTR TOO FOR ENDQUE
	DECRQH header		;;DECREMENT THE Q COUNTER
%lab3:!
>;END OF RMVQUE MACRO
	SUBTTL	Macro Definitions -- ASSUME - verify symbol values

;Assume macro verifies a relation between two values
	DEFINE ASSUME(A,B,C) <
	IFIDN <B><EQ>,<IFN <A> - <C>,<IF1 <PRINTX ?ASSUME failed: 'A 'B 'C>>>
	IFIDN <B><NE>,<IFE <A> - <C>,<IF1 <PRINTX ?ASSUME failed: 'A 'B 'C>>>
	IFIDN <B><GT>,<IFLE <A> - <C>,<IF1 <PRINTX ?ASSUME failed: 'A 'B 'C>>>
	IFIDN <B><LT>,<IFGE <A> - <C>,<IF1 <PRINTX ?ASSUME failed: 'A 'B 'C>>>
	>
	SUBTTL	Macro Definitions -- D36SYM - MACSYM fixups

;D36SYM should be called by DECnet-36 modules which call TOPS-20's
;MACSYM universal after SEARCHing MACSYM and D36PAR.  It redefines
;those variables, macros and OPDEFs from MACSYM which do not fit into
;the DECnet-36 environment as defined in MACSYM.

IFE FTOPS10,<DEFINE D36SYM,<PURGE P3,P4>>
	SUBTTL	Macro Definitions -- Network management -- Error macro

;Define error macro that works like RETBAD, except that it understands
; negative error codes

DEFINE RNMXER (ERN,EXTRA)<
	IFNB <ERN'EXTRA>,<
	JRST [	EXTRA
	   IFNB <ERN>,<MOVX T1,ERN>
		RET]>
	IFB <ERN'EXTRA>,<
	RET>>

	SUBTTL	Macro Definitions -- Network management -- No data macro

;Define macro that returns a 'no data present' code

DEFINE RNMXND <
	JRST [	MOVX T1,NF.NDP
		RET]
>

	SUBTTL	Macro Definitions -- Network management -- Success macro

;Define success macro that does a return with success code loaded into T1

DEFINE RNMXOK <
	JRST [	MOVX T1,NF.FCS
		RET]
>
	SUBTTL	Macro Definitions -- Network management -- Parameters

;The PA structure is used to keep the information for a DECnet network
;management parameter.  It is pointed to by a table, generated with the
;PARAMETER macro.  This structure is read by the routine NTPARM in D36COM.

	BEGSTR PA
		FIELD FLA,5	;[7318]Flag field
	  	  BIT NST	;[7318]Cannot set this parameter
		  BIT NCL	;[7318]Cannot clear this parameter
		  BIT NRD	;[7318]Cannot read this parameter (Write only memory)
		  BIT BEX	;[7318]Buffer from NTMAN expected
		  BIT DRC	;[7318]Don't range check "set" value
		FILLER 13	;[7318]
		HWORD PNR	;[7318]Parameter #
		WORD DEF	;[7318]Default value for parameter
		WORD MAX	;[7318]Maximum value that can be set
		WORD MIN	;[7318]Minimum value that be set
		WORD SET	;Instruction to execute to set the parameter
		WORD RED	;Instruction to execute to read the parameter
		WORD CLR	;Instruction to execute to clear the parameter
	ENDSTR

;The PARAMETER macro generates one entry in the parameter table
;Make sure that the assumtions are valid
	ASSUME PAPNR,EQ,<0,,-1>	;[7318]
	ASSUME PA.PNR,EQ,0	;[7318]
	ASSUME PA.NST,EQ,0	;[7318]
	ASSUME PA.NCL,EQ,0	;[7318]
	ASSUME PA.NRD,EQ,0	;[7318]
	ASSUME PADEF,EQ,-1	;[7318]
	ASSUME PA.DEF,EQ,1	;[7318]
	ASSUME PA.MAX,EQ,2	;[7318]
	ASSUME PA.MIN,EQ,3	;[7318]
	ASSUME PA.SET,EQ,4	;[7318]
	ASSUME PA.RED,EQ,5	;[7318]
	ASSUME PA.CLR,EQ,6	;[7318]
;Define PARAMETER macro
DEFINE PARAMETER (NR,XFLAG,XMAX,XMIN,XDEF,XSET,XREAD,XCLEAR,COMNT) <
   IFB <XFLAG>,<FLAG==0>
   IFNB <XFLAG>,<FLAG==XFLAG>
   IFB <XMAX>,<MAX==^D65535>
   IFNB <XMAX>,<MAX==XMAX>
   IFB <XMIN>,<MIN==0>
   IFNB <XMIN>,<MIN==XMIN>
   IFB <XDEF>,<DEF==0,,-1>
   IFNB <XDEF>,<DEF==XDEF>
   IFE <<CURPSX-PXRESCD>*<CURPSX-PXSWAPCD>>,<
	XCDSEC,,[FLAG!NR>	;[7318]
   IFN <<CURPSX-PXRESCD>*<CURPSX-PXSWAPCD>>,<
	 MSEC1,,[FLAG!NR>	;[7318]
		DEF		;[7318]
		MAX		;[7318]
		MIN		;[7318]
  IFNB <XSET>, <XSET>
   IFB <XSET>, <TRN>
 IFNB <XREAD>, <XREAD>
  IFB <XREAD>, <TRN>
 IFNB <XCLEAR>,<XCLEAR>
 IFB <XCLEAR>, <TRN> ]
>
	SUBTTL	Macro Definitions -- Network management -- Counters

;The CT structure is used to keep the information for a DECnet network
;management counter.  It is pointed to by a table, generated with the
;COUNTER macro.  This structure is read by the routine NTCTRS in D36COM.

	BEGSTR CT
		FIELD BMF,1	;Bit map flag
		FIELD HDR,35	;Counter width, number
		WORD RED	;Instruction to execute to read the counter
		WORD CLR	;Instruction to execute to clear the counter
		WORD BMC	;Instruction to execute to get the bit map
	ENDSTR

;The COUNTER macro generates one entry in the counter table
;First make sure that the COUNTER macros assumptions are valid
	ASSUME CTRED,EQ,-1
	ASSUME CT.RED,EQ,1
	ASSUME CTCLR,EQ,-1
	ASSUME CT.CLR,EQ,2

;Now define COUNTER macro
DEFINE COUNTER(NR,WIDTH,ACCESS,CLEAR,BMACC,COMMENT) <

  IFNB <BMACC>,<FLAG==<CTBMF_-^D18>>
   IFB <BMACC>,<FLAG==0>

   IFE <<CURPSX-PXRESCD>*<CURPSX-PXSWAPCD>>,<
	XCDSEC,,[XWD FLAG!WIDTH,NR>
   IFN <<CURPSX-PXRESCD>*<CURPSX-PXSWAPCD>>,<
	MSEC1,,[XWD FLAG!WIDTH,NR>
		ACCESS
 IFNB <CLEAR>, <CLEAR>
 IFB <CLEAR>,  <TRN>
 IFNB <BMACC>, <BMACC> ]
>
	SUBTTL	Structure Definitions -- Queue Header

;See macros ENDQUE, DEQUE and RMVQUE for examples of QH uses.
;LLINKS also uses these definitions in its QSRTMB routine

;When a queue is emptied, DEQUE assures that the QHBEG pointer, the
;QHEND pointer and the QHCNT count will be zero.

BEGSTR QH
	WORD BEG		;THESE MAY BE MADE LESS THAN FULL WORDS
	WORD END		; IF NEED BE AND FULL-WORD ADDRESSING
				; IS NOT REQUIRED.
	HWORD MAX		;MAX LENGTH QUEUE EVER GOT
	HWORD CNT		;CURRENT LENGTH OF QUEUE
ENDSTR


;Structure QP, queue pointer, is included to emphasize the fact that
;ENDQUE and DEQUE expect the forward pointer in a block to be a full
;word, and to simplify the addition of backward pointers should that
;become desirable.

;Note that the message block does not use QP, since it is in the
;universal file, not in LLINKS.  There is a comment in the definition
;of the message block pointing out that the forward pointer must be a
;full word for LLINKS.

BEGSTR QP
	WORD NXT		;POINTER TO NEXT BLOCK ON QUEUE
ENDSTR

;Byte pointer and count structure. Routines DNGUBY, DNPUBY, and
;all related DNGUnB require a pointer to this type of structure.
;All byte pointers are section local (for the moment)

BEGSTR BP
	WORD BPT		;BYTE POINTER TO USER STRING
	WORD BYT		;BYTE COUNT LEFT
ENDSTR

;DNGUBY will return an error of NEPAM% if the count BPPYT runs out,
;DNPUBY will return an error of NEPVL% if the count runs out,
;and both will return NEADC% if they get an addressing error of
;any kind.
	SUBTTL	Structure Definitions -- DECnet-36 Initialization Block

;The initialization block is the argument to all DECnet-36 initialization
; routines.  It is set with NODE% jsys functions, and read by the various
; DECnet layers during and after initialization.

	BEGSTR IB
		FIELD PH2,1	;Set if Phase II desired
		FILLER 1
		FIELD RTR,4	;Routing type: one of
				; RNT.L1 Level-1 router
				; RNT.NR Endnode
		FIELD FCM,2	;Default flow control
		WORD NAM	;Executor node name (in sixbit)
		WORD ADR	;Executor node address (16-bit address)
		WORD MXA	;Maximum address
		WORD MXB	;Maximum buffers
		WORD DGL	;Default goal
		WORD DBL	;Default # of buffers per link
		WORD BIP	;Buffer input percentage
		WORD BSZ	;Buffer size
	ENDSTR
	SUBTTL	Structure Definitions -- DECnet-36 Message Descriptor

;This is the DECnet-36 Message Segment Descrpitor.  Every Segment of
;the message is described by this small block.  In the typical case,
;this descriptor resides in the owner's (the owner being a level of
;DECnet) portion of the Message Block.
;
;NSP's message trace facility (TRCMSG) makes illicit use of the MSD
;fields and of the nature of the position value returned by DNRPOS.
;The trace program DNTATL also knows about the structure of the MSD.
;
;Note that DTESER and D8KINT 'know' that all the fields in the MSD
;are full-words.

BEGSTR MD		;Input Meaning,      ;Output Meaning
	WORD NXT,QP.LEN	;MUST BE ZERO        ;PTR TO NEXT MSD
	WORD PTR	;ILDB PTR INTO MSG   ;IDPB PTR INTO MSG
	WORD AUX	;NOT USED            ;ILDB PTR TO BEG OF MSG
	WORD BYT	;BYTES LEFT TO READ  ;BYTES WRITTEN SO FAR
	FIELD VMC,3	;VIRTUAL MAP CONTEXT
		VMC.XC==:0	;EXEC Context (Map through EPT)
		VMC.US==:1	;USER Context (Map through UPT)
		VMC.NO==:2	;DO NOT Map (Physical Address)
	HWORD ALL	;ALLOCATED LENGTH IN BYTES
	WORD ALA	;ALLOCATED ADDRESS OF SEGMENT'S DATA
ENDSTR
	SUBTTL	Structure Definitions -- DECnet-36 Message Block

;The following is the definition of the DECnet-36 Message Block.  This is
;the fundamental data structure used to represent an individual message.
;The Message Block is divided up into a public section and several private
;sections which belong to each of the layers of the DECnet architecture.

;The Public Section

BEGSTR MB
	WORD NXT		;PTR TO NEXT MESSAGE.  MUST BE FULL
				; WORD FOR NSP, SEE BEGSTR QP IN LLINKS.MAC
	WORD FMS		;POINTER TO FIRST MSD (DLLs
				; EXPECT THIS FIELD TO BE RIGHT HERE)
	WORD MSN		;DDCMP MESSAGE NUMBER (DLLs
				; EXPECT THIS FIELD TO BE RIGHT HERE)
	HWORD DST		;DESTINATION NODE
	HWORD SRC		;SOURCE NODE
	WORD DS1		; FIRST 32 BITS OF DESTINATION
	WORD SR1		; FIRST 32 BITS OF SOURCE
	FIELD FLG,9		;FLAGS
	  BIT OTH		;ON THE "OTHER" SUBLINK
	  BIT BOM		;BEGINNING OF MESSAGE
	  BIT EOM		;END OF MESSAGE
	  BIT EBF		;MESSAGE BLOCK HAS BEEN ALLOCATED FROM
				; EMERGENCY BUFFER FREE LIST
	  BIT PH2		;PHASE II MESSAGE
	  BIT DON		;"SYNCHRONOUS" INTERLOCK DONE BIT (NSP & SC)
	  BIT LCL		;BOUND FOR THE LOCAL NSP
	  BIT UNR		;UNREACHABLE

	FIELD VST,9		;VISITS COUNT
	HWORD ABS		;Adjacency's block size
	WORD CHN		;LOOPBACK CHANNEL (CIRCUIT ID)
	WORD PRC		;PROCEDURE PROCESSOR (NSP & SC)
	WORD AR1		;ARGUMENT STORAGE #1 (NSP & SC)
	WORD AR2		;ARGUMENT STORAGE #2 (NSP & SC)
	WORD AR3		;ARGUMENT STORAGE #3 (NSP & SC)
ENDSTR
;Router's Section

	RMH.LN==^D 21		;BYTES FOR RTR HEADER

BEGSTR RM,MB.LST
	WORD OCP		;OUTPUT CIRCUIT BLK PTR
	WORD ICP		;INPUT CIRCUIT BLK PTR
	WORD OAP		;OUTPUT ADJACENCY POINTER
	WORD IAP		;INPUT ADJACENCY POINTER
	FILLER 1		;FILLER SO THAT FST FITS BETTER
	FIELD FST,8		;FIRST BYTE IN MESSAGE
				;** THIS ORDER MUST BE ENFORCED **
				;Phase III definitions
	  BIT MZ1		; RESERVED (MUST BE ZERO)
	  BIT EVL		; EVOLUTION BIT (RESERVED)
	  BIT MZ2		; RESERVED (MUST BE ZERO)
	  BIT RTS		; BEING RETURNED TO SENDER
	  BIT RQR		; RETURN REQUESTED
	  BIT MZ3		; RESERVED (MUST BE ZERO)
	  BIT MB1		; RESERVED (MUST BE ONE)
	  BIT CTL		; CONTROL MESSAGE (NOT DATA)
;
; Redefine the bits for the Phase IV packet format

;	SYNSTR RMPFD,RMMZ1 ;PAD FIELD
;	SYNSTR RMVER,RMEVL ;VERSION (1 IF PHASE II)
;	SYNSTR RMINP,RMMZ2 ;INTRA-NI PACKET
;	SYNSTR RMLGF,RMMZ3 ;LONG FORMAT HEADER

	FIELD CTY,3		; CONTROL MESSAGE TYPE
	FIELD FLG,5		;FLAG FIELD
	  BIT ODN		; LOCAL NSP DOESN'T WANT THIS LOCAL MESSAGE
				;  "ODN"ED
	  BIT PH2		;MESSAGE SEEMS TO BE PHASE II
	  BIT TRY		;NSP wants Router to "TRYHARD" on the NI
	  BIT TST		;This is a test message
	  BIT DRM		;This message should be resent to multicast
				; "All-Endnodes"
	WORD MSD,MD.LEN		;ROOM FOR RTR MESSAGE DESCRIPTOR

;Note that the HDR field is only used on output and that the marks
;are only used on input, so they occupy the same space.

	WORD HDR,<<RMH.LN+3>/4> ;RTR HEADER ROOM (** OUTPUT ONLY **)
	WORD MK1		;FIRST MARK
	WORD MK2		;SECOND MARK
ENDSTR
;Network Services Section

	NMH.LN==^D 12		;LENGTH OF HEADER SPACE (BYTES)
				;** MUST BE AT LEAST 2 WORD FOR MARKS

BEGSTR NM,RM.LST
	FIELD FLG,6		;FLAGS
	  BIT ACK		;NEEDS TO BE ACKED
	  BIT RET		;RETURN MSG TO SC
	  BIT DLY		;ACK DELAY ALLOWED
	FIELD SGN,12		;MESSAGE SEGMENT NUMBER
	FIELD MGF,9		;THE MSGFLG FIELD OF THE NSP HEADER
	FIELD CNT,9		;# OF TIMES WE'VE SENT MESSAGE
	WORD TIM		;TIME STAMP
	WORD PRT		;PTR TO PORT BLOCK
	HWORD LLA		;LOCAL LINK ADDRESS
	HWORD RLA		;REMOTE LINK ADDRESS
	WORD MSD,MD.LEN		;SPACE FOR MSD

	WORD ORQ,QP.LEN		;ORQ queue link
	WORD MAG		;Magic word for DTESRV

;Note that the HDR field is only used on output and that the marks
;are only used on input, so they occupy the same space.

	WORD HDR,<<NMH.LN+3>/4> ;NSP HEADER ROOM
	WORD MK1		;FIRST MARK
	WORD MK2		;SECOND MARK
ENDSTR
;Here is the User Data Area

	UDH.LN==^D16		;BYTES OF USER DATA KEPT IN MSG BLK

BEGSTR UD,NM.LST
	WORD MSD,MD.LEN		;SPACE FOR MSD
	WORD DAT,<<UDH.LN+3>/4>	;ROOM FOR 16 BYTES ALWAYS AVAILABLE
ENDSTR

	MB.LEN==UD.LST		;REDEFINE LENGTH OF MB

;We make use of the User Data MSD (UD.MSD) as the input MSD (on input
;all the message data is in one MSD.  References to the input MSD
;should use the symbol IN.MSD.
;
	XP IN.MSD,UD.MSD	;DEFINE THE INPUT MSD
;
;We will also define a first MSD (FI.MSD), which will most likely be
;RM.MSD (the router MSD), although all references to it should be
;to FI.MSD.
;
	XP FI.MSD,RM.MSD	;FIRST MSD IN A MESSAGE BLOCK
;
;The following fields are used to pass the NSP.  UUO arguments from
;SCxUUO and SCLUUO to SCLINK.  When SCLINK returns control back to
;SCxUUO, it changes these arguments and expects SCxUUO to change them
;in the user's argument block.  These arguments are stored over the
;private portions of the message block.
;
;When Session Control uses a message block like this, it can never be
;used as a conventional message block (i.e.  with MSDs, etc.).

BEGSTR SA,MB.LST		;START RIGHT AFTER PUBLIC PORTION OF MB
	FIELD FLG,6		;FLAGS (NOTE: THESE MUST BE IN
				; THE SAME ORDER AS NSWAI AND NSEOM)
	  BIT WAI		; WAIT IF USER WANTS (CHECK NS.WAI)
	  BIT EOM		; END OF MESSAGE FLAG
	  BIT BOM		; BEGINNING OF MESSAGE FLAG
	  BIT KCB		; KEEP CONNECT BLOCK FOR LIFE OF LINK
	  BIT BLK		; HIBER ROUTINE HAS BLOCKED.
				;Room for future MONUSR flags 
	FIELD MFG,6		;MONUSR FLAGS, NOT PART OF SAFLG!
	  BIT EVA		; USER BUFFER IN EXEC VIRTUAL ADDR SPACE
	  BIT SAT		; DATA READ SATISFIED
				;Room for future monitor flags
	HWORD ERR		;PLACE TO STORE ERROR RETURN
	HWORD NAG		;NUMBER OF USER ARGUMENTS SUPPLIED
	HWORD AFN		;FUNCTION CODE
	HWORD AST		;STATUS VARIABLE
	HWORD ACH		;CHANNEL OR JOB NUMBER
	WORD AA1		;ARGUMENT ONE
	WORD AA2		;ARGUMENT TWO
	WORD AA3		;ARGUMENT THREE
	WORD SBP		;POINTER TO STRING BLOCK
	WORD CBP		;POINTER TO CONNECT BLOCK
	WORD BCT		;BUFFER BYTE COUNT
	WORD BPT,2		;BUFFER BYTE POINTER (POSSIBLY EXTENDED)
	WORD SJB		;POINTER TO SESSION CONTROL JOB BLOCK
	WORD SLB		;POINTER TO SESSION CONTROL LINK BLOCK
	WORD SLT		;Indirect table entry this SAB belongs in

	WORD HBA		;ADDRESS OF ROUTINE TO PERFORM HIBER
	WORD WKA		;ADDRESS OF ROUTINE TO PERFORM WAKE

	WORD UID		;SLB'S SERIAL NUMBER - FOR STALE DETECTION
ENDSTR

IFG <SA.LST-MB.LEN>,<IF2,<PRINTX ?Session Control SA structure is longer
			  PRINTX ? than a message block.>>
SA.LEN==SA.LST+1		;MAKE SA.LEN INCLUDE MB.LEN
	SUBTTL	Structure Definitions -- Session Control Link Block

;This is the sub-link block.  There are two of these in the SL block, one
;for the normal sub-link and one for the other sublink.

BEGSTR SS
	FIELD FLG,18		;FLAG FIELD
	  BIT OTH		;INDICATES THIS IS THE "OTHER" SUB-LINK
	FIELD XDO,9		;SUBLINK TRANSMIT DRQS OUTSTANDING
	FIELD RDO,9		;SUBLINK RECEIVE DRQS OUTSTANDING
	WORD INQ,QH.LEN		;SUBLINK INPUT QUEUE
ENDSTR


;This is the Session Control Link Block.  It contains all the per-logical
;link data.

BEGSTR SL			;SESSION CONTROL LINK BLOCK
	WORD ASQ		;NEXT SLB ON ALL SLBs QUEUE
	WORD NXP		;NEXT SLB WITH ACTIVE PSI
	WORD JFQ		;NEXT SLB WITH ACTIVE JIFFY REQUEST
	WORD SLB		;CHECK POINTER TO THIS SLB
	WORD SJB		;POINTER TO JOB BLOCK (SJB)
	WORD CHN		;CHANNEL NUMBER (STARTS AT 1)

	HWORD DOB		;DESTINATION OBJECT TYPE
	HWORD SOB		;SOURCE OBJECT TYPE

	FIELD FLG,18		;FLAG FIELD
	  BIT CCB		; CHECK CONNECT BLOCK
	  BIT KCB		; KEEP CONNECT BLOCK FOR LIFE OF LINK
	  BIT PSI		; PSI PENDING FLAG
	  BIT PH2		; PHASE II HAS NO RESEND CAPABILITY
	  BIT ABO		; TRYING TO CLOSE AFTER ABORT & RELEASE
	  BIT FSL		; FREE THE SLB WHEN DONE WITH ALL PROCESSING
	  BIT BSY		; SLB IS BUSY (CANNOT BE FREED)
	  BIT LBC		; LINK IS BEING CLOSED BY NSP
	  BIT JFR		; JIFFY REQUEST OUTSTANDING
	  BIT EOM		; LAST SEGMENT OUTPUT WAS END OF MESSAGE
	  BIT PAS		; Set if this SLB belongs to a passive task

	FIELD STA,6		;SESSION CONTROL STATE
	FIELD XFL,3		;TRANSMIT FLOW CONTROL OPTION
	FIELD RFL,3		;RECEIVE FLOW CONTROL OPTION

	HWORD GOL		;RECEIVE DATA REQUEST GOAL

	HWORD INQ		;INPUT QUOTA FOR LINK
	HWORD OTQ		;OUTPUT QUOTA FOR LINK
	HWORD INU		;INPUT BUFFERS IN USE
	HWORD OTU		;OUTPUT BUFFERS IN USE

	HWORD SST		;LINK STATUS WORD
	HWORD PSM		;THE PSI MASK

	WORD NSL,SS.LEN		;"NORMAL" SUBLINK
	WORD OSL,SS.LEN		;"OTHER" SUBLINK

	HWORD DRR		;NORMAL DATA REQUESTS TO RESEND AT CLOCK LEVEL
	HWORD RSN		;REASON CODE OF DISCONNECT OR REJECT (16 BITS)

	WORD PID		;NSPpid OF PORT

	HWORD DNA		;DESTINATION NODE ADDRESS
	HWORD SIZ		;SEGMENT SIZE IN BYTES

	WORD CTM		;CONNECT INITIATE TIMER
	WORD WKA		;ADDRESS OF WAKEUP ROUTINE
	WORD CDM		;PTR TO CONNECT/DISCONNECT MESSAGE
	WORD CBP		;POINTER TO CONNECT BLOCK FOR PASSIVE TASK
	WORD OTM		;PTR TO PARTIALLY FILLED OUTPUT MESSAGE

	WORD UID		;SERIAL NUMBER - FOR STALE DETECTION

	HWORD BYS		;User bytes sent
	HWORD BYR		;User bytes received

	HWORD PKS		;PACKETS SENT OUT
	HWORD PKR		;PACKETS RECIEVED
ENDSTR
	SUBTTL	Structure Definitions -- Session Control Job Block

;We allocate SLT.LN number of channels in the channel table in the SJB
;itself.  When a job has more than SLT.LN channels open, we allocate
;the table from free core.
;
	XP SLT.LN,4		;LENGTH OF INITIAL SLB TABLE
;
;There is one Session Control Job Block for every job with an open
;logical link on the system.

BEGSTR SJ			;SESSION CONTROL JOB BLOCK
	WORD NXT		;NEXT JOB BLOCK IN SYSTEM
	WORD CHT		;PTR TO SLB TABLE (INDEXED BY CHANNEL)
	WORD CHC		;COUNT OF SPACES ALLOCATED IN SLB TABLE
	WORD PSJ		;POINTER TO SYSTEM'S POINTER TO THE SJB
				; THIS POINTS TO PDBSJB ON TOPS-10 AND
				; IS USED FOR RESET PROCESSING

	FIELD FLG,9		;FLAGS FIELD
IFN FTOPS20,BIT BLK		;(20  )THIS FORK IS BLOCKED
IFN FTOPS10,BIT PRV		;(10  )USER IS PRVJ PRIVILEGED
	  BIT RST		;(both)RESET IN PROGRESS
IFN FTOPS10,FIELD JOB,9		;(10)JOB NUMBER
IFN FTOPS20,FIELD FRK,9		;(20)FORK NUMBER
	HWORD CTA		;NUMBER OF CI TIMERS ACTIVE FOR JOB

	WORD SLT,SLT.LN		;INITIAL SLB TABLE
	WORD TXQ,QH.LEN		;TRANSACTION QUEUE OF LLINKS CALLS
	WORD PSQ,QH.LEN		;QUEUE OF SLBs WITH PSIs OUTSTANDING

;Note that the following two quotas are copied in SCUUO from the PDB's
;information about the job quotas

	HWORD GOL		;INPUT DATA REQUEST GOAL
	HWORD INQ		;JOB INPUT QUOTA
	HWORD OTQ		;JOB OUTPUT QUOTA
	HWORD INU		;BUFFERS USED TOWARD INPUT QUOTA BY JOB
	HWORD OTU		;BUFFERS USED TOWARD OUTPUT QUOTA BY JOB

	WORD SAB		;SA BLOCK POINTER
IFN FTOPS10,WORD MUU		;(10)SAVE MUUO WORD HERE FOR STOTAC, ETC
IFN FTOPS20,<
	WORD PRT		;(20)Pointer to the port indirect table
	WORD MXP		;(20)Number of slots in port table
> ;End of FTOPS20
ENDSTR
	SUBTTL Structure Definitions -- NSP Sublink Block

;The Sublink Block is part of the link block.  It holds the information
;about the "normal" and the "other" sublinks.
;
;The structure name ES is used instead of the more obvious NS
;(NSP Sublink) to avoid a conflict with the other NS structure
;defined in this universal file.  The "E" stands for the new
;name for the NSP layer: "End-to-end" layer.

BEGSTR ES
	FIELD FLG,12		;FLAGS, KEEP FIELD MOD 3 WIDE FOR DDT
	  BIT OTH		;SET IF THIS IS OTHER SUBLINK
	  BIT ACK		;SEND ACK FOR THIS SUBLINK NEXT JIFFY
	  BIT NAK		;SEND NAK TO PH2 NSP (TURN ACK ON TOO)
	  BIT ROF		;RECEIVE IS OFF
	  BIT ROC		;RECEIVE OFF HAS CHANGED
	  BIT XOF		;XMIT IS OFF
;	  BIT XOC		;XMIT OFF HAS CHANGED (NOT USED)
	  BIT BFR		;REMOTE IS "BUFFER-RICH" ON THIS LINK
	  BIT DLY		;ACK DELAYING ALLOWED
	FILLER 1		;MAKE FOLLOWING FIELD PRETTY FOR DDT
	FIELD RFL,2		;RECEIVE FLOW CONTROL TYPE
	FILLER 1		;MAKE FOLLOWING FIELD PRETTY FOR DDT
	FIELD XFL,2		;XMIT FLOW CONTROL TYPE
	FIELD GOL,9		;DATA REQUEST GOAL (9 FOR DDT EASE)
	FIELD CGL,9		;AFTER-CONGESTION RECOVERY GOAL

	NXTWRD
	FIELD XLD,8		;XMIT DRQS OUTSTANDING TO LOCAL SC
	FIELD XRD,8		;XMIT DRQS OUTSTANDING TO REMOTE NSP
	FIELD XSD,8		;XMIT DRQS NEED TO SEND TO SC

	NXTWRD
	FIELD RLD,8		;RECEIVE DRQS OUTSTANDING TO LOCAL SC
	FIELD RRD,8		;RECEIVE DRQS OUTSTANDING TO REMOTE NSP
	FIELD RSD,8		;RECEIVE DRQS NEED TO SEND TO SC

	NXTWRD
	FIELD LMA,12		;LAST MESSAGE NUMBER ASSIGNED
	FIELD LAR,12		;LAST ACK RECEIVED (AND PROCESSED)
	FIELD LMR,12		;LAST MESSAGE RECEIVED

	WORD AKQ,QH.LEN		;QUEUE HEADER FOR THE TO-BE-ACKED Q
	WORD RCQ,QH.LEN		;QUEUE HEADER FOR THE RECEIVE Q
	WORD XMQ,QH.LEN		;QUEUE HEADER FOR THE XMIT Q

	FIELD CWS,12		;Current window size
	FIELD CDA,12		;# of ACKs since last window change
	FIELD DLT,12		;ACK delay timer

ENDSTR
 	SUBTTL Structure Definitions -- NSP LINK Block

;The Link Block holds all the NSP information about this logical link.

BEGSTR EL
	WORD APQ,QP.LEN		;NEXT IN QUEUE OF ALL LINK BLOCKS
	WORD HBQ,QP.LEN		;NEXT IN QUEUE OF LINKS IN A HASH BUCKET
	WORD JFQ,QP.LEN		;NEXT IN QUEUE OF LINKS NEEDING JIFFY SERVICE
	FIELD FLG,9		;FLAGS, MOD 3 NUMBER OF BITS FOR DDT
	  BIT OJQ		;LINK IS ON THE JIFFY-REQUEST QUEUE
	  BIT SNC		;SET IF NOT YET TOLD SC ABOUT NO CONF
	  BIT CNF		;SET IF WE HAVE CONFIDENCE IN LINK
	  BIT SCM		;SEND CONNECT ACK MESSAGE NEXT JIFFY
	  BIT SDM		;SEND DISCONNECT CONFIRM MESSAGE NEXT JIFFY
	  BIT ABO		;ABORTING THIS LOGICAL LINK
	  BIT DTO		;DELAY TIMER IS FOR "OTHER" SUBLINK
	FIELD STA,6		;NSP STATE OF THIS LINK
	HWORD SIZ		;MAX SIZE OF A SEGMENT ON THIS LINK

	HWORD LLA		;LOCAL LINK ADDRESS
	HWORD RLA		;REMOTE LINK ADDRESS

	WORD ORQ,QH.LEN		;Queue header for MBs sent to ROUTER and
				; expected to be returned to LLINKS
	WORD CLC		;Count of retries left, trying to close a
				; port waiting for MBs to be returned from
				; ROUTER and children.

	HWORD ORC		;COUNT OF MSGS OUT IN ROUTER
	FIELD VER,3		;VERSION OF REMOTE NSP, SEE VER3.1,VER3.2
	FILLER 3		;MAKE DTM RIGHT JUSTIFIED FOR DDT
	FIELD DSG,12		;MSG SEGMENT BEING TIMED FOR DELAY CALC
				; (MUST BE SEGNUM-SIZE FIELD FOR CMODxx)
	WORD DTM		; AND TIME IT WAS FIRST SENT

	HWORD NNM		;THE REMOTE'S NODE NUMBER
	WORD NDB		;PTR TO NSP NODE BLOCK

	WORD TMA		;INACTIVITY TIMER
	WORD SCV		;SESSION CONTROL CALL VECTOR BASE ADDRESS
	WORD SCB		;SESSION CONTROL BLOCK ID
	WORD CIM		;Ptr to (R)CI message
	WORD DIM		;PTR TO DI MESSAGE
	WORD NSL,ES.LEN		;THE NORMAL SUBLINK BLOCK
	WORD OSL,ES.LEN		;THE OTHER SUBLINK BLOCK


	WORD CIR		;OUTPUT CIRCUIT FOR LOOPBACK CONNECTION

	WORD CHK		;ADDRESS OF THIS EL, FOR ADDR CHECK
ENDSTR
	SUBTTL  Structure Definitions -- Router Adjacency Block
BEGSTR AJ
	WORD NXT		;Pointer to next adjacency block

	FIELD STA,2		;Adjacency state
	FIELD NTY,4		;Neighbor node type

	FIELD FLA,6		;Flag field
	  BIT PH4		;Phase 4 node
	  BIT VRQ		;Verification requested by remote
	  BIT BLO		;Blocking is requested by this node
	  BIT RJF		;Reject flag
	  BIT MTA		;No multi-cast traffic accepted
	FIELD VER,8		;Version of neighbor's router
	FIELD ECO,8		;ECO number of neighbor's router
	FIELD CUS,8		;Customer version of neighbor's router

	WORD NAH		;Adjacency's hi-order address (NI)
	FIELD NAL,18		;Low order in string format <a1,a2>
	FILLER 2
	FIELD NAA,6		;Adjacency's node area
	FIELD NAN,10		;Adjacency's node number
	 MSKSTR (AJADR,AJ.NAN,<AJNAA!AJNAN>) ; 16 bit address of adjacency
; Make a macro to be sure masks are in same word
	WORD RTV		;Pointer to this adjacency's routing vector
	WORD CBP		;Circuit block for this adjacency
	WORD BSZ		;Block size requested by neighbor
	WORD NHT		;Neighbor's hello timer
	WORD TLR		;Time last message received from adjacency
	FIELD PRI,8		;Routers priority to be designated router (NI)
	FIELD ARE,8		;Routers area (reserved field)
	FIELD MPD,^D16		;MPD (reserved)

ENDSTR


;These are the various types of nodes (in FIELD AJNTY).

	XP ADJ.3F,0		;Phase III routing node
	XP ADJ.3S,1		;Phase III non-routing node
	XP ADJ.L2,3		;Phase IV level II router
	XP ADJ.L1,4		;Phase IV level I router
	XP ADJ.LN,5		;Phase IV non-routing
	 ADJ.MX==ADJ.LN		;Maximum node type

;These are the various states in field AJSTA

	XP ADJ.UN,0		;This entry is currently unused
	XP ADJ.IN,1		;Currently initializing
	XP ADJ.UP,2		;Adjacency is up
	XP ADJ.OL,3		;Adjacency is off-line
	SUBTTL  Structure Definitions -- Router Circuit Block

;This structure contains all the "per-circuit" data for Router-36.

BEGSTR RC
	WORD NXT		;Pointer to next circuit block
	WORD LID		;Circuit ID
	WORD DLB		;Data link block address
	WORD AJQ,QH.LEN		;Queue of adjacencies belonging to this circuit

	FIELD FLG,6		;Place for some flags
	  BIT BCT		; Broadcast circuit (should be bit 0)
	  BIT SRM		; Send routing message flag
	  BIT EBU		; Emergency buffer is in use
	  BIT SHM		; Send hello message
	  BIT DSR		; We are the designated router

	FIELD STA,3		; Circuit state
	FIELD CST,12		; Circuit cost
	FIELD DRT,9		; Timer before we assume DSR role

	WORD TLS		;Time last message of any type was sent
	WORD TLR		;Time last routing message was sent
	WORD TLH		;Time we sent the last hello (NI only)
	WORD TIN		;Time we got protocol up from controller
	WORD TM3		;Hello message timer
	HWORD BSZ		;Minimum of adjacencies' block sizes
	HWORD RBS		;Receive block size for this circuit
	HWORD MXR		;Maximum routers allowed on this circuit
	HWORD NRO		;Number of routers online
	WORD DSH		;ID of current designated router (NI only)
	HWORD DSL		; ...
	HWORD PRI		;Priority to be designated router (NI only)

	WORD JSQ,QH.LEN		;Queue header for jiffy resend queue
				;Circuit counters:
	WORD CMQ		; Messages queued
	WORD CLC		; Local messages
	WORD SLZ		;   (0) Time stamp of when last zeroed.
	WORD CAP		; (800) Arriving packets received (to NSP)
	WORD CDP		; (801) Departing packets sent (from NSP)
	WORD CAL		; (802) Arriving congestion loss (to NSP)
	WORD CTR		; (810) Transit packets received
	WORD CTS		; (811) Transit packets sent
	WORD CTL		; (812) Transit congestion loss
	WORD CCD		; (820) Circuit down events
	WORD AJD		;	Adjacency down
	WORD CIF		; (821) Initialization failures
	WORD BSX		; (xxxx) Adjacency block size exceeded /output
ENDSTR
;These are the possible circuit states (in FIELD RCSTA).

	XP RCS.OF,0		;Off, not to be looked at
	XP RCS.RJ,1		;Rejected - Attempt to queue output failed
	XP RCS.FA,2		;Failed - Received line down from DLL
	XP RCS.WT,3		;Waiting for protocol up (initializing)
	XP RCS.TI,4		;Waiting for Router inititialization message
	XP RCS.TV,5		;Waiting for Router verification message
	XP RCS.TT,6		;Through-put testing (or whatever)
	XP RCS.RN,7		;Circuit is up and running
	SUBTTL  Structure Definitions -- DNADLL data link block

BEGSTR DL
	WORD NXT		; Link to next data link block
	WORD UID		; ID supplied by DNADLL user
	WORD DID		; Device ID
	FIELD FLG,6		; Data link flags
	  BIT RUN		; Data link is running
	  BIT EBU		; Emergency buffer in use
	  BIT LIU		; Line in use by circuit
	HWORD KNO		; Kontroller number (DTE only)
	WORD UNB		; Pointer to the User-NI block
	WORD PID		; Portal ID
	WORD LTP		; Line table pointer
	WORD SLZ		;(0) Seconds since last zeroed
	WORD BYR		;(1000) Total bytes received
	WORD BYS		;(1001) Total bytes sent
	WORD DBR		;(1010) Total data blocks received
	WORD DBS		;(1011) Total data blocks sent
	WORD UBU		;(1065) User buffer unavailable
ENDSTR
;Router test message data block

IFN FTRTST,<

BEGSTR TR
	WORD TND		; Node to test with
	WORD TSN		; Serial number of message
	WORD TAF		; Time when message reaches RTRFWD
	WORD TIC		; Time at input complete
	WORD TOC		; Time when output complete is received
	WORD TTD		; Time given to DLL
	WORD TTA		; Total time to turn around (TIC-TAF)
	WORD TED		; Time to get from FWD to DLL (TTD-TAF)
	WORD TFD		; Time from forward to output done (TTF-TOC)
ENDSTR
> ;End FTRTST
;This structure describes the DECnet word in the TOPS-10 PDB.
;Note that this field never made it into the PDB.

BEGSTR PD			;DECNET WORD IN PDB
	FIELD GOL,12		;PROCESS'S GOAL
	FIELD DQT,12		;PROCESS'S DEFAULT QUOTA
	FIELD IPR,12		;PROCESS'S INPUT PERCENTAGE
ENDSTR
	SUBTTL Value Definitions --  NSP Port States

;Define the Port State constants

DEFINE STATE(st),<
	ZZ==ZZ+1
	NPS.'st==ZZ>
	ZZ==0

	STATE	OP		;OPEN, WAITING FOR ENTER ACTIVE FROM SC
	STATE	CI		;CONNECT INITIATE SENT
	STATE	CD		;CONNECT DELIVERED
	STATE	CR		;CONNECT RECEIVED
	STATE	CC		;CONNECT CONFIRM
	STATE	DR		;DISCONNECT REJECT
	STATE	RC		;DISCONNECT REJECT COMPLETE (DRC)
	STATE	RN		;RUN
	STATE	RJ		;REJECT
	STATE	DI		;DISCONNECT INITIATE
	STATE	IC		;DISCONNECT INITIATE COMPLETE (DIC)
	STATE	DN		;DISCONNECT NOTIFICATION
	STATE	CN		;CLOSE NOTIFICATION
	STATE	NR		;NO RESOURCES
	STATE	NC		;NO COMMUNICATION
	STATE	CL		;CLOSED
	STATE	DP		;DESTROY PORT

PURGE	ZZ,STATE
	SUBTTL Value Definitions -- DECnet Standard Parameters

;The REASON values for a Disconnect Initiate or Disconnect Confirm message

	..RDX==10		;SAVE PRESENT RADIX
	RADIX 10		;USE DECIMAL FOR THE REASONS

	RSNRBO==0		;REJECTED BY OBJECT
	RSNDBO==0		;DISCONNECTED BY OBJECT (WHEN RUNNING)
	RSNRES==1		;NO RESOURCES
	RSNUNN==2		;UNRECOGNIZED NODE NAME
	RSNRNS==3		;REMOTE NODE SHUT DOWN
	RSNURO==4		;UNRECOGNIZED OBJECT
	RSNIOF==5		;INVALID OBJECT NAME FORMAT
	RSNOTB==6		;OBJECT TOO BUSY
	RSNABM==8		;ABORT BY MANAGEMENT
	RSNABO==9		;ABORT BY OBJECT
	RSNINF==10		;INVALID NODE NAME FORMAT
	RSNLNS==11		;LOCAL NODE SHUT DOWN
	RSNACR==34		;ACCESS CONTROL REJECTION
	RSNNRO==38		;NO RESPONSE FROM OBJECT
	RSNNUR==39		;NODE UNREACHABLE
	RSNNLK==41		;NO LINK
	RSNDSC==42		;DISCONNECT COMPLETE
	RSNIMG==43		;IMAGE FIELD TOO LONG (RQSTRID,
				; PASSWORD, ACCOUNT, USRDATA, ETC)

	RADIX ..RDX		;RESTORE PREVIOUS RADIX
	SUBTTL Value Definitions -- DECnet-wide states

;The following states are from the possible executor states as defined
;by Network Management.  This state is contained in the cell DCNSTA
;located in D36COM.

	XP DS.ON,0		;ON
	XP DS.OFF,1		;OFF
	XP DS.SHU,2		;SHUT
	XP DS.RES,3		;RESTRICTED
	SUBTTL Inter-Layer Parameters -- Overall Argument Conventions

;Session Control will be called with the following basic calling
;sequence:

;Call:	T1/ Function-specific argument, see below
;	T2/ Function-specific argument, see below
;	T3/ Function code = SV.xxx, defined below
;	T4/ Full-word pointer to a message block
;	CALL	@NP.SCV(PB)
;	Normal Return
;Changes T1,T2,T3,T4, preserves all others



;NSP will be called with the following basic calling sequence:

;Call:	T1/ Function-specific argument, see below
;	T2/ Function-specific argument, see below
;	T3/ Function code = NV.xxx, defined below
;	T4/ Full-word pointer to a message block
;	CALL	NSP
;	Normal Return
;Changes T1,T2,T3,T4, preserves all others



;Router will be called with the following basic calling sequence:

;Call:	T1/ RT%RQR set if return is requested on transmission failure
;	MB/ Pointer to the message block
;	CALL	RTRXMT
;	Normal Return
;Changes T1,T2,T3,T4, preserves all others


;The DLL layer kontrollers are called with the the following sequence:

;Call:	T1/ Kontroller Function (KF.xxx)
;	T2/ Pointer to Line Block to use
;	T3/ Function dependant data (usually pointer to message block)
;	CALL CALKON
;	Normal Return
;Changes T1-T4
	SUBTTL Inter-Layer Parameters -- Session Control Function Codes

;These are the function codes for the calls to Session Control from
;NSP.

	XP SV.CCR, 0		;CONNECT CONFIRMED CALL
	XP SV.DIR, 1		;DISCONNECT INITIATE RECEIVED CALL
	XP SV.DCR, 2		;DISCONNECT CONFIRM RECEIVED CALL
	XP SV.OND, 3		;OUTPUT NOT DONE CALL
	XP SV.ODN, 4		;OUTPUT DONE CALL
	XP SV.SEG, 5		;SEGMENT RECEIVED CALL
	XP SV.DRQ, 6		;DATA REQUEST RECEIVED CALL
	XP SV.NCF, 7		;NO CONFIDENCE IN PORT CALL
	XP SV.NRS,10		;NO RESOURCES CALL
	XP SV.CLS,11		;CLOSE COMPLETED CALL
	XP SV.NLK,12		;NO LINK CALL
	XP SV.NCM,13		;NO COMMUNICATION CALL
	XP SV.NRN,14		;NOT IN RUN STATE
	XP SV.CAK,15		;CONNECT ACKNOWLEGE CALL

				;The Connect Initiate call does not go
				;through the vectored interface, since
				;it must go to a single routine
				;capable of sorting out which Session
				;Control will handle the incoming
				;message.  the connect initiate call
				;goes to the global label SCTLCI.
	SUBTTL Inter-Layer Parameters -- NSP Function Codes

	XP NV.OPN, 0		;OPEN FROM SESSION CONTROL
	XP NV.ACT, 1		;ENTER ACTIVE FROM SESSION CONTROL
	XP NV.ACC, 2		;ACCEPT CONNECT FROM SESSION CONTROL
	XP NV.REJ, 3		;REJECT CONNECT FROM SESSION CONTROL
	XP NV.SEG, 4		;SEND SEGMENT FROM SESSION CONTROL
	XP NV.DRQ, 5		;REQUEST DATA FOR SESSION CONTROL
	XP NV.GOL, 6		;SET QUOTA/GOAL FROM SESSION CONTROL
	XP NV.DSC, 7		;SEND DISCONNECT FROM SESSION CONTROL
	XP NV.ABO,10		;SEND ABORT FROM SESSION CONTROL
	XP NV.CLS,11		;CLOSE PORT FROM SESSION CONTROL

	XP NV.RVF,12		;FIRST ROUTER CALL VECTOR OFFSET
	XP NV.RCV,12		;RECEIVE MESSAGE FROM ROUTER
	XP NV.ODN,13		;OUTPUT DONE FROM ROUTER
	XP NV.RTS,14		;RETURN TO SENDER FROM ROUTER
	XP NV.RFR,15		;Returned to sender from remote router
	XP NV.RVL,15		;LAST ROUTER CALL VECTOR OFFSET
	SUBTTL Inter-Layer Parameters -- Session Control/NSP

;Arguments passed between Session Control and NSP:

;Flow Control Mode, for NSP and Session Control.  These must not be
;changed, as they mirror definitions in the protocol.

	XP FCM.NO,0		;NO FLOW
	XP FCM.SG,1		;SEGMENT
	XP FCM.MG,2		;MESSAGE
	XP FCM.XX,3		;RESERVED


;The DATA REQUEST call's argument definitions for T2

BEGSTR QA
	FIELD FLG,6
;	  BIT OFF		;SET IF THE SUBLINK IS TO BE TURNED OFF
	HWORD CNT		;THE DATA REQUEST COUNT BEING REQUESTED
ENDSTR				;IF NEGATIVE, ITS 2'S COMPLEMENT IN FIELD
				; HALF WORD SO LOADE CAN MAKE HRRE
;Some of the calls between Session Control and NSP require more arguments
;than will fit into the two registers reserved for argument passing.
;These calls pass instead a pointer to an argument block.  The formats
;of those blocks are described here.

;The OPEN call's argument block

BEGSTR OA			;OPEN ARGUMENT BLOCK
	WORD SCB		;SCB ID FOR NEW PORT
	WORD NOD		;DESTINATION NODE
	WORD FLO		;FLOW CONTROL TYPE
	WORD GOL		;DATA REQUEST GOAL
	WORD SIZ		;MAX BYTES ALLOWED IN A MESSAGE SEGMENT
	WORD SCV		;SESSION CONTROL'S ENTRY ADDRESS
	WORD CIR		;LOOPBACK CIRCUIT
ENDSTR


;The ACCEPT call's argument block

BEGSTR AA			;ACCEPT ARGUMENT BLOCK
	WORD SCB		;SCB ID FOR NEW PORT
	WORD PID		;NSP'S PORT IDENTIFIER
	WORD FLO		;FLOW CONTROL TYPE
	WORD GOL		;DATA REQUEST GOAL
	WORD SIZ		;MAX BYTES ALLOWED IN A MESSAGE SEGMENT
	WORD SCV		;SESSION CONTROL'S ENTRY ADDRESS
ENDSTR

;The Connect Initiate and Connect Confirm calls' argument format for T2.
;T1 holds the NSPpid for the new logical link.

BEGSTR IA
	HWORD FLO		;FLOW CONTROL TYPE
	HWORD SIZ		;MAX BYTES ALLOWED IN A MESSAGE SEGMENT
				;SOURCE NODE ID AND ROUTER CHANNEL ARE
				; IN THE PUBLIC PART OF THE MESSAGE BLOCK
ENDSTR
	SUBTTL Inter-Layer Parameters -- NSP/Router

;Arguments passed between NSP and Router:

;NSP passes this flag in T1 to Router on a call to RTRXMT if it wants
;to request a return of the message it is sending.

	XP RT%RQR,1B0		;RETURN REQUESTED ON TRANSMISSION FAILURE
	XP RT%ODN,1B1		;RETURN MESSAGE BLOCK TO NSP WHEN OUTPUT DONE
	XP RT%TRY,1B2		;TRYHARD WHEN OUTPUT CIRCUIT IS NI

;NSP passes this flag in T1 to Router on a call to RTRINI, to say that he
;is the one and only NSP which will take Phase II messages.

	XP RT%PH2,1B0		;I AM THE "PHASE2" NSP
	SUBTTL Inter-Layer Parameters -- Router/DLL

;The interface between Router and the DLL is vectored. These are the
;functions codes of the interrupts which the DLL ("kontroller") will
;pass to Router.


	XP DI.ODN,1		;OUTPUT DONE
	XP DI.INC,2		;INPUT COMPLETE
	XP DI.LSC,3		;LINE STATE CHANGE
	XP DI.ICB,4		;INITIALIZE CIRCUIT BLOCK

;The DLL performs these functions for Router.

	XP DF.OPN,0		;OPEN THE CIRCUIT
	XP DF.CLS,1		;CLOSE THE CIRCUIT
	XP DF.XMT,2		;TRANSMIT MESSAGE

;The DLL preforms these functions for Network management (NTMAN)

	XP DF.SET,3		;NTMAN - SET FUNCTION
	XP DF.CLR,4		;NTMAN - CLEAR FUNCTION
	XP DF.RED,5		;NTMAN - READ FUNCTION
	XP DF.SHC,6		;NTMAN - Show counters
	XP DF.SZC,7		;NTMAN - Show and zero counters
	XP DF.RET,10		;NTMAN - Return list (e.g. show known lines)
	XP DF.A2N,11		;NTMAN - Map node address to name
	XP DF.N2A,12		;NTMAN - Map node name to address
	XP DF.CET,13		;NTMAN - Check entity
	XP DF.MAX,DF.CET	;MAXIMUM FUNCTION NUMBER

;These are needed until NTMAN is modernized

	XP KF.SET,5		;Set parameters
	XP KF.CLR,6		;Clear parameters
	XP KF.RED,7		;Read parameters

;These are DTESRV specific functions

	XP DD.OPN,0 		; Open circuit
	XP DD.CLS,1 		; Close circuit
	XP DD.QUE,2 		; Queue output buffer
	XP DD.PRB,3 		; Post receive message block
	XP DD.CKE,4		; Check existance of DTE
	XP DD.MAX,DD.CKE	; Maximum function number

;These are the generic line states.

	XP LS.ON,0		; On
	XP LS.OFF,1		; Off
	XP LS.SRV,2		; Service
	XP LS.CLR,3		; Cleared

;These are the error codes CIDLL will return to DNADLL on non-network
; management functions.

	XP CIEBAS,2000		;CI errors have a base of 2000

	XP CNSUC%,0!CIEBAS	;Success
	XP CNNCI%,1!CIEBAS	;No CI interface present
	XP CNNRE%,2!CIEBAS	;No resources
	XP CNNSP%,3!CIEBAS	;No such port
	XP CNPNA%,4!CIEBAS	;Port block not allocated
	XP CNPAO%,5!CIEBAS	;Port is already open
	XP CNLPT%,6!CIEBAS	;Local port is illegal
	XP CNPWS%,7!CIEBAS	;Port is in wrong state
	XP CNIMS%,10!CIEBAS	;Illegal message size
	XP CNXMF%,11!CIEBAS	;SCA datagram send failed
	SUBTTL Inter-Layer Parameters -- Layer/NMX (Event logger)

;The interface between a layer and the event logger in NTMAN is vectored.
;These are the function codes a layer will pass to NTMAN.

	XP EV.GEC,0		;Get an EC block
	XP EV.REC,1		;Release an EC block
	XP EV.FIL,2		;Filter an event
	XP EV.LOG,3		;Log an event
	XP EV.SIG,4		;Log a signal
	SUBTTL Network Management -- Argument blocks

;The following is the defintion of the Line-ID that router maps into
;a line block address. This is used
;	On an initial open from the DLL to ROUTER;
;	By router to determine an Kontroller specific peculiarities;
;	By network management to communicate with ROUTER.

BEGSTR LI			;LINE-ID
	FIELD LXC,1		; BIT INDICATING LINE ID OR CIRCUIT ID.
	FILLER 2		;  (BIT=0 MEANS CIRCUIT, =1 MEANS LINE)
	FIELD DEV,6		; DEVICE TYPE
	FIELD KON,9		; CONTROLLER NUMBER (CPU# FOR DTE'S AND CI'S)
	FIELD UNI,9		; UNIT NUMBER
	FIELD DRP,9		; DROP NUMBER (PORT FOR CI'S)
ENDSTR

;These are the bits indicating which of the above fields are present
	XP KD.DEV,1		;DEVICE NAME (ALWAYS PRESENT)
	XP KD.KON,2		;CONTROLLER NUMBER
	XP KD.UNI,4		;UNIT NUMBER
	XP KD.DRP,10		;DROP NUMBER

;These are the types of devices that we know about (in field LIDEV).

	XP LD.TST,0		;TEST BED DRIVER (OBSOLETE)
	XP LD.DTE,1		;DTE
	XP LD.KDP,2		;KDP
	XP LD.DDP,3		;DDP
	XP LD.CIP,4		;CI PORT
	XP LD.NI,5		;ETHERNET
	XP LD.DMR,6		;DMR
	   LD.MAX==LD.DMR

;Define block of ''globals'' used by NMX

BEGSTR NX
	FIELD FLG,7		;FLAGS
	 BIT  WRM		;WRITING MONITOR'S DATA BASE. 1=WRITING
	 BIT  WUS		;WRITING USERS DATA STRING. 1=WRITING
	 BIT  ZMC		;ZEROING OR CLEARING MONITOR CORE.
	 BIT  CXP		;COUNTER=1 OR PARAMETER=0.
	 BIT  NIL		;NOT IN LAYER. (I DIDN'T BIT)
	 BIT  ECV		;DO ENTITY CONVERSION
	 BIT  MCX		;BUFFER IS IN MONITOR CONTEXT
	FILLER 2
	FIELD NTY,3		;NODE TYPE, IF NODE.
	 XP NX.EXN,1		;EXECUTOR NODE
	 XP NX.REN,2		;REMOTE NODE
	 XP NX.LPN,3		;LOOPBACK NODE
	FIELD LTY,3		;LINE TYPE
	 XP NX.TST,0		;TEST BED DRIVER (OBSOLETE)
	 XP NX.DTE,1		;DTE
	 XP NX.KDP,2		;KDP
	 XP NX.DDP,3		;DDP
	 XP NX.CIP,4		;CI PORT
	 XP NX.NI,5		;ETHERNET
	 XP NX.DMR,6		;DMR
	FIELD ENT,3		;ENTITY TYPE
	HWORD PRM		;PARAMETER/COUNTER IDENTIFIER.
	WORD NUM		;ENTITY SEQUENCE NUMBER. (NODE ADDR OF LINE ID)
	WORD VAL,8		;MAXIMUM STRING SIZE (32 BYTES)
	WORD MBY		;MAXIMUM NUMBER OF BYTES
	WORD ADR		;USER VIRTUAL ADDRESS OF ARGUMENT BLOCK
	WORD UUO		;SAVED CALLING UUO (NEED FOR STOTAC)
	WORD EID,BP.LEN		;STRING POINTER TO ENTITY ID
	WORD FNC		;FUNCTION CODE.
	WORD SEL		;SELECTION CRITERIA FOR FUNCTION.
	WORD DAT,BP.LEN		;STRING POINTER FIELD TO DATA STRING
	WORD ERR		;ERROR CODE.
ENDSTR

;A special error code

	NEADC%==^D47
	SUBTTL Network Management -- NSP and ROUTING VERSION Number Formats
;Define NSP and Routing Version number words

BEGSTR VN
	FIELD VER,8		;Version number
	FIELD ECO,8		;ECO number
	FIELD UCO,8		;User ECO number
	FILLER 12		;Fill up the word
ENDSTR


;Define Counter Block Sub-fields

BEGSTR KB
	FIELD BMF,1		;Bit Map Flag
	FIELD WID,^D17		;Counter width in bits
	HWORD TYP		;Counter Type (Number)
	WORD VAL		;Counter Value
	WORD MSK		;Bit Mask
ENDSTR
	SUBTTL Network Management -- Values used by NMX

	XP NSXILL,0		;ILLEGAL
	XP NSXVRS,1		;NSP VERSION NUMBER
	XP NSXECO,2		;ECO NUMBER
	XP NSXUEC,3		;USER ECO NUMBER
	XP NSXDLY,4		;DELAY
	XP NSXDLW,5
	XP NSXIAT,6		;
	XP NSXRTM,7		;RESPONSE TIMEOUTS

;Line states according to NMX

	XP NCK.ON,0		;CIRCUIT/LINE STATE ON
	XP NCK.OF,1		;STATE OFF
	XP NCK.SR,2		;SERVICE
	XP NCK.CL,3		;CLEARED

;Line substates according to NMX

	XP NCB.ST,0		;--STARTING
	XP NCB.SN,^D10		;--SYNCHRONIZING
	XP NCB.FA,^D11		;--FAILED
;Circuit states according to Router
	XP RNS.OF,0		; Off
	XP RNS.FA,1		; Failed
	XP RNS.ST,2		; Starting
	XP RNS.ON,3		; Running

;Network management node states
	XP RM.REA,4		;Reachable
	XP RM.UNR,5		;Unreachable

;For LLINKS and ROUTER
;Entity types
	XP .NTNON,-1
	XP .NTNOD,0		;NODE ENTITY
	XP .NTLIN,1		;LINE
	XP .NTLOG,2		;LOGGING
	XP .NTCKT,3		;CIRCUIT
	XP .NTMOD,4		;MODULE
	XP .NTARE,5		;AREA


;Qualifiers for functions
	XP .NTSGN,-5		;SIGNIFICANT		;(FOR .NTRET)
	XP .NTADJ,-4		;ADJACENT
	XP .NTLOP,-3		;LOOP
 	XP .NTACT,-2		;ACTIVE ITEMS
	XP .NTKNO,-1		;KNOWN ITEMS		
	SUBTTL	Network Management -- NMX Function Block Definition

;This is the NMX Interface Function Argument Block.  Its purpose
;is to implement a standard calling interface between Network
;Management (NTMAN) and the DECnet Layers.
;Define Network management Functions Block

BEGSTR NF
	WORD EID		;Entity ID
	HWORD BYT		;Byte count
	HWORD PRM		;Parameter Number
	FIELD BFF,1		;Buffer Flag
	FIELD UBF,1		;User Buffer passed (for return KNOWN NODES)
	FIELD QUF,1		;Qualifier Flag
	FIELD ETY,6		;Entity Type
	FIELD SEL,9		;Selector
	HWORD BLN		;Buffer Length
	WORD QUA		;Qualifier
	WORD BUF		;Buffer Address or Parameter value
	WORD BPT		;Byte pointer to data
ENDSTR

;Network management Function Codes
	XP NF.ILG,-1		;Illegal Function
	XP NF.SET,0		;Set Parameter
	XP NF.CLR,1		;Clear Parameter
	XP NF.RED,2		;Read Parameter
	XP NF.COU,3		;Show Counters
	XP NF.SZC,4		;Show and Zero Counters
	XP NF.RET,5		;Return list of Entity Ids
	XP NF.A2N,6		;Map Node Address to Name
	XP NF.N2A,7		;Map Node Name to Address
	XP NF.CET,10		;Check Entity
	XP NF.CKL,11		;Check Loopback Node

	NF.MAX==NF.CKL		;Maximum Function code value

;Network Management Interface Error returns

;These error codes are for internal monitor use only
	XP NF.FCS,^D1		;Function completed successfully
	XP NF.NDP,^D0		;No data present

;The following error codes may be returned to the user level
	XP NF.UFO,^D-1		;Unrecognized Function or Option
	XP NF.IMF,^D-2		;Invalid Message Format
	XP NF.PRV,^D-3		;Privilege Violation
	XP NF.MPE,^D-5		;Management Program Error
	XP NF.UPT,^D-6		;Unrecognized Parameter Type
	XP NF.URC,^D-8		;Unrecognized Component
	XP NF.INI,^D-9		;Invalid Identification
	XP NF.CWS,^D-11		;Component in Wrong State
	XP NF.RES,^D-15		;Resource Error
	XP NF.IPV,^D-16		;Invalid Parameter Value
	XP NF.NRM,^D-20		;No room, or slot already taken
	XP NF.PNA,^D-22		;Parameter not applicable
	XP NF.PVL,^D-23		;Parameter value too long
	XP NF.OPF,^D-25		;Operation failure
	XP NF.FNS,^D-26		;Function not supported
	XP NF.IPG,^D-27		;Invalid Parameter grouping
	XP NF.PAM,^D-29		;Parameter missing
	SUBTTL	Network Management -- Event Parameters and Argument blocks

;Event Classes
	XP .NCNML,0		;NETWORK MGMT LAYER
	XP .NCALP,1		;APPLICATION LAYER
	XP .NCSCT,2		;SESSION CONTROL LAYER
	XP .NCNSP,3		;NETWORK SERVICES (NSP) LAYER
	XP .NCRTR,4		;ROUTER LAYER
	XP .NCDLL,5		;DATA LINK LAYER
	XP .NCPLL,6		;PHYSICAL LINK LAYER
;		7-31		;RESERVED FOR COMMON CLASSES
;		32-63		;RESERVED FOR RSTS
;		64-95		;RESERVED FOR RSX
	XP .NCLCG,^D96		;TOPS-10/20 specific events
;		97-127		;RESERVED FOR TOPS-10/20
;		128-159		;RESERVED FOR RT
;		160-479		;RESERVED FOR FUTURE DEC USE
;		480-511		;RESERVED FOR CUSTOMER USE

;Event and signal queue maximum lengths
	XP NMXELN,^D10		;Maximum # of entries in event queue
	XP NMXSLN,^D10		;[7.1251] Maximum # of entries in signal queue

;Event communication block.
;
;The EC block is a communications area between a layer and NTMAN.

BEGSTR EC
	;NTMAN private section
	HWORD LOS		;Count of "events lost"
	HWORD CNT		;Count of events on queue
	FIELD DEL,1		;This EC block marked for deallocation
	FILLER 2

	;Communications area, set by the layer
	FIELD LAY,3		;DECnet layer this EC block belongs to
	HWORD ETY		;Entity type of DECnet device this EC block
				; belongs to
	WORD EID		;Entity ID of DECnet device this EC block
				; belongs to
	HWORD MAX		;Maximum # of events on queue allowed
ENDSTR

;Network event block
;
;A NE block contains all information about an event

BEGSTR NE
	WORD NXT		;Pointer to next NE block on queue
	WORD TIM		;Time of event
	WORD CBK		;Address of callback routine
	WORD ECP		;Pointer to event communications block
	FIELD CCL,13		;Event class
	FIELD CTY,5		;Event type
	HWORD DLN		;Data length in bytes
	HWORD ETP		;Entity type
	WORD EID		;Entity ID
	WORD DAT		;Fullword pointer to data string
ENDSTR

;Filter argument block
;
;Used to pass arguments to the EV.FIL function of NMXEVT

BEGSTR FA			;Filter argument block
	HWORD CCL		;Event class
	HWORD CTY		;Event type
ENDSTR

IFN FTDEBUG <

;For test and debug purposes there is an extra function of the NTMAN jsys.
;This function will log an event or signal.
;
;The function code is -5 (.NTTEV)
	.NTTEV==:-5
;
;The entity ID and type for the event are taken from the standard words in
;the NTMAN argument block.
;
;Word .NTSEL points to a secondary argument block of the following layour
;
	BEGSTR ET
		FIELD SIG,1	;Set if this is a signal
		HWORD CNT	;Replication count
		FIELD CCL,13	;Event class
		FIELD CTY,5	;Event type
		HWORD DLN	;Data length in bytes
		WORD DAT,<44/4>	;Space for data
	ENDSTR
>
	SUBTTL	Test Bed Stuff

;Here are the TRACE and ETRACE symbols.

	XP TRCCOM,1B35		;/TRACE:COM
	XP TRCRTR,1B34		;/TRACE:RTR
	XP TRCNSP,1B33		;/TRACE:NSP
	XP TRCSC,1B32		;/TRACE:SC
	XP TRCUSR,1B31		;/TRACE:USR
	XP TRCNMX,1B30		;/TRACE:NMX

	XP ETRCOM,1B35		;/ETRACE:COM
	XP ETRRTR,1B34		;/ETRACE:RTR
	XP ETRNSP,1B33		;/ETRACE:NSP
	XP ETRSC,1B32		;/ETRACE:SC
	XP ETRUSR,1B31		;/ETRACE:USR
	XP ETRNMX,1B30		;/ETRACE:NMX

;This is a macro for generating traces about things.

DEFINE	TRACE(PREFIX,TEXT),<
  IFN FTTRACE,<
	EXT <S.TRAC,.TSTRG>
	CALL [SAVEAC <T1,T2,T3,T4> ;;YES, SAVE SOME AC'S
	      HRRZ T1,S.TRAC	;;GET THE TRACE SWITCH
	      TXNN T1,TRC'PREFIX ;;IF HE WANTS IT, GIVE IT TO HIM
	      RET		;;RETURN TO SENDER
	      MOVEI T1,[ASCIZ/['PREFIX: 'TEXT]
/] 				;;SET UP FOR SCAN .TSTRG
	      CALLSCAN .TSTRG	;;CALL HIM
	      RET]		;; AND RETURN
  >;END OF IFN FTTRACE
>

DEFINE	ETRACE(PREFIX,TEXT),<
  IFN FTTRACE,<
	EXT <S.ETRA,.TSTRG>
	CALL [SAVEAC <T1,T2,T3,T4> ;;YES, SAVE SOME AC'S
	      HRRZ T1,S.ETRA	;;GET THE TRACE SWITCH
	      TXNN T1,ETR'PREFIX ;;IF HE WANTS IT, GIVE IT TO HIM
	      RET		;;RETURN TO SENDER
	      MOVEI T1,[ASCIZ/['PREFIX: 'TEXT]
/] 				;;SET UP FOR SCAN .TSTRG
	      CALLSCAN .TSTRG	;;CALL HIM
	      RET]		;; AND RETURN
  >;END OF IFN FTTRACE
>
	SUBTTL  FIXADJ Macro - Compensate for bug in negative ADJBP

;This macro should be removed if and when the KL microcode is fixed to
;handle byte pointers that have a 777777 in the right half and an index
;AC that points to the first address in a section.  Such a byte pointer
;might be generated by backing up a byte pointer with an ADJBP instruction.

;For example, if the byte pointer is 41006,,777777 and AC 6 contains 10,,0
;the effective address calculation computes an address of 7,777777.  If it
;is the case that section 7 is not mapped a page fault will result even if
;the instruction is an ILDB wishing to get its byte from 10,,0.  This macro
;will change the byte pointer from 410xx,,-1 to 4410xx,,0.

DEFINE FIXADJ (ac),<
	TLNE ac,700000		;Is it 0410xx,,xxx?
	IFSKP.
	  TLO ac,400000		;Yes, make it 4410xx,,xxx
	  HRRI ac,1(ac)		;Non-carrying add to RH, TLO just made IFIW!
	ENDIF.
>
DEFINE TSTS6 <>

;;Hack in test section 6
;DEFINE TSTS6 <
;  IF2,<IFNDEF $TSTS6,<EXTERNAL $TSTS6>>
;	JSP CX,$TSTS6
;>
	SUBTTL	End of D36PAR

	END