dns.h (256281) | dns.h (269257) |
---|---|
1/* 2 * services/cache/dns.h - Cache services for DNS using msg and rrset caches. 3 * 4 * Copyright (c) 2007, NLnet Labs. All rights reserved. 5 * 6 * This software is open source. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 7 unchanged lines hidden (view full) --- 16 * this list of conditions and the following disclaimer in the documentation 17 * and/or other materials provided with the distribution. 18 * 19 * Neither the name of the NLNET LABS nor the names of its contributors may 20 * be used to endorse or promote products derived from this software without 21 * specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 1/* 2 * services/cache/dns.h - Cache services for DNS using msg and rrset caches. 3 * 4 * Copyright (c) 2007, NLnet Labs. All rights reserved. 5 * 6 * This software is open source. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 7 unchanged lines hidden (view full) --- 16 * this list of conditions and the following disclaimer in the documentation 17 * and/or other materials provided with the distribution. 18 * 19 * Neither the name of the NLNET LABS nor the names of its contributors may 20 * be used to endorse or promote products derived from this software without 21 * specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 25 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 26 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE 27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 * POSSIBILITY OF SUCH DAMAGE. | 24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
34 */ 35 36/** 37 * \file 38 * 39 * This file contains the DNS cache. 40 */ 41 --- 35 unchanged lines hidden (view full) --- 77 * @param pside: if true, information came from a server which was fetched 78 * from the parentside of the zonecut. This means that the type NS 79 * can be updated to full TTL even in prefetch situations. 80 * @param region: region to allocate better entries from cache into. 81 * (used when is_referral is false). 82 * @return 0 on alloc error (out of memory). 83 */ 84int dns_cache_store(struct module_env* env, struct query_info* qinf, | 34 */ 35 36/** 37 * \file 38 * 39 * This file contains the DNS cache. 40 */ 41 --- 35 unchanged lines hidden (view full) --- 77 * @param pside: if true, information came from a server which was fetched 78 * from the parentside of the zonecut. This means that the type NS 79 * can be updated to full TTL even in prefetch situations. 80 * @param region: region to allocate better entries from cache into. 81 * (used when is_referral is false). 82 * @return 0 on alloc error (out of memory). 83 */ 84int dns_cache_store(struct module_env* env, struct query_info* qinf, |
85 struct reply_info* rep, int is_referral, uint32_t leeway, int pside, | 85 struct reply_info* rep, int is_referral, time_t leeway, int pside, |
86 struct regional* region); 87 88/** 89 * Store message in the cache. Stores in message cache and rrset cache. 90 * Both qinfo and rep should be malloced and are put in the cache. 91 * They should not be used after this call, as they are then in shared cache. 92 * Does not return errors, they are logged and only lead to less cache. 93 * --- 6 unchanged lines hidden (view full) --- 100 * that many seconds before actual TTL expiry. 101 * @param pside: if true, information came from a server which was fetched 102 * from the parentside of the zonecut. This means that the type NS 103 * can be updated to full TTL even in prefetch situations. 104 * @param qrep: message that can be altered with better rrs from cache. 105 * @param region: to allocate into for qmsg. 106 */ 107void dns_cache_store_msg(struct module_env* env, struct query_info* qinfo, | 86 struct regional* region); 87 88/** 89 * Store message in the cache. Stores in message cache and rrset cache. 90 * Both qinfo and rep should be malloced and are put in the cache. 91 * They should not be used after this call, as they are then in shared cache. 92 * Does not return errors, they are logged and only lead to less cache. 93 * --- 6 unchanged lines hidden (view full) --- 100 * that many seconds before actual TTL expiry. 101 * @param pside: if true, information came from a server which was fetched 102 * from the parentside of the zonecut. This means that the type NS 103 * can be updated to full TTL even in prefetch situations. 104 * @param qrep: message that can be altered with better rrs from cache. 105 * @param region: to allocate into for qmsg. 106 */ 107void dns_cache_store_msg(struct module_env* env, struct query_info* qinfo, |
108 hashvalue_t hash, struct reply_info* rep, uint32_t leeway, int pside, | 108 hashvalue_t hash, struct reply_info* rep, time_t leeway, int pside, |
109 struct reply_info* qrep, struct regional* region); 110 111/** 112 * Find a delegation from the cache. 113 * @param env: module environment with the DNS cache. 114 * @param qname: query name. 115 * @param qnamelen: length of qname. 116 * @param qtype: query type. 117 * @param qclass: query class. 118 * @param region: where to allocate result delegation. 119 * @param msg: if not NULL, delegation message is returned here, synthesized 120 * from the cache. 121 * @param timenow: the time now, for checking if TTL on cache entries is OK. 122 * @return new delegation or NULL on error or if not found in cache. 123 */ 124struct delegpt* dns_cache_find_delegation(struct module_env* env, 125 uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, | 109 struct reply_info* qrep, struct regional* region); 110 111/** 112 * Find a delegation from the cache. 113 * @param env: module environment with the DNS cache. 114 * @param qname: query name. 115 * @param qnamelen: length of qname. 116 * @param qtype: query type. 117 * @param qclass: query class. 118 * @param region: where to allocate result delegation. 119 * @param msg: if not NULL, delegation message is returned here, synthesized 120 * from the cache. 121 * @param timenow: the time now, for checking if TTL on cache entries is OK. 122 * @return new delegation or NULL on error or if not found in cache. 123 */ 124struct delegpt* dns_cache_find_delegation(struct module_env* env, 125 uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, |
126 struct regional* region, struct dns_msg** msg, uint32_t timenow); | 126 struct regional* region, struct dns_msg** msg, time_t timenow); |
127 128/** 129 * Find cached message 130 * @param env: module environment with the DNS cache. 131 * @param qname: query name. 132 * @param qnamelen: length of qname. 133 * @param qtype: query type. 134 * @param qclass: query class. --- 37 unchanged lines hidden (view full) --- 172 * space left, does not grow the array. 173 * @param msg: msg to put it in. 174 * @param region: region to alloc in 175 * @param rrset: to add in authority section 176 * @param now: now. 177 * @return true if worked, false on fail 178 */ 179int dns_msg_authadd(struct dns_msg* msg, struct regional* region, | 127 128/** 129 * Find cached message 130 * @param env: module environment with the DNS cache. 131 * @param qname: query name. 132 * @param qnamelen: length of qname. 133 * @param qtype: query type. 134 * @param qclass: query class. --- 37 unchanged lines hidden (view full) --- 172 * space left, does not grow the array. 173 * @param msg: msg to put it in. 174 * @param region: region to alloc in 175 * @param rrset: to add in authority section 176 * @param now: now. 177 * @return true if worked, false on fail 178 */ 179int dns_msg_authadd(struct dns_msg* msg, struct regional* region, |
180 struct ub_packed_rrset_key* rrset, uint32_t now); | 180 struct ub_packed_rrset_key* rrset, time_t now); |
181 182#endif /* SERVICES_CACHE_DNS_H */ | 181 182#endif /* SERVICES_CACHE_DNS_H */ |