GNUnet  0.11.x
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_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, const struct GNUNET_TESTING_Command *cmd, 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, const struct GNUNET_TESTING_Command *cmd)
 The cleanup function of this cmd frees resources the cmd allocated. More...
 
static int 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,
const struct GNUNET_TESTING_Command cmd,
struct GNUNET_TESTING_Interpreter is 
)
static

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

Definition at line 48 of file testing_api_cmd_system_destroy.c.

51 {
52  struct TestSystemState *tss = cls;
53  const struct GNUNET_TESTING_Command *system_cmd;
54  struct GNUNET_TESTING_System *tl_system;
55 
58  &tl_system);
60 }
@ GNUNET_YES
Definition: gnunet_common.h:97
int GNUNET_TESTING_get_trait_test_system(const struct GNUNET_TESTING_Command *cmd, struct GNUNET_TESTING_System **test_system)
Function to get the trait with struct GNUNET_TESTING_System.
const struct GNUNET_TESTING_Command * GNUNET_TESTING_interpreter_lookup_command(const char *label)
Lookup command by label.
void GNUNET_TESTING_system_destroy(struct GNUNET_TESTING_System *system, int remove_paths)
Free system resources.
Definition: testing.c:528
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:93
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(), and GNUNET_YES.

Here is the call graph for this function:

◆ system_destroy_cleanup()

static void system_destroy_cleanup ( void *  cls,
const struct GNUNET_TESTING_Command cmd 
)
static

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

Definition at line 68 of file testing_api_cmd_system_destroy.c.

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

References GNUNET_free.

◆ system_destroy_traits()

static int 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 82 of file testing_api_cmd_system_destroy.c.

86 {
87  return GNUNET_OK;
88 }
@ GNUNET_OK
Definition: gnunet_common.h:95

References GNUNET_OK.

◆ 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 82 of file testing_api_cmd_system_destroy.c.

101 {
102  struct TestSystemState *tss;
103 
104  tss = GNUNET_new (struct TestSystemState);
105  tss->create_label = create_label;
106 
107  struct GNUNET_TESTING_Command cmd = {
108  .cls = tss,
109  .label = label,
110  .run = &system_destroy_run,
111  .cleanup = &system_destroy_cleanup,
112  .traits = &system_destroy_traits
113  };
114 
115  return cmd;
116 }
#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 int system_destroy_traits(void *cls, const void **ret, const char *trait, unsigned int index)
Trait function of this cmd does nothing.
static void system_destroy_run(void *cls, const struct GNUNET_TESTING_Command *cmd, struct GNUNET_TESTING_Interpreter *is)
The run method of this cmd will remove the test environment for a node.
static void system_destroy_cleanup(void *cls, const struct GNUNET_TESTING_Command *cmd)
The cleanup function of this cmd frees resources the cmd allocated.