apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Querna <c...@force-elite.com>
Subject Re: [PATCH] Multicast Support
Date Fri, 31 Dec 2004 03:46:55 GMT
Colm MacCarthaigh wrote:
> 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 :)

I haven't done anything with SSM, but I agree it would be nice to have a 
single API if this is a feature that will be widely used.

> 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() ).

I made is a sockaddr, because I believed that to be the most portable.

Interface names are per-OS. (eg win32, linux, freebsd, and solaris are 
all different). This means if I want cross platform or even cross 
machine configuration, it must not use the interface name, but a network 
address. (Cross Machine: eg, some machines have Intel Cards, others have 
Broadcom, in FreeBSD these have different interface names.)

I welcome a better solution... :)

I thought that for any OS that prefers the interface name/number, we can 
always map the sockaddr to that interface pretty easily.

>>+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 ?

No disagreement here, I just made them for myself for pure convenience.

>>+ * 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 :)

Opps. Copy and Paste got me into trouble again.

Thanks for feedback, everything helps.


View raw message