apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Colm MacCarthaigh <c...@stdlib.net>
Subject Re: [PATCH] Multicast Support
Date Fri, 31 Dec 2004 01:36:44 GMT
On Thu, Dec 30, 2004 at 04:35:50PM -0800, Paul Querna wrote:
> +static apr_status_t do_mcast_opt(int type, apr_socket_t *sock,
> +                                 apr_byte_t value)
> I hope to commit the patch this weekend... I would love comments on any 
> part of it.

It might be useful to abstract to a slightly higher level and include
support for Source-Specific Multicast (SSM) in the API now, even if an
implementation is premature. All this boils down to is adding a 

	"apr_sockaddr_t * source" 

argument to the API calls, for now it can be a mandatory NULL, with a
NOTIMP return if it's defined. But later when SSM is implemented (I'll
submit a patch ;) this means the same API can be used. This is where
Multicast is supposed to be headed anyway :)

Passing "iface" as a sockaddr is not going to be portable, the API's on
some systems (Win32 and Linux, using IPv6) for example prefer interface
names as the references. Using a string might be better, as it's
possible to convert strings to interface numbers ( if_nametoindex() ) and
sockaddr's ( inet_addr() ).

See mnc_multicast.c in

	http://people.heanet.ie/~colmmacc/mnc/mnc-1.3.tar.gz

for my last stab at an IPv6/IPv6 ASM/SSM *nix/Win32 portable Multicast
abstraction. 

> +static int sock_is_ipv4(apr_socket_t* sock) 
> +{
> +    if (sock->local_addr->family == APR_INET)
> +        return 1;
> +    return 0;
> +}
> +
> +#if APR_HAVE_IPV6
> +static int sock_is_ipv6(apr_socket_t* sock)
> +{
> +    if (sock->local_addr->family == APR_INET6)
> +        return 1;
> +    return 0;
> +}

These functions are not specific to multicast and might be better placed
non-static in sockaddr.c or sockets.c ? They look useful :) Otherwise
why not make them macros ?

> +/**
> + * Join a Multicast Group
> + * @param sock The socket to join a multicast group
> + * @param join The address of the multicast group to join
> + * @param iface Address of the interface to use.  If NULL is passed, the 
> + *              defautl multicast interface will be used. (OS Dependent)
> + */

Default is mis-spelled a few times :)

I havn't had a chance to compile it yet (just battling with subversion
now), might be back with Linux hackery.

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net

Mime
View raw message