Guardian Programmer's Guide

Table Of Contents
Writing a Terminal Simulator
Guardian Programmer’s Guide 421922-014
24 - 14
Tracking the BREAK Owner
Tracking the BREAK Owner
The terminal-simulation process must know the BREAK owner so that it can send
Break-on-device messages to it.
When the terminal-simulation process receives a SETMODE function 11 or
SETPARAM function 3 message, the message includes a 16-bit parameter value
(sysmsg[2] in the Setmode message, sysmsg[4] in the Setparam message) that
indicates how to set BREAK ownership, as follows:
If the sender of the message is the BREAK owner, the process handle of the owner
can be determined by a call to the FILE_GETRECEIVEINFO_ procedure. That
process handle should already be contained in the table of openers that a terminal-
simulation process typically keeps. The terminal-simulation process can remember the
BREAK owner by storing its opener-table index. (For a fuller discussion of opener
tables, see Section 22, Writing a Server Program.)
When requested, the terminal-simulation process must reply to the Setmode or
Setparam message, including in the response a value that represents the previous
owner. (See Processing System Messages, earlier in this section.) If there was no
previous owner, it sends a value of 0. If there was a previous owner, it sends an
internally defined value, typically the negative of the opener-table index for that owner.
That way, if the negative value comes back to the terminal-simulation process in a later
Setmode or Setparam message, the BREAK owner that it represents will be
understood.
Basing Interprocess I/O on BREAK Mode
The terminal-simulation process must base its communication with requesters on
whether the terminal-simulation process is currently in BREAK mode or normal mode:
If the terminal-simulation process is in normal mode, the process can communicate
with any requester.
If the terminal-simulation process is in BREAK mode, the process must
communicate only with a process that has BREAK access. An error must be
returned to all other processes that attempt to communicate with the terminal-
simulation process. This error can be returned using the error-return
parameter of the REPLY procedure.
When the terminal-simulation process receives a SETMODE function 12 message, the
process should update a variable to indicate whether the process is in BREAK mode or
normal mode or update a variable indicating whether the requester has BREAK
access.
If value is then BREAK should be
0 disabled and there is no owner
positive enabled and the sender of the message is the owner
negative enabled and the owner is indicated by the negative value