Initial vendor import of ldns-1.6.4 into contrib.
[dragonfly.git] / contrib / ldns / ldns / ldns.h
1 /*
2  * dns.h -- defines for the Domain Name System
3  *
4  * Copyright (c) 2005-2008, NLnet Labs. All rights reserved.
5  *
6  * See LICENSE for the license.
7  *
8  * This library was created by:
9  * Jelte Jansen, Erik Rozendaal and Miek Gieben
10  *
11  * A bunch of defines that are used in the DNS.
12  */
13
14
15 /**
16 \mainpage LDNS Documentation
17
18 \section introduction Introduction
19
20 The goal of ldns is to simplify DNS programming, it supports recent RFCs
21 like the DNSSEC documents, and allow developers to easily create software
22 conforming to current RFCs, and experimental software for current Internet
23 drafts. A secondary benefit of using ldns is speed, because ldns is written
24 in C, and although it is not optimized for performance, it should be a lot
25 faster than Perl.
26
27 The first main tool to use ldns is Drill, from which part of the library was
28 derived. From version 1.0.0 on, drill is included in the ldns release
29 and will not be distributed seperately anymore. The library also includes some
30 other examples and tools to show how it can be used. These can be found in the
31 examples/ directory in the tarball.
32
33 ldns depends on OpenSSL for it's cryptographic functions.
34 Feature list
35
36   - Transparent IPv4 and IPv6 support (overridable if necessary),
37   - TSIG support,
38   - DNSSEC support; signing and verification,
39   - small size,
40   - online documentation as well as manual pages. 
41
42 If you want to send us patches please use the code from subversion (trunk). 
43
44 \section using_ldns Using ldns
45
46 Almost all interaction between an application and ldns goes through the ldns
47 data structures (\ref ldns_rr, \ref ldns_pkt, etc.). These are input or
48 output to the functions of ldns. For example, \ref ldns_zone_new_frm_fp
49 reads a zone from a \c FILE pointer, and returns an \ref ldns_zone
50 structure.
51
52
53 Let's use Drill as an example. Drill is a tool much like dig, whose most
54 basic function is to send 1 query to a nameserver and print the response.
55
56 To be able to do this, drill uses the resolver module of ldns, which acts as
57 a stub resolver. The resolver module uses the net module to actually send
58 the query that drill requested. It then uses the wire2host module to
59 translate the response and place it in ldns' internal structures. These are
60 passed back to drill, which then uses the host2str module to print the
61 response in presentation format.
62
63 \section gettingstarted Getting Started
64
65 See the \ref design page for a very high level description of the design
66 choices made for ldns. 
67
68 For an overview of the functions and types ldns provides, you can check out
69 the \ref ldns ldns header file descriptions.
70
71 If you want to see some libdns action, you can read our tutorials:
72   - \ref tutorial1_mx
73   - \ref tutorial2_zone
74   - \ref tutorial3_signzone
75
76 Or you can just use the menu above to browse through the API docs.
77
78 <div style="visibility:hidden;">
79 \image html LogoInGradientBar2-y100.png
80 </div>
81 */
82
83 /**
84  * \file ldns.h
85  *
86  * Including this file will include all ldns files, and define some lookup tables.
87  */
88
89 #ifndef LDNS_DNS_H
90 #define LDNS_DNS_H
91
92 #include <stdio.h>
93 #include <stdlib.h>
94
95 #include <ldns/util.h>
96 #include <ldns/buffer.h>
97 #include <ldns/common.h>
98 #include <ldns/dname.h>
99 #include <ldns/dnssec.h>
100 #include <ldns/dnssec_verify.h>
101 #include <ldns/dnssec_sign.h>
102 #include <ldns/error.h>
103 #include <ldns/higher.h>
104 #include <ldns/host2str.h>
105 #include <ldns/host2wire.h>
106 #include <ldns/net.h>
107 #include <ldns/packet.h>
108 #include <ldns/rdata.h>
109 #include <ldns/resolver.h>
110 #include <ldns/rr.h>
111 #include <ldns/str2host.h>
112 #include <ldns/tsig.h>
113 #include <ldns/update.h>
114 #include <ldns/wire2host.h>
115 #include <ldns/rr_functions.h>
116 #include <ldns/keys.h>
117 #include <ldns/parse.h>
118 #include <ldns/zone.h>
119 #include <ldns/dnssec_zone.h>
120 #include <ldns/rbtree.h>
121 #include <ldns/sha1.h>
122 #include <ldns/sha2.h>
123
124 #define LDNS_IP4ADDRLEN      (32/8)
125 #define LDNS_IP6ADDRLEN      (128/8)
126 #define LDNS_PORT       53
127 #define LDNS_ROOT_LABEL_STR     "."
128 #define LDNS_DEFAULT_TTL        3600
129
130 /* lookup tables for standard DNS stuff  */
131
132 /** Taken from RFC 2538, section 2.1.  */
133 extern ldns_lookup_table ldns_certificate_types[];
134 /** Taken from RFC 2535, section 7.  */
135 extern ldns_lookup_table ldns_algorithms[];
136 /** Taken from RFC 2538.  */
137 extern ldns_lookup_table ldns_cert_algorithms[];
138 /** rr types  */
139 extern ldns_lookup_table ldns_rr_classes[];
140 /** Response codes */
141 extern ldns_lookup_table ldns_rcodes[];
142 /** Operation codes */
143 extern ldns_lookup_table ldns_opcodes[];
144 /** EDNS flags */
145 extern ldns_lookup_table ldns_edns_flags[];
146
147 #endif /* LDNS_DNS_H */