GNUnet  0.10.x
Macros | Functions | Variables
gnunet-service-testbed.c File Reference

implementation of the TESTBED service More...

#include "gnunet-service-testbed.h"
#include "gnunet-service-testbed_barriers.h"
#include "gnunet-service-testbed_connectionpool.h"
Include dependency graph for gnunet-service-testbed.c:

Go to the source code of this file.

Macros

#define GROW_SS
 

Functions

static int host_list_add (struct GNUNET_TESTBED_Host *host)
 Function to add a host to the current list of known hosts. More...
 
void GST_send_operation_fail_msg (struct GNUNET_SERVICE_Client *client, uint64_t operation_id, const char *emsg)
 Send operation failure message to client. More...
 
void GST_send_operation_success_msg (struct GNUNET_SERVICE_Client *client, uint64_t operation_id)
 Function to send generic operation success message to given client. More...
 
static void hr_completion (void *cls, const char *emsg)
 Callback which will be called after a host registration succeeded or failed. More...
 
static void register_next_host (struct Slave *slave)
 Attempts to register the next host in the host registration queue. More...
 
void GST_queue_host_registration (struct Slave *slave, GNUNET_TESTBED_HostRegistrationCompletion cb, void *cb_cls, struct GNUNET_TESTBED_Host *host)
 Adds a host registration's request to a slave's registration queue. More...
 
void GST_forwarded_operation_reply_relay (void *cls, const struct GNUNET_MessageHeader *msg)
 Callback to relay the reply msg of a forwarded operation back to the client. More...
 
void GST_forwarded_operation_timeout (void *cls)
 Task to free resources when forwarded operation has been timed out. More...
 
static struct GNUNET_TESTING_SharedServiceparse_shared_services (char *ss_str, struct GNUNET_CONFIGURATION_Handle *cfg)
 Parse service sharing specification line. More...
 
static int check_init (void *cls, const struct GNUNET_TESTBED_InitMessage *msg)
 Check GNUNET_MESSAGE_TYPE_TESTBED_INIT messages. More...
 
static void handle_init (void *cls, const struct GNUNET_TESTBED_InitMessage *msg)
 Message handler for GNUNET_MESSAGE_TYPE_TESTBED_INIT messages. More...
 
static int check_add_host (void *cls, const struct GNUNET_TESTBED_AddHostMessage *msg)
 Check #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST messages. More...
 
static void handle_add_host (void *cls, const struct GNUNET_TESTBED_AddHostMessage *msg)
 Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST messages. More...
 
static void handle_slave_get_config (void *cls, const struct GNUNET_TESTBED_SlaveGetConfigurationMessage *msg)
 Handler for #GNUNET_MESSAGE_TYPE_TESTBED_GETSLAVECONFIG messages. More...
 
void GST_clear_fopcq ()
 Clears the forwarded operations queue. More...
 
static void shutdown_task (void *cls)
 Task to clean up and shutdown nicely. More...
 
static void * client_connect_cb (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq)
 Callback for client connect. More...
 
static void client_disconnect_cb (void *cls, struct GNUNET_SERVICE_Client *client, void *app_ctx)
 Callback for client disconnect. More...
 
static void testbed_run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SERVICE_Handle *service)
 Testbed setup. More...
 
 GNUNET_SERVICE_MAIN ("testbed", GNUNET_SERVICE_OPTION_NONE, &testbed_run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_var_size(init, GNUNET_MESSAGE_TYPE_TESTBED_INIT, struct GNUNET_TESTBED_InitMessage, NULL), GNUNET_MQ_hd_var_size(add_host, GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST, struct GNUNET_TESTBED_AddHostMessage, NULL), GNUNET_MQ_hd_fixed_size(slave_get_config, GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION, struct GNUNET_TESTBED_SlaveGetConfigurationMessage, NULL), GNUNET_MQ_hd_fixed_size(link_controllers, GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS, struct GNUNET_TESTBED_ControllerLinkRequest, NULL), GNUNET_MQ_hd_var_size(remote_overlay_connect, GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT, struct GNUNET_TESTBED_RemoteOverlayConnectMessage, NULL), GNUNET_MQ_hd_fixed_size(overlay_connect, GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT, struct GNUNET_TESTBED_OverlayConnectMessage, NULL), GNUNET_MQ_hd_var_size(peer_create, GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER, struct GNUNET_TESTBED_PeerCreateMessage, NULL), GNUNET_MQ_hd_fixed_size(peer_destroy, GNUNET_MESSAGE_TYPE_TESTBED_DESTROY_PEER, struct GNUNET_TESTBED_PeerDestroyMessage, NULL), GNUNET_MQ_hd_fixed_size(peer_start, GNUNET_MESSAGE_TYPE_TESTBED_START_PEER, struct GNUNET_TESTBED_PeerStartMessage, NULL), GNUNET_MQ_hd_fixed_size(peer_stop, GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER, struct GNUNET_TESTBED_PeerStopMessage, NULL), GNUNET_MQ_hd_fixed_size(peer_get_config, GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION, struct GNUNET_TESTBED_PeerGetConfigurationMessage, NULL), GNUNET_MQ_hd_var_size(manage_peer_service, GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE, struct GNUNET_TESTBED_ManagePeerServiceMessage, NULL), GNUNET_MQ_hd_fixed_size(shutdown_peers, GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS, struct GNUNET_TESTBED_ShutdownPeersMessage, NULL), GNUNET_MQ_hd_var_size(peer_reconfigure, GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER, struct GNUNET_TESTBED_PeerReconfigureMessage, NULL), GNUNET_MQ_hd_var_size(barrier_init, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT, struct GNUNET_TESTBED_BarrierInit, NULL), GNUNET_MQ_hd_var_size(barrier_cancel, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL, struct GNUNET_TESTBED_BarrierCancel, NULL), GNUNET_MQ_hd_var_size(barrier_status, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS, struct GNUNET_TESTBED_BarrierStatusMsg, NULL), GNUNET_MQ_handler_end())
 Define "main" method using service macro. More...
 

Variables

struct GNUNET_CONFIGURATION_HandleGST_config
 Our configuration. More...
 
struct ContextGST_context
 The master context; generated with the first INIT message. More...
 
struct GNUNET_TESTBED_Host ** GST_host_list
 Array of hosts. More...
 
struct ForwardedOperationContextfopcq_head
 DLL head for forwarded operation contexts. More...
 
struct ForwardedOperationContextfopcq_tail
 DLL tail for forwarded operation contexts. More...
 
struct OperationQueueGST_opq_openfds
 Operation queue for open file descriptors. More...
 
struct GNUNET_TIME_Relative GST_timeout
 Timeout for operations which may take some time. More...
 
unsigned int GST_host_list_size
 The size of the host list. More...
 
unsigned int GST_peer_list_size
 The size of the peer list. More...
 
static char * hostname
 Our hostname; we give this to all the peers we start. More...
 

Detailed Description

implementation of the TESTBED service

Author
Sree Harsha Totakura

Definition in file gnunet-service-testbed.c.

Macro Definition Documentation

◆ GROW_SS

#define GROW_SS
Value:
do { \
GNUNET_array_grow(slist, n, n + 1); \
GNUNET_memcpy(&slist[n - 1], &ss, \
sizeof(struct GNUNET_TESTING_SharedService)); \
} while (0)
Specification of a service that is to be shared among peers.

Referenced by parse_shared_services().

Function Documentation

◆ host_list_add()

static int host_list_add ( struct GNUNET_TESTBED_Host host)
static

Function to add a host to the current list of known hosts.

Parameters
hostthe host to add
Returns
GNUNET_OK on success; GNUNET_SYSERR on failure due to host-id already in use

Definition at line 99 of file gnunet-service-testbed.c.

References GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTBED_host_get_id_(), GST_array_grow_large_enough, GST_host_list_size, and LOG_DEBUG.

Referenced by handle_add_host(), and handle_init().

100 {
101  uint32_t host_id;
102 
103  host_id = GNUNET_TESTBED_host_get_id_(host);
104  if (GST_host_list_size <= host_id)
106  if (NULL != GST_host_list[host_id])
107  {
108  LOG_DEBUG("A host with id: %u already exists\n", host_id);
109  return GNUNET_SYSERR;
110  }
111  GST_host_list[host_id] = host;
112  return GNUNET_OK;
113 }
unsigned int GST_host_list_size
The size of the host list.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
#define GST_array_grow_large_enough(ptr, size, accommodate_size)
Similar to GNUNET_array_grow(); however instead of calling GNUNET_array_grow() several times we call ...
struct GNUNET_TESTBED_Host ** GST_host_list
Array of hosts.
uint32_t GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host)
Obtain the host&#39;s unique global ID.
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
#define LOG_DEBUG(...)
Debug logging shorthand.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GST_send_operation_fail_msg()

void GST_send_operation_fail_msg ( struct GNUNET_SERVICE_Client client,
uint64_t  operation_id,
const char *  emsg 
)

Send operation failure message to client.

Parameters
clientthe client to which the failure message has to be sent to
operation_idthe id of the failed operation
emsgthe error message; can be NULL

Definition at line 124 of file gnunet-service-testbed.c.

References env, GNUNET_TESTBED_OperationFailureEventMessage::event_type, GNUNET_htonll(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_SERVICE_client_get_mq(), GNUNET_TESTBED_ET_OPERATION_FINISHED, msg, and GNUNET_TESTBED_OperationFailureEventMessage::operation_id.

Referenced by GST_forwarded_operation_timeout(), handle_manage_peer_service(), handle_peer_create(), handle_peer_destroy(), handle_peer_get_config(), handle_peer_reconfigure(), handle_peer_start(), handle_peer_stop(), handle_slave_get_config(), prc_stop_cb(), service_manage_result_cb(), shutdown_peers_reply_cb(), and timeout_overlay_connect().

127 {
128  struct GNUNET_MQ_Envelope *env;
130  uint16_t emsg_len;
131 
132  emsg_len = (NULL == emsg) ? 0 : strlen(emsg) + 1;
133  env = GNUNET_MQ_msg_extra(msg,
134  emsg_len,
138  GNUNET_memcpy(&msg[1],
139  emsg,
140  emsg_len);
142  env);
143 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
Definition: service.c:2424
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
Event notification from a controller to a client.
Definition: testbed.h:493
int32_t event_type
&#39;enum GNUNET_TESTBED_EventType&#39; (in NBO); GNUNET_TESTBED_ET_OPERATION_FINISHED.
Definition: testbed.h:503
#define GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT
Message for operation events.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
uint64_t operation_id
Operation ID of the operation that created this event.
Definition: testbed.h:508
A requested testbed operation has been completed.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:35
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:351
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GST_send_operation_success_msg()

void GST_send_operation_success_msg ( struct GNUNET_SERVICE_Client client,
uint64_t  operation_id 
)

Function to send generic operation success message to given client.

Parameters
clientthe client to send the message to
operation_idthe id of the operation which was successful

Definition at line 153 of file gnunet-service-testbed.c.

References env, GNUNET_TESTBED_GenericOperationSuccessEventMessage::event_type, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SERVICE_client_get_mq(), GNUNET_TESTBED_ET_OPERATION_FINISHED, hr_completion(), msg, and GNUNET_TESTBED_GenericOperationSuccessEventMessage::operation_id.

Referenced by handle_peer_destroy(), handle_peer_reconfigure(), handle_shutdown_peers(), prc_stop_cb(), service_manage_result_cb(), and shutdown_peers_reply_cb().

155 {
156  struct GNUNET_MQ_Envelope *env;
158 
159  env = GNUNET_MQ_msg(msg,
164  env);
165 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
Definition: service.c:2424
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
#define GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS
Message to signal a generic operation has been successful.
uint64_t operation_id
Operation ID of the operation that created this event.
Definition: testbed.h:555
A requested testbed operation has been completed.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:35
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
Event notification from a controller to a client for a generic operational success where the operatio...
Definition: testbed.h:540
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:351
int32_t event_type
&#39;enum GNUNET_TESTBED_EventType&#39; (in NBO); GNUNET_TESTBED_ET_OPERATION_FINISHED.
Definition: testbed.h:550
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hr_completion()

static void hr_completion ( void *  cls,
const char *  emsg 
)
static

Callback which will be called after a host registration succeeded or failed.

Callback which will be called to after a host registration succeeded or failed.

Parameters
clsthe handle to the slave at which the registration is completed
emsgthe error message; NULL if host registration is successful

Definition at line 211 of file gnunet-service-testbed.c.

References HostRegistration::cb, HostRegistration::cb_cls, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_TESTBED_host_get_id_(), HostRegistration::host, Slave::host_id, Slave::hr_dll_head, Slave::hr_dll_tail, LOG, register_next_host(), and Slave::rhandle.

Referenced by GST_send_operation_success_msg(), and register_next_host().

213 {
214  struct Slave *slave = cls;
215  struct HostRegistration *hr;
216 
217  slave->rhandle = NULL;
218  hr = slave->hr_dll_head;
219  GNUNET_assert(NULL != hr);
221  "Registering host %u at %u successful\n",
225  slave->hr_dll_tail,
226  hr);
227  if (NULL != hr->cb)
228  hr->cb(hr->cb_cls,
229  emsg);
230  GNUNET_free(hr);
231  if (NULL != slave->hr_dll_head)
232  register_next_host(slave);
233 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define LOG(kind,...)
Definition: arm_api.c:33
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static void register_next_host(struct Slave *slave)
Attempts to register the next host in the host registration queue.
Structure representing a connected(directly-linked) controller.
struct GNUNET_TESTBED_HostRegistrationHandle * rhandle
The current host registration handle.
GNUNET_TESTBED_HostRegistrationCompletion cb
The callback to call after this registration&#39;s status is available.
struct GNUNET_TESTBED_Host ** GST_host_list
Array of hosts.
A DLL of host registrations to be made.
uint32_t GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host)
Obtain the host&#39;s unique global ID.
struct HostRegistration * hr_dll_tail
Tail of the host registration DLL.
struct HostRegistration * hr_dll_head
Head of the host registration DLL.
struct GNUNET_TESTBED_Host * host
The host that has to be registered.
uint32_t host_id
The id of the host this controller is running on.
void * cb_cls
The closure for the above callback.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ register_next_host()

static void register_next_host ( struct Slave slave)
static

Attempts to register the next host in the host registration queue.

Parameters
slavethe slave controller whose host registration queue is checked for host registrations

Definition at line 186 of file gnunet-service-testbed.c.

References Slave::controller, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_TESTBED_host_get_id_(), GNUNET_TESTBED_register_host(), HostRegistration::host, Slave::host_id, hr_completion(), Slave::hr_dll_head, LOG, and Slave::rhandle.

Referenced by GST_queue_host_registration(), and hr_completion().

187 {
188  struct HostRegistration *hr;
189 
190  hr = slave->hr_dll_head;
191  GNUNET_assert(NULL != hr);
192  GNUNET_assert(NULL == slave->rhandle);
193  LOG(GNUNET_ERROR_TYPE_DEBUG, "Registering host %u at %u\n",
196  slave->rhandle
198  hr->host,
200  slave);
201 }
#define LOG(kind,...)
Definition: arm_api.c:33
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_TESTBED_HostRegistrationHandle * rhandle
The current host registration handle.
static void hr_completion(void *cls, const char *emsg)
Callback which will be called after a host registration succeeded or failed.
struct GNUNET_TESTBED_Host ** GST_host_list
Array of hosts.
A DLL of host registrations to be made.
uint32_t GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host)
Obtain the host&#39;s unique global ID.
struct HostRegistration * hr_dll_head
Head of the host registration DLL.
struct GNUNET_TESTBED_Host * host
The host that has to be registered.
uint32_t host_id
The id of the host this controller is running on.
struct GNUNET_TESTBED_Controller * controller
The controller handle.
struct GNUNET_TESTBED_HostRegistrationHandle * GNUNET_TESTBED_register_host(struct GNUNET_TESTBED_Controller *controller, struct GNUNET_TESTBED_Host *host, GNUNET_TESTBED_HostRegistrationCompletion cc, void *cc_cls)
Register a host with the controller.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GST_queue_host_registration()

void GST_queue_host_registration ( struct Slave slave,
GNUNET_TESTBED_HostRegistrationCompletion  cb,
void *  cb_cls,
struct GNUNET_TESTBED_Host host 
)

Adds a host registration's request to a slave's registration queue.

Parameters
slavethe slave controller at which the given host has to be registered
cbthe host registration completion callback
cb_clsthe closure for the host registration completion callback
hostthe host which has to be registered

Definition at line 246 of file gnunet-service-testbed.c.

References HostRegistration::cb, HostRegistration::cb_cls, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_new, GNUNET_NO, GNUNET_TESTBED_host_get_id_(), GNUNET_YES, HostRegistration::host, Slave::host_id, Slave::hr_dll_head, Slave::hr_dll_tail, LOG, and register_next_host().

Referenced by lcf_proc_task(), and register_host().

250 {
251  struct HostRegistration *hr;
252  int call_register;
253 
255  "Queueing host registration for host %u at %u\n",
258  hr = GNUNET_new(struct HostRegistration);
259  hr->cb = cb;
260  hr->cb_cls = cb_cls;
261  hr->host = host;
262  call_register = (NULL == slave->hr_dll_head) ? GNUNET_YES : GNUNET_NO;
264  slave->hr_dll_tail,
265  hr);
266  if (GNUNET_YES == call_register)
267  register_next_host(slave);
268 }
#define LOG(kind,...)
Definition: arm_api.c:33
static void register_next_host(struct Slave *slave)
Attempts to register the next host in the host registration queue.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_new(type)
Allocate a struct or union of the given type.
GNUNET_TESTBED_HostRegistrationCompletion cb
The callback to call after this registration&#39;s status is available.
struct GNUNET_TESTBED_Host ** GST_host_list
Array of hosts.
A DLL of host registrations to be made.
uint32_t GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host)
Obtain the host&#39;s unique global ID.
struct HostRegistration * hr_dll_tail
Tail of the host registration DLL.
struct HostRegistration * hr_dll_head
Head of the host registration DLL.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
struct GNUNET_TESTBED_Host * host
The host that has to be registered.
uint32_t host_id
The id of the host this controller is running on.
#define GNUNET_YES
Definition: gnunet_common.h:77
void * cb_cls
The closure for the above callback.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GST_forwarded_operation_reply_relay()

