aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2013-03-04 01:20:48 +0000
committerLRN <lrn1986@gmail.com>2013-03-04 01:20:48 +0000
commita100428ffd01733a28f4e66b61c958d9367209c2 (patch)
tree02bbbe1f798a8ab987533505d5e6a3bfabbe828a /src/fs
parent93beeb2fafd68d5173587ad13f7538c4de2d000a (diff)
downloadgnunet-a100428ffd01733a28f4e66b61c958d9367209c2.tar.gz
gnunet-a100428ffd01733a28f4e66b61c958d9367209c2.zip
Implement GNUNET_FS_namespace_insert_advertisement_into_metadata
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/fs_namespace_advertise.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/fs/fs_namespace_advertise.c b/src/fs/fs_namespace_advertise.c
index 3b64e619c..554f61657 100644
--- a/src/fs/fs_namespace_advertise.c
+++ b/src/fs/fs_namespace_advertise.c
@@ -200,6 +200,46 @@ advertisement_cont (void *cls, int success,
200 200
201 201
202/** 202/**
203 * Create an SKS uri that points to the root entry of the namespace,
204 * then insert that SKS uri into metadata.
205 *
206 * @param ns handle for the namespace that should be advertised
207 * @param meta meta-data into which namespace advertisement should be inserted
208 * @param rootEntry name of the root of the namespace (use NULL to use default)
209 * @return GNUNET_OK on success, GNUNET_SYSERR on error
210 */
211int
212GNUNET_FS_namespace_insert_advertisement_into_metadata (
213 struct GNUNET_FS_Namespace *ns, struct GNUNET_CONTAINER_MetaData *meta,
214 const char *rootEntry)
215{
216 struct GNUNET_FS_Uri *sks_uri;
217 char *emsg;
218 char *sks_uri_string;
219 int md_insert;
220
221 if (NULL == rootEntry)
222 rootEntry = "/";
223
224 emsg = NULL;
225 sks_uri = GNUNET_FS_uri_sks_create (ns, rootEntry, &emsg);
226 GNUNET_free_non_null (emsg);
227 if (NULL == sks_uri)
228 return GNUNET_SYSERR;
229
230 sks_uri_string = GNUNET_FS_uri_to_string (sks_uri);
231 GNUNET_FS_uri_destroy (sks_uri);
232 if (NULL == sks_uri_string)
233 return GNUNET_SYSERR;
234
235 md_insert = GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet>",
236 EXTRACTOR_METATYPE_URI, EXTRACTOR_METAFORMAT_UTF8,
237 "text/plain", sks_uri_string, strlen (sks_uri_string) + 1);
238 GNUNET_free (sks_uri_string);
239 return md_insert;
240}
241
242/**
203 * Publish an advertismement for a namespace. 243 * Publish an advertismement for a namespace.
204 * 244 *
205 * @param h handle to the file sharing subsystem 245 * @param h handle to the file sharing subsystem