Commit 704c851d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Export and use ListenUDP

parent ab48ec93
...@@ -101,7 +101,7 @@ VLC_EXPORT( int, __net_Accept, ( vlc_object_t *, int *, mtime_t ) ); ...@@ -101,7 +101,7 @@ 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) #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_ConnectUDP, ( vlc_object_t *p_this, const char *psz_host, int i_port, int hlim ) );
int net_ListenUDP1 (vlc_object_t *obj, const char *host, int port); VLC_EXPORT( int, net_ListenUDP1, (vlc_object_t *obj, const char *host, int port) );
#define net_OpenUDP(a, b, c, d, e ) __net_OpenUDP(VLC_OBJECT(a), b, c, d, e) #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 ) ); VLC_EXPORT( int, __net_OpenUDP, ( vlc_object_t *p_this, const char *psz_bind, int i_bind, const char *psz_server, int i_server ) );
......
...@@ -554,6 +554,7 @@ struct module_symbols_t ...@@ -554,6 +554,7 @@ struct module_symbols_t
void (*config_ChainDestroy_inner) (config_chain_t *); void (*config_ChainDestroy_inner) (config_chain_t *);
char * (*config_ChainCreate_inner) (char **, config_chain_t **, char *); char * (*config_ChainCreate_inner) (char **, config_chain_t **, char *);
int (*utf8_open_inner) (const char *filename, int flags, mode_t mode); 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__) # if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner # define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
...@@ -1031,6 +1032,7 @@ struct module_symbols_t ...@@ -1031,6 +1032,7 @@ struct module_symbols_t
# define config_ChainDestroy (p_symbols)->config_ChainDestroy_inner # define config_ChainDestroy (p_symbols)->config_ChainDestroy_inner
# define config_ChainCreate (p_symbols)->config_ChainCreate_inner # define config_ChainCreate (p_symbols)->config_ChainCreate_inner
# define utf8_open (p_symbols)->utf8_open_inner # define utf8_open (p_symbols)->utf8_open_inner
# define net_ListenUDP1 (p_symbols)->net_ListenUDP1_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/****************************************************************** /******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access. * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
...@@ -1511,6 +1513,7 @@ struct module_symbols_t ...@@ -1511,6 +1513,7 @@ struct module_symbols_t
((p_symbols)->config_ChainDestroy_inner) = config_ChainDestroy; \ ((p_symbols)->config_ChainDestroy_inner) = config_ChainDestroy; \
((p_symbols)->config_ChainCreate_inner) = config_ChainCreate; \ ((p_symbols)->config_ChainCreate_inner) = config_ChainCreate; \
((p_symbols)->utf8_open_inner) = utf8_open; \ ((p_symbols)->utf8_open_inner) = utf8_open; \
((p_symbols)->net_ListenUDP1_inner) = net_ListenUDP1; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \ (p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->__sout_CfgParse_deprecated = NULL; \ (p_symbols)->__sout_CfgParse_deprecated = NULL; \
(p_symbols)->sout_CfgCreate_deprecated = NULL; \ (p_symbols)->sout_CfgCreate_deprecated = NULL; \
......
...@@ -480,8 +480,8 @@ static int MMSOpen( access_t *p_access, vlc_url_t *p_url, int i_proto ) ...@@ -480,8 +480,8 @@ static int MMSOpen( access_t *p_access, vlc_url_t *p_url, int i_proto )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_sys->i_handle_udp = net_OpenUDP( p_access, p_sys->sz_bind_addr, p_sys->i_handle_udp = net_ListenUDP1( p_access, p_sys->sz_bind_addr,
7000, "", 0 ); 7000 );
if( p_sys->i_handle_udp < 0 ) if( p_sys->i_handle_udp < 0 )
{ {
msg_Err( p_access, "failed to open a connection (udp)" ); msg_Err( p_access, "failed to open a connection (udp)" );
......
...@@ -144,7 +144,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -144,7 +144,7 @@ static void Run( intf_thread_t *p_intf )
} }
if( b_master ) if( b_master )
i_socket = net_OpenUDP( p_intf, NULL, NETSYNC_PORT, NULL, 0 ); i_socket = net_ListenUDP1( p_intf, NULL, NETSYNC_PORT );
else else
i_socket = net_ConnectUDP( p_intf, psz_master, NETSYNC_PORT, 0 ); i_socket = net_ConnectUDP( p_intf, psz_master, NETSYNC_PORT, 0 );
......
...@@ -257,7 +257,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -257,7 +257,7 @@ static int Open( vlc_object_t *p_this )
} }
var_Get( p_stream, SOUT_CFG_PREFIX "port", &val ); var_Get( p_stream, SOUT_CFG_PREFIX "port", &val );
p_sys->i_fd = net_OpenUDP( p_stream, NULL, val.i_int, NULL, 0 ); p_sys->i_fd = net_ListenUDP1( p_stream, NULL, val.i_int );
if ( p_sys->i_fd < 0 ) if ( p_sys->i_fd < 0 )
{ {
free( p_sys ); free( p_sys );
......
...@@ -398,7 +398,7 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap, ...@@ -398,7 +398,7 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
if( p_sap->b_control == VLC_TRUE ) if( p_sap->b_control == VLC_TRUE )
{ {
p_address->i_rfd = net_OpenUDP( p_sap, psz_addr, SAP_PORT, "", 0 ); p_address->i_rfd = net_ListenUDP1( p_sap, psz_addr, SAP_PORT );
if( p_address->i_rfd != -1 ) if( p_address->i_rfd != -1 )
net_StopSend( p_address->i_rfd ); net_StopSend( p_address->i_rfd );
p_address->i_buff = 0; p_address->i_buff = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment