GNUnet  0.10.x
Data Structures | Functions | Variables
ats-testing.c File Reference

ats testing library: setup topology solvers More...

#include "ats-testing.h"
Include dependency graph for ats-testing.c:

Go to the source code of this file.

Data Structures

struct  TestbedConnectOperation
 Connect peers with testbed. More...
 

Functions

static void do_shutdown (void *cls)
 Shutdown nicely. More...
 
static struct BenchmarkPartnerfind_partner (struct BenchmarkPeer *me, const struct GNUNET_PeerIdentity *peer)
 
static struct BenchmarkPeerfind_peer (const struct GNUNET_PeerIdentity *peer)
 
static void * comm_connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
 Method called whenever a given peer connects. More...
 
static void comm_disconnect_cb (void *cls, const struct GNUNET_PeerIdentity *peer, void *internal_cls)
 
static void handle_pong (void *cls, const struct TestMessage *message)
 
static void handle_ping (void *cls, const struct TestMessage *message)
 
static void * transport_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
 
static void transport_disconnect_adapter (void *cls, void *op_result)
 
static void * core_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
 
static void core_disconnect_adapter (void *cls, void *op_result)
 
static void connect_completion_callback (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
 
static void do_connect_peers (void *cls)
 
static void comm_connect_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg)
 
static void do_comm_connect (void *cls)
 
static void ats_performance_info_cb (void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *ats_prop)
 
static void * ats_perf_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
 
static void ats_perf_disconnect_adapter (void *cls, void *op_result)
 
static void ats_connect_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg)
 
static void do_connect_ats (void *cls)
 
static void peerinformation_cb (void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, const char *emsg)
 
static void main_run (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers_, unsigned int links_succeeded, unsigned int links_failed)
 Signature of a main function for a testcase. More...
 
static void controller_event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
 Controller event callback. More...
 
struct BenchmarkPeerGNUNET_ATS_TEST_get_peer (int src)
 Topology related functions. More...
 
struct BenchmarkPartnerGNUNET_ATS_TEST_get_partner (int src, int dest)
 
void GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file, unsigned int num_slaves, unsigned int num_masters, int test_core, GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb, void *done_cb_cls, GNUNET_ATS_AddressInformationCallback log_request_cb)
 Create a topology for ats testing. More...
 
void GNUNET_ATS_TEST_shutdown_topology (void)
 Shutdown topology. More...
 

Variables

struct GNUNET_CONFIGURATION_Handlecfg
 Handle to our configuration. More...
 
struct GNUNET_ATS_TEST_Topologytop
 

Detailed Description

ats testing library: setup topology solvers

Author
Christian Grothoff
Matthias Wachs

Definition in file ats-testing.c.

Function Documentation

◆ do_shutdown()

static void do_shutdown ( void *  cls)
static

Shutdown nicely.

Parameters
clsNULL

Definition at line 61 of file ats-testing.c.

References BenchmarkPeer::ats_perf_op, BenchmarkPeer::ats_task, BenchmarkState::benchmarking, BenchmarkPeer::comm_op, TestbedConnectOperation::connect_op, BenchmarkPeer::core_connect_ops, GNUNET_ATS_TEST_generate_traffic_stop_all(), GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_free_non_null, GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_SCHEDULER_shutdown(), GNUNET_TESTBED_operation_done(), GNUNET_ATS_TEST_Topology::mps, GNUNET_ATS_TEST_Topology::num_masters, BenchmarkPeer::num_partners, GNUNET_ATS_TEST_Topology::num_slaves, p, BenchmarkPeer::partners, BenchmarkPeer::peer_id_op, GNUNET_ATS_TEST_Topology::sps, and GNUNET_ATS_TEST_Topology::state.

Referenced by main_run().

62 {
63  int c_m;
64  int c_s;
65  int c_op;
66  struct BenchmarkPeer *p;
67 
69 
71  "Benchmarking done\n");
72 
74 
75  for (c_m = 0; c_m < top->num_masters; c_m++)
76  {
77  p = &top->mps[c_m];
78  if (NULL != top->mps[c_m].peer_id_op)
79  {
81  p->peer_id_op = NULL;
82  }
83 
84  if (NULL != p->ats_task)
86  p->ats_task = NULL;
87 
88  for (c_op = 0; c_op < p->num_partners; c_op++)
89  {
90  if ((NULL != p->core_connect_ops) &&
91  (NULL != p->core_connect_ops[c_op].connect_op))
92  {
94  "Failed to connect peer 0 and %u\n",
95  c_op);
97  p->core_connect_ops[c_op].connect_op = NULL;
98  }
99  }
100 
101  if (NULL != p->ats_perf_op)
102  {
104  p->ats_perf_op = NULL;
105  }
106 
107  if (NULL != p->comm_op)
108  {
110  p->comm_op = NULL;
111  }
113  GNUNET_free(p->partners);
114  p->partners = NULL;
115  }
116 
117  for (c_s = 0; c_s < top->num_slaves; c_s++)
118  {
119  p = &top->sps[c_s];
120  if (NULL != p->peer_id_op)
121  {
123  p->peer_id_op = NULL;
124  }
125  if (NULL != p->ats_perf_op)
126  {
128  p->ats_perf_op = NULL;
129  }
130  if (NULL != p->comm_op)
131  {
133  p->comm_op = NULL;
134  }
135  GNUNET_free(p->partners);
136  p->partners = NULL;
137  }
139  GNUNET_free(top);
140  top = NULL;
141 }
struct GNUNET_TESTBED_Operation * comm_op
Testbed operation to connect to core.
Definition: ats-testing.h:143
struct GNUNET_TESTBED_Operation * peer_id_op
Testbed operation to get peer information.
Definition: ats-testing.h:133
struct GNUNET_TESTBED_Operation * ats_perf_op
Testbed operation to connect to ATS performance service.
Definition: ats-testing.h:138
struct BenchmarkPartner * partners
Array of partners with num_slaves entries (if master) or num_master entries (if slave) ...
Definition: ats-testing.h:188
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:517
int num_partners
Number of partners.
Definition: ats-testing.h:193
int benchmarking
Are we connected to CORE service of all peers: GNUNET_YES/NO.
Definition: ats-testing.h:380
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
Information we track for a peer in the testbed.
Definition: ats-testing.h:109
struct BenchmarkState state
Benchmark state.
Definition: ats-testing.h:453
void GNUNET_TESTBED_operation_done(struct GNUNET_TESTBED_Operation *operation)
This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) f...
Definition: testbed_api.c:2037
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:433
struct BenchmarkPeer * sps
Array of slave peers.
Definition: ats-testing.h:438
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:428
struct GNUNET_SCHEDULER_Task * ats_task
Masters only Progress task.
Definition: ats-testing.h:176
#define GNUNET_log(kind,...)
void GNUNET_ATS_TEST_generate_traffic_stop_all()
Stop all traffic generators.
struct TestbedConnectOperation * core_connect_ops
Masters only: Testbed connect operations to connect masters to slaves.
Definition: ats-testing.h:154
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
struct GNUNET_TESTBED_Operation * connect_op
Testbed operation to connect peers.
Definition: ats-testing.c:47
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:956
Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_partner()

static struct BenchmarkPartner* find_partner ( struct BenchmarkPeer me,
const struct GNUNET_PeerIdentity peer 
)
static

Definition at line 145 of file ats-testing.c.

References BenchmarkPartner::dest, GNUNET_memcmp, BenchmarkPeer::id, BenchmarkPeer::num_partners, and BenchmarkPeer::partners.

Referenced by ats_performance_info_cb(), and comm_connect_cb().

