gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r26645 - in gnunet/src: hello include peerinfo transport


From: gnunet
Subject: [GNUnet-SVN] r26645 - in gnunet/src: hello include peerinfo transport
Date: Thu, 28 Mar 2013 16:14:38 +0100

Author: wachs
Date: 2013-03-28 16:14:38 +0100 (Thu, 28 Mar 2013)
New Revision: 26645

Added:
   gnunet/src/hello/test_friend_hello.c
Modified:
   gnunet/src/hello/Makefile.am
   gnunet/src/hello/gnunet-hello.c
   gnunet/src/hello/hello.c
   gnunet/src/hello/test_hello.c
   gnunet/src/include/gnunet_hello_lib.h
   gnunet/src/include/gnunet_protocols.h
   gnunet/src/peerinfo/perf_peerinfo_api.c
   gnunet/src/peerinfo/test_peerinfo_api.c
   gnunet/src/transport/gnunet-service-transport_hello.c
   gnunet/src/transport/gnunet-service-transport_validation.c
   gnunet/src/transport/test_plugin_transport.c
Log:
new friend only HELLO type GNUNET_MESSAGE_TYPE_FRIEND_HELLO


Modified: gnunet/src/hello/Makefile.am
===================================================================
--- gnunet/src/hello/Makefile.am        2013-03-28 14:28:02 UTC (rev 26644)
+++ gnunet/src/hello/Makefile.am        2013-03-28 15:14:38 UTC (rev 26645)
@@ -24,7 +24,8 @@
  gnunet-hello
 
 check_PROGRAMS = \
- test_hello
+ test_hello \
+ test_friend_hello
 
 if ENABLE_TEST_RUN
 TESTS = $(check_PROGRAMS)
@@ -36,6 +37,11 @@
  $(top_builddir)/src/hello/libgnunethello.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
+test_friend_hello_SOURCES = \
+ test_friend_hello.c
+test_friend_hello_LDADD = \
+ $(top_builddir)/src/hello/libgnunethello.la \
+ $(top_builddir)/src/util/libgnunetutil.la  
 
 gnunet_hello_SOURCES = \
  gnunet-hello.c

Modified: gnunet/src/hello/gnunet-hello.c
===================================================================
--- gnunet/src/hello/gnunet-hello.c     2013-03-28 14:28:02 UTC (rev 26644)
+++ gnunet/src/hello/gnunet-hello.c     2013-03-28 15:14:38 UTC (rev 26645)
@@ -23,6 +23,7 @@
  * @author Christian Grothoff
  */
 #include "platform.h"
+#include "gnunet_protocols.h"
 #include "gnunet_hello_lib.h"
 
 /**
@@ -109,6 +110,7 @@
   struct GNUNET_HELLO_Message *result;
   struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pk;
   uint64_t fsize;
+  int friend_only;
 
   GNUNET_log_setup ("gnunet-hello", "INFO", NULL);
   if (argc != 2)
@@ -166,7 +168,12 @@
               argv[1]);
       return 1;
     }
-    result = GNUNET_HELLO_create (&pk, &add_from_hello, &orig);
+    friend_only = GNUNET_NO;
+    if (GNUNET_MESSAGE_TYPE_HELLO == GNUNET_HELLO_get_type ((struct 
GNUNET_MessageHeader *) orig))
+       friend_only = GNUNET_NO;
+    if (GNUNET_MESSAGE_TYPE_FRIEND_HELLO == GNUNET_HELLO_get_type ((struct 
GNUNET_MessageHeader *) orig))
+       friend_only = GNUNET_YES;
+    result = GNUNET_HELLO_create (&pk, &add_from_hello, &orig, friend_only);
     GNUNET_assert (NULL != result);
      fh = GNUNET_DISK_file_open (argv[1], 
                                 GNUNET_DISK_OPEN_WRITE,

Modified: gnunet/src/hello/hello.c
===================================================================
--- gnunet/src/hello/hello.c    2013-03-28 14:28:02 UTC (rev 26644)
+++ gnunet/src/hello/hello.c    2013-03-28 15:14:38 UTC (rev 26645)
@@ -103,7 +103,24 @@
   GNUNET_HELLO_TransportPluginsFind plugins_find;
 };
 
+/**
+ * Return HELLO type
+ *
+ * @param h HELLO Message to test
+ * @param GNUNET_MESSAGE_TYPE_HELLO or GNUNET_MESSAGE_TYPE_FRIEND_HELLO or 0 
on error
+ */
 
+uint16_t
+GNUNET_HELLO_get_type (const struct GNUNET_MessageHeader *h)
+{
+  if (GNUNET_MESSAGE_TYPE_HELLO == ntohs(h->type))
+       return GNUNET_MESSAGE_TYPE_HELLO;
+  if (GNUNET_MESSAGE_TYPE_FRIEND_HELLO == ntohs(h->type))
+       return GNUNET_MESSAGE_TYPE_FRIEND_HELLO;
+  return 0;
+}
+
+
 /**
  * Copy the given address information into
  * the given buffer using the format of HELLOs.
@@ -204,7 +221,8 @@
 GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded
                      *publicKey,
                      GNUNET_HELLO_GenerateAddressListCallback addrgen,
-                     void *addrgen_cls)
+                     void *addrgen_cls,
+                     int friend_only)
 {
   char buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - 256 -
               sizeof (struct GNUNET_HELLO_Message)];
@@ -224,7 +242,10 @@
     }
   }
   hello = GNUNET_malloc (sizeof (struct GNUNET_HELLO_Message) + used);
-  hello->header.type = htons (GNUNET_MESSAGE_TYPE_HELLO);
+  if (GNUNET_NO == friend_only)
+       hello->header.type = htons (GNUNET_MESSAGE_TYPE_HELLO);
+  else
+       hello->header.type = htons (GNUNET_MESSAGE_TYPE_FRIEND_HELLO);
   hello->header.size = htons (sizeof (struct GNUNET_HELLO_Message) + used);
   memcpy (&hello->publicKey, publicKey,
           sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded));
@@ -261,7 +282,8 @@
 
   msize = GNUNET_HELLO_size (msg);
   if ((msize < sizeof (struct GNUNET_HELLO_Message)) ||
-      (ntohs (msg->header.type) != GNUNET_MESSAGE_TYPE_HELLO))
+      ((ntohs (msg->header.type) != GNUNET_MESSAGE_TYPE_HELLO) &&
+                        (ntohs (msg->header.type) != 
GNUNET_MESSAGE_TYPE_FRIEND_HELLO)))
     return NULL;
   ret = NULL;
   if (return_modified)
@@ -408,8 +430,24 @@
                     const struct GNUNET_HELLO_Message *h2)
 {
   struct MergeContext mc = { h1, h2, NULL, NULL, 0, 0, 0 };
+  int friend_only;
+  if (h1->header.type != h2->header.type)
+  {
+               /* Trying to merge different HELLO types */
+               GNUNET_break (0);
+               return NULL;
+  }
+  if (GNUNET_MESSAGE_TYPE_HELLO == (ntohs(h1->header.type)))
+       friend_only = GNUNET_NO;
+  else if (GNUNET_MESSAGE_TYPE_FRIEND_HELLO == (ntohs(h1->header.type)))
+               friend_only = GNUNET_YES;
+  else
+  {
+               GNUNET_break (0);
+               return NULL;
+  }
 
-  return GNUNET_HELLO_create (&h1->publicKey, &merge_addr, &mc);
+       return GNUNET_HELLO_create (&h1->publicKey, &merge_addr, &mc, 
friend_only);
 }
 
 
@@ -488,7 +526,8 @@
   uint16_t ret = ntohs (hello->header.size);
 
   if ((ret < sizeof (struct GNUNET_HELLO_Message)) ||
-      (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO))
+      ((ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO) &&
+                        (ntohs (hello->header.type) != 
GNUNET_MESSAGE_TYPE_FRIEND_HELLO)))
     return 0;
   return ret;
 }
@@ -508,7 +547,8 @@
   uint16_t ret = ntohs (hello->header.size);
 
   if ((ret < sizeof (struct GNUNET_HELLO_Message)) ||
-      (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO))
+      ((ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO) &&
+                        (ntohs (hello->header.type) != 
GNUNET_MESSAGE_TYPE_FRIEND_HELLO)))
     return GNUNET_SYSERR;
   *publicKey = hello->publicKey;
   return GNUNET_OK;
@@ -529,7 +569,8 @@
   uint16_t ret = ntohs (hello->header.size);
 
   if ((ret < sizeof (struct GNUNET_HELLO_Message)) ||
-      (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO))
+      ((ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO) &&
+                        (ntohs (hello->header.type) != 
GNUNET_MESSAGE_TYPE_FRIEND_HELLO)))
     return GNUNET_SYSERR;
   GNUNET_CRYPTO_hash (&hello->publicKey,
                       sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded),
