aboutsummaryrefslogtreecommitdiff
path: root/src/dhtu/testing_dhtu_cmd_send.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dhtu/testing_dhtu_cmd_send.c')
-rw-r--r--src/dhtu/testing_dhtu_cmd_send.c118
1 files changed, 118 insertions, 0 deletions
diff --git a/src/dhtu/testing_dhtu_cmd_send.c b/src/dhtu/testing_dhtu_cmd_send.c
new file mode 100644
index 000000000..e620e329e
--- /dev/null
+++ b/src/dhtu/testing_dhtu_cmd_send.c
@@ -0,0 +1,118 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 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/**
22 * @file testing/testing_dhtu_cmd_send.c
23 * @brief use DHTU to send a message
24 * @author Christian Grothoff
25 */
26#include "platform.h"
27#include "gnunet_testing_ng_lib.h"
28
29
30/**
31 * State for the 'send' command.
32 */
33struct SendState
34{
35
36 /**
37 * Mandatory context for async commands.
38 */
39 struct GNUNET_TESTING_AsyncContext ac;
40
41};
42
43
44/**
45 *
46 *
47 * @param cls a `struct SendState`
48 */
49static void
50send_cleanup (void *cls)
51{
52 struct SendState *ss = cls;
53
54 GNUNET_free (ss);
55}
56
57
58/**
59 * Return trains of the ``send`` command.
60 *
61 * @param cls closure.
62 * @param[out] ret result
63 * @param trait name of the trait.
64 * @param index index number of the object to offer.
65 * @return #GNUNET_OK on success.
66 * #GNUNET_NO if no trait was found
67 */
68static enum GNUNET_GenericReturnValue
69send_traits (void *cls,
70 const void **ret,
71 const char *trait,
72 unsigned int index)
73{
74 return GNUNET_NO;
75}
76
77
78/**
79 * Run the 'send' command.
80 *
81 * @param cls closure.
82 * @param is interpreter state.
83 */
84static void
85send_run (void *cls,
86 struct GNUNET_TESTING_Interpreter *is)
87{
88 struct SendState *ss = cls;
89
90#if 0
91 other_cmd = GNUNET_TESTING_interpreter_lookup_command (ss->other_label);
92 GNUNET_TESTING_get_trait_XXX (other_cmd,
93 &data);
94#endif
95 GNUNET_TESTING_async_finish (&ss->ac);
96}
97
98
99struct GNUNET_TESTING_Command
100GNUNET_TESTING_DHTU_cmd_send (const char *label)
101{
102 struct SendState *ss;
103
104 ss = GNUNET_new (struct SendState);
105
106 {
107 struct GNUNET_TESTING_Command cmd = {
108 .cls = ss,
109 .label = label,
110 .run = &send_run,
111 .ac = &ss->ac,
112 .cleanup = &send_cleanup,
113 .traits = &send_traits
114 };
115
116 return cmd;
117 }
118}