Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/nml/nmlevr.bli
There are no other files named nmlevr.bli in the archive.
! <BRANDT.DEVELOPMENT>NMLEVR.BLI.1 28-Jul-82 02:53:34, Edit by BRANDT
!
!   Ident 08.
!     Include MODULE entity processing in routine READ_EVENT_REQUESTS.
!
! NET:<PECKHAM.DEVELOPMENT>NMLEVR.BLI.4 27-Jun-82 01:35:43, Edit by PECKHAM
!
! Ident 07.
! Fix conversion to TOPS20 time. This must mirror the changes in NMLEVT.
!
! NET:<PECKHAM.DEVELOPMENT>NMLEVR.BLI.2 22-Apr-82 08:25:12, Edit by PECKHAM
!
! Ident 06.
! Change configuration switch naming.
!
! NET:<PECKHAM.DEVELOPMENT>NMLEVR.BLI.2 26-Mar-82 08:44:41, Edit by PECKHAM
!
! Ident 05.
! Utilize new MCB time block.
!
! NET:<PECKHAM.DEVELOPMENT>NMLEVR.BLI.17 23-Mar-82 13:20:05, Edit by PECKHAM
!
! Ident 04.
! Use new event queing routines.
! Use configuration switches from NMLCOM.
! Take advantage of fix in NMU$NETWORK_OPEN
! to make response buffer optional.
!
! NET:<PECKHAM.DEVELOPMENT>NMLEVR.BLI.3 23-Feb-82 10:22:14, Edit by PECKHAM
!
! Ident 03.
! Fix MEMORY_RELEASE length in WAIT_FOR_CONNECT.
!
module NMLEVR (
               ident = 'X03.08'
		) =
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:	DECnet-10/20 V3.0 Network Management Layer (NML)
!
! ABSTRACT:
!
!	This module performs the NML Event receiving function.
!
! ENVIRONMENT:	TOPS-10/20 & MCB/RSX11 User mode under NML
!
! AUTHOR: Scott G. Robinson , CREATION DATE: 20-Mar-81
!         from NMLRCV by Dale C. Gunn
!
! MODIFIED BY:
!
!	, : VERSION
! 3.01	L. Webber, 20-Oct-81
!	Fixed call to NETWORK_OPEN to pass a response pointer and length;
!	put in error handling for NETWORK_OPEN and MEMORY_GET.
!
! 3.02  L. Webber, 20-Nov-81
!       Fixed 3.01 so that addresses not pointers are used in memory gets
!       and retrieves.
!
! 3.03  S. Thigpen, 06-Jan-82
!       Fixed dot bug in WAIT_FOR_CONNECT's call to NMU$MEMORY_RELEASE.
!--

!
! INCLUDE FILES:
!

library 'NMLLIB';				! All required definitions

require 'NMLEXT';				! NML External routines

!
! TABLE OF CONTENTS
!

forward routine
    NML$EVENT_RECEIVER : novalue;

forward routine
    WAIT_FOR_CONNECT,                   ! Wait for connection to target task
    READ_EVENT_REQUESTS : novalue;      ! Read Event Logging Messages

!
! MACROS:
!
!
! EQUATED SYMBOLS:
!

literal
    BUFFER_LENGTH = 300,                ! Buffer length in bytes
    BUFFER_SIZE = ch$allocation (BUFFER_LENGTH, 8), ! In words
    BUFFER_ALLOCATION = BUFFER_SIZE*%upval; ! In addr units

!
! OWN STORAGE:
!
!
! EXTERNAL REFERENCES:
!

external routine
    NML$EVENT_MANAGER,
    NMU$NETWORK_UTILITIES;

external
    NMLVER,                             ! Network Managment version number
    DECECO,                             ! Digital ECO number
    USRECO;                             ! User ECO number

!<BLF/SYNONYM %unquote =>
%global_routine ('NML$EVENT_RECEIVER', TASK, RESOURCE) : novalue =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine is the top level of the Network Management
!	Event receiver. The receiver is responsible for
!       accepting connections from remote NMLs, verifying their
!       privilege to perform logging functions based on access control
!       information provided with the connection.
!
! FORMAL PARAMETERS
!
!	TASK	 - Address of task block for this task
!	RESOURCE - Address of cell for this task to use as
!                  a resource variable.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	NONE.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin
%if NML$CFG_LOGGING_RECEIVER
%then

    local
	BUFFER_PTR;                     ! General I/O buffer pointer

    BUFFER_PTR = ch$ptr (NMU$MEMORY_GET (BUFFER_ALLOCATION),, 8);

!
! Loop forever, wait for link connected, read requests until disconnected.
!

    while $true do
	begin
        !
        ! Put our Network Management version number into the buffer
        ! to send as the optional data on a link connect acceptance.
        !
        begin

        local
            PTR;

        PTR = .BUFFER_PTR;              ! Point to connect accept buffer
        PUTB (.NMLVER, PTR);            ! Store NM major version
        PUTB (.DECECO, PTR);            ! Store our minor (ECO) version
        PUTB (.USRECO, PTR);            ! Store customer ECO number
        end;
        begin

        local
            LINK_ID;                    ! Open logical link identifier

	LINK_ID = WAIT_FOR_CONNECT (EVENT_OBJECT, 3, .BUFFER_PTR);
	READ_EVENT_REQUESTS (.LINK_ID, .BUFFER_PTR, BUFFER_LENGTH);
	NMU$NETWORK_CLOSE (.LINK_ID, 0, 0);
        end;
	end;

%else
    0                                   ! To avoid empty compound expression
%fi
    end;                                ! End of NML$RECEIVE_EVENT
%routine ('WAIT_FOR_CONNECT', OBJECT, DATA_LEN, DATA_PTR) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine opens a target link for connection by
!	another task.  When a connect is attempted the user
!	access rights are checked and the source task's version
!	number is checked.  If all checks are ok, then the
!	link is accepted (sending the optional acceptance data)
!	and the LINK_ID is returned.  If any check fails,
!	a reject is sent with the appropriate error code.
!
! FORMAL PARAMETERS
!
!	OBJECT	    - DECnet object code
!	DATA_LEN    - Number of bytes in optional accept data
!	DATA_PTR    - Pointer to optional acceptance data
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	The LINK_ID of the opened link.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin
%if NML$CFG_LOGGING_RECEIVER
%then

    local
	LINK_HANDLE,				! Handle of link
	CBLK : CONNECT_BLOCK,			! Link connection block
	CONNECTED,				! Boolean indicating connect success
	REASON;					! Link rejection reason

!
! Initially link is not connected
!
    CONNECTED = $false;
!
! Set the object code and clear the task name and descriptor.
!
    CBLK [CB_OBJECT] = .OBJECT;
    CBLK [CB_TASK_LENGTH] = 0;
    CBLK [CB_DESCRIPTOR_LENGTH] = 0;
!
! Loop until the link is connected
!

    while not .CONNECTED do
	begin
        !
        ! Wait for a connect to this target task
        !
        if (LINK_HANDLE = NMU$NETWORK_OPEN (TARGET_LINK, CBLK, 0, 0, 0)) geq 0
        then
            !
            ! Accept the Connection
            !
            if not (CONNECTED = NMU$NETWORK_ACCEPT (.LINK_HANDLE,
                                                    .DATA_LEN,.DATA_PTR))
            then
                NMU$NETWORK_CLOSE (.LINK_HANDLE, 0, 0);

	end;

!
! Return handle (id) of link that was opened and accepted.
!
    return .LINK_HANDLE
%else
    0                                   ! To avoid empty compound expression
%fi
    end;                                ! End of WAIT_FOR_CONNECT
%routine ('READ_EVENT_REQUESTS', LINK_ID, BUF_PTR, BUF_LEN) : novalue =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine performs the Event receiver function on
!	a logical link that has already been opened. The looping
!	continues until the task at the other end of the link closes
!	it (or some other nefarious glitch takes it down).
!
! FORMAL PARAMETERS
!
!	LINK_ID - Identifier for logical link to do looping on
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
!
!	NONE.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

    begin
%if NML$CFG_LOGGING_RECEIVER
%then

    local
        REB : RAW_EVENT_BLOCK,
        TB : TIME_BLOCK;

    REB [REB_TIME_BLOCK] = TB;
    !
    ! Loop through reading EVENT requests as long as link stays up.
    !

    while $true do
	begin

        local
            BYTE_COUNT;                 ! Received EVENT request message length

	!
	! Check if we received a message, or read completed for some
	! other reason. (Maybe the link was disconnected.)
	!

	if (BYTE_COUNT = NMU$NETWORK_READ (.LINK_ID, .BUF_LEN, .BUF_PTR)) leq 0
        then exitloop;

        !
        ! Put the EVENT on the queue to be processed.
        !

        begin

        local
            PTR;

        PTR = ch$plus (.BUF_PTR, 1);
        REB [REB_SINK_FLAGS] = ch$rchar_a (PTR);
        REB [REB_EVENT_CODE] = GETW (PTR);
%if $MCB
%then
        begin                           ! Get EVENT_TIME
        TB [TIME_JULIAN] = GETW (PTR);
        TB [TIME_SECOND] = GETW (PTR);
        TB [TIME_MILLISECOND] = GETW (PTR);
        end;
%else
%if $TOPS20
%then
        begin
        local JULIAN, SECONDS;
        DECLARE_JSYS (IDCNV, ODCNV);
        JULIAN = GETW (PTR);
        SECONDS = GETW (PTR);
        PTR = ch$plus (.PTR, 2);

        if .JULIAN <0, 1> neq 0         ! Make
        then                            ! odd
            begin                       ! half-days
            JULIAN = .JULIAN - 1;       ! even.
            SECONDS = .SECONDS + 12*60*60;
            end;

        begin
        local BASE, MONTH;
        $$IDCNV (1977^18 + 0, 0^18, 0;,BASE); ! Get 1-JAN-77
        BASE = .BASE + .JULIAN^17;      ! add in days to now
        $$ODCNV (.BASE, 0; BASE, MONTH); ! convert to year/julian
        $$IDCNV (.BASE, .MONTH, .SECONDS;,TB); ! put seconds in
        end;
        end;
%else
        %info ('Not prepared to handle time for TOPS10')
        PTR = ch$plus (.PTR, 6);
%fi
%fi
        REB [REB_SOURCE_POINTER] = .PTR;
        PTR = ch$plus (.PTR, 2);
        PTR = ch$plus (.PTR, ch$rchar_a (PTR));
        REB [REB_ENTITY_TYPE] = GETW (PTR);
        REB [REB_ENTITY_POINTER] = .PTR;

        selectone .REB [REB_ENTITY_TYPE] of
            set
            [NODE_E] :
                begin
                PTR = ch$plus (.PTR, 2);
                PTR = ch$plus (.PTR, ch$rchar_a (PTR));
                end;
            [CIRCUIT_, LINE_, MODULE_] :
                PTR = ch$plus (.PTR, ch$rchar_a (PTR));
            [LOGGING_] :
                PTR = ch$plus (.PTR, 1);
            tes;

        REB [REB_DATA_POINTER] = .PTR;
        REB [REB_DATA_LENGTH] = .BYTE_COUNT - ch$diff (.PTR, ch$plus (.BUF_PTR, 1));
        end;
        NML$EVENT_RECORDER (REB);
	end;

%else
    0                                   ! To avoid empty compound expression
%fi
    end;                                ! End of READ_EVENT_REQUESTS
end                                     ! End of Module NMLEVR

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