pub struct Tsig<Octs, Name> { /* private fields */ }
Implementations§
source§impl<O, N> Tsig<O, N>
impl<O, N> Tsig<O, N>
sourcepub fn new(
algorithm: N,
time_signed: Time48,
fudge: u16,
mac: O,
original_id: u16,
error: TsigRcode,
other: O,
) -> Result<Self, LongRecordData>
pub fn new( algorithm: N, time_signed: Time48, fudge: u16, mac: O, original_id: u16, error: TsigRcode, other: O, ) -> Result<Self, LongRecordData>
Creates new TSIG record data from its components.
See the access methods for an explanation of these components. The function will return an error if the wire format length of the record would exceed 65,535 octets.
sourcepub unsafe fn new_unchecked(
algorithm: N,
time_signed: Time48,
fudge: u16,
mac: O,
original_id: u16,
error: TsigRcode,
other: O,
) -> Self
pub unsafe fn new_unchecked( algorithm: N, time_signed: Time48, fudge: u16, mac: O, original_id: u16, error: TsigRcode, other: O, ) -> Self
Creates new TSIG record data without checking.
§Safety
The caller needs to ensure that the wire format length of the created record will not exceed 65,535 octets.
sourcepub fn algorithm(&self) -> &N
pub fn algorithm(&self) -> &N
Returns a reference to the algorithm name.
TSIG encodes the algorithm used for keys and signatures as a domain name. It does, however, only use the format. No structure is used at all.
sourcepub fn time_signed(&self) -> Time48
pub fn time_signed(&self) -> Time48
Returns the Unix time when the signature is created.
Despite its type, this is actually a 48 bit number. The upper 16 bits will never be set.
sourcepub fn fudge(&self) -> u16
pub fn fudge(&self) -> u16
Return the number of seconds of offset from signing time permitted.
When a signature is checked, the local system time needs to be within
this many seconds from time_signed
to be accepted.
sourcepub fn original_id(&self) -> u16
pub fn original_id(&self) -> u16
Returns the original message ID.
Since the message ID is part of the signature generation but may be changed for a forwarded message, it is included in the TSIG record.
sourcepub fn other(&self) -> &O
pub fn other(&self) -> &O
Returns a reference to the other bytes.
This field is only used for BADTIME errors to return the server time. Otherwise it is empty.
sourcepub fn other_time(&self) -> Option<Time48>
pub fn other_time(&self) -> Option<Time48>
Returns the other bytes as the server time.
If the other bytes field is exactly 6 bytes long, this methods
returns it as a u64
representation of the Unix time contained.
sourcepub fn is_valid_at(&self, now: Time48) -> bool
pub fn is_valid_at(&self, now: Time48) -> bool
Returns whether the record is valid at the given time.
The method checks whether the given time is within fudge
seconds of the time_signed
.
sourcepub fn is_valid_now(&self) -> bool
pub fn is_valid_now(&self) -> bool
Returns whether the record is valid right now.
The method checks whether the current system time is within fudge
seconds of the time_signed
.
Trait Implementations§
source§impl<O, OO, N, NN> CanonicalOrd<Tsig<OO, NN>> for Tsig<O, N>
impl<O, OO, N, NN> CanonicalOrd<Tsig<OO, NN>> for Tsig<O, N>
source§fn canonical_cmp(&self, other: &Tsig<OO, NN>) -> Ordering
fn canonical_cmp(&self, other: &Tsig<OO, NN>) -> Ordering
self
and other
.source§fn canonical_lt(&self, other: &Rhs) -> bool
fn canonical_lt(&self, other: &Rhs) -> bool
self
is canonically less than other
.source§fn canonical_le(&self, other: &Rhs) -> bool
fn canonical_le(&self, other: &Rhs) -> bool
self
is canonically less than or equal to other
.source§fn canonical_gt(&self, other: &Rhs) -> bool
fn canonical_gt(&self, other: &Rhs) -> bool
self
is canonically greater than other
.source§fn canonical_ge(&self, other: &Rhs) -> bool
fn canonical_ge(&self, other: &Rhs) -> bool
self
is canonically greater than or equal to other
.source§impl<Octs: AsRef<[u8]>, Name: ToDname> ComposeRecordData for Tsig<Octs, Name>
impl<Octs: AsRef<[u8]>, Name: ToDname> ComposeRecordData for Tsig<Octs, Name>
source§fn rdlen(&self, _compress: bool) -> Option<u16>
fn rdlen(&self, _compress: bool) -> Option<u16>
source§fn compose_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
target
.source§fn compose_canonical_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_canonical_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
target
.source§fn compose_len_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_len_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
source§fn compose_canonical_len_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_canonical_len_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
source§impl<Octs, TOcts, Name, TName> FlattenInto<Tsig<TOcts, TName>> for Tsig<Octs, Name>
impl<Octs, TOcts, Name, TName> FlattenInto<Tsig<TOcts, TName>> for Tsig<Octs, Name>
type AppendError = <TOcts as OctetsFrom<Octs>>::Error
fn try_flatten_into(self) -> Result<Tsig<TOcts, TName>, Self::AppendError>
source§impl<O, N> From<Tsig<O, N>> for AllRecordData<O, N>
impl<O, N> From<Tsig<O, N>> for AllRecordData<O, N>
source§impl<Octs, SrcOctets, Name, SrcName> OctetsFrom<Tsig<SrcOctets, SrcName>> for Tsig<Octs, Name>
impl<Octs, SrcOctets, Name, SrcName> OctetsFrom<Tsig<SrcOctets, SrcName>> for Tsig<Octs, Name>
type Error = <Octs as OctetsFrom<SrcOctets>>::Error
source§impl<O: AsRef<[u8]>, N: ToDname> Ord for Tsig<O, N>
impl<O: AsRef<[u8]>, N: ToDname> Ord for Tsig<O, N>
source§impl<'a, Octs: Octets + ?Sized> ParseRecordData<'a, Octs> for Tsig<Octs::Range<'a>, ParsedDname<Octs::Range<'a>>>
impl<'a, Octs: Octets + ?Sized> ParseRecordData<'a, Octs> for Tsig<Octs::Range<'a>, ParsedDname<Octs::Range<'a>>>
source§fn parse_rdata(
rtype: Rtype,
parser: &mut Parser<'a, Octs>,
) -> Result<Option<Self>, ParseError>
fn parse_rdata( rtype: Rtype, parser: &mut Parser<'a, Octs>, ) -> Result<Option<Self>, ParseError>
source§impl<O, OO, N, NN> PartialEq<Tsig<OO, NN>> for Tsig<O, N>
impl<O, OO, N, NN> PartialEq<Tsig<OO, NN>> for Tsig<O, N>
source§impl<O, OO, N, NN> PartialOrd<Tsig<OO, NN>> for Tsig<O, N>
impl<O, OO, N, NN> PartialOrd<Tsig<OO, NN>> for Tsig<O, N>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more