ldns  1.7.0
host2str.c
Go to the documentation of this file.
1 /*
2  * host2str.c
3  *
4  * conversion routines from the host format
5  * to the presentation format (strings)
6  *
7  * a Net::DNS like library for C
8  *
9  * (c) NLnet Labs, 2004-2006
10  *
11  * See the file LICENSE for the license
12  */
13 #include <ldns/config.h>
14 
15 #include <ldns/ldns.h>
16 
17 #include <limits.h>
18 
19 #ifdef HAVE_SYS_SOCKET_H
20 #include <sys/socket.h>
21 #endif
22 #ifdef HAVE_ARPA_INET_H
23 #include <arpa/inet.h>
24 #endif
25 #ifdef HAVE_NETDB_H
26 #include <netdb.h>
27 #endif
28 #include <time.h>
29 #include <sys/time.h>
30 
31 #ifndef INET_ADDRSTRLEN
32 #define INET_ADDRSTRLEN 16
33 #endif
34 #ifndef INET6_ADDRSTRLEN
35 #define INET6_ADDRSTRLEN 46
36 #endif
37 
38 /* lookup tables for standard DNS stuff */
39 
40 /* Taken from RFC 2535, section 7. */
42  { LDNS_RSAMD5, "RSAMD5" },
43  { LDNS_DH, "DH" },
44  { LDNS_DSA, "DSA" },
45  { LDNS_ECC, "ECC" },
46  { LDNS_RSASHA1, "RSASHA1" },
47  { LDNS_DSA_NSEC3, "DSA-NSEC3-SHA1" },
48  { LDNS_RSASHA1_NSEC3, "RSASHA1-NSEC3-SHA1" },
49 #ifdef USE_SHA2
50  { LDNS_RSASHA256, "RSASHA256"},
51  { LDNS_RSASHA512, "RSASHA512"},
52 #endif
53 #ifdef USE_GOST
54  { LDNS_ECC_GOST, "ECC-GOST"},
55 #endif
56 #ifdef USE_ECDSA
57  { LDNS_ECDSAP256SHA256, "ECDSAP256SHA256"},
58  { LDNS_ECDSAP384SHA384, "ECDSAP384SHA384"},
59 #endif
60 #ifdef USE_ED25519
61  { LDNS_ED25519, "ED25519"},
62 #endif
63 #ifdef USE_ED448
64  { LDNS_ED448, "ED448"},
65 #endif
66  { LDNS_INDIRECT, "INDIRECT" },
67  { LDNS_PRIVATEDNS, "PRIVATEDNS" },
68  { LDNS_PRIVATEOID, "PRIVATEOID" },
69  { 0, NULL }
70 };
71 
72 /* Taken from RFC 4398 */
74  { LDNS_CERT_PKIX, "PKIX" },
75  { LDNS_CERT_SPKI, "SPKI" },
76  { LDNS_CERT_PGP, "PGP" },
77  { LDNS_CERT_IPKIX, "IPKIX" },
78  { LDNS_CERT_ISPKI, "ISPKI" },
79  { LDNS_CERT_IPGP, "IPGP" },
80  { LDNS_CERT_ACPKIX, "ACPKIX" },