56 return TLS_WANT_POLLIN;
59 return ret >= 0 ? ret : -1;
67 return TLS_WANT_POLLOUT;
70 return ret >= 0 ? ret : -1;
77 struct tls_config *cfg =
NULL;
80 if (tls_init() == -1) {
88 p->
ctx = !
c->listen ? tls_client() : tls_server();
94 cfg = tls_config_new();
99 if (tls_config_set_protocols(cfg, TLS_PROTOCOLS_ALL) == -1)
103 if (tls_config_set_ciphers(cfg,
"compat") == -1)
105 if (
c->ca_file && tls_config_set_ca_file(cfg,
c->ca_file) == -1)
107 if (
c->cert_file && tls_config_set_cert_file(cfg,
c->cert_file) == -1)
109 if (
c->key_file && tls_config_set_key_file(cfg,
c->key_file) == -1)
112 tls_config_insecure_noverifycert(cfg);
113 tls_config_insecure_noverifyname(cfg);
114 tls_config_insecure_noverifytime(cfg);
116 if (tls_configure(p->
ctx, cfg) == -1)
135 tls_config_free(cfg);
147 tls_config_free(cfg);
int ffurl_read(URLContext *h, unsigned char *buf, int size)
Read up to size bytes from the resource accessed by h, and store the read bytes in buf.
int ffurl_get_short_seek(URLContext *h)
Return the current short seek threshold value for this URL.
int ffurl_closep(URLContext **hh)
Close the resource accessed by the URLContext h, and free the memory used by it.
int ffurl_write(URLContext *h, const unsigned char *buf, int size)
Write size bytes from buf to the resource accessed by h.
int ffurl_get_file_handle(URLContext *h)
Return the file descriptor associated with this URL.
Convenience header that includes libavutil's core.
#define flags(name, subs,...)
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
#define AVERROR_EOF
End of file.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
common internal api header.
common internal API header
Describe the class of an AVClass context structure.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AVDictionary **options)
#define TLS_COMMON_OPTIONS(pstruct, options_field)
static int tls_close(URLContext *h)
static int tls_read(URLContext *h, uint8_t *buf, int size)
static int tls_write(URLContext *h, const uint8_t *buf, int size)
static int ff_tls_open(URLContext *h, const char *uri, int flags, AVDictionary **options)
static ssize_t tls_write_callback(struct tls *ctx, const void *buf, size_t buflen, void *cb_arg)
static const AVClass tls_class
static int ff_tls_close(URLContext *h)
const URLProtocol ff_tls_protocol
static const AVOption options[]
static int tls_get_short_seek(URLContext *h)
static int ff_tls_read(URLContext *h, uint8_t *buf, int size)
static int tls_get_file_handle(URLContext *h)
static int ff_tls_write(URLContext *h, const uint8_t *buf, int size)
static ssize_t tls_read_callback(struct tls *ctx, void *buf, size_t buflen, void *cb_arg)
unbuffered private I/O API
#define URL_PROTOCOL_FLAG_NETWORK