return ldns_buffer_status(output);
}
- // @TODO change this to be more accurate output
+ // TODO can this output be more accurate?
ldns_edns_hex_data2buffer_str(output, data, len);
return ldns_buffer_status(output);
break;
default:
ldns_buffer_printf(output, " %02x", data[0]);
- ldns_buffer_printf(output, " %02x:", data[1]);
+ ldns_buffer_printf(output, " %02x", data[1]);
break;
}
return ldns_buffer_status(output);
}
-static ldns_status //@TODO change static?
+ldns_status
ldns_edns_option_list2buffer_str(ldns_buffer *output, ldns_edns_option_list* edns_list)
{
size_t count = ldns_edns_option_list_get_count(edns_list);
size_t i, size;
uint8_t* data;
- // @TODO parse malformed? of in packet.c:ldns_pkt_edns_option_list() ?
-
for (i = 0; i < count; i++) {
ldns_edns_option_code code;
ldns_edns_option* edns = ldns_edns_option_list_get_option(edns_list, i);
*/
ldns_status ldns_pkt2buffer_str(ldns_buffer *output, const ldns_pkt *pkt);
+/**
+ * Converts the list of EDNS options to presentation
+ * format (as char *) and appends it to the given buffer
+ *
+ * \param[in] output pointer to the buffer to append the data to
+ * \param[in] edns_list the list of EDNS options
+ * \return status
+ */
+ldns_status ldns_edns_option_list2buffer_str(ldns_buffer *output,
+ ldns_edns_option_list* edns_list);
+
/**
* Converts the data in the DNS packet to presentation
* format (as char *) and appends it to the given buffer
return packet->_edns_list;
}
- /* if the list doesn't exists, we create it by parsing the _edns_data */
+ /* if the list doesn't exists, we create it by parsing the
+ * packet->_edns_data
+ */
assert(ldns_pkt_edns_data(packet));
max = ldns_rdf_size(ldns_pkt_edns_data(packet));
while (pos < max) {
ldns_edns_option* edns;
uint8_t *data;
- if (pos + 4 > max) {
+ if (pos + 4 > max) { /* make sure the header is */
ldns_edns_option_list_deep_free(edns_list);
return NULL;
}
ldns_edns_option_code code = ldns_read_uint16(&wire[pos]);
size_t size = ldns_read_uint16(&wire[pos+2]);
pos += 4;
- if (pos + size > max) {
+
+ if (pos + size > max) { /* make sure the size fits the data */
ldns_edns_option_list_deep_free(edns_list);
return NULL;
}