FFmpeg
Data Structures | Macros | Functions | Variables
libssh.c File Reference
#include <fcntl.h>
#include <libssh/sftp.h>
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "libavutil/attributes.h"
#include "libavformat/avio.h"
#include "avformat.h"
#include "internal.h"
#include "url.h"

Go to the source code of this file.

Data Structures

struct  LIBSSHContext
 

Macros

#define LIBSSH_STATIC
 
#define OFFSET(x)   offsetof(LIBSSHContext, x)
 
#define D   AV_OPT_FLAG_DECODING_PARAM
 
#define E   AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static av_cold int libssh_create_ssh_session (LIBSSHContext *libssh, const char *hostname, unsigned int port)
 
static av_cold int libssh_authentication (LIBSSHContext *libssh, const char *user, const char *password)
 
static av_cold int libssh_create_sftp_session (LIBSSHContext *libssh)
 
static av_cold int libssh_open_file (LIBSSHContext *libssh, int flags, const char *file)
 
static av_cold void libssh_stat_file (LIBSSHContext *libssh)
 
static av_cold int libssh_close (URLContext *h)
 
static av_cold int libssh_connect (URLContext *h, const char *url, char *path, size_t path_size)
 
static av_cold int libssh_open (URLContext *h, const char *url, int flags)
 
static int64_t libssh_seek (URLContext *h, int64_t pos, int whence)
 
static int libssh_read (URLContext *h, unsigned char *buf, int size)
 
static int libssh_write (URLContext *h, const unsigned char *buf, int size)
 
static int libssh_open_dir (URLContext *h)
 
static int libssh_read_dir (URLContext *h, AVIODirEntry **next)
 
static int libssh_close_dir (URLContext *h)
 
static int libssh_delete (URLContext *h)
 
static int libssh_move (URLContext *h_src, URLContext *h_dst)
 

Variables

static const AVOption options []
 
static const AVClass libssh_context_class
 
const URLProtocol ff_libssh_protocol
 

Macro Definition Documentation

◆ LIBSSH_STATIC

#define LIBSSH_STATIC

Definition at line 22 of file libssh.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(LIBSSHContext, x)

Definition at line 472 of file libssh.c.

◆ D

Definition at line 473 of file libssh.c.

◆ E

Definition at line 474 of file libssh.c.

Function Documentation

◆ libssh_create_ssh_session()

static av_cold int libssh_create_ssh_session ( LIBSSHContext libssh,
const char *  hostname,
unsigned int  port 
)
static

Definition at line 44 of file libssh.c.

Referenced by libssh_connect().

◆ libssh_authentication()

static av_cold int libssh_authentication ( LIBSSHContext libssh,
const char *  user,
const char *  password 
)
static

Definition at line 72 of file libssh.c.

Referenced by libssh_connect().

◆ libssh_create_sftp_session()

static av_cold int libssh_create_sftp_session ( LIBSSHContext libssh)
static

Definition at line 118 of file libssh.c.

Referenced by libssh_connect().

◆ libssh_open_file()

static av_cold int libssh_open_file ( LIBSSHContext libssh,
int  flags,
const char *  file 
)
static

Definition at line 133 of file libssh.c.

Referenced by libssh_open().

◆ libssh_stat_file()

static av_cold void libssh_stat_file ( LIBSSHContext libssh)
static

Definition at line 157 of file libssh.c.

Referenced by libssh_open().

◆ libssh_close()

static av_cold int libssh_close ( URLContext h)
static

Definition at line 170 of file libssh.c.

Referenced by libssh_close_dir(), libssh_delete(), libssh_move(), libssh_open(), and libssh_open_dir().

◆ libssh_connect()

static av_cold int libssh_connect ( URLContext h,
const char *  url,
char *  path,
size_t  path_size 
)
static

Definition at line 189 of file libssh.c.

Referenced by libssh_delete(), libssh_move(), libssh_open(), and libssh_open_dir().

◆ libssh_open()

static av_cold int libssh_open ( URLContext h,
const char *  url,
int  flags 
)
static

