[][src]Struct rpki::resources::AsResources

pub struct AsResources(_);

The AS Resources of an RPKI Certificate.

This type contains the ‘Autonomous System Identifier Delegation Extension’ as defined in [RFC 3779] in the restricted form specified in [RFC 6487].

This type contains the resources as represented in an RPKI certificate’s AS resources extension. This extension provides two options: there can be an actual set of AS numbers associated with the certificate – this is the AsResources::Blocks variant –, or the AS resources of the issuer can be inherited – the AsResources::Inherit variant.

Methods

impl AsResources[src]

pub fn inherit() -> Self[src]

Creates a new AsResources with a ResourcesChoice::Inherit

pub fn blocks(blocks: AsBlocks) -> Self[src]

Creates a new AsResources for the given blocks.

pub fn is_inherited(&self) -> bool[src]

Returns whether the resources are of the inherited variant.

pub fn as_blocks(&self) -> Option<&AsBlocks>[src]

Returns a reference to the blocks if there are any.

pub fn to_blocks(&self) -> Result<AsBlocks, ValidationError>[src]

Converts the resources into blocks or returns an error.

impl AsResources[src]

pub fn take_from<S: Source>(cons: &mut Constructed<S>) -> Result<Self, S::Err>[src]

Takes the AS resources from the beginning of an encoded value.

The ASN.1 specification for the ASIdentifiers types parsed here is given in section 3.2.3 of RFC 3779 as follows:

ASIdentifiers      ::= SEQUENCE {
    asnum              [0] EXPLICIT AsIdentifierChoice OPTIONAL,
    rdi                [1] EXPLICIT AsIdentifierChoice OPTIONAL }

AsIdentifierChoice ::= CHOICE {
    inherit            NULL,
    asIdsOrRanges      SEQUENCE OF ASIdOrRange }

ASIdOrRange        ::= CHOICE {
    id                 ASId,
    range              ASRange }

ASRange            ::= SEQUENCE {
    min                ASId,
    max                ASId }

ASId               ::= INTEGER

Section 4.8.11 of RFC 6487 limits the ASIdentifiers to the asnum choice. If asIdsOrRanges is chosen, it must include a non-empty set of AS numbers.

This function implements these limitations. It maps the id choice of AsIdOrRange to a range covering one number in order to keep things simpler.

pub fn encode(self) -> impl Values[src]

pub fn encode_ref<'a>(&'a self) -> impl Values + 'a[src]

Trait Implementations

impl Clone for AsResources[src]

impl Eq for AsResources[src]

impl PartialEq<AsResources> for AsResources[src]

impl Display for AsResources[src]

impl Debug for AsResources[src]

impl FromStr for AsResources[src]

type Err = FromStrError

The associated error which can be returned from parsing.

impl Serialize for AsResources[src]

impl<'de> Deserialize<'de> for AsResources[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]