Skip to main content

AffiliationRules

Struct AffiliationRules 

Source
#[non_exhaustive]
pub struct AffiliationRules { pub friendly_ids: Vec<String>, pub friendly: char, pub friendly_requires_authenticated: bool, pub spoofed: Option<char>, pub suspicious: Option<char>, pub authenticated: Option<char>, }
Expand description

How a tracked transmitter’s affiliation (the second letter of the CoT type, a-?-...) is chosen from its trust verdict and from a list of your own aircraft.

The order matters and is fixed:

  1. A spoofed verdict gives spoofed (default 's', suspect), and a suspicious verdict gives suspicious (default: no change). This comes before the friendly list on purpose: a spoofer that copies the serial number of one of your drones must not turn into a friendly marker.
  2. A Basic ID or Operator ID in friendly_ids gives friendly (default 'f'), unless the verdict is spoofed or suspicious. With friendly_requires_authenticated only an authenticated (DRIP signed) transmitter qualifies.
  3. An authenticated verdict gives authenticated (default: no change).
  4. Otherwise the default passed in (Options::affiliation).
use uas_cot::rid::AffiliationRules;

let rules = AffiliationRules::default()
    .friendly_id("1596F35074529ABCDEFG")
    .suspicious_as('s')
    .spoofed_as('h');
assert_eq!(rules.friendly_ids, ["1596F35074529ABCDEFG"]);

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§friendly_ids: Vec<String>

Basic IDs (serial numbers, registrations, session IDs) and Operator IDs of your own aircraft. Matched exactly, after trimming spaces.

§friendly: char

Affiliation for a match in friendly_ids (default 'f').

§friendly_requires_authenticated: bool

Only an authenticated transmitter counts as friendly (default false: most drones do not sign their broadcasts yet).

§spoofed: Option<char>

Affiliation for a spoofed verdict (default Some('s'), suspect).

§suspicious: Option<char>

Affiliation for a suspicious verdict (default None: unchanged).

§authenticated: Option<char>

Affiliation for an authenticated verdict that is not on the friendly list (default None: unchanged).

Implementations§

Source§

impl AffiliationRules

Source

pub fn friendly_id(self, id: impl Into<String>) -> Self

Adds one of your aircraft (Basic ID or Operator ID).

Source

pub fn friendly_as(self, affiliation: char) -> Self

Sets friendly.

Source

pub fn require_authenticated_friendly(self, yes: bool) -> Self

Source

pub fn spoofed_as(self, affiliation: char) -> Self

Sets spoofed.

Source

pub fn suspicious_as(self, affiliation: char) -> Self

Sets suspicious.

Source

pub fn authenticated_as(self, affiliation: char) -> Self

Source

pub fn no_verdict_rules(self) -> Self

Clears every verdict rule, so a verdict never changes the affiliation; only the friendly list applies (still not to a spoofed or suspicious transmitter).

Source

pub fn affiliation(&self, uas: &TrackedUas, default: char) -> char

The affiliation for uas, or default when no rule applies.

Trait Implementations§

Source§

impl Clone for AffiliationRules

Source§

fn clone(&self) -> Self

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 AffiliationRules

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for AffiliationRules

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for AffiliationRules

Source§

impl PartialEq for AffiliationRules

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AffiliationRules

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, 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.