|
Zephyr Project API 4.4.99
A Scalable Open Source RTOS
|
Data Structures | |
| struct | ssh_server_event_client_connected |
| Client connection transport data. More... | |
| struct | ssh_server_event_client_disconnected |
| Client disconnection transport data. More... | |
| struct | ssh_server_event |
| SSH server event. More... | |
Typedefs | |
| typedef int(* | ssh_server_event_callback_t) (struct ssh_server *sshd, const struct ssh_server_event *event, void *user_data) |
| Callback function type for SSH server events. | |
Enumerations | |
| enum | ssh_server_event_type { SSH_SERVER_EVENT_CLOSED , SSH_SERVER_EVENT_CLIENT_CONNECTED , SSH_SERVER_EVENT_CLIENT_DISCONNECTED } |
| Server event types. More... | |
Functions | |
| int | ssh_server_start (struct ssh_server *sshd, const struct net_sockaddr *bind_addr, int host_key_index, const char *username, const char *password, const int *authorized_keys, size_t authorized_keys_len, ssh_server_event_callback_t server_callback, ssh_transport_event_callback_t transport_callback, void *user_data) |
| Start an SSH server. | |
| int | ssh_server_stop (struct ssh_server *sshd) |
| Stop an SSH server. | |
| int | ssh_server_transport_close (struct ssh_server *sshd, int idx) |
| Close an SSH server transport connection. | |
| int | ssh_server_register_transport_callback (struct ssh_transport_conf *conf) |
| Register a callback function for getting the transport associated with a client connection. | |
| int | ssh_server_unregister_transport_callback (struct ssh_transport_conf *conf) |
| Unregister a callback function for getting the transport associated with a client connection. | |
| struct ssh_server * | ssh_transport_get_server (struct ssh_transport *transport) |
| Get the SSH server instance that owns a given transport. | |
| typedef int(* ssh_server_event_callback_t) (struct ssh_server *sshd, const struct ssh_server_event *event, void *user_data) |
#include <server.h>
Callback function type for SSH server events.
This callback is invoked by the SSH server to notify the application of various events related to client connections and disconnections. The callback receives a pointer to the SSH server instance, an event structure containing details about the event, and user data provided during server initialization.
| sshd | Pointer to the SSH server instance that is invoking the callback. |
| event | Pointer to a structure containing details about the event that occurred. |
| user_data | Pointer to user-defined data that was provided when the server was started, |
#include <server.h>
Server event types.
| int ssh_server_register_transport_callback | ( | struct ssh_transport_conf * | conf | ) |
#include <server.h>
Register a callback function for getting the transport associated with a client connection.
The registered callback is invoked for server-side transport events. On the server 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.
| conf | Configuration data for the transport callback. The structure must remain valid until it is unregistered. |
| int ssh_server_start | ( | struct ssh_server * | sshd, |
| const struct net_sockaddr * | bind_addr, | ||
| int | host_key_index, | ||
| const char * | username, | ||
| const char * | password, | ||
| const int * | authorized_keys, | ||
| size_t | authorized_keys_len, | ||
| ssh_server_event_callback_t | server_callback, | ||
| ssh_transport_event_callback_t | transport_callback, | ||
| void * | user_data ) |
#include <server.h>
Start an SSH server.
| sshd | Pointer to the SSH server instance to start. |
| bind_addr | Network address to bind the SSH server to. |
| host_key_index | Index of the host key to use for the SSH server. |
| username | Username for SSH authentication. Set to NULL or empty string to allow any username to be used for incoming connections. |
| password | Password for SSH authentication. Set to NULL or empty string to disable password authentication. |
| authorized_keys | Array of indices for authorized public keys. Set to NULL to disable public key authentication. |
| authorized_keys_len | Length of the authorized_keys array. |
| server_callback | Callback function to handle SSH server events. |
| transport_callback | Callback function to handle SSH transport events. |
| user_data | Pointer to user-defined data that will be passed to the callback functions. |
| int ssh_server_stop | ( | struct ssh_server * | sshd | ) |
#include <server.h>
Stop an SSH server.
| sshd | Pointer to the SSH server instance to stop. |
| int ssh_server_transport_close | ( | struct ssh_server * | sshd, |
| int | idx ) |
#include <server.h>
Close an SSH server transport connection.
| sshd | Pointer to the SSH server instance. |
| idx | Index of the transport connection to close. |
| int ssh_server_unregister_transport_callback | ( | struct ssh_transport_conf * | conf | ) |
#include <server.h>
Unregister a callback function for getting the transport associated with a client connection.
| conf | Configuration data for the transport callback |
| struct ssh_server * ssh_transport_get_server | ( | struct ssh_transport * | transport | ) |
#include <server.h>
Get the SSH server instance that owns a given transport.
This is useful inside a registered transport callback, which is invoked globally for events from all server instances, to determine which server instance a transport belongs to. It must only be called for a transport obtained from a server transport callback.
| transport | Transport to get the owning server for. |