Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
SSH Server Library

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.

Detailed Description

Since
4.5
Version
0.1.0

Typedef Documentation

◆ ssh_server_event_callback_t

typedef int(* ssh_server_event_callback_t) (struct ssh_server *sshd, const struct ssh_server_event *event, void *user_data)

#include <zephyr/net/ssh/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.

Parameters
sshdPointer to the SSH server instance that is invoking the callback.
eventPointer to a structure containing details about the event that occurred.
user_dataPointer to user-defined data that was provided when the server was started,
Returns
0 on success, or a non-zero value to indicate an error.

Enumeration Type Documentation

◆ ssh_server_event_type

#include <zephyr/net/ssh/server.h>

Server event types.

Enumerator
SSH_SERVER_EVENT_CLOSED 

Server has been closed.

SSH_SERVER_EVENT_CLIENT_CONNECTED 

Client has connected to the server.

SSH_SERVER_EVENT_CLIENT_DISCONNECTED 

Client has disconnected from the server.

Function Documentation

◆ ssh_server_start()

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 <zephyr/net/ssh/server.h>

Start an SSH server.

Parameters
sshdPointer to the SSH server instance to start.
bind_addrNetwork address to bind the SSH server to.
host_key_indexIndex of the host key to use for the SSH server.
usernameUsername for SSH authentication. Set to NULL or empty string to allow any username to be used for incoming connections.
passwordPassword for SSH authentication. Set to NULL or empty string to disable password authentication.
authorized_keysArray of indices for authorized public keys. Set to NULL to disable public key authentication.
authorized_keys_lenLength of the authorized_keys array.
server_callbackCallback function to handle SSH server events.
transport_callbackCallback function to handle SSH transport events.
user_dataPointer to user-defined data that will be passed to the callback functions.
Returns
0 on success, or a negative error code on failure.

◆ ssh_server_stop()

int ssh_server_stop ( struct ssh_server * sshd)

#include <zephyr/net/ssh/server.h>

Stop an SSH server.

Parameters
sshdPointer to the SSH server instance to stop.
Returns
0 on success, or a negative error code on failure.

◆ ssh_server_transport_close()

int ssh_server_transport_close ( struct ssh_server * sshd,
int idx )

#include <zephyr/net/ssh/server.h>

Close an SSH server transport connection.

Parameters
sshdPointer to the SSH server instance.
idxIndex of the transport connection to close.
Returns
0 on success, or a negative error code on failure.