GNUnet  0.10.x
Typedefs | Enumerations | Functions
testbed_api_operations.h File Reference

internal API to access the 'operations' subsystem More...

#include "gnunet_testbed_service.h"
#include "gnunet_helper_lib.h"
Include dependency graph for testbed_api_operations.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void(* OperationStart) (void *cls)
 Function to call to start an operation once all queues the operation is part of declare that the operation can be activated. More...
 
typedef void(* OperationRelease) (void *cls)
 Function to call to cancel an operation (release all associated resources). More...
 

Enumerations

enum  OperationQueueType { OPERATION_QUEUE_TYPE_FIXED, OPERATION_QUEUE_TYPE_ADAPTIVE }
 The type of operation queue. More...
 

Functions

struct OperationQueueGNUNET_TESTBED_operation_queue_create_ (enum OperationQueueType type, unsigned int max_active)
 Create an operation queue. More...
 
void GNUNET_TESTBED_operation_queue_destroy_ (struct OperationQueue *queue)
 Destroy an operation queue. More...
 
int GNUNET_TESTBED_operation_queue_destroy_empty_ (struct OperationQueue *queue)
 Destroys the operation queue if it is empty. More...
 
void GNUNET_TESTBED_operation_queue_reset_max_active_ (struct OperationQueue *queue, unsigned int max_active)
 Function to reset the maximum number of operations in the given queue. More...
 
void GNUNET_TESTBED_operation_queue_insert2_ (struct OperationQueue *queue, struct GNUNET_TESTBED_Operation *op, unsigned int nres)
 Add an operation to a queue. More...
 
void GNUNET_TESTBED_operation_queue_insert_ (struct OperationQueue *queue, struct GNUNET_TESTBED_Operation *op)
 Add an operation to a queue. More...
 
void GNUNET_TESTBED_operation_begin_wait_ (struct GNUNET_TESTBED_Operation *op)
 Marks the given operation as waiting on the queues. More...
 
struct GNUNET_TESTBED_OperationGNUNET_TESTBED_operation_create_ (void *cls, OperationStart start, OperationRelease release)
 Create an 'operation' to be performed. More...
 
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 resources. More...
 
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 and continues to hold resources until another operation contents for them. More...
 
void GNUNET_TESTBED_operation_activate_ (struct GNUNET_TESTBED_Operation *op)
 Marks and inactive operation as active. More...
 
void GNUNET_TESTBED_operation_mark_failed (struct GNUNET_TESTBED_Operation *op)
 Marks an operation as failed. More...
 

Detailed Description

internal API to access the 'operations' subsystem

Author
Christian Grothoff

Definition in file testbed_api_operations.h.

Typedef Documentation

◆ OperationStart

typedef void(* OperationStart) (void *cls)

Function to call to start an operation once all queues the operation is part of declare that the operation can be activated.

Parameters
clsthe closure from GNUNET_TESTBED_operation_create_()

Definition at line 156 of file testbed_api_operations.h.

◆ OperationRelease

typedef void(* OperationRelease) (void *cls)

Function to call to cancel an operation (release all associated resources).

This can be because of a call to "GNUNET_TESTBED_operation_cancel" (before the operation generated an event) or AFTER the operation generated an event due to a call to "GNUNET_TESTBED_operation_done". Thus it is not guaranteed that a callback to the 'OperationStart' preceeds the call to 'OperationRelease'. Implementations of this function are expected to clean up whatever state is in 'cls' and release all resources associated with the operation.

Parameters
clsthe closure from GNUNET_TESTBED_operation_create_()

Definition at line 172 of file testbed_api_operations.h.

Enumeration Type Documentation

◆ OperationQueueType

The type of operation queue.

Enumerator
OPERATION_QUEUE_TYPE_FIXED 

Operation queue which permits a fixed maximum number of operations to be active at any time.

OPERATION_QUEUE_TYPE_ADAPTIVE 

