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