Skip to content

mapping

Enums

Functions


firma_core::mapping::ManagedMappingRuleError

Section titled “firma_core::mapping::ManagedMappingRuleError”

Enum

A canonical snapshot rule violates the shared mapping language.

Variants:

  • Host
  • Method
  • Path
  • ActionClass

Traits: Error, Eq, Copy

Trait Implementations:

  • PartialEq
    • fn eq(self: &Self, other: &Self) -> bool
  • Clone
    • fn clone(self: &Self) -> Self
  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
  • Display
    • fn fmt(self: &Self, __formatter: & mut ::core::fmt::Formatter) -> ::core::fmt::Result

Function

Matches value against a pattern where * accepts any character sequence.

Wildcards cross host labels and path segments. No other character has special meaning.

fn glob_match(pattern: &str, value: &str) -> bool

firma_core::mapping::glob_patterns_overlap

Section titled “firma_core::mapping::glob_patterns_overlap”

Function

Returns whether two * glob patterns accept at least one common string.

fn glob_patterns_overlap(left: &str, right: &str) -> bool

Function

Computes OpenFirma’s additive mapping-rule specificity score.

fn mapping_specificity(has_method: bool, host_pattern: &str, path_pattern: Option<&str>) -> usize

firma_core::mapping::normalize_mapping_host

Section titled “firma_core::mapping::normalize_mapping_host”

Function

Normalizes a mapping host pattern into OpenFirma’s canonical matching form.

Normalization trims whitespace, lowercases ASCII host text, removes DNS trailing dots, removes ports 80 and 443, and preserves other numeric ports.

fn normalize_mapping_host(host: &str) -> String

firma_core::mapping::split_mapping_authority

Section titled “firma_core::mapping::split_mapping_authority”

Function

Splits a mapping authority into its canonical name and optional port.

This is the single authority splitter shared by host normalization, dispatch-host normalization, and the managed mapping domain types, so the three can never disagree on what a spelling means. The input is trimmed; DNS names are lowercased with trailing dots removed; only an all-digit trailing segment after the last : (or after ]: for bracketed IPv6) counts as a port. Anything else (for example example.com:https or an unbracketed IPv6 literal) is returned whole as the name with no port.

Intentionally not built on std::net parsers: this layer splits and preserves spelling over a pattern language that includes * wildcards, which no std parser accepts, while validation lives downstream in the domain types. Parsing first would either reject wildcards or re-render canonically, both of which change the observable normalization contract pinned by the mapping compatibility corpus.

fn split_mapping_authority(authority: &str) -> (String, Option<String>)

firma_core::mapping::validate_authored_mapping_host

Section titled “firma_core::mapping::validate_authored_mapping_host”

Function

Check authored authority spelling before normalization can erase intent.

Rejects malformed authorities, empty host names, and implicit promotion to a catch-all. Canonical snapshot validation additionally checks DNS and ports.

fn validate_authored_mapping_host(host: &str) -> Result<(), String>

firma_core::mapping::validate_managed_rule

Section titled “firma_core::mapping::validate_managed_rule”

Function

Validate the canonical rule language shared by snapshot producers and consumers.

Rejects non-canonical hosts, unsupported methods, empty/oversized/NUL paths, and action classes outside the built-in registry.

fn validate_managed_rule(method: Option<&str>, host: &str, path: Option<&str>, action_class: &str) -> Result<(), ManagedMappingRuleError>