Trailing-Edge - PDP-10 Archives - BB-H348C-RM_1982 - swskit-v21/documentation/nspsrv-rel4.doc
There are no other files named nspsrv-rel4.doc in the archive.


     The TOPS-20  monitor  modules for NSP contains  message
control  routines  and  JSYS interfaces for NSP.  NSP allows
communication between DECnet objects  via  "logical  links".
These modules communicate with adjacent communications front
ends  or communications  devices as is the case for the 2020
and  establish  logical links requested by processes in  the
host  and  by  processes on other hosts in the network.  The
same modules that run on the DECSYSTEM-2040/50/60  also  run
on the DECSYSTEM-2020.

	The release 3A module, NSPSRV, has been broken  into
four modules in release 4:

	FILNSP - File system interface to NSP
	NSPINT - NSP internal interface
	NSPPAR - Data structure and symbol definitions
	NSPSRV - NSP interface to TOPS20, LL control routines

     A logical link requires:   1)  a  server  task  and  an
initiator  task,  2)  a physical communications path between
the two, and 3)  the  control  logical  in  the  hosts  (and
intermediate  front  ends)  for data flow.  A process "owns"
one end of a logical link by obtaining a JFN on that link (a
DECnet file specification).

Data Base

     NSPSRV maintains the following information in  the  JFN
block of the job's JSB once a logical link is established.

     1.  FILLLB/ address of logical link block

     2.  FILBFO/ byte pointer for current output buffer

     3.  FILBFI/ byte pointer for current input buffer

     4.  FILBCT/ # output bytes remaining ,, #  input  bytes

     5.  FILWND/ output window page address ,, input  window
         page address

	NSP resets the following words for the input or output
	direction depending upon the current user action:

     6.  FILCNT/ bytes remaining in current buffer

     7.  FILBYN/ byte # of current byte

     8.  FILLEN/ total file length in bytes

     9.  FILBYT/ byte pointer to current window

     The object type table OBJTBL contains  the  NSP  object
names and corresponding object numbers.    OBJTBL is defined
in STG. The table is initially loaded by OBJINI in NSPSRV.

     The logical link address bit table LLBITS  is  used  to
keep  track of which logical link numbers (addresses) are in
use.  LLBITS is defined in STG.

     NSPSRV controls, allocates, and deallocates entries  in
the  logical link table;  there is one logical link block in
the table for each link.   A  logical  link  block  contains
                                                      Page 2

information  needed  by  NSPSRV to properly manage the link.
The information is of two classes:  1) link parameters, such
as  current  link state, buffer counts, and segment numbers,
and 2) process parameters,  such  as  PSI  channels,  owning
fork, and byte counts.

 LLUPL  !X!                    Up Pointer                       ! *
 LLDWN  !X!X!X!XXX!           Down Pointer                      ! *
        !X!X! LLSTA !               ! LLLNK                     ! *
        ! ! !       !    Link Flags !      This Link's ID       !
        ! LLFRK                     ! LLDRC  ! LLPII  ! LLPIC   !
        !        Owning Fork        !Data PI ! Int PI ! CI PI   !
        ! LLIIN           ! LLFNM     ! LLHLK                   !
        !  Segment # for  !  Remote   !       Link ID on        !
        ! Incoming LS/INT ! Object #  !      Foreign Host       !
 LLMSG  !               Ptr. to Raw Message Queue               !
 LLMSI  !               Ptr. to Interrupt Message               !
        !!!  ! LLSWG                 ! LLMSM     ! free  ! free ! *
        !!!  !   Max. Segment Size   !           !       !      !
        !!  !!!  ! LLOPT                                        ! *
        !!  !!!  !                                              !
        ! Next Data Xmit  ! Next LS/INT Xmit !Next Data Receive !
        !LLDSN Segment #  !LLISN Segment #   !LLIDN Segment #   !
 LLOMSG !             Ptr. to Ordered Message Queue             !
        ! LLUCT  ! LLTSK                                        !
        !        !              Ptr. to Task Name               !
 LLHST  !               Ptr. to Remote Host Name                !
        ! LLMIC  ! LLFDS                                        !
        !        !       Remote descriptor block                !
 LLBPTR !                 Working Byte Pointer                  !
 LLBPCT !                  Current Byte Count                   !
        ! LLBSZ  !LLDRW!LLDMT !!LLLSC! LLRSN                    !
        !        !     !      !!     !  Disconnect Reason Code  !
 LLSEGQ !                 Header for Sent Queue                 !
                                                      Page 3

	!        free               ! LLRFK reserved process ID !
	! LLMQI        ! LLMQO      ! LLQUN       ! LLQOU       !
        ! LLNAM                     ! LLSOB                     !
        !    No. of This Object     !    Object of Remote CI    !
 LLDSC  !               Ptr. to Descriptor Block                !
 LLUSR  !                Ptr. to User Name Block                !
 LLACT  !            Ptr. to Accounting String Block            !
        ! LLPCT  ! LLPSW                                        !
        !        !            Ptr. to Password Block            !
 LLUSGP !                  User, Group from CI                  !

			Word 0

LLDED	B0	The MCB is dead

			Word 1

LLCIL	B0	Connected to internal link at other end
LLRES	B1	This link reserved for fork in LLRFK
LLLWC	B2	Connect Confirm was received
LLRCT	B3-5	Reserve Count

                           Word 2

