peer.c revision 9c3531d72aeaad6c5f01efe6a1c82023e1379e4d
dda4bfe6499d09ea8123447579e56069d8176fcbBob Halley * Copyright (C) 2000 Internet Software Consortium.
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister * Permission to use, copy, modify, and distribute this software for any
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister * purpose with or without fee is hereby granted, provided that the above
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister * copyright notice and this permission notice appear in all copies.
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence/* $Id: peer.c,v 1.8 2000/06/22 21:54:35 tale Exp $ */
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister * Bit positions in the dns_peer_t structure flags field
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peerlist_new(isc_mem_t *mem, dns_peerlist_t **list) {
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peerlist_attach(dns_peerlist_t *source, dns_peerlist_t **target) {
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peerlist_addpeer(dns_peerlist_t *peers, dns_peer_t *peer) {
2cde028c51055c9fd4837337116cd4fdfe8ff623James Bristerdns_peerlist_peerbyaddr(dns_peerlist_t *servers,
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister if (isc_netaddr_equal(addr, &server->address)) {
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peerlist_currpeer(dns_peerlist_t *peers, dns_peer_t **retval) {
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peer_new(isc_mem_t *mem, isc_netaddr_t *addr, dns_peer_t **peerptr) {
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister memset(&peer->bitflags, 0x0, sizeof peer->bitflags);
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peer_attach(dns_peer_t *source, dns_peer_t **target) {
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister if (p->refs == 0) {
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peer_setbogus(dns_peer_t *peer, isc_boolean_t newval) {
b3e77535185043f089b346166440402d092030c3David Lawrence existed = DNS_BIT_CHECK(BOGUS_BIT, &peer->bitflags);
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS);
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peer_getbogus(dns_peer_t *peer, isc_boolean_t *retval) {
b3e77535185043f089b346166440402d092030c3David Lawrence if (DNS_BIT_CHECK(BOGUS_BIT, &peer->bitflags)) {
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peer_setprovideixfr(dns_peer_t *peer, isc_boolean_t newval) {
b3e77535185043f089b346166440402d092030c3David Lawrence existed = DNS_BIT_CHECK(PROVIDE_IXFR_BIT, &peer->bitflags);
b3e77535185043f089b346166440402d092030c3David Lawrence DNS_BIT_SET(PROVIDE_IXFR_BIT, &peer->bitflags);
5475a2d296215b7a93bd89804dc33c36a6de7cb5James Brister return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS);
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peer_getprovideixfr(dns_peer_t *peer, isc_boolean_t *retval) {
b3e77535185043f089b346166440402d092030c3David Lawrence if (DNS_BIT_CHECK(PROVIDE_IXFR_BIT, &peer->bitflags)) {
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peer_setrequestixfr(dns_peer_t *peer, isc_boolean_t newval) {
b3e77535185043f089b346166440402d092030c3David Lawrence existed = DNS_BIT_CHECK(REQUEST_IXFR_BIT, &peer->bitflags);
b3e77535185043f089b346166440402d092030c3David Lawrence DNS_BIT_SET(REQUEST_IXFR_BIT, &peer->bitflags);
5475a2d296215b7a93bd89804dc33c36a6de7cb5James Brister return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS);
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peer_getrequestixfr(dns_peer_t *peer, isc_boolean_t *retval) {
b3e77535185043f089b346166440402d092030c3David Lawrence if (DNS_BIT_CHECK(REQUEST_IXFR_BIT, &peer->bitflags)) {
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peer_settransfers(dns_peer_t *peer, isc_int32_t newval) {
b3e77535185043f089b346166440402d092030c3David Lawrence existed = DNS_BIT_CHECK(TRANSFERS_BIT, &peer->bitflags);
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS);
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peer_gettransfers(dns_peer_t *peer, isc_int32_t *retval) {
b3e77535185043f089b346166440402d092030c3David Lawrence if (DNS_BIT_CHECK(TRANSFERS_BIT, &peer->bitflags)) {
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peer_settransferformat(dns_peer_t *peer, dns_transfer_format_t newval) {
b3e77535185043f089b346166440402d092030c3David Lawrence existed = DNS_BIT_CHECK(SERVER_TRANSFER_FORMAT_BIT,
b3e77535185043f089b346166440402d092030c3David Lawrence DNS_BIT_SET(SERVER_TRANSFER_FORMAT_BIT, &peer->bitflags);
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS);
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peer_gettransferformat(dns_peer_t *peer, dns_transfer_format_t *retval) {
b3e77535185043f089b346166440402d092030c3David Lawrence if (DNS_BIT_CHECK(SERVER_TRANSFER_FORMAT_BIT, &peer->bitflags)) {
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peer_getkey(dns_peer_t *peer, dns_name_t **retval) {
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister return (peer->key == NULL ? ISC_R_NOTFOUND : ISC_R_SUCCESS);
b3e77535185043f089b346166440402d092030c3David Lawrencedns_peer_setkey(dns_peer_t *peer, dns_name_t **keyval) {
2cde028c51055c9fd4837337116cd4fdfe8ff623James Brister isc_mem_put(peer->mem, peer->key, sizeof(dns_name_t));