if (mtu <= 0)
max_size = AVAHI_DNS_PACKET_MAX_SIZE;
- else if (mtu >= 48)
- max_size = mtu - 48;
+ else if (mtu >= AVAHI_DNS_PACKET_EXTRA_SIZE)
+ max_size = mtu - AVAHI_DNS_PACKET_EXTRA_SIZE;
else
max_size = 0;
g_assert(p);
g_assert(ret_cache_flush);
-/* g_message("consume_record()"); */
+/* avahi_log_debug("consume_record()"); */
if (avahi_dns_packet_consume_name(p, name, sizeof(name)) < 0 ||
avahi_dns_packet_consume_uint16(p, &type) < 0 ||
p->rindex + rdlength > p->size)
goto fail;
-/* g_message("name = %s, rdlength = %u", name, rdlength); */
+/* avahi_log_debug("name = %s, rdlength = %u", name, rdlength); */
*ret_cache_flush = !!(class & AVAHI_DNS_CACHE_FLUSH);
class &= ~AVAHI_DNS_CACHE_FLUSH;
start = avahi_dns_packet_get_rptr(p);
- r = avahi_record_new_full(name, class, type);
+ r = avahi_record_new_full(name, class, type, ttl);
switch (type) {
case AVAHI_DNS_TYPE_PTR:
case AVAHI_DNS_TYPE_CNAME:
-/* g_message("ptr"); */
+/* avahi_log_debug("ptr"); */
if (avahi_dns_packet_consume_name(p, buf, sizeof(buf)) < 0)
goto fail;
case AVAHI_DNS_TYPE_SRV:
-/* g_message("srv"); */
+/* avahi_log_debug("srv"); */
if (avahi_dns_packet_consume_uint16(p, &r->data.srv.priority) < 0 ||
avahi_dns_packet_consume_uint16(p, &r->data.srv.weight) < 0 ||
case AVAHI_DNS_TYPE_HINFO:
-/* g_message("hinfo"); */
+/* avahi_log_debug("hinfo"); */
if (avahi_dns_packet_consume_string(p, buf, sizeof(buf)) < 0)
goto fail;
case AVAHI_DNS_TYPE_TXT:
-/* g_message("txt"); */
+/* avahi_log_debug("txt"); */
if (rdlength > 0) {
r->data.txt.string_list = avahi_string_list_parse(avahi_dns_packet_get_rptr(p), rdlength);
case AVAHI_DNS_TYPE_A:
-/* g_message("A"); */
+/* avahi_log_debug("A"); */
if (avahi_dns_packet_consume_bytes(p, &r->data.a.address, sizeof(AvahiIPv4Address)) < 0)
goto fail;
case AVAHI_DNS_TYPE_AAAA:
-/* g_message("aaaa"); */
+/* avahi_log_debug("aaaa"); */
if (avahi_dns_packet_consume_bytes(p, &r->data.aaaa.address, sizeof(AvahiIPv6Address)) < 0)
goto fail;
default:
-/* g_message("generic"); */
+/* avahi_log_debug("generic"); */
if (rdlength > 0) {
break;
}
-/* g_message("%i == %u ?", (guint8*) avahi_dns_packet_get_rptr(p) - (guint8*) start, rdlength); */
+/* avahi_log_debug("%i == %u ?", (guint8*) avahi_dns_packet_get_rptr(p) - (guint8*) start, rdlength); */
/* Check if we read enough data */
if ((guint8*) avahi_dns_packet_get_rptr(p) - (guint8*) start != rdlength)
goto fail;
-
- r->ttl = ttl;
return r;
if (!(t = avahi_dns_packet_append_name(p, k->name)) ||
!avahi_dns_packet_append_uint16(p, k->type) ||
- !avahi_dns_packet_append_uint16(p, k->class | (unicast_response ? AVAHI_DNS_UNICAST_RESPONSE : 0))) {
+ !avahi_dns_packet_append_uint16(p, k->clazz | (unicast_response ? AVAHI_DNS_UNICAST_RESPONSE : 0))) {
p->size = size;
return NULL;
}
if (!(t = avahi_dns_packet_append_name(p, r->key->name)) ||
!avahi_dns_packet_append_uint16(p, r->key->type) ||
- !avahi_dns_packet_append_uint16(p, cache_flush ? (r->key->class | AVAHI_DNS_CACHE_FLUSH) : (r->key->class &~ AVAHI_DNS_CACHE_FLUSH)) ||
+ !avahi_dns_packet_append_uint16(p, cache_flush ? (r->key->clazz | AVAHI_DNS_CACHE_FLUSH) : (r->key->clazz &~ AVAHI_DNS_CACHE_FLUSH)) ||
!avahi_dns_packet_append_uint32(p, (max_ttl && r->ttl > max_ttl) ? max_ttl : r->ttl) ||
!(l = avahi_dns_packet_append_uint16(p, 0)))
goto fail;
size = avahi_string_list_serialize(r->data.txt.string_list, NULL, 0);
-/* g_message("appending string: %u %p", size, r->data.txt.string_list); */
+/* avahi_log_debug("appending string: %u %p", size, r->data.txt.string_list); */
if (!(data = avahi_dns_packet_extend(p, size)))
goto fail;
size = avahi_dns_packet_extend(p, 0) - start;
g_assert(size <= 0xFFFF);
-/* g_message("appended %u", size); */
+/* avahi_log_debug("appended %u", size); */
* (guint16*) l = g_htons((guint16) size);