Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_dns.h File Reference

Minimal DNS message helpers: parse a query question and build an A-record response. More...

#include <stddef.h>
#include <stdint.h>
+ Include dependency graph for n_dns.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define N_DNS_QNAME_MAX   256
 Maximum decoded QNAME length, including the terminating NUL.
 
#define N_DNS_TYPE_A   1
 DNS resource-record type A (IPv4 address).
 

Functions

int n_dns_build_a_response (const unsigned char *query, size_t qlen, uint32_t ipv4_be, uint32_t ttl, unsigned char *out, size_t outsz)
 Build a DNS response answering a query's first question with one A record.
 
int n_dns_parse_query (const unsigned char *msg, size_t len, uint16_t *id_out, char *qname_out, size_t qname_sz, uint16_t *qtype_out)
 Parse the header id and the first question (QNAME + QTYPE) of a DNS message.
 

Detailed Description

Minimal DNS message helpers: parse a query question and build an A-record response.

Author
Castagnier Mickael
Version
1.0

Definition in file n_dns.h.