- dtucker@cvs.openbsd.org 2009/12/06 23:41:15
[openssh-git.git] / openbsd-compat / getrrsetbyname.h
blob1283f55062e0cc5ebdb323cb68c4b02d125d2be5
1 /* OPENBSD BASED ON : include/netdb.h */
3 /* $OpenBSD: getrrsetbyname.c,v 1.4 2001/08/16 18:16:43 ho Exp $ */
5 /*
6 * Copyright (c) 2001 Jakob Schlyter. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
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.
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.
32 * Portions Copyright (c) 1999-2001 Internet Software Consortium.
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.
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.
48 #ifndef _GETRRSETBYNAME_H
49 #define _GETRRSETBYNAME_H
51 #include "includes.h"
53 #ifndef HAVE_GETRRSETBYNAME
55 #include <sys/types.h>
56 #include <netinet/in.h>
57 #include <arpa/nameser.h>
58 #include <netdb.h>
59 #include <resolv.h>
61 #ifndef HFIXEDSZ
62 #define HFIXEDSZ 12
63 #endif
65 #ifndef T_RRSIG
66 #define T_RRSIG 46
67 #endif
70 * Flags for getrrsetbyname()
72 #ifndef RRSET_VALIDATED
73 # define RRSET_VALIDATED 1
74 #endif
77 * Return codes for getrrsetbyname()
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
88 struct rdatainfo {
89 unsigned int rdi_length; /* length of data */
90 unsigned char *rdi_data; /* record data */
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 */
105 int getrrsetbyname(const char *, unsigned int, unsigned int, unsigned int, struct rrsetinfo **);
106 void freerrset(struct rrsetinfo *);
108 #endif /* !defined(HAVE_GETRRSETBYNAME) */
110 #endif /* _GETRRSETBYNAME_H */