Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
268fcf2
avoid some compiler warnings (we build with -Werror...)
rhaberkorn Jun 1, 2018
3bd9639
Lua 5.3 compatibility: use luaL_optinteger() instead of luaL_optint()
rhaberkorn Jun 1, 2018
23ba579
removed dependency on the rename-tool
rhaberkorn Jun 1, 2018
228895b
daemonize after dmconfig server has been initialized
rhaberkorn Jun 18, 2018
0ed7b27
do fsync() before rename(): avoids possible data loss when power cycl…
rhaberkorn May 20, 2020
c32e681
fixed compiler warnings/errors with GCC 7
rhaberkorn Oct 27, 2020
b7a0c0c
fixed recursive notifications on the root (ie. entire database tree)
rhaberkorn Jan 28, 2021
e026ba4
rewrote event_client_sample.c: it now represents the current state of…
rhaberkorn Feb 19, 2021
7109fc6
dmctrl: fixed crashes when omitting parameters to subcommands
rhaberkorn May 6, 2021
ed6bbfe
fixed processing of the interface state callback
rhaberkorn May 31, 2021
a879fbc
update_interface_state(): make sure that missing interfaces are repor…
rhaberkorn Jun 1, 2021
f478a5b
disabled notifications on all dm_set_*_by_id()
rhaberkorn Jun 1, 2021
3354f34
fixup f478a5b0c20fd77e2469571b4fe1a6c82b2251d7: some notifications we…
rhaberkorn Jun 9, 2021
00ba936
ported from Python 2 to 3
rhaberkorn Jun 23, 2021
04d9843
fixed compiler warnings/errors with GCC 10
rhaberkorn Jul 1, 2021
e93a708
fixed strncpy() problems that could theoretically result in untermina…
rhaberkorn Jul 14, 2021
fca2a6f
added dm_authentication action and added missing action for system.nt…
rhaberkorn Oct 10, 2021
ad906e1
invalid AVP_PATHs will now return RC_ERR_VALUE_NOT_FOUND
rhaberkorn Jan 6, 2022
69b4dc6
minor fix in update_interface_state(): report interface as down also …
rhaberkorn Jan 11, 2022
08714a0
avoid dm_save() recursions (FIXME FIXME FIXME)
rhaberkorn Jan 11, 2022
3fe2420
Revert "avoid dm_save() recursions (FIXME FIXME FIXME)"
rhaberkorn Feb 6, 2022
3a7e48c
avoid ev_loop recursion: some of the server-to-client requests have b…
rhaberkorn Feb 9, 2022
0b764a8
added --with-config-version to specify the version that configs are s…
rhaberkorn May 20, 2022
324e06e
fixed the dm.list() and dm.set() commands of the Lua interface
rhaberkorn Jun 15, 2022
4e56524
fixed serious memory leaks of DM2_REQUEST stubs
rhaberkorn Jun 22, 2022
a0a4238
added interfaces-state.interface.ipv[46].gateway-ip array for queryin…
rhaberkorn Oct 2, 2022
2d357ce
fixed memory leak in update_interface_state()
rhaberkorn Dec 10, 2022
8641bd1
fixed file descriptor leak and error handling in update_interface_sta…
rhaberkorn Dec 10, 2022
61c79ac
ported the event_notify_sample.c to the new libdmconfig API
rhaberkorn Dec 11, 2022
63254ba
deserialize the base config before running fncStartup.lua
rhaberkorn May 14, 2023
ce0a9c5
use talloc_total_size() for testing for libtalloc: will work with lib…
rhaberkorn Jan 12, 2024
25a16bd
avoid `bool` as variable names, so that stdbool.h can be included
rhaberkorn Jan 12, 2024
0e97a9d
removed unnecessary checks - they are treated as errors by modern ver…
rhaberkorn Sep 23, 2024
29520c5
dm_deserialize: fixed deserialization of octal escapes (for `encoding…
rhaberkorn Jul 16, 2025
8cb1d9b
fixed reporting of interfaces-state.interface.X.phys-address
rhaberkorn Sep 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ mand/p_table_stubs.c
# libdmconfig build files
libdmconfig/codes.h
libdmconfig/extensivedump.out
libdmconfig/tests/event_client_sample
libdmconfig/tests/event_notify_sample

# lua build files
lua/fncAdminPasswd.out
Expand Down Expand Up @@ -50,7 +52,8 @@ stamp-h1
/build*

# pyang plugin
OpenCPE.pyc
__pycache__
*.pyc
p_table*
dm_action_*

Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ AM_CFLAGS = -DWITH_SOAPDEFS_H

EXTRA_DIST = doxygen.cfg

SUBDIRS = utils libdmconfig libdmconfig/tests mand lua
SUBDIRS = utils libdmconfig libdmconfig/tests mand

LIBTOOL_DEPS = @LIBTOOL_DEPS@
libtool: $(LIBTOOL_DEPS)
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ aware and depend on particular entries in those models.
- expat
- libev
- libtalloc
- lua 5.1 or 5.2
- libnl and libnl-route
- lua 5.1 - 5.3
- xsltproc
- python
- pyang
- python3
- pyang v1.7
- python3-six

## Optional tools and libraries

Expand Down Expand Up @@ -75,6 +77,10 @@ libdmconfig API documentation can be build with doxygen:

For how to use this API, refer to the C and Lua samples in libdmconfig/tests.

**NOTE:** Currently only the [event_client_sample.c](libdmconfig/tests/event_client_sample.c)
and [event_notify_sample.c](libdmconfig/tests/event_notify_sample.c)
examples build and reflect the current state of the API.

# Adding new YANG modules

YANG is specified in [RFC 6020][1]. mand already contains several IETF YANG modules
Expand Down
16 changes: 13 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dnl ##

AC_MSG_PART(Build Tools)

AM_PATH_PYTHON
AM_PATH_PYTHON([3.0])
AX_PYTHON_MODULE([pyang], [true])
AC_CHECK_PROG(PYANG, pyang, pyang)

Expand All @@ -40,7 +40,6 @@ AM_PROG_CC_C_O
AC_CHECK_PROG(LUAC, luac, luac)
AC_CHECK_PROG(LUAC, luac5.1, luac5.1)
AC_CHECK_HEADER(lua.h, , AC_MSG_ERROR(You need the lua headers) )
AC_CHECK_PROG(RENAME, rename, rename)
AC_PROG_INSTALL
AC_SET_MAKE
AC_CHECK_DEBUGGING
Expand Down Expand Up @@ -101,9 +100,14 @@ AC_CHECK_LIB([lua], lua_callk, , [have_liblua=no], [-ldl -lm])
if test x$have_liblua = xno; then
AC_CHECK_LIB([lua5.1], lua_call, , AC_MSG_ERROR(Required liblua missing), [-ldl -lm])
fi
AC_CHECK_LIB(talloc, talloc_named_const, , AC_MSG_ERROR(Required libtalloc missing) )
AC_CHECK_LIB(talloc, talloc_total_size, , AC_MSG_ERROR(Required libtalloc missing) )
AC_CHECK_HEADERS([talloc.h talloc/talloc.h])

# Necessary to rertrieving the interface-state.
PKG_CHECK_MODULES([LIBNL3], [libnl-3.0 >= 3.2.8 libnl-route-3.0 >= 3.2.8])
AC_SUBST([LIBNL3_LIBS])
AC_SUBST([LIBNL3_CFLAGS])

save_LIBS=$LIBS

AC_CHECK_HEADER(pthread.h, , AC_MSG_ERROR(You need the pthread headers) )
Expand All @@ -117,6 +121,12 @@ dnl

AC_MSG_PART(Options)

AC_ARG_WITH(config-version,
[AC_HELP_STRING([--with-config-version=<VERSION>],
[Version of serialized configs])],
[cfg_version=$withval], [cfg_version=1])
AC_DEFINE_UNQUOTED(CFG_VERSION, $cfg_version, [Version of serialized configs])

dnl libdmconfig related options

AC_ARG_ENABLE(libdmconfig-debug,
Expand Down
6 changes: 0 additions & 6 deletions libdmconfig/dm_dmclient_rpc_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

uint32_t rpc_client_active_notify(void *ctx, DM2_AVPGRP *obj) __attribute__ ((weak, alias ("__rpc_client_active_notify")));
uint32_t rpc_client_event_broadcast(void *ctx, const char *path, uint32_t type) __attribute__ ((weak, alias ("__rpc_client_event_broadcast")));
uint32_t rpc_client_get_interface_state(void *ctx, const char *if_name, DM2_REQUEST *answer) __attribute__ ((weak, alias ("__rpc_client_get_interface_state")));
uint32_t rpc_agent_firmware_download(void *ctx, char *address, uint8_t credentialstype, char *credential,
char *install_target, uint32_t timeframe, uint8_t retry_count,
uint32_t retry_interval, uint32_t retry_interval_increment,
Expand All @@ -28,11 +27,6 @@ uint32_t __rpc_client_event_broadcast(void *ctx __attribute__((unused)), const c
return RC_OK;
}

uint32_t __rpc_client_get_interface_state(void *ctx __attribute__((unused)), const char *if_name __attribute__((unused)), DM2_REQUEST *answer __attribute__((unused)))
{
return RC_OK;
}

uint32_t __rpc_agent_firmware_download(void *ctx __attribute__((unused)),
char *address __attribute__((unused)),
uint8_t credentialstype __attribute__((unused)),
Expand Down
1 change: 0 additions & 1 deletion libdmconfig/dm_dmclient_rpc_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

uint32_t rpc_client_active_notify(void *ctx, DM2_AVPGRP *obj);
uint32_t rpc_client_event_broadcast(void *ctx, const char *path, uint32_t type);
uint32_t rpc_client_get_interface_state(void *ctx, const char *if_name, DM2_REQUEST *answer);
uint32_t rpc_agent_firmware_download(void *ctx, char *address, uint8_t credentialstype, char *credential,
char *install_target, uint32_t timeframe, uint8_t retry_count,
uint32_t retry_interval, uint32_t retry_interval_increment,
Expand Down
17 changes: 0 additions & 17 deletions libdmconfig/dm_dmclient_rpc_skel.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,6 @@ rpc_client_event_broadcast_skel(void *ctx, DM2_AVPGRP *obj)
return rpc_client_event_broadcast(ctx, path, type);
}

static inline uint32_t
rpc_client_get_interface_state_skel(void *ctx, DM2_AVPGRP *obj, DM2_REQUEST *answer)
{
uint32_t rc;
char *if_name;

if ((rc = dm_expect_string_type(obj, AVP_STRING, VP_TRAVELPING, &if_name)) != RC_OK
|| (rc = dm_expect_end(obj)) != RC_OK)
return rc;

return rpc_client_get_interface_state(ctx, if_name, answer);
}

static inline uint32_t
rpc_agent_firmware_download_skel(void *ctx, DM2_AVPGRP *obj, DM2_REQUEST *answer)
{
Expand Down Expand Up @@ -154,10 +141,6 @@ rpc_dmclient_switch(void *ctx, const DMC_REQUEST *req, DM2_AVPGRP *obj __attribu
return rc;

switch (req->code) {
case CMD_CLIENT_GET_INTERFACE_STATE:
rc = rpc_client_get_interface_state_skel(ctx, obj, *answer);
break;

case CMD_FIRMWARE_DOWNLOAD:
rpc_agent_firmware_download_skel(ctx, obj, *answer);
break;
Expand Down
64 changes: 0 additions & 64 deletions libdmconfig/dm_dmclient_rpc_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,6 @@ uint32_t rpc_event_broadcast(DMCONTEXT *ctx, const char *path, uint32_t type)

}

uint32_t rpc_get_interface_state_async(DMCONTEXT *ctx, const char *if_name, DMRESULT_CB cb, void *data)
{
uint32_t rc;
DM2_REQUEST *req;

if (!(req = dm_new_request(ctx, CMD_CLIENT_GET_INTERFACE_STATE, CMD_FLAG_REQUEST, 0, 0)))
return RC_ERR_ALLOC;

if ((rc = dm_add_string(req, AVP_STRING, VP_TRAVELPING, if_name)) != RC_OK
|| (rc = dm_finalize_packet(req)) != RC_OK)
return rc;

return dm_enqueue_request(ctx, req, cb, data);
}

uint32_t rpc_agent_firmware_download_async(DMCONTEXT *ctx, const char *address, uint8_t credentialstype, const char *credential,
const char *install_target, uint32_t timeframe, uint8_t retry_count,
uint32_t retry_interval, uint32_t retry_interval_increment,
Expand Down Expand Up @@ -124,52 +109,3 @@ uint32_t rpc_agent_set_boot_order_async(DMCONTEXT *ctx, int pcnt, const char **b

return dm_enqueue_request(ctx, req, cb, data);
}

/*
* sync call wrapper's
*/

uint32_t rpc_get_interface_state(DMCONTEXT *ctx, const char *if_name, DM2_AVPGRP *answer)
{
struct async_reply reply = {.rc = RC_OK, .answer = answer };

rpc_get_interface_state_async(ctx, if_name, dm_async_cb, &reply);
ev_run(ctx->ev, 0);

return reply.rc;
}

uint32_t rpc_agent_firmware_download(DMCONTEXT *ctx, const char *address, uint8_t credentialstype, const char *credential,
const char *install_target, uint32_t timeframe, uint8_t retry_count,
uint32_t retry_interval, uint32_t retry_interval_increment,
DM2_AVPGRP *answer)
{
struct async_reply reply = {.rc = RC_OK, .answer = answer };

rpc_agent_firmware_download_async(ctx, address, credentialstype, credential, install_target,
timeframe, retry_count, retry_interval, retry_interval_increment,
dm_async_cb, &reply);
ev_run(ctx->ev, 0);

return reply.rc;
}

uint32_t rpc_agent_firmware_commit(DMCONTEXT *ctx, int32_t job_id)
{
struct async_reply reply = {.rc = RC_OK, .answer = NULL };

rpc_agent_firmware_commit_async(ctx, job_id, dm_async_cb, &reply);
ev_run(ctx->ev, 0);

return reply.rc;
}

uint32_t rpc_agent_set_boot_order(DMCONTEXT *ctx, int pcnt, const char **boot_order)
{
struct async_reply reply = {.rc = RC_OK, .answer = NULL };

rpc_agent_set_boot_order_async(ctx, pcnt, boot_order, dm_async_cb, &reply);
ev_run(ctx->ev, 0);

return reply.rc;
}
9 changes: 0 additions & 9 deletions libdmconfig/dm_dmclient_rpc_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,11 @@
#include "mand/dm_notify.h"

uint32_t rpc_event_broadcast(DMCONTEXT *ctx, const char *path, uint32_t type);
uint32_t rpc_get_interface_state_async(DMCONTEXT *ctx, const char *if_name, DMRESULT_CB cb, void *data);
uint32_t rpc_agent_firmware_download_async(DMCONTEXT *ctx, const char *address, uint8_t credentialstype, const char *credential,
const char *install_target, uint32_t timeframe, uint8_t retry_count,
uint32_t retry_interval, uint32_t retry_interval_increment,
DMRESULT_CB cb, void *data);
uint32_t rpc_agent_firmware_commit_async(DMCONTEXT *ctx, int32_t job_id, DMRESULT_CB cb, void *data);
uint32_t rpc_agent_set_boot_order_async(DMCONTEXT *ctx, int pcnt, const char **boot_order, DMRESULT_CB cb, void *data);

uint32_t rpc_get_interface_state(DMCONTEXT *ctx, const char *if_name, DM2_AVPGRP *answer);
uint32_t rpc_agent_firmware_download(DMCONTEXT *ctx, const char *address, uint8_t credentialstype, const char *credential,
const char *install_target, uint32_t timeframe, uint8_t retry_count,
uint32_t retry_interval, uint32_t retry_interval_increment,
DM2_AVPGRP *grp);
uint32_t rpc_agent_firmware_commit(DMCONTEXT *ctx, int32_t job_id);
uint32_t rpc_agent_set_boot_order(DMCONTEXT *ctx, int pcnt, const char **boot_order);

#endif
8 changes: 5 additions & 3 deletions libdmconfig/dm_dmconfig_rpc_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ uint32_t rpc_system_shutdown(void *ctx);
uint32_t rpc_firmware_download(void *ctx, char *address, uint8_t credentialstype, char *credential,
char *install_target, uint32_t timeframe, uint8_t retry_count,
uint32_t retry_interval, uint32_t retry_interval_increment,
DM2_REQUEST *answer);
uint32_t rpc_firmware_commit(void *ctx, int32_t job_id);
uint32_t rpc_set_boot_order(void *ctx, int pcnt, const char **boot_order);
struct dm_request_info *request_info);
uint32_t rpc_firmware_commit(void *ctx, int32_t job_id,
struct dm_request_info *request_info);
uint32_t rpc_set_boot_order(void *ctx, int pcnt, const char **boot_order,
struct dm_request_info *request_info);

#endif
Loading