curl: reschedule uses GNUNET_CURL_perform2.
[oweals/gnunet.git] / src / include / gnunet_dnsparser_lib.h
index e800442dc9cd9eec73d473802b7728ff15d31115..0fc6ac19c93b9fc8cbe760341827c1a5cd8c00b6 100644 (file)
@@ -1,34 +1,36 @@
 /*
       This file is part of GNUnet
-      Copyright (C) 2010-2014 Christian Grothoff (and other contributing authors)
+      Copyright (C) 2010-2014 GNUnet e.V.
 
-      GNUnet is free software; you can redistribute it and/or modify
-      it under the terms of the GNU General Public License as published
-      by the Free Software Foundation; either version 3, or (at your
-      option) any later version.
+      GNUnet is free software: you can redistribute it and/or modify it
+      under the terms of the GNU Affero General Public License as published
+      by the Free Software Foundation, either version 3 of the License,
+      or (at your option) any later version.
 
       GNUnet 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
-      General Public License for more details.
-
-      You should have received a copy of the GNU General Public License
-      along with GNUnet; see the file COPYING.  If not, write to the
-      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-      Boston, MA 02110-1301, USA.
+      Affero General Public License for more details.
+     
+      You should have received a copy of the GNU Affero General Public License
+      along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 /**
- * @file include/gnunet_dnsparser_lib.h
- * @brief API for helper library to parse DNS packets.
  * @author Philipp Toelke
  * @author Christian Grothoff
+ *
+ * @file
+ * API for helper library to parse DNS packets.
+ *
+ * @defgroup dns-parser  DNS parser library
+ * Helper library to parse DNS packets.
+ * @{
  */
 #ifndef GNUNET_DNSPARSER_LIB_H
 #define GNUNET_DNSPARSER_LIB_H
 
 #include "gnunet_util_lib.h"
-#include "gnunet_tun_lib.h"
 
 /**
  * Maximum length of a label in DNS.
@@ -44,6 +46,7 @@
 /**
  * A few common DNS types.
  */
+#define GNUNET_DNSPARSER_TYPE_ANY 0
 #define GNUNET_DNSPARSER_TYPE_A 1
 #define GNUNET_DNSPARSER_TYPE_NS 2
 #define GNUNET_DNSPARSER_TYPE_CNAME 5
 #define GNUNET_DNSPARSER_TYPE_PTR 12
 #define GNUNET_DNSPARSER_TYPE_MX 15
 #define GNUNET_DNSPARSER_TYPE_TXT 16
+#define GNUNET_DNSPARSER_TYPE_RP 17
+#define GNUNET_DNSPARSER_TYPE_AFSDB 18
+#define GNUNET_DNSPARSER_TYPE_SIG 24
+#define GNUNET_DNSPARSER_TYPE_KEY 25
 #define GNUNET_DNSPARSER_TYPE_AAAA 28
+#define GNUNET_DNSPARSER_TYPE_LOC 29
 #define GNUNET_DNSPARSER_TYPE_SRV 33
+#define GNUNET_DNSPARSER_TYPE_NAPTR 35
+#define GNUNET_DNSPARSER_TYPE_KX 36
 #define GNUNET_DNSPARSER_TYPE_CERT 37
+#define GNUNET_DNSPARSER_TYPE_DNAME 39
+#define GNUNET_DNSPARSER_TYPE_APL 42
+#define GNUNET_DNSPARSER_TYPE_DS 43
+#define GNUNET_DNSPARSER_TYPE_SSHFP 44
+#define GNUNET_DNSPARSER_TYPE_IPSECKEY 45
+#define GNUNET_DNSPARSER_TYPE_RRSIG 46
+#define GNUNET_DNSPARSER_TYPE_NSEC 47
+#define GNUNET_DNSPARSER_TYPE_DNSKEY 48
+#define GNUNET_DNSPARSER_TYPE_DHCID 49
+#define GNUNET_DNSPARSER_TYPE_NSEC3 50
+#define GNUNET_DNSPARSER_TYPE_NSEC3PARAM 51
 #define GNUNET_DNSPARSER_TYPE_TLSA 52
