Re: [streaming] MiniSAPserver port to Solaris 10

Saso Kiselkov <[email protected]> Mon, 02 Mar 2009 09:37:06 +0100
Newsgroups gmane.comp.video.videolan.vls.general
Message-ID <[email protected]>
Thanks. I've constructed one more patch (attached) against trunk, 
because the following additional changes were necessary:

 - Make broadcast.cpp include config.h.
 - Change the argument to setsockopt when setting IP_MULTICAST_TTL to 
"unsigned char" instead of "int".  Turns out Solaris is a bit more 
pedantic about this than Linux (both define it as u_char, but Linux 
accepts other types as well, whereas Solaris refuses with EINVAL). I 
renamed the argument in Broadcast() from i_ttl to c_ttl as well, hoping 
to follow videolan coding standards correctly.

After these changes, the packets get routed correctly.

Cheers
--
Saso

Rémi Denis-Courmont wrote:
> Le dimanche 1 mars 2009 22:53:11 Saso Kiselkov, vous avez écrit :
>   
>> Where can I get the latest development source for testing?
>>     
>
> svn://svn.videolan.org/network/miniSAPserver/trunk
>
>

_______________________________________________
streaming mailing list
To unsubscribe or modify your subscription options:
http://mailman.videolan.org/listinfo/streaming
sapserver-solaris-2.patch (text/x-patch, 3.6 KB)
diff -rc minisapserver/broadcast.cpp minisapserver-new/broadcast.cpp
*** minisapserver/broadcast.cpp	Mon Mar  2 09:10:07 2009
--- minisapserver-new/broadcast.cpp	Mon Mar  2 09:21:20 2009
***************
*** 23,28 ****
--- 23,31 ----
   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
   *****************************************************************************/
  
+ #ifdef HAVE_CONFIG_H
+ # include "config.h"
+ #endif
  #include <sys/types.h>
  #include <sys/socket.h>
  #ifdef HAVE_SYS_SOCKIO_H
***************
*** 44,50 ****
  #include "message.h"
  #include "broadcast.h"
  
! Broadcast::Broadcast(int i_ttl, const char *psz_iface) : fd4 (-1), fd6 (-1),
                                                           scope_id (0)
  {
      /* Initializes IPv6 socket */
--- 47,53 ----
  #include "message.h"
  #include "broadcast.h"
  
! Broadcast::Broadcast(unsigned char c_ttl, const char *psz_iface) : fd4 (-1), fd6 (-1),
                                                           scope_id (0)
  {
      /* Initializes IPv6 socket */
***************
*** 81,89 ****
              }
          }
  
!         if (i_ttl != 0)
              setsockopt (fd6, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
!                         &i_ttl, sizeof(i_ttl));
  
          if (bind (fd6, (struct sockaddr *)&addr, sizeof (addr)) == 0)
              shutdown (fd6, SHUT_RD);
--- 84,92 ----
              }
          }
  
!         if (c_ttl != 0)
              setsockopt (fd6, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
!                         &c_ttl, sizeof(c_ttl));
  
          if (bind (fd6, (struct sockaddr *)&addr, sizeof (addr)) == 0)
              shutdown (fd6, SHUT_RD);
***************
*** 132,140 ****
              }
          }
  
!         if (i_ttl != 0)
              setsockopt (fd4, IPPROTO_IP, IP_MULTICAST_TTL,
!                         &i_ttl, sizeof(i_ttl));
  
          if (bind (fd4, (struct sockaddr *)&addr, sizeof (addr)) == 0)
              shutdown (fd4, SHUT_RD);
--- 135,143 ----
              }
          }
  
!         if (c_ttl != 0)
              setsockopt (fd4, IPPROTO_IP, IP_MULTICAST_TTL,
!                         &c_ttl, sizeof(c_ttl));
  
          if (bind (fd4, (struct sockaddr *)&addr, sizeof (addr)) == 0)
              shutdown (fd4, SHUT_RD);
diff -rc minisapserver/broadcast.h minisapserver-new/broadcast.h
*** minisapserver/broadcast.h	Mon Mar  2 09:10:07 2009
--- minisapserver-new/broadcast.h	Mon Mar  2 09:21:44 2009
***************
*** 31,37 ****
  
  class Broadcast {
    public:
!     Broadcast(int i_ttl = 0, const char *psz_iface = NULL);
      ~Broadcast(void);
      int Send(Message*, const struct sockaddr *dst, socklen_t len);
  
--- 31,37 ----
  
  class Broadcast {
    public:
!     Broadcast(unsigned char c_ttl = 0, const char *psz_iface = NULL);
      ~Broadcast(void);
      int Send(Message*, const struct sockaddr *dst, socklen_t len);
  
diff -rc minisapserver/sapserver.cpp minisapserver-new/sapserver.cpp
*** minisapserver/sapserver.cpp	Mon Mar  2 09:10:07 2009
--- minisapserver-new/sapserver.cpp	Mon Mar  2 09:21:57 2009
***************
*** 241,247 ****
                 config.GetDaemonMode() ? "daemon" : "program");
  
          /* Create the broadcast object */
!         Broadcast broadcast (config.GetTTL (), config.GetInterface ());
  
          vector<Announce *> announces;
  
--- 241,247 ----
                 config.GetDaemonMode() ? "daemon" : "program");
  
          /* Create the broadcast object */
!         Broadcast broadcast ((unsigned char) config.GetTTL (), config.GetInterface ());
  
          vector<Announce *> announces;