Electroneum
Loading...
Searching...
No Matches
msgreply.h
Go to the documentation of this file.
1/*
2 * util/data/msgreply.h - store message and reply data.
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
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright notice,
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
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
41
42#ifndef UTIL_DATA_MSGREPLY_H
43#define UTIL_DATA_MSGREPLY_H
46struct sldns_buffer;
47struct comm_reply;
48struct alloc_cache;
49struct iovec;
50struct regional;
51struct edns_data;
52struct edns_option;
53struct inplace_cb;
54struct module_qstate;
55struct module_env;
56struct msg_parse;
57struct rrset_parse;
58struct local_rrset;
59struct dns_msg;
60
63#define PREFETCH_TTL_CALC(ttl) ((ttl) - (ttl)/10)
64
100
110
207
217
233struct reply_info*
235 time_t ttl, time_t prettl, size_t an, size_t ns, size_t ar,
236 size_t total, enum sec_status sec);
237
248int query_info_parse(struct query_info* m, struct sldns_buffer* query);
249
265int reply_info_parse(struct sldns_buffer* pkt, struct alloc_cache* alloc,
266 struct query_info* qinf, struct reply_info** rep,
267 struct regional* region, struct edns_data* edns);
268
284int parse_create_msg(struct sldns_buffer* pkt, struct msg_parse* msg,
285 struct alloc_cache* alloc, struct query_info* qinf,
286 struct reply_info** rep, struct regional* region);
287
290 struct regional* region, struct query_info* qi);
291
297
304void reply_info_set_ttls(struct reply_info* rep, time_t timenow);
305
312void reply_info_parsedelete(struct reply_info* rep, struct alloc_cache* alloc);
313
321int query_info_compare(void* m1, void* m2);
322
325
327size_t msgreply_sizefunc(void* k, void* d);
328
330void query_entry_delete(void *q, void* arg);
331
333void reply_info_delete(void* d, void* arg);
334
338
347 struct reply_info* r, hashvalue_type h);
348
361 struct alloc_cache* alloc, struct regional* region);
362
376 struct alloc_cache* alloc, struct regional* region);
377
390 struct rrset_parse *pset, struct regional* region,
391 struct ub_packed_rrset_key* pk);
392
400 struct reply_info* rep);
401
408int reply_check_cname_chain(struct query_info* qinfo, struct reply_info* rep);
409
417
426 struct reply_info* rep);
427
438 uint8_t* name, size_t namelen, uint16_t type, uint16_t dclass);
439
450 uint8_t* name, size_t namelen, uint16_t type, uint16_t dclass);
451
462 uint8_t* name, size_t namelen, uint16_t type, uint16_t dclass);
463
470void log_dns_msg(const char* str, struct query_info* qinfo,
471 struct reply_info* rep);
472
486void log_reply_info(enum verbosity_value v, struct query_info *qinf,
487 struct sockaddr_storage *addr, socklen_t addrlen, struct timeval dur,
488 int cached, struct sldns_buffer *rmsg);
489
496void log_query_info(enum verbosity_value v, const char* str,
497 struct query_info* qinf);
498
508int edns_opt_append(struct edns_data* edns, struct regional* region,
509 uint16_t code, size_t len, uint8_t* data);
510
520int edns_opt_list_append(struct edns_option** list, uint16_t code, size_t len,
521 uint8_t* data, struct regional* region);
522
530
538
551int inplace_cb_reply_call(struct module_env* env, struct query_info* qinfo,
552 struct module_qstate* qstate, struct reply_info* rep, int rcode,
553 struct edns_data* edns, struct regional* region);
554
568 struct query_info* qinfo, struct module_qstate* qstate,
569 struct reply_info* rep, int rcode, struct edns_data* edns,
570 struct regional* region);
571
585 struct query_info* qinfo, struct module_qstate* qstate,
586 struct reply_info* rep, int rcode, struct edns_data* edns,
587 struct regional* region);
588
603 struct query_info* qinfo, struct module_qstate* qstate,
604 struct reply_info* rep, int rcode, struct edns_data* edns,
605 struct regional* region);
606
624int inplace_cb_query_call(struct module_env* env, struct query_info* qinfo,
625 uint16_t flags, struct sockaddr_storage* addr, socklen_t addrlen,
626 uint8_t* zone, size_t zonelen, struct module_qstate* qstate,
627 struct regional* region);
628
638 struct module_qstate* qstate);
639
650 struct module_qstate* qstate, struct dns_msg* response);
651
656 struct regional* region);
657
662
667
671int edns_opt_compare(struct edns_option* p, struct edns_option* q);
672
677
678#endif /* UTIL_DATA_MSGREPLY_H */
verbosity_value
Definition log.h:49
uint32_t hashvalue_type
Definition lruhash.h:119
int query_info_parse(struct query_info *m, struct sldns_buffer *query)
void edns_opt_list_free(struct edns_option *list)
struct reply_info * reply_info_copy(struct reply_info *rep, struct alloc_cache *alloc, struct regional *region)
int query_info_compare(void *m1, void *m2)
int edns_opt_list_compare(struct edns_option *p, struct edns_option *q)
struct ub_packed_rrset_key * reply_find_rrset(struct reply_info *rep, uint8_t *name, size_t namelen, uint16_t type, uint16_t dclass)
struct msgreply_entry * query_info_entrysetup(struct query_info *q, struct reply_info *r, hashvalue_type h)
int edns_opt_compare(struct edns_option *p, struct edns_option *q)
int inplace_cb_reply_local_call(struct module_env *env, struct query_info *qinfo, struct module_qstate *qstate, struct reply_info *rep, int rcode, struct edns_data *edns, struct regional *region)
struct edns_option * edns_opt_copy_alloc(struct edns_option *list)
void log_dns_msg(const char *str, struct query_info *qinfo, struct reply_info *rep)
int inplace_cb_query_response_call(struct module_env *env, struct module_qstate *qstate, struct dns_msg *response)
void log_reply_info(enum verbosity_value v, struct query_info *qinf, struct sockaddr_storage *addr, socklen_t addrlen, struct timeval dur, int cached, struct sldns_buffer *rmsg)
struct ub_packed_rrset_key * reply_find_answer_rrset(struct query_info *qinfo, struct reply_info *rep)
int inplace_cb_query_call(struct module_env *env, struct query_info *qinfo, uint16_t flags, struct sockaddr_storage *addr, socklen_t addrlen, uint8_t *zone, size_t zonelen, struct module_qstate *qstate, struct regional *region)
int edns_opt_list_remove(struct edns_option **list, uint16_t code)
uint8_t * reply_find_final_cname_target(struct query_info *qinfo, struct reply_info *rep)
void reply_info_set_ttls(struct reply_info *rep, time_t timenow)
int inplace_cb_reply_cache_call(struct module_env *env, struct query_info *qinfo, struct module_qstate *qstate, struct reply_info *rep, int rcode, struct edns_data *edns, struct regional *region)
int edns_opt_list_append(struct edns_option **list, uint16_t code, size_t len, uint8_t *data, struct regional *region)
int reply_all_rrsets_secure(struct reply_info *rep)
int inplace_cb_reply_servfail_call(struct module_env *env, struct query_info *qinfo, struct module_qstate *qstate, struct reply_info *rep, int rcode, struct edns_data *edns, struct regional *region)
void reply_info_sortref(struct reply_info *rep)
int reply_check_cname_chain(struct query_info *qinfo, struct reply_info *rep)
int inplace_cb_edns_back_parsed_call(struct module_env *env, struct module_qstate *qstate)
void log_query_info(enum verbosity_value v, const char *str, struct query_info *qinf)
void reply_info_parsedelete(struct reply_info *rep, struct alloc_cache *alloc)
struct edns_option * edns_opt_list_find(struct edns_option *list, uint16_t code)
struct reply_info * parse_reply_in_temp_region(struct sldns_buffer *pkt, struct regional *region, struct query_info *qi)
int edns_opt_append(struct edns_data *edns, struct regional *region, uint16_t code, size_t len, uint8_t *data)
void reply_info_delete(void *d, void *arg)
hashvalue_type query_info_hash(struct query_info *q, uint16_t flags)
int reply_info_parse(struct sldns_buffer *pkt, struct alloc_cache *alloc, struct query_info *qinf, struct reply_info **rep, struct regional *region, struct edns_data *edns)
struct ub_packed_rrset_key * reply_find_rrset_section_ns(struct reply_info *rep, uint8_t *name, size_t namelen, uint16_t type, uint16_t dclass)
size_t msgreply_sizefunc(void *k, void *d)
int parse_create_msg(struct sldns_buffer *pkt, struct msg_parse *msg, struct alloc_cache *alloc, struct query_info *qinf, struct reply_info **rep, struct regional *region)
struct ub_packed_rrset_key * reply_find_rrset_section_an(struct reply_info *rep, uint8_t *name, size_t namelen, uint16_t type, uint16_t dclass)
void query_entry_delete(void *q, void *arg)
void query_info_clear(struct query_info *m)
struct edns_option * edns_opt_copy_region(struct edns_option *list, struct regional *region)
int inplace_cb_reply_call(struct module_env *env, struct query_info *qinfo, struct module_qstate *qstate, struct reply_info *rep, int rcode, struct edns_data *edns, struct regional *region)
int reply_info_alloc_rrset_keys(struct reply_info *rep, struct alloc_cache *alloc, struct regional *region)
int parse_copy_decompress_rrset(struct sldns_buffer *pkt, struct msg_parse *msg, struct rrset_parse *pset, struct regional *region, struct ub_packed_rrset_key *pk)
struct reply_info * construct_reply_info_base(struct regional *region, uint16_t flags, size_t qd, time_t ttl, time_t prettl, size_t an, size_t ns, size_t ar, size_t total, enum sec_status sec)
uint64_t rrset_id_type
sec_status
unsigned short uint16_t
Definition stdint.h:125
unsigned int uint32_t
Definition stdint.h:126
unsigned char uint8_t
Definition stdint.h:124
Definition dns.h:61
Definition lruhash.h:203
Definition msgreply.h:211
struct query_info key
Definition msgreply.h:213
struct lruhash_entry entry
Definition msgreply.h:215
uint16_t qclass
Definition msgreply.h:81
size_t qname_len
Definition msgreply.h:77
struct local_rrset * local_alias
Definition msgreply.h:98
uint8_t * qname
Definition msgreply.h:75
uint16_t qtype
Definition msgreply.h:79
size_t ar_numrrsets
Definition msgreply.h:175
size_t an_numrrsets
Definition msgreply.h:170
uint8_t authoritative
Definition msgreply.h:133
uint32_t padding
Definition msgreply.h:144
size_t ns_numrrsets
Definition msgreply.h:173
struct ub_packed_rrset_key ** rrsets
Definition msgreply.h:187
time_t ttl
Definition msgreply.h:151
uint16_t flags
Definition msgreply.h:127
enum sec_status security
Definition msgreply.h:162
size_t rrset_count
Definition msgreply.h:178
uint8_t qdcount
Definition msgreply.h:141
time_t prefetch_ttl
Definition msgreply.h:157
struct rrset_ref ref[1]
Definition msgreply.h:205
rrset_id_type id
Definition msgreply.h:108
struct ub_packed_rrset_key * key
Definition msgreply.h:106