Commit 0d39f13d authored by Laurent Aimar's avatar Laurent Aimar

* all: added a i_ttl field in network_socket_t to allow per connection ttl

setting (in fact only used by access_out/udp.c.
parent 05eff32d
......@@ -2,7 +2,7 @@
* network.h: interface to communicate with network plug-ins
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: network.h,v 1.3 2002/07/20 18:01:41 sam Exp $
* $Id: network.h,v 1.4 2003/07/31 23:44:49 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -35,6 +35,8 @@ struct network_socket_t
char * psz_server_addr;
int i_server_port;
int i_ttl;
/* Return values */
int i_handle;
size_t i_mtu;
......
......@@ -2,7 +2,7 @@
* ftp.c:
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: ftp.c,v 1.19 2003/05/15 22:27:36 massiot Exp $
* $Id: ftp.c,v 1.20 2003/07/31 23:44:49 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -200,6 +200,7 @@ static int Open( vlc_object_t *p_this )
socket_desc.i_server_port = p_url->i_server_port;
socket_desc.psz_bind_addr = "";
socket_desc.i_bind_port = 0;
socket_desc.i_ttl = 0;
p_input->p_private = (void*)&socket_desc;
if( !( p_network = module_Need( p_input, "network", psz_network ) ) )
{
......@@ -644,6 +645,7 @@ static int ftp_StartStream( input_thread_t *p_input, off_t i_start )
socket_desc.i_server_port = i_port;
socket_desc.psz_bind_addr = "";
socket_desc.i_bind_port = 0;
socket_desc.i_ttl = 0;
p_input->p_private = (void*)&socket_desc;
if( !( p_network = module_Need( p_input, "network", "" ) ) )
{
......
......@@ -2,7 +2,7 @@
* http.c: HTTP access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: http.c,v 1.40 2003/07/31 21:18:59 bigben Exp $
* $Id: http.c,v 1.41 2003/07/31 23:44:49 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -710,6 +710,7 @@ static int Open( vlc_object_t *p_this )
p_access_data->socket_desc.psz_server_addr = psz_proxy;
p_access_data->socket_desc.i_server_port = i_proxy_port;
p_access_data->socket_desc.i_type = NETWORK_TCP;
p_access_data->socket_desc.i_ttl = 0;
snprintf( p_access_data->psz_buffer, MAX_QUERY_SIZE,
"GET http://%s:%d/%s HTTP/1.0\r\n",
......@@ -721,6 +722,7 @@ static int Open( vlc_object_t *p_this )
p_access_data->socket_desc.i_type = NETWORK_TCP;
p_access_data->socket_desc.psz_server_addr = psz_server_addr;
p_access_data->socket_desc.i_server_port = i_server_port;
p_access_data->socket_desc.i_ttl = 0;
snprintf( p_access_data->psz_buffer, MAX_QUERY_SIZE,
"GET /%s HTTP/1.1\r\nHost: %s\r\n",
......
......@@ -2,7 +2,7 @@
* mmsh.c:
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: mmsh.c,v 1.3 2003/05/08 19:06:45 titer Exp $
* $Id: mmsh.c,v 1.4 2003/07/31 23:44:49 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -711,6 +711,7 @@ static input_socket_t * NetOpenTCP( input_thread_t *p_input, url_t *p_url )
socket_desc.i_server_port = p_url->i_port;
socket_desc.psz_bind_addr = "";
socket_desc.i_bind_port = 0;
socket_desc.i_ttl = 0;
p_input->p_private = (void*)&socket_desc;
if( !( p_network = module_Need( p_input, "network", psz_network ) ) )
{
......
......@@ -2,7 +2,7 @@
* mms.c: MMS access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: mmstu.c,v 1.5 2003/07/16 15:32:41 sam Exp $
* $Id: mmstu.c,v 1.6 2003/07/31 23:44:49 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -449,6 +449,7 @@ static int MMSOpen( input_thread_t *p_input,
socket_desc.i_server_port = p_url->i_port;
socket_desc.psz_bind_addr = "";
socket_desc.i_bind_port = 0;
socket_desc.i_ttl = 0;
p_input->p_private = (void*)&socket_desc;
if( !( p_network = module_Need( p_input, "network", psz_network ) ) )
{
......@@ -490,6 +491,7 @@ static int MMSOpen( input_thread_t *p_input,
socket_desc.i_server_port = 0;
socket_desc.psz_bind_addr = p_sys->psz_bind_addr;
socket_desc.i_bind_port = 7000; //p_url->i_bind_port; FIXME
socket_desc.i_ttl = 0;
p_input->p_private = (void*)&socket_desc;
if( !( p_network = module_Need( p_input, "network", psz_network ) ) )
{
......
......@@ -2,7 +2,7 @@
* udp.c: raw UDP & RTP access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: udp.c,v 1.20 2003/07/23 07:37:34 jpsaman Exp $
* $Id: udp.c,v 1.21 2003/07/31 23:44:49 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Tristan Leteurtre <tooney@via.ecp.fr>
......@@ -261,6 +261,7 @@ static int Open( vlc_object_t *p_this )
socket_desc.i_bind_port = i_bind_port;
socket_desc.psz_server_addr = psz_server_addr;
socket_desc.i_server_port = i_server_port;
socket_desc.i_ttl = 0;
/* Find an appropriate network module */
p_input->p_private = (void*) &socket_desc;
......
......@@ -2,7 +2,7 @@
* udp.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: udp.c,v 1.10 2003/06/19 18:45:06 gbazin Exp $
* $Id: udp.c,v 1.11 2003/07/31 23:44:49 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
......@@ -127,6 +127,8 @@ static int Open( vlc_object_t *p_this )
module_t *p_network;
network_socket_t socket_desc;
char *val;
if( !( p_sys = p_access->p_sys =
malloc( sizeof( sout_access_out_sys_t ) ) ) )
{
......@@ -192,6 +194,11 @@ static int Open( vlc_object_t *p_this )
socket_desc.i_server_port = i_dst_port;
socket_desc.psz_bind_addr = "";
socket_desc.i_bind_port = 0;
socket_desc.i_ttl = 0;
if( ( val = sout_cfg_find_value( p_access->p_cfg, "ttl" ) ) )
{
socket_desc.i_ttl = atoi( val );
}
p_sys->p_thread->p_private = (void*)&socket_desc;
if( !( p_network = module_Need( p_sys->p_thread,
"network", "" ) ) )
......
......@@ -2,7 +2,7 @@
* ipv4.c: IPv4 network abstraction layer
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: ipv4.c,v 1.19 2003/06/15 01:23:31 massiot Exp $
* $Id: ipv4.c,v 1.20 2003/07/31 23:44:49 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Mathias Kretschmer <mathias@research.att.com>
......@@ -347,7 +347,11 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
if( IN_MULTICAST( ntohl(inet_addr(psz_server_addr) ) ) )
{
/* set the time-to-live */
int ttl = config_GetInt( p_this, "ttl" );
int ttl = p_socket->i_ttl;
if( ttl < 1 )
{
ttl = config_GetInt( p_this, "ttl" );
}
if( ttl < 1 ) ttl = 1;
if( setsockopt( i_handle, IPPROTO_IP, IP_MULTICAST_TTL,
......
......@@ -2,7 +2,7 @@
* ipv6.c: IPv6 network abstraction layer
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: ipv6.c,v 1.13 2003/06/15 01:23:31 massiot Exp $
* $Id: ipv6.c,v 1.14 2003/07/31 23:44:49 fenrir Exp $
*
* Authors: Alexis Guillard <alexis.guillard@bt.com>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -367,7 +367,11 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
if( *psz_server_addr )
{
int ttl = config_GetInt( p_this, "ttl" );
int ttl = p_socket->i_ttl;
if( ttl < 1 )
{
ttl = config_GetInt( p_this, "ttl" );
}
if( ttl < 1 ) ttl = 1;
/* Build socket for remote connection */
......
......@@ -2,7 +2,7 @@
* sap.c : SAP interface module
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: sap.c,v 1.20 2003/07/23 01:28:54 gbazin Exp $
* $Id: sap.c,v 1.21 2003/07/31 23:44:49 fenrir Exp $
*
* Authors: Arnaud Schauly <gitan@via.ecp.fr>
* Clment Stenac <zorglub@via.ecp.fr>
......@@ -225,6 +225,7 @@ static void Run( intf_thread_t *p_intf )
socket_desc.i_bind_port = HELLO_PORT;
socket_desc.psz_server_addr = "";
socket_desc.i_server_port = 0;
socket_desc.i_ttl = 0;
p_intf->p_private = (void*) &socket_desc;
psz_network = "ipv4";
......@@ -257,6 +258,7 @@ static void Run( intf_thread_t *p_intf )
socket_desc.i_bind_port = HELLO_PORT;
socket_desc.psz_server_addr = "";
socket_desc.i_server_port = 0;
socket_desc.i_ttl = 0;
p_intf->p_private = (void*) &socket_desc;
psz_network = "ipv6";
......
......@@ -211,6 +211,7 @@ sap_session_t * sout_SAPNew ( sout_instance_t *p_sout, char * psz_url_arg,
socket_desc.psz_server_addr = SAP_IPV4_ADDR;
socket_desc.i_server_port = SAP_PORT;
socket_desc.i_handle = 0;
socket_desc.i_ttl = 0;
/* Call the network module */
p_sout->p_private = (void*) &socket_desc;
......@@ -250,6 +251,7 @@ sap_session_t * sout_SAPNew ( sout_instance_t *p_sout, char * psz_url_arg,
socket_desc.psz_server_addr = sap_ipv6_addr;
socket_desc.i_server_port = SAP_PORT;
socket_desc.i_handle = 0;
socket_desc.i_ttl = 0;
/* Call the network module */
p_sout->p_private = (void *) &socket_desc;
......
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