FREE(rd);
}
+/**
+ * Create a new rdf from a string
+ * \param[in] str string to use
+ * \param[in] t type to use
+ * \return ldns_rdf*
+ */
+ldns_rdf *
+ldns_rdf_new_frm_str(const char *str, ldns_rdf_type t)
+{
+ ldns_rdf *rd;
+ ldns_status stat;
+
+ switch(t) {
+ case LDNS_RDF_TYPE_NONE:
+ stat = ldns_conv_none(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_DNAME:
+ stat = ldns_conv_dname(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_INT8:
+ stat = ldns_conv_int8(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_INT16:
+ stat = ldns_conv_int16(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_INT32:
+ stat = ldns_conv_int32(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_A:
+ stat = ldns_conv_a(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_AAAA:
+ stat = ldns_conv_aaaa(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_STR:
+ stat = ldns_conv_str(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_APL:
+ stat = ldns_conv_apl(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_B64:
+ stat = ldns_conv_b64(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_HEX:
+ stat = ldns_conv_hex(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_NSEC:
+ stat = ldns_conv_nsec(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_TYPE:
+ stat = ldns_conv_type(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_CLASS:
+ stat = ldns_conv_class(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_CERT:
+ stat = ldns_conv_cert(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_ALG:
+ stat = ldns_conv_alg(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_UNKNOWN:
+ stat = ldns_conv_unknown(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_TIME:
+ stat = ldns_conv_time(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_TSIGTIME:
+ stat = ldns_conv_tsigtime(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_SERVICE:
+ stat = ldns_conv_service(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_LOC:
+ stat = ldns_conv_loc(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_WKS:
+ stat = ldns_conv_wks(&rd, (const uint8_t*) str);
+ break;
+ case LDNS_RDF_TYPE_NSAP:
+ stat = ldns_conv_nsap(&rd, (const uint8_t*) str);
+ break;
+ default:
+ /* default default ??? */
+ break;
+ }
+ if (LDNS_STATUS_OK != stat) {
+ return NULL;
+ } else {
+ ldns_rdf_set_type(rd, t);
+ return rd;
+ }
+}
+
/**
* remove \\DDD, \\[space] and other escapes from the input
* See RFC 1035, section 5.1
#endif
/**
- * convert a short str into wireformat
+ * convert a string to a int16 in wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
*/
ldns_status
-ldns_conv_int16(ldns_rdf **rd, const char *shortstr)
+ldns_conv_int16(ldns_rdf **rd, const uint8_t *shortstr)
{
char *end = NULL;
uint16_t *r;
}
/**
- * convert a time str value to wireformat
+ * convert a time string to a time value in wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
*/
ldns_status
-ldns_conv_time(ldns_rdf **rd, const char *time)
+ldns_conv_time(ldns_rdf **rd, const uint8_t *time)
{
/* convert a time YYHM to wireformat */
uint16_t *r = NULL;
}
/**
- * convert a long (32 bits)
+ * convert a strings into a 4 byte int in wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
*/
ldns_status
-ldns_conv_int32(ldns_rdf **rd, const char *longstr)
+ldns_conv_int32(ldns_rdf **rd, const uint8_t *longstr)
{
char *end;
uint16_t *r = NULL;
}
/**
- * convert a byte (8 bits)
+ * convert a byte into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
*/
ldns_status
-ldns_conv_int8(ldns_rdf **rd, const char *bytestr)
+ldns_conv_int8(ldns_rdf **rd, const uint8_t *bytestr)
{
char *end;
uint8_t *r = NULL;
}
}
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_none(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_dname(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_a(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_aaaa(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_str(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_apl(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_b64(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_hex(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_nsec(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_type(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_class(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_cert(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_alg(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_unknown(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_tsigtime(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_service(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_loc(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_wks(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+/**
+ * convert .... into wireformat
+ * \param[in] rd the rdf where to put the data
+ * \param[in] str the string to be converted
+ * \return ldns_status
+ */
+ldns_status
+ldns_conv_nsap(ldns_rdf **rd, const uint8_t* str)
+{
+ return LDNS_STATUS_OK;
+}
+
+
+
#if 0
/**