GNUnet  0.10.x
Data Structures | Typedefs | Functions | Variables
gnunet-service-testbed_links.h File Reference

TESTBED service components that deals with starting slave controllers and establishing lateral links between controllers. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Slave
 Structure representing a connected(directly-linked) controller. More...
 

Typedefs

typedef void(* GST_NeigbourConnectNotifyCallback) (void *cls, struct GNUNET_TESTBED_Controller *controller)
 The notification callback to call when we are connect to neighbour. More...
 

Functions

void GST_neighbour_list_clean (void)
 Cleans up the neighbour list. More...
 
struct NeighbourGST_get_neighbour (uint32_t id)
 Get a neighbour from the neighbour list. More...
 
void GST_free_nccq (void)
 Function to cleanup the neighbour connect contexts. More...
 
struct NeighbourConnectNotificationGST_neighbour_get_connection (struct Neighbour *n, GST_NeigbourConnectNotifyCallback cb, void *cb_cls)
 Try to open a connection to the given neigbour. More...
 
void GST_neighbour_get_connection_cancel (struct NeighbourConnectNotification *h)
 Cancel the request for opening a connection to the neighbour. More...
 
void GST_neighbour_release_connection (struct Neighbour *n)
 Release the connection to the neighbour. More...
 
struct NeighbourGST_create_neighbour (struct GNUNET_TESTBED_Host *host)
 Function to create a neigbour and add it into the neighbour list. More...
 
void handle_link_controllers (void *cls, const struct GNUNET_TESTBED_ControllerLinkRequest *msg)
 Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS message. More...
 
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. More...
 
void GST_slave_list_clear (void)
 Cleans up the slave list. More...
 

Variables

struct Slave ** GST_slave_list
 A list of directly linked neighbours. More...
 
unsigned int GST_slave_list_size
 The size of directly linked neighbours list. More...
 

Detailed Description

TESTBED service components that deals with starting slave controllers and establishing lateral links between controllers.

Author
Sree Harsha Totakura

Definition in file gnunet-service-testbed_links.h.

Typedef Documentation

◆ GST_NeigbourConnectNotifyCallback

typedef void(* GST_NeigbourConnectNotifyCallback) (void *cls, struct GNUNET_TESTBED_Controller *controller)

The notification callback to call when we are connect to neighbour.

Parameters
clsthe closure given to GST_neighbour_get_connection()
controllerthe controller handle to the neighbour

Definition at line 132 of file gnunet-service-testbed_links.h.

Function Documentation

◆ GST_neighbour_list_clean()

void GST_neighbour_list_clean ( void  )

Cleans up the neighbour list.

Definition at line 1087 of file gnunet-service-testbed_links.c.

References Neighbour::conn_op, GNUNET_free, GNUNET_free_non_null, GNUNET_TESTBED_operation_release_(), id, and neighbour_list_size.

Referenced by shutdown_task().

1088 {
1089  struct Neighbour *n;
1090  unsigned int id;
1091 
1092  for (id = 0; id < neighbour_list_size; id++)
1093  {
1094  if (NULL == (n = neighbour_list[id]))
1095  continue;
1096  if (NULL != n->conn_op)
1098  GNUNET_free (n);
1099  neighbour_list[id] = NULL;
1100  }
1102 }
A connected controller which is not our child.
void GNUNET_TESTBED_operation_release_(struct GNUNET_TESTBED_Operation *op)
An operation is &#39;done&#39; (was cancelled or finished); remove it from the queues and release associated ...
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.
struct GNUNET_TESTBED_Operation * conn_op
Operation handle for opening a lateral connection to another controller.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GST_get_neighbour()

struct Neighbour* GST_get_neighbour ( uint32_t  id)

Get a neighbour from the neighbour list.

Parameters
idthe index of the neighbour in the neighbour list
Returns
the Neighbour; NULL if the given index in invalid (index greater than the list size or neighbour at that index is NULL)

Definition at line 1113 of file gnunet-service-testbed_links.c.

References id, and neighbour_list_size.

Referenced by handle_overlay_connect().

