Struct radius_rust::protocol::radius_packet::RadiusPacket
source · [−]pub struct RadiusPacket { /* private fields */ }Expand description
Represents RADIUS packet
Implementations
sourceimpl RadiusPacket
impl RadiusPacket
sourcepub fn initialise_packet(code: TypeCode) -> RadiusPacket
pub fn initialise_packet(code: TypeCode) -> RadiusPacket
Initialises RADIUS packet with random ID and authenticator
sourcepub fn initialise_packet_from_bytes(
dictionary: &Dictionary,
bytes: &[u8]
) -> Result<RadiusPacket, RadiusError>
pub fn initialise_packet_from_bytes(
dictionary: &Dictionary,
bytes: &[u8]
) -> Result<RadiusPacket, RadiusError>
Initialises RADIUS packet from raw bytes
sourcepub fn set_attributes(&mut self, attributes: Vec<RadiusAttribute>)
pub fn set_attributes(&mut self, attributes: Vec<RadiusAttribute>)
Sets attrbiutes
sourcepub fn override_id(&mut self, new_id: u8)
pub fn override_id(&mut self, new_id: u8)
Overrides RadiusPacket id
sourcepub fn override_authenticator(&mut self, new_authenticator: Vec<u8>)
pub fn override_authenticator(&mut self, new_authenticator: Vec<u8>)
Overrides RadiusPacket authenticator
sourcepub fn override_message_authenticator(
&mut self,
new_message_authenticator: Vec<u8>
) -> Result<(), RadiusError>
pub fn override_message_authenticator(
&mut self,
new_message_authenticator: Vec<u8>
) -> Result<(), RadiusError>
Overrides RadiusPacket Message-Authenticator
Note: would fail if RadiusPacket has no Message-Authenticator attribute defined
sourcepub fn generate_message_authenticator(
&mut self,
secret: &str
) -> Result<(), RadiusError>
pub fn generate_message_authenticator(
&mut self,
secret: &str
) -> Result<(), RadiusError>
Generates HMAC-MD5 hash for Message-Authenticator attribute
Note 1: this function assumes that RadiusAttribute Message-Authenticator already exists in RadiusPacket Note 2: Message-Authenticator in RadiusPacket would be overwritten when this function is called
sourcepub fn message_authenticator(&self) -> Result<&[u8], RadiusError>
pub fn message_authenticator(&self) -> Result<&[u8], RadiusError>
Returns Message-Authenticator value, if exists in RadiusPacket
sourcepub fn authenticator(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn authenticator(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Returns RadiusPacket authenticator
sourcepub fn attributes(&self) -> &[RadiusAttribute]
pub fn attributes(&self) -> &[RadiusAttribute]
Returns RadiusPacket attributes
sourcepub fn attribute_by_name(&self, name: &str) -> Option<&RadiusAttribute>
pub fn attribute_by_name(&self, name: &str) -> Option<&RadiusAttribute>
Returns RadiusAttribute with given name
sourcepub fn attribute_by_id(&self, id: u8) -> Option<&RadiusAttribute>
pub fn attribute_by_id(&self, id: u8) -> Option<&RadiusAttribute>
Returns RadiusAttribute with given id
Trait Implementations
sourceimpl Debug for RadiusPacket
impl Debug for RadiusPacket
sourceimpl PartialEq<RadiusPacket> for RadiusPacket
impl PartialEq<RadiusPacket> for RadiusPacket
sourcefn eq(&self, other: &RadiusPacket) -> bool
fn eq(&self, other: &RadiusPacket) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &RadiusPacket) -> bool
fn ne(&self, other: &RadiusPacket) -> bool
This method tests for !=.
impl StructuralPartialEq for RadiusPacket
Auto Trait Implementations
impl RefUnwindSafe for RadiusPacket
impl Send for RadiusPacket
impl Sync for RadiusPacket
impl Unpin for RadiusPacket
impl UnwindSafe for RadiusPacket
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more