|
DTNMA Reference Tools v2.1.0 - 27.ge2c7586
Delay-Tolerant Networking Management Architecture (DTNMA) Tool Suite
|
#include "eval.h"#include "oper_eval_ctx.h"#include "valprod.h"#include "amm/oper.h"#include "cace/ari/text.h"#include "cace/amm/lookup.h"#include "cace/util/logging.h"#include "cace/util/defs.h"
Include dependency graph for eval.c:Functions | |
| static int | refda_eval_expand_item (refda_runctx_t *runctx, refda_eval_item_t out, const cace_ari_t *in) |
| Expand a reference to a literal value matching SIMPLE or EXPR typedef. | |
| int | refda_eval_oper (refda_eval_ctx_t *ctx, const cace_amm_lookup_t *deref) |
| This is a semi-internal function for evaluating a single operator in an existing evaluation context. | |
| int | refda_eval_expand_expr (refda_eval_ctx_t *ctx, const cace_ari_t *expr) |
| Perform the expansion portion of the evaluation procedure from a literal value expression. | |
| int | refda_eval_reduce (refda_eval_ctx_t *ctx, cace_ari_t *result) |
| Implement the reduction portion of the evaluation procedure. | |
| int | refda_eval_expand_target (refda_eval_ctx_t *ctx, const cace_ari_t *target) |
| Perform the expansion portion of the evaluation procedure from either an inline expression (literal value) or produced expression (from reference value). | |
| int | refda_eval_target (refda_runctx_t *runctx, cace_ari_t *result, const cace_ari_t *target) |
| A shortcut to fully evaluate an expression. | |
| int refda_eval_expand_expr | ( | refda_eval_ctx_t * | ctx, |
| const cace_ari_t * | expr | ||
| ) |
Perform the expansion portion of the evaluation procedure from a literal value expression.
refda_agent_s::objs_mutex must already be locked. | [in] | ctx | The evaluation context, which must already be initialized. |
| [in] | expr | The literal-value EXPR to evaluate. |
References cace_ari_cget_ac(), CACE_ARI_TEXT_ENC_OPTS_DEFAULT, cace_ari_text_encode(), CACE_LOG_DEBUG, cace_log_is_enabled_for(), CACE_LOG_WARNING, CHKERR1, refda_eval_ctx_t::input, cace_ari_ac_t::items, REFDA_EVAL_ERR_BAD_TYPE, refda_eval_expand_item(), and refda_eval_ctx_t::runctx.
Referenced by refda_acl_search_endpoint(), refda_alarms_purge(), refda_eval_expand_target(), refda_exec_check_sbr_condition(), and refda_reporting_item_lit().
|
static |
Expand a reference to a literal value matching SIMPLE or EXPR typedef.
References refda_runctx_t::agent, cace_amm_lookup_deinit(), cace_amm_lookup_deref(), cace_amm_lookup_init(), cace_ari_init(), CACE_ARI_TYPE_CONST, CACE_ARI_TYPE_EDD, CACE_ARI_TYPE_OPER, CACE_ARI_TYPE_TYPEDEF, CACE_ARI_TYPE_VAR, CACE_LOG_DEBUG, cace_ari_t::is_ref, cace_amm_lookup_t::obj_type, refda_agent_t::objs, REFDA_EVAL_ERR_BAD_TYPE, REFDA_EVAL_ERR_DEREF_FAILED, REFDA_EVAL_ERR_PROD_FAILED, refda_valprod_ctx_deinit(), refda_valprod_ctx_init(), refda_valprod_run(), and refda_valprod_ctx_t::value.
Referenced by refda_eval_expand_expr().
| int refda_eval_expand_target | ( | refda_eval_ctx_t * | ctx, |
| const cace_ari_t * | target | ||
| ) |
Perform the expansion portion of the evaluation procedure from either an inline expression (literal value) or produced expression (from reference value).
refda_agent_s::objs_mutex must already be locked. | [in] | ctx | The evaluation context, which must already be initialized. |
| [in] | target | The literal-value EXPR to evaluate or reference-value to produce and evaluate. |
References refda_runctx_t::agent, cace_amm_lookup_deinit(), cace_amm_lookup_deref(), cace_amm_lookup_init(), CACE_LOG_DEBUG, CHKERR1, cace_ari_t::is_ref, refda_agent_t::objs, refda_eval_expand_expr(), refda_valprod_ctx_deinit(), refda_valprod_ctx_init(), refda_valprod_run(), refda_eval_ctx_t::runctx, and refda_valprod_ctx_t::value.
Referenced by refda_adm_ietf_dtnma_agent_oper_eval(), refda_adm_ietf_dtnma_agent_oper_unary_eval(), and refda_eval_target().
| int refda_eval_oper | ( | refda_eval_ctx_t * | ctx, |
| const cace_amm_lookup_t * | deref | ||
| ) |
This is a semi-internal function for evaluating a single operator in an existing evaluation context.
| [in,out] | ctx | The evaluation context already populated with refda_eval_ctx_t::stack values. At the start of evaluation any named operands are popped from the stack At the completion of evaluation the result value is pushed onto the stack. This function does not use the refda_eval_ctx_t::input value. |
| [in] | deref | The dereferenced operator with any needed actual parameters. |
References cace_amm_obj_desc_t::app_data, cace_amm_type_convert(), cace_amm_type_is_valid(), cace_ari_deinit(), cace_ari_init(), CACE_ARI_TEXT_ENC_OPTS_DEFAULT, cace_ari_text_encode(), CACE_LOG_DEBUG, cace_log_is_enabled_for(), CACE_LOG_WARNING, CHKRET, refda_amm_oper_desc_t::evaluate, cace_amm_idseg_val_t::name, cace_amm_lookup_t::obj, cace_amm_obj_desc_t::obj_id, refda_oper_eval_ctx_t::operands, cace_ari_itemized_t::ordered, cace_amm_user_data_t::ptr, refda_oper_eval_ctx_deinit(), refda_oper_eval_ctx_init(), refda_oper_eval_ctx_populate(), refda_amm_oper_desc_t::res_type, refda_oper_eval_ctx_t::result, and refda_eval_ctx_t::stack.
Referenced by predicate_compose(), and refda_eval_reduce().
| int refda_eval_reduce | ( | refda_eval_ctx_t * | ctx, |
| cace_ari_t * | result | ||
| ) |
Implement the reduction portion of the evaluation procedure.
| [in] | ctx | The evaluation context, which must already be expanded into. |
| [out] | result | The single result value from the evaluation. This ARI must be initialized before the call and will be valid if the return code is zero but must be deinitialized regardless. |
References cace_ari_set_copy(), CACE_ARI_TEXT_ENC_OPTS_DEFAULT, cace_ari_text_encode(), CACE_ARI_TYPE_OPER, CACE_LOG_DEBUG, cace_log_is_enabled_for(), CACE_LOG_WARNING, refda_eval_ctx_t::input, cace_amm_lookup_t::obj_type, REFDA_EVAL_ERR_NON_SINGLE, refda_eval_oper(), and refda_eval_ctx_t::stack.
Referenced by refda_acl_search_endpoint(), refda_adm_ietf_dtnma_agent_oper_eval(), refda_adm_ietf_dtnma_agent_oper_unary_eval(), refda_alarms_purge(), refda_eval_target(), refda_exec_check_sbr_condition(), and refda_reporting_item_lit().
| int refda_eval_target | ( | refda_runctx_t * | runctx, |
| cace_ari_t * | result, | ||
| const cace_ari_t * | target | ||
| ) |
A shortcut to fully evaluate an expression.
refda_agent_s::objs_mutex must already be locked. | [in] | runctx | The running context for evaluation. |
| [out] | result | The single result value from the evaluation. This ARI must be initialized before the call and will be valid if the return code is zero but must be deinitialized regardless. |
| [in] | target | The literal-value EXPR to evaluate or reference-value to produce and evaluate. |
References refda_eval_ctx_deinit(), refda_eval_ctx_init(), refda_eval_expand_target(), and refda_eval_reduce().
Referenced by refda_adm_ietf_dtnma_agent_ctrl_if_then_else(), refda_adm_ietf_dtnma_agent_ctrl_wait_cond_check(), refda_adm_ietf_dtnma_agent_oper_tbl_filter(), refda_alarms_compress(), refda_alarms_mgr_state(), TEST_CASE(), and test_refda_eval_target_failure().