36 #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
55 unsigned int global_node_number,
65 name_len = strlen (barrier_name) + 1;
67 atm->
header.
size = htons ((uint16_t) msg_length);
70 memcpy (&atm[1], barrier_name, name_len);
81 unsigned int reached = barrier->
reached;
89 percentage_to_be_reached,
94 if (((0 < percentage_to_be_reached) &&
95 (percentage_reached >= percentage_to_be_reached)) ||
96 ((0 < number_to_be_reached) && (reached >= number_to_be_reached)))
182 double percentage_to_be_reached,
183 unsigned int number_to_be_reached)
194 GNUNET_assert ((0 < percentage_to_be_reached && 0 == number_to_be_reached) ||
195 (0 == percentage_to_be_reached && 0 < number_to_be_reached));
static int ret
Return value of the commandline.
struct GNUNET_TESTING_Interpreter * is
struct GNUNET_HashCode key
The key used in the DHT.
static int write_message(uint16_t message_type, const char *data, size_t data_length)
Write message to the master process.
struct GNUNET_TESTING_Command GNUNET_TESTING_command_new(void *cls, const char *label, GNUNET_TESTING_CommandRunRoutine run, GNUNET_TESTING_CommandCleanupRoutine cleanup, GNUNET_TESTING_CommandGetTraits traits, struct GNUNET_TESTING_AsyncContext *ac)
Create a new command.
struct GNUNET_TESTING_Trait GNUNET_TESTING_trait_end(void)
"end" trait.
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait(const struct GNUNET_TESTING_Trait *traits, const void **ret, const char *trait, unsigned int index)
Extract a trait.
void(* GNUNET_TESTING_cmd_helper_write_cb)(struct GNUNET_MessageHeader *message, size_t msg_length)
Callback function to write messages from the helper process running on a netjail node to the master p...
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
void * GNUNET_CONTAINER_multishortmap_get(const struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key)
Given a key find a value in the map matching the key.
GNUNET_GenericReturnValue
Named constants for return values.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ATTACHED
struct GNUNET_TESTING_Barrier * barrier
Message send by a child loop to inform the master loop how much GNUNET_CMDS_BARRIER_REACHED messages ...
uint32_t expected_reaches
How often the child loop will reach the barrier.
uint32_t node_number
The number of the node the barrier is running on.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ATTACHED.
const char * name
Name of the barrier.
unsigned int number_to_be_reached
Number of commands which need to reach the barrier to change state.
struct GNUNET_CONTAINER_MultiShortmap * nodes
Hash map containing the global known nodes which are not natted.
double percentage_to_be_reached
Percentage of of commands which need to reach the barrier to change state.
unsigned int reached
Number of commands which reached this barrier.
unsigned int expected_reaches
Number of commands attached to this barrier.
A command to be run by the interpreter.
char label[127+1]
Label for the command.
Global state of the interpreter, used by a command to access information about other commands.
Node in the netjail topology.
unsigned int node_number
The overall number of the node in the whole test system.
A struct GNUNET_TESTING_Trait can be used to exchange data between cmds.
unsigned int index
Index number associated with the trait.
void TST_interpreter_add_barrier(struct GNUNET_TESTING_Interpreter *is, struct GNUNET_TESTING_Barrier *barrier)
Add a barrier to the loop.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_barrier_create(const char *label, double percentage_to_be_reached, unsigned int number_to_be_reached)
Command to create a barrier.
static enum GNUNET_GenericReturnValue barrier_traits(void *cls, const void **ret, const char *trait, unsigned int index)
Offer internal data from a "barrier" CMD, to other commands.
void GNUNET_TESTING_send_barrier_attach(struct GNUNET_TESTING_Interpreter *is, char *barrier_name, unsigned int global_node_number, unsigned int expected_reaches, GNUNET_TESTING_cmd_helper_write_cb write_message)
Send Message to master loop that cmds being attached to a barrier.
struct GNUNET_TESTING_NetjailNode * GNUNET_TESTING_barrier_get_node(struct GNUNET_TESTING_Barrier *barrier, unsigned int node_number)
Getting a node from a map by global node number.
static void barrier_cleanup(void *cls)
Cleanup the state from a "barrier" CMD, and possibly cancel a pending operation thereof.
#define LOG(kind,...)
Generic logging shortcut.
unsigned int GNUNET_TESTING_barrier_crossable(struct GNUNET_TESTING_Barrier *barrier)
This function checks, if a barrier can be crossed, which actually means that the cmd representing the...
static void barrier_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
Run the command.