GNUnet 0.22.2
testbed_api_cmd_system_create.c File Reference
Include dependency graph for testbed_api_cmd_system_create.c:

Go to the source code of this file.

Data Structures

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

Macros

#define BASE_DIR   "testdir"
 

Functions

static void system_create_run (void *cls, struct GNUNET_TESTING_Interpreter *is)
 The run method of this cmd will setup a test environment for a node. More...
 
static int system_create_traits (void *cls, const void **ret, const char *trait, unsigned int index)
 This function prepares an array with traits. More...
 
static void system_create_cleanup (void *cls)
 The cleanup function of this cmd frees resources the cmd allocated. More...
 
struct GNUNET_TESTING_Command GNUNET_TESTBED_cmd_system_create (const char *label, const char *my_node_id)
 This command is setting up a test environment for a peer to start. More...
 

Macro Definition Documentation

◆ BASE_DIR

#define BASE_DIR   "testdir"

Definition at line 32 of file testbed_api_cmd_system_create.c.

Function Documentation

◆ system_create_run()

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

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

Definition at line 51 of file testbed_api_cmd_system_create.c.

53{
54 struct TestSystemState *tss = cls;
55
57 NULL,
58 NULL);
59}
struct GNUNET_TESTBED_System * GNUNET_TESTBED_system_create(const char *testdir, const char *trusted_ip, const char *hostname)
Create a system handle.
Definition: testbed.c:136
Struct to hold information for callbacks.
struct GNUNET_TESTBED_System * test_system

References GNUNET_TESTBED_system_create(), TestSystemState::test_system, and TestSystemState::testdir.

Referenced by GNUNET_TESTBED_cmd_system_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ system_create_traits()

static int system_create_traits ( void *  cls,
const void **  ret,
const char *  trait,
unsigned int  index 
)
static

This function prepares an array with traits.

Definition at line 67 of file testbed_api_cmd_system_create.c.

71{
72 struct TestSystemState *tss = cls;
73 struct GNUNET_TESTING_Trait traits[] = {
75 tss->test_system),
77 };
78
80 ret,
81 trait,
82 index);
83}
static int ret
Final status code.
Definition: gnunet-arm.c:93
struct GNUNET_TESTING_Trait GNUNET_TESTING_trait_end(void)
"end" of traits array.
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait(const struct GNUNET_TESTING_Trait *traits, const void **ret, const char *trait, unsigned int index)
Obtain value of a trait from a command.
struct GNUNET_TESTING_Trait GNUNET_TESTING_TESTBED_make_trait_test_system(struct GNUNET_TESTBED_System *value)
A struct GNUNET_TESTING_Trait can be used to exchange data between cmds.
unsigned int index
Index number associated with the trait.
static enum GNUNET_GenericReturnValue traits(void *cls, const void **ret, const char *trait, unsigned int index)
This function prepares an array with traits.

References GNUNET_TESTING_get_trait(), GNUNET_TESTING_TESTBED_make_trait_test_system(), GNUNET_TESTING_trait_end(), GNUNET_TESTING_Trait::index, ret, TestSystemState::test_system, and traits().

Referenced by GNUNET_TESTBED_cmd_system_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ system_create_cleanup()

static void system_create_cleanup ( void *  cls)
static

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

Definition at line 91 of file testbed_api_cmd_system_create.c.

92{
93 struct TestSystemState *tss = cls;
94
97
98 GNUNET_free (tss);
99}
void GNUNET_TESTBED_system_destroy(struct GNUNET_TESTBED_System *system, bool remove_paths)
Free system resources.
Definition: testbed.c:150
@ GNUNET_YES
#define GNUNET_free(ptr)
Wrapper around free.

References GNUNET_free, GNUNET_TESTBED_system_destroy(), GNUNET_YES, and TestSystemState::test_system.

Referenced by GNUNET_TESTBED_cmd_system_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_cmd_system_create()

struct GNUNET_TESTING_Command GNUNET_TESTBED_cmd_system_create ( const char *  label,
const char *  my_node_id 
)

This command is setting up a test environment for a peer to start.

Parameters
labelName for command.
my_node_idThe specific id of the node this command is running on. A sub string of the id is the process id of the master process. This id is used to build the name of the temporary directory of the peer to start.

Definition at line 111 of file testbed_api_cmd_system_create.c.

113{
114 struct TestSystemState *tss;
115
116 tss = GNUNET_new (struct TestSystemState);
118 "%s%s",
119 BASE_DIR,
120 my_node_id);
121
122 return GNUNET_TESTING_command_new (tss,
123 label,
127}
static const char * my_node_id
#define GNUNET_TESTING_command_new(cls, label, run, cleanup, traits)
Create a new command.
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static void system_create_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
The run method of this cmd will setup a test environment for a node.
#define BASE_DIR
static int system_create_traits(void *cls, const void **ret, const char *trait, unsigned int index)
This function prepares an array with traits.
static void system_create_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.

References BASE_DIR, GNUNET_asprintf(), GNUNET_new, GNUNET_TESTING_command_new, my_node_id, system_create_cleanup(), system_create_run(), system_create_traits(), and TestSystemState::testdir.

Here is the call graph for this function: