]> git.sesse.net Git - vlc/commitdiff
Cleanup
authorRémi Denis-Courmont <rem@videolan.org>
Mon, 6 Nov 2006 17:29:07 +0000 (17:29 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Mon, 6 Nov 2006 17:29:07 +0000 (17:29 +0000)
include/network.h
include/vlc_symbols.h
src/network/io.c
src/network/udp.c

index 61b494bdb3c1ecf1caa7a796cd590fcdb1143d30..1f6d197253c124e799fb49f33cfc1d3e568e1614 100644 (file)
@@ -89,8 +89,10 @@ int net_Socket (vlc_object_t *obj, int family, int socktype, int proto);
 #define net_OpenTCP(a, b, c) __net_ConnectTCP(VLC_OBJECT(a), b, c)
 VLC_EXPORT( int, __net_ConnectTCP, ( vlc_object_t *p_this, const char *psz_host, int i_port ) );
 
-int *net_Listen (vlc_object_t *p_this, const char *psz_host, int i_port,
-                 int family, int socktype, int protocol);
+/*int *net_Listen, (vlc_object_t *p_this, const char *psz_host, int i_port,
+                                int family, int socktype, int protocol);*/
+VLC_EXPORT( int, net_ListenSingle, (vlc_object_t *p_this, const char *psz_host, int i_port,
+                                    int family, int socktype, int protocol) );
 
 #define net_ListenTCP(a, b, c) __net_ListenTCP(VLC_OBJECT(a), b, c)
 VLC_EXPORT( int *, __net_ListenTCP, ( vlc_object_t *, const char *, int ) );
@@ -101,7 +103,10 @@ VLC_EXPORT( int, __net_Accept, ( vlc_object_t *, int *, mtime_t ) );
 #define net_ConnectUDP(a, b, c, d ) __net_ConnectUDP(VLC_OBJECT(a), b, c, d)
 VLC_EXPORT( int, __net_ConnectUDP, ( vlc_object_t *p_this, const char *psz_host, int i_port, int hlim ) );
 
-VLC_EXPORT( int, net_ListenUDP1, (vlc_object_t *obj, const char *host, int port) );
+static inline int net_ListenUDP1 (vlc_object_t *obj, const char *host, int port)
+{
+       return net_ListenSingle (obj, host, port, AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP);
+}
 
 #define net_OpenUDP(a, b, c, d, e ) __net_OpenUDP(VLC_OBJECT(a), b, c, d, e)
 VLC_EXPORT( int, __net_OpenUDP, ( vlc_object_t *p_this, const char *psz_bind, int i_bind, const char *psz_server, int i_server ) );
index ff2c6965797cf4161797f5f0161e9f8f573e6e7d..87175350ba777b749fe80e24e81df4fce27437e7 100644 (file)
@@ -554,7 +554,6 @@ struct module_symbols_t
     void (*config_ChainDestroy_inner) (config_chain_t *);
     char * (*config_ChainCreate_inner) (char **, config_chain_t **, char *);
     int (*utf8_open_inner) (const char *filename, int flags, mode_t mode);
-    int (*net_ListenUDP1_inner) (vlc_object_t *obj, const char *host, int port);
 };
 # if defined (__PLUGIN__)
 #  define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
@@ -1032,7 +1031,6 @@ struct module_symbols_t
 #  define config_ChainDestroy (p_symbols)->config_ChainDestroy_inner
 #  define config_ChainCreate (p_symbols)->config_ChainCreate_inner
 #  define utf8_open (p_symbols)->utf8_open_inner
-#  define net_ListenUDP1 (p_symbols)->net_ListenUDP1_inner
 # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
 /******************************************************************
  * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
@@ -1513,7 +1511,6 @@ struct module_symbols_t
     ((p_symbols)->config_ChainDestroy_inner) = config_ChainDestroy; \
     ((p_symbols)->config_ChainCreate_inner) = config_ChainCreate; \
     ((p_symbols)->utf8_open_inner) = utf8_open; \
-    ((p_symbols)->net_ListenUDP1_inner) = net_ListenUDP1; \
     (p_symbols)->net_ConvertIPv4_deprecated = NULL; \
     (p_symbols)->__sout_CfgParse_deprecated = NULL; \
     (p_symbols)->sout_CfgCreate_deprecated = NULL; \
index c6cad1649e132537ec429904040bba218c82b483..65cd3c2752f2910b327323115860fcd966b89a86 100644 (file)
@@ -114,8 +114,8 @@ int net_Socket (vlc_object_t *p_this, int family, int socktype,
 }
 
 
-int *net_Listen (vlc_object_t *p_this, const char *psz_host, int i_port,
-                 int family, int socktype, int protocol)
+static int *net_Listen (vlc_object_t *p_this, const char *psz_host,
+                        int i_port, int family, int socktype, int protocol)
 {
     struct addrinfo hints, *res;
 
@@ -233,6 +233,28 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host, int i_port,
 }
 
 
+int net_ListenSingle (vlc_object_t *obj, const char *host, int port,
+                      int family, int socktype, int protocol)
+{
+    int *fdv = net_Listen (obj, host, port, family, socktype, protocol);
+    if (fdv == NULL)
+        return -1;
+
+    for (unsigned i = 1; fdv[i] != -1; i++)
+    {
+        msg_Warn (obj, "A socket has been dropped!");
+        net_Close (fdv[i]);
+    }
+
+    int fd = fdv[0];
+    assert (fd != -1);
+
+    free (fdv);
+    return fd;
+}
+
+
+
 /*****************************************************************************
  * __net_Close:
  *****************************************************************************
index 08bcffd33d1d4f17f9d0ff0778ec0041e4ed19db..62b64b035b167feb13fa717efa5445c9d01ebc9b 100644 (file)
@@ -402,38 +402,6 @@ int __net_ConnectUDP( vlc_object_t *p_this, const char *psz_host, int i_port,
 }
 
 
-static inline
-int *__net_ListenUDP (vlc_object_t *obj, const char *host, int port)
-{
-    int *fdv = net_Listen (obj, host, port, 0, SOCK_DGRAM, IPPROTO_UDP);
-    if (fdv == NULL)
-        return NULL;
-
-    /* FIXME: handle multicast subscription */
-    return fdv;
-}
-
-
-int net_ListenUDP1 (vlc_object_t *obj, const char *host, int port)
-{
-    int *fdv = __net_ListenUDP (obj, host, port);
-    if (fdv == NULL)
-        return -1;
-
-    for (unsigned i = 1; fdv[i] != -1; i++)
-    {
-        msg_Warn (obj, "A socket has been dropped!");
-        net_Close (fdv[i]);
-    }
-
-    int fd = fdv[0];
-    assert (fd != -1);
-
-    free (fdv);
-    return fd;
-}
-
-
 /*****************************************************************************
  * __net_OpenUDP:
  *****************************************************************************