Google
 

Trailing-Edge - PDP-10 Archives - BB-R595B-SM_11-9-85 - mcb/xpt/xptini.bli
There is 1 other file named xptini.bli in the archive. Click here to see a list.
module XPTINI	(
		IDENT = 'X01150'
		) =
begin

!
!                    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.
!

!++
! FACILITY:	Transport
!
! ABSTRACT:
!
!	Contains the Transport initialization and termination modules.
!
! ENVIRONMENT:	MCB
!
! AUTHOR: L. Webber , CREATION DATE: 27-Jul-79
!
! MODIFIED BY:
!
!	L. Webber, 27-Jul-79 : VERSION 1.00
!
! 1.01	L. Webber, 20-Dec-79
!	Modify for MCB changes; take line startup out of INIT_XPT
!
! 1.02	L. Webber, 24-Jan-80
!	Combine Hop and Cost into one matrix
!
! 1.03	L. Webber, 29-Jan-80
!	Modify dispatch table to dispatch to separate routines
!
! 1.04	L. Webber, 2-Feb-80
!	Modify to accomodate node and line sub-data-bases
!	Take out dispatch table (moved to XPTITF)
!	Changed name to XPTINI from XPTMAIN
!
! 1.05	L. Webber, 27-Jun-80
!	Modify to use MCBLIB macros
!
! 1.06	A. Peckham, 15-Oct-80
!	Update for new function modifiers.
!
! 1.07	L. Webber, 11-Dec-80
!	Modify to support MCB 3.1
!
! 1.08	L. Webber, 6-Apr-81
!	Update to initialize INITtimer in line data base.
!	Also, change names of T5 and T6 to Hello_clock and T4, respectively.
!
! 1.09	L. Webber, 10-Apr-81
!	Fix call to RLS_BLK.
!
! 1.10	L. Webber, 6-May-81
!	Replace call to $LLLTM with a $MCB_ENABLE_LONG_TIMER.
!
! 1.11	L. Webber, 27-May-81
!	Add code to initialize the new circuit data base fields added
!	to support the new DLL interface.  Take out code to release
!	the node ID blocks; it would only be of use if Transport were
!	reinitialized during an MCB session.
!
! 1.12	L. Webber, 16-Jul-81
!	Add code to initialize the "Adjacent" field in the node data base.
!
! 1.13	L. Webber, 17-Sep-81
!	Add initialization for node data base field Phase2_node.
!
! 1.14	L. Webber, 23-Feb-82
!	Add initialization for DLLquota.
!
! 1.15	A. Peckham, 22-Apr-82
!	Eliminate references to GETLINE, GETNODE, RLS_BLK.
!
!--
!
! INCLUDE FILES:
!

require 'XPTMAC';

!
! TABLE OF CONTENTS
!

forward routine
	INIT_XPT: CALL$ novalue,
	TERM_XPT: CALL$ novalue;

!
! MACROS:
!

!
! EQUATED SYMBOLS:
!

!
! OWN STORAGE:
!

$MCB_PROCESS(name=XPE)

!
! EXTERNAL REFERENCES:
!
global routine INIT_XPT (CCB): CALL$ novalue =

!++
! FUNCTIONAL DESCRIPTION:
!
!  Initializes Transport.  All tables are set to their initial value,
!  and all lines are initialized.
!
! FORMAL PARAMETERS
!
!	CCB
!
! IMPLICIT INPUTS
!
!	All entries in the Transport Data Base
!
! ROUTINE VALUE:
! COMPLETION CODES:
!
!	NONE.
!
! SIDE EFFECTS:
!
!	All lines are initialized, all nodes become unreachable,
!	and all local transport users (including NSP) will have
!	to re-identify themselves.
!
!--

begin
map CCB: ref block field (C_fields);
require 'XPTSYM';

!
!  Initialize all the quotas
!

Maxh = $MAXH;
Maxv = $MAXV;
Maxc = $MAXC;
Maxl = $MAXL;
UPDATEquota = $UPDQ;
ECLquota = $ECLQ;
INPUTquota = $INPQ;
DLLquota = $LINQ;

!
!  Initialize the Transport identification (local node address)
!

Tid = .CCB[C_PRM1];

!
! Run through the initialization password data base and
! update the TV messages.
! Also set flags if verification is needed.
!

Request_TV = false;                     ! Assume verification not needed
Request_OTV = false;