Definition at line 226 of file libssh.c.

◆ libssh_seek()

static int64_t libssh_seek ( URLContext h,
int64_t  pos,
int  whence 
)
static

Definition at line 247 of file libssh.c.

◆ libssh_read()

static int libssh_read ( URLContext h,
unsigned char *  buf,
int  size 
)
static

Definition at line 286 of file libssh.c.

◆ libssh_write()

static int libssh_write ( URLContext h,
const unsigned char *  buf,
int  size 
)
static

Definition at line 298 of file libssh.c.

◆ libssh_open_dir()

static int libssh_open_dir ( URLContext h)
static

Definition at line 310 of file libssh.c.

◆ libssh_read_dir()

static int libssh_read_dir ( URLContext h,
AVIODirEntry **  next 
)
static

Definition at line 332 of file libssh.c.

◆ libssh_close_dir()

static int libssh_close_dir ( URLContext h)
static

Definition at line 382 of file libssh.c.

◆ libssh_delete()

static int libssh_delete ( URLContext h)
static

Definition at line 392 of file libssh.c.

◆ libssh_move()

static int libssh_move ( URLContext h_src,
URLContext h_dst 
)
static

Definition at line 428 of file libssh.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{"timeout", "set timeout of socket I/O operations", OFFSET(rw_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, D|E },
{"truncate", "Truncate existing files on write", OFFSET(trunc), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, E },
{"private_key", "set path to private key", OFFSET(priv_key), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D|E },
{NULL}
}

Definition at line 475 of file libssh.c.

◆ libssh_context_class

const AVClass libssh_context_class
static
Initial value:
= {
.class_name = "libssh",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 482 of file libssh.c.

◆ ff_libssh_protocol

const URLProtocol ff_libssh_protocol
Initial value:
= {
.name = "sftp",
.url_open = libssh_open,
.url_read = libssh_read,
.url_write = libssh_write,
.url_seek = libssh_seek,
.url_close = libssh_close,
.url_delete = libssh_delete,
.url_move = libssh_move,
.url_open_dir = libssh_open_dir,
.url_read_dir = libssh_read_dir,
.url_close_dir = libssh_close_dir,
.priv_data_size = sizeof(LIBSSHContext),
.priv_data_class = &libssh_context_class,
}

Definition at line 489 of file libssh.c.

OFFSET
#define OFFSET(x)
Definition: libssh.c:472
URL_PROTOCOL_FLAG_NETWORK
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:33
libssh_seek
static int64_t libssh_seek(URLContext *h, int64_t pos, int whence)
Definition: libssh.c:247
libssh_open
static av_cold int libssh_open(URLContext *h, const char *url, int flags)
Definition: libssh.c:226
libssh_delete
static int libssh_delete(URLContext *h)
Definition: libssh.c:392
libssh_move
static int libssh_move(URLContext *h_src, URLContext *h_dst)
Definition: libssh.c:428
trunc
static __device__ float trunc(float a)
Definition: cuda_runtime.h:179
libssh_open_dir
static int libssh_open_dir(URLContext *h)
Definition: libssh.c:310
LIBSSHContext
Definition: libssh.c:32
libssh_close_dir
static int libssh_close_dir(URLContext *h)
Definition: libssh.c:382
libssh_close
static av_cold int libssh_close(URLContext *h)
Definition: libssh.c:170
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
libssh_read
static int libssh_read(URLContext *h, unsigned char *buf, int size)
Definition: libssh.c:286
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
options
static const AVOption options[]
Definition: libssh.c:475
libssh_read_dir
static int libssh_read_dir(URLContext *h, AVIODirEntry **next)
Definition: libssh.c:332
libssh_context_class
static const AVClass libssh_context_class
Definition: libssh.c:482
E
#define E
Definition: libssh.c:474
libssh_write
static int libssh_write(URLContext *h, const unsigned char *buf, int size)
Definition: libssh.c:298
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239
D
#define D
Definition: libssh.c:473