Operation queue which adapts the number of operations to be active based on the operation completion times of previously executed operation in it.

Definition at line 43 of file testbed_api_operations.h.

43  {
49 
55 };
Operation queue which permits a fixed maximum number of operations to be active at any time...
Operation queue which adapts the number of operations to be active based on the operation completion ...

Function Documentation

◆ GNUNET_TESTBED_operation_queue_create_()

struct OperationQueue* GNUNET_TESTBED_operation_queue_create_ ( enum OperationQueueType  type,
unsigned int  max_active 
)

Create an operation queue.

Parameters
typethe type of operation queue
max_activemaximum number of operations in this queue that can be active in parallel at the same time.
Returns
handle to the queue
Parameters
typethe type of operation queue
max_activemaximum number of operations in this queue that can be active in parallel at the same time
Returns
handle to the queue

Definition at line 1044 of file testbed_api_operations.c.

References ADAPTIVE_QUEUE_DEFAULT_HISTORY, ADAPTIVE_QUEUE_DEFAULT_MAX_ACTIVE, adaptive_queue_set_max_active(), OperationQueue::fctx, GNUNET_new, GNUNET_TESTBED_SD_init_(), OperationQueue::max_active, FeedbackCtx::max_active_bound, OPERATION_QUEUE_TYPE_FIXED, QueueEntry::queue, FeedbackCtx::sd, type, and OperationQueue::type.

Referenced by GNUNET_TESTBED_controller_connect(), GNUNET_TESTBED_get_statistics(), GNUNET_TESTBED_host_create_with_id(), and testbed_run().

1046 {
1047  struct OperationQueue *queue;
1048  struct FeedbackCtx *fctx;
1049 
1050  queue = GNUNET_new(struct OperationQueue);
1051  queue->type = type;
1053  {
1054  queue->max_active = max_active;
1055  }
1056  else
1057  {
1058  fctx = GNUNET_new(struct FeedbackCtx);
1059  fctx->max_active_bound = max_active;
1061  queue->fctx = fctx;
1063  }
1064  return queue;
1065 }
static void queue(const char *hostname)
Add hostname to the list of requests to be made.
static void adaptive_queue_set_max_active(struct OperationQueue *queue, unsigned int n)
Cleansup the existing timing slots and sets new timing slots in the given queue to accommodate given ...
Operation queue which permits a fixed maximum number of operations to be active at any time...
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Context for operation queues of type OPERATION_QUEUE_TYPE_ADAPTIVE.
unsigned int max_active_bound
Bound on the maximum number of operations which can be active.
struct SDHandle * GNUNET_TESTBED_SD_init_(unsigned int max_cnt)
Initialize standard deviation calculation handle.
struct SDHandle * sd
Handle for calculating standard deviation.
enum OperationQueueType type
The type of this opeartion queue.
#define ADAPTIVE_QUEUE_DEFAULT_MAX_ACTIVE
The number of parallel opeartions we start with by default for adaptive queues.
Queue of operations where we can only support a certain number of concurrent operations of a particul...
#define ADAPTIVE_QUEUE_DEFAULT_HISTORY
The number of readings containing past operation's timing information that we keep track of for adapt...
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
unsigned int max_active
Max number of operations which can be active at any time in this queue.
struct FeedbackCtx * fctx
Feedback context; only relevant for adaptive operation queues.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_operation_queue_destroy_()

void GNUNET_TESTBED_operation_queue_destroy_ ( struct OperationQueue queue)

Destroy an operation queue.

The queue MUST be empty at this time.

Parameters
queuequeue to destroy

Destroy an operation queue.

If the queue is still in use by operations it is marked as expired and its resources are released in the destructor GNUNET_TESTBED_operations_fini().

Parameters
queuequeue to destroy

Definition at line 1097 of file testbed_api_operations.c.

References OperationQueue::expired, GNUNET_array_append, GNUNET_assert, GNUNET_YES, is_queue_empty(), n_expired_opqs, and queue_destroy().

