Constants

From Libssh2

Contents

Method Types

/* libssh2_session_method_pref() constants */
#define LIBSSH2_METHOD_KEX          0
#define LIBSSH2_METHOD_HOSTKEY      1
#define LIBSSH2_METHOD_CRYPT_CS     2
#define LIBSSH2_METHOD_CRYPT_SC     3
#define LIBSSH2_METHOD_MAC_CS       4
#define LIBSSH2_METHOD_MAC_SC       5
#define LIBSSH2_METHOD_COMP_CS      6
#define LIBSSH2_METHOD_COMP_SC      7
#define LIBSSH2_METHOD_LANG_CS      8
#define LIBSSH2_METHOD_LANG_SC      9


Disconnect Reasons

/* Disconnect Codes (defined by SSH protocol) */
#define SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT          1
#define SSH_DISCONNECT_PROTOCOL_ERROR                       2
#define SSH_DISCONNECT_KEY_EXCHANGE_FAILED                  3
#define SSH_DISCONNECT_RESERVED                             4
#define SSH_DISCONNECT_MAC_ERROR                            5
#define SSH_DISCONNECT_COMPRESSION_ERROR                    6
#define SSH_DISCONNECT_SERVICE_NOT_AVAILABLE                7
#define SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED       8
#define SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE              9
#define SSH_DISCONNECT_CONNECTION_LOST                      10
#define SSH_DISCONNECT_BY_APPLICATION                       11
#define SSH_DISCONNECT_TOO_MANY_CONNECTIONS                 12
#define SSH_DISCONNECT_AUTH_CANCELLED_BY_USER               13
#define SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE       14
#define SSH_DISCONNECT_ILLEGAL_USER_NAME                    15

Session Flags

/* session.flags bits */
#define LIBSSH2_FLAG_SIGPIPE        0x00000001

Channel

#define LIBSSH2_CHANNEL_WINDOW_DEFAULT                65536
#define LIBSSH2_CHANNEL_PACKET_DEFAULT                16384
#define LIBSSH2_CHANNEL_MINADJUST                     1024
/* Defaults for pty requests */
#define LIBSSH2_TERM_WIDTH                            80
#define LIBSSH2_TERM_HEIGHT                           24
#define LIBSSH2_TERM_WIDTH_PX                         0
#define LIBSSH2_TERM_HEIGHT_PX                        0

/* SSH2 proto defines this as a standard extended data stream ID */
#define SSH_EXTENDED_DATA_STDERR                      1

/* Extended Data Handling */
#define LIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL          0
#define LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE          1
#define LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE           2

/* Group flushing for libssh2_channel_flush_ex() */
#define LIBSSH2_CHANNEL_FLUSH_EXTENDED_DATA           -1
#define LIBSSH2_CHANNEL_FLUSH_ALL                     -2

Polling

/* Poll FD Descriptor Types */
#define LIBSSH2_POLLFD_SOCKET           1
#define LIBSSH2_POLLFD_CHANNEL          2
#define LIBSSH2_POLLFD_LISTENER         3
/* Note: Win32 Doesn't actually have a poll() implementation,
   so some of these values are faked with select() data */
/* Poll FD events/revents -- Match sys/poll.h where possible */

/* Data available to be read or connection available -- All */
#define LIBSSH2_POLLFD_POLLIN           0x0001

/* Priority data available to be read -- Socket only */
#define LIBSSH2_POLLFD_POLLPRI          0x0002

/* Extended data available to be read -- Channel only */
#define LIBSSH2_POLLFD_POLLEXT          0x0002

/* Can may be written -- Socket/Channel */
#define LIBSSH2_POLLFD_POLLOUT          0x0004
/* revents only */

/* Error Condition -- Socket */
#define LIBSSH2_POLLFD_POLLERR          0x0008

/* HangUp/EOF -- Socket */
#define LIBSSH2_POLLFD_POLLHUP          0x0010

