1val_getaddrinfo(3) Programmer's Manual val_getaddrinfo(3)
2
3
4
6 val_getaddrinfo() - get DNSSEC-validated network address and service
7 translation
8
10 #include <validator/validator.h>
11
12 int val_getaddrinfo(const struct val_context *ctx,
13 const char *nodename,
14 const char *servname,
15 const struct addrinfo *hints,
16 struct addrinfo **res,
17 val_status_t * val_status);
18
19 int val_getnameinfo(val_context_t * ctx,
20 const struct sockaddr *sa,
21 socklen_t salen,
22 char *host,
23 size_t hostlen,
24 char *serv,
25 size_t servlen,
26 int flags,
27 val_status_t * val_status);
28
30 val_getaddrinfo() and val_getnameinfo perform DNSSEC validation of DNS
31 queries. They are intended to be DNSSEC-aware replacements for
32 getaddrinfo(3) and getnameinfo(3).
33
34 val_getaddrinfo() returns a network address value of type struct
35 addrinfo in the res parameter. val_getnameinfo is used to convert a
36 sockaddr structure to a pair of host name and service strings.
37
38 val_status gives the combined validation status value for all answers
39 returned by the each of the functions. val_istrusted() and
40 val_isvalidated() can be used to determine the trustworthiness of data
41 and p_val_status() can be used to display the status value to the user
42 in ASCII format (See libval(3) more for information).
43
44 The ctx parameter specifies the validation context, which can be set to
45 NULL for default values (see libval(3) and dnsval.conf for more details
46 on validation contexts and validation policy).
47
48 The nodename, servname, and hints parameters have similar syntax and
49 semantics as the corresponding parameters for the original
50 getaddrinfo() function. The res parameter is similar to the res
51 parameter for getaddrinfo(). Please see the manual page for
52 getaddrinfo(3) for more details about these parameters.
53
55 The val_getaddrinfo() function returns 0 on success and a non-zero
56 error code on failure. *res will point to a dynamically allocated
57 linked list of addrinfo structures on success and will be NULL if no
58 answer was available.
59
60 The val_status parameter gives an indication for trustworthiness of
61 data. If *res is NULL, this value gives an indication of whether the
62 non-existence of data can be trusted or not.
63
65 #include <stdio.h>
66 #include <stdlib.h>
67 #include <validator.h>
68
69 int main(int argc, char *argv[])
70 {
71 struct addrinfo *ainfo = NULL;
72 int retval;
73
74 if (argc < 2) {
75 printf("Usage: %s <hostname>\n", argv[0]);
76 exit(1);
77 }
78
79 retval = val_getaddrinfo(NULL, argv[1], NULL, NULL, &ainfo);
80
81 if ((retval == 0) && (ainfo != NULL)) {
82
83 printf("Validation Status = %d [%s]\n",
84 ainfo->ai_val_status,
85 p_val_status(ainfo->ai_val_status));
86
87 val_freeaddrinfo(ainfo);
88 }
89
90 return 0;
91 }
92
94 Copyright 2004-2013 SPARTA, Inc. All rights reserved. See the COPYING
95 file included with the DNSSEC-Tools package for details.
96
98 Abhijit Hayatnagarkar, Michael Baer
99
101 getaddrinfo(3)
102
103 val_gethostbyname(3), val_res_query(3)
104
105 libval(3)
106
107 http://www.dnssec-tools.org
108
109
110
111perl v5.18.4 2015-04-27 val_getaddrinfo(3)