OpenDNSSEC-signer  2.1.7
edns.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 NLNet Labs. All rights reserved.
3  *
4  * Taken from NSD3 and adjusted for OpenDNSSEC, NLnet Labs.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
34 #ifndef WIRE_EDNS_H
35 #define WIRE_EDNS_H
36 
37 #include "config.h"
38 #include "status.h"
39 #include "wire/buffer.h"
40 
41 #include <ldns/ldns.h>
42 
43 #define OPT_LEN 9U /* length of the NSD EDNS response record minus 2 */
44 #define OPT_RDATA 2 /* holds the rdata length comes after OPT_LEN */
45 #define DNSSEC_OK_MASK 0x8000U /* do bit mask */
46 
47 #define EDNS_MAX_MESSAGE_LEN 4096
48 
53 typedef struct edns_data_struct edns_data_type;
55  unsigned char ok[OPT_LEN];
56  unsigned char error[OPT_LEN];
57  unsigned char rdata_none[OPT_RDATA];
58 };
59 
68 };
69 typedef enum edns_status_enum edns_status;
70 
75 typedef struct edns_rr_struct edns_rr_type;
78  size_t position;
79  size_t maxlen;
80  int dnssec_ok;
81 };
82 
83 
90 extern void edns_init(edns_data_type* data, uint16_t max_length);
91 
98 extern edns_rr_type* edns_rr_create(void);
99 
100 
106 extern void edns_rr_reset(edns_rr_type* err);
107 
115 extern int edns_rr_parse(edns_rr_type* err, buffer_type* buffer);
116 
123 extern size_t edns_rr_reserved_space(edns_rr_type* err);
124 
125 extern void edns_rr_cleanup(edns_rr_type* err);
126 
127 
128 #endif /* WIRE_EDNS_H */
edns_init
void edns_init(edns_data_type *data, uint16_t max_length)
Definition: edns.c:64
edns_data_struct::ok
unsigned char ok[OPT_LEN]
Definition: edns.h:55
edns_rr_create
edns_rr_type * edns_rr_create(void)
Definition: edns.c:50
edns_rr_struct::dnssec_ok
int dnssec_ok
Definition: edns.h:80
edns_data_struct::rdata_none
unsigned char rdata_none[OPT_RDATA]
Definition: edns.h:57
OPT_RDATA
#define OPT_RDATA
Definition: edns.h:44
edns_data_struct
Definition: edns.h:54
edns_rr_reset
void edns_rr_reset(edns_rr_type *err)
Definition: edns.c:90
edns_status_enum
edns_status_enum
Definition: edns.h:64
edns_rr_struct::position
size_t position
Definition: edns.h:78
OPT_LEN
#define OPT_LEN
Definition: edns.h:43
buffer_struct
Definition: buffer.h:112
edns_data_struct::error
unsigned char error[OPT_LEN]
Definition: edns.h:56
buffer.h
edns_rr_struct
Definition: edns.h:76
edns_rr_struct::maxlen
size_t maxlen
Definition: edns.h:79
edns_rr_reserved_space
size_t edns_rr_reserved_space(edns_rr_type *err)
Definition: edns.c:162
EDNS_ERROR
@ EDNS_ERROR
Definition: edns.h:67
EDNS_NOT_PRESENT
@ EDNS_NOT_PRESENT
Definition: edns.h:65
EDNS_OK
@ EDNS_OK
Definition: edns.h:66
edns_rr_struct::status
edns_status status
Definition: edns.h:77
edns_status
enum edns_status_enum edns_status
Definition: edns.h:69
edns_rr_parse
int edns_rr_parse(edns_rr_type *err, buffer_type *buffer)
Definition: edns.c:107
edns_rr_cleanup
void edns_rr_cleanup(edns_rr_type *err)
Definition: edns.c:172