radius_rust/client/mod.rs
1//! Module contains RADIUS Client implementation and related traits definitions
2
3
4use crate::protocol::radius_packet::RadiusPacket;
5use crate::protocol::error::RadiusError;
6
7
8#[cfg(all(feature = "async-radius"))]
9use async_trait::async_trait;
10#[cfg(all(feature = "async-radius"))]
11#[async_trait]
12/// This trait is to be implemented by user, if they are planning to resolve AUTH, ACCT or CoA
13/// RADIUS requests for Async RADIUS Client
14pub trait AsyncClientTrait {
15 /// Responsible for sending packets off to RADIUS Server ignoring any response received
16 async fn send_packet(&self, _packet: &mut RadiusPacket) -> Result<(), RadiusError> {
17 todo!()
18 }
19 /// Responsible for sending packets off to RADIUS Server returning response
20 async fn send_and_receive_packet(&self, _packet: &mut RadiusPacket) -> Result<Vec<u8>, RadiusError> {
21 todo!()
22 }
23}
24
25/// This trait is to be implemented by user, if they are planning to resolve AUTH, ACCT or CoA
26/// RADIUS requests for Async RADIUS Client
27pub trait SyncClientTrait {
28 /// Responsible for sending packets off to RADIUS Server ignoring any response received
29 fn send_packet(&mut self, _packet: &mut RadiusPacket) -> Result<(), RadiusError> {
30 todo!()
31 }
32 /// Responsible for sending packets off to RADIUS Server returning response
33 fn send_and_receive_packet(&mut self, _packet: &mut RadiusPacket) -> Result<Vec<u8>, RadiusError> {
34 todo!()
35 }
36}
37
38pub mod client;