Trailing-Edge
-
PDP-10 Archives
-
BB-FB49A-RM
-
sources/sgapri.b36
There are no other files named sgapri.b36 in the archive.
%title 'SNA Trace Protocol for SNT Input'
module SGAPRI (ident = 'Version 1.00') =
begin
! Copyright (c) 1984, 1985 by
! 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:
!
! SNA Gateway Trace Protocol Access Module for SNT Input
!
! ABSTRACT:
!
! Functions to process Trace protocol input messages
! from DECnet.
!
! ENVIORNMENT:
!
! TOPS-20 Operating Systems, user interface.
!
! AUTHOR: Dennis Brannon, CREATION DATE: January 17, 1984
!
! MODIFIED BY:
!
! D. Brannon, 11-Oct-84 : VERSION 1.00
!
!--
!
! TABLE OF CONTENTS
!
!
! INCLUDE FILES
!
library 'SNTDEF';
library 'SNTLIB';
!
! FORWARD ROUTINES
!
forward routine
GAP$RI_COPY: novalue, ! Copy message
GAP$RI_DAT, ! Parse Data trace message
GAP$RI_PROTOCOL_TYPE, ! Check Protocol type
GAP$RI_STR; ! Parse Start trace message
!
! EXTERNAL REFERENCES
!
external
ST: SNTBLOCK;
external routine
GAD$ABORT_LINK,
GAD$DISCONNECT_LINK;
%routine ('GAP$RI_COPY', SOURCE, DESTINATION) : novalue =
!++
! FUNCTIONAL DESCRIPTION:
!
! Function to copy a counted string to a specified destination
! as an ASCIZ string.
!
! FORMAL PARAMETERS:
!
! SOURCE Address containing the source pointer to the
! counted string. Updated upon successful copy.
!
! DESTINATION Address containing the destination pointer for
! the ASCIZ string. Updated upon successful copy.
!
! IMPLICIT INPUTS:
!
! none
!
! IMPLICIT OUTPUTS:
!
! none
!
! ROUTINE VALUE:
!
! none
!
! SIDE EFFECTS:
!
! none
!
!--
begin
local
LENGTH;
LENGTH = ch$rchar_a (.SOURCE); ! Get the count byte
ch$copy (.LENGTH, ..SOURCE, 0, (.LENGTH + 1), ..DESTINATION);
.SOURCE = ch$plus (..SOURCE, .LENGTH);
.DESTINATION = ch$plus (..DESTINATION, (.LENGTH + 1));
return;
end; ! End of GAP$RI_COPY
%global_routine ('GAP$RI_DAT', POINTER, LENGTH) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Parse incoming SNA Trace data message.
!
! FORMAL PARAMETERS:
!
! ST The trace data base.
! POINTER Current pointer to the protocol message
! LENGTH Number of bytes remaining in the message.
!
! IMPLICIT INPUTS:
!
! none
!
! IMPLICIT OUTPUTS:
!
! none
!
! ROUTINE VALUE:
!
! $TRUE Parse completed
! $FALSE Failed to parse
!
! SIDE EFFECTS:
!
! none
!
!--
begin
local
DEST_POINTER,
IPOINTER,
LEN,
WB: ref WORK_BUFFER;
IPOINTER = ch$plus (.POINTER, 1); ! Skip the type and flag fields
WB = .ST[ST_WORK_AREA] ; ! Address of user supplied work area
return $TRUE;
end; ! End of GAP$RI_DAT
%global_routine ('GAP$RI_PROTOCOL_TYPE', POINTER, LENGTH) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Function to determine the protocol message type by sampling the first
! byte of the message containing the message type value.
!
! FORMAL PARAMETERS:
!
! ST The SNA Trace data base.
! POINTER Pointer to the protocol message buffer.
! LENGTH Number of bytes in the buffer.
!
! IMPLICIT INPUTS:
!
! none
!
! IMPLICIT OUTPUTS:
!
! none
!
! ROUTINE VALUE:
!
! $TRUE Parse completed, was able to determine message type
! $FALSE Failed to determine the message type
!
! SIDE EFFECTS:
!
! none
!
!--
begin
local
PROTOCOL,
IPOINTER;
! Get the message type
IPOINTER = .POINTER;
PROTOCOL = ch$rchar_a (IPOINTER);
ST[ST_RSP_CODE] = .PROTOCOL; ! Save the response type
ST[ST_DATA_BLOCK] = .POINTER + 1; ! Save the address to the message
ST[ST_DATA_SIZE] = .LENGTH; ! Save the length of the message
selectone .PROTOCOL of
set
[ST$STR]:
begin
return (GAP$RI_STR (.IPOINTER, (.LENGTH-1)));
end;
[ST$DAT]:
begin
ST[RSP_DAT] = $TRUE;
return (GAP$RI_DAT (.IPOINTER, (.LENGTH-1)));
end;
[otherwise]: ! Unrecognized protocol message
begin
ST[RSP_UNK] = $TRUE;
return $FALSE;
end;
tes;
end; ! End of GAP$RI_PROTOCOL_TYPE
%global_routine ('GAP$RI_STR', POINTER, LENGTH) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Parse incoming start trace message.
!
! FORMAL PARAMETERS:
!
! ST The trace data base.
! POINTER Current pointer to the protocol message
! LENGTH Number of bytes remaining in the message.
!
! IMPLICIT INPUTS:
!
! none
!
! IMPLICIT OUTPUTS:
!
! none
!
! ROUTINE VALUE:
!
! $TRUE Parse completed
! $FALSE Failed to parse
!
! SIDE EFFECTS:
!
! none
!
!--
begin
local
DEST_POINTER,
IPOINTER,
LEN,
WB: ref WORK_BUFFER;
IPOINTER = .POINTER;
WB = .ST[ST_WORK_AREA] ; ! Address of user supplied work area
if .ST[RSP_STR]
then
begin
ST[ST_STATUS2] = SNT$_PROTOCOL; ! SNATRACE$_PROTOCOL;
return SNT$_PROTOCOL; ! SNATRACE$_PROTOCOL;
end;
ST[RSP_STR] = $TRUE; ! Get message type
!
! Check the protocol version numbers.
!
if CH$GTR (3,
CH$PTR(UPLIT (STVER,STECO,STUEC)),
3,
CH$PTR(IPOINTER),
0)
then
begin
ST[ST_STATUS2] = SNT$_INCVER; ! SNT$_INCVER;
return SNT$_INCVER; ! SNT$_INCVER;
end;
IPOINTER = ch$plus (.IPOINTER, 3);
!
! Check the buffering level.
!
ST[ST_BUFFERS] = ch$rchar_a (IPOINTER);
IPOINTER = ch$plus (.IPOINTER,1); ! Skip till MSGLEN
ST[ST_MSGLEN] = ch$rword_a (IPOINTER); ! get the message length
ST[ST_SEGLEN] = ch$rword_a (IPOINTER); ! get the segment length
if .ST[ST_SEGLEN] eql .ST[ST_MSGLEN]
then ST[ST_SIZE] = .ST[ST_MSGLEN]
else return $FALSE;
return $TRUE;
end; ! End of GAP$RI_STR
end ! End of Module SGAPRI
eludom
! Local Modes:
! Mode:BLISS
! Auto Save Mode:2
! Comment Column:40
! Comment Rounding:+1
! End: