2 * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: peer.h,v 1.20.18.8 2006/02/28 03:10:48 marka Exp $ */
29 * Data structures for peers (e.g. a 'server' config file statement)
37 #include <isc/magic.h>
38 #include <isc/netaddr.h>
40 #include <dns/types.h>
42 #define DNS_PEERLIST_MAGIC ISC_MAGIC('s','e','R','L')
43 #define DNS_PEER_MAGIC ISC_MAGIC('S','E','r','v')
45 #define DNS_PEERLIST_VALID(ptr) ISC_MAGIC_VALID(ptr, DNS_PEERLIST_MAGIC)
46 #define DNS_PEER_VALID(ptr) ISC_MAGIC_VALID(ptr, DNS_PEER_MAGIC)
58 ISC_LIST(dns_peer_t) elements;
67 isc_netaddr_t address;
68 unsigned int prefixlen;
70 dns_transfer_format_t transfer_format;
71 isc_uint32_t transfers;
72 isc_boolean_t support_ixfr;
73 isc_boolean_t provide_ixfr;
74 isc_boolean_t request_ixfr;
75 isc_boolean_t support_edns;
77 isc_sockaddr_t *transfer_source;
78 isc_sockaddr_t *notify_source;
79 isc_sockaddr_t *query_source;
80 isc_uint16_t udpsize; /* recieve size */
81 isc_uint16_t maxudp; /* transmit size */
83 isc_uint32_t bitflags;
85 ISC_LINK(dns_peer_t) next;
95 dns_peerlist_new(isc_mem_t *mem, dns_peerlist_t **list);
98 dns_peerlist_attach(dns_peerlist_t *source, dns_peerlist_t **target);
101 dns_peerlist_detach(dns_peerlist_t **list);
104 * After return caller still holds a reference to peer.
107 dns_peerlist_addpeer(dns_peerlist_t *peers, dns_peer_t *peer);
112 dns_peerlist_peerbyaddr(dns_peerlist_t *peers, isc_netaddr_t *addr,
113 dns_peer_t **retval);
119 dns_peerlist_currpeer(dns_peerlist_t *peers, dns_peer_t **retval);
122 dns_peer_new(isc_mem_t *mem, isc_netaddr_t *ipaddr, dns_peer_t **peer);
125 dns_peer_newprefix(isc_mem_t *mem, isc_netaddr_t *ipaddr,
126 unsigned int prefixlen, dns_peer_t **peer);
129 dns_peer_attach(dns_peer_t *source, dns_peer_t **target);
132 dns_peer_detach(dns_peer_t **list);
135 dns_peer_setbogus(dns_peer_t *peer, isc_boolean_t newval);
138 dns_peer_getbogus(dns_peer_t *peer, isc_boolean_t *retval);
141 dns_peer_setrequestixfr(dns_peer_t *peer, isc_boolean_t newval);
144 dns_peer_getrequestixfr(dns_peer_t *peer, isc_boolean_t *retval);
147 dns_peer_setprovideixfr(dns_peer_t *peer, isc_boolean_t newval);
150 dns_peer_getprovideixfr(dns_peer_t *peer, isc_boolean_t *retval);
153 dns_peer_setsupportedns(dns_peer_t *peer, isc_boolean_t newval);
156 dns_peer_getsupportedns(dns_peer_t *peer, isc_boolean_t *retval);
159 dns_peer_settransfers(dns_peer_t *peer, isc_uint32_t newval);
162 dns_peer_gettransfers(dns_peer_t *peer, isc_uint32_t *retval);
165 dns_peer_settransferformat(dns_peer_t *peer, dns_transfer_format_t newval);
168 dns_peer_gettransferformat(dns_peer_t *peer, dns_transfer_format_t *retval);
171 dns_peer_setkeybycharp(dns_peer_t *peer, const char *keyval);
174 dns_peer_getkey(dns_peer_t *peer, dns_name_t **retval);
177 dns_peer_setkey(dns_peer_t *peer, dns_name_t **keyval);
180 dns_peer_settransfersource(dns_peer_t *peer,
181 const isc_sockaddr_t *transfer_source);
184 dns_peer_gettransfersource(dns_peer_t *peer, isc_sockaddr_t *transfer_source);
187 dns_peer_setudpsize(dns_peer_t *peer, isc_uint16_t udpsize);
190 dns_peer_getudpsize(dns_peer_t *peer, isc_uint16_t *udpsize);
193 dns_peer_setmaxudp(dns_peer_t *peer, isc_uint16_t maxudp);
196 dns_peer_getmaxudp(dns_peer_t *peer, isc_uint16_t *maxudp);
199 dns_peer_setnotifysource(dns_peer_t *peer, const isc_sockaddr_t *notify_source);
202 dns_peer_getnotifysource(dns_peer_t *peer, isc_sockaddr_t *notify_source);
205 dns_peer_setquerysource(dns_peer_t *peer, const isc_sockaddr_t *query_source);
208 dns_peer_getquerysource(dns_peer_t *peer, isc_sockaddr_t *query_source);
212 #endif /* DNS_PEER_H */