Struct radius::core::packet::Packet[][src]

pub struct Packet { /* fields omitted */ }
Expand description

This struct represents a packet of RADIUS for request and response.

Implementations

impl Packet[src]

pub fn new(code: Code, secret: &[u8]) -> Self[src]

Constructor for a Packet.

By default, this constructor makes an instance with a random identifier value. If you’d like to set an arbitrary identifier, please use new_with_identifier() constructor instead or set_identifier() method for created instance.

pub fn new_with_identifier(code: Code, secret: &[u8], identifier: u8) -> Self[src]

Constructor for a Packet with arbitrary identifier value.

If you want to make an instance with a random identifier value, please consider using new().

pub fn get_code(&self) -> Code[src]

pub fn get_identifier(&self) -> u8[src]

pub fn get_secret(&self) -> &Vec<u8>[src]

pub fn get_authenticator(&self) -> &Vec<u8>[src]

pub fn set_identifier(&mut self, identifier: u8)[src]

This sets an identifier value to an instance.

pub fn decode(bs: &[u8], secret: &[u8]) -> Result<Self, PacketError>[src]

This decodes bytes into a Packet.

pub fn make_response_packet(&self, code: Code) -> Self[src]

This method makes a response packet according to self (i.e. request packet).

pub fn encode(&self) -> Result<Vec<u8>, PacketError>[src]

This method encodes the Packet into bytes.

pub fn is_authentic_response(
    response: &[u8],
    request: &[u8],
    secret: &[u8]
) -> bool
[src]

Returns whether the Packet is authentic response or not.

pub fn is_authentic_request(request: &[u8], secret: &[u8]) -> bool[src]

Returns whether the Packet is authentic request or not.

pub fn add(&mut self, avp: AVP)[src]

Add an AVP to the list of AVPs.

pub fn extend(&mut self, avps: Vec<AVP>)[src]

Add AVPs to the list of AVPs.

pub fn delete(&mut self, typ: AVPType)[src]

Delete all of AVPs from the list according to given AVP type.

pub fn lookup(&self, typ: AVPType) -> Option<&AVP>[src]

Returns an AVP that matches at first with the given AVP type. If there are not any matched ones, this returns None.

pub fn lookup_all(&self, typ: AVPType) -> Vec<&AVP>[src]

Returns AVPs that match with the given AVP type.

Trait Implementations

impl Clone for Packet[src]

fn clone(&self) -> Packet[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Packet[src]

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

Formats the value using the given formatter. Read more

impl PartialEq<Packet> for Packet[src]

fn eq(&self, other: &Packet) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Packet) -> bool[src]

This method tests for !=.

impl StructuralPartialEq for Packet[src]

Auto Trait Implementations

impl RefUnwindSafe for Packet

impl Send for Packet

impl Sync for Packet

impl Unpin for Packet

impl UnwindSafe for Packet

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

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

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V