| //! Stub Shodan mailbox driver capsule. | |
| use kernel::{AppId, AppSlice, Callback, Driver, Grant, ReturnCode, Shared}; | |
| #[derive(Default)] | |
| pub struct AppData { | |
| pub buffer: Option<AppSlice<Shared, u8>>, | |
| } | |
| pub struct Mailbox { | |
| pub app_data_grant: Grant<AppData>, | |
| } | |
| impl Driver for Mailbox { | |
| fn subscribe(&self, _: usize, _: Option<Callback>, _: AppId) -> ReturnCode { | |
| ReturnCode::EINVAL | |
| } | |
| fn command(&self, _minor_num: usize, _r2: usize, _r3: usize, _app_id: AppId) -> ReturnCode { | |
| return ReturnCode::EINVAL; | |
| } | |
| fn allow(&self, app_id: AppId, _: usize, slice: Option<AppSlice<Shared, u8>>) -> ReturnCode { | |
| let _ = self.app_data_grant.enter(app_id, |app_data, _| { | |
| app_data.buffer = slice; | |
| }); | |
| return ReturnCode::SUCCESS; | |
| } | |
| } |