void GST_forwarded_operation_reply_relay ( void *  cls,
const struct GNUNET_MessageHeader msg 
)

Callback to relay the reply msg of a forwarded operation back to the client.

Parameters
clsForwardedOperationContext
msgthe message to relay

Definition at line 278 of file gnunet-service-testbed.c.

References ForwardedOperationContext::client, ForwardedOperationContext::cls, env, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MQ_msg_copy(), GNUNET_MQ_send(), GNUNET_SCHEDULER_cancel(), GNUNET_SERVICE_client_get_mq(), LOG_DEBUG, GNUNET_MessageHeader::size, ForwardedOperationContext::timeout_task, and GNUNET_MessageHeader::type.

Referenced by forward_overlay_connect(), forwarded_overlay_connect_listener(), handle_manage_peer_service(), handle_peer_get_config(), handle_peer_reconfigure(), handle_peer_start(), handle_peer_stop(), peer_create_success_cb(), and peer_destroy_success_cb().

280 {
281  struct ForwardedOperationContext *fopc = cls;
282  struct GNUNET_MQ_Envelope *env;
283 
284  LOG_DEBUG("Relaying message with type: %u, size: %u\n",
285  ntohs(msg->type),
286  ntohs(msg->size));
287  env = GNUNET_MQ_msg_copy(msg);
289  env);
292  fopcq_tail,
293  fopc);
294  GNUNET_free(fopc);
295 }
struct GNUNET_SCHEDULER_Task * timeout_task
Task ID for the timeout task.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GNUNET_MQ_Envelope * GNUNET_MQ_msg_copy(const struct GNUNET_MessageHeader *hdr)
Create a new envelope by copying an existing message.
Definition: mq.c:651
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
Definition: service.c:2424
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
struct ForwardedOperationContext * fopcq_head
DLL head for forwarded operation contexts.
void * cls
Closure pointer.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct ForwardedOperationContext * fopcq_tail
DLL tail for forwarded operation contexts.
struct GNUNET_SERVICE_Client * client
The client to which we have to reply.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:351
Context information for operations forwarded to subcontrollers.
#define LOG_DEBUG(...)
Debug logging shorthand.
#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:

◆ GST_forwarded_operation_timeout()

void GST_forwarded_operation_timeout ( void *  cls)

Task to free resources when forwarded operation has been timed out.

Task to free resources when forwarded operation has been timedout.

Parameters
clsthe ForwardedOperationContext

Definition at line 304 of file gnunet-service-testbed.c.

References ForwardedOperationContext::client, ForwardedOperationContext::cls, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_TESTBED_forward_operation_msg_cancel_(), GST_send_operation_fail_msg(), LOG, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, and ForwardedOperationContext::timeout_task.

Referenced by client_disconnect_cb(), forward_overlay_connect(), forwarded_overlay_connect_timeout(), GST_notify_client_disconnect_oc(), GST_notify_client_disconnect_peers(), handle_manage_peer_service(), handle_peer_destroy(), handle_peer_get_config(), handle_peer_reconfigure(), handle_peer_start(), handle_peer_stop(), and peer_create_forward_timeout().

305 {
306  struct ForwardedOperationContext *fopc = cls;
307 
308  fopc->timeout_task = NULL;
311  "A forwarded operation has timed out\n");
313  fopc->operation_id,
314  "A forwarded operation has timed out");
316  fopcq_tail,
317  fopc);
318  GNUNET_free(fopc);
319 }
struct GNUNET_SCHEDULER_Task * timeout_task
Task ID for the timeout task.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
void GST_send_operation_fail_msg(struct GNUNET_SERVICE_Client *client, uint64_t operation_id, const char *emsg)
Send operation failure message to client.
#define LOG(kind,...)
Definition: arm_api.c:33
struct OperationContext * opc
The generated operation context.
struct ForwardedOperationContext * fopcq_head
DLL head for forwarded operation contexts.
void GNUNET_TESTBED_forward_operation_msg_cancel_(struct OperationContext *opc)
Function to cancel an operation created by simply forwarding an operation message.
Definition: testbed_api.c:1399
void * cls
Closure pointer.
struct ForwardedOperationContext * fopcq_tail
DLL tail for forwarded operation contexts.
struct GNUNET_SERVICE_Client * client
The client to which we have to reply.
uint64_t operation_id
The id of the operation that has been forwarded.
Context information for operations forwarded to subcontrollers.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_shared_services()

