"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.16.7/lib/dns/include/dns/peer.h" (4 Sep 2020, 6475 Bytes) of package /linux/misc/dns/bind9/9.16.7/bind-9.16.7.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "peer.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
    3  *
    4  * This Source Code Form is subject to the terms of the Mozilla Public
    5  * License, v. 2.0. If a copy of the MPL was not distributed with this
    6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    7  *
    8  * See the COPYRIGHT file distributed with this work for additional
    9  * information regarding copyright ownership.
   10  */
   11 
   12 #ifndef DNS_PEER_H
   13 #define DNS_PEER_H 1
   14 
   15 /*****
   16 ***** Module Info
   17 *****/
   18 
   19 /*! \file dns/peer.h
   20  * \brief
   21  * Data structures for peers (e.g. a 'server' config file statement)
   22  */
   23 
   24 /***
   25  *** Imports
   26  ***/
   27 
   28 #include <inttypes.h>
   29 #include <stdbool.h>
   30 
   31 #include <isc/lang.h>
   32 #include <isc/magic.h>
   33 #include <isc/netaddr.h>
   34 #include <isc/refcount.h>
   35 
   36 #include <dns/types.h>
   37 
   38 #define DNS_PEERLIST_MAGIC ISC_MAGIC('s', 'e', 'R', 'L')
   39 #define DNS_PEER_MAGIC     ISC_MAGIC('S', 'E', 'r', 'v')
   40 
   41 #define DNS_PEERLIST_VALID(ptr) ISC_MAGIC_VALID(ptr, DNS_PEERLIST_MAGIC)
   42 #define DNS_PEER_VALID(ptr) ISC_MAGIC_VALID(ptr, DNS_PEER_MAGIC)
   43 
   44 /***
   45  *** Types
   46  ***/
   47 
   48 struct dns_peerlist {
   49     unsigned int   magic;
   50     isc_refcount_t refs;
   51 
   52     isc_mem_t *mem;
   53 
   54     ISC_LIST(dns_peer_t) elements;
   55 };
   56 
   57 struct dns_peer {
   58     unsigned int   magic;
   59     isc_refcount_t refs;
   60 
   61     isc_mem_t *mem;
   62 
   63     isc_netaddr_t         address;
   64     unsigned int          prefixlen;
   65     bool              bogus;
   66     dns_transfer_format_t transfer_format;
   67     uint32_t          transfers;
   68     bool              support_ixfr;
   69     bool              provide_ixfr;
   70     bool              request_ixfr;
   71     bool              support_edns;
   72     bool              request_nsid;
   73     bool              send_cookie;
   74     bool              request_expire;
   75     bool              force_tcp;
   76     bool              tcp_keepalive;
   77     dns_name_t *          key;
   78     isc_sockaddr_t *      transfer_source;
   79     isc_dscp_t        transfer_dscp;
   80     isc_sockaddr_t *      notify_source;
   81     isc_dscp_t        notify_dscp;
   82     isc_sockaddr_t *      query_source;
   83     isc_dscp_t        query_dscp;
   84     uint16_t          udpsize;     /* receive size */
   85     uint16_t          maxudp;      /* transmit size */
   86     uint16_t          padding;     /* pad block size */
   87     uint8_t           ednsversion; /* edns version */
   88 
   89     uint32_t bitflags;
   90 
   91     ISC_LINK(dns_peer_t) next;
   92 };
   93 
   94 /***
   95  *** Functions
   96  ***/
   97 
   98 ISC_LANG_BEGINDECLS
   99 
  100 isc_result_t
  101 dns_peerlist_new(isc_mem_t *mem, dns_peerlist_t **list);
  102 
  103 void
  104 dns_peerlist_attach(dns_peerlist_t *source, dns_peerlist_t **target);
  105 
  106 void
  107 dns_peerlist_detach(dns_peerlist_t **list);
  108 
  109 /*
  110  * After return caller still holds a reference to peer.
  111  */
  112 void
  113 dns_peerlist_addpeer(dns_peerlist_t *peers, dns_peer_t *peer);
  114 
  115 /*
  116  * Ditto. */
  117 isc_result_t
  118 dns_peerlist_peerbyaddr(dns_peerlist_t *peers, const isc_netaddr_t *addr,
  119             dns_peer_t **retval);
  120 
  121 /*
  122  * What he said.
  123  */
  124 isc_result_t
  125 dns_peerlist_currpeer(dns_peerlist_t *peers, dns_peer_t **retval);
  126 
  127 isc_result_t
  128 dns_peer_new(isc_mem_t *mem, const isc_netaddr_t *ipaddr, dns_peer_t **peer);
  129 
  130 isc_result_t
  131 dns_peer_newprefix(isc_mem_t *mem, const isc_netaddr_t *ipaddr,
  132            unsigned int prefixlen, dns_peer_t **peer);
  133 
  134 void
  135 dns_peer_attach(dns_peer_t *source, dns_peer_t **target);
  136 
  137 void
  138 dns_peer_detach(dns_peer_t **list);
  139 
  140 isc_result_t
  141 dns_peer_setbogus(dns_peer_t *peer, bool newval);
  142 
  143 isc_result_t
  144 dns_peer_getbogus(dns_peer_t *peer, bool *retval);
  145 
  146 isc_result_t
  147 dns_peer_setrequestixfr(dns_peer_t *peer, bool newval);
  148 
  149 isc_result_t
  150 dns_peer_getrequestixfr(dns_peer_t *peer, bool *retval);
  151 
  152 isc_result_t
  153 dns_peer_setprovideixfr(dns_peer_t *peer, bool newval);
  154 
  155 isc_result_t
  156 dns_peer_getprovideixfr(dns_peer_t *peer, bool *retval);
  157 
  158 isc_result_t
  159 dns_peer_setrequestnsid(dns_peer_t *peer, bool newval);
  160 
  161 isc_result_t
  162 dns_peer_getrequestnsid(dns_peer_t *peer, bool *retval);
  163 
  164 isc_result_t
  165 dns_peer_setsendcookie(dns_peer_t *peer, bool newval);
  166 
  167 isc_result_t
  168 dns_peer_getsendcookie(dns_peer_t *peer, bool *retval);
  169 
  170 isc_result_t
  171 dns_peer_setrequestexpire(dns_peer_t *peer, bool newval);
  172 
  173 isc_result_t
  174 dns_peer_getrequestexpire(dns_peer_t *peer, bool *retval);
  175 
  176 isc_result_t
  177 dns_peer_setsupportedns(dns_peer_t *peer, bool newval);
  178 
  179 isc_result_t
  180 dns_peer_getforcetcp(dns_peer_t *peer, bool *retval);
  181 
  182 isc_result_t
  183 dns_peer_setforcetcp(dns_peer_t *peer, bool newval);
  184 
  185 isc_result_t
  186 dns_peer_gettcpkeepalive(dns_peer_t *peer, bool *retval);
  187 
  188 isc_result_t
  189 dns_peer_settcpkeepalive(dns_peer_t *peer, bool newval);
  190 
  191 isc_result_t
  192 dns_peer_getsupportedns(dns_peer_t *peer, bool *retval);
  193 
  194 isc_result_t
  195 dns_peer_settransfers(dns_peer_t *peer, uint32_t newval);
  196 
  197 isc_result_t
  198 dns_peer_gettransfers(dns_peer_t *peer, uint32_t *retval);
  199 
  200 isc_result_t
  201 dns_peer_settransferformat(dns_peer_t *peer, dns_transfer_format_t newval);
  202 
  203 isc_result_t
  204 dns_peer_gettransferformat(dns_peer_t *peer, dns_transfer_format_t *retval);
  205 
  206 isc_result_t
  207 dns_peer_setkeybycharp(dns_peer_t *peer, const char *keyval);
  208 
  209 isc_result_t
  210 dns_peer_getkey(dns_peer_t *peer, dns_name_t **retval);
  211 
  212 isc_result_t
  213 dns_peer_setkey(dns_peer_t *peer, dns_name_t **keyval);
  214 
  215 isc_result_t
  216 dns_peer_settransfersource(dns_peer_t *      peer,
  217                const isc_sockaddr_t *transfer_source);
  218 
  219 isc_result_t
  220 dns_peer_gettransfersource(dns_peer_t *peer, isc_sockaddr_t *transfer_source);
  221 
  222 isc_result_t
  223 dns_peer_setudpsize(dns_peer_t *peer, uint16_t udpsize);
  224 
  225 isc_result_t
  226 dns_peer_getudpsize(dns_peer_t *peer, uint16_t *udpsize);
  227 
  228 isc_result_t
  229 dns_peer_setmaxudp(dns_peer_t *peer, uint16_t maxudp);
  230 
  231 isc_result_t
  232 dns_peer_getmaxudp(dns_peer_t *peer, uint16_t *maxudp);
  233 
  234 isc_result_t
  235 dns_peer_setpadding(dns_peer_t *peer, uint16_t padding);
  236 
  237 isc_result_t
  238 dns_peer_getpadding(dns_peer_t *peer, uint16_t *padding);
  239 
  240 isc_result_t
  241 dns_peer_setnotifysource(dns_peer_t *peer, const isc_sockaddr_t *notify_source);
  242 
  243 isc_result_t
  244 dns_peer_getnotifysource(dns_peer_t *peer, isc_sockaddr_t *notify_source);
  245 
  246 isc_result_t
  247 dns_peer_setquerysource(dns_peer_t *peer, const isc_sockaddr_t *query_source);
  248 
  249 isc_result_t
  250 dns_peer_getquerysource(dns_peer_t *peer, isc_sockaddr_t *query_source);
  251 
  252 isc_result_t
  253 dns_peer_setnotifydscp(dns_peer_t *peer, isc_dscp_t dscp);
  254 
  255 isc_result_t
  256 dns_peer_getnotifydscp(dns_peer_t *peer, isc_dscp_t *dscpp);
  257 
  258 isc_result_t
  259 dns_peer_settransferdscp(dns_peer_t *peer, isc_dscp_t dscp);
  260 
  261 isc_result_t
  262 dns_peer_gettransferdscp(dns_peer_t *peer, isc_dscp_t *dscpp);
  263 
  264 isc_result_t
  265 dns_peer_setquerydscp(dns_peer_t *peer, isc_dscp_t dscp);
  266 
  267 isc_result_t
  268 dns_peer_getquerydscp(dns_peer_t *peer, isc_dscp_t *dscpp);
  269 
  270 isc_result_t
  271 dns_peer_setednsversion(dns_peer_t *peer, uint8_t ednsversion);
  272 
  273 isc_result_t
  274 dns_peer_getednsversion(dns_peer_t *peer, uint8_t *ednsversion);
  275 ISC_LANG_ENDDECLS
  276 
  277 #endif /* DNS_PEER_H */