%include sasinit ; goptions ftitle=simplex hpos=100 vpos=40 ; title ls=5 ' ' ; footnote h=1 c=blue f=simplex j=r '1'; proc gslide ; note j=c c=black f=simplex h=2 'Techniques for writing a DECnet/VMS server' ; note j=c c=black f=simplex h=2 'Bob Graham, Dow Chemical, La. Division' ; note j=c c=black f=simplex h=2 'April, 1987' ; run; title h=2.5 c=black j=l ls=3 ' ' 'What you need to know' ; footnote h=1 c=blue f=simplex j=r '2'; proc gslide ; note h=1.8 c=green f=special ' J' c=blue f=simplex ' How to declare a network object' ; note h=1.8 c=green f=special ' J' c=blue f=simplex ' How to use non-transparent network access ' ; note h=1.8 c=green f=special ' J' c=blue f=simplex ' How to write AST driven program '; note h=1.8 c=green f=special ' J' c=blue f=simplex ' How to debug a network process '; run; title h=2.5 c=black j=l ls=3 ' ' 'Why you would want to write a server'; footnote h=1 c=blue f=simplex j=r '3'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' performance'; note h=2 c=green f=special ' J' c=blue f=simplex ' fast connect time'; note h=2 c=green f=special ' J' c=blue f=simplex ' no process creation'; note h=2 c=green f=special ' J' c=blue f=simplex ' no image activation'; note h=2 c=green f=special ' J' c=blue f=simplex ' no file opens, database init, etc.'; run; footnote h=1 c=blue f=simplex j=r '4'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' lower load on system'; note h=2 c=green f=special ' J' c=blue f=simplex ' one process instead of many'; note h=2 c=green f=special ' J' c=blue f=simplex ' reduces/eliminates locking'; note h=2 c=green f=special ' J' c=blue f=simplex ' easier to do caching'; run; footnote h=1 c=blue f=simplex j=r '5'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' gain control over service'; note h=2 c=green f=special ' J' c=blue f=simplex ' eliminates access control for links'; note h=2 c=green f=special ' J' c=blue f=simplex ' can implement own security design'; note h=2 c=green f=special ' J' c=blue f=simplex ' can keep counters for usage logging'; run; footnote h=1 c=blue f=simplex j=r '6'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' DOWDIR as an example'; note h=1.8 c=green f=special ' J' c=blue f=simplex ' needed fast method to look up MAIL users'; note h=1.8 c=green f=special ' J' c=blue f=simplex ' opening and reading keyed file across'; note h=1.8 f=special ' ' c=blue f=simplex ' the network was too slow'; note h=1.8 c=green f=special ' J' c=blue f=simplex ' having a copy on every node was unworkable'; note h=1.8 c=green f=special ' J' c=blue f=simplex ' DOWDIR has 6 servers for 600+ nodes'; note h=1.8 c=green f=special ' J' c=blue f=simplex ' response time depends mainly on number'; note h=1.8 f=special ' ' c=blue f=simplex ' of hops to server'; note h=1.8 c=green f=special ' J' c=blue f=simplex ' typically < 1 second for nearby server'; run; title h=2.5 c=black j=l ls=3 ' ' 'Basic run-time scheme of server'; footnote h=1 c=blue f=simplex j=r '7'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' process is created'; note h=2 c=green f=special ' J' c=blue f=simplex ' do application initialization'; note h=2 c=green f=special ' J' c=blue f=simplex ' open files'; note h=2 c=green f=special ' J' c=blue f=simplex ' load caches'; note h=2 c=green f=special ' J' c=blue f=simplex ' consistancy checks'; note h=2 c=green f=special ' J' c=blue f=simplex ' create network mailbox'; note h=2 c=green f=special ' J' c=blue f=simplex ' open channel to network'; note h=2 c=green f=special ' J' c=blue f=simplex ' declare network object'; run; footnote h=1 c=blue f=simplex j=r '8'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' wait for something to happen'; note h=2 c=green f=special ' J' c=blue f=simplex ' connect request arrives in mailbox'; note h=2 c=green f=special ' J' c=blue f=simplex ' connect is accepted or rejected'; note h=2 c=green f=special ' J' c=blue f=simplex ' processes transactions'; note h=2 c=green f=special ' J' c=blue f=simplex ' breaks link when done'; note h=2 c=green f=special ' J' c=blue f=simplex ' shutsdown when MSG$_ NETSHUT received'; run; title h=2.5 c=black j=l ls=3 ' ' 'How to get the server started'; footnote h=1 c=blue f=simplex j=r '9'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' at least two different methods'; note h=2 c=green f=special ' J' c=blue f=simplex " actual code doesn't HAVE to be different"; note h=2 f=special ' ' c=blue f=simplex ' for the two methods'; run; title2 h=2.0 c=black j=l ls=1 ' ' 'with RUN command' ; footnote h=1 c=blue f=simplex j=r '10'; proc gslide ; note h=1.8 c=green f=special ' J' c=blue f=simplex ' RUN/DETACH command in SYSTARTUP.COM'; note h=1.8 c=green f=special ' J' c=blue f=simplex ' must run AFTER network is up'; note h=1.8 c=green f=special ' J' c=blue f=simplex ' after STARTNET.COM'; note h=1.8 c=rec f=special ' J' c=blue f=simplex ' synchronize on STARTNET job'; run; footnote h=1 c=blue f=simplex j=r '11a'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' Pros'; note h=2 c=green f=special ' J' c=blue f=simplex ' easy to do'; note h=2 c=green f=special ' J' c=blue f=simplex ' avoid expensive initialization code' ; note h=2 c=green f=special ' J' c=blue f=simplex ' retain context ' ; note h=2 c=green f=special ' ' c=blue f=simplex ' updates forward to other servers'; note h=2 c=green f=special ' J' c=blue f=simplex " first connection doesn't wait"; note h=2 f=special ' ' c=blue f=simplex " for process creation"; run; footnote h=1 c=blue f=simplex j=r '11b'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' Cons'; note h=2 c=green f=special ' J' c=blue f=simplex ' server always running, uses memory,'; note h=2 f=special ' ' c=blue f=simplex ' and balance set slot'; note h=2 c=green f=special ' J' c=blue f=simplex ' have to manually start if network is'; note h=2 f=special ' ' c=blue f=simplex ' shutdown and restarted'; run; title2 h=2.0 c=black j=l ls=1 ' ' '"Pop-Up" Server' ; footnote h=1 c=blue f=simplex j=r '12'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' Let DECnet create server process'; note h=2 c=green f=special ' J' c=blue f=simplex ' create UAF record, include'; note h=2 c=green f=special ' ' c=blue f=simplex ' LGICMD and network only access'; note h=2 c=green f=special ' J' c=blue f=simplex ' needs SYSNAM privilege'; note h=2 c=green f=special ' J' c=blue f=simplex ' define object including '; note h=2 c=green f=special ' ' c=blue f=simplex ' username/password and image file'; note h=2 c=green f=special ' J' c=blue f=simplex ' LGICMD checks NCB for valid request ' ; run; footnote h=1 c=blue f=simplex j=r '13'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' Pros'; note h=2 c=green f=special ' J' c=blue f=simplex ' server "pops up" when needed,'; note h=2 c=green f=special ' ' c=blue f=simplex ' goes away when not needed'; note h=2 c=green f=special ' J' c=blue f=simplex ' can create new server when is full'; note h=2 c=green f=special ' J' c=blue f=simplex ' Cons'; note h=2 c=green f=special ' J' c=blue f=simplex ' slightly more complicated to do'; note h=2 c=green f=special ' J' c=blue f=simplex ' first connection may take awhile'; note h=2 c=green f=special ' J' c=blue f=simplex ' initialization code done repeatedly'; run; title h=2.5 c=black j=l ls=3 ' ' 'Non-transparent task-to-task concepts'; title2; footnote h=1 c=blue f=simplex j=r '14'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' $ASSIGN to create a channel to _ NET:'; note h=2 c=green f=special ' J' c=blue f=simplex ' creates a new NETnn device'; note h=2 c=green f=special ' J' c=blue f=simplex ' channel is communication path to DECnet'; note h=2 c=green f=special ' J' c=blue f=simplex " doesn't create a link"; note h=2 c=green f=special ' J' c=blue f=simplex ' can associate a mailbox to channel'; note h=2 c=green f=special ' ' c=blue f=simplex ' for special DECnet messages'; run; footnote h=1 c=blue f=simplex j=r '15'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' $QIO (IO$_ ACCESS) to create a link'; note h=2 c=green f=special ' J' c=blue f=simplex ' $QIO (IO$_ DEACCESS) to break link'; note h=2 c=green f=special ' J' c=blue f=simplex ' send/receive data is the same as transparent'; note h=2 c=green f=special ' J' c=blue f=simplex ' a non-tranparent task CAN communicate,'; note h=2 c=green f=special ' ' c=blue f=simplex ' with a transparent one'; run; title h=2.5 c=black j=l ls=3 ' ' 'Create and open channel to network'; footnote h=1 c=blue f=simplex j=r '16'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' $ASSIGN to "_ NET:" with associated mailbox'; note h=2 c=green f=special ' J' c=blue f=simplex ' network channel is used for control purposes, '; note h=2 c=green f=special ' ' c=blue f=simplex ' not logical links'; note h=2 c=green f=special ' J' c=blue f=simplex ' declare self to be network object'; note h=2 c=green f=special ' J' c=blue f=simplex ' reject connection requests'; run; footnote h=1 c=blue f=simplex j=r '17'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' mailbox receives control messages'; note h=2 c=green f=special ' J' c=blue f=simplex ' connection requests'; note h=2 c=green f=special ' J' c=blue f=simplex ' network shutdown messages'; note h=2 c=green f=special ' J' c=blue f=simplex ' interrupt data'; note h=2 c=green f=special ' J' c=blue f=simplex ' easiest to do with LIB$ASN_ WTH_ MBX'; run; footnote h=1 c=blue f=simplex j=r '18'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' hints:'; note h=2 c=green f=special ' J' c=blue f=simplex " don't forget leading underscore,"; note h=2 c=blue c=blue f=simplex ' some joker may have logical "NET" defined' ; note h=2 c=green f=special ' J' c=blue f=simplex ' may define a logical name for mailbox'; note h=2 c=green f=special ' J' c=blue f=simplex ' other program can send control message' ; note h=2 c=green f=special ' J' c=blue f=simplex ' shutdown without shutting DECnet'; note h=2 c=green f=special ' J' c=blue f=simplex ' do $GETDVI on channel to get name'; note h=2 c=green f=special ' J' c=blue f=simplex ' use $CRELNM to create logical name'; run; title h=2.5 c=black j=l ls=3 ' ' 'Declare network object'; footnote h=1 c=blue f=simplex j=r '19'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' need SYSNAM to declare object number'; note h=2 c=green f=special ' J' c=blue f=simplex ' $QIO (IO$_ ACPCONTROL) on network channel'; note h=2 c=green f=special ' J' c=blue f=simplex ' other operations possible with this function,'; note h=2 c=green f=special ' ' c=blue f=simplex ' this is only one documented'; note h=2 c=blue f=simplex ' (8.6.2.10, VAX/VMS Networking Manual)'; note h=2 c=green f=special ' J' c=blue f=simplex ' P1 is 5 byte buffer, by descriptor'; note h=2 c=green f=special ' J' c=blue f=simplex ' buffer and descriptor must be READ/WRITE'; note h=2 c=green f=special ' J' c=blue f=simplex ' see $NFBDEF macro in SYS$LIBRARY:LIB.MLB'; run; footnote h=1 c=blue f=simplex j=r '20'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' if started via RUN, then translate logical name'; note h=2 c=blue c=blue f=simplex' or hardcode the object number'; note h=2 c=green f=special ' J' c=blue f=simplex ' "pop-up" server can get object number from NCB'; note h=2 c=green f=special ' J' c=blue f=simplex ' translate SYS$NET to get NCB'; note h=2 c=green f=special ' J' c=blue f=simplex ' destination descriptor is last part of NCB'; note h=2 c=green f=special ' J' c=blue f=simplex ' $CANCEL on channel removes object definition'; run; title h=2.5 c=black j=l ls=3 ' ' 'Mailbox operations'; footnote h=1 c=blue f=simplex j=r '21'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' always have a read posted, or'; note h=2 c=green f=special ' ' c=blue f=simplex ' have write-attention AST posted'; note h=2 c=green f=special ' J' c=blue f=simplex ' messages have fixed format '; note h=2 c=green f=special ' ' c=blue f=simplex ' (8.6.1.2 in VAX/VMS Network Manual)'; note h=2 c=green f=special ' J' c=blue f=simplex ' first word in message indicates the type'; note h=2 c=green f=special ' J' c=blue f=simplex ' types are defined in $MSGDEF'; note h=2 c=green f=special ' J' c=blue f=simplex ' MSG$_ CONNECT - connection request'; note h=2 c=green f=special ' J' c=blue f=simplex ' MSG$_ NETSHUT - network shutting down'; note h=2 c=green f=special ' J' c=blue f=simplex ' MSG$_ INTMSG - interrupt data'; note h=2 c=green f=special ' J' c=blue f=simplex ' link failures'; run; footnote h=1 c=blue f=simplex j=r '22'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' second word is unit number of NET device'; note h=2 c=green f=special ' J' c=blue f=simplex ' device name, as counted string'; note h=2 c=green f=special ' J' c=blue f=simplex ' always "NET" for DECnet mailboxes'; note h=2 c=green f=special ' J' c=blue f=simplex ' identifies link device (NETnn)'; note h=2 c=green f=special ' J' c=blue f=simplex ' for interrupt data and link failure messages'; note h=2 c=green f=special ' J' c=blue f=simplex ' why connect routine should get unit number'; run; footnote h=1 c=blue f=simplex j=r '23'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' rest of message is data as counted string'; note h=2 c=green f=special ' J' c=blue f=simplex ' NCB for MSG$_ CONNECT'; note h=2 c=green f=special ' J' c=blue f=simplex ' easiest to have single mailbox associated '; note h=2 c=green f=special ' J' c=blue f=simplex ' with network control channel'; note h=2 c=green f=special ' J' c=blue f=simplex ' and all active links'; run; title h=2.5 c=black j=l ls=3 ' ' 'Connect request'; footnote h=1 c=blue f=simplex j=r '24'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' extract NCB from mailbox message'; note h=2 c=green f=special ' J' c=blue f=simplex ' can extract optional data from NCB'; note h=2 c=green f=special ' J' c=blue f=simplex ' protocol version levels'; note h=2 c=green f=special ' J' c=blue f=simplex ' buffer sizes supported'; note h=2 c=green f=special ' J' c=blue f=simplex ' special privileges, access modes, etc.'; run; footnote h=1 c=blue f=simplex j=r '25'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' reject if insufficient resources'; note h=2 c=green f=special ' J' c=blue f=simplex ' QIO (IO$_ ACCESS .or. IO$M_ ABORT)'; note h=2 c=green f=special ' J' c=blue f=simplex ' on network control channel'; note h=2 c=green f=special ' J' c=blue f=simplex ' NCB is P1 parameter'; run; footnote h=1 c=blue f=simplex j=r '26'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' accept if sufficient resources'; note h=2 c=green f=special ' J' c=blue f=simplex ' assign another channel to "_ NET:"'; note h=2 c=green f=special ' J' c=blue f=simplex ' use network control channel mailbox'; note h=2 c=green f=special ' J' c=blue f=simplex ' initialize link context'; note h=2 c=green f=special ' J' c=blue f=simplex ' zero counters'; note h=2 c=green f=special ' J' c=blue f=simplex ' store protocol version, etc.'; note h=2 c=green f=special ' J' c=blue f=simplex ' flag link as INITIALIZING'; run; footnote h=1 c=blue f=simplex j=r '27'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' get the unit number of the NETnn device'; note h=2 c=green f=special ' J' c=blue f=simplex ' see note about link failure messages'; note h=2 c=green f=special ' J' c=blue f=simplex ' accept link $QIO (IO$_ ACCESS)'; note h=2 c=green f=special ' J' c=blue f=simplex ' P1 is NCB'; note h=2 c=green f=special ' J' c=blue f=simplex ' modify NCB to send optional data back'; note h=2 c=green f=special ' J' c=blue f=simplex ' completion AST posts read on link'; run; title h=2.5 c=black j=l ls=3 ' ' 'Process transactions'; footnote h=1 c=blue f=simplex j=r '28'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' driven by READ completion AST '; note h=2 c=green f=special ' J' c=blue f=simplex ' simplest - $WAKE the process'; note h=2 c=green f=special ' J' c=blue f=simplex ' mainline scans links for completed reads'; note h=2 c=green f=special ' J' c=blue f=simplex ' processes each one request'; note h=2 c=green f=special ' J' c=blue f=simplex ' goes back to $HIBER'; note h=2 c=green f=special ' J' c=blue f=simplex ' variation would be to queue requests'; note h=2 c=green f=special ' J' c=blue f=simplex ' mainline code could do them FIFO'; run; footnote h=1 c=blue f=simplex j=r '29'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' Most sophisticated - be completely AST driven'; note h=2 c=green f=special ' J' c=blue f=simplex ' read completion AST processes request'; note h=2 c=green f=special ' J' c=blue f=simplex ' request would have to be done in AST mode'; note h=2 c=green f=special ' J' c=blue f=simplex ' for example:'; note h=2 c=green f=special ' J' c=blue f=simplex ' access an RMS file with multiple streams'; note h=2 c=green f=special ' ' c=blue f=simplex ' and RAB$M_ ASY (asynchronous I/O) set'; run; footnote h=1 c=blue f=simplex j=r '30'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' response via $QIO to link (IO$_ WRITEVBLK)'; note h=2 c=green f=special ' J' c=blue f=simplex ' WRITE completion AST posts the next read'; note h=2 c=green f=special ' J' c=blue f=simplex ' WRITE and READ ASTs check IOSB status'; note h=2 c=green f=special ' J' c=blue f=simplex ' disconnect link if I/O failed' ; run; title h=2.5 c=black j=l ls=3 ' ' 'Disconnecting links'; footnote h=1 c=blue f=simplex j=r '31'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' by doing $DASSGN on link channel'; note h=2 c=green f=special ' J' c=blue f=simplex ' or $QIO (IO$_ DEACCESS), keeps channel'; note h=2 c=green f=special ' J' c=blue f=simplex ' done for several reasons'; note h=2 c=green f=special ' J' c=blue f=simplex ' receive failure/disconnect mbx message'; note h=2 c=green f=special ' J' c=blue f=simplex ' IOSB status on link I/O indicates failure'; note h=2 c=green f=special ' J' c=blue f=simplex ' can have inactivity timeout on links'; note h=2 c=green f=special ' J' c=blue f=simplex ' links are cheap to create'; note h=2 c=green f=special ' J' c=blue f=simplex ' limited number of links possible'; note h=2 c=green f=special ' J' c=blue f=simplex ' remote process just creates new link'; run; title h=2.5 c=black j=l ls=3 ' ' 'Link context'; footnote h=1 c=blue f=simplex j=r '32'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex " pass pointer to context data as "; note h=2 c=green f=special ' ' c=blue f=simplex " AST parameter to completion AST's"; note h=2 c=green f=special ' J' c=blue f=simplex ' possible context variables'; note h=2 c=green f=special ' J' c=blue f=simplex ' channel number for link'; note h=2 c=green f=special ' J' c=blue f=simplex ' unit number of link NETnn device'; note h=2 c=green f=special ' J' c=blue f=simplex ' I/O status block and buffer'; note h=2 c=green f=special ' J' c=blue f=simplex ' link state ( ACTIVE, PENDING, ... )'; note h=2 c=green f=special ' J' c=blue f=simplex ' protocol version being used'; note h=2 c=green f=special ' J' c=blue f=simplex ' link counters'; note h=2 c=green f=special ' J' c=blue f=simplex ' RAB to database file'; run; title h=2.5 c=black j=l ls=3 ' ' 'Debugging your server'; footnote h=1 c=blue f=simplex j=r '33'; proc gslide ; note h=2 c=green f=special ' J' c=blue f=simplex ' have the proper privileges (at least SYSNAM)'; note h=2 c=green f=special ' J' c=blue f=simplex ' two terminal method'; note h=2 c=green f=special ' J' c=blue f=simplex ' RUN the server from one terminal'; note h=2 c=green f=special ' J' c=blue f=simplex ' RUN remote program from another terminal'; note h=2 c=green f=special ' J' c=blue f=simplex ' single terminal method'; note h=2 c=green f=special ' J' c=blue f=simplex ' RUN the server from the terminal'; note h=2 c=green f=special ' J' c=blue f=simplex ' do SPAWN from the debugger'; note h=2 c=green f=special ' J' c=blue f=simplex ' RUN remote program from the subprocess'; note h=2 c=green f=special ' J' c=blue f=simplex ' ATTACH between the two'; run;