[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r7044 - in GNUnet: . src/applications/chat/lib src/applicat
From: |
gnunet |
Subject: |
[GNUnet-SVN] r7044 - in GNUnet: . src/applications/chat/lib src/applications/chat/tools src/applications/fs src/applications/fs/collection src/applications/fs/ecrs src/applications/fs/fsui src/applications/fs/gap src/applications/fs/namespace src/applications/fs/tools src/applications/fs/uritrack src/include src/util src/util/containers src/util/pseudonym |
Date: |
Tue, 3 Jun 2008 23:57:05 -0600 (MDT) |
Author: grothoff
Date: 2008-06-03 23:57:05 -0600 (Tue, 03 Jun 2008)
New Revision: 7044
Added:
GNUnet/src/include/gnunet_util_pseudonym.h
GNUnet/src/util/containers/meta.c
GNUnet/src/util/containers/metatest.c
GNUnet/src/util/pseudonym/
Removed:
GNUnet/src/applications/fs/ecrs/meta.c
GNUnet/src/applications/fs/ecrs/metatest.c
GNUnet/src/applications/fs/pseudonyms/
GNUnet/src/include/gnunet_pseudonym_lib.h
Modified:
GNUnet/configure.ac
GNUnet/src/applications/chat/lib/Makefile.am
GNUnet/src/applications/chat/lib/loopback_test.c
GNUnet/src/applications/chat/lib/messaging.c
GNUnet/src/applications/chat/tools/Makefile.am
GNUnet/src/applications/chat/tools/gnunet-chat.c
GNUnet/src/applications/fs/Makefile.am
GNUnet/src/applications/fs/collection/collection.c
GNUnet/src/applications/fs/collection/collectiontest.c
GNUnet/src/applications/fs/ecrs/Makefile.am
GNUnet/src/applications/fs/ecrs/directory.c
GNUnet/src/applications/fs/ecrs/directorytest.c
GNUnet/src/applications/fs/ecrs/ecrs.h
GNUnet/src/applications/fs/ecrs/ecrstest.c
GNUnet/src/applications/fs/ecrs/helper.c
GNUnet/src/applications/fs/ecrs/keyspace.c
GNUnet/src/applications/fs/ecrs/namespace.c
GNUnet/src/applications/fs/ecrs/namespacetest.c
GNUnet/src/applications/fs/ecrs/parser.c
GNUnet/src/applications/fs/ecrs/search.c
GNUnet/src/applications/fs/ecrs/searchtest.c
GNUnet/src/applications/fs/ecrs/uri.c
GNUnet/src/applications/fs/fsui/Makefile.am
GNUnet/src/applications/fs/fsui/basic_fsui_test.c
GNUnet/src/applications/fs/fsui/deserialize.c
GNUnet/src/applications/fs/fsui/download.c
GNUnet/src/applications/fs/fsui/download_persistence_test.c
GNUnet/src/applications/fs/fsui/fsui.c
GNUnet/src/applications/fs/fsui/fsui.h
GNUnet/src/applications/fs/fsui/recursive_download_persistence_test.c
GNUnet/src/applications/fs/fsui/recursive_download_test.c
GNUnet/src/applications/fs/fsui/search.c
GNUnet/src/applications/fs/fsui/search_linked_download_persistence_test.c
GNUnet/src/applications/fs/fsui/search_pause_resume_persistence_test.c
GNUnet/src/applications/fs/fsui/search_ranking_test.c
GNUnet/src/applications/fs/fsui/serialize.c
GNUnet/src/applications/fs/fsui/upload.c
GNUnet/src/applications/fs/fsui/upload_unindex_persistence_test.c
GNUnet/src/applications/fs/gap/test_linear_topology.c
GNUnet/src/applications/fs/gap/test_loopback.c
GNUnet/src/applications/fs/gap/test_multi_results.c
GNUnet/src/applications/fs/namespace/Makefile.am
GNUnet/src/applications/fs/namespace/info.c
GNUnet/src/applications/fs/namespace/namespace_infotest.c
GNUnet/src/applications/fs/namespace/update_info.c
GNUnet/src/applications/fs/namespace/uri.c
GNUnet/src/applications/fs/tools/Makefile.am
GNUnet/src/applications/fs/tools/gnunet-auto-share.c
GNUnet/src/applications/fs/tools/gnunet-directory.c
GNUnet/src/applications/fs/tools/gnunet-download.c
GNUnet/src/applications/fs/tools/gnunet-insert.c
GNUnet/src/applications/fs/tools/gnunet-pseudonym.c
GNUnet/src/applications/fs/tools/gnunet-search.c
GNUnet/src/applications/fs/uritrack/file_info.c
GNUnet/src/applications/fs/uritrack/tracktest.c
GNUnet/src/include/Makefile.am
GNUnet/src/include/gnunet_chat_lib.h
GNUnet/src/include/gnunet_collection_lib.h
GNUnet/src/include/gnunet_ecrs_lib.h
GNUnet/src/include/gnunet_fsui_lib.h
GNUnet/src/include/gnunet_namespace_lib.h
GNUnet/src/include/gnunet_util.h
GNUnet/src/include/gnunet_util_containers.h
GNUnet/src/util/Makefile.am
GNUnet/src/util/containers/Makefile.am
GNUnet/src/util/pseudonym/Makefile.am
GNUnet/src/util/pseudonym/common.c
GNUnet/src/util/pseudonym/common.h
GNUnet/src/util/pseudonym/info.c
GNUnet/src/util/pseudonym/info.h
GNUnet/src/util/pseudonym/info_test.c
GNUnet/src/util/pseudonym/names.c
GNUnet/src/util/pseudonym/notification.c
GNUnet/src/util/pseudonym/notification.h
Log:
update to refactored API, moving metadata and pseudonym support to gnunet util
Modified: GNUnet/configure.ac
===================================================================
--- GNUnet/configure.ac 2008-06-04 05:56:31 UTC (rev 7043)
+++ GNUnet/configure.ac 2008-06-04 05:57:05 UTC (rev 7044)
@@ -892,7 +892,6 @@
src/applications/fs/lib/Makefile
src/applications/fs/gap/Makefile
src/applications/fs/namespace/Makefile
-src/applications/fs/pseudonyms/Makefile
src/applications/fs/uritrack/Makefile
src/applications/fs/tools/Makefile
src/applications/getoption/Makefile
@@ -937,6 +936,7 @@
src/util/network/Makefile
src/util/network_client/Makefile
src/util/os/Makefile
+src/util/pseudonym/Makefile
src/util/string/Makefile
src/util/threads/Makefile
src/util/win/Makefile
Modified: GNUnet/src/applications/chat/lib/Makefile.am
===================================================================
--- GNUnet/src/applications/chat/lib/Makefile.am 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/chat/lib/Makefile.am 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -9,8 +9,6 @@
libgnunetchat_api_la_SOURCES = \
messaging.c
libgnunetchat_api_la_LIBADD = \
- $(top_builddir)/src/applications/fs/pseudonyms/libgnunetpseudonym.la \
- $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
$(top_builddir)/src/util/libgnunetutil.la
check_PROGRAMS = \
@@ -23,6 +21,5 @@
loopback_test_LDADD = \
$(top_builddir)/src/applications/testing/libgnunettesting_api.la \
$(top_builddir)/src/applications/stats/libgnunetstats_api.la \
- $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
$(top_builddir)/src/applications/chat/lib/libgnunetchat_api.la \
$(top_builddir)/src/util/libgnunetutil.la
Modified: GNUnet/src/applications/chat/lib/loopback_test.c
===================================================================
--- GNUnet/src/applications/chat/lib/loopback_test.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/chat/lib/loopback_test.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -34,7 +34,6 @@
#include "platform.h"
#include "gnunet_protocols.h"
#include "gnunet_chat_lib.h"
-#include "gnunet_ecrs_lib.h"
#include "gnunet_testing_lib.h"
#include "gnunet_stats_lib.h"
#include "gnunet_util.h"
@@ -48,7 +47,7 @@
struct Wanted
{
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
GNUNET_HashCode *sender;
@@ -68,7 +67,7 @@
receive_callback (void *cls,
struct GNUNET_CHAT_Room *room,
const GNUNET_HashCode * sender,
- const struct GNUNET_ECRS_MetaData *member_info,
+ const struct GNUNET_MetaData *member_info,
const char *message, GNUNET_CHAT_MSG_OPTIONS options)
{
struct Wanted *want = cls;
@@ -77,7 +76,7 @@
fprintf (stderr, "%s - told that %s says %s\n",
want->me,
member_info == NULL ? NULL
- : GNUNET_ECRS_meta_data_get_by_type (member_info, EXTRACTOR_TITLE),
+ : GNUNET_meta_data_get_by_type (member_info, EXTRACTOR_TITLE),
message);
#endif
GNUNET_semaphore_down (want->pre, GNUNET_YES);
@@ -86,7 +85,7 @@
((sender != NULL) &&
(want->sender != NULL) &&
(0 == memcmp (sender, want->sender, sizeof (GNUNET_HashCode))))) &&
- (GNUNET_ECRS_meta_data_test_equal (member_info,
+ (GNUNET_meta_data_test_equal (member_info,
want->meta)) &&
(options == want->opt)))
{
@@ -99,7 +98,7 @@
static int
member_list_callback (void *cls,
- const struct GNUNET_ECRS_MetaData *member_info,
+ const struct GNUNET_MetaData *member_info,
const GNUNET_RSA_PublicKey * member_id,
GNUNET_CHAT_MSG_OPTIONS options)
{
@@ -110,7 +109,7 @@
fprintf (stderr, "%s - told that %s joins\n",
want->me,
member_info == NULL ? NULL
- : GNUNET_ECRS_meta_data_get_by_type (member_info,
+ : GNUNET_meta_data_get_by_type (member_info,
EXTRACTOR_TITLE));
#endif
GNUNET_semaphore_down (want->pre, GNUNET_YES);
@@ -120,7 +119,7 @@
(want->meta == NULL)) ||
((member_info != NULL) &&
(want->meta != NULL) &&
- (GNUNET_ECRS_meta_data_test_equal (member_info,
+ (GNUNET_meta_data_test_equal (member_info,
want->meta)))) &&
(options == want->opt)))
{
@@ -160,8 +159,8 @@
struct GNUNET_CHAT_Room *r1;
struct GNUNET_CHAT_Room *r2;
unsigned int seq;
- struct GNUNET_ECRS_MetaData *meta1;
- struct GNUNET_ECRS_MetaData *meta2;
+ struct GNUNET_MetaData *meta1;
+ struct GNUNET_MetaData *meta2;
GNUNET_HashCode alice;
GNUNET_HashCode bob;
struct Wanted alice_wanted;
@@ -191,10 +190,10 @@
return -1;
}
#endif
- meta1 = GNUNET_ECRS_meta_data_create ();
- GNUNET_ECRS_meta_data_insert (meta1, EXTRACTOR_TITLE, "Alice");
- meta2 = GNUNET_ECRS_meta_data_create ();
- GNUNET_ECRS_meta_data_insert (meta2, EXTRACTOR_TITLE, "Bob");
+ meta1 = GNUNET_meta_data_create ();
+ GNUNET_meta_data_insert (meta1, EXTRACTOR_TITLE, "Alice");
+ meta2 = GNUNET_meta_data_create ();
+ GNUNET_meta_data_insert (meta2, EXTRACTOR_TITLE, "Bob");
/* alice joining */
#if DEBUG
Modified: GNUnet/src/applications/chat/lib/messaging.c
===================================================================
--- GNUnet/src/applications/chat/lib/messaging.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/chat/lib/messaging.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -29,7 +29,6 @@
#include "gnunet_util.h"
#include "gnunet_protocols.h"
#include "gnunet_chat_lib.h"
-#include "gnunet_pseudonym_lib.h"
#include "gnunet_directories.h"
#include "chat.h"
@@ -48,7 +47,7 @@
struct GNUNET_GC_Configuration *cfg;
- struct GNUNET_ECRS_MetaData *member_info;
+ struct GNUNET_MetaData *member_info;
char *room_name;
@@ -84,7 +83,7 @@
/**
* Description of the member.
*/
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
/**
* Member ID (pseudonym).
@@ -103,7 +102,7 @@
char *room;
meta_len =
- GNUNET_ECRS_meta_data_get_serialized_size (chat_room->member_info,
+ GNUNET_meta_data_get_serialized_size (chat_room->member_info,
GNUNET_YES);
room_len = strlen (chat_room->room_name);
size_of_join = sizeof (CS_chat_MESSAGE_JoinRequest) + meta_len
@@ -125,7 +124,7 @@
sizeof (GNUNET_RSA_PrivateKeyEncoded);
memcpy (room, chat_room->room_name, room_len);
if (GNUNET_SYSERR ==
- GNUNET_ECRS_meta_data_serialize (chat_room->ectx,
+ GNUNET_meta_data_serialize (chat_room->ectx,
chat_room->member_info,
&room[room_len], meta_len, GNUNET_YES))
{
@@ -158,7 +157,7 @@
CS_chat_MESSAGE_JoinNotification *join_msg;
CS_chat_MESSAGE_ReceiveNotification *received_msg;
GNUNET_HashCode id;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
struct MemberList *members;
struct MemberList *pos;
struct MemberList *prev;
@@ -220,7 +219,7 @@
}
join_msg = (CS_chat_MESSAGE_JoinNotification *) reply;
meta_len = size - sizeof (CS_chat_MESSAGE_JoinNotification);
- meta = GNUNET_ECRS_meta_data_deserialize (room->ectx,
+ meta = GNUNET_meta_data_deserialize (room->ectx,
(const char *)
&join_msg[1], meta_len);
if (meta == NULL)
@@ -232,7 +231,7 @@
pos->meta = meta;
GNUNET_hash (&join_msg->public_key,
sizeof (GNUNET_RSA_PublicKey), &pos->id);
- GNUNET_PSEUDO_add (room->ectx, room->cfg, &pos->id, meta);
+ GNUNET_pseudonym_add (room->ectx, room->cfg, &pos->id, meta);
room->member_list_callback (room->member_list_callback_cls,
meta, &join_msg->public_key,
ntohl (join_msg->msg_options));
@@ -263,7 +262,7 @@
members = pos->next;
else
prev->next = pos->next;
- GNUNET_ECRS_meta_data_destroy (pos->meta);
+ GNUNET_meta_data_destroy (pos->meta);
GNUNET_free (pos);
break;
case GNUNET_CS_PROTO_CHAT_MESSAGE_NOTIFICATION:
@@ -318,7 +317,7 @@
{
pos = members;
members = pos->next;
- GNUNET_ECRS_meta_data_destroy (pos->meta);
+ GNUNET_meta_data_destroy (pos->meta);
GNUNET_free (pos);
}
return NULL;
@@ -437,7 +436,7 @@
GNUNET_CHAT_join_room (struct GNUNET_GE_Context *ectx,
struct GNUNET_GC_Configuration *cfg,
const char *nick_name,
- struct GNUNET_ECRS_MetaData *member_info,
+ struct GNUNET_MetaData *member_info,
const char *room_name,
GNUNET_CHAT_MSG_OPTIONS msg_options,
GNUNET_CHAT_MessageCallback messageCallback,
@@ -459,7 +458,7 @@
priv_key = GNUNET_RSA_decode_key (key);
GNUNET_RSA_get_public_key (priv_key, &pub_key);
GNUNET_hash (&pub_key, sizeof (GNUNET_RSA_PublicKey), me);
- GNUNET_PSEUDO_add (ectx, cfg, me, member_info);
+ GNUNET_pseudonym_add (ectx, cfg, me, member_info);
GNUNET_RSA_free_key (priv_key);
sock = GNUNET_client_connection_create (ectx, cfg);
if (sock == NULL)
@@ -470,7 +469,7 @@
chat_room = GNUNET_malloc (sizeof (struct GNUNET_CHAT_Room));
chat_room->msg_options = msg_options;
chat_room->room_name = GNUNET_strdup (room_name);
- chat_room->member_info = GNUNET_ECRS_meta_data_duplicate (member_info);
+ chat_room->member_info = GNUNET_meta_data_duplicate (member_info);
chat_room->my_private_key = key;
chat_room->message_callback = messageCallback;
chat_room->message_callback_cls = message_cls;
@@ -487,7 +486,7 @@
{
GNUNET_free (chat_room->room_name);
GNUNET_client_connection_destroy (chat_room->sock);
- GNUNET_ECRS_meta_data_destroy (chat_room->member_info);
+ GNUNET_meta_data_destroy (chat_room->member_info);
GNUNET_free (chat_room);
GNUNET_free (key);
return NULL;
@@ -513,7 +512,7 @@
GNUNET_thread_stop_sleep (chat_room->listen_thread);
GNUNET_thread_join (chat_room->listen_thread, &unused);
GNUNET_free (chat_room->room_name);
- GNUNET_ECRS_meta_data_destroy (chat_room->member_info);
+ GNUNET_meta_data_destroy (chat_room->member_info);
GNUNET_client_connection_destroy (chat_room->sock);
GNUNET_free (chat_room->my_private_key);
GNUNET_free (chat_room);
Modified: GNUnet/src/applications/chat/tools/Makefile.am
===================================================================
--- GNUnet/src/applications/chat/tools/Makefile.am 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/chat/tools/Makefile.am 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -9,7 +9,5 @@
gnunet_chat_SOURCES = \
gnunet-chat.c
gnunet_chat_LDADD = \
- $(top_builddir)/src/applications/chat/lib/libgnunetchat_api.la \
- $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
- $(top_builddir)/src/applications/fs/pseudonyms/libgnunetpseudonym.la
+ $(top_builddir)/src/applications/chat/lib/libgnunetchat_api.la
Modified: GNUnet/src/applications/chat/tools/gnunet-chat.c
===================================================================
--- GNUnet/src/applications/chat/tools/gnunet-chat.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/chat/tools/gnunet-chat.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -29,8 +29,6 @@
#include "gnunet_protocols.h"
#include "gnunet_directories.h"
#include "gnunet_chat_lib.h"
-#include "gnunet_ecrs_lib.h"
-#include "gnunet_pseudonym_lib.h"
#define MAX_MESSAGE_LENGTH (32 * 1024)
@@ -48,7 +46,7 @@
static struct GNUNET_CHAT_Room *room;
-static struct GNUNET_ECRS_MetaData *meta;
+static struct GNUNET_MetaData *meta;
struct UserList {
struct UserList * next;
@@ -95,14 +93,14 @@
receive_callback (void *cls,
struct GNUNET_CHAT_Room *room,
const GNUNET_HashCode * sender,
- const struct GNUNET_ECRS_MetaData *meta,
+ const struct GNUNET_MetaData *meta,
const char *message, GNUNET_CHAT_MSG_OPTIONS options)
{
char *nick;
const char * fmt;
if (sender != NULL)
- nick = GNUNET_PSEUDO_id_to_name (ectx, cfg, sender);
+ nick = GNUNET_pseudonym_id_to_name (ectx, cfg, sender);
else
nick = GNUNET_strdup(_("anonymous"));
fmt = NULL;
@@ -153,7 +151,7 @@
static int
member_list_callback (void *cls,
- const struct GNUNET_ECRS_MetaData *member_info,
+ const struct GNUNET_MetaData *member_info,
const GNUNET_RSA_PublicKey * member_id,
GNUNET_CHAT_MSG_OPTIONS options)
{
@@ -163,7 +161,7 @@
struct UserList * prev;
GNUNET_hash (member_id, sizeof (GNUNET_RSA_PublicKey), &id);
- nick = GNUNET_PSEUDO_id_to_name (ectx, cfg, &id);
+ nick = GNUNET_pseudonym_id_to_name (ectx, cfg, &id);
fprintf (stdout, member_info != NULL
? _("`%s' entered the room\n") : _("`%s' left the room\n"), nick);
GNUNET_free (nick);
@@ -262,7 +260,7 @@
&receive_callback, NULL,
&member_list_callback, NULL,
&confirmation_callback, NULL, &me);
- my_name = GNUNET_PSEUDO_id_to_name (ectx, cfg, &me);
+ my_name = GNUNET_pseudonym_id_to_name (ectx, cfg, &me);
fprintf (stdout,
_("Joined room `%s' as user `%s'.\n"),
room_name, my_name);
@@ -278,10 +276,10 @@
GNUNET_CHAT_leave_room(room);
free_user_list();
GNUNET_free(nickname);
- GNUNET_ECRS_meta_data_destroy(meta);
+ GNUNET_meta_data_destroy(meta);
nickname = GNUNET_strdup(msg);
- meta = GNUNET_ECRS_meta_data_create ();
- GNUNET_ECRS_meta_data_insert (meta, EXTRACTOR_TITLE, nickname);
+ meta = GNUNET_meta_data_create ();
+ GNUNET_meta_data_insert (meta, EXTRACTOR_TITLE, nickname);
room = GNUNET_CHAT_join_room (ectx,
cfg,
nickname,
@@ -291,7 +289,7 @@
&receive_callback, NULL,
&member_list_callback, NULL,
&confirmation_callback, NULL, &me);
- my_name = GNUNET_PSEUDO_id_to_name (ectx, cfg, &me);
+ my_name = GNUNET_pseudonym_id_to_name (ectx, cfg, &me);
fprintf (stdout,
_("Changed username to `%s'.\n"),
my_name);
@@ -324,7 +322,7 @@
strstr(user, " ")[0] = '\0';
msg += strlen(user) + 1;
if (GNUNET_OK !=
- GNUNET_PSEUDO_name_to_id(ectx,
+ GNUNET_pseudonym_name_to_id(ectx,
cfg,
user,
&uid))
@@ -383,7 +381,7 @@
GNUNET_hash(&pos->pkey,
sizeof(GNUNET_RSA_PublicKey),
&pid);
- name = GNUNET_PSEUDO_id_to_name(ectx, cfg, &pid);
+ name = GNUNET_pseudonym_id_to_name(ectx, cfg, &pid);
fprintf(stdout, "`%s' ", name);
GNUNET_free(name);
pos = pos->next;
@@ -519,8 +517,8 @@
lock = GNUNET_mutex_create(GNUNET_NO);
if (room_name == NULL)
room_name = GNUNET_strdup("gnunet");
- meta = GNUNET_ECRS_meta_data_create ();
- GNUNET_ECRS_meta_data_insert (meta, EXTRACTOR_TITLE, nickname);
+ meta = GNUNET_meta_data_create ();
+ GNUNET_meta_data_insert (meta, EXTRACTOR_TITLE, nickname);
room = GNUNET_CHAT_join_room (ectx,
cfg,
nickname,
@@ -535,12 +533,12 @@
fprintf (stderr, _("Failed to join room `%s'\n"), room_name);
GNUNET_free (room_name);
GNUNET_free (nickname);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
GNUNET_mutex_destroy(lock);
GNUNET_fini (ectx, cfg);
return -1;
}
- my_name = GNUNET_PSEUDO_id_to_name (ectx, cfg, &me);
+ my_name = GNUNET_pseudonym_id_to_name (ectx, cfg, &me);
fprintf (stdout,
_
("Joined room `%s' as user `%s'.\n"),
@@ -571,7 +569,7 @@
}
GNUNET_CHAT_leave_room (room);
free_user_list();
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
GNUNET_free (room_name);
GNUNET_free (nickname);
GNUNET_fini (ectx, cfg);
Modified: GNUnet/src/applications/fs/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/Makefile.am 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/Makefile.am 2008-06-04 05:57:05 UTC (rev
7044)
@@ -1,5 +1,5 @@
SUBDIRS = \
- . gap lib ecrs uritrack pseudonyms namespace fsui collection tools
+ . gap lib ecrs uritrack namespace fsui collection tools
INCLUDES = -I$(top_srcdir)/src/include
Modified: GNUnet/src/applications/fs/collection/collection.c
===================================================================
--- GNUnet/src/applications/fs/collection/collection.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/collection/collection.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -102,7 +102,7 @@
/**
* Metadata describing the collection
*/
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
/**
* Files in the collection.
@@ -232,7 +232,7 @@
GNUNET_GE_BREAK (ectx, 0);
mlen = rsize;
}
- collectionData->meta = GNUNET_ECRS_meta_data_deserialize (ectx, pos, mlen);
+ collectionData->meta = GNUNET_meta_data_deserialize (ectx, pos, mlen);
rsize -= mlen;
pos += mlen;
GNUNET_GE_BREAK (ectx, collectionData->meta != NULL);
@@ -267,7 +267,7 @@
GNUNET_GE_ASSERT (ectx, collectionData->files[i].uri != NULL);
GNUNET_free (tmp);
collectionData->files[i].meta
- = GNUNET_ECRS_meta_data_deserialize (ectx, pos, mlen);
+ = GNUNET_meta_data_deserialize (ectx, pos, mlen);
GNUNET_GE_ASSERT (ectx, collectionData->files[i].meta != NULL);
pos += mlen;
rsize -= mlen;
@@ -285,7 +285,7 @@
if (collectionData->files[i].uri != NULL)
GNUNET_ECRS_uri_destroy (collectionData->files[i].uri);
if (collectionData->files[i].meta != NULL)
- GNUNET_ECRS_meta_data_destroy (collectionData->files[i].meta);
+ GNUNET_meta_data_destroy (collectionData->files[i].meta);
collectionData->files[i]
= collectionData->files[collectionData->file_count - 1];
GNUNET_array_grow (collectionData->files,
@@ -318,10 +318,10 @@
/* write collection data */
mlen =
- GNUNET_ECRS_meta_data_get_serialized_size (collectionData->meta,
+ GNUNET_meta_data_get_serialized_size (collectionData->meta,
GNUNET_NO);
buf = GNUNET_malloc (mlen);
- if (mlen != GNUNET_ECRS_meta_data_serialize (ectx,
+ if (mlen != GNUNET_meta_data_serialize (ectx,
collectionData->meta, buf,
mlen, GNUNET_NO))
{
@@ -353,10 +353,10 @@
for (i = 0; i < collectionData->file_count; i++)
{
mlen =
- GNUNET_ECRS_meta_data_get_serialized_size (collectionData->files[i].
+ GNUNET_meta_data_get_serialized_size (collectionData->files[i].
meta, GNUNET_NO);
buf = GNUNET_malloc (mlen);
- if (mlen != GNUNET_ECRS_meta_data_serialize (ectx,
+ if (mlen != GNUNET_meta_data_serialize (ectx,
collectionData->files[i].
meta, buf, mlen,
GNUNET_NO))
@@ -406,7 +406,7 @@
GNUNET_CO_collection_start (unsigned int anonymityLevel,
unsigned int prio,
GNUNET_Int32Time updateInterval,
- const struct GNUNET_ECRS_MetaData *meta)
+ const struct GNUNET_MetaData *meta)
{
struct GNUNET_ECRS_URI *advertisement;
struct GNUNET_ECRS_URI *rootURI;
@@ -441,7 +441,7 @@
collectionData->data.updateInterval = htonl (updateInterval);
collectionData->data.anonymityLevel = htonl (anonymityLevel);
collectionData->data.priority = htonl (prio);
- collectionData->meta = GNUNET_ECRS_meta_data_duplicate (meta);
+ collectionData->meta = GNUNET_meta_data_duplicate (meta);
GNUNET_ECRS_uri_destroy (advertisement);
GNUNET_ECRS_uri_destroy (rootURI);
GNUNET_mutex_unlock (lock);
@@ -465,10 +465,10 @@
return GNUNET_SYSERR;
}
GNUNET_ECRS_namespace_delete (ectx, cfg, &collectionData->data.pid);
- GNUNET_ECRS_meta_data_destroy (collectionData->meta);
+ GNUNET_meta_data_destroy (collectionData->meta);
for (i = 0; i < collectionData->file_count; i++)
{
- GNUNET_ECRS_meta_data_destroy (collectionData->files[i].meta);
+ GNUNET_meta_data_destroy (collectionData->files[i].meta);
GNUNET_ECRS_uri_destroy (collectionData->files[i].uri);
}
GNUNET_array_grow (collectionData->files, collectionData->file_count, 0);
@@ -483,10 +483,10 @@
*
* @return NULL if there is no collection, otherwise its metadata
*/
-struct GNUNET_ECRS_MetaData *
+struct GNUNET_MetaData *
GNUNET_CO_collection_get_name ()
{
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
GNUNET_mutex_lock (lock);
if (collectionData == NULL)
@@ -494,7 +494,7 @@
GNUNET_mutex_unlock (lock);
return NULL;
}
- meta = GNUNET_ECRS_meta_data_duplicate (collectionData->meta);
+ meta = GNUNET_meta_data_duplicate (collectionData->meta);
GNUNET_mutex_unlock (lock);
return meta;
}
@@ -679,7 +679,7 @@
}
}
fc.uri = GNUNET_ECRS_uri_duplicate (fi->uri);
- fc.meta = GNUNET_ECRS_meta_data_duplicate (fi->meta);
+ fc.meta = GNUNET_meta_data_duplicate (fi->meta);
GNUNET_array_append (collectionData->files, collectionData->file_count, fc);
collectionData->changed = GNUNET_YES;
if (ntohl (collectionData->data.updateInterval) ==
Modified: GNUnet/src/applications/fs/collection/collectiontest.c
===================================================================
--- GNUnet/src/applications/fs/collection/collectiontest.c 2008-06-04
05:56:31 UTC (rev 7043)
+++ GNUnet/src/applications/fs/collection/collectiontest.c 2008-06-04
05:57:05 UTC (rev 7044)
@@ -41,8 +41,8 @@
#endif
int ok;
struct GNUNET_ClientServerConnection *sock;
- struct GNUNET_ECRS_MetaData *meta;
- struct GNUNET_ECRS_MetaData *have;
+ struct GNUNET_MetaData *meta;
+ struct GNUNET_MetaData *have;
GNUNET_ECRS_FileInfo fi;
GNUNET_disable_entropy_gathering ();
@@ -63,8 +63,8 @@
GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS); /* give apps time to
start */
#endif
ok = GNUNET_YES;
- meta = GNUNET_ECRS_meta_data_create ();
- GNUNET_ECRS_meta_data_insert (meta, EXTRACTOR_MIMETYPE, "test/foo");
+ meta = GNUNET_meta_data_create ();
+ GNUNET_meta_data_insert (meta, EXTRACTOR_MIMETYPE, "test/foo");
sock = GNUNET_client_connection_create (NULL, cfg);
CHECK (sock != NULL);
GNUNET_CO_init (NULL, cfg);
@@ -76,8 +76,8 @@
meta));
have = GNUNET_CO_collection_get_name ();
CHECK (NULL != have);
- CHECK (GNUNET_ECRS_meta_data_test_equal (have, meta));
- GNUNET_ECRS_meta_data_destroy (have);
+ CHECK (GNUNET_meta_data_test_equal (have, meta));
+ GNUNET_meta_data_destroy (have);
fi.meta = meta;
fi.uri =
GNUNET_ECRS_string_to_uri (NULL,
@@ -88,8 +88,8 @@
GNUNET_CO_init (NULL, cfg);
have = GNUNET_CO_collection_get_name ();
CHECK (NULL != have);
- CHECK (GNUNET_ECRS_meta_data_test_equal (have, meta));
- GNUNET_ECRS_meta_data_destroy (have);
+ CHECK (GNUNET_meta_data_test_equal (have, meta));
+ GNUNET_meta_data_destroy (have);
GNUNET_CO_collection_publish_now ();
GNUNET_CO_collection_stop ();
CHECK (NULL == GNUNET_CO_collection_get_name ());
@@ -102,7 +102,7 @@
GNUNET_client_connection_destroy (sock);
}
if (meta != NULL)
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
#if START_DAEMON
GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
#endif
Modified: GNUnet/src/applications/fs/ecrs/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/ecrs/Makefile.am 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/ecrs/Makefile.am 2008-06-04 05:57:05 UTC (rev
7044)
@@ -10,7 +10,6 @@
helper.c \
indexinfo.c \
keyspace.c \
- meta.c \
namespace.c \
parser.c \
search.c \
@@ -33,7 +32,6 @@
downloadtest \
namespacetest \
uritest \
- metatest \
searchtest \
directorytest \
ecrstest \
@@ -56,11 +54,6 @@
namespacetest_LDADD = \
$(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la
-metatest_SOURCES = \
- metatest.c
-metatest_LDADD = \
- $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la
-
ecrstest_SOURCES = \
ecrstest.c
ecrstest_LDADD = \
Modified: GNUnet/src/applications/fs/ecrs/directory.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/directory.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/ecrs/directory.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -54,7 +54,7 @@
GNUNET_ECRS_directory_list_contents (struct GNUNET_GE_Context *ectx,
const char *data,
unsigned long long len,
- struct GNUNET_ECRS_MetaData **md,
+ struct GNUNET_MetaData **md,
GNUNET_ECRS_SearchResultProcessor spcb,
void *spcbClosure)
{
@@ -75,7 +75,7 @@
mdSize = ntohl (mdSize);
if (mdSize > len - 8 - sizeof (unsigned int))
return GNUNET_SYSERR; /* invalid size */
- *md = GNUNET_ECRS_meta_data_deserialize (ectx,
+ *md = GNUNET_meta_data_deserialize (ectx,
&data[8 +
sizeof (unsigned int)],
mdSize);
@@ -137,7 +137,7 @@
return GNUNET_SYSERR; /* malformed - or partial download */
}
- fi.meta = GNUNET_ECRS_meta_data_deserialize (ectx, &data[pos], mdSize);
+ fi.meta = GNUNET_meta_data_deserialize (ectx, &data[pos], mdSize);
if (fi.meta == NULL)
{
GNUNET_ECRS_uri_destroy (fi.uri);
@@ -148,7 +148,7 @@
count++;
if (spcb != NULL)
spcb (&fi, NULL, GNUNET_NO, spcbClosure);
- GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_meta_data_destroy (fi.meta);
GNUNET_ECRS_uri_destroy (fi.uri);
}
return count;
@@ -271,7 +271,7 @@
unsigned long long *len,
unsigned int count,
const GNUNET_ECRS_FileInfo * fis,
- struct GNUNET_ECRS_MetaData *meta)
+ struct GNUNET_MetaData *meta)
{
int i;
int j;
@@ -294,8 +294,8 @@
ucs = GNUNET_malloc (sizeof (char *) * count);
size = 8 + sizeof (unsigned int);
size +=
- GNUNET_ECRS_meta_data_get_serialized_size (meta,
- GNUNET_ECRS_SERIALIZE_FULL);
+ GNUNET_meta_data_get_serialized_size (meta,
+ GNUNET_SERIALIZE_FULL);
sizes = GNUNET_malloc (count * sizeof (unsigned long long));
perm = GNUNET_malloc (count * sizeof (int));
for (i = 0; i < count; i++)
@@ -304,8 +304,8 @@
ucs[i] = GNUNET_ECRS_uri_to_string (fis[i].uri);
GNUNET_GE_ASSERT (ectx, ucs[i] != NULL);
psize =
- GNUNET_ECRS_meta_data_get_serialized_size (fis[i].meta,
- GNUNET_ECRS_SERIALIZE_FULL);
+ GNUNET_meta_data_get_serialized_size (fis[i].meta,
+ GNUNET_SERIALIZE_FULL);
if (psize == -1)
{
GNUNET_GE_BREAK (ectx, 0);
@@ -335,12 +335,12 @@
pos = 8;
memcpy (*data, GNUNET_DIRECTORY_MAGIC, 8);
- ret = GNUNET_ECRS_meta_data_serialize (ectx,
+ ret = GNUNET_meta_data_serialize (ectx,
meta,
&(*data)[pos +
sizeof (unsigned int)],
size - pos - sizeof (unsigned int),
- GNUNET_ECRS_SERIALIZE_FULL);
+ GNUNET_SERIALIZE_FULL);
GNUNET_GE_ASSERT (ectx, ret != GNUNET_SYSERR);
ret = htonl (ret);
memcpy (&(*data)[pos], &ret, sizeof (unsigned int));
@@ -356,13 +356,13 @@
memcpy (&(*data)[pos], ucs[i], strlen (ucs[i]) + 1);
pos += strlen (ucs[i]) + 1;
GNUNET_free (ucs[i]);
- ret = GNUNET_ECRS_meta_data_serialize (ectx,
+ ret = GNUNET_meta_data_serialize (ectx,
fis[i].meta,
&(*data)[pos +
sizeof (unsigned int)],
size - pos -
sizeof (unsigned int),
- GNUNET_ECRS_SERIALIZE_FULL);
+ GNUNET_SERIALIZE_FULL);
GNUNET_GE_ASSERT (ectx, ret != GNUNET_SYSERR);
ret = htonl (ret);
memcpy (&(*data)[pos], &ret, sizeof (unsigned int));
Modified: GNUnet/src/applications/fs/ecrs/directorytest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/directorytest.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/ecrs/directorytest.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -48,7 +48,7 @@
for (i = 0; i < p->max; i++)
{
- if (GNUNET_ECRS_meta_data_test_equal (p->fi[i].meta,
+ if (GNUNET_meta_data_test_equal (p->fi[i].meta,
fi->meta) &&
GNUNET_ECRS_uri_test_equal (p->fi[i].uri, fi->uri))
{
@@ -66,8 +66,8 @@
char *data;
unsigned long long dlen;
GNUNET_ECRS_FileInfo *fis;
- struct GNUNET_ECRS_MetaData *meta;
- struct GNUNET_ECRS_MetaData *meta2;
+ struct GNUNET_MetaData *meta;
+ struct GNUNET_MetaData *meta2;
struct PCLS cls;
int p;
int q;
@@ -79,11 +79,11 @@
fis = GNUNET_malloc (sizeof (GNUNET_ECRS_FileInfo) * i);
for (p = 0; p < i; p++)
{
- fis[p].meta = GNUNET_ECRS_meta_data_create ();
+ fis[p].meta = GNUNET_meta_data_create ();
for (q = 0; q <= p; q++)
{
GNUNET_snprintf (txt, 128, "%u -- %u\n", p, q);
- GNUNET_ECRS_meta_data_insert (fis[p].meta,
+ GNUNET_meta_data_insert (fis[p].meta,
q %
EXTRACTOR_getHighestKeywordTypeNumber
(), txt);
@@ -95,26 +95,26 @@
fis[p].uri = GNUNET_ECRS_string_to_uri (NULL, uri);
if (fis[p].uri == NULL)
{
- GNUNET_ECRS_meta_data_destroy (fis[p].meta);
+ GNUNET_meta_data_destroy (fis[p].meta);
while (--p > 0)
{
- GNUNET_ECRS_meta_data_destroy (fis[p].meta);
+ GNUNET_meta_data_destroy (fis[p].meta);
GNUNET_ECRS_uri_destroy (fis[p].uri);
}
GNUNET_free (fis);
ABORT (); /* error in testcase */
}
}
- meta = GNUNET_ECRS_meta_data_create ();
- GNUNET_ECRS_meta_data_insert (meta, EXTRACTOR_TITLE, "A title");
- GNUNET_ECRS_meta_data_insert (meta, EXTRACTOR_AUTHOR, "An author");
+ meta = GNUNET_meta_data_create ();
+ GNUNET_meta_data_insert (meta, EXTRACTOR_TITLE, "A title");
+ GNUNET_meta_data_insert (meta, EXTRACTOR_AUTHOR, "An author");
if (GNUNET_OK !=
GNUNET_ECRS_directory_create (NULL, &data, &dlen, i, fis, meta))
{
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
for (p = 0; p < i; p++)
{
- GNUNET_ECRS_meta_data_destroy (fis[p].meta);
+ GNUNET_meta_data_destroy (fis[p].meta);
GNUNET_ECRS_uri_destroy (fis[p].uri);
}
GNUNET_free (fis);
@@ -130,18 +130,18 @@
ret = 1;
goto END;
}
- if (!GNUNET_ECRS_meta_data_test_equal (meta, meta2))
+ if (!GNUNET_meta_data_test_equal (meta, meta2))
{
ret = 1;
goto END;
}
END:
GNUNET_free (data);
- GNUNET_ECRS_meta_data_destroy (meta);
- GNUNET_ECRS_meta_data_destroy (meta2);
+ GNUNET_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta2);
for (p = 0; p < i; p++)
{
- GNUNET_ECRS_meta_data_destroy (fis[p].meta);
+ GNUNET_meta_data_destroy (fis[p].meta);
GNUNET_ECRS_uri_destroy (fis[p].uri);
}
GNUNET_free (fis);
Modified: GNUnet/src/applications/fs/ecrs/ecrs.h
===================================================================
--- GNUnet/src/applications/fs/ecrs/ecrs.h 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/ecrs/ecrs.h 2008-06-04 05:57:05 UTC (rev
7044)
@@ -104,22 +104,6 @@
} data;
} URI;
-typedef struct
-{
- EXTRACTOR_KeywordType type;
- char *data;
-} Item;
-
-/**
- * Meta data to associate with a file, directory or namespace.
- */
-typedef struct GNUNET_ECRS_MetaData
-{
- unsigned int itemCount;
- Item *items;
-} MetaData;
-
-
void GNUNET_ECRS_encryptInPlace (const GNUNET_HashCode * hc,
void *data, unsigned int len);
Modified: GNUnet/src/applications/fs/ecrs/ecrstest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/ecrstest.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/ecrs/ecrstest.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -101,14 +101,14 @@
NULL, &testTerminate, NULL, &uri);
if (ret != GNUNET_SYSERR)
{
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
struct GNUNET_ECRS_URI *key;
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
key = GNUNET_ECRS_keyword_string_to_uri (NULL, name);
ret = GNUNET_ECRS_publish_under_keyword (NULL, cfg, key, 0, 0,
GNUNET_get_time () + 10 * GNUNET_CRON_MINUTES, /* expire */
uri, meta);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
want = uri;
GNUNET_free (name);
if (ret == GNUNET_OK)
Modified: GNUnet/src/applications/fs/ecrs/helper.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/helper.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/ecrs/helper.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -26,6 +26,7 @@
*/
#include "platform.h"
+#include "gnunet_util.h"
#include "gnunet_ecrs_lib.h"
#include "ecrs.h"
@@ -188,4 +189,239 @@
return uri;
}
+static char *mimeMap[][2] = {
+ {"application/bz2", ".bz2"},
+ {"application/gnunet-directory", ".gnd"},
+ {"application/java", ".class"},
+ {"application/msword", ".doc"},
+ {"application/ogg", ".ogg"},
+ {"application/pdf", ".pdf"},
+ {"application/pgp-keys", ".key"},
+ {"application/pgp-signature", ".pgp"},
+ {"application/postscript", ".ps"},
+ {"application/rar", ".rar"},
+ {"application/rtf", ".rtf"},
+ {"application/xml", ".xml"},
+ {"application/x-debian-package", ".deb"},
+ {"application/x-dvi", ".dvi"},
+ {"applixation/x-flac", ".flac"},
+ {"applixation/x-gzip", ".gz"},
+ {"application/x-java-archive", ".jar"},
+ {"application/x-java-vm", ".class"},
+ {"application/x-python-code", ".pyc"},
+ {"application/x-redhat-package-manager", ".rpm"},
+ {"application/x-rpm", ".rpm"},
+ {"application/x-tar", ".tar"},
+ {"application/x-tex-pk", ".pk"},
+ {"application/x-texinfo", ".texinfo"},
+ {"application/x-xcf", ".xcf"},
+ {"application/x-xfig", ".xfig"},
+ {"application/zip", ".zip"},
+
+ {"audio/midi", ".midi"},
+ {"audio/mpeg", ".mp3"},
+ {"audio/real", ".rm"},
+ {"audio/x-wav", ".wav"},
+
+ {"image/gif", ".gif"},
+ {"image/jpeg", ".jpg"},
+ {"image/pcx", ".pcx"},
+ {"image/png", ".png"},
+ {"image/tiff", ".tiff"},
+ {"image/x-ms-bmp", ".bmp"},
+ {"image/x-xpixmap", ".xpm"},
+
+ {"text/css", ".css"},
+ {"text/html", ".html"},
+ {"text/plain", ".txt"},
+ {"text/rtf", ".rtf"},
+ {"text/x-c++hdr", ".h++"},
+ {"text/x-c++src", ".c++"},
+ {"text/x-chdr", ".h"},
+ {"text/x-csrc", ".c"},
+ {"text/x-java", ".java"},
+ {"text/x-moc", ".moc"},
+ {"text/x-pascal", ".pas"},
+ {"text/x-perl", ".pl"},
+ {"text/x-python", ".py"},
+ {"text/x-tex", ".tex"},
+
+ {"video/avi", ".avi"},
+ {"video/mpeg", ".mpeg"},
+ {"video/quicktime", ".qt"},
+ {"video/real", ".rm"},
+ {"video/x-msvideo", ".avi"},
+ {NULL, NULL},
+};
+
+/**
+ * Suggest a better filename for a file (and do the
+ * renaming).
+ * @return the new filename
+ */
+char *
+GNUNET_ECRS_suggest_better_filename (struct GNUNET_GE_Context *ectx,
+ const char *filename)
+{
+ EXTRACTOR_ExtractorList *l;
+ EXTRACTOR_KeywordList *list;
+ const char *key;
+ const char *mime;
+ char *path;
+ int i;
+ unsigned int j;
+ char *renameTo;
+ char *ret;
+ struct stat filestat;
+
+ path = GNUNET_strdup (filename);
+ i = strlen (path);
+ while ((i > 0) && (path[i] != DIR_SEPARATOR))
+ i--;
+ path[i] = '\0';
+ ret = NULL;
+ l = EXTRACTOR_loadDefaultLibraries ();
+ list = EXTRACTOR_getKeywords (l, filename);
+ key = EXTRACTOR_extractLast (EXTRACTOR_TITLE, list);
+ if (key == NULL)
+ key = EXTRACTOR_extractLast (EXTRACTOR_DESCRIPTION, list);
+ if (key == NULL)
+ key = EXTRACTOR_extractLast (EXTRACTOR_COMMENT, list);
+ if (key == NULL)
+ key = EXTRACTOR_extractLast (EXTRACTOR_SUBJECT, list);
+ if (key == NULL)
+ key = EXTRACTOR_extractLast (EXTRACTOR_ALBUM, list);
+ if (key == NULL)
+ key = EXTRACTOR_extractLast (EXTRACTOR_UNKNOWN, list);
+ mime = EXTRACTOR_extractLast (EXTRACTOR_MIMETYPE, list);
+ if (mime != NULL)
+ {
+ i = 0;
+ while ((mimeMap[i][0] != NULL) && (0 != strcmp (mime, mimeMap[i][0])))
+ i++;
+ if (mimeMap[i][1] == NULL)
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
+ "Did not find mime type `%s' in extension list.\n",
+ mime);
+ mime = mimeMap[i][1];
+ }
+ if (key == NULL)
+ {
+ key = &filename[strlen (filename) - 1];
+ while ((key != filename) && (key[0] != DIR_SEPARATOR))
+ key--;
+ if (key[0] == DIR_SEPARATOR)
+ key++;
+ }
+ if (mime != NULL)
+ {
+ if (0 == strcmp (&key[strlen (key) - strlen (mime)], mime))
+ mime = NULL;
+ }
+ if (mime == NULL)
+ {
+ i = strlen (filename);
+ while ((i > 0) &&
+ (filename[i] != '.') && (filename[i] != DIR_SEPARATOR))
+ i--;
+ if (filename[i] == '.')
+ mime = &filename[i];
+ }
+ if (mime == NULL)
+ {
+ renameTo =
+ GNUNET_malloc (strlen (path) + strlen (key) +
+ strlen (DIR_SEPARATOR_STR) + 20);
+ strcpy (renameTo, path);
+ if (path[strlen (path) - 1] != DIR_SEPARATOR)
+ strcat (renameTo, DIR_SEPARATOR_STR);
+ strcat (renameTo, key);
+ }
+ else
+ {
+ renameTo =
+ GNUNET_malloc (strlen (path) + strlen (key) + strlen (mime) +
+ strlen (DIR_SEPARATOR_STR) + 20);
+ strcpy (renameTo, path);
+ if (path[strlen (path) - 1] != DIR_SEPARATOR)
+ strcat (renameTo, DIR_SEPARATOR_STR);
+ strcat (renameTo, key);
+ if (strcasecmp (renameTo + strlen (renameTo) - strlen (mime), mime) !=
+ 0)
+ strcat (renameTo, mime);
+ }
+ for (i = strlen (renameTo) - 1; i >= 0; i--)
+ if (!isprint (renameTo[i]))
+ renameTo[i] = '_';
+ else if (renameTo[i] == '.' && i > 0 && renameTo[i - 1] == '.')
+ {
+ /* remove .. to avoid directory traversal */
+ renameTo[i - 1] = renameTo[i] = '_';
+ i--;
+ }
+ if (0 != strcmp (renameTo, filename))
+ {
+ if (0 == STAT (renameTo, &filestat))
+ {
+ i = strlen (renameTo);
+ j = 0;
+ do
+ {
+ GNUNET_snprintf (&renameTo[i], 19, ".%u", j++);
+ if (j > 100000)
+ break;
+ }
+ while (0 == STAT (renameTo, &filestat));
+ }
+
+ if (0 != STAT (renameTo, &filestat))
+ {
+ if (0 != RENAME (filename, renameTo))
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
+ _("Renaming of file `%s' to `%s' failed: %s\n"),
+ filename, renameTo, STRERROR (errno));
+ else
+ ret = GNUNET_strdup (renameTo);
+ }
+ else
+ {
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
+ _
+ ("Could not rename file `%s' to `%s': file exists\n"),
+ filename, renameTo);
+ }
+ }
+ GNUNET_free (path);
+ GNUNET_free (renameTo);
+ EXTRACTOR_freeKeywords (list);
+ EXTRACTOR_removeAll (l);
+ return ret;
+}
+
+/**
+ * Does the meta-data claim that this is a directory?
+ * Checks if the mime-type is that of a GNUnet directory.
+ */
+int
+GNUNET_meta_data_test_for_directory (const struct GNUNET_MetaData * md)
+{
+ char * mime;
+ int ret;
+
+ mime = GNUNET_meta_data_get_by_type(md, EXTRACTOR_MIMETYPE);
+ if (mime == NULL)
+ return GNUNET_SYSERR;
+ if (0 == strcmp (mime, GNUNET_DIRECTORY_MIME))
+ ret = GNUNET_YES;
+ else
+ ret = GNUNET_NO;
+ GNUNET_free(mime);
+ return ret;
+}
+
+
+
/* end of helper.c */
Modified: GNUnet/src/applications/fs/ecrs/keyspace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/keyspace.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/ecrs/keyspace.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -86,9 +86,9 @@
}
dstURI = (const char *) &kb[1];
j++;
- fi.meta = GNUNET_ECRS_meta_data_deserialize (ectx,
- &((const char *) kb)[j],
- size - j);
+ fi.meta = GNUNET_meta_data_deserialize (ectx,
+ &((const char *) kb)[j],
+ size - j);
if (fi.meta == NULL)
{
GNUNET_GE_BREAK (ectx, 0); /* kblock malformed */
@@ -98,11 +98,11 @@
if (fi.uri == NULL)
{
GNUNET_GE_BREAK (ectx, 0); /* kblock malformed */
- GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_meta_data_destroy (fi.meta);
return GNUNET_SYSERR;
}
GNUNET_ECRS_uri_destroy (fi.uri);
- GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_meta_data_destroy (fi.meta);
return GNUNET_OK;
}
@@ -126,7 +126,7 @@
unsigned int priority,
GNUNET_CronTime expirationTime,
const struct GNUNET_ECRS_URI *dst,
- const struct GNUNET_ECRS_MetaData *md)
+ const struct GNUNET_MetaData *md)
{
struct GNUNET_ClientServerConnection *sock;
GNUNET_DatastoreValue *value;
@@ -156,8 +156,8 @@
return GNUNET_SYSERR;
}
mdsize =
- GNUNET_ECRS_meta_data_get_serialized_size (md,
- GNUNET_ECRS_SERIALIZE_PART);
+ GNUNET_meta_data_get_serialized_size (md,
+ GNUNET_SERIALIZE_PART);
dstURI = GNUNET_ECRS_uri_to_string (dst);
size = mdsize + sizeof (GNUNET_EC_KBlock) + strlen (dstURI) + 1;
if (size > MAX_KBLOCK_SIZE)
@@ -168,12 +168,12 @@
kb->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD);
memcpy (&kb[1], dstURI, strlen (dstURI) + 1);
mdsize = size - sizeof (GNUNET_EC_KBlock) - strlen (dstURI) - 1;
- mdsize = GNUNET_ECRS_meta_data_serialize (ectx,
- md,
- &((char *)
- &kb[1])[strlen (dstURI) +
- 1], mdsize,
- GNUNET_ECRS_SERIALIZE_PART);
+ mdsize = GNUNET_meta_data_serialize (ectx,
+ md,
+ &((char *)
+ &kb[1])[strlen (dstURI) +
+ 1], mdsize,
+ GNUNET_SERIALIZE_PART);
if (mdsize == -1)
{
GNUNET_GE_BREAK (ectx, 0);
@@ -191,13 +191,13 @@
memcpy (&kb[1], dstURI, strlen (dstURI) + 1);
GNUNET_GE_ASSERT (ectx,
mdsize ==
- GNUNET_ECRS_meta_data_serialize (ectx,
- md,
- &((char *)
- &kb[1])[strlen
- (dstURI) +
- 1], mdsize,
-
GNUNET_ECRS_SERIALIZE_FULL));
+ GNUNET_meta_data_serialize (ectx,
+ md,
+ &((char *)
+ &kb[1])[strlen
+ (dstURI) +
+ 1], mdsize,
+ GNUNET_SERIALIZE_FULL));
}
value->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
value->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD);
Deleted: GNUnet/src/applications/fs/ecrs/meta.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/meta.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/ecrs/meta.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -1,940 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2003, 2004, 2005, 2006 Christian Grothoff (and other contributing
authors)
-
- 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
- option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-/**
- * @file applications/fs/ecrs/meta.c
- * @brief Meta-data handling
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include "ecrs.h"
-#include "gnunet_ecrs_lib.h"
-#include <zlib.h>
-
-#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS
-
-/**
- * Create a fresh MetaData token.
- */
-MetaData *
-GNUNET_ECRS_meta_data_create ()
-{
- MetaData *ret;
- ret = GNUNET_malloc (sizeof (MetaData));
- ret->items = NULL;
- ret->itemCount = 0;
- return ret;
-}
-
-/**
- * Free meta data.
- */
-void
-GNUNET_ECRS_meta_data_destroy (MetaData * md)
-{
- int i;
- for (i = 0; i < md->itemCount; i++)
- GNUNET_free (md->items[i].data);
- GNUNET_array_grow (md->items, md->itemCount, 0);
- GNUNET_free (md);
-}
-
-/**
- * Add the current time as the publication date
- * to the meta-data.
- */
-void
-GNUNET_ECRS_meta_data_add_publication_date (MetaData * md)
-{
- char *dat;
- GNUNET_Int32Time t;
-
- GNUNET_get_time_int32 (&t);
- GNUNET_ECRS_meta_data_delete (md, EXTRACTOR_PUBLICATION_DATE, NULL);
- dat = GNUNET_int32_time_to_string (&t);
- GNUNET_ECRS_meta_data_insert (md, EXTRACTOR_PUBLICATION_DATE, dat);
- GNUNET_free (dat);
-}
-
-/**
- * Extend metadata.
- * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists
- */
-int
-GNUNET_ECRS_meta_data_insert (MetaData * md,
- EXTRACTOR_KeywordType type, const char *data)
-{
- int idx;
- char *p;
-
- GNUNET_GE_ASSERT (NULL, data != NULL);
- for (idx = 0; idx < md->itemCount; idx++)
- {
- if ((md->items[idx].type == type) &&
- (0 == strcmp (md->items[idx].data, data)))
- return GNUNET_SYSERR;
- }
- idx = md->itemCount;
- GNUNET_array_grow (md->items, md->itemCount, md->itemCount + 1);
- md->items[idx].type = type;
- md->items[idx].data = p = GNUNET_strdup (data);
-
- /* remove hints to OS */
- if (type == EXTRACTOR_FILENAME)
- {
- while ((p = strchr (p, '\\')))
- *p = '/';
- }
-
- return GNUNET_OK;
-}
-
-/**
- * Remove an item.
- * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md
- */
-int
-GNUNET_ECRS_meta_data_delete (MetaData * md,
- EXTRACTOR_KeywordType type, const char *data)
-{
- int idx;
- int ret = GNUNET_SYSERR;
- for (idx = 0; idx < md->itemCount; idx++)
- {
- if ((md->items[idx].type == type) &&
- ((data == NULL) || (0 == strcmp (md->items[idx].data, data))))
- {
- GNUNET_free (md->items[idx].data);
- md->items[idx] = md->items[md->itemCount - 1];
- GNUNET_array_grow (md->items, md->itemCount, md->itemCount - 1);
- if (data == NULL)
- {
- ret = GNUNET_OK;
- continue;
- }
- return GNUNET_OK;
- }
- }
- return ret;
-}
-
-/**
- * Iterate over MD entries, excluding thumbnails.
- *
- * @return number of entries
- */
-int
-GNUNET_ECRS_meta_data_get_contents (const MetaData * md,
- GNUNET_ECRS_MetaDataProcessor iterator,
- void *closure)
-{
- int i;
- int sub;
-
- sub = 0;
- for (i = md->itemCount - 1; i >= 0; i--)
- {
- if (md->items[i].type != EXTRACTOR_THUMBNAIL_DATA)
- {
- if ((iterator != NULL) &&
- (GNUNET_OK != iterator (md->items[i].type,
- md->items[i].data, closure)))
- return GNUNET_SYSERR;
- }
- else
- sub++;
- }
- return md->itemCount - sub;
-}
-
-/**
- * Iterate over MD entries
- *
- * @return number of entries
- */
-char *
-GNUNET_ECRS_meta_data_get_by_type (const MetaData * md,
- EXTRACTOR_KeywordType type)
-{
- int i;
-
- for (i = md->itemCount - 1; i >= 0; i--)
- if (type == md->items[i].type)
- return GNUNET_strdup (md->items[i].data);
- return NULL;
-}
-
-/**
- * Iterate over MD entries
- *
- * @return number of entries
- */
-char *
-GNUNET_ECRS_meta_data_get_first_by_types (const MetaData * md, ...)
-{
- char *ret;
- va_list args;
- EXTRACTOR_KeywordType type;
-
- ret = NULL;
- va_start (args, md);
- while (1)
- {
- type = va_arg (args, EXTRACTOR_KeywordType);
- if (type == -1)
- break;
- ret = GNUNET_ECRS_meta_data_get_by_type (md, type);
- if (ret != NULL)
- break;
- }
- va_end (args);
- return ret;
-}
-
-
-/**
- * This function can be used to decode the binary data
- * stream produced by the thumbnailextractor.
- *
- * @param in 0-terminated string from the meta-data
- * @return 1 on error, 0 on success
- */
-static int
-decodeThumbnail (const char *in, unsigned char **out, size_t * outSize)
-{
- unsigned char *buf;
- size_t pos;
- size_t wpos;
- unsigned char marker;
- size_t i;
- size_t end;
- size_t inSize;
-
- inSize = strlen (in);
- if (inSize == 0)
- {
- *out = NULL;
- *outSize = 0;
- return 1;
- }
-
- buf = malloc (inSize); /* slightly more than needed ;-) */
- *out = buf;
-
- pos = 0;
- wpos = 0;
- while (pos < inSize)
- {
- end = pos + 255; /* 255 here: count the marker! */
- if (end > inSize)
- end = inSize;
- marker = in[pos++];
- for (i = pos; i < end; i++)
- buf[wpos++] = (in[i] == marker) ? 0 : in[i];
- pos = end;
- }
- *outSize = wpos;
- return 0;
-}
-
-/**
- * Get a thumbnail from the meta-data (if present).
- *
- * @param thumb will be set to the thumbnail data. Must be
- * freed by the caller!
- * @return number of bytes in thumbnail, 0 if not available
- */
-size_t
-GNUNET_ECRS_meta_data_get_thumbnail (const struct GNUNET_ECRS_MetaData * md,
- unsigned char **thumb)
-{
- char *encoded;
- int ret;
- size_t size;
-
- encoded = GNUNET_ECRS_meta_data_get_by_type (md, EXTRACTOR_THUMBNAIL_DATA);
- if (encoded == NULL)
- return 0;
- if (strlen (encoded) == 0)
- {
- GNUNET_free (encoded);
- return 0; /* invalid */
- }
- *thumb = NULL;
- ret = decodeThumbnail (encoded, thumb, &size);
- GNUNET_free (encoded);
- if (ret == 0)
- return size;
- else
- return 0;
-}
-
-/**
- * Duplicate MetaData.
- */
-MetaData *
-GNUNET_ECRS_meta_data_duplicate (const MetaData * md)
-{
- int i;
- MetaData *ret;
-
- if (md == NULL)
- return NULL;
- ret = GNUNET_ECRS_meta_data_create ();
- for (i = md->itemCount - 1; i >= 0; i--)
- GNUNET_ECRS_meta_data_insert (ret, md->items[i].type, md->items[i].data);
- return ret;
-}
-
-/**
- * Extract meta-data from a file.
- *
- * @return GNUNET_SYSERR on error, otherwise the number
- * of meta-data items obtained
- */
-int
-GNUNET_ECRS_meta_data_extract_from_file (struct GNUNET_GE_Context *ectx,
- MetaData * md,
- const char *filename,
- EXTRACTOR_ExtractorList * extractors)
-{
- EXTRACTOR_KeywordList *head;
- EXTRACTOR_KeywordList *pos;
- int ret;
-
- if (filename == NULL)
- return GNUNET_SYSERR;
- if (extractors == NULL)
- return 0;
- head = EXTRACTOR_getKeywords (extractors, filename);
- head = EXTRACTOR_removeDuplicateKeywords (head,
-
EXTRACTOR_DUPLICATES_REMOVE_UNKNOWN);
- pos = head;
- ret = 0;
- while (pos != NULL)
- {
- if (GNUNET_OK ==
- GNUNET_ECRS_meta_data_insert (md, pos->keywordType, pos->keyword))
- ret++;
- pos = pos->next;
- }
- EXTRACTOR_freeKeywords (head);
- return ret;
-}
-
-static unsigned int
-tryCompression (char *data, unsigned int oldSize)
-{
- char *tmp;
- uLongf dlen;
-
-#ifdef compressBound
- dlen = compressBound (oldSize);
-#else
- dlen = oldSize + (oldSize / 100) + 20;
- /* documentation says 100.1% oldSize + 12 bytes, but we
- should be able to overshoot by more to be safe */
-#endif
- tmp = GNUNET_malloc (dlen);
- if (Z_OK == compress2 ((Bytef *) tmp,
- &dlen, (const Bytef *) data, oldSize, 9))
- {
- if (dlen < oldSize)
- {
- memcpy (data, tmp, dlen);
- GNUNET_free (tmp);
- return dlen;
- }
- }
- GNUNET_free (tmp);
- return oldSize;
-}
-
-/**
- * Decompress input, return the decompressed data
- * as output, set outputSize to the number of bytes
- * that were found.
- *
- * @return NULL on error
- */
-static char *
-decompress (const char *input,
- unsigned int inputSize, unsigned int outputSize)
-{
- char *output;
- uLongf olen;
-
- olen = outputSize;
- output = GNUNET_malloc (olen);
- if (Z_OK == uncompress ((Bytef *) output,
- &olen, (const Bytef *) input, inputSize))
- {
- return output;
- }
- else
- {
- GNUNET_free (output);
- return NULL;
- }
-}
-
-/**
- * Flag in 'version' that indicates compressed meta-data.
- */
-#define HEADER_COMPRESSED 0x80000000
-
-/**
- * Bits in 'version' that give the version number.
- */
-#define HEADER_VERSION_MASK 0x7FFFFFFF
-
-typedef struct
-{
- /**
- * The version of the MD serialization.
- * The highest bit is used to indicate
- * compression.
- */
- unsigned int version;
-
- /**
- * How many MD entries are there?
- */
- unsigned int entries;
-
- /**
- * Size of the MD (decompressed)
- */
- unsigned int size;
-
- /**
- * This is followed by 'entries' values of type 'unsigned int' that
- * correspond to EXTRACTOR_KeywordTypes. After that, the meta-data
- * keywords follow (0-terminated). The MD block always ends with
- * 0-termination, padding with 0 until a multiple of 8 bytes.
- */
-
-} MetaDataHeader;
-
-/**
- * Serialize meta-data to target.
- *
- * @param size maximum number of bytes available
- * @param part is it ok to just write SOME of the
- * meta-data to match the size constraint,
- * possibly discarding some data? GNUNET_YES/GNUNET_NO.
- * @return number of bytes written on success,
- * GNUNET_SYSERR on error (typically: not enough
- * space)
- */
-int
-GNUNET_ECRS_meta_data_serialize (struct GNUNET_GE_Context *ectx,
- const MetaData * md,
- char *target, unsigned int max, int part)
-{
- MetaDataHeader *hdr;
- size_t size;
- size_t pos;
- int i;
- int len;
- unsigned int ic;
-
- if (max < sizeof (MetaDataHeader))
- return GNUNET_SYSERR; /* far too small */
- ic = md->itemCount;
- hdr = NULL;
- while (1)
- {
- size = sizeof (MetaDataHeader);
- size += sizeof (unsigned int) * ic;
- for (i = 0; i < ic; i++)
- size += 1 + strlen (md->items[i].data);
- while (size % 8 != 0)
- size++;
- hdr = GNUNET_malloc (size);
- hdr->version = htonl (0);
- hdr->entries = htonl (ic);
- for (i = 0; i < ic; i++)
- ((unsigned int *) &hdr[1])[i] =
- htonl ((unsigned int) md->items[i].type);
- pos = sizeof (MetaDataHeader);
- pos += sizeof (unsigned int) * ic;
- for (i = 0; i < ic; i++)
- {
- len = strlen (md->items[i].data) + 1;
- memcpy (&((char *) hdr)[pos], md->items[i].data, len);
- pos += len;
- }
-
- hdr->size = htonl (size);
- if ((part & GNUNET_ECRS_SERIALIZE_NO_COMPRESS) == 0)
- {
- pos = tryCompression ((char *) &hdr[1],
- size - sizeof (MetaDataHeader));
- }
- else
- {
- pos = size - sizeof (MetaDataHeader);
- }
- if (pos < size - sizeof (MetaDataHeader))
- {
- hdr->version = htonl (HEADER_COMPRESSED);
- size = pos + sizeof (MetaDataHeader);
- }
- if (size <= max)
- break;
- GNUNET_free (hdr);
- hdr = NULL;
-
- if ((part & GNUNET_ECRS_SERIALIZE_PART) == 0)
- {
- return GNUNET_SYSERR; /* does not fit! */
- }
- /* partial serialization ok, try again with less meta-data */
- if (size > 2 * max)
- ic = ic * 2 / 3; /* still far too big, make big reductions */
- else
- ic--; /* small steps, we're close */
- }
- GNUNET_GE_ASSERT (ectx, size <= max);
- memcpy (target, hdr, size);
- GNUNET_free (hdr);
- /* extra check: deserialize! */
-#if EXTRA_CHECKS
- {
- MetaData *mdx;
- mdx = GNUNET_ECRS_meta_data_deserialize (ectx, target, size);
- GNUNET_GE_ASSERT (ectx, NULL != mdx);
- GNUNET_ECRS_meta_data_destroy (mdx);
- }
-#endif
- return size;
-}
-
-/**
- * Estimate (!) the size of the meta-data in
- * serialized form. The estimate MAY be higher
- * than what is strictly needed.
- */
-unsigned int
-GNUNET_ECRS_meta_data_get_serialized_size (const MetaData * md, int part)
-{
- MetaDataHeader *hdr;
- size_t size;
- size_t pos;
- int i;
- int len;
- unsigned int ic;
-
- ic = md->itemCount;
- size = sizeof (MetaDataHeader);
- size += sizeof (unsigned int) * ic;
- for (i = 0; i < ic; i++)
- size += 1 + strlen (md->items[i].data);
- while (size % 8 != 0)
- size++;
- hdr = GNUNET_malloc (size);
- hdr->version = htonl (0);
- hdr->entries = htonl (md->itemCount);
- for (i = 0; i < ic; i++)
- ((unsigned int *) &hdr[1])[i] = htonl ((unsigned int) md->items[i].type);
- pos = sizeof (MetaDataHeader);
- pos += sizeof (unsigned int) * md->itemCount;
- for (i = 0; i < ic; i++)
- {
- len = strlen (md->items[i].data) + 1;
- memcpy (&((char *) hdr)[pos], md->items[i].data, len);
- pos += len;
- }
- if ((part & GNUNET_ECRS_SERIALIZE_NO_COMPRESS) == 0)
- {
- pos = tryCompression ((char *) &hdr[1], size - sizeof (MetaDataHeader));
- }
- else
- {
- pos = size - sizeof (MetaDataHeader);
- }
- if (pos < size - sizeof (MetaDataHeader))
- size = pos + sizeof (MetaDataHeader);
-
- GNUNET_free (hdr);
-
- return size;
-}
-
-/**
- * Deserialize meta-data. Initializes md.
- * @param size number of bytes available
- * @return MD on success, NULL on error (i.e.
- * bad format)
- */
-struct GNUNET_ECRS_MetaData *
-GNUNET_ECRS_meta_data_deserialize (struct GNUNET_GE_Context *ectx,
- const char *input, unsigned int size)
-{
- MetaData *md;
- const MetaDataHeader *hdr;
- unsigned int ic;
- char *data;
- unsigned int dataSize;
- int compressed;
- int i;
- unsigned int pos;
- int len;
-
- if (size < sizeof (MetaDataHeader))
- return NULL;
- hdr = (const MetaDataHeader *) input;
- if ((ntohl (MAKE_UNALIGNED (hdr->version)) & HEADER_VERSION_MASK) != 0)
- return NULL; /* unsupported version */
- ic = ntohl (MAKE_UNALIGNED (hdr->entries));
- compressed =
- (ntohl (MAKE_UNALIGNED (hdr->version)) & HEADER_COMPRESSED) != 0;
- if (compressed)
- {
- dataSize = ntohl (MAKE_UNALIGNED (hdr->size)) - sizeof (MetaDataHeader);
- if (dataSize > 2 * 1042 * 1024)
- {
- GNUNET_GE_BREAK (ectx, 0);
- return NULL; /* only 2 MB allowed [to make sure we don't
blow
- our memory limit because of a mal-formed
- message... ] */
- }
- data = decompress ((char *) &input[sizeof (MetaDataHeader)],
- size - sizeof (MetaDataHeader), dataSize);
- if (data == NULL)
- {
- GNUNET_GE_BREAK (ectx, 0);
- return NULL;
- }
- }
- else
- {
- data = (char *) &hdr[1];
- dataSize = size - sizeof (MetaDataHeader);
- if (size != ntohl (MAKE_UNALIGNED (hdr->size)))
- {
- GNUNET_GE_BREAK (ectx, 0);
- return NULL;
- }
- }
-
- if ((sizeof (unsigned int) * ic + ic) > dataSize)
- {
- GNUNET_GE_BREAK (ectx, 0);
- goto FAILURE;
- }
- if ((ic > 0) && (data[dataSize - 1] != '\0'))
- {
- GNUNET_GE_BREAK (ectx, 0);
- goto FAILURE;
- }
-
- md = GNUNET_ECRS_meta_data_create ();
- GNUNET_array_grow (md->items, md->itemCount, ic);
- i = 0;
- pos = sizeof (unsigned int) * ic;
- while ((pos < dataSize) && (i < ic))
- {
- len = strlen (&data[pos]) + 1;
- md->items[i].type = (EXTRACTOR_KeywordType)
- ntohl (MAKE_UNALIGNED (((unsigned int *) data)[i]));
- md->items[i].data = GNUNET_strdup (&data[pos]);
- pos += len;
- i++;
- }
- if (i < ic)
- { /* oops */
- GNUNET_ECRS_meta_data_destroy (md);
- goto FAILURE;
- }
- if (compressed)
- GNUNET_free (data);
- return md;
-FAILURE:
- if (compressed)
- GNUNET_free (data);
- return NULL; /* size too small */
-}
-
-/**
- * Does the meta-data claim that this is a directory?
- * Checks if the mime-type is that of a GNUnet directory.
- */
-int
-GNUNET_ECRS_meta_data_test_for_directory (const MetaData * md)
-{
- int i;
-
- for (i = md->itemCount - 1; i >= 0; i--)
- {
- if (md->items[i].type == EXTRACTOR_MIMETYPE)
- {
- if (0 == strcmp (md->items[i].data, GNUNET_DIRECTORY_MIME))
- return GNUNET_YES;
- else
- return GNUNET_NO;
- }
- }
- return GNUNET_SYSERR;
-}
-
-static char *mimeMap[][2] = {
- {"application/bz2", ".bz2"},
- {"application/gnunet-directory", ".gnd"},
- {"application/java", ".class"},
- {"application/msword", ".doc"},
- {"application/ogg", ".ogg"},
- {"application/pdf", ".pdf"},
- {"application/pgp-keys", ".key"},
- {"application/pgp-signature", ".pgp"},
- {"application/postscript", ".ps"},
- {"application/rar", ".rar"},
- {"application/rtf", ".rtf"},
- {"application/xml", ".xml"},
- {"application/x-debian-package", ".deb"},
- {"application/x-dvi", ".dvi"},
- {"applixation/x-flac", ".flac"},
- {"applixation/x-gzip", ".gz"},
- {"application/x-java-archive", ".jar"},
- {"application/x-java-vm", ".class"},
- {"application/x-python-code", ".pyc"},
- {"application/x-redhat-package-manager", ".rpm"},
- {"application/x-rpm", ".rpm"},
- {"application/x-tar", ".tar"},
- {"application/x-tex-pk", ".pk"},
- {"application/x-texinfo", ".texinfo"},
- {"application/x-xcf", ".xcf"},
- {"application/x-xfig", ".xfig"},
- {"application/zip", ".zip"},
-
- {"audio/midi", ".midi"},
- {"audio/mpeg", ".mp3"},
- {"audio/real", ".rm"},
- {"audio/x-wav", ".wav"},
-
- {"image/gif", ".gif"},
- {"image/jpeg", ".jpg"},
- {"image/pcx", ".pcx"},
- {"image/png", ".png"},
- {"image/tiff", ".tiff"},
- {"image/x-ms-bmp", ".bmp"},
- {"image/x-xpixmap", ".xpm"},
-
- {"text/css", ".css"},
- {"text/html", ".html"},
- {"text/plain", ".txt"},
- {"text/rtf", ".rtf"},
- {"text/x-c++hdr", ".h++"},
- {"text/x-c++src", ".c++"},
- {"text/x-chdr", ".h"},
- {"text/x-csrc", ".c"},
- {"text/x-java", ".java"},
- {"text/x-moc", ".moc"},
- {"text/x-pascal", ".pas"},
- {"text/x-perl", ".pl"},
- {"text/x-python", ".py"},
- {"text/x-tex", ".tex"},
-
- {"video/avi", ".avi"},
- {"video/mpeg", ".mpeg"},
- {"video/quicktime", ".qt"},
- {"video/real", ".rm"},
- {"video/x-msvideo", ".avi"},
- {NULL, NULL},
-};
-
-
-/**
- * Suggest a better filename for a file (and do the
- * renaming).
- * @return the new filename
- */
-char *
-GNUNET_ECRS_suggest_better_filename (struct GNUNET_GE_Context *ectx,
- const char *filename)
-{
- EXTRACTOR_ExtractorList *l;
- EXTRACTOR_KeywordList *list;
- const char *key;
- const char *mime;
- char *path;
- int i;
- unsigned int j;
- char *renameTo;
- char *ret;
- struct stat filestat;
-
- path = GNUNET_strdup (filename);
- i = strlen (path);
- while ((i > 0) && (path[i] != DIR_SEPARATOR))
- i--;
- path[i] = '\0';
- ret = NULL;
- l = EXTRACTOR_loadDefaultLibraries ();
- list = EXTRACTOR_getKeywords (l, filename);
- key = EXTRACTOR_extractLast (EXTRACTOR_TITLE, list);
- if (key == NULL)
- key = EXTRACTOR_extractLast (EXTRACTOR_DESCRIPTION, list);
- if (key == NULL)
- key = EXTRACTOR_extractLast (EXTRACTOR_COMMENT, list);
- if (key == NULL)
- key = EXTRACTOR_extractLast (EXTRACTOR_SUBJECT, list);
- if (key == NULL)
- key = EXTRACTOR_extractLast (EXTRACTOR_ALBUM, list);
- if (key == NULL)
- key = EXTRACTOR_extractLast (EXTRACTOR_UNKNOWN, list);
- mime = EXTRACTOR_extractLast (EXTRACTOR_MIMETYPE, list);
- if (mime != NULL)
- {
- i = 0;
- while ((mimeMap[i][0] != NULL) && (0 != strcmp (mime, mimeMap[i][0])))
- i++;
- if (mimeMap[i][1] == NULL)
- GNUNET_GE_LOG (ectx,
- GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
- "Did not find mime type `%s' in extension list.\n",
- mime);
- mime = mimeMap[i][1];
- }
- if (key == NULL)
- {
- key = &filename[strlen (filename) - 1];
- while ((key != filename) && (key[0] != DIR_SEPARATOR))
- key--;
- if (key[0] == DIR_SEPARATOR)
- key++;
- }
- if (mime != NULL)
- {
- if (0 == strcmp (&key[strlen (key) - strlen (mime)], mime))
- mime = NULL;
- }
- if (mime == NULL)
- {
- i = strlen (filename);
- while ((i > 0) &&
- (filename[i] != '.') && (filename[i] != DIR_SEPARATOR))
- i--;
- if (filename[i] == '.')
- mime = &filename[i];
- }
- if (mime == NULL)
- {
- renameTo =
- GNUNET_malloc (strlen (path) + strlen (key) +
- strlen (DIR_SEPARATOR_STR) + 20);
- strcpy (renameTo, path);
- if (path[strlen (path) - 1] != DIR_SEPARATOR)
- strcat (renameTo, DIR_SEPARATOR_STR);
- strcat (renameTo, key);
- }
- else
- {
- renameTo =
- GNUNET_malloc (strlen (path) + strlen (key) + strlen (mime) +
- strlen (DIR_SEPARATOR_STR) + 20);
- strcpy (renameTo, path);
- if (path[strlen (path) - 1] != DIR_SEPARATOR)
- strcat (renameTo, DIR_SEPARATOR_STR);
- strcat (renameTo, key);
- if (strcasecmp (renameTo + strlen (renameTo) - strlen (mime), mime) !=
- 0)
- strcat (renameTo, mime);
- }
- for (i = strlen (renameTo) - 1; i >= 0; i--)
- if (!isprint (renameTo[i]))
- renameTo[i] = '_';
- else if (renameTo[i] == '.' && i > 0 && renameTo[i - 1] == '.')
- {
- /* remove .. to avoid directory traversal */
- renameTo[i - 1] = renameTo[i] = '_';
- i--;
- }
- if (0 != strcmp (renameTo, filename))
- {
- if (0 == STAT (renameTo, &filestat))
- {
- i = strlen (renameTo);
- j = 0;
- do
- {
- GNUNET_snprintf (&renameTo[i], 19, ".%u", j++);
- if (j > 100000)
- break;
- }
- while (0 == STAT (renameTo, &filestat));
- }
-
- if (0 != STAT (renameTo, &filestat))
- {
- if (0 != RENAME (filename, renameTo))
- GNUNET_GE_LOG (ectx,
- GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
- _("Renaming of file `%s' to `%s' failed: %s\n"),
- filename, renameTo, STRERROR (errno));
- else
- ret = GNUNET_strdup (renameTo);
- }
- else
- {
- GNUNET_GE_LOG (ectx,
- GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
- _
- ("Could not rename file `%s' to `%s': file exists\n"),
- filename, renameTo);
- }
- }
- GNUNET_free (path);
- GNUNET_free (renameTo);
- EXTRACTOR_freeKeywords (list);
- EXTRACTOR_removeAll (l);
- return ret;
-}
-
-/**
- * Test if two MDs are equal.
- */
-int
-GNUNET_ECRS_meta_data_test_equal (const struct GNUNET_ECRS_MetaData *md1,
- const struct GNUNET_ECRS_MetaData *md2)
-{
- int i;
- int j;
- int found;
-
- if (md1->itemCount != md2->itemCount)
- return GNUNET_NO;
- for (i = 0; i < md1->itemCount; i++)
- {
- found = GNUNET_NO;
- for (j = 0; j < md2->itemCount; j++)
- if ((md1->items[i].type == md2->items[j].type) &&
- (0 == strcmp (md1->items[i].data, md2->items[j].data)))
- found = GNUNET_YES;
- if (found == GNUNET_NO)
- return GNUNET_NO;
- }
- return GNUNET_YES;
-}
-
-
-/* end of meta.c */
Deleted: GNUnet/src/applications/fs/ecrs/metatest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/metatest.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/ecrs/metatest.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -1,208 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2003, 2004, 2006 Christian Grothoff (and other contributing authors)
-
- 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
- option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-/**
- * @file applications/fs/ecrs/metatest.c
- * @brief Test for meta.c
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include <extractor.h>
-#include "gnunet_util.h"
-#include "gnunet_ecrs_lib.h"
-#include "ecrs.h"
-
-#define ABORT(m) { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if
(m != NULL) GNUNET_ECRS_meta_data_destroy(m); return 1; }
-
-static int
-testMeta (int i)
-{
- struct GNUNET_ECRS_MetaData *m;
- char *val;
- int j;
- unsigned int size;
-
- m = GNUNET_ECRS_meta_data_create ();
- if (GNUNET_OK !=
- GNUNET_ECRS_meta_data_insert (m, EXTRACTOR_TITLE, "TestTitle"))
- ABORT (m);
- if (GNUNET_OK !=
- GNUNET_ECRS_meta_data_insert (m, EXTRACTOR_AUTHOR, "TestTitle"))
- ABORT (m);
- if (GNUNET_OK == GNUNET_ECRS_meta_data_insert (m, EXTRACTOR_TITLE,
"TestTitle")) /* dup! */
- ABORT (m);
- if (GNUNET_OK == GNUNET_ECRS_meta_data_insert (m, EXTRACTOR_AUTHOR,
"TestTitle")) /* dup! */
- ABORT (m);
- if (2 != GNUNET_ECRS_meta_data_get_contents (m, NULL, NULL))
- ABORT (m);
- if (GNUNET_OK !=
- GNUNET_ECRS_meta_data_delete (m, EXTRACTOR_AUTHOR, "TestTitle"))
- ABORT (m);
- if (GNUNET_OK == GNUNET_ECRS_meta_data_delete (m, EXTRACTOR_AUTHOR,
"TestTitle")) /* already gone */
- ABORT (m);
- if (1 != GNUNET_ECRS_meta_data_get_contents (m, NULL, NULL))
- ABORT (m);
- if (GNUNET_OK !=
- GNUNET_ECRS_meta_data_delete (m, EXTRACTOR_TITLE, "TestTitle"))
- ABORT (m);
- if (GNUNET_OK == GNUNET_ECRS_meta_data_delete (m, EXTRACTOR_TITLE,
"TestTitle")) /* already gone */
- ABORT (m);
- if (0 != GNUNET_ECRS_meta_data_get_contents (m, NULL, NULL))
- ABORT (m);
- val = GNUNET_malloc (256);
- for (j = 0; j < i; j++)
- {
- GNUNET_snprintf (val, 256, "%s.%d",
- "A teststring that should compress well.", j);
- if (GNUNET_OK !=
- GNUNET_ECRS_meta_data_insert (m, EXTRACTOR_UNKNOWN, val))
- {
- GNUNET_free (val);
- ABORT (m);
- }
- }
- GNUNET_free (val);
- if (i != GNUNET_ECRS_meta_data_get_contents (m, NULL, NULL))
- ABORT (m);
-
- size =
- GNUNET_ECRS_meta_data_get_serialized_size (m, GNUNET_ECRS_SERIALIZE_FULL);
- val = GNUNET_malloc (size);
- if (size != GNUNET_ECRS_meta_data_serialize (NULL,
- m, val, size,
- GNUNET_ECRS_SERIALIZE_FULL))
- {
- GNUNET_free (val);
- ABORT (m);
- }
- GNUNET_ECRS_meta_data_destroy (m);
- m = GNUNET_ECRS_meta_data_deserialize (NULL, val, size);
- GNUNET_free (val);
- if (m == NULL)
- ABORT (m);
- val = GNUNET_malloc (256);
- for (j = 0; j < i; j++)
- {
- GNUNET_snprintf (val, 256, "%s.%d",
- "A teststring that should compress well.", j);
- if (GNUNET_OK !=
- GNUNET_ECRS_meta_data_delete (m, EXTRACTOR_UNKNOWN, val))
- {
- GNUNET_free (val);
- ABORT (m);
- }
- }
- GNUNET_free (val);
- if (0 != GNUNET_ECRS_meta_data_get_contents (m, NULL, NULL))
- {
- ABORT (m);
- }
- GNUNET_ECRS_meta_data_destroy (m);
- return 0;
-}
-
-int
-testMetaMore (int i)
-{
- struct GNUNET_ECRS_MetaData *meta;
- int q;
- char txt[128];
- char *data;
- unsigned long long size;
-
- meta = GNUNET_ECRS_meta_data_create ();
- for (q = 0; q <= i; q++)
- {
- GNUNET_snprintf (txt, 128, "%u -- %u\n", i, q);
- GNUNET_ECRS_meta_data_insert (meta,
- q %
- EXTRACTOR_getHighestKeywordTypeNumber (),
- txt);
- }
- size =
- GNUNET_ECRS_meta_data_get_serialized_size (meta,
- GNUNET_ECRS_SERIALIZE_FULL);
- data = GNUNET_malloc (size * 4);
- if (size != GNUNET_ECRS_meta_data_serialize (NULL,
- meta,
- data, size * 4,
- GNUNET_ECRS_SERIALIZE_FULL))
- {
- GNUNET_free (data);
- ABORT (meta);
- }
- GNUNET_ECRS_meta_data_destroy (meta);
- GNUNET_free (data);
- return 0;
-}
-
-static int
-testMetaLink ()
-{
- struct GNUNET_ECRS_MetaData *m;
- char *val;
- unsigned int size;
-
- m = GNUNET_ECRS_meta_data_create ();
- if (GNUNET_OK !=
- GNUNET_ECRS_meta_data_insert (m, EXTRACTOR_UNKNOWN, "link"))
- ABORT (m);
- if (GNUNET_OK !=
- GNUNET_ECRS_meta_data_insert (m, EXTRACTOR_FILENAME, "lib-link.m4"))
- ABORT (m);
- size =
- GNUNET_ECRS_meta_data_get_serialized_size (m, GNUNET_ECRS_SERIALIZE_FULL);
- val = GNUNET_malloc (size);
- if (size != GNUNET_ECRS_meta_data_serialize (NULL,
- m, val, size,
- GNUNET_ECRS_SERIALIZE_FULL))
- {
- GNUNET_free (val);
- ABORT (m);
- }
- GNUNET_ECRS_meta_data_destroy (m);
- m = GNUNET_ECRS_meta_data_deserialize (NULL, val, size);
- GNUNET_free (val);
- if (m == NULL)
- ABORT (m);
- GNUNET_ECRS_meta_data_destroy (m);
- return 0;
-}
-
-
-int
-main (int argc, char *argv[])
-{
- int failureCount = 0;
- int i;
-
- for (i = 0; i < 255; i++)
- failureCount += testMeta (i);
- for (i = 1; i < 255; i++)
- failureCount += testMetaMore (i);
- failureCount += testMetaLink ();
-
- if (failureCount != 0)
- return 1;
- return 0;
-}
-
-/* end of metatest.c */
Modified: GNUnet/src/applications/fs/ecrs/namespace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespace.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/ecrs/namespace.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -142,7 +142,7 @@
struct GNUNET_ECRS_URI *
GNUNET_ECRS_namespace_create (struct GNUNET_GE_Context *ectx,
struct GNUNET_GC_Configuration *cfg,
- const struct GNUNET_ECRS_MetaData *meta,
+ const struct GNUNET_MetaData *meta,
unsigned int anonymityLevel,
unsigned int priority,
GNUNET_CronTime expiration,
@@ -197,8 +197,8 @@
/* create advertisements */
mdsize =
- GNUNET_ECRS_meta_data_get_serialized_size (meta,
- GNUNET_ECRS_SERIALIZE_PART);
+ GNUNET_meta_data_get_serialized_size (meta,
+ GNUNET_SERIALIZE_PART);
size = mdsize + sizeof (GNUNET_EC_NBlock);
if (size > MAX_NBLOCK_SIZE)
{
@@ -207,11 +207,11 @@
nb = (GNUNET_EC_NBlock *) & value[1];
nb->type = htonl (GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
mdsize = size - sizeof (GNUNET_EC_NBlock);
- mdsize = GNUNET_ECRS_meta_data_serialize (ectx,
- meta,
- (char *) &nb[1],
- mdsize,
- GNUNET_ECRS_SERIALIZE_PART);
+ mdsize = GNUNET_meta_data_serialize (ectx,
+ meta,
+ (char *) &nb[1],
+ mdsize,
+ GNUNET_SERIALIZE_PART);
if (mdsize == -1)
{
GNUNET_GE_BREAK (ectx, 0);
@@ -226,10 +226,10 @@
value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
nb = (GNUNET_EC_NBlock *) & value[1];
nb->type = htonl (GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
- GNUNET_ECRS_meta_data_serialize (ectx,
- meta,
- (char *) &nb[1], mdsize,
- GNUNET_ECRS_SERIALIZE_FULL);
+ GNUNET_meta_data_serialize (ectx,
+ meta,
+ (char *) &nb[1], mdsize,
+ GNUNET_SERIALIZE_FULL);
}
value->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
value->type = htonl (GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
@@ -362,7 +362,7 @@
const GNUNET_HashCode * thisId,
const GNUNET_HashCode * nextId,
const struct GNUNET_ECRS_URI *dstU,
- const struct GNUNET_ECRS_MetaData *md)
+ const struct GNUNET_MetaData *md)
{
struct GNUNET_ECRS_URI *uri;
struct GNUNET_ClientServerConnection *sock;
@@ -416,8 +416,8 @@
/* THEN: construct GNUNET_EC_SBlock */
dstURI = GNUNET_ECRS_uri_to_string (dstU);
mdsize =
- GNUNET_ECRS_meta_data_get_serialized_size (md,
- GNUNET_ECRS_SERIALIZE_PART);
+ GNUNET_meta_data_get_serialized_size (md,
+ GNUNET_SERIALIZE_PART);
size = mdsize + sizeof (GNUNET_EC_SBlock) + strlen (dstURI) + 1;
if (size > MAX_SBLOCK_SIZE)
{
@@ -428,11 +428,11 @@
destPos = (char *) &sb[1];
memcpy (destPos, dstURI, strlen (dstURI) + 1);
mdsize = size - sizeof (GNUNET_EC_SBlock) - strlen (dstURI) - 1;
- mdsize = GNUNET_ECRS_meta_data_serialize (ectx,
- md,
- &destPos[strlen (dstURI) + 1],
- mdsize,
- GNUNET_ECRS_SERIALIZE_PART);
+ mdsize = GNUNET_meta_data_serialize (ectx,
+ md,
+ &destPos[strlen (dstURI) + 1],
+ mdsize,
+ GNUNET_SERIALIZE_PART);
if (mdsize == -1)
{
GNUNET_GE_BREAK (ectx, 0);
@@ -450,10 +450,10 @@
sb->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED);
destPos = (char *) &sb[1];
memcpy (destPos, dstURI, strlen (dstURI) + 1);
- GNUNET_ECRS_meta_data_serialize (ectx,
- md,
- &destPos[strlen (dstURI) + 1],
- mdsize, GNUNET_ECRS_SERIALIZE_FULL);
+ GNUNET_meta_data_serialize (ectx,
+ md,
+ &destPos[strlen (dstURI) + 1],
+ mdsize, GNUNET_SERIALIZE_FULL);
}
value->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
value->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED);
Modified: GNUnet/src/applications/fs/ecrs/namespacetest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespacetest.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/ecrs/namespacetest.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -73,9 +73,9 @@
struct GNUNET_ECRS_URI *uri;
struct GNUNET_ECRS_URI *advURI;
struct GNUNET_ECRS_URI *rootURI;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
adv = GNUNET_ECRS_keyword_string_to_uri (NULL, "testNamespace");
GNUNET_hash ("root", 4, &root);
rootURI =
@@ -105,7 +105,7 @@
fprintf (stderr, "Completed namespace search...\n");
CHECK (GNUNET_OK == GNUNET_ECRS_namespace_delete (NULL, cfg, &pid));
CHECK (GNUNET_SYSERR == GNUNET_ECRS_namespace_delete (NULL, cfg, &pid));
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
GNUNET_ECRS_uri_destroy (rootURI);
GNUNET_ECRS_uri_destroy (advURI);
CHECK (match == 1);
Modified: GNUnet/src/applications/fs/ecrs/parser.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/parser.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/ecrs/parser.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -102,7 +102,7 @@
/**
- * @param scls must be of type "struct GNUNET_ECRS_MetaData **"
+ * @param scls must be of type "struct GNUNET_MetaData **"
*/
int
GNUNET_ECRS_getopt_configure_set_metadata (GNUNET_CommandLineProcessorContext
@@ -110,17 +110,17 @@
const char *option,
const char *value)
{
- struct GNUNET_ECRS_MetaData **mm = scls;
+ struct GNUNET_MetaData **mm = scls;
EXTRACTOR_KeywordType type;
const char *typename;
const char *typename_i18n;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
char *tmp;
meta = *mm;
if (meta == NULL)
{
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
*mm = meta;
}
@@ -141,7 +141,7 @@
(tmp[strlen (typename)] == ':') &&
(0 == strncmp (typename, tmp, strlen (typename))))
{
- GNUNET_ECRS_meta_data_insert (meta, type,
+ GNUNET_meta_data_insert (meta, type,
&tmp[strlen (typename) + 1]);
GNUNET_free (tmp);
tmp = NULL;
@@ -151,8 +151,8 @@
(tmp[strlen (typename_i18n)] == ':') &&
(0 == strncmp (typename_i18n, tmp, strlen (typename_i18n))))
{
- GNUNET_ECRS_meta_data_insert (meta, type,
- &tmp[strlen (typename_i18n) + 1]);
+ GNUNET_meta_data_insert (meta, type,
+ &tmp[strlen (typename_i18n) + 1]);
GNUNET_free (tmp);
tmp = NULL;
break;
@@ -160,7 +160,7 @@
}
if (tmp != NULL)
{
- GNUNET_ECRS_meta_data_insert (meta, EXTRACTOR_UNKNOWN, tmp);
+ GNUNET_meta_data_insert (meta, EXTRACTOR_UNKNOWN, tmp);
GNUNET_free (tmp);
printf (_
("Unknown metadata type in metadata option `%s'. Using metadata
type `unknown' instead.\n"),
Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/ecrs/search.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -273,10 +273,10 @@
struct GNUNET_ECRS_URI uri;
int ret;
- fi.meta = GNUNET_ECRS_meta_data_deserialize (ectx,
- (const char *) &nb[1],
- size -
- sizeof (GNUNET_EC_NBlock));
+ fi.meta = GNUNET_meta_data_deserialize (ectx,
+ (const char *) &nb[1],
+ size -
+ sizeof (GNUNET_EC_NBlock));
if (fi.meta == NULL)
{
GNUNET_GE_BREAK (ectx, 0); /* nblock malformed */
@@ -294,7 +294,7 @@
}
else
ret = GNUNET_OK;
- GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_meta_data_destroy (fi.meta);
return ret;
}
@@ -389,7 +389,7 @@
}
dstURI = (const char *) &kb[1];
j++;
- fi.meta = GNUNET_ECRS_meta_data_deserialize (ectx,
+ fi.meta = GNUNET_meta_data_deserialize (ectx,
&((const char *)
kb)[j], size - j);
if (fi.meta == NULL)
@@ -402,7 +402,7 @@
if (fi.uri == NULL)
{
GNUNET_GE_BREAK (ectx, 0); /* kblock malformed */
- GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_meta_data_destroy (fi.meta);
GNUNET_free (kb);
return GNUNET_SYSERR;
}
@@ -416,7 +416,7 @@
else
ret = GNUNET_OK;
GNUNET_ECRS_uri_destroy (fi.uri);
- GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_meta_data_destroy (fi.meta);
GNUNET_free (kb);
return ret;
}
@@ -481,11 +481,11 @@
}
j++;
/* j == strlen(dstURI) + 1 */
- fi.meta = GNUNET_ECRS_meta_data_deserialize (ectx,
- &dstURI[j],
- size - j -
- sizeof
- (GNUNET_EC_SBlock));
+ fi.meta = GNUNET_meta_data_deserialize (ectx,
+ &dstURI[j],
+ size - j -
+ sizeof
+ (GNUNET_EC_SBlock));
if (fi.meta == NULL)
{
GNUNET_GE_BREAK (ectx, 0); /* sblock malformed */
@@ -496,7 +496,7 @@
if (fi.uri == NULL)
{
GNUNET_GE_BREAK (ectx, 0); /* sblock malformed */
- GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_meta_data_destroy (fi.meta);
GNUNET_free (sb);
return GNUNET_SYSERR;
}
@@ -509,7 +509,7 @@
else
ret = GNUNET_OK;
GNUNET_ECRS_uri_destroy (fi.uri);
- GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_meta_data_destroy (fi.meta);
/* compute current/NEXT URI (if updateable GNUNET_EC_SBlock) and issue
respective query automatically! */
Modified: GNUnet/src/applications/fs/ecrs/searchtest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/searchtest.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/ecrs/searchtest.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -83,7 +83,7 @@
int ok;
struct GNUNET_ClientServerConnection *sock;
struct GNUNET_ECRS_URI *uri;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
struct GNUNET_ECRS_URI *key;
cfg = GNUNET_GC_create ();
@@ -110,7 +110,7 @@
uri = GNUNET_ECRS_string_to_uri (NULL,
"gnunet://ecrs/sks/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820/test");
CHECK (uri != NULL);
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
key = GNUNET_ECRS_keyword_string_to_uri (NULL, "XXtest");
CHECK (GNUNET_OK == GNUNET_ECRS_publish_under_keyword (NULL, cfg, key, 0, 0,
GNUNET_get_time () + 10 * GNUNET_CRON_MINUTES, /* expire */
@@ -129,7 +129,7 @@
CHECK (GNUNET_OK == searchFile (key, 1));
GNUNET_ECRS_uri_destroy (key);
GNUNET_ECRS_uri_destroy (uri);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
/* now searching just for 'XXtest' should again give 2 results! */
#if 0
Modified: GNUnet/src/applications/fs/ecrs/uri.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/uri.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/ecrs/uri.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -963,22 +963,35 @@
return ret;
}
+static int
+gather_uri_data(EXTRACTOR_KeywordType type,
+ const char * data,
+ void * cls)
+{
+ URI * uri = cls;
+ char * nkword;
+ int j;
+ for (j = uri->data.ksk.keywordCount - 1; j >= 0; j--)
+ if (0 == strcmp (&uri->data.ksk.keywords[j][1],
+ data))
+ return GNUNET_OK;
+ nkword = GNUNET_malloc (strlen (data) + 2);
+ strcpy (nkword, " "); /* not mandatory */
+ strcat (nkword, data);
+ uri->data.ksk.keywords[uri->data.ksk.keywordCount++] = nkword;
+ return GNUNET_OK;
+}
+
/**
* Construct a keyword-URI from meta-data (take all entries
* in the meta-data and construct one large keyword URI
* that lists all keywords that can be found in the meta-data).
*/
URI *
-GNUNET_ECRS_meta_data_to_uri (const MetaData * md)
+GNUNET_meta_data_to_uri (const struct GNUNET_MetaData * md)
{
URI *ret;
- int i;
- int j;
- int havePreview;
- int add;
- const char *kword;
- char *nkword;
if (md == NULL)
return NULL;
@@ -986,56 +999,14 @@
ret->type = ksk;
ret->data.ksk.keywordCount = 0;
ret->data.ksk.keywords = NULL;
- havePreview = 0;
- for (i = md->itemCount - 1; i >= 0; i--)
- {
- if (md->items[i].type == EXTRACTOR_THUMBNAIL_DATA)
- {
- havePreview++;
- }
- else
- {
- for (j = md->itemCount - 1; j > i; j--)
- {
- if (0 == strcmp (md->items[i].data, md->items[j].data))
- {
- havePreview++; /* duplicate! */
- break;
- }
- }
- }
- }
- GNUNET_array_grow (ret->data.ksk.keywords,
- ret->data.ksk.keywordCount, md->itemCount - havePreview);
- for (i = md->itemCount - 1; i >= 0; i--)
- {
- if (md->items[i].type == EXTRACTOR_THUMBNAIL_DATA)
- {
- havePreview--;
- }
- else
- {
- add = 1;
- for (j = md->itemCount - 1; j > i; j--)
- {
- if (0 == strcmp (md->items[i].data, md->items[j].data))
- {
- havePreview--;
- add = 0;
- break;
- }
- }
- if (add == 1)
- {
- GNUNET_GE_ASSERT (NULL, md->items[i].data != NULL);
- kword = md->items[i].data;
- nkword = GNUNET_malloc (strlen (kword) + 2);
- strcpy (nkword, " "); /* not mandatory */
- strcat (nkword, kword);
- ret->data.ksk.keywords[i - havePreview] = nkword;
- }
- }
- }
+ ret->data.ksk.keywords
+ = GNUNET_malloc(sizeof(char*) *
+ GNUNET_meta_data_get_contents(md,
+ NULL,
+ NULL));
+ GNUNET_meta_data_get_contents(md,
+ &gather_uri_data,
+ ret);
return ret;
}
Modified: GNUnet/src/applications/fs/fsui/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/fsui/Makefile.am 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/fsui/Makefile.am 2008-06-04 05:57:05 UTC (rev
7044)
@@ -18,7 +18,6 @@
$(top_builddir)/src/applications/identity/libgnunetidentity_api.la \
$(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
$(top_builddir)/src/applications/fs/namespace/libgnunetnamespace.la \
- $(top_builddir)/src/applications/fs/pseudonyms/libgnunetpseudonym.la \
$(top_builddir)/src/applications/fs/uritrack/libgnuneturitrack.la \
$(top_builddir)/src/util/libgnunetutil.la
Modified: GNUnet/src/applications/fs/fsui/basic_fsui_test.c
===================================================================
--- GNUnet/src/applications/fs/fsui/basic_fsui_test.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/fsui/basic_fsui_test.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -49,7 +49,7 @@
static volatile enum GNUNET_FSUI_EventType lastEvent;
-static struct GNUNET_ECRS_MetaData *search_meta;
+static struct GNUNET_MetaData *search_meta;
static struct GNUNET_ECRS_URI *search_uri;
@@ -74,7 +74,7 @@
search_uri =
GNUNET_ECRS_uri_duplicate (event->data.SearchResult.fi.uri);
search_meta =
- GNUNET_ECRS_meta_data_duplicate (event->data.SearchResult.fi.meta);
+ GNUNET_meta_data_duplicate (event->data.SearchResult.fi.meta);
break;
case GNUNET_FSUI_upload_completed:
#if DEBUG_VERBOSE
@@ -116,7 +116,7 @@
char keyword[40];
char *fn;
int prog;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
struct GNUNET_ECRS_URI *kuri;
struct GNUNET_GC_Configuration *cfg;
struct GNUNET_FSUI_UploadList *upload = NULL;
@@ -149,7 +149,7 @@
GNUNET_disk_file_write (NULL,
filename,
"foo bar test!", strlen ("foo bar test!"), "600");
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
kuri =
GNUNET_ECRS_keyword_command_line_to_uri (NULL, 2,
(const char **) keywords);
@@ -163,7 +163,7 @@
5 * GNUNET_CRON_HOURS, meta, kuri, kuri);
CHECK (upload != NULL);
GNUNET_ECRS_uri_destroy (kuri);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
prog = 0;
while (lastEvent != GNUNET_FSUI_upload_completed)
{
@@ -212,7 +212,7 @@
GNUNET_FSUI_download_stop (download);
download = NULL;
GNUNET_ECRS_uri_destroy (search_uri);
- GNUNET_ECRS_meta_data_destroy (search_meta);
+ GNUNET_meta_data_destroy (search_meta);
/* unindex */
unindex = GNUNET_FSUI_unindex_start (ctx, filename);
prog = 0;
Modified: GNUnet/src/applications/fs/fsui/deserialize.c
===================================================================
--- GNUnet/src/applications/fs/fsui/deserialize.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/fsui/deserialize.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -202,12 +202,12 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-static struct GNUNET_ECRS_MetaData *
+static struct GNUNET_MetaData *
read_meta (struct GNUNET_GE_Context *ectx, ReadBuffer * rb)
{
unsigned int size;
char *buf;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
if (read_uint (rb, &size) != GNUNET_OK)
{
@@ -226,7 +226,7 @@
GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
- meta = GNUNET_ECRS_meta_data_deserialize (ectx, buf, size);
+ meta = GNUNET_meta_data_deserialize (ectx, buf, size);
if (meta == NULL)
{
GNUNET_free (buf);
@@ -257,7 +257,7 @@
fi->uri = read_uri (ectx, rb);
if (fi->uri == NULL)
{
- GNUNET_ECRS_meta_data_destroy (fi->meta);
+ GNUNET_meta_data_destroy (fi->meta);
fi->meta = NULL;
GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
@@ -343,7 +343,7 @@
{
GNUNET_free (ret->filename);
GNUNET_ECRS_uri_destroy (ret->fi.uri);
- GNUNET_ECRS_meta_data_destroy (ret->fi.meta);
+ GNUNET_meta_data_destroy (ret->fi.meta);
for (i = 0; i < ret->completedDownloadsCount; i++)
{
if (ret->completedDownloads[i] != NULL)
@@ -779,7 +779,7 @@
if (l.uri != NULL)
GNUNET_ECRS_uri_destroy (l.uri);
if (l.meta != NULL)
- GNUNET_ECRS_meta_data_destroy (l.meta);
+ GNUNET_meta_data_destroy (l.meta);
if (l.keywords != NULL)
GNUNET_ECRS_uri_destroy (l.keywords);
GNUNET_GE_BREAK (NULL, 0);
Modified: GNUnet/src/applications/fs/fsui/download.c
===================================================================
--- GNUnet/src/applications/fs/fsui/download.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/fsui/download.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -65,7 +65,7 @@
const struct GNUNET_ECRS_URI
*uri,
const struct
- GNUNET_ECRS_MetaData *meta,
+ GNUNET_MetaData *meta,
const char *filename,
struct GNUNET_FSUI_SearchList
*psearch,
@@ -103,7 +103,7 @@
return GNUNET_OK; /* already downloading */
pos = pos->next;
}
- filename = GNUNET_ECRS_meta_data_get_by_type (fi->meta, EXTRACTOR_FILENAME);
+ filename = GNUNET_meta_data_get_by_type (fi->meta, EXTRACTOR_FILENAME);
if (filename == NULL)
{
char *tmp = GNUNET_ECRS_uri_to_string (fi->uri);
@@ -147,7 +147,7 @@
int fd;
char *fn;
size_t totalBytes;
- struct GNUNET_ECRS_MetaData *md;
+ struct GNUNET_MetaData *md;
totalBytes = GNUNET_ECRS_uri_get_file_size (dl->fi.uri);
fn =
@@ -179,7 +179,7 @@
&md,
&listURIfoundDirectory, dl);
if (md != NULL)
- GNUNET_ECRS_meta_data_destroy (md);
+ GNUNET_meta_data_destroy (md);
if (dl->is_recursive)
{
int n;
@@ -195,7 +195,7 @@
GNUNET_mutex_unlock (dl->ctx->lock);
if (n == 0)
GNUNET_disk_directory_create (dl->ctx->ectx, dl->filename);
- GNUNET_ECRS_meta_data_destroy (md);
+ GNUNET_meta_data_destroy (md);
MUNMAP (dirBlock, totalBytes);
}
}
@@ -306,7 +306,7 @@
unsigned int anonymityLevel,
int is_recursive,
const struct GNUNET_ECRS_URI *uri,
- const struct GNUNET_ECRS_MetaData *meta,
+ const struct GNUNET_MetaData *meta,
const char *filename,
struct GNUNET_FSUI_SearchList *psearch,
GNUNET_FSUI_DownloadList * parent)
@@ -334,7 +334,7 @@
dl->ctx = ctx;
dl->filename = GNUNET_strdup (filename);
dl->fi.uri = GNUNET_ECRS_uri_duplicate (uri);
- dl->fi.meta = GNUNET_ECRS_meta_data_duplicate (meta);
+ dl->fi.meta = GNUNET_meta_data_duplicate (meta);
dl->total = GNUNET_ECRS_uri_get_file_size (uri);
dl->child = NULL;
dl->cctx = NULL;
@@ -381,7 +381,7 @@
unsigned int anonymityLevel,
int doRecursive,
const struct GNUNET_ECRS_URI *uri,
- const struct GNUNET_ECRS_MetaData *meta,
+ const struct GNUNET_MetaData *meta,
const char *filename,
struct GNUNET_FSUI_SearchList *psearch,
struct GNUNET_FSUI_DownloadList *pdownload)
@@ -691,7 +691,7 @@
GNUNET_ECRS_uri_destroy (dl->completedDownloads[i]);
GNUNET_array_grow (dl->completedDownloads, dl->completedDownloadsCount, 0);
GNUNET_ECRS_uri_destroy (dl->fi.uri);
- GNUNET_ECRS_meta_data_destroy (dl->fi.meta);
+ GNUNET_meta_data_destroy (dl->fi.meta);
GNUNET_free (dl->filename);
GNUNET_free (dl);
return GNUNET_OK;
Modified: GNUnet/src/applications/fs/fsui/download_persistence_test.c
===================================================================
--- GNUnet/src/applications/fs/fsui/download_persistence_test.c 2008-06-04
05:56:31 UTC (rev 7043)
+++ GNUnet/src/applications/fs/fsui/download_persistence_test.c 2008-06-04
05:57:05 UTC (rev 7044)
@@ -167,7 +167,7 @@
};
int prog;
char *buf;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
struct GNUNET_ECRS_URI *kuri = NULL;
struct GNUNET_GC_Configuration *cfg;
struct GNUNET_FSUI_UnindexList *unindex = NULL;
@@ -203,7 +203,7 @@
buf[i] = GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 256);
GNUNET_disk_file_write (ectx, fn, buf, FILESIZE, "600");
GNUNET_free (buf);
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
kuri =
GNUNET_ECRS_keyword_command_line_to_uri (ectx, 2,
(const char **) keywords);
@@ -291,7 +291,7 @@
/* END OF TEST CODE */
FAILURE:
if (meta != NULL)
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
if (ctx != NULL)
{
if (unindex != NULL)
Modified: GNUnet/src/applications/fs/fsui/fsui.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/fsui/fsui.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -613,7 +613,7 @@
{
freeDownloadList (list->child);
GNUNET_ECRS_uri_destroy (list->fi.uri);
- GNUNET_ECRS_meta_data_destroy (list->fi.meta);
+ GNUNET_meta_data_destroy (list->fi.meta);
GNUNET_free (list->filename);
for (i = 0; i < list->completedDownloadsCount; i++)
GNUNET_ECRS_uri_destroy (list->completedDownloads[i]);
@@ -641,7 +641,7 @@
next = list->next;
GNUNET_free (list->filename);
if (list->meta != NULL)
- GNUNET_ECRS_meta_data_destroy (list->meta);
+ GNUNET_meta_data_destroy (list->meta);
if (list->keywords != NULL)
GNUNET_ECRS_uri_destroy (list->keywords);
if (list->uri != NULL)
@@ -818,7 +818,7 @@
{
res = spos->resultsReceived;
spos->resultsReceived = res->next;
- GNUNET_ECRS_meta_data_destroy (res->fi.meta);
+ GNUNET_meta_data_destroy (res->fi.meta);
GNUNET_ECRS_uri_destroy (res->fi.uri);
GNUNET_free (res->matchingSearches);
GNUNET_free (res);
Modified: GNUnet/src/applications/fs/fsui/fsui.h
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.h 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/fsui/fsui.h 2008-06-04 05:57:05 UTC (rev
7044)
@@ -429,7 +429,7 @@
/**
* Metadata for this file.
*/
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
/**
* Keywords to be used for this upload.
Modified: GNUnet/src/applications/fs/fsui/recursive_download_persistence_test.c
===================================================================
--- GNUnet/src/applications/fs/fsui/recursive_download_persistence_test.c
2008-06-04 05:56:31 UTC (rev 7043)
+++ GNUnet/src/applications/fs/fsui/recursive_download_persistence_test.c
2008-06-04 05:57:05 UTC (rev 7044)
@@ -300,7 +300,7 @@
char keyword[40];
int prog;
char *buf;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
struct GNUNET_ECRS_URI *kuri = NULL;
struct GNUNET_GC_Configuration *cfg;
struct GNUNET_FSUI_UnindexList *unindex = NULL;
@@ -338,11 +338,11 @@
GNUNET_free (buf);
GNUNET_free (fn);
}
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
kuri =
GNUNET_ECRS_keyword_command_line_to_uri (ectx, 2,
(const char **) keywords);
- GNUNET_ECRS_meta_data_insert (meta, EXTRACTOR_MIMETYPE,
+ GNUNET_meta_data_insert (meta, EXTRACTOR_MIMETYPE,
GNUNET_DIRECTORY_MIME);
upload =
GNUNET_FSUI_upload_start (ctx, UPLOAD_PREFIX,
@@ -364,7 +364,7 @@
upURI,
meta, UPLOAD_PREFIX "-download",
NULL, NULL);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
prog = 0;
suspendRestart = 10;
while (prog < 100)
Modified: GNUnet/src/applications/fs/fsui/recursive_download_test.c
===================================================================
--- GNUnet/src/applications/fs/fsui/recursive_download_test.c 2008-06-04
05:56:31 UTC (rev 7043)
+++ GNUnet/src/applications/fs/fsui/recursive_download_test.c 2008-06-04
05:57:05 UTC (rev 7044)
@@ -266,7 +266,7 @@
"down_bar",
};
int prog;
- struct GNUNET_ECRS_MetaData *meta = NULL;
+ struct GNUNET_MetaData *meta = NULL;
struct GNUNET_ECRS_URI *kuri = NULL;
struct GNUNET_GC_Configuration *cfg;
struct GNUNET_FSUI_UploadList *upload = NULL;
@@ -294,7 +294,7 @@
&eventCallback, NULL);
CHECK (ctx != NULL);
fn = makeHierarchy (42, DIRECTORY_TREE_SPEC);
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
kuri =
GNUNET_ECRS_keyword_command_line_to_uri (ectx, 2,
(const char **) keywords);
@@ -342,7 +342,7 @@
}
FAILURE:
if (meta != NULL)
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
if (ctx != NULL)
{
if (download != NULL)
Modified: GNUnet/src/applications/fs/fsui/search.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/fsui/search.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -34,7 +34,6 @@
#include "gnunet_fsui_lib.h"
#include "gnunet_uritrack_lib.h"
#include "gnunet_namespace_lib.h"
-#include "gnunet_pseudonym_lib.h"
#include "fsui.h"
#define DEBUG_SEARCH GNUNET_NO
@@ -98,7 +97,7 @@
{
GNUNET_NS_namespace_set_root (ectx, pos->ctx->cfg, fi->uri);
GNUNET_ECRS_uri_get_namespace_from_sks (fi->uri, &nsid);
- GNUNET_PSEUDO_add (ectx, pos->ctx->cfg, &nsid, fi->meta);
+ GNUNET_pseudonym_add (ectx, pos->ctx->cfg, &nsid, fi->meta);
return GNUNET_OK;
}
GNUNET_mutex_lock (pos->lock);
@@ -180,7 +179,7 @@
srl = GNUNET_malloc (sizeof (struct SearchResultList));
memset (srl, 0, sizeof (struct SearchResultList));
GNUNET_array_append (srl->matchingSearches, srl->matchingSearchCount, rec);
- srl->fi.meta = GNUNET_ECRS_meta_data_duplicate (fi->meta);
+ srl->fi.meta = GNUNET_meta_data_duplicate (fi->meta);
srl->fi.uri = GNUNET_ECRS_uri_duplicate (fi->uri);
srl->mandatoryMatchesRemaining = pos->mandatory_keyword_count;
if (rec->is_required)
@@ -560,7 +559,7 @@
sl->resultsReceived = srl->next;
GNUNET_array_grow (srl->matchingSearches, srl->matchingSearchCount, 0);
GNUNET_ECRS_uri_destroy (srl->fi.uri);
- GNUNET_ECRS_meta_data_destroy (srl->fi.meta);
+ GNUNET_meta_data_destroy (srl->fi.meta);
if (srl->test_download != NULL)
{
GNUNET_ECRS_file_download_partial_stop (srl->test_download);
Modified:
GNUnet/src/applications/fs/fsui/search_linked_download_persistence_test.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search_linked_download_persistence_test.c
2008-06-04 05:56:31 UTC (rev 7043)
+++ GNUnet/src/applications/fs/fsui/search_linked_download_persistence_test.c
2008-06-04 05:57:05 UTC (rev 7044)
@@ -329,7 +329,7 @@
char keyword[40];
int prog;
char *buf;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
struct GNUNET_ECRS_URI *kuri = NULL;
struct GNUNET_GC_Configuration *cfg;
struct GNUNET_FSUI_UnindexList *unindex = NULL;
@@ -367,11 +367,11 @@
GNUNET_free (buf);
GNUNET_free (fn);
}
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
kuri =
GNUNET_ECRS_keyword_command_line_to_uri (ectx, 2,
(const char **) keywords);
- GNUNET_ECRS_meta_data_insert (meta, EXTRACTOR_MIMETYPE,
+ GNUNET_meta_data_insert (meta, EXTRACTOR_MIMETYPE,
GNUNET_DIRECTORY_MIME);
upload =
GNUNET_FSUI_upload_start (ctx, UPLOAD_PREFIX,
@@ -396,7 +396,7 @@
meta,
UPLOAD_PREFIX "-download", search,
NULL);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
prog = 0;
suspendRestart = 10;
while (prog < 1000)
Modified: GNUnet/src/applications/fs/fsui/search_pause_resume_persistence_test.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search_pause_resume_persistence_test.c
2008-06-04 05:56:31 UTC (rev 7043)
+++ GNUnet/src/applications/fs/fsui/search_pause_resume_persistence_test.c
2008-06-04 05:57:05 UTC (rev 7044)
@@ -140,7 +140,7 @@
};
char keyword[40];
int prog;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
struct GNUNET_ECRS_URI *kuri;
struct GNUNET_GC_Configuration *cfg;
struct GNUNET_FSUI_UploadList *upload;
@@ -194,7 +194,7 @@
GNUNET_disk_file_write (NULL,
fn, "foo bar test!", strlen ("foo bar test!"),
"600");
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
kuri =
GNUNET_ECRS_keyword_command_line_to_uri (NULL, 2,
(const char **) keywords);
@@ -211,7 +211,7 @@
GNUNET_free (fn);
fn = NULL;
GNUNET_ECRS_uri_destroy (kuri);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
prog = 0;
while (lastEvent != GNUNET_FSUI_upload_completed)
{
@@ -240,11 +240,11 @@
GNUNET_FSUI_search_stop (search);
CHECK (uri != NULL);
fn = makeName (43);
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
waitForEvent = GNUNET_FSUI_download_completed;
download =
GNUNET_FSUI_download_start (ctx, 0, GNUNET_NO, uri, meta, fn, NULL, NULL);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
GNUNET_free (fn);
fn = NULL;
GNUNET_ECRS_uri_destroy (uri);
Modified: GNUnet/src/applications/fs/fsui/search_ranking_test.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search_ranking_test.c 2008-06-04
05:56:31 UTC (rev 7043)
+++ GNUnet/src/applications/fs/fsui/search_ranking_test.c 2008-06-04
05:57:05 UTC (rev 7044)
@@ -136,7 +136,7 @@
};
char keyword[40];
int prog;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
struct GNUNET_ECRS_URI *kuri;
struct GNUNET_GC_Configuration *cfg;
struct GNUNET_FSUI_UploadList *upload;
@@ -170,7 +170,7 @@
GNUNET_disk_file_write (NULL,
fn, "foo bar test!", strlen ("foo bar test!"),
"600");
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
kuri =
GNUNET_ECRS_keyword_command_line_to_uri (NULL, 2,
(const char **) keywords);
@@ -187,7 +187,7 @@
GNUNET_free (fn);
fn = NULL;
GNUNET_ECRS_uri_destroy (kuri);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
prog = 0;
while (lastEvent != GNUNET_FSUI_upload_completed)
{
Modified: GNUnet/src/applications/fs/fsui/serialize.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serialize.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/fsui/serialize.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -115,24 +115,24 @@
static void
writeMetaData (struct GNUNET_GE_Context *ectx,
- WriteBuffer * wb, const struct GNUNET_ECRS_MetaData *meta)
+ WriteBuffer * wb, const struct GNUNET_MetaData *meta)
{
unsigned int size;
char *buf;
- size = GNUNET_ECRS_meta_data_get_serialized_size (meta,
- GNUNET_ECRS_SERIALIZE_FULL
- |
-
GNUNET_ECRS_SERIALIZE_NO_COMPRESS);
+ size = GNUNET_meta_data_get_serialized_size (meta,
+ GNUNET_SERIALIZE_FULL
+ |
+ GNUNET_SERIALIZE_NO_COMPRESS);
if (size > 1024 * 1024)
size = 1024 * 1024;
buf = GNUNET_malloc (size);
- GNUNET_ECRS_meta_data_serialize (ectx,
- meta,
- buf,
- size,
- GNUNET_ECRS_SERIALIZE_PART |
- GNUNET_ECRS_SERIALIZE_NO_COMPRESS);
+ GNUNET_meta_data_serialize (ectx,
+ meta,
+ buf,
+ size,
+ GNUNET_SERIALIZE_PART |
+ GNUNET_SERIALIZE_NO_COMPRESS);
WRITEINT (wb, size);
write_buffered (wb, buf, size);
GNUNET_free (buf);
Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/fsui/upload.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -59,7 +59,7 @@
event.data.UploadProgress.uc.cctx = utc->cctx;
event.data.UploadProgress.uc.ppos = utc->parent;
event.data.UploadProgress.uc.pcctx = utc->parent->cctx;
- if (GNUNET_YES == GNUNET_ECRS_meta_data_test_for_directory (utc->meta))
+ if (GNUNET_YES == GNUNET_meta_data_test_for_directory (utc->meta))
{
if (direct == GNUNET_YES)
unaccounted = GNUNET_YES;
@@ -146,7 +146,7 @@
createDirectoryHelper (struct GNUNET_GE_Context *ectx,
struct GNUNET_GC_Configuration *cfg,
struct GNUNET_FSUI_UploadList *children,
- struct GNUNET_ECRS_MetaData *meta, char **error)
+ struct GNUNET_MetaData *meta, char **error)
{
GNUNET_ECRS_FileInfo *fis;
unsigned int count;
@@ -390,12 +390,12 @@
if (utc->shared->doIndex != GNUNET_SYSERR)
{
if (utc->child == NULL)
- GNUNET_ECRS_meta_data_extract_from_file (utc->shared->ctx->ectx,
+ GNUNET_meta_data_extract_from_file (utc->shared->ctx->ectx,
utc->meta, utc->filename,
utc->shared->extractors);
while (GNUNET_OK ==
- GNUNET_ECRS_meta_data_delete (utc->meta, EXTRACTOR_FILENAME,
- NULL));
+ GNUNET_meta_data_delete (utc->meta, EXTRACTOR_FILENAME,
+ NULL));
/* only publish the last part of the path
-- we do not want to publish $HOME or similar
trivially deanonymizing information */
@@ -409,7 +409,7 @@
if ((is_directory || (utc->child != NULL)) &&
((strlen (pfn) == 0) || (pfn[strlen (pfn) - 1] != DIR_SEPARATOR)))
strcat (pfn, DIR_SEPARATOR_STR);
- GNUNET_ECRS_meta_data_insert (utc->meta, EXTRACTOR_FILENAME, pfn);
+ GNUNET_meta_data_insert (utc->meta, EXTRACTOR_FILENAME, pfn);
GNUNET_free (pfn);
if (0 != strcmp (utc->shared->top_filename, utc->filename))
{
@@ -426,7 +426,7 @@
pfn = GNUNET_malloc (tend - tpos + 1);
pfn[tend - tpos] = '\0';
memcpy (pfn, &utc->filename[tpos + 1], tend - tpos);
- GNUNET_ECRS_meta_data_insert (utc->meta, EXTRACTOR_RELATION,
+ GNUNET_meta_data_insert (utc->meta, EXTRACTOR_RELATION,
pfn);
GNUNET_free (pfn);
}
@@ -467,9 +467,9 @@
loc = GNUNET_ECRS_uri_duplicate (utc->uri);
}
while (GNUNET_OK ==
- GNUNET_ECRS_meta_data_delete (utc->meta, EXTRACTOR_SPLIT, NULL));
+ GNUNET_meta_data_delete (utc->meta, EXTRACTOR_SPLIT, NULL));
while (GNUNET_OK ==
- GNUNET_ECRS_meta_data_delete (utc->meta, EXTRACTOR_LOWERCASE,
+ GNUNET_meta_data_delete (utc->meta, EXTRACTOR_LOWERCASE,
NULL));
if (utc->shared->global_keywords != NULL)
GNUNET_ECRS_publish_under_keyword (ectx,
@@ -489,7 +489,7 @@
utc->meta);
if (utc->shared->individualKeywords == GNUNET_YES)
{
- uri = GNUNET_ECRS_meta_data_to_uri (utc->meta);
+ uri = GNUNET_meta_data_to_uri (utc->meta);
GNUNET_ECRS_publish_under_keyword (ectx,
utc->shared->ctx->cfg,
uri,
@@ -564,7 +564,7 @@
if (ul->uri != NULL)
GNUNET_ECRS_uri_destroy (ul->uri);
if (ul->meta != NULL)
- GNUNET_ECRS_meta_data_destroy (ul->meta);
+ GNUNET_meta_data_destroy (ul->meta);
/* unlink from parent */
next = ul->parent->child;
if (next == NULL)
@@ -602,7 +602,7 @@
const struct GNUNET_ECRS_URI
*keywords,
const struct
- GNUNET_ECRS_MetaData *md,
+ GNUNET_MetaData *md,
struct
GNUNET_FSUI_UploadList
*parent);
@@ -613,17 +613,17 @@
struct GNUNET_FSUI_UploadList *parent = data;
char *filename;
struct GNUNET_FSUI_UploadList *child;
- struct GNUNET_ECRS_MetaData *md;
+ struct GNUNET_MetaData *md;
filename = GNUNET_malloc (strlen (dirName) + strlen (name) + 2);
strcpy (filename, dirName);
if (dirName[strlen (dirName) - 1] != DIR_SEPARATOR)
strcat (filename, DIR_SEPARATOR_STR);
strcat (filename, name);
- md = GNUNET_ECRS_meta_data_create ();
+ md = GNUNET_meta_data_create ();
child = addUploads (parent->shared, filename, NULL, md, parent);
GNUNET_free (filename);
- GNUNET_ECRS_meta_data_destroy (md);
+ GNUNET_meta_data_destroy (md);
if (child == NULL)
return GNUNET_SYSERR;
parent->total += child->total;
@@ -634,7 +634,7 @@
addUploads (struct GNUNET_FSUI_UploadShared *shared,
const char *filename,
const struct GNUNET_ECRS_URI *keywords,
- const struct GNUNET_ECRS_MetaData *md,
+ const struct GNUNET_MetaData *md,
struct GNUNET_FSUI_UploadList *parent)
{
GNUNET_FSUI_UploadList *utc;
@@ -663,8 +663,8 @@
}
utc->meta =
(md ==
- NULL) ? GNUNET_ECRS_meta_data_create () :
- GNUNET_ECRS_meta_data_duplicate (md);
+ NULL) ? GNUNET_meta_data_create () :
+ GNUNET_meta_data_duplicate (md);
}
else
{
@@ -678,10 +678,10 @@
GNUNET_free (utc);
return NULL;
}
- utc->meta = GNUNET_ECRS_meta_data_duplicate (md);
- GNUNET_ECRS_meta_data_insert (utc->meta,
- EXTRACTOR_MIMETYPE,
- GNUNET_DIRECTORY_MIME);
+ utc->meta = GNUNET_meta_data_duplicate (md);
+ GNUNET_meta_data_insert (utc->meta,
+ EXTRACTOR_MIMETYPE,
+ GNUNET_DIRECTORY_MIME);
}
if (keywords != NULL)
utc->keywords = GNUNET_ECRS_uri_duplicate (keywords);
@@ -749,7 +749,7 @@
int doExtract,
int individualKeywords,
GNUNET_CronTime expiration,
- const struct GNUNET_ECRS_MetaData *md,
+ const struct GNUNET_MetaData *md,
const struct GNUNET_ECRS_URI *globalURI,
const struct GNUNET_ECRS_URI *keyUri)
{
Modified: GNUnet/src/applications/fs/fsui/upload_unindex_persistence_test.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload_unindex_persistence_test.c
2008-06-04 05:56:31 UTC (rev 7043)
+++ GNUnet/src/applications/fs/fsui/upload_unindex_persistence_test.c
2008-06-04 05:57:05 UTC (rev 7044)
@@ -163,7 +163,7 @@
};
int prog;
char *buf;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
struct GNUNET_ECRS_URI *kuri = NULL;
struct GNUNET_GC_Configuration *cfg;
@@ -193,7 +193,7 @@
buf[i] = GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 256);
GNUNET_disk_file_write (ectx, fn, buf, FILESIZE, "600");
GNUNET_free (buf);
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
kuri =
GNUNET_ECRS_keyword_command_line_to_uri (ectx, 2,
(const char **) keywords);
@@ -208,7 +208,7 @@
CHECK (upload != NULL);
GNUNET_ECRS_uri_destroy (kuri);
kuri = NULL;
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
prog = 0;
suspendRestart = 4;
while (lastEvent != GNUNET_FSUI_upload_completed)
Modified: GNUnet/src/applications/fs/gap/test_linear_topology.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_linear_topology.c 2008-06-04
05:56:31 UTC (rev 7043)
+++ GNUnet/src/applications/fs/gap/test_linear_topology.c 2008-06-04
05:57:05 UTC (rev 7044)
@@ -115,14 +115,14 @@
NULL, &testTerminate, NULL, &uri);
if (ret != GNUNET_SYSERR)
{
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
struct GNUNET_ECRS_URI *key;
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
key = GNUNET_ECRS_keyword_string_to_uri (NULL, name);
ret = GNUNET_ECRS_publish_under_keyword (ectx, cfg, key, 0, 0,
GNUNET_get_time () + 100 * GNUNET_CRON_MINUTES, /* expire */
uri, meta);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
GNUNET_ECRS_uri_destroy (uri);
GNUNET_free (name);
if (ret == GNUNET_OK)
Modified: GNUnet/src/applications/fs/gap/test_loopback.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_loopback.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/gap/test_loopback.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -110,14 +110,14 @@
&uri);
if (ret != GNUNET_SYSERR)
{
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
struct GNUNET_ECRS_URI *key;
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
key = GNUNET_ECRS_keyword_string_to_uri (NULL, name);
ret = GNUNET_ECRS_publish_under_keyword (ectx, cfg, key, 0, 0,
GNUNET_get_time () + 10 * GNUNET_CRON_MINUTES, /* expire */
uri, meta);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
GNUNET_ECRS_uri_destroy (uri);
GNUNET_free (name);
if (ret == GNUNET_OK)
Modified: GNUnet/src/applications/fs/gap/test_multi_results.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_multi_results.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/gap/test_multi_results.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -100,12 +100,12 @@
NULL, NULL, &testTerminate, NULL, &uri);
if (ret != GNUNET_SYSERR)
{
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
ret = GNUNET_ECRS_publish_under_keyword (ectx, cfg, key, 0, 0,
GNUNET_get_time () + 100 * GNUNET_CRON_MINUTES, /* expire */
uri, meta);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
GNUNET_free (name);
if (ret == GNUNET_OK)
return uri;
Modified: GNUnet/src/applications/fs/namespace/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/namespace/Makefile.am 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/namespace/Makefile.am 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -10,7 +10,6 @@
update_info.c \
uri.c
libgnunetnamespace_la_LIBADD = \
- $(top_builddir)/src/applications/fs/pseudonyms/libgnunetpseudonym.la \
$(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
$(top_builddir)/src/util/libgnunetutil.la
Modified: GNUnet/src/applications/fs/namespace/info.c
===================================================================
--- GNUnet/src/applications/fs/namespace/info.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/namespace/info.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -26,7 +26,6 @@
#include "platform.h"
#include "gnunet_directories.h"
-#include "gnunet_pseudonym_lib.h"
#include "gnunet_namespace_lib.h"
#include "gnunet_util.h"
#include "common.h"
@@ -45,7 +44,7 @@
unsigned int anonymityLevel,
unsigned int insertPriority,
GNUNET_CronTime insertExpiration,
- const struct GNUNET_ECRS_MetaData *meta,
+ const struct GNUNET_MetaData *meta,
const struct GNUNET_ECRS_URI *advertisementURI,
const GNUNET_HashCode * rootEntry)
{
@@ -63,7 +62,7 @@
{
GNUNET_NS_namespace_set_root (ectx, cfg, ret);
GNUNET_ECRS_uri_get_namespace_from_sks (ret, &id);
- GNUNET_PSEUDO_add (ectx, cfg, &id, meta);
+ GNUNET_pseudonym_add (ectx, cfg, &id, meta);
}
return ret;
}
Modified: GNUnet/src/applications/fs/namespace/namespace_infotest.c
===================================================================
--- GNUnet/src/applications/fs/namespace/namespace_infotest.c 2008-06-04
05:56:31 UTC (rev 7043)
+++ GNUnet/src/applications/fs/namespace/namespace_infotest.c 2008-06-04
05:57:05 UTC (rev 7044)
@@ -44,7 +44,7 @@
int ok;
struct GNUNET_ECRS_URI *uri = NULL;
struct GNUNET_ECRS_URI *euri = NULL;
- struct GNUNET_ECRS_MetaData *meta = NULL;
+ struct GNUNET_MetaData *meta = NULL;
GNUNET_HashCode root;
GNUNET_HashCode nsid;
int old;
@@ -67,8 +67,8 @@
GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS); /* give apps time to
start */
/* ACTUAL TEST CODE */
- meta = GNUNET_ECRS_meta_data_create ();
- GNUNET_ECRS_meta_data_insert (meta, 0, "test");
+ meta = GNUNET_meta_data_create ();
+ GNUNET_meta_data_insert (meta, 0, "test");
GNUNET_create_random_hash (&root);
uri = GNUNET_NS_namespace_create (ectx,
cfg,
@@ -98,7 +98,7 @@
if (euri != NULL)
GNUNET_ECRS_uri_destroy (euri);
if (meta != NULL)
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
GNUNET_ECRS_namespace_delete (ectx, cfg, &nsid);
GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
Modified: GNUnet/src/applications/fs/namespace/update_info.c
===================================================================
--- GNUnet/src/applications/fs/namespace/update_info.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/namespace/update_info.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -104,7 +104,7 @@
}
if (fi != NULL)
{
- fi->meta = GNUNET_ECRS_meta_data_deserialize (ectx, &uri[pos], size);
+ fi->meta = GNUNET_meta_data_deserialize (ectx, &uri[pos], size);
if (fi->meta == NULL)
{
GNUNET_free (buf);
@@ -114,7 +114,7 @@
fi->uri = GNUNET_ECRS_string_to_uri (ectx, uri);
if (fi->uri == NULL)
{
- GNUNET_ECRS_meta_data_destroy (fi->meta);
+ GNUNET_meta_data_destroy (fi->meta);
fi->meta = NULL;
GNUNET_free (buf);
GNUNET_GE_BREAK (ectx, 0);
@@ -152,8 +152,8 @@
uri = GNUNET_ECRS_uri_to_string (fi->uri);
metaSize =
- GNUNET_ECRS_meta_data_get_serialized_size (fi->meta,
- GNUNET_ECRS_SERIALIZE_FULL);
+ GNUNET_meta_data_get_serialized_size (fi->meta,
+ GNUNET_SERIALIZE_FULL);
size = sizeof (struct UpdateData) + metaSize + strlen (uri) + 1;
buf = GNUNET_malloc (size);
buf->nextId = *nextId;
@@ -163,12 +163,12 @@
memcpy (&buf[1], uri, strlen (uri) + 1);
GNUNET_GE_ASSERT (ectx,
metaSize ==
- GNUNET_ECRS_meta_data_serialize (ectx,
- fi->meta,
- &((char *)
- &buf[1])[strlen (uri) +
- 1], metaSize,
-
GNUNET_ECRS_SERIALIZE_FULL));
+ GNUNET_meta_data_serialize (ectx,
+ fi->meta,
+ &((char *)
+ &buf[1])[strlen (uri) +
+ 1], metaSize,
+ GNUNET_SERIALIZE_FULL));
GNUNET_free (uri);
fn = GNUNET_NS_internal_get_data_filename_ (ectx,
cfg,
@@ -248,7 +248,7 @@
const GNUNET_HashCode * thisId,
const GNUNET_HashCode * nextId,
const struct GNUNET_ECRS_URI *dst,
- const struct GNUNET_ECRS_MetaData *md)
+ const struct GNUNET_MetaData *md)
{
GNUNET_Int32Time creationTime;
GNUNET_HashCode nid;
@@ -374,7 +374,7 @@
if ((uri != NULL) && (dst != NULL))
{
fi.uri = (struct GNUNET_ECRS_URI *) dst;
- fi.meta = (struct GNUNET_ECRS_MetaData *) md;
+ fi.meta = (struct GNUNET_MetaData *) md;
write_update_data (ectx,
cfg,
nsid, &tid, &nid, &fi, updateInterval, creationTime);
@@ -447,12 +447,12 @@
&fi, &lastId, &nextId, pubFreq, nextTime))
{
GNUNET_ECRS_uri_destroy (fi.uri);
- GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_meta_data_destroy (fi.meta);
return GNUNET_SYSERR;
}
}
GNUNET_ECRS_uri_destroy (fi.uri);
- GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_meta_data_destroy (fi.meta);
return GNUNET_OK;
}
Modified: GNUnet/src/applications/fs/namespace/uri.c
===================================================================
--- GNUnet/src/applications/fs/namespace/uri.c 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/applications/fs/namespace/uri.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -33,7 +33,6 @@
#include "platform.h"
#include "gnunet_ecrs_lib.h"
#include "gnunet_namespace_lib.h"
-#include "gnunet_pseudonym_lib.h"
/**
* Convert namespace URI to a human readable format
@@ -54,7 +53,7 @@
if (!GNUNET_ECRS_uri_test_sks (uri))
return NULL;
GNUNET_ECRS_uri_get_namespace_from_sks (uri, &nsid);
- name = GNUNET_PSEUDO_id_to_name (ectx, cfg, &nsid);
+ name = GNUNET_pseudonym_id_to_name (ectx, cfg, &nsid);
if (name == NULL)
return GNUNET_ECRS_uri_to_string (uri);
GNUNET_ECRS_uri_get_content_hash_from_sks (uri, &chk);
Modified: GNUnet/src/applications/fs/tools/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/tools/Makefile.am 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/tools/Makefile.am 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -24,7 +24,6 @@
gnunet-insert.c
gnunet_insert_LDADD = \
- $(top_builddir)/src/applications/fs/pseudonyms/libgnunetpseudonym.la \
$(top_builddir)/src/applications/fs/namespace/libgnunetnamespace.la \
$(top_builddir)/src/applications/fs/uritrack/libgnuneturitrack.la \
$(top_builddir)/src/applications/fs/fsui/libgnunetfsui.la \
@@ -46,7 +45,6 @@
gnunet_pseudonym_SOURCES = \
gnunet-pseudonym.c
gnunet_pseudonym_LDADD = \
- $(top_builddir)/src/applications/fs/pseudonyms/libgnunetpseudonym.la \
$(top_builddir)/src/applications/fs/namespace/libgnunetnamespace.la \
$(top_builddir)/src/applications/fs/uritrack/libgnuneturitrack.la \
$(top_builddir)/src/applications/fs/collection/libgnunetcollection.la \
Modified: GNUnet/src/applications/fs/tools/gnunet-auto-share.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-auto-share.c 2008-06-04
05:56:31 UTC (rev 7043)
+++ GNUnet/src/applications/fs/tools/gnunet-auto-share.c 2008-06-04
05:57:05 UTC (rev 7044)
@@ -236,7 +236,7 @@
struct AddMetadataClosure
{
const char *filename;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
};
@@ -273,7 +273,7 @@
section, option, NULL, &value);
if (value != NULL)
{
- GNUNET_ECRS_meta_data_insert (amc->meta, type, value);
+ GNUNET_meta_data_insert (amc->meta, type, value);
GNUNET_free (value);
}
return 0;
@@ -314,18 +314,18 @@
GNUNET_free (fn);
return GNUNET_OK;
}
- amc.meta = GNUNET_ECRS_meta_data_create ();
+ amc.meta = GNUNET_meta_data_create ();
amc.filename = filename;
/* attaching a listener will prompt iteration
over all config values! */
GNUNET_GC_attach_change_listener (meta_cfg, &add_meta_data, &amc);
GNUNET_GC_detach_change_listener (meta_cfg, &add_meta_data, &amc);
- keys = GNUNET_ECRS_meta_data_get_by_type (amc.meta, EXTRACTOR_KEYWORDS);
+ keys = GNUNET_meta_data_get_by_type (amc.meta, EXTRACTOR_KEYWORDS);
if (keys != NULL)
kuri = GNUNET_ECRS_keyword_string_to_uri (NULL, keys);
else
kuri = NULL;
- GNUNET_ECRS_meta_data_delete (amc.meta, EXTRACTOR_KEYWORDS, keys);
+ GNUNET_meta_data_delete (amc.meta, EXTRACTOR_KEYWORDS, keys);
GNUNET_free_non_null (keys);
ul = GNUNET_FSUI_upload_start (ctx,
fn,
@@ -337,7 +337,7 @@
amc.meta, gloKeywords, kuri);
if (kuri != NULL)
GNUNET_ECRS_uri_destroy (kuri);
- GNUNET_ECRS_meta_data_destroy (amc.meta);
+ GNUNET_meta_data_destroy (amc.meta);
GNUNET_free (fn);
return GNUNET_SYSERR;
}
Modified: GNUnet/src/applications/fs/tools/gnunet-directory.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-directory.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/tools/gnunet-directory.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -52,9 +52,9 @@
}
static void
-printMeta (const struct GNUNET_ECRS_MetaData *meta)
+printMeta (const struct GNUNET_MetaData *meta)
{
- GNUNET_ECRS_meta_data_get_contents (meta, &itemPrinter, NULL);
+ GNUNET_meta_data_get_contents (meta, &itemPrinter, NULL);
}
static int
@@ -74,7 +74,7 @@
printDirectory (const char *filename)
{
unsigned long long len;
- struct GNUNET_ECRS_MetaData *md;
+ struct GNUNET_MetaData *md;
char *data;
int ret;
char *name;
@@ -121,7 +121,7 @@
if (md != NULL)
{
printMeta (md);
- GNUNET_ECRS_meta_data_destroy (md);
+ GNUNET_meta_data_destroy (md);
}
printf ("\n");
GNUNET_free (name);
Modified: GNUnet/src/applications/fs/tools/gnunet-download.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-download.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/tools/gnunet-download.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -174,11 +174,11 @@
const GNUNET_HashCode * key, int isRoot, void *cls)
{
struct GNUNET_FSUI_Context *ctx = cls;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
char *fn;
char *f;
- f = GNUNET_ECRS_meta_data_get_first_by_types (fi->meta,
+ f = GNUNET_meta_data_get_first_by_types (fi->meta,
EXTRACTOR_FILENAME,
EXTRACTOR_TITLE,
EXTRACTOR_ARTIST,
@@ -196,11 +196,11 @@
if (verbose > 1)
printf (_("Starting download `%s'\n"), f);
GNUNET_free (f);
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
GNUNET_FSUI_download_start (ctx,
anonymity, do_recursive, fi->uri, meta, fn,
NULL, NULL);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
GNUNET_free (fn);
return GNUNET_OK;
}
@@ -220,7 +220,7 @@
int try_rename;
struct GNUNET_FSUI_Context *ctx;
struct GNUNET_ECRS_URI *uri;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
int i;
i = GNUNET_init (argc,
@@ -346,13 +346,13 @@
GNUNET_free (efn);
goto quit;
}
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
count = GNUNET_ECRS_directory_list_contents (ectx,
data,
sbuf.st_size,
&meta, &directoryIterator,
ctx);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
MUNMAP (data, sbuf.st_size);
CLOSE (fd);
GNUNET_free (efn);
@@ -367,12 +367,12 @@
}
else
{
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
dl = GNUNET_FSUI_download_start (ctx,
anonymity,
do_recursive, uri, meta, filename,
NULL, NULL);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
if (dl == NULL)
{
GNUNET_FSUI_stop (ctx);
Modified: GNUnet/src/applications/fs/tools/gnunet-insert.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-insert.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/tools/gnunet-insert.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -31,7 +31,6 @@
#include "gnunet_directories.h"
#include "gnunet_fsui_lib.h"
#include "gnunet_namespace_lib.h"
-#include "gnunet_pseudonym_lib.h"
#include "gnunet_util.h"
/* hmm. Man says time.h, but that doesn't yield the
@@ -54,13 +53,13 @@
static char *cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE;
-static struct GNUNET_ECRS_MetaData *meta;
+static struct GNUNET_MetaData *meta;
static struct GNUNET_ECRS_URI *topKeywords;
static struct GNUNET_ECRS_URI *gloKeywords;
-static struct GNUNET_ECRS_MetaData *meta;
+static struct GNUNET_MetaData *meta;
static unsigned int anonymity = 1;
@@ -120,7 +119,7 @@
convertId (next_id, &nextId);
convertId (this_id, &thisId);
convertId (prev_id, &prevId);
- if (GNUNET_OK != GNUNET_PSEUDO_name_to_id (ectx, cfg, pseudonym, &nsid))
+ if (GNUNET_OK != GNUNET_pseudonym_name_to_id (ectx, cfg, pseudonym, &nsid))
{
printf (_("\tUnknown namespace `%s'\n"), pseudonym);
return;
@@ -375,7 +374,7 @@
unsigned long long verbose;
GNUNET_HashCode pid;
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
i = GNUNET_init (argc,
argv,
"gnunet-insert [OPTIONS] FILENAME",
@@ -436,7 +435,7 @@
listKeywords (fname, dirname, l);
GNUNET_free (dirname);
EXTRACTOR_removeAll (l);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
meta = NULL;
errorCode = 0;
@@ -451,7 +450,7 @@
if (pseudonym != NULL)
{
if ((GNUNET_OK !=
- GNUNET_PSEUDO_name_to_id (ectx, cfg,
+ GNUNET_pseudonym_name_to_id (ectx, cfg,
pseudonym, &pid)) ||
(GNUNET_OK != GNUNET_ECRS_namespace_test_exists (ectx, cfg, &pid)))
{
@@ -562,7 +561,7 @@
/* first insert all of the top-level files or directories */
tmp = GNUNET_expand_file_name (ectx, filename);
if (!do_disable_creation_time)
- GNUNET_ECRS_meta_data_add_publication_date (meta);
+ GNUNET_meta_data_add_publication_date (meta);
start_time = GNUNET_get_time ();
errorCode = 1;
ul = GNUNET_FSUI_upload_start (ctx,
@@ -585,7 +584,7 @@
GNUNET_FSUI_stop (ctx);
quit:
if (meta != NULL)
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
if (gloKeywords != NULL)
GNUNET_ECRS_uri_destroy (gloKeywords);
if (topKeywords != NULL)
Modified: GNUnet/src/applications/fs/tools/gnunet-pseudonym.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-pseudonym.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/tools/gnunet-pseudonym.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -28,7 +28,6 @@
#include "gnunet_directories.h"
#include "gnunet_collection_lib.h"
#include "gnunet_namespace_lib.h"
-#include "gnunet_pseudonym_lib.h"
#include "gnunet_util.h"
static struct GNUNET_GE_Context *ectx;
@@ -59,7 +58,7 @@
static char *cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE;
-static struct GNUNET_ECRS_MetaData *meta;
+static struct GNUNET_MetaData *meta;
static struct GNUNET_ECRS_URI *advertisement;
@@ -121,22 +120,22 @@
}
static void
-printMeta (const struct GNUNET_ECRS_MetaData *m)
+printMeta (const struct GNUNET_MetaData *m)
{
- GNUNET_ECRS_meta_data_get_contents (m, &itemPrinter, NULL);
+ GNUNET_meta_data_get_contents (m, &itemPrinter, NULL);
}
static int
namespacePrinter (void *unused,
const GNUNET_HashCode * id,
- const struct GNUNET_ECRS_MetaData *md, int rating)
+ const struct GNUNET_MetaData *md, int rating)
{
GNUNET_EncName enc;
GNUNET_HashCode nsid;
int cpos;
char *namespaceName;
- namespaceName = GNUNET_PSEUDO_id_to_name (ectx, cfg, id);
+ namespaceName = GNUNET_pseudonym_id_to_name (ectx, cfg, id);
GNUNET_hash_to_enc (id, &enc);
if (0 == strcmp (namespaceName, (char *) &enc))
printf (_("Namespace `%s' has rating %d.\n"), namespaceName, rating);
@@ -170,9 +169,9 @@
if (delta != 0)
{
if (GNUNET_OK ==
- GNUNET_PSEUDO_name_to_id (ectx, cfg, namespaceName, &nsid))
+ GNUNET_pseudonym_name_to_id (ectx, cfg, namespaceName, &nsid))
{
- rating = GNUNET_PSEUDO_rank (ectx, cfg, &nsid, delta);
+ rating = GNUNET_pseudonym_rank (ectx, cfg, &nsid, delta);
printf (_("\tRating (after update): %d\n"), rating);
}
else
@@ -198,14 +197,14 @@
char *root;
char *ns_name;
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
i = GNUNET_init (argc,
argv,
"gnunet-pseudonym [OPTIONS]",
&cfgFilename, gnunetpseudonymOptions, &ectx, &cfg);
if (i == -1)
{
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
GNUNET_fini (ectx, cfg);
return -1;
}
@@ -225,7 +224,7 @@
if (delete_name != NULL)
{
if (GNUNET_OK ==
- GNUNET_PSEUDO_name_to_id (ectx, cfg, delete_name, &nsid))
+ GNUNET_pseudonym_name_to_id (ectx, cfg, delete_name, &nsid))
{
if (GNUNET_OK == GNUNET_NS_namespace_delete (ectx, cfg, &nsid))
{
@@ -248,7 +247,7 @@
/* create collections / namespace */
if (create_name != NULL)
{
- GNUNET_ECRS_meta_data_insert (meta, EXTRACTOR_TITLE, create_name);
+ GNUNET_meta_data_insert (meta, EXTRACTOR_TITLE, create_name);
if (start_collection)
{
/* FIXME: allow other update policies */
@@ -304,7 +303,7 @@
else
{
GNUNET_ECRS_uri_get_namespace_from_sks (rootURI, &nsid);
- ns_name = GNUNET_PSEUDO_id_to_name (ectx, cfg, &nsid);
+ ns_name = GNUNET_pseudonym_id_to_name (ectx, cfg, &nsid);
root = GNUNET_ECRS_uri_to_string (rootURI);
printf (_("Namespace `%s' created (root: %s).\n"),
ns_name, root);
@@ -315,7 +314,7 @@
if (NULL != advertisement)
GNUNET_ECRS_uri_destroy (advertisement);
}
- GNUNET_ECRS_meta_data_delete (meta, EXTRACTOR_TITLE, create_name);
+ GNUNET_meta_data_delete (meta, EXTRACTOR_TITLE, create_name);
GNUNET_free (create_name);
create_name = NULL;
}
@@ -329,11 +328,11 @@
if (0 == be_quiet)
{
/* print information about pseudonyms */
- cnt = GNUNET_PSEUDO_list_all (ectx, cfg, &namespacePrinter, NULL);
+ cnt = GNUNET_pseudonym_list_all (ectx, cfg, &namespacePrinter, NULL);
if (cnt == -1)
printf (_("Could not access namespace information.\n"));
}
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
GNUNET_CO_done ();
GNUNET_fini (ectx, cfg);
return success;
Modified: GNUnet/src/applications/fs/tools/gnunet-search.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-search.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/tools/gnunet-search.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -57,9 +57,9 @@
}
static void
-printMeta (const struct GNUNET_ECRS_MetaData *meta)
+printMeta (const struct GNUNET_MetaData *meta)
{
- GNUNET_ECRS_meta_data_get_contents (meta, &itemPrinter, NULL);
+ GNUNET_meta_data_get_contents (meta, &itemPrinter, NULL);
}
/**
@@ -83,12 +83,12 @@
fis[fiCount - 1].uri =
GNUNET_ECRS_uri_duplicate (event->data.SearchResult.fi.uri);
fis[fiCount - 1].meta =
- GNUNET_ECRS_meta_data_duplicate (event->data.SearchResult.fi.meta);
+ GNUNET_meta_data_duplicate (event->data.SearchResult.fi.meta);
uri = GNUNET_ECRS_uri_to_string (event->data.SearchResult.fi.uri);
printf ("%s:\n", uri);
filename =
- GNUNET_ECRS_meta_data_get_by_type (event->data.SearchResult.fi.meta,
+ GNUNET_meta_data_get_by_type (event->data.SearchResult.fi.meta,
EXTRACTOR_FILENAME);
if (filename != NULL)
{
@@ -199,9 +199,9 @@
char *outfile;
unsigned long long n;
char *data;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
/* ?: anything here to put into meta? */
if (GNUNET_OK ==
GNUNET_ECRS_directory_create (ectx, &data, &n, fiCount, fis, meta))
@@ -216,7 +216,7 @@
for (i = 0; i < fiCount; i++)
{
GNUNET_ECRS_uri_destroy (fis[i].uri);
- GNUNET_ECRS_meta_data_destroy (fis[i].meta);
+ GNUNET_meta_data_destroy (fis[i].meta);
}
GNUNET_array_grow (fis, fiCount, 0);
quit:
Modified: GNUnet/src/applications/fs/uritrack/file_info.c
===================================================================
--- GNUnet/src/applications/fs/uritrack/file_info.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/uritrack/file_info.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -184,19 +184,19 @@
GNUNET_URITRACK_list (ectx, cfg, GNUNET_NO, &checkPresent, &cpc);
if (cpc.present == 1)
return;
- size = GNUNET_ECRS_meta_data_get_serialized_size (fi->meta,
- GNUNET_ECRS_SERIALIZE_FULL
- |
-
GNUNET_ECRS_SERIALIZE_NO_COMPRESS);
+ size = GNUNET_meta_data_get_serialized_size (fi->meta,
+ GNUNET_SERIALIZE_FULL
+ |
+ GNUNET_SERIALIZE_NO_COMPRESS);
data = GNUNET_malloc (size);
GNUNET_GE_ASSERT (ectx,
- size == GNUNET_ECRS_meta_data_serialize (ectx,
- fi->meta,
- data,
- size,
-
GNUNET_ECRS_SERIALIZE_FULL
- |
-
GNUNET_ECRS_SERIALIZE_NO_COMPRESS));
+ size == GNUNET_meta_data_serialize (ectx,
+ fi->meta,
+ data,
+ size,
+ GNUNET_SERIALIZE_FULL
+ |
+
GNUNET_SERIALIZE_NO_COMPRESS));
size = htonl (size);
suri = GNUNET_ECRS_uri_to_string (fi->uri);
sem = createIPC (ectx, cfg);
@@ -363,7 +363,7 @@
if (need_metadata == GNUNET_YES)
{
fi.meta =
- GNUNET_ECRS_meta_data_deserialize (ectx, &result[spos], msize);
+ GNUNET_meta_data_deserialize (ectx, &result[spos], msize);
if (fi.meta == NULL)
{
GNUNET_GE_BREAK (ectx, 0);
@@ -381,7 +381,7 @@
if (GNUNET_OK != iterator (&fi, NULL, GNUNET_NO, closure))
{
if (fi.meta != NULL)
- GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_meta_data_destroy (fi.meta);
GNUNET_ECRS_uri_destroy (fi.uri);
if (0 != MUNMAP (result, buf.st_size))
GNUNET_GE_LOG_STRERROR_FILE (ectx,
@@ -396,7 +396,7 @@
}
rval++;
if (fi.meta != NULL)
- GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_meta_data_destroy (fi.meta);
GNUNET_ECRS_uri_destroy (fi.uri);
}
if (0 != MUNMAP (result, buf.st_size))
Modified: GNUnet/src/applications/fs/uritrack/tracktest.c
===================================================================
--- GNUnet/src/applications/fs/uritrack/tracktest.c 2008-06-04 05:56:31 UTC
(rev 7043)
+++ GNUnet/src/applications/fs/uritrack/tracktest.c 2008-06-04 05:57:05 UTC
(rev 7044)
@@ -45,7 +45,7 @@
{
if ((fi1.meta != NULL) &&
(fi1.uri != NULL) &&
- (GNUNET_ECRS_meta_data_test_equal (fi->meta,
+ (GNUNET_meta_data_test_equal (fi->meta,
fi1.meta))
&& (GNUNET_ECRS_uri_test_equal (fi->uri, fi1.uri)))
{
@@ -54,7 +54,7 @@
}
if ((fi2.meta != NULL) &&
(fi2.uri != NULL) &&
- (GNUNET_ECRS_meta_data_test_equal (fi->meta,
+ (GNUNET_meta_data_test_equal (fi->meta,
fi2.meta))
&& (GNUNET_ECRS_uri_test_equal (fi->uri, fi2.uri)))
{
@@ -70,25 +70,25 @@
{
if ((fi1.meta != NULL) &&
(fi1.uri != NULL) &&
- (GNUNET_ECRS_meta_data_test_equal (fi->meta,
+ (GNUNET_meta_data_test_equal (fi->meta,
fi1.meta))
&& (GNUNET_ECRS_uri_test_equal (fi->uri, fi1.uri)))
{
GNUNET_ECRS_uri_destroy (fi1.uri);
fi1.uri = NULL;
- GNUNET_ECRS_meta_data_destroy (fi1.meta);
+ GNUNET_meta_data_destroy (fi1.meta);
fi1.meta = NULL;
return GNUNET_OK;
}
if ((fi2.meta != NULL) &&
(fi2.uri != NULL) &&
- (GNUNET_ECRS_meta_data_test_equal (fi->meta,
+ (GNUNET_meta_data_test_equal (fi->meta,
fi2.meta))
&& (GNUNET_ECRS_uri_test_equal (fi->uri, fi2.uri)))
{
GNUNET_ECRS_uri_destroy (fi2.uri);
fi2.uri = NULL;
- GNUNET_ECRS_meta_data_destroy (fi2.meta);
+ GNUNET_meta_data_destroy (fi2.meta);
fi2.meta = NULL;
return GNUNET_OK;
}
@@ -99,11 +99,11 @@
testTracking ()
{
fi1.uri = GNUNET_ECRS_keyword_string_to_uri (NULL, "foo");
- fi1.meta = GNUNET_ECRS_meta_data_create ();
- GNUNET_ECRS_meta_data_insert (fi1.meta, EXTRACTOR_MIMETYPE, "foo/bar");
+ fi1.meta = GNUNET_meta_data_create ();
+ GNUNET_meta_data_insert (fi1.meta, EXTRACTOR_MIMETYPE, "foo/bar");
fi2.uri = GNUNET_ECRS_keyword_string_to_uri (NULL, "foot");
- fi2.meta = GNUNET_ECRS_meta_data_create ();
- GNUNET_ECRS_meta_data_insert (fi2.meta, EXTRACTOR_MIMETYPE, "foo/bar");
+ fi2.meta = GNUNET_meta_data_create ();
+ GNUNET_meta_data_insert (fi2.meta, EXTRACTOR_MIMETYPE, "foo/bar");
GNUNET_URITRACK_clear (NULL, cfg);
GNUNET_URITRACK_register_track_callback (NULL, cfg, ¬ified, NULL);
Modified: GNUnet/src/include/Makefile.am
===================================================================
--- GNUnet/src/include/Makefile.am 2008-06-04 05:56:31 UTC (rev 7043)
+++ GNUnet/src/include/Makefile.am 2008-06-04 05:57:05 UTC (rev 7044)
@@ -34,7 +34,6 @@
gnunet_namespace_lib.h \
gnunet_pingpong_service.h \
gnunet_protocols.h \
- gnunet_pseudonym_lib.h \
gnunet_remote_lib.h \
gnunet_rpc_lib.h \
gnunet_rpc_service.h \
@@ -68,5 +67,6 @@
gnunet_util_network.h \
gnunet_util_network_client.h \
gnunet_util_os.h \
+ gnunet_util_pseudonym.h \
gnunet_util_string.h \
gnunet_util_threads.h
Modified: GNUnet/src/include/gnunet_chat_lib.h
===================================================================
--- GNUnet/src/include/gnunet_chat_lib.h 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/include/gnunet_chat_lib.h 2008-06-04 05:57:05 UTC (rev
7044)
@@ -109,7 +109,7 @@
typedef int (*GNUNET_CHAT_MessageCallback) (void *cls,
struct GNUNET_CHAT_Room * room,
const GNUNET_HashCode * sender,
- const struct GNUNET_ECRS_MetaData
+ const struct GNUNET_MetaData
* member_info,
const char *message,
GNUNET_CHAT_MSG_OPTIONS options);
@@ -121,7 +121,7 @@
*/
typedef int (*GNUNET_CHAT_MemberListCallback) (void *cls,
const struct
- GNUNET_ECRS_MetaData *
+ GNUNET_MetaData *
member_info,
const GNUNET_RSA_PublicKey *
member_id,
@@ -174,7 +174,7 @@
*ectx,
struct GNUNET_GC_Configuration
*cfg, const char *nick_name,
- struct GNUNET_ECRS_MetaData
+ struct GNUNET_MetaData
*member_info,
const char *room_name,
GNUNET_CHAT_MSG_OPTIONS
Modified: GNUnet/src/include/gnunet_collection_lib.h
===================================================================
--- GNUnet/src/include/gnunet_collection_lib.h 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/include/gnunet_collection_lib.h 2008-06-04 05:57:05 UTC (rev
7044)
@@ -56,7 +56,7 @@
int GNUNET_CO_collection_start (unsigned int anonymityLevel,
unsigned int priority,
GNUNET_Int32Time updateInterval,
- const struct GNUNET_ECRS_MetaData *meta);
+ const struct GNUNET_MetaData *meta);
/**
* Stop collection.
@@ -71,7 +71,7 @@
*
* @return NULL if there is no collection, otherwise its metadata
*/
-struct GNUNET_ECRS_MetaData *GNUNET_CO_collection_get_name (void);
+struct GNUNET_MetaData *GNUNET_CO_collection_get_name (void);
/**
* GNUNET_ND_UPLOAD an update of the current collection information to the
Modified: GNUnet/src/include/gnunet_ecrs_lib.h
===================================================================
--- GNUnet/src/include/gnunet_ecrs_lib.h 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/include/gnunet_ecrs_lib.h 2008-06-04 05:57:05 UTC (rev
7044)
@@ -78,22 +78,7 @@
#define GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC -1
#define GNUNET_ECRS_SBLOCK_UPDATE_NONE 0
-/* ***************** metadata API (meta.c) ******************** */
-
/**
- * Meta data to associate with a file, directory or namespace.
- */
-struct GNUNET_ECRS_MetaData;
-
-/**
- * Iterator over meta data.
- * @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort
- */
-typedef int (*GNUNET_ECRS_MetaDataProcessor) (EXTRACTOR_KeywordType type,
- const char *data,
- void *closure);
-
-/**
* Iterator over keywords
*
* @param keyword the keyword
@@ -104,159 +89,14 @@
int is_mandatory, void *closure);
/**
- * Create a fresh MetaData token.
- */
-struct GNUNET_ECRS_MetaData *GNUNET_ECRS_meta_data_create (void);
-
-/**
- * Duplicate a MetaData token.
- */
-struct GNUNET_ECRS_MetaData *GNUNET_ECRS_meta_data_duplicate (const struct
-
GNUNET_ECRS_MetaData
- *meta);
-
-/**
- * Free meta data.
- */
-void GNUNET_ECRS_meta_data_destroy (struct GNUNET_ECRS_MetaData *md);
-
-/**
- * Test if two MDs are equal.
- */
-int GNUNET_ECRS_meta_data_test_equal (const struct GNUNET_ECRS_MetaData *md1,
- const struct GNUNET_ECRS_MetaData *md2);
-
-
-/**
- * Extend metadata.
- * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists
- */
-int GNUNET_ECRS_meta_data_insert (struct GNUNET_ECRS_MetaData *md,
- EXTRACTOR_KeywordType type,
- const char *data);
-
-/**
- * Remove an item.
- * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md
- */
-int GNUNET_ECRS_meta_data_delete (struct GNUNET_ECRS_MetaData *md,
- EXTRACTOR_KeywordType type,
- const char *data);
-
-/**
- * Add the current time as the publication date
- * to the meta-data.
- */
-void GNUNET_ECRS_meta_data_add_publication_date (struct GNUNET_ECRS_MetaData
- *md);
-
-/**
- * Iterate over MD entries, excluding thumbnails.
- *
- * @return number of entries
- */
-int GNUNET_ECRS_meta_data_get_contents (const struct GNUNET_ECRS_MetaData *md,
- GNUNET_ECRS_MetaDataProcessor
- iterator, void *closure);
-
-/**
- * Get the first MD entry of the given type.
- * @return NULL if we do not have any such entry,
- * otherwise client is responsible for freeing the value!
- */
-char *GNUNET_ECRS_meta_data_get_by_type (const struct GNUNET_ECRS_MetaData
- *md, EXTRACTOR_KeywordType type);
-
-/**
- * Get the first matching MD entry of the given types.
- * @paarm ... -1-terminated list of types
- * @return NULL if we do not have any such entry,
- * otherwise client is responsible for freeing the value!
- */
-char *GNUNET_ECRS_meta_data_get_first_by_types (const struct
- GNUNET_ECRS_MetaData *md,
- ...);
-
-/**
- * Get a thumbnail from the meta-data (if present).
- *
- * @param thumb will be set to the thumbnail data. Must be
- * freed by the caller!
- * @return number of bytes in thumbnail, 0 if not available
- */
-size_t GNUNET_ECRS_meta_data_get_thumbnail (const struct GNUNET_ECRS_MetaData
- *md, unsigned char **thumb);
-
-/**
- * Extract meta-data from a file.
- *
- * @return GNUNET_SYSERR on error, otherwise the number
- * of meta-data items obtained
- */
-int GNUNET_ECRS_meta_data_extract_from_file (struct GNUNET_GE_Context *ectx,
- struct GNUNET_ECRS_MetaData *md,
- const char *filename,
- EXTRACTOR_ExtractorList *
- extractors);
-
-/* = 0 */
-#define GNUNET_ECRS_SERIALIZE_FULL GNUNET_NO
-
-/* = 1 */
-#define GNUNET_ECRS_SERIALIZE_PART GNUNET_YES
-
-/* disallow compression (if speed is important) */
-#define GNUNET_ECRS_SERIALIZE_NO_COMPRESS 2
-
-
-/**
- * Serialize meta-data to target.
- *
- * @param size maximum number of bytes available
- * @param part is it ok to just write SOME of the
- * meta-data to match the size constraint,
- * possibly discarding some data? GNUNET_YES/GNUNET_NO.
- * @return number of bytes written on success,
- * GNUNET_SYSERR on error (typically: not enough
- * space)
- */
-int GNUNET_ECRS_meta_data_serialize (struct GNUNET_GE_Context *ectx,
- const struct GNUNET_ECRS_MetaData *md,
- char *target, unsigned int size,
- int part);
-
-/**
- * Compute size of the meta-data in
- * serialized form.
- * @part flags (partial ok, may compress?)
- */
-unsigned int GNUNET_ECRS_meta_data_get_serialized_size (const struct
- GNUNET_ECRS_MetaData
- *md, int part);
-
-/**
- * Deserialize meta-data. Initializes md.
- * @param size number of bytes available
- * @return MD on success, NULL on error (i.e.
- * bad format)
- */
-struct GNUNET_ECRS_MetaData *GNUNET_ECRS_meta_data_deserialize (struct
-
GNUNET_GE_Context
- *ectx,
- const char
- *input,
- unsigned int
- size);
-
-/**
* Does the meta-data claim that this is a directory?
* Checks if the mime-type is that of a GNUnet directory.
*
* @return GNUNET_YES if it is, GNUNET_NO if it is not, GNUNET_SYSERR if
* we have no mime-type information (treat as 'GNUNET_NO')
*/
-int GNUNET_ECRS_meta_data_test_for_directory (const struct
- GNUNET_ECRS_MetaData *md);
+int GNUNET_meta_data_test_for_directory (const struct
+ GNUNET_MetaData *md);
/**
* Suggest a better filename for a file (and do the
@@ -476,14 +316,14 @@
* in the meta-data and construct one large keyword URI
* that lists all keywords that can be found in the meta-data).
*/
-struct GNUNET_ECRS_URI *GNUNET_ECRS_meta_data_to_uri (const struct
- GNUNET_ECRS_MetaData
+struct GNUNET_ECRS_URI *GNUNET_meta_data_to_uri (const struct
+ GNUNET_MetaData
*md);
typedef struct
{
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
struct GNUNET_ECRS_URI *uri;
} GNUNET_ECRS_FileInfo;
@@ -498,7 +338,7 @@
const char *value);
/**
- * @param scls must be of type "struct GNUNET_ECRS_MetaData **"
+ * @param scls must be of type "struct GNUNET_MetaData **"
*/
int
GNUNET_ECRS_getopt_configure_set_metadata (GNUNET_CommandLineProcessorContext
@@ -635,7 +475,7 @@
GNUNET_GC_Configuration
*cfg,
const struct
- GNUNET_ECRS_MetaData
+ GNUNET_MetaData
*meta,
unsigned int
anonymityLevel,
@@ -728,7 +568,7 @@
GNUNET_ECRS_URI
*dst,
const struct
- GNUNET_ECRS_MetaData
+ GNUNET_MetaData
*md);
/**
@@ -747,7 +587,7 @@
unsigned int priority,
GNUNET_CronTime expirationTime,
const struct GNUNET_ECRS_URI *dst,
- const struct GNUNET_ECRS_MetaData *md);
+ const struct GNUNET_MetaData *md);
/**
* The search has found another result. Callback to notify
@@ -941,7 +781,7 @@
int GNUNET_ECRS_directory_list_contents (struct GNUNET_GE_Context *ectx,
const char *data,
unsigned long long len,
- struct GNUNET_ECRS_MetaData **md,
+ struct GNUNET_MetaData **md,
GNUNET_ECRS_SearchResultProcessor
spcb, void *spcbClosure);
@@ -963,7 +803,7 @@
unsigned long long *len,
unsigned int count,
const GNUNET_ECRS_FileInfo * fis,
- struct GNUNET_ECRS_MetaData *meta);
+ struct GNUNET_MetaData *meta);
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_fsui_lib.h
===================================================================
--- GNUnet/src/include/gnunet_fsui_lib.h 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/include/gnunet_fsui_lib.h 2008-06-04 05:57:05 UTC (rev
7044)
@@ -974,7 +974,7 @@
*
* @return NULL on error
*/
-struct GNUNET_FSUI_DownloadList *GNUNET_FSUI_download_start (struct
GNUNET_FSUI_Context *ctx, unsigned int anonymityLevel, int doRecursive, const
struct GNUNET_ECRS_URI *uri, const struct GNUNET_ECRS_MetaData *meta, const
char *filename, struct GNUNET_FSUI_SearchList *parentSearch, struct
GNUNET_FSUI_DownloadList *parentDownload); /* download.c */
+struct GNUNET_FSUI_DownloadList *GNUNET_FSUI_download_start (struct
GNUNET_FSUI_Context *ctx, unsigned int anonymityLevel, int doRecursive, const
struct GNUNET_ECRS_URI *uri, const struct GNUNET_MetaData *meta, const char
*filename, struct GNUNET_FSUI_SearchList *parentSearch, struct
GNUNET_FSUI_DownloadList *parentDownload); /* download.c */
/**
* Abort a download. If the dl is for a recursive download, all
@@ -1042,7 +1042,7 @@
GNUNET_CronTime
expiration,
const struct
- GNUNET_ECRS_MetaData
+ GNUNET_MetaData
*topLevelMetaData,
const struct
GNUNET_ECRS_URI
Modified: GNUnet/src/include/gnunet_namespace_lib.h
===================================================================
--- GNUnet/src/include/gnunet_namespace_lib.h 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/include/gnunet_namespace_lib.h 2008-06-04 05:57:05 UTC (rev
7044)
@@ -77,7 +77,7 @@
GNUNET_CronTime
insertExpiration,
const struct
- GNUNET_ECRS_MetaData
+ GNUNET_MetaData
*meta,
const struct
GNUNET_ECRS_URI
@@ -171,7 +171,7 @@
const struct
GNUNET_ECRS_URI *dst,
const struct
- GNUNET_ECRS_MetaData *md);
+ GNUNET_MetaData *md);
/**
* Compute the next ID for peridodically updated content.
Deleted: GNUnet/src/include/gnunet_pseudonym_lib.h
===================================================================
--- GNUnet/src/include/gnunet_pseudonym_lib.h 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/include/gnunet_pseudonym_lib.h 2008-06-04 05:57:05 UTC (rev
7044)
@@ -1,126 +0,0 @@
-/*
- This file is part of GNUnet
- (C) 2004, 2005, 2006, 2008 Christian Grothoff (and other contributing
authors)
-
- 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
- option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-/**
- * @file include/gnunet_pseudonym_lib.h
- * @brief high-level support for pseudonyms
- * @author Christian Grothoff
- */
-
-#ifndef GNUNET_PSEUDONYM_LIB_H
-#define GNUNET_PSEUDONYM_LIB_H
-
-#include "gnunet_ecrs_lib.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#if 0 /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
-/**
- * Iterator over all known pseudonyms.
- *
- * @param rating the local rating of the pseudonym
- * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
- */
-typedef int (*GNUNET_PSEUDO_PseudonymIterator) (void *cls,
- const GNUNET_HashCode *
- pseudonym,
- const struct
- GNUNET_ECRS_MetaData * md,
- int rating);
-
-/**
- * Change the ranking of a pseudonym.
- *
- * @param pseudonym id of the pseudonym
- * @param delta by how much should the rating be changed?
- * @return new rating of the namespace
- */
-int GNUNET_PSEUDO_rank (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * pseudonym, int delta);
-
-/**
- * Add a pseudonym to the set of known pseudonyms.
- *
- * @param pseudonym the pseudonym's identifier
- */
-void GNUNET_PSEUDO_add (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * pseudo,
- const struct GNUNET_ECRS_MetaData *meta);
-
-
-/**
- * List all known pseudonyms.
- */
-int GNUNET_PSEUDO_list_all (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- GNUNET_PSEUDO_PseudonymIterator iterator,
- void *closure);
-
-/**
- * Register callback to be invoked whenever we discover
- * a new pseudonym.
- */
-int GNUNET_PSEUDO_register_discovery_callback (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration
- *cfg,
- GNUNET_PSEUDO_PseudonymIterator
- iterator, void *closure);
-
-/**
- * Unregister namespace discovery callback.
- */
-int
-GNUNET_PSEUDO_unregister_discovery_callback (GNUNET_PSEUDO_PseudonymIterator
- iterator, void *closure);
-
-/**
- * Return the unique, human readable name for the given pseudonym.
- *
- * @return NULL on failure (should never happen)
- */
-char *GNUNET_PSEUDO_id_to_name (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * pseudo);
-
-/**
- * Get the pseudonym ID belonging to the given human readable name.
- *
- * @return GNUNET_OK on success
- */
-int GNUNET_PSEUDO_name_to_id (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const char *hname, GNUNET_HashCode * psid);
-
-#if 0 /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
Modified: GNUnet/src/include/gnunet_util.h
===================================================================
--- GNUnet/src/include/gnunet_util.h 2008-06-04 05:56:31 UTC (rev 7043)
+++ GNUnet/src/include/gnunet_util.h 2008-06-04 05:57:05 UTC (rev 7044)
@@ -60,6 +60,7 @@
#include "gnunet_util_error_loggers.h"
#include "gnunet_util_containers.h"
#include "gnunet_util_cron.h"
+#include "gnunet_util_pseudonym.h"
#include "gnunet_util_boot.h"
#ifdef __cplusplus
Modified: GNUnet/src/include/gnunet_util_containers.h
===================================================================
--- GNUnet/src/include/gnunet_util_containers.h 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/include/gnunet_util_containers.h 2008-06-04 05:57:05 UTC (rev
7044)
@@ -36,6 +36,7 @@
/* add error and config prototypes */
#include "gnunet_util.h"
#include "gnunet_util_crypto.h"
+#include <extractor.h>
#ifdef __cplusplus
extern "C"
@@ -45,6 +46,8 @@
#endif
#endif
+/* ******************* bloomfilter ***************** */
+
/**
* @brief bloomfilter representation (opaque)
*/
@@ -168,6 +171,176 @@
void *iterator_arg,
unsigned int size, unsigned int k);
+/* ****************** metadata ******************* */
+
+/**
+ * Meta data to associate with a file, directory or namespace.
+ */
+struct GNUNET_MetaData;
+
+/**
+ * Iterator over meta data.
+ * @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort
+ */
+typedef int (*GNUNET_MetaDataProcessor) (EXTRACTOR_KeywordType type,
+ const char *data,
+ void *closure);
+
+/**
+ * Create a fresh MetaData token.
+ */
+struct GNUNET_MetaData *GNUNET_meta_data_create (void);
+
+/**
+ * Duplicate a MetaData token.
+ */
+struct GNUNET_MetaData *GNUNET_meta_data_duplicate (const struct
+ GNUNET_MetaData
+ *meta);
+
+/**
+ * Free meta data.
+ */
+void GNUNET_meta_data_destroy (struct GNUNET_MetaData *md);
+
+/**
+ * Test if two MDs are equal.
+ */
+int GNUNET_meta_data_test_equal (const struct GNUNET_MetaData *md1,
+ const struct GNUNET_MetaData *md2);
+
+
+/**
+ * Extend metadata.
+ * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists
+ */
+int GNUNET_meta_data_insert (struct GNUNET_MetaData *md,
+ EXTRACTOR_KeywordType type,
+ const char *data);
+
+/**
+ * Remove an item.
+ * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md
+ */
+int GNUNET_meta_data_delete (struct GNUNET_MetaData *md,
+ EXTRACTOR_KeywordType type,
+ const char *data);
+
+/**
+ * Add the current time as the publication date
+ * to the meta-data.
+ */
+void GNUNET_meta_data_add_publication_date (struct GNUNET_MetaData
+ *md);
+
+/**
+ * Iterate over MD entries, excluding thumbnails.
+ *
+ * @return number of entries
+ */
+int GNUNET_meta_data_get_contents (const struct GNUNET_MetaData *md,
+ GNUNET_MetaDataProcessor
+ iterator, void *closure);
+
+/**
+ * Get the first MD entry of the given type.
+ * @return NULL if we do not have any such entry,
+ * otherwise client is responsible for freeing the value!
+ */
+char *GNUNET_meta_data_get_by_type (const struct GNUNET_MetaData
+ *md, EXTRACTOR_KeywordType type);
+
+/**
+ * Get the first matching MD entry of the given types.
+ * @paarm ... -1-terminated list of types
+ * @return NULL if we do not have any such entry,
+ * otherwise client is responsible for freeing the value!
+ */
+char *GNUNET_meta_data_get_first_by_types (const struct
+ GNUNET_MetaData *md,
+ ...);
+
+/**
+ * Get a thumbnail from the meta-data (if present).
+ *
+ * @param thumb will be set to the thumbnail data. Must be
+ * freed by the caller!
+ * @return number of bytes in thumbnail, 0 if not available
+ */
+size_t GNUNET_meta_data_get_thumbnail (const struct GNUNET_MetaData
+ *md, unsigned char **thumb);
+
+/**
+ * Extract meta-data from a file.
+ *
+ * @return GNUNET_SYSERR on error, otherwise the number
+ * of meta-data items obtained
+ */
+int GNUNET_meta_data_extract_from_file (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_MetaData *md,
+ const char *filename,
+ EXTRACTOR_ExtractorList *
+ extractors);
+
+/* = 0 */
+#define GNUNET_SERIALIZE_FULL GNUNET_NO
+
+/* = 1 */
+#define GNUNET_SERIALIZE_PART GNUNET_YES
+
+/* disallow compression (if speed is important) */
+#define GNUNET_SERIALIZE_NO_COMPRESS 2
+
+
+/**
+ * Serialize meta-data to target.
+ *
+ * @param size maximum number of bytes available
+ * @param part is it ok to just write SOME of the
+ * meta-data to match the size constraint,
+ * possibly discarding some data? GNUNET_YES/GNUNET_NO.
+ * @return number of bytes written on success,
+ * GNUNET_SYSERR on error (typically: not enough
+ * space)
+ */
+int GNUNET_meta_data_serialize (struct GNUNET_GE_Context *ectx,
+ const struct GNUNET_MetaData *md,
+ char *target, unsigned int size,
+ int part);
+
+/**
+ * Compute size of the meta-data in
+ * serialized form.
+ * @part flags (partial ok, may compress?)
+ */
+unsigned int GNUNET_meta_data_get_serialized_size (const struct
+ GNUNET_MetaData
+ *md, int part);
+
+/**
+ * Deserialize meta-data. Initializes md.
+ * @param size number of bytes available
+ * @return MD on success, NULL on error (i.e.
+ * bad format)
+ */
+struct GNUNET_MetaData *GNUNET_meta_data_deserialize (struct
+
GNUNET_GE_Context
+ *ectx,
+ const char
+ *input,
+ unsigned int
+ size);
+
+/**
+ * Does the meta-data claim that this is a directory?
+ * Checks if the mime-type is that of a GNUnet directory.
+ *
+ * @return GNUNET_YES if it is, GNUNET_NO if it is not, GNUNET_SYSERR if
+ * we have no mime-type information (treat as 'GNUNET_NO')
+ */
+int GNUNET_meta_data_test_for_directory (const struct
+ GNUNET_MetaData *md);
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
Copied: GNUnet/src/include/gnunet_util_pseudonym.h (from rev 7026,
GNUnet/src/include/gnunet_pseudonym_lib.h)
===================================================================
--- GNUnet/src/include/gnunet_util_pseudonym.h (rev 0)
+++ GNUnet/src/include/gnunet_util_pseudonym.h 2008-06-04 05:57:05 UTC (rev
7044)
@@ -0,0 +1,126 @@
+/*
+ This file is part of GNUnet
+ (C) 2004, 2005, 2006, 2008 Christian Grothoff (and other contributing
authors)
+
+ 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
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file include/gnunet_pseudonym_lib.h
+ * @brief high-level support for pseudonyms
+ * @author Christian Grothoff
+ */
+
+#ifndef GNUNET_PSEUDONYM_LIB_H
+#define GNUNET_PSEUDONYM_LIB_H
+
+#include "gnunet_util_crypto.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0 /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+/**
+ * Iterator over all known pseudonyms.
+ *
+ * @param rating the local rating of the pseudonym
+ * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
+ */
+typedef int (*GNUNET_PseudonymIterator) (void *cls,
+ const GNUNET_HashCode *
+ pseudonym,
+ const struct
+ GNUNET_MetaData * md,
+ int rating);
+
+/**
+ * Change the ranking of a pseudonym.
+ *
+ * @param pseudonym id of the pseudonym
+ * @param delta by how much should the rating be changed?
+ * @return new rating of the namespace
+ */
+int GNUNET_pseudonym_rank (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * pseudonym, int delta);
+
+/**
+ * Add a pseudonym to the set of known pseudonyms.
+ *
+ * @param pseudonym the pseudonym's identifier
+ */
+void GNUNET_pseudonym_add (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * pseudo,
+ const struct GNUNET_MetaData *meta);
+
+
+/**
+ * List all known pseudonyms.
+ */
+int GNUNET_pseudonym_list_all (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ GNUNET_PseudonymIterator iterator,
+ void *closure);
+
+/**
+ * Register callback to be invoked whenever we discover
+ * a new pseudonym.
+ */
+int GNUNET_pseudonym_register_discovery_callback (struct GNUNET_GE_Context
*ectx,
+ struct GNUNET_GC_Configuration
+ *cfg,
+ GNUNET_PseudonymIterator
+ iterator, void *closure);
+
+/**
+ * Unregister namespace discovery callback.
+ */
+int
+GNUNET_pseudonym_unregister_discovery_callback (GNUNET_PseudonymIterator
+ iterator, void *closure);
+
+/**
+ * Return the unique, human readable name for the given pseudonym.
+ *
+ * @return NULL on failure (should never happen)
+ */
+char *GNUNET_pseudonym_id_to_name (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * pseudo);
+
+/**
+ * Get the pseudonym ID belonging to the given human readable name.
+ *
+ * @return GNUNET_OK on success
+ */
+int GNUNET_pseudonym_name_to_id (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const char *hname, GNUNET_HashCode * psid);
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
Modified: GNUnet/src/util/Makefile.am
===================================================================
--- GNUnet/src/util/Makefile.am 2008-06-04 05:56:31 UTC (rev 7043)
+++ GNUnet/src/util/Makefile.am 2008-06-04 05:57:05 UTC (rev 7044)
@@ -13,6 +13,7 @@
os \
string \
threads \
+ pseudonym \
.
INCLUDES = -I$(top_srcdir)/src/include
@@ -68,6 +69,7 @@
network/libnetwork.la \
network_client/libnetwork_client.la \
os/libos.la \
+ pseudonym/libpseudonym.la \
threads/libthreads.la
libgnunetutil_la_SOURCES = libgnunetutil.c
Modified: GNUnet/src/util/containers/Makefile.am
===================================================================
--- GNUnet/src/util/containers/Makefile.am 2008-06-04 05:56:31 UTC (rev
7043)
+++ GNUnet/src/util/containers/Makefile.am 2008-06-04 05:57:05 UTC (rev
7044)
@@ -5,10 +5,16 @@
noinst_LTLIBRARIES = libcontainers.la
libcontainers_la_SOURCES = \
- bloomfilter.c
+ bloomfilter.c \
+ meta.c
+libcontainers_la_LIBADD = \
+ -lz \
+ -lextractor
+
check_PROGRAMS = \
- bloomtest
+ bloomtest \
+ metatest
TESTS = $(check_PROGRAMS)
@@ -16,3 +22,9 @@
bloomtest.c
bloomtest_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la
+
+
+metatest_SOURCES = \
+ metatest.c
+metatest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la
Copied: GNUnet/src/util/containers/meta.c (from rev 7026,
GNUnet/src/applications/fs/ecrs/meta.c)
===================================================================
--- GNUnet/src/util/containers/meta.c (rev 0)
+++ GNUnet/src/util/containers/meta.c 2008-06-04 05:57:05 UTC (rev 7044)
@@ -0,0 +1,719 @@
+/*
+ This file is part of GNUnet.
+ (C) 2003, 2004, 2005, 2006 Christian Grothoff (and other contributing
authors)
+
+ 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
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file util/containers/meta.c
+ * @brief Storing of meta data
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunet_util.h"
+#include <zlib.h>
+
+#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS
+
+typedef struct
+{
+ EXTRACTOR_KeywordType type;
+ char *data;
+} Item;
+
+/**
+ * Meta data to associate with a file, directory or namespace.
+ */
+typedef struct GNUNET_MetaData
+{
+ unsigned int itemCount;
+ Item *items;
+} MetaData;
+
+/**
+ * Create a fresh MetaData token.
+ */
+MetaData *
+GNUNET_meta_data_create ()
+{
+ MetaData *ret;
+ ret = GNUNET_malloc (sizeof (MetaData));
+ ret->items = NULL;
+ ret->itemCount = 0;
+ return ret;
+}
+
+/**
+ * Free meta data.
+ */
+void
+GNUNET_meta_data_destroy (MetaData * md)
+{
+ int i;
+ for (i = 0; i < md->itemCount; i++)
+ GNUNET_free (md->items[i].data);
+ GNUNET_array_grow (md->items, md->itemCount, 0);
+ GNUNET_free (md);
+}
+
+/**
+ * Add the current time as the publication date
+ * to the meta-data.
+ */
+void
+GNUNET_meta_data_add_publication_date (MetaData * md)
+{
+ char *dat;
+ GNUNET_Int32Time t;
+
+ GNUNET_get_time_int32 (&t);
+ GNUNET_meta_data_delete (md, EXTRACTOR_PUBLICATION_DATE, NULL);
+ dat = GNUNET_int32_time_to_string (&t);
+ GNUNET_meta_data_insert (md, EXTRACTOR_PUBLICATION_DATE, dat);
+ GNUNET_free (dat);
+}
+
+/**
+ * Extend metadata.
+ * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists
+ */
+int
+GNUNET_meta_data_insert (MetaData * md,
+ EXTRACTOR_KeywordType type, const char *data)
+{
+ int idx;
+ char *p;
+
+ GNUNET_GE_ASSERT (NULL, data != NULL);
+ for (idx = 0; idx < md->itemCount; idx++)
+ {
+ if ((md->items[idx].type == type) &&
+ (0 == strcmp (md->items[idx].data, data)))
+ return GNUNET_SYSERR;
+ }
+ idx = md->itemCount;
+ GNUNET_array_grow (md->items, md->itemCount, md->itemCount + 1);
+ md->items[idx].type = type;
+ md->items[idx].data = p = GNUNET_strdup (data);
+
+ /* remove hints to OS */
+ if (type == EXTRACTOR_FILENAME)
+ {
+ while ((p = strchr (p, '\\')))
+ *p = '/';
+ }
+
+ return GNUNET_OK;
+}
+
+/**
+ * Remove an item.
+ * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md
+ */
+int
+GNUNET_meta_data_delete (MetaData * md,
+ EXTRACTOR_KeywordType type, const char *data)
+{
+ int idx;
+ int ret = GNUNET_SYSERR;
+ for (idx = 0; idx < md->itemCount; idx++)
+ {
+ if ((md->items[idx].type == type) &&
+ ((data == NULL) || (0 == strcmp (md->items[idx].data, data))))
+ {
+ GNUNET_free (md->items[idx].data);
+ md->items[idx] = md->items[md->itemCount - 1];
+ GNUNET_array_grow (md->items, md->itemCount, md->itemCount - 1);
+ if (data == NULL)
+ {
+ ret = GNUNET_OK;
+ continue;
+ }
+ return GNUNET_OK;
+ }
+ }
+ return ret;
+}
+
+/**
+ * Iterate over MD entries, excluding thumbnails.
+ *
+ * @return number of entries
+ */
+int
+GNUNET_meta_data_get_contents (const MetaData * md,
+ GNUNET_MetaDataProcessor iterator,
+ void *closure)
+{
+ int i;
+ int sub;
+
+ sub = 0;
+ for (i = md->itemCount - 1; i >= 0; i--)
+ {
+ if (! EXTRACTOR_isBinaryType(md->items[i].type))
+ {
+ if ((iterator != NULL) &&
+ (GNUNET_OK != iterator (md->items[i].type,
+ md->items[i].data, closure)))
+ return GNUNET_SYSERR;
+ }
+ else
+ sub++;
+ }
+ return md->itemCount - sub;
+}
+
+/**
+ * Iterate over MD entries
+ *
+ * @return number of entries
+ */
+char *
+GNUNET_meta_data_get_by_type (const MetaData * md,
+ EXTRACTOR_KeywordType type)
+{
+ int i;
+
+ for (i = md->itemCount - 1; i >= 0; i--)
+ if (type == md->items[i].type)
+ return GNUNET_strdup (md->items[i].data);
+ return NULL;
+}
+
+/**
+ * Iterate over MD entries
+ *
+ * @return number of entries
+ */
+char *
+GNUNET_meta_data_get_first_by_types (const MetaData * md, ...)
+{
+ char *ret;
+ va_list args;
+ EXTRACTOR_KeywordType type;
+
+ ret = NULL;
+ va_start (args, md);
+ while (1)
+ {
+ type = va_arg (args, EXTRACTOR_KeywordType);
+ if (type == -1)
+ break;
+ ret = GNUNET_meta_data_get_by_type (md, type);
+ if (ret != NULL)
+ break;
+ }
+ va_end (args);
+ return ret;
+}
+
+
+/**
+ * This function can be used to decode the binary data
+ * stream produced by the thumbnailextractor.
+ *
+ * @param in 0-terminated string from the meta-data
+ * @return 1 on error, 0 on success
+ */
+static int
+decodeThumbnail (const char *in, unsigned char **out, size_t * outSize)
+{
+ unsigned char *buf;
+ size_t pos;
+ size_t wpos;
+ unsigned char marker;
+ size_t i;
+ size_t end;
+ size_t inSize;
+
+ inSize = strlen (in);
+ if (inSize == 0)
+ {
+ *out = NULL;
+ *outSize = 0;
+ return 1;
+ }
+
+ buf = malloc (inSize); /* slightly more than needed ;-) */
+ *out = buf;
+
+ pos = 0;
+ wpos = 0;
+ while (pos < inSize)
+ {
+ end = pos + 255; /* 255 here: count the marker! */
+ if (end > inSize)
+ end = inSize;
+ marker = in[pos++];
+ for (i = pos; i < end; i++)
+ buf[wpos++] = (in[i] == marker) ? 0 : in[i];
+ pos = end;
+ }
+ *outSize = wpos;
+ return 0;
+}
+
+/**
+ * Get a thumbnail from the meta-data (if present).
+ *
+ * @param thumb will be set to the thumbnail data. Must be
+ * freed by the caller!
+ * @return number of bytes in thumbnail, 0 if not available
+ */
+size_t
+GNUNET_meta_data_get_thumbnail (const struct GNUNET_MetaData * md,
+ unsigned char **thumb)
+{
+ char *encoded;
+ int ret;
+ size_t size;
+
+ encoded = GNUNET_meta_data_get_by_type (md, EXTRACTOR_THUMBNAIL_DATA);
+ if (encoded == NULL)
+ return 0;
+ if (strlen (encoded) == 0)
+ {
+ GNUNET_free (encoded);
+ return 0; /* invalid */
+ }
+ *thumb = NULL;
+ ret = decodeThumbnail (encoded, thumb, &size);
+ GNUNET_free (encoded);
+ if (ret == 0)
+ return size;
+ else
+ return 0;
+}
+
+/**
+ * Duplicate MetaData.
+ */
+MetaData *
+GNUNET_meta_data_duplicate (const MetaData * md)
+{
+ int i;
+ MetaData *ret;
+
+ if (md == NULL)
+ return NULL;
+ ret = GNUNET_meta_data_create ();
+ for (i = md->itemCount - 1; i >= 0; i--)
+ GNUNET_meta_data_insert (ret, md->items[i].type, md->items[i].data);
+ return ret;
+}
+
+/**
+ * Extract meta-data from a file.
+ *
+ * @return GNUNET_SYSERR on error, otherwise the number
+ * of meta-data items obtained
+ */
+int
+GNUNET_meta_data_extract_from_file (struct GNUNET_GE_Context *ectx,
+ MetaData * md,
+ const char *filename,
+ EXTRACTOR_ExtractorList * extractors)
+{
+ EXTRACTOR_KeywordList *head;
+ EXTRACTOR_KeywordList *pos;
+ int ret;
+
+ if (filename == NULL)
+ return GNUNET_SYSERR;
+ if (extractors == NULL)
+ return 0;
+ head = EXTRACTOR_getKeywords (extractors, filename);
+ head = EXTRACTOR_removeDuplicateKeywords (head,
+
EXTRACTOR_DUPLICATES_REMOVE_UNKNOWN);
+ pos = head;
+ ret = 0;
+ while (pos != NULL)
+ {
+ if (GNUNET_OK ==
+ GNUNET_meta_data_insert (md, pos->keywordType, pos->keyword))
+ ret++;
+ pos = pos->next;
+ }
+ EXTRACTOR_freeKeywords (head);
+ return ret;
+}
+
+static unsigned int
+tryCompression (char *data, unsigned int oldSize)
+{
+ char *tmp;
+ uLongf dlen;
+
+#ifdef compressBound
+ dlen = compressBound (oldSize);
+#else
+ dlen = oldSize + (oldSize / 100) + 20;
+ /* documentation says 100.1% oldSize + 12 bytes, but we
+ should be able to overshoot by more to be safe */
+#endif
+ tmp = GNUNET_malloc (dlen);
+ if (Z_OK == compress2 ((Bytef *) tmp,
+ &dlen, (const Bytef *) data, oldSize, 9))
+ {
+ if (dlen < oldSize)
+ {
+ memcpy (data, tmp, dlen);
+ GNUNET_free (tmp);
+ return dlen;
+ }
+ }
+ GNUNET_free (tmp);
+ return oldSize;
+}
+
+/**
+ * Decompress input, return the decompressed data
+ * as output, set outputSize to the number of bytes
+ * that were found.
+ *
+ * @return NULL on error
+ */
+static char *
+decompress (const char *input,
+ unsigned int inputSize, unsigned int outputSize)
+{
+ char *output;
+ uLongf olen;
+
+ olen = outputSize;
+ output = GNUNET_malloc (olen);
+ if (Z_OK == uncompress ((Bytef *) output,
+ &olen, (const Bytef *) input, inputSize))
+ {
+ return output;
+ }
+ else
+ {
+ GNUNET_free (output);
+ return NULL;
+ }
+}
+
+/**
+ * Flag in 'version' that indicates compressed meta-data.
+ */
+#define HEADER_COMPRESSED 0x80000000
+
+/**
+ * Bits in 'version' that give the version number.
+ */
+#define HEADER_VERSION_MASK 0x7FFFFFFF
+
+typedef struct
+{
+ /**
+ * The version of the MD serialization.
+ * The highest bit is used to indicate
+ * compression.
+ */
+ unsigned int version;
+
+ /**
+ * How many MD entries are there?
+ */
+ unsigned int entries;
+
+ /**
+ * Size of the MD (decompressed)
+ */
+ unsigned int size;
+
+ /**
+ * This is followed by 'entries' values of type 'unsigned int' that
+ * correspond to EXTRACTOR_KeywordTypes. After that, the meta-data
+ * keywords follow (0-terminated). The MD block always ends with
+ * 0-termination, padding with 0 until a multiple of 8 bytes.
+ */
+
+} MetaDataHeader;
+
+/**
+ * Serialize meta-data to target.
+ *
+ * @param size maximum number of bytes available
+ * @param part is it ok to just write SOME of the
+ * meta-data to match the size constraint,
+ * possibly discarding some data? GNUNET_YES/GNUNET_NO.
+ * @return number of bytes written on success,
+ * GNUNET_SYSERR on error (typically: not enough
+ * space)
+ */
+int
+GNUNET_meta_data_serialize (struct GNUNET_GE_Context *ectx,
+ const MetaData * md,
+ char *target, unsigned int max, int part)
+{
+ MetaDataHeader *hdr;
+ size_t size;
+ size_t pos;
+ int i;
+ int len;
+ unsigned int ic;
+
+ if (max < sizeof (MetaDataHeader))
+ return GNUNET_SYSERR; /* far too small */
+ ic = md->itemCount;
+ hdr = NULL;
+ while (1)
+ {
+ size = sizeof (MetaDataHeader);
+ size += sizeof (unsigned int) * ic;
+ for (i = 0; i < ic; i++)
+ size += 1 + strlen (md->items[i].data);
+ while (size % 8 != 0)
+ size++;
+ hdr = GNUNET_malloc (size);
+ hdr->version = htonl (0);
+ hdr->entries = htonl (ic);
+ for (i = 0; i < ic; i++)
+ ((unsigned int *) &hdr[1])[i] =
+ htonl ((unsigned int) md->items[i].type);
+ pos = sizeof (MetaDataHeader);
+ pos += sizeof (unsigned int) * ic;
+ for (i = 0; i < ic; i++)
+ {
+ len = strlen (md->items[i].data) + 1;
+ memcpy (&((char *) hdr)[pos], md->items[i].data, len);
+ pos += len;
+ }
+
+ hdr->size = htonl (size);
+ if ((part & GNUNET_SERIALIZE_NO_COMPRESS) == 0)
+ {
+ pos = tryCompression ((char *) &hdr[1],
+ size - sizeof (MetaDataHeader));
+ }
+ else
+ {
+ pos = size - sizeof (MetaDataHeader);
+ }
+ if (pos < size - sizeof (MetaDataHeader))
+ {
+ hdr->version = htonl (HEADER_COMPRESSED);
+ size = pos + sizeof (MetaDataHeader);
+ }
+ if (size <= max)
+ break;
+ GNUNET_free (hdr);
+ hdr = NULL;
+
+ if ((part & GNUNET_SERIALIZE_PART) == 0)
+ {
+ return GNUNET_SYSERR; /* does not fit! */
+ }
+ /* partial serialization ok, try again with less meta-data */
+ if (size > 2 * max)
+ ic = ic * 2 / 3; /* still far too big, make big reductions */
+ else
+ ic--; /* small steps, we're close */
+ }
+ GNUNET_GE_ASSERT (ectx, size <= max);
+ memcpy (target, hdr, size);
+ GNUNET_free (hdr);
+ /* extra check: deserialize! */
+#if EXTRA_CHECKS
+ {
+ MetaData *mdx;
+ mdx = GNUNET_meta_data_deserialize (ectx, target, size);
+ GNUNET_GE_ASSERT (ectx, NULL != mdx);
+ GNUNET_meta_data_destroy (mdx);
+ }
+#endif
+ return size;
+}
+
+/**
+ * Estimate (!) the size of the meta-data in
+ * serialized form. The estimate MAY be higher
+ * than what is strictly needed.
+ */
+unsigned int
+GNUNET_meta_data_get_serialized_size (const MetaData * md, int part)
+{
+ MetaDataHeader *hdr;
+ size_t size;
+ size_t pos;
+ int i;
+ int len;
+ unsigned int ic;
+
+ ic = md->itemCount;
+ size = sizeof (MetaDataHeader);
+ size += sizeof (unsigned int) * ic;
+ for (i = 0; i < ic; i++)
+ size += 1 + strlen (md->items[i].data);
+ while (size % 8 != 0)
+ size++;
+ hdr = GNUNET_malloc (size);
+ hdr->version = htonl (0);
+ hdr->entries = htonl (md->itemCount);
+ for (i = 0; i < ic; i++)
+ ((unsigned int *) &hdr[1])[i] = htonl ((unsigned int) md->items[i].type);
+ pos = sizeof (MetaDataHeader);
+ pos += sizeof (unsigned int) * md->itemCount;
+ for (i = 0; i < ic; i++)
+ {
+ len = strlen (md->items[i].data) + 1;
+ memcpy (&((char *) hdr)[pos], md->items[i].data, len);
+ pos += len;
+ }
+ if ((part & GNUNET_SERIALIZE_NO_COMPRESS) == 0)
+ {
+ pos = tryCompression ((char *) &hdr[1], size - sizeof (MetaDataHeader));
+ }
+ else
+ {
+ pos = size - sizeof (MetaDataHeader);
+ }
+ if (pos < size - sizeof (MetaDataHeader))
+ size = pos + sizeof (MetaDataHeader);
+
+ GNUNET_free (hdr);
+
+ return size;
+}
+
+/**
+ * Deserialize meta-data. Initializes md.
+ * @param size number of bytes available
+ * @return MD on success, NULL on error (i.e.
+ * bad format)
+ */
+struct GNUNET_MetaData *
+GNUNET_meta_data_deserialize (struct GNUNET_GE_Context *ectx,
+ const char *input, unsigned int size)
+{
+ MetaData *md;
+ const MetaDataHeader *hdr;
+ unsigned int ic;
+ char *data;
+ unsigned int dataSize;
+ int compressed;
+ int i;
+ unsigned int pos;
+ int len;
+
+ if (size < sizeof (MetaDataHeader))
+ return NULL;
+ hdr = (const MetaDataHeader *) input;
+ if ((ntohl (MAKE_UNALIGNED (hdr->version)) & HEADER_VERSION_MASK) != 0)
+ return NULL; /* unsupported version */
+ ic = ntohl (MAKE_UNALIGNED (hdr->entries));
+ compressed =
+ (ntohl (MAKE_UNALIGNED (hdr->version)) & HEADER_COMPRESSED) != 0;
+ if (compressed)
+ {
+ dataSize = ntohl (MAKE_UNALIGNED (hdr->size)) - sizeof (MetaDataHeader);
+ if (dataSize > 2 * 1042 * 1024)
+ {
+ GNUNET_GE_BREAK (ectx, 0);
+ return NULL; /* only 2 MB allowed [to make sure we don't
blow
+ our memory limit because of a mal-formed
+ message... ] */
+ }
+ data = decompress ((char *) &input[sizeof (MetaDataHeader)],
+ size - sizeof (MetaDataHeader), dataSize);
+ if (data == NULL)
+ {
+ GNUNET_GE_BREAK (ectx, 0);
+ return NULL;
+ }
+ }
+ else
+ {
+ data = (char *) &hdr[1];
+ dataSize = size - sizeof (MetaDataHeader);
+ if (size != ntohl (MAKE_UNALIGNED (hdr->size)))
+ {
+ GNUNET_GE_BREAK (ectx, 0);
+ return NULL;
+ }
+ }
+
+ if ((sizeof (unsigned int) * ic + ic) > dataSize)
+ {
+ GNUNET_GE_BREAK (ectx, 0);
+ goto FAILURE;
+ }
+ if ((ic > 0) && (data[dataSize - 1] != '\0'))
+ {
+ GNUNET_GE_BREAK (ectx, 0);
+ goto FAILURE;
+ }
+
+ md = GNUNET_meta_data_create ();
+ GNUNET_array_grow (md->items, md->itemCount, ic);
+ i = 0;
+ pos = sizeof (unsigned int) * ic;
+ while ((pos < dataSize) && (i < ic))
+ {
+ len = strlen (&data[pos]) + 1;
+ md->items[i].type = (EXTRACTOR_KeywordType)
+ ntohl (MAKE_UNALIGNED (((unsigned int *) data)[i]));
+ md->items[i].data = GNUNET_strdup (&data[pos]);
+ pos += len;
+ i++;
+ }
+ if (i < ic)
+ { /* oops */
+ GNUNET_meta_data_destroy (md);
+ goto FAILURE;
+ }
+ if (compressed)
+ GNUNET_free (data);
+ return md;
+FAILURE:
+ if (compressed)
+ GNUNET_free (data);
+ return NULL; /* size too small */
+}
+
+/**
+ * Test if two MDs are equal.
+ */
+int
+GNUNET_meta_data_test_equal (const struct GNUNET_MetaData *md1,
+ const struct GNUNET_MetaData *md2)
+{
+ int i;
+ int j;
+ int found;
+
+ if (md1->itemCount != md2->itemCount)
+ return GNUNET_NO;
+ for (i = 0; i < md1->itemCount; i++)
+ {
+ found = GNUNET_NO;
+ for (j = 0; j < md2->itemCount; j++)
+ if ((md1->items[i].type == md2->items[j].type) &&
+ (0 == strcmp (md1->items[i].data, md2->items[j].data)))
+ found = GNUNET_YES;
+ if (found == GNUNET_NO)
+ return GNUNET_NO;
+ }
+ return GNUNET_YES;
+}
+
+
+/* end of meta.c */
Copied: GNUnet/src/util/containers/metatest.c (from rev 7026,
GNUnet/src/applications/fs/ecrs/metatest.c)
===================================================================
--- GNUnet/src/util/containers/metatest.c (rev 0)
+++ GNUnet/src/util/containers/metatest.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -0,0 +1,206 @@
+/*
+ This file is part of GNUnet.
+ (C) 2003, 2004, 2006 Christian Grothoff (and other contributing authors)
+
+ 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
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file util/containers/metatest.c
+ * @brief Test for meta.c
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include <extractor.h>
+#include "gnunet_util.h"
+
+#define ABORT(m) { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if
(m != NULL) GNUNET_meta_data_destroy(m); return 1; }
+
+static int
+testMeta (int i)
+{
+ struct GNUNET_MetaData *m;
+ char *val;
+ int j;
+ unsigned int size;
+
+ m = GNUNET_meta_data_create ();
+ if (GNUNET_OK !=
+ GNUNET_meta_data_insert (m, EXTRACTOR_TITLE, "TestTitle"))
+ ABORT (m);
+ if (GNUNET_OK !=
+ GNUNET_meta_data_insert (m, EXTRACTOR_AUTHOR, "TestTitle"))
+ ABORT (m);
+ if (GNUNET_OK == GNUNET_meta_data_insert (m, EXTRACTOR_TITLE, "TestTitle"))
/* dup! */
+ ABORT (m);
+ if (GNUNET_OK == GNUNET_meta_data_insert (m, EXTRACTOR_AUTHOR, "TestTitle"))
/* dup! */
+ ABORT (m);
+ if (2 != GNUNET_meta_data_get_contents (m, NULL, NULL))
+ ABORT (m);
+ if (GNUNET_OK !=
+ GNUNET_meta_data_delete (m, EXTRACTOR_AUTHOR, "TestTitle"))
+ ABORT (m);
+ if (GNUNET_OK == GNUNET_meta_data_delete (m, EXTRACTOR_AUTHOR, "TestTitle"))
/* already gone */
+ ABORT (m);
+ if (1 != GNUNET_meta_data_get_contents (m, NULL, NULL))
+ ABORT (m);
+ if (GNUNET_OK !=
+ GNUNET_meta_data_delete (m, EXTRACTOR_TITLE, "TestTitle"))
+ ABORT (m);
+ if (GNUNET_OK == GNUNET_meta_data_delete (m, EXTRACTOR_TITLE, "TestTitle"))
/* already gone */
+ ABORT (m);
+ if (0 != GNUNET_meta_data_get_contents (m, NULL, NULL))
+ ABORT (m);
+ val = GNUNET_malloc (256);
+ for (j = 0; j < i; j++)
+ {
+ GNUNET_snprintf (val, 256, "%s.%d",
+ "A teststring that should compress well.", j);
+ if (GNUNET_OK !=
+ GNUNET_meta_data_insert (m, EXTRACTOR_UNKNOWN, val))
+ {
+ GNUNET_free (val);
+ ABORT (m);
+ }
+ }
+ GNUNET_free (val);
+ if (i != GNUNET_meta_data_get_contents (m, NULL, NULL))
+ ABORT (m);
+
+ size =
+ GNUNET_meta_data_get_serialized_size (m, GNUNET_SERIALIZE_FULL);
+ val = GNUNET_malloc (size);
+ if (size != GNUNET_meta_data_serialize (NULL,
+ m, val, size,
+ GNUNET_SERIALIZE_FULL))
+ {
+ GNUNET_free (val);
+ ABORT (m);
+ }
+ GNUNET_meta_data_destroy (m);
+ m = GNUNET_meta_data_deserialize (NULL, val, size);
+ GNUNET_free (val);
+ if (m == NULL)
+ ABORT (m);
+ val = GNUNET_malloc (256);
+ for (j = 0; j < i; j++)
+ {
+ GNUNET_snprintf (val, 256, "%s.%d",
+ "A teststring that should compress well.", j);
+ if (GNUNET_OK !=
+ GNUNET_meta_data_delete (m, EXTRACTOR_UNKNOWN, val))
+ {
+ GNUNET_free (val);
+ ABORT (m);
+ }
+ }
+ GNUNET_free (val);
+ if (0 != GNUNET_meta_data_get_contents (m, NULL, NULL))
+ {
+ ABORT (m);
+ }
+ GNUNET_meta_data_destroy (m);
+ return 0;
+}
+
+int
+testMetaMore (int i)
+{
+ struct GNUNET_MetaData *meta;
+ int q;
+ char txt[128];
+ char *data;
+ unsigned long long size;
+
+ meta = GNUNET_meta_data_create ();
+ for (q = 0; q <= i; q++)
+ {
+ GNUNET_snprintf (txt, 128, "%u -- %u\n", i, q);
+ GNUNET_meta_data_insert (meta,
+ q %
+ EXTRACTOR_getHighestKeywordTypeNumber (),
+ txt);
+ }
+ size =
+ GNUNET_meta_data_get_serialized_size (meta,
+ GNUNET_SERIALIZE_FULL);
+ data = GNUNET_malloc (size * 4);
+ if (size != GNUNET_meta_data_serialize (NULL,
+ meta,
+ data, size * 4,
+ GNUNET_SERIALIZE_FULL))
+ {
+ GNUNET_free (data);
+ ABORT (meta);
+ }
+ GNUNET_meta_data_destroy (meta);
+ GNUNET_free (data);
+ return 0;
+}
+
+static int
+testMetaLink ()
+{
+ struct GNUNET_MetaData *m;
+ char *val;
+ unsigned int size;
+
+ m = GNUNET_meta_data_create ();
+ if (GNUNET_OK !=
+ GNUNET_meta_data_insert (m, EXTRACTOR_UNKNOWN, "link"))
+ ABORT (m);
+ if (GNUNET_OK !=
+ GNUNET_meta_data_insert (m, EXTRACTOR_FILENAME, "lib-link.m4"))
+ ABORT (m);
+ size =
+ GNUNET_meta_data_get_serialized_size (m, GNUNET_SERIALIZE_FULL);
+ val = GNUNET_malloc (size);
+ if (size != GNUNET_meta_data_serialize (NULL,
+ m, val, size,
+ GNUNET_SERIALIZE_FULL))
+ {
+ GNUNET_free (val);
+ ABORT (m);
+ }
+ GNUNET_meta_data_destroy (m);
+ m = GNUNET_meta_data_deserialize (NULL, val, size);
+ GNUNET_free (val);
+ if (m == NULL)
+ ABORT (m);
+ GNUNET_meta_data_destroy (m);
+ return 0;
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ int failureCount = 0;
+ int i;
+
+ for (i = 0; i < 255; i++)
+ failureCount += testMeta (i);
+ for (i = 1; i < 255; i++)
+ failureCount += testMetaMore (i);
+ failureCount += testMetaLink ();
+
+ if (failureCount != 0)
+ return 1;
+ return 0;
+}
+
+/* end of metatest.c */
Copied: GNUnet/src/util/pseudonym (from rev 7026,
GNUnet/src/applications/fs/pseudonyms)
Modified: GNUnet/src/util/pseudonym/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/pseudonyms/Makefile.am 2008-06-02 21:51:05 UTC
(rev 7026)
+++ GNUnet/src/util/pseudonym/Makefile.am 2008-06-04 05:57:05 UTC (rev
7044)
@@ -1,16 +1,13 @@
INCLUDES = -I$(top_srcdir)/src/include
-lib_LTLIBRARIES = \
- libgnunetpseudonym.la
+noinst_LTLIBRARIES = \
+ libpseudonym.la
-libgnunetpseudonym_la_SOURCES = \
+libpseudonym_la_SOURCES = \
common.c common.h \
names.c \
info.c info.h \
notification.c notification.h
-libgnunetpseudonym_la_LIBADD = \
- $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
- $(top_builddir)/src/util/libgnunetutil.la
check_PROGRAMS = \
info_test
@@ -22,8 +19,6 @@
info_test_SOURCES = \
info_test.c
info_test_LDADD = \
- $(top_builddir)/src/applications/fs/pseudonyms/libgnunetpseudonym.la \
- $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
$(top_builddir)/src/util/libgnunetutil.la
Modified: GNUnet/src/util/pseudonym/common.c
===================================================================
--- GNUnet/src/applications/fs/pseudonyms/common.c 2008-06-02 21:51:05 UTC
(rev 7026)
+++ GNUnet/src/util/pseudonym/common.c 2008-06-04 05:57:05 UTC (rev 7044)
@@ -19,7 +19,7 @@
*/
/**
- * @file applications/fs/namespace/common.c
+ * @file util/pseudonym/common.c
* @brief helper functions
* @author Christian Grothoff
*/
@@ -34,10 +34,10 @@
* pseudonym identifier and directory prefix.
*/
char *
-GNUNET_PSEUDO_internal_get_data_filename_ (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration
- *cfg, const char *prefix,
- const GNUNET_HashCode * psid)
+GNUNET_pseudonym_internal_get_data_filename_ (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration
+ *cfg, const char *prefix,
+ const GNUNET_HashCode * psid)
{
char *tmp;
char *ret;
Modified: GNUnet/src/util/pseudonym/common.h
===================================================================
--- GNUnet/src/applications/fs/pseudonyms/common.h 2008-06-02 21:51:05 UTC
(rev 7026)
+++ GNUnet/src/util/pseudonym/common.h 2008-06-04 05:57:05 UTC (rev 7044)
@@ -25,7 +25,7 @@
*/
-#include "gnunet_pseudonym_lib.h"
+#include "gnunet_util_pseudonym.h"
#ifndef PS_COMMON_H
#define PS_COMMON_H
@@ -40,12 +40,12 @@
* @param prefix PS_METADATA_DIR or PS_NAMES_DIR
* @param psid maybe NULL
*/
-char *GNUNET_PSEUDO_internal_get_data_filename_ (struct GNUNET_GE_Context
- *ectx,
- struct
- GNUNET_GC_Configuration *cfg,
- const char *prefix,
- const GNUNET_HashCode *
- psid);
+char *GNUNET_pseudonym_internal_get_data_filename_ (struct GNUNET_GE_Context
+ *ectx,
+ struct
+ GNUNET_GC_Configuration
*cfg,
+ const char *prefix,
+ const GNUNET_HashCode *
+ psid);
#endif
Modified: GNUnet/src/util/pseudonym/info.c
===================================================================
--- GNUnet/src/applications/fs/pseudonyms/info.c 2008-06-02 21:51:05 UTC
(rev 7026)
+++ GNUnet/src/util/pseudonym/info.c 2008-06-04 05:57:05 UTC (rev 7044)
@@ -19,14 +19,13 @@
*/
/**
- * @file applications/fs/pseudonym/info.c
+ * @file util/pseudonym/info.c
* @brief keeping track of pseudonyms and metadata about them
* @author Christian Grothoff
*/
#include "platform.h"
#include "gnunet_directories.h"
-#include "gnunet_pseudonym_lib.h"
#include "gnunet_util.h"
#include "info.h"
#include "notification.h"
@@ -37,7 +36,7 @@
write_pseudonym_info (struct GNUNET_GE_Context *ectx,
struct GNUNET_GC_Configuration *cfg,
const GNUNET_HashCode * nsid,
- const struct GNUNET_ECRS_MetaData *meta,
+ const struct GNUNET_MetaData *meta,
int ranking, const char *ns_name)
{
unsigned int size;
@@ -46,11 +45,11 @@
char *buf;
char *fn;
- fn = GNUNET_PSEUDO_internal_get_data_filename_ (ectx,
- cfg, PS_METADATA_DIR, nsid);
+ fn = GNUNET_pseudonym_internal_get_data_filename_ (ectx,
+ cfg, PS_METADATA_DIR,
nsid);
size =
- GNUNET_ECRS_meta_data_get_serialized_size (meta,
- GNUNET_ECRS_SERIALIZE_FULL);
+ GNUNET_meta_data_get_serialized_size (meta,
+ GNUNET_SERIALIZE_FULL);
tag = size + sizeof (int) + 1;
off = 0;
if (ns_name != NULL)
@@ -69,26 +68,26 @@
buf[sizeof (int)] = '\0';
}
GNUNET_GE_ASSERT (ectx,
- size == GNUNET_ECRS_meta_data_serialize (ectx,
- meta,
- &buf[sizeof
- (int) +
- off + 1],
- size,
-
GNUNET_ECRS_SERIALIZE_FULL));
+ size == GNUNET_meta_data_serialize (ectx,
+ meta,
+ &buf[sizeof
+ (int) +
+ off + 1],
+ size,
+ GNUNET_SERIALIZE_FULL));
GNUNET_disk_file_write (ectx, fn, buf, tag, "660");
GNUNET_free (fn);
GNUNET_free (buf);
/* create entry for pseudonym name in names */
- GNUNET_free_non_null (GNUNET_PSEUDO_id_to_name (ectx, cfg, nsid));
+ GNUNET_free_non_null (GNUNET_pseudonym_id_to_name (ectx, cfg, nsid));
}
int
-GNUNET_PSEUDO_internal_read_info_ (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid,
- struct GNUNET_ECRS_MetaData **meta,
- int *ranking, char **ns_name)
+GNUNET_pseudonym_internal_read_info_ (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * nsid,
+ struct GNUNET_MetaData **meta,
+ int *ranking, char **ns_name)
{
unsigned long long len;
unsigned int size;
@@ -100,8 +99,8 @@
*meta = NULL;
if (ns_name != NULL)
*ns_name = NULL;
- fn = GNUNET_PSEUDO_internal_get_data_filename_ (ectx,
- cfg, PS_METADATA_DIR, nsid);
+ fn = GNUNET_pseudonym_internal_get_data_filename_ (ectx,
+ cfg, PS_METADATA_DIR,
nsid);
if ((GNUNET_OK != GNUNET_disk_file_test (ectx,
fn) ||
(GNUNET_OK != GNUNET_disk_file_size (ectx, fn, &len, GNUNET_YES))))
@@ -151,7 +150,7 @@
size = len - zend;
if (meta != NULL)
{
- *meta = GNUNET_ECRS_meta_data_deserialize (ectx, &buf[zend], size);
+ *meta = GNUNET_meta_data_deserialize (ectx, &buf[zend], size);
if ((*meta) == NULL)
{
/* invalid data! remove! */
@@ -169,7 +168,7 @@
struct ListPseudonymClosure
{
- GNUNET_PSEUDO_PseudonymIterator iterator;
+ GNUNET_PseudonymIterator iterator;
void *closure;
struct GNUNET_GE_Context *ectx;
struct GNUNET_GC_Configuration *cfg;
@@ -182,18 +181,18 @@
int ret;
GNUNET_HashCode id;
int rating;
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
ret = GNUNET_OK;
if (GNUNET_OK != GNUNET_enc_to_hash (fn, &id))
return GNUNET_OK; /* invalid name */
if (GNUNET_OK !=
- GNUNET_PSEUDO_internal_read_info_ (c->ectx, c->cfg, &id, &meta,
- &rating, NULL))
+ GNUNET_pseudonym_internal_read_info_ (c->ectx, c->cfg, &id, &meta,
+ &rating, NULL))
return GNUNET_OK; /* ignore entry */
if (c->iterator != NULL)
ret = c->iterator (c->closure, &id, meta, rating);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
return ret;
}
@@ -201,10 +200,10 @@
* List all available pseudonyms.
*/
int
-GNUNET_PSEUDO_list_all (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- GNUNET_PSEUDO_PseudonymIterator iterator,
- void *closure)
+GNUNET_pseudonym_list_all (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ GNUNET_PseudonymIterator iterator,
+ void *closure)
{
struct ListPseudonymClosure cls;
char *fn;
@@ -215,8 +214,8 @@
cls.ectx = ectx;
cls.cfg = cfg;
fn =
- GNUNET_PSEUDO_internal_get_data_filename_ (ectx, cfg, PS_METADATA_DIR,
- NULL);
+ GNUNET_pseudonym_internal_get_data_filename_ (ectx, cfg, PS_METADATA_DIR,
+ NULL);
GNUNET_disk_directory_create (ectx, fn);
ret = GNUNET_disk_directory_scan (ectx, fn, &list_pseudonym_helper, &cls);
GNUNET_free (fn);
@@ -232,27 +231,27 @@
* @return new rating of the pseudonym
*/
int
-GNUNET_PSEUDO_rank (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid, int delta)
+GNUNET_pseudonym_rank (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * nsid, int delta)
{
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
int ret;
int ranking;
char *name;
name = NULL;
ret =
- GNUNET_PSEUDO_internal_read_info_ (ectx, cfg, nsid, &meta, &ranking,
- &name);
+ GNUNET_pseudonym_internal_read_info_ (ectx, cfg, nsid, &meta, &ranking,
+ &name);
if (ret == GNUNET_SYSERR)
{
ranking = 0;
- meta = GNUNET_ECRS_meta_data_create ();
+ meta = GNUNET_meta_data_create ();
}
ranking += delta;
write_pseudonym_info (ectx, cfg, nsid, meta, ranking, name);
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
GNUNET_free_non_null (name);
return ranking;
}
@@ -263,8 +262,8 @@
static int
merge_meta_helper (EXTRACTOR_KeywordType type, const char *data, void *cls)
{
- struct GNUNET_ECRS_MetaData *meta = cls;
- GNUNET_ECRS_meta_data_insert (meta, type, data);
+ struct GNUNET_MetaData *meta = cls;
+ GNUNET_meta_data_insert (meta, type, data);
return GNUNET_OK;
}
@@ -276,29 +275,29 @@
* @param id the pseudonym identifier
*/
void
-GNUNET_PSEUDO_add (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * id,
- const struct GNUNET_ECRS_MetaData *meta)
+GNUNET_pseudonym_add (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * id,
+ const struct GNUNET_MetaData *meta)
{
char *name;
int ranking;
- struct GNUNET_ECRS_MetaData *old;
+ struct GNUNET_MetaData *old;
ranking = 0;
if (GNUNET_OK ==
- GNUNET_PSEUDO_internal_read_info_ (ectx, cfg, id, &old, &ranking,
- &name))
+ GNUNET_pseudonym_internal_read_info_ (ectx, cfg, id, &old, &ranking,
+ &name))
{
- GNUNET_ECRS_meta_data_get_contents (meta, &merge_meta_helper, old);
+ GNUNET_meta_data_get_contents (meta, &merge_meta_helper, old);
write_pseudonym_info (ectx, cfg, id, old, ranking, name);
- GNUNET_ECRS_meta_data_destroy (old);
+ GNUNET_meta_data_destroy (old);
}
else
{
write_pseudonym_info (ectx, cfg, id, meta, ranking, NULL);
}
- GNUNET_PSEUDO_internal_notify_ (id, meta, ranking);
+ GNUNET_pseudonym_internal_notify_ (id, meta, ranking);
GNUNET_free_non_null (name);
}
Modified: GNUnet/src/util/pseudonym/info.h
===================================================================
--- GNUnet/src/applications/fs/pseudonyms/info.h 2008-06-02 21:51:05 UTC
(rev 7026)
+++ GNUnet/src/util/pseudonym/info.h 2008-06-04 05:57:05 UTC (rev 7044)
@@ -19,22 +19,21 @@
*/
/**
- * @file applications/fs/pseudonym/info.h
+ * @file util/pseudonym/info.h
* @brief keeping track of pseudonyms and metadata about them
* @author Christian Grothoff
*/
-#ifndef NAMESPACE_INFO_H
-#define NAMESPACE_INFO_H
+#ifndef PSEUDONYM_INFO_H
+#define PSEUDONYM_INFO_H
-#include "gnunet_namespace_lib.h"
#include "gnunet_util.h"
int
-GNUNET_PSEUDO_internal_read_info_ (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid,
- struct GNUNET_ECRS_MetaData **meta,
- int *ranking, char **ns_name);
+GNUNET_pseudonym_internal_read_info_ (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * nsid,
+ struct GNUNET_MetaData **meta,
+ int *ranking, char **ns_name);
#endif
Modified: GNUnet/src/util/pseudonym/info_test.c
===================================================================
--- GNUnet/src/applications/fs/pseudonyms/info_test.c 2008-06-02 21:51:05 UTC
(rev 7026)
+++ GNUnet/src/util/pseudonym/info_test.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -19,16 +19,13 @@
*/
/**
- * @file applications/fs/pseudonym/info_test.c
+ * @file util/pseudonym/info_test.c
* @brief testcase for info.c
* @author Christian Grothoff
*/
#include "platform.h"
#include "gnunet_util.h"
-#include "gnunet_ecrs_lib.h"
-#include "gnunet_pseudonym_lib.h"
-#include "gnunet_pseudonym_lib.h"
#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(ectx, 0); goto
FAILURE; }
@@ -36,7 +33,7 @@
main (int argc, char *argv[])
{
int ok;
- struct GNUNET_ECRS_MetaData *meta = NULL;
+ struct GNUNET_MetaData *meta = NULL;
GNUNET_HashCode id1;
GNUNET_HashCode rid1;
GNUNET_HashCode id2;
@@ -57,32 +54,32 @@
return -1;
}
/* ACTUAL TEST CODE */
- old = GNUNET_PSEUDO_list_all (ectx, cfg, NULL, NULL);
- meta = GNUNET_ECRS_meta_data_create ();
- GNUNET_ECRS_meta_data_insert (meta, EXTRACTOR_TITLE, "test");
+ old = GNUNET_pseudonym_list_all (ectx, cfg, NULL, NULL);
+ meta = GNUNET_meta_data_create ();
+ GNUNET_meta_data_insert (meta, EXTRACTOR_TITLE, "test");
GNUNET_create_random_hash (&id1);
- GNUNET_PSEUDO_add (ectx, cfg, &id1, meta);
- newVal = GNUNET_PSEUDO_list_all (ectx, cfg, NULL, NULL);
+ GNUNET_pseudonym_add (ectx, cfg, &id1, meta);
+ newVal = GNUNET_pseudonym_list_all (ectx, cfg, NULL, NULL);
CHECK (old < newVal);
old = newVal;
- name1 = GNUNET_PSEUDO_id_to_name (ectx, cfg, &id1);
+ name1 = GNUNET_pseudonym_id_to_name (ectx, cfg, &id1);
GNUNET_create_random_hash (&id2);
- GNUNET_PSEUDO_add (ectx, cfg, &id2, meta);
- newVal = GNUNET_PSEUDO_list_all (ectx, cfg, NULL, NULL);
+ GNUNET_pseudonym_add (ectx, cfg, &id2, meta);
+ newVal = GNUNET_pseudonym_list_all (ectx, cfg, NULL, NULL);
CHECK (old < newVal);
- name2 = GNUNET_PSEUDO_id_to_name (ectx, cfg, &id2);
+ name2 = GNUNET_pseudonym_id_to_name (ectx, cfg, &id2);
CHECK (name2 != NULL);
- name1 = GNUNET_PSEUDO_id_to_name (ectx, cfg, &id1);
+ name1 = GNUNET_pseudonym_id_to_name (ectx, cfg, &id1);
CHECK (name1 != NULL);
- CHECK (GNUNET_OK == GNUNET_PSEUDO_name_to_id (ectx, cfg, name2, &rid2));
- CHECK (GNUNET_OK == GNUNET_PSEUDO_name_to_id (ectx, cfg, name1, &rid1));
+ CHECK (GNUNET_OK == GNUNET_pseudonym_name_to_id (ectx, cfg, name2, &rid2));
+ CHECK (GNUNET_OK == GNUNET_pseudonym_name_to_id (ectx, cfg, name1, &rid1));
CHECK (0 == memcmp (&id1, &rid1, sizeof (GNUNET_HashCode)));
CHECK (0 == memcmp (&id2, &rid2, sizeof (GNUNET_HashCode)));
GNUNET_free (name1);
GNUNET_free (name2);
/* END OF TEST CODE */
FAILURE:
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
GNUNET_GC_free (cfg);
return (ok == GNUNET_YES) ? 0 : 1;
}
Modified: GNUnet/src/util/pseudonym/names.c
===================================================================
--- GNUnet/src/applications/fs/pseudonyms/names.c 2008-06-02 21:51:05 UTC
(rev 7026)
+++ GNUnet/src/util/pseudonym/names.c 2008-06-04 05:57:05 UTC (rev 7044)
@@ -19,7 +19,7 @@
*/
/**
- * @file applications/fs/namespace/names.c
+ * @file util/pseudonym/names.c
* @brief create unique, human-readable names for namespaces
* @author Christian Grothoff
*/
@@ -27,7 +27,6 @@
#include "platform.h"
#include <extractor.h>
#include "gnunet_directories.h"
-#include "gnunet_namespace_lib.h"
#include "gnunet_util.h"
#include "info.h"
#include "common.h"
@@ -39,11 +38,11 @@
* @return NULL on failure (should never happen)
*/
char *
-GNUNET_PSEUDO_id_to_name (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid)
+GNUNET_pseudonym_id_to_name (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * nsid)
{
- struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_MetaData *meta;
char *name;
GNUNET_HashCode nh;
char *fn;
@@ -56,29 +55,29 @@
meta = NULL;
name = NULL;
if (GNUNET_OK ==
- GNUNET_PSEUDO_internal_read_info_ (ectx, cfg, nsid, &meta, NULL, &name))
+ GNUNET_pseudonym_internal_read_info_ (ectx, cfg, nsid, &meta, NULL,
&name))
{
if ((meta != NULL) && (name == NULL))
- name = GNUNET_ECRS_meta_data_get_first_by_types (meta,
- EXTRACTOR_TITLE,
- EXTRACTOR_FILENAME,
- EXTRACTOR_DESCRIPTION,
- EXTRACTOR_SUBJECT,
- EXTRACTOR_PUBLISHER,
- EXTRACTOR_AUTHOR,
- EXTRACTOR_COMMENT,
- EXTRACTOR_SUMMARY,
- EXTRACTOR_OWNER, -1);
+ name = GNUNET_meta_data_get_first_by_types (meta,
+ EXTRACTOR_TITLE,
+ EXTRACTOR_FILENAME,
+ EXTRACTOR_DESCRIPTION,
+ EXTRACTOR_SUBJECT,
+ EXTRACTOR_PUBLISHER,
+ EXTRACTOR_AUTHOR,
+ EXTRACTOR_COMMENT,
+ EXTRACTOR_SUMMARY,
+ EXTRACTOR_OWNER, -1);
if (meta != NULL)
{
- GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_meta_data_destroy (meta);
meta = NULL;
}
}
if (name == NULL)
name = GNUNET_strdup (_("no-name"));
GNUNET_hash (name, strlen (name), &nh);
- fn = GNUNET_PSEUDO_internal_get_data_filename_ (ectx,
+ fn = GNUNET_pseudonym_internal_get_data_filename_ (ectx,
cfg, PS_NAMES_DIR, &nh);
len = 0;
GNUNET_disk_file_size (ectx, fn, &len, GNUNET_YES);
@@ -116,9 +115,9 @@
* @return GNUNET_OK on success
*/
int
-GNUNET_PSEUDO_name_to_id (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const char *ns_uname, GNUNET_HashCode * nsid)
+GNUNET_pseudonym_name_to_id (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const char *ns_uname, GNUNET_HashCode * nsid)
{
size_t slen;
unsigned long long len;
@@ -138,8 +137,8 @@
name[slen - 1] = '\0';
GNUNET_hash (name, strlen (name), &nh);
GNUNET_free (name);
- fn = GNUNET_PSEUDO_internal_get_data_filename_ (ectx,
- cfg, PS_NAMES_DIR, &nh);
+ fn = GNUNET_pseudonym_internal_get_data_filename_ (ectx,
+ cfg, PS_NAMES_DIR, &nh);
if ((GNUNET_OK != GNUNET_disk_file_test (ectx,
fn) ||
(GNUNET_OK != GNUNET_disk_file_size (ectx, fn, &len, GNUNET_YES))) ||
Modified: GNUnet/src/util/pseudonym/notification.c
===================================================================
--- GNUnet/src/applications/fs/pseudonyms/notification.c 2008-06-02
21:51:05 UTC (rev 7026)
+++ GNUnet/src/util/pseudonym/notification.c 2008-06-04 05:57:05 UTC (rev
7044)
@@ -27,13 +27,12 @@
#include "platform.h"
#include "gnunet_directories.h"
-#include "gnunet_pseudonym_lib.h"
#include "gnunet_util.h"
struct DiscoveryCallback
{
struct DiscoveryCallback *next;
- GNUNET_PSEUDO_PseudonymIterator callback;
+ GNUNET_PseudonymIterator callback;
void *closure;
};
@@ -45,9 +44,9 @@
* Internal notification about new tracked URI.
*/
void
-GNUNET_PSEUDO_internal_notify_ (const GNUNET_HashCode * id,
- const struct GNUNET_ECRS_MetaData *md,
- int rating)
+GNUNET_pseudonym_internal_notify_ (const GNUNET_HashCode * id,
+ const struct GNUNET_MetaData *md,
+ int rating)
{
struct DiscoveryCallback *pos;
@@ -68,11 +67,11 @@
* a new pseudonym.
*/
int
-GNUNET_PSEUDO_register_discovery_callback (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration
- *cfg,
- GNUNET_PSEUDO_PseudonymIterator
- iterator, void *closure)
+GNUNET_pseudonym_register_discovery_callback (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration
+ *cfg,
+ GNUNET_PseudonymIterator
+ iterator, void *closure)
{
struct DiscoveryCallback *list;
@@ -82,7 +81,7 @@
GNUNET_mutex_lock (lock);
list->next = head;
head = list;
- GNUNET_PSEUDO_list_all (ectx, cfg, iterator, closure);
+ GNUNET_pseudonym_list_all (ectx, cfg, iterator, closure);
GNUNET_mutex_unlock (lock);
return GNUNET_OK;
}
@@ -91,8 +90,8 @@
* Unregister pseudonym discovery callback.
*/
int
-GNUNET_PSEUDO_unregister_discovery_callback (GNUNET_PSEUDO_PseudonymIterator
- iterator, void *closure)
+GNUNET_pseudonym_unregister_discovery_callback (GNUNET_PseudonymIterator
+ iterator, void *closure)
{
struct DiscoveryCallback *prev;
struct DiscoveryCallback *pos;
@@ -122,12 +121,12 @@
-void __attribute__ ((constructor)) GNUNET_PSEUDO_ltdl_init ()
+void __attribute__ ((constructor)) GNUNET_pseudonym_ltdl_init ()
{
lock = GNUNET_mutex_create (GNUNET_NO);
}
-void __attribute__ ((destructor)) GNUNET_PSEUDO_ltdl_fini ()
+void __attribute__ ((destructor)) GNUNET_pseudonym_ltdl_fini ()
{
GNUNET_mutex_destroy (lock);
lock = NULL;
Modified: GNUnet/src/util/pseudonym/notification.h
===================================================================
--- GNUnet/src/applications/fs/pseudonyms/notification.h 2008-06-02
21:51:05 UTC (rev 7026)
+++ GNUnet/src/util/pseudonym/notification.h 2008-06-04 05:57:05 UTC (rev
7044)
@@ -25,7 +25,7 @@
*/
-#include "gnunet_pseudonym_lib.h"
+#include "gnunet_util.h"
#ifndef PSEUDONYM_NOTIFICATON_H
#define PSEUDONYM_NOTIFICATON_H
@@ -34,8 +34,8 @@
* Internal notification about new tracked pseudonym.
*/
void
-GNUNET_PSEUDO_internal_notify_ (const GNUNET_HashCode * id,
- const struct GNUNET_ECRS_MetaData *md,
- int rating);
+GNUNET_pseudonym_internal_notify_ (const GNUNET_HashCode * id,
+ const struct GNUNET_MetaData *md,
+ int rating);
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r7044 - in GNUnet: . src/applications/chat/lib src/applications/chat/tools src/applications/fs src/applications/fs/collection src/applications/fs/ecrs src/applications/fs/fsui src/applications/fs/gap src/applications/fs/namespace src/applications/fs/tools src/applications/fs/uritrack src/include src/util src/util/containers src/util/pseudonym,
gnunet <=