GNUnet  0.17.6
Data Structures | Functions
testing_api_cmd_system_destroy.c File Reference

cmd to destroy a testing system handle. More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_ng_lib.h"
#include "gnunet_testing_netjail_lib.h"
#include "gnunet_testing_lib.h"
Include dependency graph for testing_api_cmd_system_destroy.c:

Go to the source code of this file.

Data Structures

struct  TestSystemState
 Struct to hold information for callbacks. More...
 

Functions

static void system_destroy_run (void *cls, struct GNUNET_TESTING_Interpreter *is)
 The run method of this cmd will remove the test environment for a node. More...
 
static void system_destroy_cleanup (void *cls)
 The cleanup function of this cmd frees resources the cmd allocated. More...
 
static enum GNUNET_GenericReturnValue system_destroy_traits (void *cls, const void **ret, const char *trait, unsigned int index)
 Trait function of this cmd does nothing. More...
 
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_system_destroy (const char *label, const char *create_label)
 Create command. More...
 

Detailed Description

cmd to destroy a testing system handle.

Author
t3sserakt

Definition in file testing_api_cmd_system_destroy.c.

Function Documentation

◆ system_destroy_run()

static void system_destroy_run ( void *  cls,
struct GNUNET_TESTING_Interpreter is 
)
static

The run method of this cmd will remove the test environment for a node.

Definition at line 49 of file testing_api_cmd_system_destroy.c.

51 {
52  struct TestSystemState *tss = cls;
53  const struct GNUNET_TESTING_Command *system_cmd;
54  const struct GNUNET_TESTING_System *tl_system;
55 
57  tss->create_label);
59  &tl_system);
61  GNUNET_YES);
62 }
static struct GNUNET_NT_InterfaceScanner * is
Network scanner to determine network types.
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_test_system(const struct GNUNET_TESTING_Command *cmd, const struct GNUNET_TESTING_System **ret)
const struct GNUNET_TESTING_Command * GNUNET_TESTING_interpreter_lookup_command(struct GNUNET_TESTING_Interpreter *is, const char *label)
Lookup command by label.
@ GNUNET_YES
void GNUNET_TESTING_system_destroy(struct GNUNET_TESTING_System *system, int remove_paths)
Free system resources.
Definition: testing.c:538
A command to be run by the interpreter.
Handle for a system on which GNUnet peers are executed; a system is used for reserving unique paths a...
Definition: testing.c:103
Struct to hold information for callbacks.

References TestSystemState::create_label, GNUNET_TESTING_get_trait_test_system(), GNUNET_TESTING_interpreter_lookup_command(), GNUNET_TESTING_system_destroy(), GNUNET_YES, and is.

Here is the call graph for this function:

◆ system_destroy_cleanup()

static void system_destroy_cleanup ( void *  cls)
static

The cleanup function of this cmd frees resources the cmd allocated.

Definition at line 70 of file testing_api_cmd_system_destroy.c.

71 {
72  struct TestSystemState *tss = cls;
73 
74  GNUNET_free (tss);
75 }
#define GNUNET_free(ptr)
Wrapper around free.

References GNUNET_free.

◆ system_destroy_traits()

static enum GNUNET_GenericReturnValue system_destroy_traits ( void *  cls,
const void **  ret,
const char *  trait,
unsigned int  index 
)
static

Trait function of this cmd does nothing.

Definition at line 70 of file testing_api_cmd_system_destroy.c.

87 {
88  return GNUNET_OK;
89 }
@ GNUNET_OK
Definition: gnunet_common.h:99

◆ GNUNET_TESTING_cmd_system_destroy()

struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_system_destroy ( const char *  label,
const char *  create_label 
)

Create command.

Parameters
labelname for command.
create_labelLabel of the cmd which started the test system.
Returns
command.

Definition at line 70 of file testing_api_cmd_system_destroy.c.

102 {
103  struct TestSystemState *tss;
104 
105  tss = GNUNET_new (struct TestSystemState);
106  tss->create_label = create_label;
107  {
108  struct GNUNET_TESTING_Command cmd = {
109  .cls = tss,
110  .label = label,
111  .run = &system_destroy_run,
112  .cleanup = &system_destroy_cleanup,
113  .traits = &system_destroy_traits
114  };
115 
116  return cmd;
117  }
118 }
#define GNUNET_new(type)
Allocate a struct or union of the given type.
const char * label
Label for the command.
void * cls
Closure for all commands with command-specific context information.
static void system_destroy_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.
static void system_destroy_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
The run method of this cmd will remove the test environment for a node.
static enum GNUNET_GenericReturnValue system_destroy_traits(void *cls, const void **ret, const char *trait, unsigned int index)
Trait function of this cmd does nothing.