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