147 {
148  int c_m;
149 
150  for (c_m = 0; c_m < me->num_partners; c_m++)
151  {
152  /* Find a partner with other as destination */
153  if (0 == GNUNET_memcmp(peer,
154  &me->partners[c_m].dest->id))
155  {
156  return &me->partners[c_m];
157  }
158  }
159 
160  return NULL;
161 }
struct BenchmarkPartner * partners
Array of partners with num_slaves entries (if master) or num_master entries (if slave) ...
Definition: ats-testing.h:188
int num_partners
Number of partners.
Definition: ats-testing.h:193
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
struct BenchmarkPeer * dest
The partner peer.
Definition: ats-testing.h:279
struct GNUNET_PeerIdentity id
Peer ID.
Definition: ats-testing.h:128
Here is the caller graph for this function:

◆ find_peer()

static struct BenchmarkPeer* find_peer ( const struct GNUNET_PeerIdentity peer)
static

Definition at line 165 of file ats-testing.c.

References GNUNET_memcmp, BenchmarkPeer::id, GNUNET_ATS_TEST_Topology::mps, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, and GNUNET_ATS_TEST_Topology::sps.

Referenced by comm_connect_cb().

166 {
167  int c_p;
168 
169  for (c_p = 0; c_p < top->num_masters; c_p++)
170  {
171  if (0 == GNUNET_memcmp(&top->mps[c_p].id,
172  peer))
173  return &top->mps[c_p];
174  }
175 
176  for (c_p = 0; c_p < top->num_slaves; c_p++)
177  {
178  if (0 == GNUNET_memcmp(&top->sps[c_p].id,
179  peer))
180  return &top->sps[c_p];
181  }
182  return NULL;
183 }
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:433
struct BenchmarkPeer * sps
Array of slave peers.
Definition: ats-testing.h:438
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:428
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
struct GNUNET_PeerIdentity id
Peer ID.
Definition: ats-testing.h:128
Here is the caller graph for this function:

◆ comm_connect_cb()

static void* comm_connect_cb ( void *  cls,
const struct GNUNET_PeerIdentity peer,
struct GNUNET_MQ_Handle mq 
)
static

Method called whenever a given peer connects.

Parameters
clsclosure
peerpeer identity this notification is about
mqqueue to use to send messages to peer
Returns
the struct BenchmarkPartner of peer

Definition at line 195 of file ats-testing.c.

References BenchmarkState::connected_CORE, BenchmarkPeer::core_connections, BenchmarkPeer::core_slave_connections, GNUNET_ATS_TEST_Topology::done_cb, GNUNET_ATS_TEST_Topology::done_cb_cls, find_partner(), find_peer(), GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_strdup, GNUNET_YES, BenchmarkPeer::id, id, BenchmarkPeer::master, me, GNUNET_ATS_TEST_Topology::mps, mq, BenchmarkPartner::mq, BenchmarkPeer::no, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, p, GNUNET_ATS_TEST_Topology::sps, and GNUNET_ATS_TEST_Topology::state.

Referenced by core_connect_adapter(), and transport_connect_adapter().

198 {
199  struct BenchmarkPeer *me = cls;
200  struct BenchmarkPeer *remote;
201  struct BenchmarkPartner *p;
202  char *id;
203  int c;
204  int completed;
205 
206  remote = find_peer(peer);
207  if (NULL == remote)
208  {
210  "Unknown peer connected: `%s'\n",
211  GNUNET_i2s(peer));
212  GNUNET_break(0);
213  return NULL;
214  }
215 
216  id = GNUNET_strdup(GNUNET_i2s(&me->id));
218  "%s [%u] `%s' connected to %s [%u] %s\n",
219  (me->master == GNUNET_YES) ? "Master" : "Slave",
220  me->no,
221  id,
222  (remote->master == GNUNET_YES) ? "Master" : "Slave",
223  remote->no,
224  GNUNET_i2s(peer));
225 
226  me->core_connections++;
227  if ((GNUNET_YES == me->master) &&
228  (GNUNET_NO == remote->master) &&
230  {
232 
234  {
236  "Master [%u] connected all slaves\n",
237  me->no);
238  }
239  completed = GNUNET_YES;
240  for (c = 0; c < top->num_masters; c++)
241  {
243  completed = GNUNET_NO;
244  }
245  if (GNUNET_YES == completed)
246  {
248  "All master peers connected all slave peers\n");
250  /* Notify about setup done */
251  if (NULL != top->done_cb)
253  top->mps,
254  top->sps);
255  }
256  }
257  GNUNET_free(id);
258  p = find_partner(me,
259  peer);
260  if (NULL != p)
261  p->mq = mq;
262  return p;
263 }
static GNUNET_NETWORK_STRUCT_END struct GNUNET_PeerIdentity me
Our own peer identity.
int connected_CORE
Are we connected to all slave peers on CORE level: GNUNET_YES/NO.
Definition: ats-testing.h:375
static struct BenchmarkPartner * find_partner(struct BenchmarkPeer *me, const struct GNUNET_PeerIdentity *peer)
Definition: ats-testing.c:145
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
#define GNUNET_NO
Definition: gnunet_common.h:78
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
int core_connections
Number of core connections.
Definition: ats-testing.h:198
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
int no
Unique identifier.
Definition: ats-testing.h:118
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
Information we track for a peer in the testbed.
Definition: ats-testing.h:109
struct BenchmarkState state
Benchmark state.
Definition: ats-testing.h:453
int master
Is this peer a measter: GNUNET_YES/GNUNET_NO.
Definition: ats-testing.h:123
Information about a benchmarking partner.
Definition: ats-testing.h:270
int core_slave_connections
Masters only: Number of connections to slave peers.
Definition: ats-testing.h:204
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:433
struct BenchmarkPeer * sps
Array of slave peers.
Definition: ats-testing.h:438
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:428
struct GNUNET_MQ_Handle * mq
Message queue handle.
Definition: ats-testing.h:284
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
#define GNUNET_log(kind,...)
#define GNUNET_YES
Definition: gnunet_common.h:77
GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb
Definition: ats-testing.h:455
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
struct GNUNET_PeerIdentity id
Peer ID.
Definition: ats-testing.h:128
#define GNUNET_free(ptr)
Wrapper around free.
static struct BenchmarkPeer * find_peer(const struct GNUNET_PeerIdentity *peer)
Definition: ats-testing.c:165
Here is the call graph for this function:
Here is the caller graph for this function:

◆ comm_disconnect_cb()

static void comm_disconnect_cb ( void *  cls,
const struct GNUNET_PeerIdentity peer,
void *  internal_cls 
)
static
Parameters
clsthis peer
peerid of disconnecting peer
internal_clsthe struct BenchmarkPartner of peer

Definition at line 272 of file ats-testing.c.

References BenchmarkState::benchmarking, BenchmarkPeer::core_connections, BenchmarkPartner::dest, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_strdup, GNUNET_YES, BenchmarkPeer::id, id, BenchmarkPeer::master, me, p, and GNUNET_ATS_TEST_Topology::state.

Referenced by core_connect_adapter(), and transport_connect_adapter().

