Google
 

Trailing-Edge - PDP-10 Archives - BB-R595B-SM_11-9-85 - mcb/sc/scprm.req
There is 1 other file named scprm.req in the archive. Click here to see a list.
!                    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.

!++
!	*** Start of SCPRM ***
!
! Macros, structures, and stuff for Session Control
!--

literal
    SCPRM_VERSION = 21;

library 'MCB:XPORTX';
library 'MCB:MCBLIB';

$show (all);

literal
    true = (1 eql 1),		! Affirmative
    false = (1 eql 0),		! Not so
    paranoid = true,		! Conditional compile of some checking
    none_such = -1;		! Huh?

structure
    BYTE_VECTOR [I; N] =
    %if %bliss (bliss16)
    %then
	[N] (BYTE_VECTOR + I)<0, 8>
    %fi
    %if %bliss (bliss36)
    %then
	[N/4] (BYTE_VECTOR + I/4)<(I mod 4)*9, 9>
    %fi;



DECLARE_SEVERITY (SC, SEVERE);

$SC_SEVERE (SC$_IFC, 'illegal function code')
$SC_SEVERE (SC$_ISC, 'illegal subfunction code')
$SC_SEVERE (SC$_LWS, 'link in wrong state')
$SC_SEVERE (SC$_NNS, 'no Network Services layer')
$SC_SEVERE (SC$_NNM, 'no Network Management module')

DECLARE_SEVERITY (SCX, SEVERE);

$SCX_SEVERE (SCX$_ILE, 'internal logic error')
$SCX_SEVERE (SCX$_ISC, 'illegal subfunction code')
$SCX_SEVERE (SCX$_NSC, 'no Session Control server process')
!+
! Macro to conditionally align addresses for 36-bit compilation
!-
macro
    $SC_WAIT =				! Resource wait in SC
	begin
	SCDB [SCF_KLOK] = true;
	SCDB [SCF_SUCC] = false;
	return
	end %,

    $SCX_WAIT =				! Resource wait in SCX
	begin
	TNB [TNF_RWT] = true;
	SCXDB [SCXF_SUCC] = false;
	return
	end %;


!+
! MCB Scheduling Macros
!-
macro
    $SC_DO_CCP (ccb, sts) =
	begin
	bind $SC$CCB = (ccb): block field (C_FIELDS);
	$SC$CCB [C_FNC] = FC_CCP;
	%if not %null (sts) %then $SC$CCB [C_STS] = sts; %fi
	$MCB_SCHEDULE_CCB (ccb)
	end %,

    $SC_DO_RCE (ccb, sts) =
	begin
	bind $SC$CCB = (ccb): block field (C_FIELDS);
	$SC$CCB [C_FNC] = FC_RCE;
	%if not %null (sts) %then $SC$CCB [C_STS] = sts; %fi
	$MCB_SCHEDULE_CCB (ccb)
	end %,

    $SC_DO_RCP (ccb, mdf, lnk) =
	begin
	%if not %declared (DO_RCP)
	%then external routine DO_RCP: linkage_ccb novalue; %fi
	DO_RCP (ccb, mdf, lnk)
	end %,

    $SC_DO_XCP (ccb, sts) =
	begin
	bind $SC$CCB = (ccb): block field (C_FIELDS);
	$SC$CCB [C_FNC] = FC_XCP;
	%if not %null (sts) %then $SC$CCB [C_STS] = sts; %fi
	$MCB_SCHEDULE_CCB (ccb)
	end %,

    $SC_DO_XME (ccb, mdf, lnk) =
	begin
	%if not %declared (DO_XME)
	%then external routine DO_XME: linkage_ccb novalue; %fi
	DO_XME (ccb, mdf, lnk)
	end %,

    $SCX_DO_RCE (ccb, sts) =
	begin
	bind $SC$CCB = (ccb): block field (C_FIELDS);
	$SC$CCB [C_FNC] = FC_RCE;
	%if not %null (sts) %then $SC$CCB [C_STS] = sts; %fi
	$MCB_SCHEDULE_CCB (ccb)
	end %,

    $SCX_DO_XME (ccb, mdf, iop, lcb, buf) =
	begin
	%if not %declared (DO$XME)
	%then external routine DO$XME: linkage_ccb novalue; %fi
	DO$XME (ccb, mdf, iop, lcb, buf)
	end %;


