msg_auth_status/iprev.rs
1//! Method iprev Result
2
3/// Parsed iprev=..
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct IpRevResult<'hdr> {
6 /// iprev resultcode
7 pub code: IpRevResultCode,
8 /// reason = ..
9 pub reason: Option<&'hdr str>,
10 /// iprev policy.iprev = ..
11 pub policy_iprev: Option<&'hdr str>,
12 /// unparsed
13 pub raw: Option<&'hdr str>,
14}
15
16impl<'hdr> IpRevResult<'hdr> {
17 pub(crate) fn set_policy(&mut self, prop: &ptypes::IpRevPolicy<'hdr>) -> bool {
18 match prop {
19 ptypes::IpRevPolicy::IpRev(val) => self.policy_iprev = Some(val),
20 ptypes::IpRevPolicy::Unknown(_key, _val) => {} // ignore RFC unknowns
21 }
22 true
23 }
24 pub(crate) fn set_smtp(&mut self, _prop: &ptypes::IpRevSmtp<'hdr>) -> bool {
25 // ignore these rfc breaking things
26 false
27 }
28}
29
30/// IpRev Result Codes - s.2.7.3
31#[derive(Clone, Debug, Default, PartialEq)]
32pub enum IpRevResultCode {
33 /// Result code not seen
34 #[default]
35 Unknown,
36 /// The DNS evaluation succeeded, i.e., the "reverse" and
37 /// "forward" lookup results were returned and were in agreement.
38 Pass,
39 /// The DNS evaluation failed. In particular, the "reverse" and
40 /// "forward" lookups each produced results, but they were not in
41 /// agreement, or the "forward" query completed but produced no
42 /// result, e.g., a DNS RCODE of 3, commonly known as NXDOMAIN, or an
43 /// RCODE of 0 (NOERROR) in a reply containing no answers, was
44 /// returned.
45 Fail,
46 /// The DNS evaluation could not be completed due to some
47 /// error that is likely transient in nature, such as a temporary DNS
48 /// error, e.g., a DNS RCODE of 2, commonly known as SERVFAIL, or
49 /// other error condition resulted. A later attempt may produce a
50 /// final result.
51 TempError,
52 /// The DNS evaluation could not be completed because no PTR
53 /// data are published for the connecting IP address, e.g., a DNS
54 /// RCODE of 3, commonly known as NXDOMAIN, or an RCODE of 0 (NOERROR)
55 /// in a reply containing no answers, was returned. This prevented
56 /// completion of the evaluation. A later attempt is unlikely to
57 /// produce a final result.
58 PermError,
59}
60
61pub mod ptypes;
62pub use ptypes::IpRevProperty;