[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] DNS Service Discovery (aka Rendezvous) bindings for Ruby

Richard Kilmer

10/7/2004 11:19:00 PM

All,

We are pleased to announce the first (actually second) release of the Ruby
'dnssd' library (v 0.6.0). This is a native extension.

This represents a Ruby binding to the DNS Service Discovery API published
and open-sourced by Apple Computer. This should compile with the source
available from the Darwin project, or on OS X Panther systems. It will
also compile on Win32 platforms that have installed the Rendezvous for
Windows Technology Preview 2 which can be found here:

http://developer.apple.com/macosx/r...

There is a project wiki on RubyForge:

http://dnssd.rub...

With a developer guide here:

http://dnssd.rub.../wiki/wiki.pl?DeveloperGuide

Some background on DNSSD and MultiCast DNS here:

http://dnssd.rub.../wiki/wiki.pl?DNSSDBackground

And the Rdoc of the 'C' code here:

http://dnssd.rub.../doc/index.html

You can download the library here:

http://rubyforge.org/frs/?gr...

The low level APIs are documented and in place...higher level APIs are in
the works as we speak. A source .gem will follow soon (its a .tar.gz file
right now...for you rpa folks ;-)

Charlie Mills did most of this work...so thanks Charlie!

Best,

Rich Kilmer
Charlie Mills
Chad Fowler
Stuart Cheshire <- DNSSD Architect from Apple!




5 Answers

Richard Kilmer

10/8/2004 2:37:00 AM

0




On 10/7/04 7:19 PM, "Richard Kilmer" <rich@infoether.com> wrote:

<SNIP>

> The low level APIs are documented and in place...higher level APIs are in
> the works as we speak. A source .gem will follow soon (its a .tar.gz file
> right now...for you rpa folks ;-)
>

Gem is up!

sudo gem install dnssd --remote
Attempting remote installation of 'dnssd'
Updating Gem source index for: http://gems.rub...
Building native extensions. This could take a while...
ruby extconf.rb install dnssd --remote
checking for dns_sd.h... yes
checking for htons()... yes
checking for ntohs()... yes
checking for if_indextoname()... yes
checking for if_nametoindex()... yes
creating Makefile

make
gcc -fno-common -g -O2 -fno-common -pipe -fno-common -Wall -I.
-I/usr/local/lib/ruby/1.8/powerpc-darwin
-I/usr/local/lib/ruby/1.8/powerpc-darwin -I. -DHAVE_DNS_SD_H -DHAVE_HTONS
-DHAVE_NTOHS -DHAVE_IF_INDEXTONAME -DHAVE_IF_NAMETOINDEX -c rdnssd.c
gcc -fno-common -g -O2 -fno-common -pipe -fno-common -Wall -I.
-I/usr/local/lib/ruby/1.8/powerpc-darwin
-I/usr/local/lib/ruby/1.8/powerpc-darwin -I. -DHAVE_DNS_SD_H -DHAVE_HTONS
-DHAVE_NTOHS -DHAVE_IF_INDEXTONAME -DHAVE_IF_NAMETOINDEX -c
rdnssd_service.c
gcc -fno-common -g -O2 -fno-common -pipe -fno-common -Wall -I.
-I/usr/local/lib/ruby/1.8/powerpc-darwin
-I/usr/local/lib/ruby/1.8/powerpc-darwin -I. -DHAVE_DNS_SD_H -DHAVE_HTONS
-DHAVE_NTOHS -DHAVE_IF_INDEXTONAME -DHAVE_IF_NAMETOINDEX -c
rdnssd_structs.c
gcc -fno-common -g -O2 -fno-common -pipe -fno-common -Wall -I.
-I/usr/local/lib/ruby/1.8/powerpc-darwin
-I/usr/local/lib/ruby/1.8/powerpc-darwin -I. -DHAVE_DNS_SD_H -DHAVE_HTONS
-DHAVE_NTOHS -DHAVE_IF_INDEXTONAME -DHAVE_IF_NAMETOINDEX -c rdnssd_tr.c
cc -dynamic -bundle -undefined suppress -flat_namespace -L"/usr/local/lib"
-o rdnssd.bundle rdnssd.o rdnssd_service.o rdnssd_structs.o rdnssd_tr.o
-lruby -ldl -lobjc

make install
install -c -p -m 0755 rdnssd.bundle
/usr/local/lib/ruby/gems/1.8/gems/dnssd-0.6.0/lib
Successfully installed dnssd, version 0.6.0




