libamxb  4.8.2
Bus Agnostic C API
amxb_expr_funcs.c File Reference
#include <stdlib.h>
#include <amxc/amxc.h>
#include <amxp/amxp.h>
#include <amxd/amxd_common.h>
#include <amxd/amxd_dm.h>
#include <amxd/amxd_object.h>
#include <amxd/amxd_path.h>
#include <amxb/amxb.h>
#include <amxb/amxb_operators.h>
#include "amxb/amxb_be_intf.h"
#include "amxb_priv.h"

Go to the source code of this file.

Data Structures

struct  _amxb_resolve
 

Typedefs

typedef struct _amxb_resolve amxb_resolve_t
 

Functions

static int amxb_ba_resolve_path (amxb_bus_ctx_t *bus_ctx, UNUSED const amxc_var_t *args, void *priv)
 
static void amxb_ba_get_all_matching (amxd_path_t *path, amxc_var_t *ret)
 
static amxp_expr_status_t amxb_ba_value_spath (UNUSED amxp_expr_t *expr, amxc_var_t *args, amxc_var_t *ret)
 
 CONSTRUCTOR_LVL (102)
 

Typedef Documentation

◆ amxb_resolve_t

typedef struct _amxb_resolve amxb_resolve_t

Function Documentation

◆ amxb_ba_get_all_matching()

static void amxb_ba_get_all_matching ( amxd_path_t *  path,
amxc_var_t *  ret 
)
static

Definition at line 93 of file amxb_expr_funcs.c.

94  {
95  amxc_var_t args;
96  amxb_resolve_t resolver = {
97  .ret = ret,
98  .path = path
99  };
100  amxc_var_init(&args);
101  amxc_var_set_type(&args, AMXC_VAR_ID_HTABLE);
102 
104 
105  amxc_var_clean(&args);
106 }
static int amxb_ba_resolve_path(amxb_bus_ctx_t *bus_ctx, UNUSED const amxc_var_t *args, void *priv)
int amxb_be_for_all_connections(amxb_be_task_fn_t fn, const amxc_var_t *args, void *priv)
Calls a function on all open connections.
amxc_var_t * ret

◆ amxb_ba_resolve_path()

static int amxb_ba_resolve_path ( amxb_bus_ctx_t bus_ctx,
UNUSED const amxc_var_t *  args,
void *  priv 
)
static

Definition at line 76 of file amxb_expr_funcs.c.

78  {
79  int retval = -1;
80  amxb_resolve_t* resolver = (amxb_resolve_t*) priv;
81  uint32_t caps = 0;
82 
85  goto exit;
86  }
87  retval = amxb_resolve(bus_ctx, resolver->path, resolver->ret);
88 
89 exit:
90  return retval;
91 }
#define AMXB_BE_DISCOVER_RESOLVE
Definition: amxb_be_intf.h:344
int amxb_resolve(amxb_bus_ctx_t *bus_ctx, amxd_path_t *obj_path, amxc_var_t *ret_val)
uint32_t PRIVATE amxb_be_get_capabilities(amxb_bus_ctx_t *bus_ctx)
Definition: amxb_ba_priv.c:157
static uint32_t caps
Definition: dummy_be.c:70
amxd_path_t * path
static amxb_bus_ctx_t * bus_ctx
Definition: test_amxb_e2e.c:84

◆ amxb_ba_value_spath()

static amxp_expr_status_t amxb_ba_value_spath ( UNUSED amxp_expr_t *  expr,
amxc_var_t *  args,
amxc_var_t *  ret 
)
static

Definition at line 108 of file amxb_expr_funcs.c.

110  {
111 
112  amxp_expr_status_t status = amxp_expr_status_invalid_value;
113  amxc_llist_it_t* it = amxc_llist_get_first(&args->data.vl);
114  amxc_var_t* data = amxc_var_from_llist_it(it);
115  const char* str_path = NULL;
116  amxd_path_t path;
117 
118  amxd_path_init(&path, NULL);
119 
120  when_null(it, exit);
121  when_true(amxc_var_type_of(data) != AMXC_VAR_ID_CSTRING, exit);
122 
123  str_path = amxc_var_constcast(cstring_t, data);
124  when_failed(amxd_path_setf(&path, false, "%s", str_path), exit);
125 
126  amxc_var_set_type(ret, AMXC_VAR_ID_LIST);
127  amxb_ba_get_all_matching(&path, ret);
128 
129  status = amxp_expr_status_ok;
130 
131 exit:
132  amxd_path_clean(&path);
133  return status;
134 }
static void amxb_ba_get_all_matching(amxd_path_t *path, amxc_var_t *ret)

◆ CONSTRUCTOR_LVL()

CONSTRUCTOR_LVL ( 102  )

Definition at line 136 of file amxb_expr_funcs.c.

136  {
137  amxp_expr_add_value_fn("search_path", amxb_ba_value_spath);
138 }
static amxp_expr_status_t amxb_ba_value_spath(UNUSED amxp_expr_t *expr, amxc_var_t *args, amxc_var_t *ret)