pub struct LvsModel {
pub version: u64,
pub start_id: u64,
pub named_pattern_cnt: u64,
pub nodes: Vec<LvsNode>,
pub tag_symbols: Vec<LvsTagSymbol>,
/* private fields */
}Expand description
A parsed LVS trust schema.
See the module docs for which LVS features are supported. Construct via
LvsModel::decode (typically via
crate::TrustSchema::from_lvs_binary).
Fields§
§version: u64§start_id: u64§named_pattern_cnt: u64§nodes: Vec<LvsNode>§tag_symbols: Vec<LvsTagSymbol>Implementations§
Source§impl LvsModel
impl LvsModel
Sourcepub fn decode(input: &[u8]) -> Result<Self, LvsError>
pub fn decode(input: &[u8]) -> Result<Self, LvsError>
Parse an LVS binary model from its TLV wire bytes.
The top-level LvsModel has no outer TLV wrapper — the input
buffer is a sequence of top-level TLV fields (Version, StartId,
NamedPatternCnt, *Node, *TagSymbol).
Sourcepub fn uses_user_functions(&self) -> bool
pub fn uses_user_functions(&self) -> bool
Returns true if the loaded schema references any user functions.
Because v0.1.0 does not dispatch user functions, any rule that depends on one will never match a packet. Callers that need bit-exact parity with python-ndn’s evaluation can inspect this flag and refuse to use the schema.
Sourcepub fn check(&self, data_name: &Name, key_name: &Name) -> bool
pub fn check(&self, data_name: &Name, key_name: &Name) -> bool
Check whether data_name is allowed to be signed by key_name
under this LVS schema. Returns true if:
data_namereaches some nodeDin the graph, andDhas at least oneSignConstraint, andkey_namereaches a node whose id is listed inD.sign_constraints.