OpenDNSSEC-signer  1.4.1
Data Structures | Macros | Typedefs | Enumerations | Functions
edns.h File Reference
#include "config.h"
#include "shared/allocator.h"
#include "wire/buffer.h"
#include <ldns/ldns.h>
Include dependency graph for edns.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  edns_data_struct
 
struct  edns_rr_struct
 

Macros

#define OPT_LEN   9U /* length of the NSD EDNS response record minus 2 */
 
#define OPT_RDATA   2 /* holds the rdata length comes after OPT_LEN */
 
#define DNSSEC_OK_MASK   0x8000U /* do bit mask */
 
#define EDNS_MAX_MESSAGE_LEN   4096
 

Typedefs

typedef struct edns_data_struct edns_data_type
 
typedef enum edns_status_enum edns_status
 
typedef struct edns_rr_struct edns_rr_type
 

Enumerations

enum  edns_status_enum { EDNS_NOT_PRESENT, EDNS_OK, EDNS_ERROR }
 

Functions

void edns_init (edns_data_type *data, uint16_t max_length)
 
edns_rr_typeedns_rr_create (allocator_type *allocator)
 
void edns_rr_reset (edns_rr_type *err)
 
int edns_rr_parse (edns_rr_type *err, buffer_type *buffer)
 
size_t edns_rr_reserved_space (edns_rr_type *err)
 

Macro Definition Documentation

#define DNSSEC_OK_MASK   0x8000U /* do bit mask */

Definition at line 47 of file edns.h.

Referenced by edns_rr_parse().

#define EDNS_MAX_MESSAGE_LEN   4096

Definition at line 49 of file edns.h.

#define OPT_LEN   9U /* length of the NSD EDNS response record minus 2 */

EDNS.

Definition at line 45 of file edns.h.

Referenced by edns_rr_parse(), edns_rr_reserved_space(), and query_add_optional().

#define OPT_RDATA   2 /* holds the rdata length comes after OPT_LEN */

Definition at line 46 of file edns.h.

Referenced by edns_rr_parse(), edns_rr_reserved_space(), and query_add_optional().

Typedef Documentation

EDNS data.

Definition at line 55 of file edns.h.

typedef struct edns_rr_struct edns_rr_type

EDNS RR.

Definition at line 77 of file edns.h.

Definition at line 71 of file edns.h.

Enumeration Type Documentation

EDNS status.

Enumerator
EDNS_NOT_PRESENT 
EDNS_OK 
EDNS_ERROR 

Definition at line 66 of file edns.h.

Function Documentation

void edns_init ( edns_data_type data,
uint16_t  max_length 
)

Initialize EDNS.

Parameters
[in]dataEDNS data.
[in]max_lengthmaximum length.

Initialize EDNS.

Definition at line 75 of file edns.c.

References edns_data_struct::error, and edns_data_struct::ok.

edns_rr_type* edns_rr_create ( allocator_type allocator)

Create new EDNS RR.

Parameters
[in]allocatormemory allocator.
Returns
edns_rr_type* EDNS RR.

Create new EDNS RR.

Definition at line 52 of file edns.c.

References edns_rr_struct::allocator, allocator_alloc(), edns_rr_reset(), and ods_log_error().

Referenced by query_create().

int edns_rr_parse ( edns_rr_type err,
buffer_type buffer 
)

Parse EDNS OPT RR.

Parameters
[in]errEDNS record.
[in]bufferpacket buffer.
Returns
int 1 if EDNS and valid, 0 otherwise.

Parse EDNS OPT RR.

Definition at line 120 of file edns.c.

References buffer_available(), buffer_position(), buffer_read_u16(), buffer_read_u8(), buffer_set_position(), edns_rr_struct::dnssec_ok, DNSSEC_OK_MASK, EDNS_ERROR, EDNS_OK, edns_rr_struct::maxlen, ods_log_debug(), OPT_LEN, OPT_RDATA, edns_rr_struct::position, and edns_rr_struct::status.

size_t edns_rr_reserved_space ( edns_rr_type err)

The amount of space to reserve in the response for the EDNS data.

Parameters
[in]errEDNS record.
Returns
size_t amount of space to reserve.

The amount of space to reserve in the response for the EDNS data.

Definition at line 173 of file edns.c.

References EDNS_NOT_PRESENT, OPT_LEN, OPT_RDATA, and edns_rr_struct::status.

Referenced by query_prepare().

void edns_rr_reset ( edns_rr_type err)

Reset EDNS OPT RR.

Parameters
[in]errEDNS record.

Reset EDNS OPT RR.

Definition at line 102 of file edns.c.

References edns_rr_struct::dnssec_ok, EDNS_NOT_PRESENT, edns_rr_struct::maxlen, edns_rr_struct::position, and edns_rr_struct::status.

Referenced by edns_rr_create(), and query_reset().