Referenced by GNUNET_TESTBED_controller_disconnect(), GNUNET_TESTBED_host_destroy(), GNUNET_TESTBED_operation_queue_destroy_empty_(), and shutdown_task().

1098 {
1099  if (GNUNET_YES != is_queue_empty(queue))
1100  {
1101  GNUNET_assert(0 == queue->expired); /* Are you calling twice on same queue? */
1102  queue->expired = 1;
1104  return;
1105  }
1106  queue_destroy(queue);
1107 }
static int is_queue_empty(struct OperationQueue *opq)
Checks if the given operation queue is empty or not.
static struct OperationQueue ** expired_opqs
Array of operation queues which are to be destroyed.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static void queue_destroy(struct OperationQueue *queue)
Cleanup the given operation queue.
#define GNUNET_array_append(arr, size, element)
Append an element to a list (growing the list by one).
static unsigned int n_expired_opqs
Number of expired operation queues in the above array.
#define GNUNET_YES
Definition: gnunet_common.h:77
unsigned int expired
Is this queue marked for expiry?
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_operation_queue_destroy_empty_()

int GNUNET_TESTBED_operation_queue_destroy_empty_ ( struct OperationQueue queue)

Destroys the operation queue if it is empty.

If not empty return GNUNET_NO.

Parameters
queuethe queue to destroy if empty
Returns
GNUNET_YES if the queue is destroyed. GNUNET_NO if not (because it is not empty)

Definition at line 1118 of file testbed_api_operations.c.

References GNUNET_NO, GNUNET_TESTBED_operation_queue_destroy_(), GNUNET_YES, and is_queue_empty().

Referenced by oprelease_get_stats().

1119 {
1120  if (GNUNET_NO == is_queue_empty(queue))
1121  return GNUNET_NO;
1123  return GNUNET_YES;
1124 }
static int is_queue_empty(struct OperationQueue *opq)
Checks if the given operation queue is empty or not.
#define GNUNET_NO
Definition: gnunet_common.h:78
void GNUNET_TESTBED_operation_queue_destroy_(struct OperationQueue *queue)
Destroys an operation queue.
#define GNUNET_YES
Definition: gnunet_common.h:77
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_operation_queue_reset_max_active_()

void GNUNET_TESTBED_operation_queue_reset_max_active_ ( struct OperationQueue queue,
unsigned int  max_active 
)

Function to reset the maximum number of operations in the given queue.

If max_active is lesser than the number of currently active operations, the active operations are not stopped immediately.

Parameters
queuethe operation queue which has to be modified
max_activethe new maximum number of active operations

Definition at line 1159 of file testbed_api_operations.c.

References OperationQueue::active, defer(), OperationQueue::max_active, QueueEntry::op, OperationQueue::overload, recheck_waiting(), and OperationQueue::rq_head.

Referenced by adaptive_queue_set_max_active().

1161 {
1162  struct QueueEntry *entry;
1163 
1164  queue->max_active = max_active;
1165  queue->overload = 0;
1166  while ((queue->active > queue->max_active)
1167  && (NULL != (entry = queue->rq_head)))
1168  defer(entry->op);
1169  recheck_waiting(queue);
1170 }
static void defer(struct GNUNET_TESTBED_Operation *op)
Defers a ready to be executed operation back to waiting.
struct QueueEntry * rq_head
DLL head for the ready queue.
static void recheck_waiting(struct OperationQueue *opq)
Rechecks if any of the operations in the given operation queue's waiting list can be made active...
unsigned int overload
The number of resources occupied by failed operations in the current shot.
An entry in the operation queue.
unsigned int active
Number of operations that are currently active in this queue.
unsigned int max_active
Max number of operations which can be active at any time in this queue.
struct GNUNET_TESTBED_Operation * op
The operation this entry holds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_operation_queue_insert2_()

