]> git.sesse.net Git - vlc/blobdiff - src/network/tls.c
Android: Fix src/network/udp.c compilation.
[vlc] / src / network / tls.c
index 385e99e9201ec5c42475c7b34826d5c318109622..104620f459d20ac08929e7d2dd980790356f90de 100644 (file)
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include "libvlc.h"
 
 #include <vlc_tls.h>
+#include <vlc_modules.h>
 
 /**
  * Allocates a whole server's TLS credentials.
@@ -69,15 +70,14 @@ tls_ServerCreate (vlc_object_t *obj, const char *cert_path,
         var_SetString (srv, "tls-x509-key", key_path);
     }
 
-    srv->p_module = module_Need (srv, "tls server", 0, 0);
+    srv->p_module = module_need (srv, "tls server", NULL, false );
     if (srv->p_module == NULL)
     {
         msg_Err (srv, "TLS server plugin not available");
-        vlc_object_destroy (srv);
+        vlc_object_release (srv);
         return NULL;
     }
 
-    vlc_object_attach (srv, obj);
     msg_Dbg (srv, "TLS server plugin initialized");
     return srv;
 }
@@ -92,9 +92,8 @@ void tls_ServerDelete (tls_server_t *srv)
     if (srv == NULL)
         return;
 
-    module_Unneed (srv, srv->p_module);
-    vlc_object_detach (srv);
-    vlc_object_destroy (srv);
+    module_unneed (srv, srv->p_module);
+    vlc_object_release (srv);
 }
 
 
@@ -120,14 +119,7 @@ int tls_ServerAddCRL (tls_server_t *srv, const char *path)
 
 tls_session_t *tls_ServerSessionPrepare (tls_server_t *srv)
 {
-    tls_session_t *ses;
-
-    ses = srv->pf_open (srv);
-    if (ses == NULL)
-        return NULL;
-
-    vlc_object_attach (ses, srv);
-    return ses;
+    return srv->pf_open (srv);
 }
 
 
@@ -185,11 +177,11 @@ tls_ClientCreate (vlc_object_t *obj, int fd, const char *psz_hostname)
     else
         msg_Dbg (cl, "requested anonymous server");
 
-    cl->p_module = module_Need (cl, "tls client", 0, 0);
+    cl->p_module = module_need (cl, "tls client", NULL, false );
     if (cl->p_module == NULL)
     {
         msg_Err (cl, "TLS client plugin not available");
-        vlc_object_destroy (cl);
+        vlc_object_release (cl);
         return NULL;
     }
 
@@ -202,13 +194,12 @@ tls_ClientCreate (vlc_object_t *obj, int fd, const char *psz_hostname)
     if (val == 0)
     {
         msg_Dbg (cl, "TLS client session initialized");
-        vlc_object_attach (cl, obj);
         return cl;
     }
     msg_Err (cl, "TLS client session handshake error");
 
-    module_Unneed (cl, cl->p_module);
-    vlc_object_destroy (cl);
+    module_unneed (cl, cl->p_module);
+    vlc_object_release (cl);
     return NULL;
 }
 
@@ -222,7 +213,6 @@ void tls_ClientDelete (tls_session_t *cl)
     if (cl == NULL)
         return;
 
-    module_Unneed (cl, cl->p_module);
-    vlc_object_detach (cl);
-    vlc_object_destroy (cl);
+    module_unneed (cl, cl->p_module);
+    vlc_object_release (cl);
 }