Structures

From Libssh2

Accessible Structures

typedef struct {
    unsigned long flags;

    libssh2_uint64_t filesize;
    unsigned long uid, gid, permissions, atime, mtime;
} LIBSSH2_SFTP_ATTRIBUTES;

/* SFTP attribute flag bits */
#define LIBSSH2_SFTP_ATTR_SIZE           0x0001
#define LIBSSH2_SFTP_ATTR_UIDGID         0x0002
#define LIBSSH2_SFTP_ATTR_PERMISSIONS    0x0004
#define LIBSSH2_SFTP_ATTR_ACMODTIME      0x0008

Used by libssh2_sftp_readdir(), libssh2_sftp_fstat(), libssh2_sftp_fsetstat(), libssh2_sftp_stat(), libssh2_sftp_lstat(), and libssh2_sftp_setstat() to retreive and set file metadata. If a given bit in flags is set, then the corresponding field(s) is/should-be set to meaningful values.

The permissions field is a bit-set with the same interpretation as the st_mode field of a POSIX stat struct. In particular, the high-order bits determine the file type (regular, directory, symlink, etc.) Use the masks and macros declared in <sys/stat.h> to interpret the file type.

typedef struct {
    char *name;
    unsigned long name_len;
    char *value;
    unsigned long value_len;
    char mandatory;
} libssh2_publickey_attribute;

typedef struct {
    unsigned char *packet;

    unsigned char *name;
    unsigned long name_len;
    unsigned char *blob;
    unsigned long blob_len;
    unsigned long num_attrs;
    libssh2_publickey_attribute *attrs;
} libssh2_publickey_list;

libssh2_publickey_list is an individual publickey typically used in a vector (hence the slightly misleading name) with the libssh2_publickey_*() family of functions. The name element typically corresponds to a comment field as implemented at the server while blob contains the raw key data. For each key instance, an arbitrary number of attributes may be included.

Opaque Structures

  • LIBSSH2_SESSION
    Manages the secsh-transport layer of a given SSH2 session. LIBSSH2_SESSION objects are the controling structures for all LIBSSH2_CHANNELs.
    • LIBSSH2_CHANNEL
      An individual communication sub-stream between the client and server.
      • LIBSSH2_SFTP
        A specialized form of LIBSSH2_CHANNEL implementing the secsh-filexfer protocol.
        • LIBSSH2_SFTP_HANDLE
          An open file or directory handle used the SFTP subsystem.
      • LIBSSH2_PUBLICKEY
        A specialized form of LIBSSH2_CHANNEL implementing the publickey subsystem.
      • LIBSSH2_LISTENER
        A specialized form of LIBSSH2_CHANNEL implementing remote port forwarding listeners.

Internal Structures

  • LIBSSH2_PACKET
    An indivudual transmission unit sent to or received from the remote end.
  • LIBSSH2_PACKET_BRIGADE
    Linked-list element containing buffered/unhandled packets.
  • LIBSSH2_CHANNEL_BRIGADE
    Linked list element containing active channels within a given stream.
  • LIBSSH2_KEX_METHOD
    Defines a key exchange handler (e.g. diffie-hellman-group1-sha1)
  • LIBSSH2_HOSTKEY_METHOD
    Defines a hostkey exchange handler (e.g. ssh-rsa or ssh-dsa)
  • LIBSSH2_MAC_METHOD
    Defines a message authentication handler (e.g. hmac-sha1)
  • LIBSSH2_CRYPT_METHOD
    Defines a symmetric crypto handler (e.g. aes256-cbc)
  • LIBSSH2_COMP_METHOD
    Defines a compression handler (e.g. zlib)