Home | History | Annotate | Line # | Download | only in dist
      1 /*
      2  * answer.h -- manipulating query answers and encoding them.
      3  *
      4  * Copyright (c) 2001-2006, NLnet Labs. All rights reserved.
      5  *
      6  * See LICENSE for the license.
      7  *
      8  */
      9 
     10 #ifndef ANSWER_H
     11 #define ANSWER_H
     12 
     13 #include <sys/types.h>
     14 
     15 #include "dns.h"
     16 #include "namedb.h"
     17 #include "packet.h"
     18 #include "query.h"
     19 
     20 /*
     21  * Structure used to keep track of RRsets that need to be stored in
     22  * the answer packet.
     23  */
     24 typedef struct answer answer_type;
     25 struct answer {
     26 	size_t rrset_count;
     27 	rrset_type *rrsets[MAXRRSPP];
     28 	domain_type *domains[MAXRRSPP];
     29 	rr_section_type section[MAXRRSPP];
     30 };
     31 
     32 
     33 void encode_answer(query_type *q, const answer_type *answer);
     34 
     35 
     36 void answer_init(answer_type *answer);
     37 
     38 /*
     39  * Add the specified RRset to the answer in the specified section.  If
     40  * the RRset is already present and in the same (or "higher") section
     41  * return 0, otherwise return 1.
     42  */
     43 int answer_add_rrset(answer_type *answer, rr_section_type section,
     44 		     domain_type *domain, rrset_type *rrset);
     45 
     46 
     47 #endif /* ANSWER_H */
     48