Skip to content

Commit 6f32085

Browse files
authored
Add support for setting network buffers. (#31)
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
1 parent 8d1dd06 commit 6f32085

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/traits.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ pub trait StreamContext: Context {
136136
hostcalls::get_buffer(BufferType::DownstreamData, start, max_size).unwrap()
137137
}
138138

139+
fn set_downstream_data(&self, start: usize, size: usize, value: &[u8]) {
140+
hostcalls::set_buffer(BufferType::DownstreamData, start, size, value).unwrap()
141+
}
142+
139143
fn on_downstream_close(&mut self, _peer_type: PeerType) {}
140144

141145
fn on_upstream_data(&mut self, _data_size: usize, _end_of_stream: bool) -> Action {
@@ -146,6 +150,10 @@ pub trait StreamContext: Context {
146150
hostcalls::get_buffer(BufferType::UpstreamData, start, max_size).unwrap()
147151
}
148152

153+
fn set_upstream_data(&self, start: usize, size: usize, value: &[u8]) {
154+
hostcalls::set_buffer(BufferType::UpstreamData, start, size, value).unwrap()
155+
}
156+
149157
fn on_upstream_close(&mut self, _peer_type: PeerType) {}
150158

151159
fn on_log(&mut self) {}

0 commit comments

Comments
 (0)