ndn-lite
ndn-trust-schema-pattern.h
Go to the documentation of this file.
1 
2 #ifndef NDN_TRUST_SCHEMA_PATTERN_H
3 #define NDN_TRUST_SCHEMA_PATTERN_H
4 
5 #include <stdint.h>
6 #include <stddef.h>
7 #include <string.h>
8 
10 
11 #include "../../ndn-constants.h"
12 #include "../../ndn-error-code.h"
13 
18 typedef struct ndn_trust_schema_pattern {
26  uint32_t components_size;
36 
43 static inline int
45 {
46  if (pattern->components_size + 1 <= NDN_NAME_COMPONENTS_SIZE) {
47  memcpy(pattern->components + pattern->components_size, component, sizeof(ndn_trust_schema_pattern_component_t));
48  pattern->components_size++;
49 
50  return 0;
51  }
52  else
53  return NDN_OVERSIZE;
54 }
55 
64 int
65 ndn_trust_schema_pattern_from_string(ndn_trust_schema_pattern_t* pattern, const char* string, uint32_t size);
66 
73 int
75 
76 
83 int
84 index_of_pattern_component_type(const ndn_trust_schema_pattern_t* pattern, uint32_t type);
85 
92 int
94 
95 #endif // NDN_TRUST_SCHEMA_PATTERN_H
The structure to represent an NDN Trust Schema Pattern Component.
Definition: ndn-trust-schema-pattern-component.h:21
struct ndn_trust_schema_pattern ndn_trust_schema_pattern_t
The structure to represent the NDN Trust Schema pattern.
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.
Definition: ndn-trust-schema-pattern.c:8
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.
Definition: ndn-trust-schema-pattern.h:44
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.
Definition: ndn-trust-schema-pattern.c:158
uint8_t num_subpattern_indexes
The number of subpattern indexes in the schema pattern.
Definition: ndn-trust-schema-pattern.h:34
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.
Definition: ndn-trust-schema-pattern.c:141
#define NDN_NAME_COMPONENTS_SIZE
Definition: ndn-constants.h:17
The structure to represent the NDN Trust Schema pattern.
Definition: ndn-trust-schema-pattern.h:18
uint8_t num_subpattern_captures
The number of subpattern captures in the schema pattern.
Definition: ndn-trust-schema-pattern.h:30
#define NDN_TRUST_SCHEMA_PATTERN_COMPONENTS_SIZE
Definition: ndn-constants.h:130
#define NDN_OVERSIZE
The object given is larger than expected.
Definition: ndn-error-code.h:33
uint32_t components_size
The number of schema components.
Definition: ndn-trust-schema-pattern.h:26
ndn_trust_schema_pattern_component_t components[NDN_TRUST_SCHEMA_PATTERN_COMPONENTS_SIZE]
The array of schema components contained in this schema pattern (not including T and L)
Definition: ndn-trust-schema-pattern.h:22
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.
Definition: ndn-trust-schema-pattern.c:173