[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29760 - in gnunet/src: conversation set testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29760 - in gnunet/src: conversation set testbed |
Date: |
Tue, 1 Oct 2013 14:28:08 +0200 |
Author: grothoff
Date: 2013-10-01 14:28:08 +0200 (Tue, 01 Oct 2013)
New Revision: 29760
Modified:
gnunet/src/conversation/Makefile.am
gnunet/src/conversation/conversation_api.c
gnunet/src/conversation/gnunet-service-conversation.c
gnunet/src/set/test_set_api.c
gnunet/src/testbed/testbed_api_statistics.c
Log:
-fixing misc FTBFS issues
Modified: gnunet/src/conversation/Makefile.am
===================================================================
--- gnunet/src/conversation/Makefile.am 2013-10-01 12:27:55 UTC (rev 29759)
+++ gnunet/src/conversation/Makefile.am 2013-10-01 12:28:08 UTC (rev 29760)
@@ -23,7 +23,7 @@
libgnunetconversation_la_SOURCES = \
conversation_api.c
libgnunetconversation_la_LIBADD = \
- -lgnunetutil -lgnunetgns_common -lgnunetgns
+ -lgnunetutil -lgnunetnamestore -lgnunetgns
libgnunetconversation_la_LDFLAGS = \
$(GNUNET_LDFLAGS) $(WINFLAGS) \
-version-info 0:0:0
@@ -62,7 +62,7 @@
gnunet_service_conversation_SOURCES = \
gnunet-service-conversation.c
gnunet_service_conversation_LDADD = \
- -lgnunetutil -lgnunetmesh -lgnunetgns_common -lgnunetgns\
+ -lgnunetutil -lgnunetmesh -lgnunetnamestore -lgnunetgns\
$(INTLLIBS)
gnunet_service_conversation_LDFLAGS = \
$(GNUNET_LDFLAGS) $(WINFLAGS) -export-dynamic
@@ -77,8 +77,6 @@
-
-
test_conversation_api_SOURCES = \
test_conversation_api.c
test_conversation_api_LDADD = \
@@ -86,6 +84,5 @@
-lgnunetutil
test_conversation_api_LDFLAGS = \
$(GNUNET_LDFLAGS) $(WINFLAGS) -export-dynamic
-
+
pkgcfg_DATA = conversation.conf
-
Modified: gnunet/src/conversation/conversation_api.c
===================================================================
--- gnunet/src/conversation/conversation_api.c 2013-10-01 12:27:55 UTC (rev
29759)
+++ gnunet/src/conversation/conversation_api.c 2013-10-01 12:28:08 UTC (rev
29760)
@@ -33,9 +33,10 @@
*
*/
-#include <gnunet/platform.h>
-#include <gnunet/gnunet_util_lib.h>
-#include <gnunet/gnunet_gns_service.h>
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_dnsparser_lib.h"
+#include "gnunet_gns_service.h"
#include "gnunet_protocols_conversation.h"
#include "gnunet_conversation_service.h"
@@ -140,12 +141,10 @@
static void
setup_gns_txt (struct GNUNET_CONVERSATION_Handle *handle)
{
- struct GNUNET_CRYPTO_EccPublicKey zone_pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey zone_pkey;
struct GNUNET_CRYPTO_EccPrivateKey *zone_key;
- struct GNUNET_CRYPTO_EccPublicKey peer_pkey;
struct GNUNET_CRYPTO_EccPrivateKey *peer_key;
struct GNUNET_NAMESTORE_RecordData rd;
- struct GNUNET_HashCode hash;
struct GNUNET_PeerIdentity peer;
char *zone_keyfile;
@@ -170,22 +169,23 @@
}
zone_key = GNUNET_CRYPTO_ecc_key_create_from_file (zone_keyfile);
- GNUNET_CRYPTO_ecc_key_get_public (zone_key, &zone_pkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (zone_key, &zone_pkey);
peer_key = GNUNET_CRYPTO_ecc_key_create_from_file (peer_keyfile);
- GNUNET_CRYPTO_ecc_key_get_public (peer_key, &peer_pkey);
-
- GNUNET_CRYPTO_hash (&peer_pkey, sizeof (peer_pkey), &hash);
-
- peer.hashPubKey = hash;
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (peer_key,
+ &peer.public_key);
const char *h = GNUNET_i2s_full (&peer);
rd.data_size = strlen (h) + 1;
rd.data = h;
- rd.record_type = GNUNET_GNS_RECORD_TXT;
- rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
+ rd.record_type = GNUNET_DNSPARSER_TYPE_TXT;
+ rd.flags = GNUNET_NAMESTORE_RF_NONE;
- GNUNET_NAMESTORE_record_put_by_authority (handle->namestore, zone_key,
- "conversation", 1, &rd, NULL, NULL);
+ /* FIXME: continuation? return value? */
+ GNUNET_NAMESTORE_records_store (handle->namestore,
+ zone_key,
+ "conversation",
+ 1, &rd,
+ NULL, NULL);
}
/**
@@ -219,8 +219,12 @@
static void
check_gns (struct GNUNET_CONVERSATION_Handle *h)
{
- GNUNET_GNS_lookup (h->gns, "conversation.gads", GNUNET_GNS_RECORD_TXT,
- GNUNET_NO, NULL, &check_gns_cb, (void *) h);
+ GNUNET_GNS_lookup (h->gns, "conversation.gads",
+ NULL /* FIXME_ZONE */,
+ GNUNET_DNSPARSER_TYPE_TXT,
+ GNUNET_NO,
+ NULL,
+ &check_gns_cb, h);
return;
}
@@ -238,11 +242,10 @@
static void
receive_message_cb (void *cls, const struct GNUNET_MessageHeader *msg)
{
- struct ServerClientAvailableAnswerMessage *avbmsg;
+ struct GNUNET_CONVERSATION_Handle *h = cls;
struct ServerClientSessionInitiateMessage *imsg;
struct ServerClientSessionRejectMessage *rmsg;
struct GNUNET_CONVERSATION_MissedCallNotification *missed_calls;
- struct GNUNET_CONVERSATION_Handle *h = (struct GNUNET_CONVERSATION_Handle *)
cls;
if (NULL != msg)
{
@@ -566,39 +569,37 @@
gns_call_cb (void *cls, uint32_t rd_count,
const struct GNUNET_NAMESTORE_RecordData *rd)
{
+ struct GNUNET_CONVERSATION_Handle *handle = cls;
struct GNUNET_PeerIdentity peer;
- char hash[104];
- struct GNUNET_CONVERSATION_Handle *handle = (struct
GNUNET_CONVERSATION_Handle *) cls;
- int i = 0;
+ unsigned int i;
- if (0 == rd_count)
+ for (i=0;i<rd_count;i++)
+ {
+ switch (rd[i].record_type)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Lookup failed\n");
- handle->notification_handler (NULL, handle, NotificationType_NO_PEER,
- NULL);
+ case GNUNET_DNSPARSER_TYPE_TXT: /* FIXME: use fresh record type for
voide... */
+ if (GNUNET_OK !=
+ GNUNET_CRYPTO_ecc_public_sign_key_from_string (rd[i].data,
+ rd[i].data_size,
+ &peer.public_key))
+ {
+ GNUNET_break_op (0);
+ continue;
+ }
+ initiate_call (handle, peer);
+ return;
+ default:
+ break;
}
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Lookup succeeded\n");
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Lookup failed\n");
+ handle->notification_handler (NULL, handle,
+ NotificationType_NO_PEER,
+ NULL);
+}
- if (GNUNET_GNS_RECORD_TXT == rd[i].record_type)
- {
- memcpy (&hash, rd[i].data, 104);
- GNUNET_CRYPTO_hash_from_string2 (hash, strlen (hash),
- &(peer.hashPubKey));
- initiate_call (handle, peer);
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No resolution!\n");
- handle->notification_handler (NULL, handle,
- NotificationType_NO_PEER, NULL);
- }
- }
- return;
-}
-
/**
* GNS lookup
*/
@@ -618,12 +619,16 @@
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Lookup for %s\n", domain);
- GNUNET_GNS_lookup (h->gns, domain, GNUNET_GNS_RECORD_TXT, GNUNET_NO, NULL,
+ GNUNET_GNS_lookup (h->gns,
+ domain,
+ NULL /* FIXME: ZONE! */,
+ GNUNET_DNSPARSER_TYPE_TXT,
+ GNUNET_NO,
+ NULL,
&gns_call_cb, h);
-
- return;
}
+
/******************************************************************************/
/********************** API CALL DEFINITIONS
*************************/
/******************************************************************************/
@@ -696,29 +701,34 @@
handle = NULL;
}
+
void
-GNUNET_CONVERSATION_call (struct GNUNET_CONVERSATION_Handle *h, const char
*callee,
- int doGnsLookup)
+GNUNET_CONVERSATION_call (struct GNUNET_CONVERSATION_Handle *h,
+ const char *callee,
+ int doGnsLookup)
{
struct GNUNET_PeerIdentity peer;
+
if (NULL == h || NULL == h->client)
return;
if (GNUNET_YES == doGnsLookup)
- {
- gns_lookup_and_call (h, callee);
- }
- else
- {
- if (GNUNET_OK !=
- GNUNET_CRYPTO_hash_from_string2 (callee, strlen (callee),
- &(peer.hashPubKey)))
- {
- h->notification_handler (NULL, h, NotificationType_NO_PEER, NULL);
- }
-
- initiate_call (h, peer);
- }
+ {
+ gns_lookup_and_call (h, callee);
+ return;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CRYPTO_ecc_public_sign_key_from_string (callee,
+ strlen (callee),
+ &peer.public_key))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("`%s' is not a valid public key\n"),
+ callee);
+ h->notification_handler (NULL, h, NotificationType_NO_PEER, NULL);
+ return;
+ }
+ initiate_call (h, peer);
}
void
Modified: gnunet/src/conversation/gnunet-service-conversation.c
===================================================================
--- gnunet/src/conversation/gnunet-service-conversation.c 2013-10-01
12:27:55 UTC (rev 29759)
+++ gnunet/src/conversation/gnunet-service-conversation.c 2013-10-01
12:28:08 UTC (rev 29760)
@@ -174,18 +174,26 @@
end_time = GNUNET_TIME_absolute_get ();
total_time = GNUNET_TIME_absolute_get_difference (start_time, end_time);
FPRINTF (stderr, "\nResults of send\n");
- FPRINTF (stderr, "Test time %llu ms\n",
- (unsigned long long) total_time.rel_value);
- FPRINTF (stderr, "Test total packets: %d\n", data_sent);
- FPRINTF (stderr, "Test bandwidth: %f kb/s\n", data_sent_size * 1.0 /
total_time.rel_value); // 4bytes * ms
- FPRINTF (stderr, "Test throughput: %f packets/s\n\n", data_sent * 1000.0 /
total_time.rel_value); // packets * ms
+ FPRINTF (stderr, "Test time %s\n",
+ GNUNET_STRINGS_relative_time_to_string (total_time,
+ GNUNET_NO));
+ FPRINTF (stderr, "Test total packets: %d\n",
+ data_sent);
+ FPRINTF (stderr, "Test bandwidth: %f kb/s\n",
+ data_sent_size * 1000.0 / (total_time.rel_value_us + 1)); //
4bytes * us
+ FPRINTF (stderr, "Test throughput: %f packets/s\n\n",
+ data_sent * 1000000.0 / (total_time.rel_value_us + 1)); //
packets * us
FPRINTF (stderr, "\nResults of recv\n");
- FPRINTF (stderr, "Test time %llu ms\n",
- (unsigned long long) total_time.rel_value);
- FPRINTF (stderr, "Test total packets: %d\n", data_received);
- FPRINTF (stderr, "Test bandwidth: %f kb/s\n", data_received_size * 1.0 /
total_time.rel_value); // 4bytes * ms
- FPRINTF (stderr, "Test throughput: %f packets/s\n\n", data_received * 1000.0
/ total_time.rel_value); // packets * ms
+ FPRINTF (stderr, "Test time %s\n",
+ GNUNET_STRINGS_relative_time_to_string (total_time,
+ GNUNET_NO));
+ FPRINTF (stderr, "Test total packets: %d\n",
+ data_received);
+ FPRINTF (stderr, "Test bandwidth: %f kb/s\n",
+ data_received_size * 1000.0 / (total_time.rel_value_us + 1));
// 4bytes * us
+ FPRINTF (stderr, "Test throughput: %f packets/s\n\n",
+ data_received * 1000000.0 / (total_time.rel_value_us + 1)); //
packets * us
}
/**
@@ -1711,7 +1719,7 @@
const struct GNUNET_CONFIGURATION_Handle *c)
{
- static uint32_t ports[] = { 50002, 50003, NULL };
+ static uint32_t ports[] = { 50002, 50003, 0 };
cfg = c;
mesh = GNUNET_MESH_connect (cfg,
Modified: gnunet/src/set/test_set_api.c
===================================================================
--- gnunet/src/set/test_set_api.c 2013-10-01 12:27:55 UTC (rev 29759)
+++ gnunet/src/set/test_set_api.c 2013-10-01 12:28:08 UTC (rev 29760)
@@ -231,9 +231,9 @@
config = cfg;
GNUNET_CRYPTO_get_host_identity (cfg, &local_id);
- printf ("my id (from CRYPTO): %s\n", GNUNET_h2s (&local_id.hashPubKey));
+ printf ("my id (from CRYPTO): %s\n", GNUNET_i2s (&local_id));
GNUNET_TESTING_peer_get_identity (peer, &local_id);
- printf ("my id (from TESTING): %s\n", GNUNET_h2s (&local_id.hashPubKey));
+ printf ("my id (from TESTING): %s\n", GNUNET_i2s (&local_id));
test_iter ();
Modified: gnunet/src/testbed/testbed_api_statistics.c
===================================================================
--- gnunet/src/testbed/testbed_api_statistics.c 2013-10-01 12:27:55 UTC (rev
29759)
+++ gnunet/src/testbed/testbed_api_statistics.c 2013-10-01 12:28:08 UTC (rev
29760)
@@ -25,7 +25,7 @@
* @author Sree Harsha Totakura
*/
#include "platform.h"
-#include "gnunet_common.h"
+#include "gnunet_util_lib.h"
#include "gnunet_testbed_service.h"
#include "testbed_api_operations.h"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29760 - in gnunet/src: conversation set testbed,
gnunet <=