Struct radius_rust::client::mutex_client::Client [−][src]
Represents RADIUS client instance
The key difference between this client and the one from radius_rust::client::client::Client
is that this client's socket poll is wrapped into Mutex (there are cases when we cannot use mut
reference to Client and socket_poll is the only thing which blocks the Client usage in such
cases)
Implementations
impl Client
[src]
pub fn initialise_client(
auth_port: u16,
acct_port: u16,
coa_port: u16,
dictionary: Dictionary,
server: String,
secret: String,
retries: u16,
timeout: u16
) -> Result<Client, RadiusError>
[src]
auth_port: u16,
acct_port: u16,
coa_port: u16,
dictionary: Dictionary,
server: String,
secret: String,
retries: u16,
timeout: u16
) -> Result<Client, RadiusError>
Initialise RADIUS client instance
pub fn create_packet(
&self,
code: TypeCode,
attributes: Vec<RadiusAttribute>
) -> RadiusPacket
[src]
&self,
code: TypeCode,
attributes: Vec<RadiusAttribute>
) -> RadiusPacket
Creates RADIUS packet with any TypeCode
pub fn create_auth_packet(
&self,
attributes: Vec<RadiusAttribute>
) -> RadiusPacket
[src]
&self,
attributes: Vec<RadiusAttribute>
) -> RadiusPacket
Creates RADIUS Access Request packet
pub fn create_acct_packet(
&self,
attributes: Vec<RadiusAttribute>
) -> RadiusPacket
[src]
&self,
attributes: Vec<RadiusAttribute>
) -> RadiusPacket
Creates RADIUS Accounting Request packet
pub fn create_coa_packet(
&self,
attributes: Vec<RadiusAttribute>
) -> RadiusPacket
[src]
&self,
attributes: Vec<RadiusAttribute>
) -> RadiusPacket
Creates RADIUS CoA Request packet
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
Examples
use radius_rust::client::mutex_client::Client; use radius_rust::protocol::dictionary::Dictionary; use radius_rust::protocol::radius_packet::TypeCode; fn main() { let dictionary = Dictionary::from_file("./dict_examples/integration_dict").unwrap(); let client = Client::initialise_client(1812, 1813, 3799, dictionary, String::from("127.0.0.1"), String::from("secret"), 1, 2).unwrap(); client.create_attribute_by_name("User-Name", String::from("testing").into_bytes()); }
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
Examples
use radius_rust::client::mutex_client::Client; use radius_rust::protocol::dictionary::Dictionary; use radius_rust::protocol::radius_packet::TypeCode; fn main() { let dictionary = Dictionary::from_file("./dict_examples/integration_dict").unwrap(); let client = Client::initialise_client(1812, 1813, 3799, dictionary, String::from("127.0.0.1"), String::from("secret"), 1, 2).unwrap(); client.create_attribute_by_id(1, String::from("testing").into_bytes()); }
pub fn generate_message_hash(&self, packet: &mut RadiusPacket) -> Vec<u8>
[src]
Generates HMAC-MD5 hash for Message-Authenticator attribute
Note: this function assumes that RadiusAttribute Message-Authenticator already exists in RadiusPacket
pub fn get_radius_attr_original_string_value(
&self,
attribute: &RadiusAttribute
) -> Result<String, RadiusError>
[src]
&self,
attribute: &RadiusAttribute
) -> Result<String, RadiusError>
Gets the original value as a String if the RadiusAttribute respresents dictionary attribute that has type: string, ipaddr, ipv6addr or ipv6prefix
pub fn get_radius_attr_original_integer_value(
&self,
attribute: &RadiusAttribute
) -> Result<u64, RadiusError>
[src]
&self,
attribute: &RadiusAttribute
) -> Result<u64, RadiusError>
Gets the original value as a String if the RadiusAttribute respresents dictionary attribute that has type:integer or date
pub fn initialise_packet_from_bytes(
&self,
reply: &[u8]
) -> Result<RadiusPacket, RadiusError>
[src]
&self,
reply: &[u8]
) -> Result<RadiusPacket, RadiusError>
Initialises RadiusPacket from bytes
pub fn send_packet(&self, packet: &mut RadiusPacket) -> Result<(), RadiusError>
[src]
Sends packet to RADIUS server but does not return a response
pub fn send_and_receive_packet(
&self,
packet: &mut RadiusPacket
) -> Result<Vec<u8>, RadiusError>
[src]
&self,
packet: &mut RadiusPacket
) -> Result<Vec<u8>, RadiusError>
Sends packet to RADIUS server and returns a response
pub fn verify_reply(
&self,
request: &RadiusPacket,
reply: &[u8]
) -> Result<(), RadiusError>
[src]
&self,
request: &RadiusPacket,
reply: &[u8]
) -> Result<(), RadiusError>
Verifies that reply packet's ID and authenticator are a match
pub fn verify_message_authenticator(
&self,
packet: &[u8]
) -> Result<(), RadiusError>
[src]
&self,
packet: &[u8]
) -> Result<(), RadiusError>
Verifies that reply packet's Message-Authenticator attribute is valid
pub fn verify_packet_attributes(&self, packet: &[u8]) -> Result<(), RadiusError>
[src]
Verifies that reply packet's attributes have valid values
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Client
[src]
impl Send for Client
[src]
impl Sync for Client
[src]
impl Unpin for Client
[src]
impl UnwindSafe for Client
[src]
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>,