1VAL_GETADDRINFO(1)    User Contributed Perl Documentation   VAL_GETADDRINFO(1)
2
3
4

NAME

6       val_getaddrinfo(), val_freeaddrinfo() - get DNSSEC-validated network
7       address and service translation
8

SYNOPSIS

10         #include <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 val_addrinfo **res,
17                             val_status_t * val_status);
18
19         void val_freeaddrinfo(struct val_addrinfo *ainfo);
20
21         int val_getnameinfo(val_context_t * ctx,
22                             const struct sockaddr *sa,
23                             socklen_t salen,
24                             char *host,
25                             size_t hostlen,
26                             char *serv,
27                             size_t servlen,
28                             int flags,
29                             val_status_t * val_status);
30

DESCRIPTION

32       val_getaddrinfo() and val_getnameinfo perform DNSSEC validation of DNS
33       queries.  They are intended to be DNSSEC-aware replacements for getad‐
34       drinfo(3) and getnameinfo(3).
35
36       val_getaddrinfo()  returns a network address value of type struct
37       val_addrinfo in the res parameter.  val_getnameinfo is used to convert
38       a sockaddr structure to a pair of host name and service strings.
39
40           struct val_addrinfo
41           {
42                int ai_flags;
43                int ai_family;
44                int ai_socktype;
45                int ai_protocol;
46                size_t ai_addrlen;
47                struct sockaddr *ai_addr;
48                char * ai_canonname;
49                struct val_addrinfo *ai_next;
50                val_status_t  ai_val_status;
51           };
52
53       The val_addrinfo structure is similar to the addrinfo structure
54       (described in getaddrinfo(3)).  val_addrinfo has an additional field
55       ai_val_status that represents the validation status for that particular
56       record.  val_status gives the combined validation status value for all
57       answers returned by the each of the functions.  val_istrusted() and
58       val_isvalidated() can be used to determine the trustworthiness of data
59       and p_val_status() can be used to display the status value to the user
60       in ASCII format (See libval(3) more for information).
61
62       The ctx parameter specifies the validation context, which can be set to
63       NULL for default values (see libval(3) and dnsval.conf for more details
64       on validation contexts and validation policy).
65
66       The nodename, servname, and hints parameters have similar syntax and
67       semantics as the corresponding parameters for the original getad‐
68       drinfo() function.  The res parameter is similar to the res parameter
69       for getaddrinfo(), except that it is of type struct val_addrinfo
70       instead of struct addrinfo.  Please see the manual page for getad‐
71       drinfo(3) for more details about these parameters.
72
73       val_freeaddrinfo() frees the memory allocated for a val_addrinfo linked
74       list.
75

RETURN VALUES

77       The val_getaddrinfo() function returns 0 on success and a non-zero
78       error code on failure.  *res will point to a dynamically allocated
79       linked list of val_addrinfo structures on success and will be NULL if
80       no answer was available.
81
82       The val_status parameter gives an indication for trustworthiness of
83       data. If *res is NULL, this value gives an indication of whether the
84       non-existence of data can be trusted or not.
85

EXAMPLE

87        #include <stdio.h>
88        #include <stdlib.h>
89        #include <validator.h>
90
91        int main(int argc, char *argv[])
92        {
93                 struct val_addrinfo *ainfo = NULL;
94                 int retval;
95
96                 if (argc < 2) {
97                         printf("Usage: %s <hostname>\n", argv[0]);
98                         exit(1);
99                 }
100
101                 retval = val_getaddrinfo(NULL, argv[1], NULL, NULL, &ainfo);
102
103                 if ((retval == 0) && (ainfo != NULL)) {
104
105                         printf("Validation Status = %d [%s]\n",
106                                ainfo->ai_val_status,
107                                p_val_status(ainfo->ai_val_status));
108
109                         val_freeaddrinfo(ainfo);
110                 }
111
112                 return 0;
113        }
114
116       Copyright 2004-2007 SPARTA, Inc.  All rights reserved.  See the COPYING
117       file included with the DNSSEC-Tools package for details.
118

AUTHORS

120       Abhijit Hayatnagarkar, Michael Baer
121

SEE ALSO

123       getaddrinfo(3)
124
125       val_gethostbyname(3), val_query(3)
126
127       libval(3)
128
129       http://dnssec-tools.sourceforge.net
130
131
132
133perl v5.8.6                       2007-09-10                VAL_GETADDRINFO(1)
Impressum