#include <stdlib.h>
#include <string.h>
#include <amxc/amxc.h>
#include <amxp/amxp.h>
#include <amxd/amxd_dm.h>
#include <amxd/amxd_object.h>
#include <amxd/amxd_object_function.h>
#include <amxb/amxb_be.h>
#include <amxo/amxo.h>
#include "dummy_be.h"
#include <amxc/amxc_macros.h>
Go to the source code of this file.
|
static void | amxb_dummy_send_notification (const char *const sig_name, const amxc_var_t *const data, void *const priv) |
|
static void | amxb_dummy_free_subscription (UNUSED const char *key, amxc_htable_it_t *it) |
|
static void * | amxb_dummy_connect (UNUSED const char *host, UNUSED const char *port, UNUSED const char *path, UNUSED amxp_signal_mngr_t *sigmngr) |
|
static int | amxb_dummy_disconnect (UNUSED void *ctx) |
|
static int | amxb_dummy_invoke (UNUSED void *const ctx, amxb_invoke_t *invoke_ctx, amxc_var_t *args, amxb_request_t *request, UNUSED int timeout) |
|
static void | amxb_dummy_free (UNUSED void *ctx) |
|
static int | amxb_dummy_register (UNUSED void *const ctx, UNUSED amxd_dm_t *const dm) |
|
static bool | amxb_dummy_has (UNUSED void *const ctx, const char *object) |
|
static uint32_t | amxb_dummy_capabilities (UNUSED void *const ctx) |
|
static int | amxb_dummy_subscribe (UNUSED void *const ctx, const char *object) |
|
static int | amxb_dummy_unsubscribe (UNUSED void *const ctx, const char *object) |
|
int | test_register_dummy_be (void) |
|
int | test_unregister_dummy_be (void) |
|
int | test_load_dummy_remote (const char *odl) |
|
void | test_set_dummy_caps (uint32_t dummy_caps) |
|
amxd_dm_t * | test_get_dm (void) |
|
amxo_parser_t * | test_get_parser (void) |
|
◆ amxb_dummy_capabilities()
static uint32_t amxb_dummy_capabilities |
( |
UNUSED void *const |
ctx | ) |
|
|
static |
◆ amxb_dummy_connect()
static void* amxb_dummy_connect |
( |
UNUSED const char * |
host, |
|
|
UNUSED const char * |
port, |
|
|
UNUSED const char * |
path, |
|
|
UNUSED amxp_signal_mngr_t * |
sigmngr |
|
) |
| |
|
static |
Definition at line 94 of file dummy_be.c.
100 amxo_parser_init(&
parser);
static amxd_dm_t remote_dm
static amxp_signal_mngr_t * dummy_sigmngr
static amxo_parser_t parser
◆ amxb_dummy_disconnect()
static int amxb_dummy_disconnect |
( |
UNUSED void * |
ctx | ) |
|
|
static |
◆ amxb_dummy_free()
static void amxb_dummy_free |
( |
UNUSED void * |
ctx | ) |
|
|
static |
◆ amxb_dummy_free_subscription()
static void amxb_dummy_free_subscription |
( |
UNUSED const char * |
key, |
|
|
amxc_htable_it_t * |
it |
|
) |
| |
|
static |
◆ amxb_dummy_has()
static bool amxb_dummy_has |
( |
UNUSED void *const |
ctx, |
|
|
const char * |
object |
|
) |
| |
|
static |
◆ amxb_dummy_invoke()
static int amxb_dummy_invoke |
( |
UNUSED void *const |
ctx, |
|
|
amxb_invoke_t * |
invoke_ctx, |
|
|
amxc_var_t * |
args, |
|
|
amxb_request_t * |
request, |
|
|
UNUSED int |
timeout |
|
) |
| |
|
static |
Definition at line 111 of file dummy_be.c.
117 amxc_var_t empty_args;
118 amxc_var_t* return_value = NULL;
119 amxc_var_init(&empty_args);
120 amxc_var_set_type(&empty_args, AMXC_VAR_ID_HTABLE);
121 amxc_var_set_type(request->result, AMXC_VAR_ID_LIST);
129 return_value = amxc_var_add_new(request->result);
130 amxd_object_t* obj = amxd_dm_findf(&
remote_dm, invoke_ctx->object);
132 rv = amxd_status_invalid_path;
134 rv = amxd_object_invoke_function(obj, invoke_ctx->method, args, return_value);
137 amxc_var_clean(&empty_args);
◆ amxb_dummy_register()
static int amxb_dummy_register |
( |
UNUSED void *const |
ctx, |
|
|
UNUSED amxd_dm_t *const |
dm |
|
) |
| |
|
static |
◆ amxb_dummy_send_notification()
static void amxb_dummy_send_notification |
( |
const char *const |
sig_name, |
|
|
const amxc_var_t *const |
data, |
|
|
void *const |
priv |
|
) |
| |
|
static |
Definition at line 74 of file dummy_be.c.
77 amxc_var_t notification;
78 amxc_htable_it_t* it = (amxc_htable_it_t*) priv;
79 amxc_var_init(¬ification);
80 amxc_var_set_type(¬ification, AMXC_VAR_ID_HTABLE);
82 amxc_var_copy(¬ification, data);
83 amxc_var_add_key(cstring_t, ¬ification,
"notification", sig_name);
85 amxp_sigmngr_emit_signal(
dummy_sigmngr, amxc_htable_it_get_key(it), ¬ification);
87 amxc_var_clean(¬ification);
◆ amxb_dummy_subscribe()
static int amxb_dummy_subscribe |
( |
UNUSED void *const |
ctx, |
|
|
const char * |
object |
|
) |
| |
|
static |
Definition at line 162 of file dummy_be.c.
166 amxc_string_t expression;
167 amxc_htable_it_t* it = NULL;
169 amxc_string_init(&expression, 0);
171 when_failed(retval, exit);
173 it = (amxc_htable_it_t*) calloc(1,
sizeof(amxc_htable_it_t));
175 amxc_string_appendf(&expression,
"path starts with \"%s.\"",
object);
176 amxp_slot_connect_filtered(&
remote_dm.sigmngr,
178 amxc_string_get(&expression, 0),
183 amxc_string_clean(&expression);
static amxc_htable_t subscriptions
static void amxb_dummy_send_notification(const char *const sig_name, const amxc_var_t *const data, void *const priv)
◆ amxb_dummy_unsubscribe()
static int amxb_dummy_unsubscribe |
( |
UNUSED void *const |
ctx, |
|
|
const char * |
object |
|
) |
| |
|
static |
Definition at line 187 of file dummy_be.c.
189 amxc_htable_it_t* it = amxc_htable_get(&
subscriptions,
object);
static void amxb_dummy_free_subscription(UNUSED const char *key, amxc_htable_it_t *it)
◆ test_get_dm()
amxd_dm_t* test_get_dm |
( |
void |
| ) |
|
◆ test_get_parser()
amxo_parser_t* test_get_parser |
( |
void |
| ) |
|
◆ test_load_dummy_remote()
int test_load_dummy_remote |
( |
const char * |
odl | ) |
|
Definition at line 254 of file dummy_be.c.
255 amxd_object_t* root_obj = amxd_dm_get_root(&
remote_dm);
257 return amxo_parser_parse_file(&
parser, odl, root_obj);
◆ test_register_dummy_be()
int test_register_dummy_be |
( |
void |
| ) |
|
Definition at line 244 of file dummy_be.c.
static amxb_be_funcs_t amxb_dummy_impl
◆ test_set_dummy_caps()
void test_set_dummy_caps |
( |
uint32_t |
dummy_caps | ) |
|
◆ test_unregister_dummy_be()
int test_unregister_dummy_be |
( |
void |
| ) |
|
◆ amxb_dummy_be_info
amxb_be_info_t amxb_dummy_be_info |
Initial value:= {
.name = "dummy",
.description = "AMXB Dummy Backend for testing",
}
static amxb_version_t dummy_be_version
static amxb_version_t sup_max_lib_version
static amxb_version_t sup_min_lib_version
Definition at line 235 of file dummy_be.c.
◆ amxb_dummy_impl
amxb_be_funcs_t amxb_dummy_impl |
|
static |
Initial value:= {
.get_fd = NULL,
.read = NULL,
.async_invoke = NULL,
.wait_request = NULL,
.close_request = NULL,
.name = "dummy",
.size = sizeof(amxb_be_funcs_t),
}
static void amxb_dummy_free(UNUSED void *ctx)
static int amxb_dummy_subscribe(UNUSED void *const ctx, const char *object)
static int amxb_dummy_disconnect(UNUSED void *ctx)
static uint32_t amxb_dummy_capabilities(UNUSED void *const ctx)
static int amxb_dummy_register(UNUSED void *const ctx, UNUSED amxd_dm_t *const dm)
static int amxb_dummy_unsubscribe(UNUSED void *const ctx, const char *object)
static bool amxb_dummy_has(UNUSED void *const ctx, const char *object)
static int amxb_dummy_invoke(UNUSED void *const ctx, amxb_invoke_t *invoke_ctx, amxc_var_t *args, amxb_request_t *request, UNUSED int timeout)
static void * amxb_dummy_connect(UNUSED const char *host, UNUSED const char *port, UNUSED const char *path, UNUSED amxp_signal_mngr_t *sigmngr)
Definition at line 198 of file dummy_be.c.
◆ caps
uint32_t caps = AMXB_BE_DISCOVER_DESCRIBE | AMXB_BE_DISCOVER_LIST | AMXB_BE_DISCOVER |
|
static |
◆ dummy_be_version
amxb_version_t dummy_be_version |
|
static |
Initial value:= {
.major = 0,
.minor = 0,
.build = 0,
}
Definition at line 229 of file dummy_be.c.
◆ dummy_sigmngr
amxp_signal_mngr_t* dummy_sigmngr = NULL |
|
static |
◆ parser
◆ remote_dm
◆ subscriptions
amxc_htable_t subscriptions |
|
static |
◆ sup_max_lib_version
amxb_version_t sup_max_lib_version |
|
static |
Initial value:= {
.major = 2,
.minor = -1,
.build = -1
}
Definition at line 223 of file dummy_be.c.
◆ sup_min_lib_version
amxb_version_t sup_min_lib_version |
|
static |
Initial value:= {
.major = 2,
.minor = 0,
.build = -1
}
Definition at line 217 of file dummy_be.c.