static struct GNUNET_TESTING_SharedService* parse_shared_services ( char *  ss_str,
struct GNUNET_CONFIGURATION_Handle cfg 
)
static

Parse service sharing specification line.

Format is "[<service:share>] [<service:share>] ..."

Parameters
ss_strthe spec string to be parsed
cfgthe configuration to use for shared services
Returns
an array suitable to pass to GNUNET_TESTING_system_create(). NULL upon empty service sharing specification.

Definition at line 332 of file gnunet-service-testbed.c.

References find_typedefs::arg, GNUNET_TESTING_SharedService::cfg, cfg, GNUNET_ERROR_TYPE_WARNING, GNUNET_strdup, GROW_SS, LOG, LOG_DEBUG, GNUNET_TESTING_SharedService::service, service, and GNUNET_TESTING_SharedService::share.

Referenced by handle_init().

334 {
336  struct GNUNET_TESTING_SharedService *slist;
337  char service[256];
338  char *arg;
339  unsigned int n;
340 
341 #define GROW_SS \
342  do { \
343  GNUNET_array_grow(slist, n, n + 1); \
344  GNUNET_memcpy(&slist[n - 1], &ss, \
345  sizeof(struct GNUNET_TESTING_SharedService)); \
346  } while (0)
347 
348  slist = NULL;
349  n = 0;
350  ss.cfg = cfg;
351  for (; NULL != (arg = strtok(ss_str, " ")); ss_str = NULL)
352  {
353  ss.service = NULL;
354  ss.share = 0;
355  if (2 != sscanf(arg, "%255[^:]:%u",
356  service,
357  &ss.share))
358  {
360  "Ignoring shared service spec: %s",
361  arg);
362  continue;
363  }
364  LOG_DEBUG("Will be sharing %s service among %u peers\n",
365  service,
366  ss.share);
367  ss.service = GNUNET_strdup(service);
368  GROW_SS;
369  }
370  if (NULL != slist)
371  {
372  /* Add trailing NULL block */
373  (void)memset(&ss,
374  0,
375  sizeof(struct GNUNET_TESTING_SharedService));
376  GROW_SS;
377  }
378  return slist;
379 #undef GROW_SS
380 }
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
Specification of a service that is to be shared among peers.
#define LOG(kind,...)
Definition: arm_api.c:33
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
const struct GNUNET_CONFIGURATION_Handle * cfg
The configuration template for the service.
#define GROW_SS
#define LOG_DEBUG(...)
Debug logging shorthand.
Here is the caller graph for this function:

◆ check_init()

static int check_init ( void *  cls,
const struct GNUNET_TESTBED_InitMessage msg 
)
static

Check GNUNET_MESSAGE_TYPE_TESTBED_INIT messages.

Parameters
clsidentification of the client
messagethe actual message
Returns
GNUNET_OK if message is well-formed

Definition at line 391 of file gnunet-service-testbed.c.

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTBED_InitMessage::header, and GNUNET_MessageHeader::size.

393 {
394  const char *controller_hostname;
395  uint16_t msize;
396 
397  msize = ntohs(msg->header.size) - sizeof(struct GNUNET_TESTBED_InitMessage);
398  controller_hostname = (const char *)&msg[1];
399  if ('\0' != controller_hostname[msize - 1])
400  {
401  GNUNET_break(0);
402  return GNUNET_SYSERR;
403  }
404  return GNUNET_OK;
405 }
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_INIT.
Definition: testbed.h:40
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
Initial message from a client to a testing control service.
Definition: testbed.h:36
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define GNUNET_SYSERR
Definition: gnunet_common.h:76

◆ handle_init()

static void handle_init ( void *  cls,
const struct GNUNET_TESTBED_InitMessage msg 
)
static

Message handler for GNUNET_MESSAGE_TYPE_TESTBED_INIT messages.

Parameters
clsidentification of the client
messagethe actual message

Definition at line 415 of file gnunet-service-testbed.c.

References Context::client, GNUNET_CONFIGURATION_get_value_string(), GNUNET_free, GNUNET_new, GNUNET_OK, GNUNET_SERVICE_client_continue(), GNUNET_strdup, GNUNET_TESTBED_host_create_with_id(), GNUNET_TESTING_system_create(), GNUNET_TESTBED_InitMessage::host_id, Context::host_id, host_list_add(), hostname, LOG_DEBUG, Context::master_ip, parse_shared_services(), GNUNET_TESTING_SharedService::service, service, and Context::system.

