From 8449a419a8a9874207b6a87fcb40e3a4019e2c79 Mon Sep 17 00:00:00 2001 From: Amin Ben Ramdhane Date: Fri, 29 Apr 2022 12:14:07 +0100 Subject: [PATCH] Remove unused file and macros --- backupSession.c | 2 +- common.c | 67 +++++++++++++++------------------------ configure.ac | 3 -- cwmp.c | 5 --- cwmp_uci.c | 14 ++++----- inc/common.h | 80 +++++++++++++++++++++++++++-------------------- inc/cwmp_kernel.h | 8 ----- inc/log.h | 47 ---------------------------- inc/ubus.h | 9 ++---- ubus.c | 6 ++-- 10 files changed, 86 insertions(+), 155 deletions(-) delete mode 100644 inc/cwmp_kernel.h diff --git a/backupSession.c b/backupSession.c index 64c3cd2..670473e 100644 --- a/backupSession.c +++ b/backupSession.c @@ -213,7 +213,7 @@ mxml_node_t *bkp_session_node_found(mxml_node_t *tree, char *name, struct search if (mxmlGetType(c) == MXML_ELEMENT && strcmp(keys[i].name, (char *) mxmlGetElement(c)) == 0) { d = c; d = mxmlWalkNext(d, c, MXML_DESCEND); - if ((keys[i].value == NULL) || (d && mxmlGetType(d) == MXML_OPAQUE && STRCMP(keys[i].value, mxmlGetOpaque(d)) == 0)) + if ((keys[i].value == NULL) || (d && mxmlGetType(d) == MXML_OPAQUE && CWMP_STRCMP(keys[i].value, mxmlGetOpaque(d)) == 0)) i++; } c = mxmlWalkNext(c, b, MXML_NO_DESCEND); diff --git a/common.c b/common.c index d787d35..d47331c 100755 --- a/common.c +++ b/common.c @@ -43,64 +43,49 @@ struct cwmp_mem { char mem[0]; }; -char *Obj_Excluded[] = { +static char *Obj_Excluded[] = { "Device.DeviceInfo.ProcessStatus.Process.", "Device.Hosts.Host." }; struct option cwmp_long_options[] = { - { "boot-event", no_argument, NULL, 'b' }, { "get-rpc-methods", no_argument, NULL, 'g' }, - { "command-input", no_argument, NULL, 'c' }, { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'v' }, { NULL, 0, NULL, 0 } + { "boot-event", no_argument, NULL, 'b' }, + { "get-rpc-methods", no_argument, NULL, 'g' }, + { "command-input", no_argument, NULL, 'c' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 } }; struct FAULT_CPE FAULT_CPE_ARRAY[] = { [FAULT_CPE_METHOD_NOT_SUPPORTED] = { "9000", FAULT_9000, FAULT_CPE_TYPE_SERVER, "Method not supported" }, - [FAULT_CPE_REQUEST_DENIED] = { "9001", FAULT_9001, FAULT_CPE_TYPE_SERVER, - "Request denied (no reason specified)" }, + [FAULT_CPE_REQUEST_DENIED] = { "9001", FAULT_9001, FAULT_CPE_TYPE_SERVER, "Request denied (no reason specified)" }, [FAULT_CPE_INTERNAL_ERROR] = { "9002", FAULT_9002, FAULT_CPE_TYPE_SERVER, "Internal error" }, [FAULT_CPE_INVALID_ARGUMENTS] = { "9003", FAULT_9003, FAULT_CPE_TYPE_CLIENT, "Invalid arguments" }, [FAULT_CPE_RESOURCES_EXCEEDED] = { "9004", FAULT_9004, FAULT_CPE_TYPE_SERVER, "Resources exceeded" }, [FAULT_CPE_INVALID_PARAMETER_NAME] = { "9005", FAULT_9005, FAULT_CPE_TYPE_CLIENT, "Invalid parameter name" }, [FAULT_CPE_INVALID_PARAMETER_TYPE] = { "9006", FAULT_9006, FAULT_CPE_TYPE_CLIENT, "Invalid parameter type" }, [FAULT_CPE_INVALID_PARAMETER_VALUE] = { "9007", FAULT_9007, FAULT_CPE_TYPE_CLIENT, "Invalid parameter value" }, - [FAULT_CPE_NON_WRITABLE_PARAMETER] = { "9008", FAULT_9008, FAULT_CPE_TYPE_CLIENT, - "Attempt to set a non-writable parameter" }, - [FAULT_CPE_NOTIFICATION_REJECTED] = { "9009", FAULT_9009, FAULT_CPE_TYPE_SERVER, - "Notification request rejected" }, + [FAULT_CPE_NON_WRITABLE_PARAMETER] = { "9008", FAULT_9008, FAULT_CPE_TYPE_CLIENT, "Attempt to set a non-writable parameter" }, + [FAULT_CPE_NOTIFICATION_REJECTED] = { "9009", FAULT_9009, FAULT_CPE_TYPE_SERVER, "Notification request rejected" }, [FAULT_CPE_DOWNLOAD_FAILURE] = { "9010", FAULT_9010, FAULT_CPE_TYPE_SERVER, "Download failure" }, [FAULT_CPE_UPLOAD_FAILURE] = { "9011", FAULT_9011, FAULT_CPE_TYPE_SERVER, "Upload failure" }, - [FAULT_CPE_FILE_TRANSFER_AUTHENTICATION_FAILURE] = { "9012", FAULT_9012, FAULT_CPE_TYPE_SERVER, - "File transfer server authentication failure" }, - [FAULT_CPE_FILE_TRANSFER_UNSUPPORTED_PROTOCOL] = { "9013", FAULT_9013, FAULT_CPE_TYPE_SERVER, - "Unsupported protocol for file transfer" }, - [FAULT_CPE_DOWNLOAD_FAIL_MULTICAST_GROUP] = { "9014", FAULT_9014, FAULT_CPE_TYPE_SERVER, - "Download failure: unable to join multicast group" }, - [FAULT_CPE_DOWNLOAD_FAIL_CONTACT_SERVER] = { "9015", FAULT_9015, FAULT_CPE_TYPE_SERVER, - "Download failure: unable to contact file server" }, - [FAULT_CPE_DOWNLOAD_FAIL_ACCESS_FILE] = { "9016", FAULT_9016, FAULT_CPE_TYPE_SERVER, - "Download failure: unable to access file" }, - [FAULT_CPE_DOWNLOAD_FAIL_COMPLETE_DOWNLOAD] = { "9017", FAULT_9017, FAULT_CPE_TYPE_SERVER, - "Download failure: unable to complete download" }, - [FAULT_CPE_DOWNLOAD_FAIL_FILE_CORRUPTED] = { "9018", FAULT_9018, FAULT_CPE_TYPE_SERVER, - "Download failure: file corrupted" }, - [FAULT_CPE_DOWNLOAD_FAIL_FILE_AUTHENTICATION] = { "9019", FAULT_9019, FAULT_CPE_TYPE_SERVER, - "Download failure: file authentication failure" }, - [FAULT_CPE_DOWNLOAD_FAIL_WITHIN_TIME_WINDOW] = { "9020", FAULT_9020, FAULT_CPE_TYPE_SERVER, - "Download failure: unable to complete download" }, - [FAULT_CPE_DUPLICATE_DEPLOYMENT_UNIT] = { "9026", FAULT_9026, FAULT_CPE_TYPE_SERVER, - "Duplicate deployment unit" }, - [FAULT_CPE_SYSTEM_RESOURCES_EXCEEDED] = { "9027", FAULT_9027, FAULT_CPE_TYPE_SERVER, - "System ressources exceeded" }, + [FAULT_CPE_FILE_TRANSFER_AUTHENTICATION_FAILURE] = { "9012", FAULT_9012, FAULT_CPE_TYPE_SERVER, "File transfer server authentication failure" }, + [FAULT_CPE_FILE_TRANSFER_UNSUPPORTED_PROTOCOL] = { "9013", FAULT_9013, FAULT_CPE_TYPE_SERVER, "Unsupported protocol for file transfer" }, + [FAULT_CPE_DOWNLOAD_FAIL_MULTICAST_GROUP] = { "9014", FAULT_9014, FAULT_CPE_TYPE_SERVER, "Download failure: unable to join multicast group" }, + [FAULT_CPE_DOWNLOAD_FAIL_CONTACT_SERVER] = { "9015", FAULT_9015, FAULT_CPE_TYPE_SERVER, "Download failure: unable to contact file server" }, + [FAULT_CPE_DOWNLOAD_FAIL_ACCESS_FILE] = { "9016", FAULT_9016, FAULT_CPE_TYPE_SERVER, "Download failure: unable to access file" }, + [FAULT_CPE_DOWNLOAD_FAIL_COMPLETE_DOWNLOAD] = { "9017", FAULT_9017, FAULT_CPE_TYPE_SERVER, "Download failure: unable to complete download" }, + [FAULT_CPE_DOWNLOAD_FAIL_FILE_CORRUPTED] = { "9018", FAULT_9018, FAULT_CPE_TYPE_SERVER, "Download failure: file corrupted" }, + [FAULT_CPE_DOWNLOAD_FAIL_FILE_AUTHENTICATION] = { "9019", FAULT_9019, FAULT_CPE_TYPE_SERVER, "Download failure: file authentication failure" }, + [FAULT_CPE_DOWNLOAD_FAIL_WITHIN_TIME_WINDOW] = { "9020", FAULT_9020, FAULT_CPE_TYPE_SERVER, "Download failure: unable to complete download" }, + [FAULT_CPE_DUPLICATE_DEPLOYMENT_UNIT] = { "9026", FAULT_9026, FAULT_CPE_TYPE_SERVER, "Duplicate deployment unit" }, + [FAULT_CPE_SYSTEM_RESOURCES_EXCEEDED] = { "9027", FAULT_9027, FAULT_CPE_TYPE_SERVER, "System ressources exceeded" }, [FAULT_CPE_UNKNOWN_DEPLOYMENT_UNIT] = { "9028", FAULT_9028, FAULT_CPE_TYPE_SERVER, "Unknown deployment unit" }, - [FAULT_CPE_INVALID_DEPLOYMENT_UNIT_STATE] = { "9029", FAULT_9029, FAULT_CPE_TYPE_SERVER, - "Invalid deployment unit state" }, - [FAULT_CPE_INVALID_DOWNGRADE_REJECTED] = { "9030", FAULT_9030, FAULT_CPE_TYPE_SERVER, - "Invalid deployment unit Update: Downgrade not permitted" }, - [FAULT_CPE_INVALID_UPDATE_VERSION_UNSPECIFIED] = { "9031", FAULT_9031, FAULT_CPE_TYPE_SERVER, - "Invalid deployment unit Update: Version not specified" }, - [FAULT_CPE_INVALID_UPDATE_VERSION_EXIST] = { "9031", FAULT_9032, FAULT_CPE_TYPE_SERVER, - "Invalid deployment unit Update: Version already exist" } + [FAULT_CPE_INVALID_DEPLOYMENT_UNIT_STATE] = { "9029", FAULT_9029, FAULT_CPE_TYPE_SERVER, "Invalid deployment unit state" }, + [FAULT_CPE_INVALID_DOWNGRADE_REJECTED] = { "9030", FAULT_9030, FAULT_CPE_TYPE_SERVER, "Invalid deployment unit Update: Downgrade not permitted" }, + [FAULT_CPE_INVALID_UPDATE_VERSION_UNSPECIFIED] = { "9031", FAULT_9031, FAULT_CPE_TYPE_SERVER, "Invalid deployment unit Update: Version not specified" }, + [FAULT_CPE_INVALID_UPDATE_VERSION_EXIST] = { "9031", FAULT_9032, FAULT_CPE_TYPE_SERVER, "Invalid deployment unit Update: Version already exist" } }; static void show_help(void) @@ -744,7 +729,7 @@ char *get_time(time_t t_time) return local_time; } -bool is_obj_excluded(char *object_name) +bool is_obj_excluded(const char *object_name) { unsigned int i = 0; diff --git a/configure.ac b/configure.ac index 7eaf339..583ee0d 100644 --- a/configure.ac +++ b/configure.ac @@ -16,9 +16,6 @@ AS_IF([test "x$enable_acs" = "xmulti"], [AC_DEFINE(ACS_MULTI)]) AS_IF([test "x$enable_acs" = "xyes"], [AC_DEFINE(ACS_MULTI)]) AS_IF([test "x$enable_acs" = "xno"], [AC_DEFINE(ACS_MULTI)]) -AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [enable debugging messages])], AC_DEFINE(WITH_CWMP_DEBUG),) -AC_ARG_ENABLE(devel, [AS_HELP_STRING([--enable-devel], [enable development messages])], AC_DEFINE(WITH_DEV_DEBUG),) - AC_ARG_ENABLE(libopenssl, [AS_HELP_STRING([--enable-libopenssl], [enable libopenssl feature])], AC_DEFINE(LOPENSSL)) AM_CONDITIONAL([LOPENSSL],[test "x$enable_libopenssl" = "xyes"]) diff --git a/cwmp.c b/cwmp.c index c94b4ee..32aec09 100644 --- a/cwmp.c +++ b/cwmp.c @@ -175,11 +175,6 @@ static int cwmp_schedule_rpc(struct cwmp *cwmp, struct session *session) goto retry; CWMP_LOG(INFO, "Get the %sResponse message from the ACS", rpc_acs_methods[rpc_acs->type].name); - /* - * This condition is not always false. - * while the value of thread_end can be changed to true in the exit of icwmp. - */ - // cppcheck-suppress knownConditionTrueFalse if (rpc_acs_methods[rpc_acs->type].parse_response || thread_end) if (rpc_acs_methods[rpc_acs->type].parse_response(cwmp, session, rpc_acs)) goto retry; diff --git a/cwmp_uci.c b/cwmp_uci.c index 5b33521..372c9be 100644 --- a/cwmp_uci.c +++ b/cwmp_uci.c @@ -125,11 +125,11 @@ void cwmp_uci_exit_by_config(int config) } } -int cwmp_uci_init() +int cwmp_uci_init(void) { - int i; - int uci_nbre_conf_paths = (int)(sizeof(uci_save_conf_paths) / sizeof(struct uci_paths)); - for (i = 0; i < uci_nbre_conf_paths; i++) { + unsigned int i = 0; + + for (i = 0; i < ARRAY_SIZE(uci_save_conf_paths); i++) { cwmp_uci_init_by_config(i); } return 0; @@ -137,9 +137,9 @@ int cwmp_uci_init() void cwmp_uci_exit(void) { - int i; - int uci_nbre_conf_paths = (int)(sizeof(uci_save_conf_paths) / sizeof(struct uci_paths)); - for (i = 0; i < uci_nbre_conf_paths; i++) { + unsigned int i = 0; + + for (i = 0; i < ARRAY_SIZE(uci_save_conf_paths); i++) { cwmp_uci_exit_by_config(i); } } diff --git a/inc/common.h b/inc/common.h index 5529c6f..57badc5 100644 --- a/inc/common.h +++ b/inc/common.h @@ -21,9 +21,21 @@ #define CWMP_VERSION "3.0.0" #endif -#define __offsetof__(x) (x) +#ifndef FREE +#define FREE(x) do { if(x) {free(x); x = NULL;} } while (0) +#endif -#define ARRAYSIZEOF(a) (sizeof(a) / sizeof((a)[0])) +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) +#endif + +#define CWMP_STRCMP(S1, S2) ((S1 != NULL && S2 != NULL) ? strcmp(S1, S2) : -1) + +#define CWMP_STRNCPY(DST, SRC, SIZE) \ + do { \ + strncpy(DST, SRC, SIZE - 1); \ + DST[SIZE - 1] = '\0'; \ + } while (0) #define USP_OBJECT_NAME "usp.raw" #define MAX_EVENTS 64 @@ -49,7 +61,6 @@ #define FIREWALL_CWMP "/etc/firewall.cwmp" #define CWMP_VARSTATE_UCI_PACKAGE "/var/state/cwmp" -#define STRCMP(S1, S2) ((S1 != NULL && S2 != NULL) ? strcmp(S1, S2) : -1) extern char *commandKey; extern bool thread_end; extern bool signal_exit; @@ -156,7 +167,10 @@ enum action { RESTART, }; -enum cwmp_start { CWMP_START_BOOT = 1, CWMP_START_PERIODIC = 2 }; +enum cwmp_start { + CWMP_START_BOOT = 1, + CWMP_START_PERIODIC = 2 +}; enum cwmp_ret_err { CWMP_XML_ERR = -1, @@ -167,9 +181,16 @@ enum cwmp_ret_err { CWMP_RETRY_SESSION }; -enum http_compression { COMP_NONE, COMP_GZIP, COMP_DEFLATE }; +enum http_compression { + COMP_NONE, + COMP_GZIP, + COMP_DEFLATE +}; -enum enum_ip_version { IPv4 = 4, IPv6 = 6 }; +enum enum_ip_version { + IPv4 = 4, + IPv6 = 6 +}; typedef struct rpc { struct list_head list; @@ -202,7 +223,10 @@ enum amd_version_enum { AMD_5, }; -enum instance_mode { INSTANCE_MODE_NUMBER, INSTANCE_MODE_ALIAS }; +enum instance_mode { + INSTANCE_MODE_NUMBER, + INSTANCE_MODE_ALIAS +}; struct cwmp_namespaces { char *soap_env; @@ -248,9 +272,16 @@ enum acs_support_idx { RPC_ACS_NOT_SUPPORT }; -enum load_type { TYPE_DOWNLOAD = 0, TYPE_SCHEDULE_DOWNLOAD, TYPE_UPLOAD }; +enum load_type { + TYPE_DOWNLOAD = 0, + TYPE_SCHEDULE_DOWNLOAD, + TYPE_UPLOAD +}; -enum dustate_type { DU_INSTALL = 1, DU_UPDATE, DU_UNINSTALL }; +enum dustate_type { + DU_INSTALL = 1, + DU_UPDATE, DU_UNINSTALL +}; enum fault_cpe_idx { FAULT_CPE_NO_FAULT, @@ -322,7 +353,10 @@ enum fault_code_enum { __FAULT_MAX }; -enum client_server_faults { FAULT_CPE_TYPE_CLIENT, FAULT_CPE_TYPE_SERVER }; +enum client_server_faults { + FAULT_CPE_TYPE_CLIENT, + FAULT_CPE_TYPE_SERVER +}; struct rpc_cpe_method { const char *name; @@ -452,8 +486,7 @@ extern long int flashsize; extern struct FAULT_CPE FAULT_CPE_ARRAY[]; extern struct cwmp_namespaces ns; -void add_dm_parameter_to_list(struct list_head *head, char *param_name, char *param_data, char *param_type, - int notification, bool writable); +void add_dm_parameter_to_list(struct list_head *head, char *param_name, char *param_data, char *param_type, int notification, bool writable); void delete_dm_parameter_from_list(struct cwmp_dm_parameter *dm_parameter); void cwmp_free_all_dm_parameter_list(struct list_head *list); int global_env_init(int argc, char **argv, struct env *env); @@ -495,27 +528,6 @@ char *string_to_hex(const unsigned char *str, size_t size); int copy_file(char *source_file, char *target_file); int get_connection_interface(); char *get_time(time_t t_time); -bool is_obj_excluded(char *object_name); - -#ifndef FREE -#define FREE(x) \ - do { \ - if (x) { \ - free(x); \ - x = NULL; \ - } \ - } while (0) -#endif - -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - - -#define CWMP_STRNCPY(DST, SRC, SIZE) \ - do { \ - strncpy(DST, SRC, SIZE - 1); \ - DST[SIZE - 1] = '\0'; \ - } while (0) +bool is_obj_excluded(const char *object_name); #endif diff --git a/inc/cwmp_kernel.h b/inc/cwmp_kernel.h deleted file mode 100644 index ff38909..0000000 --- a/inc/cwmp_kernel.h +++ /dev/null @@ -1,8 +0,0 @@ - -#define NETLINK_MAX_PAYLOAD 1024 -#define NETLINK_USER 31 -#define NETLINK_CWMP_ID "NETLINK_CWMP_ID" -#define NETLINK_END_DATA "END_DATA" -#define NETLINK_NULL "NULL" - -int kernel_api_cwmp_value_change_call(int count, ...); diff --git a/inc/log.h b/inc/log.h index 01797aa..5cb7ba5 100644 --- a/inc/log.h +++ b/inc/log.h @@ -43,54 +43,7 @@ int log_set_severity_idx(char *value); #define DEFAULT_LOG_FILE_NAME "/var/log/icwmpd.log" #define DEFAULT_LOG_SEVERITY INFO -#ifdef WITH_CWMP_DEBUG -#ifndef CWMP_LOG #define CWMP_LOG(SEV, MESSAGE, args...) puts_log(SEV, MESSAGE, ##args); #define CWMP_LOG_XML_MSG puts_log_xmlmsg -#endif -#else -#define CWMP_LOG(SEV, MESSAGE, args...) -#define CWMP_LOG_XML_MSG(X, Y, Z) -#endif - -#ifdef WITH_DEV_DEBUG -#ifndef DD -#define DD(SEV, MESSAGE, args...) puts_log(SEV, MESSAGE, ##args); -#endif -#else -#define DD(SEV, MESSAGE, args...) -#endif - -#ifndef DETECT_CRASH -#define DETECT_CRASH(MESSAGE, args...) \ - { \ - const char *A[] = { MESSAGE }; \ - printf("DETECT_CRASH: %s %s %d\n", __FUNCTION__, __FILE__, __LINE__); \ - fflush(stdout); \ - if (sizeof(A) > 0) \ - printf(*A, ##args); \ - sleep(1); \ - } -#endif - -#ifndef TRACE -#define TRACE_TYPE 0 -static inline void trace_empty_func() {} -#if TRACE_TYPE == 2 -#define TRACE(MESSAGE, args...) \ - do { \ - const char *A[] = { MESSAGE }; \ - fprintf(stderr, "TRACE: %s %s %d ", __FUNCTION__, __FILE__, __LINE__); \ - if (sizeof(A) > 0) \ - fprintf(stderr, *A, ##args); \ - fprintf(stderr, "\n"); \ - fflush(stderr); \ - } while (0) -#elif TRACE_TYPE == 1 -#define TRACE(MESSAGE, ...) printf(MESSAGE, ##__VA_ARGS__) -#else -#define TRACE(MESSAGE, ...) trace_empty_func() -#endif -#endif #endif /* _LOG_H_ */ diff --git a/inc/ubus.h b/inc/ubus.h index f9b395f..67d5aa6 100644 --- a/inc/ubus.h +++ b/inc/ubus.h @@ -9,15 +9,12 @@ * * Copyright (C) 2012 Luka Perkov */ + #ifndef _FREECWMP_UBUS_H__ #define _FREECWMP_UBUS_H__ -#include -/* -#include -#include -#include "common.h" -*/ +#include + #include "common.h" #define ARRAY_MAX 8 diff --git a/ubus.c b/ubus.c index c414178..f851d5c 100755 --- a/ubus.c +++ b/ubus.c @@ -51,7 +51,7 @@ static int cwmp_handle_command(struct ubus_context *ctx, struct ubus_object *obj struct blob_attr *tb[__COMMAND_MAX]; struct blob_buf blob_command; - blobmsg_parse(command_policy, ARRAYSIZEOF(command_policy), tb, blob_data(msg), blob_len(msg)); + blobmsg_parse(command_policy, ARRAY_SIZE(command_policy), tb, blob_data(msg), blob_len(msg)); if (!tb[COMMAND_NAME]) return UBUS_STATUS_INVALID_ARGUMENT; @@ -213,7 +213,7 @@ static int cwmp_handle_inform(struct ubus_context *ctx, struct ubus_object *obj memset(&blob_inform, 0, sizeof(struct blob_buf)); blob_buf_init(&blob_inform, 0); - blobmsg_parse(inform_policy, ARRAYSIZEOF(inform_policy), tb, blob_data(msg), blob_len(msg)); + blobmsg_parse(inform_policy, ARRAY_SIZE(inform_policy), tb, blob_data(msg), blob_len(msg)); if (tb[INFORM_GET_RPC_METHODS]) { grm = blobmsg_data(tb[INFORM_GET_RPC_METHODS]); @@ -273,7 +273,7 @@ static struct ubus_object main_object = { .name = "tr069", .type = &main_object_type, .methods = freecwmp_methods, - .n_methods = ARRAYSIZEOF(freecwmp_methods), + .n_methods = ARRAY_SIZE(freecwmp_methods), }; int cwmp_ubus_init(struct cwmp *cwmp)