Lines Matching full:rr

1 /* rr.c
33 ldns_rr *rr; in ldns_rr_new() local
34 rr = LDNS_MALLOC(ldns_rr); in ldns_rr_new()
35 if (!rr) { in ldns_rr_new()
39 ldns_rr_set_owner(rr, NULL); in ldns_rr_new()
40 ldns_rr_set_question(rr, false); in ldns_rr_new()
41 ldns_rr_set_rd_count(rr, 0); in ldns_rr_new()
42 rr->_rdata_fields = NULL; in ldns_rr_new()
43 ldns_rr_set_class(rr, LDNS_RR_CLASS_IN); in ldns_rr_new()
44 ldns_rr_set_ttl(rr, LDNS_DEFAULT_TTL); in ldns_rr_new()
45 return rr; in ldns_rr_new()
51 ldns_rr *rr; in ldns_rr_new_frm_type() local
55 rr = LDNS_MALLOC(ldns_rr); in ldns_rr_new_frm_type()
56 if (!rr) { in ldns_rr_new_frm_type()
62 rr->_rdata_fields = LDNS_XMALLOC(ldns_rdf *, ldns_rr_descriptor_minimum(desc)); in ldns_rr_new_frm_type()
63 if(!rr->_rdata_fields) { in ldns_rr_new_frm_type()
64 LDNS_FREE(rr); in ldns_rr_new_frm_type()
68 rr->_rdata_fields[i] = NULL; in ldns_rr_new_frm_type()
71 ldns_rr_set_owner(rr, NULL); in ldns_rr_new_frm_type()
72 ldns_rr_set_question(rr, false); in ldns_rr_new_frm_type()
74 ldns_rr_set_rd_count(rr, ldns_rr_descriptor_minimum(desc)); in ldns_rr_new_frm_type()
75 ldns_rr_set_class(rr, LDNS_RR_CLASS_IN); in ldns_rr_new_frm_type()
76 ldns_rr_set_ttl(rr, LDNS_DEFAULT_TTL); in ldns_rr_new_frm_type()
77 ldns_rr_set_type(rr, t); in ldns_rr_new_frm_type()
78 return rr; in ldns_rr_new_frm_type()
82 ldns_rr_free(ldns_rr *rr) in ldns_rr_free() argument
85 if (rr) { in ldns_rr_free()
86 if (ldns_rr_owner(rr)) { in ldns_rr_free()
87 ldns_rdf_deep_free(ldns_rr_owner(rr)); in ldns_rr_free()
89 for (i = 0; i < ldns_rr_rd_count(rr); i++) { in ldns_rr_free()
90 ldns_rdf_deep_free(ldns_rr_rdf(rr, i)); in ldns_rr_free()
92 LDNS_FREE(rr->_rdata_fields); in ldns_rr_free()
93 LDNS_FREE(rr); in ldns_rr_free()
112 * So the RR should look like. e.g.
188 /* split the rr in its parts -1 signals trouble */ in ldns_rr_new_frm_str_internal()
213 * the rest of the RR is still there. That is in ldns_rr_new_frm_str_internal()
270 /* apparently we are done, and it's only a question RR in ldns_rr_new_frm_str_internal()
428 /* unknown RR data */ in ldns_rr_new_frm_str_internal()
509 /* Normal RR */ in ldns_rr_new_frm_str_internal()
733 ldns_rr *rr; in _ldns_rr_new_frm_fp_l_internal() local
777 s = ldns_rr_new_frm_str_internal(&rr, (const char*)line, in _ldns_rr_new_frm_fp_l_internal()
780 s = ldns_rr_new_frm_str_internal(&rr, (const char*)line, in _ldns_rr_new_frm_fp_l_internal()
787 *newrr = rr; in _ldns_rr_new_frm_fp_l_internal()
790 ldns_rr_free(rr); in _ldns_rr_new_frm_fp_l_internal()
805 ldns_rr_set_owner(ldns_rr *rr, ldns_rdf *owner) in ldns_rr_set_owner() argument
807 rr->_owner = owner; in ldns_rr_set_owner()
811 ldns_rr_set_question(ldns_rr *rr, bool question) in ldns_rr_set_question() argument
813 rr->_rr_question = question; in ldns_rr_set_question()
817 ldns_rr_set_ttl(ldns_rr *rr, uint32_t ttl) in ldns_rr_set_ttl() argument
819 rr->_ttl = ttl; in ldns_rr_set_ttl()
823 ldns_rr_set_rd_count(ldns_rr *rr, size_t count) in ldns_rr_set_rd_count() argument
825 rr->_rd_count = count; in ldns_rr_set_rd_count()
829 ldns_rr_set_type(ldns_rr *rr, ldns_rr_type rr_type) in ldns_rr_set_type() argument
831 rr->_rr_type = rr_type; in ldns_rr_set_type()
835 ldns_rr_set_class(ldns_rr *rr, ldns_rr_class rr_class) in ldns_rr_set_class() argument
837 rr->_rr_class = rr_class; in ldns_rr_set_class()
841 ldns_rr_set_rdf(ldns_rr *rr, const ldns_rdf *f, size_t position) in ldns_rr_set_rdf() argument
846 rd_count = ldns_rr_rd_count(rr); in ldns_rr_set_rdf()
849 pop = rr->_rdata_fields[position]; in ldns_rr_set_rdf()
850 rr->_rdata_fields[position] = (ldns_rdf*)f; in ldns_rr_set_rdf()
858 ldns_rr_push_rdf(ldns_rr *rr, const ldns_rdf *f) in ldns_rr_push_rdf() argument
863 rd_count = ldns_rr_rd_count(rr); in ldns_rr_push_rdf()
867 rr->_rdata_fields, ldns_rdf *, rd_count + 1); in ldns_rr_push_rdf()
873 rr->_rdata_fields = rdata_fields; in ldns_rr_push_rdf()
874 rr->_rdata_fields[rd_count] = (ldns_rdf*)f; in ldns_rr_push_rdf()
876 ldns_rr_set_rd_count(rr, rd_count + 1); in ldns_rr_push_rdf()
881 ldns_rr_pop_rdf(ldns_rr *rr) in ldns_rr_pop_rdf() argument
887 rd_count = ldns_rr_rd_count(rr); in ldns_rr_pop_rdf()
893 pop = rr->_rdata_fields[rd_count - 1]; in ldns_rr_pop_rdf()
898 rr->_rdata_fields, ldns_rdf *, rd_count - 1); in ldns_rr_pop_rdf()
900 rr->_rdata_fields = newrd; in ldns_rr_pop_rdf()
902 LDNS_FREE(rr->_rdata_fields); in ldns_rr_pop_rdf()
905 ldns_rr_set_rd_count(rr, rd_count - 1); in ldns_rr_pop_rdf()
910 ldns_rr_rdf(const ldns_rr *rr, size_t nr) in ldns_rr_rdf() argument
912 if (rr && nr < ldns_rr_rd_count(rr)) { in ldns_rr_rdf()
913 return rr->_rdata_fields[nr]; in ldns_rr_rdf()
920 ldns_rr_owner(const ldns_rr *rr) in ldns_rr_owner() argument
922 return rr->_owner; in ldns_rr_owner()
926 ldns_rr_is_question(const ldns_rr *rr) in ldns_rr_is_question() argument
928 return rr->_rr_question; in ldns_rr_is_question()
932 ldns_rr_ttl(const ldns_rr *rr) in ldns_rr_ttl() argument
934 return rr->_ttl; in ldns_rr_ttl()
938 ldns_rr_rd_count(const ldns_rr *rr) in ldns_rr_rd_count() argument
940 return rr->_rd_count; in ldns_rr_rd_count()
944 ldns_rr_get_type(const ldns_rr *rr) in ldns_rr_get_type() argument
946 return rr->_rr_type; in ldns_rr_get_type()
950 ldns_rr_get_class(const ldns_rr *rr) in ldns_rr_get_class() argument
952 return rr->_rr_class; in ldns_rr_get_class()
1133 ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr) in ldns_rr_list_push_rr() argument
1157 rr_list->_rrs[rr_count] = (ldns_rr*)rr; in ldns_rr_list_push_rr()
1213 /* pop a number of rr's and put them in a rr_list */ in ldns_rr_list_pop_rr_list()
1241 ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, const ldns_rr *rr) in ldns_rr_list_contains_rr() argument
1245 if (!rr_list || !rr || ldns_rr_list_rr_count(rr_list) == 0) { in ldns_rr_list_contains_rr()
1250 if (rr == ldns_rr_list_rr(rr_list, i)) { in ldns_rr_list_contains_rr()
1252 } else if (ldns_rr_compare(rr, ldns_rr_list_rr(rr_list, i)) == 0) { in ldns_rr_list_contains_rr()
1295 ldns_rr_set_push_rr(ldns_rr_list *rr_list, ldns_rr *rr) in ldns_rr_set_push_rr() argument
1301 assert(rr != NULL); in ldns_rr_set_push_rr()
1308 return ldns_rr_list_push_rr(rr_list, rr); in ldns_rr_set_push_rr()
1310 /* check with the final rr in the rr_list */ in ldns_rr_set_push_rr()
1313 if (ldns_rr_get_class(last) != ldns_rr_get_class(rr)) { in ldns_rr_set_push_rr()
1316 if (ldns_rr_get_type(last) != ldns_rr_get_type(rr)) { in ldns_rr_set_push_rr()
1320 if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_RRSIG) { in ldns_rr_set_push_rr()
1321 if (ldns_rr_ttl(last) != ldns_rr_ttl(rr)) { in ldns_rr_set_push_rr()
1326 ldns_rr_owner(rr)) != 0) { in ldns_rr_set_push_rr()
1329 /* ok, still alive - check if the rr already in ldns_rr_set_push_rr()
1333 ldns_rr_list_rr(rr_list, i), rr) == 0) { in ldns_rr_set_push_rr()
1338 return ldns_rr_list_push_rr(rr_list, rr); in ldns_rr_set_push_rr()
1401 ldns_rr_clone(const ldns_rr *rr) in ldns_rr_clone() argument
1406 if (!rr) { in ldns_rr_clone()
1414 if (ldns_rr_owner(rr)) { in ldns_rr_clone()
1415 ldns_rr_set_owner(new_rr, ldns_rdf_clone(ldns_rr_owner(rr))); in ldns_rr_clone()
1417 ldns_rr_set_ttl(new_rr, ldns_rr_ttl(rr)); in ldns_rr_clone()
1418 ldns_rr_set_type(new_rr, ldns_rr_get_type(rr)); in ldns_rr_clone()
1419 ldns_rr_set_class(new_rr, ldns_rr_get_class(rr)); in ldns_rr_clone()
1420 ldns_rr_set_question(new_rr, ldns_rr_is_question(rr)); in ldns_rr_clone()
1422 for (i = 0; i < ldns_rr_rd_count(rr); i++) { in ldns_rr_clone()
1423 if (ldns_rr_rdf(rr,i)) { in ldns_rr_clone()
1424 ldns_rr_push_rdf(new_rr, ldns_rdf_clone(ldns_rr_rdf(rr, i))); in ldns_rr_clone()
1782 ldns_rr2canonical(ldns_rr *rr) in ldns_rr2canonical() argument
1786 if (!rr) { in ldns_rr2canonical()
1790 ldns_dname2canonical(ldns_rr_owner(rr)); in ldns_rr2canonical()
1793 * lowercase the rdata dnames if the rr type is one in ldns_rr2canonical()
1799 switch(ldns_rr_get_type(rr)) { in ldns_rr2canonical()
1823 for (i = 0; i < ldns_rr_rd_count(rr); i++) { in ldns_rr2canonical()
1824 ldns_dname2canonical(ldns_rr_rdf(rr, i)); in ldns_rr2canonical()
1843 ldns_rr_label_count(const ldns_rr *rr) in ldns_rr_label_count() argument
1845 if (!rr) { in ldns_rr_label_count()
1849 ldns_rr_owner(rr)); in ldns_rr_label_count()
2086 /* All RR's defined in 1035 are well known and can thus
2087 * be compressed. See RFC3597. These RR's are:
2516 * or unset all known RR types. Arguably these functions are better situated
2519 * other than rr.c where it is declared static.
2521 * Alternatively rr.c could have provided an iterator for rr_type or
2531 * The RR type space is split into 256 window blocks, each representing
2532 * the low-order 8 bits of the 16-bit RR type space. Each block that
2533 * has at least one active RR type is encoded using a single octet
2538 * Window blocks are present in the NSEC RR RDATA in increasing
2550 * value within that block, among the set of RR types present at the
2551 * NSEC RR's owner name. Trailing zero octets not specified MUST be