417 {
418  struct GNUNET_SERVICE_Client *client = cls;
419  struct GNUNET_TESTBED_Host *host;
420  const char *controller_hostname;
421  char *ss_str;
422  struct GNUNET_TESTING_SharedService *ss;
423  unsigned int cnt;
424 
425  if (NULL != GST_context)
426  {
427  LOG_DEBUG("We are being connected to laterally\n");
429  return;
430  }
431  controller_hostname = (const char *)&msg[1];
432  ss_str = NULL;
433  ss = NULL;
434  if (GNUNET_OK ==
436  "TESTBED",
437  "SHARED_SERVICES",
438  &ss_str))
439  {
440  ss = parse_shared_services(ss_str,
441  GST_config);
442  GNUNET_free(ss_str);
443  ss_str = NULL;
444  }
445  GST_context = GNUNET_new(struct Context);
446  GST_context->client = client;
447  GST_context->host_id = ntohl(msg->host_id);
448  GST_context->master_ip = GNUNET_strdup(controller_hostname);
449  LOG_DEBUG("Our IP: %s\n",
452  = GNUNET_TESTING_system_create("testbed",
454  hostname,
455  ss);
456  if (NULL != ss)
457  {
458  for (cnt = 0; NULL != ss[cnt].service; cnt++)
459  {
460  ss_str = (char *)ss[cnt].service;
461  GNUNET_free(ss_str);
462  }
463  GNUNET_free(ss);
464  ss = NULL;
465  }
466  host =
469  NULL,
470  GST_config,
471  0);
472  host_list_add(host);
473  LOG_DEBUG("Created master context with host ID: %u\n",
476 }
Context to hold data of peer.
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
Specification of a service that is to be shared among peers.
struct GNUNET_TESTBED_Host * GNUNET_TESTBED_host_create_with_id(uint32_t id, const char *hostname, const char *username, const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t port)
Create a host to run peers and controllers on.
char * master_ip
The network address of the master controller.
struct GNUNET_TESTING_System * system
The TESTING system handle for starting peers locally.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static struct GNUNET_TESTING_SharedService * parse_shared_services(char *ss_str, struct GNUNET_CONFIGURATION_Handle *cfg)
Parse service sharing specification line.
Opaque handle to a host running experiments managed by the testing framework.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
Handle to a client that is connected to a service.
Definition: service.c:246
uint32_t host_id
Our host id according to this context.
static int host_list_add(struct GNUNET_TESTBED_Host *host)
Function to add a host to the current list of known hosts.
struct GNUNET_SERVICE_Client * client
The client handle associated with this context.
int GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
struct GNUNET_TESTING_System * GNUNET_TESTING_system_create(const char *testdir, const char *trusted_ip, const char *hostname, const struct GNUNET_TESTING_SharedService *shared_services)
Create a system handle.
Definition: testing.c:449
const char * service
The name of the service.
uint32_t host_id
Host ID that the controller is either given (if this is the dominating client) or assumed to have (fo...
Definition: testbed.h:48
static char * hostname
Our hostname; we give this to all the peers we start.
struct Context * GST_context
The master context; generated with the first INIT message.
struct GNUNET_CONFIGURATION_Handle * GST_config
Our configuration.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2234
#define LOG_DEBUG(...)
Debug logging shorthand.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:

◆ check_add_host()

static int check_add_host ( void *  cls,
const struct GNUNET_TESTBED_AddHostMessage msg 
)
static

Check #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST messages.

Parameters
clsidentification of the client
msgthe actual message
Returns
GNUNET_OK if message is well-formed

Definition at line 487 of file gnunet-service-testbed.c.

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTBED_AddHostMessage::header, GNUNET_TESTBED_AddHostMessage::hostname_length, GNUNET_MessageHeader::size, and GNUNET_TESTBED_AddHostMessage::username_length.

489 {
490  uint16_t username_length;
491  uint16_t hostname_length;
492  uint16_t msize;
493 
494  msize = ntohs(msg->header.size) - sizeof(struct GNUNET_TESTBED_AddHostMessage);
495  username_length = ntohs(msg->username_length);
496  hostname_length = ntohs(msg->hostname_length);
497  /* msg must contain hostname */
498  if ((msize <= username_length) ||
499  (0 == hostname_length))
500  {
501  GNUNET_break(0);
502  return GNUNET_SYSERR;
503  }
504  /* msg must contain configuration */
505  if (msize <= username_length + hostname_length)
506  {
507  GNUNET_break(0);
508  return GNUNET_SYSERR;
509  }
510  return GNUNET_OK;
511 }
uint16_t username_length
Number of bytes in the user name that follows; 0 to use no user name; otherwise &#39;strlen (username)&#39;...
Definition: testbed.h:84
Notify the service about a host that we intend to use.
Definition: testbed.h:63
uint16_t hostname_length
Number of bytes in the host name (excluding 0-termination) that follows the user name; cannot be 0...
Definition: testbed.h:90
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST.
Definition: testbed.h:67

◆ handle_add_host()

static void handle_add_host ( void *  cls,
const struct GNUNET_TESTBED_AddHostMessage msg 
)
static

Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST messages.

Parameters
clsidentification of the client
msgthe actual message

Definition at line 521 of file gnunet-service-testbed.c.

References env, GNUNET_break_op, GNUNET_CONFIGURATION_destroy(), GNUNET_free, GNUNET_free_non_null, GNUNET_malloc, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS, GNUNET_MQ_msg, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_OK, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_SERVICE_client_get_mq(), GNUNET_strlcpy(), GNUNET_TESTBED_extract_config_(), GNUNET_TESTBED_host_create_with_id(), GNUNET_TESTBED_host_destroy(), GNUNET_TESTBED_AddHostMessage::header, GNUNET_TESTBED_AddHostMessage::host_id, GNUNET_TESTBED_HostConfirmedMessage::host_id, Context::host_id, host_list_add(), hostname, GNUNET_TESTBED_AddHostMessage::hostname_length, LOG_DEBUG, GNUNET_TESTBED_AddHostMessage::ssh_port, and GNUNET_TESTBED_AddHostMessage::username_length.

523 {
524  struct GNUNET_SERVICE_Client *client = cls;
525  struct GNUNET_TESTBED_Host *host;
527  struct GNUNET_CONFIGURATION_Handle *host_cfg;
528  char *username;
529  char *hostname;
530  char *emsg;
531  const void *ptr;
532  uint32_t host_id;
533  uint16_t username_length;
534  uint16_t hostname_length;
535  struct GNUNET_MQ_Envelope *env;
536 
537  username_length = ntohs(msg->username_length);
538  hostname_length = ntohs(msg->hostname_length);
539  username = NULL;
540  hostname = NULL;
541  ptr = &msg[1];
542  if (0 != username_length)
543  {
544  username = GNUNET_malloc(username_length + 1);
545  GNUNET_strlcpy(username, ptr, username_length + 1);
546  ptr += username_length;
547  }
548  hostname = GNUNET_malloc(hostname_length + 1);
549  GNUNET_strlcpy(hostname, ptr, hostname_length + 1);
550  if (NULL == (host_cfg = GNUNET_TESTBED_extract_config_(&msg->header)))
551  {
552  GNUNET_free_non_null(username);
553  GNUNET_free_non_null(hostname);
554  GNUNET_break_op(0);
556  return;
557  }
558  host_id = ntohl(msg->host_id);
559  LOG_DEBUG("Received ADDHOST %u message\n", host_id);
560  LOG_DEBUG("-------host id: %u\n", host_id);
561  LOG_DEBUG("-------hostname: %s\n", hostname);
562  if (NULL != username)
563  LOG_DEBUG("-------username: %s\n", username);
564  else
565  LOG_DEBUG("-------username: <not given>\n");
566  LOG_DEBUG("-------ssh port: %u\n", ntohs(msg->ssh_port));
567  host = GNUNET_TESTBED_host_create_with_id(host_id,
568  hostname,
569  username,
570  host_cfg,
571  ntohs(msg->ssh_port));
572  GNUNET_free_non_null(username);
573  GNUNET_free(hostname);
575  if (NULL == host)
576  {
577  GNUNET_break_op(0);
579  return;
580  }
581  if (GNUNET_OK != host_list_add(host))
582  {
583  /* We are unable to add a host */
584  emsg = "A host exists with given host-id";
585  LOG_DEBUG("%s: %u",
586  emsg,
587  host_id);
589  env = GNUNET_MQ_msg_extra(reply,
590  strlen(emsg) + 1,
592  GNUNET_memcpy(&reply[1],
593  emsg,
594  strlen(emsg) + 1);
595  }
596  else
597  {
598  LOG_DEBUG("Added host %u at %u\n",
599  host_id,
601  env = GNUNET_MQ_msg(reply,
603  }
604  reply->host_id = htonl(host_id);
606  env);
608 }
Confirmation from the service that adding a host worked (or failed).
Definition: testbed.h:112
uint16_t username_length
Number of bytes in the user name that follows; 0 to use no user name; otherwise &#39;strlen (username)&#39;...
Definition: testbed.h:84
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
Definition: service.c:2424
struct GNUNET_TESTBED_Host * GNUNET_TESTBED_host_create_with_id(uint32_t id, const char *hostname, const char *username, const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t port)
Create a host to run peers and controllers on.
uint16_t hostname_length
Number of bytes in the host name (excluding 0-termination) that follows the user name; cannot be 0...
Definition: testbed.h:90
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
#define GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS
Message to signal that a add host succeeded.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
Opaque handle to a host running experiments managed by the testing framework.
struct GNUNET_CONFIGURATION_Handle * GNUNET_TESTBED_extract_config_(const struct GNUNET_MessageHeader *msg)
Generates configuration by uncompressing configuration in given message.
Definition: testbed_api.c:2059
Handle to a client that is connected to a service.
Definition: service.c:246
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
uint32_t host_id
Our host id according to this context.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
static int host_list_add(struct GNUNET_TESTBED_Host *host)
Function to add a host to the current list of known hosts.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
uint32_t host_id
Unique ID for the host (in NBO).
Definition: testbed.h:121
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2315
uint32_t host_id
Unique ID for the host (in NBO).
Definition: testbed.h:72
void GNUNET_TESTBED_host_destroy(struct GNUNET_TESTBED_Host *host)
Destroy a host handle.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST.
Definition: testbed.h:67
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
static char * hostname
Our hostname; we give this to all the peers we start.
configuration data
Definition: configuration.c:83
struct Context * GST_context
The master context; generated with the first INIT message.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:351
size_t GNUNET_strlcpy(char *dst, const char *src, size_t n)
Like strlcpy but portable.
Definition: strings.c:219
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2234
#define LOG_DEBUG(...)
Debug logging shorthand.
#define GNUNET_malloc(size)
Wrapper around malloc.
uint16_t ssh_port
SSH port to use, 0 for default (in NBO).
Definition: testbed.h:77
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:

◆ handle_slave_get_config()

static void handle_slave_get_config ( void *  cls,
const struct GNUNET_TESTBED_SlaveGetConfigurationMessage msg 
)
static

Handler for #GNUNET_MESSAGE_TYPE_TESTBED_GETSLAVECONFIG messages.

Parameters
clsidentification of the client
msgthe actual message

Definition at line 618 of file gnunet-service-testbed.c.

References cfg, config, GNUNET_TESTBED_SlaveConfiguration::config_size, env, GNUNET_assert, GNUNET_CONFIGURATION_serialize(), GNUNET_free, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_ntohll(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_get_mq(), GNUNET_TESTBED_compress_config_(), GNUNET_TESTBED_host_get_cfg_(), GST_send_operation_fail_msg(), GST_slave_list, GST_slave_list_size, Slave::host_id, GNUNET_TESTBED_SlaveGetConfigurationMessage::operation_id, GNUNET_TESTBED_SlaveConfiguration::operation_id, GNUNET_TESTBED_SlaveGetConfigurationMessage::slave_id, and GNUNET_TESTBED_SlaveConfiguration::slave_id.

620 {
621  struct GNUNET_SERVICE_Client *client = cls;
622  struct Slave *slave;
623  struct GNUNET_TESTBED_SlaveConfiguration *reply;
624  const struct GNUNET_CONFIGURATION_Handle *cfg;
625  struct GNUNET_MQ_Envelope *env;
626  char *config;
627  char *xconfig;
628  size_t config_size;
629  size_t xconfig_size;
630  uint64_t op_id;
631  uint32_t slave_id;
632 
633  slave_id = ntohl(msg->slave_id);
634  op_id = GNUNET_ntohll(msg->operation_id);
635  if ((GST_slave_list_size <= slave_id) ||
636  (NULL == GST_slave_list[slave_id]))
637  {
638  /* FIXME: Add forwardings for this type of message here.. */
640  op_id,
641  "Slave not found");
643  return;
644  }
645  slave = GST_slave_list[slave_id];
647  config = GNUNET_CONFIGURATION_serialize(cfg,
648  &config_size);
649  /* FIXME: maybe we want to transmit the delta to the default here? */
650  xconfig_size = GNUNET_TESTBED_compress_config_(config,
651  config_size,
652  &xconfig);
653  GNUNET_free(config);
654  GNUNET_assert(xconfig_size + sizeof(struct GNUNET_TESTBED_SlaveConfiguration) <= UINT16_MAX);
655  GNUNET_assert(xconfig_size <= UINT16_MAX);
656  env = GNUNET_MQ_msg_extra(reply,
657  xconfig_size,
659  reply->slave_id = msg->slave_id;
660  reply->operation_id = msg->operation_id;
661  reply->config_size = htons((uint16_t)config_size);
662  GNUNET_memcpy(&reply[1],
663  xconfig,
664  xconfig_size);
665  GNUNET_free(xconfig);
667  env);
669 }
#define GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION
Message which contains the configuration of slave controller.
void GST_send_operation_fail_msg(struct GNUNET_SERVICE_Client *client, uint64_t operation_id, const char *emsg)
Send operation failure message to client.
uint32_t slave_id
The id of the host where the slave is running.
Definition: testbed.h:647
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
Definition: service.c:2424
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
uint64_t operation_id
Operation ID.
Definition: testbed.h:652
uint16_t config_size
The size of the configuration when uncompressed.
Definition: testbed.h:657
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
Structure representing a connected(directly-linked) controller.
Handle to a client that is connected to a service.
Definition: service.c:246
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
struct GNUNET_TESTBED_Host ** GST_host_list
Array of hosts.
static const struct GNUNET_CONFIGURATION_Handle * config
const struct GNUNET_CONFIGURATION_Handle * GNUNET_TESTBED_host_get_cfg_(const struct GNUNET_TESTBED_Host *host)
Obtain the host&#39;s configuration template.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
uint64_t operation_id
Operation ID.
Definition: testbed.h:631
Reply to GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION message.
Definition: testbed.h:638
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
size_t GNUNET_TESTBED_compress_config_(const char *config, size_t size, char **xconfig)
Compresses given configuration using zlib compress.
Definition: testbed_api.c:1750
char * GNUNET_CONFIGURATION_serialize(const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size)
Serializes the given configuration.
uint32_t host_id
The id of the host this controller is running on.
configuration data
Definition: configuration.c:83
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:351
uint32_t slave_id
The id of the slave host.
Definition: testbed.h:626
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2234
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:48
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:

◆ GST_clear_fopcq()

void GST_clear_fopcq ( void  )

Clears the forwarded operations queue.

Definition at line 676 of file gnunet-service-testbed.c.

References ForwardedOperationContext::cls, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_SCHEDULER_cancel(), GNUNET_TESTBED_forward_operation_msg_cancel_(), HandlerContext_ShutdownPeers::nslaves, OP_FORWARDED, OP_GET_SLAVE_CONFIG, OP_LINK_CONTROLLERS, OP_MANAGE_SERVICE, OP_OVERLAY_CONNECT, OP_PEER_CREATE, OP_PEER_DESTROY, OP_PEER_INFO, OP_PEER_RECONFIGURE, OP_PEER_START, OP_PEER_STOP, OP_SHUTDOWN_PEERS, ForwardedOperationContext::opc, ForwardedOperationContext::timeout_task, and ForwardedOperationContext::type.

Referenced by handle_shutdown_peers(), and shutdown_task().

677 {
678  struct ForwardedOperationContext *fopc;
679 
680  while (NULL != (fopc = fopcq_head))
681  {
683  fopcq_tail,
684  fopc);
686  if (NULL != fopc->timeout_task)
688  switch (fopc->type)
689  {
690  case OP_PEER_CREATE:
691  GNUNET_free(fopc->cls);
692  break;
693 
694  case OP_SHUTDOWN_PEERS:
695  {
696  struct HandlerContext_ShutdownPeers *hc = fopc->cls;
697 
698  GNUNET_assert(0 < hc->nslaves);
699  hc->nslaves--;
700  if (0 == hc->nslaves)
701  GNUNET_free(hc);
702  }
703  break;
704 
705  case OP_PEER_START:
706  case OP_PEER_STOP:
707  case OP_PEER_DESTROY:
708  case OP_PEER_INFO:
709  case OP_OVERLAY_CONNECT:
710  case OP_LINK_CONTROLLERS:
711  case OP_GET_SLAVE_CONFIG:
712  case OP_MANAGE_SERVICE:
713  case OP_PEER_RECONFIGURE:
714  break;
715 
716  case OP_FORWARDED:
717  GNUNET_assert(0);
718  }
719  ;
720  GNUNET_free(fopc);
721  }
722 }
struct GNUNET_SCHEDULER_Task * timeout_task
Task ID for the timeout task.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct OperationContext * opc
The generated operation context.
Stop and destroy all peers.
Definition: testbed_api.h:98
Reconfigure a peer.
Definition: testbed_api.h:73
Link controllers operation.
Definition: testbed_api.h:88
struct ForwardedOperationContext * fopcq_head
DLL head for forwarded operation contexts.
void GNUNET_TESTBED_forward_operation_msg_cancel_(struct OperationContext *opc)
Function to cancel an operation created by simply forwarding an operation message.
Definition: testbed_api.c:1399
enum OperationType type
The type of the operation which is forwarded.
Peer destroy operation.
Definition: testbed_api.h:63
Peer start operation.
Definition: testbed_api.h:53
unsigned int nslaves
The number of slave we expect to hear from since we forwarded the GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOW...
void * cls
Closure pointer.
Overlay connection operation.
Definition: testbed_api.h:78
Forwarded operation.
Definition: testbed_api.h:83
Peer stop operation.
Definition: testbed_api.h:58
Get slave config operation.
Definition: testbed_api.h:93
Start/stop service at a peer.
Definition: testbed_api.h:103
struct ForwardedOperationContext * fopcq_tail
DLL tail for forwarded operation contexts.
Peer create operation.
Definition: testbed_api.h:48
Context data for GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS handler.
Context information for operations forwarded to subcontrollers.
Get peer information operation.
Definition: testbed_api.h:68
#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:

◆ shutdown_task()

static void shutdown_task ( void *  cls)
static

Task to clean up and shutdown nicely.

Parameters
clsNULL

Definition at line 731 of file gnunet-service-testbed.c.

References GNUNET_CONFIGURATION_destroy(), GNUNET_free, GNUNET_free_non_null, GNUNET_TESTBED_host_destroy(), GNUNET_TESTBED_operation_queue_destroy_(), GNUNET_TESTING_system_destroy(), GNUNET_YES, GST_barriers_destroy(), GST_cache_clear(), GST_clear_fopcq(), GST_connection_pool_destroy(), GST_destroy_peers(), GST_free_lcf(), GST_free_mctxq(), GST_free_nccq(), GST_free_occq(), GST_free_prcq(), GST_free_roccq(), GST_host_list_size, GST_neighbour_list_clean(), GST_route_list_clear(), GST_slave_list_clear(), GST_stats_destroy(), hostname, id, LOG_DEBUG, Context::master_ip, and Context::system.

Referenced by testbed_run().

732 {
733  uint32_t id;
734 
735  LOG_DEBUG("Shutting down testbed service\n");
736  /* cleanup any remaining forwarded operations */
737  GST_clear_fopcq();
738  GST_free_lcf();
739  GST_free_mctxq();
740  GST_free_occq();
741  GST_free_roccq();
742  GST_free_nccq();
744  GST_free_prcq();
745  /* Clear peer list */
747  /* Clear route list */
749  /* Clear GST_slave_list */
751  /* Clear host list */
752  for (id = 0; id < GST_host_list_size; id++)
753  if (NULL != GST_host_list[id])
756  if (NULL != GST_context)
757  {
759  if (NULL != GST_context->system)
761  GNUNET_YES);
763  GST_context = NULL;
764  }
766  /* Free hello cache */
767  GST_cache_clear();
770  GST_opq_openfds = NULL;
774 }
unsigned int GST_host_list_size
The size of the host list.
void GST_route_list_clear(void)
Cleans up the route list.
void GST_barriers_destroy()
Function to stop the barrier service.
void GST_clear_fopcq()
Clears the forwarded operations queue.
void GST_stats_destroy(void)
Shutdown the status calls module.
char * master_ip
The network address of the master controller.
struct GNUNET_TESTING_System * system
The TESTING system handle for starting peers locally.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
void GST_free_mctxq(void)
Frees the ManageServiceContext queue.
struct OperationQueue * GST_opq_openfds
Operation queue for open file descriptors.
struct GNUNET_TESTBED_Host ** GST_host_list
Array of hosts.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
void GST_cache_clear(void)
Clear cache.
void GNUNET_TESTBED_operation_queue_destroy_(struct OperationQueue *queue)
Destroys an operation queue.
void GNUNET_TESTING_system_destroy(struct GNUNET_TESTING_System *system, int remove_paths)
Free system resources.
Definition: testing.c:530
void GNUNET_TESTBED_host_destroy(struct GNUNET_TESTBED_Host *host)
Destroy a host handle.
static char * hostname
Our hostname; we give this to all the peers we start.
struct Context * GST_context
The master context; generated with the first INIT message.
void GST_free_prcq(void)
Cleans up the Peer reconfigure context list.
#define GNUNET_YES
Definition: gnunet_common.h:77
void GST_free_lcf(void)
Cleans up the queue used for forwarding link controllers requests.
void GST_free_occq(void)
Clears all pending overlay connect contexts in queue.
struct GNUNET_CONFIGURATION_Handle * GST_config
Our configuration.
#define LOG_DEBUG(...)
Debug logging shorthand.
void GST_connection_pool_destroy()
Cleanup the connection pool.
#define GNUNET_free(ptr)
Wrapper around free.
void GST_destroy_peers(void)
Stops and destroys all peers.
void GST_free_roccq(void)
Clears all pending remote overlay connect contexts in queue.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ client_connect_cb()

static void* client_connect_cb ( void *  cls,
struct GNUNET_SERVICE_Client client,
struct GNUNET_MQ_Handle mq 
)
static

Callback for client connect.

Parameters
clsNULL
clientthe client which has disconnected
mqqueue for sending messages to client
Returns
client

Definition at line 786 of file gnunet-service-testbed.c.

Referenced by testbed_run().

789 {
790  return client;
791 }
Here is the caller graph for this function:

◆ client_disconnect_cb()

static void client_disconnect_cb ( void *  cls,
struct GNUNET_SERVICE_Client client,
void *  app_ctx 
)
static

Callback for client disconnect.

Parameters
clsNULL
clientthe client which has disconnected
app_ctxshould match client

Definition at line 802 of file gnunet-service-testbed.c.

References ForwardedOperationContext::client, Context::client, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_SCHEDULER_cancel(), GST_forwarded_operation_timeout(), GST_link_notify_disconnect(), GST_notify_client_disconnect_oc(), GST_notify_client_disconnect_peers(), LOG, ForwardedOperationContext::next, and ForwardedOperationContext::timeout_task.

Referenced by testbed_run().

805 {
806  struct ForwardedOperationContext *fopc;
807  struct ForwardedOperationContext *fopcn;
808 
809  GNUNET_assert(client == app_ctx);
813  for (fopc = fopcq_head; NULL != fopc; fopc = fopcn)
814  {
815  fopcn = fopc->next;
816  if (fopc->client == client)
817  {
818  /* handle as if it were a timeout */
821  }
822  }
823  if (NULL == GST_context)
824  return;
825  if (client == GST_context->client)
826  {
828  "Master client disconnected\n");
829  GST_context->client = NULL;
830  /* should not be needed as we're terminated by failure to read
831  * from stdin, but if stdin fails for some reason, this shouldn't
832  * hurt for now --- might need to revise this later if we ever
833  * decide that master connections might be temporarily down
834  * for some reason */
835  //GNUNET_SCHEDULER_shutdown ();
836  }
837 }
struct GNUNET_SCHEDULER_Task * timeout_task
Task ID for the timeout task.
void GST_notify_client_disconnect_oc(struct GNUNET_SERVICE_Client *client)
Notify OC subsystem that client disconnected.
#define LOG(kind,...)
Definition: arm_api.c:33
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void GST_forwarded_operation_timeout(void *cls)
Task to free resources when forwarded operation has been timed out.
struct ForwardedOperationContext * fopcq_head
DLL head for forwarded operation contexts.
struct GNUNET_SERVICE_Client * client
The client handle associated with this context.
void GST_notify_client_disconnect_peers(struct GNUNET_SERVICE_Client *client)
Notify peers subsystem that client disconnected.
struct GNUNET_SERVICE_Client * client
The client to which we have to reply.
struct Context * GST_context
The master context; generated with the first INIT message.
struct ForwardedOperationContext * next
The next pointer for DLL.
Context information for operations forwarded to subcontrollers.
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:

