Struct radius_rust::server::server::Server [−][src]
pub struct Server { /* fields omitted */ }
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]
&self,
attribute_name: &str,
value: Vec<u8>
) -> Result<RadiusAttribute, RadiusError>
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]
&self,
attribute_id: u8,
value: Vec<u8>
) -> Result<RadiusAttribute, RadiusError>
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]
&self,
reply_code: TypeCode,
attributes: Vec<RadiusAttribute>,
request: &mut [u8]
) -> RadiusPacket
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]
&self,
request: &[u8]
) -> Result<(), RadiusError>
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]
&self,
request: &[u8]
) -> Result<RadiusPacket, RadiusError>
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
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]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,