-
+#define GNUNET_DNSPARSER_TYPE_HIP 55
+#define GNUNET_DNSPARSER_TYPE_CDS 59
+#define GNUNET_DNSPARSER_TYPE_CDNSKEY 60
+#define GNUNET_DNSPARSER_TYPE_OPENPGPKEY 61
+#define GNUNET_DNSPARSER_TYPE_TKEY 249
+#define GNUNET_DNSPARSER_TYPE_TSIG 250
+#define GNUNET_DNSPARSER_TYPE_ALL 255
+#define GNUNET_DNSPARSER_TYPE_URI 256
+#define GNUNET_DNSPARSER_TYPE_TA 32768
 
 /**
  * A DNS query.
@@ -408,10 +437,10 @@ struct GNUNET_DNSPARSER_Record
 
     /**
      * For NS, CNAME and PTR records, this is the uncompressed 0-terminated hostname.
-   * In UTF-8 format.  The library will convert from and to DNS-IDNA
-   * as necessary.  Use #GNUNET_DNSPARSER_check_label() to test if an
-   * individual label is well-formed.  If a given name is not well-formed,
-   * creating the DNS packet will fail.
+     * In UTF-8 format.  The library will convert from and to DNS-IDNA
+     * as necessary.  Use #GNUNET_DNSPARSER_check_label() to test if an
+     * individual label is well-formed.  If a given name is not well-formed,
+     * creating the DNS packet will fail.
      */
     char *hostname;
 
@@ -812,6 +841,58 @@ GNUNET_DNSPARSER_parse_srv (const char *udp_payload,
                            size_t udp_payload_length,
                            size_t *off);
 
+/* ***************** low-level duplication API ******************** */
+
+/**
+ * Duplicate (deep-copy) the given DNS record
+ *
+ * @param r the record
+ * @return the newly allocated record
+ */
+struct GNUNET_DNSPARSER_Record *
+GNUNET_DNSPARSER_duplicate_record (const struct GNUNET_DNSPARSER_Record *r);
+
+
+/**
+ * Duplicate (deep-copy) the given DNS record
+ *
+ * @param r the record
+ * @return the newly allocated record
+ */
+struct GNUNET_DNSPARSER_SoaRecord *
+GNUNET_DNSPARSER_duplicate_soa_record (const struct GNUNET_DNSPARSER_SoaRecord *r);
+
+
+/**
+ * Duplicate (deep-copy) the given DNS record
+ *
+ * @param r the record
+ * @return the newly allocated record
+ */
+struct GNUNET_DNSPARSER_CertRecord *
+GNUNET_DNSPARSER_duplicate_cert_record (const struct GNUNET_DNSPARSER_CertRecord *r);
+
+
+/**
+ * Duplicate (deep-copy) the given DNS record
+ *
+ * @param r the record
+ * @return the newly allocated record
+ */
+struct GNUNET_DNSPARSER_MxRecord *
+GNUNET_DNSPARSER_duplicate_mx_record (const struct GNUNET_DNSPARSER_MxRecord *r);
+
+
+/**
+ * Duplicate (deep-copy) the given DNS record
+ *
+ * @param r the record
+ * @return the newly allocated record
+ */
+struct GNUNET_DNSPARSER_SrvRecord *
+GNUNET_DNSPARSER_duplicate_srv_record (const struct GNUNET_DNSPARSER_SrvRecord *r);
+
+
 /* ***************** low-level deallocation API ******************** */
 
 /**
@@ -885,3 +966,5 @@ GNUNET_DNSPARSER_hex_to_bin (const char *hex,
 
 
 #endif
+
+/** @} */  /* end of group */