diff options
Diffstat (limited to 'src/cadet/cadet_api_drop_message.c')
-rw-r--r-- | src/cadet/cadet_api_drop_message.c | 59 |
1 files changed, 59 insertions, 0 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 */ | ||