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