[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6926 - in GNUnet: . src/applications/chat src/applications
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6926 - in GNUnet: . src/applications/chat src/applications/dht src/applications/fs src/applications/fs/fsui src/applications/fs/namespace src/applications/fs/tools src/applications/stats src/include |
Date: |
Thu, 29 May 2008 21:59:29 -0600 (MDT) |
Author: grothoff
Date: 2008-05-29 21:59:29 -0600 (Thu, 29 May 2008)
New Revision: 6926
Removed:
GNUnet/src/applications/fs/namespace/names.c
GNUnet/src/applications/fs/namespace/namespace_info.c
GNUnet/src/applications/fs/namespace/namespace_info.h
GNUnet/src/applications/fs/namespace/namespace_notification.c
GNUnet/src/applications/fs/namespace/namespace_notification.h
Modified:
GNUnet/configure.ac
GNUnet/src/applications/chat/chat.c
GNUnet/src/applications/chat/chat.h
GNUnet/src/applications/chat/clientapi.c
GNUnet/src/applications/dht/Makefile.am
GNUnet/src/applications/fs/Makefile.am
GNUnet/src/applications/fs/fsui/Makefile.am
GNUnet/src/applications/fs/fsui/search.c
GNUnet/src/applications/fs/namespace/Makefile.am
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-insert.c
GNUnet/src/applications/fs/tools/gnunet-pseudonym.c
GNUnet/src/applications/stats/clientapi.c
GNUnet/src/include/Makefile.am
GNUnet/src/include/gnunet_chat_lib.h
GNUnet/src/include/gnunet_ecrs_lib.h
GNUnet/src/include/gnunet_namespace_lib.h
GNUnet/src/include/gnunet_protocols.h
GNUnet/todo
Log:
split of namespace library into namespace + pseudonym library almost complete
Modified: GNUnet/configure.ac
===================================================================
--- GNUnet/configure.ac 2008-05-30 03:36:23 UTC (rev 6925)
+++ GNUnet/configure.ac 2008-05-30 03:59:29 UTC (rev 6926)
@@ -889,6 +889,7 @@
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
Modified: GNUnet/src/applications/chat/chat.c
===================================================================
--- GNUnet/src/applications/chat/chat.c 2008-05-30 03:36:23 UTC (rev 6925)
+++ GNUnet/src/applications/chat/chat.c 2008-05-30 03:59:29 UTC (rev 6926)
@@ -134,7 +134,10 @@
{
if (0 == strcmp(room,
pos->room))
- coreAPI->cs_send_message (pos->client, message, GNUNET_YES);
+ {
+ /* fixme: private / anonymous delivery options! */
+ coreAPI->cs_send_message (pos->client, message, GNUNET_YES);
+ }
pos = pos->next;
}
GNUNET_mutex_unlock (chatMutex);
Modified: GNUnet/src/applications/chat/chat.h
===================================================================
--- GNUnet/src/applications/chat/chat.h 2008-05-30 03:36:23 UTC (rev 6925)
+++ GNUnet/src/applications/chat/chat.h 2008-05-30 03:59:29 UTC (rev 6926)
@@ -29,45 +29,172 @@
#include "gnunet_core.h"
#include "gnunet_chat_lib.h"
+/**
+ * We have received a chat message (server to client). After this
+ * struct, the remaining bytes are the actual message in plaintext.
+ */
typedef struct
{
GNUNET_MessageHeader header;
- unsigned short nick_len;
+ /**
+ * Message options, see GNUNET_CHAT_MSG_OPTIONS.
+ */
+ unsigned int msg_options;
- unsigned short msg_len;
+ /**
+ * Hash of the public key of the pseudonym of the
+ * sender of the message (all zeros for anonymous).
+ */
+ GNUNET_HashCode sender;
- /*int room_name_len; */
+} CS_chat_MESSAGE_ReceiveNotification;
- char nick[1];
+/**
+ * Send a chat message (client to server). After this struct, the
+ * remaining bytes are the actual message in plaintext.
+ */
+typedef struct
+{
+ GNUNET_MessageHeader header;
-} CS_chat_MESSAGE;
+ /**
+ * Desired message options, see GNUNET_CHAT_MSG_OPTIONS.
+ */
+ unsigned int msg_options;
+ /**
+ * Sequence number of the message (unique per sender).
+ */
+ unsigned int sequence_number;
+
+ /**
+ * Reserved (for alignment).
+ */
+ unsigned int reserved;
+
+ /**
+ * Who should receive this message? Set to all zeros
+ * for "everyone".
+ */
+ GNUNET_HashCode target;
+
+} CS_chat_MESSAGE_TransmitRequest;
+
+/**
+ * Confirm receipt of a chat message (this is the receipt
+ * send from the daemon to the original sender; clients
+ * do not have to ever generate receipts on their own).
+ */
typedef struct
{
GNUNET_MessageHeader header;
- GNUNET_RSA_PublicKey pkey;
+ /**
+ * Sequence number of the original message.
+ */
+ unsigned int sequence_number;
+ /**
+ * Time of receipt.
+ */
+ GNUNET_CronTime timestamp;
+
+ /**
+ * Who is confirming the receipt?
+ */
+ GNUNET_HashCode target;
+
+ /**
+ * Hash of the (possibly encrypted) content.
+ */
+ GNUNET_HashCode content;
+
+ /**
+ * Signature confirming receipt. Signature
+ * covers everything from header through content.
+ */
+ GNUNET_RSA_Signature signature;
+
+} CS_chat_MESSAGE_ConfirmationReceipt;
+
+/**
+ * Message send from client to daemon to join a chat room.
+ */
+typedef struct
+{
+ GNUNET_MessageHeader header;
+
+ /**
+ * Options. Set all options that this client is willing to receive.
+ * For example, if the client does not want to receive anonymous or
+ * OTR messages but is willing to generate acknowledgements and
+ * receive private messages, this should be set to
+ * GNUNET_CHAT_MSG_PRIVATE | GNUNET_CHAT_MSG_ACKNOWLEDGED.
+ */
+ unsigned int msg_options;
+
+ /**
+ * Private key of the joining member.
+ */
+ GNUNET_RSA_PrivateKeyEncoded private_key;
+
unsigned short nick_len;
/* followed by nick_len bytes of
the nickname; then followed
by the name of the chat room */
-} CS_chat_JOIN_MESSAGE;
+} CS_chat_MESSAGE_JoinRequest;
+/**
+ * Message send by server to client to indicate joining
+ * or leaving of another room member. This struct is
+ * followed by the serialized ECRS MetaData describing
+ * the new member.
+ */
typedef struct
{
GNUNET_MessageHeader header;
+
+ /**
+ * Options. Set to all options that the new user is willing to
+ * process. For example, if the client does not want to receive
+ * anonymous or OTR messages but is willing to generate
+ * acknowledgements and receive private messages, this should be set
+ * to GNUNET_CHAT_MSG_PRIVATE | GNUNET_CHAT_MSG_ACKNOWLEDGED.
+ */
+ unsigned int msg_options;
- unsigned short nick_len;
+ /**
+ * Public key of the new user.
+ */
+ GNUNET_RSA_PublicKey public_key;
- char nick[1];
+} CS_chat_MESSAGE_JoinNotification;
-} CS_chat_ROOM_MEMBER_MESSAGE;
+/**
+ * Message send by server to client to indicate
+ * leaving of another room member.
+ */
+typedef struct
+{
+ GNUNET_MessageHeader header;
+
+ /**
+ * Reserved (for alignment).
+ */
+ unsigned int reserved;
+
+ /**
+ * Who is leaving?
+ */
+ GNUNET_HashCode user;
+} CS_chat_MESSAGE_LeaveNotification;
+
+
#endif
/* end of chat.h */
Modified: GNUnet/src/applications/chat/clientapi.c
===================================================================
--- GNUnet/src/applications/chat/clientapi.c 2008-05-30 03:36:23 UTC (rev
6925)
+++ GNUnet/src/applications/chat/clientapi.c 2008-05-30 03:59:29 UTC (rev
6926)
@@ -47,73 +47,59 @@
struct GNUNET_GC_Configuration *cfg;
+ struct GNUNET_ECRS_MetaData * member_info;
+
char *nickname;
char *room_name;
- GNUNET_RSA_PublicKey my_public_key;
+ struct GNUNET_RSA_PrivateKeyEncoded *my_private_key;
- GNUNET_HashCode my_public_key_hash;
+ GNUNET_CHAT_MessageCallback message_callback;
- struct GNUNET_RSA_PrivateKey *my_private_key;
+ void *message_callback_cls;
- char *memberInfo;
+ GNUNET_CHAT_MemberListCallback member_list_callback;
- GNUNET_CHAT_MessageCallback callback;
+ void *member_list_callback_cls;
- GNUNET_CHAT_MemberListCallback member_list_callback;
+ GNUNET_CHAT_MessageConfirmation confirmation_callback;
+ void *confirmation_cls;
+
int shutdown_flag;
- void *callback_cls;
- void *member_list_callback_cls;
-
};
static int
GNUNET_CHAT_rejoin_room (struct GNUNET_CHAT_Room *chat_room)
{
CS_chat_JOIN_MESSAGE *join_msg;
- GNUNET_MessageHeader csHdr;
- GNUNET_HashCode hash_of_me;
- GNUNET_HashCode hash_of_room_name;
- int size_of_join;
+ unsigned int size_of_join;
+ unsigned int nick_len;
+ char * nick;
- csHdr.size = htons (sizeof (CS_chat_JOIN_MESSAGE));
- csHdr.type = htons (GNUNET_CS_PROTO_CHAT_JOIN_MSG);
-
- GNUNET_hash (&chat_room->my_public_key, sizeof (GNUNET_RSA_PublicKey),
- &hash_of_me);
- GNUNET_hash (chat_room->room_name, strlen (chat_room->room_name),
- &hash_of_room_name);
+ nick_len = strlen(chat_room->nickname);
size_of_join =
- sizeof (CS_chat_JOIN_MESSAGE) + strlen (chat_room->nickname) +
+ sizeof (CS_chat_JOIN_MESSAGE) + nick_len +
strlen (chat_room->room_name);
+ if (size_of_join >= GNUNET_MAX_BUFFER_SIZE - 8)
+ return GNUNET_SYSERR;
join_msg = GNUNET_malloc (size_of_join);
- join_msg->nick_len = htons (strlen (chat_room->nickname));
- memcpy (&join_msg->pkey, &chat_room->my_public_key,
- sizeof (GNUNET_RSA_PublicKey));
-
-#if FIXED
- char *nick = (char *) &join_msg[1];
- memcpy (nick, chat_room->nickname, strlen (chat_room->nickname));
-#endif
-
- memcpy (&join_msg->nick[0], chat_room->nickname,
- strlen (chat_room->nickname));
- memcpy (&join_msg->
- nick[strlen (chat_room->nickname)],
- chat_room->room_name, strlen (chat_room->room_name));
- join_msg->header = csHdr;
join_msg->header.size = htons (size_of_join);
+ join_msg->header.type = htons (GNUNET_CS_PROTO_CHAT_JOIN_MSG);
+ join_msg->nick_len = htons (nick_len);
+ nick = (char *) &join_msg[1];
+ memcpy (nick, chat_room->nickname, nick_len);
+ memcpy (&nick[nick_len],
+ chat_room->room_name, strlen (chat_room->room_name));
if (GNUNET_SYSERR ==
GNUNET_client_connection_write (chat_room->sock, &join_msg->header))
{
GNUNET_free (join_msg);
return GNUNET_SYSERR;
- }
-
+ }
GNUNET_free (join_msg);
return GNUNET_OK;
}
@@ -275,7 +261,7 @@
* Returns the private key on success,
* NULL on error.
*/
-static struct GNUNET_RSA_PrivateKey *
+static struct GNUNET_RSA_PrivateKeyEncoded *
GNUNET_CHAT_initPrivateKey (struct GNUNET_GE_Context *ectx,
struct GNUNET_GC_Configuration *cfg,
const char *nick_name)
@@ -285,7 +271,6 @@
GNUNET_RSA_PrivateKeyEncoded *encPrivateKey;
unsigned short len;
int res;
- struct GNUNET_RSA_PrivateKey *privKey;
if (-1 == GNUNET_GC_get_configuration_value_filename (cfg,
"PATHS",
@@ -355,51 +340,50 @@
keyfile,
encPrivateKey, ntohs (encPrivateKey->len),
"600");
- GNUNET_free (encPrivateKey);
+ GNUNET_RSA_free_key(key);
GNUNET_GE_LOG (ectx,
GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Done creating key.\n"));
}
- else
- {
- privKey = GNUNET_RSA_decode_key (encPrivateKey);
- GNUNET_free (encPrivateKey);
- }
GNUNET_free (keyfile);
GNUNET_GE_ASSERT (ectx, privKey != NULL);
- return privKey;
+ return encPrivateKey;
}
/**
* Join a chat room.
*
- * @param nickname the nick you want to use
+ * @param nick_name nickname of the user joining (used to
+ * determine which public key to use);
+ * the nickname should probably also
+ * be used in the member_info (as "EXTRACTOR_TITLE")
+ * @param member_info information about the joining member
* @param memberInfo public information about you
- * @param callback which function to call if a message has
- * been received?
- * @param cls argument to callback
+ * @param messageCallback which function to call if a message has
+ * been received?
+ * @param message_cls argument to callback
+ * @param memberCallback which function to call for join/leave notifications
+ * @param confirmationCallback which function to call for confirmations (maybe
NULL)
* @return NULL on error
*/
struct GNUNET_CHAT_Room *
GNUNET_CHAT_join_room (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const char *nickname,
- const char *room_name,
-
- const char *memberInfo,
- GNUNET_CHAT_MessageCallback callback, void *cls,
- GNUNET_CHAT_MemberListCallback memberCallback,
- void *membercls)
+ struct GNUNET_GC_Configuration*cfg,
+ const char *nick_name,
+ struct GNUNET_ECRS_MetaData * member_info,
+ const char *room_name,
+ GNUNET_CHAT_MessageCallback messageCallback,
+ void *message_cls,
+ GNUNET_CHAT_MemberListCallback memberCallback,
+ void *member_cls,
+ GNUNET_CHAT_MessageConfirmation confirmationCallback,
+ void *confirmation_cls)
{
- CS_chat_JOIN_MESSAGE *join_msg;
- GNUNET_HashCode hash_of_me;
struct GNUNET_CHAT_Room *chat_room;
struct GNUNET_ClientServerConnection *sock;
- int size_of_join;
- GNUNET_RSA_PublicKey me;
- struct GNUNET_RSA_PrivateKey *key;
+ struct GNUNET_RSA_PrivateKeyEncoded *key;
- key = GNUNET_CHAT_initPrivateKey(ectx, cfg, nickname);
+ key = GNUNET_CHAT_initPrivateKey(ectx, cfg, nick_name);
if (key == NULL)
return NULL;
sock = GNUNET_client_connection_create (ectx, cfg);
@@ -408,47 +392,38 @@
GNUNET_RSA_free_key(key);
return NULL;
}
- GNUNET_RSA_get_public_key (key, &me);
- GNUNET_hash (&me, sizeof (GNUNET_RSA_PublicKey), &hash_of_me);
- size_of_join =
- sizeof (CS_chat_JOIN_MESSAGE) + strlen (nickname) + strlen (room_name);
- join_msg = GNUNET_malloc (size_of_join);
- join_msg->header.size = htons (size_of_join);
- join_msg->header.type = htons (GNUNET_CS_PROTO_CHAT_JOIN_MSG);
- join_msg->nick_len = htons (strlen (nickname));
- memcpy (&join_msg->pkey, &me, sizeof (GNUNET_RSA_PublicKey));
- //join_msg->pubkey_len = htons (sizeof (GNUNET_RSA_PublicKey));
- memcpy (&join_msg->nick[0], nickname, strlen (nickname));
- //memcpy (&join_msg->nick[strlen (nickname)], me,
- // sizeof (GNUNET_RSA_PublicKey));
- memcpy (&join_msg->nick[strlen (nickname)], room_name, strlen (room_name));
- if (GNUNET_SYSERR ==
- GNUNET_client_connection_write (sock, &join_msg->header))
- {
- /* ALREADY LOGGED */
- fprintf (stderr, _("Error writing to socket.\n"));
- GNUNET_client_connection_destroy (sock);
- GNUNET_free (join_msg);
- GNUNET_RSA_free_key(key);
- return NULL;
- }
- GNUNET_free (join_msg);
chat_room = GNUNET_malloc (sizeof (struct GNUNET_CHAT_Room));
- chat_room->nickname = GNUNET_strdup (nickname);
+ chat_room->nickname = GNUNET_strdup (nick_name);
chat_room->room_name = GNUNET_strdup (room_name);
- chat_room->my_public_key = me;
- chat_room->my_public_key_hash = hash_of_me;
+ chat_room->member_info = GNUNET_ECRS_meta_data_duplicate(member_info);
chat_room->my_private_key = key;
- chat_room->callback = callback;
- chat_room->callback_cls = cls;
+ chat_room->message_callback = callback;
+ chat_room->message_callback_cls = cls;
chat_room->member_list_callback = memberCallback;
chat_room->member_list_callback_cls = membercls;
+ chat_room->confirmation_callback = confirmation_callback;
+ chat_room->confirmation_cls = confirmation_cls;
chat_room->ectx = ectx;
chat_room->cfg = cfg;
- chat_room->memberInfo = GNUNET_strdup (memberInfo);
chat_room->sock = sock;
chat_room->listen_thread =
GNUNET_thread_create (&poll_thread, chat_room, 1024 * 2);
+ if (chat_room->listen_thread == NULL)
+ {
+ GNUNET_free(chat_room->nickname);
+ GNUNET_free(chat_room->room_name);
+ GNUNET_client_connection_destroy (chat_room->sock);
+ GNUNET_ECRS_meta_data_destroy(chat_room->member_info);
+ GNUNET_free(chat_room);
+ GNUNET_free(key);
+ return NULL;
+ }
+ if (GNUNET_SYSERR ==
+ GNUNET_CHAT_rejoin_room(chat_room))
+ {
+ GNUNET_CHAT_leave_room(chat_room);
+ return NULL;
+ }
return chat_room;
}
@@ -458,19 +433,18 @@
void
GNUNET_CHAT_leave_room (struct GNUNET_CHAT_Room *chat_room)
{
-
void *unused;
+
chat_room->shutdown_flag = GNUNET_YES;
GNUNET_client_connection_close_forever (chat_room->sock);
GNUNET_thread_stop_sleep (chat_room->listen_thread);
GNUNET_thread_join (chat_room->listen_thread, &unused);
GNUNET_free (chat_room->room_name);
GNUNET_free (chat_room->nickname);
- GNUNET_free (chat_room->memberInfo);
+ GNUNET_ECRS_meta_data_destroy(chat_room->member_info);
GNUNET_client_connection_destroy (chat_room->sock);
GNUNET_RSA_free_key(chat_room->my_private_key);
GNUNET_free (chat_room);
-
}
/**
@@ -488,30 +462,29 @@
const GNUNET_RSA_PublicKey * receiver)
{
int ret = GNUNET_OK;
- GNUNET_MessageHeader cs_msg_hdr;
CS_chat_MESSAGE *msg_to_send;
+ unsigned int msg_size;
- cs_msg_hdr.size =
- htons (sizeof (CS_chat_MESSAGE) +
- strlen (room->nickname) + strlen (message) +
- strlen (room->room_name));
- cs_msg_hdr.type = htons (GNUNET_CS_PROTO_CHAT_MSG);
- msg_to_send = GNUNET_malloc (ntohs (cs_msg_hdr.size));
- msg_to_send->nick_len = htons (strlen (room->nickname));
- msg_to_send->msg_len = htons (strlen (message));
- memcpy (&msg_to_send->nick[0], room->nickname, strlen (room->nickname));
- memcpy (&msg_to_send->nick[strlen (room->nickname)], message,
- strlen (message));
- memcpy (&msg_to_send->nick[strlen (room->nickname) + strlen (message)],
- room->room_name, strlen (room->room_name));
- msg_to_send->header = cs_msg_hdr;
- if (GNUNET_SYSERR ==
- GNUNET_client_connection_write (room->sock, &msg_to_send->header))
- {
- fprintf (stderr, _("Error writing to socket.\n"));
- ret = GNUNET_SYSERR;
- }
-
+ msg_size = strlen(message) + sizeof(CS_chat_MESSAGE_TransmitRequest);
+ if (msg_size > GNUNET_MAX_BUFFER_SIZE - 8)
+ return GNUNET_SYSERR;
+ msg_to_send = GNUNET_malloc (msg_size);
+ msg_to_send->header.size = htons(msg_size);
+ msg_to_send->header.type = htons(GNUNET_CS_PROTO_CHAT_TRANSMIT_REQUEST);
+ msg_to_send->msg_options = htonl(options);
+ msg_to_send->sequence_number = room->sequence_number++;
+ msg_to_send->reserved = htonl(0);
+ if (receiver == NULL)
+ memset(&msg_to_send->target, 0, sizeof(GNUNET_HashCode));
+ else
+ GNUNET_hash(receiver,
+ sizeof(GNUNET_RSA_PublicKey),
+ &msg_to_send->target);
+ memcpy(&msg_to_send[1],
+ message,
+ strlen(message));
+ ret = GNUNET_client_connection_write (room->sock, &msg_to_send->header);
+ GNUNET_free(msg_to_send);
return ret;
}
Modified: GNUnet/src/applications/dht/Makefile.am
===================================================================
--- GNUnet/src/applications/dht/Makefile.am 2008-05-30 03:36:23 UTC (rev
6925)
+++ GNUnet/src/applications/dht/Makefile.am 2008-05-30 03:59:29 UTC (rev
6926)
@@ -1 +1 @@
-SUBDIRS = module tools
+SUBDIRS = module
Modified: GNUnet/src/applications/fs/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/Makefile.am 2008-05-30 03:36:23 UTC (rev
6925)
+++ GNUnet/src/applications/fs/Makefile.am 2008-05-30 03:59:29 UTC (rev
6926)
@@ -1,5 +1,5 @@
SUBDIRS = \
- . gap lib ecrs uritrack namespace fsui collection tools
+ . gap lib ecrs uritrack pseudonyms namespace fsui collection tools
INCLUDES = -I$(top_srcdir)/src/include
Modified: GNUnet/src/applications/fs/fsui/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/fsui/Makefile.am 2008-05-30 03:36:23 UTC (rev
6925)
+++ GNUnet/src/applications/fs/fsui/Makefile.am 2008-05-30 03:59:29 UTC (rev
6926)
@@ -18,6 +18,7 @@
$(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/search.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search.c 2008-05-30 03:36:23 UTC (rev
6925)
+++ GNUnet/src/applications/fs/fsui/search.c 2008-05-30 03:59:29 UTC (rev
6926)
@@ -34,6 +34,7 @@
#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
@@ -89,14 +90,18 @@
struct SearchResultList *srl;
struct SearchRecordList *rec;
int update;
+ GNUNET_HashCode nsid;
ectx = pos->ctx->ectx;
GNUNET_URITRACK_track (ectx, pos->ctx->cfg, fi);
if (isRoot)
{
GNUNET_NS_namespace_set_root (ectx, pos->ctx->cfg, fi->uri);
- GNUNET_NS_namespace_add_information (ectx, pos->ctx->cfg, fi->uri,
- fi->meta);
+ GNUNET_ECRS_uri_get_namespace_from_sks(fi->uri,
+ &nsid);
+ GNUNET_PSEUDO_add (ectx, pos->ctx->cfg,
+ &nsid,
+ fi->meta);
return GNUNET_OK;
}
GNUNET_mutex_lock (pos->lock);
Modified: GNUnet/src/applications/fs/namespace/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/namespace/Makefile.am 2008-05-30 03:36:23 UTC
(rev 6925)
+++ GNUnet/src/applications/fs/namespace/Makefile.am 2008-05-30 03:59:29 UTC
(rev 6926)
@@ -5,13 +5,12 @@
libgnunetnamespace_la_SOURCES = \
common.c common.h \
- names.c \
- namespace_info.c namespace_info.h \
- namespace_notification.c namespace_notification.h \
+ info.c \
root_info.c \
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
Deleted: GNUnet/src/applications/fs/namespace/names.c
===================================================================
--- GNUnet/src/applications/fs/namespace/names.c 2008-05-30 03:36:23 UTC
(rev 6925)
+++ GNUnet/src/applications/fs/namespace/names.c 2008-05-30 03:59:29 UTC
(rev 6926)
@@ -1,170 +0,0 @@
-/*
- This file is part of GNUnet
- (C) 2003, 2004, 2005, 2006, 2007, 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 applications/fs/namespace/names.c
- * @brief create unique, human-readable names for namespaces
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include <extractor.h>
-#include "gnunet_directories.h"
-#include "gnunet_namespace_lib.h"
-#include "gnunet_util.h"
-#include "namespace_info.h"
-#include "common.h"
-
-
-/**
- * Return the unique, human readable name for the given namespace.
- *
- * @return NULL on failure (should never happen)
- */
-char *
-GNUNET_NS_nsid_to_name (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid)
-{
- struct GNUNET_ECRS_MetaData *meta;
- char *name;
- GNUNET_HashCode nh;
- char *fn;
- unsigned long long len;
- int fd;
- unsigned int i;
- unsigned int idx;
- char *ret;
-
- meta = NULL;
- name = NULL;
- if (GNUNET_OK ==
- GNUNET_NS_internal_read_namespace_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);
- if (meta != NULL)
- {
- GNUNET_ECRS_meta_data_destroy (meta);
- meta = NULL;
- }
- }
- if (name == NULL)
- name = GNUNET_strdup (_("no-name"));
- GNUNET_hash (name, strlen (name), &nh);
- fn = GNUNET_NS_internal_get_data_filename_ (ectx,
- cfg, NS_NAMES_DIR, &nh, NULL);
- if ((GNUNET_OK != GNUNET_disk_file_test (ectx,
- fn) ||
- (GNUNET_OK != GNUNET_disk_file_size (ectx, fn, &len, GNUNET_YES))))
- {
- GNUNET_free (fn);
- return NULL;
- }
- fd = GNUNET_disk_file_open (ectx, fn, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
- i = 0;
- idx = -1;
- while ((len >= sizeof (GNUNET_HashCode)) &&
- (sizeof (GNUNET_HashCode)
- == READ (fd, &nh, sizeof (GNUNET_HashCode))))
- {
- if (0 == memcmp (&nh, nsid, sizeof (GNUNET_HashCode)))
- {
- idx = i;
- break;
- }
- i++;
- len -= sizeof (GNUNET_HashCode);
- }
- if (idx == -1)
- {
- idx = i;
- WRITE (fd, nsid, sizeof (GNUNET_HashCode));
- }
- CLOSE (fd);
- ret = GNUNET_malloc (strlen (name) + 32);
- GNUNET_snprintf (ret, strlen (name) + 32, "%s-%u", name, idx);
- GNUNET_free (name);
- GNUNET_free (fn);
- return ret;
-}
-
-/**
- * Get the namespace ID belonging to the given namespace name.
- *
- * @return GNUNET_OK on success
- */
-int
-GNUNET_NS_name_to_nsid (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const char *ns_uname, GNUNET_HashCode * nsid)
-{
- size_t slen;
- unsigned long long len;
- unsigned int idx;
- char *name;
- GNUNET_HashCode nh;
- char *fn;
- int fd;
-
- idx = -1;
- slen = strlen (ns_uname);
- while ((slen > 0) && (1 != sscanf (&ns_uname[slen - 1], "-%u", &idx)))
- slen--;
- if (slen == 0)
- return GNUNET_SYSERR;
- name = GNUNET_strdup (ns_uname);
- name[slen] = '\0';
- GNUNET_hash (name, strlen (name), &nh);
- GNUNET_free (name);
- fn = GNUNET_NS_internal_get_data_filename_ (ectx,
- cfg, NS_NAMES_DIR, &nh, NULL);
- if ((GNUNET_OK != GNUNET_disk_file_test (ectx,
- fn) ||
- (GNUNET_OK != GNUNET_disk_file_size (ectx, fn, &len, GNUNET_YES))) ||
- ((idx + 1) * sizeof (GNUNET_HashCode) > len))
- {
- GNUNET_free (fn);
- return GNUNET_SYSERR;
- }
- fd = GNUNET_disk_file_open (ectx, fn, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
- GNUNET_free (fn);
- LSEEK (fd, idx * sizeof (GNUNET_HashCode), SEEK_SET);
- if (sizeof (GNUNET_HashCode) != READ (fd, nsid, sizeof (GNUNET_HashCode)))
- {
- CLOSE (fd);
- return GNUNET_SYSERR;
- }
- CLOSE (fd);
- return GNUNET_OK;
-}
-
-
-/* end of names.c */
Deleted: GNUnet/src/applications/fs/namespace/namespace_info.c
===================================================================
--- GNUnet/src/applications/fs/namespace/namespace_info.c 2008-05-30
03:36:23 UTC (rev 6925)
+++ GNUnet/src/applications/fs/namespace/namespace_info.c 2008-05-30
03:59:29 UTC (rev 6926)
@@ -1,388 +0,0 @@
-/*
- This file is part of GNUnet
- (C) 2003, 2004, 2005, 2006, 2007, 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 applications/fs/namespace/namespace_info.c
- * @brief keeping track of namespaces and metadata about them
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include "gnunet_directories.h"
-#include "gnunet_namespace_lib.h"
-#include "gnunet_util.h"
-#include "namespace_info.h"
-#include "namespace_notification.h"
-#include "common.h"
-
-
-static void
-write_namespace_info (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid,
- const struct GNUNET_ECRS_MetaData *meta,
- int ranking, const char *ns_name)
-{
- unsigned int size;
- unsigned int tag;
- unsigned int off;
- char *buf;
- char *fn;
-
- fn = GNUNET_NS_internal_get_data_filename_ (ectx,
- cfg,
- NS_METADATA_DIR, nsid, NULL);
- size =
- GNUNET_ECRS_meta_data_get_serialized_size (meta,
- GNUNET_ECRS_SERIALIZE_FULL);
- tag = size + sizeof (int) + 1;
- off = 0;
- if (ns_name != NULL)
- {
- off = strlen (ns_name);
- tag += off;
- }
- buf = GNUNET_malloc (tag);
- ((int *) buf)[0] = htonl (ranking); /* ranking */
- if (ns_name != NULL)
- {
- memcpy (&buf[sizeof (int)], ns_name, off + 1);
- }
- else
- {
- 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));
- GNUNET_disk_file_write (ectx, fn, buf, tag, "660");
- GNUNET_free (fn);
- GNUNET_free (buf);
- /* create entry for namespace name in names */
- GNUNET_free_non_null (GNUNET_NS_nsid_to_name (ectx, cfg, nsid));
-}
-
-int
-GNUNET_NS_internal_read_namespace_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)
-{
- unsigned long long len;
- unsigned int size;
- unsigned int zend;
- char *buf;
- char *fn;
-
- if (meta != NULL)
- *meta = NULL;
- if (ns_name != NULL)
- *ns_name = NULL;
- fn = GNUNET_NS_internal_get_data_filename_ (ectx,
- cfg,
- NS_METADATA_DIR, nsid, NULL);
- if ((GNUNET_OK != GNUNET_disk_file_test (ectx,
- fn) ||
- (GNUNET_OK != GNUNET_disk_file_size (ectx, fn, &len, GNUNET_YES))))
- {
- GNUNET_free (fn);
- return GNUNET_SYSERR;
- }
- if (len <= sizeof (int) + 1)
- {
- GNUNET_free (fn);
- return GNUNET_SYSERR;
- }
- if (len > 16 * 1024 * 1024)
- {
- /* too big, must be invalid! remove! */
- GNUNET_GE_BREAK (ectx, 0);
- UNLINK (fn);
- GNUNET_free (fn);
- return GNUNET_SYSERR;
- }
- buf = GNUNET_malloc (len);
- if (len != GNUNET_disk_file_read (ectx, fn, len, buf))
- {
- GNUNET_free (buf);
- GNUNET_free (fn);
- return GNUNET_SYSERR;
- }
- if (ranking != NULL)
- *ranking = ntohl (((int *) buf)[0]);
- zend = sizeof (int);
- while ((zend < len) && (buf[zend] != '\0'))
- zend++;
- if (zend == len)
- {
- GNUNET_free (buf);
- GNUNET_free (fn);
- return GNUNET_SYSERR;
- }
- if (ns_name != NULL)
- {
- if (zend != sizeof (int))
- *ns_name = GNUNET_strdup (&buf[sizeof (int)]);
- else
- *ns_name = NULL;
- }
- zend++;
- size = len - zend;
- if (meta != NULL)
- {
- *meta = GNUNET_ECRS_meta_data_deserialize (ectx, &buf[zend], size);
- if ((*meta) == NULL)
- {
- /* invalid data! remove! */
- GNUNET_GE_BREAK (ectx, 0);
- UNLINK (fn);
- GNUNET_free (buf);
- GNUNET_free (fn);
- return GNUNET_SYSERR;
- }
- }
- GNUNET_free (fn);
- GNUNET_free (buf);
- return GNUNET_OK;
-}
-
-struct ListNamespaceClosure
-{
- GNUNET_NS_NamespaceIterator iterator;
- void *closure;
- struct GNUNET_GE_Context *ectx;
- struct GNUNET_GC_Configuration *cfg;
-};
-
-static int
-list_namespace_helper (const char *fn, const char *dirName, void *cls)
-{
- struct ListNamespaceClosure *c = cls;
- int ret;
- GNUNET_HashCode id;
- char *name;
- int rating;
- struct GNUNET_ECRS_MetaData *meta;
-
- ret = GNUNET_OK;
- if (GNUNET_OK != GNUNET_enc_to_hash (fn, &id))
- return GNUNET_OK; /* invalid name */
- if (GNUNET_OK !=
- GNUNET_NS_internal_read_namespace_info_ (c->ectx, c->cfg, &id, &meta,
- &rating, NULL))
- return GNUNET_OK; /* ignore entry */
- name = GNUNET_NS_nsid_to_name (c->ectx, c->cfg, &id);
- if (c->iterator != NULL)
- ret = c->iterator (c->closure, name, &id, meta, rating);
- GNUNET_free_non_null (name);
- GNUNET_ECRS_meta_data_destroy (meta);
- return ret;
-}
-
-/**
- * List all available namespaces.
- */
-int
-GNUNET_NS_namespace_list_all (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- GNUNET_NS_NamespaceIterator iterator,
- void *closure)
-{
- struct ListNamespaceClosure cls;
- char *fn;
- int ret;
-
- cls.iterator = iterator;
- cls.closure = closure;
- cls.ectx = ectx;
- cls.cfg = cfg;
- fn =
- GNUNET_NS_internal_get_data_filename_ (ectx, cfg, NS_METADATA_DIR, NULL,
- NULL);
- GNUNET_disk_directory_create (ectx, fn);
- ret = GNUNET_disk_directory_scan (ectx, fn, &list_namespace_helper, &cls);
- GNUNET_free (fn);
- return ret;
-}
-
-/**
- * Create a new namespace (and publish an advertismement).
- * This function is synchronous, but may block the system
- * for a while since it must create a public-private key pair!
- *
- * @param meta meta-data about the namespace (maybe NULL)
- * @return namespace root URI on success, NULL on error (namespace already
exists)
- */
-struct GNUNET_ECRS_URI *
-GNUNET_NS_namespace_create (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- unsigned int anonymityLevel,
- unsigned int insertPriority,
- GNUNET_CronTime insertExpiration,
- const char *namespaceName,
- const struct GNUNET_ECRS_MetaData *meta,
- const struct GNUNET_ECRS_URI *advertisementURI,
- const GNUNET_HashCode * rootEntry)
-{
- struct GNUNET_ECRS_URI *ret;
- GNUNET_HashCode id;
-
- ret = GNUNET_ECRS_namespace_create (ectx,
- cfg,
- namespaceName,
- meta,
- anonymityLevel,
- insertPriority,
- insertExpiration, advertisementURI,
- rootEntry);
- if (ret != NULL)
- {
- GNUNET_NS_namespace_set_root (ectx, cfg, ret);
- GNUNET_ECRS_uri_get_namespace_from_sks (ret, &id);
- write_namespace_info (ectx, cfg, &id, meta, 0, namespaceName);
- GNUNET_NS_internal_notify_ (namespaceName, &id, meta, 0);
- }
- return ret;
-}
-
-/**
- * Delete a local namespace.
- *
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
- */
-int
-GNUNET_NS_namespace_delete (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid)
-{
- int ret;
- char *ns_name;
- char *fn;
-
- if (GNUNET_OK != GNUNET_NS_internal_read_namespace_info_ (ectx,
- cfg,
- nsid,
- NULL,
- NULL, &ns_name))
- return GNUNET_SYSERR;
- if (ns_name == NULL)
- return GNUNET_SYSERR;
- ret = GNUNET_ECRS_namespace_delete (ectx, cfg, ns_name);
- GNUNET_free (ns_name);
- fn = GNUNET_NS_internal_get_data_filename_ (ectx,
- cfg, NS_UPDATE_DIR, nsid, NULL);
- GNUNET_disk_directory_remove (ectx, fn);
- GNUNET_free (fn);
- return ret;
-}
-
-/**
- * Change the ranking of a namespace.
- *
- * @param nsid id of the namespace
- * @param delta by how much should the rating be
- * changed?
- * @return new rating of the namespace
- */
-int
-GNUNET_NS_namespace_rank (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid, int delta)
-{
- struct GNUNET_ECRS_MetaData *meta;
- int ret;
- int ranking;
- char *name;
-
- ret =
- GNUNET_NS_internal_read_namespace_info_ (ectx, cfg, nsid, &meta, &ranking,
- &name);
- if (ret == GNUNET_SYSERR)
- {
- ranking = 0;
- meta = GNUNET_ECRS_meta_data_create ();
- }
- ranking += delta;
- write_namespace_info (ectx, cfg, nsid, meta, ranking, name);
- GNUNET_ECRS_meta_data_destroy (meta);
- GNUNET_free (name);
- return ranking;
-}
-
-/**
- * Insert metadata into existing MD record (passed as cls).
- */
-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);
- return GNUNET_OK;
-}
-
-/**
- * Add a namespace to the set of known namespaces.
- * For all namespace advertisements that we discover
- * FSUI should automatically call this function.
- *
- * @param ns the namespace identifier
- */
-void
-GNUNET_NS_namespace_add_information (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const struct GNUNET_ECRS_URI *uri,
- const struct GNUNET_ECRS_MetaData *meta)
-{
- char *name;
- int ranking;
- struct GNUNET_ECRS_MetaData *old;
- GNUNET_HashCode id;
-
- if (!GNUNET_ECRS_uri_test_sks (uri))
- {
- GNUNET_GE_BREAK (ectx, 0);
- return;
- }
- GNUNET_ECRS_uri_get_namespace_from_sks (uri, &id);
- ranking = 0;
- if (GNUNET_OK ==
- GNUNET_NS_internal_read_namespace_info_ (ectx, cfg, &id, &old, &ranking,
- &name))
- {
- GNUNET_ECRS_meta_data_get_contents (meta, &merge_meta_helper, old);
- write_namespace_info (ectx, cfg, &id, old, ranking, name);
- GNUNET_ECRS_meta_data_destroy (old);
- }
- else
- {
- write_namespace_info (ectx, cfg, &id, meta, ranking, NULL);
- }
- GNUNET_NS_internal_notify_ (name, &id, meta, ranking);
- GNUNET_free_non_null (name);
-}
-
-
-/* end of namespace_info.c */
Deleted: GNUnet/src/applications/fs/namespace/namespace_info.h
===================================================================
--- GNUnet/src/applications/fs/namespace/namespace_info.h 2008-05-30
03:36:23 UTC (rev 6925)
+++ GNUnet/src/applications/fs/namespace/namespace_info.h 2008-05-30
03:59:29 UTC (rev 6926)
@@ -1,40 +0,0 @@
-/*
- This file is part of GNUnet
- (C) 2003, 2004, 2005, 2006, 2007, 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 applications/fs/namespace/namespace_info.h
- * @brief keeping track of namespaces and metadata about them
- * @author Christian Grothoff
- */
-
-#ifndef NAMESPACE_INFO_H
-#define NAMESPACE_INFO_H
-
-#include "gnunet_namespace_lib.h"
-#include "gnunet_util.h"
-
-int
-GNUNET_NS_internal_read_namespace_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);
-
-#endif
Deleted: GNUnet/src/applications/fs/namespace/namespace_notification.c
===================================================================
--- GNUnet/src/applications/fs/namespace/namespace_notification.c
2008-05-30 03:36:23 UTC (rev 6925)
+++ GNUnet/src/applications/fs/namespace/namespace_notification.c
2008-05-30 03:59:29 UTC (rev 6926)
@@ -1,136 +0,0 @@
-/*
- This file is part of GNUnet
- (C) 2003, 2004, 2005, 2006, 2007, 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 applications/fs/namespace/namespace_notification.c
- * @brief implementation of the notification mechanism
- * @author Christian Grothoff
- */
-
-
-#include "platform.h"
-#include "gnunet_directories.h"
-#include "gnunet_namespace_lib.h"
-#include "gnunet_util.h"
-
-struct DiscoveryCallback
-{
- struct DiscoveryCallback *next;
- GNUNET_NS_NamespaceIterator callback;
- void *closure;
-};
-
-static struct DiscoveryCallback *head;
-
-static struct GNUNET_Mutex *lock;
-
-/**
- * Internal notification about new tracked URI.
- */
-void
-GNUNET_NS_internal_notify_ (const char *name,
- const GNUNET_HashCode * id,
- const struct GNUNET_ECRS_MetaData *md, int rating)
-{
- struct DiscoveryCallback *pos;
-
- GNUNET_mutex_lock (lock);
- pos = head;
- while (pos != NULL)
- {
- pos->callback (pos->closure, name, id, md, rating);
- pos = pos->next;
- }
- GNUNET_mutex_unlock (lock);
-}
-
-
-
-/**
- * Register callback to be invoked whenever we discover
- * a new namespace.
- */
-int
-GNUNET_NS_register_discovery_callback (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- GNUNET_NS_NamespaceIterator iterator,
- void *closure)
-{
- struct DiscoveryCallback *list;
-
- list = GNUNET_malloc (sizeof (struct DiscoveryCallback));
- list->callback = iterator;
- list->closure = closure;
- GNUNET_mutex_lock (lock);
- list->next = head;
- head = list;
- GNUNET_NS_namespace_list_all (ectx, cfg, iterator, closure);
- GNUNET_mutex_unlock (lock);
- return GNUNET_OK;
-}
-
-/**
- * Unregister namespace discovery callback.
- */
-int
-GNUNET_NS_unregister_discovery_callback (GNUNET_NS_NamespaceIterator iterator,
- void *closure)
-{
- struct DiscoveryCallback *prev;
- struct DiscoveryCallback *pos;
-
- prev = NULL;
- GNUNET_mutex_lock (lock);
- pos = head;
- while ((pos != NULL) &&
- ((pos->callback != iterator) || (pos->closure != closure)))
- {
- prev = pos;
- pos = pos->next;
- }
- if (pos == NULL)
- {
- GNUNET_mutex_unlock (lock);
- return GNUNET_SYSERR;
- }
- if (prev == NULL)
- head = pos->next;
- else
- prev->next = pos->next;
- GNUNET_free (pos);
- GNUNET_mutex_unlock (lock);
- return GNUNET_OK;
-}
-
-
-
-void __attribute__ ((constructor)) GNUNET_NS_ltdl_init ()
-{
- lock = GNUNET_mutex_create (GNUNET_NO);
-}
-
-void __attribute__ ((destructor)) GNUNET_NS_ltdl_fini ()
-{
- GNUNET_mutex_destroy (lock);
- lock = NULL;
-}
-
-
-/* end of namespace_notification.c */
Deleted: GNUnet/src/applications/fs/namespace/namespace_notification.h
===================================================================
--- GNUnet/src/applications/fs/namespace/namespace_notification.h
2008-05-30 03:36:23 UTC (rev 6925)
+++ GNUnet/src/applications/fs/namespace/namespace_notification.h
2008-05-30 03:59:29 UTC (rev 6926)
@@ -1,42 +0,0 @@
-/*
- This file is part of GNUnet
- (C) 2003, 2004, 2005, 2006, 2007, 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 applications/fs/namespace/namespace_notification.h
- * @brief implementation of the notification mechanism
- * @author Christian Grothoff
- */
-
-
-#include "gnunet_namespace_lib.h"
-
-#ifndef NAMESPACE_NOTIFICATON_H
-#define NAMESPACE_NOTIFICATON_H
-
-/**
- * Internal notification about new tracked URI.
- */
-void
-GNUNET_NS_internal_notify_ (const char *name,
- const GNUNET_HashCode * id,
- const struct GNUNET_ECRS_MetaData *md,
- int rating);
-
-#endif
Modified: GNUnet/src/applications/fs/namespace/update_info.c
===================================================================
--- GNUnet/src/applications/fs/namespace/update_info.c 2008-05-30 03:36:23 UTC
(rev 6925)
+++ GNUnet/src/applications/fs/namespace/update_info.c 2008-05-30 03:59:29 UTC
(rev 6926)
@@ -28,8 +28,6 @@
#include "gnunet_directories.h"
#include "gnunet_namespace_lib.h"
#include "gnunet_util.h"
-#include "namespace_info.h"
-#include "namespace_notification.h"
#include "common.h"
@@ -263,23 +261,8 @@
char *old;
struct GNUNET_ECRS_URI *uri;
char *name;
- GNUNET_EncName enc;
- if ((GNUNET_OK !=
- GNUNET_NS_internal_read_namespace_info_ (ectx,
- cfg,
- nsid,
- NULL,
- NULL,
- &name)) || (name == NULL))
- {
- GNUNET_hash_to_enc (nsid, &enc);
- GNUNET_GE_LOG (ectx,
- GNUNET_GE_WARNING | GNUNET_GE_BULK |
- GNUNET_GE_USER,
- _("Could not determine namespace name for `%s'."), &enc);
- return NULL;
- }
+ name = "FIXME";
/* computation of IDs of update(s). Not as terrible as
it looks, just enumerating all of the possible cases
Modified: GNUnet/src/applications/fs/namespace/uri.c
===================================================================
--- GNUnet/src/applications/fs/namespace/uri.c 2008-05-30 03:36:23 UTC (rev
6925)
+++ GNUnet/src/applications/fs/namespace/uri.c 2008-05-30 03:59:29 UTC (rev
6926)
@@ -33,6 +33,7 @@
#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
@@ -53,7 +54,7 @@
if (!GNUNET_ECRS_uri_test_sks (uri))
return NULL;
GNUNET_ECRS_uri_get_namespace_from_sks (uri, &nsid);
- name = GNUNET_NS_nsid_to_name (ectx, cfg, &nsid);
+ name = GNUNET_PSEUDO_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-05-30 03:36:23 UTC
(rev 6925)
+++ GNUnet/src/applications/fs/tools/Makefile.am 2008-05-30 03:59:29 UTC
(rev 6926)
@@ -24,6 +24,7 @@
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 \
@@ -45,6 +46,7 @@
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-insert.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-insert.c 2008-05-30 03:36:23 UTC
(rev 6925)
+++ GNUnet/src/applications/fs/tools/gnunet-insert.c 2008-05-30 03:59:29 UTC
(rev 6926)
@@ -31,6 +31,7 @@
#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
@@ -119,7 +120,7 @@
convertId (next_id, &nextId);
convertId (this_id, &thisId);
convertId (prev_id, &prevId);
- if (GNUNET_OK != GNUNET_NS_name_to_nsid (ectx, cfg, pseudonym, &nsid))
+ if (GNUNET_OK != GNUNET_PSEUDO_name_to_id (ectx, cfg, pseudonym, &nsid))
{
printf (_("\tUnknown namespace `%s'\n"), pseudonym);
return;
Modified: GNUnet/src/applications/fs/tools/gnunet-pseudonym.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-pseudonym.c 2008-05-30 03:36:23 UTC
(rev 6925)
+++ GNUnet/src/applications/fs/tools/gnunet-pseudonym.c 2008-05-30 03:59:29 UTC
(rev 6926)
@@ -28,6 +28,7 @@
#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;
@@ -127,14 +128,15 @@
static int
namespacePrinter (void *unused,
- const char *namespaceName,
const GNUNET_HashCode * id,
const struct GNUNET_ECRS_MetaData *md, int rating)
{
GNUNET_EncName enc;
GNUNET_HashCode nsid;
int cpos;
+ char *namespaceName;
+ namespaceName = GNUNET_PSEUDO_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);
@@ -142,7 +144,7 @@
printf (_("Namespace `%s' (%s) has rating %d.\n"),
namespaceName, (char *) &enc, rating);
printMeta (md);
-
+ GNUNET_free(namespaceName);
if (set_rating != NULL)
{
int delta;
@@ -168,9 +170,9 @@
if (delta != 0)
{
if (GNUNET_OK ==
- GNUNET_NS_name_to_nsid (ectx, cfg, namespaceName, &nsid))
+ GNUNET_PSEUDO_name_to_id (ectx, cfg, namespaceName, &nsid))
{
- rating = GNUNET_NS_namespace_rank (ectx, cfg, &nsid, delta);
+ rating = GNUNET_PSEUDO_rank (ectx, cfg, &nsid, delta);
printf (_("\tRating (after update): %d\n"), rating);
}
else
@@ -218,7 +220,7 @@
/* delete pseudonyms */
if (delete_name != NULL)
{
- if (GNUNET_OK == GNUNET_NS_name_to_nsid (ectx, cfg, delete_name, &nsid))
+ if (GNUNET_OK == GNUNET_PSEUDO_name_to_id (ectx, cfg, delete_name,
&nsid))
{
if (GNUNET_OK == GNUNET_NS_namespace_delete (ectx, cfg, &nsid))
{
@@ -322,7 +324,7 @@
if (0 == be_quiet)
{
/* print information about pseudonyms */
- cnt = GNUNET_NS_namespace_list_all (ectx, cfg, &namespacePrinter, NULL);
+ cnt = GNUNET_PSEUDO_list_all (ectx, cfg, &namespacePrinter, NULL);
if (cnt == -1)
printf (_("Could not access namespace information.\n"));
}
Modified: GNUnet/src/applications/stats/clientapi.c
===================================================================
--- GNUnet/src/applications/stats/clientapi.c 2008-05-30 03:36:23 UTC (rev
6925)
+++ GNUnet/src/applications/stats/clientapi.c 2008-05-30 03:59:29 UTC (rev
6926)
@@ -223,9 +223,24 @@
name = "GNUNET_CS_PROTO_TRACEKIT_REPLY";
break;
- case GNUNET_CS_PROTO_CHAT_MSG:
- name = "GNUNET_CS_PROTO_CHAT_MSG";
+ case GNUNET_CS_PROTO_CHAT_JOIN_REQUEST:
+ name = "GNUNET_CS_PROTO_CHAT_JOIN_REQUEST";
break;
+ case GNUNET_CS_PROTO_CHAT_JOIN_NOTIFICATION:
+ name = "GNUNET_CS_PROTO_CHAT_JOIN_NOTIFICATION";
+ break;
+ case GNUNET_CS_PROTO_CHAT_LEAVE_NOTIFICATION:
+ name = "GNUNET_CS_PROTO_CHAT_LEAVE_NOTIFICATION";
+ break;
+ case GNUNET_CS_PROTO_CHAT_MESSAGE_NOTIFICATION:
+ name = "GNUNET_CS_PROTO_CHAT_MESSAGE_NOTIFICATION";
+ break;
+ case GNUNET_CS_PROTO_CHAT_TRANSMIT_REQUEST:
+ name = "GNUNET_CS_PROTO_CHAT_TRANSMIT_REQUEST";
+ break;
+ case GNUNET_CS_PROTO_CHAT_CONFIRMATION_RECEIPT:
+ name = "GNUNET_CS_PROTO_CHAT_CONFIRMATION_RECEIPT";
+ break;
case GNUNET_CS_PROTO_DHT_REQUEST_GET:
name = "GNUNET_CS_PROTO_DHT_REQUEST_GET";
@@ -234,13 +249,6 @@
name = "GNUNET_CS_PROTO_DHT_REQUEST_PUT";
break;
- case GNUNET_CS_PROTO_TESTBED_REQUEST:
- name = "GNUNET_CS_PROTO_TESTBED_REQUEST";
- break;
- case GNUNET_CS_PROTO_TESTBED_REPLY:
- name = "GNUNET_CS_PROTO_TESTBED_REPLY";
- break;
-
case GNUNET_CS_PROTO_VPN_MSG:
name = "GNUNET_CS_PROTO_VPN_MSG";
break;
Modified: GNUnet/src/include/Makefile.am
===================================================================
--- GNUnet/src/include/Makefile.am 2008-05-30 03:36:23 UTC (rev 6925)
+++ GNUnet/src/include/Makefile.am 2008-05-30 03:59:29 UTC (rev 6926)
@@ -33,6 +33,7 @@
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 \
Modified: GNUnet/src/include/gnunet_chat_lib.h
===================================================================
--- GNUnet/src/include/gnunet_chat_lib.h 2008-05-30 03:36:23 UTC (rev
6925)
+++ GNUnet/src/include/gnunet_chat_lib.h 2008-05-30 03:59:29 UTC (rev
6926)
@@ -29,6 +29,7 @@
#define GNUNET_CHAT_LIB_H
#include "gnunet_util_core.h"
+#include "gnunet_ecrs.h"
#ifdef __cplusplus
extern "C"
@@ -41,7 +42,7 @@
/**
* Version number.
*/
-#define GNUNET_CHAT_VERSION "0.0.1"
+#define GNUNET_CHAT_VERSION "0.0.2"
typedef enum
{
@@ -84,6 +85,8 @@
} GNUNET_CHAT_MSG_OPTIONS;
+#if 0
+/* these are not yet implemented / supported */
/**
* Callback function to iterate over rooms.
*
@@ -99,8 +102,8 @@
int GNUNET_CHAT_list_rooms (struct GNUNET_GE_Context *ectx,
struct GNUNET_GC_Configuration *cfg,
GNUNET_CHAT_RoomIterator it, void *cls);
+#endif
-
/**
* Handle for a (joined) chat room.
*/
@@ -129,80 +132,83 @@
GNUNET_CHAT_MSG_OPTIONS options);
/**
- * @param is_joining will be GNUNET_YES if the member is joining, GNUNET_NO if
he is leaving
+ * @param member_info will be non-null if the member is joining, NULL if he is
leaving
+ * @param member_id hash of public key of the user (for unique identification)
*/
typedef int (*GNUNET_CHAT_MemberListCallback) (void *cls,
- const char *nick,
- int is_joining,
- GNUNET_CronTime timestamp);
+ const struct
GNUNET_ECRS_MetaData* member_info,
+ const GNUNET_HashCode
*member_id);
+
/**
+ * Callback used for message delivery confirmations.
+ *
+ * @param timestamp when was the message received?
+ * @param msg_hash hash fo the original message
+ * @param room in which room was the message received?
+ * @param receipt signature confirming delivery
+ * @return GNUNET_OK
+ */
+typedef int (*GNUNET_CHAT_MessageConfirmation) (void *cls,
+ struct GNUNET_CHAT_Room *room,
+ unsigned int orig_seq_number,
+ GNUNET_CronTime timestamp,
+ const GNUNET_HashCode *
receiver,
+ const GNUNET_HashCode *
msg_hash,
+ const GNUNET_RSA_Signature *
receipt);
+
+
+
+/**
* Join a chat room.
*
- * @param nickname the nick you want to use
+ * @param nick_name nickname of the user joining (used to
+ * determine which public key to use);
+ * the nickname should probably also
+ * be used in the member_info (as "EXTRACTOR_TITLE")
+ * @param member_info information about the joining member
* @param memberInfo public information about you
- * @param callback which function to call if a message has
- * been received?
- * @param cls argument to callback
+ * @param messageCallback which function to call if a message has
+ * been received?
+ * @param message_cls argument to callback
+ * @param memberCallback which function to call for join/leave notifications
+ * @param confirmationCallback which function to call for confirmations (maybe
NULL)
* @return NULL on error
*/
struct GNUNET_CHAT_Room *
GNUNET_CHAT_join_room (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration*cfg,
- const char *nickname,
+ struct GNUNET_GC_Configuration*cfg,
+ const char *nick_name,
+ struct GNUNET_ECRS_MetaData * member_info,
const char *room_name,
- const char *memberInfo,
- GNUNET_CHAT_MessageCallback callback,
- void *cls,
+ GNUNET_CHAT_MessageCallback messageCallback,
+ void *message_cls,
GNUNET_CHAT_MemberListCallback memberCallback,
- void *member_cls);
+ void *member_cls,
+ GNUNET_CHAT_MessageConfirmation confirmationCallback,
+ void *confirmation_cls);
/**
* Leave a chat room.
*/
void GNUNET_CHAT_leave_room (struct GNUNET_CHAT_Room *room);
-
/**
- * Message delivery confirmations.
+ * Send a message to the chat room.
*
- * @param timestamp when was the message sent?
- * @param senderNick what is the nickname of the receiver?
- * @param message the message (maybe NULL)
- * @param room in which room was the message received?
- * @param options what were the options of the message
- * @param response what was the receivers response (GNUNET_OK, GNUNET_NO,
GNUNET_SYSERR).
- * @param receipt signature confirming delivery (maybe NULL, only
- * if confirmation was requested)
- * @return GNUNET_OK to continue, GNUNET_SYSERR to refuse processing further
- * confirmations from anyone for this message
- */
-typedef int (*GNUNET_CHAT_MessageConfirmation) (void *cls,
- struct GNUNET_CHAT_Room *
- room,
- const char *receiverNick,
- const GNUNET_RSA_PublicKey *
- receiverKey,
- const char *message,
- GNUNET_CronTime timestamp,
- GNUNET_CHAT_MSG_OPTIONS
- options, int response,
- const GNUNET_RSA_Signature *
- receipt);
-
-/**
- * Send a message.
- *
+ * @param message 0-terminated Utf-8 string describing the message
+ * (may not be longer than ~63k)
* @param receiver use NULL to send to everyone in the room
+ * @param sequence_number set to the sequence number that was
+ * assigned to the message
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
GNUNET_CHAT_send_message (struct GNUNET_CHAT_Room *room,
const char *message,
- GNUNET_CHAT_MessageConfirmation callback,
- void *cls,
GNUNET_CHAT_MSG_OPTIONS options,
- const GNUNET_RSA_PublicKey * receiver);
+ const GNUNET_RSA_PublicKey * receiver,
+ unsigned int * sequence_number);
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_ecrs_lib.h
===================================================================
--- GNUnet/src/include/gnunet_ecrs_lib.h 2008-05-30 03:36:23 UTC (rev
6925)
+++ GNUnet/src/include/gnunet_ecrs_lib.h 2008-05-30 03:59:29 UTC (rev
6926)
@@ -240,13 +240,10 @@
* @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);
+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?
@@ -287,8 +284,9 @@
/**
* Convert a UTF-8 String to a URI.
*/
-struct GNUNET_ECRS_URI *GNUNET_ECRS_string_to_uri (struct GNUNET_GE_Context
- *ectx, const char *uri);
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_string_to_uri (struct GNUNET_GE_Context *ectx,
+ const char *uri);
/**
* Free URI.
@@ -326,9 +324,8 @@
*
* @return NULL if argument is not a location URI
*/
-struct GNUNET_ECRS_URI *GNUNET_ECRS_uri_get_content_uri_from_loc (const struct
-
GNUNET_ECRS_URI
- *uri);
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_uri_get_content_uri_from_loc (const struct GNUNET_ECRS_URI *uri);
/**
* Function that produces a signature for
@@ -349,33 +346,27 @@
* RSA signatures for "sender".
* @return the location URI
*/
-struct GNUNET_ECRS_URI *GNUNET_ECRS_location_to_uri (const struct
- GNUNET_ECRS_URI *baseUri,
- const
- GNUNET_RSA_PublicKey *
- peer,
- GNUNET_Int32Time
- expirationTime,
- GNUNET_ECRS_SignFunction
- signer,
- void *signer_cls);
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_location_to_uri (const struct GNUNET_ECRS_URI *baseUri,
+ const GNUNET_RSA_PublicKey *peer,
+ GNUNET_Int32Time expirationTime,
+ GNUNET_ECRS_SignFunction signer,
+ void *signer_cls);
/**
* Duplicate URI.
*/
-struct GNUNET_ECRS_URI *GNUNET_ECRS_uri_duplicate (const struct
- GNUNET_ECRS_URI *uri);
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_uri_duplicate (const struct GNUNET_ECRS_URI *uri);
/**
* Expand a keyword-URI by duplicating all keywords,
* adding the current date (YYYY-MM-DD) after each
* keyword.
*/
-struct GNUNET_ECRS_URI *GNUNET_ECRS_uri_expand_keywords_with_date (const
- struct
-
GNUNET_ECRS_URI
- *uri);
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_uri_expand_keywords_with_date (const struct GNUNET_ECRS_URI *uri);
/**
* Create an ECRS URI from a single user-supplied string of keywords.
@@ -392,12 +383,9 @@
* @return an ECRS URI for the given keywords, NULL
* if keywords is not legal (i.e. empty).
*/
-struct GNUNET_ECRS_URI *GNUNET_ECRS_keyword_string_to_uri (struct
- GNUNET_GE_Context
- *ectx,
- const char
- *keywords);
- /* helper.c */
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_keyword_string_to_uri (struct GNUNET_GE_Context *ectx,
+ const char *keywords);
/**
* Create an ECRS URI from a user-supplied command line of keywords.
@@ -416,14 +404,10 @@
* @return an ECRS URI for the given keywords, NULL
* if keywords is not legal (i.e. empty).
*/
-struct GNUNET_ECRS_URI *GNUNET_ECRS_keyword_command_line_to_uri (struct
-
GNUNET_GE_Context
- *ectx,
- unsigned int
- argc,
- const char
- **argv);
- /* helper.c */
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_keyword_command_line_to_uri (struct GNUNET_GE_Context*ectx,
+ unsigned int argc,
+ const char **argv);
/**
* Test if two URIs are equal.
@@ -478,9 +462,8 @@
* 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
- *md);
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_meta_data_to_uri (const struct GNUNET_ECRS_MetaData *md);
typedef struct
@@ -551,8 +534,18 @@
* @return GNUNET_SYSERR if the upload failed (i.e. not enough space
* or gnunetd not running)
*/
-int GNUNET_ECRS_file_upload (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const char *filename, int doIndex, unsigned int
anonymityLevel, unsigned int priority, GNUNET_CronTime expirationTime,
/* absolute time */
- GNUNET_ECRS_UploadProgressCallback upcb, void
*upcbClosure, GNUNET_ECRS_TestTerminate tt, void *ttClosure, struct
GNUNET_ECRS_URI **uri); /* upload.c */
+int GNUNET_ECRS_file_upload (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const char *filename,
+ int doIndex,
+ unsigned int anonymityLevel,
+ unsigned int priority,
+ GNUNET_CronTime expirationTime, /* absolute
time */
+ GNUNET_ECRS_UploadProgressCallback upcb,
+ void *upcbClosure,
+ GNUNET_ECRS_TestTerminate tt,
+ void *ttClosure,
+ struct GNUNET_ECRS_URI **uri); /* upload.c */
/**
* Test if a file is indexed.
@@ -594,7 +587,13 @@
*
* @return GNUNET_SYSERR if the unindexing failed (i.e. not indexed)
*/
-int GNUNET_ECRS_file_unindex (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const char *filename,
GNUNET_ECRS_UploadProgressCallback upcb, void *upcbClosure,
GNUNET_ECRS_TestTerminate tt, void *ttClosure); /* unindex.c */
+int GNUNET_ECRS_file_unindex (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const char *filename,
+ GNUNET_ECRS_UploadProgressCallback upcb,
+ void *upcbClosure,
+ GNUNET_ECRS_TestTerminate tt,
+ void *ttClosure); /* unindex.c */
/**
@@ -617,24 +616,16 @@
*
* @return URI on success, NULL on error (namespace already exists)
*/
-struct GNUNET_ECRS_URI *GNUNET_ECRS_namespace_create (struct GNUNET_GE_Context
- *ectx,
- struct
- GNUNET_GC_Configuration
- *cfg, const char *name,
- const struct
- GNUNET_ECRS_MetaData
- *meta,
- unsigned int
- anonymityLevel,
- unsigned int priority,
- GNUNET_CronTime
- expiration,
- const struct
- GNUNET_ECRS_URI
- *advertisementURI,
- const GNUNET_HashCode *
- rootEntry);
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_namespace_create (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const char *name,
+ const struct GNUNET_ECRS_MetaData *meta,
+ unsigned int anonymityLevel,
+ unsigned int priority,
+ GNUNET_CronTime expiration,
+ const struct GNUNET_ECRS_URI *advertisementURI,
+ const GNUNET_HashCode *rootEntry);
/* namespace.c */
/**
@@ -655,7 +646,9 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_ECRS_namespace_delete (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const char *namespaceName); /* namespace.c */
+int GNUNET_ECRS_namespace_delete (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const char *namespaceName); /*
namespace.c */
/**
* Callback with information about local (!) namespaces.
@@ -674,7 +667,10 @@
* @param list where to store the names (is allocated, caller frees)
* @return GNUNET_SYSERR on error, otherwise the number of pseudonyms in list
*/
-int GNUNET_ECRS_get_namespaces (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, GNUNET_ECRS_NamespaceInfoProcessor cb, void
*cls); /* namespace.c */
+int GNUNET_ECRS_get_namespaces (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ GNUNET_ECRS_NamespaceInfoProcessor cb,
+ void *cls); /* namespace.c */
/**
* Add an entry into a namespace.
@@ -686,35 +682,19 @@
* entry?
* @return URI on success, NULL on error
*/
-struct GNUNET_ECRS_URI *GNUNET_ECRS_namespace_add_content (struct
- GNUNET_GE_Context
- *ectx,
- struct
-
GNUNET_GC_Configuration
- *cfg,
- const char *name,
- unsigned int
- anonymityLevel,
- unsigned int
- priority,
- GNUNET_CronTime
- expirationTime,
- GNUNET_Int32Time
- creationTime,
- GNUNET_Int32Time
- updateInterval,
- const
- GNUNET_HashCode *
- thisId,
- const
- GNUNET_HashCode *
- nextId,
- const struct
- GNUNET_ECRS_URI
- *dst,
- const struct
- GNUNET_ECRS_MetaData
- *md);
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_namespace_add_content (struct GNUNET_GE_Context*ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const char *name,
+ unsigned int anonymityLevel,
+ unsigned int priority,
+ GNUNET_CronTime expirationTime,
+ GNUNET_Int32Time creationTime,
+ GNUNET_Int32Time updateInterval,
+ const GNUNET_HashCode *thisId,
+ const GNUNET_HashCode *nextId,
+ const struct GNUNET_ECRS_URI *dst,
+ const struct GNUNET_ECRS_MetaData *md);
/* namespace.c */
/**
@@ -760,7 +740,13 @@
* this must be a simple URI (with a single
* keyword)
*/
-struct GNUNET_ECRS_SearchContext *GNUNET_ECRS_search_start (struct
GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration *cfg, const struct
GNUNET_ECRS_URI *uri, unsigned int anonymityLevel,
GNUNET_ECRS_SearchResultProcessor spcb, void *spcbClosure); /* search.c */
+struct GNUNET_ECRS_SearchContext *
+GNUNET_ECRS_search_start (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const struct GNUNET_ECRS_URI *uri,
+ unsigned int anonymityLevel,
+ GNUNET_ECRS_SearchResultProcessor spcb,
+ void *spcbClosure); /* search.c */
/**
* Stop search for content.
@@ -776,7 +762,14 @@
* @param uri specifies the search parameters
* @param uri set to the URI of the uploaded file
*/
-int GNUNET_ECRS_search (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const struct GNUNET_ECRS_URI *uri, unsigned int
anonymityLevel, GNUNET_ECRS_SearchResultProcessor spcb, void *spcbClosure,
GNUNET_ECRS_TestTerminate tt, void *ttClosure); /* search.c */
+int GNUNET_ECRS_search (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const struct GNUNET_ECRS_URI *uri,
+ unsigned int anonymityLevel,
+ GNUNET_ECRS_SearchResultProcessor spcb,
+ void *spcbClosure,
+ GNUNET_ECRS_TestTerminate tt,
+ void *ttClosure); /* search.c */
/**
* Notification of ECRS to a client about the progress of an insertion
@@ -850,7 +843,15 @@
* @param uri the URI of the file (determines what to download)
* @param filename where to store the file
*/
-int GNUNET_ECRS_file_download (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const struct GNUNET_ECRS_URI *uri, const char
*filename, unsigned int anonymityLevel, GNUNET_ECRS_DownloadProgressCallback
dpcb, void *dpcbClosure, GNUNET_ECRS_TestTerminate tt, void *ttClosure); /*
download.c */
+int GNUNET_ECRS_file_download (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const struct GNUNET_ECRS_URI *uri,
+ const char *filename,
+ unsigned int anonymityLevel,
+ GNUNET_ECRS_DownloadProgressCallback dpcb,
+ void *dpcbClosure,
+ GNUNET_ECRS_TestTerminate tt,
+ void *ttClosure); /* download.c */
/**
* DOWNLOAD parts of a file. Note that this will store
@@ -871,7 +872,18 @@
* @param start starting offset
* @param length length of the download (starting at offset)
*/
-int GNUNET_ECRS_file_download_partial (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const struct GNUNET_ECRS_URI *uri, const char
*filename, unsigned long long offset, unsigned long long length, unsigned int
anonymityLevel, int no_temporaries, GNUNET_ECRS_DownloadProgressCallback dpcb,
void *dpcbClosure, GNUNET_ECRS_TestTerminate tt, void *ttClosure); /*
download.c */
+int GNUNET_ECRS_file_download_partial (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const struct GNUNET_ECRS_URI *uri,
+ const char *filename,
+ unsigned long long offset,
+ unsigned long long length,
+ unsigned int anonymityLevel,
+ int no_temporaries,
+ GNUNET_ECRS_DownloadProgressCallback
dpcb,
+ void *dpcbClosure,
+ GNUNET_ECRS_TestTerminate tt,
+ void *ttClosure); /* download.c */
/**
* Iterate over all entries in a directory. Note that directories
@@ -887,7 +899,12 @@
* @return number of entries on success, GNUNET_SYSERR if the
* directory is malformed
*/
-int GNUNET_ECRS_directory_list_contents (struct GNUNET_GE_Context *ectx, const
char *data, unsigned long long len, struct GNUNET_ECRS_MetaData **md,
GNUNET_ECRS_SearchResultProcessor spcb, void *spcbClosure); /*
directory.c */
+int GNUNET_ECRS_directory_list_contents (struct GNUNET_GE_Context *ectx,
+ const char *data,
+ unsigned long long len,
+ struct GNUNET_ECRS_MetaData **md,
+ GNUNET_ECRS_SearchResultProcessor
spcb,
+ void *spcbClosure); /*
directory.c */
/**
* Create a directory.
Modified: GNUnet/src/include/gnunet_namespace_lib.h
===================================================================
--- GNUnet/src/include/gnunet_namespace_lib.h 2008-05-30 03:36:23 UTC (rev
6925)
+++ GNUnet/src/include/gnunet_namespace_lib.h 2008-05-30 03:59:29 UTC (rev
6926)
@@ -38,19 +38,6 @@
#endif
/**
- * Iterator over all namespaces.
- *
- * @param rating the local rating of the namespace
- * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
- */
-typedef int (*GNUNET_NS_NamespaceIterator) (void *cls,
- const char *namespaceName,
- const GNUNET_HashCode *
- namespaceId,
- const struct GNUNET_ECRS_MetaData
- * md, int rating);
-
-/**
* Iterator over all updateable content.
*
* @param uri URI of the last content published
@@ -78,7 +65,16 @@
* @param meta meta-data about the namespace (maybe NULL)
* @return URI on success, NULL on error (namespace already exists)
*/
-struct GNUNET_ECRS_URI *GNUNET_NS_namespace_create (struct GNUNET_GE_Context
*ectx, struct GNUNET_GC_Configuration *cfg, unsigned int anonymityLevel,
unsigned int insertPriority, GNUNET_CronTime insertExpiration, const char
*namespaceName, const struct GNUNET_ECRS_MetaData *meta, const struct
GNUNET_ECRS_URI *advertisementURI, const GNUNET_HashCode * rootEntry); /*
namespace_info.c */
+struct GNUNET_ECRS_URI *
+GNUNET_NS_namespace_create (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ unsigned int anonymityLevel,
+ unsigned int insertPriority,
+ GNUNET_CronTime insertExpiration,
+ const char *namespaceName,
+ const struct GNUNET_ECRS_MetaData *meta,
+ const struct GNUNET_ECRS_URI *advertisementURI,
+ const GNUNET_HashCode * rootEntry);
/**
* Delete a local namespace. Only prevents future insertions into the
@@ -86,33 +82,11 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_NS_namespace_delete (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const GNUNET_HashCode * nsid); /* namespace.c
*/
+int GNUNET_NS_namespace_delete (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * nsid);
/**
- * Change the ranking of a (non-local) namespace.
- *
- * @param nsid id of the namespace
- * @param delta by how much should the rating be
- * changed?
- * @return new rating of the namespace
- */
-int GNUNET_NS_namespace_rank (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const GNUNET_HashCode * nsid, int delta); /*
namespace_info.c */
-
-/**
- * Add a namespace to the set of known namespaces. For all namespace
- * advertisements that we discover this function should be
- * callled.
- *
- * @param ns the namespace identifier
- */
-void GNUNET_NS_namespace_add_information (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const struct GNUNET_ECRS_URI *uri,
- const struct GNUNET_ECRS_MetaData
- *meta);
-
-
-/**
* Get the root of the namespace (if we have one).
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
@@ -126,29 +100,6 @@
const struct GNUNET_ECRS_URI *uri);
/**
- * List all available (local or non-local) namespaces.
- */
-int GNUNET_NS_namespace_list_all (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, GNUNET_NS_NamespaceIterator iterator, void
*closure); /* namespace_info.c */
-
-/**
- * Register callback to be invoked whenever we discover
- * a new namespace.
- */
-int GNUNET_NS_register_discovery_callback (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration
- *cfg,
- GNUNET_NS_NamespaceIterator
- iterator, void *closure);
-
-/**
- * Unregister namespace discovery callback.
- */
-int GNUNET_NS_unregister_discovery_callback (GNUNET_NS_NamespaceIterator
- iterator, void *closure);
-
-
-
-/**
* Add an entry into a namespace (also for publishing
* updates). Typical uses are (all others would be odd):
* <ul>
@@ -187,7 +138,19 @@
* entry?
* @return the resulting URI, NULL on error
*/
-struct GNUNET_ECRS_URI *GNUNET_NS_add_to_namespace (struct GNUNET_GE_Context
*ectx, struct GNUNET_GC_Configuration *cfg, unsigned int anonymityLevel,
unsigned int insertPriority, GNUNET_CronTime insertExpiration, const
GNUNET_HashCode * nsid, GNUNET_Int32Time updateInterval, const GNUNET_HashCode
* lastId, const GNUNET_HashCode * thisId, const GNUNET_HashCode * nextId, const
struct GNUNET_ECRS_URI *dst, const struct GNUNET_ECRS_MetaData *md); /*
update_info.c */
+struct GNUNET_ECRS_URI *
+GNUNET_NS_add_to_namespace (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ unsigned int anonymityLevel,
+ unsigned int insertPriority,
+ GNUNET_CronTime insertExpiration,
+ const GNUNET_HashCode * nsid,
+ GNUNET_Int32Time updateInterval,
+ const GNUNET_HashCode * lastId,
+ const GNUNET_HashCode * thisId,
+ const GNUNET_HashCode * nextId,
+ const struct GNUNET_ECRS_URI *dst,
+ const struct GNUNET_ECRS_MetaData *md); /*
update_info.c */
/**
* Compute the next ID for peridodically updated content.
@@ -206,28 +169,13 @@
/**
* List all updateable content in a given namespace.
*/
-int GNUNET_NS_namespace_list_contents (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const GNUNET_HashCode * nsid,
GNUNET_NS_UpdateIterator iterator, void *closure); /* namespace_info.c */
+int GNUNET_NS_namespace_list_contents (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * nsid,
+ GNUNET_NS_UpdateIterator iterator,
+ void *closure); /* namespace_info.c */
-
/**
- * Return the unique, human readable name for the given namespace.
- *
- * @return NULL on failure (should never happen)
- */
-char *GNUNET_NS_nsid_to_name (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid);
-
-/**
- * Get the namespace ID belonging to the given namespace name.
- *
- * @return GNUNET_OK on success
- */
-int GNUNET_NS_name_to_nsid (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const char *ns_uname, GNUNET_HashCode * nsid);
-
-/**
* Convert namespace URI to a human readable format
* (using the namespace description, if available).
*/
Modified: GNUnet/src/include/gnunet_protocols.h
===================================================================
--- GNUnet/src/include/gnunet_protocols.h 2008-05-30 03:36:23 UTC (rev
6925)
+++ GNUnet/src/include/gnunet_protocols.h 2008-05-30 03:59:29 UTC (rev
6926)
@@ -259,32 +259,26 @@
/* ********** CS CHAT application messages ********** */
-#define GNUNET_CS_PROTO_CHAT_JOIN_MSG 44
-#define GNUNET_CS_PROTO_CHAT_MSG 45
-#define GNUNET_CS_PROTO_CHAT_ROOM_MEMBER_MESSAGE 46
-#define GNUNET_CS_PROTO_CHAT_ROOM_MEMBER_LEAVE_MESSAGE 47
+#define GNUNET_CS_PROTO_CHAT_JOIN_REQUEST 44
+#define GNUNET_CS_PROTO_CHAT_JOIN_NOTIFICATION 45
+#define GNUNET_CS_PROTO_CHAT_LEAVE_NOTIFICATION 46
+#define GNUNET_CS_PROTO_CHAT_MESSAGE_NOTIFICATION 47
+#define GNUNET_CS_PROTO_CHAT_TRANSMIT_REQUEST 48
+#define GNUNET_CS_PROTO_CHAT_CONFIRMATION_RECEIPT 49
/* ********** CS DHT application messages ********** */
/**
* Client to CS or CS to client: get from table
*/
-#define GNUNET_CS_PROTO_DHT_REQUEST_GET 48
+#define GNUNET_CS_PROTO_DHT_REQUEST_GET 60
/**
* Client to CS or CS to client: put into table
*/
-#define GNUNET_CS_PROTO_DHT_REQUEST_PUT 49
+#define GNUNET_CS_PROTO_DHT_REQUEST_PUT 61
-/* ********** CS TESTBED application messages ********** */
-
-#define GNUNET_CS_PROTO_TESTBED_REQUEST 50
-
-#define GNUNET_CS_PROTO_TESTBED_REPLY 51
-
-
-
/* ************* CS VPN messages ************* */
/**
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2008-05-30 03:36:23 UTC (rev 6925)
+++ GNUnet/todo 2008-05-30 03:59:29 UTC (rev 6926)
@@ -4,7 +4,18 @@
RC == Release Critical
0.8.0 [5'08] (aka "new protocol"):
-- gnunet-chat (CS-only) [RC]
+- namespaces:
+ + need way to map nsid to namespace name (for ECRS interaction!)
+ => additional store? (used to have it, gone with libpseudonym!)
+ => rather: use pseudo's mapping (used already in gnunet-insert, etc!)
+ => need to inform user creating pseudonym about mapped name!!!
+ + need better / actual / compiling testcase!
+ + FSUI: compile errors!
+ + tools: compile errors!
+- chat: [RC]
+ + adapt gnunet-chat for new client api
+ + adapt clientapi.c for new API and message format
+ + adapt chat.c for new message format and requirements
- Windows: gnunet-auto-share
- document gnunet-auto-share on webpage [RC]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6926 - in GNUnet: . src/applications/chat src/applications/dht src/applications/fs src/applications/fs/fsui src/applications/fs/namespace src/applications/fs/tools src/applications/stats src/include,
gnunet <=