mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
GstRTSPConnection: Add GTlsInteraction support
https://bugzilla.gnome.org/show_bug.cgi?id=750471
This commit is contained in:
parent
0aacd7f393
commit
74a4347614
3 changed files with 67 additions and 1 deletions
|
@ -1523,6 +1523,10 @@ gst_rtsp_connection_get_write_socket
|
|||
gst_rtsp_connection_get_tls
|
||||
gst_rtsp_connection_set_tls_validation_flags
|
||||
gst_rtsp_connection_get_tls_validation_flags
|
||||
gst_rtsp_connection_set_tls_database
|
||||
gst_rtsp_connection_get_tls_database
|
||||
gst_rtsp_connection_set_tls_interaction
|
||||
gst_rtsp_connection_get_tls_interaction
|
||||
|
||||
GstRTSPWatch
|
||||
GstRTSPWatchFuncs
|
||||
|
|
|
@ -159,6 +159,7 @@ struct _GstRTSPConnection
|
|||
|
||||
/* TLS */
|
||||
GTlsDatabase *tls_database;
|
||||
GTlsInteraction *tls_interaction;
|
||||
|
||||
DecodeCtx ctx;
|
||||
DecodeCtx *ctxp;
|
||||
|
@ -253,7 +254,7 @@ verify_error:
|
|||
|
||||
static void
|
||||
socket_client_event (GSocketClient * client, GSocketClientEvent event,
|
||||
GSocketConnectable * connectable, GIOStream * connection,
|
||||
GSocketConnectable * connectable, GTlsConnection * connection,
|
||||
GstRTSPConnection * rtspconn)
|
||||
{
|
||||
if (event == G_SOCKET_CLIENT_TLS_HANDSHAKING) {
|
||||
|
@ -261,6 +262,8 @@ socket_client_event (GSocketClient * client, GSocketClientEvent event,
|
|||
|
||||
g_signal_connect (connection, "accept-certificate",
|
||||
(GCallback) tls_accept_certificate, rtspconn);
|
||||
|
||||
g_tls_connection_set_interaction (connection, rtspconn->tls_interaction);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -622,6 +625,61 @@ gst_rtsp_connection_get_tls_database (GstRTSPConnection * conn)
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_connection_set_tls_interaction:
|
||||
* @conn: a #GstRTSPConnection
|
||||
* @interaction: a #GTlsInteraction
|
||||
*
|
||||
* Sets a #GTlsInteraction object to be used when the connection or certificate
|
||||
* database need to interact with the user. This will be used to prompt the
|
||||
* user for passwords where necessary.
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
void
|
||||
gst_rtsp_connection_set_tls_interaction (GstRTSPConnection * conn,
|
||||
GTlsInteraction * interaction)
|
||||
{
|
||||
GTlsInteraction *old_interaction;
|
||||
|
||||
g_return_if_fail (conn != NULL);
|
||||
|
||||
if (interaction)
|
||||
g_object_ref (interaction);
|
||||
|
||||
old_interaction = conn->tls_interaction;
|
||||
conn->tls_interaction = interaction;
|
||||
|
||||
if (old_interaction)
|
||||
g_object_unref (old_interaction);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_connection_get_tls_interaction:
|
||||
* @conn: a #GstRTSPConnection
|
||||
*
|
||||
* Gets a #GTlsInteraction object to be used when the connection or certificate
|
||||
* database need to interact with the user. This will be used to prompt the
|
||||
* user for passwords where necessary.
|
||||
*
|
||||
* Returns: (transfer full): a reference on the #GTlsInteraction. Use
|
||||
* g_object_unref() to release.
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
GTlsInteraction *
|
||||
gst_rtsp_connection_get_tls_interaction (GstRTSPConnection * conn)
|
||||
{
|
||||
GTlsInteraction *result;
|
||||
|
||||
g_return_val_if_fail (conn != NULL, NULL);
|
||||
|
||||
if ((result = conn->tls_interaction))
|
||||
g_object_ref (result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static GstRTSPResult
|
||||
setup_tunneling (GstRTSPConnection * conn, GTimeVal * timeout, gchar * uri)
|
||||
{
|
||||
|
@ -2298,6 +2356,8 @@ gst_rtsp_connection_free (GstRTSPConnection * conn)
|
|||
g_object_unref (conn->client);
|
||||
if (conn->tls_database)
|
||||
g_object_unref (conn->tls_database);
|
||||
if (conn->tls_interaction)
|
||||
g_object_unref (conn->tls_interaction);
|
||||
|
||||
g_timer_destroy (conn->timer);
|
||||
gst_rtsp_url_free (conn->url);
|
||||
|
|
|
@ -78,6 +78,8 @@ gboolean gst_rtsp_connection_set_tls_validation_flags (GstRTSPConnec
|
|||
GTlsCertificateFlags gst_rtsp_connection_get_tls_validation_flags (GstRTSPConnection * conn);
|
||||
void gst_rtsp_connection_set_tls_database (GstRTSPConnection * conn, GTlsDatabase * database);
|
||||
GTlsDatabase * gst_rtsp_connection_get_tls_database (GstRTSPConnection * conn);
|
||||
void gst_rtsp_connection_set_tls_interaction (GstRTSPConnection * conn, GTlsInteraction * interaction);
|
||||
GTlsInteraction * gst_rtsp_connection_get_tls_interaction (GstRTSPConnection * conn);
|
||||
|
||||
/* sending/receiving raw bytes */
|
||||
GstRTSPResult gst_rtsp_connection_read (GstRTSPConnection * conn, guint8 * data,
|
||||
|
|
Loading…
Reference in a new issue