-preparatory steps for transport API change
[oweals/gnunet.git] / src / core / gnunet-service-core_kx.h
index a7f4b90582996f40c0fe05b8ef146034e0177425..7649315ce49d225a54b45fa8d8860d3564d5f31a 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2009, 2010, 2011 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
      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.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -27,6 +27,7 @@
 #define GNUNET_SERVICE_CORE_KX_H
 
 #include "gnunet_util_lib.h"
+#include "gnunet_transport_service.h"
 
 
 /**
@@ -36,15 +37,24 @@ struct GSC_KeyExchangeInfo;
 
 
 /**
- * We received a SET_KEY message.  Validate and update
+ * 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.
  *
  * @param kx key exchange status for the corresponding peer
  * @param msg the set key message we received
  */
 void
-GSC_KX_handle_set_key (struct GSC_KeyExchangeInfo *kx, 
-                      const struct GNUNET_MessageHeader *msg);
+GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx,
+                            const struct GNUNET_MessageHeader *msg);
 
 
 /**
@@ -55,8 +65,8 @@ GSC_KX_handle_set_key (struct GSC_KeyExchangeInfo *kx,
  * @param msg the encrypted PING message itself
  */
 void
-GSC_KX_handle_ping (struct GSC_KeyExchangeInfo *kx, 
-                   const struct GNUNET_MessageHeader *msg);
+GSC_KX_handle_ping (struct GSC_KeyExchangeInfo *kx,
+                    const struct GNUNET_MessageHeader *msg);
 
 
 /**
@@ -67,24 +77,19 @@ GSC_KX_handle_ping (struct GSC_KeyExchangeInfo *kx,
  */
 void
 GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx,
-                   const struct GNUNET_MessageHeader *msg);
+                    const struct GNUNET_MessageHeader *msg);
 
 
 /**
  * Encrypt and transmit a message with the given payload.
  *
  * @param kx key exchange context
- * @param bw_in bandwidth limit to transmit to the other peer;
- *              the other peer shall not send us more than the
- *              given rate
  * @param payload payload of the message
  * @param payload_size number of bytes in 'payload'
  */
 void
 GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx,
-                            struct GNUNET_BANDWIDTH_Value32NBO bw_in,
-                            const void *payload,
-                            size_t payload_size);
+                             const void *payload, size_t payload_size);
 
 
 /**
@@ -93,14 +98,10 @@ GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx,
  *
  * @param kx key exchange information context
  * @param msg encrypted message
- * @param atsi performance data
- * @param atsi_count number of entries in ats (excluding 0-termination)
  */
 void
-GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, 
-                                const struct GNUNET_MessageHeader *msg,
-                                const struct GNUNET_TRANSPORT_ATS_Information *atsi,
-                                uint32_t atsi_count);
+GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx,
+                                 const struct GNUNET_MessageHeader *msg);
 
 
 /**
@@ -125,17 +126,37 @@ GSC_KX_stop (struct GSC_KeyExchangeInfo *kx);
 /**
  * Initialize KX subsystem.
  *
- * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ * @param pk private key to use for the peer
+ * @param server the server of the CORE service
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
  */
-int 
-GSC_KX_init (void);
+int
+GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk,
+             struct GNUNET_SERVER_Handle *server);
 
 
 /**
  * Shutdown KX subsystem.
  */
-void 
+void
 GSC_KX_done (void);
 
+
+/**
+ * Handle #GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS request.  For this
+ * request type, the client does not have to have transmitted an INIT
+ * request.  All current peers are returned, regardless of which
+ * message types they accept.
+ *
+ * @param cls unused
+ * @param client client sending the iteration request
+ * @param message iteration request message
+ */
+void
+GSC_KX_handle_client_monitor_peers (void *cls,
+                                    struct GNUNET_SERVER_Client *client,
+                                    const struct GNUNET_MessageHeader *message);
+
+
 #endif
 /* end of gnunet-service-core_kx.h */