void GNUNET_TESTBED_operation_queue_insert2_ ( struct OperationQueue queue,
struct GNUNET_TESTBED_Operation op,
unsigned int  nres 
)

Add an operation to a queue.

An operation can be in multiple queues at once. Once the operation is inserted into all the queues GNUNET_TESTBED_operation_begin_wait_() has to be called to actually start waiting for the operation to become active.

Parameters
queuequeue to add the operation to
opoperation to add to the queue
nresthe number of units of the resources of queue needed by the operation. Should be greater than 0.

Definition at line 1185 of file testbed_api_operations.c.

References GNUNET_array_append, GNUNET_assert, GNUNET_TESTBED_Operation::nqueues, GNUNET_TESTBED_Operation::nres, and GNUNET_TESTBED_Operation::queues.

Referenced by GNUNET_TESTBED_operation_queue_insert_().

1188 {
1189  unsigned int qsize;
1190 
1191  GNUNET_assert(0 < nres);
1192  qsize = op->nqueues;
1193  GNUNET_array_append(op->queues, op->nqueues, queue);
1194  GNUNET_array_append(op->nres, qsize, nres);
1195  GNUNET_assert(qsize == op->nqueues);
1196 }
unsigned int * nres
Array of number of resources an operation need from each queue.
unsigned int nres
How many units of resources does the operation need.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
unsigned int nqueues
Number of queues in the operation queues array.
#define GNUNET_array_append(arr, size, element)
Append an element to a list (growing the list by one).
struct OperationQueue ** queues
Array of operation queues this Operation belongs to.
Here is the caller graph for this function:

◆ GNUNET_TESTBED_operation_queue_insert_()

void GNUNET_TESTBED_operation_queue_insert_ ( struct OperationQueue queue,
struct GNUNET_TESTBED_Operation op 
)

Add an operation to a queue.

An operation can be in multiple queues at once. Once the operation is inserted into all the queues GNUNET_TESTBED_operation_begin_wait_() has to be called to actually start waiting for the operation to become active.

Parameters
queuequeue to add the operation to
opoperation to add to the queue

An operation can be in multiple queues at once. Once the operation is inserted into all the queues GNUNET_TESTBED_operation_begin_wait_() has to be called to actually start waiting for the operation to become active. The operation is assumed to take 1 queue resource. Use GNUNET_TESTBED_operation_queue_insert2_() if it requires more than 1

Parameters
queuequeue to add the operation to
opoperation to add to the queue

Definition at line 1211 of file testbed_api_operations.c.

References GNUNET_TESTBED_operation_queue_insert2_().

Referenced by GNUNET_TESTBED_controller_link(), GNUNET_TESTBED_get_slave_config_(), GNUNET_TESTBED_get_statistics(), GNUNET_TESTBED_host_queue_oc_(), GNUNET_TESTBED_overlay_configure_topology_va(), GNUNET_TESTBED_peer_create(), GNUNET_TESTBED_peer_destroy(), GNUNET_TESTBED_peer_get_information(), GNUNET_TESTBED_peer_manage_service(), GNUNET_TESTBED_peer_start(), GNUNET_TESTBED_peer_stop(), GNUNET_TESTBED_peer_update_configuration(), GNUNET_TESTBED_service_connect(), GNUNET_TESTBED_shutdown_peers(), GST_connection_pool_get_handle(), and GST_neighbour_get_connection().

1213 {
1214  return GNUNET_TESTBED_operation_queue_insert2_(queue, op, 1);
1215 }
void GNUNET_TESTBED_operation_queue_insert2_(struct OperationQueue *queue, struct GNUNET_TESTBED_Operation *op, unsigned int nres)
Add an operation to a queue.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_operation_begin_wait_()

void GNUNET_TESTBED_operation_begin_wait_ ( struct GNUNET_TESTBED_Operation op)

Marks the given operation as waiting on the queues.