Mikael Brockman

10/8/2004 11:02:00 PM

0

Richard Kilmer <rich@infoether.com> writes:

> All,
>
> We are pleased to announce the first (actually second) release of the Ruby
> 'dnssd' library (v 0.6.0). This is a native extension.
>
> This represents a Ruby binding to the DNS Service Discovery API published
> and open-sourced by Apple Computer. This should compile with the source
> available from the Darwin project, or on OS X Panther systems. It will
> also compile on Win32 platforms that have installed the Rendezvous for
> Windows Technology Preview 2 which can be found here:
>
> http://developer.apple.com/macosx/r...

I don't understand how to install it on Linux. setup.rb is looking for
-lmdns, but I can't find any shared libraries in the mDNSResponder tree.



Charles Mills

10/9/2004 2:34:00 AM

0

On Oct 8, 2004, at 4:01 PM, Mikael Brockman wrote:
> I don't understand how to install it on Linux. setup.rb is looking for
> -lmdns, but I can't find any shared libraries in the mDNSResponder
> tree.
>

Building on a mac is easy :)
Figuring out how to build on linux was a pain :(

But it isn't that bad. It looks like they renamed libmdns to libdns_sd.
So, make this change in extconf.rb:
## replace ##
have_library( "mdns", "DNSServiceRefSockFD" ) or
abort( "can't find rendezvous library" )
## with ##
have_library( "mdns", "DNSServiceRefSockFD" ) or
have_library( "dns_sd", "DNSServiceRefSockFD" ) or
abort( "can't find rendezvous library" )
########
then:
$ ruby extconf.rb
checking for DNSServiceRefSockFD() in -lmdns... no
checking for DNSServiceRefSockFD() in -ldns_sd... yes
checking for dns_sd.h... yes
checking for htons()... yes
checking for ntohs()... yes
checking for if_indextoname()... yes
checking for if_nametoindex()... yes
creating Makefile
$ make
<snip>
$ /etc/init.d/mdns start # if you don't have it started already
Starting Apple Darwin Multicast DNS / DNS Service Discovery daemon:
mdnsd.
$ cd ../test
$ ruby test_resolve_ichat.rb
Press <return> to start (and <return to end):
############ HIT ENTER ###########
######## OPEN ICHAT on my MAC ####
Browsing: #<DNSSD::BrowseReply boson@rodin._presence._tcp.local.
interface:eth0>
Adding: #<DNSSD::ResolveReply boson@rodin._presence._tcp.local.
interface:eth0 target:rodin.local.:5298 {"status"=>"avail", "vc"=>"A!",
"last"=>"Mills", "txtvers"=>"1", "AIM"=>"charlesmmills",
"version"=>"1", "phsh"=>"41e70d70b1b37798ff87f753a05ba8025355b4a4",
"1st"=>"Charles", "port.p2pj"=>"5298", "email"=>"hidden from spam"}>
####### QUIT ICHAT ###############
Browsing: #<DNSSD::BrowseReply boson@rodin._presence._tcp.local.
interface:eth0>
Removing: #<DNSSD::ResolveReply boson@rodin._presence._tcp.local.
interface:eth0 target:rodin.local.:5298 {"status"=>"avail", "vc"=>"A!",
"last"=>"Mills", "txtvers"=>"1", "AIM"=>"charlesmmills",
"version"=>"1", "phsh"=>"41e70d70b1b37798ff87f753a05ba8025355b4a4",
"1st"=>"Charles", "port.p2pj"=>"5298", "email"=>"hidden from spam"}>

############ HIT ENTER ###########
<#DNSSD::Service (stopped)>
$ echo "beautiful, it worked"
$

I am running gentoo linux on a PC if it matters.

If you still have problems try getting the latest version of
mDNSResponder from CVS. Instructions here:
http://developer.apple.com/darwin/tools/cvs/...
There needs to be a better way to do this, it is really a pain to get,
registration required, etc. :(

Other stuff I found out trying to get this to work:

Apples DNS DS libs:
http://developer.apple.com/darwin/projects/r...

Other DNS SD libs (that won't work with the Ruby bindings and may be
packed for your linux distro):
http://jmdns.source...
http://www.porchdogsoft.com/products/howl/GettingSt...

-Charlie



Chad Fowler

10/9/2004 2:42:00 AM

0

On Sat, 9 Oct 2004 11:33:57 +0900, Charles Mills <cmills@freeshell.org> wrote:
> On Oct 8, 2004, at 4:01 PM, Mikael Brockman wrote:
> > I don't understand how to install it on Linux. setup.rb is looking for
> > -lmdns, but I can't find any shared libraries in the mDNSResponder
> > tree.
> >
>
> Building on a mac is easy :)
> Figuring out how to build on linux was a pain :(
>

I'm not sure why, but I didn't have to make these changes on my redhat box.

I just installed Apple's open source dnssd stuff from source and then
built our Ruby lib.

Weird, eh?

Chad


Mikael Brockman

10/9/2004 2:58:00 AM

0

Charles Mills <cmills@freeshell.org> writes:

> On Oct 8, 2004, at 4:01 PM, Mikael Brockman wrote:
> > I don't understand how to install it on Linux. setup.rb is looking for
> > -lmdns, but I can't find any shared libraries in the mDNSResponder
> > tree.
> >
>
> Building on a mac is easy :)
> Figuring out how to build on linux was a pain :(
>
> But it isn't that bad. It looks like they renamed libmdns to libdns_sd.
> So, make this change in extconf.rb:
> ## replace ##
> have_library( "mdns", "DNSServiceRefSockFD" ) or
> abort( "can't find rendezvous library" )
> ## with ##
> have_library( "mdns", "DNSServiceRefSockFD" ) or
> have_library( "dns_sd", "DNSServiceRefSockFD" ) or
> abort( "can't find rendezvous library" )
> ########
> then:
> $ ruby extconf.rb
> checking for DNSServiceRefSockFD() in -lmdns... no
> checking for DNSServiceRefSockFD() in -ldns_sd... yes
> checking for dns_sd.h... yes
> checking for htons()... yes
> checking for ntohs()... yes
> checking for if_indextoname()... yes
> checking for if_nametoindex()... yes
> creating Makefile
> $ make
> <snip>
> $ /etc/init.d/mdns start # if you don't have it started already
> Starting Apple Darwin Multicast DNS / DNS Service Discovery daemon:
> mdnsd.
> $ cd ../test
> $ ruby test_resolve_ichat.rb
> Press <return> to start (and <return to end):
> ############ HIT ENTER ###########
> ######## OPEN ICHAT on my MAC ####
> Browsing: #<DNSSD::BrowseReply
> boson@rodin._presence._tcp.local. interface:eth0>
> Adding: #<DNSSD::ResolveReply
> boson@rodin._presence._tcp.local. interface:eth0
> target:rodin.local.:5298 {"status"=>"avail", "vc"=>"A!",
> "last"=>"Mills", "txtvers"=>"1", "AIM"=>"charlesmmills",
> "version"=>"1", "phsh"=>"41e70d70b1b37798ff87f753a05ba8025355b4a4",
> "1st"=>"Charles", "port.p2pj"=>"5298", "email"=>"hidden from spam"}>
> ####### QUIT ICHAT ###############
> Browsing: #<DNSSD::BrowseReply
> boson@rodin._presence._tcp.local. interface:eth0>
> Removing: #<DNSSD::ResolveReply
> boson@rodin._presence._tcp.local. interface:eth0
> target:rodin.local.:5298 {"status"=>"avail", "vc"=>"A!",
> "last"=>"Mills", "txtvers"=>"1", "AIM"=>"charlesmmills",
> "version"=>"1", "phsh"=>"41e70d70b1b37798ff87f753a05ba8025355b4a4",
> "1st"=>"Charles", "port.p2pj"=>"5298", "email"=>"hidden from spam"}>
>
> ############ HIT ENTER ###########
> <#DNSSD::Service (stopped)>
> $ echo "beautiful, it worked"
> $
>
> I am running gentoo linux on a PC if it matters.
>
> If you still have problems try getting the latest version of
> mDNSResponder from CVS. Instructions here:
> http://developer.apple.com/darwin/tools/cvs/...
> There needs to be a better way to do this, it is really a pain to get,
> registration required, etc. :(
>
> Other stuff I found out trying to get this to work:
>
> Apples DNS DS libs:
> http://developer.apple.com/darwin/projects/r...
>
> Other DNS SD libs (that won't work with the Ruby bindings and may be
> packed for your linux distro):
> http://jmdns.source...
> http://www.porchdogsoft.com/products/howl/GettingSt...

Thanks, Charlie! I think the release doesn't build anything but a
couple of toy clients on Linux. The code in CVS built libraries,
though.