aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_namestore_service.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-03-07 09:59:36 +0000
committerChristian Grothoff <christian@grothoff.org>2012-03-07 09:59:36 +0000
commit2deb334f33e65baa4b0009c67ba1df53448ab5ce (patch)
treec4e13b187e808653c3d1d878b2340878199d7fb9 /src/include/gnunet_namestore_service.h
parent1eb6660144445bd81396eea0bf49d42efc07e5ed (diff)
downloadgnunet-2deb334f33e65baa4b0009c67ba1df53448ab5ce.tar.gz
gnunet-2deb334f33e65baa4b0009c67ba1df53448ab5ce.zip
-additional namestore conversion APIs added
Diffstat (limited to 'src/include/gnunet_namestore_service.h')
-rw-r--r--src/include/gnunet_namestore_service.h61
1 files changed, 52 insertions, 9 deletions
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h
index a50243d09..f2f314bfc 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -74,15 +74,6 @@ struct GNUNET_NAMESTORE_ZoneIterator;
74#define GNUNET_NAMESTORE_MAX_VALUE_SIZE (63 * 1024) 74#define GNUNET_NAMESTORE_MAX_VALUE_SIZE (63 * 1024)
75 75
76 76
77/**
78 * Convert a type name (i.e. "AAAA") to the corresponding number.
79 *
80 * @param typename name to convert
81 * @return corresponding number, UINT32_MAX on error
82 */
83uint32_t
84GNUNET_NAMESTORE_typename_to_number (const char *typename);
85
86 77
87/** 78/**
88 * Connect to the namestore service. 79 * Connect to the namestore service.
@@ -450,6 +441,58 @@ GNUNET_NAMESTORE_records_deserialize (size_t len,
450 struct GNUNET_NAMESTORE_RecordData *dest); 441 struct GNUNET_NAMESTORE_RecordData *dest);
451 442
452 443
444
445/**
446 * Convert the 'value' of a record to a string.
447 *
448 * @param type type of the record
449 * @param data value in binary encoding
450 * @param data_size number of bytes in data
451 * @return NULL on error, otherwise human-readable representation of the value
452 */
453char *
454GNUNET_NAMESTORE_value_to_string (uint32_t type,
455 const void *data,
456 size_t data_size);
457
458
459/**
460 * Convert human-readable version of a 'value' of a record to the binary
461 * representation.
462 *
463 * @param type type of the record
464 * @param s human-readable string
465 * @param data set to value in binary encoding (will be allocated)
466 * @param data_size set to number of bytes in data
467 * @return GNUNET_OK on success
468 */
469int
470GNUNET_NAMESTORE_string_to_value (uint32_t type,
471 const char *s,
472 void **data,
473 size_t *data_size);
474
475
476/**
477 * Convert a type name (i.e. "AAAA") to the corresponding number.
478 *
479 * @param typename name to convert
480 * @return corresponding number, UINT32_MAX on error
481 */
482uint32_t
483GNUNET_NAMESTORE_typename_to_number (const char *typename);
484
485
486/**
487 * Convert a type number (i.e. 1) to the corresponding type string (i.e. "A")
488 *
489 * @param type number of a type to convert
490 * @return corresponding typestring, NULL on error
491 */
492const char *
493GNUNET_NAMESTORE_number_to_typename (uint32_t type);
494
495
453#if 0 /* keep Emacsens' auto-indent happy */ 496#if 0 /* keep Emacsens' auto-indent happy */
454{ 497{
455#endif 498#endif