/*
*	SCCS File Type - 
*
* 	What identification string
*/
static char *_S_NKSRdefsh =	"@(#)NKSRdefs.h	1.10";

/* need to include /kr/sunix/emulator/include/KERcalls.h before this file */


#define RW 2
#define RXW 3
#define XU 4

#define NAMELENGTH 8
#define PASSLENGTH 11
#define LINELENGTH 80
#define PATHLENGTH 64
#define SHORT 12
#define LONG 50
#define SYSNAMELEN 60

#define SEC_LOW_ENTRY      0
#define SEC_HIGH_ENTRY     15
#define INTEG_LOW_ENTRY     16
#define INTEG_HIGH_ENTRY    31
#define CMPTMNT_LOW_ENTRY   32
#define CMPTMNT_HIGH_ENTRY  63


/* an enumerated type used by the procedures "stoa" (security to ascii)
   and "ctoa" (compartment to ascii). */
#define LNAME      1    /* return the long name */
#define SNAME      2    /* return the short name */


	typedef char    nameType;
	typedef char    passType;
	typedef char    lineType;
	typedef char    pathType;

#define secShortName secshort
#define secLongName  seclong
#define sysNameType  sysnType
	typedef char    secShortName;
	typedef char    secLongName;
	typedef char    sysNameType;

	/* system version type */
	/* major and minor have been renamed (different than the modula
	 * version) due to a conflict with emulator include files       */
#define versionType  verType
	typedef struct
	{
		cardinal majornum;      /* major version number */
		cardinal minornum;      /* minor version number */
	} versionType;

/*
 *   syspstruct
 *
 *   system profile database record
 */
	typedef struct
	{
		sysNameType      sys_name[SYSNAMELEN];  /* system name for this system */
		sysNameType      inst_name[SYSNAMELEN]; /* name of install where this system is located */
		cardinal         sys_no;       /* unique KSOS system number */
		versionType      version;      /* KSOS OS version number (major/minor) */
		cardinal32       gen_date;     /* KSOS OS system generation date */
		access_level_type  systemMax;  /* max level ever permitted for this system */
		access_level_type  currMax;    /* max level currently permitted on this system */
		access_level_type  currMinMax; /* defines the lowest maximum level needed to
						  login in (ie if a user's max level is 
						  less than this level he can not login) */
		
	} syspstruct;

/*
 *   secMapstruct
 *
 *   shortName is in uppercase and needn't end with null
 *   longName is uppercase, may include blanks, and must end with null
 *   active is 'A' active or 'I' inactive
 *
 *   The map has 64 entries
 *    0 - 15 are security level categories
 *   16 - 31 are integrity level categories
 *   32 - 63 are seurity compartments
 */
	typedef struct
	{
		secShortName    shortName[SHORT]; /* 12 bytes */
		secLongName     longName[LONG];   /* 50 bytes */
		char		fillnull;	  /*  1 byte  */
		char    	active;           /*  1 byte */
	} secMapstruct;

#define userName usname
#define userPassword uspassw
#define usermaxLevel usmxlev
/*
 *   uaastruct
 *
 *   user access authentication database
 */
	typedef struct                              /*  256 bytes */
	{
		nameType    userName[NAMELENGTH];   /*    8 bytes */
		passType    userPassword[PASSLENGTH]; /* 11 bytes */
		char        pad1;                   /*    1 byte  */
		char        loginOk;                /*    1 byte  */
		char        pad2;                   /*    1 byte  */
		access_level_type usermaxLevel;     /*    6 bytes */
		tii_struct     tii;                 /*   16 bytes */
		pathType    loginDir[PATHLENGTH];   /*   64 bytes */
		pathType    loginShell[PATHLENGTH]; /*   64 bytes */
		pathType    loginEmul[PATHLENGTH];  /*   64 bytes */
		char        filler[20];             /*   20 bytes */

	} uaastruct;

#define groupName gname
#define groupPassword gpassw
#define groupmaxLevel gmaxlev
/*
 *   gaastruct
 *
 *   group access authentication database
 */
	typedef struct                              /* 30 bytes */
	{

		nameType    groupName[NAMELENGTH];  /*  8 bytes */
		passType    groupPassword[PASSLENGTH]; /* 11 bytes */
		char	    fillchar;		    /* 1 byte  */
		int         groupid;                /*  2 bytes */
		access_level_type groupmaxLevel;    /*  6 bytes */
		int         groupAdmin;             /*  2 bytes */
	} gaastruct;

#define deviceName dvcname
#define deviceSeid dvcseid
#define devicemaxLevel dvclevel
#define device_tii dvctii
#define valid_required valrequr
#define assign_required assrequr
/*
 *   dpstruct
 *
 *   device profile database
 */
	typedef struct                              /* 30 bytes */
	{
		nameType   deviceName[NAMELENGTH];  /*  8 bytes */
		seid       deviceSeid;              /*  4 bytes */
		tii_struct device_tii;              /* 16 bytes */
		boolean	   valid_required;	    /*  1 byte  setting of drive valid required */
		boolean    assign_required;         /*  1 byte  can be assigned to user by assign function */
	} dpstruct;

	/* valid parity types */
	typedef int	parityType;
#define ODD  00
#define EVEN 01
#define NONE 02

/*
 *   tpstruct
 *
 *   terminal profile database
 */
	typedef struct                          /* 23 bytes */
	{
		char              ttyid;        /* 1 unique terminal id */
		boolean           config;       /* 1 terminal is configured */
		boolean           console;      /* 1 terminal is to be treated as a console */
		cardinal          xmitBaud;     /* 2 default xmit baud rate */
		cardinal          recBaud;      /* 2 default rec baud rate */
		parityType        parity;       /* 2 default parity */
		char              clrScreen[8]; /* 8 sequence required to clear the screen */
		access_level_type maxLevel;     /* 6 maximum access level for this terminal */
	} tpstruct;
