SNAX Connection Manager (SNAX/CM) Manual

User Process Procedures
SNAX/CM Sample Server
097842 Tandem Computers Incorporated C–11
The User Procedures File
SVUSERS
Following is sample code in a file named SVUSERS for the user procedures. This
example file contains a procedure to make the connection, start the user’s process, and
disconnect.
-------------------------------------------------------------------------------------------
-- DO^USERx^CONNECT Procedure
-- The "CONNECT" procedure is called when SXCMSV detects that a connection has been made.
-- DO^USERx^CONNECT can then use the connected LUs in whatever way the customer wants.
-- The provided examples allow the customer to RUN a program similar to
-- TACL (DO^USER1^CONNECT), or to RUN RJECIS (DO^USER2^CONNECT).
--
-- INPUTS: proc^buf - a structure in extended memory that holds the configured options
-- for the LU to be started. See SVUSERD for definition.
-- luexpname- The alias LU name output from FNAMEEXPAND.
-- errmsg - A stack string buffer into which error message strings can be
-- placed before calling WRITETERM_ for display on the OUT file.
-- xpoolhead- The pool header for an extended memory pool.
--
-- OUTPUT: CONNECT^BUF- An extended pool buffer with the structure
-- CONNECTED^BUFFER^TEMPLATE (see SVUSERD). CONNECT^BUF saves a
-- record of the connection and is passed to DO^USERx^DISCONNECT.
-- CONNECT^BUF is allocated (using GETPOOL) by DO^USERx^CONNECT,
-- but is released by SXCMSV.
--
-- If the customer does not want the DO^USERx^DISCONNECT procedure
-- to be called, then a CONNECT^BUF should not be allocated, and
-- 0D should be returned.
-------------------------------------------------------------------------------------------
INT(32) PROC do^user1^connect( proc^buf, luexpname, errmsg, xpoolhead );
INT .EXT proc^buf( proc^buffer^template );
INT .luexpname;
STRING .errmsg;
INT .xpoolhead;
BEGIN -- do^user1^connect
LITERAL np^mem^size = 64, ! default newprocess values
np^pri = 144,
np^insp^off = 0,
np^insp^on = 1;
INT mem^size := np^mem^size,
pri := np^pri,
inspect^flags := np^insp^off;
INT procfn := -1;
INT .proc^id[0:3] := 4 * [" "];
STRING .proc^id^string := @proc^id '<<' 1;
INT .proc^name[0:11] := 12 * [" "];
INT .file^name[0:11] := [" "];