275 {
276  struct BenchmarkPeer *me = cls;
277  struct BenchmarkPartner *p = internal_cls;
278  char *id;
279 
280  if (NULL == p)
281  return;
282 
283  id = GNUNET_strdup(GNUNET_i2s(&me->id));
285  "%s disconnected from %s\n",
286  id,
287  GNUNET_i2s(peer));
289  me->core_connections--;
290 
291  if ((GNUNET_YES == top->state.benchmarking) &&
292  ((GNUNET_YES == me->master) ||
293  (GNUNET_YES == p->dest->master)))
294  {
296  "%s disconnected from %s while benchmarking\n",
297  id,
298  GNUNET_i2s(peer));
299  }
300  GNUNET_free(id);
301 }
static GNUNET_NETWORK_STRUCT_END struct GNUNET_PeerIdentity me
Our own peer identity.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
int core_connections
Number of core connections.
Definition: ats-testing.h:198
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
int benchmarking
Are we connected to CORE service of all peers: GNUNET_YES/NO.
Definition: ats-testing.h:380
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
Information we track for a peer in the testbed.
Definition: ats-testing.h:109
struct BenchmarkState state
Benchmark state.
Definition: ats-testing.h:453
int master
Is this peer a measter: GNUNET_YES/GNUNET_NO.
Definition: ats-testing.h:123
Information about a benchmarking partner.
Definition: ats-testing.h:270
#define GNUNET_log(kind,...)
#define GNUNET_YES
Definition: gnunet_common.h:77
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
struct BenchmarkPeer * dest
The partner peer.
Definition: ats-testing.h:279
struct GNUNET_PeerIdentity id
Peer ID.
Definition: ats-testing.h:128
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_pong()

static void handle_pong ( void *  cls,
const struct TestMessage message 
)
static

Definition at line 305 of file ats-testing.c.

References GNUNET_ATS_TEST_traffic_handle_pong(), and p.

307 {
308  struct BenchmarkPartner *p = cls;
309 
311 }
void GNUNET_ATS_TEST_traffic_handle_pong(struct BenchmarkPartner *p)
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
Information about a benchmarking partner.
Definition: ats-testing.h:270
Here is the call graph for this function:

◆ handle_ping()

static void handle_ping ( void *  cls,
const struct TestMessage message 
)
static

Definition at line 315 of file ats-testing.c.

References GNUNET_ATS_TEST_traffic_handle_ping(), and p.

317 {
318  struct BenchmarkPartner *p = cls;
319 
321 }
void GNUNET_ATS_TEST_traffic_handle_ping(struct BenchmarkPartner *p)
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
Information about a benchmarking partner.
Definition: ats-testing.h:270
Here is the call graph for this function:

◆ transport_connect_adapter()

static void* transport_connect_adapter ( void *  cls,
const struct GNUNET_CONFIGURATION_Handle cfg 
)
static

Definition at line 325 of file ats-testing.c.

References comm_connect_cb(), comm_disconnect_cb(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_TRANSPORT_core_connect(), BenchmarkPeer::id, me, ping(), pong(), TEST_MESSAGE_TYPE_PING, TEST_MESSAGE_TYPE_PONG, and BenchmarkPeer::th.

Referenced by do_comm_connect().

327 {
328  struct BenchmarkPeer *me = cls;
332  struct TestMessage,
333  me),
336  struct TestMessage,
337  me),
339  };
340 
342  &me->id,
343  handlers,
344  me,
347  NULL);
348  if (NULL == me->th)
350  "Failed to create transport connection \n");
351  return me->th;
352 }
static GNUNET_NETWORK_STRUCT_END struct GNUNET_PeerIdentity me
Our own peer identity.
static void ping(void *cls)
Send a ping to destination.
#define TEST_MESSAGE_TYPE_PONG
Message type sent as response during traffic generation.
Definition: ats-testing.h:43
static void * comm_connect_cb(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
Method called whenever a given peer connects.
Definition: ats-testing.c:195
struct GNUNET_TRANSPORT_CoreHandle * th
Transport handle.
Definition: ats-testing.h:164
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define TEST_MESSAGE_TYPE_PING
Message type sent for traffic generation.
Definition: ats-testing.h:38
struct GNUNET_TRANSPORT_CoreHandle * GNUNET_TRANSPORT_core_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_PeerIdentity *self, const struct GNUNET_MQ_MessageHandler *handlers, void *cls, GNUNET_TRANSPORT_NotifyConnect nc, GNUNET_TRANSPORT_NotifyDisconnect nd)
Connect to the transport service.
static void comm_disconnect_cb(void *cls, const struct GNUNET_PeerIdentity *peer, void *internal_cls)
Definition: ats-testing.c:272
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
Information we track for a peer in the testbed.
Definition: ats-testing.h:109
Message handler for a specific message type.
static void pong(struct GNUNET_CADET_Channel *channel, const struct CadetPingMessage *ping)
Reply with a pong to origin.
#define GNUNET_log(kind,...)
struct GNUNET_PeerIdentity id
Peer ID.
Definition: ats-testing.h:128
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ transport_disconnect_adapter()

static void transport_disconnect_adapter ( void *  cls,
void *  op_result 
)
static

Definition at line 356 of file ats-testing.c.

References GNUNET_TRANSPORT_core_disconnect(), me, and BenchmarkPeer::th.

Referenced by do_comm_connect().

358 {
359  struct BenchmarkPeer *me = cls;
360 
362  me->th = NULL;
363 }
static GNUNET_NETWORK_STRUCT_END struct GNUNET_PeerIdentity me
Our own peer identity.
struct GNUNET_TRANSPORT_CoreHandle * th
Transport handle.
Definition: ats-testing.h:164
Information we track for a peer in the testbed.
Definition: ats-testing.h:109
void GNUNET_TRANSPORT_core_disconnect(struct GNUNET_TRANSPORT_CoreHandle *handle)
Disconnect from the transport service.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ core_connect_adapter()

static void* core_connect_adapter ( void *  cls,
const struct GNUNET_CONFIGURATION_Handle cfg 
)
static

Definition at line 367 of file ats-testing.c.

References BenchmarkPeer::ch, comm_connect_cb(), comm_disconnect_cb(), GNUNET_CORE_connect(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, me, ping(), pong(), TEST_MESSAGE_TYPE_PING, and TEST_MESSAGE_TYPE_PONG.

Referenced by do_comm_connect().

369 {
370  struct BenchmarkPeer *me = cls;
374  struct TestMessage,
375  me),
378  struct TestMessage,
379  me),
381  };
382 
383  me->ch = GNUNET_CORE_connect(cfg,
384  me,
385  NULL,
388  handlers);
389  if (NULL == me->ch)
391  "Failed to create core connection \n");
392  return me->ch;
393 }
static GNUNET_NETWORK_STRUCT_END struct GNUNET_PeerIdentity me
Our own peer identity.
static void ping(void *cls)
Send a ping to destination.
#define TEST_MESSAGE_TYPE_PONG
Message type sent as response during traffic generation.
Definition: ats-testing.h:43
static void * comm_connect_cb(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
Method called whenever a given peer connects.
Definition: ats-testing.c:195
struct GNUNET_CORE_Handle * ch
Core handle.
Definition: ats-testing.h:159
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define TEST_MESSAGE_TYPE_PING
Message type sent for traffic generation.
Definition: ats-testing.h:38
static void comm_disconnect_cb(void *cls, const struct GNUNET_PeerIdentity *peer, void *internal_cls)
Definition: ats-testing.c:272
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
Information we track for a peer in the testbed.
Definition: ats-testing.h:109
Message handler for a specific message type.
static void pong(struct GNUNET_CADET_Channel *channel, const struct CadetPingMessage *ping)
Reply with a pong to origin.
struct GNUNET_CORE_Handle * GNUNET_CORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, GNUNET_CORE_StartupCallback init, GNUNET_CORE_ConnectEventHandler connects, GNUNET_CORE_DisconnectEventHandler disconnects, const struct GNUNET_MQ_MessageHandler *handlers)
Connect to the core service.
Definition: core_api.c:690
#define GNUNET_log(kind,...)
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ core_disconnect_adapter()

