[comp.os.vms] Trapping broadcast messages

KARNEY%PPC.MFENET@NMFECC.ARPA (04/25/88)

I'm using smg$set_broadcast_trapping and smg$get_broadcast_message to trap
and redirect broadcast messages.  Two questions about this:

(1) Is there a way of doing this without involving SMG?  (I'm not using SMG
otherwise.)

(2) How you I determine the class of the broadcast message (OPER, SHUTDOWN,
MAIL, GENERAL, etc.)?  I want to pass this information along too.

    Charles Karney
    Plasma Physics Laboratory   Phone:   +1 609 243 2607
    Princeton University        MFEnet:  Karney@PPC.MFEnet
    PO Box 451                  ARPAnet: Karney%PPC.MFEnet@NMFECC.ARPA
    Princeton, NJ 08543-0451    Bitnet:  Karney%PPC.MFEnet@ANLVMS.Bitnet

CC:
        info-vax@KL.SRI.COM
        KARNEY

leres@ucbarpa.Berkeley.EDU (Craig Leres) (04/30/88)

Charles Karney (KARNEY%PPC.MFENET@NMFECC.ARPA) writes:

> (1) Is there a way of doing this without involving SMG?  (I'm not using SMG
> otherwise.)
>
> (2) How you I determine the class of the broadcast message (OPER, SHUTDOWN,
> MAIL, GENERAL, etc.)?  I want to pass this information along too.

Check out the "Terminal/Mailbox Interaction" section of part I of
the I/O User's Reference manual. When you associate a mailbox with
a terminal, the message type is included in the mailbox message.

This interface is pretty sexy; by changing the NOBRDCST and BRDCSTMBX
terminal characteristics, you can control if the broadcast goes to
the terminal and/or the broadcast mailbox.

		Craig

cfchiesa@bsu-cs.UUCP (Christopher Chiesa) (04/30/88)

I tried to e-mail this response, but it bounced.  So be it...

> I'm using smg$set_broadcast_trapping and smg$get_broadcast_message to trap
> and redirect broadcast messages.  Two questions about this:
> 
> (1) Is there a way of doing this without involving SMG?  (I'm not using SMG
> otherwise.)
> 
> (2) How you I determine the class of the broadcast message (OPER, SHUTDOWN,
> MAIL, GENERAL, etc.)?  I want to pass this information along too.
>

You can trap broadcast messages, and select/deselect classes of them, by 
passing the appropriate parameters to the $QIO system service.  I've been 
writing a program lately, part of which does precisely this.  I'll hold off
posting the source (MACRO assembler; SO THERE, Michael [sorry; inside comment
from the LAST time I posted MACRO code]) until/unless there's a request for
it. 

Basically, you have to do the following:

      *  Create a mailbox (using $CREMBX system service)

      *  Assign a channel to the terminal, with associated mailbox (the 
          one created above) (using $ASSIGN system service).

      *  Set the BRDCSTMBX terminal-mode characteristic ON, and the 
          BROADCAST terminal-mode characteristic OFF (using $QIO system
          service).

      *  Optionally, select the broadcast-message classes you wish the 
          terminal to receive, using $QIO .

   -- after doing all this, any broadcast messages that would normally appear
      on the terminal screen, will be directed to the mailbox instead.  What
      you do with them once this is set up, is your business.  Options include
      reading the mailbox whenever YOU are ready to look at the broadcasts,
      and setting a "write-attention AST" on the mailbox so that a routine you
      specify can be executed IMMEDIATELY when data is written to the mailbox.

   -- and don't forget to "clean up" all this jazz when your program executes;
      that means saving the original terminal characteristics for later resto-
      ration, for one thing...  Terminal characteristics will NOT be automat-
      ically restored by VMS exit handlers when your image terminates. 
-- 
UUCP: <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!cfchiesa 
cfchiesa@bsu-cs.UUCP                                           

KARNEY%PPC.MFENET@NMFECC.ARPA (06/09/88)

A month ago, I asked:
        I'm using smg$set_broadcast_trapping and smg$get_broadcast_message to
        trap and redirect broadcast messages.  Two questions about this:

        (1) Is there a way of doing this without involving SMG?  (I'm not
        using SMG otherwise.)

        (2) How you I determine the class of the broadcast message (OPER,
        SHUTDOWN, MAIL, GENERAL, etc.)?  I want to pass this information along
        too.

I received replies from: Jerry Leichter, Mark H. Wood, Kevin Lahey, Tony
Carter, and Eric Loyd.  Thanks for the help!

In brief the answers are (1) Yes, (2) No.

A fuller answer to (1) is:
(a) Associate a mailbox with the terminal with LIB$ASN_WTH_MBX.
(b) Do a IO$_SETMODE on the terminal with TT$M_MBXDSBL, TT$M_NOBRDCST, and
TT2$M_BRDCSTMBX. 
(c) Do a IO$_READVBLK on the mailbox channel specifying a buffer and an AST
completion routine.
(d) The completion routine extracts the broadcast message length from byte
20 and 21 of the buffer, and the message text from bytes 22 on.  It does
whatever it needs to do, and reposts the IO$_READVBLK on the mailbox
channel.

Incidentally, it turns out that I couldn't use SMG$SET_BROADCAST_TRAPPING
to trap the broadcasts because I already had a mailbox associated with the
terminal.

More details are in I/O User's Reference Manual Part I, Sec 8.2.4.

    Charles Karney
    Plasma Physics Laboratory   Phone:   +1 609 243 2607
    Princeton University        MFEnet:  Karney@PPC.MFEnet
    PO Box 451                  ARPAnet: Karney%PPC.MFEnet@NMFECC.ARPA
    Princeton, NJ 08543-0451    Bitnet:  Karney%PPC.MFEnet@ANLVMS.Bitnet

CC:
        info-vax@KL.SRI.COM
        KARNEY