#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_ng_lib.h"
#include "gnunet_testing_netjail_lib.h"
#include "gnunet_peerstore_service.h"
#include "gnunet_transport_core_service.h"
#include "gnunet_transport_application_service.h"
#include "transport-testing-cmds.h"
Go to the source code of this file.
Macros | |
#define | LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) |
Generic logging shortcut. More... | |
Functions | |
static void | retrieve_hello (void *cls) |
Function to start the retrieval task to retrieve the hello of this peer from the peerstore. More... | |
static void | hello_iter_cb (void *cb_cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg) |
Callback delivering the hello of this peer from peerstore. More... | |
static void | notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer, void *handler_cls) |
Disconnect callback for the connection to the core service. More... | |
static void * | notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq) |
Connect callback for the connection to the core service. More... | |
static void | start_peer_run (void *cls, struct GNUNET_TESTING_Interpreter *is) |
The run method of this cmd will start all services of a peer to test the transport service. More... | |
static void | start_peer_cleanup (void *cls) |
The cleanup function of this cmd frees resources the cmd allocated. More... | |
static int | start_peer_traits (void *cls, const void **ret, const char *trait, unsigned int index) |
This function prepares an array with traits. More... | |
struct GNUNET_TESTING_Command | GNUNET_TRANSPORT_cmd_start_peer (const char *label, const char *system_label, uint32_t no, const char *node_ip, struct GNUNET_MQ_MessageHandler *handlers, const char *cfgname, GNUNET_TRANSPORT_notify_connect_cb notify_connect, unsigned int broadcast) |
Create command. More... | |
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log (kind, __VA_ARGS__) |
Generic logging shortcut.
Definition at line 38 of file transport_api_cmd_start_peer.c.
|
static |
Function to start the retrieval task to retrieve the hello of this peer from the peerstore.
Definition at line 82 of file transport_api_cmd_start_peer.c.
References GNUNET_PEERSTORE_iteration_start(), GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY, hello_iter_cb(), GNUNET_TESTING_StartPeerState::id, GNUNET_TESTING_StartPeerState::ph, GNUNET_TESTING_StartPeerState::pic, and GNUNET_TESTING_StartPeerState::rh_task.
Referenced by hello_iter_cb(), and start_peer_run().
|
static |
Callback delivering the hello of this peer from peerstore.
Definition at line 50 of file transport_api_cmd_start_peer.c.
References GNUNET_TESTING_StartPeerState::ac, GNUNET_ERROR_TYPE_DEBUG, GNUNET_malloc, GNUNET_PEERSTORE_iteration_stop(), GNUNET_SCHEDULER_add_now(), GNUNET_TESTING_async_finish(), GNUNET_TESTING_StartPeerState::hello, GNUNET_TESTING_StartPeerState::hello_size, LOG, GNUNET_TESTING_StartPeerState::pic, record(), retrieve_hello(), and GNUNET_TESTING_StartPeerState::rh_task.
Referenced by retrieve_hello().
|
static |
Disconnect callback for the connection to the core service.
Definition at line 101 of file transport_api_cmd_start_peer.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_TESTING_StartPeerState::id, LOG, GNUNET_TESTING_StartPeerState::no, and GNUNET_TESTING_StartPeerState::peer.
Referenced by start_peer_run().
|
static |
Connect callback for the connection to the core service.
Definition at line 121 of file transport_api_cmd_start_peer.c.
References GNUNET_TESTING_StartPeerState::ac, GNUNET_TESTING_StartPeerState::connected_peers_map, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multishortmap_put(), GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_i2s(), GNUNET_new, GNUNET_TESTING_StartPeerState::id, GNUNET_TESTING_AsyncContext::is, key, LOG, mq, GNUNET_TESTING_StartPeerState::no, GNUNET_TESTING_StartPeerState::notify_connect, GNUNET_PeerIdentity::public_key, and ret.
Referenced by GNUNET_TRANSPORT_cmd_start_peer(), and start_peer_run().
|
static |
The run method of this cmd will start all services of a peer to test the transport service.
Definition at line 168 of file transport_api_cmd_start_peer.c.
References GNUNET_TESTING_StartPeerState::ah, GNUNET_TESTING_StartPeerState::broadcast, GNUNET_TESTING_StartPeerState::cfg, GNUNET_TESTING_StartPeerState::cfgname, dummy, GNUNET_asprintf(), GNUNET_assert, GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_load(), GNUNET_CONFIGURATION_set_value_string(), GNUNET_DISK_file_test(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_i2s_full(), GNUNET_NO, GNUNET_OK, GNUNET_PEERSTORE_connect(), GNUNET_SCHEDULER_add_now(), GNUNET_SYSERR, GNUNET_TESTING_interpreter_fail(), GNUNET_TESTING_interpreter_lookup_command(), GNUNET_TRANSPORT_application_init(), GNUNET_TRANSPORT_core_connect(), GNUNET_YES, GNUNET_TESTING_StartPeerState::handlers, GNUNET_TESTING_StartPeerState::id, is, LOG, GNUNET_TESTING_StartPeerState::no, GNUNET_TESTING_StartPeerState::node_ip, notify_connect(), notify_disconnect(), GNUNET_TESTING_StartPeerState::peer, GNUNET_TESTING_StartPeerState::ph, retrieve_hello(), GNUNET_TESTING_StartPeerState::rh_task, GNUNET_TESTING_StartPeerState::system_label, GNUNET_TESTING_StartPeerState::th, and GNUNET_TESTING_StartPeerState::tl_system.
Referenced by GNUNET_TRANSPORT_cmd_start_peer().
|
static |
The cleanup function of this cmd frees resources the cmd allocated.
Definition at line 379 of file transport_api_cmd_start_peer.c.
References GNUNET_TESTING_StartPeerState::cfgname, GNUNET_TESTING_StartPeerState::connected_peers_map, GNUNET_free, GNUNET_TESTING_StartPeerState::handlers, GNUNET_TESTING_StartPeerState::hello, GNUNET_TESTING_StartPeerState::node_ip, and GNUNET_TESTING_StartPeerState::system_label.
Referenced by GNUNET_TRANSPORT_cmd_start_peer().
|
static |
This function prepares an array with traits.
Definition at line 408 of file transport_api_cmd_start_peer.c.
References ah, GNUNET_TESTING_StartPeerState::ah, GNUNET_TESTING_StartPeerState::connected_peers_map, GNUNET_TESTING_get_trait(), GNUNET_TESTING_trait_end(), GNUNET_TRANSPORT_TESTING_make_trait_application_handle(), GNUNET_TRANSPORT_TESTING_make_trait_broadcast(), GNUNET_TRANSPORT_TESTING_make_trait_connected_peers_map(), GNUNET_TRANSPORT_TESTING_make_trait_hello(), GNUNET_TRANSPORT_TESTING_make_trait_hello_size(), GNUNET_TRANSPORT_TESTING_make_trait_peer_id(), GNUNET_TRANSPORT_TESTING_make_trait_state(), GNUNET_TESTING_StartPeerState::hello, GNUNET_TESTING_StartPeerState::hello_size, GNUNET_TESTING_StartPeerState::id, GNUNET_TESTING_Trait::index, ret, and traits().
Referenced by GNUNET_TRANSPORT_cmd_start_peer().
struct GNUNET_TESTING_Command GNUNET_TRANSPORT_cmd_start_peer | ( | const char * | label, |
const char * | system_label, | ||
uint32_t | no, | ||
const char * | node_ip, | ||
struct GNUNET_MQ_MessageHandler * | handlers, | ||
const char * | cfgname, | ||
GNUNET_TRANSPORT_notify_connect_cb | notify_connect, | ||
unsigned int | broadcast | ||
) |
Create command.
label | name for command. |
system_label | Label of the cmd to setup a test environment. |
no | Decimal number representing the last byte of the IP address of this peer. |
node_ip | The IP address of this node. |
handlers | Handler for messages received by this peer. |
cfgname | Configuration file name for this peer. |
notify_connect | Method which will be called, when a peer connects. |
broadcast | Flag indicating, if broadcast should be switched on. |
Definition at line 444 of file transport_api_cmd_start_peer.c.
References GNUNET_TESTING_StartPeerState::ac, GNUNET_TESTING_StartPeerState::broadcast, GNUNET_TESTING_StartPeerState::cfgname, GNUNET_TESTING_StartPeerState::connected_peers_map, GNUNET_CONTAINER_multishortmap_create(), GNUNET_memcpy, GNUNET_new, GNUNET_new_array, GNUNET_NO, GNUNET_strdup, GNUNET_TESTING_command_new_ac(), handlers, GNUNET_TESTING_StartPeerState::handlers, GNUNET_TESTING_StartPeerState::no, GNUNET_TESTING_StartPeerState::node_ip, GNUNET_TESTING_StartPeerState::notify_connect, notify_connect(), start_peer_cleanup(), start_peer_run(), start_peer_traits(), and GNUNET_TESTING_StartPeerState::system_label.