resolver
Rob Rosell
rosell at stolaf.edu
Wed Jun 12 07:49:29 AEST 1991
Greetings Everybody!!
I am attemptig to write an applications which will list the hosts in the
current domain or within another specified domain. The information needs
to be retrieved through the domain name server.
The problem is that the man page which I have read over, along with the
header files, is rather incomplete in it's explanation of the resolver
functions.
There are 5 functions listed in the resolver man page.
NAME
resolver, res_mkquery, res_send, res_init, dn_comp,
dn_expand - resolver routines
SYNOPSIS
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)
int op;
char *dname;
int class, type;
char *data;
int datalen;
struct rrec *newrr;
char *buf;
int buflen;
res_send(msg, msglen, answer, anslen)
char *msg;
int msglen;
char *answer;
int anslen;
res_init()
dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
u_char *exp_dn, *comp_dn;
int length;
u_char **dnptrs, **lastdnptr;
dn_expand(msg, msglen, comp_dn, exp_dn, length)
u_char *msg, *eomorig, *comp_dn, exp_dn;
int length;
Supposedly, res_init reads from the initialization file, /etc/resolv.conf
I believe, to get the default domain name and Internet address of the
initial hosts the name server is running on. I'm fine up to this point.
res_mkquery is supposed to construct a query and place it in buf, so that
the query may later be sent to the domain name server. Parameters for
int op; char *dname; int class, type; char *buf; and int buflen; are given
either in the man pages or in the header files. Data, and newrr are
completely unmentioned except for a VERY brief statement about newrr in the
man page which says it isn't used for anything yet anyway...
Ok, supposing I figure out what data is for, I am ready to send my
query with res_send. I think that msg is the query we are sending,
i.e. buf from res_mkquery. res_send should place the answer from the
domain name server in char *answer. I've tried various parameters for
res_mkquery but I find no significant results when I attempt to send the
query with res_send.
The most baffeling members of the resolver functions are dn_comp and
dn_expand. Nowhere is there an explanation of *eomorig for dn_expand,
or an explanation of why the domainname should be compressed in the
first place. I understand the concepts behind these two functions
but I am at a loss as to how to use them, or what they're arguements
For any and all help I will be most greatfull!!!
Thanks!
-------------------------------------------------------------------------------
E-Mail: rosell at acc.stolaf.edu SnailMail: Rob Rosell
rosell at acc.stolaf.edu Snail Mail: Rob Rosell
(The Guy in the Hat) St.Olaf College
Computers, Coshmuters, Why do I bother? Northfield, MN 55057
------------------------------------------------------------------------------
More information about the Comp.unix.programmer
mailing list