diff options
author | t3sserakt <t3ss@posteo.de> | 2020-06-05 16:48:29 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2020-06-05 16:48:29 +0200 |
commit | 11dbdc79aeb05e82913ac70cf2ac8d4f45b02c28 (patch) | |
tree | 27626cd1ad6e5e0fd2654657b925a1be8508008d /src | |
parent | d22eacb13eb676b5c096b47c72a3fdbdb332d5a5 (diff) | |
download | gnunet-11dbdc79aeb05e82913ac70cf2ac8d4f45b02c28.tar.gz gnunet-11dbdc79aeb05e82913ac70cf2ac8d4f45b02c28.zip |
- forgot to actually add a file and some method documentations.
Diffstat (limited to 'src')
-rw-r--r-- | src/cadet/cadet_api_drop_message.c | 59 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_connection.c | 5 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_connection.h | 4 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 32 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.h | 22 |
5 files changed, 99 insertions, 23 deletions
diff --git a/src/cadet/cadet_api_drop_message.c b/src/cadet/cadet_api_drop_message.c new file mode 100644 index 000000000..d9f7e003e --- /dev/null +++ b/src/cadet/cadet_api_drop_message.c | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2011, 2017, 2019 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file cadet/cadet_api_drop_message.c | ||
22 | * @brief cadet api: client implementation of cadet service | ||
23 | * @author t3sserakt | ||
24 | */ | ||
25 | #include "platform.h" | ||
26 | #include "cadet.h" | ||
27 | |||
28 | |||
29 | /** | ||
30 | * Drop the next cadet message of a given type.. | ||
31 | * | ||
32 | * @param mq message queue | ||
33 | * @param ccn client channel number. | ||
34 | * @param type of cadet message to be dropped. | ||
35 | */ | ||
36 | void | ||
37 | GNUNET_CADET_drop_message (struct GNUNET_MQ_Handle *mq, | ||
38 | struct GNUNET_CADET_ClientChannelNumber ccn, | ||
39 | uint16_t type) | ||
40 | { | ||
41 | struct GNUNET_CADET_RequestDropCadetMessage *message; | ||
42 | struct GNUNET_MQ_Envelope *env; | ||
43 | |||
44 | env = GNUNET_MQ_msg (message, GNUNET_MESSAGE_TYPE_CADET_DROP_CADET_MESSAGE); | ||
45 | |||
46 | message->ccn = ccn; | ||
47 | message->type = type; | ||
48 | |||
49 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
50 | "Dropping message for channel of type %s (%d)\n", type == GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY ? "GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY" : "UNKNOWN", type); | ||
51 | |||
52 | GNUNET_MQ_send (mq, env); | ||
53 | |||
54 | } | ||
55 | |||
56 | |||
57 | |||
58 | |||
59 | /* end of cadet_api_drop_message.c */ | ||
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index 1dac9eb1e..a7c1d9fb0 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c | |||
@@ -595,6 +595,11 @@ GCC_handle_encrypted (struct CadetConnection *cc, | |||
595 | } | 595 | } |
596 | 596 | ||
597 | 597 | ||
598 | /** | ||
599 | * Set the signature for a monotime value on a GNUNET_CADET_ConnectionCreateMessage. | ||
600 | * | ||
601 | * @param msg The GNUNET_CADET_ConnectionCreateMessage. | ||
602 | */ | ||
598 | void | 603 | void |
599 | set_monotime_sig (struct GNUNET_CADET_ConnectionCreateMessage *msg) | 604 | set_monotime_sig (struct GNUNET_CADET_ConnectionCreateMessage *msg) |
600 | { | 605 | { |
diff --git a/src/cadet/gnunet-service-cadet_connection.h b/src/cadet/gnunet-service-cadet_connection.h index a9ebef567..ed0e909fb 100644 --- a/src/cadet/gnunet-service-cadet_connection.h +++ b/src/cadet/gnunet-service-cadet_connection.h | |||
@@ -182,6 +182,10 @@ void | |||
182 | GCC_handle_kx_auth (struct CadetConnection *cc, | 182 | GCC_handle_kx_auth (struct CadetConnection *cc, |
183 | const struct | 183 | const struct |
184 | GNUNET_CADET_TunnelKeyExchangeAuthMessage *msg); | 184 | GNUNET_CADET_TunnelKeyExchangeAuthMessage *msg); |
185 | |||
186 | /** | ||
187 | * Purpose for the signature of a monotime. | ||
188 | */ | ||
185 | struct CadetConnectionCreatePS | 189 | struct CadetConnectionCreatePS |
186 | { | 190 | { |
187 | 191 | ||
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index 0ff4d1fb8..55800b88c 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -1552,17 +1552,12 @@ GCP_send_ooo (struct CadetPeer *cp, | |||
1552 | env); | 1552 | env); |
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | /* | 1555 | /** |
1556 | * FIXME: comment | 1556 | * 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. |
1557 | */ | 1557 | * |
1558 | void | 1558 | * @param peer The peer we received a new time value from. |
1559 | GCP_update_monotime (struct CadetPeer *peer) | 1559 | * @param monotime Time value we check against the last time value we received from a peer. |
1560 | { | 1560 | * @return GNUNET_YES if monotime is newer than the last received time value, GNUNET_NO if monotime is not newer. |
1561 | peer->last_connection_create = GNUNET_TIME_absolute_get_monotonic (cfg); | ||
1562 | } | ||
1563 | |||
1564 | /* | ||
1565 | * FIXME: comment | ||
1566 | */ | 1561 | */ |
1567 | int | 1562 | int |
1568 | GCP_check_and_update_monotime (struct CadetPeer *peer, | 1563 | GCP_check_and_update_monotime (struct CadetPeer *peer, |
@@ -1579,16 +1574,17 @@ GCP_check_and_update_monotime (struct CadetPeer *peer, | |||
1579 | return GNUNET_NO; | 1574 | return GNUNET_NO; |
1580 | } | 1575 | } |
1581 | 1576 | ||
1582 | /* | 1577 | /** |
1583 | * FIXME: documentation here | 1578 | * Checking the signature for a monotime of a GNUNET_CADET_ConnectionCreateMessage. |
1579 | * | ||
1580 | * @param peer The peer that signed the monotime value. | ||
1581 | * @param msg The GNUNET_CADET_ConnectionCreateMessage with the monotime value. | ||
1582 | * @return GNUNET_OK if the signature is good, GNUNET_SYSERR if not. | ||
1584 | */ | 1583 | */ |
1585 | int | 1584 | int |
1586 | GCP_check_monotime_sig (struct CadetPeer *peer, const struct | 1585 | GCP_check_monotime_sig (struct CadetPeer *peer, |
1587 | GNUNET_CADET_ConnectionCreateMessage *msg) | 1586 | const struct GNUNET_CADET_ConnectionCreateMessage *msg) |
1588 | { | 1587 | { |
1589 | // struct CadetPeer *peer; | ||
1590 | // const struct GNUNET_CADET_ConnectionCreateMessage *msg; | ||
1591 | |||
1592 | struct CadetConnectionCreatePS cp = { .purpose.purpose = htonl ( | 1588 | struct CadetConnectionCreatePS cp = { .purpose.purpose = htonl ( |
1593 | GNUNET_SIGNATURE_PURPOSE_CADET_CONNECTION_INITIATOR), | 1589 | GNUNET_SIGNATURE_PURPOSE_CADET_CONNECTION_INITIATOR), |
1594 | .purpose.size = htonl (sizeof(cp)), | 1590 | .purpose.size = htonl (sizeof(cp)), |
diff --git a/src/cadet/gnunet-service-cadet_peer.h b/src/cadet/gnunet-service-cadet_peer.h index 31bd23121..5782b8bff 100644 --- a/src/cadet/gnunet-service-cadet_peer.h +++ b/src/cadet/gnunet-service-cadet_peer.h | |||
@@ -402,13 +402,25 @@ void | |||
402 | GCP_set_mq (struct CadetPeer *cp, | 402 | GCP_set_mq (struct CadetPeer *cp, |
403 | struct GNUNET_MQ_Handle *mq); | 403 | struct GNUNET_MQ_Handle *mq); |
404 | 404 | ||
405 | /** | ||
406 | * Checking the signature for a monotime of a GNUNET_CADET_ConnectionCreateMessage. | ||
407 | * | ||
408 | * @param peer The peer that signed the monotime value. | ||
409 | * @param msg The GNUNET_CADET_ConnectionCreateMessage with the monotime value. | ||
410 | * @return GNUNET_OK if the signature is good, GNUNET_SYSERR if not. | ||
411 | */ | ||
405 | int | 412 | int |
406 | GCP_check_monotime_sig (struct CadetPeer *peer, const struct GNUNET_CADET_ConnectionCreateMessage *msg); | 413 | GCP_check_monotime_sig (struct CadetPeer *peer, const struct |
407 | 414 | GNUNET_CADET_ConnectionCreateMessage *msg); | |
408 | void | ||
409 | GCP_update_monotime (struct CadetPeer *cp); | ||
410 | 415 | ||
411 | int | 416 | /** |
417 | * 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. | ||
418 | * | ||
419 | * @param peer The peer we received a new time value from. | ||
420 | * @param monotime Time value we check against the last time value we received from a peer. | ||
421 | * @return GNUNET_YES if monotime is newer than the last received time value, GNUNET_NO if monotime is not newer. | ||
422 | */ | ||
423 | int | ||
412 | GCP_check_and_update_monotime (struct CadetPeer *peer, | 424 | GCP_check_and_update_monotime (struct CadetPeer *peer, |
413 | struct GNUNET_TIME_AbsoluteNBO monotime); | 425 | struct GNUNET_TIME_AbsoluteNBO monotime); |
414 | 426 | ||