#![allow(non_upper_case_globals)]
use crate::*;
use winapi::um::winnt::*;
use core::fmt::{self, Debug, Formatter};
#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)] pub struct ImpersonationLevel(SECURITY_IMPERSONATION_LEVEL);
impl Debug for ImpersonationLevel {
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
let friendly = match *self {
security::Anonymous => "SecurityAnonymous",
security::Identification => "SecurityIdentification",
security::Impersonation => "SecurityImpersonation",
security::Delegation => "SecurityDelegation",
_ => "Security???",
};
write!(fmt, "{friendly}")
}
}
impl From<ImpersonationLevel> for SECURITY_IMPERSONATION_LEVEL { fn from(il: ImpersonationLevel) -> Self { il.0 } }
pub const Anonymous : ImpersonationLevel = ImpersonationLevel(SecurityAnonymous);
pub const Identification : ImpersonationLevel = ImpersonationLevel(SecurityIdentification);
pub const Impersonation : ImpersonationLevel = ImpersonationLevel(SecurityImpersonation);
pub const Delegation : ImpersonationLevel = ImpersonationLevel(SecurityDelegation);