From dev-return-13475-apmail-apr-dev-archive=apr.apache.org@apr.apache.org Fri Dec 31 01:36:53 2004 Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 26787 invoked from network); 31 Dec 2004 01:36:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 31 Dec 2004 01:36:53 -0000 Received: (qmail 44308 invoked by uid 500); 31 Dec 2004 01:36:52 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 44269 invoked by uid 500); 31 Dec 2004 01:36:52 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 44255 invoked by uid 99); 31 Dec 2004 01:36:51 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Date: Fri, 31 Dec 2004 01:36:44 +0000 From: Colm MacCarthaigh To: Paul Querna Cc: dev@apr.apache.org Subject: Re: [PATCH] Multicast Support Message-ID: <20041231013644.GA24492@castlerea.stdlib.net.> Reply-To: colm@stdlib.net References: <41D49EE6.1060702@force-elite.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <41D49EE6.1060702@force-elite.com> User-Agent: Mutt/1.3.28i X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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