Once all queues permit the operation to become active, the operation will be activated. The actual activation will occur in a separate task (thus allowing multiple queue insertions to be made without having the first one instantly trigger the operation if the first queue has sufficient resources).

Parameters
opthe operation to marks as waiting

Definition at line 1228 of file testbed_api_operations.c.

References change_state(), check_readiness(), GNUNET_assert, OP_STATE_WAITING, and GNUNET_TESTBED_Operation::rq_entry.

Referenced by GNUNET_TESTBED_controller_link(), GNUNET_TESTBED_get_slave_config_(), GNUNET_TESTBED_get_statistics(), GNUNET_TESTBED_overlay_configure_topology_va(), GNUNET_TESTBED_overlay_connect(), GNUNET_TESTBED_peer_create(), GNUNET_TESTBED_peer_destroy(), GNUNET_TESTBED_peer_get_information(), GNUNET_TESTBED_peer_manage_service(), GNUNET_TESTBED_peer_start(), GNUNET_TESTBED_peer_stop(), GNUNET_TESTBED_peer_update_configuration(), GNUNET_TESTBED_service_connect(), GNUNET_TESTBED_shutdown_peers(), GST_connection_pool_get_handle(), and GST_neighbour_get_connection().

1229 {
1230  GNUNET_assert(NULL == op->rq_entry);
1232  (void)check_readiness(op);
1233 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static void change_state(struct GNUNET_TESTBED_Operation *op, enum OperationState state)
Changes the state of the operation while moving its associated queue entries in the operation&#39;s opera...
static int check_readiness(struct GNUNET_TESTBED_Operation *op)
Checks for the readiness of an operation and schedules a operation start task.
The operation is currently waiting for resources.
struct ReadyQueueEntry * rq_entry
Entry corresponding to this operation in ready queue.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_operation_create_()

struct GNUNET_TESTBED_Operation* GNUNET_TESTBED_operation_create_ ( void *  cls,
OperationStart  start,
OperationRelease  release 
)

Create an 'operation' to be performed.

Parameters
clsclosure for the callbacks
startfunction to call to start the operation
releasefunction to call to close down the operation
Returns
handle to the operation

Definition at line 1021 of file testbed_api_operations.c.

References GNUNET_TESTBED_Operation::cb_cls, GNUNET_new, QueueEntry::op, OP_STATE_INIT, GNUNET_TESTBED_Operation::release, start, GNUNET_TESTBED_Operation::start, and GNUNET_TESTBED_Operation::state.

Referenced by GNUNET_TESTBED_controller_link(), GNUNET_TESTBED_get_slave_config_(), GNUNET_TESTBED_get_statistics(), GNUNET_TESTBED_overlay_configure_topology_va(), GNUNET_TESTBED_overlay_connect(), GNUNET_TESTBED_peer_create(), GNUNET_TESTBED_peer_destroy(), GNUNET_TESTBED_peer_get_information(), GNUNET_TESTBED_peer_manage_service(), GNUNET_TESTBED_peer_start(), GNUNET_TESTBED_peer_stop(), GNUNET_TESTBED_peer_update_configuration(), GNUNET_TESTBED_service_connect(), GNUNET_TESTBED_shutdown_peers(), GST_connection_pool_get_handle(), and GST_neighbour_get_connection().

1023 {
1024  struct GNUNET_TESTBED_Operation *op;
1025 
1026  op = GNUNET_new(struct GNUNET_TESTBED_Operation);
1027  op->start = start;
1028  op->state = OP_STATE_INIT;
1029  op->release = release;
1030  op->cb_cls = cls;
1031  return op;
1032 }
void * cb_cls
Closure for callbacks.
static int start
Set if we are to start default services (including ARM).
Definition: gnunet-arm.c:39
OperationRelease release
Function to call to clean up after the operation (which may or may not have been started yet)...
The operation is just created and is in initial state.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Opaque handle to an abstract operation to be executed by the testing framework.
enum OperationState state
The state of the operation.
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:139
OperationStart start
Function to call when we have the resources to begin the operation.
Here is the caller graph for this function:

◆ GNUNET_TESTBED_operation_release_()

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 resources.

Parameters
opoperation that finished

Definition at line 1289 of file testbed_api_operations.c.

References OperationQueue::active, GNUNET_TESTBED_Operation::cb_cls, GNUNET_assert, GNUNET_free, GNUNET_free_non_null, GNUNET_TESTBED_operation_activate_(), GNUNET_TESTBED_Operation::nqueues, QueueEntry::nres, GNUNET_TESTBED_Operation::nres, OP_STATE_ACTIVE, OP_STATE_INACTIVE, OP_STATE_INIT, OP_STATE_READY, OP_STATE_WAITING, GNUNET_TESTBED_Operation::qentries, GNUNET_TESTBED_Operation::queues, recheck_waiting(), GNUNET_TESTBED_Operation::release, remove_queue_entry(), rq_remove(), GNUNET_TESTBED_Operation::state, and update_tslots().

Referenced by check_readiness(), GNUNET_TESTBED_operation_done(), and GST_neighbour_list_clean().

1290 {
1291  struct QueueEntry *entry;
1292  struct OperationQueue *opq;
1293  unsigned int i;
1294 
1295  if (OP_STATE_INIT == op->state)
1296  {
1297  GNUNET_free(op);
1298  return;
1299  }
1300  if (OP_STATE_READY == op->state)
1301  rq_remove(op);
1302  if (OP_STATE_INACTIVE == op->state) /* Activate the operation if inactive */
1304  if (OP_STATE_ACTIVE == op->state)
1305  update_tslots(op);
1306  GNUNET_assert(NULL != op->queues);
1307  GNUNET_assert(NULL != op->qentries);
1308  for (i = 0; i < op->nqueues; i++)
1309  {
1310  entry = op->qentries[i];
1311  remove_queue_entry(op, i);
1312  opq = op->queues[i];
1313  switch (op->state)
1314  {
1315  case OP_STATE_INIT:
1316  case OP_STATE_INACTIVE:
1317  GNUNET_assert(0);
1318  break;
1319 
1320  case OP_STATE_WAITING:
1321  break;
1322 
1323  case OP_STATE_ACTIVE:
1324  case OP_STATE_READY:
1325  GNUNET_assert(0 != opq->active);
1326  GNUNET_assert(opq->active >= entry->nres);
1327  opq->active -= entry->nres;
1328  recheck_waiting(opq);
1329  break;
1330  }
1331  GNUNET_free(entry);
1332  }
1334  GNUNET_free(op->queues);
1335  GNUNET_free(op->nres);
1336  if (NULL != op->release)
1337  op->release(op->cb_cls);
1338  GNUNET_free(op);
1339 }
void * cb_cls
Closure for callbacks.
unsigned int * nres
Array of number of resources an operation need from each queue.
unsigned int nres
How many units of resources does the operation need.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
The operation is inactive.
OperationRelease release
Function to call to clean up after the operation (which may or may not have been started yet)...
struct QueueEntry ** qentries
Array of operation queue entries corresponding to this operation in operation queues for this operati...
The operation is just created and is in initial state.
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
static void update_tslots(struct GNUNET_TESTBED_Operation *op)
update tslots with the operation&#39;s completion time.
unsigned int nqueues
Number of queues in the operation queues array.
The operation is currently waiting for resources.
static void recheck_waiting(struct OperationQueue *opq)
Rechecks if any of the operations in the given operation queue&#39;s waiting list can be made active...
static void rq_remove(struct GNUNET_TESTBED_Operation *op)
Removes an operation from the ready queue.
void GNUNET_TESTBED_operation_activate_(struct GNUNET_TESTBED_Operation *op)
Marks and inactive operation as active.
The operation is ready to be started.
static void remove_queue_entry(struct GNUNET_TESTBED_Operation *op, unsigned int index)
Removes a queue entry of an operation from one of the operation queues&#39; lists depending on the state ...
An entry in the operation queue.
unsigned int active
Number of operations that are currently active in this queue.
enum OperationState state
The state of the operation.
Queue of operations where we can only support a certain number of concurrent operations of a particul...
struct OperationQueue ** queues
Array of operation queues this Operation belongs to.
The operation has started and is active.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_operation_inactivate_()

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 and continues to hold resources until another operation contents for them.

Parameters
opthe operation to be marked as inactive. The operation start callback should have been called before for this operation to mark it as inactive.

Definition at line 1246 of file testbed_api_operations.c.

References change_state(), GNUNET_assert, GNUNET_free, GNUNET_malloc, GNUNET_memcpy, GNUNET_TESTBED_Operation::nqueues, OP_STATE_ACTIVE, OP_STATE_INACTIVE, GNUNET_TESTBED_Operation::queues, recheck_waiting(), and GNUNET_TESTBED_Operation::state.

Referenced by GST_neighbour_get_connection_cancel(), and GST_neighbour_release_connection().

1247 {
1248  struct OperationQueue **queues;
1249  size_t ms;
1250  unsigned int nqueues;
1251  unsigned int i;
1252 
1255  nqueues = op->nqueues;
1256  ms = sizeof(struct OperationQueue *) * nqueues;
1257  queues = GNUNET_malloc(ms);
1258  /* Cloning is needed as the operation be released by waiting operations and
1259  hence its nqueues memory ptr will be freed */
1260  GNUNET_memcpy(queues, op->queues, ms);
1261  for (i = 0; i < nqueues; i++)
1262  recheck_waiting(queues[i]);
1263  GNUNET_free(queues);
1264 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
The operation is inactive.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
static void change_state(struct GNUNET_TESTBED_Operation *op, enum OperationState state)
Changes the state of the operation while moving its associated queue entries in the operation&#39;s opera...
unsigned int nqueues
Number of queues in the operation queues array.
static void recheck_waiting(struct OperationQueue *opq)
Rechecks if any of the operations in the given operation queue&#39;s waiting list can be made active...
enum OperationState state
The state of the operation.
Queue of operations where we can only support a certain number of concurrent operations of a particul...
struct OperationQueue ** queues
Array of operation queues this Operation belongs to.
The operation has started and is active.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_operation_activate_()

void GNUNET_TESTBED_operation_activate_ ( struct GNUNET_TESTBED_Operation op)

Marks and inactive operation as active.

This fuction should be called to ensure that the oprelease callback will not be called until it is either marked as inactive or released.

Parameters
opthe operation to be marked as active

Definition at line 1275 of file testbed_api_operations.c.

References change_state(), GNUNET_assert, OP_STATE_ACTIVE, OP_STATE_INACTIVE, and GNUNET_TESTBED_Operation::state.

Referenced by GNUNET_TESTBED_operation_release_(), and trigger_notifications().

1276 {
1279 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
The operation is inactive.
static void change_state(struct GNUNET_TESTBED_Operation *op, enum OperationState state)
Changes the state of the operation while moving its associated queue entries in the operation&#39;s opera...
enum OperationState state
The state of the operation.
The operation has started and is active.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_operation_mark_failed()

void GNUNET_TESTBED_operation_mark_failed ( struct GNUNET_TESTBED_Operation op)

Marks an operation as failed.

Parameters
opthe operation to be marked as failed

Definition at line 1348 of file testbed_api_operations.c.

References GNUNET_TESTBED_Operation::failed, and GNUNET_YES.

Referenced by handle_op_fail_event().

1349 {
1350  op->failed = GNUNET_YES;
1351 }
int failed
Is this a failed operation?
#define GNUNET_YES
Definition: gnunet_common.h:77
Here is the caller graph for this function: