ndn-lite
Data Structures | Typedefs | Functions
ndn-trust-schema-pattern.h File Reference
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include "ndn-trust-schema-pattern-component.h"
#include "../../ndn-constants.h"
#include "../../ndn-error-code.h"

Go to the source code of this file.

Data Structures

struct  ndn_trust_schema_pattern
 The structure to represent the NDN Trust Schema pattern. More...
 

Typedefs

typedef struct ndn_trust_schema_pattern ndn_trust_schema_pattern_t
 The structure to represent the NDN Trust Schema pattern. More...
 

Functions

static int ndn_trust_schema_pattern_append_component (ndn_trust_schema_pattern_t *pattern, const ndn_trust_schema_pattern_component_t *component)
 Appends a component to the end of a pattern. More...
 
int ndn_trust_schema_pattern_from_string (ndn_trust_schema_pattern_t *pattern, const char *string, uint32_t size)
 Init an NDN Trust Schema pattern from a string. More...
 
int ndn_trust_schema_pattern_copy (const ndn_trust_schema_pattern_t *lhs, ndn_trust_schema_pattern_t *rhs)
 Copy the lhs pattern to the rhs pattern. More...
 
int index_of_pattern_component_type (const ndn_trust_schema_pattern_t *pattern, uint32_t type)
 Find the first index in a trust schema pattern of a particular type. More...
 
int last_index_of_pattern_component_type (const ndn_trust_schema_pattern_t *pattern, uint32_t type)
 Find the last index in a trust schema pattern of a particular type. More...
 

Typedef Documentation

◆ ndn_trust_schema_pattern_t

The structure to represent the NDN Trust Schema pattern.

This structure is memory expensive so please be careful when using it.

Function Documentation

◆ index_of_pattern_component_type()

int index_of_pattern_component_type ( const ndn_trust_schema_pattern_t pattern,
uint32_t  type 
)

Find the first index in a trust schema pattern of a particular type.

Parameters
pattern.Input. The NDN Trust Schema pattern to be parsed.
type.Input. The pattern component type to search for.
Returns
Index of first pattern component of given type if successfully found, -1 otherwise.

◆ last_index_of_pattern_component_type()

int last_index_of_pattern_component_type ( const ndn_trust_schema_pattern_t pattern,
uint32_t  type 
)

Find the last index in a trust schema pattern of a particular type.

Parameters
pattern.Input. The NDN Trust Schema pattern to be parsed.
type.Input. The pattern component type to search for.
Returns
Index of last pattern component of given type if successfully found, -1 otherwise.

◆ ndn_trust_schema_pattern_append_component()

static int ndn_trust_schema_pattern_append_component ( ndn_trust_schema_pattern_t pattern,
const ndn_trust_schema_pattern_component_t component 
)
inlinestatic

Appends a component to the end of a pattern.

This function will do memory copy.

Parameters
name.Output. The pattern to append to.
component.Input. The name component to append with.
Returns
0 if there is no error.

◆ ndn_trust_schema_pattern_copy()

int ndn_trust_schema_pattern_copy ( const ndn_trust_schema_pattern_t lhs,
ndn_trust_schema_pattern_t rhs 
)

Copy the lhs pattern to the rhs pattern.

Parameters
lhs.Input. The pattern to be copied.
rhs.Output. The pattern that will be copied to.
Returns
0 if there is no error.

◆ ndn_trust_schema_pattern_from_string()

int ndn_trust_schema_pattern_from_string ( ndn_trust_schema_pattern_t pattern,
const char *  string,
uint32_t  size 
)

Init an NDN Trust Schema pattern from a string.

This function will do memory copy and only support regular string; not support URI currently.

Parameters
pattern.Output. The NDN Trust Schema pattern to be inited.
string.Input. The string from which the NDN Trust Schema pattern is inited.
size.Input. Size of the input string.
Returns
0 if there is no error.