Grid Community Toolkit  6.2.1653033972 (tag: v6.2.20220524)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
getrrsetbyname.h
1 /* OPENBSD BASED ON : include/netdb.h */
2 
3 /* $OpenBSD: getrrsetbyname.c,v 1.4 2001/08/16 18:16:43 ho Exp $ */
4 
5 /*
6  * Copyright (c) 2001 Jakob Schlyter. All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 /*
32  * Portions Copyright (c) 1999-2001 Internet Software Consortium.
33  *
34  * Permission to use, copy, modify, and distribute this software for any
35  * purpose with or without fee is hereby granted, provided that the above
36  * copyright notice and this permission notice appear in all copies.
37  *
38  * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
39  * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
40  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
41  * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
42  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
43  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
44  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
45  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
46  */
47 
48 #ifndef _GETRRSETBYNAME_H
49 #define _GETRRSETBYNAME_H
50 
51 #include "includes.h"
52 
53 #ifndef HAVE_GETRRSETBYNAME
54 
55 #include <sys/types.h>
56 #include <netinet/in.h>
57 #include <arpa/nameser.h>
58 #include <netdb.h>
59 #include <resolv.h>
60 
61 #ifndef HFIXEDSZ
62 #define HFIXEDSZ 12
63 #endif
64 
65 #ifndef T_RRSIG
66 #define T_RRSIG 46
67 #endif
68 
69 /*
70  * Flags for getrrsetbyname()
71  */
72 #ifndef RRSET_VALIDATED
73 # define RRSET_VALIDATED 1
74 #endif
75 
76 /*
77  * Return codes for getrrsetbyname()
78  */
79 #ifndef ERRSET_SUCCESS
80 # define ERRSET_SUCCESS 0
81 # define ERRSET_NOMEMORY 1
82 # define ERRSET_FAIL 2
83 # define ERRSET_INVAL 3
84 # define ERRSET_NONAME 4
85 # define ERRSET_NODATA 5
86 #endif
87 
88 struct rdatainfo {
89  unsigned int rdi_length; /* length of data */
90  unsigned char *rdi_data; /* record data */
91 };
92 
93 struct rrsetinfo {
94  unsigned int rri_flags; /* RRSET_VALIDATED ... */
95  unsigned int rri_rdclass; /* class number */
96  unsigned int rri_rdtype; /* RR type number */
97  unsigned int rri_ttl; /* time to live */
98  unsigned int rri_nrdatas; /* size of rdatas array */
99  unsigned int rri_nsigs; /* size of sigs array */
100  char *rri_name; /* canonical name */
101  struct rdatainfo *rri_rdatas; /* individual records */
102  struct rdatainfo *rri_sigs; /* individual signatures */
103 };
104 
105 int getrrsetbyname(const char *, unsigned int, unsigned int, unsigned int, struct rrsetinfo **);
106 void freerrset(struct rrsetinfo *);
107 
108 #endif /* !defined(HAVE_GETRRSETBYNAME) */
109 
110 #endif /* _GETRRSETBYNAME_H */