private MX_Record ParseMxRecord(byte[] reply,ref int offset,int ttl)
{
/* RFC 1035 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.
*/
int pref = reply[offset++] << 8 | reply[offset++];
string name = "";
if(GetQName(reply,ref offset,ref name)){
return new MX_Record(pref,name,ttl);
}
return null;
}