[vlc-commits] tls: add vlc_tls_SocketOpenTLS()
Rémi Denis-Courmont
git at videolan.org
Sat Feb 25 22:41:58 CET 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Feb 25 21:40:45 2017 +0200| [7509e1f829d11797179337603c6affc2fe13607b] | committer: Rémi Denis-Courmont
tls: add vlc_tls_SocketOpenTLS()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7509e1f829d11797179337603c6affc2fe13607b
---
include/vlc_tls.h | 8 ++++++++
src/libvlccore.sym | 1 +
src/network/tls.c | 15 +++++++++++++++
3 files changed, 24 insertions(+)
diff --git a/include/vlc_tls.h b/include/vlc_tls.h
index 623436f..38a41f7 100644
--- a/include/vlc_tls.h
+++ b/include/vlc_tls.h
@@ -252,6 +252,14 @@ vlc_tls_t *vlc_tls_SocketOpenAddrInfo(vlc_object_t *obj,
VLC_API vlc_tls_t *vlc_tls_SocketOpenTCP(vlc_object_t *obj,
const char *hostname, unsigned port);
+/**
+ * Initiates a TLS session over TCP.
+ */
+VLC_API vlc_tls_t *vlc_tls_SocketOpenTLS(vlc_tls_creds_t *crd,
+ const char *hostname, unsigned port,
+ const char *service,
+ const char *const *alpn, char **alp);
+
VLC_DEPRECATED
static inline vlc_tls_t *
vlc_tls_ClientSessionCreateFD(vlc_tls_creds_t *crd, int fd, const char *host,
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 8a29141..b4bdd98 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -444,6 +444,7 @@ vlc_tls_Write
vlc_tls_GetLine
vlc_tls_SocketOpen
vlc_tls_SocketOpenTCP
+vlc_tls_SocketOpenTLS
ToCharset
update_Check
update_Delete
diff --git a/src/network/tls.c b/src/network/tls.c
index 286c70c..a4f35c9 100644
--- a/src/network/tls.c
+++ b/src/network/tls.c
@@ -493,3 +493,18 @@ vlc_tls_t *vlc_tls_SocketOpenTCP(vlc_object_t *obj, const char *name,
freeaddrinfo(res);
return tls;
}
+
+vlc_tls_t *vlc_tls_SocketOpenTLS(vlc_tls_creds_t *creds, const char *name,
+ unsigned port, const char *service,
+ const char *const *alpn, char **alp)
+{
+ vlc_tls_t *tcp = vlc_tls_SocketOpenTCP(VLC_OBJECT(creds), name, port);
+ if (tcp == NULL)
+ return NULL;
+
+ vlc_tls_t *tls = vlc_tls_ClientSessionCreate(creds, tcp, name, service,
+ alpn, alp);
+ if (tls == NULL)
+ vlc_tls_SessionDelete(tcp);
+ return tls;
+}
More information about the vlc-commits
mailing list