Google
 

Trailing-Edge - PDP-10 Archives - TOPS-20_V6.1_DECnetSrc_7-23-85 - mcb/xpt/xptlib.req
There is 1 other file named xptlib.req in the archive. Click here to see a list.
!                    COPYRIGHT (c) 1980, 1981, 1982
!                    DIGITAL EQUIPMENT CORPORATION
!                        Maynard, Massachusetts
!
!     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  which  is  not supplied by
!     DIGITAL.

library 'MCB:XPORTX';
library 'MCB:MCBLIB';
library 'MCB:NMXLIB';
require 'MCB:DLLLIB';

macro
    $bias =                             ! Mapping bias
        $integer %,
    $fill [] =                          ! Skip field, no label, display
        %bliss16 [%bliss36 [%remaining]] %,
    $list_head =                        ! Two word list head
        $sub_block (2) %;
!+
! Linkages and routine synonyms
!-

linkage
    XPT$LKG_LINEb = jsr (register = 5),
    XPT$LKG_NODEb = jsr (register = 5),
    XPT$LKG_NUM = jsr (register = 0);

macro
    XPT$GET_LINE_DB = GTLINE %,
    XPT$GET_NODE_DB = GTNODE %;

macro
    $TLI_GET_LINE_DB (NUMBER) =
        begin
        external routine XPT$GET_LINE_DB : XPT$LKG_NUM;
        XPT$GET_LINE_DB (NUMBER)
        end %,
    $TLI_GET_NODE_DB (NUMBER) =
        begin
        external routine XPT$GET_NODE_DB : XPT$LKG_NUM;
        XPT$GET_NODE_DB (NUMBER)
        end %,
    $XPT_GET_LINE_DB (NUMBER) =
        begin
        external routine XPT$GET_LINE_DB : XPT$LKG_NUM;
        XPT$GET_LINE_DB (NUMBER)
        end %,
    $XPT_GET_NODE_DB (NUMBER) =
        begin
        external routine XPT$GET_NODE_DB : XPT$LKG_NUM;
        XPT$GET_NODE_DB (NUMBER)
        end %;

macro
    $XPT_for_each_LINEb_do_begin =
        begin
        local LINEb: ref LINEblock;
        LINEb = .XPTDB[XPTlindb];
        decru $XPT$LINEb_cnt from NLN to 1 do
            begin %,
    $XPT_next_LINEb_end =
            LINEb = vector [.LINEb,LINEsize]
            end
        end %;

macro
    $XPT_for_each_NODEb_do_begin =
        begin
        local NODEb: ref NODEblock;
        NODEb = .XPTDB[XPTnoddb];
        decru $XPT$NODEb_cnt from NN to 1 do
            begin %,
    $XPT_next_NODEb_end =
            NODEb = vector [.NODEb,NODEsize];
            end;
        end; %;

macro
    $TLI_for_each_PWDb_do_begin =
        begin
        local PWDb: ref PWDblock;
        if (PWDb = .PWDdb) neqa 0
        then do begin %,
    $TLI_next_PWDb_end =
                end
             while (PWDb = .PWDlink) neqa 0;
        end; %;

!+
!
!  Macros and structures for the Transport process
!
!-

literal
    TRUE = 1 eql 1,
    FALSE = 1 eql 0;

macro SETBIT(VALUE,PIT) = (VALUE = .VALUE or (PIT))%;
macro CLEARBIT(VALUE,PIT) = (VALUE = .VALUE and not (PIT))%;
macro BITON(VALUE,PIT) = ((VALUE and (PIT)) neq 0)%;
macro BITOFF(VALUE,PIT) = ((VALUE and (PIT)) eql 0)%;
macro CHECKSUM(SUM,VAL) =
      begin
      builtin ROT;
      if ROT((SUM=.SUM+VAL),1) then SUM = .SUM + 1;
      end %;

macro POINTER = register%;
macro GETB(PTR) = ch$rchar_a(PTR)%;
macro PUTB(VALUE,PTR) = ch$wchar_a(VALUE,PTR)%;
macro EX_PUTW(VALUE,PTR) =
    if VALUE geq 128 then begin
	local X; X;
	X = VALUE;
	ch$wchar_a(.X<0,7>+128,PTR);
	ch$wchar_a(.X<7,7>,PTR);
	end
    else ch$wchar_a(VALUE,PTR);
%;

