]> git.sesse.net Git - vlc/blobdiff - plugins/network/ipv4.c
* ALL: new module API. Makes a few things a lot simpler, and we gain
[vlc] / plugins / network / ipv4.c
index 0c2d1f1a72b62376b1ae49794072b351a5e12d95..78880c3d3e3ea07d11df16cb55e35cf30816a793 100644 (file)
@@ -2,7 +2,7 @@
  * ipv4.c: IPv4 network abstraction layer
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: ipv4.c,v 1.14 2002/07/19 21:14:13 massiot Exp $
+ * $Id: ipv4.c,v 1.15 2002/07/31 20:56:52 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Mathias Kretschmer <mathias@research.att.com>
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static void getfunctions( function_list_t * );
-static int  NetworkOpen( vlc_object_t *, network_socket_t * );
+static int NetOpen( vlc_object_t * );
 
 /*****************************************************************************
- * Build configuration tree.
+ * Module descriptor
  *****************************************************************************/
-MODULE_CONFIG_START
-MODULE_CONFIG_STOP
-MODULE_INIT_START
-    SET_DESCRIPTION( _("IPv4 network abstraction layer") )
-    ADD_CAPABILITY( NETWORK, 50 )
-MODULE_INIT_STOP
-MODULE_ACTIVATE_START
-    getfunctions( &p_module->p_functions->network );
-MODULE_ACTIVATE_STOP
-MODULE_DEACTIVATE_START
-MODULE_DEACTIVATE_STOP
-
-/*****************************************************************************
- * Functions exported as capabilities. They are declared as static so that
- * we don't pollute the namespace too much.
- *****************************************************************************/
-static void getfunctions( function_list_t * p_function_list )
-{
-#define f p_function_list->functions.network
-    f.pf_open = NetworkOpen;
-#undef f
-}
+vlc_module_begin();
+    set_description( _("IPv4 network abstraction layer") );
+    set_capability( "network", 50 );
+    set_callbacks( NetOpen, NULL );
+vlc_module_end();
 
 /*****************************************************************************
  * BuildAddr: utility function to build a struct sockaddr_in
@@ -357,10 +336,12 @@ static int OpenTCP( vlc_object_t * p_this, network_socket_t * p_socket )
 }
 
 /*****************************************************************************
- * NetworkOpen: wrapper around OpenUDP and OpenTCP
+ * NetOpen: wrapper around OpenUDP and OpenTCP
  *****************************************************************************/
-static int NetworkOpen( vlc_object_t * p_this, network_socket_t * p_socket )
+static int NetOpen( vlc_object_t * p_this )
 {
+    network_socket_t * p_socket = p_this->p_private;
+
     if( p_socket->i_type == NETWORK_UDP )
     {
         return OpenUDP( p_this, p_socket );