|
sdns
low-level DNS library
|
#include <sdns.h>

Public Attributes | ||
| char * | name | |
| RFC1035 - domain name. | ||
| uint16_t | type | |
| RFC1035 - RR type code. | ||
| union { | ||
| uint16_t class | ||
| RFC1035 - class of the data in rdata. | ||
| uint16_t udp_size | ||
| size of the UDP packet | ||
| }; | ||
| union { | ||
| uint32_t ttl | ||
| Time To Live. | ||
| sdns_opt_ttl opt_ttl | ||
| will expand to sdns_opt_ttl if type=OPT | ||
| }; | ||
| uint16_t | rdlength | |
| RFC1035 - length of the RDATA field. | ||
| union { | ||
| char * rdata | ||
| resource record data (for all RRs except for OPT) | ||
| sdns_opt_rdata * opt_rdata | ||
| if type=OPT, this will refer to sdns_opt_rdata structure | ||
| void * psdns_rr | ||
| this is not DNS-RFC. It's just a reference for our library | ||
| }; | ||
| uint8_t | decoded | |
| this is not DNS-RFC. it's just a flag to know if the rdata is decoded or not | ||
| struct _sdns_rr * | next | |
| non-rfc field, just keep the reference to the next structure (linked-list) | ||
Each resource record of a DNS packet has the following format. This is the standard format of answer section, authority section and additional section of a DNS packet (RFC1035::Section4.3.1).
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | | / / / NAME / | | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | TYPE | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | CLASS | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | TTL | | | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | RDLENGTH | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| / RDATA / / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
NOTE: Three fields of this structure are not RFC standard and are only used here as helpers.