static void core_disconnect_adapter ( void *  cls,
void *  op_result 
)
static

Definition at line 397 of file ats-testing.c.

References BenchmarkPeer::ch, GNUNET_CORE_disconnect(), and me.

Referenced by do_comm_connect().

399 {
400  struct BenchmarkPeer *me = cls;
401 
403  me->ch = NULL;
404 }
static GNUNET_NETWORK_STRUCT_END struct GNUNET_PeerIdentity me
Our own peer identity.
struct GNUNET_CORE_Handle * ch
Core handle.
Definition: ats-testing.h:159
Information we track for a peer in the testbed.
Definition: ats-testing.h:109
void GNUNET_CORE_disconnect(struct GNUNET_CORE_Handle *handle)
Disconnect from the core service.
Definition: core_api.c:728
Here is the call graph for this function:
Here is the caller graph for this function:

◆ connect_completion_callback()

static void connect_completion_callback ( void *  cls,
struct GNUNET_TESTBED_Operation op,
const char *  emsg 
)
static

Definition at line 408 of file ats-testing.c.

References _, TestbedConnectOperation::connect_op, BenchmarkState::connected_PEERS, BenchmarkPeer::core_connect_ops, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_shutdown(), GNUNET_TESTBED_operation_done(), GNUNET_YES, TestbedConnectOperation::master, BenchmarkPeer::no, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, TestbedConnectOperation::slave, and GNUNET_ATS_TEST_Topology::state.

Referenced by do_connect_peers().

411 {
412  struct TestbedConnectOperation *cop = cls;
413  static int ops = 0;
414  int c;
415 
416  if (NULL == emsg)
417  {
419  _("Connected master [%u] with slave [%u]\n"),
420  cop->master->no,
421  cop->slave->no);
422  }
423  else
424  {
426  _("Failed to connect master peer [%u] with slave [%u]\n"),
427  cop->master->no, cop->slave->no);
428  GNUNET_break(0);
430  }
432  ops++;
433  for (c = 0; c < top->num_slaves; c++)
434  {
435  if (cop == &cop->master->core_connect_ops[c])
436  cop->master->core_connect_ops[c].connect_op = NULL;
437  }
438  if (ops == top->num_masters * top->num_slaves)
439  {
441  }
442 }
struct BenchmarkPeer * slave
The benchmarking slave to connect to.
Definition: ats-testing.c:42
struct BenchmarkPeer * master
The benchmarking master initiating this connection.
Definition: ats-testing.c:37
Connect peers with testbed.
Definition: ats-testing.c:33
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:517
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define _(String)
GNU gettext support macro.
Definition: platform.h:181
int no
Unique identifier.
Definition: ats-testing.h:118
struct BenchmarkState state
Benchmark state.
Definition: ats-testing.h:453
void GNUNET_TESTBED_operation_done(struct GNUNET_TESTBED_Operation *operation)
This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) f...
Definition: testbed_api.c:2037
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:433
int connected_PEERS
Are we connected to all peers: GNUNET_YES/NO.
Definition: ats-testing.h:370
#define GNUNET_log(kind,...)
#define GNUNET_YES
Definition: gnunet_common.h:77
struct TestbedConnectOperation * core_connect_ops
Masters only: Testbed connect operations to connect masters to slaves.
Definition: ats-testing.h:154
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
struct GNUNET_TESTBED_Operation * connect_op
Testbed operation to connect peers.
Definition: ats-testing.c:47
Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_connect_peers()

static void do_connect_peers ( void *  cls)
static

Definition at line 446 of file ats-testing.c.

References connect_completion_callback(), TestbedConnectOperation::connect_op, BenchmarkState::connected_ATS_service, BenchmarkState::connected_COMM_service, BenchmarkPeer::core_connect_ops, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_malloc, GNUNET_NO, GNUNET_SCHEDULER_shutdown(), GNUNET_TESTBED_overlay_connect(), TestbedConnectOperation::master, GNUNET_ATS_TEST_Topology::mps, BenchmarkPeer::no, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, p, BenchmarkPeer::peer, TestbedConnectOperation::slave, GNUNET_ATS_TEST_Topology::sps, and GNUNET_ATS_TEST_Topology::state.

Referenced by comm_connect_completion_cb().

447 {
448  int c_m;
449  int c_s;
450  struct BenchmarkPeer *p;
451 
454  return;
455 
457  "Connecting peers on CORE level\n");
458  for (c_m = 0; c_m < top->num_masters; c_m++)
459  {
460  p = &top->mps[c_m];
462  sizeof(struct TestbedConnectOperation));
463 
464  for (c_s = 0; c_s < top->num_slaves; c_s++)
465  {
467  "Connecting master [%u] with slave [%u]\n",
468  p->no,
469  top->sps[c_s].no);
470  p->core_connect_ops[c_s].master = p;
471  p->core_connect_ops[c_s].slave = &top->sps[c_s];
475  &p->core_connect_ops[c_s],
476  top->sps[c_s].peer,
477  p->peer);
478  if (NULL == p->core_connect_ops[c_s].connect_op)
479  {
481  "Could not connect master [%u] and slave [%u]\n",
482  p->no,
483  top->sps[c_s].no);
484  GNUNET_break(0);
486  return;
487  }
488  }
489  }
490 }
struct BenchmarkPeer * slave
The benchmarking slave to connect to.
Definition: ats-testing.c:42
static void connect_completion_callback(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
Definition: ats-testing.c:408
struct BenchmarkPeer * master
The benchmarking master initiating this connection.
Definition: ats-testing.c:37
Connect peers with testbed.
Definition: ats-testing.c:33
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_overlay_connect(void *op_cls, GNUNET_TESTBED_OperationCompletionCallback cb, void *cb_cls, struct GNUNET_TESTBED_Peer *p1, struct GNUNET_TESTBED_Peer *p2)
Both peers must have been started before calling this function.
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
#define GNUNET_NO
Definition: gnunet_common.h:78
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:517
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
int no
Unique identifier.
Definition: ats-testing.h:118
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
Information we track for a peer in the testbed.
Definition: ats-testing.h:109
struct BenchmarkState state
Benchmark state.
Definition: ats-testing.h:453
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:433
struct BenchmarkPeer * sps
Array of slave peers.
Definition: ats-testing.h:438
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:428
#define GNUNET_log(kind,...)
int connected_ATS_service
Are we connected to ATS service of all peers: GNUNET_YES/NO.
Definition: ats-testing.h:360
struct TestbedConnectOperation * core_connect_ops
Masters only: Testbed connect operations to connect masters to slaves.
Definition: ats-testing.h:154
int connected_COMM_service
Are we connected to CORE service of all peers: GNUNET_YES/NO.
Definition: ats-testing.h:365
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
struct GNUNET_TESTBED_Operation * connect_op
Testbed operation to connect peers.
Definition: ats-testing.c:47
struct GNUNET_TESTBED_Peer * peer
Handle with testbed.
Definition: ats-testing.h:113
#define GNUNET_malloc(size)
Wrapper around malloc.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ comm_connect_completion_cb()

static void comm_connect_completion_cb ( void *  cls,
struct GNUNET_TESTBED_Operation op,
void *  ca_result,
const char *  emsg 
)
static

Definition at line 494 of file ats-testing.c.

References BenchmarkState::connected_COMM_service, do_connect_peers(), GNUNET_break, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_shutdown(), GNUNET_YES, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, GNUNET_ATS_TEST_Topology::state, and GNUNET_ATS_TEST_Topology::test_core.

Referenced by do_comm_connect().

498 {
499  static int comm_done = 0;
500 
501  if ((NULL != emsg) || (NULL == ca_result))
502  {
504  "Initialization failed, shutdown\n");
505  GNUNET_break(0);
507  return;
508  }
509  comm_done++;
510 
511  if (comm_done == top->num_slaves + top->num_masters)
512  {
514  "Connected to all %s services\n",
515  (GNUNET_YES == top->test_core) ? "CORE" : "TRANSPORT");
518  NULL);
519  }
520 }
int test_core
Test core (GNUNET_YES) or transport (GNUNET_NO)
Definition: ats-testing.h:398
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:517
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct BenchmarkState state
Benchmark state.
Definition: ats-testing.h:453
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1264
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:433
static void do_connect_peers(void *cls)
Definition: ats-testing.c:446
#define GNUNET_log(kind,...)
#define GNUNET_YES
Definition: gnunet_common.h:77
int connected_COMM_service
Are we connected to CORE service of all peers: GNUNET_YES/NO.
Definition: ats-testing.h:365
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_comm_connect()