!+
! Macro for conditionally mapping/binding database.
!-
macro
    $SC_GET_DATA_BASE (dabname) =
	%if not %declared (MCB$GAW_PROCESS_DATA_BASE)
	%then external MCB$GAW_PROCESS_DATA_BASE: vector [2]; %fi
	%if %declared (dabname)
	%then map dabname : ref
	%else bind dabname = .MCB$GAW_PROCESS_DATA_BASE [1] :
	%fi block field (SC_FIELDS) %,

    $SCX_GET_DATA_BASE (dabname) =
	%if not %declared (MCB$GAW_PROCESS_DATA_BASE)
	%then external MCB$GAW_PROCESS_DATA_BASE: vector [2]; %fi
	%if %declared (dabname)
	%then map dabname : ref
	%else bind dabname = .MCB$GAW_PROCESS_DATA_BASE [1] :
	%fi block field (SCXDB_FIELDS) %;


!+
! Dispatching macros for SC
!-
macro
    $SC_DISPATCH_INPUT (QUE) =
	begin
	bind CCB = QUE: ref block field (C_FIELDS);
	if .CCB neq 0
	then DISPATCH$ (.CCB [C_MOD], RCPWT, (.LNK))
	end %,

    $SC_DISPATCH_OUTPUT (QUE) =
	begin
	bind CCB = QUE: ref block field (C_FIELDS);
	if .CCB neq 0
	then DISPATCH$ (.CCB [C_MOD], XMEWT, (.LNK))
	end %;


!+
! Dispatching macros for SCX
!-
macro
    $SCX_DISPATCH_INPUT (QUE) =
	begin
	bind
	    CCB = QUE: ref block field (C_FIELDS),
	    IDSP = $IDSP: vector;	
	if .CCB neq 0
	then DISPATCH$ (.CCB [C_MOD], $IDSP, (.TNB))
	end %,

    $SCX_DISPATCH_OUTPUT (QUE, CB) =
	begin
	bind
	    IOP = QUE: ref block field (IOP_FIELDS),
	    ODSP = $ODSP: vector;
	if .IOP neq 0
	then DISPATCH$ (((.IOP [I_MOD]) and %o'177')^-2, .ODSP [(.IOP [I_FNC]) - IOP_LO], (CB))
	end %;


!+
! Queue Management Macros
!-
macro
    $SCX_STACK (QUE, STR) =		! Queue STR to head of QUE
	begin
	%if not %declared ($SCQHD) %then external routine $SCQHD: novalue; %fi
	$SCQHD (QUE, STR)
	end %,

    $SCX_ENQUEUE (QUE, STR) =		! Queue STR to tail of QUE
	begin
	%if not %declared ($SCQIN) %then external routine $SCQIN: novalue; %fi
	$SCQIN (QUE, STR)
	end %,

    $SCX_DEQUEUE (QUE, STR) =		! Dequeue from QUE to STR
	begin
	%if not %declared ($SCQRM) %then external routine $SCQRM; %fi
	$SCQRM (QUE, STR)
	end %;
