-
Oussama Ghorbel authoredOussama Ghorbel authored
dsl_cpe_status_parser.c 232.71 KiB
/******************************************************************************
Copyright (c) 2019 Intel Corporation
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
*******************************************************************************/
#if defined(INCLUDE_DSL_JSON_PARSING) && (INCLUDE_DSL_JSON_PARSING == 1)
#include "json.h"
#include "dsl_cpe_status_parser.h"
#include "drv_dsl_cpe_api_ioctl.h"
#include "drv_dsl_cpe_api.h"
#include "dsl_cpe_interface.h"
#if defined (INCLUDE_DSL_CPE_API_VRX)
#include "dsl_cpe_bnd_vrx.h"
#endif
#undef DSL_CCA_DBG_BLOCK
#define DSL_CCA_DBG_BLOCK DSL_CCA_DBG_APP
#define STATUS_FILE_PATH_TMP "/tmp/status/dsl.tmp"
#define STATUS_FILE_PATH "/tmp/status/dsl"
#define SECTION_PATH_LENGTH 256
/*
Definitions for status file parameters' update types,
to be used in different update functions in order to
determine which parameters need to be updated
*/
typedef enum
{
DSL_UPDATE_TYPE_NONE, /* only for nodes with JSON object type */
DSL_UPDATE_TYPE_INIT, /* parameters to be updated during initialization */
DSL_UPDATE_TYPE_POLL, /* parameters to be updated on polling timer */
DSL_UPDATE_TYPE_EVENT /* parameters to be updated by events only */
} DSL_CPE_StatusNodeUpdateType_t;
/*
JSON Status File node definition
*/
typedef struct
{
DSL_CPE_StatusNodeIdx_t eNodeIdx;
DSL_char_t jsonPath[SECTION_PATH_LENGTH];
json_type jsonType;
DSL_CPE_StatusNodeUpdateType_t eUpdateType;
} DSL_CPE_JsonStatusNode_t;
/*
JSON Status File entire structure definition (metadata),
to be used for creation of physical Status File as well as
for further operations
*/
static const DSL_CPE_JsonStatusNode_t jsonStatusNodes[] =
{
{ DSL_ROOT, "dsl",
json_type_object, DSL_UPDATE_TYPE_NONE },
/* common section */
{ DSL_LINE_ENTRIES, "dsl.line_number_of_entries",
json_type_int, DSL_UPDATE_TYPE_INIT },
{ DSL_CHANNEL_ENTRIES, "dsl.channel_number_of_entries",
json_type_int, DSL_UPDATE_TYPE_INIT },
{ DSL_BND_GROUP_ENTRIES, "dsl.bonding_group_number_of_entries",
json_type_int, DSL_UPDATE_TYPE_INIT },
{ DSL_API_VERSION, "dsl.api_version",