macro MAPBUF (ccb,addr_addr,len_addr) =
    MAP$(CCB[C_BIAS]);
    addr_addr = CCB[C_ADDR]
    %IF %LENGTH GTR 2 %THEN
	; len_addr = CCB[C_CNT] %FI
%;

structure VECTOR1 [I; N,UNIT=%upval] =		!One-based vector
    [N * UNIT]
    (VECTOR1 + (I-1)*UNIT)<0,%bpunit*UNIT,0>;

structure ENTRY1 [I; N,UNIT=1] =		!One-based data base entry
    [N * UNIT]					! of length N
    (ENTRY1 + ((I-1) * N * UNIT));

macro $CCBRG = 4%;		!Standard MCB CCB register
!
! XPT CCB definitions
!

$field
    C_XPT_OVERLAY_FIELDS =
        set
            $overlay (C_LIN)
        C_HANDLE = [$integer],
            $continue
            $overlay (C_PRM1)
        C_XPT_SOURCE = [$integer],
            $continue
            $overlay (C_PRM2)
        C_XPT_DESTINATION = [$integer],
            $continue
            $overlay (C_PRM4)
        C_XPT_TYPE = [$tiny_integer],
        C_XPT_ADJUST = [$tiny_integer],
            $continue
            $overlay (C_XPT_TYPE)
        C_XPT_SUBTYPE = [$tiny_integer],
            $continue
            $overlay (C_PRM5)
        C_XPT_ALLOCATION = [$integer]
            $continue
        tes;

macro C_XPT_FIELDS = C_FIELDS, C_XPT_OVERLAY_FIELDS %;

literal				!Flags a buffer as belonging to a process:
    UPDATEcode = 1,		!  Routing or Hello message (also a subcode)
    INITcode = 2,		!  Transport Initialize
    ECLcode = 3,		!  ECL interface
    FWDcode = 4,		!  Forwarded buffer (at DLL)
    HELLOcode = 5,		!  Subcode for Hello message
    NOcode = 6;			!  Forwarded buffer which is not to be counted
				!    against any quotas

!
! XPT AND TLI CCB MODIFIER CODE DEFINITIONS
!


LITERAL
    XM_STP = 2^1,
    XM_STR = 1^1,
    XM_DAT = 0^1;

LITERAL
    TM_DAT = 0^1,
    TM_INI = 6^1,
    TM_STP = 4^1,
    TM_STR = 5^1,
    TM_TRM = 7^1;

LITERAL
    NM_INI = 0^1,
    NM_TRM = 4^1;
!+
!
!  Field mapping for Transport Central Data Base
!
!-

$show(fields)
$show(literals)

