Guardian Programmer's Guide

Table Of Contents
Writing a Command-Interpreter Monitor ($CMON)
Guardian Programmer’s Guide 421922-014
23 - 11
Controlling Logon
information was sent in the Prelogon^msg message. The Logon^msg message has
the following structure:
After processing the Logon^msg message, the $CMON process replies with an
indication of whether the user is allowed to log on. The reply can also contain display
text. The structure of the reply message is as follows:
The following code fragment checks a flag value before deciding whether to accept the
logon request:
CALL READUPDATEX(RECV^NUM,SBUFFER,RCOUNT,BYTES^READ);
IF BUFFER[0] = -50 THEN
BEGIN
IF ACCEPT^LOGON = YES THEN
BEGIN
LOGON^REPLY.REPLYCODE := 0;
LOGON^REPLY.REPLYTEXT ':=' ["Welcome!",0];
END;
ELSE
BEGIN
LOGON^REPLY.REPLYCODE := 1;
LOGON^REPLY.REPLYTEXT ':=' ["Logon rejected",0];
END;
SCAN LOGON^REPLY.REPLYTEXT[0] UNTIL 0 -> @LAST;
REPLY^LEN := 2 + @LAST - @LOGON^REPLY.REPLYTEXT;
CALL REPLYX(LOGON^REPLY,REPLY^LEN);
END;
Format of command-interpreter message -50 (Logon^msg message):
STRUCT LOGON^MSG;
BEGIN
INT MSGCODE; ![0] value -50
INT USERID; ![1] user ID of user logging on
INT CIPRI; ![2] current priority of command
! interpreter
INT CIINFILE[0:11]; ![3] name of command file of
! TACL process
INT CIOUTFILE[0:11]; ![15] name of list file for the
! TACL process
END;
Format of Logon^reply structure:
STRUCT LOGON^REPLY;
BEGIN
INT REPLYCODE; ![0] if 0, proceed to VERIFYUSER;
! if 1, disallow logon
STRING REPLYTEXT[0:n]; ![1] optional display text;
! maximum length is 132 bytes
END;