xref: /dragonfly/contrib/ldns/ldns/ldns.h (revision ec1c3f3a)
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 separately 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 git.
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/dane.h>
99 #include <ldns/dname.h>
100 #include <ldns/dnssec.h>
101 #include <ldns/dnssec_verify.h>
102 #include <ldns/dnssec_sign.h>
103 #include <ldns/duration.h>
104 #include <ldns/edns.h>
105 #include <ldns/error.h>
106 #include <ldns/higher.h>
107 #include <ldns/host2str.h>
108 #include <ldns/host2wire.h>
109 #include <ldns/net.h>
110 #include <ldns/packet.h>
111 #include <ldns/rdata.h>
112 #include <ldns/resolver.h>
113 #include <ldns/rr.h>
114 #include <ldns/str2host.h>
115 #include <ldns/tsig.h>
116 #include <ldns/update.h>
117 #include <ldns/wire2host.h>
118 #include <ldns/rr_functions.h>
119 #include <ldns/keys.h>
120 #include <ldns/parse.h>
121 #include <ldns/zone.h>
122 #include <ldns/dnssec_zone.h>
123 #include <ldns/radix.h>
124 #include <ldns/rbtree.h>
125 #include <ldns/sha1.h>
126 #include <ldns/sha2.h>
127 
128 #ifdef __cplusplus
129 extern "C" {
130 #endif
131 
132 #define LDNS_IP4ADDRLEN      (32/8)
133 #define LDNS_IP6ADDRLEN      (128/8)
134 #define LDNS_PORT	53
135 #define LDNS_ROOT_LABEL_STR     "."
136 #define LDNS_DEFAULT_TTL	3600
137 
138 /* lookup tables for standard DNS stuff  */
139 
140 /** Taken from RFC 2538, section 2.1.  */
141 extern ldns_lookup_table ldns_certificate_types[];
142 /** Taken from RFC 2535, section 7.  */
143 extern ldns_lookup_table ldns_algorithms[];
144 /** Taken from RFC 2538.  */
145 extern ldns_lookup_table ldns_cert_algorithms[];
146 /** rr types  */
147 extern ldns_lookup_table ldns_rr_classes[];
148 /** Response codes */
149 extern ldns_lookup_table ldns_rcodes[];
150 /** Operation codes */
151 extern ldns_lookup_table ldns_opcodes[];
152 /** EDNS flags */
153 extern ldns_lookup_table ldns_edns_flags[];
154 
155 #ifdef __cplusplus
156 }
157 #endif
158 
159 #endif /* LDNS_DNS_H */
160