Google
 

Trailing-Edge - PDP-10 Archives - BB-X117B-SB_1986 - 10,7/nml/nmlsta.b36
There is 1 other file named nmlsta.b36 in the archive. Click here to see a list.
! UPD ID= 268, SNARK:<6.1.NML>NMLSTA.B36.8,   1-Mar-85 10:02:51 by GLINDELL
!  No need to poke data link watcher any more
!
! UPD ID= 257, SNARK:<6.1.NML>NMLSTA.B36.7,  10-Feb-85 14:49:21 by GLINDELL
!  Check NML circuit substate also: if loading, dumping or triggering then
!  do not change substate
!
! UPD ID= 234, SNARK:<6.1.NML>NMLSTA.B36.6,  17-Jan-85 14:33:25 by GLINDELL
!  Replace PROGRAM_ERROR with TASK_ERROR
!
! UPD ID= 209, SNARK:<6.1.NML>NMLSTA.B36.5,  10-Dec-84 15:37:10 by HALPIN
! Get MONSYM Library file out of default directory, not BLI:
!
! UPD ID= 129, SNARK:<6.1.NML>NMLSTA.B36.4,  19-Oct-84 09:53:07 by HALPIN
! Make sure we don't get ON-FAILED or ON-STARTING state when the circuit
! is really Running, i.e. there are adjacent nodes on line.
! Check for OFF to ON-STARTING transistions and call the Data Link
! Watcher to try and Initialize Protocol on DTE's.
! Change Parameter passed to Calculation Routine to be a Pointer to
! a Circuit Id.
!
! UPD ID= 119, SLICE:<6.1.NML>NMLSTA.B36.3,  25-Sep-84 10:22:59 by HALPIN
! Fix Previous line's comment character.
!
! UPD ID= 117, SLICE:<6.1.NML>NMLSTA.B36.2,  24-Sep-84 16:46:45 by HALPIN
%title 'NMLSTA -- STATE Calculation Routines'
module NMLSTA	(
		ident = 'X04.01'
		) =
begin

!
!			  COPYRIGHT (c) 1980, 1981 BY
!	      DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
!
! 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:	DECnet-10/20 V4.0 Network Management Layer (NML)
!
! ABSTRACT:
!
!
! ENVIRONMENT:	TOPS-10/20 NML
!
! AUTHOR: James J. Halpin Creation Date Sept 7, 1984
!
! MODIFIED BY:
!
!	, : VERSION
! 01	-
!--
!
! INCLUDE FILES:
!

library 'NMLLIB';                       ! All required definitions

%if $TOPS20
    %then
	library 'MONSYM';			! Monitor symbols

	library 'JLNKG';			! JSYS linkage definitions
    %fi

require 'NMLEXT';                       ! NML External routines

!
! TABLE OF CONTENTS
!

forward routine
               NML$CALCULATE_CIRCUIT_STATE: novalue;

!
! MACROS:
!

!
! EXTERNAL REFERENCES:
!

external routine
                NML$GET_VDB_PARAMETER,
                NML$SET_VDB_PARAMETER,
                NML$CLR_VDB_PARAMETER;

%global_routine ('NML$CALCULATE_CIRCUIT_STATE', CIRCUIT_ID) : novalue =

!++
! FUNCTIONAL DESCRIPTION:
!
!       Calculates the current state of the requested circuit and
!       stores it into the Volatile Database.
!
! FORMAL PARAMETERS:
!
!       CIRCUIT_ID - Pointer to Circuit Id.
!
! IMPLICIT INPUTS:
!
!       NONE.
!
! ROUTINE VALUE:
!
!       NONE.
!
! SIDE EFFECTS:
!
!       The Value of the Circuit State Parameter in NML's Volatile
!       Database will be updated.
!
!--

   begin

   literal
          CIRCUIT_OFF = 0,
          CIRCUIT_FAILED = 1,
          CIRCUIT_STARTING = 2,
          CIRCUIT_RUNNING = 3,
          NML_FAILED = 11,
          NML_OFF = 1,
          NML_ON = 0,
          NML_SERVICE = 2,
          NML_STARTING = 0,
          NML_NO_SUBSTATE = -1,
          OB_LENGTH = 24,           ! Length of the output buffer
          OB_SIZE = ch$allocation (OB_LENGTH,8),
          OB_ALLOCATION = OB_SIZE * %upval,
          STATE_PARAMETER_NUMBER = 0,
          SUBSTATE_PARAMETER_NUMBER = 1;


   local
        BUFFER_ADDRESS,             ! Address of the output buffer
        BUFFER_LENGTH,              ! Buffer Length in bytes
        BUFFER_POINTER,
        LENGTH,                     ! Number of bytes returned from NMX
        RESULT,
        ROUTER_CIRCUIT_STATE,
        NML_CIRCUIT_STATE,
        NML_CIRCUIT_SUBSTATE;


   if (BUFFER_ADDRESS = NMU$MEMORY_GET (OB_ALLOCATION)) eqla 0
   then return;

   BUFFER_POINTER = ch$ptr (.BUFFER_ADDRESS,,8);
   BUFFER_LENGTH = OB_LENGTH;

   NML$GET_VDB_PARAMETER (ENTITY_CIRCUIT,
                          .CIRCUIT_ID,
                          STATE_PARAMETER_NUMBER,
                          NML_CIRCUIT_STATE);

   if .NML_CIRCUIT_STATE eql NML_SERVICE 
   then begin
             NMU$MEMORY_RELEASE (.BUFFER_ADDRESS, OB_ALLOCATION);
             return;
        end;

