*/
ldns_packet_type *ldns_packet_new();
+/**
+ * Frees the packet structure and all data that it contains
+ *
+ * @param packet The packet structure to free
+ */
+void ldns_packet_free(ldns_packet_type *packet);
+
/**
* Converts the data on the uint8_t bytearray (in wire format) to a DNS packet
*
return packet;
}
+void
+ldns_packet_free(ldns_packet_type *packet)
+{
+ FREE(packet->_header);
+ if (packet->_question) {
+ /*ldns_rrset_destroy(packet->_question);*/
+ }
+ if (packet->_answer) {
+ /*ldns_rrset_destroy(packet->_answer);*/
+ FREE(packet->_answer);
+ }
+ if (packet->_authority) {
+ /*ldns_rrset_destroy(packet->_authority);*/
+ FREE(packet->_authority);
+ }
+ if (packet->_additional) {
+ /*ldns_rrset_destroy(packet->_additional);*/
+ FREE(packet->_authority);
+ }
+ FREE(packet);
+}
+
static size_t
ldns_wire2packet_header(ldns_packet_type *packet,
const uint8_t *wire,
printf("ancount: %d\n",(int) packet_ancount(packet));
printf("nscount: %d\n",(int) packet_nscount(packet));
printf("arcount: %d\n",(int) packet_arcount(packet));
+
+ ldns_packet_free(packet);
return 0;
}