ableos/kernel/src/ipc/buffer.rs

38 lines
944 B
Rust
Raw Normal View History

2023-05-15 02:19:34 -05:00
use crossbeam_queue::{ArrayQueue, SegQueue};
use super::message::Message;
enum BufferTypes {
Unbound(SegQueue<Message>),
Bound(ArrayQueue<Message>),
}
pub struct IpcBuffer {
protocol: Protocol,
buffer: BufferTypes,
}
impl IpcBuffer {
pub fn validate_messages(&mut self) -> Result<(), IpcError> {
Ok(())
}
}
pub enum IpcError {
InvalidMessage,
}
/// TODO: define this, possibly as the binary form of the IDL
/// DEPEND: This depends on an IDL
pub struct Protocol {
// TODO: add in settings
// like `invalid_message_handler` with some options similar to
// `Deny` Drops the message
// `Allow` Allows invalid messages (This disables validators IPC side and relies on programs to handle invalid messages)
// `CustomFunct` a callback
// and `report_invalid_messages_to_sender`
// `True`
// `False`
// settings: PSettings,
}