17#include <libssh/libssh.h>
24#define STDERR_FILENO 2
28#define STDOUT_FILENO 1
32#define SSH_BASE_OPTIONS \
33 { "remote-host", ws_required_argument, NULL, OPT_REMOTE_HOST}, \
34 { "remote-port", ws_required_argument, NULL, OPT_REMOTE_PORT}, \
35 { "remote-username", ws_required_argument, NULL, OPT_REMOTE_USERNAME}, \
36 { "remote-password", ws_required_argument, NULL, OPT_REMOTE_PASSWORD}, \
37 { "remote-count", ws_required_argument, NULL, OPT_REMOTE_COUNT}, \
38 { "sshkey", ws_required_argument, NULL, OPT_SSHKEY}, \
39 { "sshkey-passphrase", ws_required_argument, NULL, OPT_SSHKEY_PASSPHRASE}, \
40 { "proxycommand", ws_required_argument, NULL, OPT_PROXYCOMMAND}, \
41 { "ssh-sha1", ws_no_argument, NULL, OPT_SSH_SHA1}, \
42 { "update-known-hosts", ws_no_argument, NULL, OPT_UPDATE_KNOWN_HOSTS}
44#define SSH_BASE_OPTIONS_ENUM \
47 OPT_REMOTE_USERNAME, \
48 OPT_REMOTE_PASSWORD, \
50 OPT_SSHKEY_PASSPHRASE, \
53 OPT_UPDATE_KNOWN_HOSTS
55#define SSH_BASE_PACKET_OPTIONS \
57 { "remote-interface", ws_required_argument, NULL, OPT_REMOTE_INTERFACE}, \
58 { "remote-filter", ws_required_argument, NULL, OPT_REMOTE_FILTER}
60#define SSH_BASE_PACKET_OPTIONS_ENUM \
61 SSH_BASE_OPTIONS_ENUM, \
62 OPT_REMOTE_INTERFACE, \
77 bool update_known_hosts;
167void ssh_cleanup(ssh_session* sshs, ssh_channel* channel);
struct _extcap_parameters extcap_parameters
Holds all runtime parameters and state for an extcap plugin, parsed from command-line arguments and u...
ssh_session create_ssh_connection(const ssh_params_t *ssh_params, char **err_info)
Creates an SSH session based on the provided parameters.
Definition ssh-base.c:261
ssh_params_t * ssh_params_new(void)
Create a new SSH parameters structure.
Definition ssh-base.c:622
struct _ssh_params ssh_params_t
Holds the connection parameters required to establish an SSH session for an SSH-based extcap capture.
void ssh_base_list_config(unsigned *count)
Print SSH base server and authentication configuration options.
Definition ssh-base.c:131
void add_libssh_info(extcap_parameters *extcap_conf)
Adds information about the libssh library version to the extcap parameters.
Definition ssh-base.c:181
void ssh_params_free(ssh_params_t *ssh_params)
Frees the memory allocated for an ssh_params_t structure.
Definition ssh-base.c:639
void ssh_params_set_log_level(ssh_params_t *ssh_params, enum ws_log_level level)
Set the log level for SSH parameters.
Definition ssh-base.c:659
bool ssh_base_setup_graceful_shutdown(extcap_parameters *extcap_conf)
Sets up ssh_async_loop_read to allow graceful shutdown.
Definition ssh-base.c:493
int ssh_channel_printf(ssh_channel channel, const char *fmt,...)
Writes a formatted message to an SSH channel.
Definition ssh-base.c:466
int ssh_async_loop_read(ssh_session sshs, ssh_channel channel, FILE *fp)
Asynchronously reads the output of a single SSH command.
Definition ssh-base.c:511
void ssh_cleanup(ssh_session *sshs, ssh_channel *channel)
Cleans up SSH session and channel resources.
Definition ssh-base.c:605
void ssh_base_add_help_options(extcap_parameters *extcap_conf)
Adds SSH base server and authentication options to the help options.
Definition ssh-base.c:168
Holds the connection parameters required to establish an SSH session for an SSH-based extcap capture.
Definition ssh-base.h:68
char * username
Definition ssh-base.h:71
char * password
Definition ssh-base.h:72
bool ssh_sha1
Definition ssh-base.h:76
int debug
Definition ssh-base.h:78
char * sshkey_passphrase
Definition ssh-base.h:74
char * proxycommand
Definition ssh-base.h:75
uint16_t port
Definition ssh-base.h:70
char * sshkey_path
Definition ssh-base.h:73
char * host
Definition ssh-base.h:69