.TITLE TTCONN .IDENT \ISUQUOTA 2.9\ ; THIS ROUTINE MAINTAINS THE TERMINAL CONNECT TIME USAGE FILE. .PAGE .SBTTL SYMBOLS & MACROS ; ARG_CNT= 0 ARG_PRCS= 4 MAX_CSW= 256 MAX_CON= 1 MAX_RTT= 128 MAX_DZS= 8*15 ; SYSTEM MACROS $RMSDEF $SECDEF ; USER MACROS BFBDEF PRCSDEF QUOMSGDEF TTCONNDEF TTINFDEF .PAGE .SBTTL LOCAL READ-ONLY DATA .PSECT LCLRODATA,RD,NOWRT,NOEXE,LONG STRG_TYPE_TT: .ASCII \1\ ; CSW #1 .ASCII \2\ ; CSW #2 .ASCII \3\ ; CSW #3 N_TYPE_CSW= .-STRG_TYPE_TT .ASCII \O\ ; OPA0 .ASCII \R\ ; REMOTE TERMINAL .ASCII \T\ ; DZ TERMINAL N_TYPE_TT= .-STRG_TYPE_TT TAB_NUM_TYPE: .LONG MAX_CSW ; MAX CSW #1 PORTS .LONG MAX_CSW ; MAX CSW #2 PORTS .LONG MAX_CSW ; MAX CSW #3 PORTS .LONG MAX_CON ; ONE CONSOLE (OPA0) .LONG MAX_RTT ; MAX REMOTE TERMINALS .LONG MAX_DZS ; MAX DZ PORTS N_TOTAL_TT= + MAX_CON+MAX_RTT+MAX_DZS DSC_CSWTT: .LONG 3 .LONG TTDESC+1 TAB_UPCASE: UPCASEDEF TAB_ASCBIN: ASCBINDEF .PAGE .SBTTL RMS DATA .PSECT RMSDATA,RD,WRT,NOEXE,LONG FAB_TTINFO: $FAB FNM=,- ALQ=N_TOTAL_TT*TT_K_LENGTH/512+1,- FOP=UFO FAB_TTDESC: $FAB FNM=,- FAC=,- RFM=FIX,- MRS=TTINF_K_LENGTH,- BKS=1,- SHR=,- ORG=IDX RAB_TTDESC: $RAB FAB=FAB_TTDESC,- UBF=TTDESC,- USZ=TTINF_K_LENGTH,- RAC=SEQ .PAGE .SBTTL MSG VECTORS .PSECT MSGVECS,RD,WRT,NOEXE,LONG MSG_BADTTNAM: .LONG 5 .LONG ISUQUO_BADTTNAM .LONG 3 .LONG 0 .BLKL 2 .PAGE .SBTTL LOCAL READ-WRITE DATA .PSECT LCLRWDATA,RD,WRT,NOEXE,LONG INADR_TTINFO: .LONG INADR_TTINFO,INADR_TTINFO ADR_TTINFO: .BLKQ 1 ATAB_TTINFO: .BLKL N_TYPE_TT IDX_TYPE: .BLKL 1 SELECT_OP: .BLKB 1 DELTA_TTRESET: .BLKQ 1 TTNAME: .BLKB 4 TTDESC: .BLKB TTINF_K_LENGTH WORK: .BLKL 4 .PAGE .SBTTL TTCONNINI .PSECT CODE,RD,NOWRT,EXE,LONG ; CREATE/INITIALIZE THE TT CONNECT TIME USAGE FILE (ISUTTINFO). ; IF A TERMINAL DESCRIPTION FILE (ISUTTDESC) EXISTS THEN THE FLAG ENTRY ; IN ISUTTINFO IS SET TO MATCH THE TERMINAL CATEGORY (PUBLIC, PRIVATE, ; OR DIAL-UP). TERMINALS NOT SPECIFIED IN ISUTTDESC DEFAULT TO PUBLIC. .ENTRY TTCONNINI,^M EMUL #10000000,#TT_K_RINTVL,- ; INIT RESET INTERVAL #0,DELTA_TTRESET $CREATE FAB=FAB_TTINFO ; CREATE TTINFO FILE BLBS R0,10$ JMP RET_TTCONNINI ; ERROR RETURN 10$: $CRMPSC_S INADR=INADR_TTINFO,- ; MAP IT INTO MEMORY RETADR=ADR_TTINFO,- FLAGS=#SEC$M_EXPREG!SEC$M_WRT,- CHAN=FAB_TTINFO+FAB$L_STV BLBS R0,20$ JMP RET_TTCONNINI ; ERROR RETURN 20$: MOVL ADR_TTINFO,R8 ; ADR START TTINFO FILE CLRL R6 ; INITYPE LOOP INDEX LOOP_INITYPE: MOVL R8,ATAB_TTINFO[R6] ; BASE ADR TTINFO THIS TYPE CLRL R7 ; INITT LOOP INDEX LOOP_INITT: MOVL #TT_M_PUBLIC,TT_FLAGS(R8) ; PUBLIC IS DEFAULT CATEGORY CLRL TT_UIC(R8) ; NO PREVIOUS USER ADDL #TT_K_LENGTH,R8 ; NEXT PORT CONT_INITT: AOBLSS TAB_NUM_TYPE[R6],R7,LOOP_INITT ; DO ALL PORTS THIS TYPE CONT_INITYPE: AOBLSS #N_TYPE_TT,R6,LOOP_INITYPE ; DO ALL TT TYPES $OPEN FAB=FAB_TTDESC ; OPEN TT DESCRIPTION FILE BLBS R0,10$ MOVL #1,R0 ; NO DESCRIPTION FILE JMP RET_TTCONNINI 10$: $CONNECT RAB=RAB_TTDESC BLBS R0,LOOP_TTDESC JMP RET_TTCONNINI ; ERROR RETURN MOVAB TTDESC,R8 ; ADR BUFR LOOP_TTDESC: $GET RAB=RAB_TTDESC ; GET TT DESCRIPTION BLBC R0,INI_CLOSETTDESC JSB PROC_INI_MAP ; MAP IT INTO TTINFO TSTL R9 ; SUCCESS? BNEQ 10$ ; YES MOVAL MSG_BADTTNAM+QMSG_FAO_ARG+4,R6 ; DISPLAY ERROR MOVAL #^XFFFFFFFF,(R6)+ ; FAKE CSW MOVB #4,WORK ; ASCIC TTNAME MOVC3 #4,TTINF_PORT(R8),WORK+1 MOVAB WORK,(R6)+ $PUTMSG_S MSGVEC=MSG_BADTTNAM ; DISPLAY MSG BRW CONT_TTDESC 10$: MOVTC #1,TTINF_CATEGORY(R8),#^A\ \,- ; UPCASE TT CATEGORY CODE TAB_UPCASE,#1,WORK CMPB WORK,#^A\U\ ; PUBLIC TT? BNEQ 13$ ; NO MOVL #TT_M_PUBLIC,TT_FLAGS(R9) ; MARK IT PUBLIC BRW CONT_TTDESC 13$: CMPB WORK,#^A\R\ ; PRIVATE TT? BNEQ 15$ ; NO MOVL #TT_M_RESTRICTED,TT_FLAGS(R9) ; MARK IT PRIVATE BRW CONT_TTDESC 15$: MOVL #TT_M_DIALUP,TT_FLAGS(R9) ; EVERYTHING ELSE LIKE DIAL-UP CONT_TTDESC: BRW LOOP_TTDESC INI_CLOSETTDESC: $CLOSE FAB=FAB_TTDESC MOVL #1,R0 ; FORCE SUCCESS RET_TTCONNINI: RET .PAGE .SBTTL TTCONNOPS .ENTRY TTCONNGET,^M MOVB #1,SELECT_OP ; SELECT GET BRW TTCONNOPS .ENTRY TTCONNUPD,^M MOVB #2,SELECT_OP ; SELECT UPD BRW TTCONNOPS .PAGE TTCONNOPS: MOVL ARG_PRCS(AP),R11 ; ADR PRCS BUFR BLK BNEQ 10$ MOVL #SS$_BADPARAM,R0 ; ERROR RETURN JMP RET_TTCONNOPS 10$: MOVAB BFB_BUFR(R11),R10 ; ADR PRCS DATA CMPL PRCS_TYPE(R10),#PRCS_M_IAC ; INTERACTIVE PRCS? BNEQ RET_TTCONNOPS ; NO JSB PROC_OPS_MAP ; MAP TT INTO TTINFO TSTL R9 ; SUCCESS? BNEQ OPS_SELECTOR ; YES MOVAL MSG_BADTTNAM+QMSG_FAO_ARG+4,R6 ; DISPLAY ERROR MSG MOVAW PRCS_CSW(R10),(R6)+ ; CSW PORT MOVAB PRCS_TTNAME(R10),(R6)+ ; TTNAME $PUTMSG_S MSGVEC=MSG_BADTTNAM MOVL #SS$_NORMAL,R0 ; FORCE SUCCESS WILL GIVE USER JMP RET_TTCONNOPS ; NORMAL SESSION QUOTA. OPS_SELECTOR: CASEB SELECT_OP,#1,#1 ; SELECT SPECIFIC OPERATION 1$: .WORD OPS_GET-1$ .WORD OPS_UPD-1$ MOVL #SS$_BADPARAM,R0 ; ERROR RETURN RET_TTCONNOPS: RET .PAGE .SBTTL OPS_GET OPS_GET: BITL #TT_M_PUBLIC,TT_FLAGS(R9) ; PUBLIC TT? BNEQ GET_PUBLIC ; YES BITL #TT_M_RESTRICTED,TT_FLAGS(R9) ; PRIVATE TT? BNEQ GET_RESTRICTED ; YES BRW GET_TTRESET GET_PUBLIC: CMPL PRCS_UIC(R10),TT_UIC(R9) ; NEW USER? BNEQ GET_TTRESET ; YES CMPQ PRCS_LOGIN_T(R10),TT_RESET_T(R9) ; START A NEW "DAY"? BGEQ GET_TTRESET ; YES MOVL TT_CONN(R9),PRCS_CONN(R10) ; SESSION CONN QUOTA MOVQ TT_RESET_T(R9),PRCS_RESET_T(R10) ; TIME OF NEXT "DAWN" JMP RET_TTCONNGET GET_RESTRICTED: MOVL #60*60*24-1,PRCS_CONN(R10) ; GIVE 'EM ALL DAY GET_TTRESET: MOVQ PRCS_LOGIN_T(R10),TT_LOGIN_T(R9) ; NEW LOGIN THIS TT ADDQ3 DELTA_TTRESET,TT_LOGIN_T(R9),TT_RESET_T(R9) MOVQ TT_RESET_T(R9),PRCS_RESET_T(R10) MOVL PRCS_UIC(R10),TT_UIC(R9) MOVL PRCS_CONN(R10),TT_CONN(R9) RET_TTCONNGET: RET .PAGE .SBTTL OPS_UPD OPS_UPD: SUBQ3 PRCS_LOGIN_T(R10),PRCS_LOGOUT_T(R10),- ; CONNECT TIME USED WORK EDIV #10000000,WORK,WORK+8,WORK+12 ; CVT TO SECONDS SUBL WORK+8,TT_CONN(R9) ; UPD CONNECT QUOTA RET_TTCONNUPD: RET .PAGE .SBTTL PROC_INI_MAP PROC_INI_MAP: CLRL R9 ; INIT ADR TTINFO MOVAB TTDESC,R8 ; ADR TT DESCRIPTION BUFFER MOVTC #4,TTINF_PORT(R8),#^A\ \,- ; UPCASE TTNAME TAB_UPCASE,#4,TTNAME LOCC TTNAME,#N_TYPE_TT,STRG_TYPE_TT ; LOCATE TT TYPE BNEQ 5$ JMP RSB_INI_MAP ; ERROR RETURN 5$: SUBL3 #STRG_TYPE_TT,R1,IDX_TYPE ; INDEX TO TT TYPE DATA CMPL IDX_TYPE,#N_TYPE_CSW ; CSW PORT? BGEQ 10$ ; NO (INDEX IS ZERO BASE) PUSHAL WORK ; CVT PORT TO BINARY PUSHAQ DSC_CSWTT CALLS #2,G^OTS$CVT_TO_L BLBS R0,20$ JMP RSB_INI_MAP ; ERROR RETURN 10$: CLRQ WORK MOVTC #1,TTNAME+2,#0,TAB_ASCBIN,- ; ASCII LETTER ("DZ") TO BINARY #1,WORK MULL #8,WORK ; 8 PORTS PER DZ MOVTC #1,TTNAME+3,#0,TAB_ASCBIN,- ; ASCII DIGIT (PORT) TO BINARY #1,WORK+4 ADDL WORK+4,WORK 20$: MOVL IDX_TYPE,R6 ; INDEX TO DATA THIS TT TYPE CMPL WORK,TAB_NUM_TYPE[R6] ; IN RANGE? BGTR RSB_INI_MAP ; NO MULL #TT_K_LENGTH,WORK ADDL3 WORK,ATAB_TTINFO[R6],R9 ; ADR TTINFO ENTRY RSB_INI_MAP: RSB .PAGE .SBTTL PROC_OPS_MAP PROC_OPS_MAP: CLRL R9 ; INIT ADR TTINFO TSTW PRCS_CSW(R10) ; COMSW TT? BEQL 10$ ; NO MOVZBL PRCS_CSW_NODE(R10),R6 ; CSW NODE ID CMPL R6,#N_TYPE_CSW ; IN RANGE? BLEQ 5$ ; YES JMP RSB_OPS_MAP 5$: SUBL3 #1,R6,IDX_TYPE ; INDEX TO TT TYPE DATA MOVZBL PRCS_CSW_TT(R10),WORK ; PORT ID BRW 20$ 10$: MOVTC #4,PRCS_TTNAME+1(R10),#^A\ \,- ; UPCASE TTNAME TAB_UPCASE,#4,TTNAME LOCC TTNAME,#N_TYPE_TT,STRG_TYPE_TT ; FIND TT TYPE BEQL RSB_OPS_MAP ; ERROR RETURN SUBL3 #STRG_TYPE_TT,R1,IDX_TYPE ; INDEX TO TT TYPE DATA CLRQ WORK MOVTC #1,TTNAME+2,#0,TAB_ASCBIN,- ; ASCII LETTER ("DZ") TO BINARY #1,WORK MULL #8,WORK ; 8 PORTS PER DZ MOVTC #1,TTNAME+3,#0,TAB_ASCBIN,- ; ASCII DIGIT (PORT) TO BINARY #1,WORK+4 ADDL WORK+4,WORK 20$: MOVL IDX_TYPE,R6 ; INDEX TO TT TYPE DATA CMPL WORK,TAB_NUM_TYPE[R6] ; PORT IN RANGE? BGTR RSB_OPS_MAP ; NO MULL #TT_K_LENGTH,WORK ; OFFSET INTO TTINFO THIS TYPE ADDL3 WORK,ATAB_TTINFO[R6],R9 ; ADR TTINFO ENTRY RSB_OPS_MAP: RSB .END