dns.h (266114) | dns.h (276605) |
---|---|
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 --- 65 unchanged lines hidden (view full) --- 74 * It will store only the RRsets, not the message. 75 * @param leeway: TTL value, if not 0, other rrsets are considered expired 76 * that many seconds before actual TTL expiry. 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). | 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 --- 65 unchanged lines hidden (view full) --- 74 * It will store only the RRsets, not the message. 75 * @param leeway: TTL value, if not 0, other rrsets are considered expired 76 * that many seconds before actual TTL expiry. 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 * @param flags: flags with BIT_CD for AAAA queries in dns64 translation. |
|
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, time_t leeway, int pside, | 83 * @return 0 on alloc error (out of memory). 84 */ 85int dns_cache_store(struct module_env* env, struct query_info* qinf, 86 struct reply_info* rep, int is_referral, time_t leeway, int pside, |
86 struct regional* region); | 87 struct regional* region, uint16_t flags); |
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 * 94 * @param env: module environment with the DNS cache. --- 32 unchanged lines hidden (view full) --- 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. | 88 89/** 90 * Store message in the cache. Stores in message cache and rrset cache. 91 * Both qinfo and rep should be malloced and are put in the cache. 92 * They should not be used after this call, as they are then in shared cache. 93 * Does not return errors, they are logged and only lead to less cache. 94 * 95 * @param env: module environment with the DNS cache. --- 32 unchanged lines hidden (view full) --- 128 129/** 130 * Find cached message 131 * @param env: module environment with the DNS cache. 132 * @param qname: query name. 133 * @param qnamelen: length of qname. 134 * @param qtype: query type. 135 * @param qclass: query class. |
136 * @param flags: flags with BIT_CD for AAAA queries in dns64 translation. |
|
135 * @param region: where to allocate result. 136 * @param scratch: where to allocate temporary data. 137 * @return new response message (alloced in region, rrsets do not have IDs). 138 * or NULL on error or if not found in cache. 139 * TTLs are made relative to the current time. 140 */ 141struct dns_msg* dns_cache_lookup(struct module_env* env, 142 uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, | 137 * @param region: where to allocate result. 138 * @param scratch: where to allocate temporary data. 139 * @return new response message (alloced in region, rrsets do not have IDs). 140 * or NULL on error or if not found in cache. 141 * TTLs are made relative to the current time. 142 */ 143struct dns_msg* dns_cache_lookup(struct module_env* env, 144 uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, |
143 struct regional* region, struct regional* scratch); | 145 uint16_t flags, struct regional* region, struct regional* scratch); |
144 145/** 146 * find and add A and AAAA records for missing nameservers in delegpt 147 * @param env: module environment with rrset cache 148 * @param qclass: which class to look in. 149 * @param region: where to store new dp info. 150 * @param dp: delegation point to fill missing entries. 151 * @return false on alloc failure. --- 22 unchanged lines hidden (view full) --- 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, time_t now); 181 | 146 147/** 148 * find and add A and AAAA records for missing nameservers in delegpt 149 * @param env: module environment with rrset cache 150 * @param qclass: which class to look in. 151 * @param region: where to store new dp info. 152 * @param dp: delegation point to fill missing entries. 153 * @return false on alloc failure. --- 22 unchanged lines hidden (view full) --- 176 * @param region: region to alloc in 177 * @param rrset: to add in authority section 178 * @param now: now. 179 * @return true if worked, false on fail 180 */ 181int dns_msg_authadd(struct dns_msg* msg, struct regional* region, 182 struct ub_packed_rrset_key* rrset, time_t now); 183 |
184/** 185 * Adjust the prefetch_ttl for a cached message. This adds a value to the 186 * prefetch ttl - postponing the time when it will be prefetched for future 187 * incoming queries. 188 * @param env: module environment with caches and time. 189 * @param qinfo: query info for the query that needs adjustment. 190 * @param adjust: time in seconds to add to the prefetch_leeway. 191 * @param flags: flags with BIT_CD for AAAA queries in dns64 translation. 192 * @return false if not in cache. true if added. 193 */ 194int dns_cache_prefetch_adjust(struct module_env* env, struct query_info* qinfo, 195 time_t adjust, uint16_t flags); 196 |
|
182#endif /* SERVICES_CACHE_DNS_H */ | 197#endif /* SERVICES_CACHE_DNS_H */ |