Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.unix.programmer > #8278

Re: Resolver API question

From Rainer Weikusat <rweikusat@talktalk.net>
Newsgroups comp.unix.programmer
Subject Re: Resolver API question
Date 2016-03-30 15:54 +0100
Message-ID <87mvpg3tk7.fsf@doppelsaurus.mobileactivedefense.com> (permalink)
References <nddn6b$eqk$1@gioia.aioe.org> <barmar-AF2BB6.11350029032016@88-209-239-213.giganet.hu> <nde8b4$1emg$1@gioia.aioe.org>

Show all headers | View raw


spud@potato.field writes:
> On Tue, 29 Mar 2016 11:35:00 -0400
> Barry Margolin <barmar@alum.mit.edu> wrote:
>>In article <nddn6b$eqk$1@gioia.aioe.org>, spud@potato.field wrote:
>>
>>> I'm trying to decode the rdata field returned in a resource record by the
>>> ns_parserr() function. eg:
>>> 
>>> ns_parserr(&msg,ns_s_an,i,&r_rec);
>>> rdata = ns_rr_rdata(r_rec);
>>> 
>>> However the ns_name_uncompress() function only seems to work with rdata in
>>  NS  records

[...]

>>There's no name in the rdata of an A record, it just has an IP address, 
>>which is in binary. And for an MX record you have to skip over the 
>>priority field to get to the server name.
>
> I'm presuming that priority field is a subfield of the rdata field in the
> resource record because its not a field defined in the ns_rr structure?

DNS answers contain so-called 'resource records' of various types and
the resource record data (rdata) format depends on the type, eg, for MX
records, RFC1035 says

,----
| 3.3.9. MX RDATA format
| 
|     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|     |                  PREFERENCE                   |
|     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|     /                   EXCHANGE                    /
|     /                                               /
|     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| 
| where:
| 
| PREFERENCE      A 16 bit integer which specifies the preference given to
|                 this RR among others at the same owner.  Lower values
|                 are preferred.
| 
| EXCHANGE        A <domain-name> which specifies a host willing to act as
|                 a mail exchange for the owner name.
`----
https://tools.ietf.org/html/rfc1035

Back to comp.unix.programmer | Previous | NextPrevious in thread | Find similar


Thread

Resolver API question spud@potato.field - 2016-03-29 10:59 +0000
  Re: Resolver API question Barry Margolin <barmar@alum.mit.edu> - 2016-03-29 11:35 -0400
    Re: Resolver API question spud@potato.field - 2016-03-29 15:52 +0000
      Re: Resolver API question Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-30 15:54 +0100

csiph-web