#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_iterate(), GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY, hello_iter_cb(), StartPeerState::id, StartPeerState::ph, StartPeerState::pic, and 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 StartPeerState::ac, GNUNET_ERROR_TYPE_DEBUG, GNUNET_malloc, GNUNET_PEERSTORE_iterate_cancel(), GNUNET_SCHEDULER_add_now(), GNUNET_TESTING_async_finish(), StartPeerState::hello, StartPeerState::hello_size, LOG, StartPeerState::pic, record(), retrieve_hello(), and 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(), StartPeerState::id, LOG, StartPeerState::no, and 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 StartPeerState::ac, 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, StartPeerState::id, GNUNET_TESTING_AsyncContext::is, key, LOG, mq, StartPeerState::no, StartPeerState::notify_connect, peer, GNUNET_PeerIdentity::public_key, and ret.
Referenced by 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 StartPeerState::ah, StartPeerState::broadcast, StartPeerState::cfg, 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_configuration_create(), GNUNET_TESTING_get_trait_test_system(), GNUNET_TESTING_interpreter_fail(), GNUNET_TESTING_interpreter_lookup_command(), GNUNET_TESTING_peer_configure(), GNUNET_TESTING_peer_get_identity(), GNUNET_TESTING_peer_start(), GNUNET_TRANSPORT_application_init(), GNUNET_TRANSPORT_core_connect(), GNUNET_YES, StartPeerState::handlers, StartPeerState::id, is, LOG, StartPeerState::no, StartPeerState::node_ip, notify_connect(), notify_disconnect(), StartPeerState::peer, StartPeerState::ph, retrieve_hello(), StartPeerState::rh_task, StartPeerState::system_label, StartPeerState::th, and StartPeerState::tl_system.
|
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 StartPeerState::cfgname, StartPeerState::connected_peers_map, GNUNET_free, StartPeerState::handlers, StartPeerState::hello, StartPeerState::node_ip, and StartPeerState::system_label.
|
static |
This function prepares an array with traits.
Definition at line 408 of file transport_api_cmd_start_peer.c.
References ah, StartPeerState::ah, StartPeerState::connected_peers_map, GNUNET_TESTING_get_trait(), GNUNET_TESTING_trait_end(), GNUNET_TRANSPORT_make_trait_application_handle(), GNUNET_TRANSPORT_make_trait_broadcast(), GNUNET_TRANSPORT_make_trait_connected_peers_map(), GNUNET_TRANSPORT_make_trait_hello(), GNUNET_TRANSPORT_make_trait_hello_size(), GNUNET_TRANSPORT_make_trait_peer_id(), GNUNET_TRANSPORT_make_trait_state(), StartPeerState::hello, StartPeerState::hello_size, StartPeerState::id, GNUNET_TESTING_Trait::index, and ret.
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 408 of file transport_api_cmd_start_peer.c.