content frames

This commit is contained in:
nora 2022-02-10 02:50:53 +01:00
parent 970fdbb9b5
commit 4cf7d7558b
7 changed files with 101 additions and 10 deletions

View file

@ -1,6 +1,8 @@
use crate::error::{ConException, ProtocolError, Result};
use amqp_core::methods::FieldValue;
use anyhow::Context;
use bytes::Bytes;
use smallvec::SmallVec;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tracing::trace;
@ -31,6 +33,21 @@ pub enum FrameType {
Heartbeat = 8,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ContentHeader {
pub class_id: u16,
pub weight: u16,
pub body_size: u64,
pub property_flags: SmallVec<[u16; 1]>,
pub property_fields: Vec<FieldValue>,
}
impl ContentHeader {
pub fn new() -> Self {
todo!()
}
}
pub async fn write_frame<W>(frame: &Frame, mut w: W) -> Result<()>
where
W: AsyncWriteExt + Unpin,