DTNMA Reference Tools v2.1.0 - 13.gc5c0bac
Delay-Tolerant Networking Management Architecture (DTNMA) Tool Suite
Loading...
Searching...
No Matches
exec.h File Reference
#include "exec_status.h"
#include "agent.h"
#include "runctx.h"
#include "amm/sbr.h"
#include "amm/tbr.h"
#include <cace/ari.h>
#include <m-atomic.h>
+ Include dependency graph for exec.h:
+ This graph shows which files directly or indirectly include this file:

Macros

#define REFDA_EXEC_ERR_BAD_TYPE   3
 Error result when an invalid type is present.
 
#define REFDA_EXEC_ERR_DEREF_FAILED   4
 Error result when dereferencing fails.
 
#define REFDA_EXEC_ERR_PROD_FAILED   5
 Error result when value production fails.
 

Functions

int refda_exec_add_target (refda_runctx_ptr_t *runctxp, const cace_ari_t *target, refda_exec_status_t *finish)
 From outside the exec worker thread, inject a single execution target and allow its sequence to be tracked to its finish.
 
void * refda_exec_worker (void *arg)
 Work thread function for the Agent execution manager.
 
int refda_exec_waiting (refda_agent_t *agent)
 Execute any waiting sequences as part of normal worker iteration.
 
bool refda_exec_worker_iteration (refda_agent_t *agent)
 Helper function to run a single iteration of the exec worker thread.
 
int refda_exec_tbr_enable (refda_agent_t *agent, refda_amm_tbr_desc_t *tbr)
 Begin periodic execution of a time based rule.
 
int refda_exec_tbr_disable (refda_agent_t *agent, refda_amm_tbr_desc_t *tbr)
 Cease periodic execution of a time based rule.
 
int refda_exec_sbr_enable (refda_agent_t *agent, refda_amm_sbr_desc_t *sbr)
 Begin periodic execution of a state based rule.
 
int refda_exec_sbr_disable (refda_agent_t *agent, refda_amm_sbr_desc_t *sbr)
 Cease periodic execution of a state based rule.
 
int refda_exec_next (refda_exec_seq_t *seq, const cace_ari_t *target)
 Setup an ARI to execute next in the sequence.
 

Macro Definition Documentation

◆ REFDA_EXEC_ERR_BAD_TYPE

#define REFDA_EXEC_ERR_BAD_TYPE   3

Error result when an invalid type is present.

◆ REFDA_EXEC_ERR_DEREF_FAILED

#define REFDA_EXEC_ERR_DEREF_FAILED   4

Error result when dereferencing fails.

◆ REFDA_EXEC_ERR_PROD_FAILED

#define REFDA_EXEC_ERR_PROD_FAILED   5

Error result when value production fails.

Function Documentation

◆ refda_exec_add_target()

int refda_exec_add_target ( refda_runctx_ptr_t runctxp,
const cace_ari_t target,
refda_exec_status_t finish 
)

From outside the exec worker thread, inject a single execution target and allow its sequence to be tracked to its finish.

This function is thread safe on the agent.

Parameters
[in]runctxpThe run context, which includes the agent pointer.
[in]targetThe execution target (CTRL ref or macro).
[in]finishAn optional execution-finished state for the whole target, or a null pointer to not track this state.

References agent, refda_runctx_t::agent, CACE_LOG_CRIT, CACE_LOG_ERR, CHKERR1, refda_agent_t::exec_next_pid, refda_agent_t::exec_state, refda_agent_t::exec_state_mutex, refda_agent_t::execs_sem, refda_exec_status_t::failed, refda_exec_status_t::finished, refda_exec_seq_t::pid, refda_exec_proc_expand(), refda_exec_seq_t::runctx, and refda_exec_seq_t::status.

Referenced by refda_agent_startup_exec(), and refda_exec_add_execset().

◆ refda_exec_next()

int refda_exec_next ( refda_exec_seq_t seq,
const cace_ari_t target 
)

Setup an ARI to execute next in the sequence.

The front of the execution sequence, the current item, is not modified.

Parameters
[in]agentThe agent context pointer
[in]seqThe sequence within which to inject the ARI target(s)
[in]targetThe ARI to execute
Returns
Non-zero if the ARI could not be queued for execution

References CHKERR1, and refda_exec_proc_expand().

Referenced by refda_adm_ietf_dtnma_agent_ctrl_catch(), and refda_adm_ietf_dtnma_agent_ctrl_if_then_else().

◆ refda_exec_sbr_disable()

int refda_exec_sbr_disable ( refda_agent_t agent,
refda_amm_sbr_desc_t sbr 
)

Cease periodic execution of a state based rule.