static void do_comm_connect ( void *  cls)
static

Definition at line 524 of file ats-testing.c.

References comm_connect_completion_cb(), BenchmarkPeer::comm_op, core_connect_adapter(), core_disconnect_adapter(), GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_TESTBED_service_connect(), GNUNET_YES, GNUNET_ATS_TEST_Topology::mps, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, BenchmarkPeer::peer, GNUNET_ATS_TEST_Topology::sps, GNUNET_ATS_TEST_Topology::test_core, transport_connect_adapter(), and transport_disconnect_adapter().

Referenced by ats_connect_completion_cb().

525 {
526  int c_s;
527  int c_m;
528 
530  "Connecting to all %s services\n",
531  (GNUNET_YES == top->test_core) ? "CORE" : "TRANSPORT");
532  for (c_m = 0; c_m < top->num_masters; c_m++)
533  {
534  if (GNUNET_YES == top->test_core)
535  top->mps[c_m].comm_op
537  top->mps[c_m].peer,
538  "core",
540  NULL,
543  &top->mps[c_m]);
544  else
545  {
546  top->mps[c_m].comm_op
548  top->mps[c_m].peer,
549  "transport",
551  NULL,
554  &top->mps[c_m]);
555  }
556  }
557 
558  for (c_s = 0; c_s < top->num_slaves; c_s++)
559  {
560  if (GNUNET_YES == top->test_core)
561  top->sps[c_s].comm_op
563  top->sps[c_s].peer,
564  "core",
566  NULL,
569  &top->sps[c_s]);
570  else
571  {
572  top->sps[c_s].comm_op
574  top->sps[c_s].peer,
575  "transport",
577  NULL,
580  &top->sps[c_s]);
581  }
582  }
583 }
int test_core
Test core (GNUNET_YES) or transport (GNUNET_NO)
Definition: ats-testing.h:398
struct GNUNET_TESTBED_Operation * comm_op
Testbed operation to connect to core.
Definition: ats-testing.h:143
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_service_connect(void *op_cls, struct GNUNET_TESTBED_Peer *peer, const char *service_name, GNUNET_TESTBED_ServiceConnectCompletionCallback cb, void *cb_cls, GNUNET_TESTBED_ConnectAdapter ca, GNUNET_TESTBED_DisconnectAdapter da, void *cada_cls)
Connect to a service offered by the given peer.
static void * core_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Definition: ats-testing.c:367
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:433
static void comm_connect_completion_cb(void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg)
Definition: ats-testing.c:494
struct BenchmarkPeer * sps
Array of slave peers.
Definition: ats-testing.h:438
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:428
static void * transport_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Definition: ats-testing.c:325
#define GNUNET_log(kind,...)
#define GNUNET_YES
Definition: gnunet_common.h:77
static void core_disconnect_adapter(void *cls, void *op_result)
Definition: ats-testing.c:397
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
struct GNUNET_TESTBED_Peer * peer
Handle with testbed.
Definition: ats-testing.h:113
static void transport_disconnect_adapter(void *cls, void *op_result)
Definition: ats-testing.c:356
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ats_performance_info_cb()

static void ats_performance_info_cb ( void *  cls,
const struct GNUNET_HELLO_Address address,
int  address_active,
struct GNUNET_BANDWIDTH_Value32NBO  bandwidth_out,
struct GNUNET_BANDWIDTH_Value32NBO  bandwidth_in,
const struct GNUNET_ATS_Properties ats_prop 
)
static

Definition at line 587 of file ats-testing.c.

References GNUNET_ATS_TEST_Topology::ats_perf_cb, BenchmarkPartner::bandwidth_in, BenchmarkPartner::bandwidth_out, GNUNET_ATS_Properties::delay, BenchmarkPartner::dest, GNUNET_ATS_Properties::distance, find_partner(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_strdup, GNUNET_YES, BenchmarkPeer::id, BenchmarkPeer::master, me, BenchmarkPartner::me, BenchmarkPeer::no, p, GNUNET_HELLO_Address::peer, peer_id, BenchmarkPartner::props, GNUNET_ATS_Properties::scope, GNUNET_ATS_Properties::utilization_in, GNUNET_ATS_Properties::utilization_out, and GNUNET_BANDWIDTH_Value32NBO::value__.

Referenced by ats_perf_connect_adapter().

593 {
594  struct BenchmarkPeer *me = cls;
595  struct BenchmarkPartner *p;
596  int log;
597  char *peer_id;
598 
599  if (NULL == address)
600  {
602  "Peer %u: ATS Service disconnected!\n",
603  me->no);
604  return;
605  }
606 
607  p = find_partner(me,
608  &address->peer);
609  if (NULL == p)
610  {
611  /* This is not one of my partners
612  * Will happen since the peers will connect to each other due to gossiping
613  */
614  return;
615  }
616  peer_id = GNUNET_strdup(GNUNET_i2s(&me->id));
617 
618  log = GNUNET_NO;
619  if ((p->bandwidth_in != ntohl(bandwidth_in.value__)) ||
620  (p->bandwidth_out != ntohl(bandwidth_out.value__)))
621  log = GNUNET_YES;
622  p->bandwidth_in = ntohl(bandwidth_in.value__);
623  p->bandwidth_out = ntohl(bandwidth_out.value__);
624 
626  "%s [%u] received ATS information: %s\n",
627  (GNUNET_YES == p->me->master) ? "Master" : "Slave",
628  p->me->no,
629  GNUNET_i2s(&p->dest->id));
630 
631  p->props.utilization_out = ats_prop->utilization_out;
632  p->props.utilization_in = ats_prop->utilization_in;
633  p->props.scope = ats_prop->scope;
634  p->props.delay = ats_prop->delay;
635  p->props.distance = ats_prop->distance;
636 
637  if (GNUNET_YES == log)
638  top->ats_perf_cb(cls, address,
639  address_active,
640  bandwidth_out,
641  bandwidth_in,
642  ats_prop);
643  GNUNET_free(peer_id);
644 }
static GNUNET_NETWORK_STRUCT_END struct GNUNET_PeerIdentity me
Our own peer identity.
uint32_t utilization_in
Actual traffic on this connection from the other peer to this peer.
static struct BenchmarkPartner * find_partner(struct BenchmarkPeer *me, const struct GNUNET_PeerIdentity *peer)
Definition: ats-testing.c:145
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
static char * peer_id
Option –peer.
Definition: gnunet-cadet.c:42
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
uint32_t value__
The actual value (bytes per second).
int no
Unique identifier.
Definition: ats-testing.h:118
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
uint32_t bandwidth_in
Bandwidth assigned inbound.
Definition: ats-testing.h:334
Information we track for a peer in the testbed.
Definition: ats-testing.h:109
int master
Is this peer a measter: GNUNET_YES/GNUNET_NO.
Definition: ats-testing.h:123
Information about a benchmarking partner.
Definition: ats-testing.h:270
struct GNUNET_TIME_Relative delay
Delay.
uint32_t bandwidth_out
Bandwidth assigned outbound.
Definition: ats-testing.h:339
struct GNUNET_PeerIdentity peer
For which peer is this an address?
GNUNET_ATS_AddressInformationCallback ats_perf_cb
Definition: ats-testing.h:457
enum GNUNET_NetworkType scope
Which network scope does the respective address belong to? This property does not change...
#define GNUNET_log(kind,...)
#define GNUNET_YES
Definition: gnunet_common.h:77
struct GNUNET_ATS_Properties props
Current ATS properties.
Definition: ats-testing.h:329
struct BenchmarkPeer * me
The peer itself this partner belongs to.
Definition: ats-testing.h:274
unsigned int distance
Distance on network layer (required for distance-vector routing) in hops.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
struct BenchmarkPeer * dest
The partner peer.
Definition: ats-testing.h:279
struct GNUNET_PeerIdentity id
Peer ID.
Definition: ats-testing.h:128
#define GNUNET_free(ptr)
Wrapper around free.
uint32_t utilization_out
Actual traffic on this connection from this peer to the other peer.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ats_perf_connect_adapter()

