stupid lwres question
Mark_Andrews at isc.org
Mark_Andrews at isc.org
Fri Oct 18 02:18:57 UTC 2002
> >>>>> "Mark" == Mark Andrews <Mark.Andrews at isc.org> writes:
> Mark> I ment to say dns_rdata_fromregion() and dns_rdata_tostruct().
>
> Mark> Also dns_rdata_totext().
>
> Four questions
> 1) will there be man pages for these eventually?
Some day.
> 2) is this an interface you want people to use?
Yes.
> 3) I think that the only docs are in the headers, are there others?
No (apart from the source itself).
> 4) I think that I should do something like the following:
>
> isc_region_t region;
> dns_rdata_t rd;
> dns_rdata_sig_t sig;
>
> {res is result from lwres_getrrsetbyname()}
>
> region.base = &res->rri_sigs[i];
> region.length = res->rri_length;
region.base = res->rri_sigs[i].rdi_data;
region.length = res->rri_sigs[i].rdi_length;
> dns_rdata_fromregion(&rd, ns_c_in, ns_t_sig, ®ion);
dns_rdata_fromregion(&rd, dns_rdataclass_in,
dns_rdatatype_sig, ®ion);
>
> dns_rdata_tostruct(&rd, &sig, NULL);
> - -> I now have the signature decoded into a structure.
>
> isc_buffer_t *mybuf;
> isc_mem_t *mymem;
mymem = NULL;
mybuf = NULL;
> isc_mem_create(0, 0, &mymem);
>
> isc_buffer_allocate(mymem, &mybuf, 1024); /* but is there a better number? */
>
> dns_rdata_totext(&rd, NULL, mybuf);
printf("%*.s\n", isc_buffer_usedlength(mybuf),
isc_buffer_base(mybuf));
dns_rdata_totext() will return ISC_R_NOSPACE if the buffer is
to small.
Mark
--
Mark Andrews, Internet Software Consortium
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742 INTERNET: Mark.Andrews at isc.org
More information about the bind-workers
mailing list