--- /dev/null
+/*
+ This file is part of GNUnet.
+ Copyright (C) 2011, 2017, 2019 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+*/
+/**
+ * @file cadet/cadet_api_drop_message.c
+ * @brief cadet api: client implementation of cadet service
+ * @author t3sserakt
+ */
+#include "platform.h"
+#include "cadet.h"
+
+
+/**
+ * Drop the next cadet message of a given type..
+ *
+ * @param mq message queue
+ * @param ccn client channel number.
+ * @param type of cadet message to be dropped.
+ */
+void
+GNUNET_CADET_drop_message (struct GNUNET_MQ_Handle *mq,
+ struct GNUNET_CADET_ClientChannelNumber ccn,
+ uint16_t type)
+{
+ struct GNUNET_CADET_RequestDropCadetMessage *message;
+ struct GNUNET_MQ_Envelope *env;
+
+ env = GNUNET_MQ_msg (message, GNUNET_MESSAGE_TYPE_CADET_DROP_CADET_MESSAGE);
+
+ message->ccn = ccn;
+ message->type = type;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Dropping message for channel of type %s (%d)\n", type == GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY ? "GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY" : "UNKNOWN", type);
+
+ GNUNET_MQ_send (mq, env);
+
+}
+
+
+
+
+/* end of cadet_api_drop_message.c */
}
+/**
+ * Set the signature for a monotime value on a GNUNET_CADET_ConnectionCreateMessage.
+ *
+ * @param msg The GNUNET_CADET_ConnectionCreateMessage.
+ */
void
set_monotime_sig (struct GNUNET_CADET_ConnectionCreateMessage *msg)
{
GCC_handle_kx_auth (struct CadetConnection *cc,
const struct
GNUNET_CADET_TunnelKeyExchangeAuthMessage *msg);
+
+/**
+ * Purpose for the signature of a monotime.
+ */
struct CadetConnectionCreatePS
{
env);
}
-/*
- * FIXME: comment
- */
-void
-GCP_update_monotime (struct CadetPeer *peer)
-{
- peer->last_connection_create = GNUNET_TIME_absolute_get_monotonic (cfg);
-}
-
-/*
- * FIXME: comment
+/**
+ * Checking if a monotime value is newer than the last monotime value received from a peer. If the time value is newer it will be stored at the peer.
+ *
+ * @param peer The peer we received a new time value from.
+ * @param monotime Time value we check against the last time value we received from a peer.
+ * @return GNUNET_YES if monotime is newer than the last received time value, GNUNET_NO if monotime is not newer.
*/
int
GCP_check_and_update_monotime (struct CadetPeer *peer,
return GNUNET_NO;
}
-/*
- * FIXME: documentation here
+/**
+ * Checking the signature for a monotime of a GNUNET_CADET_ConnectionCreateMessage.
+ *
+ * @param peer The peer that signed the monotime value.
+ * @param msg The GNUNET_CADET_ConnectionCreateMessage with the monotime value.
+ * @return GNUNET_OK if the signature is good, GNUNET_SYSERR if not.
*/
int
-GCP_check_monotime_sig (struct CadetPeer *peer, const struct
- GNUNET_CADET_ConnectionCreateMessage *msg)
+GCP_check_monotime_sig (struct CadetPeer *peer,
+ const struct GNUNET_CADET_ConnectionCreateMessage *msg)
{
- // struct CadetPeer *peer;
- // const struct GNUNET_CADET_ConnectionCreateMessage *msg;
-
struct CadetConnectionCreatePS cp = { .purpose.purpose = htonl (
GNUNET_SIGNATURE_PURPOSE_CADET_CONNECTION_INITIATOR),
.purpose.size = htonl (sizeof(cp)),
GCP_set_mq (struct CadetPeer *cp,
struct GNUNET_MQ_Handle *mq);
+/**
+ * Checking the signature for a monotime of a GNUNET_CADET_ConnectionCreateMessage.
+ *
+ * @param peer The peer that signed the monotime value.
+ * @param msg The GNUNET_CADET_ConnectionCreateMessage with the monotime value.
+ * @return GNUNET_OK if the signature is good, GNUNET_SYSERR if not.
+ */
int
-GCP_check_monotime_sig (struct CadetPeer *peer, const struct GNUNET_CADET_ConnectionCreateMessage *msg);
-
-void
-GCP_update_monotime (struct CadetPeer *cp);
+GCP_check_monotime_sig (struct CadetPeer *peer, const struct
+ GNUNET_CADET_ConnectionCreateMessage *msg);
-int
+/**
+ * Checking if a monotime value is newer than the last monotime value received from a peer. If the time value is newer it will be stored at the peer.
+ *
+ * @param peer The peer we received a new time value from.
+ * @param monotime Time value we check against the last time value we received from a peer.
+ * @return GNUNET_YES if monotime is newer than the last received time value, GNUNET_NO if monotime is not newer.
+ */
+int
GCP_check_and_update_monotime (struct CadetPeer *peer,
struct GNUNET_TIME_AbsoluteNBO monotime);