static void* ats_perf_connect_adapter ( void *  cls,
const struct GNUNET_CONFIGURATION_Handle cfg 
)
static

Definition at line 648 of file ats-testing.c.

References BenchmarkPeer::ats_perf_handle, ats_performance_info_cb(), GNUNET_ATS_performance_init(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, and me.

Referenced by do_connect_ats().

650 {
651  struct BenchmarkPeer *me = cls;
652 
653  me->ats_perf_handle
656  me);
657  if (NULL == me->ats_perf_handle)
659  "Failed to create ATS performance handle \n");
660  return me->ats_perf_handle;
661 }
static GNUNET_NETWORK_STRUCT_END struct GNUNET_PeerIdentity me
Our own peer identity.
static void ats_performance_info_cb(void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *ats_prop)
Definition: ats-testing.c:587
Information we track for a peer in the testbed.
Definition: ats-testing.h:109
struct GNUNET_ATS_PerformanceHandle * ats_perf_handle
ATS performance handle.
Definition: ats-testing.h:148
struct GNUNET_ATS_PerformanceHandle * GNUNET_ATS_performance_init(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ATS_AddressInformationCallback addr_info_cb, void *addr_info_cb_cls)
Get handle to access performance API of the ATS subsystem.
#define GNUNET_log(kind,...)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ats_perf_disconnect_adapter()

static void ats_perf_disconnect_adapter ( void *  cls,
void *  op_result 
)
static

Definition at line 665 of file ats-testing.c.

References BenchmarkPeer::ats_perf_handle, GNUNET_ATS_performance_done(), and me.

Referenced by do_connect_ats().

667 {
668  struct BenchmarkPeer *me = cls;
669 
671  me->ats_perf_handle = NULL;
672 }
static GNUNET_NETWORK_STRUCT_END struct GNUNET_PeerIdentity me
Our own peer identity.
void GNUNET_ATS_performance_done(struct GNUNET_ATS_PerformanceHandle *ph)
Client is done using the ATS performance subsystem, release resources.
Information we track for a peer in the testbed.
Definition: ats-testing.h:109
struct GNUNET_ATS_PerformanceHandle * ats_perf_handle
ATS performance handle.
Definition: ats-testing.h:148
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ats_connect_completion_cb()

static void ats_connect_completion_cb ( void *  cls,
struct GNUNET_TESTBED_Operation op,
void *  ca_result,
const char *  emsg 
)
static

Definition at line 676 of file ats-testing.c.

References BenchmarkState::connected_ATS_service, do_comm_connect(), GNUNET_break, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_shutdown(), GNUNET_YES, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, and GNUNET_ATS_TEST_Topology::state.

Referenced by do_connect_ats().

680 {
681  static int op_done = 0;
682 
683  if ((NULL != emsg) || (NULL == ca_result))
684  {
686  "Initialization failed, shutdown\n");
687  GNUNET_break(0);
689  return;
690  }
691  op_done++;
692  if (op_done == (top->num_masters + top->num_slaves))
693  {
695  "Connected to all ATS services\n");
698  NULL);
699  }
700 }
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:517
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct BenchmarkState state
Benchmark state.
Definition: ats-testing.h:453
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1264
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:433
#define GNUNET_log(kind,...)
int connected_ATS_service
Are we connected to ATS service of all peers: GNUNET_YES/NO.
Definition: ats-testing.h:360
#define GNUNET_YES
Definition: gnunet_common.h:77
static void do_comm_connect(void *cls)
Definition: ats-testing.c:524
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_connect_ats()

static void do_connect_ats ( void *  cls)
static

Definition at line 704 of file ats-testing.c.

References ats_connect_completion_cb(), ats_perf_connect_adapter(), ats_perf_disconnect_adapter(), BenchmarkPeer::ats_perf_op, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_TESTBED_service_connect(), GNUNET_ATS_TEST_Topology::mps, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, BenchmarkPeer::peer, and GNUNET_ATS_TEST_Topology::sps.

Referenced by peerinformation_cb().

705 {
706  int c_m;
707  int c_s;
708 
710  "Connecting to all ATS services\n");
711  for (c_m = 0; c_m < top->num_masters; c_m++)
712  {
713  top->mps[c_m].ats_perf_op
715  top->mps[c_m].peer,
716  "ats",
718  NULL,
721  &top->mps[c_m]);
722  }
723 
724  for (c_s = 0; c_s < top->num_slaves; c_s++)
725  {
726  top->sps[c_s].ats_perf_op
728  top->sps[c_s].peer,
729  "ats",
731  NULL,
734  &top->sps[c_s]);
735  }
736 }
struct GNUNET_TESTBED_Operation * ats_perf_op
Testbed operation to connect to ATS performance service.
Definition: ats-testing.h:138
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_service_connect(void *op_cls, struct GNUNET_TESTBED_Peer *peer, const char *service_name, GNUNET_TESTBED_ServiceConnectCompletionCallback cb, void *cb_cls, GNUNET_TESTBED_ConnectAdapter ca, GNUNET_TESTBED_DisconnectAdapter da, void *cada_cls)
Connect to a service offered by the given peer.
static void * ats_perf_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Definition: ats-testing.c:648
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:433
struct BenchmarkPeer * sps
Array of slave peers.
Definition: ats-testing.h:438
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:428
static void ats_perf_disconnect_adapter(void *cls, void *op_result)
Definition: ats-testing.c:665
#define GNUNET_log(kind,...)
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
struct GNUNET_TESTBED_Peer * peer
Handle with testbed.
Definition: ats-testing.h:113
static void ats_connect_completion_cb(void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg)
Definition: ats-testing.c:676
Here is the call graph for this function:
Here is the caller graph for this function:

◆ peerinformation_cb()

static void peerinformation_cb ( void *  cb_cls,
struct GNUNET_TESTBED_Operation op,
const struct GNUNET_TESTBED_PeerInformation pinfo,
const char *  emsg 
)
static

Definition at line 741 of file ats-testing.c.