!+
! Field mapping for SC's data base
!-
$field SC_FIELDS =
    set
    SC_TICK = [$byte],			! Reserved place for long timer
    SC_FLAGS = [$byte],			! SC's status info
    $overlay (SC_FLAGS)
	SCF_STAT = [$bits (2)], 	! SC state (must be low 2 bits)
	SCF_KLOK = [$bit], 		! Long timer active
	SCF_OPEN = [$bit],		! Port OPEN in progress
	SCF_SUCC = [$bit],		! SC resource allocation success flag
    $continue
    SC_NSPIX = [$byte], 		! NSP's PIX
    SC_NMPIX = [$byte],			! NMX's PIX
    SC_SNPIX = [$byte],			! SC's extension process PIX
    SC_LLINK = [$byte], 		! Last logical link handled
    SC_IPORT = [$byte],			! Number of currently OPEN input ports
    SC_RPORT = [$byte],			! Required number of OPEN input ports
    SC_LADDR = [$short_integer],	! Local node address
    SC_HADDR = [$short_integer],	! Host node address
    SC_SSIZE = [$short_integer],	! NSP segment size
    SC_LINKS = [$short_integer],	! Maximum number of logical links
    SC_NODES = [$short_integer],	! Maximum number of network nodes
    SC_LOOPS = [$short_integer],	! Maximum number of loopbacks
    SC_ITIME = [$short_integer],	! Incoming connect timer value
    SC_OTIME = [$short_integer],	! Outgoing connect timer value

    SC_OTN_LEN = [$short_integer],	! Length of OTN table
    SC_ONP_LEN = [$short_integer],	! Length of ONP table

    SC_OTN_BIAS = [$address], 		! OTN address doubleword
    SC_OTN_ADDR = [$addresx], 		!   Object-type to object-name
    $overlay (SC_OTN_BIAS)		!   mapping table
	SC_OTN = [$address], 		!
    $continue

    SC_ONP_BIAS = [$address], 		! ONP address doubleword
    SC_ONP_ADDR = [$addresx], 		!   Object-name to process-name
    $overlay (SC_ONP_BIAS)		!   mapping table
	SC_ONP = [$address], 		!
    $continue

    SC_LLT_BIAS = [$address],	 	! LLT address doubleword
    SC_LLT_ADDR = [$addresx], 		! ...
    $overlay (SC_LLT_BIAS)
	SC_LLT = [$address], 		! ...
    $continue

    SC_NMT_BIAS = [$address], 		! NMT address doubleword
    SC_NMT_ADDR = [$addresx], 		! ...
    $overlay (SC_NMT_BIAS)
	SC_NMT = [$address], 		! ...
    $continue

    $overlay (SC_TICK)
	SC_TOP = [$address]		! Guaranteed beginning of SCDB
    $continue
    tes;

literal
    SC_SIZE = $field_set_size,		! Length of SC data base
    S_ST_ON = 0,			! SC is ON
    S_ST_OFF = 1,			! SC is OFF
    S_ST_SHUT = 2,			! SC is SHUT
    S_ST_RST = 3;			! SC is RESTRICTed
!+
! Field mapping for SC's logical link table
!-
$field LLT_FIELDS =
    set
    L_STATE = [$byte],		 	! Link state
    L_FLAGS = [$byte],			! Processing flags
    $overlay (L_FLAGS)
	LL_ACDW = [$bits (3)], 		! Abort-Close-Disconnect flags
	LL_BUSY = [$bit],		! Link is in use
	LL_KLOK = [$bit], 		! Connect timer running
	LL_INTM = [$bit],		! Link has outstanding interrupt msg
    $continue
    $overlay(LL_ACDW)
	LL_ABTI = [$bit], 		! Abort initiated
	LL_CLSI = [$bit], 		! Close initiated
	LL_DSCI = [$bit], 		! Disconnect initiated
    $continue
    L_ULA = [$byte], 			! User link address
    L_LLA = [$byte],			! Logical link address
    L_PID = [$byte], 			! Port ID
    L_PIX = [$byte], 			! User process index
    L_RNA = [$short_integer], 		! Remote node address
    L_CHN = [$short_integer],		! Channel #
    L_TIMER = [$short_integer],		! Timer value
    L_STS = [$short_integer],		! Status value for link disolution

    L_I_HEAD = [$addresx], 		! Input queue header
    L_I_TAIL = [$addresx], 		!   "     "   tail
    $overlay (L_I_HEAD)
	L_IQUE = [$address], 		! ...
    $continue

    L_O_HEAD = [$addresx], 		! Output queue header
    L_O_TAIL = [$addresx], 		!   "      "   tail
    $overlay (L_O_HEAD)
	L_OQUE = [$address], 		! Output queue
    $continue

    L_N_HEAD = [$addresx], 		! Interrupt queue header
    L_N_TAIL = [$addresx], 		!     "       "   tail
    $overlay (L_N_HEAD)
	L_INTQ = [$address], 		! ...
    $continue

    $overlay (L_STATE)
	L_TOP = [$address]		! Guaranteed beginning of LLT
    $continue
    tes;