$FIELD XPTDBflds =
    set
    XPTltim =		[$BYTE],
    XPTSrm = [$bit],
    TLI2TVrequested = [$bit],
    TLI3TVrequested = [$bit],
    XPTxpe =		[$BYTE],
    XPTtli =		[$BYTE],
    XPTxpt =		[$BYTE],
    XPTnm =		[$BYTE],
    XPThopcostb = [$bias],
    XPThopcosta = [$address],
    XPTnoddb =	[$ADDRESS],
    XPT$nn =	[$short_integer],
    XPTnn =	[$short_integer],       ! 920 - MAXIMUM ADDRESS
    XPTlindb =	[$ADDRESS],
    XPT$nln =	[$short_integer],       ! 921 - MAXIMUM CIRCUITS
    XPTnod_nn =	[$ADDRESS],             ! 
    XPTlnkxl =	[$ADDRESS],             ! Phase II link table
    XPT$lnkxl = [$short_integer],       ! Number of Phase II links
    XPT$maxp =	[$short_integer],       ! Number of Phase II links per circuit
    XPT$linq =	[$BYTE],
    XPTdllq =   [$TINY_INTEGER],
    XPT$maxc =	[$short_integer],
    XPTmaxc =	[$short_integer],       ! 922 - MAXIMUM COST
    XPT$maxh =	[$short_integer],
    XPTmaxh =	[$short_integer],       ! 923 - MAXIMUM HOPS
    XPT$maxv =	[$short_integer],
    XPTmaxv =	[$short_integer],       ! 924 - MAXIMUM VISITS
    XPT$maxl =	[$short_integer],
    XPTmaxl =	[$short_integer],       ! Maximum link cost
    XPTtid =	[$short_integer],       ! Transport address
    XPT$t1 =	[$INTEGER],             ! 910 - ROUTING TIMER
    XPT$t2 =	[$INTEGER],             ! Update timer
    XPT$t3 =	[$INTEGER],             ! Default hello timer
    XPT$t4 =	[$INTEGER],             ! Default listen timer
    XPT$init =	[$INTEGER],             ! Initialization timer
    XPTt1 =	[$INTEGER],             ! Routing clock
    XPTt2 =	[$INTEGER],             ! Update clock
    XPTnextl =	[$tiny_integer],
    XPT$updq =	[$BYTE],
    XPTupdq =	[$BYTE],
    XPT$eclq =	[$BYTE],
    XPTeclq =	[$BYTE],
    XPT$inpq =	[$BYTE],
    XPTinq =	[$TINY_INTEGER],
    XPTinfill =	[$BYTE],
    XPTflg =	[$short_integer],
    XPTrequ =	[$list_head],
    XPTnodel =	[$INTEGER],
    XPTnode =	[$byte_string(6)],
    XPTdllsz =	[$INTEGER],             ! 931 - BUFFER SIZE
    XPTph2sz =  [$INTEGER],
    XPTaged_loss = [$counter (8)],      ! 900 - Aged Packet Loss
    XPTrange_loss = [$counter (8)],     ! 902 - Node Out-of-Range Packet Loss
    XPTsize_loss = [$counter (8)],      ! 903 - Oversize Packet Loss
    XPTfmt_loss = [$counter (8)],       ! 910 - Packet Format Error
    XPTrout_loss = [$counter (8)],      ! 920 - Partial Routing Update Loss
    XPTver_rej = [$counter (8)],        ! 930 - Verification Reject
    XPTunreach_loss = [$counter (16)],  ! 901 - Node Unreachable Packet Loss
    XPTreq_cnt = [$byte],
    XPT$hello = [$tiny_integer],        ! Default hello data length
        $ALIGN(FULLWORD)
    XPTmaxn =		[$INTEGER],
    XPTincn =		[$INTEGER],
    XPTraddr =		[$ADDRESS],
    XPTsynblk =		[$ADDRESS],
    XPTpasswords = [$address],
    XPT_TI_ADDR = [$address],
    XPT_TI_CNT = [$short_integer],
    XPT_NI_ADDR = [$address],
    XPT_NI_CNT = [$short_integer],
    XPT_HELLO_ADDR = [$address],
    XPT_HELLO_CNT = [$short_integer],
    XPT_FALSE_NI_LINEb = [$address],
    XPT_FALSE_NI_ADDR = [$address],
    XPT_FALSE_NI_CNT = [$short_integer]
    tes;

literal XPTDB_length = $FIELD_SET_SIZE;

macro XPTDBblock = block [XPTDB_length] field (XPTDBflds)%;
!
! Synonyms for XPTDB
!
macro $ECLQ = .XPTDB[XPT$eclq]%;
macro $INPQ = .XPTDB[XPT$inpq]%;
macro $LINQ = .XPTDB[XPT$linq]%;
macro $MAXC = .XPTDB[XPT$maxc]%;
macro $MAXH = .XPTDB[XPT$maxh]%;
macro $MAXL = .XPTDB[XPT$maxl]%;
macro $MAXlk = .XPTDB[XPT$maxp]%;
macro $MAXV = .XPTDB[XPT$maxv]%;
macro $T1ini = .XPTDB[XPT$t1]%;
macro $T2ini = .XPTDB[XPT$t2]%;
macro $TIini = .XPTDB[XPT$init]%;
macro $UPDQ = .XPTDB[XPT$updq]%;
macro Aged_Loss = XPTDB[XPTaged_loss]%;
macro Default_Hello_data_length = .XPTDB[XPT$hello]%;
macro Default_Hello_timer = .XPTDB[XPT$t3]%;
macro Default_Init_timer = .XPTDB[XPT$init]%;
macro Default_Listen_timer = .XPTDB[XPT$t4]%;
macro Default_Routing_timer = .XPTDB[XPT$t1]%;
macro Default_Update_timer = .XPTDB[XPT$t2]%;
macro DLLquota = XPTDB[XPTdllq]%;
macro DLLsize = XPTDB[XPTdllsz]%;
macro ECLquota = XPTDB[XPTeclq]%;
macro False_NI_LINEb = XPTDB[XPT_FALSE_NI_LINEb]%;
macro False_NI_msg_ADDR = XPTDB[XPT_FALSE_NI_ADDR]%;
macro False_NI_msg_CNT = XPTDB[XPT_FALSE_NI_CNT]%;
macro Format_Errors = XPTDB[XPTfmt_loss]%;
macro Hello_msg_CNT = XPTDB[XPT_HELLO_CNT]%;
macro Hello_msg_ADDR = XPTDB[XPT_HELLO_ADDR]%;
macro Hopcost_address = .XPTDB[XPThopcosta]%;
macro Hopcost_bias = .XPTDB[XPThopcostb]%;
macro IncN = XPTDB[XPTincn]%;
macro Init_timer = XPTDB[XPT$init]%;
macro INPUTfill = XPTDB[XPTinfill]%;
macro INPUTquota = XPTDB[XPTinq]%;
macro Maxc = XPTDB[XPTmaxc]%;
macro Maxh = XPTDB[XPTmaxh]%;
macro Maximum_Address_limit = XPTDB[XPT$nn]%;
macro Maximum_Circuits_limit = XPTDB[XPT$nln]%;
macro Maxl = XPTDB[XPTmaxl]%;
macro MaxN = XPTDB[XPTmaxn]%;
macro Maxv = XPTDB[XPTmaxv]%;
macro NEXTline = XPTDB[XPTnextl]%;
macro NI_msg_CNT = XPTDB[XPT_NI_CNT]%;
macro NI_msg_ADDR = XPTDB[XPT_NI_ADDR]%;
macro NLN = .XPTDB[XPT$nln]%;
macro NN = .XPTDB[XPTnn]%;
macro NODEmaximum_address_vector = XPTDB[XPTnod_nn]%;
macro NODEname = XPTDB[XPTnode]%;
macro NODEname_length = XPTDB[XPTnodel]%;
macro Oversize_Loss = XPTDB[XPTsize_loss]%;
macro PWDDB = XPTDB[XPTpasswords]%;
macro PD_NMX = .XPTDB[XPTnm]%;
macro PD_TLI = .XPTDB[XPTtli]%;
macro PD_XPE = .XPTDB[XPTxpe]%;
macro PD_XPT = .XPTDB[XPTxpt]%;
macro Ph2link_table = XPTDB[XPTlnkxl]%;
macro Ph2link_allocated = XPTDB[XPT$lnkxl]%;
macro PH2size = XPTDB[XPTph2sz]%;
macro Range_Loss = XPTDB[XPTrange_loss]%;
macro Request_OTV = XPTDB[TLI2TVrequested]%;
macro Request_TV = XPTDB[TLI3TVrequested]%;
macro REqueue = XPTDB[XPTrequ]%;
macro REqueue_count = XPTDB[XPTreq_cnt]%;
macro ROUTESaddr = XPTDB[XPTraddr]%;
macro Routing_changed = XPTDB[XPTSrm]%;
macro Routing_clock = XPTDB[XPTt1]%;
macro Routing_Loss = XPTDB[XPTrout_loss]%;
macro Routing_timer = XPTDB[XPT$t1]%;
macro Synchblk = XPTDB[XPTsynblk]%;
macro T1 = XPTDB[XPTt1]%;
macro T2 = XPTDB[XPTt2]%;
macro TI_msg_CNT = XPTDB[XPT_TI_CNT]%;
macro TI_msg_ADDR = XPTDB[XPT_TI_ADDR]%;
macro Tid = XPTDB[XPTtid]%;
macro Timer = XPTDB[XPTltim]%;
macro Unreach_Loss = XPTDB[XPTunreach_loss]%;
macro Update_clock = XPTDB[XPTt2]%;
macro Update_timer = XPTDB[XPT$t2]%;
macro UPDATEquota = XPTDB[XPTupdq]%;
macro Verify_Rejects = XPTDB[XPTver_rej]%;
macro XPTflags = XPTDB[XPTflg]%;
!
!  Field mapping for Transport node data base entry
!

$FIELD NODEfields =
    set
    XPTol =	[$tiny_integer],        ! OL or User
    XPTlocal =  [$bit],
    XPTp2 =	[$BIT],
        $fill($bits(5))
    XPTreach =	[$BIT],
        $align(UNIT)
    XPTaddress = [$short_integer],
    XPTminhop =	[$INTEGER],             ! 821 - HOPS
    XPTmincost=	[$INTEGER]              ! 820 - COST
    tes;

literal
    NODEsize = $field_set_size,
    NODElength = NODEsize * %UPVAL;     ! Length of node data base entry

macro NODEblock = block [NODElength] field (NODEfields)%;
!
! Synonyms for NODEb
!
macro Local_node = NODEb[XPTlocal]%;
macro Maximum_address =
        begin
        local MXA : ref vector;
        if (MXA = .NODEmaximum_address_vector) neqa 0
        then begin
             if (MXA = .MXA [.NODEaddress - 1]) neq 0
             then begin
                  if .MXA leq .XPTDB[XPTnn]
                  then MXA
                  else XPTDB[XPTnn]
                  end
             else XPTDB[XPTnn]
             end
        else XPTDB[XPTnn]
        end%;
macro Minhop = NODEb[XPTminhop]%;
macro Mincost = NODEb[XPTmincost]%;
macro NODEaddress = NODEb[XPTaddress]%;
macro OL = NODEb[XPTol]%;
macro Phase2_node = NODEb[XPTp2]%;
macro Reach = NODEb[XPTreach]%;
macro User = NODEb[XPTol]%;
!
!  Field mapping for Transport line data base entry
!

$FIELD LINEfields =
    set
    XPTlinsta =	[$TINY_INTEGER],
    TLIowned = [$bit],
    TLIsend_TI = [$bit],
    TLIsend_TV = [$bit],
    TLIFreeing = [$bit],
    XPTsend_hello = [$bit],
    XPTsend_routes = [$bit],
    XPTinit_line = [$bit],
    XPTline_up = [$bit],
        $align(fullword)
    XPTnty =	[$tiny_integer],        ! Node type, as defined below.
    TLIintercept = [$bit],              ! If on, node init as ourselves.
                                        ! If off, false node init.
    XPTphase2_circuit = [$bit],
    TLIph2only = [$bit],                ! If on, force phase II protocol
        $fill($bit)
    XPTDTE_circuit = [$bit],            ! If on, this line goes
        $align(fullword)                ! to a TOPS20 node.
    XPTnid =	[$address],             ! 800 - ADJACENT NODE address
        $align(fullword)
    XPTDLLstate = [$tiny_integer],      ! Last received state from DLL.
    XPTnnml = [$tiny_integer],          ! Adjacent node name length
    XPTnnm = [$byte_string (6)],        ! Adjacent node name
        $align (fullword)
    XPTblock_size = [$short_integer],   ! 810 - BLOCK SIZE
    XPTcost = [$short_integer],         ! 900 - COST
    XPThello_timer = [$short_integer],  ! 906 - HELLO TIMER
    XPTlisten_timer = [$short_integer], ! 907 - LISTEN TIMER
    XPTXPThandle = [$integer],          ! Transport process handle:
        $overlay(XPTXPThandle)
    XPTlinno = [$byte],                 !  Number of this line
    XPTXPTpix = [$byte],                !  Transport's PIX
        $continue
    XPTTLIhandle = [$integer],          ! TLI process handle
    XPTDLLhandle = [$integer],          ! DLL process handle
    XPTnmxid = [$integer],              ! NMXID (for event logging)
    XPTlinq = [$tiny_integer],
    XPTnstate = [$tiny_integer],        ! 0 - STATE
    TLIlinrcvr = [$tiny_integer],
    TLIxstate = [$tiny_integer],        ! Last requested XPT state
    TLIrcvrsta = [$tiny_integer],
    XPTinp_cnt = [$byte],
        $align(fullword)
    XPThello_clock = [$integer],        ! Clock for hello timer
    XPTlisten_clock = [$integer],       ! Clock for listen timer
    XPTlinccb =	[$address],             ! CCBs waiting for line up/down
    TLItime_zeroed = [$time],           !   0 - Time last zeroed
    XPTend_rcv = [$counter (32)],       ! 800 - Terminating Packets Received
    XPTend_xmt = [$counter (32)],       ! 801 - Originating Packets Sent
    XPTend_cng = [$counter (16)],       ! 802 - Terminating Congestion Loss
    XPTxit_rcv = [$counter (32)],       ! 810 - Transit Packets Received
    XPTxit_xmt = [$counter (32)],       ! 811 - Transit Packets Sent
    XPTxit_cng = [$counter (16)],       ! 812 - Transit Congestion Loss
    XPTlinedn =	[$counter (8)],         ! 820 - Circuit Down
    XPTini_fail = [$counter (8)]        ! 821 - Initialization Failure
    tes;

literal
    LINEsize = $field_set_size,
    LINElength = LINEsize * %UPVAL;     ! Length of line data base entry

