xine-lib: xine-lib-1.2.12/src/input/input_ssh.c File Reference

xine-lib 1.2.12

Data Structures | Macros | Functions | Variables
input_ssh.c File Reference
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <errno.h>`
`#include <libssh2.h>`
`#include <libssh2_sftp.h>`
`#include <xine/xine_internal.h>`
`#include <xine/xineutils.h>`
`#include <xine/input_plugin.h>`
`#include "net_buf_ctrl.h"`
`#include "http_helper.h"`
`#include "input_helper.h"`

## Data Structures
struct | ssh_input_plugin_t
struct | sftp_input_class_t

## Macros
#define | LOG_MODULE "input_ssh"
#define | LOG_VERBOSE
#define | DEFAULT_SSH_PORT 22

## Functions
static int | _wait_socket (ssh_input_plugin_t *this)
static void | _emit_authentication_request (ssh_input_plugin_t *this)
static int | _ssh_connect (ssh_input_plugin_t *this, const xine_url_t *url)
static int | _sftp_session_init (ssh_input_plugin_t *this)
static int | _scp_channel_init (ssh_input_plugin_t *this, const char *uri)
static int | _sftp_open (ssh_input_plugin_t *this, const char *uri)
static off_t | _scp_read (input_plugin_t *this_gen, void *buf_gen, off_t len)
static off_t | _sftp_read (input_plugin_t *this_gen, void *buf_gen, off_t len)
static off_t | _scp_get_length (input_plugin_t *this_gen)
static off_t | _sftp_get_length (input_plugin_t *this_gen)
static off_t | _get_current_pos (input_plugin_t *this_gen)
static off_t | _scp_seek (input_plugin_t *this_gen, off_t offset, int origin)
static off_t | _sftp_seek (input_plugin_t *this_gen, off_t offset, int origin)
static const char * | _get_mrl (input_plugin_t *this_gen)
static int | _get_optional_data (input_plugin_t *this_gen, void *data, int data_type)
static void | _dispose (input_plugin_t *this_gen)
static int | _scp_fill_preview (ssh_input_plugin_t *this)
static int | _open_plugin (input_plugin_t *this_gen)
static input_plugin_t * | _get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *mrl)
static void * | scp_init_class (xine_t *xine, const void *data)
static ssh_input_plugin_t * | _open_input (sftp_input_class_t *this, xine_url_t *url, const char *mrl)
static int | _read_dir (sftp_input_class_t *this, ssh_input_plugin_t *input, const char *mrl, const char *uri, int *nFiles)
static xine_mrl_t ** | _get_dir (input_class_t *this_gen, const char *filename, int *nFiles)
static void | _dispose_class_sftp (input_class_t *this_gen)
static void * | sftp_init_class (xine_t *xine, const void *data)

## Variables
const input_info_t | input_info_sftp
const input_info_t | input_info_scp
const plugin_info_t xine_plugin_info[] | EXPORTED

## Macro Definition Documentation

## ◆ DEFAULT_SSH_PORT

#define DEFAULT_SSH_PORT 22

## ◆ LOG_MODULE

#define LOG_MODULE "input_ssh"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## Function Documentation

## ◆ _dispose()

static void _dispose | ( | input_plugin_t * | this_gen | ) |
| static

References _x_freep(), _x_freep_wipe_string(), _x_io_tcp_close(), nbc_close, and NULL.

Referenced by _get_instance().

## ◆ _dispose_class_sftp()

static void _dispose_class_sftp | ( | input_class_t * | this_gen | ) |
| static

References _x_input_free_mrls().

Referenced by sftp_init_class().

## ◆ _emit_authentication_request()

static void _emit_authentication_request | ( | ssh_input_plugin_t * | this | ) |
| static

References _x_message(), LOG_MODULE, NULL, XINE_MSG_AUTHENTICATION_NEEDED, XINE_VERBOSITY_LOG, and xprintf.

Referenced by _ssh_connect().

## ◆ _get_current_pos()

static off_t _get_current_pos | ( | input_plugin_t * | this_gen | ) |
| static

Referenced by _get_instance().

## ◆ _get_dir()

static xine_mrl_t ** _get_dir | ( | input_class_t * | this_gen,
|  | const char * | filename,
|  | int * | nFiles
| ) |  |
| static

References _open_input(), _read_dir(), _x_input_free_mrls(), _x_input_get_default_server_mrls(), _x_url_cleanup(), _x_url_parse2(), input(), LOG_MODULE, NULL, xine_url_t::uri, XINE_VERBOSITY_LOG, and xprintf.

