GKN@SDSC.BITNET (Gerard K. Newman) (07/26/86)
From: dstevens(David L Stevens)%sitvxb.BITNET@WISCVM.ARPA
Subject: Help needed accessing LAT data structures.
Date: Wed, 23 Jul 86 15:54:43 EDT
... Now once I connect to the VAX I need a way to get that
information. I know LATCP will show me my PRO's service name if
I do a SHOW SERVER command. But I need a way for a user program
to get at that information. Is there a system service call that
I missed, or a utility I don't know about. Even the VMS data-
structure that contains the information would be appreciated at
this point.
As far as I know there is no system service to return this information.
However, I do have some code which will return the server name (and it
used to return the line number and session number in older versions of
the DECserver-100 code, but that broke just recently). Basically you
have to pop into kernel mode, hunt down the UCB for the LAT terminal
in question, chase down this thing called a CSB (circuit state block)
and dig information out of it.
A subroutine which does this is at the end of this message.
I figured all of this out by digging around in the fiche (V4.2). I
notice that the LTDRIVER (or any of the rest of the things involved with
LAT, for that matter) listings are no longer in the V4.4 fiche. I
wonder if this is on purpose or if it is an oversight...
gkn
---------------------------------------
Arpa: GKN%SDSC.BITNET@WISCVM.WISC.EDU
USPS: Gerard K. Newman
San Diego Supercomputer Center
P.O. Box 85608
San Diego, CA 92138
AT&T: (619) 534-5076 <-- new phone number
--------------------------------------------------------------------------------
[please note that this is only part of a much longer program, and I have
only included the pieces which are relevant to LAT]
$UCBDEF ;Define UCB offsets
$TTYUCBDEF ;Define terminal-specific UCB offsets
; Constants that are likely to change in a future release of VMS that are not
; defined in SYS.STB or in a macro anywhere. These values come from fiche
; 687, panels C14 and C15. The fields in the remote virtual circuit ID are
; from observation of DECserver-100s.
CSB_B_SERVER = ^X1C ;Offset in the CSB to the server name le
ngth
CSB_T_SERVER = ^X1D ;Offset in the CSB to the server name st
ring
CSB_Z_DST = ^X2E ;Offset in the CSB to the server Etherne
t address
CSB_B_REMIDN = ^X5E ;Offset to the CSB remote ID
UCB$L_LT_CSB = ^X134 ;Offset in the UCB to the CSB address
UCB$B_LT_REMID = ^X140 ;Offset in the UCB to the remote virtual
circuit ID
.Page
.Subtitle LOOKUP_LAT - Look up the location of a LAT terminal
;+
;
; ----- LOOKUP_LAT: Look up the location of a LAT terminal
;
;
; This routine will go find out the server name and remote line # of a
; terminal connected via LAT. If the server name in the CSB is null,
; then the Ethernet address will be used in its place.
;
; Inputs:
;
; R9 - Current PIB address
;
; Outputs:
;
; PIB$L_LOCADDR & PIB$L_LOCLENG filled in in the current PIB.
;
;-
LOOKUP_LAT: ;Here to look up a LAT terminal
CLRL SERVER_LENG ;No server name yet
CLRQ PIB$L_LOCLENG(R9) ;And therefore no location
MOVL R9,PIB ;Copy the current PIB address
$CMKRNL_S B^50$ ;First thing to do is to find the UCB
BLBC R0,40$ ;Nope
; Now format a line which contains the server name and line ID (or the
; Ethernet address and line ID for servers without names)
MOVAB LT_FAO,R0 ;Presume that we have a server name
MOVAL SERVER_ARGS,R1 ;Address the argument list
MOVL SERVER_LENG,(R1)+ ;Copy the length of the server name
BEQL 10$ ;If EQL the server doesn't have a name
MOVAB SERVER_BUFF,(R1)+ ;Copy the address of the server name
BRB 30$ ;Join common code
; The server doesn't have a name. Use the Ethernet address instead (really
; should come up with something better...)
10$: MOVAB ETHER_FAO,R0 ;Sigh. Use the Ethernet address
MOVAL -(R1),R1 ;Back up the arg list pointer
MOVL #6,R2 ;Loop count for the Ethernet address
MOVAB SERVER_ETHER,R3 ;Address the server's Ethernet address
20$: MOVZBL (R3)+,(R1)+ ;Copy the Ethernet address
SOBGTR R2,20$ ;One byte at a time
; Common code to compute the remote server port number and session number
30$: EDIV #4,SERVER_REMID,(R1),4(R1) ;Compute the port and session number
INCL (R1)+ ;The first port is numbered 1
TSTL (R1) ;However, session 4 comes out
BNEQ 35$ ; as remainder 0
MOVL #4,(R1) ;So we'll make it session 4 if need be.
; Format the location
35$: MOVL #24,PIB$L_LOCLENG(R9) ;Reset the output descriptor length
MOVAB LOC_BUFF,PIB$L_LOCADDR(R9) ;Use this for an output buffer
$FAOL_S CTRSTR=(R0),- ;Format the location string
OUTBUF=PIB$L_LOCLENG(R9),- ;Output buffer is here
OUTLEN=PIB$L_LOCLENG(R9),- ;Return the length here
PRMLST=SERVER_ARGS ;Here are the arguments
40$: RSB ;Done !
; Here in kernel mode to find the suspect LAT UCB (and the CSB)
50$: .Word ^M<R2,R3,R4,R5,R6,R7,R8,R9,R10,R11> ;Here to find the LT UCB
MOVL PIB,R1 ;Address our PIB
MOVAB PIB$L_TERMLENG(R1),R1 ;Point to the device name descriptor
BSBW FIND_UCB ;Go hunt down the UCB
BLBC R0,60$ ;Oh well ... the terminal disconnected o
ut from underneath us
; Ensure that we use the LT UCB rather than the VT UCB just in case we have
; a disconnectable LAT terminal.
MOVL UCB$L_TL_PHYUCB(R1),R1 ;Chain to the "real" UCB
BGEQ 60$ ;Eh?
; Obtain the circuit state block (CSB) address, the server name and the
; remote line ID
MOVL UCB$L_LT_CSB(R1),R0 ;Get the CSB address
BEQL 60$ ;Nope (??)
; Note: My present understanding of the remote ID bit is somewhat limited.
; From cursory examination of a running DECserver-100, it appears
; that it allocates 4 IDs per port, assigning RVCIs 1-4 to port 1,
; 5-8 to port 2, and so on. I have no idea what a DECSA terminal
; server uses as it's RVCIs.
MOVZBL UCB$B_LT_REMID(R1),SERVER_REMID ;Get the remote port number
MOVZBL CSB_B_SERVER(R0),SERVER_LENG ;Copy the server name length
MOVQ CSB_T_SERVER(R0),SERVER_BUFF ;Copy the
MOVQ CSB_T_SERVER+8(R0),SERVER_BUFF+8 ; server name
MOVL CSB_Z_DST(R0),SERVER_ETHER ;Copy the server's
MOVW CSB_Z_DST+4(R0),SERVER_ETHER+4 ; Ethernet address
MOVL #SS$_NORMAL,R0 ;Success !
60$: RET ;Back to user mode, status in R0