1use core::fmt;
4use zeroize::{Zeroize, ZeroizeOnDrop};
5
6#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
9#[repr(C)]
10pub struct Luid {
11 pub low_part: u32,
12 pub high_part: i32,
13}
14
15impl Luid {
16 pub const ZERO: Luid = Luid {
17 low_part: 0,
18 high_part: 0,
19 };
20
21 #[inline]
22 pub const fn new(low_part: u32, high_part: i32) -> Self {
23 Self {
24 low_part,
25 high_part,
26 }
27 }
28
29 #[inline]
30 pub const fn as_u64(self) -> u64 {
31 ((self.high_part as u32 as u64) << 32) | (self.low_part as u64)
32 }
33}
34
35impl fmt::Display for Luid {
36 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
37 write!(f, "0x{:016x}", self.as_u64())
38 }
39}
40
41#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
44pub struct AuthPackageId(pub u32);
45
46#[derive(Clone, Default, Zeroize, ZeroizeOnDrop)]
56pub struct KrbCred {
57 pub encoded: Vec<u8>,
58}
59
60impl KrbCred {
61 #[inline]
62 pub fn new(encoded: Vec<u8>) -> Self {
63 Self { encoded }
64 }
65
66 #[inline]
67 pub fn as_bytes(&self) -> &[u8] {
68 &self.encoded
69 }
70
71 #[inline]
72 pub fn is_empty(&self) -> bool {
73 self.encoded.is_empty()
74 }
75
76 #[inline]
77 pub fn len(&self) -> usize {
78 self.encoded.len()
79 }
80}
81
82impl fmt::Debug for KrbCred {
83 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
84 f.debug_struct("KrbCred")
85 .field("len", &self.encoded.len())
86 .finish_non_exhaustive()
87 }
88}
89
90#[derive(Clone, Debug, Default)]
92pub struct TicketCacheInfo {
93 pub server_name: String,
94 pub realm_name: String,
95 pub start_time_ft: i64,
96 pub end_time_ft: i64,
97 pub renew_time_ft: i64,
98 pub encryption_type: i32,
99 pub ticket_flags: u32,
100}