Referenced by sftp_init_class().

## ◆ _get_instance()

static input_plugin_t * _get_instance | ( | input_class_t * | cls_gen,
|  | xine_stream_t * | stream,
|  | const char * | mrl
| ) |  |
| static

References _dispose(), _get_current_pos(), _get_mrl(), _get_optional_data(), _open_plugin(), _scp_get_length(), _scp_read(), _scp_seek(), _sftp_get_length(), _sftp_read(), _sftp_seek(), _x_input_default_get_blocksize(), _x_input_default_read_block(), _x_input_get_capabilities_preview(), _x_input_get_capabilities_seekable(), _x_mrl_remove_auth(), LOG_MODULE, nbc_init, NULL, xine_stream_s::xine, XINE_VERBOSITY_LOG, and xprintf.

Referenced by scp_init_class(), and sftp_init_class().

## ◆ _get_mrl()

static const char * _get_mrl | ( | input_plugin_t * | this_gen | ) |
| static

Referenced by _get_instance().

## ◆ _get_optional_data()

static int _get_optional_data | ( | input_plugin_t * | this_gen,
|  | void * | data,
|  | int | data_type
| ) |  |
| static

References INPUT_OPTIONAL_DATA_PREVIEW, and INPUT_OPTIONAL_UNSUPPORTED.

Referenced by _get_instance().

## ◆ _open_input()

static ssh_input_plugin_t * _open_input | ( | sftp_input_class_t * | this,
|  | xine_url_t * | url,
|  | const char * | mrl
| ) |  |
| static

References _sftp_session_init(), _ssh_connect(), input(), and NULL.

Referenced by _get_dir().

## ◆ _open_plugin()

static int _open_plugin | ( | input_plugin_t * | this_gen | ) |
| static

References _scp_channel_init(), _scp_fill_preview(), _sftp_get_length(), _sftp_open(), _sftp_session_init(), _ssh_connect(), _x_freep_wipe_string(), _x_message(), _x_url_cleanup(), _x_url_parse2(), NULL, xine_url_t::proto, xine_url_t::uri, and XINE_MSG_GENERAL_WARNING.

Referenced by _get_instance().

## ◆ _read_dir()

static int _read_dir | ( | sftp_input_class_t * | this,
|  | ssh_input_plugin_t * | input,
|  | const char * | mrl,
|  | const char * | uri,
|  | int * | nFiles
| ) |  |
| static

References _x_asprintf(), _x_input_alloc_mrls(), _x_input_get_show_hidden_files(), _x_input_realloc_mrls(), _x_input_sort_mrls(), input(), LOG_MODULE, xine_mrl_s::mrl, mrl_file, mrl_file_directory, mrl_file_normal, mrl_net, NULL, xine_mrl_s::origin, xine_mrl_s::size, xine_mrl_s::type, type, XINE_VERBOSITY_LOG, and xprintf.

Referenced by _get_dir().

## ◆ _scp_channel_init()

static int _scp_channel_init | ( | ssh_input_plugin_t * | this,
|  | const char * | uri
| ) |  |
| static

References _wait_socket(), _x_action_pending(), LOG_MODULE, XINE_VERBOSITY_LOG, and xprintf.

Referenced by _open_plugin().

## ◆ _scp_fill_preview()

static int _scp_fill_preview | ( | ssh_input_plugin_t * | this | ) |
| static

References _scp_read(), LOG_MODULE, XINE_VERBOSITY_LOG, and xprintf.

Referenced by _open_plugin().

## ◆ _scp_get_length()

static off_t _scp_get_length | ( | input_plugin_t * | this_gen | ) |
| static

Referenced by _get_instance().

## ◆ _scp_read()

static off_t _scp_read | ( | input_plugin_t * | this_gen,
|  | void * | buf_gen,
|  | off_t | len
| ) |  |
| static

References _wait_socket(), _x_action_pending(), LOG_MODULE, XINE_VERBOSITY_LOG, and xprintf.

Referenced by _get_instance(), and _scp_fill_preview().

## ◆ _scp_seek()

static off_t _scp_seek | ( | input_plugin_t * | this_gen,
|  | off_t | offset,
|  | int | origin
| ) |  |
| static

References _x_input_seek_preview().

Referenced by _get_instance().

## ◆ _sftp_get_length()

static off_t _sftp_get_length | ( | input_plugin_t * | this_gen | ) |
| static

