[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26281 - in gnunet/src: fs include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26281 - in gnunet/src: fs include |
Date: |
Mon, 4 Mar 2013 02:20:48 +0100 |
Author: LRN
Date: 2013-03-04 02:20:48 +0100 (Mon, 04 Mar 2013)
New Revision: 26281
Modified:
gnunet/src/fs/fs_namespace_advertise.c
gnunet/src/include/gnunet_fs_service.h
Log:
Implement GNUNET_FS_namespace_insert_advertisement_into_metadata
Modified: gnunet/src/fs/fs_namespace_advertise.c
===================================================================
--- gnunet/src/fs/fs_namespace_advertise.c 2013-03-04 01:20:43 UTC (rev
26280)
+++ gnunet/src/fs/fs_namespace_advertise.c 2013-03-04 01:20:48 UTC (rev
26281)
@@ -200,6 +200,46 @@
/**
+ * Create an SKS uri that points to the root entry of the namespace,
+ * then insert that SKS uri into metadata.
+ *
+ * @param ns handle for the namespace that should be advertised
+ * @param meta meta-data into which namespace advertisement should be inserted
+ * @param rootEntry name of the root of the namespace (use NULL to use default)
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ */
+int
+GNUNET_FS_namespace_insert_advertisement_into_metadata (
+ struct GNUNET_FS_Namespace *ns, struct GNUNET_CONTAINER_MetaData *meta,
+ const char *rootEntry)
+{
+ struct GNUNET_FS_Uri *sks_uri;
+ char *emsg;
+ char *sks_uri_string;
+ int md_insert;
+
+ if (NULL == rootEntry)
+ rootEntry = "/";
+
+ emsg = NULL;
+ sks_uri = GNUNET_FS_uri_sks_create (ns, rootEntry, &emsg);
+ GNUNET_free_non_null (emsg);
+ if (NULL == sks_uri)
+ return GNUNET_SYSERR;
+
+ sks_uri_string = GNUNET_FS_uri_to_string (sks_uri);
+ GNUNET_FS_uri_destroy (sks_uri);
+ if (NULL == sks_uri_string)
+ return GNUNET_SYSERR;
+
+ md_insert = GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet>",
+ EXTRACTOR_METATYPE_URI, EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain", sks_uri_string, strlen (sks_uri_string) + 1);
+ GNUNET_free (sks_uri_string);
+ return md_insert;
+}
+
+/**
* Publish an advertismement for a namespace.
*
* @param h handle to the file sharing subsystem
Modified: gnunet/src/include/gnunet_fs_service.h
===================================================================
--- gnunet/src/include/gnunet_fs_service.h 2013-03-04 01:20:43 UTC (rev
26280)
+++ gnunet/src/include/gnunet_fs_service.h 2013-03-04 01:20:48 UTC (rev
26281)
@@ -2219,6 +2219,21 @@
/**
+ * Create an SKS uri that points to the root entry of the namespace,
+ * then insert that SKS uri into metadata.
+ *
+ * @param ns handle for the namespace that should be advertised
+ * @param meta meta-data into which namespace advertisement should be inserted
+ * @param rootEntry name of the root of the namespace (use NULL to use default)
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ */
+int
+GNUNET_FS_namespace_insert_advertisement_into_metadata (
+ struct GNUNET_FS_Namespace *ns, struct GNUNET_CONTAINER_MetaData *meta,
+ const char *rootEntry);
+
+
+/**
* Abort the namespace advertisement operation.
*
* @param ac context of the operation to abort.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26281 - in gnunet/src: fs include,
gnunet <=