7#ifndef ZEPHYR_INCLUDE_NET_SSH_COMMON_H_
8#define ZEPHYR_INCLUDE_NET_SSH_COMMON_H_
41enum ssh_channel_request_type {
42 SSH_CHANNEL_REQUEST_UNKNOWN,
43 SSH_CHANNEL_REQUEST_PSEUDO_TERMINAL,
44 SSH_CHANNEL_REQUEST_X11_FORWARD,
45 SSH_CHANNEL_REQUEST_ENV_VAR,
46 SSH_CHANNEL_REQUEST_SHELL,
47 SSH_CHANNEL_REQUEST_EXEC,
48 SSH_CHANNEL_REQUEST_SUBSYSTEM,
49 SSH_CHANNEL_REQUEST_WINDOW_CHANGE,
50 SSH_CHANNEL_REQUEST_FLOW_CONTROL,
51 SSH_CHANNEL_REQUEST_SIGNAL,
52 SSH_CHANNEL_REQUEST_EXIT_STATUS,
53 SSH_CHANNEL_REQUEST_EXIT_SIGNAL
56struct ssh_channel_event {
57 enum ssh_channel_event_type {
58 SSH_CHANNEL_EVENT_OPEN_RESULT,
59 SSH_CHANNEL_EVENT_REQUEST,
60 SSH_CHANNEL_EVENT_REQUEST_RESULT,
61 SSH_CHANNEL_EVENT_RX_DATA_READY,
62 SSH_CHANNEL_EVENT_TX_DATA_READY,
63 SSH_CHANNEL_EVENT_RX_STDERR_DATA_READY,
64 SSH_CHANNEL_EVENT_EOF,
65 SSH_CHANNEL_EVENT_CLOSED
68 struct ssh_channel_event_channel_request {
69 enum ssh_channel_request_type type;
73 struct ssh_channel_event_channel_request_result {
75 } channel_request_result;
79typedef int (*ssh_channel_event_callback_t)(
struct ssh_channel *channel,
80 const struct ssh_channel_event *event,
83struct ssh_transport_event {
84 enum ssh_transport_event_type {
85 SSH_TRANSPORT_EVENT_CLOSED,
86 SSH_TRANSPORT_EVENT_SERVICE_ACCEPTED,
87 SSH_TRANSPORT_EVENT_AUTHENTICATE_RESULT,
88 SSH_TRANSPORT_EVENT_CHANNEL_OPEN,
91 struct ssh_transport_event_authenticate_result {
93 } authenticate_result;
94 struct ssh_transport_event_channel_open {
95 struct ssh_channel *channel;
100typedef int (*ssh_transport_event_callback_t)(
struct ssh_transport *transport,
101 const struct ssh_transport_event *event,
104#define SSH_EXTENDED_DATA_STDERR 1
106#ifdef CONFIG_SSH_CLIENT
107const char *ssh_transport_client_user_name(
struct ssh_transport *transport);
108int ssh_transport_auth_password(
struct ssh_transport *transport,
const char *user_name,
109 const char *password);
110int ssh_transport_channel_open(
struct ssh_transport *transport,
111 ssh_channel_event_callback_t callback,
void *user_data);
114#ifdef CONFIG_SSH_SERVER
115int ssh_channel_open_result(
struct ssh_channel *channel,
bool success,
116 ssh_channel_event_callback_t callback,
void *user_data);
118int ssh_channel_request_result(
struct ssh_channel *channel,
bool success);
120#ifdef CONFIG_SSH_CLIENT
121int ssh_channel_request_shell(
struct ssh_channel *channel);
124int ssh_channel_read(
struct ssh_channel *channel,
void *data,
uint32_t len);
125int ssh_channel_write(
struct ssh_channel *channel,
const void *data,
uint32_t len);
126int ssh_channel_read_stderr(
struct ssh_channel *channel,
void *data,
uint32_t len);
127int ssh_channel_write_stderr(
struct ssh_channel *channel,
const void *data,
uint32_t len);
void(* ssh_service_client_cb_t)(struct ssh_client *ssh, int instance, void *user_data)
Callback used while iterating over SSH client connections.
Definition common.h:139
void(* ssh_service_server_cb_t)(struct ssh_server *sshd, int instance, void *user_data)
Callback used while iterating over SSH server connections.
Definition common.h:159
void ssh_client_foreach(ssh_service_client_cb_t cb, void *user_data)
Go through all SSH client connections.
void ssh_server_foreach(ssh_service_server_cb_t cb, void *user_data)
Go through all SSH server connections.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90