aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2012-03-01 10:08:51 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2012-03-01 10:08:51 +0000
commitee54440407ae065e379eaa8af806aa04cc33ffeb (patch)
tree0517aacf476aa70c5135decd7be2c97bd00de9e7 /src/include
parent0fa5aa271c4ed215539af88240654b8e2c9a8729 (diff)
-new api
git-svn-id: https://gnunet.org/svn/gnunet@20158 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/include')
-rw-r--r--src/include/block_gns.h11
-rw-r--r--src/include/gnunet_namestore_service.h35
2 files changed, 40 insertions, 6 deletions
diff --git a/src/include/block_gns.h b/src/include/block_gns.h
index 4514acf6b6..04dcac3bca 100644
--- a/src/include/block_gns.h
+++ b/src/include/block_gns.h
@@ -65,6 +65,11 @@ struct GNSNameRecordBlock
{
/**
+ * The public key of the authority
+ */
+ struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded public_key;
+
+ /**
* GNUNET_RSA_Signature using RSA-key generated from the records.
*/
struct GNUNET_CRYPTO_RsaSignature signature;
@@ -74,11 +79,6 @@ struct GNSNameRecordBlock
*/
struct GNUNET_CRYPTO_RsaSignaturePurpose purpose;
- /**
- * The public key of the authority
- */
- struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded public_key;
-
/* number of records that follow */
uint32_t rd_count GNUNET_PACKED;
@@ -86,7 +86,6 @@ struct GNSNameRecordBlock
/* variable-size GNSRecordBlocks follows here */
-
};
GNUNET_NETWORK_STRUCT_END
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h
index 1302644187..5616225dfa 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -357,6 +357,41 @@ void
GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe);
+
+/* convenience APIs for serializing / deserializing GNS records */
+
+/**
+ * Calculate how many bytes we will need to serialize the given
+ * records.
+ */
+size_t
+GNUNET_NAMESTORE_records_get_size (unsigned int rd_count,
+ const struct GNUNET_NAMESTORE_RecordData *rd);
+
+/**
+ * Serialize the given records to the given destination buffer.
+ */
+ssize_t
+GNUNET_NAMESTORE_records_serialize (unsigned int rd_count,
+ const struct GNUNET_NAMESTORE_RecordData *rd,
+ size_t dest_size,
+ char *dest);
+
+
+/**
+ * @param rd_count expected number of records in 'src'
+ * @param dest array of 'rd_count' entries for storing record data;
+ * 'data' values in 'dest' will point into 'src' and will thus
+ * become invalid if 'src' is modified
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ */
+int
+GNUNET_NAMESTORE_records_deserialize (size_t len,
+ const char *src,
+ unsigned int rd_count,
+ struct GNUNET_NAMESTORE_RecordData *dest);
+
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif