struct edns_record
{
edns_status_type status;
size_t position;
size_t maxlen;
size_t opt_reserved_space;
int dnssec_ok;
int nsid;
cookie_status_type cookie_status;
size_t cookie_len;
uint8_t cookie[40];
int ede; /* RFC 8914 - Extended DNS Errors */
char* ede_text; /* RFC 8914 - Extended DNS Errors text*/
uint16_t ede_text_len;
};
typedef struct edns_record edns_record_type;
/* The Extended DNS Error codes (RFC8914) we use */
#define EDE_OTHER 0
#define EDE_NOT_READY 14
#define EDE_PROHIBITED 18
#define EDE_NOT_AUTHORITATIVE 20
#define EDE_NOT_SUPPORTED 21
#define EDE_INVALID_DATA 24
/* ASSIGN_EDE_CODE_AND_STRING_LITERAL may only be used with string literals.
* This is guaranteed by concatenating and empty string to LITERAL, which
* will make compilation fail if this macro is used with variables.
*/
#define ASSIGN_EDE_CODE_AND_STRING_LITERAL(EDE, CODE, LITERAL) \
do { \
EDE = (CODE); \
EDE ## _text = (LITERAL ""); \
EDE ## _text_len = sizeof(LITERAL) - 1; \
} while (0)
void edns_init_data(edns_data_type *data, uint16_t max_length);
void edns_init_record(edns_record_type *data);
int edns_parse_record(edns_record_type *data, buffer_type *packet,
struct query* q, struct nsd* nsd);
/*
* The amount of space to reserve in the response for the EDNS data
* (if required).
*/
size_t edns_reserved_space(edns_record_type *data);