References do_connect_ats(), done(), GNUNET_assert, GNUNET_ERROR_TYPE_INFO, GNUNET_i2s(), GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_TESTBED_operation_done(), GNUNET_TESTBED_PIT_IDENTITY, GNUNET_YES, BenchmarkPeer::id, GNUNET_TESTBED_PeerInformation::id, BenchmarkPeer::master, BenchmarkPeer::no, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, p, BenchmarkPeer::peer_id_op, GNUNET_TESTBED_PeerInformation::pit, and GNUNET_TESTBED_PeerInformation::result.

Referenced by main_run().

745 {
746  struct BenchmarkPeer *p = cb_cls;
747  static int done = 0;
748 
750 
751  p->id = *pinfo->result.id;
753  "%s [%u] has peer id `%s'\n",
754  (p->master == GNUNET_YES) ? "Master" : "Slave",
755  p->no,
756  GNUNET_i2s(&p->id));
757 
759  p->peer_id_op = NULL;
760  done++;
761 
762  if (done == top->num_slaves + top->num_masters)
763  {
765  "Retrieved all peer ID, connect to ATS\n");
767  NULL);
768  }
769 }
static void done()
struct GNUNET_TESTBED_Operation * peer_id_op
Testbed operation to get peer information.
Definition: ats-testing.h:133
union GNUNET_TESTBED_PeerInformation::@64 result
The result of the get information operation; Choose according to the pit.
enum GNUNET_TESTBED_PeerInformationType pit
Peer information type; captures which of the types in the &#39;op_result&#39; is actually in use...
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
static void do_connect_ats(void *cls)
Definition: ats-testing.c:704
struct GNUNET_PeerIdentity * id
The identity of the peer.
int no
Unique identifier.
Definition: ats-testing.h:118
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
Information we track for a peer in the testbed.
Definition: ats-testing.h:109
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1264
int master
Is this peer a measter: GNUNET_YES/GNUNET_NO.
Definition: ats-testing.h:123
void GNUNET_TESTBED_operation_done(struct GNUNET_TESTBED_Operation *operation)
This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) f...
Definition: testbed_api.c:2037
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:433
What is the identity of the peer? Returns a &#39;const struct GNUNET_PeerIdentity *&#39;. ...
#define GNUNET_log(kind,...)
#define GNUNET_YES
Definition: gnunet_common.h:77
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
struct GNUNET_PeerIdentity id
Peer ID.
Definition: ats-testing.h:128
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main_run()

static void main_run ( void *  cls,
struct GNUNET_TESTBED_RunHandle h,
unsigned int  num_peers,
struct GNUNET_TESTBED_Peer **  peers_,
unsigned int  links_succeeded,
unsigned int  links_failed 
)
static

Signature of a main function for a testcase.

Parameters
clsclosure
htestbed handle
num_peersnumber of peers in 'peers'
peers_handle to peers run in the testbed
links_succeededthe number of overlay link connection attempts that succeeded
links_failedthe number of overlay link connection attempts that failed

Definition at line 785 of file ats-testing.c.

References GNUNET_ATS_Properties::delay, BenchmarkPartner::dest, GNUNET_ATS_Properties::distance, do_shutdown(), GNUNET_assert, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_malloc, GNUNET_new_array, GNUNET_NO, GNUNET_NT_UNSPECIFIED, GNUNET_SCHEDULER_add_shutdown(), GNUNET_TESTBED_peer_get_information(), GNUNET_TESTBED_PIT_IDENTITY, GNUNET_TIME_UNIT_ZERO, GNUNET_YES, BenchmarkPeer::master, BenchmarkPartner::me, GNUNET_ATS_TEST_Topology::mps, BenchmarkPeer::no, GNUNET_ATS_TEST_Topology::num_masters, BenchmarkPeer::num_partners, GNUNET_ATS_TEST_Topology::num_slaves, BenchmarkPeer::partners, BenchmarkPeer::peer, BenchmarkPeer::peer_id_op, peerinformation_cb(), BenchmarkPeer::pref_partner, BenchmarkPeer::pref_value, BenchmarkPartner::props, GNUNET_ATS_Properties::scope, GNUNET_ATS_TEST_Topology::sps, TEST_ATS_PREFERENCE_DEFAULT, GNUNET_ATS_Properties::utilization_in, and GNUNET_ATS_Properties::utilization_out.

Referenced by GNUNET_ATS_TEST_create_topology().

791 {
792  int c_m;
793  int c_s;
794 
795  GNUNET_assert(NULL == cls);
797  GNUNET_assert(NULL != peers_);
798 
800  top);
801 
803  "Setting up %u masters and %u slaves\n",
804  top->num_masters,
805  top->num_slaves);
806 
807  /* Setup master peers */
808  for (c_m = 0; c_m < top->num_masters; c_m++)
809  {
810  GNUNET_assert(NULL != peers_[c_m]);
811  top->mps[c_m].peer = peers_[c_m];
812  top->mps[c_m].no = c_m;
813  top->mps[c_m].master = GNUNET_YES;
814  top->mps[c_m].pref_partner = &top->sps[c_m];
816  top->mps[c_m].partners =
817  GNUNET_malloc(top->num_slaves * sizeof(struct BenchmarkPartner));
818  top->mps[c_m].num_partners = top->num_slaves;
819  /* Initialize partners */
820  for (c_s = 0; c_s < top->num_slaves; c_s++)
821  {
822  top->mps[c_m].partners[c_s].me = &top->mps[c_m];
823  top->mps[c_m].partners[c_s].dest = &top->sps[c_s];
824  }
825  /* Get configuration */
826  top->mps[c_m].peer_id_op
830  &top->mps[c_m]);
831  }
832 
833  /* Setup slave peers */
834  for (c_s = 0; c_s < top->num_slaves; c_s++)
835  {
836  GNUNET_assert(NULL != peers_[c_s + top->num_masters]);
837  top->sps[c_s].peer = peers_[c_s + top->num_masters];
838  top->sps[c_s].no = c_s + top->num_masters;
839  top->sps[c_s].master = GNUNET_NO;
840  top->sps[c_s].partners =
842  struct BenchmarkPartner);
844  /* Initialize partners */
845  for (c_m = 0; c_m < top->num_masters; c_m++)
846  {
847  top->sps[c_s].partners[c_m].me = &top->sps[c_s];
848  top->sps[c_s].partners[c_m].dest = &top->mps[c_m];
849 
850  /* Initialize properties */
852  top->sps[c_s].partners[c_m].props.distance = 0;
854  top->sps[c_s].partners[c_m].props.utilization_in = 0;
855  top->sps[c_s].partners[c_m].props.utilization_out = 0;
856  }
857  /* Get configuration */
858  top->sps[c_s].peer_id_op
862  &top->sps[c_s]);
863  }
864 }
static void peerinformation_cb(void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, const char *emsg)
Definition: ats-testing.c:741
struct GNUNET_TESTBED_Operation * peer_id_op
Testbed operation to get peer information.
Definition: ats-testing.h:133
uint32_t utilization_in
Actual traffic on this connection from the other peer to this peer.
#define TEST_ATS_PREFERENCE_DEFAULT
Definition: ats-testing.h:33
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked.
Definition: scheduler.c:1284
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct BenchmarkPartner * partners
Array of partners with num_slaves entries (if master) or num_master entries (if slave) ...
Definition: ats-testing.h:188
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
#define GNUNET_NO
Definition: gnunet_common.h:78
double pref_value
Masters only Progress task.
Definition: ats-testing.h:182
static void do_shutdown(void *cls)
Shutdown nicely.
Definition: ats-testing.c:61
int num_partners
Number of partners.
Definition: ats-testing.h:193
int no
Unique identifier.
Definition: ats-testing.h:118
int master
Is this peer a measter: GNUNET_YES/GNUNET_NO.
Definition: ats-testing.h:123
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
Information about a benchmarking partner.
Definition: ats-testing.h:270
struct GNUNET_TIME_Relative delay
Delay.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_peer_get_information(struct GNUNET_TESTBED_Peer *peer, enum GNUNET_TESTBED_PeerInformationType pit, GNUNET_TESTBED_PeerInfoCallback cb, void *cb_cls)
Request information about a peer.
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:433
struct BenchmarkPeer * sps
Array of slave peers.
Definition: ats-testing.h:438
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:428
static unsigned int num_peers
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
enum GNUNET_NetworkType scope
Which network scope does the respective address belong to? This property does not change...
What is the identity of the peer? Returns a &#39;const struct GNUNET_PeerIdentity *&#39;. ...
#define GNUNET_log(kind,...)
struct BenchmarkPeer * pref_partner
Masters only: Peer to set ATS preferences for.
Definition: ats-testing.h:170
#define GNUNET_YES
Definition: gnunet_common.h:77
struct GNUNET_ATS_Properties props
Current ATS properties.
Definition: ats-testing.h:329
struct BenchmarkPeer * me
The peer itself this partner belongs to.
Definition: ats-testing.h:274
unsigned int distance
Distance on network layer (required for distance-vector routing) in hops.
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
struct BenchmarkPeer * dest
The partner peer.
Definition: ats-testing.h:279
struct GNUNET_TESTBED_Peer * peer
Handle with testbed.
Definition: ats-testing.h:113
#define GNUNET_malloc(size)
Wrapper around malloc.
uint32_t utilization_out
Actual traffic on this connection from this peer to the other peer.
Category of last resort.
Definition: gnunet_nt_lib.h:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ controller_event_cb()

