Low-level bindings
The symbols documented on this page have all been generated automatically, along with their documentation. Most of them are pure wrappers around the C functions, but some of them also do things like return-type conversion to a Julia type (e.g. converting const char*
to String
).
Where possible the original documentation from the libssh headers has been included or a link generated to the upstream documentation. Note that some links may not work if the upstream documentation and this page have been generated against different versions, and some symbols in the Other section should be elsewhere.
The symbols on this page, including the auto-generated wrappers, are unsafe. Improper use may cause memory corruption (including segfaults) and weeping and gnashing of teeth. Check the upstream documentation carefully when using them, and test your code thoroughly.
LibSSH.lib.ssh_finalize
— Methodssh_finalize()
LibSSH.lib.ssh_init
— Methodssh_init()
LibSSH.lib.SSH_AGAIN
— ConstantValue returned when the function is in non-blocking mode and must be called again.
LibSSH.lib.SSH_AUTH_METHOD_GSSAPI_MIC
— ConstantAuth method enum (upstream documentation).
LibSSH.lib.SSH_AUTH_METHOD_HOSTBASED
— ConstantAuth method enum (upstream documentation).
LibSSH.lib.SSH_AUTH_METHOD_INTERACTIVE
— ConstantAuth method enum (upstream documentation).
LibSSH.lib.SSH_AUTH_METHOD_NONE
— ConstantAuth method enum (upstream documentation).
LibSSH.lib.SSH_AUTH_METHOD_PASSWORD
— ConstantAuth method enum (upstream documentation).
LibSSH.lib.SSH_AUTH_METHOD_PUBLICKEY
— ConstantAuth method enum (upstream documentation).
LibSSH.lib.SSH_AUTH_METHOD_UNKNOWN
— ConstantAuth method enum (upstream documentation).
LibSSH.lib.SSH_ERROR
— ConstantValue returned if an error occurred.
LibSSH.lib.SSH_OK
— ConstantValue returned on success.
LibSSH.lib.SSH_PACKET_NOT_USED
— ConstantAuthentication
LibSSH.lib.ssh_set_agent_channel
— Methodssh_set_agent_channel(session, channel)
LibSSH.lib.ssh_set_agent_socket
— Methodssh_set_agent_socket(session, fd)
LibSSH.lib.ssh_userauth_agent
— Methodssh_userauth_agent(session, username)
LibSSH.lib.ssh_userauth_gssapi
— Methodssh_userauth_gssapi(session)
LibSSH.lib.ssh_userauth_kbdint
— Methodssh_userauth_kbdint(session, user, submethods)
LibSSH.lib.ssh_userauth_kbdint_getanswer
— Methodssh_userauth_kbdint_getanswer(session, i; throw = true)
Auto-generated wrapper around ssh_userauth_kbdint_getanswer()
.
LibSSH.lib.ssh_userauth_kbdint_getinstruction
— Methodssh_userauth_kbdint_getinstruction(session)
LibSSH.lib.ssh_userauth_kbdint_getname
— Methodssh_userauth_kbdint_getname(session; throw = true)
Auto-generated wrapper around ssh_userauth_kbdint_getname()
.
LibSSH.lib.ssh_userauth_kbdint_getnanswers
— Methodssh_userauth_kbdint_getnanswers(session)
LibSSH.lib.ssh_userauth_kbdint_getnprompts
— Methodssh_userauth_kbdint_getnprompts(session)
LibSSH.lib.ssh_userauth_kbdint_getprompt
— Methodssh_userauth_kbdint_getprompt(session, i, echo; throw = true)
Auto-generated wrapper around ssh_userauth_kbdint_getprompt()
.
LibSSH.lib.ssh_userauth_kbdint_setanswer
— Methodssh_userauth_kbdint_setanswer(session, i, answer)
LibSSH.lib.ssh_userauth_list
— Methodssh_userauth_list(session, username)
LibSSH.lib.ssh_userauth_none
— Methodssh_userauth_none(session, username)
LibSSH.lib.ssh_userauth_password
— Methodssh_userauth_password(session, username, password)
LibSSH.lib.ssh_userauth_publickey
— Methodssh_userauth_publickey(session, username, privkey)
LibSSH.lib.ssh_userauth_publickey_auto
— Methodssh_userauth_publickey_auto(session, username, passphrase)
LibSSH.lib.ssh_userauth_publickey_auto_get_current_identity
— Methodssh_userauth_publickey_auto_get_current_identity(session, value)
LibSSH.lib.ssh_userauth_try_publickey
— Methodssh_userauth_try_publickey(session, username, pubkey)
Buffers
LibSSH.lib.ssh_buffer_add_data
— Methodssh_buffer_add_data(buffer, data, len)
LibSSH.lib.ssh_buffer_free
— Methodssh_buffer_free(buffer)
LibSSH.lib.ssh_buffer_get
— Methodssh_buffer_get(buffer)
LibSSH.lib.ssh_buffer_get_data
— Methodssh_buffer_get_data(buffer, data, requestedlen)
LibSSH.lib.ssh_buffer_get_len
— Methodssh_buffer_get_len(buffer)
LibSSH.lib.ssh_buffer_new
— Methodssh_buffer_new()
LibSSH.lib.ssh_buffer_reinit
— Methodssh_buffer_reinit(buffer)
Callbacks
LibSSH.lib.ssh_add_channel_callbacks
— Methodssh_add_channel_callbacks(channel, cb)
Add channel callback functions
This function will add channel callback functions to the channel callback list. Callbacks missing from a callback structure will be probed in the next on the list.
Arguments
channel
: The channel to set the callback structure.cb
: The callback structure itself.
Returns
SSH_OK
on success, SSH_ERROR
on error.
See also
LibSSH.lib.ssh_remove_channel_callbacks
— Methodssh_remove_channel_callbacks(channel, cb)
Remove a channel callback.
The channel has been added with ssh_add_channel_callbacks
or ssh_set_channel_callbacks
in this case.
Arguments
channel
: The channel to remove the callback structure from.cb
: The callback structure to remove
Returns
LibSSH.lib.ssh_set_callbacks
— Methodssh_set_callbacks(session, cb)
Set the session callback functions.
This functions sets the callback structure to use your own callback functions for auth, logging and status.
Note, that the callback structure is not copied into the session so it needs to be valid for the whole session lifetime.
struct ssh_callbacks_struct cb = {
+Low-level bindings · LibSSH Low-level bindings
The symbols documented on this page have all been generated automatically, along with their documentation. Most of them are pure wrappers around the C functions, but some of them also do things like return-type conversion to a Julia type (e.g. converting const char*
to String
).
Where possible the original documentation from the libssh headers has been included or a link generated to the upstream documentation. Note that some links may not work if the upstream documentation and this page have been generated against different versions, and some symbols in the Other section should be elsewhere.
Warning The symbols on this page, including the auto-generated wrappers, are unsafe. Improper use may cause memory corruption (including segfaults) and weeping and gnashing of teeth. Check the upstream documentation carefully when using them, and test your code thoroughly.
LibSSH.lib.ssh_finalize
— Methodssh_finalize()
sourceLibSSH.lib.ssh_init
— Methodssh_init()
sourceLibSSH.lib.SSH_AGAIN
— ConstantValue returned when the function is in non-blocking mode and must be called again.
sourceLibSSH.lib.SSH_AUTH_METHOD_GSSAPI_MIC
— ConstantAuth method enum (upstream documentation).
sourceLibSSH.lib.SSH_AUTH_METHOD_HOSTBASED
— ConstantAuth method enum (upstream documentation).
sourceLibSSH.lib.SSH_AUTH_METHOD_INTERACTIVE
— ConstantAuth method enum (upstream documentation).
sourceLibSSH.lib.SSH_AUTH_METHOD_NONE
— ConstantAuth method enum (upstream documentation).
sourceLibSSH.lib.SSH_AUTH_METHOD_PASSWORD
— ConstantAuth method enum (upstream documentation).
sourceLibSSH.lib.SSH_AUTH_METHOD_PUBLICKEY
— ConstantAuth method enum (upstream documentation).
sourceLibSSH.lib.SSH_AUTH_METHOD_UNKNOWN
— ConstantAuth method enum (upstream documentation).
sourceLibSSH.lib.SSH_ERROR
— ConstantValue returned if an error occurred.
sourceLibSSH.lib.SSH_OK
— ConstantValue returned on success.
sourceLibSSH.lib.SSH_PACKET_NOT_USED
— Constantsource Authentication
LibSSH.lib.ssh_set_agent_channel
— Methodssh_set_agent_channel(session, channel)
sourceLibSSH.lib.ssh_set_agent_socket
— Methodssh_set_agent_socket(session, fd)
sourceLibSSH.lib.ssh_userauth_agent
— Methodssh_userauth_agent(session, username)
sourceLibSSH.lib.ssh_userauth_gssapi
— Methodssh_userauth_gssapi(session)
sourceLibSSH.lib.ssh_userauth_kbdint
— Methodssh_userauth_kbdint(session, user, submethods)
sourceLibSSH.lib.ssh_userauth_kbdint_getanswer
— Methodssh_userauth_kbdint_getanswer(session, i; throw = true)
Auto-generated wrapper around ssh_userauth_kbdint_getanswer()
.
sourceLibSSH.lib.ssh_userauth_kbdint_getinstruction
— Methodssh_userauth_kbdint_getinstruction(session)
sourceLibSSH.lib.ssh_userauth_kbdint_getname
— Methodssh_userauth_kbdint_getname(session; throw = true)
Auto-generated wrapper around ssh_userauth_kbdint_getname()
.
sourceLibSSH.lib.ssh_userauth_kbdint_getnanswers
— Methodssh_userauth_kbdint_getnanswers(session)
sourceLibSSH.lib.ssh_userauth_kbdint_getnprompts
— Methodssh_userauth_kbdint_getnprompts(session)
sourceLibSSH.lib.ssh_userauth_kbdint_getprompt
— Methodssh_userauth_kbdint_getprompt(session, i, echo; throw = true)
Auto-generated wrapper around ssh_userauth_kbdint_getprompt()
.
sourceLibSSH.lib.ssh_userauth_kbdint_setanswer
— Methodssh_userauth_kbdint_setanswer(session, i, answer)
sourceLibSSH.lib.ssh_userauth_list
— Methodssh_userauth_list(session, username)
sourceLibSSH.lib.ssh_userauth_none
— Methodssh_userauth_none(session, username)
sourceLibSSH.lib.ssh_userauth_password
— Methodssh_userauth_password(session, username, password)
sourceLibSSH.lib.ssh_userauth_publickey
— Methodssh_userauth_publickey(session, username, privkey)
sourceLibSSH.lib.ssh_userauth_publickey_auto
— Methodssh_userauth_publickey_auto(session, username, passphrase)
sourceLibSSH.lib.ssh_userauth_publickey_auto_get_current_identity
— Methodssh_userauth_publickey_auto_get_current_identity(session, value)
sourceLibSSH.lib.ssh_userauth_try_publickey
— Methodssh_userauth_try_publickey(session, username, pubkey)
sourceBuffers
LibSSH.lib.ssh_buffer_add_data
— Methodssh_buffer_add_data(buffer, data, len)
sourceLibSSH.lib.ssh_buffer_free
— Methodssh_buffer_free(buffer)
sourceLibSSH.lib.ssh_buffer_get
— Methodssh_buffer_get(buffer)
sourceLibSSH.lib.ssh_buffer_get_data
— Methodssh_buffer_get_data(buffer, data, requestedlen)
sourceLibSSH.lib.ssh_buffer_get_len
— Methodssh_buffer_get_len(buffer)
sourceLibSSH.lib.ssh_buffer_new
— Methodssh_buffer_new()
sourceLibSSH.lib.ssh_buffer_reinit
— Methodssh_buffer_reinit(buffer)
sourceCallbacks
LibSSH.lib.ssh_add_channel_callbacks
— Methodssh_add_channel_callbacks(channel, cb)
Add channel callback functions
This function will add channel callback functions to the channel callback list. Callbacks missing from a callback structure will be probed in the next on the list.
Arguments
channel
: The channel to set the callback structure.cb
: The callback structure itself.
Returns
SSH_OK
on success, SSH_ERROR
on error.
See also
sourceLibSSH.lib.ssh_remove_channel_callbacks
— Methodssh_remove_channel_callbacks(channel, cb)
Remove a channel callback.
The channel has been added with ssh_add_channel_callbacks
or ssh_set_channel_callbacks
in this case.
Arguments
channel
: The channel to remove the callback structure from.cb
: The callback structure to remove
Returns
sourceLibSSH.lib.ssh_set_callbacks
— Methodssh_set_callbacks(session, cb)
Set the session callback functions.
This functions sets the callback structure to use your own callback functions for auth, logging and status.
Note, that the callback structure is not copied into the session so it needs to be valid for the whole session lifetime.
struct ssh_callbacks_struct cb = {
.userdata = data,
.auth_function = my_auth_function
};
ssh_callbacks_init(&cb);
- ssh_set_callbacks(session, &cb);
Arguments
session
: The session to set the callback structure.cb
: The callback structure itself.
Returns
sourceLibSSH.lib.ssh_set_channel_callbacks
— Methodssh_set_channel_callbacks(channel, cb)
Set the channel callback functions.
This functions sets the callback structure to use your own callback functions for channel data and exceptions.
Note, that the structure is not copied to the channel structure so it needs to be valid as for the whole life of the channel or until it is removed with ssh_remove_channel_callbacks
().
struct ssh_channel_callbacks_struct cb = {
+ ssh_set_callbacks(session, &cb);
Arguments
session
: The session to set the callback structure.cb
: The callback structure itself.
Returns
sourceLibSSH.lib.ssh_set_channel_callbacks
— Methodssh_set_channel_callbacks(channel, cb)
Set the channel callback functions.
This functions sets the callback structure to use your own callback functions for channel data and exceptions.
Note, that the structure is not copied to the channel structure so it needs to be valid as for the whole life of the channel or until it is removed with ssh_remove_channel_callbacks
().
struct ssh_channel_callbacks_struct cb = {
.userdata = data,
.channel_data_function = my_channel_data_function
};
ssh_callbacks_init(&cb);
- ssh_set_channel_callbacks(channel, &cb);
Warning this function will not replace existing callbacks but set the new one atop of them.
Arguments
channel
: The channel to set the callback structure.cb
: The callback structure itself.
Returns
sourceLibSSH.lib.ssh_set_server_callbacks
— Methodssh_set_server_callbacks(session, cb)
Set the session server callback functions.
This functions sets the callback structure to use your own callback functions for user authentication, new channels and requests.
Note, that the structure is not copied to the session structure so it needs to be valid for the whole session lifetime.
struct ssh_server_callbacks_struct cb = {
+ ssh_set_channel_callbacks(channel, &cb);
Warning this function will not replace existing callbacks but set the new one atop of them.
Arguments
channel
: The channel to set the callback structure.cb
: The callback structure itself.
Returns
sourceLibSSH.lib.ssh_set_server_callbacks
— Methodssh_set_server_callbacks(session, cb)
Set the session server callback functions.
This functions sets the callback structure to use your own callback functions for user authentication, new channels and requests.
Note, that the structure is not copied to the session structure so it needs to be valid for the whole session lifetime.
struct ssh_server_callbacks_struct cb = {
.userdata = data,
.auth_password_function = my_auth_function
};
ssh_callbacks_init(&cb);
- ssh_set_server_callbacks(session, &cb);
Arguments
session
: The session to set the callback structure.cb
: The callback structure itself.
Returns
sourceChannel
LibSSH.lib.channel_read_buffer
— Methodchannel_read_buffer(channel, buffer, count, is_stderr)
sourceLibSSH.lib.ssh_channel_accept_forward
— Methodssh_channel_accept_forward(session, timeout_ms, destination_port)
sourceLibSSH.lib.ssh_channel_accept_x11
— Methodssh_channel_accept_x11(channel, timeout_ms)
sourceLibSSH.lib.ssh_channel_cancel_forward
— Methodssh_channel_cancel_forward(session, address, port)
sourceLibSSH.lib.ssh_channel_change_pty_size
— Methodssh_channel_change_pty_size(channel, cols, rows)
sourceLibSSH.lib.ssh_channel_close
— Methodssh_channel_close(channel)
sourceLibSSH.lib.ssh_channel_free
— Methodssh_channel_free(channel)
sourceLibSSH.lib.ssh_channel_get_exit_state
— Methodssh_channel_get_exit_state(channel, pexit_code, pexit_signal, pcore_dumped)
sourceLibSSH.lib.ssh_channel_get_exit_status
— Methodssh_channel_get_exit_status(channel)
sourceLibSSH.lib.ssh_channel_get_session
— Methodssh_channel_get_session(channel)
sourceLibSSH.lib.ssh_channel_is_closed
— Methodssh_channel_is_closed(channel)
sourceLibSSH.lib.ssh_channel_is_eof
— Methodssh_channel_is_eof(channel)
sourceLibSSH.lib.ssh_channel_is_open
— Methodssh_channel_is_open(channel)
sourceLibSSH.lib.ssh_channel_listen_forward
— Methodssh_channel_listen_forward(session, address, port, bound_port)
sourceLibSSH.lib.ssh_channel_new
— Methodssh_channel_new(session)
sourceLibSSH.lib.ssh_channel_open_auth_agent
— Methodssh_channel_open_auth_agent(channel)
sourceLibSSH.lib.ssh_channel_open_forward
— Methodssh_channel_open_forward(channel, remotehost, remoteport, sourcehost, localport)
sourceLibSSH.lib.ssh_channel_open_forward_port
— Methodssh_channel_open_forward_port(session, timeout_ms, destination_port, originator, originator_port)
sourceLibSSH.lib.ssh_channel_open_forward_unix
— Methodssh_channel_open_forward_unix(channel, remotepath, sourcehost, localport)
sourceLibSSH.lib.ssh_channel_open_reverse_forward
— Methodssh_channel_open_reverse_forward(channel, remotehost, remoteport, sourcehost, localport)
sourceLibSSH.lib.ssh_channel_open_session
— Methodssh_channel_open_session(channel)
sourceLibSSH.lib.ssh_channel_open_x11
— Methodssh_channel_open_x11(channel, orig_addr, orig_port)
sourceLibSSH.lib.ssh_channel_poll
— Methodssh_channel_poll(channel, is_stderr)
sourceLibSSH.lib.ssh_channel_poll_timeout
— Methodssh_channel_poll_timeout(channel, timeout, is_stderr)
sourceLibSSH.lib.ssh_channel_read
— Methodssh_channel_read(channel, dest, count, is_stderr)
sourceLibSSH.lib.ssh_channel_read_nonblocking
— Methodssh_channel_read_nonblocking(channel, dest, count, is_stderr)
sourceLibSSH.lib.ssh_channel_read_timeout
— Methodssh_channel_read_timeout(channel, dest, count, is_stderr, timeout_ms)
sourceLibSSH.lib.ssh_channel_request_auth_agent
— Methodssh_channel_request_auth_agent(channel)
sourceLibSSH.lib.ssh_channel_request_env
— Methodssh_channel_request_env(channel, name, value)
sourceLibSSH.lib.ssh_channel_request_exec
— Methodssh_channel_request_exec(channel, cmd)
sourceLibSSH.lib.ssh_channel_request_pty
— Methodssh_channel_request_pty(channel)
sourceLibSSH.lib.ssh_channel_request_pty_size_modes
— Methodssh_channel_request_pty_size_modes(channel, term, cols, rows, modes, modes_len)
sourceLibSSH.lib.ssh_channel_request_send_break
— Methodssh_channel_request_send_break(channel, length)
sourceLibSSH.lib.ssh_channel_request_send_exit_signal
— Methodssh_channel_request_send_exit_signal(channel, signum, core, errmsg, lang)
sourceLibSSH.lib.ssh_channel_request_send_exit_status
— Methodssh_channel_request_send_exit_status(channel, exit_status)
sourceLibSSH.lib.ssh_channel_request_send_signal
— Methodssh_channel_request_send_signal(channel, signum)
sourceLibSSH.lib.ssh_channel_request_sftp
— Methodssh_channel_request_sftp(channel)
sourceLibSSH.lib.ssh_channel_request_shell
— Methodssh_channel_request_shell(channel)
sourceLibSSH.lib.ssh_channel_request_subsystem
— Methodssh_channel_request_subsystem(channel, subsystem)
sourceLibSSH.lib.ssh_channel_request_x11
— Methodssh_channel_request_x11(channel, single_connection, protocol, cookie, screen_number)
sourceLibSSH.lib.ssh_channel_select
— Methodssh_channel_select(readchans, writechans, exceptchans, timeout)
sourceLibSSH.lib.ssh_channel_send_eof
— Methodssh_channel_send_eof(channel)
sourceLibSSH.lib.ssh_channel_set_blocking
— Methodssh_channel_set_blocking(channel, blocking)
sourceLibSSH.lib.ssh_channel_set_counter
— Methodssh_channel_set_counter(channel, counter)
sourceLibSSH.lib.ssh_channel_window_size
— Methodssh_channel_window_size(channel)
sourceLibSSH.lib.ssh_channel_write
— Methodssh_channel_write(channel, data, len)
sourceLibSSH.lib.ssh_channel_write_stderr
— Methodssh_channel_write_stderr(channel, data, len)
sourceErrors
LibSSH.lib.ssh_get_error
— Methodssh_get_error(error)
sourceLibSSH.lib.ssh_get_error_code
— Methodssh_get_error_code(error)
sourceHelpers
LibSSH.lib.ssh_basename
— Methodssh_basename(path)
sourceLibSSH.lib.ssh_dirname
— Methodssh_dirname(path)
sourceLibSSH.lib.ssh_get_hexa
— Methodssh_get_hexa(what, len)
sourceLibSSH.lib.ssh_get_random
— Methodssh_get_random(where, len, strong)
sourceLibSSH.lib.ssh_getpass
— Methodssh_getpass(prompt, buf, len, echo, verify)
sourceLibSSH.lib.ssh_mkdir
— Methodssh_mkdir(pathname, mode)
sourceLibSSH.lib.ssh_print_hexa
— Methodssh_print_hexa(descr, what, len)
sourceLibSSH.lib.ssh_version
— Methodssh_version(req_version)
sourceLogging
LibSSH.lib.ssh_get_log_callback
— Methodssh_get_log_callback()
Get the pointer to the logging callback function.
Returns
The pointer the the callback or NULL if none set.
sourceLibSSH.lib.ssh_get_log_level
— Methodssh_get_log_level()
sourceLibSSH.lib.ssh_get_log_userdata
— Methodssh_get_log_userdata()
sourceLibSSH.lib.ssh_set_log_callback
— Methodssh_set_log_callback(cb)
Set the logging callback function.
Arguments
cb
:[in] The callback to set.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.ssh_set_log_level
— Methodssh_set_log_level(level)
sourceLibSSH.lib.ssh_set_log_userdata
— Methodssh_set_log_userdata(data)
sourceMessage
LibSSH.lib.ssh_message_free
— Methodssh_message_free(msg)
sourceLibSSH.lib.ssh_message_get
— Methodssh_message_get(session)
sourceLibSSH.lib.ssh_message_subtype
— Methodssh_message_subtype(msg)
sourceLibSSH.lib.ssh_message_type
— Methodssh_message_type(msg)
sourcePolling
LibSSH.lib.ssh_event_add_connector
— Methodssh_event_add_connector(event, connector)
sourceLibSSH.lib.ssh_event_add_fd
— Methodssh_event_add_fd(event, fd, events, cb, userdata)
sourceLibSSH.lib.ssh_event_add_session
— Methodssh_event_add_session(event, session)
sourceLibSSH.lib.ssh_event_dopoll
— Methodssh_event_dopoll(event, timeout)
sourceLibSSH.lib.ssh_event_free
— Methodssh_event_free(event)
sourceLibSSH.lib.ssh_event_new
— Methodssh_event_new()
sourceLibSSH.lib.ssh_event_remove_connector
— Methodssh_event_remove_connector(event, connector)
sourceLibSSH.lib.ssh_event_remove_fd
— Methodssh_event_remove_fd(event, fd)
sourceLibSSH.lib.ssh_event_remove_session
— Methodssh_event_remove_session(event, session)
sourcePublic/private keys
LibSSH.lib.ssh_key_cmp
— Methodssh_key_cmp(k1, k2, what)
sourceLibSSH.lib.ssh_key_dup
— Methodssh_key_dup(key)
sourceLibSSH.lib.ssh_key_free
— Methodssh_key_free(key)
sourceLibSSH.lib.ssh_key_is_private
— Methodssh_key_is_private(k)
sourceLibSSH.lib.ssh_key_is_public
— Methodssh_key_is_public(k)
sourceLibSSH.lib.ssh_key_new
— Methodssh_key_new()
sourceLibSSH.lib.ssh_key_type
— Methodssh_key_type(key)
sourceLibSSH.lib.ssh_key_type_from_name
— Methodssh_key_type_from_name(name)
sourceLibSSH.lib.ssh_key_type_to_char
— Methodssh_key_type_to_char(type)
sourceLibSSH.lib.ssh_pki_copy_cert_to_privkey
— Methodssh_pki_copy_cert_to_privkey(cert_key, privkey)
sourceLibSSH.lib.ssh_pki_export_privkey_base64
— Methodssh_pki_export_privkey_base64(privkey, passphrase, auth_fn, auth_data, b64_key)
sourceLibSSH.lib.ssh_pki_export_privkey_base64_format
— Methodssh_pki_export_privkey_base64_format(privkey, passphrase, auth_fn, auth_data, b64_key, format)
sourceLibSSH.lib.ssh_pki_export_privkey_file
— Methodssh_pki_export_privkey_file(privkey, passphrase, auth_fn, auth_data, filename)
sourceLibSSH.lib.ssh_pki_export_privkey_file_format
— Methodssh_pki_export_privkey_file_format(privkey, passphrase, auth_fn, auth_data, filename, format)
sourceLibSSH.lib.ssh_pki_export_privkey_to_pubkey
— Methodssh_pki_export_privkey_to_pubkey(privkey, pkey)
sourceLibSSH.lib.ssh_pki_export_pubkey_base64
— Methodssh_pki_export_pubkey_base64(key, b64_key)
sourceLibSSH.lib.ssh_pki_export_pubkey_file
— Methodssh_pki_export_pubkey_file(key, filename)
sourceLibSSH.lib.ssh_pki_generate
— Methodssh_pki_generate(type, parameter, pkey)
sourceLibSSH.lib.ssh_pki_import_cert_base64
— Methodssh_pki_import_cert_base64(b64_cert, type, pkey)
sourceLibSSH.lib.ssh_pki_import_cert_file
— Methodssh_pki_import_cert_file(filename, pkey)
sourceLibSSH.lib.ssh_pki_import_privkey_base64
— Methodssh_pki_import_privkey_base64(b64_key, passphrase, auth_fn, auth_data, pkey)
sourceLibSSH.lib.ssh_pki_import_privkey_file
— Methodssh_pki_import_privkey_file(filename, passphrase, auth_fn, auth_data, pkey)
sourceLibSSH.lib.ssh_pki_import_pubkey_base64
— Methodssh_pki_import_pubkey_base64(b64_key, type, pkey)
sourceLibSSH.lib.ssh_pki_import_pubkey_file
— Methodssh_pki_import_pubkey_file(filename, pkey)
sourceLibSSH.lib.ssh_pki_key_ecdsa_name
— Methodssh_pki_key_ecdsa_name(key)
sourceServer
LibSSH.lib.ssh_bind_accept
— Methodssh_bind_accept(ssh_bind_o, session)
Accept an incoming ssh connection and initialize the session.
Arguments
ssh_bind_o
: The ssh server bind to accept a connection.session
: A preallocated ssh session
Returns
SSH_OK
when a connection is established
See also
sourceLibSSH.lib.ssh_bind_accept_fd
— Methodssh_bind_accept_fd(ssh_bind_o, session, fd)
Accept an incoming ssh connection on the given file descriptor and initialize the session.
Arguments
ssh_bind_o
: The ssh server bind to accept a connection.session
: A preallocated ssh sessionfd
: A file descriptor of an already established TCP inbound connection
Returns
SSH_OK
when a connection is established
See also
sourceLibSSH.lib.ssh_bind_fd_toaccept
— Methodssh_bind_fd_toaccept(ssh_bind_o)
Allow the file descriptor to accept new sessions.
Arguments
ssh_bind_o
: The ssh server bind to use.
sourceLibSSH.lib.ssh_bind_free
— Methodssh_bind_free(ssh_bind_o)
Free a ssh servers bind.
Note that this will also free options that have been set on the bind, including keys set with SSH_BIND_OPTIONS_IMPORT_KEY.
Arguments
ssh_bind_o
: The ssh server bind to free.
sourceLibSSH.lib.ssh_bind_get_fd
— Methodssh_bind_get_fd(ssh_bind_o)
Recover the file descriptor from the session.
Arguments
ssh_bind_o
: The ssh server bind to get the fd from.
Returns
The file descriptor.
sourceLibSSH.lib.ssh_bind_listen
— Methodssh_bind_listen(ssh_bind_o)
Start listening to the socket.
Arguments
ssh_bind_o
: The ssh server bind to use.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.ssh_bind_new
— Methodsource LibSSH.lib.ssh_bind_options_parse_config
— Methodssh_bind_options_parse_config(sshbind, filename)
sourceLibSSH.lib.ssh_bind_options_set
— Methodssh_bind_options_set(sshbind, type, value)
sourceLibSSH.lib.ssh_bind_set_blocking
— Methodssh_bind_set_blocking(ssh_bind_o, blocking)
Set the session to blocking/nonblocking mode.
Arguments
ssh_bind_o
: The ssh server bind to use.blocking
: Zero for nonblocking mode.
sourceLibSSH.lib.ssh_bind_set_callbacks
— Methodssh_bind_set_callbacks(sshbind, callbacks, userdata)
Set the callback for this bind.
struct ssh_callbacks_struct cb = {
+ ssh_set_server_callbacks(session, &cb);
Arguments
session
: The session to set the callback structure.cb
: The callback structure itself.
Returns
sourceChannel
LibSSH.lib.channel_read_buffer
— Methodchannel_read_buffer(channel, buffer, count, is_stderr)
sourceLibSSH.lib.ssh_channel_accept_forward
— Methodssh_channel_accept_forward(session, timeout_ms, destination_port)
sourceLibSSH.lib.ssh_channel_accept_x11
— Methodssh_channel_accept_x11(channel, timeout_ms)
sourceLibSSH.lib.ssh_channel_cancel_forward
— Methodssh_channel_cancel_forward(session, address, port)
sourceLibSSH.lib.ssh_channel_change_pty_size
— Methodssh_channel_change_pty_size(channel, cols, rows)
sourceLibSSH.lib.ssh_channel_close
— Methodssh_channel_close(channel)
sourceLibSSH.lib.ssh_channel_free
— Methodssh_channel_free(channel)
sourceLibSSH.lib.ssh_channel_get_exit_state
— Methodssh_channel_get_exit_state(channel, pexit_code, pexit_signal, pcore_dumped)
sourceLibSSH.lib.ssh_channel_get_exit_status
— Methodssh_channel_get_exit_status(channel)
sourceLibSSH.lib.ssh_channel_get_session
— Methodssh_channel_get_session(channel)
sourceLibSSH.lib.ssh_channel_is_closed
— Methodssh_channel_is_closed(channel)
sourceLibSSH.lib.ssh_channel_is_eof
— Methodssh_channel_is_eof(channel)
sourceLibSSH.lib.ssh_channel_is_open
— Methodssh_channel_is_open(channel)
sourceLibSSH.lib.ssh_channel_listen_forward
— Methodssh_channel_listen_forward(session, address, port, bound_port)
sourceLibSSH.lib.ssh_channel_new
— Methodssh_channel_new(session)
sourceLibSSH.lib.ssh_channel_open_auth_agent
— Methodssh_channel_open_auth_agent(channel)
sourceLibSSH.lib.ssh_channel_open_forward
— Methodssh_channel_open_forward(channel, remotehost, remoteport, sourcehost, localport)
sourceLibSSH.lib.ssh_channel_open_forward_port
— Methodssh_channel_open_forward_port(session, timeout_ms, destination_port, originator, originator_port)
sourceLibSSH.lib.ssh_channel_open_forward_unix
— Methodssh_channel_open_forward_unix(channel, remotepath, sourcehost, localport)
sourceLibSSH.lib.ssh_channel_open_reverse_forward
— Methodssh_channel_open_reverse_forward(channel, remotehost, remoteport, sourcehost, localport)
sourceLibSSH.lib.ssh_channel_open_session
— Methodssh_channel_open_session(channel)
sourceLibSSH.lib.ssh_channel_open_x11
— Methodssh_channel_open_x11(channel, orig_addr, orig_port)
sourceLibSSH.lib.ssh_channel_poll
— Methodssh_channel_poll(channel, is_stderr)
sourceLibSSH.lib.ssh_channel_poll_timeout
— Methodssh_channel_poll_timeout(channel, timeout, is_stderr)
sourceLibSSH.lib.ssh_channel_read
— Methodssh_channel_read(channel, dest, count, is_stderr)
sourceLibSSH.lib.ssh_channel_read_nonblocking
— Methodssh_channel_read_nonblocking(channel, dest, count, is_stderr)
sourceLibSSH.lib.ssh_channel_read_timeout
— Methodssh_channel_read_timeout(channel, dest, count, is_stderr, timeout_ms)
sourceLibSSH.lib.ssh_channel_request_auth_agent
— Methodssh_channel_request_auth_agent(channel)
sourceLibSSH.lib.ssh_channel_request_env
— Methodssh_channel_request_env(channel, name, value)
sourceLibSSH.lib.ssh_channel_request_exec
— Methodssh_channel_request_exec(channel, cmd)
sourceLibSSH.lib.ssh_channel_request_pty
— Methodssh_channel_request_pty(channel)
sourceLibSSH.lib.ssh_channel_request_pty_size_modes
— Methodssh_channel_request_pty_size_modes(channel, term, cols, rows, modes, modes_len)
sourceLibSSH.lib.ssh_channel_request_send_break
— Methodssh_channel_request_send_break(channel, length)
sourceLibSSH.lib.ssh_channel_request_send_exit_signal
— Methodssh_channel_request_send_exit_signal(channel, signum, core, errmsg, lang)
sourceLibSSH.lib.ssh_channel_request_send_exit_status
— Methodssh_channel_request_send_exit_status(channel, exit_status)
sourceLibSSH.lib.ssh_channel_request_send_signal
— Methodssh_channel_request_send_signal(channel, signum)
sourceLibSSH.lib.ssh_channel_request_sftp
— Methodssh_channel_request_sftp(channel)
sourceLibSSH.lib.ssh_channel_request_shell
— Methodssh_channel_request_shell(channel)
sourceLibSSH.lib.ssh_channel_request_subsystem
— Methodssh_channel_request_subsystem(channel, subsystem)
sourceLibSSH.lib.ssh_channel_request_x11
— Methodssh_channel_request_x11(channel, single_connection, protocol, cookie, screen_number)
sourceLibSSH.lib.ssh_channel_select
— Methodssh_channel_select(readchans, writechans, exceptchans, timeout)
sourceLibSSH.lib.ssh_channel_send_eof
— Methodssh_channel_send_eof(channel)
sourceLibSSH.lib.ssh_channel_set_blocking
— Methodssh_channel_set_blocking(channel, blocking)
sourceLibSSH.lib.ssh_channel_set_counter
— Methodssh_channel_set_counter(channel, counter)
sourceLibSSH.lib.ssh_channel_window_size
— Methodssh_channel_window_size(channel)
sourceLibSSH.lib.ssh_channel_write
— Methodssh_channel_write(channel, data, len)
sourceLibSSH.lib.ssh_channel_write_stderr
— Methodssh_channel_write_stderr(channel, data, len)
sourceErrors
LibSSH.lib.ssh_get_error
— Methodssh_get_error(error)
sourceLibSSH.lib.ssh_get_error_code
— Methodssh_get_error_code(error)
sourceHelpers
LibSSH.lib.ssh_basename
— Methodssh_basename(path)
sourceLibSSH.lib.ssh_dirname
— Methodssh_dirname(path)
sourceLibSSH.lib.ssh_get_hexa
— Methodssh_get_hexa(what, len)
sourceLibSSH.lib.ssh_get_random
— Methodssh_get_random(where, len, strong)
sourceLibSSH.lib.ssh_getpass
— Methodssh_getpass(prompt, buf, len, echo, verify)
sourceLibSSH.lib.ssh_mkdir
— Methodssh_mkdir(pathname, mode)
sourceLibSSH.lib.ssh_print_hexa
— Methodssh_print_hexa(descr, what, len)
sourceLibSSH.lib.ssh_version
— Methodssh_version(req_version)
sourceLogging
LibSSH.lib.ssh_get_log_callback
— Methodssh_get_log_callback()
Get the pointer to the logging callback function.
Returns
The pointer the the callback or NULL if none set.
sourceLibSSH.lib.ssh_get_log_level
— Methodssh_get_log_level()
sourceLibSSH.lib.ssh_get_log_userdata
— Methodssh_get_log_userdata()
sourceLibSSH.lib.ssh_set_log_callback
— Methodssh_set_log_callback(cb)
Set the logging callback function.
Arguments
cb
:[in] The callback to set.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.ssh_set_log_level
— Methodssh_set_log_level(level)
sourceLibSSH.lib.ssh_set_log_userdata
— Methodssh_set_log_userdata(data)
sourceMessage
LibSSH.lib.ssh_message_free
— Methodssh_message_free(msg)
sourceLibSSH.lib.ssh_message_get
— Methodssh_message_get(session)
sourceLibSSH.lib.ssh_message_subtype
— Methodssh_message_subtype(msg)
sourceLibSSH.lib.ssh_message_type
— Methodssh_message_type(msg)
sourcePolling
LibSSH.lib.ssh_event_add_connector
— Methodssh_event_add_connector(event, connector)
sourceLibSSH.lib.ssh_event_add_fd
— Methodssh_event_add_fd(event, fd, events, cb, userdata)
sourceLibSSH.lib.ssh_event_add_session
— Methodssh_event_add_session(event, session)
sourceLibSSH.lib.ssh_event_dopoll
— Methodssh_event_dopoll(event, timeout)
sourceLibSSH.lib.ssh_event_free
— Methodssh_event_free(event)
sourceLibSSH.lib.ssh_event_new
— Methodssh_event_new()
sourceLibSSH.lib.ssh_event_remove_connector
— Methodssh_event_remove_connector(event, connector)
sourceLibSSH.lib.ssh_event_remove_fd
— Methodssh_event_remove_fd(event, fd)
sourceLibSSH.lib.ssh_event_remove_session
— Methodssh_event_remove_session(event, session)
sourcePublic/private keys
LibSSH.lib.ssh_key_cmp
— Methodssh_key_cmp(k1, k2, what)
sourceLibSSH.lib.ssh_key_dup
— Methodssh_key_dup(key)
sourceLibSSH.lib.ssh_key_free
— Methodssh_key_free(key)
sourceLibSSH.lib.ssh_key_is_private
— Methodssh_key_is_private(k)
sourceLibSSH.lib.ssh_key_is_public
— Methodssh_key_is_public(k)
sourceLibSSH.lib.ssh_key_new
— Methodssh_key_new()
sourceLibSSH.lib.ssh_key_type
— Methodssh_key_type(key)
sourceLibSSH.lib.ssh_key_type_from_name
— Methodssh_key_type_from_name(name)
sourceLibSSH.lib.ssh_key_type_to_char
— Methodssh_key_type_to_char(type)
sourceLibSSH.lib.ssh_pki_copy_cert_to_privkey
— Methodssh_pki_copy_cert_to_privkey(cert_key, privkey)
sourceLibSSH.lib.ssh_pki_export_privkey_base64
— Methodssh_pki_export_privkey_base64(privkey, passphrase, auth_fn, auth_data, b64_key)
sourceLibSSH.lib.ssh_pki_export_privkey_base64_format
— Methodssh_pki_export_privkey_base64_format(privkey, passphrase, auth_fn, auth_data, b64_key, format)
sourceLibSSH.lib.ssh_pki_export_privkey_file
— Methodssh_pki_export_privkey_file(privkey, passphrase, auth_fn, auth_data, filename)
sourceLibSSH.lib.ssh_pki_export_privkey_file_format
— Methodssh_pki_export_privkey_file_format(privkey, passphrase, auth_fn, auth_data, filename, format)
sourceLibSSH.lib.ssh_pki_export_privkey_to_pubkey
— Methodssh_pki_export_privkey_to_pubkey(privkey, pkey)
sourceLibSSH.lib.ssh_pki_export_pubkey_base64
— Methodssh_pki_export_pubkey_base64(key, b64_key)
sourceLibSSH.lib.ssh_pki_export_pubkey_file
— Methodssh_pki_export_pubkey_file(key, filename)
sourceLibSSH.lib.ssh_pki_generate
— Methodssh_pki_generate(type, parameter, pkey)
sourceLibSSH.lib.ssh_pki_import_cert_base64
— Methodssh_pki_import_cert_base64(b64_cert, type, pkey)
sourceLibSSH.lib.ssh_pki_import_cert_file
— Methodssh_pki_import_cert_file(filename, pkey)
sourceLibSSH.lib.ssh_pki_import_privkey_base64
— Methodssh_pki_import_privkey_base64(b64_key, passphrase, auth_fn, auth_data, pkey)
sourceLibSSH.lib.ssh_pki_import_privkey_file
— Methodssh_pki_import_privkey_file(filename, passphrase, auth_fn, auth_data, pkey)
sourceLibSSH.lib.ssh_pki_import_pubkey_base64
— Methodssh_pki_import_pubkey_base64(b64_key, type, pkey)
sourceLibSSH.lib.ssh_pki_import_pubkey_file
— Methodssh_pki_import_pubkey_file(filename, pkey)
sourceLibSSH.lib.ssh_pki_key_ecdsa_name
— Methodssh_pki_key_ecdsa_name(key)
sourceServer
LibSSH.lib.ssh_bind_accept
— Methodssh_bind_accept(ssh_bind_o, session)
Accept an incoming ssh connection and initialize the session.
Arguments
ssh_bind_o
: The ssh server bind to accept a connection.session
: A preallocated ssh session
Returns
SSH_OK
when a connection is established
See also
sourceLibSSH.lib.ssh_bind_accept_fd
— Methodssh_bind_accept_fd(ssh_bind_o, session, fd)
Accept an incoming ssh connection on the given file descriptor and initialize the session.
Arguments
ssh_bind_o
: The ssh server bind to accept a connection.session
: A preallocated ssh sessionfd
: A file descriptor of an already established TCP inbound connection
Returns
SSH_OK
when a connection is established
See also
sourceLibSSH.lib.ssh_bind_fd_toaccept
— Methodssh_bind_fd_toaccept(ssh_bind_o)
Allow the file descriptor to accept new sessions.
Arguments
ssh_bind_o
: The ssh server bind to use.
sourceLibSSH.lib.ssh_bind_free
— Methodssh_bind_free(ssh_bind_o)
Free a ssh servers bind.
Note that this will also free options that have been set on the bind, including keys set with SSH_BIND_OPTIONS_IMPORT_KEY.
Arguments
ssh_bind_o
: The ssh server bind to free.
sourceLibSSH.lib.ssh_bind_get_fd
— Methodssh_bind_get_fd(ssh_bind_o)
Recover the file descriptor from the session.
Arguments
ssh_bind_o
: The ssh server bind to get the fd from.
Returns
The file descriptor.
sourceLibSSH.lib.ssh_bind_listen
— Methodssh_bind_listen(ssh_bind_o)
Start listening to the socket.
Arguments
ssh_bind_o
: The ssh server bind to use.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.ssh_bind_new
— Methodsource LibSSH.lib.ssh_bind_options_parse_config
— Methodssh_bind_options_parse_config(sshbind, filename)
sourceLibSSH.lib.ssh_bind_options_set
— Methodssh_bind_options_set(sshbind, type, value)
sourceLibSSH.lib.ssh_bind_set_blocking
— Methodssh_bind_set_blocking(ssh_bind_o, blocking)
Set the session to blocking/nonblocking mode.
Arguments
ssh_bind_o
: The ssh server bind to use.blocking
: Zero for nonblocking mode.
sourceLibSSH.lib.ssh_bind_set_callbacks
— Methodssh_bind_set_callbacks(sshbind, callbacks, userdata)
Set the callback for this bind.
struct ssh_callbacks_struct cb = {
.userdata = data,
.auth_function = my_auth_function
};
ssh_callbacks_init(&cb);
- ssh_bind_set_callbacks(session, &cb);
Arguments
sshbind
:[in] The bind to set the callback on.callbacks
:[in] An already set up ssh_bind_callbacks
instance.userdata
:[in] A pointer to private data to pass to the callbacks.
Returns
sourceLibSSH.lib.ssh_bind_set_fd
— Methodssh_bind_set_fd(ssh_bind_o, fd)
Set the file descriptor for a session.
Arguments
ssh_bind_o
: The ssh server bind to set the fd.fd
: The file descriptssh_bind B
sourceLibSSH.lib.ssh_gssapi_get_creds
— Methodssh_gssapi_get_creds(session)
sourceLibSSH.lib.ssh_handle_key_exchange
— Methodssh_handle_key_exchange(session)
Handles the key exchange and set up encryption
Arguments
session
: A connected ssh session
Returns
SSH_OK
if the key exchange was successful
See also
sourceLibSSH.lib.ssh_message_auth_kbdint_is_response
— Methodssh_message_auth_kbdint_is_response(msg)
Auto-generated wrapper around ssh_message_auth_kbdint_is_response()
.
sourceLibSSH.lib.ssh_message_auth_password
— Methodssh_message_auth_password(msg; throw = true)
Auto-generated wrapper around ssh_message_auth_password()
. Original upstream documentation is below.
Get the password of the authenticated user.
Deprecated This function should not be used anymore as there is a callback based server implementation now auth_password_function.
Arguments
msg
:[in] The message to get the password from.
Returns
The password or NULL if an error occurred.
See also
sourceLibSSH.lib.ssh_message_auth_pubkey
— Methodssh_message_auth_pubkey(msg)
Get the publickey of the authenticated user.
If you need the key for later user you should duplicate it.
Deprecated This function should not be used anymore as there is a callback based server implementation auth_pubkey_function.
Arguments
msg
:[in] The message to get the public key from.
Returns
The public key or NULL.
See also
ssh_key_dup
(), ssh_key_cmp
(), ssh_message_get
(), ssh_message_type
()
sourceLibSSH.lib.ssh_message_auth_publickey_state
— Methodssh_message_auth_publickey_state(msg)
Deprecated This function should not be used anymore as there is a callback based server implementation auth_pubkey_function
Arguments
msg
:[in] The message to get the public key state from.
sourceLibSSH.lib.ssh_message_auth_reply_pk_ok
— Methodssh_message_auth_reply_pk_ok(msg, algo, pubkey)
sourceLibSSH.lib.ssh_message_auth_reply_pk_ok_simple
— Methodssh_message_auth_reply_pk_ok_simple(msg)
sourceLibSSH.lib.ssh_message_auth_set_methods
— Methodssh_message_auth_set_methods(msg, methods; throw = true)
Auto-generated wrapper around ssh_message_auth_set_methods()
.
sourceLibSSH.lib.ssh_message_auth_user
— Methodssh_message_auth_user(msg; throw = true)
Auto-generated wrapper around ssh_message_auth_user()
. Original upstream documentation is below.
Get the name of the authenticated user.
Arguments
msg
:[in] The message to get the username from.
Returns
The username or NULL if an error occurred.
See also
sourceLibSSH.lib.ssh_message_global_request_reply_success
— Methodssh_message_global_request_reply_success(msg, bound_port)
sourceLibSSH.lib.ssh_message_reply_default
— Methodssh_message_reply_default(msg; throw = true)
Auto-generated wrapper around ssh_message_reply_default()
. Original upstream documentation is below.
Reply with a standard reject message.
Use this function if you don't know what to respond or if you want to reject a request.
Arguments
msg
:[in] The message to use for the reply.
Returns
0 on success, -1 on error.
See also
sourceLibSSH.lib.ssh_message_service_reply_success
— Methodssh_message_service_reply_success(msg)
sourceLibSSH.lib.ssh_message_service_service
— Methodssh_message_service_service(msg)
sourceLibSSH.lib.ssh_send_issue_banner
— Methodssh_send_issue_banner(session, banner)
Send the server's issue-banner to client.
Arguments
session
:[in] The server session.banner
:[in] The server's banner.
Returns
sourceLibSSH.lib.ssh_send_keepalive
— Methodssh_send_keepalive(session)
sourceLibSSH.lib.ssh_server_init_kex
— Methodssh_server_init_kex(session)
Initialize the set of key exchange, hostkey, ciphers, MACs, and compression algorithms for the given ssh_session
.
The selection of algorithms and keys used are determined by the options that are currently set in the given ssh_session
structure. May only be called before the initial key exchange has begun.
Arguments
session
: The session structure to initialize.
Returns
SSH_OK
if initialization succeeds.
See also
sourceLibSSH.lib.ssh_set_auth_methods
— Methodssh_set_auth_methods(session, auth_methods)
Set the acceptable authentication methods to be sent to the client.
Supported methods are:
SSH_AUTH_METHOD_PASSWORD
SSH_AUTH_METHOD_PUBLICKEY
SSH_AUTH_METHOD_HOSTBASED
SSH_AUTH_METHOD_INTERACTIVE
SSH_AUTH_METHOD_GSSAPI_MIC
Arguments
session
:[in] The server sessionauth_methods
:[in] The authentication methods we will support, which can be bitwise-or'd.
sourceLibSSH.lib.ssh_set_message_callback
— Methodssh_set_message_callback(session, ssh_bind_message_callback, data)
sourceSession
LibSSH.lib.ssh_blocking_flush
— Methodssh_blocking_flush(session, timeout)
sourceLibSSH.lib.ssh_clean_pubkey_hash
— Methodssh_clean_pubkey_hash(hash)
sourceLibSSH.lib.ssh_connect
— Methodssh_connect(session)
sourceLibSSH.lib.ssh_copyright
— Methodssh_copyright()
sourceLibSSH.lib.ssh_disconnect
— Methodssh_disconnect(session)
sourceLibSSH.lib.ssh_dump_knownhost
— Methodssh_dump_knownhost(session)
sourceLibSSH.lib.ssh_free
— Methodssh_free(session)
sourceLibSSH.lib.ssh_get_cipher_in
— Methodssh_get_cipher_in(session)
sourceLibSSH.lib.ssh_get_cipher_out
— Methodssh_get_cipher_out(session)
sourceLibSSH.lib.ssh_get_clientbanner
— Methodssh_get_clientbanner(session)
sourceLibSSH.lib.ssh_get_disconnect_message
— Methodssh_get_disconnect_message(session)
sourceLibSSH.lib.ssh_get_fd
— Methodssh_get_fd(session)
sourceLibSSH.lib.ssh_get_fingerprint_hash
— Methodssh_get_fingerprint_hash(type, hash, len)
sourceLibSSH.lib.ssh_get_hmac_in
— Methodssh_get_hmac_in(session)
sourceLibSSH.lib.ssh_get_hmac_out
— Methodssh_get_hmac_out(session)
sourceLibSSH.lib.ssh_get_issue_banner
— Methodssh_get_issue_banner(session)
sourceLibSSH.lib.ssh_get_kex_algo
— Methodssh_get_kex_algo(session)
sourceLibSSH.lib.ssh_get_openssh_version
— Methodssh_get_openssh_version(session)
sourceLibSSH.lib.ssh_get_poll_flags
— Methodssh_get_poll_flags(session)
sourceLibSSH.lib.ssh_get_pubkey_hash
— Methodssh_get_pubkey_hash(session, hash)
sourceLibSSH.lib.ssh_get_publickey
— Methodssh_get_publickey(session, key)
sourceLibSSH.lib.ssh_get_publickey_hash
— Methodssh_get_publickey_hash(key, type, hash, hlen)
sourceLibSSH.lib.ssh_get_server_publickey
— Methodssh_get_server_publickey(session, key)
sourceLibSSH.lib.ssh_get_serverbanner
— Methodssh_get_serverbanner(session)
sourceLibSSH.lib.ssh_get_status
— Methodssh_get_status(session)
sourceLibSSH.lib.ssh_get_version
— Methodssh_get_version(session)
sourceLibSSH.lib.ssh_is_blocking
— Methodssh_is_blocking(session)
sourceLibSSH.lib.ssh_is_connected
— Methodssh_is_connected(session)
sourceLibSSH.lib.ssh_is_server_known
— Methodssh_is_server_known(session)
sourceLibSSH.lib.ssh_known_hosts_parse_line
— Methodssh_known_hosts_parse_line(host, line, entry)
sourceLibSSH.lib.ssh_knownhosts_entry_free
— Methodssh_knownhosts_entry_free(entry)
sourceLibSSH.lib.ssh_new
— Methodssh_new()
sourceLibSSH.lib.ssh_options_copy
— Methodssh_options_copy(src, dest)
sourceLibSSH.lib.ssh_options_get
— Methodssh_options_get(session, type, value; throw = true)
Auto-generated wrapper around ssh_options_get()
.
sourceLibSSH.lib.ssh_options_get_port
— Methodssh_options_get_port(session, port_target; throw = true)
Auto-generated wrapper around ssh_options_get_port()
.
sourceLibSSH.lib.ssh_options_getopt
— Methodssh_options_getopt(session, argcptr, argv)
sourceLibSSH.lib.ssh_options_parse_config
— Methodssh_options_parse_config(session, filename)
sourceLibSSH.lib.ssh_options_set
— Methodssh_options_set(session, type, value; throw = true)
Auto-generated wrapper around ssh_options_set()
.
sourceLibSSH.lib.ssh_print_hash
— Methodssh_print_hash(type, hash, len)
sourceLibSSH.lib.ssh_request_no_more_sessions
— Methodssh_request_no_more_sessions(session)
sourceLibSSH.lib.ssh_select
— Methodssh_select(channels, outchannels, maxfd, readfds, timeout)
sourceLibSSH.lib.ssh_send_debug
— Methodssh_send_debug(session, message, always_display)
sourceLibSSH.lib.ssh_send_ignore
— Methodssh_send_ignore(session, data)
sourceLibSSH.lib.ssh_session_export_known_hosts_entry
— Methodssh_session_export_known_hosts_entry(session, pentry_string)
sourceLibSSH.lib.ssh_session_get_known_hosts_entry
— Methodssh_session_get_known_hosts_entry(session, pentry)
sourceLibSSH.lib.ssh_session_has_known_hosts_entry
— Methodssh_session_has_known_hosts_entry(session)
sourceLibSSH.lib.ssh_session_is_known_server
— Methodssh_session_is_known_server(session)
sourceLibSSH.lib.ssh_session_set_disconnect_message
— Methodssh_session_set_disconnect_message(session, message)
sourceLibSSH.lib.ssh_session_update_known_hosts
— Methodssh_session_update_known_hosts(session)
sourceLibSSH.lib.ssh_set_blocking
— Methodssh_set_blocking(session, blocking)
sourceLibSSH.lib.ssh_set_counters
— Methodssh_set_counters(session, scounter, rcounter)
sourceLibSSH.lib.ssh_set_fd_except
— Methodssh_set_fd_except(session)
sourceLibSSH.lib.ssh_set_fd_toread
— Methodssh_set_fd_toread(session)
sourceLibSSH.lib.ssh_set_fd_towrite
— Methodssh_set_fd_towrite(session)
sourceLibSSH.lib.ssh_silent_disconnect
— Methodssh_silent_disconnect(session)
sourceLibSSH.lib.ssh_write_knownhost
— Methodssh_write_knownhost(session)
sourceStrings
LibSSH.lib.ssh_string_burn
— Methodssh_string_burn(str)
sourceLibSSH.lib.ssh_string_copy
— Methodssh_string_copy(str)
sourceLibSSH.lib.ssh_string_data
— Methodssh_string_data(str)
sourceLibSSH.lib.ssh_string_fill
— Methodssh_string_fill(str, data, len)
sourceLibSSH.lib.ssh_string_free
— Methodssh_string_free(str)
sourceLibSSH.lib.ssh_string_free_char
— Methodssh_string_free_char(s)
sourceLibSSH.lib.ssh_string_from_char
— Methodssh_string_from_char(what)
sourceLibSSH.lib.ssh_string_get_char
— Methodssh_string_get_char(str)
sourceLibSSH.lib.ssh_string_len
— Methodssh_string_len(str)
sourceLibSSH.lib.ssh_string_new
— Methodssh_string_new(size)
sourceLibSSH.lib.ssh_string_to_char
— Methodssh_string_to_char(str)
sourceSCP
LibSSH.lib.ssh_scp_accept_request
— Methodssh_scp_accept_request(scp)
sourceLibSSH.lib.ssh_scp_close
— Methodssh_scp_close(scp)
sourceLibSSH.lib.ssh_scp_deny_request
— Methodssh_scp_deny_request(scp, reason)
sourceLibSSH.lib.ssh_scp_free
— Methodssh_scp_free(scp)
sourceLibSSH.lib.ssh_scp_init
— Methodssh_scp_init(scp)
sourceLibSSH.lib.ssh_scp_leave_directory
— Methodssh_scp_leave_directory(scp)
sourceLibSSH.lib.ssh_scp_new
— Methodssh_scp_new(session, mode, location)
sourceLibSSH.lib.ssh_scp_pull_request
— Methodssh_scp_pull_request(scp)
sourceLibSSH.lib.ssh_scp_push_directory
— Methodssh_scp_push_directory(scp, dirname, mode)
sourceLibSSH.lib.ssh_scp_push_file
— Methodssh_scp_push_file(scp, filename, size, perms)
sourceLibSSH.lib.ssh_scp_push_file64
— Methodssh_scp_push_file64(scp, filename, size, perms)
sourceLibSSH.lib.ssh_scp_read
— Methodssh_scp_read(scp, buffer, size)
sourceLibSSH.lib.ssh_scp_request_get_filename
— Methodssh_scp_request_get_filename(scp)
sourceLibSSH.lib.ssh_scp_request_get_permissions
— Methodssh_scp_request_get_permissions(scp)
sourceLibSSH.lib.ssh_scp_request_get_size
— Methodssh_scp_request_get_size(scp)
sourceLibSSH.lib.ssh_scp_request_get_size64
— Methodssh_scp_request_get_size64(scp)
sourceLibSSH.lib.ssh_scp_request_get_warning
— Methodssh_scp_request_get_warning(scp)
sourceLibSSH.lib.ssh_scp_write
— Methodssh_scp_write(scp, buffer, len)
sourceSFTP
LibSSH.lib.sftp_aio_begin_read
— Methodsftp_aio_begin_read(file, len, aio)
Start an asynchronous read from a file using an opened sftp file handle.
Its goal is to avoid the slowdowns related to the request/response pattern of a synchronous read. To do so, you must call 2 functions :
sftp_aio_begin_read
() and sftp_aio_wait_read
().
The first step is to call sftp_aio_begin_read
(). This function sends a read request to the sftp server, dynamically allocates memory to store information about the sent request and provides the caller an sftp aio handle to that memory.
The second step is to call sftp_aio_wait_read
() and pass it the address of a location storing the sftp aio handle provided by sftp_aio_begin_read
().
These two functions do not close the open sftp file handle passed to sftp_aio_begin_read
() irrespective of whether they fail or not.
It is the responsibility of the caller to ensure that the open sftp file handle passed to sftp_aio_begin_read
() must not be closed before the corresponding call to sftp_aio_wait_read
(). After sftp_aio_wait_read
() returns, it is caller's decision whether to immediately close the file by calling sftp_close
() or to keep it open and perform some more operations on it.
This function caps the length a user is allowed to read from an sftp file, the value of len parameter after capping is returned on success.
The value used for the cap is same as the value of the max_read_length field of the sftp_limits_t
returned by sftp_limits
().
Warning When calling this function, the internal file offset is updated corresponding to the number of bytes requested to read.
Warning A call to sftp_aio_begin_read
() sends a request to the server. When the server answers, libssh allocates memory to store it until sftp_aio_wait_read
() is called. Not calling sftp_aio_wait_read
() will lead to memory leaks.
Arguments
file
: The opened sftp file handle to be read from.len
: Number of bytes to read.aio
: Pointer to a location where the sftp aio handle (corresponding to the sent request) should be stored.
Returns
On success, the number of bytes the server is requested to read (value of len parameter after capping). On error, SSH_ERROR
with sftp and ssh errors set.
See also
sftp_aio_wait_read
(), sftp_aio_free
(), sftp_open
(), sftp_close
(), sftp_get_error
(), ssh_get_error
()
sourceLibSSH.lib.sftp_aio_begin_write
— Methodsftp_aio_begin_write(file, buf, len, aio)
Start an asynchronous write to a file using an opened sftp file handle.
Its goal is to avoid the slowdowns related to the request/response pattern of a synchronous write. To do so, you must call 2 functions :
sftp_aio_begin_write
() and sftp_aio_wait_write
().
The first step is to call sftp_aio_begin_write
(). This function sends a write request to the sftp server, dynamically allocates memory to store information about the sent request and provides the caller an sftp aio handle to that memory.
The second step is to call sftp_aio_wait_write
() and pass it the address of a location storing the sftp aio handle provided by sftp_aio_begin_write
().
These two functions do not close the open sftp file handle passed to sftp_aio_begin_write
() irrespective of whether they fail or not.
It is the responsibility of the caller to ensure that the open sftp file handle passed to sftp_aio_begin_write
() must not be closed before the corresponding call to sftp_aio_wait_write
(). After sftp_aio_wait_write
() returns, it is caller's decision whether to immediately close the file by calling sftp_close
() or to keep it open and perform some more operations on it.
This function caps the length a user is allowed to write to an sftp file, the value of len parameter after capping is returned on success.
The value used for the cap is same as the value of the max_write_length field of the sftp_limits_t
returned by sftp_limits
().
Warning When calling this function, the internal file offset is updated corresponding to the number of bytes requested to write.
Warning A call to sftp_aio_begin_write
() sends a request to the server. When the server answers, libssh allocates memory to store it until sftp_aio_wait_write
() is called. Not calling sftp_aio_wait_write
() will lead to memory leaks.
Arguments
file
: The opened sftp file handle to write to.buf
: Pointer to the buffer containing data to write.len
: Number of bytes to write.aio
: Pointer to a location where the sftp aio handle (corresponding to the sent request) should be stored.
Returns
On success, the number of bytes the server is requested to write (value of len parameter after capping). On error, SSH_ERROR
with sftp and ssh errors set.
See also
sftp_aio_wait_write
(), sftp_aio_free
(), sftp_open
(), sftp_close
(), sftp_get_error
(), ssh_get_error
()
sourceLibSSH.lib.sftp_aio_free
— Methodsftp_aio_free(aio)
Deallocate memory corresponding to a sftp aio handle.
This function deallocates memory corresponding to the aio handle returned by the sftp_aio_begin_*() functions. Users can use this function to free memory corresponding to an aio handle for an outstanding async i/o request on encountering some error.
Arguments
aio
: sftp aio handle corresponding to which memory has to be deallocated.
See also
sftp_aio_begin_read
(), sftp_aio_wait_read
(), sftp_aio_begin_write
(), sftp_aio_wait_write
()
sourceLibSSH.lib.sftp_aio_wait_read
— Methodsftp_aio_wait_read(aio::Ptr{sftp_aio}, buf::Ptr{Cvoid}, buf_size::Csize_t)
Auto-generated wrapper around sftp_aio_wait_read()
. Original upstream documentation is below.
Wait for an asynchronous read to complete and store the read data in the supplied buffer.
A pointer to an sftp aio handle should be passed while calling this function. Except when the return value is SSH_AGAIN
, this function releases the memory corresponding to the supplied aio handle and assigns NULL to that aio handle using the passed pointer to that handle.
If the file is opened in non-blocking mode and the request hasn't been executed yet, this function returns SSH_AGAIN
and must be called again using the same sftp aio handle.
Warning A call to this function with an invalid sftp aio handle may never return.
Arguments
aio
: Pointer to the sftp aio handle returned by sftp_aio_begin_read
().buf
: Pointer to the buffer in which read data will be stored.buf_size
: Size of the buffer in bytes. It should be bigger or equal to the length parameter of the sftp_aio_begin_read
() call.
Returns
Number of bytes read, 0 on EOF, SSH_ERROR
if an error occurred, SSH_AGAIN
if the file is opened in nonblocking mode and the request hasn't been executed yet.
See also
sourceLibSSH.lib.sftp_aio_wait_write
— Methodsftp_aio_wait_write(aio::Ptr{sftp_aio})
Auto-generated wrapper around sftp_aio_wait_write()
. Original upstream documentation is below.
Wait for an asynchronous write to complete.
A pointer to an sftp aio handle should be passed while calling this function. Except when the return value is SSH_AGAIN
, this function releases the memory corresponding to the supplied aio handle and assigns NULL to that aio handle using the passed pointer to that handle.
If the file is opened in non-blocking mode and the request hasn't been executed yet, this function returns SSH_AGAIN
and must be called again using the same sftp aio handle.
Warning A call to this function with an invalid sftp aio handle may never return.
Arguments
aio
: Pointer to the sftp aio handle returned by sftp_aio_begin_write
().
Returns
Number of bytes written on success, SSH_ERROR
if an error occurred, SSH_AGAIN
if the file is opened in nonblocking mode and the request hasn't been executed yet.
See also
sourceLibSSH.lib.sftp_async_read
— Methodsftp_async_read(file, data, len, id)
Wait for an asynchronous read to complete and save the data.
Warning A call to this function with an invalid identifier will never return.
Arguments
file
: The opened sftp file handle to be read from.data
: Pointer to buffer to receive read data.len
: Size of the buffer in bytes. It should be bigger or equal to the length parameter of the sftp_async_read_begin
() call.id
: The identifier returned by the sftp_async_read_begin
() function.
Returns
Number of bytes read, 0 on EOF, SSH_ERROR
if an error occurred, SSH_AGAIN
if the file is opened in nonblocking mode and the request hasn't been executed yet.
See also
sourceLibSSH.lib.sftp_async_read_begin
— Methodsftp_async_read_begin(file, len)
Start an asynchronous read from a file using an opened sftp file handle.
Its goal is to avoid the slowdowns related to the request/response pattern of a synchronous read. To do so, you must call 2 functions:
sftp_async_read_begin
() and sftp_async_read
().
The first step is to call sftp_async_read_begin
(). This function returns a request identifier. The second step is to call sftp_async_read
() using the returned identifier.
Warning When calling this function, the internal offset is updated corresponding to the len parameter.
Warning A call to sftp_async_read_begin
() sends a request to the server. When the server answers, libssh allocates memory to store it until sftp_async_read
() is called. Not calling sftp_async_read
() will lead to memory leaks.
Arguments
file
: The opened sftp file handle to be read from.len
: Size to read in bytes.
Returns
An identifier corresponding to the sent request, < 0 on error.
See also
sftp_async_read
(), sftp_open
()
sourceLibSSH.lib.sftp_attributes_free
— Methodsftp_attributes_free(file)
Free a sftp attribute structure.
Arguments
file
: The sftp attribute structure to free.
sourceLibSSH.lib.sftp_canonicalize_path
— Methodsftp_canonicalize_path(sftp, path)
Canonicalize a sftp path.
Arguments
sftp
: The sftp session handle.path
: The path to be canonicalized.
Returns
A pointer to the newly allocated canonicalized path, NULL on error. The caller needs to free the memory using ssh_string_free_char
().
sourceLibSSH.lib.sftp_chmod
— Methodsftp_chmod(sftp, file, mode)
Change permissions of a file
Arguments
sftp
: The sftp session handle.file
: The file which owner and group should be changed.mode
: Specifies the permissions to use. It is modified by the process's umask in the usual way: The permissions of the created file are (mode & ~umask)
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_chown
— Methodsftp_chown(sftp, file, owner, group)
Change the file owner and group
Arguments
sftp
: The sftp session handle.file
: The file which owner and group should be changed.owner
: The new owner which should be set.group
: The new group which should be set.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_close
— Methodsftp_close(file::sftp_file)
Auto-generated wrapper around sftp_close()
. Original upstream documentation is below.
Close an open file handle.
Arguments
file
: The open sftp file handle to close.
Returns
Returns SSH_NO_ERROR or SSH_ERROR
if an error occurred.
See also
sourceLibSSH.lib.sftp_closedir
— Methodsftp_closedir(dir::sftp_dir)
Auto-generated wrapper around sftp_closedir()
. Original upstream documentation is below.
Close a directory handle opened by sftp_opendir
().
Arguments
dir
: The sftp directory handle to close.
Returns
Returns SSH_NO_ERROR or SSH_ERROR
if an error occurred.
sourceLibSSH.lib.sftp_dir_eof
— Methodsftp_dir_eof(dir)
Tell if the directory has reached EOF (End Of File).
Arguments
dir
: The sftp directory handle.
Returns
1 if the directory is EOF, 0 if not.
See also
sourceLibSSH.lib.sftp_expand_path
— Methodsftp_expand_path(sftp, path)
Canonicalize path using expand-path.com extension
Arguments
sftp
: The sftp session handle.path
: The path to be canonicalized.
Returns
A pointer to the newly allocated canonicalized path, NULL on error. The caller needs to free the memory using ssh_string_free_char
().
sourceLibSSH.lib.sftp_extension_supported
— Methodsftp_extension_supported(sftp, name, data)
Check if the given extension is supported.
Example:
sftp_extension_supported(sftp, "statvfs@openssh.com", "2");
Arguments
sftp
: The sftp session to use.name
: The name of the extension.data
: The data of the extension.
Returns
1 if supported, 0 if not.
sourceLibSSH.lib.sftp_extensions_get_count
— Methodsftp_extensions_get_count(sftp)
Get the count of extensions provided by the server.
Arguments
sftp
: The sftp session to use.
Returns
The count of extensions provided by the server, 0 on error or not available.
sourceLibSSH.lib.sftp_extensions_get_data
— Methodsftp_extensions_get_data(sftp, indexn; throw = true)
Auto-generated wrapper around sftp_extensions_get_data()
. Original upstream documentation is below.
Get the data of the extension provided by the server.
This is normally the version number of the extension.
Arguments
sftp
: The sftp session to use.indexn
: The index number of the extension data you want.
Returns
The data of the extension.
sourceLibSSH.lib.sftp_extensions_get_name
— Methodsftp_extensions_get_name(sftp, indexn; throw = true)
Auto-generated wrapper around sftp_extensions_get_name()
. Original upstream documentation is below.
Get the name of the extension provided by the server.
Arguments
sftp
: The sftp session to use.indexn
: The index number of the extension name you want.
Returns
The name of the extension.
sourceLibSSH.lib.sftp_file_set_blocking
— Methodsftp_file_set_blocking(handle)
Make the sftp communication for this file handle blocking.
Arguments
handle
:[in] The file handle to set blocking.
sourceLibSSH.lib.sftp_file_set_nonblocking
— Methodsftp_file_set_nonblocking(handle)
Make the sftp communication for this file handle non blocking.
Arguments
handle
:[in] The file handle to set non blocking.
sourceLibSSH.lib.sftp_free
— Methodsftp_free(sftp)
Close and deallocate a sftp session.
Arguments
sftp
: The sftp session handle to free.
sourceLibSSH.lib.sftp_fstat
— Methodsftp_fstat(file)
Get information about a file or directory from a file handle.
Arguments
file
: The sftp file handle to get the stat information.
Returns
The sftp attributes structure of the file or directory, NULL on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_fstatvfs
— Methodsftp_fstatvfs(file)
Get information about a mounted file system.
Arguments
file
: An opened file.
Returns
A statvfs structure or NULL on error.
See also
sourceLibSSH.lib.sftp_fsync
— Methodsftp_fsync(file)
Synchronize a file's in-core state with storage device
This calls the "fsync@openssh.com" extension. You should check if the extensions is supported using:
int supported = sftp_extension_supported(sftp, "fsync@openssh.com", "1");
Arguments
file
: The opened sftp file handle to sync
Returns
0 on success, < 0 on error with ssh and sftp error set.
sourceLibSSH.lib.sftp_get_error
— Methodsftp_get_error(sftp)
Get the last sftp error.
Use this function to get the latest error set by a posix like sftp function.
Arguments
sftp
: The sftp session where the error is saved.
Returns
The saved error (see server responses), < 0 if an error in the function occurred.
See also
Server responses
sourceLibSSH.lib.sftp_hardlink
— Methodsftp_hardlink(sftp, oldpath, newpath)
Create a hard link.
Arguments
sftp
: The sftp session handle.oldpath
: Specifies the pathname of the file for which the new hardlink is to be created.newpath
: Specifies the pathname of the hardlink to be created.
Returns
0 on success, -1 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_home_directory
— Methodsftp_home_directory(sftp::sftp_session, username::Ptr{Cchar})
Auto-generated wrapper around sftp_home_directory()
. Original upstream documentation is below.
Get the specified user's home directory
This calls the "home-directory" extension. You should check if the extension is supported using:
int supported = sftp_extension_supported(sftp, "home-directory", "1");
Arguments
sftp
: The sftp session handle.username
: username of the user whose home directory is requested.
Returns
On success, a newly allocated string containing the absolute real-path of the home directory of the user. NULL on error. The caller needs to free the memory using ssh_string_free_char
().
sourceLibSSH.lib.sftp_init
— Methodsftp_init(sftp::sftp_session)
Auto-generated wrapper around sftp_init()
. Original upstream documentation is below.
Initialize the sftp protocol with the server.
This function involves the SFTP protocol initialization (as described in the SFTP specification), including the version and extensions negotiation.
Arguments
sftp
: The sftp session to initialize.
Returns
0 on success, < 0 on error with ssh error set.
See also
sftp_new
()
sourceLibSSH.lib.sftp_limits
— Methodsftp_limits(sftp)
Get information about the various limits the server might impose.
Arguments
sftp
: The sftp session handle.
Returns
A limits structure or NULL on error.
See also
sourceLibSSH.lib.sftp_limits_free
— Methodsftp_limits_free(limits)
Free the memory of an allocated limits.
Arguments
limits
: The limits to free.
sourceLibSSH.lib.sftp_lsetstat
— Methodsftp_lsetstat(sftp, file, attr)
This request is like setstat (excluding mode and size) but sets file attributes on symlinks themselves.
Note, that this function can only set time values using 32 bit values due to the restrictions in the SFTP protocol version 3 implemented by libssh. The support for 64 bit time values was introduced in SFTP version 5, which is not implemented by libssh nor any major SFTP servers.
Arguments
sftp
: The sftp session handle.file
: The symbolic link which attributes should be changed.attr
: The file attributes structure with the attributes set which should be changed.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_lstat
— Methodsftp_lstat(session, path)
Get information about a file or directory.
Identical to sftp_stat
, but if the file or directory is a symbolic link, then the link itself is stated, not the file that it refers to.
Arguments
session
: The sftp session handle.path
: The path to the file or directory to obtain the information.
Returns
The sftp attributes structure of the file or directory, NULL on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_mkdir
— Methodsftp_mkdir(sftp::sftp_session, directory::Ptr{Cchar}, mode::mode_t)
Auto-generated wrapper around sftp_mkdir()
. Original upstream documentation is below.
Create a directory.
Arguments
sftp
: The sftp session handle.directory
: The directory to create.mode
: Specifies the permissions to use. It is modified by the process's umask in the usual way: The permissions of the created file are (mode & ~umask)
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_new
— Methodsftp_new(session::ssh_session)
Auto-generated wrapper around sftp_new()
. Original upstream documentation is below.
Creates a new sftp session.
This function creates a new sftp session and allocates a new sftp channel with the server inside of the provided ssh session. This function call is usually followed by the sftp_init
(), which initializes SFTP protocol itself.
Arguments
session
: The ssh session to use.
Returns
A new sftp session or NULL on error.
See also
sourceLibSSH.lib.sftp_new_channel
— Methodsftp_new_channel(session, channel)
Start a new sftp session with an existing channel.
Arguments
session
: The ssh session to use.channel
: An open session channel with subsystem already allocated
Returns
A new sftp session or NULL on error.
See also
sourceLibSSH.lib.sftp_open
— Methodsftp_open(session::sftp_session, file::Ptr{Cchar}, accesstype::Cint, mode::mode_t)
Auto-generated wrapper around sftp_open()
. Original upstream documentation is below.
Open a file on the server.
Arguments
session
: The sftp session handle.file
: The file to be opened.accesstype
: Is one of O_RDONLY, O_WRONLY or O_RDWR which request opening the file read-only,write-only or read/write. Acesss may also be bitwise-or'd with one or more of the following: O_CREAT - If the file does not exist it will be created. O_EXCL - When used with O_CREAT, if the file already exists it is an error and the open will fail. O_TRUNC - If the file already exists it will be truncated.mode
: Mode specifies the permissions to use if a new file is created. It is modified by the process's umask in the usual way: The permissions of the created file are (mode & ~umask)
Returns
A sftp file handle, NULL on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_opendir
— Methodsftp_opendir(session::sftp_session, path::Ptr{Cchar})
Auto-generated wrapper around sftp_opendir()
. Original upstream documentation is below.
Open a directory used to obtain directory entries.
Arguments
session
: The sftp session handle to open the directory.path
: The path of the directory to open.
Returns
A sftp directory handle or NULL on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_read
— Methodsftp_read(file, buf, count)
Read from a file using an opened sftp file handle.
This function caps the length a user is allowed to read from an sftp file.
The value used for the cap is same as the value of the max_read_length field of the sftp_limits_t
returned by sftp_limits
().
Arguments
file
: The opened sftp file handle to be read from.buf
: Pointer to buffer to receive read data.count
: Size of the buffer in bytes.
Returns
Number of bytes read, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_readdir
— Methodsftp_readdir(session::sftp_session, dir::sftp_dir)
Auto-generated wrapper around sftp_readdir()
. Original upstream documentation is below.
Get a single file attributes structure of a directory.
Arguments
session
: The sftp session handle to read the directory entry.dir
: The opened sftp directory handle to read from.
Returns
A file attribute structure or NULL at the end of the directory.
See also
sftp_opendir
(), sftp_attribute_free(), sftp_closedir
()
sourceLibSSH.lib.sftp_readlink
— Methodsftp_readlink(sftp, path)
Read the value of a symbolic link.
Arguments
sftp
: The sftp session handle.path
: Specifies the path name of the symlink to be read.
Returns
The target of the link, NULL on error. The caller needs to free the memory using ssh_string_free_char
().
See also
sourceLibSSH.lib.sftp_rename
— Methodsftp_rename(sftp::sftp_session, original::Ptr{Cchar}, newname::Ptr{Cchar})
Auto-generated wrapper around sftp_rename()
. Original upstream documentation is below.
Rename or move a file or directory.
Arguments
sftp
: The sftp session handle.original
: The original url (source url) of file or directory to be moved.newname
: The new url (destination url) of the file or directory after the move.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_rewind
— Methodsftp_rewind(file)
Rewinds the position of the file pointer to the beginning of the file.
Arguments
file
: Open sftp file handle.
sourceLibSSH.lib.sftp_rmdir
— Methodsftp_rmdir(sftp::sftp_session, directory::Ptr{Cchar})
Auto-generated wrapper around sftp_rmdir()
. Original upstream documentation is below.
Remove a directory.
Arguments
sftp
: The sftp session handle.directory
: The directory to remove.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_seek
— Methodsftp_seek(file, new_offset)
Seek to a specific location in a file.
Arguments
file
: Open sftp file handle to seek in.new_offset
: Offset in bytes to seek.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.sftp_seek64
— Methodsftp_seek64(file, new_offset)
Seek to a specific location in a file. This is the 64bit version.
Arguments
file
: Open sftp file handle to seek in.new_offset
: Offset in bytes to seek.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.sftp_server_free
— Methodsftp_server_free(sftp)
Close and deallocate a sftp server session.
Arguments
sftp
: The sftp session handle to free.
sourceLibSSH.lib.sftp_server_init
— Methodsftp_server_init(sftp)
Initialize the sftp server.
Arguments
sftp
: The sftp session to init.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.sftp_server_new
— Methodsftp_server_new(session, chan)
Create a new sftp server session.
Arguments
session
: The ssh session to use.chan
: The ssh channel to use.
Returns
A new sftp server session.
sourceLibSSH.lib.sftp_server_version
— Methodsftp_server_version(sftp)
Get the version of the SFTP protocol supported by the server
Arguments
sftp
: The sftp session handle.
Returns
The server version.
sourceLibSSH.lib.sftp_setstat
— Methodsftp_setstat(sftp, file, attr)
Set file attributes on a file, directory or symbolic link.
Note, that this function can only set time values using 32 bit values due to the restrictions in the SFTP protocol version 3 implemented by libssh. The support for 64 bit time values was introduced in SFTP version 5, which is not implemented by libssh nor any major SFTP servers.
Arguments
sftp
: The sftp session handle.file
: The file which attributes should be changed.attr
: The file attributes structure with the attributes set which should be changed.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_stat
— Methodsftp_stat(session::sftp_session, path::Ptr{Cchar})
Auto-generated wrapper around sftp_stat()
. Original upstream documentation is below.
Get information about a file or directory.
Arguments
session
: The sftp session handle.path
: The path to the file or directory to obtain the information.
Returns
The sftp attributes structure of the file or directory, NULL on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_statvfs
— Methodsftp_statvfs(sftp, path)
Get information about a mounted file system.
Arguments
sftp
: The sftp session handle.path
: The pathname of any file within the mounted file system.
Returns
A statvfs structure or NULL on error.
See also
sourceLibSSH.lib.sftp_statvfs_free
— Methodsftp_statvfs_free(statvfs_o)
Free the memory of an allocated statvfs.
Arguments
statvfs_o
: The statvfs to free.
sourceLibSSH.lib.sftp_symlink
— Methodsftp_symlink(sftp, target, dest)
Create a symbolic link.
Arguments
sftp
: The sftp session handle.target
: Specifies the target of the symlink.dest
: Specifies the path name of the symlink to be created.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_tell
— Methodsftp_tell(file)
Report current byte position in file.
Arguments
file
: Open sftp file handle.
Returns
The offset of the current byte relative to the beginning of the file associated with the file descriptor. < 0 on error.
sourceLibSSH.lib.sftp_tell64
— Methodsftp_tell64(file)
Report current byte position in file.
Arguments
file
: Open sftp file handle.
Returns
The offset of the current byte relative to the beginning of the file associated with the file descriptor.
sourceLibSSH.lib.sftp_unlink
— Methodsftp_unlink(sftp::sftp_session, file::Ptr{Cchar})
Auto-generated wrapper around sftp_unlink()
. Original upstream documentation is below.
Unlink (delete) a file.
Arguments
sftp
: The sftp session handle.file
: The file to unlink/delete.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_utimes
— Methodsftp_utimes(sftp, file, times)
Change the last modification and access time of a file.
Arguments
sftp
: The sftp session handle.file
: The file which owner and group should be changed.times
: A timeval structure which contains the desired access and modification time.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_write
— Methodsftp_write(file, buf, count)
Write to a file using an opened sftp file handle.
This function caps the length a user is allowed to write to an sftp file.
The value used for the cap is same as the value of the max_write_length field of the sftp_limits_t
returned by sftp_limits
().
Arguments
file
: Open sftp file handle to write to.buf
: Pointer to buffer to write data.count
: Size of buffer in bytes.
Returns
Number of bytes written, < 0 on error with ssh and sftp error set.
See also
sftp_open
(), sftp_read
(), sftp_close
()
sourceThreading
LibSSH.lib.ssh_threads_get_default
— Methodssh_threads_get_default()
Returns a pointer to the appropriate callbacks structure for the environment, to be used with ssh_threads_set_callbacks
.
Returns
A pointer to a ssh_threads_callbacks_struct
to be used with ssh_threads_set_callbacks
.
See also
sourceLibSSH.lib.ssh_threads_get_noop
— Methodssh_threads_get_noop()
Get the noop threads callbacks structure
This can be used with ssh_threads_set_callbacks
. These callbacks do nothing and are being used by default.
Returns
Always returns a valid pointer to the noop callbacks structure.
See also
sourceLibSSH.lib.ssh_threads_get_pthread
— Methodssh_threads_get_pthread()
Returns a pointer on the pthread threads callbacks, to be used with ssh_threads_set_callbacks
.
See also
sourceLibSSH.lib.ssh_threads_set_callbacks
— Methodssh_threads_set_callbacks(cb)
Set the thread callbacks structure.
This is necessary if your program is using libssh in a multithreaded fashion. This function must be called first, outside of any threading context (in your main() function for instance), before you call ssh_init
().
Known bug libgcrypt 1.6 and bigger backend does not support custom callback. Using anything else than pthreads here will fail.
Arguments
cb
:[in] A pointer to a ssh_threads_callbacks_struct
structure, which contains the different callbacks to be set.
Returns
Always returns SSH_OK
.
See also
ssh_threads_callbacks_struct
, SSH_THREADS_PTHREAD
sourceOther
LibSSH.lib.ssh_message_auth_interactive_request
— Methodssh_message_auth_interactive_request(msg, name, instruction, num_prompts, prompts, echo)
Initiate keyboard-interactive authentication from a server.
sourceLibSSH.lib.ssh_message_auth_reply_success
— Methodssh_message_auth_reply_success(msg, partial; throw = true)
Auto-generated wrapper around ssh_message_auth_reply_success()
.
sourceLibSSH.lib.sftp_limits_struct
— Typesftp_limits_struct
SFTP limits structure.
sourceLibSSH.lib.sftp_limits_t
— TypePointer to a sftp_limits_struct
sourceLibSSH.lib.sftp_statvfs_struct
— Typesftp_statvfs_struct
SFTP statvfs structure.
sourceLibSSH.lib.ssh_auth_callback
— TypeSSH authentication callback for password and publickey auth.
Arguments
prompt
: Prompt to be displayed.buf
: Buffer to save the password. You should null-terminate it.len
: Length of the buffer.echo
: Enable or disable the echo of what you type.verify
: Should the password be verified?userdata
: Userdata to be passed to the callback function. Useful for GUI applications.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.ssh_auth_gssapi_mic_callback
— TypeSSH authentication callback. Tries to authenticates user with the "gssapi-with-mic" method
Warning Implementations should verify that parameter user matches in some way the principal. user and principal can be different. Only the latter is guaranteed to be safe.
Arguments
session
: Current session handleruser
: Username of the user (can be spoofed)principal
: Authenticated principal of the user, including realm.userdata
: Userdata to be passed to the callback function.
Returns
SSH_AUTH_DENIED Authentication failed.
sourceLibSSH.lib.ssh_auth_none_callback
— TypeSSH authentication callback. Tries to authenticates user with the "none" method which is anonymous or passwordless.
Arguments
session
: Current session handleruser
: User that wants to authenticateuserdata
: Userdata to be passed to the callback function.
Returns
SSH_AUTH_DENIED Authentication failed.
sourceLibSSH.lib.ssh_auth_password_callback
— TypeSSH authentication callback.
Arguments
session
: Current session handleruser
: User that wants to authenticatepassword
: Password used for authenticationuserdata
: Userdata to be passed to the callback function.
Returns
SSH_AUTH_DENIED Authentication failed.
sourceLibSSH.lib.ssh_auth_pubkey_callback
— TypeSSH authentication callback.
Arguments
session
: Current session handleruser
: User that wants to authenticatepubkey
: public key used for authenticationsignature_state
: SSH_PUBLICKEY_STATE_NONE if the key is not signed (simple public key probe), SSH_PUBLICKEY_STATE_VALID if the signature is valid. Others values should be replied with a SSH_AUTH_DENIED.userdata
: Userdata to be passed to the callback function.
Returns
SSH_AUTH_DENIED Authentication failed.
sourceLibSSH.lib.ssh_bind
— Typesource LibSSH.lib.ssh_bind_callbacks
— TypeCallbacks for a ssh_bind
(upstream documentation).
sourceLibSSH.lib.ssh_bind_callbacks_struct
— Typessh_bind_callbacks_struct
These are the callbacks exported by the ssh_bind
structure.
They are called by the server module when events appear on the network.
sourceLibSSH.lib.ssh_bind_incoming_connection_callback
— TypeIncoming connection callback. This callback is called when a ssh_bind
has a new incoming connection.
Arguments
sshbind
: Current sshbind session handleruserdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_callback_data
— Type @brief callback for data received messages.
+ ssh_bind_set_callbacks(session, &cb);
Arguments
sshbind
:[in] The bind to set the callback on.callbacks
:[in] An already set up ssh_bind_callbacks
instance.userdata
:[in] A pointer to private data to pass to the callbacks.
Returns
sourceLibSSH.lib.ssh_bind_set_fd
— Methodssh_bind_set_fd(ssh_bind_o, fd)
Set the file descriptor for a session.
Arguments
ssh_bind_o
: The ssh server bind to set the fd.fd
: The file descriptssh_bind B
sourceLibSSH.lib.ssh_gssapi_get_creds
— Methodssh_gssapi_get_creds(session)
sourceLibSSH.lib.ssh_handle_key_exchange
— Methodssh_handle_key_exchange(session)
Handles the key exchange and set up encryption
Arguments
session
: A connected ssh session
Returns
SSH_OK
if the key exchange was successful
See also
sourceLibSSH.lib.ssh_message_auth_kbdint_is_response
— Methodssh_message_auth_kbdint_is_response(msg)
Auto-generated wrapper around ssh_message_auth_kbdint_is_response()
.
sourceLibSSH.lib.ssh_message_auth_password
— Methodssh_message_auth_password(msg; throw = true)
Auto-generated wrapper around ssh_message_auth_password()
. Original upstream documentation is below.
Get the password of the authenticated user.
Deprecated This function should not be used anymore as there is a callback based server implementation now auth_password_function.
Arguments
msg
:[in] The message to get the password from.
Returns
The password or NULL if an error occurred.
See also
sourceLibSSH.lib.ssh_message_auth_pubkey
— Methodssh_message_auth_pubkey(msg)
Get the publickey of the authenticated user.
If you need the key for later user you should duplicate it.
Deprecated This function should not be used anymore as there is a callback based server implementation auth_pubkey_function.
Arguments
msg
:[in] The message to get the public key from.
Returns
The public key or NULL.
See also
ssh_key_dup
(), ssh_key_cmp
(), ssh_message_get
(), ssh_message_type
()
sourceLibSSH.lib.ssh_message_auth_publickey_state
— Methodssh_message_auth_publickey_state(msg)
Deprecated This function should not be used anymore as there is a callback based server implementation auth_pubkey_function
Arguments
msg
:[in] The message to get the public key state from.
sourceLibSSH.lib.ssh_message_auth_reply_pk_ok
— Methodssh_message_auth_reply_pk_ok(msg, algo, pubkey)
sourceLibSSH.lib.ssh_message_auth_reply_pk_ok_simple
— Methodssh_message_auth_reply_pk_ok_simple(msg)
sourceLibSSH.lib.ssh_message_auth_set_methods
— Methodssh_message_auth_set_methods(msg, methods; throw = true)
Auto-generated wrapper around ssh_message_auth_set_methods()
.
sourceLibSSH.lib.ssh_message_auth_user
— Methodssh_message_auth_user(msg; throw = true)
Auto-generated wrapper around ssh_message_auth_user()
. Original upstream documentation is below.
Get the name of the authenticated user.
Arguments
msg
:[in] The message to get the username from.
Returns
The username or NULL if an error occurred.
See also
sourceLibSSH.lib.ssh_message_global_request_reply_success
— Methodssh_message_global_request_reply_success(msg, bound_port)
sourceLibSSH.lib.ssh_message_reply_default
— Methodssh_message_reply_default(msg; throw = true)
Auto-generated wrapper around ssh_message_reply_default()
. Original upstream documentation is below.
Reply with a standard reject message.
Use this function if you don't know what to respond or if you want to reject a request.
Arguments
msg
:[in] The message to use for the reply.
Returns
0 on success, -1 on error.
See also
sourceLibSSH.lib.ssh_message_service_reply_success
— Methodssh_message_service_reply_success(msg)
sourceLibSSH.lib.ssh_message_service_service
— Methodssh_message_service_service(msg)
sourceLibSSH.lib.ssh_send_issue_banner
— Methodssh_send_issue_banner(session, banner)
Send the server's issue-banner to client.
Arguments
session
:[in] The server session.banner
:[in] The server's banner.
Returns
sourceLibSSH.lib.ssh_send_keepalive
— Methodssh_send_keepalive(session)
sourceLibSSH.lib.ssh_server_init_kex
— Methodssh_server_init_kex(session)
Initialize the set of key exchange, hostkey, ciphers, MACs, and compression algorithms for the given ssh_session
.
The selection of algorithms and keys used are determined by the options that are currently set in the given ssh_session
structure. May only be called before the initial key exchange has begun.
Arguments
session
: The session structure to initialize.
Returns
SSH_OK
if initialization succeeds.
See also
sourceLibSSH.lib.ssh_set_auth_methods
— Methodssh_set_auth_methods(session, auth_methods)
Set the acceptable authentication methods to be sent to the client.
Supported methods are:
SSH_AUTH_METHOD_PASSWORD
SSH_AUTH_METHOD_PUBLICKEY
SSH_AUTH_METHOD_HOSTBASED
SSH_AUTH_METHOD_INTERACTIVE
SSH_AUTH_METHOD_GSSAPI_MIC
Arguments
session
:[in] The server sessionauth_methods
:[in] The authentication methods we will support, which can be bitwise-or'd.
sourceLibSSH.lib.ssh_set_message_callback
— Methodssh_set_message_callback(session, ssh_bind_message_callback, data)
sourceSession
LibSSH.lib.ssh_blocking_flush
— Methodssh_blocking_flush(session, timeout)
sourceLibSSH.lib.ssh_clean_pubkey_hash
— Methodssh_clean_pubkey_hash(hash)
sourceLibSSH.lib.ssh_connect
— Methodssh_connect(session)
sourceLibSSH.lib.ssh_copyright
— Methodssh_copyright()
sourceLibSSH.lib.ssh_disconnect
— Methodssh_disconnect(session)
sourceLibSSH.lib.ssh_dump_knownhost
— Methodssh_dump_knownhost(session)
sourceLibSSH.lib.ssh_free
— Methodssh_free(session)
sourceLibSSH.lib.ssh_get_cipher_in
— Methodssh_get_cipher_in(session)
sourceLibSSH.lib.ssh_get_cipher_out
— Methodssh_get_cipher_out(session)
sourceLibSSH.lib.ssh_get_clientbanner
— Methodssh_get_clientbanner(session)
sourceLibSSH.lib.ssh_get_disconnect_message
— Methodssh_get_disconnect_message(session)
sourceLibSSH.lib.ssh_get_fd
— Methodssh_get_fd(session)
sourceLibSSH.lib.ssh_get_fingerprint_hash
— Methodssh_get_fingerprint_hash(type, hash, len)
sourceLibSSH.lib.ssh_get_hmac_in
— Methodssh_get_hmac_in(session)
sourceLibSSH.lib.ssh_get_hmac_out
— Methodssh_get_hmac_out(session)
sourceLibSSH.lib.ssh_get_issue_banner
— Methodssh_get_issue_banner(session)
sourceLibSSH.lib.ssh_get_kex_algo
— Methodssh_get_kex_algo(session)
sourceLibSSH.lib.ssh_get_openssh_version
— Methodssh_get_openssh_version(session)
sourceLibSSH.lib.ssh_get_poll_flags
— Methodssh_get_poll_flags(session)
sourceLibSSH.lib.ssh_get_pubkey_hash
— Methodssh_get_pubkey_hash(session, hash)
sourceLibSSH.lib.ssh_get_publickey
— Methodssh_get_publickey(session, key)
sourceLibSSH.lib.ssh_get_publickey_hash
— Methodssh_get_publickey_hash(key, type, hash, hlen)
sourceLibSSH.lib.ssh_get_server_publickey
— Methodssh_get_server_publickey(session, key)
sourceLibSSH.lib.ssh_get_serverbanner
— Methodssh_get_serverbanner(session)
sourceLibSSH.lib.ssh_get_status
— Methodssh_get_status(session)
sourceLibSSH.lib.ssh_get_version
— Methodssh_get_version(session)
sourceLibSSH.lib.ssh_is_blocking
— Methodssh_is_blocking(session)
sourceLibSSH.lib.ssh_is_connected
— Methodssh_is_connected(session)
sourceLibSSH.lib.ssh_is_server_known
— Methodssh_is_server_known(session)
sourceLibSSH.lib.ssh_known_hosts_parse_line
— Methodssh_known_hosts_parse_line(host, line, entry)
sourceLibSSH.lib.ssh_knownhosts_entry_free
— Methodssh_knownhosts_entry_free(entry)
sourceLibSSH.lib.ssh_new
— Methodssh_new()
sourceLibSSH.lib.ssh_options_copy
— Methodssh_options_copy(src, dest)
sourceLibSSH.lib.ssh_options_get
— Methodssh_options_get(session, type, value; throw = true)
Auto-generated wrapper around ssh_options_get()
.
sourceLibSSH.lib.ssh_options_get_port
— Methodssh_options_get_port(session, port_target; throw = true)
Auto-generated wrapper around ssh_options_get_port()
.
sourceLibSSH.lib.ssh_options_getopt
— Methodssh_options_getopt(session, argcptr, argv)
sourceLibSSH.lib.ssh_options_parse_config
— Methodssh_options_parse_config(session, filename)
sourceLibSSH.lib.ssh_options_set
— Methodssh_options_set(session, type, value; throw = true)
Auto-generated wrapper around ssh_options_set()
.
sourceLibSSH.lib.ssh_print_hash
— Methodssh_print_hash(type, hash, len)
sourceLibSSH.lib.ssh_request_no_more_sessions
— Methodssh_request_no_more_sessions(session)
sourceLibSSH.lib.ssh_select
— Methodssh_select(channels, outchannels, maxfd, readfds, timeout)
sourceLibSSH.lib.ssh_send_debug
— Methodssh_send_debug(session, message, always_display)
sourceLibSSH.lib.ssh_send_ignore
— Methodssh_send_ignore(session, data)
sourceLibSSH.lib.ssh_session_export_known_hosts_entry
— Methodssh_session_export_known_hosts_entry(session, pentry_string)
sourceLibSSH.lib.ssh_session_get_known_hosts_entry
— Methodssh_session_get_known_hosts_entry(session, pentry)
sourceLibSSH.lib.ssh_session_has_known_hosts_entry
— Methodssh_session_has_known_hosts_entry(session)
sourceLibSSH.lib.ssh_session_is_known_server
— Methodssh_session_is_known_server(session)
sourceLibSSH.lib.ssh_session_set_disconnect_message
— Methodssh_session_set_disconnect_message(session, message)
sourceLibSSH.lib.ssh_session_update_known_hosts
— Methodssh_session_update_known_hosts(session)
sourceLibSSH.lib.ssh_set_blocking
— Methodssh_set_blocking(session, blocking)
sourceLibSSH.lib.ssh_set_counters
— Methodssh_set_counters(session, scounter, rcounter)
sourceLibSSH.lib.ssh_set_fd_except
— Methodssh_set_fd_except(session)
sourceLibSSH.lib.ssh_set_fd_toread
— Methodssh_set_fd_toread(session)
sourceLibSSH.lib.ssh_set_fd_towrite
— Methodssh_set_fd_towrite(session)
sourceLibSSH.lib.ssh_silent_disconnect
— Methodssh_silent_disconnect(session)
sourceLibSSH.lib.ssh_write_knownhost
— Methodssh_write_knownhost(session)
sourceStrings
LibSSH.lib.ssh_string_burn
— Methodssh_string_burn(str)
sourceLibSSH.lib.ssh_string_copy
— Methodssh_string_copy(str)
sourceLibSSH.lib.ssh_string_data
— Methodssh_string_data(str)
sourceLibSSH.lib.ssh_string_fill
— Methodssh_string_fill(str, data, len)
sourceLibSSH.lib.ssh_string_free
— Methodssh_string_free(str)
sourceLibSSH.lib.ssh_string_free_char
— Methodssh_string_free_char(s)
sourceLibSSH.lib.ssh_string_from_char
— Methodssh_string_from_char(what)
sourceLibSSH.lib.ssh_string_get_char
— Methodssh_string_get_char(str)
sourceLibSSH.lib.ssh_string_len
— Methodssh_string_len(str)
sourceLibSSH.lib.ssh_string_new
— Methodssh_string_new(size)
sourceLibSSH.lib.ssh_string_to_char
— Methodssh_string_to_char(str)
sourceSCP
LibSSH.lib.ssh_scp_accept_request
— Methodssh_scp_accept_request(scp)
sourceLibSSH.lib.ssh_scp_close
— Methodssh_scp_close(scp)
sourceLibSSH.lib.ssh_scp_deny_request
— Methodssh_scp_deny_request(scp, reason)
sourceLibSSH.lib.ssh_scp_free
— Methodssh_scp_free(scp)
sourceLibSSH.lib.ssh_scp_init
— Methodssh_scp_init(scp)
sourceLibSSH.lib.ssh_scp_leave_directory
— Methodssh_scp_leave_directory(scp)
sourceLibSSH.lib.ssh_scp_new
— Methodssh_scp_new(session, mode, location)
sourceLibSSH.lib.ssh_scp_pull_request
— Methodssh_scp_pull_request(scp)
sourceLibSSH.lib.ssh_scp_push_directory
— Methodssh_scp_push_directory(scp, dirname, mode)
sourceLibSSH.lib.ssh_scp_push_file
— Methodssh_scp_push_file(scp, filename, size, perms)
sourceLibSSH.lib.ssh_scp_push_file64
— Methodssh_scp_push_file64(scp, filename, size, perms)
sourceLibSSH.lib.ssh_scp_read
— Methodssh_scp_read(scp, buffer, size)
sourceLibSSH.lib.ssh_scp_request_get_filename
— Methodssh_scp_request_get_filename(scp)
sourceLibSSH.lib.ssh_scp_request_get_permissions
— Methodssh_scp_request_get_permissions(scp)
sourceLibSSH.lib.ssh_scp_request_get_size
— Methodssh_scp_request_get_size(scp)
sourceLibSSH.lib.ssh_scp_request_get_size64
— Methodssh_scp_request_get_size64(scp)
sourceLibSSH.lib.ssh_scp_request_get_warning
— Methodssh_scp_request_get_warning(scp)
sourceLibSSH.lib.ssh_scp_write
— Methodssh_scp_write(scp, buffer, len)
sourceSFTP
LibSSH.lib.sftp_aio_begin_read
— Methodsftp_aio_begin_read(file, len, aio)
Start an asynchronous read from a file using an opened sftp file handle.
Its goal is to avoid the slowdowns related to the request/response pattern of a synchronous read. To do so, you must call 2 functions :
sftp_aio_begin_read
() and sftp_aio_wait_read
().
The first step is to call sftp_aio_begin_read
(). This function sends a read request to the sftp server, dynamically allocates memory to store information about the sent request and provides the caller an sftp aio handle to that memory.
The second step is to call sftp_aio_wait_read
() and pass it the address of a location storing the sftp aio handle provided by sftp_aio_begin_read
().
These two functions do not close the open sftp file handle passed to sftp_aio_begin_read
() irrespective of whether they fail or not.
It is the responsibility of the caller to ensure that the open sftp file handle passed to sftp_aio_begin_read
() must not be closed before the corresponding call to sftp_aio_wait_read
(). After sftp_aio_wait_read
() returns, it is caller's decision whether to immediately close the file by calling sftp_close
() or to keep it open and perform some more operations on it.
This function caps the length a user is allowed to read from an sftp file, the value of len parameter after capping is returned on success.
The value used for the cap is same as the value of the max_read_length field of the sftp_limits_t
returned by sftp_limits
().
Warning When calling this function, the internal file offset is updated corresponding to the number of bytes requested to read.
Warning A call to sftp_aio_begin_read
() sends a request to the server. When the server answers, libssh allocates memory to store it until sftp_aio_wait_read
() is called. Not calling sftp_aio_wait_read
() will lead to memory leaks.
Arguments
file
: The opened sftp file handle to be read from.len
: Number of bytes to read.aio
: Pointer to a location where the sftp aio handle (corresponding to the sent request) should be stored.
Returns
On success, the number of bytes the server is requested to read (value of len parameter after capping). On error, SSH_ERROR
with sftp and ssh errors set.
See also
sftp_aio_wait_read
(), sftp_aio_free
(), sftp_open
(), sftp_close
(), sftp_get_error
(), ssh_get_error
()
sourceLibSSH.lib.sftp_aio_begin_write
— Methodsftp_aio_begin_write(file, buf, len, aio)
Start an asynchronous write to a file using an opened sftp file handle.
Its goal is to avoid the slowdowns related to the request/response pattern of a synchronous write. To do so, you must call 2 functions :
sftp_aio_begin_write
() and sftp_aio_wait_write
().
The first step is to call sftp_aio_begin_write
(). This function sends a write request to the sftp server, dynamically allocates memory to store information about the sent request and provides the caller an sftp aio handle to that memory.
The second step is to call sftp_aio_wait_write
() and pass it the address of a location storing the sftp aio handle provided by sftp_aio_begin_write
().
These two functions do not close the open sftp file handle passed to sftp_aio_begin_write
() irrespective of whether they fail or not.
It is the responsibility of the caller to ensure that the open sftp file handle passed to sftp_aio_begin_write
() must not be closed before the corresponding call to sftp_aio_wait_write
(). After sftp_aio_wait_write
() returns, it is caller's decision whether to immediately close the file by calling sftp_close
() or to keep it open and perform some more operations on it.
This function caps the length a user is allowed to write to an sftp file, the value of len parameter after capping is returned on success.
The value used for the cap is same as the value of the max_write_length field of the sftp_limits_t
returned by sftp_limits
().
Warning When calling this function, the internal file offset is updated corresponding to the number of bytes requested to write.
Warning A call to sftp_aio_begin_write
() sends a request to the server. When the server answers, libssh allocates memory to store it until sftp_aio_wait_write
() is called. Not calling sftp_aio_wait_write
() will lead to memory leaks.
Arguments
file
: The opened sftp file handle to write to.buf
: Pointer to the buffer containing data to write.len
: Number of bytes to write.aio
: Pointer to a location where the sftp aio handle (corresponding to the sent request) should be stored.
Returns
On success, the number of bytes the server is requested to write (value of len parameter after capping). On error, SSH_ERROR
with sftp and ssh errors set.
See also
sftp_aio_wait_write
(), sftp_aio_free
(), sftp_open
(), sftp_close
(), sftp_get_error
(), ssh_get_error
()
sourceLibSSH.lib.sftp_aio_free
— Methodsftp_aio_free(aio)
Deallocate memory corresponding to a sftp aio handle.
This function deallocates memory corresponding to the aio handle returned by the sftp_aio_begin_*() functions. Users can use this function to free memory corresponding to an aio handle for an outstanding async i/o request on encountering some error.
Arguments
aio
: sftp aio handle corresponding to which memory has to be deallocated.
See also
sftp_aio_begin_read
(), sftp_aio_wait_read
(), sftp_aio_begin_write
(), sftp_aio_wait_write
()
sourceLibSSH.lib.sftp_aio_wait_read
— Methodsftp_aio_wait_read(aio::Ptr{sftp_aio}, buf::Ptr{Cvoid}, buf_size::Csize_t)
Auto-generated wrapper around sftp_aio_wait_read()
. Original upstream documentation is below.
Wait for an asynchronous read to complete and store the read data in the supplied buffer.
A pointer to an sftp aio handle should be passed while calling this function. Except when the return value is SSH_AGAIN
, this function releases the memory corresponding to the supplied aio handle and assigns NULL to that aio handle using the passed pointer to that handle.
If the file is opened in non-blocking mode and the request hasn't been executed yet, this function returns SSH_AGAIN
and must be called again using the same sftp aio handle.
Warning A call to this function with an invalid sftp aio handle may never return.
Arguments
aio
: Pointer to the sftp aio handle returned by sftp_aio_begin_read
().buf
: Pointer to the buffer in which read data will be stored.buf_size
: Size of the buffer in bytes. It should be bigger or equal to the length parameter of the sftp_aio_begin_read
() call.
Returns
Number of bytes read, 0 on EOF, SSH_ERROR
if an error occurred, SSH_AGAIN
if the file is opened in nonblocking mode and the request hasn't been executed yet.
See also
sourceLibSSH.lib.sftp_aio_wait_write
— Methodsftp_aio_wait_write(aio::Ptr{sftp_aio})
Auto-generated wrapper around sftp_aio_wait_write()
. Original upstream documentation is below.
Wait for an asynchronous write to complete.
A pointer to an sftp aio handle should be passed while calling this function. Except when the return value is SSH_AGAIN
, this function releases the memory corresponding to the supplied aio handle and assigns NULL to that aio handle using the passed pointer to that handle.
If the file is opened in non-blocking mode and the request hasn't been executed yet, this function returns SSH_AGAIN
and must be called again using the same sftp aio handle.
Warning A call to this function with an invalid sftp aio handle may never return.
Arguments
aio
: Pointer to the sftp aio handle returned by sftp_aio_begin_write
().
Returns
Number of bytes written on success, SSH_ERROR
if an error occurred, SSH_AGAIN
if the file is opened in nonblocking mode and the request hasn't been executed yet.
See also
sourceLibSSH.lib.sftp_async_read
— Methodsftp_async_read(file, data, len, id)
Wait for an asynchronous read to complete and save the data.
Warning A call to this function with an invalid identifier will never return.
Arguments
file
: The opened sftp file handle to be read from.data
: Pointer to buffer to receive read data.len
: Size of the buffer in bytes. It should be bigger or equal to the length parameter of the sftp_async_read_begin
() call.id
: The identifier returned by the sftp_async_read_begin
() function.
Returns
Number of bytes read, 0 on EOF, SSH_ERROR
if an error occurred, SSH_AGAIN
if the file is opened in nonblocking mode and the request hasn't been executed yet.
See also
sourceLibSSH.lib.sftp_async_read_begin
— Methodsftp_async_read_begin(file, len)
Start an asynchronous read from a file using an opened sftp file handle.
Its goal is to avoid the slowdowns related to the request/response pattern of a synchronous read. To do so, you must call 2 functions:
sftp_async_read_begin
() and sftp_async_read
().
The first step is to call sftp_async_read_begin
(). This function returns a request identifier. The second step is to call sftp_async_read
() using the returned identifier.
Warning When calling this function, the internal offset is updated corresponding to the len parameter.
Warning A call to sftp_async_read_begin
() sends a request to the server. When the server answers, libssh allocates memory to store it until sftp_async_read
() is called. Not calling sftp_async_read
() will lead to memory leaks.
Arguments
file
: The opened sftp file handle to be read from.len
: Size to read in bytes.
Returns
An identifier corresponding to the sent request, < 0 on error.
See also
sftp_async_read
(), sftp_open
()
sourceLibSSH.lib.sftp_attributes_free
— Methodsftp_attributes_free(file)
Free a sftp attribute structure.
Arguments
file
: The sftp attribute structure to free.
sourceLibSSH.lib.sftp_canonicalize_path
— Methodsftp_canonicalize_path(sftp, path)
Canonicalize a sftp path.
Arguments
sftp
: The sftp session handle.path
: The path to be canonicalized.
Returns
A pointer to the newly allocated canonicalized path, NULL on error. The caller needs to free the memory using ssh_string_free_char
().
sourceLibSSH.lib.sftp_chmod
— Methodsftp_chmod(sftp, file, mode)
Change permissions of a file
Arguments
sftp
: The sftp session handle.file
: The file which owner and group should be changed.mode
: Specifies the permissions to use. It is modified by the process's umask in the usual way: The permissions of the created file are (mode & ~umask)
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_chown
— Methodsftp_chown(sftp, file, owner, group)
Change the file owner and group
Arguments
sftp
: The sftp session handle.file
: The file which owner and group should be changed.owner
: The new owner which should be set.group
: The new group which should be set.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_close
— Methodsftp_close(file::sftp_file)
Auto-generated wrapper around sftp_close()
. Original upstream documentation is below.
Close an open file handle.
Arguments
file
: The open sftp file handle to close.
Returns
Returns SSH_NO_ERROR or SSH_ERROR
if an error occurred.
See also
sourceLibSSH.lib.sftp_closedir
— Methodsftp_closedir(dir::sftp_dir)
Auto-generated wrapper around sftp_closedir()
. Original upstream documentation is below.
Close a directory handle opened by sftp_opendir
().
Arguments
dir
: The sftp directory handle to close.
Returns
Returns SSH_NO_ERROR or SSH_ERROR
if an error occurred.
sourceLibSSH.lib.sftp_dir_eof
— Methodsftp_dir_eof(dir)
Tell if the directory has reached EOF (End Of File).
Arguments
dir
: The sftp directory handle.
Returns
1 if the directory is EOF, 0 if not.
See also
sourceLibSSH.lib.sftp_expand_path
— Methodsftp_expand_path(sftp, path)
Canonicalize path using expand-path.com extension
Arguments
sftp
: The sftp session handle.path
: The path to be canonicalized.
Returns
A pointer to the newly allocated canonicalized path, NULL on error. The caller needs to free the memory using ssh_string_free_char
().
sourceLibSSH.lib.sftp_extension_supported
— Methodsftp_extension_supported(sftp, name, data)
Check if the given extension is supported.
Example:
sftp_extension_supported(sftp, "statvfs@openssh.com", "2");
Arguments
sftp
: The sftp session to use.name
: The name of the extension.data
: The data of the extension.
Returns
1 if supported, 0 if not.
sourceLibSSH.lib.sftp_extensions_get_count
— Methodsftp_extensions_get_count(sftp)
Get the count of extensions provided by the server.
Arguments
sftp
: The sftp session to use.
Returns
The count of extensions provided by the server, 0 on error or not available.
sourceLibSSH.lib.sftp_extensions_get_data
— Methodsftp_extensions_get_data(sftp, indexn; throw = true)
Auto-generated wrapper around sftp_extensions_get_data()
. Original upstream documentation is below.
Get the data of the extension provided by the server.
This is normally the version number of the extension.
Arguments
sftp
: The sftp session to use.indexn
: The index number of the extension data you want.
Returns
The data of the extension.
sourceLibSSH.lib.sftp_extensions_get_name
— Methodsftp_extensions_get_name(sftp, indexn; throw = true)
Auto-generated wrapper around sftp_extensions_get_name()
. Original upstream documentation is below.
Get the name of the extension provided by the server.
Arguments
sftp
: The sftp session to use.indexn
: The index number of the extension name you want.
Returns
The name of the extension.
sourceLibSSH.lib.sftp_file_set_blocking
— Methodsftp_file_set_blocking(handle)
Make the sftp communication for this file handle blocking.
Arguments
handle
:[in] The file handle to set blocking.
sourceLibSSH.lib.sftp_file_set_nonblocking
— Methodsftp_file_set_nonblocking(handle)
Make the sftp communication for this file handle non blocking.
Arguments
handle
:[in] The file handle to set non blocking.
sourceLibSSH.lib.sftp_free
— Methodsftp_free(sftp)
Close and deallocate a sftp session.
Arguments
sftp
: The sftp session handle to free.
sourceLibSSH.lib.sftp_fstat
— Methodsftp_fstat(file)
Get information about a file or directory from a file handle.
Arguments
file
: The sftp file handle to get the stat information.
Returns
The sftp attributes structure of the file or directory, NULL on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_fstatvfs
— Methodsftp_fstatvfs(file)
Get information about a mounted file system.
Arguments
file
: An opened file.
Returns
A statvfs structure or NULL on error.
See also
sourceLibSSH.lib.sftp_fsync
— Methodsftp_fsync(file)
Synchronize a file's in-core state with storage device
This calls the "fsync@openssh.com" extension. You should check if the extensions is supported using:
int supported = sftp_extension_supported(sftp, "fsync@openssh.com", "1");
Arguments
file
: The opened sftp file handle to sync
Returns
0 on success, < 0 on error with ssh and sftp error set.
sourceLibSSH.lib.sftp_get_error
— Methodsftp_get_error(sftp)
Get the last sftp error.
Use this function to get the latest error set by a posix like sftp function.
Arguments
sftp
: The sftp session where the error is saved.
Returns
The saved error (see server responses), < 0 if an error in the function occurred.
See also
Server responses
sourceLibSSH.lib.sftp_hardlink
— Methodsftp_hardlink(sftp, oldpath, newpath)
Create a hard link.
Arguments
sftp
: The sftp session handle.oldpath
: Specifies the pathname of the file for which the new hardlink is to be created.newpath
: Specifies the pathname of the hardlink to be created.
Returns
0 on success, -1 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_home_directory
— Methodsftp_home_directory(sftp::sftp_session, username::Ptr{Cchar})
Auto-generated wrapper around sftp_home_directory()
. Original upstream documentation is below.
Get the specified user's home directory
This calls the "home-directory" extension. You should check if the extension is supported using:
int supported = sftp_extension_supported(sftp, "home-directory", "1");
Arguments
sftp
: The sftp session handle.username
: username of the user whose home directory is requested.
Returns
On success, a newly allocated string containing the absolute real-path of the home directory of the user. NULL on error. The caller needs to free the memory using ssh_string_free_char
().
sourceLibSSH.lib.sftp_init
— Methodsftp_init(sftp::sftp_session)
Auto-generated wrapper around sftp_init()
. Original upstream documentation is below.
Initialize the sftp protocol with the server.
This function involves the SFTP protocol initialization (as described in the SFTP specification), including the version and extensions negotiation.
Arguments
sftp
: The sftp session to initialize.
Returns
0 on success, < 0 on error with ssh error set.
See also
sftp_new
()
sourceLibSSH.lib.sftp_limits
— Methodsftp_limits(sftp)
Get information about the various limits the server might impose.
Arguments
sftp
: The sftp session handle.
Returns
A limits structure or NULL on error.
See also
sourceLibSSH.lib.sftp_limits_free
— Methodsftp_limits_free(limits)
Free the memory of an allocated limits.
Arguments
limits
: The limits to free.
sourceLibSSH.lib.sftp_lsetstat
— Methodsftp_lsetstat(sftp, file, attr)
This request is like setstat (excluding mode and size) but sets file attributes on symlinks themselves.
Note, that this function can only set time values using 32 bit values due to the restrictions in the SFTP protocol version 3 implemented by libssh. The support for 64 bit time values was introduced in SFTP version 5, which is not implemented by libssh nor any major SFTP servers.
Arguments
sftp
: The sftp session handle.file
: The symbolic link which attributes should be changed.attr
: The file attributes structure with the attributes set which should be changed.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_lstat
— Methodsftp_lstat(session, path)
Get information about a file or directory.
Identical to sftp_stat
, but if the file or directory is a symbolic link, then the link itself is stated, not the file that it refers to.
Arguments
session
: The sftp session handle.path
: The path to the file or directory to obtain the information.
Returns
The sftp attributes structure of the file or directory, NULL on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_mkdir
— Methodsftp_mkdir(sftp::sftp_session, directory::Ptr{Cchar}, mode::mode_t)
Auto-generated wrapper around sftp_mkdir()
. Original upstream documentation is below.
Create a directory.
Arguments
sftp
: The sftp session handle.directory
: The directory to create.mode
: Specifies the permissions to use. It is modified by the process's umask in the usual way: The permissions of the created file are (mode & ~umask)
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_new
— Methodsftp_new(session::ssh_session)
Auto-generated wrapper around sftp_new()
. Original upstream documentation is below.
Creates a new sftp session.
This function creates a new sftp session and allocates a new sftp channel with the server inside of the provided ssh session. This function call is usually followed by the sftp_init
(), which initializes SFTP protocol itself.
Arguments
session
: The ssh session to use.
Returns
A new sftp session or NULL on error.
See also
sourceLibSSH.lib.sftp_new_channel
— Methodsftp_new_channel(session, channel)
Start a new sftp session with an existing channel.
Arguments
session
: The ssh session to use.channel
: An open session channel with subsystem already allocated
Returns
A new sftp session or NULL on error.
See also
sourceLibSSH.lib.sftp_open
— Methodsftp_open(session::sftp_session, file::Ptr{Cchar}, accesstype::Cint, mode::mode_t)
Auto-generated wrapper around sftp_open()
. Original upstream documentation is below.
Open a file on the server.
Arguments
session
: The sftp session handle.file
: The file to be opened.accesstype
: Is one of O_RDONLY, O_WRONLY or O_RDWR which request opening the file read-only,write-only or read/write. Acesss may also be bitwise-or'd with one or more of the following: O_CREAT - If the file does not exist it will be created. O_EXCL - When used with O_CREAT, if the file already exists it is an error and the open will fail. O_TRUNC - If the file already exists it will be truncated.mode
: Mode specifies the permissions to use if a new file is created. It is modified by the process's umask in the usual way: The permissions of the created file are (mode & ~umask)
Returns
A sftp file handle, NULL on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_opendir
— Methodsftp_opendir(session::sftp_session, path::Ptr{Cchar})
Auto-generated wrapper around sftp_opendir()
. Original upstream documentation is below.
Open a directory used to obtain directory entries.
Arguments
session
: The sftp session handle to open the directory.path
: The path of the directory to open.
Returns
A sftp directory handle or NULL on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_read
— Methodsftp_read(file, buf, count)
Read from a file using an opened sftp file handle.
This function caps the length a user is allowed to read from an sftp file.
The value used for the cap is same as the value of the max_read_length field of the sftp_limits_t
returned by sftp_limits
().
Arguments
file
: The opened sftp file handle to be read from.buf
: Pointer to buffer to receive read data.count
: Size of the buffer in bytes.
Returns
Number of bytes read, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_readdir
— Methodsftp_readdir(session::sftp_session, dir::sftp_dir)
Auto-generated wrapper around sftp_readdir()
. Original upstream documentation is below.
Get a single file attributes structure of a directory.
Arguments
session
: The sftp session handle to read the directory entry.dir
: The opened sftp directory handle to read from.
Returns
A file attribute structure or NULL at the end of the directory.
See also
sftp_opendir
(), sftp_attribute_free(), sftp_closedir
()
sourceLibSSH.lib.sftp_readlink
— Methodsftp_readlink(sftp, path)
Read the value of a symbolic link.
Arguments
sftp
: The sftp session handle.path
: Specifies the path name of the symlink to be read.
Returns
The target of the link, NULL on error. The caller needs to free the memory using ssh_string_free_char
().
See also
sourceLibSSH.lib.sftp_rename
— Methodsftp_rename(sftp::sftp_session, original::Ptr{Cchar}, newname::Ptr{Cchar})
Auto-generated wrapper around sftp_rename()
. Original upstream documentation is below.
Rename or move a file or directory.
Arguments
sftp
: The sftp session handle.original
: The original url (source url) of file or directory to be moved.newname
: The new url (destination url) of the file or directory after the move.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_rewind
— Methodsftp_rewind(file)
Rewinds the position of the file pointer to the beginning of the file.
Arguments
file
: Open sftp file handle.
sourceLibSSH.lib.sftp_rmdir
— Methodsftp_rmdir(sftp::sftp_session, directory::Ptr{Cchar})
Auto-generated wrapper around sftp_rmdir()
. Original upstream documentation is below.
Remove a directory.
Arguments
sftp
: The sftp session handle.directory
: The directory to remove.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_seek
— Methodsftp_seek(file, new_offset)
Seek to a specific location in a file.
Arguments
file
: Open sftp file handle to seek in.new_offset
: Offset in bytes to seek.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.sftp_seek64
— Methodsftp_seek64(file, new_offset)
Seek to a specific location in a file. This is the 64bit version.
Arguments
file
: Open sftp file handle to seek in.new_offset
: Offset in bytes to seek.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.sftp_server_free
— Methodsftp_server_free(sftp)
Close and deallocate a sftp server session.
Arguments
sftp
: The sftp session handle to free.
sourceLibSSH.lib.sftp_server_init
— Methodsftp_server_init(sftp)
Initialize the sftp server.
Arguments
sftp
: The sftp session to init.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.sftp_server_new
— Methodsftp_server_new(session, chan)
Create a new sftp server session.
Arguments
session
: The ssh session to use.chan
: The ssh channel to use.
Returns
A new sftp server session.
sourceLibSSH.lib.sftp_server_version
— Methodsftp_server_version(sftp)
Get the version of the SFTP protocol supported by the server
Arguments
sftp
: The sftp session handle.
Returns
The server version.
sourceLibSSH.lib.sftp_setstat
— Methodsftp_setstat(sftp, file, attr)
Set file attributes on a file, directory or symbolic link.
Note, that this function can only set time values using 32 bit values due to the restrictions in the SFTP protocol version 3 implemented by libssh. The support for 64 bit time values was introduced in SFTP version 5, which is not implemented by libssh nor any major SFTP servers.
Arguments
sftp
: The sftp session handle.file
: The file which attributes should be changed.attr
: The file attributes structure with the attributes set which should be changed.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_stat
— Methodsftp_stat(session::sftp_session, path::Ptr{Cchar})
Auto-generated wrapper around sftp_stat()
. Original upstream documentation is below.
Get information about a file or directory.
Arguments
session
: The sftp session handle.path
: The path to the file or directory to obtain the information.
Returns
The sftp attributes structure of the file or directory, NULL on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_statvfs
— Methodsftp_statvfs(sftp, path)
Get information about a mounted file system.
Arguments
sftp
: The sftp session handle.path
: The pathname of any file within the mounted file system.
Returns
A statvfs structure or NULL on error.
See also
sourceLibSSH.lib.sftp_statvfs_free
— Methodsftp_statvfs_free(statvfs_o)
Free the memory of an allocated statvfs.
Arguments
statvfs_o
: The statvfs to free.
sourceLibSSH.lib.sftp_symlink
— Methodsftp_symlink(sftp, target, dest)
Create a symbolic link.
Arguments
sftp
: The sftp session handle.target
: Specifies the target of the symlink.dest
: Specifies the path name of the symlink to be created.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_tell
— Methodsftp_tell(file)
Report current byte position in file.
Arguments
file
: Open sftp file handle.
Returns
The offset of the current byte relative to the beginning of the file associated with the file descriptor. < 0 on error.
sourceLibSSH.lib.sftp_tell64
— Methodsftp_tell64(file)
Report current byte position in file.
Arguments
file
: Open sftp file handle.
Returns
The offset of the current byte relative to the beginning of the file associated with the file descriptor.
sourceLibSSH.lib.sftp_unlink
— Methodsftp_unlink(sftp::sftp_session, file::Ptr{Cchar})
Auto-generated wrapper around sftp_unlink()
. Original upstream documentation is below.
Unlink (delete) a file.
Arguments
sftp
: The sftp session handle.file
: The file to unlink/delete.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_utimes
— Methodsftp_utimes(sftp, file, times)
Change the last modification and access time of a file.
Arguments
sftp
: The sftp session handle.file
: The file which owner and group should be changed.times
: A timeval structure which contains the desired access and modification time.
Returns
0 on success, < 0 on error with ssh and sftp error set.
See also
sourceLibSSH.lib.sftp_write
— Methodsftp_write(file, buf, count)
Write to a file using an opened sftp file handle.
This function caps the length a user is allowed to write to an sftp file.
The value used for the cap is same as the value of the max_write_length field of the sftp_limits_t
returned by sftp_limits
().
Arguments
file
: Open sftp file handle to write to.buf
: Pointer to buffer to write data.count
: Size of buffer in bytes.
Returns
Number of bytes written, < 0 on error with ssh and sftp error set.
See also
sftp_open
(), sftp_read
(), sftp_close
()
sourceThreading
LibSSH.lib.ssh_threads_get_default
— Methodssh_threads_get_default()
Returns a pointer to the appropriate callbacks structure for the environment, to be used with ssh_threads_set_callbacks
.
Returns
A pointer to a ssh_threads_callbacks_struct
to be used with ssh_threads_set_callbacks
.
See also
sourceLibSSH.lib.ssh_threads_get_noop
— Methodssh_threads_get_noop()
Get the noop threads callbacks structure
This can be used with ssh_threads_set_callbacks
. These callbacks do nothing and are being used by default.
Returns
Always returns a valid pointer to the noop callbacks structure.
See also
sourceLibSSH.lib.ssh_threads_get_pthread
— Methodssh_threads_get_pthread()
Returns a pointer on the pthread threads callbacks, to be used with ssh_threads_set_callbacks
.
See also
sourceLibSSH.lib.ssh_threads_set_callbacks
— Methodssh_threads_set_callbacks(cb)
Set the thread callbacks structure.
This is necessary if your program is using libssh in a multithreaded fashion. This function must be called first, outside of any threading context (in your main() function for instance), before you call ssh_init
().
Known bug libgcrypt 1.6 and bigger backend does not support custom callback. Using anything else than pthreads here will fail.
Arguments
cb
:[in] A pointer to a ssh_threads_callbacks_struct
structure, which contains the different callbacks to be set.
Returns
Always returns SSH_OK
.
See also
ssh_threads_callbacks_struct
, SSH_THREADS_PTHREAD
sourceOther
LibSSH.lib.ssh_message_auth_interactive_request
— Methodssh_message_auth_interactive_request(msg, name, instruction, num_prompts, prompts, echo)
Initiate keyboard-interactive authentication from a server.
sourceLibSSH.lib.ssh_message_auth_reply_success
— Methodssh_message_auth_reply_success(msg, partial; throw = true)
Auto-generated wrapper around ssh_message_auth_reply_success()
.
sourceLibSSH.lib.sftp_limits_struct
— Typesftp_limits_struct
SFTP limits structure.
sourceLibSSH.lib.sftp_limits_t
— TypePointer to a sftp_limits_struct
sourceLibSSH.lib.sftp_statvfs_struct
— Typesftp_statvfs_struct
SFTP statvfs structure.
sourceLibSSH.lib.ssh_auth_callback
— TypeSSH authentication callback for password and publickey auth.
Arguments
prompt
: Prompt to be displayed.buf
: Buffer to save the password. You should null-terminate it.len
: Length of the buffer.echo
: Enable or disable the echo of what you type.verify
: Should the password be verified?userdata
: Userdata to be passed to the callback function. Useful for GUI applications.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.ssh_auth_gssapi_mic_callback
— TypeSSH authentication callback. Tries to authenticates user with the "gssapi-with-mic" method
Warning Implementations should verify that parameter user matches in some way the principal. user and principal can be different. Only the latter is guaranteed to be safe.
Arguments
session
: Current session handleruser
: Username of the user (can be spoofed)principal
: Authenticated principal of the user, including realm.userdata
: Userdata to be passed to the callback function.
Returns
SSH_AUTH_DENIED Authentication failed.
sourceLibSSH.lib.ssh_auth_none_callback
— TypeSSH authentication callback. Tries to authenticates user with the "none" method which is anonymous or passwordless.
Arguments
session
: Current session handleruser
: User that wants to authenticateuserdata
: Userdata to be passed to the callback function.
Returns
SSH_AUTH_DENIED Authentication failed.
sourceLibSSH.lib.ssh_auth_password_callback
— TypeSSH authentication callback.
Arguments
session
: Current session handleruser
: User that wants to authenticatepassword
: Password used for authenticationuserdata
: Userdata to be passed to the callback function.
Returns
SSH_AUTH_DENIED Authentication failed.
sourceLibSSH.lib.ssh_auth_pubkey_callback
— TypeSSH authentication callback.
Arguments
session
: Current session handleruser
: User that wants to authenticatepubkey
: public key used for authenticationsignature_state
: SSH_PUBLICKEY_STATE_NONE if the key is not signed (simple public key probe), SSH_PUBLICKEY_STATE_VALID if the signature is valid. Others values should be replied with a SSH_AUTH_DENIED.userdata
: Userdata to be passed to the callback function.
Returns
SSH_AUTH_DENIED Authentication failed.
sourceLibSSH.lib.ssh_bind
— Typesource LibSSH.lib.ssh_bind_callbacks
— TypeCallbacks for a ssh_bind
(upstream documentation).
sourceLibSSH.lib.ssh_bind_callbacks_struct
— Typessh_bind_callbacks_struct
These are the callbacks exported by the ssh_bind
structure.
They are called by the server module when events appear on the network.
sourceLibSSH.lib.ssh_bind_incoming_connection_callback
— TypeIncoming connection callback. This callback is called when a ssh_bind
has a new incoming connection.
Arguments
sshbind
: Current sshbind session handleruserdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_callback_data
— Type @brief callback for data received messages.
@param data data retrieved from the socket or stream
@param len number of bytes available from this stream
@param user user-supplied pointer sent along with all callback messages
@returns number of bytes processed by the callee. The remaining bytes will
be sent in the next callback message, when more data is available.
-
sourceLibSSH.lib.ssh_callback_int
— Type @brief callback to process simple codes
+
sourceLibSSH.lib.ssh_callback_int
— Type @brief callback to process simple codes
@param code value to transmit
@param user Userdata to pass in callback
-
sourceLibSSH.lib.ssh_callbacks_struct
— Typessh_callbacks_struct
The structure to replace libssh functions with appropriate callbacks.
sourceLibSSH.lib.ssh_channel_auth_agent_req_callback
— TypeSSH auth-agent-request from the client. This request is sent by a client when agent forwarding is available. Server is free to ignore this callback, no answer is expected.
Arguments
session
: the sessionchannel
: the channeluserdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_channel_close_callback
— TypeSSH channel close callback. Called when a channel is closed by remote peer
Arguments
session
: Current session handlerchannel
: the actual channeluserdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_channel_data_callback
— TypeSSH channel data callback. Called when data is available on a channel
Arguments
session
: Current session handlerchannel
: the actual channeldata
: the data that has been read on the channellen
: the length of the datais_stderr
: is 0 for stdout or 1 for stderruserdata
: Userdata to be passed to the callback function.
Returns
number of bytes processed by the callee. The remaining bytes will be sent in the next callback message, when more data is available.
sourceLibSSH.lib.ssh_channel_env_request_callback
— TypeSSH channel environment request from a client.
Warning some environment variables can be dangerous if changed (e.g. LD_PRELOAD) and should not be fulfilled.
Arguments
session
: the sessionchannel
: the channelenv_name
: name of the environment value to be setenv_value
: value of the environment value to be setuserdata
: Userdata to be passed to the callback function.
Returns
1 if the request is denied
sourceLibSSH.lib.ssh_channel_eof_callback
— TypeSSH channel eof callback. Called when a channel receives EOF
Arguments
session
: Current session handlerchannel
: the actual channeluserdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_channel_exec_request_callback
— TypeSSH channel Exec request from a client.
Arguments
session
: the sessionchannel
: the channelcommand
: the shell command to be executeduserdata
: Userdata to be passed to the callback function.
Returns
1 if the request is denied
sourceLibSSH.lib.ssh_channel_exit_signal_callback
— TypeSSH channel exit signal callback. Called when a channel has received an exit signal
Arguments
session
: Current session handlerchannel
: the actual channelsignal
: the signal name (without the SIG prefix)core
: a boolean telling whether a core has been dumped or noterrmsg
: the description of the exceptionlang
: the language of the description (format: RFC 3066)userdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_channel_exit_status_callback
— TypeSSH channel exit status callback. Called when a channel has received an exit status
Arguments
session
: Current session handlerchannel
: the actual channelexit_status
: Exit status of the ran commanduserdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_channel_open_request_auth_agent_callback
— TypeHandles an SSH new channel open "auth-agent" request. This happens when the server sends back an "auth-agent" connection attempt. This is a client-side API
Warning The channel pointer returned by this callback must be closed by the application.
Arguments
session
: current session handleruserdata
: Userdata to be passed to the callback function.
Returns
NULL if the request should not be allowed
sourceLibSSH.lib.ssh_channel_open_request_forwarded_tcpip_callback
— TypeHandles an SSH new channel open "forwarded-tcpip" request. This happens when the server forwards an incoming TCP connection on a port it was previously requested to listen on. This is a client-side API
Warning The channel pointer returned by this callback must be closed by the application.
Arguments
session
: current session handlerdestination_address
: the address that the TCP connection connected todestination_port
: the port that the TCP connection connected tooriginator_address
: the originator IP addressoriginator_port
: the originator portuserdata
: Userdata to be passed to the callback function.
Returns
NULL if the request should not be allowed
sourceLibSSH.lib.ssh_channel_open_request_session_callback
— TypeHandles an SSH new channel open session request
Warning The channel pointer returned by this callback must be closed by the application.
Arguments
session
: current session handleruserdata
: Userdata to be passed to the callback function.
Returns
NULL if the request should not be allowed
sourceLibSSH.lib.ssh_channel_open_request_x11_callback
— TypeHandles an SSH new channel open X11 request. This happens when the server sends back an X11 connection attempt. This is a client-side API
Warning The channel pointer returned by this callback must be closed by the application.
Arguments
session
: current session handleruserdata
: Userdata to be passed to the callback function.originator_address
: IP address of the machine who sent the requestoriginator_port
: port number of the machine who sent the request
Returns
NULL if the request should not be allowed
sourceLibSSH.lib.ssh_channel_open_resp_callback
— TypeSSH channel open callback. Called when a channel open succeeds or fails.
Arguments
session
: Current session handlerchannel
: the actual channelis_success
: is 1 when the open succeeds, and 0 otherwise.userdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_channel_pty_request_callback
— TypeSSH channel PTY request from a client.
Arguments
session
: the sessionchannel
: the channelterm
: The type of terminal emulationwidth
: width of the terminal, in charactersheight
: height of the terminal, in characterspxwidth
: width of the terminal, in pixelspwheight
: height of the terminal, in pixelsuserdata
: Userdata to be passed to the callback function.
Returns
-1 if the request is denied
sourceLibSSH.lib.ssh_channel_pty_window_change_callback
— TypeSSH channel PTY windows change (terminal size) from a client.
Arguments
session
: the sessionchannel
: the channelwidth
: width of the terminal, in charactersheight
: height of the terminal, in characterspxwidth
: width of the terminal, in pixelspwheight
: height of the terminal, in pixelsuserdata
: Userdata to be passed to the callback function.
Returns
-1 if the request is denied
sourceLibSSH.lib.ssh_channel_request_resp_callback
— TypeSSH channel request response callback. Called when a response to the pending request is received.
Arguments
session
: Current session handlerchannel
: the actual channeluserdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_channel_shell_request_callback
— TypeSSH channel Shell request from a client.
Arguments
session
: the sessionchannel
: the channeluserdata
: Userdata to be passed to the callback function.
Returns
1 if the request is denied
sourceLibSSH.lib.ssh_channel_signal_callback
— TypeSSH channel signal callback. Called when a channel has received a signal
Arguments
session
: Current session handlerchannel
: the actual channelsignal
: the signal name (without the SIG prefix)userdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_channel_subsystem_request_callback
— TypeSSH channel subsystem request from a client.
Arguments
session
: the sessionchannel
: the channelsubsystem
: the subsystem requireduserdata
: Userdata to be passed to the callback function.
Returns
1 if the request is denied
sourceLibSSH.lib.ssh_channel_write_wontblock_callback
— TypeSSH channel write will not block (flow control).
Arguments
session
: the sessionchannel
: the channelbytes
:[in] size of the remote window in bytes. Writing as much data will not block.userdata
:[in] Userdata to be passed to the callback function.
Returns
0 default return value (other return codes may be added in future).
sourceLibSSH.lib.ssh_channel_x11_req_callback
— TypeSSH X11 request from the client. This request is sent by a client when X11 forwarding is requested(and available). Server is free to ignore this callback, no answer is expected.
Arguments
session
: the sessionchannel
: the channelsingle_connection
: If true, only one channel should be forwardedauth_protocol
: The X11 authentication method to be usedauth_cookie
: Authentication cookie encoded hexadecimalscreen_number
: Screen numberuserdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_control_master_options_e
— Typessh_control_master_options_e
@}
sourceLibSSH.lib.ssh_file_format_e
— Typessh_file_format_e
@}
sourceLibSSH.lib.ssh_global_request_callback
— TypeSSH global request callback. All global request will go through this callback.
Arguments
session
: Current session handlermessage
: the actual messageuserdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_jump_authenticate_callback
— TypeSSH proxyjump user authentication callback. Authenticate the user.
Arguments
session
: Jump session handleruserdata
: Userdata to be passed to the callback function.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.ssh_jump_before_connection_callback
— TypeSSH proxyjump before connection callback. Called before calling ssh_connect
()
Arguments
session
: Jump session handleruserdata
: Userdata to be passed to the callback function.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.ssh_jump_verify_knownhost_callback
— TypeSSH proxyjump verify knownhost callback. Verify the host. If not specified default function will be used.
Arguments
session
: Jump session handleruserdata
: Userdata to be passed to the callback function.
Returns
0 on success, < 0 on error.
sourceLibSSH.lib.ssh_log_callback
— TypeSSH log callback. All logging messages will go through this callback
Arguments
session
: Current session handlerpriority
: Priority of the log, the smaller being the more importantmessage
: the actual messageuserdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_logging_callback
— TypeSSH log callback.
All logging messages will go through this callback.
Arguments
priority
: Priority of the log, the smaller being the more important.function
: The function name calling the logging functions.buffer
: The actual messageuserdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_packet_callback
— TypePrototype for a packet callback, to be called when a new packet arrives
Arguments
session
: The current session of the packettype
: packet type (see ssh2.h)packet
: buffer containing the packet, excluding size, type and padding fieldsuser
: user argument to the callback and are called each time a packet shows up
Returns
SSH_PACKET_NOT_USED
Packet was not used or understood, processing must continue
sourceLibSSH.lib.ssh_server_callbacks_struct
— Typessh_server_callbacks_struct
This structure can be used to implement a libssh server, with appropriate callbacks.
sourceLibSSH.lib.ssh_service_request_callback
— TypeHandles an SSH service request
Arguments
session
: current session handlerservice
: name of the service (e.g. "ssh-userauth") requesteduserdata
: Userdata to be passed to the callback function.
Returns
-1 if the request should not be allowed
sourceLibSSH.lib.ssh_session
— TypeSession struct (upstream documentation).
sourceLibSSH.lib.ssh_socket_callbacks_struct
— Typessh_socket_callbacks_struct
These are the callbacks exported by the socket structure They are called by the socket module when a socket event appears
sourceLibSSH.lib.ssh_status_callback
— TypeSSH Connection status callback.
Arguments
session
: Current session handlerstatus
: Percentage of connection status, going from 0.0 to 1.0 once connection is done.userdata
: Userdata to be passed to the callback function.
sourceLibSSH.lib.ssh_thread_callback
— Typelibssh_threads
@{
sourceLibSSH.lib.ssh_threads_callbacks_struct
— Typessh_threads_callbacks_struct
Threads callbacks. See ssh_threads_set_callbacks
sourceSettings
This document was generated with Documenter.jl version 1.8.0 on Friday 6 December 2024. Using Julia version 1.11.2.
+
LibSSH.lib.ssh_callbacks_struct
— Typessh_callbacks_struct
The structure to replace libssh functions with appropriate callbacks.
LibSSH.lib.ssh_channel_auth_agent_req_callback
— TypeSSH auth-agent-request from the client. This request is sent by a client when agent forwarding is available. Server is free to ignore this callback, no answer is expected.
Arguments
session
: the sessionchannel
: the channeluserdata
: Userdata to be passed to the callback function.
LibSSH.lib.ssh_channel_close_callback
— TypeSSH channel close callback. Called when a channel is closed by remote peer
Arguments
session
: Current session handlerchannel
: the actual channeluserdata
: Userdata to be passed to the callback function.
LibSSH.lib.ssh_channel_data_callback
— TypeSSH channel data callback. Called when data is available on a channel
Arguments
session
: Current session handlerchannel
: the actual channeldata
: the data that has been read on the channellen
: the length of the datais_stderr
: is 0 for stdout or 1 for stderruserdata
: Userdata to be passed to the callback function.
Returns
number of bytes processed by the callee. The remaining bytes will be sent in the next callback message, when more data is available.
LibSSH.lib.ssh_channel_env_request_callback
— TypeSSH channel environment request from a client.
some environment variables can be dangerous if changed (e.g. LD_PRELOAD) and should not be fulfilled.
Arguments
session
: the sessionchannel
: the channelenv_name
: name of the environment value to be setenv_value
: value of the environment value to be setuserdata
: Userdata to be passed to the callback function.
Returns
1 if the request is denied
LibSSH.lib.ssh_channel_eof_callback
— TypeSSH channel eof callback. Called when a channel receives EOF
Arguments
session
: Current session handlerchannel
: the actual channeluserdata
: Userdata to be passed to the callback function.
LibSSH.lib.ssh_channel_exec_request_callback
— TypeSSH channel Exec request from a client.
Arguments
session
: the sessionchannel
: the channelcommand
: the shell command to be executeduserdata
: Userdata to be passed to the callback function.
Returns
1 if the request is denied
LibSSH.lib.ssh_channel_exit_signal_callback
— TypeSSH channel exit signal callback. Called when a channel has received an exit signal
Arguments
session
: Current session handlerchannel
: the actual channelsignal
: the signal name (without the SIG prefix)core
: a boolean telling whether a core has been dumped or noterrmsg
: the description of the exceptionlang
: the language of the description (format: RFC 3066)userdata
: Userdata to be passed to the callback function.
LibSSH.lib.ssh_channel_exit_status_callback
— TypeSSH channel exit status callback. Called when a channel has received an exit status
Arguments
session
: Current session handlerchannel
: the actual channelexit_status
: Exit status of the ran commanduserdata
: Userdata to be passed to the callback function.
LibSSH.lib.ssh_channel_open_request_auth_agent_callback
— TypeHandles an SSH new channel open "auth-agent" request. This happens when the server sends back an "auth-agent" connection attempt. This is a client-side API
The channel pointer returned by this callback must be closed by the application.
Arguments
session
: current session handleruserdata
: Userdata to be passed to the callback function.
Returns
NULL if the request should not be allowed
LibSSH.lib.ssh_channel_open_request_forwarded_tcpip_callback
— TypeHandles an SSH new channel open "forwarded-tcpip" request. This happens when the server forwards an incoming TCP connection on a port it was previously requested to listen on. This is a client-side API
The channel pointer returned by this callback must be closed by the application.
Arguments
session
: current session handlerdestination_address
: the address that the TCP connection connected todestination_port
: the port that the TCP connection connected tooriginator_address
: the originator IP addressoriginator_port
: the originator portuserdata
: Userdata to be passed to the callback function.
Returns
NULL if the request should not be allowed
LibSSH.lib.ssh_channel_open_request_session_callback
— TypeHandles an SSH new channel open session request
The channel pointer returned by this callback must be closed by the application.
Arguments
session
: current session handleruserdata
: Userdata to be passed to the callback function.
Returns
NULL if the request should not be allowed
LibSSH.lib.ssh_channel_open_request_x11_callback
— TypeHandles an SSH new channel open X11 request. This happens when the server sends back an X11 connection attempt. This is a client-side API
The channel pointer returned by this callback must be closed by the application.
Arguments
session
: current session handleruserdata
: Userdata to be passed to the callback function.originator_address
: IP address of the machine who sent the requestoriginator_port
: port number of the machine who sent the request
Returns
NULL if the request should not be allowed
LibSSH.lib.ssh_channel_open_resp_callback
— TypeSSH channel open callback. Called when a channel open succeeds or fails.
Arguments
session
: Current session handlerchannel
: the actual channelis_success
: is 1 when the open succeeds, and 0 otherwise.userdata
: Userdata to be passed to the callback function.
LibSSH.lib.ssh_channel_pty_request_callback
— TypeSSH channel PTY request from a client.
Arguments
session
: the sessionchannel
: the channelterm
: The type of terminal emulationwidth
: width of the terminal, in charactersheight
: height of the terminal, in characterspxwidth
: width of the terminal, in pixelspwheight
: height of the terminal, in pixelsuserdata
: Userdata to be passed to the callback function.
Returns
-1 if the request is denied
LibSSH.lib.ssh_channel_pty_window_change_callback
— TypeSSH channel PTY windows change (terminal size) from a client.
Arguments
session
: the sessionchannel
: the channelwidth
: width of the terminal, in charactersheight
: height of the terminal, in characterspxwidth
: width of the terminal, in pixelspwheight
: height of the terminal, in pixelsuserdata
: Userdata to be passed to the callback function.
Returns
-1 if the request is denied
LibSSH.lib.ssh_channel_request_resp_callback
— TypeSSH channel request response callback. Called when a response to the pending request is received.
Arguments
session
: Current session handlerchannel
: the actual channeluserdata
: Userdata to be passed to the callback function.
LibSSH.lib.ssh_channel_shell_request_callback
— TypeSSH channel Shell request from a client.
Arguments
session
: the sessionchannel
: the channeluserdata
: Userdata to be passed to the callback function.
Returns
1 if the request is denied
LibSSH.lib.ssh_channel_signal_callback
— TypeSSH channel signal callback. Called when a channel has received a signal
Arguments
session
: Current session handlerchannel
: the actual channelsignal
: the signal name (without the SIG prefix)userdata
: Userdata to be passed to the callback function.
LibSSH.lib.ssh_channel_subsystem_request_callback
— TypeSSH channel subsystem request from a client.
Arguments
session
: the sessionchannel
: the channelsubsystem
: the subsystem requireduserdata
: Userdata to be passed to the callback function.
Returns
1 if the request is denied
LibSSH.lib.ssh_channel_write_wontblock_callback
— TypeSSH channel write will not block (flow control).
Arguments
session
: the sessionchannel
: the channelbytes
:[in] size of the remote window in bytes. Writing as much data will not block.userdata
:[in] Userdata to be passed to the callback function.
Returns
0 default return value (other return codes may be added in future).
LibSSH.lib.ssh_channel_x11_req_callback
— TypeSSH X11 request from the client. This request is sent by a client when X11 forwarding is requested(and available). Server is free to ignore this callback, no answer is expected.
Arguments
session
: the sessionchannel
: the channelsingle_connection
: If true, only one channel should be forwardedauth_protocol
: The X11 authentication method to be usedauth_cookie
: Authentication cookie encoded hexadecimalscreen_number
: Screen numberuserdata
: Userdata to be passed to the callback function.
LibSSH.lib.ssh_control_master_options_e
— Typessh_control_master_options_e
@}
LibSSH.lib.ssh_file_format_e
— Typessh_file_format_e
@}
LibSSH.lib.ssh_global_request_callback
— TypeSSH global request callback. All global request will go through this callback.
Arguments
session
: Current session handlermessage
: the actual messageuserdata
: Userdata to be passed to the callback function.
LibSSH.lib.ssh_jump_authenticate_callback
— TypeSSH proxyjump user authentication callback. Authenticate the user.
Arguments
session
: Jump session handleruserdata
: Userdata to be passed to the callback function.
Returns
0 on success, < 0 on error.
LibSSH.lib.ssh_jump_before_connection_callback
— TypeSSH proxyjump before connection callback. Called before calling ssh_connect
()
Arguments
session
: Jump session handleruserdata
: Userdata to be passed to the callback function.
Returns
0 on success, < 0 on error.
LibSSH.lib.ssh_jump_verify_knownhost_callback
— TypeSSH proxyjump verify knownhost callback. Verify the host. If not specified default function will be used.
Arguments
session
: Jump session handleruserdata
: Userdata to be passed to the callback function.
Returns
0 on success, < 0 on error.
LibSSH.lib.ssh_log_callback
— TypeSSH log callback. All logging messages will go through this callback
Arguments
session
: Current session handlerpriority
: Priority of the log, the smaller being the more importantmessage
: the actual messageuserdata
: Userdata to be passed to the callback function.
LibSSH.lib.ssh_logging_callback
— TypeSSH log callback.
All logging messages will go through this callback.
Arguments
priority
: Priority of the log, the smaller being the more important.function
: The function name calling the logging functions.buffer
: The actual messageuserdata
: Userdata to be passed to the callback function.
LibSSH.lib.ssh_packet_callback
— TypePrototype for a packet callback, to be called when a new packet arrives
Arguments
session
: The current session of the packettype
: packet type (see ssh2.h)packet
: buffer containing the packet, excluding size, type and padding fieldsuser
: user argument to the callback and are called each time a packet shows up
Returns
SSH_PACKET_NOT_USED
Packet was not used or understood, processing must continue
LibSSH.lib.ssh_server_callbacks_struct
— Typessh_server_callbacks_struct
This structure can be used to implement a libssh server, with appropriate callbacks.
LibSSH.lib.ssh_service_request_callback
— TypeHandles an SSH service request
Arguments
session
: current session handlerservice
: name of the service (e.g. "ssh-userauth") requesteduserdata
: Userdata to be passed to the callback function.
Returns
-1 if the request should not be allowed
LibSSH.lib.ssh_session
— TypeSession struct (upstream documentation).
LibSSH.lib.ssh_socket_callbacks_struct
— Typessh_socket_callbacks_struct
These are the callbacks exported by the socket structure They are called by the socket module when a socket event appears
LibSSH.lib.ssh_status_callback
— TypeSSH Connection status callback.
Arguments
session
: Current session handlerstatus
: Percentage of connection status, going from 0.0 to 1.0 once connection is done.userdata
: Userdata to be passed to the callback function.
LibSSH.lib.ssh_thread_callback
— Typelibssh_threads
@{
LibSSH.lib.ssh_threads_callbacks_struct
— Typessh_threads_callbacks_struct
Threads callbacks. See ssh_threads_set_callbacks