SSH FTP file attributes

The same encoding is used both when sending and returning file attributes from the server.  When sending it to the server, the flags field specifies which attributes are included, and the server will use default values for the remaining attributes or will not modify the values of remaining attributes.  When receiving attributes from the server, the flags specify which attributes are included in the returned data.  The server normally returns all attributes known to it.

uint32 flags  
uint64 size present only if flag SSH_FILEXFER_ATTR_SIZE
uint32 uid present only if flag SSH_FILEXFER_ATTR_UIDGID
uint32 gid present only if flag SSH_FILEXFER_ATTR_UIDGID
uint32 permissions present only if flag SSH_FILEXFER_ATTR_PERMISSIONS
uint32 atime present only if flag SSH_FILEXFER_ACMODTIME
uint32 mtime present only if flag SSH_FILEXFER_ACMODTIME
uint32 extended_count present only if flag SSH_FILEXFER_ATTR_EXTENDED
string extended_type  
string extended_data ...more extended data (extended_type - extended_data pairs), so that number of pairs equals extended_count

The flags bits are defined to have the following values:

SSH_FILEXFER_ATTR_SIZE 0x00000001
SSH_FILEXFER_ATTR_UIDGID 0x00000002
SSH_FILEXFER_ATTR_PERMISSIONS 0x00000004
SSH_FILEXFER_ATTR_ACMODTIME 0x00000008
SSH_FILEXFER_ATTR_EXTENDED 0x80000000