gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13408 - in gnunet/src: fs include


From: gnunet
Subject: [GNUnet-SVN] r13408 - in gnunet/src: fs include
Date: Wed, 27 Oct 2010 00:20:20 +0200

Author: grothoff
Date: 2010-10-27 00:20:20 +0200 (Wed, 27 Oct 2010)
New Revision: 13408

Modified:
   gnunet/src/fs/fs_uri.c
   gnunet/src/include/gnunet_fs_service.h
Log:
api to add keyword

Modified: gnunet/src/fs/fs_uri.c
===================================================================
--- gnunet/src/fs/fs_uri.c      2010-10-26 21:36:52 UTC (rev 13407)
+++ gnunet/src/fs/fs_uri.c      2010-10-26 22:20:20 UTC (rev 13408)
@@ -766,6 +766,39 @@
 
 
 /**
+ * Add the given keyword to the set of keywords represented by the URI.
+ * Does nothing if the keyword is already present.
+ *
+ * @param uri ksk uri to modify
+ * @param keyword keyword to add
+ * @param is_mandatory is this keyword mandatory?
+ */
+void
+GNUNET_FS_uri_ksk_add_keyword (struct GNUNET_FS_Uri *uri,
+                              const char *keyword,
+                              int is_mandatory)
+{
+  unsigned int i;
+  const char *old;
+  char *n;
+
+  GNUNET_assert (uri->type == ksk);
+  for (i = 0; i < uri->data.ksk.keywordCount; i++)
+    {
+      old = uri->data.ksk.keywords[i];
+      if (0 == strcmp (&old[1], keyword))
+       return;
+    }
+  GNUNET_asprintf (&n,
+                  is_mandatory ? "+%s" : " %s",
+                  keyword);
+  GNUNET_array_append (uri->data.ksk.keywords,
+                      uri->data.ksk.keywordCount,
+                      n);
+}
+
+
+/**
  * Obtain the identity of the peer offering the data
  *
  * @param uri the location URI to inspect

Modified: gnunet/src/include/gnunet_fs_service.h
===================================================================
--- gnunet/src/include/gnunet_fs_service.h      2010-10-26 21:36:52 UTC (rev 
13407)
+++ gnunet/src/include/gnunet_fs_service.h      2010-10-26 22:20:20 UTC (rev 
13408)
@@ -115,6 +115,20 @@
 
 
 /**
+ * Add the given keyword to the set of keywords represented by the URI.
+ * Does nothing if the keyword is already present.
+ *
+ * @param uri ksk uri to modify
+ * @param keyword keyword to add
+ * @param is_mandatory is this keyword mandatory?
+ */
+void
+GNUNET_FS_uri_ksk_add_keyword (struct GNUNET_FS_Uri *uri,
+                              const char *keyword,
+                              int is_mandatory);
+
+
+/**
  * Convert a UTF-8 String to a URI.
  *
  * @param uri string to parse




reply via email to

[Prev in Thread] Current Thread [Next in Thread]