-preparatory steps for transport API change
authorChristian Grothoff <christian@grothoff.org>
Mon, 25 Jul 2016 16:21:08 +0000 (16:21 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 25 Jul 2016 16:21:08 +0000 (16:21 +0000)
src/core/gnunet-service-core_kx.c
src/core/gnunet-service-core_kx.h
src/core/gnunet-service-core_neighbours.c

index f2d3e0492868c76e249ea80529497c15ded5ae35..6a71099ae46e2faf6be2a9bc027a55e9a1a5f10f 100644 (file)
@@ -1607,6 +1607,41 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx,
 }
 
 
+/**
+ * Obtain the array of message handlers provided by KX.
+ *
+ * @return NULL-entry terminated array of handlers
+ */
+const struct GNUNET_MQ_MessageHandler *
+GSC_KX_get_handlers (void)
+{
+#if 0
+  GNUNET_MQ_hd_fixed_size (ephemeral_key,
+                          GNUNET_MESSAGE_TYPE_CORE_EPHEMERAL_KEY,
+                          struct EphemeralKeyMessage);
+  GNUNET_MQ_hd_fixed_size (ping,
+                          PING,
+                          struct PingMessage);
+  GNUNET_MQ_hd_fixed_size (pong,
+                          PING,
+                          struct PongMessage);
+  GNUNET_MQ_hd_var_size (encrypted,
+                        PING,
+                        struct ping);
+#endif
+  static struct GNUNET_MQ_MessageHandler handlers[] = {
+#if 0
+    make_ephemeral_key_handler (),
+    make_ping_handler (),
+    make_pong_handler (),
+    make_encrypted_handler (),
+#endif
+    GNUNET_MQ_handler_end()
+  };
+  return handlers;
+}
+
+
 /**
  * Deliver P2P message to interested clients.
  * Invokes send twice, once for clients that want the full message, and once
@@ -1641,10 +1676,12 @@ deliver_message (void *cls,
     GSC_SESSIONS_confirm_typemap (dmc->peer, m);
     return GNUNET_OK;
   default:
-    GSC_CLIENTS_deliver_message (dmc->peer, m,
+    GSC_CLIENTS_deliver_message (dmc->peer,
+                                 m,
                                  ntohs (m->size),
                                  GNUNET_CORE_OPTION_SEND_FULL_INBOUND);
-    GSC_CLIENTS_deliver_message (dmc->peer, m,
+    GSC_CLIENTS_deliver_message (dmc->peer,
+                                 m,
                                  sizeof (struct GNUNET_MessageHeader),
                                  GNUNET_CORE_OPTION_SEND_HDR_INBOUND);
   }
@@ -1686,8 +1723,8 @@ sign_ephemeral_key ()
   current_ekm.origin_identity = GSC_my_identity;
   GNUNET_assert (GNUNET_OK ==
                 GNUNET_CRYPTO_eddsa_sign (my_private_key,
-                                        &current_ekm.purpose,
-                                        &current_ekm.signature));
+                                           &current_ekm.purpose,
+                                          &current_ekm.signature));
 }
 
 
index 343015de562aeffc02777737d7db0ef8b87ebfda..7649315ce49d225a54b45fa8d8860d3564d5f31a 100644 (file)
 struct GSC_KeyExchangeInfo;
 
 
+/**
+ * Obtain the array of message handlers provided by KX.
+ *
+ * @return NULL-entry terminated array of handlers
+ */
+const struct GNUNET_MQ_MessageHandler *
+GSC_KX_get_handlers (void);
+
+
 /**
  * We received a EPHEMERAL_KEY message.  Validate and update
  * our key material and status.
index e241d829f4be46e6d422fe9fe6e8d559bb1a3ffd..7af49a3b31dd5cd47f7b1312eae2980a4b99808b 100644 (file)
@@ -479,9 +479,6 @@ handle_transport_receive (void *cls,
   case GNUNET_MESSAGE_TYPE_CORE_ENCRYPTED_MESSAGE:
     GSC_KX_handle_encrypted_message (n->kxinfo, message);
     break;
-  case GNUNET_MESSAGE_TYPE_DUMMY:
-    /*  Dummy messages for testing / benchmarking, just discard */
-    break;
   default:
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                 _("Unsupported message of type %u (%u bytes) received from peer `%s'\n"),
@@ -523,8 +520,8 @@ GSC_NEIGHBOURS_transmit (const struct GNUNET_PeerIdentity *target,
   me->deadline = GNUNET_TIME_relative_to_absolute (timeout);
   me->size = msize;
   GNUNET_memcpy (&me[1],
-          msg,
-          msize);
+                msg,
+                msize);
   GNUNET_CONTAINER_DLL_insert_tail (n->message_head,
                                     n->message_tail,
                                     me);