@@ -552,7 +593,8 @@
   uint16_t ret = ntohs (hello->header.size);
 
   if ((ret < sizeof (struct GNUNET_HELLO_Message)) ||
-      (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO))
+      ((ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO) &&
+                        (ntohs (hello->header.type) != 
GNUNET_MESSAGE_TYPE_FRIEND_HELLO)))
     return NULL;
 
   return &hello->header;
@@ -639,6 +681,9 @@
 {
   struct EqualsContext ec;
 
+  if (h1->header.type != h2->header.type)
+       return GNUNET_TIME_UNIT_ZERO_ABS;
+
   if (0 !=
       memcmp (&h1->publicKey, &h2->publicKey,
               sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded)))
@@ -1011,13 +1056,25 @@
 {
   const char *pks;
   const char *exc;
+  int friend_only;
   struct GNUNET_HELLO_ParseUriContext ctx;
 
-  if (0 != strncmp (uri,
+  if (0 == strncmp (uri,
                    GNUNET_HELLO_URI_PREFIX,
                    strlen (GNUNET_HELLO_URI_PREFIX)))
-    return GNUNET_SYSERR;
-  pks = &uri[strlen (GNUNET_HELLO_URI_PREFIX)];
+  {
+               pks = &uri[strlen (GNUNET_HELLO_URI_PREFIX)];
+               friend_only = GNUNET_NO;
+  }
+  else if (0 == strncmp (uri,
+           GNUNET_FRIEND_HELLO_URI_PREFIX,
+           strlen (GNUNET_FRIEND_HELLO_URI_PREFIX)))
+  {
+       pks = &uri[strlen (GNUNET_FRIEND_HELLO_URI_PREFIX)];
+       friend_only = GNUNET_YES;
+  }
+  else
+       return GNUNET_SYSERR;
   exc = strstr (pks, "!");
 
   if (GNUNET_OK !=
@@ -1030,7 +1087,7 @@
   ctx.pos = exc;
   ctx.ret = GNUNET_OK;
   ctx.plugins_find = plugins_find;
-  *hello = GNUNET_HELLO_create (pubkey, &add_address_to_hello, &ctx);
+  *hello = GNUNET_HELLO_create (pubkey, &add_address_to_hello, &ctx, 
friend_only);
 
   return ctx.ret;
 }

Added: gnunet/src/hello/test_friend_hello.c
===================================================================
--- gnunet/src/hello/test_friend_hello.c                                (rev 0)
+++ gnunet/src/hello/test_friend_hello.c        2013-03-28 15:14:38 UTC (rev 
26645)
@@ -0,0 +1,186 @@
+/*
+     This file is part of GNUnet
+     (C) 2009 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 3, 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 hello/test_hello.c
+ * @brief test for hello.c
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_hello_lib.h"
+
+static size_t
+my_addr_gen (void *cls, size_t max, void *buf)
+{
+  unsigned int *i = cls;
+  size_t ret;
+  struct GNUNET_HELLO_Address address;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "DEBUG: my_addr_gen called with i = %d\n", *i);
+  if (0 == *i)
+    return 0;
+  memset (&address.peer, 0, sizeof (struct GNUNET_PeerIdentity));
+  address.address = "address_information";
+  address.transport_name = "test";
+  address.address_length = *i;
+  ret =
+      GNUNET_HELLO_add_address (&address, GNUNET_TIME_absolute_get (), buf,
+                                max);
+  (*i)--;
+  return ret;
+}
+
+
+static int
+check_addr (void *cls, const struct GNUNET_HELLO_Address *address,
+            struct GNUNET_TIME_Absolute expiration)
+{
+  unsigned int *i = cls;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+          "DEBUG: check_addr called with i = %d and addrlen = %u\n",
+           *i, (unsigned int) address->address_length);
+  GNUNET_assert (address->address_length > 0);
+  GNUNET_assert (*i & (1 << (address->address_length - 1)));
+  *i -= (1 << (address->address_length - 1));
+  GNUNET_assert (0 ==
+                 strncmp ("address_information", address->address,
+                          address->address_length));
+  GNUNET_assert (0 == strcmp ("test", address->transport_name));
+  return GNUNET_OK;
+}
+
+
+static int
+remove_some (void *cls, const struct GNUNET_HELLO_Address *address,
+             struct GNUNET_TIME_Absolute expiration)
+{
+  unsigned int *i = cls;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+          "DEBUG: remove_some called with i = %d and addrlen = %u\n",
+           *i, (unsigned int) address->address_length);
+  GNUNET_assert (address->address_length > 0);
+  if (*i & (1 << (address->address_length - 1)))
+  {
+    *i -= (1 << (address->address_length - 1));
+    return GNUNET_NO;
+  }
+  return GNUNET_OK;
+}
+
+
+int
+main (int argc, char *argv[])
+{
+  struct GNUNET_HELLO_Message *msg1;
+  struct GNUNET_HELLO_Message *msg2;
+  struct GNUNET_HELLO_Message *msg3;
+  struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded publicKey;
+  struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pk;
+  struct GNUNET_TIME_Absolute startup_time;
+  unsigned int i;
+
+  GNUNET_log_setup ("test-hello", "DEBUG", NULL);
+  startup_time = GNUNET_TIME_absolute_get ();
+  memset (&publicKey, 42, sizeof (publicKey));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Testing HELLO creation (without addresses)...\n");
+  i = 0;
+  msg1 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i, GNUNET_YES);
+  GNUNET_assert (msg1 != NULL);
+  GNUNET_assert (0 < GNUNET_HELLO_size (msg1));
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Testing address iteration (empty set)...\n");
+  GNUNET_assert (NULL ==
+                 GNUNET_HELLO_iterate_addresses (msg1, GNUNET_NO, &check_addr,
+                                                 &i));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+          "Testing HELLO creation (with one address)...\n");
+  i = 1;
+  msg2 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i, GNUNET_YES);
+  GNUNET_assert (msg2 != NULL);
+  GNUNET_assert (GNUNET_HELLO_size (msg1) < GNUNET_HELLO_size (msg2));
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+          "Testing address iteration (one address)...\n");
+  i = 1;
+  GNUNET_assert (NULL ==
+                 GNUNET_HELLO_iterate_addresses (msg2, GNUNET_NO, &check_addr,
+                                                 &i));
+  GNUNET_assert (i == 0);
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+          "Testing get_key from HELLO...\n");
+  GNUNET_assert (GNUNET_OK == GNUNET_HELLO_get_key (msg2, &pk));
+  GNUNET_assert (0 == memcmp (&publicKey, &pk, sizeof (pk)));
+  GNUNET_free (msg1);
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+          "Testing HELLO creation (with two addresses)...\n");
+  i = 2;
+  msg3 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i, GNUNET_YES);
+  GNUNET_assert (msg3 != NULL);
+  GNUNET_assert (GNUNET_HELLO_size (msg2) < GNUNET_HELLO_size (msg3));
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+          "Testing address iteration (two addresses)...\n");
+  i = 3;
+  GNUNET_assert (NULL ==
+                 GNUNET_HELLO_iterate_addresses (msg3, GNUNET_NO, &check_addr,
+                                                 &i));
+  GNUNET_assert (i == 0);
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+          "Testing HELLO merge...\n");
+  msg1 = GNUNET_HELLO_merge (msg2, msg3);
+  GNUNET_assert (GNUNET_HELLO_size (msg1) == GNUNET_HELLO_size (msg3));
+
+  i = 3;
+  GNUNET_assert (NULL ==
+                 GNUNET_HELLO_iterate_addresses (msg1, GNUNET_NO, &check_addr,
+                                                 &i));
+  GNUNET_assert (i == 0);
+  GNUNET_free (msg1);
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+          "Testing address iteration to copy HELLO...\n");
+  i = 2;
+  msg1 = GNUNET_HELLO_iterate_addresses (msg3, GNUNET_YES, &remove_some, &i);
+  GNUNET_assert (msg1 != NULL);
+  GNUNET_assert (i == 0);
+  i = 1;
+  GNUNET_assert (NULL ==
+                 GNUNET_HELLO_iterate_addresses (msg1, GNUNET_NO, &check_addr,
+                                                 &i));
+  GNUNET_assert (i == 0);
+  GNUNET_free (msg1);
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+          "Testing delta address iteration...\n");
+  i = 2;
+  GNUNET_HELLO_iterate_new_addresses (msg3, msg2, startup_time, &check_addr,
+                                      &i);
+  GNUNET_assert (i == 0);
+  GNUNET_free (msg2);
+  GNUNET_free (msg3);
+  return 0;                     /* testcase passed */
+}

Modified: gnunet/src/hello/test_hello.c
===================================================================
--- gnunet/src/hello/test_hello.c       2013-03-28 14:28:02 UTC (rev 26644)
+++ gnunet/src/hello/test_hello.c       2013-03-28 15:14:38 UTC (rev 26645)
@@ -104,7 +104,7 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Testing HELLO creation (without addresses)...\n");
   i = 0;
-  msg1 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i);
+  msg1 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i, GNUNET_NO);
   GNUNET_assert (msg1 != NULL);
   GNUNET_assert (0 < GNUNET_HELLO_size (msg1));
 
@@ -116,7 +116,7 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
           "Testing HELLO creation (with one address)...\n");
   i = 1;
-  msg2 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i);
+  msg2 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i, GNUNET_NO);
   GNUNET_assert (msg2 != NULL);
   GNUNET_assert (GNUNET_HELLO_size (msg1) < GNUNET_HELLO_size (msg2));
 
@@ -137,7 +137,7 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
           "Testing HELLO creation (with two addresses)...\n");
   i = 2;
-  msg3 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i);
+  msg3 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i, GNUNET_NO);
   GNUNET_assert (msg3 != NULL);
   GNUNET_assert (GNUNET_HELLO_size (msg2) < GNUNET_HELLO_size (msg3));
 

Modified: gnunet/src/include/gnunet_hello_lib.h
===================================================================
--- gnunet/src/include/gnunet_hello_lib.h       2013-03-28 14:28:02 UTC (rev 
26644)
+++ gnunet/src/include/gnunet_hello_lib.h       2013-03-28 15:14:38 UTC (rev 
26645)
@@ -44,6 +44,10 @@
  */
 #define GNUNET_HELLO_URI_PREFIX "gnunet://hello/"
 
+/**
+ * Prefix that every FRIEND HELLO URI must start with.
+ */
+#define GNUNET_FRIEND_HELLO_URI_PREFIX "gnunet://friend-hello/"
 
 /**
  * An address for communicating with a peer.  We frequently
@@ -79,6 +83,15 @@
 
 
 /**
+ * Return HELLO type
+ *
+ * @param h HELLO Message to test
+ * @param GNUNET_MESSAGE_TYPE_HELLO or GNUNET_MESSAGE_TYPE_FRIEND_HELLO or 0 
on error
+ */
+uint16_t
+GNUNET_HELLO_get_type (const struct GNUNET_MessageHeader *h);
+
+/**
  * Allocate an address struct.
  *
  * @param peer the peer
@@ -180,13 +193,17 @@
  * expiration time and an iterator that spews the
  * transport addresses.
  *
+ * If friend only is set to GNUNET_YES we create a FRIEND_HELLO which will
+ * not be gossiped to other peers
+ *
  * @return the hello message
  */
 struct GNUNET_HELLO_Message *
 GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded
                      *publicKey,
                      GNUNET_HELLO_GenerateAddressListCallback addrgen,
-                     void *addrgen_cls);
+                     void *addrgen_cls,
+                     int friend_only);
 
 
 /**

Modified: gnunet/src/include/gnunet_protocols.h
===================================================================
--- gnunet/src/include/gnunet_protocols.h       2013-03-28 14:28:02 UTC (rev 
26644)
+++ gnunet/src/include/gnunet_protocols.h       2013-03-28 15:14:38 UTC (rev 
26645)
@@ -112,6 +112,12 @@
  */
 #define GNUNET_MESSAGE_TYPE_HELLO 16
 
+/**
+ * HELLO message used for communicating peer addresses with friends only.
+ */
+
+#define GNUNET_MESSAGE_TYPE_FRIEND_HELLO 17
+
 
/*******************************************************************************
  * FRAGMENTATION message types
  
******************************************************************************/

Modified: gnunet/src/peerinfo/perf_peerinfo_api.c
===================================================================
--- gnunet/src/peerinfo/perf_peerinfo_api.c     2013-03-28 14:28:02 UTC (rev 
26644)
+++ gnunet/src/peerinfo/perf_peerinfo_api.c     2013-03-28 15:14:38 UTC (rev 
26645)
@@ -87,7 +87,7 @@
 
   memset (&pkey, i, sizeof (pkey));
   GNUNET_CRYPTO_hash (&pkey, sizeof (pkey), &pid.hashPubKey);
-  h2 = GNUNET_HELLO_create (&pkey, &address_generator, &i);
+  h2 = GNUNET_HELLO_create (&pkey, &address_generator, &i, GNUNET_NO);
   GNUNET_PEERINFO_add_peer (h, h2, NULL, NULL);
   GNUNET_free (h2);
 }

Modified: gnunet/src/peerinfo/test_peerinfo_api.c
===================================================================
--- gnunet/src/peerinfo/test_peerinfo_api.c     2013-03-28 14:28:02 UTC (rev 
26644)
+++ gnunet/src/peerinfo/test_peerinfo_api.c     2013-03-28 15:14:38 UTC (rev 
26645)
@@ -93,7 +93,7 @@
   agc = 2;
   memset (&pkey, 32, sizeof (pkey));
   GNUNET_CRYPTO_hash (&pkey, sizeof (pkey), &pid.hashPubKey);
-  h2 = GNUNET_HELLO_create (&pkey, &address_generator, &agc);
+  h2 = GNUNET_HELLO_create (&pkey, &address_generator, &agc, GNUNET_NO);
   GNUNET_PEERINFO_add_peer (h, h2, NULL, NULL);
   GNUNET_free (h2);
 

Modified: gnunet/src/transport/gnunet-service-transport_hello.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_hello.c       2013-03-28 
14:28:02 UTC (rev 26644)
+++ gnunet/src/transport/gnunet-service-transport_hello.c       2013-03-28 
15:14:38 UTC (rev 26645)
@@ -167,7 +167,7 @@
   gc.expiration = GNUNET_TIME_relative_to_absolute (hello_expiration);
 
   GNUNET_free (our_hello);
-  our_hello = GNUNET_HELLO_create (&GST_my_public_key, &address_generator, 
&gc);
+  our_hello = GNUNET_HELLO_create (&GST_my_public_key, &address_generator, 
&gc, GNUNET_NO);
   GNUNET_assert (NULL != our_hello);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
               "Refreshed my `%s', new size is %d\n", "HELLO",
@@ -208,7 +208,7 @@
 {
   hello_cb = cb;
   hello_cb_cls = cb_cls;
-  our_hello = GNUNET_HELLO_create (&GST_my_public_key, NULL, NULL);
+  our_hello = GNUNET_HELLO_create (&GST_my_public_key, NULL, NULL, GNUNET_NO);
   GNUNET_assert (NULL != our_hello);
   refresh_hello ();
 }

Modified: gnunet/src/transport/gnunet-service-transport_validation.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_validation.c  2013-03-28 
14:28:02 UTC (rev 26644)
+++ gnunet/src/transport/gnunet-service-transport_validation.c  2013-03-28 
15:14:38 UTC (rev 26645)
@@ -1264,7 +1264,7 @@
 
   /* build HELLO to store in PEERINFO */
   ve->copied = GNUNET_NO;
-  hello = GNUNET_HELLO_create (&ve->public_key, &add_valid_peer_address, ve);
+  hello = GNUNET_HELLO_create (&ve->public_key, &add_valid_peer_address, ve, 
GNUNET_NO);
   GNUNET_PEERINFO_add_peer (GST_peerinfo, hello, NULL, NULL);
   GNUNET_free (hello);
 }
@@ -1295,7 +1295,7 @@
       memcmp (&GST_my_identity, &vac.pid, sizeof (struct GNUNET_PeerIdentity)))
     return;
   /* Add peer identity without addresses to peerinfo service */
-  h = GNUNET_HELLO_create (&vac.public_key, NULL, NULL);
+  h = GNUNET_HELLO_create (&vac.public_key, NULL, NULL, GNUNET_NO);
   GNUNET_PEERINFO_add_peer (GST_peerinfo, h, NULL, NULL);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,

Modified: gnunet/src/transport/test_plugin_transport.c
===================================================================
--- gnunet/src/transport/test_plugin_transport.c        2013-03-28 14:28:02 UTC 
(rev 26644)
+++ gnunet/src/transport/test_plugin_transport.c        2013-03-28 15:14:38 UTC 
(rev 26645)
@@ -601,7 +601,7 @@
                       &my_identity.hashPubKey);
 
 
-  hello = GNUNET_HELLO_create(&my_public_key, NULL, NULL);
+  hello = GNUNET_HELLO_create(&my_public_key, NULL, NULL, GNUNET_NO);
 
   /* load plugins... */
   setup_plugin_environment ();




reply via email to

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