]> git.meshlink.io Git - catta/blobdiff - avahi-core/dns.h
forgot to pull the publish_no_reverse change to the example.
[catta] / avahi-core / dns.h
index 743ad4e3324676f2ea8f04568a33c5f16335997e..52e8d88fa45761636ecf9c2a8fa8117929969fab 100644 (file)
@@ -1,21 +1,19 @@
 #ifndef foodnshfoo
 #define foodnshfoo
 
-/* $Id$ */
-
 /***
   This file is part of avahi.
+
   avahi is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
+
   avahi is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
   Public License for more details.
+
   You should have received a copy of the GNU Lesser General Public
   License along with avahi; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 #include "rr.h"
 #include "hashmap.h"
 
-#define AVAHI_DNS_PACKET_MAX_SIZE 9000
 #define AVAHI_DNS_PACKET_HEADER_SIZE 12
 #define AVAHI_DNS_PACKET_EXTRA_SIZE 48
+#define AVAHI_DNS_LABELS_MAX 127
+#define AVAHI_DNS_RDATA_MAX 0xFFFF
+#define AVAHI_DNS_PACKET_SIZE_MAX (AVAHI_DNS_PACKET_HEADER_SIZE + 256 + 2 + 2 + 4 + 2 + AVAHI_DNS_RDATA_MAX)
 
 typedef struct AvahiDnsPacket {
     size_t size, rindex, max_size;
     AvahiHashmap *name_table; /* for name compression */
+    uint8_t *data;
 } AvahiDnsPacket;
 
-#define AVAHI_DNS_PACKET_DATA(p) (((uint8_t*) p) + sizeof(AvahiDnsPacket))
+#define AVAHI_DNS_PACKET_DATA(p) ((p)->data ? (p)->data : ((uint8_t*) p) + sizeof(AvahiDnsPacket))
 
 AvahiDnsPacket* avahi_dns_packet_new(unsigned mtu);
 AvahiDnsPacket* avahi_dns_packet_new_query(unsigned mtu);
@@ -49,6 +50,8 @@ void avahi_dns_packet_inc_field(AvahiDnsPacket *p, unsigned idx);
 
 uint8_t *avahi_dns_packet_extend(AvahiDnsPacket *p, size_t l);
 
+void avahi_dns_packet_cleanup_name_table(AvahiDnsPacket *p);
+
 uint8_t *avahi_dns_packet_append_uint16(AvahiDnsPacket *p, uint16_t v);
 uint8_t *avahi_dns_packet_append_uint32(AvahiDnsPacket *p, uint32_t v);
 uint8_t *avahi_dns_packet_append_name(AvahiDnsPacket *p, const char *name);