#include "platform.h"
#include "testing_messenger_setup.h"
#include <stdio.h>
#include "gnunet_util_lib.h"
#include "gnunet_testbed_logger_service.h"
#include "gnunet_testbed_service.h"
#include "gnunet_testing_lib.h"
#include "gnunet_messenger_service.h"
#include "testing_messenger_barrier.h"
Go to the source code of this file.
Data Structures | |
struct | test_peer |
struct | test_properties |
Macros | |
#define | TEST_ROOM "test" |
#define | TEST_NAME "tester" |
Functions | |
static void | shutdown_cb (void *cls) |
static void | end_cb (void *cls) |
static void | end_badly_cb (void *cls) |
static void | end_operation_cb (void *cls) |
static void | end_error_cb (void *cls) |
static void | barrier2_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status) |
static void | barrier_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status) |
static void | on_message (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, enum GNUNET_MESSENGER_MessageFlags flags) |
Function called whenever a message is received or sent. More... | |
static void | second_stage (void *cls) |
static void | on_peer (void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, const char *emsg) |
static void | run (void *cls, const struct GNUNET_TESTBED_EventInformation *event) |
Main function for a peer of the testcase. More... | |
static void | barrier2_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status) |
static void | barrier_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status) |
static void | init (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, unsigned int links_succeeded, unsigned int links_failed) |
int | GNUNET_run_messenger_setup (const char *test_name, const struct test_configuration *cfg) |
#define TEST_ROOM "test" |
Definition at line 37 of file testing_messenger_setup.c.
#define TEST_NAME "tester" |
Definition at line 38 of file testing_messenger_setup.c.
|
static |
Definition at line 78 of file testing_messenger_setup.c.
References test_properties::barrier, test_properties::die_task, test_properties::end_task, GNUNET_assert, GNUNET_cancel_barrier(), GNUNET_cancel_wait_barrier(), GNUNET_MESSENGER_close_room(), GNUNET_MESSENGER_disconnect(), GNUNET_SCHEDULER_cancel(), GNUNET_TESTBED_operation_done(), test_properties::num_peer, peer, and test_properties::peers.
Referenced by init().
|
static |
Definition at line 130 of file testing_messenger_setup.c.
References test_properties::die_task, GNUNET_assert, GNUNET_MESSENGER_iterate_members(), GNUNET_SCHEDULER_shutdown(), test_properties::num_peer, peer, test_properties::peers, test_properties::status, and status.
Referenced by barrier2_cb(), and end_badly_cb().
|
static |
Definition at line 164 of file testing_messenger_setup.c.
References end_cb(), GNUNET_assert, and test_properties::status.
Referenced by init().
|
static |
Definition at line 178 of file testing_messenger_setup.c.
References GNUNET_assert, GNUNET_SCHEDULER_shutdown(), and peer.
Referenced by on_message(), and on_peer().
|
static |
Definition at line 192 of file testing_messenger_setup.c.
References GNUNET_assert, GNUNET_free, GNUNET_SCHEDULER_shutdown(), and peer.
Referenced by on_peer().
|
static |
Definition at line 207 of file testing_messenger_setup.c.
References GNUNET_assert, and peer.
Referenced by on_message().
|
static |
Definition at line 220 of file testing_messenger_setup.c.
References GNUNET_assert, GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), GNUNET_MESSENGER_enter_room(), peer, and TEST_ROOM.
Referenced by on_peer().
|
static |
Function called whenever a message is received or sent.
cls | Closure |
room | Room |
sender | Sender |
message | Message |
hash | Hash of message |
flags | Flags of message |
Definition at line 266 of file testing_messenger_setup.c.
References barrier2_wait_cb(), end_operation_cb(), GNUNET_assert, GNUNET_cancel_wait_barrier(), GNUNET_h2s(), GNUNET_i2s(), GNUNET_MESSENGER_KIND_PEER, GNUNET_MESSENGER_name_of_kind(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), GNUNET_sh2s(), GNUNET_wait_barrier(), test_peer::message, and peer.
Referenced by on_peer().
|
static |
Definition at line 304 of file testing_messenger_setup.c.
References GNUNET_assert, GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), GNUNET_MESSENGER_enter_room(), GNUNET_MESSENGER_open_room(), peer, and TEST_ROOM.
Referenced by barrier_cb().
|
static |
Definition at line 350 of file testing_messenger_setup.c.
References barrier_wait_cb(), GNUNET_TESTBED_PeerInformation::cfg, end_error_cb(), end_operation_cb(), GNUNET_assert, GNUNET_CRYPTO_get_peer_identity(), GNUNET_CRYPTO_hash(), GNUNET_MESSENGER_connect(), GNUNET_MESSENGER_open_room(), GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_strdup, GNUNET_TESTBED_PIT_CONFIGURATION, GNUNET_wait_barrier(), on_message(), peer, GNUNET_TESTBED_PeerInformation::pit, GNUNET_TESTBED_PeerInformation::result, TEST_NAME, and TEST_ROOM.
Referenced by run().
|
static |
Main function for a peer of the testcase.
cls | Closure |
event | Information about the event |
Definition at line 408 of file testing_messenger_setup.c.
References GNUNET_assert, GNUNET_SCHEDULER_shutdown(), GNUNET_TESTBED_ET_PEER_START, GNUNET_TESTBED_peer_get_information(), GNUNET_TESTBED_PIT_CONFIGURATION, test_properties::num_peer, on_peer(), peer, test_properties::peers, and GNUNET_TESTBED_EventInformation::type.
Referenced by GNUNET_run_messenger_setup().
|
static |
Definition at line 433 of file testing_messenger_setup.c.
References test_properties::barrier, test_properties::cfg, test_configuration::count, test_properties::die_task, end_cb(), GNUNET_assert, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_cancel(), GNUNET_SCHEDULER_shutdown(), GNUNET_SYSERR, GNUNET_TIME_relative_multiply(), GNUNET_TIME_UNIT_SECONDS, and status.
Referenced by barrier_cb().
|
static |
Definition at line 464 of file testing_messenger_setup.c.
References test_properties::barrier, barrier2_cb(), test_properties::cfg, test_configuration::count, GNUNET_assert, GNUNET_init_barrier(), GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_shutdown(), GNUNET_SYSERR, test_properties::num_peer, test_peer::op_task, test_properties::peers, second_stage(), and status.
Referenced by GNUNET_run_messenger_setup().
|
static |
Definition at line 502 of file testing_messenger_setup.c.
References test_properties::cfg, test_configuration::count, test_properties::die_task, end_badly_cb(), test_properties::end_task, GNUNET_assert, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_TIME_relative_multiply(), GNUNET_TIME_UNIT_SECONDS, and shutdown_cb().
Referenced by GNUNET_run_messenger_setup().
int GNUNET_run_messenger_setup | ( | const char * | test_name, |
const struct test_configuration * | cfg | ||
) |
Definition at line 521 of file testing_messenger_setup.c.
References test_properties::barrier, barrier_cb(), cfg, test_properties::cfg, GNUNET_free, GNUNET_init_barrier(), GNUNET_new_array, GNUNET_OK, GNUNET_TESTBED_ET_PEER_START, GNUNET_TESTBED_test_run(), init(), test_properties::num_hosts, test_properties::peers, run(), and test_properties::status.