macro LINEblock = block [LINElength] field (LINEfields)%;
!
! Synonyms for LINEb
!
macro Arriving_Packets = LINEb[XPTend_rcv]%;
macro Block_size = LINEb[XPTblock_size]%;
macro Departing_Packets = LINEb[XPTend_xmt]%;
macro DLLhandle = LINEb[XPTDLLhandle]%;
macro DLLstate = LINEb[XPTDLLstate]%;
macro DTEcircuit = LINEb[XPTDTE_circuit]%;
macro End_Congestion = LINEb[XPTend_cng]%;
macro Freeing = LINEb[TLIFreeing]%;
macro Hello_clock = LINEb[XPThello_clock]%;
macro Hello_timer = LINEb[XPThello_timer]%;
macro Init_Fails = LINEb[XPTini_fail]%;
macro INPUTcount = LINEb[XPTinp_cnt]%;
macro Intercept = LINEb[TLIintercept]%;
macro Lcv = LINEb[XPTcost]%;
macro Line_Downs = LINEb[XPTlinedn]%;
macro Line_up = LINEb[XPTline_up]%;
macro LINEccb = LINEb[XPTlinccb]%;
macro LINEfunction = LINEb[TLIlinrcvr]%;
macro LINEnumber = LINEb[XPTlinno]%;
macro LINEquota = LINEb[XPTlinq]%;
macro LINEstate = LINEb[XPTlinsta]%;
macro LINEstate_desired = LINEb[TLIrcvrsta]%;
macro Listen_clock = LINEb[XPTlisten_clock]%;
macro Listen_timer = LINEb[XPTlisten_timer]%;
macro Nid = LINEb[XPTnid]%;
macro NMstate = LINEb[XPTnstate]%;
macro NMXid = LINEb[XPTnmxid]%;
macro Nnm = LINEb[XPTnnm]%;
macro Nnml = LINEb[XPTnnml]%;
macro Nty = LINEb[XPTnty]%;
macro OWNED = LINEb[TLIowned]%;
macro Ph2circuit = LINEb[XPTphase2_circuit]%;
macro Ph2only = LINEb[TLIph2only]%;
macro Send_hello = LINEb[XPTsend_hello]%;
macro Send_TI = LINEb[TLIsend_TI]%;
macro Send_TV = LINEb[TLIsend_TV]%;
macro Service_line = LINEb[XPTinit_line]%;
macro Srm = LINEb[XPTsend_routes]%;
macro Time_circuit_zeroed = LINEb[TLItime_zeroed]%;
macro TLIhandle = LINEb[XPTTLIhandle]%;
macro Transit_Congestion = LINEb[XPTxit_cng]%;
macro Transit_In = LINEb[XPTxit_rcv]%;
macro Transit_Out = LINEb[XPTxit_xmt]%;
macro XPThandle = LINEb[XPTXPThandle]%;
macro XPTstate = LINEb[TLIxstate]%;

!
!  Literal values
!

literal                         ! Node types (values of the Nty vector)
        Full = 2,		!  Full routing node type
	Small = 3,		!  Small routing node type
	PhTwo = 4,		!  Standard Phase II node type
	TOPS20 = 5;		!  TOPS-20 Phase II node type

$literal                                ! DLLstate values:
    DLL_FREE = 0,                       !  Not assigned
    DLL_OFF = $distinct,                !  Off
    DLL_SYNCHRONIZING = $distinct,      !  Synch
    DLL_MAINTENANCE = $distinct,        !  Maint
    DLL_RUNNING = $distinct,            !  Run
    DLL_LO = min (DLL_FREE,DLL_OFF,DLL_SYNCHRONIZING,DLL_MAINTENANCE,DLL_RUNNING),
    DLL_HI = max (DLL_FREE,DLL_OFF,DLL_SYNCHRONIZING,DLL_MAINTENANCE,DLL_RUNNING);

literal				!Network Management states for a circuit
    ON = 0;			!  State ON
!   OFF = 2;			!  State OFF

literal				!Transport states for a circuit
    HA = 0,			!  Halt
    DT = 1,			!  DLL stop in progress - line not restarting
    OFF = 2,			!  "Line down" in progress- line not restarting
    LR = 3,			!  "Line down" in progress - line restarting
    DS = 4,			!  DLL start in progress
    TI = 5,			!  Transport init in progress
    TV = 6,			!  Transport verify expected
    TC = 7,			!  "Line up" in progress
    RU = 8;			!  Transport running on line

!
!  Line initialization/termination sequence codes
!	(for use by Line Support)
!

