]> CyberLeo.Net >> Repos - FreeBSD/releng/9.3.git/blob - contrib/bind9/lib/dns/include/dns/clientinfo.h
Fix BIND remote denial of service vulnerability. [SA-15:27]
[FreeBSD/releng/9.3.git] / contrib / bind9 / lib / dns / include / dns / clientinfo.h
1 /*
2  * Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14  * PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 /* $Id: clientinfo.h,v 1.3 2011/10/11 23:46:45 tbox Exp $ */
18
19 #ifndef DNS_CLIENTINFO_H
20 #define DNS_CLIENTINFO_H 1
21
22 /*****
23  ***** Module Info
24  *****/
25
26 /*! \file dns/clientinfo.h
27  * \brief
28  * The DNS clientinfo interface allows libdns to retrieve information
29  * about the client from the caller.
30  *
31  * The clientinfo interface is used by the DNS DB and DLZ interfaces;
32  * it allows databases to modify their answers on the basis of information
33  * about the client, such as source IP address.
34  *
35  * dns_clientinfo_t contains a pointer to an opaque structure containing
36  * client information in some form.  dns_clientinfomethods_t contains a
37  * list of methods which operate on that opaque structure to return
38  * potentially useful data.  Both structures also contain versioning
39  * information.
40  */
41
42 /*****
43  ***** Imports
44  *****/
45
46 #include <isc/sockaddr.h>
47 #include <isc/types.h>
48
49 ISC_LANG_BEGINDECLS
50
51 /*****
52  ***** Types
53  *****/
54
55 #define DNS_CLIENTINFO_VERSION 1
56 typedef struct dns_clientinfo {
57         isc_uint16_t version;
58         void *data;
59 } dns_clientinfo_t;
60
61 typedef isc_result_t (*dns_clientinfo_sourceip_t)(dns_clientinfo_t *client,
62                                                   isc_sockaddr_t **addrp);
63
64 #define DNS_CLIENTINFOMETHODS_VERSION 1
65 #define DNS_CLIENTINFOMETHODS_AGE 0
66
67 typedef struct dns_clientinfomethods {
68         isc_uint16_t version;
69         isc_uint16_t age;
70         dns_clientinfo_sourceip_t sourceip;
71 } dns_clientinfomethods_t;
72
73 /*****
74  ***** Methods
75  *****/
76 void
77 dns_clientinfomethods_init(dns_clientinfomethods_t *methods,
78                            dns_clientinfo_sourceip_t sourceip);
79
80 void
81 dns_clientinfo_init(dns_clientinfo_t *ci, void *data);
82
83 ISC_LANG_ENDDECLS
84
85 #endif /* DNS_CLIENTINFO_H */