/* Session Disconnect */
#define LIBSSH2_POLLFD_SESSION_CLOSED   0x0010

/* Invalid request -- Socket Only */
#define LIBSSH2_POLLFD_POLLNVAL         0x0020

/* Exception Condition -- Socket/Win32 */
#define LIBSSH2_POLLFD_POLLEX           0x0040

/* Channel Disconnect */
#define LIBSSH2_POLLFD_CHANNEL_CLOSED   0x0080

/* Listener Disconnect */
#define LIBSSH2_POLLFD_LISTENER_CLOSED  0x0080

SFTP

#define LIBSSH2_SFTP_VERSION                3
#define LIBSSH2_SFTP_PACKET_MAXLEN          40000
/* Flags for open_ex() */
#define LIBSSH2_SFTP_OPENFILE               0
#define LIBSSH2_SFTP_OPENDIR                1

/* Flags for rename_ex() */
#define LIBSSH2_SFTP_RENAME_OVERWRITE       0x0001
#define LIBSSH2_SFTP_RENAME_ATOMIC          0x0002
#define LIBSSH2_SFTP_RENAME_NATIVE          0x0004

/* Flags for stat_ex() */
#define LIBSSH2_SFTP_STAT                   0
#define LIBSSH2_SFTP_LSTAT                  1
#define LIBSSH2_SFTP_SETSTAT                2

/* Flags for symlink_ex() */
#define LIBSSH2_SFTP_SYMLINK                0
#define LIBSSH2_SFTP_READLINK               1
#define LIBSSH2_SFTP_REALPATH               2

/* SFTP File Transfer Flags -- (e.g. flags parameter to sftp_open()) */
 * Danger will robinson... APPEND doesn't have any effect on OpenSSH servers */
#define LIBSSH2_FXF_READ                    0x0001
#define LIBSSH2_FXF_WRITE                   0x0002
#define LIBSSH2_FXF_APPEND                  0x0004
#define LIBSSH2_FXF_CREAT                   0x0008
#define LIBSSH2_FXF_TRUNC                   0x0010
#define LIBSSH2_FXF_EXCL                    0x0020
/* SFTP Status Codes (returned by libssh2_sftp_last_error() ) */
#define LIBSSH2_FX_OK                       0
#define LIBSSH2_FX_EOF                      1
#define LIBSSH2_FX_NO_SUCH_FILE             2
#define LIBSSH2_FX_PERMISSION_DENIED        3
#define LIBSSH2_FX_FAILURE                  4
#define LIBSSH2_FX_BAD_MESSAGE              5
#define LIBSSH2_FX_NO_CONNECTION            6
#define LIBSSH2_FX_CONNECTION_LOST          7
#define LIBSSH2_FX_OP_UNSUPPORTED           8
#define LIBSSH2_FX_INVALID_HANDLE           9
#define LIBSSH2_FX_NO_SUCH_PATH             10
#define LIBSSH2_FX_FILE_ALREADY_EXISTS      11
#define LIBSSH2_FX_WRITE_PROTECT            12
#define LIBSSH2_FX_NO_MEDIA                 13
#define LIBSSH2_FX_NO_SPACE_ON_FILESYSTEM   14
#define LIBSSH2_FX_QUOTA_EXCEEDED           15
#define LIBSSH2_FX_UNKNOWN_PRINCIPLE        16
#define LIBSSH2_FX_LOCK_CONFlICT            17
#define LIBSSH2_FX_DIR_NOT_EMPTY            18
#define LIBSSH2_FX_NOT_A_DIRECTORY          19
#define LIBSSH2_FX_INVALID_FILENAME         20
#define LIBSSH2_FX_LINK_LOOP                21

Other

#define LIBSSH2_VERSION            "0.12" /* Changed with each release */
#define LIBSSH2_SSH_BANNER         "SSH-2.0-libssh2_" LIBSSH2_VERSION