From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 26-MAY-1993 10:13:00.67
To:	EVERHART
CC:	
Subj:	RE: Accounting info from certain terminal server ports?

Date: Wed, 26 May 1993 08:50:37 EDT
From: Alan Simon <simon@shrsys.hslc.org>
To: dougcc@brt.deakin.edu.au
CC: INFO-VAX@KL.SRI.COM
Message-ID: <0096D12B.4A849440.2756@shrsys.hslc.org>
Subject: RE: Accounting info from certain terminal server ports?

> From:	MX%"dougcc@brt.deakin.edu.au" 26-MAY-1993 08:21:56.47
> Subj:	Accounting info from certain terminal server ports?

> I want to get accounting info for users who login to our VMScluster from a
> certain set of terminal server ports.  That is, I want to be able to produce
> summary reports of the connect time for each user is this group.  I've
> scoured the manuals, including the LATCP manual, but I can't see anyway to
> distiguish this group of users from any others.  Creating dedicated LAT
> ports looked promising, but then I found I couldn't make such ports
> interactive.
> 
> Does anybody have any other ideas?
> 
> --
> Douglas Miller <douglas.miller@brt.deakin.edu.au>
> Computing and Communications Services, Deakin University
> Post:     BURWOOD 3125, AUSTRALIA             Phone: +61 3 805 3262
> Location: Building A, 221 Burwood Highway     Fax:   +61 3 808 9497
> 
> 
Doug:

Here's the response I got when I posed this question a few months ago:

From:	MX%"marshall@nebula.decnet.lockheed.com" 18-FEB-1993 09:46:43.04
To:	SIMON
CC:	
Subj:	Re: Accounting Question

Return-Path: <marshall@nebula.decnet.lockheed.com>
Received: from eagle.is.lmsc.lockheed.com by SHRSYS.HSLC.ORG (MX V3.1) with
          SMTP; Thu, 18 Feb 1993 09:42:16 EST
Received: from NEBULA.DECnet MAIL11D_V3 by eagle.is.lmsc.lockheed.com
          (5.57/Ultrix3.0-C) id AA13061; Thu, 18 Feb 93 06:42:16 -0800
Date: Thu, 18 Feb 93 06:42:15 -0800
Message-ID: <9302181442.AA13061@eagle.is.lmsc.lockheed.com>
From: marshall@nebula.decnet.lockheed.com (Bob Marshall Org 6791 Bldg 561
      x65737)
To: "simon@shrsys.hslc.org"@eagle.decnet.lockheed.com
Subject: Re: Accounting Question

In article <0096844F.16373CC0.10964@shrsys.hslc.org>, Alan Simon <simon@shrsys.hslc.org> writes:
>I am interested in tracking dialup usage of two different groups of modems.  In
>order to do this, I need to identify login sessions by port.  Does
>ACCOUNTNG.DAT include TT_ACCPORNAM?  If so, has anyone written any code to
>extract this information?

Accounting does not do this automatically. However, it can made to do so.
Here is a macro that will do it. Just install this image with CMKRNL
privilege, and run it from SYS$SYLOGIN. It will stuff the server name into
the "Remote Node Name" field, and the port name into the "Remote Node ID"
field. The routine was written by Kevin Homan of Science Applications, Inc.

(Note : As with any such priv'd image that you are going to run from
SYLOGIN, *USE AT YOUR OWN RISK*. I've taken a close look at the code and
I didn't see anything "funny" in there; and I've used it at my site for
some time now with no problems).
-----------------------------------------------------------------------
	.Title log_port
	.ident	/V01.00/
