ndn-lite
Data Structures | Functions
ndn-rule-storage.h File Reference
#include "trust-schema/ndn-trust-schema-rule.h"
#include "../ndn-constants.h"

Go to the source code of this file.

Data Structures

struct  ndn_rule_name_t
 
struct  ndn_rule_storage_t
 

Functions

ndn_rule_storage_tget_ndn_rule_storage_instance (void)
 There should be only one ndn_rule_storage_t. More...
 
void ndn_rule_storage_init (void)
 Init the rule storage singleton. More...
 
const ndn_trust_schema_rule_tndn_rule_storage_get_rule (const char *rule_name)
 Get a rule from the rule storage. More...
 
int ndn_rule_storage_add_rule (const char *rule_name, const ndn_trust_schema_rule_t *rule)
 Add a rule to the rule storage. More...
 
int ndn_rule_storage_remove_rule (const char *rule_name)
 Remove a rule from the rule storage. More...
 

Function Documentation

◆ get_ndn_rule_storage_instance()

ndn_rule_storage_t* get_ndn_rule_storage_instance ( void  )

There should be only one ndn_rule_storage_t.

Use this function to get the singleton instance. If the instance has not been initialized, call ndn_rule_storage_init first.

◆ ndn_rule_storage_add_rule()

int ndn_rule_storage_add_rule ( const char *  rule_name,
const ndn_trust_schema_rule_t rule 
)

Add a rule to the rule storage.

Will do a deep copy of the rule passed in.

Parameters
rule_name.Input. The string to associate with the rule added. The storage will not allow the adding of a rule with the same name as one already in storage.
rule.Input. The rule that will be deep copied into the rule storage.
Returns
0 if the rule is successfully added.

◆ ndn_rule_storage_get_rule()

const ndn_trust_schema_rule_t* ndn_rule_storage_get_rule ( const char *  rule_name)

Get a rule from the rule storage.

Parameters
rule_name.Input. The string representing the name of the rule to get from storage.
Returns
A pointer to the rule if it is found in storage. NULL otherwise.

◆ ndn_rule_storage_init()

void ndn_rule_storage_init ( void  )

Init the rule storage singleton.

This function will clear the rule storage.

◆ ndn_rule_storage_remove_rule()

int ndn_rule_storage_remove_rule ( const char *  rule_name)

Remove a rule from the rule storage.

Parameters
rule_name.Input. The name of the rule to remove.
Returns
0 if the rule corresponding to rule_name is successfully removed.