-LRN: fix dv test dependencies
[oweals/gnunet.git] / src / dv / gnunet-service-dv.c
index 60745070cc3830b49229b5ac5f16bd897f419315..6ee95c051c1c915d292469b14b716d0705d3ef8b 100644 (file)
@@ -582,7 +582,7 @@ static char *my_short_id;
 /**
  * Transmit handle to the plugin.
  */
-static struct GNUNET_CONNECTION_TransmitHandle *plugin_transmit_handle;
+static struct GNUNET_SERVER_TransmitHandle *plugin_transmit_handle;
 
 /**
  * Head of DLL for client messages
@@ -1288,7 +1288,7 @@ checkPeerID (void *cls, const GNUNET_HashCode * key, void *value)
  * @param client the TokenizedMessageContext which contains message information
  * @param message the actual message
  */
-void
+int
 tokenized_message_handler (void *cls, void *client,
                            const struct GNUNET_MessageHeader *message)
 {
@@ -1312,6 +1312,7 @@ tokenized_message_handler (void *cls, void *client,
     send_to_plugin (ctx->peer, message, ntohs (message->size),
                     &ctx->distant->identity, ctx->distant->cost);
   }
+  return GNUNET_OK;
 }
 
 #if DELAY_FORWARDS
@@ -1333,7 +1334,7 @@ send_message_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   {
     send_message (&msg_ctx->dest, &msg_ctx->sender, NULL, msg_ctx->message,
                   msg_ctx->message_size, default_dv_priority, msg_ctx->uid,
-                  GNUNET_TIME_relative_get_forever ());
+                  GNUNET_TIME_UNIT_FOREVER_REL);
     GNUNET_free (msg_ctx->message);
     GNUNET_free (msg_ctx);
   }
@@ -1628,7 +1629,7 @@ handle_dv_data_message (void *cls, const struct GNUNET_PeerIdentity *peer,
         send_message (destination, original_sender, NULL, packed_message,
                       packed_message_size, default_dv_priority,
                       ntohl (incoming->uid),
-                      GNUNET_TIME_relative_get_forever ());
+                      GNUNET_TIME_UNIT_FOREVER_REL);
   }
   if (ret != GNUNET_SYSERR)
     return GNUNET_OK;
@@ -1763,7 +1764,7 @@ neighbor_send_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                        sizeof (p2p_dv_MESSAGE_NeighborInfo));
     pending_message->msg = (struct GNUNET_MessageHeader *) &pending_message[1];
     pending_message->importance = default_dv_priority;
-    pending_message->timeout = GNUNET_TIME_relative_get_forever ();
+    pending_message->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
     memcpy (&pending_message->recipient, &to->identity,
             sizeof (struct GNUNET_PeerIdentity));
     pending_message->msg_size = sizeof (p2p_dv_MESSAGE_NeighborInfo);
@@ -1783,7 +1784,7 @@ neighbor_send_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
     GNUNET_SCHEDULER_add_now (try_core_send, NULL);
     /*if (core_transmit_handle == NULL)
-     * core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GNUNET_YES,  default_dv_priority, GNUNET_TIME_relative_get_forever(), &to->identity, sizeof(p2p_dv_MESSAGE_NeighborInfo), &core_transmit_notify, NULL); */
+     * core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GNUNET_YES,  default_dv_priority, GNUNET_TIME_UNIT_FOREVER_REL, &to->identity, sizeof(p2p_dv_MESSAGE_NeighborInfo), &core_transmit_notify, NULL); */
 
   }
 
@@ -2192,7 +2193,7 @@ schedule_disconnect_messages (void *cls, const GNUNET_HashCode * key,
                      sizeof (p2p_dv_MESSAGE_Disconnect));
   pending_message->msg = (struct GNUNET_MessageHeader *) &pending_message[1];
   pending_message->importance = default_dv_priority;
-  pending_message->timeout = GNUNET_TIME_relative_get_forever ();
+  pending_message->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
   memcpy (&pending_message->recipient, &notify->identity,
           sizeof (struct GNUNET_PeerIdentity));
   pending_message->msg_size = sizeof (p2p_dv_MESSAGE_Disconnect);
@@ -2206,7 +2207,7 @@ schedule_disconnect_messages (void *cls, const GNUNET_HashCode * key,
 
   GNUNET_SCHEDULER_add_now (try_core_send, NULL);
   /*if (core_transmit_handle == NULL)
-   * core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GNUNET_YES, default_dv_priority, GNUNET_TIME_relative_get_forever(), &notify->identity, sizeof(p2p_dv_MESSAGE_Disconnect), &core_transmit_notify, NULL); */
+   * core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GNUNET_YES, default_dv_priority, GNUNET_TIME_UNIT_FOREVER_REL, &notify->identity, sizeof(p2p_dv_MESSAGE_Disconnect), &core_transmit_notify, NULL); */
 
   return GNUNET_YES;
 }
@@ -2452,6 +2453,7 @@ static size_t
 generate_hello_address (void *cls, size_t max, void *buf)
 {
   struct HelloContext *hello_context = cls;
+  struct GNUNET_HELLO_Address hello_address;
   char *addr_buffer;
   size_t offset;
   size_t size;
@@ -2473,11 +2475,14 @@ generate_hello_address (void *cls, size_t max, void *buf)
   /* Copy the direct peer identity to buffer */
   memcpy (&addr_buffer[offset], hello_context->direct_peer,
           sizeof (struct GNUNET_PeerIdentity));
+  memset (&hello_address.peer, 0, sizeof (struct GNUNET_PeerIdentity));
+  hello_address.address = addr_buffer;
+  hello_address.transport_name = "dv";
+  hello_address.address_length = size;
   ret =
-      GNUNET_HELLO_add_address ("dv",
+      GNUNET_HELLO_add_address (&hello_address,
                                 GNUNET_TIME_relative_to_absolute
-                                (GNUNET_TIME_UNIT_HOURS), addr_buffer, size,
-                                buf, max);
+                                (GNUNET_TIME_UNIT_HOURS), buf, max);
 
   hello_context->addresses_to_add--;
 
@@ -3290,7 +3295,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
       GNUNET_CONTAINER_multihashmap_create (max_table_size * 3);
 
   GNUNET_SERVER_add_handlers (server, plugin_handlers);
-  coreAPI = GNUNET_CORE_connect (cfg, 1, NULL,  /* FIXME: anything we want to pass around? */
+  coreAPI = GNUNET_CORE_connect (cfg, NULL,  /* FIXME: anything we want to pass around? */
                                  &core_init, &handle_core_connect,
                                  &handle_core_disconnect, NULL, GNUNET_NO, NULL,
                                  GNUNET_NO, core_handlers);