◆ testbed_run()

static void testbed_run ( void *  cls,
const struct GNUNET_CONFIGURATION_Handle cfg,
struct GNUNET_SERVICE_Handle service 
)
static

Testbed setup.

Parameters
clsclosure
cfgconfiguration to use
servicethe initialized server

Definition at line 848 of file gnunet-service-testbed.c.

References add_host(), client_connect_cb(), client_disconnect_cb(), GNUNET_assert, GNUNET_break, GNUNET_CONFIGURATION_dup(), GNUNET_CONFIGURATION_get_value_filename(), GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONFIGURATION_get_value_time(), GNUNET_free, GNUNET_log_setup(), GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS, GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER, GNUNET_MESSAGE_TYPE_TESTBED_DESTROY_PEER, GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION, GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION, GNUNET_MESSAGE_TYPE_TESTBED_INIT, GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS, GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE, GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT, GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER, GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT, GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS, GNUNET_MESSAGE_TYPE_TESTBED_START_PEER, GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_OK, GNUNET_SCHEDULER_add_shutdown(), GNUNET_SERVICE_MAIN(), GNUNET_SERVICE_OPTION_NONE, GNUNET_TESTBED_operation_queue_create_(), GST_barriers_init(), GST_cache_init(), GST_connection_pool_init(), GST_stats_init(), GST_timeout, hostname, init, LOG_DEBUG, OPERATION_QUEUE_TYPE_FIXED, and shutdown_task().

