Commit 4b38328b authored by Gildas Bazin's avatar Gildas Bazin

* modules/misc/network/ipv4.c: multicast support for WinCE.

parent f467427e
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
*****************************************************************************/ *****************************************************************************/
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <errno.h> #include <errno.h>
...@@ -45,13 +46,19 @@ ...@@ -45,13 +46,19 @@
# include <unistd.h> # include <unistd.h>
#endif #endif
#if defined( UNDER_CE ) #if defined(WIN32) || defined(UNDER_CE)
# include <winsock.h> # if defined(UNDER_CE) && defined(sockaddr_storage)
# define close(fd) CloseHandle((HANDLE)fd) # undef sockaddr_storage
#elif defined( WIN32 ) # endif
# include <winsock2.h> # include <winsock2.h>
# include <ws2tcpip.h> # include <ws2tcpip.h>
# define close closesocket # define close closesocket
# if defined(UNDER_CE)
# undef IP_MULTICAST_TTL
# define IP_MULTICAST_TTL 3
# undef IP_ADD_MEMBERSHIP
# define IP_ADD_MEMBERSHIP 5
# endif
#else #else
# include <netdb.h> /* hostent ... */ # include <netdb.h> /* hostent ... */
# include <sys/socket.h> # include <sys/socket.h>
...@@ -256,7 +263,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket ) ...@@ -256,7 +263,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
/* Build the local socket */ /* Build the local socket */
#if defined( WIN32 ) && !defined( UNDER_CE ) #if defined( WIN32 ) || defined( UNDER_CE )
/* Under Win32 and for multicasting, we bind to INADDR_ANY, /* Under Win32 and for multicasting, we bind to INADDR_ANY,
* so let's call BuildAddr with "" instead of psz_bind_addr */ * so let's call BuildAddr with "" instead of psz_bind_addr */
if( BuildAddr( &sock, IN_MULTICAST( ntohl( inet_addr(psz_bind_addr) ) ) ? if( BuildAddr( &sock, IN_MULTICAST( ntohl( inet_addr(psz_bind_addr) ) ) ?
...@@ -282,7 +289,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket ) ...@@ -282,7 +289,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
return( -1 ); return( -1 );
} }
#if defined( WIN32 ) && !defined( UNDER_CE ) #if defined( WIN32 ) || defined( UNDER_CE )
/* Restore the sock struct so we can spare a few #ifdef WIN32 later on */ /* Restore the sock struct so we can spare a few #ifdef WIN32 later on */
if( IN_MULTICAST( ntohl( inet_addr(psz_bind_addr) ) ) ) if( IN_MULTICAST( ntohl( inet_addr(psz_bind_addr) ) ) )
{ {
...@@ -313,7 +320,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket ) ...@@ -313,7 +320,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
} }
#endif #endif
#if !defined( UNDER_CE ) && !defined( SYS_BEOS ) #if !defined( SYS_BEOS )
/* Join the multicast group if the socket is a multicast address */ /* Join the multicast group if the socket is a multicast address */
if( IN_MULTICAST( ntohl(sock.sin_addr.s_addr) ) ) if( IN_MULTICAST( ntohl(sock.sin_addr.s_addr) ) )
{ {
...@@ -418,7 +425,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket ) ...@@ -418,7 +425,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
return( -1 ); return( -1 );
} }
#if !defined( UNDER_CE ) && !defined( SYS_BEOS ) #if !defined( SYS_BEOS )
if( IN_MULTICAST( ntohl(inet_addr(psz_server_addr) ) ) ) if( IN_MULTICAST( ntohl(inet_addr(psz_server_addr) ) ) )
{ {
/* set the time-to-live */ /* set the time-to-live */
......
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