]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
str/txt conversion added
authorMiek Gieben <miekg@NLnetLabs.nl>
Thu, 20 Jan 2005 15:24:03 +0000 (15:24 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Thu, 20 Jan 2005 15:24:03 +0000 (15:24 +0000)
ldns/error.h
libdns.vim
str2host.c

index 2baa8996773be6593a5b73503cfdf07f2c598657..1dfaf2662dce9a037a0f8958fc36ef2d9547cd97 100644 (file)
@@ -27,7 +27,8 @@ enum ldns_enum_status
        LDNS_STATUS_ERR,
        LDNS_STATUS_INT_EXP,
        LDNS_STATUS_INVALID_IP4,
-       LDNS_STATUS_INVALID_IP6
+       LDNS_STATUS_INVALID_IP6,
+       LDNS_STATUS_INVALID_STR
 };
 typedef enum ldns_enum_status ldns_status;
 
index 94c6825f5c6e459441af27aee775f98cfd2d7658..a418c78c86c12390d7fc9962cf71f2ca8953f604 100644 (file)
@@ -61,6 +61,7 @@ syn keyword ldnsMacro LDNS_STATUS_INT_EXP
 syn keyword ldnsMacro  LDNS_STATUS_ERR
 syn keyword ldnsMacro  LDNS_STATUS_INVALID_IP4
 syn keyword ldnsMacro  LDNS_STATUS_INVALID_IP6
+syn keyword ldnsMacro  LDNS_STATUS_INVALID_STR
 
 " ldns/resolver.h
 syn keyword  ldnsType          ldns_resolver
index a3fc6414562b2675488ab0c1e119501d40cd789f..ac6a708b45e42064e6eb398e2530a339ad299c35 100644 (file)
@@ -185,14 +185,18 @@ ldns_str2rdf_aaaa(ldns_rdf **rd, const uint8_t* str)
 }
 
 /**
- * convert .... into wireformat
+ * convert a string into wireformat (think txt record)
  * \param[in] rd the rdf where to put the data
- * \param[in] str the string to be converted
+ * \param[in] str the string to be converted (NULL terminated)
  * \return ldns_status
  */
 ldns_status
 ldns_str2rdf_str(ldns_rdf **rd, const uint8_t* str)
 {
+       if (strlen(str) > 255) {
+               return LDNS_STATUS_INVALID_STR;
+       }
+       ldns_rdf_new(strlen(str), LDNS_RDF_TYPE_STR, str);
        return LDNS_STATUS_OK;
 }