-AvahiRecord* avahi_dns_packet_consume_record(AvahiDnsPacket *p, gboolean *ret_cache_flush) {
- gchar name[257], buf[257];
- guint16 type, class;
- guint32 ttl;
- guint16 rdlength;
- AvahiRecord *r = NULL;
- gconstpointer start;
-
- g_assert(p);
- g_assert(ret_cache_flush);
-
-/* g_message("consume_record()"); */
-
- if (avahi_dns_packet_consume_name(p, name, sizeof(name)) < 0 ||
- avahi_dns_packet_consume_uint16(p, &type) < 0 ||
- avahi_dns_packet_consume_uint16(p, &class) < 0 ||
- avahi_dns_packet_consume_uint32(p, &ttl) < 0 ||
- avahi_dns_packet_consume_uint16(p, &rdlength) < 0 ||
- p->rindex + rdlength > p->size)
- goto fail;
-
-/* g_message("name = %s, rdlength = %u", name, rdlength); */
-
- *ret_cache_flush = !!(class & AVAHI_DNS_CACHE_FLUSH);
- class &= ~AVAHI_DNS_CACHE_FLUSH;
+static int parse_rdata(AvahiDnsPacket *p, AvahiRecord *r, uint16_t rdlength) {
+ char buf[AVAHI_DOMAIN_NAME_MAX];
+ const void* start;