851 {
852  char *logfile;
853  unsigned long long num;
854 
855  LOG_DEBUG("Starting testbed\n");
856  if (GNUNET_OK ==
857  GNUNET_CONFIGURATION_get_value_filename(cfg, "TESTBED", "LOG_FILE",
858  &logfile))
859  {
861  GNUNET_log_setup("testbed",
862  "DEBUG",
863  logfile));
864  GNUNET_free(logfile);
865  }
868  "testbed",
869  "CACHE_SIZE",
870  &num));
871  GST_cache_init((unsigned int)num);
872  GST_connection_pool_init((unsigned int)num);
875  "testbed",
876  "MAX_OPEN_FDS",
877  &num));
879  (unsigned int)num);
882  "testbed",
883  "OPERATION_TIMEOUT",
884  &GST_timeout));
887  "testbed",
888  "HOSTNAME",
889  &hostname));
892  NULL);
893  LOG_DEBUG("Testbed startup complete\n");
896 }
int GNUNET_CONFIGURATION_get_value_time(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, struct GNUNET_TIME_Relative *time)
Get a configuration value that should be a relative time.
int GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
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.
Operation queue which permits a fixed maximum number of operations to be active at any time...
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
struct OperationQueue * GNUNET_TESTBED_operation_queue_create_(enum OperationQueueType type, unsigned int max_active)
Create an operation queue.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct OperationQueue * GST_opq_openfds
Operation queue for open file descriptors.
void GST_barriers_init(struct GNUNET_CONFIGURATION_Handle *cfg)
Function to initialise barrriers component.
void GST_cache_init(unsigned int size)
Initializes the cache.
int GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_dup(const struct GNUNET_CONFIGURATION_Handle *cfg)
Duplicate an existing configuration object.
struct GNUNET_TIME_Relative GST_timeout
Timeout for operations which may take some time.
static char * hostname
Our hostname; we give this to all the peers we start.
void GST_connection_pool_init(unsigned int size)
Initialise the connection pool.
int GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
void GST_stats_init(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize logging CPU and IO statisticfs.
int GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
struct GNUNET_CONFIGURATION_Handle * GST_config
Our configuration.
static void shutdown_task(void *cls)
Task to clean up and shutdown nicely.
#define LOG_DEBUG(...)
Debug logging shorthand.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:

◆ GNUNET_SERVICE_MAIN()

GNUNET_SERVICE_MAIN ( "testbed"  ,
GNUNET_SERVICE_OPTION_NONE  ,
testbed_run,
client_connect_cb,
client_disconnect_cb,
NULL  ,
GNUNET_MQ_hd_var_size(init, GNUNET_MESSAGE_TYPE_TESTBED_INIT, struct GNUNET_TESTBED_InitMessage, NULL)  ,
GNUNET_MQ_hd_var_size(add_host, GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST, struct GNUNET_TESTBED_AddHostMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(slave_get_config, GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION, struct GNUNET_TESTBED_SlaveGetConfigurationMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(link_controllers, GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS, struct GNUNET_TESTBED_ControllerLinkRequest, NULL)  ,
GNUNET_MQ_hd_var_size(remote_overlay_connect, GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT, struct GNUNET_TESTBED_RemoteOverlayConnectMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(overlay_connect, GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT, struct GNUNET_TESTBED_OverlayConnectMessage, NULL)  ,
GNUNET_MQ_hd_var_size(peer_create, GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER, struct GNUNET_TESTBED_PeerCreateMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(peer_destroy, GNUNET_MESSAGE_TYPE_TESTBED_DESTROY_PEER, struct GNUNET_TESTBED_PeerDestroyMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(peer_start, GNUNET_MESSAGE_TYPE_TESTBED_START_PEER, struct GNUNET_TESTBED_PeerStartMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(peer_stop, GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER, struct GNUNET_TESTBED_PeerStopMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(peer_get_config, GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION, struct GNUNET_TESTBED_PeerGetConfigurationMessage, NULL)  ,
GNUNET_MQ_hd_var_size(manage_peer_service, GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE, struct GNUNET_TESTBED_ManagePeerServiceMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(shutdown_peers, GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS, struct GNUNET_TESTBED_ShutdownPeersMessage, NULL)  ,
GNUNET_MQ_hd_var_size(peer_reconfigure, GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER, struct GNUNET_TESTBED_PeerReconfigureMessage, NULL)  ,
GNUNET_MQ_hd_var_size(barrier_init, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT, struct GNUNET_TESTBED_BarrierInit, NULL)  ,
GNUNET_MQ_hd_var_size(barrier_cancel, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL, struct GNUNET_TESTBED_BarrierCancel, NULL)  ,
GNUNET_MQ_hd_var_size(barrier_status, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS, struct GNUNET_TESTBED_BarrierStatusMsg, NULL)  ,
GNUNET_MQ_handler_end()   
)

Define "main" method using service macro.

Referenced by testbed_run().

Here is the caller graph for this function:

Variable Documentation

◆ GST_config

struct GNUNET_CONFIGURATION_Handle* GST_config

Our configuration.

Definition at line 38 of file gnunet-service-testbed.c.

◆ GST_context

struct Context* GST_context

◆ GST_host_list

struct GNUNET_TESTBED_Host** GST_host_list

◆ fopcq_head

struct ForwardedOperationContext* fopcq_head

◆ fopcq_tail

struct ForwardedOperationContext* fopcq_tail

◆ GST_opq_openfds

struct OperationQueue* GST_opq_openfds

Operation queue for open file descriptors.

Definition at line 63 of file gnunet-service-testbed.c.

Referenced by GST_connection_pool_get_handle(), and GST_neighbour_get_connection().

◆ GST_timeout

struct GNUNET_TIME_Relative GST_timeout

◆ GST_host_list_size

unsigned int GST_host_list_size

The size of the host list.

Definition at line 73 of file gnunet-service-testbed.c.

Referenced by handle_link_controllers(), host_list_add(), and shutdown_task().

◆ GST_peer_list_size

unsigned int GST_peer_list_size

◆ hostname

char* hostname
static