ETHZ_Logo RAMSES_Logo_Right   RAMSES   RAMSES_Logo_Left Systems Ecology  
Start    search button      Modules:   A-Z   Function   Layer        QuickRefs:   DM   AuxLib   AuxLibE   SciLib   EasyMW   MW   ISIS   RMSLib

DEFINITION MODULE LicensesMgr;

  (*******************************************************************

    Module  LicensesMgr     (Version 1.0)

      Copyright (c) 2001-2006 by Dimitrios Gyalistras and ETH Zurich.

    Purpose   Software licence definition and testing from
              within a Modula-2 program.

    Remarks   Works only under Unix systems.


    Programming

      o Design
        Dimitrios Gyalistras      25/11/2001

      o Implementation
        Dimitrios Gyalistras      25/11/2001


    ETH Zurich
    Systems Ecology
    CHN E 35.1
    Universitaetstrasse 16
    8092 Zurich
    SWITZERLAND

    URLs:
        <mailto:RAMSES@env.ethz.ch>
        <http://www.sysecol.ethz.ch>
        <http://www.sysecol.ethz.ch/SimSoftware/RAMSES>


    Last revision of definition:  11/12/2001  DG

  *******************************************************************)


  TYPE
    LicenseType  = ( undefLicenseType, licenseGranted, noLicence );


  PROCEDURE SetLicenseForNode( nodename   : ARRAY OF CHAR;  (* /usr/bin/uname -n *)
                               expirYear  : INTEGER;
                               expirMonth : INTEGER;
                               expirDay   : INTEGER;
                               l          : LicenseType );

  PROCEDURE SetLicenseForHost( hostid     : ARRAY OF CHAR;  (* /usr/bin/hostid *)
                               expirYear  : INTEGER;
                               expirMonth : INTEGER;
                               expirDay   : INTEGER;
                               l          : LicenseType );

  PROCEDURE SetLicenseForUser( userid     : ARRAY OF CHAR;  (* /usr/ucb/whoami *)
                               expirYear  : INTEGER;
                               expirMonth : INTEGER;
                               expirDay   : INTEGER;
                               l          : LicenseType );

  PROCEDURE GetCurNodeName( VAR nodename : ARRAY OF CHAR );
  PROCEDURE GetCurHostId  ( VAR hostid   : ARRAY OF CHAR );
  PROCEDURE GetCurUserId  ( VAR userid   : ARRAY OF CHAR );

  PROCEDURE GetNodeNames     ( VAR numNodes: INTEGER; VAR nodenames: ARRAY OF CHAR );
  PROCEDURE LicenseForNode   ( nodename: ARRAY OF CHAR ): LicenseType;
  PROCEDURE ExpirYearForNode ( nodename: ARRAY OF CHAR ): INTEGER;
  PROCEDURE ExpirMonthForNode( nodename: ARRAY OF CHAR ): INTEGER;
  PROCEDURE ExpirDayForNode  ( nodename: ARRAY OF CHAR ): INTEGER;

  PROCEDURE GetHostIds       ( VAR numHosts: INTEGER; VAR hostids: ARRAY OF CHAR );
  PROCEDURE LicenseForHost   ( hostid: ARRAY OF CHAR ): LicenseType;
  PROCEDURE ExpirYearForHost ( hostid: ARRAY OF CHAR ): INTEGER;
  PROCEDURE ExpirMonthForHost( hostid: ARRAY OF CHAR ): INTEGER;
  PROCEDURE ExpirDayForHost  ( hostid: ARRAY OF CHAR ): INTEGER;

  PROCEDURE GetUserIds       ( VAR numUsers: INTEGER; VAR userids: ARRAY OF CHAR );
  PROCEDURE LicenseForUser   ( userid: ARRAY OF CHAR ): LicenseType;
  PROCEDURE ExpirYearForUser ( userid: ARRAY OF CHAR ): INTEGER;
  PROCEDURE ExpirMonthForUser( userid: ARRAY OF CHAR ): INTEGER;
  PROCEDURE ExpirDayForUser  ( userid: ARRAY OF CHAR ): INTEGER;


  PROCEDURE DateOK( year, month, day: INTEGER): BOOLEAN;
  (* Returns true, if the current date as obtained from the operating system
  is smaller or equal to the date specified by the parameters "year", "month"
  and "day". *)

  PROCEDURE NodenameOK(): BOOLEAN;
  PROCEDURE HostidOK  (): BOOLEAN;
  PROCEDURE UseridOK  (): BOOLEAN;
  (* A "XxxxxOK"-procedure returns TRUE if no item of type "Xxxxx" has been defined
  by means of "SetLicenseForXxxxx" (i.e. "GetXxxxx" returns "numXxxxx" = 0), or
  if "LicenseForXxxxx() = licenseGranted" AND "DateOK() = TRUE". *)

  PROCEDURE LicenseOK (): BOOLEAN;
  (* Returns TRUE if all "XxxxxOK"-procedures return TRUE. *)


END LicensesMgr.

  Contact RAMSES@env.ethz.ch Last updated: 25-Jul-2011 [Top of page]