Parameters
[in]agentThe agent context pointer
[in]sbrThe rule to disable
Returns
Non-zero if the rule could not be stopped

References agent, CHKERR1, refda_amm_sbr_desc_t::enabled, refda_agent_t::instr, and refda_instr_t::num_sbrs.

Referenced by refda_adm_ietf_dtnma_agent_ctrl_ensure_rule_enabled(), refda_adm_ietf_dtnma_agent_ctrl_obsolete_rule(), refda_adm_ietf_dtnma_agent_ctrl_reset_rule_enabled(), and refda_exec_run_sbr().

◆ refda_exec_sbr_enable()

◆ refda_exec_tbr_disable()

int refda_exec_tbr_disable ( refda_agent_t agent,
refda_amm_tbr_desc_t tbr 
)

Cease periodic execution of a time based rule.

Parameters
[in]agentThe agent context pointer
[in]tbrThe rule to disable
Returns
Non-zero if the rule could not be stopped

References agent, CHKERR1, refda_amm_tbr_desc_t::enabled, refda_agent_t::instr, and refda_instr_t::num_tbrs.

Referenced by refda_adm_ietf_dtnma_agent_ctrl_ensure_rule_enabled(), refda_adm_ietf_dtnma_agent_ctrl_obsolete_rule(), refda_adm_ietf_dtnma_agent_ctrl_reset_rule_enabled(), refda_exec_run_tbr(), and refda_exec_schedule_tbr().

◆ refda_exec_tbr_enable()

◆ refda_exec_waiting()

int refda_exec_waiting ( refda_agent_t agent)

Execute any waiting sequences as part of normal worker iteration.

Note
This is for unit testing only, not used by agent directly.
Parameters
[in]agentThe agent state.
Returns
Zero if successful.

References agent, CACE_LOG_CRIT, CACE_LOG_DEBUG, CACE_LOG_ERR, CACE_LOG_WARNING, refda_agent_t::exec_state, refda_agent_t::exec_state_mutex, refda_exec_item_t::execution_stage, refda_exec_seq_t::items, refda_exec_seq_t::pid, refda_exec_proc_run(), and REFDA_EXEC_WAITING.

Referenced by refda_exec_worker_iteration(), test_refda_exec_state_based_rule(), test_refda_exec_state_based_rule_cond_false_then_true(), and test_refda_exec_time_based_rule().

◆ refda_exec_worker()

void * refda_exec_worker ( void *  arg)

Work thread function for the Agent execution manager.

Parameters
[in]argThe context refda_agent_t pointer.
Returns
Always NULL pointer.

References agent, CACE_LOG_INFO, and refda_exec_worker_iteration().

Referenced by refda_agent_start().

◆ refda_exec_worker_iteration()

bool refda_exec_worker_iteration ( refda_agent_t agent)

Helper function to run a single iteration of the exec worker thread.

Note
This is for unit testing only, not used by agent directly.
Parameters
[in]agentThe agent state.
Returns
True to continue the loop, false to stop

References agent, refda_runctx_t::agent, refda_timeline_sbr_event_t::agent, refda_timeline_tbr_event_t::agent, cace_ari_is_undefined(), CACE_LOG_DEBUG, CACE_LOG_ERR, CACE_LOG_INFO, cace_log_is_enabled_for(), cace_timeperiod_encode(), refda_timeline_sbr_event_t::callback, refda_timeline_tbr_event_t::callback, refda_timeline_exec_event_t::callback, refda_timeline_event_t::exec, refda_agent_t::exec_end, refda_agent_t::exec_timeline, refda_agent_t::execs, refda_agent_t::execs_enable, refda_agent_t::execs_sem, refda_exec_item_t::execution_stage, refda_agent_t::instr, refda_timeline_exec_event_t::item, refda_instr_t::num_ctrls_run, refda_timeline_event_t::purpose, refda_ctrl_exec_ctx_deinit(), refda_ctrl_exec_ctx_init(), refda_exec_add_execset(), refda_exec_proc_ctrl_finish(), refda_exec_waiting(), REFDA_EXEC_WAITING, refda_msgdata_deinit(), refda_msgdata_init(), refda_agent_t::rptgs, refda_agent_t::rptgs_sem, refda_ctrl_exec_ctx_t::runctx, refda_timeline_sbr_event_t::sbr, refda_timeline_event_t::sbr, refda_timeline_tbr_event_t::tbr, refda_timeline_event_t::tbr, refda_timeline_event_t::ts, and refda_msgdata_t::value.

Referenced by refda_exec_worker(), test_refda_exec_state_based_rule(), test_refda_exec_state_based_rule_cond_false_then_true(), and test_refda_exec_time_based_rule().