static void controller_event_cb ( void *  cls,
const struct GNUNET_TESTBED_EventInformation event 
)
static

Controller event callback.

Parameters
clsNULL
eventthe controller event

Definition at line 874 of file ats-testing.c.

References GNUNET_break, GNUNET_SCHEDULER_shutdown(), GNUNET_TESTBED_ET_CONNECT, GNUNET_TESTBED_ET_OPERATION_FINISHED, and GNUNET_TESTBED_EventInformation::type.

Referenced by GNUNET_ATS_TEST_create_topology().

876 {
877  switch (event->type)
878  {
880  break;
881 
883  break;
884 
885  default:
886  GNUNET_break(0);
888  }
889 }
enum GNUNET_TESTBED_EventType type
Type of the event.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:517
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
A requested testbed operation has been completed.
A connection between two peers was established.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_get_peer()

struct BenchmarkPeer* GNUNET_ATS_TEST_get_peer ( int  src)

Topology related functions.

Definition at line 893 of file ats-testing.c.

References GNUNET_ATS_TEST_Topology::mps, and GNUNET_ATS_TEST_Topology::num_masters.

Referenced by enforce_start_preference(), and enforce_start_send().

894 {
895  if (src > top->num_masters)
896  return NULL;
897  return &top->mps[src];
898 }
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:428
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_get_partner()

struct BenchmarkPartner* GNUNET_ATS_TEST_get_partner ( int  src,
int  dest 
)

Definition at line 902 of file ats-testing.c.

References BenchmarkPartner::dest, GNUNET_ATS_TEST_Topology::mps, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, and BenchmarkPeer::partners.

Referenced by enforce_start_preference(), enforce_start_send(), enforce_stop_preference(), and enforce_stop_send().

904 {
905  if (src > top->num_masters)
906  return NULL;
907  if (dest > top->num_slaves)
908  return NULL;
909  return &top->mps[src].partners[dest];
910 }
struct BenchmarkPartner * partners
Array of partners with num_slaves entries (if master) or num_master entries (if slave) ...
Definition: ats-testing.h:188
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:433
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:428
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_create_topology()

void GNUNET_ATS_TEST_create_topology ( char *  name,
char *  cfg_file,
unsigned int  num_slaves,
unsigned int  num_masters,
int  test_core,
GNUNET_ATS_TEST_TopologySetupDoneCallback  done_cb,
void *  done_cb_cls,
GNUNET_ATS_AddressInformationCallback  log_request_cb 
)

Create a topology for ats testing.

Parameters
nametest name
cfg_fileconfiguration file to use for the peers
num_slavesnumber of slaves
num_mastersnumber of masters
test_coreconnect to CORE service (GNUNET_YES) or transport (GNUNET_NO)
done_cbfunction to call when topology is setup
done_cb_clscls for callback
log_request_cbcallback to call when logging is required

Definition at line 926 of file ats-testing.c.

References GNUNET_ATS_TEST_Topology::ats_perf_cb, controller_event_cb(), GNUNET_ATS_TEST_Topology::done_cb, GNUNET_ATS_TEST_Topology::done_cb_cls, event_mask, GNUNET_new, GNUNET_new_array, GNUNET_TESTBED_ET_CONNECT, GNUNET_TESTBED_ET_OPERATION_FINISHED, GNUNET_TESTBED_test_run(), main_run(), GNUNET_ATS_TEST_Topology::mps, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, GNUNET_ATS_TEST_Topology::sps, and GNUNET_ATS_TEST_Topology::test_core.

Referenced by main().

933 {
935  top->num_masters = num_masters;
936  top->num_slaves = num_slaves;
937  top->done_cb = done_cb;
938  top->done_cb_cls = done_cb_cls;
939  top->test_core = test_core;
940  top->ats_perf_cb = log_request_cb;
941  top->mps = GNUNET_new_array(num_masters,
942  struct BenchmarkPeer);
943  top->sps = GNUNET_new_array(num_slaves,
944  struct BenchmarkPeer);
945 
946  /* Start topology */
947  uint64_t event_mask;
948  event_mask = 0;
949  event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
950  event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
952  cfg_file,
953  num_slaves + num_masters,
954  event_mask,
955  &controller_event_cb, NULL,
956  &main_run, NULL);
957 }
int test_core
Test core (GNUNET_YES) or transport (GNUNET_NO)
Definition: ats-testing.h:398
int GNUNET_TESTBED_test_run(const char *testname, const char *cfg_filename, unsigned int num_peers, uint64_t event_mask, GNUNET_TESTBED_ControllerCallback cc, void *cc_cls, GNUNET_TESTBED_TestMaster test_master, void *test_master_cls)
Convenience method for running a "simple" test on the local system with a single call from &#39;main&#39;...
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static void main_run(void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers_, unsigned int links_succeeded, unsigned int links_failed)
Signature of a main function for a testcase.
Definition: ats-testing.c:785
Information we track for a peer in the testbed.
Definition: ats-testing.h:109
A requested testbed operation has been completed.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
static const char * cfg_file
Configuration filename.
uint64_t event_mask
Global event mask for all testbed events.
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:433
const char * name
struct BenchmarkPeer * sps
Array of slave peers.
Definition: ats-testing.h:438
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:428
A connection between two peers was established.
GNUNET_ATS_AddressInformationCallback ats_perf_cb
Definition: ats-testing.h:457
static void controller_event_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Controller event callback.
Definition: ats-testing.c:874
GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb
Definition: ats-testing.h:455
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_shutdown_topology()

void GNUNET_ATS_TEST_shutdown_topology ( void  )

Shutdown topology.

Definition at line 964 of file ats-testing.c.

References GNUNET_SCHEDULER_shutdown().

Referenced by do_shutdown().

965 {
966  if (NULL == top)
967  return;
969 }
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:52
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:517
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cfg

Handle to our configuration.

Definition at line 50 of file ats-testing.c.

◆ top

Definition at line 52 of file ats-testing.c.

Referenced by exchange().