36#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
38#define BASE_DIR "testdir"
40#define TOPOLOGY_CONFIG "test_transport_simple_send_topo.conf"
42#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
44#define MAX_RECEIVED 1000
46#define MESSAGE_SIZE 65000
118 num = ntohl (message->
num);
133 "time traveled init %s\n",
146 "time traveld mean zero\n");
166 "time traveled: %llu\n",
169 "mean time traveled: %s %llu messages received with message number %u\n",
178 "time traveled failed\n");
185 "time traveled finish\n");
189 "time traveled end\n");
190 GNUNET_TRANSPORT_core_receive_continue (
ch, peer);
194struct GNUNET_TESTING_BarrierList*
197 struct GNUNET_TESTING_BarrierList*barriers;
198 struct GNUNET_TESTING_BarrierListEntry *ble;
200 barriers =
GNUNET_new (
struct GNUNET_TESTING_BarrierList);
201 ble =
GNUNET_new (
struct GNUNET_TESTING_BarrierListEntry);
202 ble->barrier_name =
"ready-to-connect";
203 ble->expected_reaches = 1;
208 ble =
GNUNET_new (
struct GNUNET_TESTING_BarrierListEntry);
209 ble->barrier_name =
"test-case-finished";
210 ble->expected_reaches = 1;
231 "Local test exits with status %d\n",
234 ts->finished_cb (rv);
255 GNUNET_TRANSPORT_TESTING_get_trait_connect_peer_state (cmd,
284 const char *router_ip,
289 const char *topology_data,
296 unsigned int local_m_int;
300 unsigned int sscanf_ret = 0;
313 topology = GNUNET_TESTING_get_topo_from_file (topology_data);
316 topology = GNUNET_TESTING_get_topo_from_string (topology_data);
321 sscanf_ret = sscanf (
m,
"%u", &m_int);
328 sscanf_ret = sscanf (n,
"%u", &n_int);
335 sscanf_ret = sscanf (local_m,
"%u", &local_m_int);
345 num = (n_int - 1) * local_m_int + m_int + topology->
nodes_x;
347 block_send = GNUNET_TESTING_cmd_block_until_external_trigger (
349 block_receive = GNUNET_TESTING_cmd_block_until_external_trigger (
359 "local-test-prepared",
364 "test_transport_api_tcp_node1.conf");
367 "plugin cfgname: %s\n",
399 GNUNET_TESTING_cmd_system_create (
"system-create",
418 "test-case-finished",
425 GNUNET_TESTING_cmd_system_destroy (
"system-destroy",
struct GNUNET_MQ_MessageHandlers handlers[]
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
static int ret
Final status code.
static struct GNUNET_CADET_Channel * ch
Channel handle.
static void write_message(const struct GNUNET_MessageHeader *message)
Callback to write a message to the parent process.
static void finished_cb(void *cls, enum GNUNET_GenericReturnValue rv)
static struct VoipCommand commands[]
List of supported commands.
void GNUNET_TESTING_async_finish(struct GNUNET_TESTING_AsyncContext *ac)
The asynchronous command of ac has finished.
struct GNUNET_TESTING_Interpreter * GNUNET_TESTING_run(const struct GNUNET_TESTING_Command *commands, struct GNUNET_TIME_Relative timeout, GNUNET_TESTING_ResultCallback rc, void *rc_cls)
Run the testsuite.
const struct GNUNET_TESTING_Command * GNUNET_TESTING_interpreter_lookup_command(struct GNUNET_TESTING_Interpreter *is, const char *label)
Lookup command by label.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_end(void)
Create command array terminator.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_barrier_reached(const char *label, const char *barrier_label)
If this command is executed the the process is signaling the master process that it reached a barrier...
enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_state(const struct GNUNET_TESTING_Command *cmd, const struct GNUNET_TESTING_StartPeerState **ret)
Bandwidth allocation API for applications to interact with.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
void * GNUNET_CONTAINER_multipeermap_get(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Given a key find a value in the map matching the key.
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY
There must only be one value per key; storing a value should fail if a value under the same key alrea...
#define GNUNET_log(kind,...)
GNUNET_GenericReturnValue
Named constants for return values.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
enum GNUNET_GenericReturnValue GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a)
Convert absolute time from network byte order.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_add(struct GNUNET_TIME_Relative a1, struct GNUNET_TIME_Relative a2)
Add relative times together.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_divide(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Divide relative time by a given factor.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_difference(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Absolute end)
Compute the time difference between the given start and end times.
enum GNUNET_GenericReturnValue read_file(char const *const filename, char **buffer)
Internal representation of the hash map.
Message handler for a specific message type.
The identity of the host (wraps the signing key of the peer).
State each asynchronous command must have in its closure.
enum GNUNET_GenericReturnValue finished
Indication if the command finished (GNUNET_OK).
A command to be run by the interpreter.
void * cls
Closure for all commands with command-specific context information.
Global state of the interpreter, used by a command to access information about other commands.
Topology of our netjail setup.
unsigned int nodes_x
Number of global known nodes.
The plugin API every test case plugin has to implement.
void * cls
Closure to pass to start_testcase.
struct GNUNET_TESTING_Interpreter *(* start_testcase)(void *cls, const char *topology_data, uint32_t barrier_count, const struct GNUNET_ShortHashCode *barriers, GNUNET_TESTING_cmd_helper_write_cb write_message, GNUNET_TESTING_ResultCallback finish_cb, void *finish_cb_cls)
Function to be implemented for each test case plugin which starts the test case on a netjail node.
Handle for a peer controlled via ARM.
struct GNUNET_TESTING_AsyncContext ac
Context for our asynchronous completion.
struct GNUNET_TESTING_Peer * peer
struct GNUNET_TESTING_Peer returned by GNUNET_TESTING_peer_configure.
struct GNUNET_TRANSPORT_CoreHandle * th
Peer's transport service handle.
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.
Handle for the transport service (includes all of the state for the transport service).
unsigned long long num_received
Number of received messages from sender.
struct GNUNET_TIME_Absolute time_first
Time the first message was send.
struct GNUNET_TIME_Relative mean_time
Sample mean time the message traveled.
char * cfgname
The name for the configuration file of the specific node.
char * testdir
The name for a specific test environment directory.
struct GNUNET_TESTING_NetjailTopology * topology
The complete topology information.
void(* GNUNET_TESTING_cmd_helper_write_cb)(const struct GNUNET_MessageHeader *message)
Callback function to write messages from the helper process running on a netjail node to the master p...
void GNUNET_TESTING_free_topology(struct GNUNET_TESTING_NetjailTopology *topology)
Deallocate memory of the struct GNUNET_TESTING_NetjailTopology.
struct GNUNET_TESTING_Command GNUNET_TRANSPORT_cmd_send_simple_performance(const char *label, const char *start_peer_label, const char *create_label, uint32_t num, int size, int max_send, struct GNUNET_TESTING_NetjailTopology *topology)
struct GNUNET_TESTING_Command GNUNET_TRANSPORT_cmd_stop_peer(const char *label, const char *start_label)
Create command.
struct GNUNET_TESTING_Command GNUNET_TRANSPORT_cmd_connect_peers(const char *label, const char *start_peer_label, const char *create_label, uint32_t num, struct GNUNET_TESTING_NetjailTopology *topology, unsigned int additional_connects, unsigned int wait_for_connect)
Create command.
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.
#define GNUNET_TRANSPORT_TESTING_SIMPLE_PERFORMANCE_MTYPE
Message type used by #().