$literal
    FUNCrequest = $distinct,            ! DLL request circuit
    FUNCrelease = $distinct,            ! DLL release circuit
    FUNCinitialize = $distinct,         ! DLL initialize link
    FUNCstop = $distinct,               ! DLL stop link
    FUNC_TI = $distinct,                ! DLL send TI
    FUNC_TV = $distinct,                ! DLL send TV
    FUNCline_down = $distinct,          ! XPT line up
    FUNCline_up = $distinct,            ! XPT line down
    FUNClo = min (FUNCrequest, FUNCrelease, FUNCinitialize, FUNCstop,
                  FUNC_TI, FUNC_TV, FUNCline_down, FUNCline_up),
    FUNChi = max (FUNCrequest, FUNCrelease, FUNCinitialize, FUNCstop,
                  FUNC_TI, FUNC_TV, FUNCline_down, FUNCline_up);

!
! C_XPT_TYPE for $DLL_TRANSMIT CCBs from TLI.
!

$literal
    TYPE_TI = $distinct,                ! TI message
    TYPE_TV = $distinct,                ! TV message
    TYPElo = min (TYPE_TI, TYPE_TV),
    TYPEhi = max (TYPE_TI, TYPE_TV);
!
!  Field definitions for a Node Translate Table entry
!

$FIELD NTTfields =
    set
    NTTname =	[$STRING(6)],	!Node name
    NTTaddr =	[$short_integer],!Node address
	$ALIGN(FULLWORD)
    NTTlen =	[$SUB_BLOCK()]	!End of entry
    tes;

macro NTTblock = block field (NTTfields)%;
!
!  Field definitions for a Link Translate Table entry
!

$FIELD LTTfields =
    set
    LTTnode1 =	[$short_integer],!Pair 1, node address
	$OVERLAY(LTTnode1)
    LTTnode =	[$short_integer],! Node address of a half-entry
	$CONTINUE
    LTTlink1 =	[$short_integer],!Pair 1, link address
	$OVERLAY(LTTlink1)
    LTTlink =	[$short_integer],! Link address of a half-entry
	$CONTINUE
    LTTnode2 =	[$short_integer],!Pair 2, node address
    LTTlink2 =	[$short_integer],!Pair 2, link address
    LTTlen =	[$SUB_BLOCK()]	!End of entry
    tes;

macro LTTblock = block field (LTTfields)%;
!
!  Field mapping for Transport password data base entry
!

$FIELD PWDfields =
    set
    TLIplink = [$address],              ! Link to next password entry
    TLIpnode = [$short_integer],        ! Node number or 0 (for default)
    TLIP2receive = [$byte_string (8)],  ! Phase II receive password
    TLIP2transmit = [$byte_string (10)],! Phase II transmit password
    TLIp3receive_length = [$tiny_integer],
    TLIp3receive = [$byte_string(1)]    ! Phase III receive password
                                        ! Phase III transmit password
    tes;

literal
    PWDsize = $field_set_size,
    PWDlength = PWDsize * %UPVAL;       ! Length of node data base entry

macro PWDblock = block [PWDlength] field (PWDfields)%;
!
! Synonyms for PWDb
!
macro PWDlink = PWDb[TLIplink]%;
macro PWDnode = PWDb[TLIpnode]%;
macro PWD2rcv = PWDb[TLIP2receive]%;
macro PWD2TVmsg_len = 10%;
macro PWD2TVmsg_ptr = byt$ptr(PWDb[TLIP2transmit])%;
macro PWD3rcv = PWDb[TLIp3receive]%;
macro PWD3rcv_length = PWDb[TLIp3receive_length]%;
macro PWD3TVmsg_len = (ch$rchar (ch$plus (PWD3TVmsg_ptr,3))+4)%;
macro PWD3TVmsg_ptr = ch$plus(byt$ptr(PWD3rcv),.PWD3rcv_length)%;
!+
!
!  Miscellaneous literals
!
!-

literal				!Field definitions for Hop,Cost
    Hop_P = 10,  Hop_S = 5,		!  Hop is at <10,5>
    Cost_P = 0,  Cost_S = 10;		!  Cost is at <0,10>
literal Infh = 31;		!Infinite path length
literal Infc = 1023;		!Infinite path cost

!
!  Phase II flag values for NSP
!

literal				!Routing header flag
    PH2_RTflgs = %o'106';

literal				!NSP MSGflgs values
    CI_MSGflgs = %o'30',	!  CI
    CC_MSGflgs = %o'50',	!  CC
    DI_MSGflgs = %o'70',	!  DI
    DC_MSGflgs = %o'110';	!  DC

literal				!Node Init/Verify values
    OTI_CTLflg = %o'130',	!  Node Init message flag byte
    INIT_SUBflg = 1,		!    Node Init subcode
    VER_SUBflg = 2,		!    Node Verify subcode
    OTIservices = 7;		!  "SERVICES" byte supplying intercept

literal                         !DC error codes
    NO_PATH_ERROR = 39,
    MISC_ERROR = 7;

!
!  Flag bits in the Phase III routing header
!

literal
    ALMflg =	%o'4',		!1 = Alarm message
    RQRflg =	%o'10',		!1 = "return to sender" requested
    RTSflg =	%o'20',		!1 = packet being returned to sender
    EVflg =	%o'100';	!1 = Phase II header
				!0 = Phase III header

!
!  Phase III control header flags
!

literal
    INIT_CTLflg = 1,		!Transport Init
	VFY_req = 4,		!  Flag in init. to request Node Verify
    VERIFY_CTLflg = 3,		!Transport Verify
    HELLO_CTLflg = 5,		!Hello or Test message
    ROUTING_CTLflg = 7;		!Routing message

literal				!Transport flags:
    Running = 1,		!  Transport is active
    Rfail = 2;			!  A recoverable resource failure has occurred

!
!  Size of the buffer necessary for circuit initialization
!	Equal to the largest:
!	   Transport Init
!	   Node Init
!	   Transport Verify
!	   Node Verify
!

literal
    INITbuffer_size = 58;

!
! Error codes (non-event)
!

DECLARE_SEVERITY (XPT, SUCCESS, INFO, ERROR, SEVERE);

$XPT_SUCCESS (XPT$_SUCCESS,     ' (just a filler)')
$XPT_SEVERE  (XPT$_CHECK,	' XPTDEC - corrupted data base')
$XPT_ERROR   (XPT$_IFC,         ' XPTFWD - invalid function code in a CCB')
				!		P1 = function code
$XPT_ERROR   (XPT$_DNS,         ' XPTSEL - invalid SELF destination')
				!		P1 = destination
$XPT_ERROR   (XPT$_IANT,        ' XPTSEL - invalid adjacent node type')
				!		P1 = node type
$XPT_ERROR   (XPT$_ICPT0,	' XPTSEL - duplicate CI received')
				!		P1 = source node
				!		P2 = source link
				!		P3 = destination node
				!		P4 = destination link
$XPT_INFO    (XPT$_ICPT1,	' XPTSEL - unrecognized destination address')
				!		P1 = MSGflgs
				!		P2 = source node
				!		P3 = source link
				!		P4 = destination node
				!		P5 = destination link
$XPT_INFO    (XPT$_ICPT2,	' XPTSEL - unrecognized source address')
				!		P1 = MSGflgs
				!		P2 = source node
				!		P3 = source link
				!		P4 = destination node
				!		P5 = destination link
$XPT_INFO    (XPT$_NFI,         ' XPTSEL - intercept link table full')
$XPT_SEVERE  (XPT$_BUF,		' XPTITF - lost buffer detected')
$XPT_ERROR   (XPT$_REQU,	' XPTTIM - retry of local transmit')
$XPT_SEVERE  (XPT$_FMT,		' XPTSEL - invalid message format')
$XPT_SEVERE  (XPT$_PAU,		' TLILIN - CCB lost while pausing')
$XPT_SEVERE  (XPT$_REE,         ' XPTINI - insufficient resources to initialize')

!
!  Error codes (events)
!

literal
    $XPT$E_AGE = 0,		! Aged Packet Loss
    $XPT$E_UNR = 1,		! Node Unreachable Packet Loss
    $XPT$E_RNG = 2,		! Node Out-of-Range Packet Loss
    $XPT$E_SIZ = 3,		! Oversize Packet Loss
    $XPT$E_FMT = 4,		! Packet Format Error
    $XPT$E_RUL = 5,		! Partial Routing Update Loss
    $XPT$E_VER = 6,		! Verification Reject
    $XPT$E_LLF = 7,		! Line down, line fault
    $XPT$E_LSF = 8,		! Line down, software fault
    $XPT$E_LOF = 9,		! Line down, operator cause
    $XPT$E_LUP = 10,		! Line up
    $XPT$E_ILF = 11,		! Initialization failure, line fault
    $XPT$E_ISF = 12,		! Initialization failure, software fault
    $XPT$E_IOF = 13,		! Initialization failure, operator cause
    $XPT$E_NRC = (14 or (1^15));! Node reachability change (flag means
				!   entity ID is a node address)