GNUnet  0.11.x
testing_dhtu_cmd_send.c
Go to the documentation of this file.
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 
26 #include "platform.h"
27 #include "gnunet_testing_ng_lib.h"
28 
29 
33 struct SendState
34 {
35 
40 
41 };
42 
43 
49 static void
50 send_cleanup (void *cls)
51 {
52  struct SendState *ss = cls;
53 
54  GNUNET_free (ss);
55 }
56 
57 
68 static enum GNUNET_GenericReturnValue
69 send_traits (void *cls,
70  const void **ret,
71  const char *trait,
72  unsigned int index)
73 {
74  return GNUNET_NO;
75 }
76 
77 
84 static void
85 send_run (void *cls,
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
96 }
97 
98 
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 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
static struct GNUNET_NT_InterfaceScanner * is
Network scanner to determine network types.
uint32_t data
The data value.
GNUNET_GenericReturnValue
Named constants for return values.
Definition: gnunet_common.h:92
@ GNUNET_NO
Definition: gnunet_common.h:94
void GNUNET_TESTING_async_finish(struct GNUNET_TESTING_AsyncContext *ac)
The asynchronous command of ac has finished.
const struct GNUNET_TESTING_Command * GNUNET_TESTING_interpreter_lookup_command(struct GNUNET_TESTING_Interpreter *is, const char *label)
Lookup command by label.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
State each asynchronous command must have in its closure.
A command to be run by the interpreter.
const char * label
Label for the command.
void * cls
Closure for all commands with command-specific context information.
Global state of the interpreter, used by a command to access information about other commands.
State for the 'send' command.
struct GNUNET_TESTING_AsyncContext ac
Mandatory context for async commands.
static void send_cleanup(void *cls)
struct GNUNET_TESTING_Command GNUNET_TESTING_DHTU_cmd_send(const char *label)
static void send_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
Run the 'send' command.
static enum GNUNET_GenericReturnValue send_traits(void *cls, const void **ret, const char *trait, unsigned int index)
Return trains of the send command.