blob: 1283f55062e0cc5ebdb323cb68c4b02d125d2be5 [file] [log] [blame]
Damien Miller3db2e4d2003-11-24 13:33:34 +11001/* OPENBSD BASED ON : include/netdb.h */
2
Damien Millerd9ec3702003-05-15 12:27:08 +10003/* $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,
Damien Millerb10f1cd2003-05-15 20:55:27 +100023 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
Damien Millerd9ec3702003-05-15 12:27:08 +100024 * 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
Ben Lindstrom515d0f92003-08-29 16:59:52 +000051#include "includes.h"
Damien Millerd9ec3702003-05-15 12:27:08 +100052
Darren Tucker5f88d342003-10-15 16:57:57 +100053#ifndef HAVE_GETRRSETBYNAME
Damien Millerd9ec3702003-05-15 12:27:08 +100054
55#include <sys/types.h>
56#include <netinet/in.h>
57#include <arpa/nameser.h>
58#include <netdb.h>
59#include <resolv.h>
60
Tim Rice01326eb2004-01-26 21:40:35 -080061#ifndef HFIXEDSZ
62#define HFIXEDSZ 12
63#endif
64
Damien Miller2f715ee2007-10-26 16:26:46 +100065#ifndef T_RRSIG
66#define T_RRSIG 46
Tim Rice01326eb2004-01-26 21:40:35 -080067#endif
68
Damien Millerd9ec3702003-05-15 12:27:08 +100069/*
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
88struct rdatainfo {
89 unsigned int rdi_length; /* length of data */
90 unsigned char *rdi_data; /* record data */
91};
92
93struct 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
105int getrrsetbyname(const char *, unsigned int, unsigned int, unsigned int, struct rrsetinfo **);
106void freerrset(struct rrsetinfo *);
107
Darren Tuckerb8b4d0b2003-10-15 17:22:37 +1000108#endif /* !defined(HAVE_GETRRSETBYNAME) */
Damien Millerb10f1cd2003-05-15 20:55:27 +1000109
Damien Millerd9ec3702003-05-15 12:27:08 +1000110#endif /* _GETRRSETBYNAME_H */