GNUnet  0.11.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 157 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 173 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.

44 {
50 
56 };
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 1051 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().

1053 {
1054  struct OperationQueue *queue;
1055  struct FeedbackCtx *fctx;
1056 
1057  queue = GNUNET_new (struct OperationQueue);
1058  queue->type = type;
1060  {
1061  queue->max_active = max_active;
1062  }
1063  else
1064  {
1065  fctx = GNUNET_new (struct FeedbackCtx);
1066  fctx->max_active_bound = max_active;
1068  queue->fctx = fctx;
1070  }
1071  return queue;
1072 }
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 1104 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().

1105 {
1106  if (GNUNET_YES != is_queue_empty (queue))
1107  {
1108  GNUNET_assert (0 == queue->expired); /* Are you calling twice on same queue? */
1109  queue->expired = 1;
1111  return;
1112  }
1113  queue_destroy (queue);
1114 }
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 1125 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().

1126 {
1127  if (GNUNET_NO == is_queue_empty (queue))
1128  return GNUNET_NO;
1130  return GNUNET_YES;
1131 }
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 1166 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().

1168 {
1169  struct QueueEntry *entry;
1170 
1171  queue->max_active = max_active;
1172  queue->overload = 0;
1173  while ((queue->active > queue->max_active)
1174  && (NULL != (entry = queue->rq_head)))
1175  defer (entry->op);
1176  recheck_waiting (queue);
1177 }
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 1192 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_().

1195 {
1196  unsigned int qsize;
1197 
1198  GNUNET_assert (0 < nres);
1199  qsize = op->nqueues;
1200  GNUNET_array_append (op->queues, op->nqueues, queue);
1201  GNUNET_array_append (op->nres, qsize, nres);
1202  GNUNET_assert (qsize == op->nqueues);
1203 }
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 1218 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().

1220 {
1221  return GNUNET_TESTBED_operation_queue_insert2_ (queue, op, 1);
1222 }
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 1235 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().

1236 {
1237  GNUNET_assert (NULL == op->rq_entry);
1239  (void) check_readiness (op);
1240 }
#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 1028 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().

1030 {
1031  struct GNUNET_TESTBED_Operation *op;
1032 
1033  op = GNUNET_new (struct GNUNET_TESTBED_Operation);
1034  op->start = start;
1035  op->state = OP_STATE_INIT;
1036  op->release = release;
1037  op->cb_cls = cls;
1038  return op;
1039 }
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:144
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 1296 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().

1297 {
1298  struct QueueEntry *entry;
1299  struct OperationQueue *opq;
1300  unsigned int i;
1301 
1302  if (OP_STATE_INIT == op->state)
1303  {
1304  GNUNET_free (op);
1305  return;
1306  }
1307  if (OP_STATE_READY == op->state)
1308  rq_remove (op);
1309  if (OP_STATE_INACTIVE == op->state) /* Activate the operation if inactive */
1311  if (OP_STATE_ACTIVE == op->state)
1312  update_tslots (op);
1313  GNUNET_assert (NULL != op->queues);
1314  GNUNET_assert (NULL != op->qentries);
1315  for (i = 0; i < op->nqueues; i++)
1316  {
1317  entry = op->qentries[i];
1318  remove_queue_entry (op, i);
1319  opq = op->queues[i];
1320  switch (op->state)
1321  {
1322  case OP_STATE_INIT:
1323  case OP_STATE_INACTIVE:
1324  GNUNET_assert (0);
1325  break;
1326 
1327  case OP_STATE_WAITING:
1328  break;
1329 
1330  case OP_STATE_ACTIVE:
1331  case OP_STATE_READY:
1332  GNUNET_assert (0 != opq->active);
1333  GNUNET_assert (opq->active >= entry->nres);
1334  opq->active -= entry->nres;
1335  recheck_waiting (opq);
1336  break;
1337  }
1338  GNUNET_free (entry);
1339  }
1341  GNUNET_free (op->queues);
1342  GNUNET_free (op->nres);
1343  if (NULL != op->release)
1344  op->release (op->cb_cls);
1345  GNUNET_free (op);
1346 }
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 1253 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().

1254 {
1255  struct OperationQueue **queues;
1256  size_t ms;
1257  unsigned int nqueues;
1258  unsigned int i;
1259 
1262  nqueues = op->nqueues;
1263  ms = sizeof(struct OperationQueue *) * nqueues;
1264  queues = GNUNET_malloc (ms);
1265  /* Cloning is needed as the operation be released by waiting operations and
1266  hence its nqueues memory ptr will be freed */
1267  GNUNET_memcpy (queues, op->queues, ms);
1268  for (i = 0; i < nqueues; i++)
1269  recheck_waiting (queues[i]);
1270  GNUNET_free (queues);
1271 }
#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 1282 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().

1283 {
1286 }
#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 1355 of file testbed_api_operations.c.

References GNUNET_TESTBED_Operation::failed, and GNUNET_YES.

Referenced by handle_op_fail_event().

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