! Now get NML's idea of internal substate.  If its between LOADING
! and AUTOTRIGGERING then NML is currently doing loading, dumping
! or triggering, either as command or caused by DLW.  In all these
! cases, do not reset the substate.

   if not NML$GET_VDB_PARAMETER (ENTITY_CIRCUIT,
                                 .CIRCUIT_ID,
                                 SUBSTATE_PARAMETER_NUMBER,
                                 NML_CIRCUIT_SUBSTATE)
   then NML_CIRCUIT_SUBSTATE = CIRCUIT_NO_SUBSTATE;

! Use the fact that all interesting states have values in sequence
   if (.NML_CIRCUIT_SUBSTATE geq CIRCUIT_LOADING)
   and (.NML_CIRCUIT_SUBSTATE leq CIRCUIT_AUTOTRIGGERING)
   then return;

! Not being worked on right now, get monitors point of view.
   LENGTH = .BUFFER_LENGTH;

   RESULT = $NML$SHOW (ENTITY_CIRCUIT,
                       .CIRCUIT_ID,
                       0, ! Qualifier
                       STATE_,
                       BUFFER_LENGTH,
                       .BUFFER_POINTER);

   if .RESULT eql 1 then
   begin
   local TEMP;
      BUFFER_POINTER = ch$ptr (.BUFFER_ADDRESS,,8);

      LENGTH = .LENGTH = .BUFFER_LENGTH;           ! # of data bytes returned

      TEMP = GETW (BUFFER_POINTER);               ! Get the Parameter Number
      TEMP = GETB (BUFFER_POINTER);               ! Get the format byte.


      LENGTH = .LENGTH - 3;

      ROUTER_CIRCUIT_STATE = GETB(BUFFER_POINTER);

      case .ROUTER_CIRCUIT_STATE from CIRCUIT_OFF to CIRCUIT_RUNNING of
      set
      [CIRCUIT_OFF]: begin
                          NML_CIRCUIT_STATE = NML_OFF;
                          NML$SET_VDB_PARAMETER (ENTITY_CIRCUIT,
                                                 .CIRCUIT_ID,
                                                 STATE_PARAMETER_NUMBER,
                                                 NML_CIRCUIT_STATE);
   
                          NML$CLR_VDB_PARAMETER (ENTITY_CIRCUIT,
                                                 .CIRCUIT_ID,
                                                 SUBSTATE_PARAMETER_NUMBER);
                     end;
      [CIRCUIT_FAILED]: begin
                             NML_CIRCUIT_STATE = NML_ON;
                             NML_CIRCUIT_SUBSTATE = NML_FAILED;
                             NML$SET_VDB_PARAMETER (ENTITY_CIRCUIT,
                                                    .CIRCUIT_ID,
                                                    STATE_PARAMETER_NUMBER,
                                                    NML_CIRCUIT_STATE);
   
                             NML$SET_VDB_PARAMETER (ENTITY_CIRCUIT,
                                                    .CIRCUIT_ID,
                                                    SUBSTATE_PARAMETER_NUMBER,
                                                    NML_CIRCUIT_SUBSTATE);
                        end;
   
      [CIRCUIT_STARTING]: begin
                               ! Check here for a transtion from a OFF State
                               ! to ON-STARTING.

                               NML$GET_VDB_PARAMETER (ENTITY_CIRCUIT,
                                                      .CIRCUIT_ID,
                                                      STATE_PARAMETER_NUMBER,
                                                      NML_CIRCUIT_STATE);

                               NML_CIRCUIT_STATE = NML_ON;
                               NML_CIRCUIT_SUBSTATE = NML_STARTING;
                               NML$SET_VDB_PARAMETER (ENTITY_CIRCUIT,
                                                      .CIRCUIT_ID,
                                                      STATE_PARAMETER_NUMBER,
                                                      NML_CIRCUIT_STATE);
   
                               NML$SET_VDB_PARAMETER (ENTITY_CIRCUIT,
                                                      .CIRCUIT_ID,
                                                      SUBSTATE_PARAMETER_NUMBER,
                                                      NML_CIRCUIT_SUBSTATE);
                          end;
   
      [CIRCUIT_RUNNING]: begin
                              NML_CIRCUIT_STATE = NML_ON;
                              NML$SET_VDB_PARAMETER (ENTITY_CIRCUIT,
                                                     .CIRCUIT_ID,
                                                     STATE_PARAMETER_NUMBER,
                                                     NML_CIRCUIT_STATE);

                              if not NML$GET_VDB_PARAMETER (ENTITY_CIRCUIT,
                                                           .CIRCUIT_ID,
                                                            SUBSTATE_PARAMETER_NUMBER,
                                                            NML_CIRCUIT_SUBSTATE)
                              then NML_CIRCUIT_SUBSTATE = NML_NO_SUBSTATE;

                              ! Get rid of any Illegal Substates.
                              ! If we just had a transition from ON-STARTING
                              ! or ON-FAILED, make sure we clear the old
                              ! Substate.

                              if .NML_CIRCUIT_SUBSTATE eql NML_STARTING
                              or .NML_CIRCUIT_SUBSTATE eql NML_FAILED
                              then
                              NML$CLR_VDB_PARAMETER (ENTITY_CIRCUIT,
                                                     .CIRCUIT_ID,
                                                     SUBSTATE_PARAMETER_NUMBER);


                         end;
      [OUTRANGE]: TASK_ERROR ('Invalid Circuit State returned from NMX');
                 
      tes;

   end;

   NMU$MEMORY_RELEASE (.BUFFER_ADDRESS, OB_ALLOCATION);

   end;                             ! End of NML$CALCULATE_CIRCUIT_STATE

end
eludom
! Local Modes:
! Mode:BLISS
! Auto Save Mode:2
! Comment Column:40
! Comment Rounding:+1
! End: