Struct radius_rust::server::server::Server[][src]

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

Represents RADIUS Generic Server instance

Implementations

impl Server[src]

pub fn with_dictionary(dictionary: Dictionary) -> Server[src]

Initialise Server instance with dictionary (other fields would be set to default values)

To be called first when creating RADIUS Server instance

pub fn set_server(self, server: String) -> Server[src]

Required

Sets hostname to which server would bind

pub fn set_secret(self, secret: String) -> Server[src]

Required

Sets secret which is used to encode/decode RADIUS packet

pub fn set_allowed_hosts(self, allowed_hosts: Vec<String>) -> Server[src]

Required

Sets allowed hosts, from where Server would be allowed to accept RADIUS requests

pub fn set_port(self, msg_type: RadiusMsgType, port: u16) -> Server[src]

Required/Optional

Sets remote port, that responsible for specific RADIUS Message Type

pub fn set_retries(self, retries: u16) -> Server[src]

Optional

Sets socket retries, otherwise you would have a default value of 1

pub fn set_timeout(self, timeout: u16) -> Server[src]

Optional

Sets socket timeout, otherwise you would have a default value of 2

pub fn port(&self, code: &TypeCode) -> Option<u16>[src]

Returns port of RADIUS server, that receives given type of RADIUS message/packet

pub fn server(&self) -> &str[src]

Returns hostname/FQDN of RADIUS Server

pub fn retries(&self) -> u16[src]

Returns retries

pub fn timeout(&self) -> u16[src]

Returns timeout

pub fn allowed_hosts(&self) -> &[String][src]

Returns allowed hosts list

pub fn create_attribute_by_name(
    &self,
    attribute_name: &str,
    value: Vec<u8>
) -> Result<RadiusAttribute, RadiusError>
[src]

Creates RADIUS packet attribute by name, that is defined in dictionary file

For example, see Client

pub fn create_attribute_by_id(
    &self,
    attribute_id: u8,
    value: Vec<u8>
) -> Result<RadiusAttribute, RadiusError>
[src]

Creates RADIUS packet attribute by id, that is defined in dictionary file

For example, see Client

pub fn create_reply_packet(
    &self,
    reply_code: TypeCode,
    attributes: Vec<RadiusAttribute>,
    request: &mut [u8]
) -> RadiusPacket
[src]

Creates reply RADIUS packet

Similar to Client’s create_packet(), however also sets correct packet ID and authenticator

pub fn verify_request(&self, request: &[u8]) -> Result<(), RadiusError>[src]

Verifies incoming RADIUS packet:

Server would try to build RadiusPacket from raw bytes, and if it succeeds then packet is valid, otherwise would return RadiusError

pub fn verify_request_attributes(
    &self,
    request: &[u8]
) -> Result<(), RadiusError>
[src]

Verifies RadiusAttributes’s values of incoming RADIUS packet:

Server would try to build RadiusPacket from raw bytes, and then it would try to restore RadiusAttribute original value from bytes, based on the attribute data type, see SupportedAttributeTypes

pub fn initialise_packet_from_bytes(
    &self,
    request: &[u8]
) -> Result<RadiusPacket, RadiusError>
[src]

Initialises RadiusPacket from bytes

Unlike verify_request, on success this function would return RadiusPacket

pub fn host_allowed(&self, remote_host: &SocketAddr) -> bool[src]

Checks if host from where Server received RADIUS request is allowed host, meaning RADIUS Server can process such request

Trait Implementations

impl Debug for Server[src]

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl RefUnwindSafe for Server

impl Send for Server

impl Sync for Server

impl Unpin for Server

impl UnwindSafe for Server

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, 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