On Thu, Apr 13, 2006 at 12:48:41AM +0900, Xan wrote:
> An alternative is if you point me some library that serve for receiving 
> UDP packets of client DNS and can process these

Look at the source for resolv.rb in the ruby stdlib. It has DNS message
encoding/decoding classes.

Also, the dnssd project has a net-mdns project with a forked version of
resolv.rb with bug fixes, documentation, and extensions to resolv.rb you
might find useful:

  http://dnssd.rubyforge.org/net-mdns/
  
An mDNS/DNS-SD server receives and sends DNS format messages, so might
be a useful example for you if you are writing a mini pure-ruby DNS
server.  The message encoding and decoding should be pretty easy, and I
should be able to help if you have trouble.

Also, I'd be interested in seeing your code if you publish, it could be
very interesting to have a DNS server framework in ruby. There might be
some synergy between it and DNSSD. For example, I might be able to point
nameserver in my resolv.conf to 127.0.0.1, and have a ruby DNS daemon
runnning that did lookups in .local using mDNS and forwarded all other
lookups to the "real" DNS server. If you structure your DNS server in a
way that records can be added to it at runtime (so not just load them
from a static file, perhaps have it make callbacks for record lookups),
maybe I could use it, too. :-)

Good luck,
Sam