IP*Works! SSH V9 - Online Help
IP*Works! SSH V9
Questions / Feedback?

FileOpen Event

Fires when a client wants to open or create a file.

Syntax

[VB.NET]
Public Event OnFileOpen As OnFileOpenHandler
[C#]
public event OnFileOpenHandler OnFileOpen;

public delegate void OnFileOpenHandler(object sender, SftpserverFileOpenEventArgs e);

class SftpserverFileOpenEventArgs : EventArgs {
  string ConnectionId {get;}
  string User {get;}
  string Path {get;}
  int DesiredAccess {get;}
  int Flags {get;}
  int FileType {get;}
  long FileSize {get;}
  string FileOwner {get;}
  string FileGroup {get;}
  int FilePermissions {get;}
  long FileATime {get;}
  long FileCreateTime {get;}
  long FileMTime {get;}
  int FileAttribBits {get;}
  int FileAttribBitsValid {get;}
  string OtherAttributes {get;}
  string Handle {get; set;}
  int StatusCode {get; set;}
}

Remarks

The Path parameter specifies the path and name of the file to open, create. If the operation can be completed successfully, the Handle parameter should be set to the handle identifying the opened file.

The Flags parameter specifies file creation and locking options as a bitmask. This may be a combination of the following values:

  • SSH_FXF_READ (0x00000001)
  • SSH_FXF_WRITE (0x00000002)
  • SSH_FXF_APPEND (0x00000004)
  • SSH_FXF_CREAT (0x00000008)
  • SSH_FXF_TRUNC (0x00000010)
  • SSH_FXF_EXCL (0x00000020)

The DesiredAccess parameter is a bitmask containing a combination of values from the ace-mask flags (Only for protocol versions 4 and up). This may be a combination of the following values:

  • ACE4_READ_DATA (0x00000001)
  • ACE4_LIST_DIRECTORY (0x00000001)
  • ACE4_WRITE_DATA (0x00000002)
  • ACE4_ADD_FILE (0x00000002)
  • ACE4_APPEND_DATA (0x00000004)
  • ACE4_ADD_SUBDIRECTORY (0x00000004)
  • ACE4_READ_NAMED_ATTRS (0x00000008)
  • ACE4_WRITE_NAMED_ATTRS (0x00000010)
  • ACE4_EXECUTE (0x00000020)
  • ACE4_DELETE_CHILD (0x00000040)
  • ACE4_READ_ATTRIBUTES (0x00000080)
  • ACE4_WRITE_ATTRIBUTES (0x00000100)
  • ACE4_DELETE (0x00010000)
  • ACE4_READ_ACL (0x00020000)
  • ACE4_WRITE_ACL (0x00040000)
  • ACE4_WRITE_OWNER (0x00080000)
  • ACE4_SYNCHRONIZE (0x00100000)
Please see RFC 3010 for more information on the semantics of these values.

File/Directory Attributes are specified using the following values:

FileType: The type of file. Can be one of the following values:

  • SSH_FILEXFER_TYPE_REGULAR (1)
  • SSH_FILEXFER_TYPE_DIRECTORY (2)
  • SSH_FILEXFER_TYPE_SYMLINK (3)
  • SSH_FILEXFER_TYPE_SPECIAL (4)
  • SSH_FILEXFER_TYPE_UNKNOWN (5)
  • SSH_FILEXFER_TYPE_SOCKET (6)
  • SSH_FILEXFER_TYPE_CHAR_DEVICE (7)
  • SSH_FILEXFER_TYPE_BLOCK_DEVICE (8)
  • SSH_FILEXFER_TYPE_FIFO (9)

FileSize: The file size, in bytes.

FileOwner: The file owner. If the ProtocolVersion configuration option is "3" (default), this field should be a numeric Unix-like user identifier. V4-V6 of the SFTP Protocol allow an arbitrary string.

FileGroup: The file owner group. If the ProtocolVersion configuration option is "3" (default), this field should be a numeric Unix-like group identifier. V4-V6 of the SFTP Protocol allow an arbitrary string.

FilePermissions: The POSIX-style file permissions.

FileATime: The file last-access time, in milliseconds since Jan 1, 1970 in UTC.

FileCreateTime: The file creation time, in milliseconds since Jan 1, 1970 in UTC.

FileMTime: The file last-modified time, in milliseconds since Jan 1, 1970 in UTC.

FileAttrBits: The file attributes, as a combination of the following values:

  • SSH_FILEXFER_ATTR_FLAGS_READONLY (0x00000001)
  • SSH_FILEXFER_ATTR_FLAGS_SYSTEM (0x00000002)
  • SSH_FILEXFER_ATTR_FLAGS_HIDDEN (0x00000004)
  • SSH_FILEXFER_ATTR_FLAGS_CASE_INSENSITIVE (0x00000008)
  • SSH_FILEXFER_ATTR_FLAGS_ARCHIVE (0x00000010)
  • SSH_FILEXFER_ATTR_FLAGS_ENCRYPTED (0x00000020)
  • SSH_FILEXFER_ATTR_FLAGS_COMPRESSED (0x00000040)
  • SSH_FILEXFER_ATTR_FLAGS_SPARSE (0x00000080)
  • SSH_FILEXFER_ATTR_FLAGS_APPEND_ONLY (0x00000100)
  • SSH_FILEXFER_ATTR_FLAGS_IMMUTABLE (0x00000200)
  • SSH_FILEXFER_ATTR_FLAGS_SYNC (0x00000400)
  • SSH_FILEXFER_ATTR_FLAGS_TRANSLATION_ERR (0x00000800)

FileAttrBitsValid: A mask specifying which bits in FileAttrBits are supported by the server.

OtherAttributes: A semi-colon (';') delimited list of Name=Value pairs of other attributes supported by SFTP. These include:

  • MIMEType (String)
  • AllocationSize (64-bit int)
  • ATimeNS (int): ATime nanoseconds
  • CreateTimeNS (int): CreateTime nanoseconds
  • MTimeNS (int): MTime nanoseconds
  • TextHint (8-bit int)
  • LinkCount (int)
  • UntranslatedName (String)

FileMimeType: The MIME type of the file.

Valid status codes are:

  • SSH_FX_OK 0
  • SSH_FX_EOF 1
  • SSH_FX_NO_SUCH_FILE 2
  • SSH_FX_PERMISSION_DENIED 3
  • SSH_FX_FAILURE 4
  • SSH_FX_BAD_MESSAGE 5
  • SSH_FX_NO_CONNECTION 6
  • SSH_FX_CONNECTION_LOST 7
  • SSH_FX_OP_UNSUPPORTED 8
  • SSH_FX_INVALID_HANDLE 9
  • SSH_FX_NO_SUCH_PATH 10
  • SSH_FX_FILE_ALREADY_EXISTS 11
  • SSH_FX_WRITE_PROTECT 12
  • SSH_FX_NO_MEDIA 13
  • SSH_FX_NO_SPACE_ON_FILESYSTEM 14
  • SSH_FX_QUOTA_EXCEEDED 15
  • SSH_FX_UNKNOWN_PRINCIPAL 16
  • SSH_FX_LOCK_CONFLICT 17
  • SSH_FX_DIR_NOT_EMPTY 18
  • SSH_FX_NOT_A_DIRECTORY 19
  • SSH_FX_INVALID_FILENAME 20
  • SSH_FX_LINK_LOOP 21
  • SSH_FX_CANNOT_DELETE 22
  • SSH_FX_INVALID_PARAMETER 23
  • SSH_FX_FILE_IS_A_DIRECTORY 24
  • SSH_FX_BYTE_RANGE_LOCK_CONFLICT 25
  • SSH_FX_BYTE_RANGE_LOCK_REFUSED 26
  • SSH_FX_DELETE_PENDING 27
  • SSH_FX_FILE_CORRUPT 28
  • SSH_FX_OWNER_INVALID 29
  • SSH_FX_GROUP_INVALID 30
  • SSH_FX_NO_MATCHING_BYTE_RANGE_LOCK 31

 
 
Copyright (c) 2017 /n software inc. - All rights reserved.
Build 9.0.6240.0