Skip to Content
DNS and BIND, 5th Edition
book

DNS and BIND, 5th Edition

by Cricket Liu, Paul Albitz
May 2006
Intermediate to advanced
640 pages
18h 40m
English
O'Reilly Media, Inc.
Content preview from DNS and BIND, 5th Edition

Chapter 15. Programming with the Resolver and Nameserver Library Routines

“I know what you’re thinking about,” said Tweedledum; “but it isn’t so, nohow.”

“Contrariwise,” continued Tweedledee, “if it was so, it might be; and if it were so, it would be; but as it isn’t, it ain’t. That’s logic.”

I bet you think resolver programming is hard. Contrariwise! It isn’t very hard, really. The format of DNS messages is quite straightforward; you don’t have to deal with ASN.1[*] at all, as you do with SNMP. And you have nifty library routines to make parsing DNS messages easy. We’ve included portions of RFC 1035 in Appendix A. However, you might find it handy to have a copy of RFC 1035 to look at as we go through this chapter; at least have a copy of it nearby when you write your own DNS programs.

Shell Script Programming with nslookup

Before you go off and write a C program to do your DNS chore, you should write the program as a shell script using nslookup or dig. There are good reasons to start with a shell script:

  • You can write the shell script much faster than you can write a C program.

  • If you’re not comfortable with DNS, you can work out the details of your program’s logic with a quick shell script prototype. When you finally write the C program, you can focus on the additional control you have with C rather than spending your time reworking the basic functionality.

  • You might find out that the shell script version does your task well enough so that you don’t have to write the C program after ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning DNS

Learning DNS

Cricket Liu

Publisher Resources

ISBN: 0596100574Supplemental ContentErrata Page