]> git.sesse.net Git - vlc/commitdiff
* ./include/announce.h
authorClément Stenac <zorglub@videolan.org>
Wed, 25 Jun 2003 21:03:16 +0000 (21:03 +0000)
committerClément Stenac <zorglub@videolan.org>
Wed, 25 Jun 2003 21:03:16 +0000 (21:03 +0000)
  ./src/stream_output/announce.c  : use send instead of sendto.

* ./modules/misc/sap.c : use a define

include/announce.h
modules/misc/sap.c
src/stream_output/announce.c

index df02048ff581953b01f392cd6c364591c4f84070..0da8ef04c7e38998f5ea0f52b2c9935324b63f9a 100644 (file)
@@ -2,7 +2,7 @@
  * announce.h : Session announcement
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: announce.h,v 1.4 2003/06/23 11:41:26 zorglub Exp $
+ * $Id: announce.h,v 1.5 2003/06/25 21:03:16 zorglub Exp $
  *
  * Authors: Clément Stenac <zorglub@via.ecp.fr>
  *
@@ -53,8 +53,6 @@ struct sap_session_t
         module_t p_network;
         unsigned int socket;
         unsigned int sendnow;
-        struct sockaddr_in addr;
-        struct sockaddr_in6 addr6;
         int i_ip_version;
 };
 
index 0483a06cbd171bc13f5e20edf747efa709172954..a68558e9eb71fbf8de7683be024d3a06bb79ef00 100644 (file)
@@ -2,10 +2,12 @@
  * sap.c :  SAP interface module
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: sap.c,v 1.15 2003/06/20 11:42:07 alexis Exp $
+ * $Id: sap.c,v 1.16 2003/06/25 21:03:16 zorglub Exp $
  *
  * Authors: Arnaud Schauly <gitan@via.ecp.fr>
- *
+ *          Clément Stenac <zorglub@via.ecp.fr>
+ *          Damien Lucas <nitrox@videolan.org>
+ *          
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
index 395c0a2dce571e3afc245bfc238642b6891b383d..17bc34d1c19df2a8799b45fefe36620175c21f71 100644 (file)
@@ -57,11 +57,7 @@ sap_session_t * sout_SAPNew ( sout_instance_t *p_sout ,
     module_t            *p_network; /* Network module */
     network_socket_t    socket_desc; /* Socket descriptor */
     char                psz_network[6]; /* IPv4 or IPv6 */
-    struct              sockaddr_in addr; /* IPv4 connection structure */
-    struct              sockaddr_in6 addr6;/* IPv6 connection structure */
     char                *sap_ipv6_addr=NULL; /* IPv6 built address */     
-    void                *net_ipv6_addr=NULL; /* IPv6 address in net-format */
-    int                 i_status=0;  /* Problems on system calls*/
     
     /* Allocate the SAP structure */ 
     p_new = (sap_session_t *)malloc( sizeof ( sap_session_t ) ) ;
@@ -109,12 +105,6 @@ sap_session_t * sout_SAPNew ( sout_instance_t *p_sout ,
             return NULL;
         }
         
-        /* Fill the sockaddr_in structure */ 
-        memset( &addr , 0 , sizeof(addr) );
-        addr.sin_family      = AF_INET;
-        addr.sin_addr.s_addr = inet_addr(SAP_IPV4_ADDR);
-        addr.sin_port        = htons( SAP_PORT );
-        p_new->addr = addr;
     }
     else
     {
@@ -133,28 +123,6 @@ sap_session_t * sout_SAPNew ( sout_instance_t *p_sout ,
                          psz_v6_scope[0],
                          SAP_IPV6_ADDR_2); 
 
-        /* Convert it to network format */
-        net_ipv6_addr = (struct in6_addr *)malloc( sizeof(struct in6_addr) );
-        if ( !net_ipv6_addr )
-        {
-            msg_Err( p_sout, "No memory left" );        
-            return NULL;
-        }
-        
-#ifndef WIN32
-        i_status         = inet_pton(AF_INET6,sap_ipv6_addr,net_ipv6_addr);
-#endif
-        if(i_status < 0 )
-        {
-           msg_Warn(p_sout,"Unable to convert address to network format");
-           return NULL;
-        }
-        else if(i_status == 0)
-        {
-            msg_Warn(p_sout,"Adresse de diffusion SAP invalide"); 
-            return NULL;
-        }
-        
         /* Fill the socket descriptor */
         socket_desc.i_type        = NETWORK_UDP;
         socket_desc.psz_bind_addr = ""; 
@@ -182,18 +150,9 @@ sap_session_t * sout_SAPNew ( sout_instance_t *p_sout ,
              return NULL;
          }
                 
-        /* Fill the sockaddr_in structure */
-        memset( &addr6 , 0 , sizeof(addr6) );
-        addr6.sin6_family      = AF_INET6;
-        memcpy( &addr6.sin6_addr.s6_addr , net_ipv6_addr ,
-                   sizeof(addr6.sin6_addr.s6_addr) );
-            
-        addr6.sin6_port        = htons( SAP_PORT );
-        p_new->addr6 = addr6;
 
         /* Free what we allocated */
         if( sap_ipv6_addr ) free(sap_ipv6_addr);
-        if( net_ipv6_addr ) free(net_ipv6_addr);
     }
             
     msg_Dbg (p_sout,"SAP initialization complete");
@@ -290,17 +249,13 @@ a=type:test\n", p_this->psz_name , p_this->psz_port , p_this->psz_url );
       {
           if( p_this->i_ip_version == 6)
           {
-               i_send_result =  sendto( p_this->socket , sap_send ,
-                           i_size , 0 , 
-                           (struct sockaddr *)&p_this->addr6, 
-                           sizeof(p_this->addr6) );
+               i_send_result =  send( p_this->socket , sap_send ,
+                           i_size , 0 );
           } 
           else
           {
-                i_send_result =  sendto( p_this->socket , sap_send ,
-                             i_size , 0 , 
-                             (struct sockaddr *)&p_this->addr , 
-                             sizeof(p_this->addr) );
+                i_send_result =  send( p_this->socket , sap_send ,
+                             i_size , 0 );
            }
       }