1
0
Fork 0
forked from koniifer/ableos
ableos-framebuffer/kernel/src/messaging.rs

66 lines
1.4 KiB
Rust

//! Interprocess communication.
use crate::{kernel_time::Time, proccess::PID};
/// 128 Bytes
pub type Tiny = [u8; 128];
/// 1 KibiByte
pub type Small = [u8; 1024];
/// 65.536 KibiBytes
pub type Medium = [u8; 65536];
/// 1MiB
pub type Large = [u8; 1048576];
/// 16MiB
pub type Huge = [u8; 16777216];
/// An internal message to be held in a process message
pub enum Message {
/// A Tiny message
///
/// The message is 128 bytes long
Tiny(Tiny),
/// A Small message
///
/// The message is 1 KiB long
Small(Small),
/// A Medium message
///
/// The message is 65.536 KiB long
Medium(Medium),
/// A Large message
///
/// The message is 1 MiB long
Large(Large),
/// A Huge message
///
/// The message is 16 MiB long
Huge(Huge),
}
/// A message that can be sent between processes
pub struct ProcessMessage {
/// The sender of the message
pub to_pid: PID,
/// The receiver of the message
pub from_pid: PID,
/// The message
pub message: Message,
/// The time the message was sent
pub sender_time: Time,
/// The time the message was received
pub receiver_time: Time,
}
#[derive(Debug)]
/// An enum of all possible errors that can occur when sending a message
pub enum MessagingError {
/// The message is too large to be sent
MessageTooLarge,
/// The reciever of the message is not valid
ProcessNonExistant,
}