OpenDNSSEC-signer  1.4.1
edns.h
Go to the documentation of this file.
1 /*
2  * $Id: edns.h 4958 2011-04-18 07:11:09Z matthijs $
3  *
4  * Copyright (c) 2011 NLNet Labs. All rights reserved.
5  *
6  * Taken from NSD3 and adjusted for OpenDNSSEC, NLnet Labs.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  *
29  */
30 
36 #ifndef WIRE_EDNS_H
37 #define WIRE_EDNS_H
38 
39 #include "config.h"
40 #include "shared/allocator.h"
41 #include "wire/buffer.h"
42 
43 #include <ldns/ldns.h>
44 
45 #define OPT_LEN 9U /* length of the NSD EDNS response record minus 2 */
46 #define OPT_RDATA 2 /* holds the rdata length comes after OPT_LEN */
47 #define DNSSEC_OK_MASK 0x8000U /* do bit mask */
48 
49 #define EDNS_MAX_MESSAGE_LEN 4096
50 
57  unsigned char ok[OPT_LEN];
58  unsigned char error[OPT_LEN];
59  unsigned char rdata_none[OPT_RDATA];
60 };
61 
70 };
72 
81  size_t position;
82  size_t maxlen;
83  int dnssec_ok;
84 };
85 
86 
93 void edns_init(edns_data_type* data, uint16_t max_length);
94 
102 
103 
109 void edns_rr_reset(edns_rr_type* err);
110 
118 int edns_rr_parse(edns_rr_type* err, buffer_type* buffer);
119 
127 
128 #endif /* WIRE_EDNS_H */