LLQUE     B0       Link is on outque
LLLOC	  B1	   This is a local link
LLSTA     B2-5     Link State
                    LLSTRN=0   Link in Transition
                    LLSLIS=1   Object is Listening
                    LLSCIS=2   CI Sent
                    LLSCIR=3   CI Received
                    LLSRUN=4   Link is Running
                    LLSDIS=5   DI Sent
                    LLSDIQ=6   DI is Queued
                    LLSDIR=7   DI Received
                    LLSABT=10  Connection Aborted
          B6-17    Link Flags
                    LLINT=B6   This is an internal link
                    LLSDE=B7   LL Block Disasscoicated from
                    LLFNN=B8   Data Message Thrown Away
                    LLOPI=B9   Link is Open for Read
                    LLOPW=B10  Link is Open for Write
                    LLFNA=B11  Block Waiting for ACK
                    LLFIM=B12  EOM in Input Buffer
                    LLTRN=B13  Need Initial LS Message
                    LLFDI=B14  DI was an Abort
                    LLFII=B15  Input Interrupt Needed
                    LLFEM=B16  EOM
                    LLFOB=B17  This is an Object

                           Word 7

LLBRP     B0       Back-pressure Bit for Transmit
LLBRL     B1       Back-pressure Bit for Receive
LLMFC     B2-3     Flow Control Indicator
                    0=No Flow Control
                                                      Page 4

                    1=Segment Flow Control
                    2=Message Flow Control

                          Word 10

LLBOM     B0       At Beginning of Message
LLPRT     B1-2     DTE   for This Connection
LLFLI     B3       Input Direction
LLFLO     B4       Output Direction
LLIMS     B5       Input is a Message

     The link table  is  stored  as  a  binary  tree;   tree
entries are ordered by link number.

     Many message queues are  maintained  by  NSPSRV.   Each
logical  link has two message queues associated with it, the
"raw" queue and the "ordered" queue.  The raw queue, pointed
to  by  offset  LLMSG  in  the  logical link block, contains
messages in the order in which  they  are  received  by  the
link.   The  ordered  queue,  pointed  to  by offset LLOMSG,
contains messages ordered by NSP segment number.  Also,  the
queue SMSGQ contains the messages that come in over the DTE.
Finally, the queue MSGQ contains control messages which need
processing  by the host NSP and some data message which need
to be sent to logical links.


     The initialization  routines are called from  MEXEC  at
system initialization time. First NAMINI is called. It first
checks to see whether SETSPD has  set  the  node name and/or
node number.  If it  did  not,  the defaults are established.
Next, KDPINI is called to initialize the KMC/DUPs on a

     Most of NSP's initialization is performed by NSPINI. First
the  network   data   bases   are    initialized;
specifically, the object type table OBJTBL is set up and the
logical link address bit table is zeroed.

     Lastly, the  NSP  background  task  is  started  in  an
inferior process of JOB 0.

Background Task

     NSPSRV's background task NSPTSK is usually executing an
HDISMS JSYS, periodically checking to see if the KMC11 needs
attention  (2020  only)  and  if  MSGQ  is  non-empty.   The
background task handles most message processing activities.

20 ms Task
                                                      Page 5

     NSPSRV's 20  ms  task  NSPCH7  checks  to  see  if  any
messages  have  come in over the DTE.  If a message is found
on the queue SMSGQ, the routine NSPMSG is called to  process
the message.

Message Processing

     Messages coming from  another  node  are  removed  from
SMSGQ  by  the  routine NSPMSG and placed either on NSPTSK's
queue by the routine ONMSGQ or on the link's  raw  queue  by
the  routine ONRAWQ;  this occurs during the 20 ms task.  It
is ONRAWQ that checks to see if the process is waiting for a
software  interrupt  when  a  message  arrives;   if so, the
interrupt is generated by ONRAWQ.

     MOVSEG is the routine which processes  the  raw  queue.
First,  it  takes  the  appropriate  action  when  an ACK is
encountered;  second, it builds the ordered (by NSP  segment
number) queue.

     If a process  is  blocked  (e.g.,  doing  a  SIN),  the
scheduler  test  LL,,CHKRAW  will  dispatch  to CHKRAW which
first checks the raw queue and then checks the ordered queue
for incoming messages.

     Messages going to  another  node  are  sent  to  DTESRV
(KDPSRV on the 2020) by SNDMSG.

     Messages going to processes on  this  node  are  placed
either  on  MSGQ or on the link's raw queue.  Those messages
which require processing by the host NSP  (e.g.,  a  connect
event)  are  processed  by  state  table lookups, eventually
producing new messages to be sent.

Network-Dependent I/O

     NSPSRV contains the device-dependent I/O  routines  for
the  DECnet  devices  DCN:   and  SRV:.   The routine NETSQI
processes sequential input;  after locking the logical  link
block  it dispatches to the appropriate routine as indicated
by the state transition tables.   The  routines  NETSQO  and
NETSQR, in FILNSP,  process  sequential  output  and  SOUTR,
respectively, in a similar fashion.

     FILNSP also  contains  supporting  routines  for  other
monitor  calls  which  are  used with DECnet.  GTJFN, OPENF,
CLOSF,  and  MTOPR   all   require   additional   processing
capabilities  when  dealing with the devices DCN:  and SRV:.
These routines as well as the I/O routines  mentioned  above
are  easily  found since the DTBs for devices DCN:  and SRV:
and defined in FILNSP.
                                                      Page 6


     At the very  end  of  NSPSRV  is  the  NODE  JSYS;   it
performs the following functions:

     1.  NDSLN - set the local node name

     2.  NDGLN - get the local node name

     3.  NDSNM - set the local node number

     4.  NDGNM - get the local node number

     5.  NDSLP - set loopback

     6.  NDCLP - clear loopback

     7.  NDFLP - find loopback

    8.  NDSNT - Set network topology information

    9.  NDGNT - Get network topology information

   10.  NDSIC - Set interrupt channel for topology change

   11.  NDCIC - Clear interrupt channel for topology change

   12.  NDGVR - Get NSP version information

   13.  NDGLI - Get line information

   14.  NDVFY - Verify node name