use crate::v1::definitions::AttributeType;
use crate::v1::definitions::DomainOfInterpretation;
use crate::v1::definitions::ExchangeType;
use crate::v1::definitions::NotifyMessageType;
use crate::v1::definitions::PayloadType;
#[derive(Debug, Clone)]
pub struct Packet {
pub header: Header,
pub notification_payloads: Vec<NotificationPayload>,
pub security_associations: Vec<SecurityAssociationPayload>,
pub vendor_ids: Vec<VendorIDPayload>,
pub transforms: Vec<TransformPayload>,
pub proposals: Vec<ProposalPayload>,
}
#[derive(Debug, Clone)]
pub struct Header {
pub initiator_cookie: u64,
pub responder_cookie: u64,
pub next_payload: PayloadType,
pub major_version: u8,
pub minor_version: u8,
pub exchange_mode: ExchangeType,
pub flags: u8,
pub message_id: u32,
pub length: u32,
}
#[derive(Debug, Clone)]
pub struct NotificationPayload {
pub next_payload: PayloadType,
pub length: u16,
pub protocol_id: u8,
pub notify_message_type: NotifyMessageType,
pub notification: Vec<u8>,
}
#[derive(Debug, Clone)]
pub struct SecurityAssociationPayload {
pub next_payload: PayloadType,
pub length: u16,
pub domain_of_interpretation: DomainOfInterpretation,
pub situation: Vec<u8>,
pub proposal_payload: Vec<ProposalPayload>,
}
#[derive(Debug, Clone)]
pub struct ProposalPayload {
pub next_payload: PayloadType,
pub length: u16,
pub proposal_no: u8,
pub protocol_id: u8,
pub spi_size: u8,
pub no_of_transforms: u8,
pub spi: Vec<u8>,
pub transforms: Vec<TransformPayload>,
}
#[derive(Debug, Clone)]
pub struct TransformPayload {
pub next_payload: PayloadType,
pub length: u16,
pub transform_no: u8,
pub transform_id: u8,
pub sa_attributes: Vec<DataAttribute>,
}
#[derive(Debug, Clone)]
pub struct VendorIDPayload {
pub next_payload: PayloadType,
pub length: u16,
pub vendor_id: Vec<u8>,
}
#[derive(Debug, Clone)]
pub enum DataAttribute {
DataAttributeShort(DataAttributeShort),
DataAttributeLong(DataAttributeLong),
}
#[derive(Debug, Clone)]
pub struct DataAttributeShort {
pub attribute_type: AttributeType,
pub attribute_value: u16,
}
#[derive(Debug, Clone)]
pub struct DataAttributeLong {
pub attribute_type: AttributeType,
pub attribute_value: Vec<u8>,
}