/*****************************************************************************/
/* File name: Constants.java                                                 */
/* Purpose: contains constants for NFS service                               */
/*                                                                           */
/* Last modified: 24.07.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*                                                                           */
/* This program is distributed in the hope that it will be useful, but       */
/* WITHOUT ANY WARRANTY; without even the implied warranty of                */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General */
/* Public License for more details.                                          */
/*                                                                           */
/* This software is distributed under the terms                              */
/* of the GNU General Public License as published                            */
/* by the Free Software Foundation; either version 2, or (at your option)    */
/* any later version.                                                        */
/* See file COPYING for your rights (GNU GPL)                                */
/*****************************************************************************/

package nfs;


public
interface

Constants
{

  /* $Header: /d/NFS/nfs/RCS/Constants.java,v 1.12 1999/07/29 16:06:25 vklimov Exp $ */

  final static long NFS_PROGRAM = 100003;
  final static long NFS_VERSION_LOW  = 2;
  final static long NFS_VERSION      = NFS_VERSION_LOW;
  final static long NFS_VERSION_HIGH = 3;

  final static long NFSPROC_NULL = 0;
  final static long NFSPROC_GETATTR = 1;
  final static long NFSPROC_SETATTR = 2;
  final static long NFSPROC_ROOT = 3;
  final static long NFSPROC_LOOKUP = 4;
  final static long NFSPROC_READLINK = 5;
  final static long NFSPROC_READ = 6;
  final static long NFSPROC_WRITECACHE = 7;
  final static long NFSPROC_WRITE = 8;
  final static long NFSPROC_CREATE = 9;
  final static long NFSPROC_REMOVE = 10;
  final static long NFSPROC_RENAME = 11;
  final static long NFSPROC_LINK = 12;
  final static long NFSPROC_SYMLINK = 13;
  final static long NFSPROC_MKDIR = 14;
  final static long NFSPROC_RMDIR = 15;
  final static long NFSPROC_READDIR = 16;
  final static long NFSPROC_STATFS = 17;

                                                         /* status constants */
  final static long NFS_OK = 0;
  final static long NFSERR_PERM=1;
  final static long NFSERR_NOENT=2;
  final static long NFSERR_IO=5;
  final static long NFSERR_NXIO=6;
  final static long NFSERR_ACCES=13;
  final static long NFSERR_EXIST=17;
  final static long NFSERR_NODEV=19;
  final static long NFSERR_NOTDIR=20;
  final static long NFSERR_ISDIR=21;
  final static long NFSERR_FBIG=27;
  final static long NFSERR_NOSPC=28;
  final static long NFSERR_ROFS=30;
  final static long NFSERR_NAMETOOLONG=63;
  final static long NFSERR_NOTEMPTY=66;
  final static long NFSERR_DQUOT=69;
  final static long NFSERR_STALE=70;
  final static long NFSERR_WFLUSH=99;
                                                               /* ftype */
  final static long NFNON = 0;                  /* non-file,                */
  final static long NFREG = 1;                  /* regular file,            */
  final static long NFDIR = 2;                  /* directory,               */
  final static long NFBLK = 3;                  /* block-special device,    */
  final static long NFCHR = 4;                  /* character-special device */
  final static long NFLNK = 5;                  /* symbolic link.           */

                                                       /* mode masks */

  final static int NFS_MODE_MASK_DIR = 0040000;  /* This is a directory    */
                                                  /* "type" field should be */
                                                  /* NFDIR                  */
  final static int NFS_MODE_MASK_CHR = 0020000;  /* This is a character    */
                                                  /* special file; "type"   */
                                                  /* field should  be NFCHR */
  final static int NFS_MODE_MASK_BLK = 0060000;  /* This is a block special*/
                                                  /* file; "type" field     */
                                                  /* should be NFBLK        */
  final static int NFS_MODE_MASK_REG = 0100000;  /* This is a regular file */
                                                  /* "type" field should be */
                                                  /* NFREG                  */
  final static int NFS_MODE_MASK_LNK = 0120000;  /* This is a symbolic link*/
                                                  /* file; "type" field     */
                                                  /* should be NFLNK        */
  final static int NFS_MODE_MASK_SOK = 0140000;  /* This is a named socket */
                                                  /* "type" field should be */
                                                  /* NFNON                  */
  final static int NFS_MODE_MASK_SUI = 0004000; /* Set user id on execution*/
  final static int NFS_MODE_MASK_SGI = 0002000; /* Set group id on execution*/
  final static int NFS_MODE_MASK_SSW = 0001000; /* Save swapped text even   */
                                                 /* after use                */
  final static int NFS_MODE_MASK_ROW = 0000400; /* Read permission for owner*/
  final static int NFS_MODE_MASK_WOW = 0000200; /* Write permission, owner  */
  final static int NFS_MODE_MASK_EOW = 0000100; /* Execute and search       */
                                                 /* permission for owner     */
  final static int NFS_MODE_MASK_RGR = 0000040; /* Read permission, group   */
  final static int NFS_MODE_MASK_WGR = 0000020; /* Write permission, group  */
  final static int NFS_MODE_MASK_EGR = 0000010; /* Execute and search       */
                                                 /* permission for group     */
  final static int NFS_MODE_MASK_ROT = 0000004; /* Read permission, others  */
  final static int NFS_MODE_MASK_WOT = 0000002; /* Write permission, others */
  final static int NFS_MODE_MASK_EOT = 0000001; /* Execute and search       */
                                                 /* permission for others    */

  final static long NFS_PORT = 2049;
  final static long NFS_TEST_PORT = 2047;

  final static int MAXPATHLEN = 1024;         /* The maximum number of bytes */
                                              /* in a path name argument     */

  final static int MAXNAMLEN = 255;           /* The maximum number of bytes */
                                              /* in a file name argument     */



  final static int MAXDATA = 8192;    /* The maximum number of bytes of data */
                                      /* in a READ or WRITE request          */

  final static int COOKIESIZE  = 4;       /* The size in bytes of the opaque */
                                          /* "cookie" passed by READDIR      */

  final static long INITIAL_TRANSACTION_ID = 0;

  final static long ATTRIBUTE_VALUE_NOT_SET = 0;

  final static int N_XDR_UINTS_IN_FATTR = 17;
  final static int PORTMAPPER_REGISTRATION_UDP_PACKET_DATA_LENGTH = 60;
  final static int NFSPROC_READ_UDP_PACKET_DATA_LENGTH = 13 *
                     rpc.Constants.XDR_UNSIGNED_INT_LENGTH +
                     mount.Constants.FHSIZE;
  final static int NFSPROC_READDIR_UDP_PACKET_DATA_LENGTH = 12 *
                     rpc.Constants.XDR_UNSIGNED_INT_LENGTH +
                     mount.Constants.FHSIZE;
  final static int NFSPROC_GETATTR_UDP_PACKET_DATA_LENGTH = 10 *
                     rpc.Constants.XDR_UNSIGNED_INT_LENGTH +
                     mount.Constants.FHSIZE;
  final static int NFSPROC_LOOKUP_UDP_PACKET_DATA_LENGTH = 10 *
                     rpc.Constants.XDR_UNSIGNED_INT_LENGTH +
                     mount.Constants.FHSIZE                +
                     MAXNAMLEN;
  final static int NFSPROC_READDIR_REPLY_PREFIX_LENGTH = 7 *
                     rpc.Constants.XDR_UNSIGNED_INT_LENGTH;
  final static int NFSPROC_GETATTR_REPLY_LENGTH =
                      ( 7 + 1 + N_XDR_UINTS_IN_FATTR ) *
                     rpc.Constants.XDR_UNSIGNED_INT_LENGTH;
  final static int NFSPROC_LOOKUP_REPLY_LENGTH =
                      ( 7 + 1 + N_XDR_UINTS_IN_FATTR ) *
                     rpc.Constants.XDR_UNSIGNED_INT_LENGTH  +
                     mount.Constants.FHSIZE;
  final static int NFSPROC_FILE_READ_REPLY_PREFIX_LENGTH =
                     ( 7 + N_XDR_UINTS_IN_FATTR ) *
                     rpc.Constants.XDR_UNSIGNED_INT_LENGTH;

  final static int NFSPROC_ERR_UDP_PACKET_DATA_LENGTH = 7 *
                     rpc.Constants.XDR_UNSIGNED_INT_LENGTH;
  final static int NFSPROC_READDIR_MIN_N_UINTS_DATA_LEN = 2;

  final static String PORTMAPPER_THREAD_NAME_STRING = "portmapperThread";
  final static String MOUNT_SERVER_THREAD_NAME_STRING = "mountServerThread";
  final static String NFS_SERVER_THREAD_NAME_STRING = "nfsServerThread";
  final static String PROPERTIES_FILE_PATH = "properties";
  final static String EXPORTS_FILE_PATH = "exports";
  final static String EXPORTS_FILE_COMMENT_START = "#";

} /* end of Constants interface */

/*****************************************************************************/
/* End of file: Constants.java                                               */
/*****************************************************************************/
