GNUnet  0.11.x
Macros | Functions
testing_api_trait_cmd.c File Reference

offers CMDs as traits. More...

#include "platform.h"
#include "gnunet_testing_ng_lib.h"
Include dependency graph for testing_api_trait_cmd.c:

Go to the source code of this file.

Macros

#define GNUNET_TESTING_TRAIT_CMD   "cmd"
 

Functions

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_cmd (const struct GNUNET_TESTING_Command *cmd, unsigned int index, struct GNUNET_TESTING_Command **_cmd)
 Obtain a command from cmd. More...
 
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_cmd (unsigned int index, const struct GNUNET_TESTING_Command *cmd)
 Offer a command in a trait. More...
 

Detailed Description

offers CMDs as traits.

Author
Marcello Stanisci (GNU Taler testing)
t3sserakt

Definition in file testing_api_trait_cmd.c.

Macro Definition Documentation

◆ GNUNET_TESTING_TRAIT_CMD

#define GNUNET_TESTING_TRAIT_CMD   "cmd"

Definition at line 30 of file testing_api_trait_cmd.c.

Function Documentation

◆ GNUNET_TESTING_get_trait_cmd()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_cmd ( const struct GNUNET_TESTING_Command cmd,
unsigned int  index,
struct GNUNET_TESTING_Command **  _cmd 
)

Obtain a command from cmd.

Parameters
cmdcommand to extract the command from.
indexalways zero. Commands offering this kind of traits do not need this index. For example, a "batch" CMD returns always the CMD currently being executed.
[out]_cmdwhere to write the wire details.
Returns
GNUNET_OK on success.

Definition at line 1 of file testing_api_trait_cmd.c.

48 {
49  return cmd->traits (cmd->cls,
50  (const void **) _cmd,
52  index);
53 }
enum GNUNET_GenericReturnValue(* traits)(void *cls, const void **ret, const char *trait, unsigned int index)
Extract information from a command that is useful for other commands.
void * cls
Closure for all commands with command-specific context information.
#define GNUNET_TESTING_TRAIT_CMD

Referenced by GNUNET_TESTING_interpreter_lookup_command().

Here is the caller graph for this function:

◆ GNUNET_TESTING_make_trait_cmd()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_cmd ( unsigned int  index,
const struct GNUNET_TESTING_Command cmd 
)

Offer a command in a trait.

Parameters
indexalways zero. Commands offering this kind of traits do not need this index. For example, a "meta" CMD returns always the CMD currently being executed.
cmdwire details to offer.
Returns
the trait.

Definition at line 1 of file testing_api_trait_cmd.c.

69 {
70  struct GNUNET_TESTING_Trait ret = {
71  .index = index,
72  .trait_name = GNUNET_TESTING_TRAIT_CMD,
73  .ptr = (const struct GNUNET_TESTING_Command *) cmd
74  };
75  return ret;
76 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
A command to be run by the interpreter.
unsigned int index
Index number associated with the trait.