$TLI_for_each_PWDb_do_begin
    pointer PTR;
    if ch$rchar(byt$ptr(PWD2rcv)) neq 0
    then Request_OTV = true;            ! Phase II TV should be requested
    if .PWD3rcv_length neq 0
    then Request_TV = true;             ! Phase III TV should be requested
    PTR = ch$plus (PWD3TVmsg_ptr,1);
    byt$short_string(Tid,PTR);
    if (.PWDnode neq 0) and
       (.PWDlink eqla 0)
    then begin
         local CNT;
         CNT = getb(PTR);
         CNT = .CNT + ch$diff(.PTR,byt$ptr(PWD3rcv_length));
         PWDlink = vector [PWD3rcv_length,byt$allocation(.CNT)];
         end;
$TLI_next_PWDb_end;

!
! Now the archetype TI, NI, and HELLO messages
!

begin                                   !  The TI message
pointer PTR;

if (PTR = .TI_msg_ADDR) eql 0
then if $MCB_GET_DSR (10, PTR)
     then TI_msg_ADDR = PTR = byt$ptr(.PTR)
     else return signal_stop (XPT$_REE);

putb(INIT_CTLflg,PTR);                  ! Build the
byt$short_string(Tid,PTR);              !  control header
if .Request_TV                          ! Put in TV request
then putb(4+Full,PTR)                   !  and node type
else putb(0+Full,PTR);
byt$short_string(DLLsize,PTR);          ! Put in max message size
putb (1,PTR); putb(3,PTR); putb(0,ptr);	! Put in version (1,3,0)
putb (0,PTR);				! Put in (null) seed
PTR = ch$diff(.PTR,.TI_msg_ADDR);
TI_msg_CNT = .PTR;
end;

begin                                   !  The NI message
pointer PTR;

if (PTR = .NI_msg_ADDR) eql 0
then if $MCB_GET_DSR (58, PTR)
     then NI_msg_ADDR = PTR = byt$ptr(.PTR)
     else return signal_stop (XPT$_REE);

putb(OTI_CTLflg,PTR);                   ! Construct the MSGflgs
putb(INIT_SUBflg,PTR);                  !  and the "init" subflag
ex_putw(.Tid,PTR);                      ! Put in the local node address
putb(.NODEname_length,PTR);             ! Put in the node name
PTR = ch$move(.NODEname_length,         !  as an image field
    byt$ptr(NODEname,0),.PTR);
putb(OTIservices,PTR);                  ! Specify in SERVICES we have intercept
if .Request_OTV
then putb(1,PTR)                        ! Request node verification
else putb(0,PTR);                       ! Make no REQUESTS
byt$short_string(PH2size,PTR);          ! Put in the maximum blocksize
byt$short_string(PH2size,PTR);          !  and the maximum segment size
putw($MAXlk,PTR);                       !  and the maximum number of links
putb(0,PTR); putw(0,PTR);               ! Specify a routing version of (0,0,0)
putb(0,PTR); putw(0,PTR);               !  and a similar communications version
putb(0,PTR);                            ! Specify no system ID
PTR = ch$diff(.PTR,.NI_msg_ADDR);
NI_msg_CNT = .PTR;
end;

begin                                   !  The false NI message
pointer PTR;

if .False_NI_msg_ADDR eql 0
then if $MCB_GET_DSR (58, PTR)
     then False_NI_msg_ADDR = byt$ptr(.PTR)
     else return signal_stop (XPT$_REE);

False_NI_msg_CNT = 0;
end;

begin                                   !  The HELLO message
pointer PTR;

if (PTR = .Hello_msg_ADDR) eql 0
then if $MCB_GET_DSR (4 + Default_Hello_data_length, PTR)
     then Hello_msg_ADDR = PTR = byt$ptr(.PTR)
     else return signal_stop (XPT$_REE);

putb(HELLO_CTLflg,PTR);                 ! Move in control flags
byt$short_string(Tid,PTR);              !  and source node address
putb(12,PTR);                           !  and length of test data
PTR = ch$fill (%o'252',12,.PTR);        !  and test data
PTR = ch$diff(.PTR,.Hello_msg_ADDR);
Hello_msg_CNT = .PTR;
end;

!
!  Initialize the Hop/Cost matrix to "too far"/"too costly"
!

MAP$(Hopcost_bias);
begin
    pointer P;
    P = Hopcost_address;
    decr IJ from NN*(NLN+1) to 1 do begin
	.P = ((Infh^Hop_P) or (Infc^Cost_P));
	P = vector[.P,1];
	end;
    end;

!
!  Initialize the node vectors to "unreachable" and "nowhere"
!

begin
local NODEb: ref NODEblock;

if (NODEb = .XPTDB[XPTnoddb]) eqla 0
then if $MCB_GET_DSR (NN*NODEsize*%upval, NODEb)
     then XPTDB[XPTnoddb] = .NODEb
     else return signal_stop (XPT$_REE);

incr I from 1 to NN do begin
    NODEaddress = .I;                   ! The node address
    Minhop = Infh;                      ! Too many hops away
    Mincost = Infc;                     !  and too costly.
    OL = -1;                            ! No output line.
    Reach = false;                      ! Not reachable.
    Phase2_node = false;                ! Not a phase II node.
    Local_node = false;                 ! Not a local address
    NODEb = vector [.NODEb, NODEsize];
    end;
end;

!
!  Initialize the line vectors and quotas
!

begin
local LINEb: ref LINEblock;

if (LINEb = .XPTDB[XPTlindb]) eqla 0
then if $MCB_GET_DSR (NLN*LINEsize*%upval, LINEb)
     then XPTDB[XPTlindb] = .LINEb
     else return signal_stop (XPT$_REE);

incr J from 1 to NLN do begin
    Nty = 0;                            ! No adjacent node, no type
    Nid = 0;                            !  and no address
    Nnml = 0;
    DTEcircuit = false;
    Send_hello = false;
    Srm = false;
    Freeing = false;
    Ph2only = false;
    Intercept = false;
    OWNED = false;                      ! Initialize the
    NMstate = OFF;                      !  various
    LINEstate = HA;                     !  circuit states
    XPTstate = OFF;
    DLLstate = DLL_FREE;
    LINEnumber = .J;
    XPThandle = PD_XPT^8 + .LINEnumber;
    TLIhandle = PD_TLI^8 + .LINEnumber;
    DLLhandle = 0;
    LINEquota = max($LINQ / (if NLN lss 3
                             then 1
                             else if NLN lss 7
                                  then 2
                                  else 3),
                    1);
    LINEccb = 0;
    LINEstate_desired = .LINEstate;
    LINEfunction = 0;
    Hello_clock = 0;
    Listen_clock = 0;
    LINEb = vector [.LINEb, LINEsize];
    end;
end;

!
!  Initialize the link translate table
!

begin
local LTT: ref LTTblock;

if (LTT = .Ph2link_table) eqla 0
then if $MCB_GET_DSR (.Ph2link_allocated*4*%upval, LTT)
     then Ph2link_table = .LTT
     else return signal_stop (XPT$_REE);

decru I from .Ph2link_allocated to 1 do
    begin
    LTT[LTTnode1] = -1;
    LTT[LTTlink1] = -1;
    LTT[LTTnode2] = -1;
    LTT[LTTlink2] = -1;
    LTT = LTT[LTTlen];
    end;
end;

!
!  Initialize the retry queue
!

$MCB_INITIALIZE_QUEUE(REqueue);

!
!  Set up the Transport flags
!

XPTflags = Running;

!
!  Start up the timers
!

Routing_clock = .Routing_timer;
Update_clock = .Update_timer;

$MCB_ENABLE_LONG_TIMER();
Timer = 1;

!
!  Return "complete" to calling process
!

CCB[C_STS] = CS_SUC;
CCB[C_FNC] = FC_CCP;
$MCB_SCHEDULE_CCB(.CCB);
end;				!End of INIT_XPT
global routine TERM_XPT (CCB): CALL$ novalue =

!++
! FUNCTIONAL DESCRIPTION:
!
!  Terminates Transport without bringing it back up.  This is
!  done by terminating all the lines.
!
! FORMAL PARAMETERS
!
!	CCB
!
! IMPLICIT INPUTS
!
!	XPTflags
!
! ROUTINE VALUE:
! COMPLETION CODES:
!
!	NONE.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

begin
map CCB: ref block field (C_fields);
require 'XPTSYM';

!
!  If Transport isn't up, return an error
!

if .XPTflags eql 0
then begin
     CCB[C_STS] = CE_DIS;
     CCB[C_FNC] = FC_CCP;
     $MCB_SCHEDULE_CCB(.CCB);
     return;
     end;

!
!  Declare a "Transport Terminating" event
!

%( TBS )%

!
!  Clear out the retry queue
!

while true do
    begin                               ! Terminate each CCB on the queue
    local RETRY_CCB: ref block field (C_XPT_FIELDS);
    if not $MCB_DEQUEUE_CCB(REqueue, RETRY_CCB) then exitloop;
    RETRY_CCB[C_FNC] = FC_CCP;
    RETRY_CCB[C_STS] = CE_DIS;
    $MCB_SCHEDULE_CCB(.RETRY_CCB);
    end;

!
!  Flag Transport as down
!

XPTflags = 0;
Routing_clock = 0;
Update_clock = 0;

!
!  Save the function CCB
!

Tid = .CCB;				!Note this destroys the Transport ID

!
!  Bring each line down
!

$XPT_for_each_LINEb_do_begin
    Service_line = true;                ! Flag for line service.
$XPT_next_LINEb_end;

end;				!End of TERM_XPT
end				!End of Module XPTMAIN
eludom