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

R

Richard Kilmer

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/rendezvous/

There is a project wiki on RubyForge:

http://dnssd.rubyforge.org

With a developer guide here:

http://dnssd.rubyforge.org/wiki/wiki.pl?DeveloperGuide

Some background on DNSSD and MultiCast DNS here:

http://dnssd.rubyforge.org/wiki/wiki.pl?DNSSDBackground

And the Rdoc of the 'C' code here:

http://dnssd.rubyforge.org/doc/index.html

You can download the library here:

http://rubyforge.org/frs/?group_id=316

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!
 
R

Richard Kilmer

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.rubyforge.org
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
 
M

Mikael Brockman

Richard Kilmer said:
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/rendezvous/

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.
 
C

Charles Mills

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/howto.html
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/rendezvous/

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

-Charlie
 
C

Chad Fowler

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
 
M

Mikael Brockman

Charles Mills said:
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/howto.html
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/rendezvous/

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

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top