Struct radius_rust::protocol::radius_packet::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
impl RadiusAttribute
sourcepub fn create_by_name(
dictionary: &Dictionary,
attribute_name: &str,
value: Vec<u8>
) -> Option<RadiusAttribute>
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
sourcepub fn create_by_id(
dictionary: &Dictionary,
attribute_code: u8,
value: Vec<u8>
) -> Option<RadiusAttribute>
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
sourcepub fn override_value(&mut self, new_value: Vec<u8>)
pub fn override_value(&mut self, new_value: Vec<u8>)
Overriddes RadiusAttribute value
Mainly used when building Message-Authenticator
sourcepub fn verify_original_value(
&self,
allowed_type: &Option<SupportedAttributeTypes>
) -> Result<(), RadiusError>
pub fn verify_original_value( &self, allowed_type: &Option<SupportedAttributeTypes> ) -> Result<(), RadiusError>
Verifies RadiusAttribute value, based on the ATTRIBUTE code type
sourcepub fn original_string_value(
&self,
allowed_type: &Option<SupportedAttributeTypes>
) -> Result<String, RadiusError>
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
sourcepub fn original_integer_value(
&self,
allowed_type: &Option<SupportedAttributeTypes>
) -> Result<u32, RadiusError>
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
sourcepub fn original_integer64_value(
&self,
allowed_type: &Option<SupportedAttributeTypes>
) -> Result<u64, RadiusError>
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
impl Debug for RadiusAttribute
source§impl PartialEq<RadiusAttribute> for RadiusAttribute
impl PartialEq<RadiusAttribute> for RadiusAttribute
source§fn eq(&self, other: &RadiusAttribute) -> bool
fn eq(&self, other: &RadiusAttribute) -> bool
self
and other
values to be equal, and is used
by ==
.