PageRenderTime 28ms CodeModel.GetById 7ms app.highlight 17ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/bind9/lib/dns/include/dns/peer.h

https://bitbucket.org/freebsd/freebsd-head/
C++ Header | 219 lines | 119 code | 59 blank | 41 comment | 0 complexity | 7599e8584953647d0ac5bbf9b0159faa MD5 | raw file
  1/*
  2 * Copyright (C) 2004-2009  Internet Systems Consortium, Inc. ("ISC")
  3 * Copyright (C) 2000, 2001, 2003  Internet Software Consortium.
  4 *
  5 * Permission to use, copy, modify, and/or 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.
  8 *
  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.
 16 */
 17
 18/* $Id: peer.h,v 1.35 2009/01/17 23:47:43 tbox Exp $ */
 19
 20#ifndef DNS_PEER_H
 21#define DNS_PEER_H 1
 22
 23/*****
 24 ***** Module Info
 25 *****/
 26
 27/*! \file dns/peer.h
 28 * \brief
 29 * Data structures for peers (e.g. a 'server' config file statement)
 30 */
 31
 32/***
 33 *** Imports
 34 ***/
 35
 36#include <isc/lang.h>
 37#include <isc/magic.h>
 38#include <isc/netaddr.h>
 39
 40#include <dns/types.h>
 41
 42#define DNS_PEERLIST_MAGIC	ISC_MAGIC('s','e','R','L')
 43#define DNS_PEER_MAGIC		ISC_MAGIC('S','E','r','v')
 44
 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)
 47
 48/***
 49 *** Types
 50 ***/
 51
 52struct dns_peerlist {
 53	unsigned int		magic;
 54	isc_uint32_t		refs;
 55
 56	isc_mem_t	       *mem;
 57
 58	ISC_LIST(dns_peer_t) elements;
 59};
 60
 61struct dns_peer {
 62	unsigned int		magic;
 63	isc_uint32_t		refs;
 64
 65	isc_mem_t	       *mem;
 66
 67	isc_netaddr_t		address;
 68	unsigned int		prefixlen;
 69	isc_boolean_t		bogus;
 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;
 76	isc_boolean_t		request_nsid;
 77	dns_name_t	       *key;
 78	isc_sockaddr_t	       *transfer_source;
 79	isc_sockaddr_t	       *notify_source;
 80	isc_sockaddr_t	       *query_source;
 81	isc_uint16_t		udpsize;		/* receive size */
 82	isc_uint16_t		maxudp;			/* transmit size */
 83
 84	isc_uint32_t		bitflags;
 85
 86	ISC_LINK(dns_peer_t)	next;
 87};
 88
 89/***
 90 *** Functions
 91 ***/
 92
 93ISC_LANG_BEGINDECLS
 94
 95isc_result_t
 96dns_peerlist_new(isc_mem_t *mem, dns_peerlist_t **list);
 97
 98void
 99dns_peerlist_attach(dns_peerlist_t *source, dns_peerlist_t **target);
100
101void
102dns_peerlist_detach(dns_peerlist_t **list);
103
104/*
105 * After return caller still holds a reference to peer.
106 */
107void
108dns_peerlist_addpeer(dns_peerlist_t *peers, dns_peer_t *peer);
109
110/*
111 * Ditto. */
112isc_result_t
113dns_peerlist_peerbyaddr(dns_peerlist_t *peers, isc_netaddr_t *addr,
114			dns_peer_t **retval);
115
116/*
117 * What he said.
118 */
119isc_result_t
120dns_peerlist_currpeer(dns_peerlist_t *peers, dns_peer_t **retval);
121
122isc_result_t
123dns_peer_new(isc_mem_t *mem, isc_netaddr_t *ipaddr, dns_peer_t **peer);
124
125isc_result_t
126dns_peer_newprefix(isc_mem_t *mem, isc_netaddr_t *ipaddr,
127		   unsigned int prefixlen, dns_peer_t **peer);
128
129void
130dns_peer_attach(dns_peer_t *source, dns_peer_t **target);
131
132void
133dns_peer_detach(dns_peer_t **list);
134
135isc_result_t
136dns_peer_setbogus(dns_peer_t *peer, isc_boolean_t newval);
137
138isc_result_t
139dns_peer_getbogus(dns_peer_t *peer, isc_boolean_t *retval);
140
141isc_result_t
142dns_peer_setrequestixfr(dns_peer_t *peer, isc_boolean_t newval);
143
144isc_result_t
145dns_peer_getrequestixfr(dns_peer_t *peer, isc_boolean_t *retval);
146
147isc_result_t
148dns_peer_setprovideixfr(dns_peer_t *peer, isc_boolean_t newval);
149
150isc_result_t
151dns_peer_getprovideixfr(dns_peer_t *peer, isc_boolean_t *retval);
152
153isc_result_t
154dns_peer_setrequestnsid(dns_peer_t *peer, isc_boolean_t newval);
155
156isc_result_t
157dns_peer_getrequestnsid(dns_peer_t *peer, isc_boolean_t *retval);
158
159isc_result_t
160dns_peer_setsupportedns(dns_peer_t *peer, isc_boolean_t newval);
161
162isc_result_t
163dns_peer_getsupportedns(dns_peer_t *peer, isc_boolean_t *retval);
164
165isc_result_t
166dns_peer_settransfers(dns_peer_t *peer, isc_uint32_t newval);
167
168isc_result_t
169dns_peer_gettransfers(dns_peer_t *peer, isc_uint32_t *retval);
170
171isc_result_t
172dns_peer_settransferformat(dns_peer_t *peer, dns_transfer_format_t newval);
173
174isc_result_t
175dns_peer_gettransferformat(dns_peer_t *peer, dns_transfer_format_t *retval);
176
177isc_result_t
178dns_peer_setkeybycharp(dns_peer_t *peer, const char *keyval);
179
180isc_result_t
181dns_peer_getkey(dns_peer_t *peer, dns_name_t **retval);
182
183isc_result_t
184dns_peer_setkey(dns_peer_t *peer, dns_name_t **keyval);
185
186isc_result_t
187dns_peer_settransfersource(dns_peer_t *peer,
188			   const isc_sockaddr_t *transfer_source);
189
190isc_result_t
191dns_peer_gettransfersource(dns_peer_t *peer, isc_sockaddr_t *transfer_source);
192
193isc_result_t
194dns_peer_setudpsize(dns_peer_t *peer, isc_uint16_t udpsize);
195
196isc_result_t
197dns_peer_getudpsize(dns_peer_t *peer, isc_uint16_t *udpsize);
198
199isc_result_t
200dns_peer_setmaxudp(dns_peer_t *peer, isc_uint16_t maxudp);
201
202isc_result_t
203dns_peer_getmaxudp(dns_peer_t *peer, isc_uint16_t *maxudp);
204
205isc_result_t
206dns_peer_setnotifysource(dns_peer_t *peer, const isc_sockaddr_t *notify_source);
207
208isc_result_t
209dns_peer_getnotifysource(dns_peer_t *peer, isc_sockaddr_t *notify_source);
210
211isc_result_t
212dns_peer_setquerysource(dns_peer_t *peer, const isc_sockaddr_t *query_source);
213
214isc_result_t
215dns_peer_getquerysource(dns_peer_t *peer, isc_sockaddr_t *query_source);
216
217ISC_LANG_ENDDECLS
218
219#endif /* DNS_PEER_H */