1114 {
1115  if (neighbour_list_size <= id)
1116  return NULL;
1117  return neighbour_list[id];
1118 }
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
Here is the caller graph for this function:

◆ GST_free_nccq()

void GST_free_nccq ( void  )

Function to cleanup the neighbour connect contexts.

Definition at line 1125 of file gnunet-service-testbed_links.c.

References cleanup_ncc().

Referenced by shutdown_task().

1126 {
1127  while (NULL != ncc_head)
1129 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GST_neighbour_get_connection()

struct NeighbourConnectNotification* GST_neighbour_get_connection ( struct Neighbour n,
GST_NeigbourConnectNotifyCallback  cb,
void *  cb_cls 
)

Try to open a connection to the given neigbour.

If the connection is open already, then it is re-used. If not, the request is queued in the operation queues responsible for bounding the total number of file descriptors. The actual connection will happen when the operation queue marks the corresponding operation as active.

Parameters
nthe neighbour to open a connection to
cbthe notification callback to call when the connection is opened
cb_clsthe closure for the above callback

Definition at line 979 of file gnunet-service-testbed_links.c.

References NeighbourConnectNotification::cb, NeighbourConnectNotification::cb_cls, Neighbour::conn_op, Neighbour::controller, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_new, GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_insert_(), GST_opq_openfds, h, Neighbour::host_id, LOG_DEBUG, NeighbourConnectNotification::n, Neighbour::nl_head, Neighbour::nl_tail, oprelease_neighbour_conn(), opstart_neighbour_conn(), and trigger_notifications().

Referenced by handle_link_controllers(), and handle_overlay_connect().

982 {
984 
985  GNUNET_assert (NULL != cb);
986  LOG_DEBUG ("Attempting to get connection to controller on host %u\n",
987  n->host_id);
989  h->n = n;
990  h->cb = cb;
991  h->cb_cls = cb_cls;
993  if (NULL == n->conn_op)
994  {
995  GNUNET_assert (NULL == n->controller);
1000  return h;
1001  }
1003  return h;
1004 }
uint32_t host_id
The id of the host this controller is running on.
#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&#39;s controller is opened...
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_operation_create_(void *cls, OperationStart start, OperationRelease release)
Create an &#39;operation&#39; to be performed.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
void GNUNET_TESTBED_operation_queue_insert_(struct OperationQueue *queue, struct GNUNET_TESTBED_Operation *op)
Add an operation to a queue.
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.
Definition: gnunet-arm.c:94
GST_NeigbourConnectNotifyCallback cb
The notification callback to call when we are connect to neighbour.
void * cb_cls
The closure for the above callback.
struct GNUNET_TESTBED_Controller * controller
The controller handle.
struct GNUNET_TESTBED_Operation * conn_op
Operation handle for opening a lateral connection to another controller.
struct Neighbour * n
The neighbour.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
void GNUNET_TESTBED_operation_begin_wait_(struct GNUNET_TESTBED_Operation *op)
Marks the given operation as waiting on the queues.
struct NeighbourConnectNotification * nl_head
DLL head for the list of notification requests.
#define LOG_DEBUG(msg)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GST_neighbour_get_connection_cancel()

void GST_neighbour_get_connection_cancel ( struct NeighbourConnectNotification h)

Cancel the request for opening a connection to the neighbour.

Parameters
hthe notification handle

Definition at line 1013 of file gnunet-service-testbed_links.c.

References cleanup_task, Neighbour::conn_op, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_TESTBED_operation_inactivate_(), GNUNET_YES, Neighbour::inactive, NeighbourConnectNotification::n, Neighbour::nl_head, Neighbour::nl_tail, Neighbour::notify_task, Neighbour::reference_cnt, and trigger_notifications().

Referenced by cleanup_ncc(), and cleanup_occ_rp2c().

1014 {
1015  struct Neighbour *n;
1016  int cleanup_task;
1017 
1018  n = h->n;
1019  cleanup_task = (h == n->nl_head) ? GNUNET_YES : GNUNET_NO;
1021  GNUNET_free (h);
1022  if (GNUNET_NO == cleanup_task)
1023  return;
1024  if (NULL == n->notify_task)
1025  return;
1026  GNUNET_assert (0 < n->reference_cnt);
1027  n->reference_cnt--;
1029  n->notify_task = NULL;
1030  if (NULL == n->nl_head)
1031  {
1032  if ( (0 == n->reference_cnt) && (0 == n->inactive) )
1033  {
1034  n->inactive = 1;
1036  }
1037  return;
1038  }
1040 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
A connected controller which is not our child.
unsigned int inactive
Is the conn_op inactivated?
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_NO
Definition: gnunet_common.h:81
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.
struct Neighbour * n
The neighbour.
unsigned int reference_cnt
How many references are present currently to this neighbour&#39;s connection.
struct NeighbourConnectNotification * nl_head
DLL head for the list of notification requests.
#define GNUNET_YES
Definition: gnunet_common.h:80
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...
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_SCHEDULER_Task * notify_task
Task id for the task to call notifications from the notification list.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GST_neighbour_release_connection()

void GST_neighbour_release_connection ( struct Neighbour n)

Release the connection to the neighbour.

The actual connection will be closed if connections to other neighbour are waiting (to maintain a bound on the total number of connections that are open).

Parameters
nthe neighbour whose connection can be closed

Definition at line 1051 of file gnunet-service-testbed_links.c.

References Neighbour::conn_op, GNUNET_assert, GNUNET_TESTBED_operation_inactivate_(), Neighbour::inactive, and Neighbour::reference_cnt.

Referenced by cleanup_occ_rp2c(), and neighbour_connect_cb().

1052 {
1053  GNUNET_assert (0 == n->inactive);
1054  GNUNET_assert (0 < n->reference_cnt);
1055  n->reference_cnt--;
1056  if (0 == n->reference_cnt)
1057  {
1058  n->inactive = 1;
1060  }
1061 }
unsigned int inactive
Is the conn_op inactivated?
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
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&#39;s connection.
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...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GST_create_neighbour()

struct Neighbour* GST_create_neighbour ( struct GNUNET_TESTBED_Host host)

Function to create a neigbour and add it into the neighbour list.

Parameters
hostthe host of the neighbour

Definition at line 1181 of file gnunet-service-testbed_links.c.

References GNUNET_new, GNUNET_TESTBED_host_get_id_(), Neighbour::host_id, and neighbour_list_add().

Referenced by handle_link_controllers(), and handle_overlay_connect().

1182 {
1183  struct Neighbour *n;
1184 
1185  n = GNUNET_new (struct Neighbour);
1187  neighbour_list_add (n); /* just add; connect on-demand */
1188  return n;
1189 }
A connected controller which is not our child.
uint32_t host_id
The id of the host this controller is running on.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
uint32_t GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host)
Obtain the host&#39;s unique global ID.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_link_controllers()

void handle_link_controllers ( void *  cls,
const struct GNUNET_TESTBED_ControllerLinkRequest msg 
)

Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS message.

Parameters
clsidentification of the client
msgthe actual message

Definition at line 1199 of file gnunet-service-testbed_links.c.

References LCFContext::client, LinkControllersContext::client, NeighbourConnectCtxt::client, Slave::controller_proc, LCFContext::delegated_host_id, GNUNET_TESTBED_ControllerLinkRequest::delegated_host_id, Route::dest, LCFContext::gateway, GNUNET_assert, GNUNET_break, GNUNET_break_op, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CONTAINER_multihashmap_create(), GNUNET_ERROR_TYPE_WARNING, GNUNET_new, GNUNET_NO, GNUNET_ntohll(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_now(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_TESTBED_controller_start(), GST_context, GST_create_neighbour(), GST_find_dest_route(), GST_host_list, GST_host_list_size, GST_neighbour_get_connection(), GST_slave_list_size, GST_timeout, Slave::host_id, Context::host_id, INIT, LCFContext::is_subordinate, GNUNET_TESTBED_ControllerLinkRequest::is_subordinate, Slave::lcc, lcf_proc_task(), LOG, LOG_DEBUG, Context::master_ip, NeighbourConnectCtxt::n, neighbour_connect_cb(), neighbour_list_size, NeighbourConnectCtxt::nh, NeighbourConnectCtxt::op_id, LCFContext::operation_id, GNUNET_TESTBED_ControllerLinkRequest::operation_id, LinkControllersContext::operation_id, Slave::reghost_map, route_list_add(), route_list_size, LCFContext::slave_host_id, GNUNET_TESTBED_ControllerLinkRequest::slave_host_id, slave_list_add(), slave_status_cb(), LCFContext::state, Route::thru, timeout_neighbour_connect(), and NeighbourConnectCtxt::timeout_task.

1201 {
1202  struct GNUNET_SERVICE_Client *client = cls;
1203  struct LCFContext *lcf;
1204  struct Route *route;
1205  struct Route *new_route;
1206  uint64_t op_id;
1207  uint32_t delegated_host_id;
1208  uint32_t slave_host_id;
1209 
1210  if (NULL == GST_context)
1211  {
1212  GNUNET_break (0);
1213  GNUNET_SERVICE_client_drop (client);
1214  return;
1215  }
1216  delegated_host_id = ntohl (msg->delegated_host_id);
1217  if (delegated_host_id == GST_context->host_id)
1218  {
1219  GNUNET_break (0);
1221  "Trying to link ourselves\n");
1222  GNUNET_SERVICE_client_drop (client);
1223  return;
1224  }
1225  if ((delegated_host_id >= GST_host_list_size) ||
1226  (NULL == GST_host_list[delegated_host_id]))
1227  {
1229  "Delegated host %u not registered with us\n",
1230  delegated_host_id);
1231  GNUNET_SERVICE_client_drop (client);
1232  return;
1233  }
1234  slave_host_id = ntohl (msg->slave_host_id);
1235  if ((slave_host_id >= GST_host_list_size) ||
1236  (NULL == GST_host_list[slave_host_id]))
1237  {
1239  "Slave host %u not registered with us\n",
1240  slave_host_id);
1241  GNUNET_SERVICE_client_drop (client);
1242  return;
1243  }
1244  if (slave_host_id == delegated_host_id)
1245  {
1247  "Slave and delegated host are same\n");
1248  GNUNET_SERVICE_client_drop (client);
1249  return;
1250  }
1251  op_id = GNUNET_ntohll (msg->operation_id);
1252  if (slave_host_id == GST_context->host_id) /* Link from us */
1253  {
1254  struct Slave *slave;
1255  struct LinkControllersContext *lcc;
1256 
1257  if (1 != msg->is_subordinate)
1258  {
1259  struct Neighbour *n;
1260  struct NeighbourConnectCtxt *ncc;
1261 
1262  if ((delegated_host_id < neighbour_list_size) &&
1263  (NULL != neighbour_list[delegated_host_id]))
1264  {
1265  GNUNET_break (0);
1266  GNUNET_SERVICE_client_drop (client);
1267  return;
1268  }
1269  LOG_DEBUG ("Received request to establish a link to host %u\n",
1270  delegated_host_id);
1271  n = GST_create_neighbour (GST_host_list[delegated_host_id]);
1272  ncc = GNUNET_new (struct NeighbourConnectCtxt);
1273  ncc->n = n;
1274  ncc->op_id = op_id;
1275  ncc->client = client;
1276  ncc->nh = GST_neighbour_get_connection (n,
1278  ncc);
1279  ncc->timeout_task
1282  ncc);
1284  ncc_tail,
1285  ncc);
1287  return;
1288  }
1289  if ( (delegated_host_id < GST_slave_list_size) &&
1290  (NULL != GST_slave_list[delegated_host_id]) )
1291  {
1292  GNUNET_break (0);
1293  GNUNET_SERVICE_client_drop (client);
1294  return;
1295  }
1296  LOG_DEBUG ("Received request to start and establish a link to host %u\n",
1297  delegated_host_id);
1298  slave = GNUNET_new (struct Slave);
1299  slave->host_id = delegated_host_id;
1301  GNUNET_NO);
1302  slave_list_add (slave);
1303  lcc = GNUNET_new (struct LinkControllersContext);
1304  lcc->operation_id = op_id;
1305  lcc->client = client;
1306  slave->lcc = lcc;
1307  slave->controller_proc
1309  GST_host_list[slave->host_id],
1310  &slave_status_cb,
1311  slave);
1312  new_route = GNUNET_new (struct Route);
1313  new_route->dest = delegated_host_id;
1314  new_route->thru = GST_context->host_id;
1315  route_list_add (new_route);
1316  return;
1317  }
1318 
1319  /* Route the request */
1320  if (slave_host_id >= route_list_size)
1321  {
1323  "No route towards slave host");
1324  GNUNET_SERVICE_client_drop (client);
1325  return;
1326  }
1327  lcf = GNUNET_new (struct LCFContext);
1328  lcf->delegated_host_id = delegated_host_id;
1329  lcf->slave_host_id = slave_host_id;
1330  route = GST_find_dest_route (slave_host_id);
1331  GNUNET_assert (NULL != route); /* because we add routes carefully */
1333  GNUNET_assert (NULL != GST_slave_list[route->dest]);
1334  lcf->is_subordinate = msg->is_subordinate;
1335  lcf->state = INIT;
1336  lcf->operation_id = op_id;
1337  lcf->gateway = GST_slave_list[route->dest];
1338  lcf->client = client;
1339  if (NULL == lcf_head)
1340  {
1341  GNUNET_assert (NULL == lcf_proc_task_id);
1343  lcf_tail,
1344  lcf);
1346  lcf);
1347  }
1348  else
1349  {
1351  lcf_tail,
1352  lcf);
1353  }
1354  /* FIXME: Adding a new route should happen after the controllers are linked
1355  * successfully */
1356  if (1 != msg->is_subordinate)
1357  {
1359  return;
1360  }
1361  if ( (delegated_host_id < route_list_size) &&
1362  (NULL != route_list[delegated_host_id]) )
1363  {
1364  GNUNET_break_op (0); /* Are you trying to link delegated host twice
1365  * with is subordinate flag set to GNUNET_YES? */
1366  GNUNET_SERVICE_client_drop (client);
1367  return;
1368  }
1369  new_route = GNUNET_new (struct Route);
1370  new_route->dest = delegated_host_id;
1371  new_route->thru = route->dest;
1372  route_list_add (new_route);
1374 }
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.
uint64_t operation_id
The id of the operation which created this context.
Context information for establishing a link to neighbour (Used is GST_handle_link_controllers() ...
unsigned int GST_host_list_size
The size of the host list.
struct Neighbour * n
The neighbour to whom connection should be made.
Link controllers request forwarding context.
uint32_t thru
The destination host is reachable thru.
struct NeighbourConnectNotification * nh
The notification handle associated with the neighbour&#39;s connection request.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
char * master_ip
The network address of the master controller.
int is_subordinate
should the slave controller start the delegated controller?
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Structure representing a connected(directly-linked) controller.
enum LCFContextState state
The state of this context.
Context information used while linking controllers.
#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.
Handle to a client that is connected to a service.
Definition: service.c:249
uint32_t delegated_host_id
For which host should requests be delegated? NBO.
Definition: testbed.h:152
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.
Definition: scheduler.c:1246
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.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
struct GNUNET_TESTBED_Host ** GST_host_list
Array of hosts.
A routing entry.
uint32_t delegated_host_id
The delegated host.
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2618
struct GNUNET_TESTBED_ControllerProc * controller_proc
The controller process handle if we had started the controller.
uint64_t operation_id
The ID of the operation.
uint32_t slave_host_id
The slave host.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
struct LinkControllersContext * lcc
handle to lcc which is associated with this slave startup.
uint64_t op_id
The id of the link-controllers operation responsible for creating this context.
struct GNUNET_TIME_Relative GST_timeout
Timeout for operations which may take some time.
uint32_t slave_host_id
Which host is responsible for managing the delegation? NBO.
Definition: testbed.h:162
uint32_t host_id
The id of the host this controller is running on.
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...
Definition: testbed.h:168
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
uint64_t operation_id
The id of the operation which created this message.
Definition: testbed.h:157
#define LOG_DEBUG(msg)
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2533
uint32_t dest
destination host
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.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:48
struct GNUNET_SERVICE_Client * client
The client which initiated the link controller operation.
Here is the call graph for this function:

◆ GST_link_notify_disconnect()

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.

Parameters
clientthe client that is history

Definition at line 1384 of file gnunet-service-testbed_links.c.

References cleanup_ncc(), LCFContext::client, LinkControllersContext::client, NeighbourConnectCtxt::client, drop_client_entries(), GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_free, GNUNET_TESTBED_operation_done(), GST_slave_list_size, Slave::lcc, LCFContext::next, NeighbourConnectCtxt::next, LCFContext::op, and Slave::reghost_map.

Referenced by client_disconnect_cb().

1385 {
1386  struct NeighbourConnectCtxt *ncc;
1387  struct NeighbourConnectCtxt *nccn;
1388  struct LCFContext *lcf;
1389  struct LCFContext *lcfn;
1390 
1391  for (ncc = ncc_head; NULL != ncc; ncc = nccn)
1392  {
1393  nccn = ncc->next;
1394  if (ncc->client == client)
1395  cleanup_ncc (ncc);
1396  }
1397  for (unsigned int i=0;i<GST_slave_list_size;i++)
1398  {
1399  struct Slave *slave = GST_slave_list[i];
1400  struct LinkControllersContext *lcc;
1401 
1402  if (NULL == slave)
1403  continue;
1406  client);
1407  lcc = slave->lcc;
1408  if (NULL == lcc)
1409  continue;
1410  if (lcc->client == client)
1411  {
1412  slave->lcc = NULL;
1413  GNUNET_free (lcc);
1414  }
1415  }
1416  for (lcf = lcf_head; NULL != lcf; lcf = lcfn)
1417  {
1418  lcfn = lcf->next;
1419  if ( (NULL != lcf) &&
1420  (client == lcf->client) )
1421  {
1422  if (NULL != lcf->op)
1425  lcf_tail,
1426  lcf);
1427  GNUNET_free (lcf);
1428  }
1429  }
1430 }
#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.
Context information for establishing a link to neighbour (Used is GST_handle_link_controllers() ...
Link controllers request forwarding context.
struct GNUNET_TESTBED_Operation * op
Handle for operations which are forwarded while linking controllers.
Structure representing a connected(directly-linked) controller.
Context information used while linking controllers.
struct GNUNET_SERVICE_Client * client
The client which has asked to perform this operation.
void GNUNET_TESTBED_operation_done(struct GNUNET_TESTBED_Operation *operation)
This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) f...
Definition: testbed_api.c:2020
struct LinkControllersContext * lcc
handle to lcc which is associated with this slave startup.
struct NeighbourConnectCtxt * next
DLL next for inclusion in the corresponding context list.
struct GNUNET_SERVICE_Client * client
The client requesting the connection.
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.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_SERVICE_Client * client
The client which initiated the link controller operation.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GST_slave_list_clear()

void GST_slave_list_clear ( void  )

Cleans up the slave list.

Definition at line 492 of file gnunet-service-testbed_links.c.

References destroy_slave(), GNUNET_free_non_null, GST_slave_list_size, id, and kill_slave().

Referenced by shutdown_task().

493 {
494  struct Slave *slave;
495  unsigned int id;
496 
497  for (id = 0; id < GST_slave_list_size; id++)
498  {
499  slave = GST_slave_list[id];
500  if (NULL == slave)
501  continue;
502  kill_slave (slave);
503  }
504  for (id = 0; id < GST_slave_list_size; id++)
505  {
506  slave = GST_slave_list[id];
507  if (NULL == slave)
508  continue;
509  destroy_slave (slave);
510  }
512  GST_slave_list = NULL;
513 }
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.
Structure representing a connected(directly-linked) controller.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ GST_slave_list

struct Slave** GST_slave_list

A list of directly linked neighbours.

Definition at line 283 of file gnunet-service-testbed_links.c.

Referenced by handle_barrier_init(), handle_peer_create(), handle_shutdown_peers(), and handle_slave_get_config().

◆ GST_slave_list_size

unsigned int GST_slave_list_size