use crate::source::Node;
use structured_asn1::memory::{Memory, OwnedVec, Work};
use structured_pkix::{Certificate, crl::CertificateList, ocsp::BasicResponse};
#[derive(Debug, Clone, Copy)]
pub struct OtherRevocation<'document> {
pub property: Node,
pub kind: structured_asn1::Oid<'document>,
pub enclosure: structured_asn1::Element<'document>,
pub values: crate::source::Value<'document>,
}
pub struct Located<T> {
pub property: Node,
pub enclosure: Node,
pub ordinal: usize,
pub value: T,
}
pub struct Values<'document, W: Work = Memory> {
pub(crate) certificates: OwnedVec<Located<Certificate<'document>>, W>,
pub(crate) crls: OwnedVec<Located<CertificateList<'document>>, W>,
pub(crate) ocsp: OwnedVec<Located<BasicResponse<'document>>, W>,
pub(crate) other: OwnedVec<OtherRevocation<'document>, W>,
}
impl<'d, W: Work> Values<'d, W> {
pub(crate) fn new(work: &W) -> Self {
Self {
certificates: work.vector(),
crls: work.vector(),
ocsp: work.vector(),
other: work.vector(),
}
}
pub(crate) fn into_owned(self) -> Values<'d> {
Values {
certificates: self.certificates.into_owned(),
crls: self.crls.into_owned(),
ocsp: self.ocsp.into_owned(),
other: self.other.into_owned(),
}
}
pub fn certificates(&self) -> &[Located<Certificate<'d>>] {
&self.certificates
}
pub fn crls(&self) -> &[Located<CertificateList<'d>>] {
&self.crls
}
pub fn ocsp_responses(&self) -> &[Located<BasicResponse<'d>>] {
&self.ocsp
}
pub fn other_revocation(&self) -> &[OtherRevocation<'d>] {
&self.other
}
}