Struct RadiusAttribute

Source
pub struct RadiusAttribute { /* private fields */ }
Expand description

Represents an attribute, which would be sent to RADIUS Server/client as a part of RadiusPacket

Implementations§

Source§

impl RadiusAttribute

Source

pub fn create_by_name( dictionary: &Dictionary, attribute_name: &str, value: Vec<u8>, ) -> Option<RadiusAttribute>

Creates RadiusAttribute with given name

Returns None, if ATTRIBUTE with such name is not found in Dictionary

Source

pub fn create_by_id( dictionary: &Dictionary, attribute_code: u8, value: Vec<u8>, ) -> Option<RadiusAttribute>

Creates RadiusAttribute with given id

Returns None, if ATTRIBUTE with such id is not found in Dictionary

Source

pub fn override_value(&mut self, new_value: Vec<u8>)

Overriddes RadiusAttribute value

Mainly used when building Message-Authenticator

Source

pub fn id(&self) -> u8

Returns RadiusAttribute id

Source

pub fn value(&self) -> &[u8]

Returns RadiusAttribute value

Source

pub fn name(&self) -> &str

Returns RadiusAttribute name

Source

pub fn verify_original_value( &self, allowed_type: &Option<SupportedAttributeTypes>, ) -> Result<(), RadiusError>

Verifies RadiusAttribute value, based on the ATTRIBUTE code type

Source

pub fn original_string_value( &self, allowed_type: &Option<SupportedAttributeTypes>, ) -> Result<String, RadiusError>

Returns RadiusAttribute value, if the attribute is dictionary’s ATTRIBUTE with code type string, ipaddr, ipv4addr, ipv4prefix, ipv6addr or ipv6prefix

Source

pub fn original_integer_value( &self, allowed_type: &Option<SupportedAttributeTypes>, ) -> Result<u32, RadiusError>

Returns RadiusAttribute value, if the attribute is dictionary’s ATTRIBUTE with code type integer or date

Source

pub fn original_integer64_value( &self, allowed_type: &Option<SupportedAttributeTypes>, ) -> Result<u64, RadiusError>

Returns RadiusAttribute value, if the attribute is dictionary’s ATTRIBUTE with code type integer64

Trait Implementations§

Source§

impl Debug for RadiusAttribute

Source§

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

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

impl PartialEq for RadiusAttribute

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RadiusAttribute

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V