37 #define LOG(kind, ...) \
38 GNUNET_log_from (kind, "testbed-links", __VA_ARGS__)
43 #define EVENT_MASK (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED)
424 struct Slave *slave = cls;
536 host_id = route->
thru;
556 uint64_t operation_id,
577 msize += xconfig_size;
580 msize += strlen (emsg);
630 goto registration_error;
637 goto registration_error;
649 "Host registration failed with message: %s\n",
679 "A forwarded controller link operation has timed out\n");
683 "A forwarded controller link operation has timed out\n");
811 struct Slave *slave = cls;
841 "Could not connect to delegated controller");
993 LOG_DEBUG (
"Attempting to get connection to controller on host %u\n",
1079 if (NULL != ncc->
nh)
1153 "Could not connect to delegated controller");
1211 struct Route *route;
1212 struct Route *new_route;
1214 uint32_t delegated_host_id;
1215 uint32_t slave_host_id;
1223 delegated_host_id = ntohl (
msg->delegated_host_id);
1228 "Trying to link ourselves\n");
1236 "Delegated host %u not registered with us\n",
1241 slave_host_id = ntohl (
msg->slave_host_id);
1246 "Slave host %u not registered with us\n",
1251 if (slave_host_id == delegated_host_id)
1254 "Slave and delegated host are same\n");
1261 struct Slave *slave;
1264 if (1 !=
msg->is_subordinate)
1276 LOG_DEBUG (
"Received request to establish a link to host %u\n",
1303 LOG_DEBUG (
"Received request to start and establish a link to host %u\n",
1306 slave->
host_id = delegated_host_id;
1320 new_route->
dest = delegated_host_id;
1330 "No route towards slave host");
1363 if (1 !=
msg->is_subordinate)
1377 new_route->
dest = delegated_host_id;
1398 for (ncc =
ncc_head; NULL != ncc; ncc = nccn)
1423 for (lcf =
lcf_head; NULL != lcf; lcf = lcfn)
1426 if ((NULL != lcf) &&
1429 if (NULL != lcf->
op)
1459 if (NULL != lcf->
op)
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
struct GNUNET_HashCode key
The key used in the DHT.
uint16_t status
See PRISM_STATUS_*-constants.
static char * value
Value of the record to add/remove.
#define LOG_DEBUG(...)
Debug logging shorthand.
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
struct OperationQueue * GST_opq_openfds
Operation queue for open file descriptors.
struct GNUNET_TESTBED_Host ** GST_host_list
Array of hosts.
struct Context * GST_context
The master context; generated with the first INIT message.
struct GNUNET_TIME_Relative GST_timeout
Timeout for operations which may take some time.
unsigned int GST_host_list_size
The size of the host list.
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.
data structures shared amongst components of TESTBED service
#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 ...
void GST_cleanup_focc(struct ForwardedOverlayConnectContext *focc)
Cleans up ForwardedOverlayConnectContext.
struct NeighbourConnectNotification * GST_neighbour_get_connection(struct Neighbour *n, GST_NeighbourConnectNotifyCallback cb, void *cb_cls)
Try to open a connection to the given neighbour.
static void slave_event_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Callback for event from slave controllers.
static void destroy_slave(struct Slave *slave)
Destroy a Slave object.
void GST_neighbour_get_connection_cancel(struct NeighbourConnectNotification *h)
Cancel the request for opening a connection to the neighbour.
void GST_free_lcf()
Cleans up the queue used for forwarding link controllers requests.
static void route_list_add(struct Route *route)
Adds a route to the route list.
static void slave_status_cb(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, int status)
Callback to signal successful startup of the controller process.
static void lcf_proc_task(void *cls)
The Link Controller forwarding task.
static void kill_slave(struct Slave *slave)
Kill a Slave object.
struct Neighbour * GST_get_neighbour(uint32_t id)
Get a neighbour from the neighbour list.
static struct LCFContext * lcf_head
The LCF queue.
#define EVENT_MASK
The event mask for the events we listen from sub-controllers.
struct Neighbour * GST_create_neighbour(struct GNUNET_TESTBED_Host *host)
Function to create a neighbour and add it into the neighbour list.
static void trigger_notifications(struct Neighbour *n)
Trigger notification task if there are notification requests currently waiting in the given neighbour...
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 opstart_neighbour_conn(void *cls)
Callback to be called when the neighbour connect operation is started.
void GST_slave_list_clear()
Cleans up the slave list.
static void oprelease_neighbour_conn(void *cls)
Callback to be called when the neighbour connect operation is released.
static void timeout_neighbour_connect(void *cls)
Task to be run upon timeout while attempting to connect to the neighbour.
static void neighbour_connect_notify_task(void *cls)
Task to call the notification queued in the notifications list of the given neighbour.
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...
unsigned int GST_slave_list_size
The size of directly linked neighbours list.
void handle_link_controllers(void *cls, const struct GNUNET_TESTBED_ControllerLinkRequest *msg)
Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS message.
static unsigned int route_list_size
The size of the route list.
static void lcf_proc_cc(void *cls, const char *emsg)
Completion callback for host registrations while forwarding Link Controller messages.
static void lcf_forwarded_operation_timeout(void *cls)
Task to free resources when forwarded link controllers has been timedout.
static struct Neighbour ** neighbour_list
The neighbour list.
void GST_neighbour_release_connection(struct Neighbour *n)
Release the connection to the neighbour.
static void cleanup_ncc(struct NeighbourConnectCtxt *ncc)
Cleanup neighbour connect contexts.
void GST_neighbour_list_clean()
Cleans up the neighbour list.
static void slave_list_add(struct Slave *slave)
Adds a slave to the slave array.
static void neighbour_connect_cb(void *cls, struct GNUNET_TESTBED_Controller *c)
Callback called when a connection to the neighbour is made.
static unsigned int neighbour_list_size
The size of the neighbour list.
void GST_route_list_clear()
Cleans up the route list.
LCFContextState
States of LCFContext.
@ INIT
The Context has been initialized; Nothing has been done on it.
@ DELEGATED_HOST_REGISTERED
Delegated host has been registered at the forwarding controller.
@ SLAVE_HOST_REGISTERED
The slave host has been registered at the forwarding controller.
@ FINISHED
The context has been finished (may have error)
#define LOG(kind,...)
Redefine LOG with a changed log component string.
static struct LCFContext * lcf_tail
The tail for the LCF queue.
struct Slave ** GST_slave_list
A list of directly linked neighbours.
static void neighbour_list_add(struct Neighbour *n)
Add a neighbour to the neighbour list.
void GST_free_nccq()
Function to cleanup the neighbour connect contexts.
struct NeighbourConnectCtxt * ncc_head
DLL head for the list of neighbour connect contexts.
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.
static struct Route ** route_list
A list of routes.
static struct GNUNET_SCHEDULER_Task * lcf_proc_task_id
The lcf_task handle.
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 response for controller link operation.
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.
struct NeighbourConnectCtxt * ncc_tail
DLL tail for the list of neighbour connect contexts.
void(* GST_NeighbourConnectNotifyCallback)(void *cls, struct GNUNET_TESTBED_Controller *controller)
The notification callback to call when we are connect to neighbour.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
enum GNUNET_GenericReturnValue 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.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_WARNING
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
#define GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT
Message to signal the result of GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS request.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
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.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
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 GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
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...
void GNUNET_TESTBED_cancel_registration(struct GNUNET_TESTBED_HostRegistrationHandle *handle)
Cancel the pending registration.
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_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.
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.
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.
@ GNUNET_TESTBED_ET_OPERATION_FINISHED
A requested testbed operation has been completed.
char * master_ip
The network address of the master controller.
uint32_t host_id
Our host id according to this context.
Context information to used during operations which forward the overlay connect message.
struct RegisteredHostContext * rhc
Which host does this FOCC belong to?
struct ForwardedOverlayConnectContext * next
next ForwardedOverlayConnectContext in the DLL
struct GNUNET_SERVICE_Client * client
The client handle.
Entry in list of pending tasks.
Handle to a client that is connected to a service.
Client notifies controller that it should delegate requests for a particular client to a particular s...
Response message for ControllerLinkRequest message.
uint64_t operation_id
The id of the operation which created this message.
uint16_t config_size
The size of the compressed configuration.
Handle to interact with a GNUnet testbed controller.
Opaque handle to a host running experiments managed by the testing framework.
Opaque handle to an abstract operation to be executed by the testing framework.
A DLL of host registrations to be made.
Link controllers request forwarding context.
enum LCFContextState state
The state of this context.
uint32_t delegated_host_id
The delegated host.
struct GNUNET_SERVICE_Client * client
The client which has asked to perform this operation.
struct GNUNET_SCHEDULER_Task * timeout_task
The timeout task.
uint32_t slave_host_id
The slave host.
uint64_t operation_id
The id of the operation which created this context.
struct LCFContext * prev
The LCFContext.
struct Slave * gateway
The gateway which will pass the link message to delegated host.
int is_subordinate
should the slave controller start the delegated controller?
struct GNUNET_TESTBED_Operation * op
Handle for operations which are forwarded while linking controllers.
struct LCFContext * next
The LCFContext.
Context information used while linking controllers.
uint64_t operation_id
The ID of the operation.
struct GNUNET_SERVICE_Client * client
The client which initiated the link controller operation.
Context information for establishing a link to neighbour (Used is GST_handle_link_controllers()
struct NeighbourConnectNotification * nh
The notification handle associated with the neighbour's connection request.
uint64_t op_id
The id of the link-controllers operation responsible for creating this context.
struct NeighbourConnectCtxt * prev
DLL tail.
struct GNUNET_SCHEDULER_Task * timeout_task
Task to be run upon timeout.
struct Neighbour * n
The neighbour to whom connection should be made.
struct NeighbourConnectCtxt * next
DLL next for inclusion in the corresponding context list.
struct GNUNET_SERVICE_Client * client
The client requesting the connection.
Notification context to be used to notify when connection to the neighbour's controller is opened.
GST_NeighbourConnectNotifyCallback cb
The notification callback to call when we are connect to neighbour.
struct NeighbourConnectNotification * prev
DLL prev.
struct Neighbour * n
The neighbour.
void * cb_cls
The closure for the above callback.
struct NeighbourConnectNotification * next
DLL next for inclusion in neighbour's list of notification requests.
A connected controller which is not our child.
struct NeighbourConnectNotification * nl_tail
DLL tail for the list of notification requests.
struct GNUNET_TESTBED_Operation * conn_op
Operation handle for opening a lateral connection to another controller.
unsigned int reference_cnt
How many references are present currently to this neighbour's connection.
struct GNUNET_TESTBED_Controller * controller
The controller handle.
struct NeighbourConnectNotification * nl_head
DLL head for the list of notification requests.
unsigned int inactive
Is the conn_op inactivated?
struct GNUNET_SCHEDULER_Task * notify_task
Task id for the task to call notifications from the notification list.
uint32_t host_id
The id of the host this controller is running on.
This context information will be created for each host that is registered at slave controllers during...
struct ForwardedOverlayConnectContext * focc_dll_head
Head of the ForwardedOverlayConnectContext DLL.
uint32_t thru
The destination host is reachable thru.
uint32_t dest
destination host
Structure representing a connected(directly-linked) controller.
uint32_t host_id
The id of the host this controller is running on.
struct HostRegistration * hr_dll_tail
Tail of the host registration DLL.
struct GNUNET_TESTBED_Controller * controller
The controller handle.
struct HostRegistration * hr_dll_head
Head of the host registration DLL.
struct GNUNET_TESTBED_HostRegistrationHandle * rhandle
The current host registration handle.
struct GNUNET_TESTBED_ControllerProc * controller_proc
The controller process handle if we had started the controller.
struct GNUNET_CONTAINER_MultiHashMap * reghost_map
Hashmap to hold Registered host contexts.
struct LinkControllersContext * lcc
handle to lcc which is associated with this slave startup.
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.
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.
void GNUNET_TESTBED_controller_kill_(struct GNUNET_TESTBED_ControllerProc *cproc)
Sends termination signal to the controller's helper process.
void GNUNET_TESTBED_controller_destroy_(struct GNUNET_TESTBED_ControllerProc *cproc)
Cleans-up the controller's helper process handle.
const struct GNUNET_CONFIGURATION_Handle * GNUNET_TESTBED_host_get_cfg_(const struct GNUNET_TESTBED_Host *host)
Obtain the host's configuration template.
uint32_t GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host)
Obtain a host's unique global ID.
void GNUNET_TESTBED_operation_activate_(struct GNUNET_TESTBED_Operation *op)
Marks and inactive operation as active.
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 ...
void GNUNET_TESTBED_operation_queue_insert_(struct OperationQueue *queue, struct GNUNET_TESTBED_Operation *op)
Add an operation to a queue.
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 GNUNET_TESTBED_operation_begin_wait_(struct GNUNET_TESTBED_Operation *op)
Marks the given operation as waiting on the queues.