literal
    L_SIZE = $field_set_size,		! Length of the LLT entry

    ST_OFF = 0,				! Off
    ST_CIS = 1,				! Connect requested by user
    ST_CID = 2,				! Connect has been delivered to remote
    ST_OI = 3,				! Port OPEN initiated
    ST_OPN = 4,				! Port is OPEN
    ST_CR = 5,				! Connect received from remote
    ST_CRA = 6,				! Connect ack'd by local user
    ST_CA = 7,				! Local user has accepted connect
    ST_CLI = 8,				! Logical link is being closed
    ST_ABI = 9,				! Logical link is being aborted
    ST_DI = 10,				! Logical link is being disconnected
    ST_DIR = 11,			! Disconnect initiate received
    ST_RUN = 12;			! Link is in the RUN state



!+
! Field mapping for the Node Mapping Table
!-
$field
    NMT_fields =
    set
    NMT_BASE = [$sub_block (0)],        ! Base of entry
    NMT_NAML = [$tiny_integer],   	! Name length (max of 6)
    NMT_NAME = [$byte_string (6)],	! Node name
    NMT_CHAN = [$byte],                 ! Channel number
    $align (fullword)
    NMT_ADDR = [$short_integer],	! Node address
    NMT_NMXID = [$short_integer]
    tes;

literal
    NMT_SIZE = $field_set_size;
!+
! Field mapping for the Object Mapping Tables
!-

! OTN is for mapping from Object-Type to Object-Name
! An arriving connect request may specify a destination object
! by object type; if so, this structure (OTN) is examined to see
! whether it exists. If so, the corresponding object name is
! selected, and the object name is used to subsequently search
! the ONP structure.
$field OTN_FIELDS =
    set
    OTN_TYPE = [$byte],		! Object type
    OTN_NLEN = [$byte],		! Name length
    OTN_NAME = [$string (6)]	! ASCII object name
    tes;

literal
    OTN_SIZE = $field_set_size;

! ONP is for mapping from Object-Name to Process-Name
! An arriving connect request may specify a destination object
! by name; if so, this structure (ONP) is examined to see whether
! it exists. If so, the corresponding process name is selected.
! If no match is found, it is assumed that the destination is
! an RSX task, and will be determined in SCX.
$field ONP_FIELDS =
    set
    ONP_NLEN = [$byte],		! Name length
    ONP_NAME = [$string (6)],	! Object name
    $align (fullword)
    ONP_PROC = [$pointer]	! Not really a pointer, but allocates
    tes;			!   right amount of space

literal
    ONP_SIZE = $field_set_size;
