mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-18 17:26:19 +00:00
H3: move codecs to a new proto module
This commit is contained in:
+4
-2
@@ -8,8 +8,10 @@ use tokio::runtime::current_thread::Runtime;
|
||||
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use failure::{format_err, Error};
|
||||
use quinn_h3::frame::{HeadersFrame, HttpFrame, SettingsFrame};
|
||||
use quinn_h3::StreamType;
|
||||
use quinn_h3::proto::{
|
||||
frame::{HeadersFrame, HttpFrame, SettingsFrame},
|
||||
StreamType,
|
||||
};
|
||||
use slog::{o, warn, Drain, Logger};
|
||||
|
||||
type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
+1
-28
@@ -9,32 +9,5 @@ extern crate proptest;
|
||||
#[macro_use]
|
||||
extern crate assert_matches;
|
||||
|
||||
extern crate quinn_proto;
|
||||
pub mod frame;
|
||||
pub mod proto;
|
||||
pub mod qpack;
|
||||
|
||||
use bytes::BufMut;
|
||||
use quinn_proto::coding::BufMutExt;
|
||||
|
||||
pub struct StreamType(u64);
|
||||
|
||||
macro_rules! stream_types {
|
||||
{$($name:ident = $val:expr,)*} => {
|
||||
impl StreamType {
|
||||
$(pub const $name: StreamType = StreamType($val);)*
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stream_types! {
|
||||
CONTROL = 0x00,
|
||||
PUSH = 0x01,
|
||||
ENCODER = 0x02,
|
||||
DECODER = 0x03,
|
||||
}
|
||||
|
||||
impl StreamType {
|
||||
pub fn encode<W: BufMut>(&self, buf: &mut W) {
|
||||
buf.write_var(self.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,6 +426,8 @@ mod tests {
|
||||
HttpFrame::Settings(SettingsFrame {
|
||||
num_placeholders: 0xfada,
|
||||
max_header_list_size: 0xfada,
|
||||
qpack_max_table_capacity: 0,
|
||||
qpack_blocked_streams: 0,
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -453,6 +455,8 @@ mod tests {
|
||||
Ok(HttpFrame::Settings(SettingsFrame {
|
||||
num_placeholders: 16,
|
||||
max_header_list_size: 0xFADA,
|
||||
qpack_max_table_capacity: 0,
|
||||
qpack_blocked_streams: 0,
|
||||
}))
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
use bytes::BufMut;
|
||||
use quinn_proto::coding::BufMutExt;
|
||||
|
||||
pub mod frame;
|
||||
|
||||
pub struct StreamType(u64);
|
||||
|
||||
macro_rules! stream_types {
|
||||
{$($name:ident = $val:expr,)*} => {
|
||||
impl StreamType {
|
||||
$(pub const $name: StreamType = StreamType($val);)*
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stream_types! {
|
||||
CONTROL = 0x00,
|
||||
PUSH = 0x01,
|
||||
ENCODER = 0x02,
|
||||
DECODER = 0x03,
|
||||
}
|
||||
|
||||
impl StreamType {
|
||||
pub fn encode<W: BufMut>(&self, buf: &mut W) {
|
||||
buf.write_var(self.0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user