Each online client is represented with an entry in the clients table. The client may inspect his record at run-time and partially change its properties. The administrator sees all client records and has the right to adjust global and any other online client properties.

MODULE clients;

UNSAFE PATTERN clients.addUser(X_0:str, X_1:str):oid;
COMMENT "Allow user with password access to the given scenarios";

COMMAND clients.backendsum(X_0:str):str;
COMMENT "Return hex string representation of the currently used hash of the given string";

UNSAFE PATTERN clients.changePassword(X_0:str, X_1:str):void;
COMMENT "Change the password for the current user";

UNSAFE PATTERN clients.changeUsername(X_0:str, X_1:str):void;
COMMENT "Change the username of the user into the new string";

PATTERN clients.checkPermission(X_0:str, X_1:str):void;
COMMENT "Check permission for a user, requires hashed password (backendsum)";

PATTERN clients.current_sessionid():int;
COMMENT "return current session ID";

PATTERN clients.getId():int;
COMMENT "Return a number that uniquely represents the current client.";

PATTERN clients.getInfo() (X_0:bat[:str], X_1:bat[:str]);
COMMENT "Pseudo bat with client attributes.";

COMMAND clients.getLogins() (X_0:bat[:oid], X_1:bat[:str]);
COMMENT "Pseudo bat of client id and login time.";

PATTERN clients.getPasswordHash(X_0:str):str;
COMMENT "Return the password hash of the given user";

PATTERN clients.getScenario():str;
COMMENT "Retrieve current scenario name.";

PATTERN clients.getUsername():str;
COMMENT "Return the username of the currently logged in user";

PATTERN clients.getUsers() (X_0:bat[:oid], X_1:bat[:str]);
COMMENT "return a BAT with user id and one with name available in the system";

PATTERN clients.getprofile() (X_0:str, X_1:int, X_2:int, X_3:int, X_4:int);
COMMENT "Retrieve the profile settings for a client";

COMMAND clients.md5sum(X_0:str):str;
COMMENT "Return hex string representation of the MD5 hash of the given string";

UNSAFE PATTERN clients.quit():void;
COMMENT "Terminate the client session.";

UNSAFE PATTERN clients.quit(X_0:int):void;
COMMENT "Terminate the session for a single client using a soft error.\nIt is the privilege of the console user.";

UNSAFE PATTERN clients.removeUser(X_0:str):void;
COMMENT "Remove the given user from the system";

COMMAND clients.ripemd160sum(X_0:str):str;
COMMENT "Return hex string representation of the RIPEMD160 hash of the given string";

UNSAFE PATTERN clients.setListing(X_0:int):int;
COMMENT "Turn on/off echo of MAL instructions:\n1 - echo input,\n2 - show mal instruction,\n4 - show details of type resolutoin, \n8 - show binding information.";

UNSAFE PATTERN clients.setPassword(X_0:str, X_1:str):void;
COMMENT "Set the password for the given user";

UNSAFE PATTERN clients.setQryTimeoutMicro(X_0:lng):void;

UNSAFE PATTERN clients.setScenario(X_0:str):str;
COMMENT "Switch to other scenario handler, return previous one.";

UNSAFE PATTERN clients.setmemorylimit(X_0:int):void;

UNSAFE PATTERN clients.setmemorylimit(X_0:int, X_1:int):void;
COMMENT "Limit the memory claim in MB per query";

UNSAFE PATTERN clients.setoptimizer(X_0:int, X_1:str):void;
COMMENT "Set the session optimizer";

UNSAFE PATTERN clients.setoptimizer(X_0:str):void;

UNSAFE COMMAND clients.setprinttimeout(X_0:int):void;
COMMENT "Print running query every so many seconds.";

UNSAFE PATTERN clients.setquerytimeout(X_0:bte, X_1:int):void;

UNSAFE PATTERN clients.setquerytimeout(X_0:int):void;

UNSAFE PATTERN clients.setquerytimeout(X_0:int, X_1:int):void;
COMMENT "A query is aborted after q seconds (q=0 means run undisturbed).";

UNSAFE PATTERN clients.setquerytimeout(X_0:sht, X_1:int):void;

UNSAFE PATTERN clients.setsession(X_0:lng):void;
COMMENT "Abort a session after  n seconds.";

UNSAFE PATTERN clients.setsessiontimeout(X_0:bte, X_1:int):void;

UNSAFE PATTERN clients.setsessiontimeout(X_0:int):void;

UNSAFE PATTERN clients.setsessiontimeout(X_0:int, X_1:int):void;
COMMENT "Set the session timeout for a particulat session id";

UNSAFE PATTERN clients.setsessiontimeout(X_0:sht, X_1:int):void;

UNSAFE PATTERN clients.settimeout(X_0:lng):void;
COMMENT "Abort a query after  n seconds.";

UNSAFE PATTERN clients.settimeout(X_0:lng, X_1:lng):void;
COMMENT "Abort a query after q seconds (q=0 means run undisturbed).\nThe session timeout aborts the connection after spending too\nmany seconds on query processing.";

UNSAFE PATTERN clients.setworkerlimit(X_0:int):void;

UNSAFE PATTERN clients.setworkerlimit(X_0:int, X_1:int):void;
COMMENT "Limit the number of worker threads per query";

COMMAND clients.sha1sum(X_0:str):str;
COMMENT "Return hex string representation of the SHA-1 hash of the given string";

COMMAND clients.sha2sum(X_0:str, X_1:int):str;
COMMENT "Return hex string representation of the SHA-2 hash with bits of the given string";

UNSAFE PATTERN clients.shutdown(X_0:int):str;

UNSAFE PATTERN clients.shutdown(X_0:int, X_1:bit):str;
COMMENT "Close all other client connections. Return if it succeeds.\nIf forced is set then always stop the system the hard way";

UNSAFE PATTERN clients.stop(X_0:int):void;
COMMENT "Stop the query execution at the next eligble statement.";

UNSAFE PATTERN clients.stopsession(X_0:bte):void;

UNSAFE PATTERN clients.stopsession(X_0:int):void;
COMMENT "Stop a particular session";

UNSAFE PATTERN clients.stopsession(X_0:sht):void;

UNSAFE PATTERN clients.suspend(X_0:int):void;
COMMENT "Put a client process to sleep for some time.\nIt will simple sleep for a second at a time, until\nthe awake bit has been set in its descriptor";

UNSAFE PATTERN clients.wakeup(X_0:int):void;
COMMENT "Wakeup a client process";