Struct radius_rust::server::Server [−][src]
Represents RADIUS server instance
Implementations
impl Server
[src]
pub fn initialise_server(
auth_port: u16,
acct_port: u16,
coa_port: u16,
dictionary: Dictionary,
server: String,
secret: String,
retries: u16,
timeout: u16
) -> Result<Server, RadiusError>
[src]
auth_port: u16,
acct_port: u16,
coa_port: u16,
dictionary: Dictionary,
server: String,
secret: String,
retries: u16,
timeout: u16
) -> Result<Server, RadiusError>
Initialises RADIUS server instance
pub fn add_allowed_hosts(&mut self, host_addr: String)
[src]
Adds client host address to allowed hosts list
pub fn get_allowed_hosts(&self) -> &[String]
[src]
Returns allowed hosts list
pub fn add_request_handler(
&mut self,
handler_type: RadiusMsgType,
handler_function: fn(server: &Server, request: &mut [u8]) -> Result<Vec<u8>, RadiusError>
) -> Result<(), RadiusError>
[src]
&mut self,
handler_type: RadiusMsgType,
handler_function: fn(server: &Server, request: &mut [u8]) -> Result<Vec<u8>, RadiusError>
) -> Result<(), RadiusError>
Adds packet handller function to server instance
Note: server can only have 3 handlers, 1 for each Radius message/packet type
For example refer to examples/simple_radius_server.rs
pub fn get_request_handlers(
&self
) -> &HashMap<RadiusMsgType, fn(server: &Server, request: &mut [u8]) -> Result<Vec<u8>, RadiusError>>
[src]
&self
) -> &HashMap<RadiusMsgType, fn(server: &Server, request: &mut [u8]) -> Result<Vec<u8>, RadiusError>>
Returns HashMap with packet handler functions
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 (these function are same)
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 (these function are same)
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 create_packet(), however also sets correct packet ID and authenticator
pub fn run_server(&mut self) -> Result<(), RadiusError>
[src]
Main function, that starts and keeps server running
For example see examples/simple_radius_server.rs
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 validate_request() returns new RadiusPacket (if valid), so user can get data out of it
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Server
[src]
impl Send for Server
[src]
impl Sync for Server
[src]
impl Unpin for Server
[src]
impl UnwindSafe for Server
[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>,