;+
;
; ----	LOG_PORT:	Process' terminal server and port logging
;
;
; Facility:
;
;	VAX/VMS system management
;
; Environment:
;
;	VAX/VMS V5.2 or later, kernel mode
;
;	This routine will extract the current process' terminal server
;	name and port id, if it is a lat process.   This information will
;	then be stored in the remote node name and remote node id fields of
;	the process' P1 space.  These fields are normally only used by
;	RTTDRIVER and REMACP for remote process'.  These fields are
;	however written by the system accounting facility and will provide
;	a convenient means for storing and tracking this information.
;
; Version:     	V01.000
; Date:		07-FEB-1990
;
; Kevin	F. Homan
; Science Applications, Inc.
; 800 Oak Ridge Turnpike
; Oak Ridge, TN  37830
; (615) 482-9031
;
;
; Modifications:
;
;
;-
 	.page
        .library "SYS$LIBRARY:LIB"                      ;Get special macros from here
        .link    "sys$system:sys.stb"/selective_Search  ;Ease the link process a bit
	.Psect	DATA	noexe,rd,wrt,nopic,noshr,page
dvi_list:	.word	30
		.word	DVI$_TT_ACCPORNAM
		.address port_buffer
		.address port_descr
		.long	0
ttname_desc:	.ascid /TT/
ttchan:	.blkw	1
arglst:		.LONG	2
		.address port_descr
		.address port_buffer
port_descr:	.long 64
		.address	port_buffer
port_buffer:	.blkb	64

	.Psect		CODE	EXE,RD,NOWRT,NOPIC,SHR,PAGE
	.Entry	Start,^m<>

	$Assign_s -
		Devnam	= ttname_desc, -
		Chan	= ttchan	; assign tt
 	Blbc	r0,10$			; can't, die
	$Getdvi_s Chan	= ttchan,-	; Get the real
		Itmlst	= Dvi_list	; device name
 	blbs	r0,20$			; did all of it work?
10$:	ret				; by
20$:	cmpb	#0,port_buffer		; check port
	beql	50$			; null?
	$cmkrnl_s -			; no, continue
		arglst = arglst,-	; arglst
		routin = move_info	; get info in kernel mode
	blbs	r0,40$                  ; err?
	Ret
40$:	$dassgn_s chan=ttchan		; free chan
50$:	$exit_s
 	.page
	.entry	move_info,^m<r2,r3,r4,r5>
	nop
	movl	4(ap),r3		; get port length
	movl	(r3),r2			; length of server/port name
	movl	8(ap),r3		; address of server name
	locc  	#^A"/",r2,(r3)		; locate position of server
	subl	r0,r2			; calculate actual server length
 	pushr	#^m<r0,r2,r3>		; save server length
	cmpb   	#6,r2			; have room for 6 characters
	bgeq	5$			; is there room
	movb	#6,r2 	       	       	; no, just give first 6
5$:	movb	r2,ctl$t_nodename      	; store length of server
	movc5  	r2,(r3),#^A/ /,#6,ctl$t_nodename+1; store the server name
                                        ; in remote node field
 	popr	#^m<r0,r2,r3>		; restore port length
	addl	r2,r3			; offset to the portname
	decl	r0			; exclude delimiter
	incl	r3			; ditto
	cmpb   	#16,r0			; have room for 16 characters
	bgeq   	10$			; is there room
	movb	#16,r0			; no, just give first 16
10$:	movb   	r0,ctl$t_remoteid	; store length of port name
	movc5  	r0,(r3),#^A/ /,#16,ctl$t_remoteid+1; store port name
                                        ; in remote id field
	movl	#ss$_normal,r0
	ret
	.end	start

=============================================================================
Bob Marshall                     \\     "Women aren't as smart as they
Lockheed Missiles & Space Co.     \\     think they are; they think we
Sunnyvale, CA                      \\    men know a lot more than we
marshall@force.ssd.lmsc.lockheed.com\\   really do."
"I tell the truth 'cept when I lie"  \\     - Tim the Toolman
=============================================================================

-------------------------------------------------------------------------------
Alan Simon                                      simon@hslc.org  
Associate Director                              simon@shrsys.hslc.org
Health Sciences Libraries Consortium            VOICE: (215) 222-1532  
3600 Market Street, Suite 550                     FAX: (215) 222-0416
Philadelphia, PA  19104
-------------------------------------------------------------------------------

