From:	SMTP%"turion@research.ptt.nl" 21-MAR-1994 15:29:49.26
To:	EVERHART
CC:	
Subj:	part 2 status tools

X-Newsgroups: comp.os.vms
From: turion_s@dnlts0research.ptt.nl. (Paul Turion)
Subject: part 2 status tools
Message-ID: <1994Mar21.143935.794@news.research.ptt.nl>
Sender: turion_s@research.ptt.nl (Paul Turion)
Nntp-Posting-Host: dnlts0.research.ptt.nl
Reply-To: turion@research.ptt.nl
Organization: PTT Research
X-Newsreader: mxrn 6.18-4
Date: Mon, 21 Mar 1994 14:39:35 GMT
Lines: 348
To: Info-VAX@CRVAX.SRI.COM
X-Gateway-Source-Info: USENET


-+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+
X;       Data for system service calls
X;
Xiosblk:                                         ; IO status block
Xcond_val:       .word   0                       ; Additional return value st
Vatus
Xtrans_cnt:      .word   0                       ; Number of bytes transfered
Xdev_spec:       .long   0                       ; Process id of daemon
X;
Xbuf_quot:       .long   128                     ; Buffer quota for mailbox
Xdev_chan:       .word   0                       ; Device channel
Xmbx_chan:       .word   0                       ; Mailbox channel
X;
Xbuffer_len:
Xbuffer_descr:   .long   0                       ; Number of bytes transferre
Vd
Xbuffer_adr:     .address buffer                 ; Descriptor for local look
X;
X;       Data buffers
X;
X                .psect  dae_buffers, noexe, pic, noshr, lcl, wrt, rd, rel, c
Von
X;
Xstat_rec::
Xstat_num:       .blkb   1
Xstat_tot_int:   .blkw   1
Xstat_tot_bat:   .blkw   1
Xstat_tot_net:   .blkw   1
Xstat_tot_prc:   .blkw   1
Xstat_buf:       .blkb   STAT_LEN*DAE_MAX_NODES  ; Reserve info for status
X;
Xbuffer:         .blkb   INFO_SIZE               ; Total info that could be s
Vent
X;
Xdata_rec::
Xdata_num:       .blkl   1                       ; We have no data to start w
Vith
Xdata_ptr:       .blkl   DAE_MAX_REC             ; Total number of pointers i
Vnto buffer
X;
Xdata_buf:       .blkb   MAX_BUFFER              ; Where to put all info
X;
X;
X;
X                .psect  dae_code, con, exe, lcl, shr, nowrt, pic, rel
X;
X;***************************************************************************
V****
X;* *
X;* DAE_GETINFO *
X;*      The purpose of this routine is to talk to each of the nodes specifie
Vd *
X;* and return the get the information from each, storing it all in sorted *
X;* order.  The information is returned to the caller through the other two *
X;* procedures; DAE_RETURNINFO, DAE_RETURNSTATS *
X;* *
X;* Arguments:  NODES - Address of buffer with following format: *
X;* *
X;*                         Byte     Counted String   - *
X;*
X;*             FUNC - function code to be executed by daemon, byte, by value
V *
X;*                  - Bit 0: 1 all processes, 0 interactive only *
X;*                  - Bit 1: Unused *
X;*                  - Bit 2: Unused *
X;*                  - Bit 3: 1 full format, 0 brief format *
X;*                  - Bit 4: 1 node included, 0 node ommitted *
X;*                  - Bit 5: 1 get users on list, 0 ingnore users *
X;*                  - Bit 6: 1 status only, 0 both status and info *
X;*                  - Bit 7: 1 use channel, 0 use buffer *
X;* *
X;*             USER, address of a list of user names to search for. *
X;* *
X;* Returns:    False if operation failed, True if connection was made *
X;* *
X;***************************************************************************
V****
X;
X                .entry  dae_getinfo, `094m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>
X;
X                clrl    signal_bool             ; Clear our boolean signalin
Vgvariable
X;
X                tstb    @8(ap)                  ; Do we have any nodes?
X                bneq    cont_getinfo            ; Keep going if not 0
X                brw     end_getinfo             ; We have no nodes to get, e
Vrror
X;
X;       Set up the sorting stuff here
X;
Xcont_getinfo:   movb    4(ap), func_code        ; Store the function code
X                bbcc    #DAE_V_SILENT, func_code, get_nxt_arg ; Do we want e
Vrrors signaled
X                mnegl   #1, signal_bool         ; Flag that we don't want er
Vrors signaled
X;
Xget_nxt_arg:    movl    8(ap), r11              ; Save address of nodes
X                movl    12(ap), r10             ; Save address of usernames
X                beql    skip_username           ; If zero was moved into r10
V,skip the username
X;
X                movc5   (r10), @4(r10), #32, -
X                        #DAE_MAX_USER_STR, users ; Save the actual user matc
Vhing string
X                movw    (r10), users_len        ; Save the length to get pas
Vsed over the net
X                movzwl  (r10), users_descr      ; Save the length for the de
Vscriptor
X                addl3   #3, users_len, trans_length ; Save the actual number
V of bytes to transfer
X;
X                moval   stat_buf, r8            ; Store our status buffer
X                moval   data_buf, r7            ; Store our main data buffer
X                clrl    r6                      ; Count of total bytes
X;
Xskip_username:  $getsyiw_s -                    ; Get system information
X                        itmlst = syi_list       ; Specifically, get the curr
Vent node we are on
X                movc5   curr_node_len, curr_node, #32, #6, curr_node
X;
X                $setprv_s -
X                        enbflg = #1, -          ; Enable the specified privs
X                        prvadr = prv_mask       ; What privs to enable
X                cmpl    #SS$_NORMAL, r0         ; Could we get the needed pr
Vivs
X                bneq    skip_priv               ; If we don't set the local
V look flag
X;
X                movb    #1, local_look          ; Do local looks for the cur
Vrent node
X;
Xskip_priv:      bbc     #DAE_V_FULL, func_code, setup_sort
X;
X                movw    #FULL_USER_OFFSET, user_offset ; Change the offset v
Values if we want the full format
X                movw    #FULL_NODE_OFFSET, node_offset ; - for the sort oper
Vations
X;
Xsetup_sort:     movzbl  (r11)+, r9              ; Save the number of nodes
X;
Xloop:           movb    (r11)+, node_len        ; Save current node length
X                movc3   #DAE_MAX_NODE_LEN, (r11), node ; Save the node, left
V justified
X                movl    r1, r11                 ; Move past the current node
X;
X                cmpc5   node_len, node, #32, curr_node_len, curr_node
X                bneq    call_daemon             ; If they aren't equal, call
V the daemon
X;
X                tstb    local_look              ; Do we not have the priv to
V get info locally
X                beql    call_daemon             ; If byte is zero, we don't
V have priv
X;
X                jsb     get_local               ; Get the information locall
Vy, if we have the priv
X                brb     loop_ctrl               ; Skip calling the daemon
X;
Xcall_daemon:    jsb     get_foreign             ; Get the information from t
Vhe daemon
X;
Xloop_ctrl:      sobgtr  r9, loop                ; Keep going if more nodes
X;
X                divl3   #DAE_LRL, r6, data_num  ; Find number of records
X;
X                movl    data_num, r2            ; Save number of records to
V build the pointers
X                moval   data_buf, r0            ; Where the records start
X                moval   data_ptr, r1            ; Where to put the pointers
X;
X;****************************  %%%%% Join here with part 2 %%%%%%%%%%%%%%%%%
V%
X;****************************  %%%%% Join here with part 1 %%%%%%%%%%%%%%%%%
V%
X;
Xbuild_ptr:      movl    r0, (r1)+               ; Move address into the list
X                addl2   #DAE_LRL, r0            ; Move to the next address
X                sobgtr  r2, build_ptr           ; Loop control
X;
X                subl3   #1, data_num, -(sp)
X                pushl   #0
X                calls   #2, quick               ; Quick sort our data
X;
X                moval   stat_buf, r0            ; Move address in for calcul
Vations
X                subl3   r0, r8, r1              ; Subtract beginning from en
Vd
X                divl3   #STAT_LEN, r1, r2       ; Find number of statistics
X                movb    r2, stat_num
X;
Xend_getinfo:    movl    #1, r0                  ; Return whether we talked t
Voany nodes or not
X                ret                             ; Dae_getinfo
X;
X;
X;
X;***************************************************************************
V****
X;* Get_local *
X;*      Get the information locally *
X;***************************************************************************
V****
X;
Xget_local:      clrl    buffer_len              ; We have no data yet
X                bbs     #DAE_V_STATUS, func_code, get_local_stat  ; Just get
V the local status if that bit is set
X;
X                movzbl  func_code, r0
X                bicb2   #DAE_M_CHANNEL, r0      ; Make sure we don't get a c
Vhannel
X                bisb2   #DAE_M_NODE, r0         ; We want the node included
V in the name
X                pushal  users_descr             ; Pass the user name to sear
Vch for
X                pushl   r0                      ; Pass the function to perfo
Vrm
X                pushal  buffer_descr            ; Pass where to put the info
Vrmation
X                calls   #3, g`094what_look         ; Call the look routine t
Vo get information
X                jsb     storedata               ; Store the data returned
X;
Xget_local_stat: pushl   #0                      ; We want the infor returned
V in the buffer passed
X                pushl   r8                      ; Here is where to put the s
Vtats
X                calls   #2, g`094what_status       ; Get the stats
X                jsb     sum_stats               ; Sum up the stats
X                addl2   #STAT_LEN, r8           ; Move to next record
X;
X                rsb                             ; End of Get_local
X;
X;
X;
X;***************************************************************************
V****
X;* Get_foreign *
X;*      This procedure establishes a connection to a node and gets all the *
X;* information.  The node is passed by a counted ascii string. *
X;***************************************************************************
V****
X;
Xget_foreign:    clrl    buffer_len              ; Clear the buffer length
X                movc3   node_len, node, ncb     ; Move the node name into th
VeNCB
X                movc3   #len_net_obj, net_obj, (r3)  ; Move the rest of the
V string
X                addl3   node_len, #len_net_obj, ncb_descr ; Add the node len
Vgth to the descriptor
X;
X                pushaw  mbx_chan                ; Address to receive mailbox
V channel number
X                pushaw  dev_chan                ; Address to receive device
V channel number
X                pushal  buf_quot                ; Mailbox quota
X                pushal  buf_quot                ; Largest size mailbox messa
Vge allowed
X                pushaq  net_device              ; Address of device name des
Vcriptor
X                calls   #5, g`094lib$asn_wth_mbx   ; Assign channel and asso
Vciate mailbox
X                blbs    r0, continue            ; If LBC then error
X                brw     failure                 ; Exit with an error status
X;
Xcontinue:       moval   ncb_descr, r0           ; Save address of the networ
Vkfunction block
X                $qiow_s -                       ; Issue connect initiate req
Vuest
X                        chan = dev_chan, -      ; Use assigned channel
X                        func = #IO$_ACCESS, -   ; Request a logical link
X                        iosb = iosblk, -        ; Address of IO status block
X                        p2 = r0                 ; Address of NCB descriptor
X                blbs    r0, 10$                 ; If LBC then error
X                brw     failure                 ; Exit with an error status
X;
X10$:            movzwl  iosblk, r0              ; Get IO completion status
X                blbs    r0, send_func           ; If LBC then error
X                brw     failure                 ; Exit with an error status
X;
Xsend_func:      $qiow_s -                       ; Issue a write request to t
Vhe mailbox
X                        chan = dev_chan, -      ; Use assigned channel
X                        func = #IO$_WRITEVBLK,- ; Send a message to the daem
Von
X                        iosb = iosblk, -        ; Address of IO status block
X                        p1 = func_code,-        ; Where the message to send
V is
X                        p2 = trans_length       ; Send the function code and
V the data
X                blbs    r0, 20$                 ; If LBC then error
X                brw     failure                 ; Exit with an error status
X;
X20$:            movzwl  iosblk, r0              ; Get IO completion status
X                blbs    r0, read_info           ; If LBC then error
X                brw     failure                 ; Exit with an error status
X;
Xread_info:      bbs     #DAE_V_STATUS, func_code, get_status  ; Just get the
V local status if that bit is set
X;
X                $qiow_s -                       ; Issue a read request to th
Vemailbox
X                        chan = dev_chan, -      ; Use assigned channel
X                        func = #IO$_READVBLK, - ; Read a info from the daemo
Vn
X                        iosb = iosblk, -        ; Address of IO status block
X                        p1 = buffer, -          ; Buffer to hold all the inf
Vormation
X                        p2 = #INFO_SIZE         ; All three hundred DAE_LRL
V byte character strings
X                blbs    r0, 30$                 ; If LBC then error
X                brw     failure                 ; Exit with an error status
X;
X30$:            movzwl  iosblk, r0              ; Get IO completion status
X                blbs    r0, move_transcnt       ; If LBC then error
X                brw     failure                 ; Exit with an error status
X;
Xmove_transcnt:  movzwl  trans_cnt, buffer_len   ; Save the number of bytes t
Vransferred
X                jsb     storedata               ; We receive information, st
Vore it
X;
Xget_status:     $qiow_s -                       ; Issue a read request to th
Vemailbox
X                        chan = dev_chan, -      ; Use assigned channel
X                        func = #IO$_READVBLK, - ; Read a message from the da
Vemon
X                        iosb = iosblk, -        ; Address of IO status block
X                        p1 = (r8),-             ; Where we should put the me
Vssage
X                        p2 = #STAT_LEN          ; Receive all the statistics
X                blbc    r0, failure             ; If LBC then error
X                movzwl  iosblk, r0              ; Get IO completion status
X                blbc    r0, failure             ; If LBC then error
X;
X                jsb     sum_stats               ; Sum up the stats
X                addl2   #STAT_LEN, r8           ; Move to next record
X                $dassgn_s -                     ; Issue the deassign request
X                        chan = dev_chan
+-+-+-+-+-+-+-+-  END  OF PART 2 +-+-+-+-+-+-+-+-
-- 
 ------- --------------------  			Paul Turion 
| p t t |  r e s e a r c h   |			The Netherlands
|      _|                    | 			e-mail address
|    _|_|   .  .  .  .  .    |			P.Turion@research.ptt.nl
|___|_|      
My interest is in the future because
I am going to spend the rest of my life there.

