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