peer.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004-2009, 2013, 2014  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 2000, 2001, 2003  Internet Software Consortium.
00004  *
00005  * Permission to use, copy, modify, and/or distribute this software for any
00006  * purpose with or without fee is hereby granted, provided that the above
00007  * copyright notice and this permission notice appear in all copies.
00008  *
00009  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00010  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00011  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00012  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00013  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00014  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00015  * PERFORMANCE OF THIS SOFTWARE.
00016  */
00017 
00018 /* $Id: peer.h,v 1.35 2009/01/17 23:47:43 tbox Exp $ */
00019 
00020 #ifndef DNS_PEER_H
00021 #define DNS_PEER_H 1
00022 
00023 /*****
00024  ***** Module Info
00025  *****/
00026 
00027 /*! \file dns/peer.h
00028  * \brief
00029  * Data structures for peers (e.g. a 'server' config file statement)
00030  */
00031 
00032 /***
00033  *** Imports
00034  ***/
00035 
00036 #include <isc/lang.h>
00037 #include <isc/magic.h>
00038 #include <isc/netaddr.h>
00039 
00040 #include <dns/types.h>
00041 
00042 #define DNS_PEERLIST_MAGIC      ISC_MAGIC('s','e','R','L')
00043 #define DNS_PEER_MAGIC          ISC_MAGIC('S','E','r','v')
00044 
00045 #define DNS_PEERLIST_VALID(ptr) ISC_MAGIC_VALID(ptr, DNS_PEERLIST_MAGIC)
00046 #define DNS_PEER_VALID(ptr)     ISC_MAGIC_VALID(ptr, DNS_PEER_MAGIC)
00047 
00048 /***
00049  *** Types
00050  ***/
00051 
00052 struct dns_peerlist {
00053         unsigned int            magic;
00054         isc_uint32_t            refs;
00055 
00056         isc_mem_t              *mem;
00057 
00058         ISC_LIST(dns_peer_t) elements;
00059 };
00060 
00061 struct dns_peer {
00062         unsigned int            magic;
00063         isc_uint32_t            refs;
00064 
00065         isc_mem_t              *mem;
00066 
00067         isc_netaddr_t           address;
00068         unsigned int            prefixlen;
00069         isc_boolean_t           bogus;
00070         dns_transfer_format_t   transfer_format;
00071         isc_uint32_t            transfers;
00072         isc_boolean_t           support_ixfr;
00073         isc_boolean_t           provide_ixfr;
00074         isc_boolean_t           request_ixfr;
00075         isc_boolean_t           support_edns;
00076         isc_boolean_t           request_nsid;
00077         isc_boolean_t           request_sit;
00078         isc_boolean_t           request_expire;
00079         isc_boolean_t           force_tcp;
00080         dns_name_t             *key;
00081         isc_sockaddr_t         *transfer_source;
00082         isc_dscp_t              transfer_dscp;
00083         isc_sockaddr_t         *notify_source;
00084         isc_dscp_t              notify_dscp;
00085         isc_sockaddr_t         *query_source;
00086         isc_dscp_t              query_dscp;
00087         isc_uint16_t            udpsize;                /* receive size */
00088         isc_uint16_t            maxudp;                 /* transmit size */
00089         isc_uint8_t             ednsversion;            /* edns version */
00090 
00091         isc_uint32_t            bitflags;
00092 
00093         ISC_LINK(dns_peer_t)    next;
00094 };
00095 
00096 /***
00097  *** Functions
00098  ***/
00099 
00100 ISC_LANG_BEGINDECLS
00101 
00102 isc_result_t
00103 dns_peerlist_new(isc_mem_t *mem, dns_peerlist_t **list);
00104 
00105 void
00106 dns_peerlist_attach(dns_peerlist_t *source, dns_peerlist_t **target);
00107 
00108 void
00109 dns_peerlist_detach(dns_peerlist_t **list);
00110 
00111 /*
00112  * After return caller still holds a reference to peer.
00113  */
00114 void
00115 dns_peerlist_addpeer(dns_peerlist_t *peers, dns_peer_t *peer);
00116 
00117 /*
00118  * Ditto. */
00119 isc_result_t
00120 dns_peerlist_peerbyaddr(dns_peerlist_t *peers, isc_netaddr_t *addr,
00121                         dns_peer_t **retval);
00122 
00123 /*
00124  * What he said.
00125  */
00126 isc_result_t
00127 dns_peerlist_currpeer(dns_peerlist_t *peers, dns_peer_t **retval);
00128 
00129 isc_result_t
00130 dns_peer_new(isc_mem_t *mem, isc_netaddr_t *ipaddr, dns_peer_t **peer);
00131 
00132 isc_result_t
00133 dns_peer_newprefix(isc_mem_t *mem, isc_netaddr_t *ipaddr,
00134                    unsigned int prefixlen, dns_peer_t **peer);
00135 
00136 void
00137 dns_peer_attach(dns_peer_t *source, dns_peer_t **target);
00138 
00139 void
00140 dns_peer_detach(dns_peer_t **list);
00141 
00142 isc_result_t
00143 dns_peer_setbogus(dns_peer_t *peer, isc_boolean_t newval);
00144 
00145 isc_result_t
00146 dns_peer_getbogus(dns_peer_t *peer, isc_boolean_t *retval);
00147 
00148 isc_result_t
00149 dns_peer_setrequestixfr(dns_peer_t *peer, isc_boolean_t newval);
00150 
00151 isc_result_t
00152 dns_peer_getrequestixfr(dns_peer_t *peer, isc_boolean_t *retval);
00153 
00154 isc_result_t
00155 dns_peer_setprovideixfr(dns_peer_t *peer, isc_boolean_t newval);
00156 
00157 isc_result_t
00158 dns_peer_getprovideixfr(dns_peer_t *peer, isc_boolean_t *retval);
00159 
00160 isc_result_t
00161 dns_peer_setrequestnsid(dns_peer_t *peer, isc_boolean_t newval);
00162 
00163 isc_result_t
00164 dns_peer_getrequestnsid(dns_peer_t *peer, isc_boolean_t *retval);
00165 
00166 isc_result_t
00167 dns_peer_setrequestsit(dns_peer_t *peer, isc_boolean_t newval);
00168 
00169 isc_result_t
00170 dns_peer_getrequestsit(dns_peer_t *peer, isc_boolean_t *retval);
00171 
00172 isc_result_t
00173 dns_peer_setrequestexpire(dns_peer_t *peer, isc_boolean_t newval);
00174 
00175 isc_result_t
00176 dns_peer_getrequestexpire(dns_peer_t *peer, isc_boolean_t *retval);
00177 
00178 isc_result_t
00179 dns_peer_setsupportedns(dns_peer_t *peer, isc_boolean_t newval);
00180 
00181 isc_result_t
00182 dns_peer_getforcetcp(dns_peer_t *peer, isc_boolean_t *retval);
00183 
00184 isc_result_t
00185 dns_peer_setforcetcp(dns_peer_t *peer, isc_boolean_t newval);
00186 
00187 isc_result_t
00188 dns_peer_getsupportedns(dns_peer_t *peer, isc_boolean_t *retval);
00189 
00190 isc_result_t
00191 dns_peer_settransfers(dns_peer_t *peer, isc_uint32_t newval);
00192 
00193 isc_result_t
00194 dns_peer_gettransfers(dns_peer_t *peer, isc_uint32_t *retval);
00195 
00196 isc_result_t
00197 dns_peer_settransferformat(dns_peer_t *peer, dns_transfer_format_t newval);
00198 
00199 isc_result_t
00200 dns_peer_gettransferformat(dns_peer_t *peer, dns_transfer_format_t *retval);
00201 
00202 isc_result_t
00203 dns_peer_setkeybycharp(dns_peer_t *peer, const char *keyval);
00204 
00205 isc_result_t
00206 dns_peer_getkey(dns_peer_t *peer, dns_name_t **retval);
00207 
00208 isc_result_t
00209 dns_peer_setkey(dns_peer_t *peer, dns_name_t **keyval);
00210 
00211 isc_result_t
00212 dns_peer_settransfersource(dns_peer_t *peer,
00213                            const isc_sockaddr_t *transfer_source);
00214 
00215 isc_result_t
00216 dns_peer_gettransfersource(dns_peer_t *peer, isc_sockaddr_t *transfer_source);
00217 
00218 isc_result_t
00219 dns_peer_setudpsize(dns_peer_t *peer, isc_uint16_t udpsize);
00220 
00221 isc_result_t
00222 dns_peer_getudpsize(dns_peer_t *peer, isc_uint16_t *udpsize);
00223 
00224 isc_result_t
00225 dns_peer_setmaxudp(dns_peer_t *peer, isc_uint16_t maxudp);
00226 
00227 isc_result_t
00228 dns_peer_getmaxudp(dns_peer_t *peer, isc_uint16_t *maxudp);
00229 
00230 isc_result_t
00231 dns_peer_setnotifysource(dns_peer_t *peer, const isc_sockaddr_t *notify_source);
00232 
00233 isc_result_t
00234 dns_peer_getnotifysource(dns_peer_t *peer, isc_sockaddr_t *notify_source);
00235 
00236 isc_result_t
00237 dns_peer_setquerysource(dns_peer_t *peer, const isc_sockaddr_t *query_source);
00238 
00239 isc_result_t
00240 dns_peer_getquerysource(dns_peer_t *peer, isc_sockaddr_t *query_source);
00241 
00242 isc_result_t
00243 dns_peer_setnotifydscp(dns_peer_t *peer, isc_dscp_t dscp);
00244 
00245 isc_result_t
00246 dns_peer_getnotifydscp(dns_peer_t *peer, isc_dscp_t *dscpp);
00247 
00248 isc_result_t
00249 dns_peer_settransferdscp(dns_peer_t *peer, isc_dscp_t dscp);
00250 
00251 isc_result_t
00252 dns_peer_gettransferdscp(dns_peer_t *peer, isc_dscp_t *dscpp);
00253 
00254 isc_result_t
00255 dns_peer_setquerydscp(dns_peer_t *peer, isc_dscp_t dscp);
00256 
00257 isc_result_t
00258 dns_peer_getquerydscp(dns_peer_t *peer, isc_dscp_t *dscpp);
00259 
00260 isc_result_t
00261 dns_peer_setednsversion(dns_peer_t *peer, isc_uint8_t ednsversion);
00262 
00263 isc_result_t
00264 dns_peer_getednsversion(dns_peer_t *peer, isc_uint8_t *ednsversion);
00265 ISC_LANG_ENDDECLS
00266 
00267 #endif /* DNS_PEER_H */

Generated on Tue Apr 28 17:40:57 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha