use core::fmt;
use zeroize::{Zeroize, ZeroizeOnDrop};
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
#[repr(C)]
pub struct Luid {
pub low_part: u32,
pub high_part: i32,
}
impl Luid {
pub const ZERO: Luid = Luid {
low_part: 0,
high_part: 0,
};
#[inline]
pub const fn new(low_part: u32, high_part: i32) -> Self {
Self {
low_part,
high_part,
}
}
#[inline]
pub const fn as_u64(self) -> u64 {
((self.high_part as u32 as u64) << 32) | (self.low_part as u64)
}
}
impl fmt::Display for Luid {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "0x{:016x}", self.as_u64())
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct AuthPackageId(pub u32);
#[derive(Clone, Default, Zeroize, ZeroizeOnDrop)]
pub struct KrbCred {
pub encoded: Vec<u8>,
}
impl KrbCred {
#[inline]
pub fn new(encoded: Vec<u8>) -> Self {
Self { encoded }
}
#[inline]
pub fn as_bytes(&self) -> &[u8] {
&self.encoded
}
#[inline]
pub fn is_empty(&self) -> bool {
self.encoded.is_empty()
}
#[inline]
pub fn len(&self) -> usize {
self.encoded.len()
}
}
impl fmt::Debug for KrbCred {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("KrbCred")
.field("len", &self.encoded.len())
.finish_non_exhaustive()
}
}
#[derive(Clone, Debug, Default)]
pub struct TicketCacheInfo {
pub server_name: String,
pub realm_name: String,
pub start_time_ft: i64,
pub end_time_ft: i64,
pub renew_time_ft: i64,
pub encryption_type: i32,
pub ticket_flags: u32,
}