36 #define LOG(kind, ...) \ 37 GNUNET_log_from (kind, "testbed-links", __VA_ARGS__) 42 #define EVENT_MASK (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED) 328 GST_slave_list[slave->
host_id] = slave;
354 if (focc->
client == client)
372 route_list[route->
dest] = route;
389 neighbour_list[n->
host_id] = n;
402 if (NULL != route_list[
id])
423 struct Slave *slave = cls;
483 GST_slave_list[slave->
host_id] = NULL;
499 slave = GST_slave_list[
id];
506 slave = GST_slave_list[
id];
512 GST_slave_list = NULL;
531 while (NULL != (route = route_list[host_id]))
535 host_id = route->
thru;
576 msize += xconfig_size;
579 msize += strlen (emsg);
629 goto registration_error;
636 goto registration_error;
648 "Host registration failed with message: %s\n",
678 "A forwarded controller link operation has timed out\n");
682 "A forwarded controller link operation has timed out\n");
699 lcf_proc_task_id = NULL;
754 if (NULL != lcf_head)
810 struct Slave *slave = cls;
840 "Could not connect to delegated controller");
992 LOG_DEBUG (
"Attempting to get connection to controller on host %u\n",
1078 if (NULL != ncc->
nh)
1100 if (NULL == (n = neighbour_list[
id]))
1105 neighbour_list[
id] = NULL;
1123 return neighbour_list[
id];
1133 while (NULL != ncc_head)
1152 "Could not connect to delegated controller");
1210 struct Route *route;
1211 struct Route *new_route;
1227 "Trying to link ourselves\n");
1235 "Delegated host %u not registered with us\n",
1245 "Slave host %u not registered with us\n",
1250 if (slave_host_id == delegated_host_id)
1253 "Slave and delegated host are same\n");
1260 struct Slave *slave;
1269 (NULL != neighbour_list[delegated_host_id]))
1275 LOG_DEBUG (
"Received request to establish a link to host %u\n",
1296 (NULL != GST_slave_list[delegated_host_id]))
1302 LOG_DEBUG (
"Received request to start and establish a link to host %u\n",
1329 "No route towards slave host");
1345 if (NULL == lcf_head)
1368 (NULL != route_list[delegated_host_id]))
1397 for (ncc = ncc_head; NULL != ncc; ncc = nccn)
1400 if (ncc->
client == client)
1405 struct Slave *slave = GST_slave_list[i];
1416 if (lcc->
client == client)
1422 for (lcf = lcf_head; NULL != lcf; lcf = lcfn)
1425 if ((NULL != lcf) &&
1428 if (NULL != lcf->
op)
1447 if (NULL != lcf_head)
1449 if (NULL != lcf_proc_task_id)
1452 lcf_proc_task_id = NULL;
1456 for (lcf = lcf_head; NULL != lcf; lcf =
lcf_head)
1458 if (NULL != lcf->
op)
struct ForwardedOverlayConnectContext * focc_dll_head
Head of the ForwardedOverlayConnectContext DLL.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GNUNET_CONTAINER_MultiHashMap * reghost_map
Hashmap to hold Registered host contexts.
struct GNUNET_SCHEDULER_Task * timeout_task
Task to be run upon timeout.
A connected controller which is not our child.
static void lcf_proc_cc(void *cls, const char *emsg)
Completion callback for host registrations while forwarding Link Controller messages.
void GNUNET_TESTBED_cancel_registration(struct GNUNET_TESTBED_HostRegistrationHandle *handle)
Cancel the pending registration.
uint64_t operation_id
The id of the operation which created this context.
void GST_link_notify_disconnect(struct GNUNET_SERVICE_Client *client)
Clean up client handle if we stored any via handle_link_controllers(), the given client disconnected...
Context information for establishing a link to neighbour (Used is GST_handle_link_controllers() ...
This context information will be created for each host that is registered at slave controllers during...
static void opstart_neighbour_conn(void *cls)
Callback to be called when the neighbour connect operation is started.
static void trigger_notifications(struct Neighbour *n)
Trigger notification task if there are notification requests currently waiting in the given neighbour...
uint32_t host_id
The id of the host this controller is running on.
unsigned int GST_host_list_size
The size of the host list.
static struct Neighbour ** neighbour_list
The neighbour list.
struct Neighbour * n
The neighbour to whom connection should be made.
void GNUNET_TESTBED_controller_disconnect(struct GNUNET_TESTBED_Controller *c)
Stop the given controller (also will terminate all peers and controllers dependent on this controller...
struct GNUNET_MessageHeader * msg
uint64_t operation_id
The id of the operation which created this message.
Link controllers request forwarding context.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
unsigned int inactive
Is the conn_op inactivated?
uint32_t thru
The destination host is reachable thru.
Handle to interact with a GNUnet testbed controller.
struct NeighbourConnectNotification * nh
The notification handle associated with the neighbour's connection request.
struct NeighbourConnectNotification * GST_neighbour_get_connection(struct Neighbour *n, GST_NeigbourConnectNotifyCallback cb, void *cb_cls)
Try to open a connection to the given neigbour.
struct NeighbourConnectNotification * next
DLL next for inclusion in neighbour's list of notification requests.
data structures shared amongst components of TESTBED service
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
struct GNUNET_SERVICE_Client * client
The client handle.
static void lcf_forwarded_operation_timeout(void *cls)
Task to free resources when forwarded link controllers has been timedout.
struct LCFContext * prev
The LCFContext.
void GNUNET_TESTBED_controller_kill_(struct GNUNET_TESTBED_ControllerProc *cproc)
Sends termination signal to the controller's helper process.
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
void GST_slave_list_clear()
Cleans up the slave list.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Notification context to be used to notify when connection to the neighbour's controller is opened...
void GST_route_list_clear()
Cleans up the route list.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_controller_link(void *op_cls, struct GNUNET_TESTBED_Controller *master, struct GNUNET_TESTBED_Host *delegated_host, struct GNUNET_TESTBED_Host *slave_host, int is_subordinate)
Create a link from slave controller to delegated controller.
char * master_ip
The network address of the master controller.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_operation_create_(void *cls, OperationStart start, OperationRelease release)
Create an 'operation' to be performed.
void GNUNET_TESTBED_operation_release_(struct GNUNET_TESTBED_Operation *op)
An operation is 'done' (was cancelled or finished); remove it from the queues and release associated ...
int is_subordinate
should the slave controller start the delegated controller?
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.
#define LOG(kind,...)
Redefine LOG with a changed log component string.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
static void cleanup_ncc(struct NeighbourConnectCtxt *ncc)
Cleanup neighbour connect contexts.
static void route_list_add(struct Route *route)
Adds a route to the route list.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
static unsigned int route_list_size
The size of the route list.
struct GNUNET_TESTBED_Operation * op
Handle for operations which are forwarded while linking controllers.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct Route * GST_find_dest_route(uint32_t host_id)
Finds the route with directly connected host as destination through which the destination host can be...
Structure representing a connected(directly-linked) controller.
struct GNUNET_TESTBED_HostRegistrationHandle * rhandle
The current host registration handle.
Opaque handle to a host running experiments managed by the testing framework.
enum LCFContextState state
The state of this context.
void GNUNET_TESTBED_operation_queue_insert_(struct OperationQueue *queue, struct GNUNET_TESTBED_Operation *op)
Add an operation to a queue.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
void GST_free_nccq()
Function to cleanup the neighbour connect contexts.
Context information used while linking controllers.
struct NeighbourConnectCtxt * ncc_tail
DLL tail for the list of neighbour connect contexts.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct Slave * gateway
The gateway which will pass the link message to delegated host.
struct NeighbourConnectNotification * nl_tail
DLL tail for the list of notification requests.
struct OperationQueue * GST_opq_openfds
Operation queue for open file descriptors.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
#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 ...
static unsigned int neighbour_list_size
The size of the neighbour list.
static struct Route ** route_list
A list of routes.
Opaque handle to an abstract operation to be executed by the testing framework.
unsigned int GST_slave_list_size
The size of directly linked neighbours list.
Response message for ControllerLinkRequest message.
static void neighbour_list_add(struct Neighbour *n)
Add a neighbour to the neighbour list.
Handle to a client that is connected to a service.
static struct LCFContext * lcf_tail
The tail for the LCF queue.
uint32_t delegated_host_id
For which host should requests be delegated? NBO.
void GST_cleanup_focc(struct ForwardedOverlayConnectContext *focc)
Cleans up ForwardedOverlayConnectContext.
#define GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT
Message to signal the result of GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS request.
GST_NeigbourConnectNotifyCallback cb
The notification callback to call when we are connect to neighbour.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
void GST_neighbour_list_clean()
Cleans up the neighbour list.
char * GNUNET_TESTBED_compress_cfg_(const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size, size_t *xsize)
Function to serialize and compress using zlib a configuration through a configuration handle...
uint32_t host_id
Our host id according to this context.
struct GNUNET_SERVICE_Client * client
The client which has asked to perform this operation.
static char * value
Value of the record to add/remove.
static void neighbour_connect_notify_task(void *cls)
Task to call the notification queued in the notifications list of the given neighbour.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
void * cb_cls
The closure for the above callback.
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.
struct GNUNET_TESTBED_Host ** GST_host_list
Array of hosts.
Context information to used during operations which forward the overlay connect message.
A DLL of host registrations to be made.
void GST_neighbour_release_connection(struct Neighbour *n)
Release the connection to the neighbour.
A requested testbed operation has been completed.
uint16_t status
See PRISM_STATUS_*-constants.
static void slave_event_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Callback for event from slave controllers.
int GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
uint32_t GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host)
Obtain the host's unique global ID.
struct HostRegistration * hr_dll_tail
Tail of the host registration DLL.
struct GNUNET_TESTBED_Controller * controller
The controller handle.
struct Neighbour * GST_create_neighbour(struct GNUNET_TESTBED_Host *host)
Function to create a neigbour and add it into the neighbour list.
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...
uint32_t delegated_host_id
The delegated host.
const struct GNUNET_CONFIGURATION_Handle * GNUNET_TESTBED_host_get_cfg_(const struct GNUNET_TESTBED_Host *host)
Obtain the host's configuration template.
struct GNUNET_TESTBED_Operation * conn_op
Operation handle for opening a lateral connection to another controller.
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
void GNUNET_TESTBED_controller_destroy_(struct GNUNET_TESTBED_ControllerProc *cproc)
Cleans-up the controller's helper process handle.
struct HostRegistration * hr_dll_head
Head of the host registration DLL.
void GNUNET_TESTBED_operation_activate_(struct GNUNET_TESTBED_Operation *op)
Marks and inactive operation as active.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
static void send_controller_link_response(struct GNUNET_SERVICE_Client *client, uint64_t operation_id, const struct GNUNET_CONFIGURATION_Handle *cfg, const char *emsg)
Function to send a failure reponse for controller link operation.
int GNUNET_TESTBED_is_host_registered_(const struct GNUNET_TESTBED_Host *host, const struct GNUNET_TESTBED_Controller *const controller)
Checks whether a host has been registered.
struct GNUNET_HashCode key
The key used in the DHT.
struct GNUNET_TESTBED_ControllerProc * controller_proc
The controller process handle if we had started the controller.
uint16_t success
Set to GNUNET_YES to signify SUCCESS; GNUNET_NO to signify failure.
static void timeout_neighbour_connect(void *cls)
Task to be run upon timeout while attempting to connect to the neighbour.
static void neighbour_connect_cb(void *cls, struct GNUNET_TESTBED_Controller *c)
Callback called when a connection to the neighbour is made.
struct NeighbourConnectCtxt * prev
DLL tail.
static void slave_list_add(struct Slave *slave)
Adds a slave to the slave array.
uint64_t operation_id
The ID of the operation.
struct Neighbour * n
The neighbour.
uint32_t slave_host_id
The slave host.
struct GNUNET_MQ_Envelope * env
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
unsigned int reference_cnt
How many references are present currently to this neighbour's connection.
struct LinkControllersContext * lcc
handle to lcc which is associated with this slave startup.
struct GNUNET_TESTBED_Controller * GNUNET_TESTBED_controller_connect(struct GNUNET_TESTBED_Host *host, uint64_t event_mask, GNUNET_TESTBED_ControllerCallback cc, void *cc_cls)
Connect to a controller process.
uint16_t config_size
The size of the compressed configuration.
Delegated host has been registered at the forwarding controller.
uint64_t op_id
The id of the link-controllers operation responsible for creating this context.
struct NeighbourConnectCtxt * ncc_head
DLL head for the list of neighbour connect contexts.
#define EVENT_MASK
The event mask for the events we listen from sub-controllers.
struct NeighbourConnectCtxt * next
DLL next for inclusion in the corresponding context list.
static int drop_client_entries(void *cls, const struct GNUNET_HashCode *key, void *value)
Clean up all forwarded operation overlay context matching the client given in cls.
void(* GST_NeigbourConnectNotifyCallback)(void *cls, struct GNUNET_TESTBED_Controller *controller)
The notification callback to call when we are connect to neighbour.
struct GNUNET_TIME_Relative GST_timeout
Timeout for operations which may take some time.
struct NeighbourConnectNotification * prev
DLL prev.
struct ForwardedOverlayConnectContext * next
next ForwardedOverlayConnectContext in the DLL
uint32_t slave_host_id
Which host is responsible for managing the delegation? NBO.
uint32_t host_id
The id of the host this controller is running on.
void GNUNET_TESTBED_operation_begin_wait_(struct GNUNET_TESTBED_Operation *op)
Marks the given operation as waiting on the queues.
struct Context * GST_context
The master context; generated with the first INIT message.
struct GNUNET_SERVICE_Client * client
The client requesting the connection.
uint8_t is_subordinate
Set to 1 if the receiving controller is the master controller for the slave host (and thus responsibl...
struct NeighbourConnectNotification * nl_head
DLL head for the list of notification requests.
Entry in list of pending tasks.
The slave host has been registred at the forwarding controller.
static struct GNUNET_SCHEDULER_Task * lcf_proc_task_id
The lcf_task handle.
struct GNUNET_SCHEDULER_Task * timeout_task
The timeout task.
struct GNUNET_TESTBED_Controller * controller
The controller handle.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
void handle_link_controllers(void *cls, const struct GNUNET_TESTBED_ControllerLinkRequest *msg)
Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS message.
static void lcf_proc_task(void *cls)
The Link Controller forwarding task.
uint64_t operation_id
The id of the operation which created this message.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
static int reghost_free_iterator(void *cls, const struct GNUNET_HashCode *key, void *value)
Iterator for freeing hash map entries in a slave's reghost_map.
static void destroy_slave(struct Slave *slave)
Destroy a Slave object.
static void kill_slave(struct Slave *slave)
Kill a Slave object.
void GNUNET_TESTBED_operation_inactivate_(struct GNUNET_TESTBED_Operation *op)
Marks an active operation as inactive - the operation will be kept in a ready-to-be-released state an...
void GST_neighbour_get_connection_cancel(struct NeighbourConnectNotification *h)
Cancel the request for opening a connection to the neighbour.
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
struct LCFContext * next
The LCFContext.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
void GST_free_lcf()
Cleans up the queue used for forwarding link controllers requests.
uint32_t dest
destination host
The context has been finished (may have error)
#define LOG_DEBUG(...)
Debug logging shorthand.
static struct LCFContext * lcf_head
The LCF queue.
static void oprelease_neighbour_conn(void *cls)
Callback to be called when the neighbour connect operation is released.
struct GNUNET_TESTBED_ControllerProc * GNUNET_TESTBED_controller_start(const char *trusted_ip, struct GNUNET_TESTBED_Host *host, GNUNET_TESTBED_ControllerStatusCallback cb, void *cls)
Starts a controller process at the given host.
struct Neighbour * GST_get_neighbour(uint32_t id)
Get a neighbour from the neighbour list.
The Context has been initialized; Nothing has been done on it.
LCFContextState
States of LCFContext.
static void slave_status_cb(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, int status)
Callback to signal successfull startup of the controller process.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_SERVICE_Client * client
The client which initiated the link controller operation.
struct GNUNET_SCHEDULER_Task * notify_task
Task id for the task to call notifications from the notification list.
Client notifies controller that it should delegate requests for a particular client to a particular s...
struct Slave ** GST_slave_list
A list of directly linked neighbours.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.