Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Functions

int ssh_client_start (struct ssh_client *ssh, const char *user_name, const struct net_sockaddr *addr, int host_key_index, ssh_transport_event_callback_t callback, void *user_data)
 Start an SSH client connection.
int ssh_client_stop (struct ssh_client *ssh)
 Stop an SSH client connection.
int ssh_client_register_transport_callback (struct ssh_transport_conf *conf)
 Register a callback function for getting the transport associated with a server connection.
int ssh_client_unregister_transport_callback (struct ssh_transport_conf *conf)
 Unregister a callback function for getting the transport associated with a server connection.
struct ssh_client * ssh_transport_get_client (struct ssh_transport *transport)
 Get the SSH client instance that owns a given transport.

Detailed Description

Since
4.5
Version
0.1.0

Function Documentation

◆ ssh_client_register_transport_callback()

int ssh_client_register_transport_callback ( struct ssh_transport_conf * conf)

#include <client.h>

Register a callback function for getting the transport associated with a server connection.

The registered callback is invoked for client-side transport events. On the client role only the following event types are emitted:

The callback return value is ignored; the callback acts as an observer and cannot influence the transport flow.

Parameters
confConfiguration data for the transport callback. The structure must remain valid until it is unregistered.
Returns
0 on success, or a negative error code on failure.

◆ ssh_client_start()

int ssh_client_start ( struct ssh_client * ssh,
const char * user_name,
const struct net_sockaddr * addr,
int host_key_index,
ssh_transport_event_callback_t callback,
void * user_data )

#include <client.h>

Start an SSH client connection.

Parameters
sshSSH client instance
user_nameUsername to use for authentication
addrAddress of the SSH server to connect to
host_key_indexIndex of the host key to use for verifying the server's identity
callbackCallback to be called on SSH transport events
user_dataUser data to be passed to the callback
Returns
0 on success, negative error code on failure

◆ ssh_client_stop()

int ssh_client_stop ( struct ssh_client * ssh)

#include <client.h>

Stop an SSH client connection.

Parameters
sshSSH client instance
Returns
0 on success, negative error code on failure

◆ ssh_client_unregister_transport_callback()

int ssh_client_unregister_transport_callback ( struct ssh_transport_conf * conf)

#include <client.h>

Unregister a callback function for getting the transport associated with a server connection.

Parameters
confConfiguration data for the transport callback
Returns
0 on success, or a negative error code on failure.

◆ ssh_transport_get_client()

struct ssh_client * ssh_transport_get_client ( struct ssh_transport * transport)

#include <client.h>

Get the SSH client instance that owns a given transport.

This is useful inside a registered transport callback, which is invoked globally for events from all client instances, to determine which client instance a transport belongs to. It must only be called for a transport obtained from a client transport callback.

Parameters
transportTransport to get the owning client for.
Returns
Pointer to the owning SSH client instance, or NULL if the transport is NULL.