GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
+ by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
* @author Igor Wronsky, Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_fs_lib.h"
+#include "gnunet_fs_service.h"
+#include "fs.h"
-
-
-/* ******************** command-line option parsing API *********************** */
+/* ******************** command-line option parsing API ******************** */
/**
* Command-line option parser function that allows the user
* @return GNUNET_OK on success
*/
int
-GNUNET_FS_getopt_configure_set_keywords (GNUNET_GETOPT_CommandLineProcessorContext* ctx,
+GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx,
void *scls,
const char *option,
const char *value)
if (u == NULL)
{
- u = GNUNET_malloc (sizeof (struct GNUNET_ECRS_URI));
+ u = GNUNET_malloc (sizeof (struct GNUNET_FS_Uri));
*uri = u;
u->type = ksk;
u->data.ksk.keywordCount = 0;
strcat (val, value);
}
}
- GNUNET_array_grow (u->data.ksk.keywords,
- u->data.ksk.keywordCount, u->data.ksk.keywordCount + 1);
- u->data.ksk.keywords[u->data.ksk.keywordCount - 1] = val;
+ GNUNET_array_append (u->data.ksk.keywords,
+ u->data.ksk.keywordCount,
+ val);
return GNUNET_OK;
}
* @return GNUNET_OK on success
*/
int
-GNUNET_FS_getopt_configure_set_metadata (GNUNET_GETOPT_CommandLineProcessorContext* ctx,
+GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx,
void *scls,
const char *option,
const char *value)
{
struct GNUNET_CONTAINER_MetaData **mm = scls;
- EXTRACTOR_KeywordType type;
+ enum EXTRACTOR_MetaType type;
const char *typename;
const char *typename_i18n;
struct GNUNET_CONTAINER_MetaData *meta;
*mm = meta;
}
- tmp = GNUNET_STRINGS_to_utf8 (NULL, value, strlen (value),
#if ENABLE_NLS
- nl_langinfo (CODESET)
+ tmp = GNUNET_STRINGS_to_utf8 (value, strlen (value),
+ nl_langinfo (CODESET));
#else
- "utf-8"
+ tmp = GNUNET_STRINGS_to_utf8 (value, strlen (value),
+ "utf-8");
#endif
- );
- type = EXTRACTOR_getHighestKeywordTypeNumber ();
+ type = EXTRACTOR_metatype_get_max ();
while (type > 0)
{
type--;
- typename = EXTRACTOR_getKeywordTypeAsString (type);
+ typename = EXTRACTOR_metatype_to_string (type);
typename_i18n = dgettext (LIBEXTRACTOR_GETTEXT_DOMAIN, typename);
if ((strlen (tmp) >= strlen (typename) + 1) &&
(tmp[strlen (typename)] == ':') &&
(0 == strncmp (typename, tmp, strlen (typename))))
{
- GNUNET_CONTAINER_meta_data_insert (meta, type, &tmp[strlen (typename) + 1]);
+ GNUNET_CONTAINER_meta_data_insert (meta,
+ "<gnunet>",
+ type,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain",
+ &tmp[strlen (typename) + 1],
+ strlen (&tmp[strlen (typename) + 1])+1);
GNUNET_free (tmp);
tmp = NULL;
break;
(tmp[strlen (typename_i18n)] == ':') &&
(0 == strncmp (typename_i18n, tmp, strlen (typename_i18n))))
{
- GNUNET_CONTAINER_meta_data_insert (meta, type,
- &tmp[strlen (typename_i18n) + 1]);
+ GNUNET_CONTAINER_meta_data_insert (meta,
+ "<gnunet>",
+ type,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain",
+ &tmp[strlen (typename_i18n) + 1],
+ strlen (&tmp[strlen (typename_i18n) + 1]) + 1);
GNUNET_free (tmp);
tmp = NULL;
break;
}
if (tmp != NULL)
{
- GNUNET_CONTAINER_meta_data_insert (meta, EXTRACTOR_UNKNOWN, tmp);
+ GNUNET_CONTAINER_meta_data_insert (meta,
+ "<gnunet>",
+ EXTRACTOR_METATYPE_UNKNOWN,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain",
+ tmp,
+ strlen(tmp) + 1);
GNUNET_free (tmp);
printf (_
("Unknown metadata type in metadata option `%s'. Using metadata type `unknown' instead.\n"),