RDK Documentation (Open Sourced RDK Components)

Description

Functions

static int isNodeArrayType (cJSON *const item)
 This function takes a cJSON node as argument and verifies whether the supplied argument is an node array. More...
 
static int saveToFile (cJSON *arrayNode, const char *filename)
 This function writes the parsed JSON information to a file. More...
 
static cJSON * getArrayNode (cJSON *node)
 This function traverses through the cJSON node list and returns the next node that is an Array. More...
 
static void processSSHWhiteList (cJSON *sshFeature)
 This function processes IP and MAC lists configured in the feature list. More...
 
void main (int argc, char **argv)
 This function parses dcm JSON information and save it to a file. More...
 

Function Documentation

◆ isNodeArrayType()

static int isNodeArrayType ( cJSON *const  item)
static

This function takes a cJSON node as argument and verifies whether the supplied argument is an node array.

Parameters
[in]itemitem to know its type.
Return values
Returns1 if the supplied item is an array kind otherwise returns 0.

Definition at line 73 of file dcmjsonparser.c.

◆ saveToFile()

static int saveToFile ( cJSON *  arrayNode,
const char *  filename 
)
static

This function writes the parsed JSON information to a file.

Parameters
[in]arrayNodeJSON array.
[in]filenameName of the file where parsed data will be stored.

@ret returns status(0/1).

Definition at line 91 of file dcmjsonparser.c.

◆ getArrayNode()

static cJSON* getArrayNode ( cJSON *  node)
static

This function traverses through the cJSON node list and returns the next node that is an Array.

Parameters
[in]nodeJSON response from SSH whitelist.

@ret returns JSON array.

Definition at line 125 of file dcmjsonparser.c.

◆ processSSHWhiteList()

static void processSSHWhiteList ( cJSON *  sshFeature)
static

This function processes IP and MAC lists configured in the feature list.

-Example: { "name":"SNMPWhitelist", "effectiveImmediate":false, "enable":true, "configData":{}, "listType":"IPv4", "listSize":5, "SNMP IP4 WL":["178.62.43.255","128.82.34.17","192.168.1.80","192.168.1.1/24","10.0.0.32/6"] },

Parameters
[in]sshFeatureContains JSON values like List type and list size

Definition at line 167 of file dcmjsonparser.c.

◆ main()

void main ( int  argc,
char **  argv 
)

This function parses dcm JSON information and save it to a file.

JSON will contain these information Feature control information like effectiveImmediate,configData.

  • Example:In this main function "featureControl" JSON is created with features in KeyValue format.

    FeatureControl { "features": [ { "name": "<feature name>", "effectiveImmediate": true, "enable": true, "configData": { <Parameter to configure> } "listType": "B8:27:EB:50:C1:CF", "listSize": 1, "RDK_RPI": [ "B8:27:EB:50:C1:FC" ] } ] }

Definition at line 204 of file dcmjsonparser.c.