References _x_action_pending(), LOG_MODULE, XINE_VERBOSITY_LOG, and xprintf.

Referenced by _get_instance(), and _open_plugin().

## ◆ _sftp_open()

static int _sftp_open | ( | ssh_input_plugin_t * | this,
|  | const char * | uri
| ) |  |
| static

References _wait_socket(), _x_action_pending(), LOG_MODULE, XINE_VERBOSITY_LOG, and xprintf.

Referenced by _open_plugin().

## ◆ _sftp_read()

static off_t _sftp_read | ( | input_plugin_t * | this_gen,
|  | void * | buf_gen,
|  | off_t | len
| ) |  |
| static

References _wait_socket(), _x_action_pending(), input_plugin_s::get_length, LOG_MODULE, XINE_VERBOSITY_LOG, and xprintf.

Referenced by _get_instance().

## ◆ _sftp_seek()

static off_t _sftp_seek | ( | input_plugin_t * | this_gen,
|  | off_t | offset,
|  | int | origin
| ) |  |
| static

References LOG_MODULE, XINE_VERBOSITY_LOG, and xprintf.

Referenced by _get_instance().

## ◆ _sftp_session_init()

static int _sftp_session_init | ( | ssh_input_plugin_t * | this | ) |
| static

References _wait_socket(), _x_action_pending(), LOG_MODULE, XINE_VERBOSITY_LOG, and xprintf.

Referenced by _open_input(), and _open_plugin().

## ◆ _ssh_connect()

static int _ssh_connect | ( | ssh_input_plugin_t * | this,
|  | const xine_url_t * | url
| ) |  |
| static

References _emit_authentication_request(), _x_action_pending(), _x_asprintf(), _x_io_tcp_connect(), _x_io_tcp_connect_finish(), DEFAULT_SSH_PORT, xine_url_t::host, LOG_MODULE, xine_url_t::password, xine_url_t::port, xine_url_t::user, xine_get_homedir(), XINE_VERBOSITY_LOG, XIO_READY, XIO_TIMEOUT, and xprintf.

Referenced by _open_input(), and _open_plugin().

## ◆ _wait_socket()

static int _wait_socket | ( | ssh_input_plugin_t * | this | ) |
| static

References _x_io_select(), XIO_READ_READY, and XIO_WRITE_READY.

Referenced by _scp_channel_init(), _scp_read(), _sftp_open(), _sftp_read(), and _sftp_session_init().

## ◆ scp_init_class()

static void * scp_init_class | ( | xine_t * | xine,
|  | const void * | data
| ) |  |
| static

References _get_instance(), input_class_s::get_instance, N_, and NULL.

## ◆ sftp_init_class()

static void * sftp_init_class | ( | xine_t * | xine,
|  | const void * | data
| ) |  |
| static

References _dispose_class_sftp(), _get_dir(), _get_instance(), _x_input_register_default_servers(), _x_input_register_show_hidden_files(), xine_s::config, N_, and NULL.

## Variable Documentation

## ◆ EXPORTED

const plugin_info_t xine_plugin_info [] EXPORTED

Initial value:
= {
{ PLUGIN_INPUT, 18, "SFTP", XINE_VERSION_CODE, &input_info_sftp, sftp_init_class },
{ PLUGIN_INPUT, 18, "SCP", XINE_VERSION_CODE, &input_info_scp, scp_init_class },
{ PLUGIN_NONE, 0, NULL, 0, NULL, NULL }
}
input_info_sftp
const input_info_t input_info_sftp
Definition: input_ssh.c:922
input_info_scp
const input_info_t input_info_scp
Definition: input_ssh.c:926
sftp_init_class
static void * sftp_init_class(xine_t *xine, const void *data)
Definition: input_ssh.c:894
scp_init_class
static void * scp_init_class(xine_t *xine, const void *data)
Definition: input_ssh.c:689
XINE_VERSION_CODE
#define XINE_VERSION_CODE
Definition: xine_internal.h:57
NULL
NULL
Definition: xine_plugin.c:78
PLUGIN_NONE
#define PLUGIN_NONE
Definition: xine_plugin.h:29
PLUGIN_INPUT
#define PLUGIN_INPUT
Definition: xine_plugin.h:30

## ◆ input_info_scp

const input_info_t input_info_scp

Initial value:
= {
.priority = 100,
}

## ◆ input_info_sftp

const input_info_t input_info_sftp

Initial value:
= {
.priority = 100,
}