Skip to main content

AccessSecurityConfig

Struct AccessSecurityConfig 

Source
pub struct AccessSecurityConfig {
    pub uag: HashMap<String, Vec<String>>,
    pub hag: HashMap<String, Vec<String>>,
    pub hag_raw: HashMap<String, Vec<String>>,
    pub asg: HashMap<String, AccessSecurityGroup>,
    pub unknown_access: AccessLevel,
}
Expand description

Access Security Configuration parsed from an ACF file.

Fields§

§uag: HashMap<String, Vec<String>>§hag: HashMap<String, Vec<String>>§hag_raw: HashMap<String, Vec<String>>

The HAG members exactly as spelled in the ACF, keyed like hag. hag stores hag_members resolution output (dotted quads under asCheckClientIP), which cannot be re-resolved after a DNS change; Self::with_refreshed_hags re-runs the resolution from these raw spellings (epics-base#863 / UI-107).

§asg: HashMap<String, AccessSecurityGroup>§unknown_access: AccessLevel

Implementations§

Source§

impl AccessSecurityConfig

Source

pub fn with_refreshed_hags(&self) -> Option<Self>

Re-run hag_members — the single resolution owner — over the raw HAG spellings and return the refreshed config when any stored member changed, None when resolution is unchanged.

Only meaningful under asCheckClientIP (the default string mode stores lowercased literals that no DNS change can move); callers gate on as_check_client_ip before paying for resolution. C freezes HAG IPs at ACF load until a manual asInit (epics-base#863; its PR #862 moves upstream toward refresh) — this is the sibling of the CA-side refresh_dns deviation that closed the client half of that issue.

Source

pub fn dump_report(&self) -> String

Render the parsed ACF (UAG/HAG/ASG with their INP* links and RULEs) in C asDumpFP shape, as a String.

This is the single owner of the dump format: the asdbdump iocsh command and the CA gateway’s R3 access-security report both render through here, so the two cannot drift. UAG, HAG, and ASG names are emitted in sorted order so the dump is stable across HashMap iteration order.

The verbose member/client listing of C’s asDumpFP(fp, NULL, NULL, verbose=TRUE) is intentionally not included: this crate models no live AS-member/client registry (see the aspmem iocsh command, which derives membership by scanning records rather than from an asgMemberList). The dump therefore covers the parsed configuration structures only.

Source

pub fn fmt_asg(&self, name: &str, out: &mut String)

Append one ASG’s INP* links and RULEs to out, in C asDumpFP shape. Shared by Self::dump_report and the asprules iocsh command’s per-ASG renderer so the rule format has one owner.

Source

pub fn check_access( &self, asg_name: &str, host: &str, user: &str, ) -> AccessLevel

Check access for a given ASG, hostname, and username.

Convenience that omits the ASL gate (treats every rule as applicable). Equivalent to check_access_asl(..., 0) with rules typically declared at level 0/1. New code should call Self::check_access_asl so a per-record ASL can correctly disable a rule whose level is below the record’s ASL.

Source

pub fn check_access_method( &self, asg_name: &str, host: &str, user: &str, record_asl: u8, method: &str, authority: &str, ) -> AccessLevel

Method/authority-aware access check. Mirrors epics-base PR #563 (METHOD/AUTHORITY) and PR #618 (cert-based ACF). When method and authority are provided, rules with non-empty method/authority lists are gated on a literal match. Rules with empty method/authority ignore those scopes (legacy behaviour preserved).

Source

pub fn compute_for_name( &self, asg_name: &str, host: &str, user: &str, roles: &[String], record_asl: u8, method: &str, authority: &str, inputs: Option<&AsgInputs>, ) -> (AccessLevel, bool)

Method/authority-aware access check that also returns the write-trap mask of the rule that resolved the access level.

Mirrors C asComputePvt (asLibRoutines.c:983-1048): the function tracks trapMask alongside access, and on every rule that raises the access level it copies that rule’s trapMask (asLibRoutines.c:1041-1042). The final pasgclient->trapMask (:1048) is therefore the trap flag of the last rule that set the granted access — exactly the value asTrapWriteWithData (rsrv/camessage.c:799-802) consults to decide whether to invoke put-logging listeners.

Returns (level, rule_was_trap). rule_was_trap is false when access stays NoAccess (no rule matched), when the matching rule carried NOTRAPWRITE, and when it carried no trap option at all. Resolve asg_name (falling back to DEFAULT) and evaluate its rules with the given roles and the ASG’s resolved INP* values. The single entry every CALC-aware caller uses — the CA server and AccessGate::check_with_roles alike.

Source

pub fn check_access_method_trap( &self, asg_name: &str, host: &str, user: &str, record_asl: u8, method: &str, authority: &str, ) -> (AccessLevel, bool)

Source

pub fn resolve_asg_inputs( &self, asg_name: &str, resolve: &dyn Fn(&str) -> Option<f64>, ) -> AsgInputs

Walk asg_name’s declared INP(A..U) links (falling back to DEFAULT, as every other lookup here does) and resolve each with resolve, returning C’s per-ASG input state. This is asCa.c’s job done on demand: the port has no standing CA monitor per link, so the values are read when the rules are evaluated.

An unknown ASG with no DEFAULT yields empty inputs — no links, so no bad bits, and a CALC rule then evaluates against zeros exactly as C does for an ASG that declares none.

Every distinct (record, field) an INP* link in this policy names, across all ASGs — the set a re-evaluation trigger must watch. C builds the same set one CA channel at a time in asCaStart.

Source

pub fn check_access_asl( &self, asg_name: &str, host: &str, user: &str, record_asl: u8, ) -> AccessLevel

Check access taking the per-record ASL into account.

Per epics-base asLibRoutines.c::asCompute: a rule with RULE(N, …) only applies when the record’s ASL ≤ N. The canonical example is RULE(0, READ) RULE(1, WRITE) — every record is readable, but only records with ASL ≥ 1 are writable. Without this gate, a low-ASL record’s protection is silently equivalent to ASL 0.

Trait Implementations§

Source§

impl Clone for AccessSecurityConfig

Source§

fn clone(&self) -> AccessSecurityConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AccessSecurityConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more