001: package ch.ethz.ssh2.sftp;
002:
003: /**
004: *
005: * SFTP Attribute Bits for the "attrib-bits" and "attrib-bits-valid" fields
006: * of the SFTP ATTR data type.
007: * <p>
008: * Yes, these are the "attrib-bits", even though they have "_FLAGS_" in
009: * their name. Don't ask - I did not invent it.
010: * <p>
011: * "<i>These fields, taken together, reflect various attributes of the file
012: * or directory, on the server. Bits not set in 'attrib-bits-valid' MUST be
013: * ignored in the 'attrib-bits' field. This allows both the server and the
014: * client to communicate only the bits it knows about without inadvertently
015: * twiddling bits they don't understand.</i>"
016: *
017: * @author Christian Plattner, plattner@inf.ethz.ch
018: * @version $Id: AttribBits.java,v 1.2 2006/08/02 12:05:00 cplattne Exp $
019: *
020: */
021: public class AttribBits {
022: /**
023: * Advisory, read-only bit. This bit is not part of the access
024: * control information on the file, but is rather an advisory field
025: * indicating that the file should not be written.
026: */
027: public static final int SSH_FILEXFER_ATTR_FLAGS_READONLY = 0x00000001;
028:
029: /**
030: * The file is part of the operating system.
031: */
032: public static final int SSH_FILEXFER_ATTR_FLAGS_SYSTEM = 0x00000002;
033:
034: /**
035: * File SHOULD NOT be shown to user unless specifically requested.
036: * For example, most UNIX systems SHOULD set this bit if the filename
037: * begins with a 'period'. This bit may be read-only (see section 5.4 of
038: * the SFTP standard draft). Most UNIX systems will not allow this to be
039: * changed.
040: */
041: public static final int SSH_FILEXFER_ATTR_FLAGS_HIDDEN = 0x00000004;
042:
043: /**
044: * This attribute applies only to directories. This attribute is
045: * always read-only, and cannot be modified. This attribute means
046: * that files and directory names in this directory should be compared
047: * without regard to case.
048: * <p>
049: * It is recommended that where possible, the server's filesystem be
050: * allowed to do comparisons. For example, if a client wished to prompt
051: * a user before overwriting a file, it should not compare the new name
052: * with the previously retrieved list of names in the directory. Rather,
053: * it should first try to create the new file by specifying
054: * SSH_FXF_CREATE_NEW flag. Then, if this fails and returns
055: * SSH_FX_FILE_ALREADY_EXISTS, it should prompt the user and then retry
056: * the create specifying SSH_FXF_CREATE_TRUNCATE.
057: * <p>
058: * Unless otherwise specified, filenames are assumed to be case sensitive.
059: */
060: public static final int SSH_FILEXFER_ATTR_FLAGS_CASE_INSENSITIVE = 0x00000008;
061:
062: /**
063: * The file should be included in backup / archive operations.
064: */
065: public static final int SSH_FILEXFER_ATTR_FLAGS_ARCHIVE = 0x00000010;
066:
067: /**
068: * The file is stored on disk using file-system level transparent
069: * encryption. This flag does not affect the file data on the wire
070: * (for either READ or WRITE requests.)
071: */
072: public static final int SSH_FILEXFER_ATTR_FLAGS_ENCRYPTED = 0x00000020;
073:
074: /**
075: * The file is stored on disk using file-system level transparent
076: * compression. This flag does not affect the file data on the wire.
077: */
078: public static final int SSH_FILEXFER_ATTR_FLAGS_COMPRESSED = 0x00000040;
079:
080: /**
081: * The file is a sparse file; this means that file blocks that have
082: * not been explicitly written are not stored on disk. For example, if
083: * a client writes a buffer at 10 M from the beginning of the file,
084: * the blocks between the previous EOF marker and the 10 M offset would
085: * not consume physical disk space.
086: * <p>
087: * Some servers may store all files as sparse files, in which case
088: * this bit will be unconditionally set. Other servers may not have
089: * a mechanism for determining if the file is sparse, and so the file
090: * MAY be stored sparse even if this flag is not set.
091: */
092: public static final int SSH_FILEXFER_ATTR_FLAGS_SPARSE = 0x00000080;
093:
094: /**
095: * Opening the file without either the SSH_FXF_ACCESS_APPEND_DATA or
096: * the SSH_FXF_ACCESS_APPEND_DATA_ATOMIC flag (see section 8.1.1.3
097: * of the SFTP standard draft) MUST result in an
098: * SSH_FX_INVALID_PARAMETER error.
099: */
100: public static final int SSH_FILEXFER_ATTR_FLAGS_APPEND_ONLY = 0x00000100;
101:
102: /**
103: * The file cannot be deleted or renamed, no hard link can be created
104: * to this file, and no data can be written to the file.
105: * <p>
106: * This bit implies a stronger level of protection than
107: * SSH_FILEXFER_ATTR_FLAGS_READONLY, the file permission mask or ACLs.
108: * Typically even the superuser cannot write to immutable files, and
109: * only the superuser can set or remove the bit.
110: */
111: public static final int SSH_FILEXFER_ATTR_FLAGS_IMMUTABLE = 0x00000200;
112:
113: /**
114: * When the file is modified, the changes are written synchronously
115: * to the disk.
116: */
117: public static final int SSH_FILEXFER_ATTR_FLAGS_SYNC = 0x00000400;
118:
119: /**
120: * The server MAY include this bit in a directory listing or realpath
121: * response. It indicates there was a failure in the translation to UTF-8.
122: * If this flag is included, the server SHOULD also include the
123: * UNTRANSLATED_NAME attribute.
124: */
125: public static final int SSH_FILEXFER_ATTR_FLAGS_TRANSLATION_ERR = 0x00000800;
126:
127: }
|