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