Ticket refs #1253: libtr098: move all TR-098 datamodel support from icwmp to libtr098 package

This commit is contained in:
Omar Kallel 2019-09-24 14:32:37 +01:00
parent 89564260af
commit afa51b623b
11 changed files with 61 additions and 5 deletions

View file

@ -52,8 +52,15 @@ icwmpd_LDADD = \
$(LIBJSON_LIBS) \
$(LBLOBMSG_LIBS) \
$(LIBZ_LIBS) \
$(LIBM_LIBS) \
$(LIBM_LIBS)
if TR098
icwmpd_LDADD += \
-ltr098
else
icwmpd_LDADD += \
-lbbfdm
endif
icwmpd_CFLAGS+=-DCWMP_VERSION=\"$(CWMP_VERSION)\"
icwmpd_LDFLAGS+=-DCWMP_VERSION=\"$(CWMP_VERSION)\"

View file

@ -24,8 +24,13 @@
#include "backupSession.h"
#include "xml.h"
#include "log.h"
#ifdef TR098
#include <libtr098/dmentry.h>
#include <libtr098/deviceinfo.h>
#else
#include <libbbfdm/dmentry.h>
#include <libbbfdm/deviceinfo.h>
#endif
#include "config.h"
pthread_mutex_t mutex_config_load = PTHREAD_MUTEX_INITIALIZER;

View file

@ -26,6 +26,9 @@ AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [enable debugging message
AC_ARG_ENABLE(devel, [AS_HELP_STRING([--enable-devel], [enable development messages])], AC_DEFINE(WITH_DEV_DEBUG),)
AC_ARG_ENABLE(dummy_mode, [AS_HELP_STRING([--enable-dummy-mode], [enable dummy mode])], AC_DEFINE(DUMMY_MODE),)
AC_ARG_ENABLE(tr098, [AS_HELP_STRING([--enable-tr098], [enable tr098])], AC_DEFINE(TR098),)
AM_CONDITIONAL([TR098],[test "x$enable_tr098" = "xyes"])
# checks for programs
AC_PROG_CC
AM_PROG_CC_C_O

11
cwmp.c
View file

@ -26,9 +26,14 @@
#include "diagnostic.h"
#include "config.h"
#include <unistd.h>
#ifdef TR098
#include <libtr098/dmentry.h>
#include <libtr098/dmcwmp.h>
#else
#include <libbbfdm/dmentry.h>
#include <libbbfdm/dmbbf.h>
#include <libbbfdm/dmdiagnostics.h>
#endif
struct cwmp cwmp_main = {0};
@ -522,7 +527,7 @@ int run_session_end_func (struct session *session)
CWMP_LOG (INFO,"Executing ippingdiagnostic: end session request");
cwmp_ip_ping_diagnostic();
}
#ifndef TR098
if (end_session_flag & END_SESSION_DOWNLOAD_DIAGNOSTIC)
{
CWMP_LOG (INFO,"Executing download diagnostic: end session request");
@ -534,6 +539,7 @@ int run_session_end_func (struct session *session)
CWMP_LOG (INFO,"Executing upload diagnostic: end session request");
cwmp_start_diagnostic(UPLOAD_DIAGNOSTIC);
}
#endif
if (end_session_flag & END_SESSION_REBOOT)
{
CWMP_LOG (INFO,"Executing Reboot: end session request");
@ -671,7 +677,10 @@ int main(int argc, char **argv)
pthread_t http_cr_server_thread;
struct sigaction act = {0};
#ifndef TR098
bbfdatamodel_type = BBFDM_CWMP; // To show only CWMP parameters
#endif
if (error = cwmp_init(argc, argv, cwmp))
{
return error;

View file

@ -24,6 +24,10 @@
#include "ubus.h"
#include "diagnostic.h"
#include "config.h"
#ifdef TR098
#include <libtr098/dmentry.h>
#include <libtr098/dmcommon.h>
#else
#include <libbbfdm/dmentry.h>
#include <libbbfdm/dmcommon.h>
#include <libbbfdm/dmdiagnostics.h>
@ -109,6 +113,7 @@ int cwmp_start_diagnostic(int diagnostic_type)
free(interface);
return 0;
}
#endif
int cwmp_ip_ping_diagnostic()
{

View file

@ -24,12 +24,19 @@
#include "jshn.h"
#include "external.h"
#include "config.h"
#ifdef TR098
#include <libtr098/dmcwmp.h>
#include <libtr098/dmcommon.h>
#include <libtr098/dmentry.h>
#include <libtr098/deviceinfo.h>
#include <libtr098/dmjson.h>
#else
#include <libbbfdm/dmbbf.h>
#include <libbbfdm/dmcommon.h>
#include <libbbfdm/dmentry.h>
#include <libbbfdm/deviceinfo.h>
#include <libbbfdm/dmjson.h>
#endif
LIST_HEAD(list_value_change);
LIST_HEAD(list_lw_value_change);
pthread_mutex_t mutex_value_change = PTHREAD_MUTEX_INITIALIZER;

View file

@ -31,8 +31,11 @@
#include "cwmp.h"
#include "xml.h"
#include "log.h"
#ifdef TR098
#include <libtr098/dmcwmp.h>
#else
#include <libbbfdm/dmbbf.h>
#endif
#include <stdarg.h>
static int pid;
static json_object *json_obj_in;

View file

@ -19,7 +19,11 @@
#include <pthread.h>
#include <microxml.h>
#include <libubox/list.h>
#ifdef TR098
#include <libtr098/dmcwmp.h>
#else
#include <libbbfdm/dmbbf.h>
#endif
#define MAX_EVENTS 64
#define MAX_INT32 2147483646

View file

@ -13,7 +13,9 @@
#define __DIAGNOSTIC__H
int cwmp_ip_ping_diagnostic();
#ifndef TR098
int cwmp_start_diagnostic(int diagnostic_type);
#endif
int cwmp_nslookup_diagnostic();
int cwmp_traceroute_diagnostic();
int cwmp_udp_echo_diagnostic();

5
ubus.c
View file

@ -19,8 +19,13 @@
#include "external.h"
#include "xml.h"
#include "log.h"
#ifdef TR098
#include <libtr098/wepkey.h>
#include <libtr098/dmentry.h>
#else
#include <libbbfdm/wepkey.h>
#include <libbbfdm/dmentry.h>
#endif
#include "netlink.h"
static struct ubus_context *ctx = NULL;

8
xml.c
View file

@ -23,11 +23,17 @@
#include "backupSession.h"
#include "log.h"
#include "jshn.h"
#ifdef TR098
#include <libtr098/dmentry.h>
#include <libtr098/deviceinfo.h>
#include <libtr098/dmcwmp.h>
#include <libtr098/softwaremodules.h>
#else
#include <libbbfdm/dmentry.h>
#include <libbbfdm/deviceinfo.h>
#include <libbbfdm/dmbbf.h>
#include <libbbfdm/softwaremodules.h>
#endif
LIST_HEAD(list_download);
LIST_HEAD(list_upload);
LIST_HEAD(list_schedule_download);