GNUnet  0.16.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"
29 
30 
34 struct SendState
35 {
36 
41 
42 };
43 
44 
50 static void
51 send_cleanup (void *cls)
52 {
53  struct SendState *ss = cls;
54 
55  GNUNET_free (ss);
56 }
57 
58 
69 static enum GNUNET_GenericReturnValue
70 send_traits (void *cls,
71  const void **ret,
72  const char *trait,
73  unsigned int index)
74 {
75  return GNUNET_NO;
76 }
77 
78 
85 static void
86 send_run (void *cls,
88 {
89  struct SendState *ss = cls;
90 
91 #if 0
92  other_cmd = GNUNET_TESTING_interpreter_lookup_command (ss->other_label);
93  GNUNET_TESTING_get_trait_XXX (other_cmd,
94  &data);
95 #endif
97 }
98 
99 
102 {
103  struct SendState *ss;
104 
105  ss = GNUNET_new (struct SendState);
106 
107  {
108  struct GNUNET_TESTING_Command cmd = {
109  .cls = ss,
110  .label = label,
111  .run = &send_run,
112  .ac = &ss->ac,
113  .cleanup = &send_cleanup,
114  .traits = &send_traits
115  };
116 
117  return cmd;
118  }
119 }
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.