!+
! SCX Data Base field definitions
!-
$field SCXDB_FIELDS =
    set
    SCX_TICK = [$byte],			! Reserved timer byte
    SCX_FLG = [$byte], 			! Processing flags
    $overlay (SCX_FLG)
	SCXF_KLOK = [$bit], 		!   Clock interrupt needed
	SCXF_SUCC = [$bit],		!   Resource allocation success flag
    $continue
    SCX_SCPIX = [$byte], 		! PIX of Session Control
    SCX_xxxxx = [$byte],		! Rsv'd
    SCX_UCB = [$addresx],		! UCB address
    SCX_TNB = [$addresx], 		! TNB list
    SCX_LINKS = [$short_integer],	! Maximum number of logical links

    SCX_MBHD = [$addresx], 		! General delivery mailbox list head
    SCX_MBTL = [$addresx],		! General delivery mailbox list tail
    $overlay (SCX_MBHD)
	SCX_MBX = [$address],		! ...
    $continue
    SCX_OTN_LEN = [$short_integer],	! Length of OTN table
    SCX_OTN_BIAS = [$address], 		! OTN address doubleword
    SCX_OTN_ADDR = [$addresx], 		!   Object-type to object-name
    $overlay (SCX_OTN_BIAS)		!   mapping table
	SCX_OTN = [$address], 		!
    $continue

    SCX_ULA_BIAS = [$address],		! User Link Address vector bias
    SCX_ULA_ADDR = [$addresx],		!  "    "      "      "    address
    $overlay (SCX_ULA_BIAS)
	SCX_ULA = [$address]		! ...
    $continue
    tes;

literal
    SCXDB_SIZE = $field_set_size;
!+
! Task Networking Control Block field definitions
!-
$field TNB_FIELDS =
    set
    TN_LINK = [$addresx],	 	! Link to next TNB in system
    TN_TASK = [$addresx],	 	! Pointer to the TCB
    TN_LCB = [$addresx], 		! Pointer to list of task's LCBs

    TN_IQHD = [$addresx],	 	! Input queue head
    TN_IQTL = [$addresx], 		! Input queue tail
    $overlay (TN_IQHD)
	TN_IQUE = [$address],		! ...
    $continue

    TN_OQHD = [$addresx],	 	! Output queue head
    TN_OQTL = [$addresx], 		! Output queue tail
    $overlay (TN_OQHD)
	TN_OQUE = [$address],		! ...
    $continue

    TN_LUN = [$byte], 			! User's LUN
    TN_FLG = [$byte], 			! Processing flags
    $overlay (TN_FLG)
	TNF_CLS = [$bit], 		!   Close initiated
	TNF_RWT = [$bit], 		!   Some link is waiting for a resource
	TNF_KLK = [$bit], 		!   Clock request
    $continue
    TN_ACT = [$byte], 			! Number of active links
    TN_MAX = [$byte],			! Max unmber of logical links
    TN_AST = [$byte], 			! Number of outstanding ASTs
    TN_xxx = [$byte],			! rsv's
    TN_SPA = [$addresx], 		! User's AST address

    TN_MBHD = [$addresx], 		! Mailbox queue head
    TN_MBTL = [$addresx],		! Mailbox queue tail
    $overlay (TN_MBHD)
	TN_MBXQ = [$address]		! ...
    $continue
    tes;

literal
    TNB_SIZE = $field_set_size;
!+
! Link Control Block field definitions
!-
$field LCB_FIELDS =
    set
    LC_LINK = [$addresx], 		! Pointer to next LCB for this task
    LC_TASK = [$addresx], 		! Pointer to the TCB
    LC_TNB = [$addresx], 		! Pointer to the TNB

    LC_OQHD = [$addresx], 		! Output queue head
    LC_OQTL = [$addresx], 		! Output queue tail
    $overlay (LC_OQHD)
	LC_OQUE = [$address], 		! ...
    $continue

    LC_NQHD = [$addresx], 		! Interrput queue head
    LC_NQTL = [$addresx], 		! Interrupt queue tail
    $overlay (LC_NQHD)
	LC_NQUE = [$address], 		! ...
    $continue

    LC_LUN = [$byte], 			! User's LUN
    LC_FLG = [$byte], 			! Processing flags
    $overlay (LC_FLG)
	LCF_CLS = [$bit], 		!   Close initiated
	LCF_NRES = [$bit],		!   Interrupt request resource needed
	LCF_ARES = [$bit],		!   Abort verify resource needed
	LCF_DSC = [$bit], 		!   Disconnect or abort initiated
    $continue
    LC_ULA = [$byte], 			! Our ULA
    LC_LLA = [$byte]			! Session Control LLA
    tes;

