#ifndef LIBRARIES_MULTIUSER_H
#define LIBRARIES_MULTIUSER_H
/*
**      $Filename: libraries/multiuser.h $
**      $Release: 1.3 $
**      $Revision: 39.2 $
**
**      multiuser.library definitions
**
**      (C) Copyright 1993 Geert Uytterhoeven
**      All Rights Reserved
*/

#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif  /* EXEC_TYPES_H */

#ifndef EXEC_LISTS_H
#include <exec/lists.h>
#endif  /* EXEC_LISTS_H */

#ifndef EXEC_LIBRARIES_H
#include <exec/libraries.h>
#endif  /* EXEC_LIBRARIES_H */

#ifndef LIBRARIES_DOS_H
#include <libraries/dos.h>
#endif  /* LIBRARIES_DOS_H */

#ifndef GRAPHICS_TEXT_H
#include <graphics/text.h>
#endif  /* GRAPHICS_TEXT_H */

#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif  /* UTILITY_TAGITEM_H */


#define MULTIUSERNAME      "multiuser.library"
#define MULTIUSERVERSION   39


   /*
    *    Reserved users/groups
    *
    *    WARNING: a uid may NOT be zero, a gid may be zero
    */

#define muOWNER_NOBODY  (0x00000000)   /* no rights */
#define muOWNER_SYSTEM  (0xffffffff)   /* always owner */

#define muMASK_UID      (0xffff0000)   /* Mask for uid bits */
#define muMASK_GID      (0x0000ffff)   /* Mask for gid bits */


#define muUSERIDSIZE    (32)           /* Maximum size for a UserID */
#define muPASSWORDSIZE  (32)           /* Maximum size for a Password */
#define muUSERNAMESIZE  (220)          /* Maximum size for a User Name */
#define muHOMEDIRSIZE   (256)          /* Maximum size for a Home Directory */


   /*
    *    Password File Format
    *
    *
    *    For each user, the Password File must have a line like this:
    *
    *    <UserID>|<Password>|<uid>|<gid>|<UserName>|<HomeDir>|<Shell>
    *
    *    with:
    *
    *       <UserID>    User Login ID (max. muUIDSIZE characters)
    *       <PassKey>   Encrypted Password
    *       <uid>       User Number (1 - 65535)
    *       <gid>       Group Number (0 - 65535)
    *       <UserName>  Full User Name (max. muUSERNAMESIZE characters)
    *       <HomeDir>   Home directory (max. muHOMEDIRSIZE characters)
    *       <Shell>     Default Shell (not used yet, AS225 compatibility)
    */


   /*
    *    Tags for muLogoutA()/muLoginA()/muSetDefProtectionA()
    */

#define muT_Input          (TAG_USER+1)   /* filehandle - default is Input() */
#define muT_Output         (TAG_USER+2)   /* filehandle - default is Output() */
#define muT_Graphical      (TAG_USER+3)   /* boolean - default is FALSE */
#define muT_PubScrName     (TAG_USER+4)   /* name of public screen */
#define muT_Task           (TAG_USER+5)   /* task (NOT the name!!) */
#define muT_Own            (TAG_USER+6)   /* make a task of this user */
#define muT_Global         (TAG_USER+7)   /* change it for all tasks on the */
                                          /* same level as this one */
#define muT_Quiet          (TAG_USER+8)   /* for muLogoutA(), don't give a */
                                          /* login prompt, simply logout */
#define muT_UserID         (TAG_USER+9)   /* UserID for muLoginA(), must be */
                                          /* used together with muT_Password!! */
#define muT_Password       (TAG_USER+10)  /* Password for muLoginA(), must be */
                                          /* used together with muT_UserID!! */
#define muT_DefProtection  (TAG_USER+11)  /* Default protection bits */
                                          /* default is RWED GROUP R OTHER R */

   /*
    *    Public User Information Structure
    *
    *    For future compatibility, you should ALWAYS use muAllocUserInfo()
    *    to allocate this structure. NEVER do it by yourself!!
    */

struct muUserInfo {
   char UserID[muUSERIDSIZE];
   UWORD uid;
   UWORD gid;
   char UserName[muUSERNAMESIZE];
   char HomeDir[muHOMEDIRSIZE];
};


   /*
    *    KeyTypes for muGetUserInfo
    */

#define muKeyType_First    0
#define muKeyType_Next     1
#define muKeyType_UserID   2  /* Case-sensitive */
#define muKeyType_uid      3
#define muKeyType_gid      4
#define muKeyType_gidNext  5
#define muKeyType_UserName 6  /* Case-insensitive */


   /*
    *    Protection bits (see <dos/dos.h>:-)
    */

#define muFIBB_SET_UID        31   /* Change owner during execution */

/* FIBB are bit definitions, FIBF are field definitions */
/* Regular RWED bits are 0 == allowed. */
/* NOTE: GRP and OTR RWED permissions are 0 == not allowed! */

/* #define FIBB_OTR_READ      15   Other: file is readable */
/* #define FIBB_OTR_WRITE     14   Other: file is writable */
/* #define FIBB_OTR_EXECUTE   13   Other: file is executable */
/* #define FIBB_OTR_DELETE    12   Other: prevent file from being deleted */
/* #define FIBB_GRP_READ      11   Group: file is readable */
/* #define FIBB_GRP_WRITE     10   Group: file is writable */
/* #define FIBB_GRP_EXECUTE   9    Group: file is executable */
/* #define FIBB_GRP_DELETE    8    Group: prevent file from being deleted */

/* #define FIBB_SCRIPT        6    program is a script (execute) file */
/* #define FIBB_PURE          5    program is reentrant and rexecutable */
/* #define FIBB_ARCHIVE       4    cleared whenever file is changed */
/* #define FIBB_READ          3    ignored by old filesystem */
/* #define FIBB_WRITE         2    ignored by old filesystem */
/* #define FIBB_EXECUTE       1    ignored by system, used by Shell */
/* #define FIBB_DELETE        0    prevent file from being deleted */

#define muFIBF_SET_UID        (1<<muFIBB_SET_UID)

/* #define FIBF_OTR_READ      (1<<FIBB_OTR_READ) */
/* #define FIBF_OTR_WRITE     (1<<FIBB_OTR_WRITE) */
/* #define FIBF_OTR_EXECUTE   (1<<FIBB_OTR_EXECUTE) */
/* #define FIBF_OTR_DELETE    (1<<FIBB_OTR_DELETE) */
/* #define FIBF_GRP_READ      (1<<FIBB_GRP_READ) */
/* #define FIBF_GRP_WRITE     (1<<FIBB_GRP_WRITE) */
/* #define FIBF_GRP_EXECUTE   (1<<FIBB_GRP_EXECUTE) */
/* #define FIBF_GRP_DELETE    (1<<FIBB_GRP_DELETE) */

/* #define FIBF_SCRIPT        (1<<FIBB_SCRIPT) */
/* #define FIBF_PURE          (1<<FIBB_PURE) */
/* #define FIBF_ARCHIVE       (1<<FIBB_ARCHIVE) */
/* #define FIBF_READ          (1<<FIBB_READ) */
/* #define FIBF_WRITE         (1<<FIBB_WRITE) */
/* #define FIBF_EXECUTE       (1<<FIBB_EXECUTE) */
/* #define FIBF_DELETE        (1<<FIBB_DELETE) */


#endif  /* LIBRARIES_MULTIUSER_H */
