Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/nml/nmlevx.bli
There are no other files named nmlevx.bli in the archive.
!NET:<PECKHAM.DEVELOPMENT>NMLEVX.BLI.4 26-May-82 13:03:44, Edit by PECKHAM
!
! Ident 06.
! Update TQ [EQ_COUNT] when an event is extracted from TQ
! in NML$EVENT_TRANSMITTER.
!
!NET:<PECKHAM.DEVELOPMENT>NMLEVX.BLI.2 22-Apr-82 08:26:14, Edit by PECKHAM
!
! Ident 05.
! Change configuration switch naming.
!
!NET:<PECKHAM.DEVELOPMENT>NMLEVX.BLI.17 24-Mar-82 12:27:57, Edit by PECKHAM
!
! Ident 04.
! Rename NML$EVENT_XMIT to NML$EVENT_TRANSMITTER.
! Use new event queing routines.
! Use configuration switches from NMLCOM.
! Take advantage of fix in NMU$NETWORK_OPEN
! to make response buffer optional.
!
module NMLEVX (					! Event Transmitter
		ident = 'X00.06',
		language (common)
		) =
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: LSG DECnet Network Management
!
! Abstract: This task takes the next request from the recorder
!	    queue destined for a remote node and transmits it.
!
! Environment: TOPS10/TOPS20 user mode, MCB RSX task level
!
! Author: Scott G. Robinson, Creation date: 20-Mar-81
!	  from NMLXMT by Steven M. Jenness
!
! 1.02	L. Webber, 20-Oct-81
!	Add error pointer and length to NETWORK_OPEN parameters.
!
! 1.03  L. Webber, 10-Feb-82
!	Fix 1.02 bug in returning error buffer.
!
!--

!<BLF/SYNONYM %unquote=>
!<BLF/SYNONYM $FIELD=FIELD>
!<BLF/PAGE>
!
! Include files
!

library 'NMLLIB';				! All needed definitions

!
! Global routines
!

forward routine
    NML$EVENT_TRANSMITTER : novalue;	! Main routine for transmitter task

!
! Local routines
!

forward routine
    CONNECT_TO_REMOTE;				! Make connection to remote Event Receiver

!
! External references
!

external routine
    NML$EVENT_MANAGER,                  ! Central EVENT request handler
    NMU$MEMORY_MANAGER,                 ! Memory management routines
    NMU$NETWORK_UTILITIES,              ! DECnet logical link interface
    NMU$QUEUE_MANAGER,                  ! Queue handling routines
    NMU$SCHED_MANAGER;                  ! Scheduler interface

!
! Equated symbols
!

literal
    TWO_SECONDS = 2,
    FIVE_SECONDS = 5,
    TEN_SECONDS = 10;
%global_routine ('NML$EVENT_TRANSMITTER', TB, TR) : novalue =

!++
! Functional description:
!
!	This task runs forever (almost) removing remote requests
!	from the request queue and sending them to the appropriate
!	remote node for processing.
!
! Formal parameters:
!
!	.TB	Task block address
!	.TR	Task resource address
!
! Routine value: none
! Side effects: none
!
!--

    begin
%if NML$CFG_LOGGING_TRANSMITTER
%then

    while $true do
	begin

        local
            TQ : ref TRANSMITTER_QUEUE,
            LINK_ID;
        !
        ! Get a transmitter queue to service
        !

	if (TQ = NML$TRANSMITTER_QUEUE_GET ()) eqla 0 then exitloop;

        !
        ! Stick a null at the end of the node-id for safety.
        !
        ch$wchar (0, ch$ptr (TQ [TQ_SINK_NODE],
                             ch$rchar (ch$ptr (TQ [TQ_SINK_NODE], 2, 8)) + 3,
                             8));
        !
        ! Connect to remote EVENT processor.
        !
        LINK_ID = CONNECT_TO_REMOTE (ch$ptr (TQ [TQ_SINK_NODE],, 8));

        if .LINK_ID gtr 0
        then
            begin
            !
            ! Send as many events as possible
            !
            while $true do
                begin

                map
                    TQ : ref EVENT_QUEUE;

                local
                    EB : ref EVENT_BUFFER;

                if (EB = NMU$QUEUE_REMOVE (.TQ)) eqla 0 then exitloop;

                TQ [EQ_COUNT] = .TQ [EQ_COUNT] - 1;
                NMU$NETWORK_WRITE (.LINK_ID, $true, .EB [EB_LENGTH], ch$ptr (EB [EB_BUFFER],, 8));
                NMU$MEMORY_RELEASE (.EB, .EB [EB_ALLOCATION]);
                end;
            !
            ! Discard the link (done with the request)
            !
            NMU$NETWORK_CLOSE (.LINK_ID, 0, 0);
            end;
	end;

%else
    0                                   ! To avoid empty compound expression
%fi
    end;                                ! End of NML$EVENT_TRANSMITTER
%routine ('CONNECT_TO_REMOTE', NODE_ID_PTR) =

!++
! Functional description:
!
!	This routine connects to the EVENT listener on the
!	host specified in the request.  It does not return
!	until the connection is made (or determined to be
!	next to impossible).
!
! Formal parameters:
!
!	.NODE_ID_PTR    Pointer to target node-id
!
! Routine value:
!
!	Link id of DECnet link to remote EVENT listener
!
! Side effects: none
!
!--

    begin
%if NML$CFG_LOGGING_TRANSMITTER
%then

    local
	CONN_BLK : CONNECT_BLOCK,
	LINK_ID;

    CONN_BLK [CB_OBJECT] = EVENT_OBJECT;
    CONN_BLK [CB_DESCRIPTOR_LENGTH] = 0;
    CONN_BLK [CB_TASK_LENGTH] = 0;
    CONN_BLK [CB_HOST_LENGTH] = ch$rchar (ch$plus (.NODE_ID_PTR, 2)) + 3;
    CONN_BLK [CB_HOST] = .NODE_ID_PTR;
    CONN_BLK [CB_USERID] = 0;
    CONN_BLK [CB_USERID_LENGTH] = 0;
    CONN_BLK [CB_ACCOUNT] = 0;
    CONN_BLK [CB_ACCOUNT_LENGTH] = 0;
    CONN_BLK [CB_PASSWORD] = 0;
    CONN_BLK [CB_PASSWORD_LENGTH] = 0;
    CONN_BLK [CB_DATA] = ch$ptr (CONN_BLK [CB_DATA_BUFFER],, 8);
    CONN_BLK [CB_DATA_LENGTH] = 0;

    decr NTIMES from 3 to 1 do
	begin
        LINK_ID = NMU$NETWORK_OPEN (SOURCE_LINK, CONN_BLK, 0, 0, 0);

        if .LINK_ID geq 0 then exitloop;

        NMU$SCHED_SLEEP (TWO_SECONDS);
	end;

    .LINK_ID
%else
    0                                   ! To avoid empty compound expression
%fi
    end;                                ! End of CONNECT_TO_REMOTE
end                                     ! End of module NMLEVX

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