Trailing-Edge
-
PDP-10 Archives
-
BB-FB51A-RM
-
sna-ai/sources/saipri.b36
There are no other files named saipri.b36 in the archive.
%title 'SNA GATEWAY ACCESS PROTOCOL INPUT'
module SAIPRI (ident = 'Version 1.0') =
begin
! Copyright (c) 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 Access Module
!
! ABSTRACT:
!
! Functions to parse Gateway Access protocol input messages
!
! ENVIRONMENT:
!
! TOPS-20 Operating Systems, user interface.
!
! AUTHOR: Vicki Gary, CREATION DATE: March 17, 1984
!
! MODIFIED BY:
!
! , : VERSION
! 01 -
!--
!
! TABLE OF CONTENTS
!
!
! INCLUDE FILES
!
library 'SNACOM';
!
! FORWARD ROUTINES
!
forward routine
GAP$I_COPY: novalue,
GAP$I_PROTOCOL_TYPE;
forward routine
GAP$I_BINDDATA,
GAP$I_DATA,
GAP$I_FLUSH_BUF,
GAP$I_RECON_PEND;
!
! EXTERNAL REFERENCES
!
external routine
GAD$ABORT_LINK,
GAD$DISCONNECT_LINK;
%global_routine ('GAP$I_PROTOCOL_TYPE', PORT: ref PORT_CONTROL_BLOCK, 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:
!
! PORT The port 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);
case .PROTOCOL from AP_BINDDATA to AP_RECON_PEND of
set
[AP_BINDDATA]: ! 3
return (GAP$I_BINDDATA (.PORT, .IPOINTER, (.LENGTH-1)));
[AP_NORMAL_DATA]: ! 5
return (GAP$I_DATA (.PORT, .IPOINTER, (.LENGTH-1)));
[AP_FLUSH_BUF]: ! 6
return (GAP$I_FLUSH_BUF(.PORT));
[AP_RECON_PEND]: ! 7
return (GAP$I_RECON_PEND (.PORT));
[inrange, ! Unrecognized protocol message
outrange]:
return $FALSE;
tes;
end; ! End of GAP$I_PROTOCOL_TYPE
%global_routine ('GAP$I_BINDDATA', PORT: ref PORT_CONTROL_BLOCK, POINTER, COUNT) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Parse incoming BIND DATA
!
! MSG : /3/FLSBUF/BINDDATA/
!
! FORMAL PARAMETERS:
!
! PORT The port data base.
! POINTER Pointer to protocol message buffer.
!
! IMPLICIT INPUTS:
!
! none
!
! IMPLICIT OUTPUTS:
!
! none
!
! ROUTINE VALUE:
!
! $TRUE Parse completed
! $FALSE Failed to parse
!
! SIDE EFFECTS:
!
! none
!
!--
begin
local
IPOINTER,
DATA_BASE: ref USER_DATA_BASE;
IPOINTER = .POINTER;
DATA_BASE = .PORT[PCB_DATA_BASE];
if not ((.PORT[PCB_STATE] = AS_BNW) or (.PORT[PCB_STATE] = AS_RCN))
then return $FALSE;
! Get BIND data
DATA_BASE[UDB_BIND_AVAILABLE] = $TRUE;
DATA_BASE[UDB_FLUSH_SEND] = ch$rchar_a (IPOINTER);
DATA_BASE[UDB_BIND_LENGTH] = .COUNT - 1;
ch$move (.DATA_BASE[UDB_BIND_LENGTH], .IPOINTER, ch$ptr (DATA_BASE[UDB_BIND_DATA],,8));
! Set port state to BIND recieved
PORT[PCB_STATE] = AS_BNR;
return $TRUE;
end; ! End of GAP$I_BINDDATA
%global_routine ('GAP$I_FLUSH_BUF', PORT: ref PORT_CONTROL_BLOCK) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Flush buffer message
!
! MSG : /4/REASON/INFORMATION/
!
! FORMAL PARAMETERS:
!
! PORT The port data base.
! POINTER Pointer to the protocol message buffer.
!
! IMPLICIT INPUTS:
!
! none
!
! IMPLICIT OUTPUTS:
!
! none
!
! ROUTINE VALUE:
!
! $TRUE Parse completed
! $FALSE Failed to parse
!
! SIDE EFFECTS:
!
! none
!
!--
begin
PORT[PCB_STATE] = AS_FLU;
return $TRUE;
end; ! End of GAP$I_FLUSH_BUF
%global_routine ('GAP$I_RECON_PEND', PORT: ref PORT_CONTROL_BLOCK) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Parse UNBIND Hold
!
! MSG : /7/
!
! FORMAL PARAMETERS:
!
! PORT The port data base.
! POINTER Pointer to the protocol message buffer.
!
! IMPLICIT INPUTS:
!
! none
!
! IMPLICIT OUTPUTS:
!
! none
!
! ROUTINE VALUE:
!
! $TRUE Parse completed
! $FALSE Failed to parse
!
! SIDE EFFECTS:
!
! none
!
!--
begin
local
DATA_BASE: ref USER_DATA_BASE;
DATA_BASE = .PORT[PCB_DATA_BASE];
PORT[PCB_STATE] = AS_RCN; ! Set port state to reconnect pending
PORT[PCB_DATA] = $FALSE; ! Clear data available
PORT[PCB_RESET_SEEN] = -1; ! reset seen yet
DATA_BASE[UDB_DATA_AVAILABLE] = $FALSE ! user ready to receive
end; ! End of GAP$I_RECON_PEND
%global_routine ('GAP$I_DATA', PORT: ref PORT_CONTROL_BLOCK, POINTER, SIZE) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Parse incoming data protocol message
!
! MSG : /5/SEQNUM/RH/DATA/
!
! FORMAL PARAMETERS:
!
! PORT The port data base.
! POINTER Pointer to the protocol message buffer.
! SIZE Number of data bytes (including the flags byte) in
! the buffer.
!
! IMPLICIT INPUTS:
!
! none
!
! IMPLICIT OUTPUTS:
!
! none
!
! ROUTINE VALUE:
!
! $TRUE Parse completed
! $FALSE Failed to parse
!
! SIDE EFFECTS:
!
! none
!
!--
begin
local
LENGTH,
IPOINTER,
DATA_BASE: ref USER_DATA_BASE;
IPOINTER = ch$plus (.POINTER, 1);
DATA_BASE = .PORT[PCB_DATA_BASE];
LENGTH = .SIZE - 1; ! Get data length
! Get data field
DATA_BASE[UDB_DATA_LENGTH] = max (.LENGTH, 0);
DATA_BASE[UDB_DATA_AVAILABLE] = $TRUE;
if .LENGTH gtr 0
then ch$move (.LENGTH, .IPOINTER, ch$ptr (DATA_BASE[UDB_USER_DATA],,8))
else DATA_BASE[UDB_USER_DATA] = 0;
return $TRUE;
end; ! End of GAP$I_DATA
%routine ('GAP$I_COPY', SOURCE, DESTINATION) : novalue =
!++
! FUNCTIONAL DESCRIPTION:
!
! Function to copy protocol buffer to data base and update buffer
! pointer.
!
! FORMAL PARAMETERS:
!
! SOURCE Address containing the source pointer to the
! protocol message buffer. Updated upon successful
! copy.
! DESTINATION Pointer to the destination location in the data
! base.
!
! IMPLICIT INPUTS:
!
! none
!
! IMPLICIT OUTPUTS:
!
! none
!
! ROUTINE VALUE:
!
! none
!
! SIDE EFFECTS:
!
! none
!
!--
begin
local
LENGTH;
LENGTH = ch$rchar (..SOURCE) + 1; ! Get the count byte
ch$move (.LENGTH, ..SOURCE, .DESTINATION);
.SOURCE = ch$plus (..SOURCE, .LENGTH);
return;
end; ! End of GAP$I_COPY
end ! End of Module SAIPRI
eludom
! Local Modes:
! Mode:BLISS
! Auto Save Mode:2
! Comment Column:40
! Comment Rounding:+1
! End: