#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 ) );
#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 ) );
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
# 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.
((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; \
}
-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;
}
+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:
*****************************************************************************
}
-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:
*****************************************************************************