literal
    LCB_SIZE = $field_set_size;
!+
! Mailbox Packet field definitions
!-
$field MBP_FIELDS =
    set
    MB_LINK = [$addresx],		! Link to next MBP
    MB_CNT = [$short_integer],		! Data length
    MB_FNC = [$byte],			! Function code (see below)
    MB_FLG = [$byte],			! Processing flags
    $overlay (MB_FLG)
	MBF_REQ = [$bit],		  ! Task request needed
    $continue
    MB_LLA = [$byte],			! Logical link address
    MB_ULA = [$byte],			! User link address
    MB_LUN = [$byte],			! User LUN
    MB_xxx = [$byte],			! Rsv'd
    MB_TIME = [$short_integer],		! Timer value, for connects
    MB_TASK = [$addresx],		! TCB address
    MB_TNB  = [$address],		! TNB address
    MB_DATA = [$sub_block (0)]		! Data starts here
    tes;

literal
    MBP_SIZE = $field_set_size,		! Length of MBP, without data

    ! Function codes
    MB$CNP = 0,				! Connect pending
    mb$lo = 1,				! Lowest code to process
    MB$CON = 1,				! Connect
    MB$INT = 2,				! Interrupt
    MB$DSC = 3,				! User disconnect received
    MB$ABT = 4,				! User abort received
    MB$ABO = 5,				! Network abort
    MB$MOP = 8,				! MOP message
    mb$hi = 8;				! Highest code to process


    ! IOP Function Codes
literal
    IOP_DMO = 6,			! Dismount
    IOP_CLO = 7,			! Network close, from RSX
    iop_lo = 25,			! Lowest user-invokable command
    IOP_XMT = 25,			! Transmit data
	IOP$DAT = 0,			  ! Normal data
	IOP$INT = 8,			  ! Interrupt data
    IOP_RCV = 26,			! Receive data
    IOP_CON = 27,			! Connect processing
	IOP$CON = 0,			  ! Connect
	IOP$ACC = 8,			  ! Accept
    IOP_DSC = 28,			! Disconnect processing
	IOP$DSC = 0,			  ! Disconnect
	IOP$ABO = 8,			  ! Abort
	IOP$REJ = 16,			  ! Reject
    IOP_CTL = 29,			! Control
	IOP$OPN = 0,			  ! Open
	IOP$CLO = IOP$OPN,		  ! System close (OPN code reused)
	IOP$CLS = 8,			  ! Close
	IOP$SPA = 16,			  ! Specify AST
	IOP$GND1 = 24,			  ! Get network data (normal)
	IOP$GND2 = 32,			  ! Get network data (masked, l & t)
	IOP$GND3 = 40,			  ! Get network data (masked)
	IOP$GLN = 56,			  ! Get local node information
    iop_hi = 29;			! Highest user-invokable command


!+
! RSX field definitions, and such
!-
$field USR_BUFF =
    set
    USR_ADDR = [$pointer],
    USR_SIZE = [$pointer]
    tes;

$field SYS_BUFF =
    set
    SYS_BIAS = [$pointer],
    SYS_ADDR = [$pointer],
    SYS_SIZE = [$pointer]
    tes;


!+
! Field mapping for queue header
!-
$field QHD_FIELDS =
    set
    Q_HEAD = [$addresx],
    Q_TAIL = [$addresx]
    tes;


!+
! Field mapping for one word of bytes
!-
$field
    LO_BYTE = [$byte],
    HI_BYTE = [$byte];

literal
	DSR_CONNECT_BLOCK_SIZE = 110;

!++
!	*** End of SCPRM ***
!--