*
* Implement:
* - manage defragmentation, retransmission, track RTT, loss, etc.
+ * - DV data structures, learning, forgetting, using them!
*
* Easy:
* - use ATS bandwidth allocation callback and schedule transmissions!
*/
struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
+ // FIXME: probably should add random IV here as well,
+ // especially if we re-use ephemeral keys!
+
/**
* HMAC over the ciphertext of the encrypted, variable-size
* body that follows. Verified via DH of @e target and
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
/**
- * How long is this signature over the ephemeral key
- * valid?
+ * How long is this signature over the ephemeral key valid?
*/
struct GNUNET_TIME_AbsoluteNBO ephemeral_validity;
};
-/**
- * Message by which a peqer confirms that it is using an ephemeral
- * key.
- */
-struct EphemeralConfirmationMessage
-{
-
- /**
- * Message header, type is #GNUNET_MESSAGE_TYPE_TRANSPORT_EPHEMERAL_CONFIRMATION
- */
- struct GNUNET_MessageHeader header;
-
- /**
- * Must be zero.
- */
- uint32_t reserved;
-
- /**
- * How long is this signature over the ephemeral key
- * valid?
- */
- struct GNUNET_TIME_AbsoluteNBO ephemeral_validity;
-
- /**
- * Ephemeral key setup by the sender for @e target, used
- * to encrypt the payload.
- */
- struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
-};
-
-
/**
* Plaintext of the variable-size payload that is encrypted
* within a `struct TransportBackchannelEncapsulationMessage`
/**
* Entry in our cache of ephemeral keys we currently use.
+ * This way, we only sign an ephemeral once per @e target,
+ * and then can re-use it over multiple
+ * #GNUNET_MESSAGE_TYPE_TRANSPORT_BACKCHANNEL_ENCAPSULATION
+ * messages (as signing is expensive).
*/
struct EphemeralCacheEntry
{
// FIXME: check HMAC
// FIXME: decrypt payload
// FIXME: forward to specified communicator!
-
- finish_cmc_handling (cmc);
-}
-
-
-/**
- * Communicator gave us an ephemeral confirmation. Process the request.
- *
- * @param cls a `struct CommunicatorMessageContext` (must call #finish_cmc_handling() when done)
- * @param ec the message that was received
- */
-static void
-handle_ephemeral_confirmation (void *cls,
- const struct EphemeralConfirmationMessage *ec)
-{
- struct CommunicatorMessageContext *cmc = cls;
-
- // FIXME: notify communicator (?) about ephemeral confirmation!?
- // FIXME: or does this have something to do with the ephemeral_map?
- // where did I plan to use this message again!?
- // FIXME: communicator API has a very general notification API,
- // nothing specific for ephemeral keys;
- // why do we have a ephemeral key-specific message here?
- // => first revise where we get such messages from communicator
- // before processing further here!
+ // (using GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL_INCOMING)
finish_cmc_handling (cmc);
}
GNUNET_MESSAGE_TYPE_TRANSPORT_BACKCHANNEL_ENCAPSULATION,
struct TransportBackchannelEncapsulationMessage,
&cmc),
- GNUNET_MQ_hd_fixed_size (ephemeral_confirmation,
- GNUNET_MESSAGE_TYPE_TRANSPORT_EPHEMERAL_CONFIRMATION,
- struct EphemeralConfirmationMessage,
- &cmc),
GNUNET_MQ_hd_var_size (dv_learn,
GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN,
struct TransportDVLearn,
* @file transport/transport_api2_communication.c
* @brief implementation of the gnunet_transport_communication_service.h API
* @author Christian Grothoff
+ *
+ * FIXME: handling of messages for "notify_cb" not implemented!
*/
#include "platform.h"
#include "gnunet_util_lib.h"
check_send_msg (void *cls,
const struct GNUNET_TRANSPORT_SendMessageTo *smt)
{
- uint16_t len = ntohs (smt->header.size) - sizeof (*smt);
- const struct GNUNET_MessageHeader *mh = (const struct GNUNET_MessageHeader *) &smt[1];
-
(void) cls;
- if (ntohs (mh->size) != len)
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
+ GNUNET_MQ_check_boxed_message (smt);
return GNUNET_OK;
}
}
+/**
+ * Transport service gives us backchannel message. Check if @a bi
+ * is well-formed.
+ *
+ * @param cls our `struct GNUNET_TRANSPORT_CommunicatorHandle *`
+ * @param bi the backchannel message
+ * @return #GNUNET_OK if @a smt is well-formed
+ */
+static int
+check_backchannel_incoming (void *cls,
+ const struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming *bi)
+{
+ (void) cls;
+ GNUNET_MQ_check_boxed_message (bi);
+ return GNUNET_OK;
+}
+
+
+/**
+ * Transport service gives us backchannel message. Handle it.
+ *
+ * @param cls our `struct GNUNET_TRANSPORT_CommunicatorHandle *`
+ * @param bi the backchannel message
+ */
+static void
+handle_backchannel_incoming (void *cls,
+ const struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming *bi)
+{
+ struct GNUNET_TRANSPORT_CommunicatorHandle *ch = cls;
+
+ // FIXME: handle bi!
+}
+
+
/**
* (re)connect our communicator to the transport service
*
GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG,
struct GNUNET_TRANSPORT_SendMessageTo,
ch),
- // FIXME: handle backchannel notifications!
+ GNUNET_MQ_hd_var_size (backchannel_incoming,
+ GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL_INCOMING,
+ struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming,
+ ch),
GNUNET_MQ_handler_end()
};
struct GNUNET_TRANSPORT_CommunicatorAvailableMessage *cam;