mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
refactor net firewall to use .forward() method
This commit is contained in:
parent
617e075c08
commit
969b4ec868
1 changed files with 7 additions and 30 deletions
|
|
@ -1639,40 +1639,17 @@ fn xmain() -> ! {
|
||||||
buffer.replace(ser).expect("couldn't return config");
|
buffer.replace(ser).expect("couldn't return config");
|
||||||
}
|
}
|
||||||
Some(Opcode::SubscribeWifiStats) => {
|
Some(Opcode::SubscribeWifiStats) => {
|
||||||
let buffer =
|
msg.forward(
|
||||||
unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) };
|
|
||||||
// have to transform it through the local memory space because you can't re-lend pages
|
|
||||||
let sub = buffer.to_original::<WifiStateSubscription, _>().unwrap();
|
|
||||||
let buf = Buffer::into_buf(sub).expect("couldn't convert to memory message");
|
|
||||||
buf.send(
|
|
||||||
cm_cid,
|
cm_cid,
|
||||||
connection_manager::ConnectionManagerOpcode::SubscribeWifiStats
|
connection_manager::ConnectionManagerOpcode::SubscribeWifiStats as _)
|
||||||
.to_u32()
|
|
||||||
.unwrap(),
|
|
||||||
)
|
|
||||||
.expect("couldn't forward subscription request");
|
.expect("couldn't forward subscription request");
|
||||||
}
|
}
|
||||||
Some(Opcode::UnsubWifiStats) => msg_blocking_scalar_unpack!(msg, s0, s1, s2, s3, {
|
Some(Opcode::UnsubWifiStats) => {
|
||||||
// now do something with the unsubscription
|
msg.forward(
|
||||||
let response = xous::send_message(
|
|
||||||
cm_cid,
|
cm_cid,
|
||||||
Message::new_blocking_scalar(
|
connection_manager::ConnectionManagerOpcode::UnsubWifiStats as _)
|
||||||
connection_manager::ConnectionManagerOpcode::UnsubWifiStats
|
.expect("couldn't forward unsub request");
|
||||||
.to_usize()
|
},
|
||||||
.unwrap(),
|
|
||||||
s0,
|
|
||||||
s1,
|
|
||||||
s2,
|
|
||||||
s3,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.expect("couldn't send unsub message");
|
|
||||||
if let xous::Result::Scalar1(val) = response {
|
|
||||||
xous::return_scalar(msg.sender, val).unwrap();
|
|
||||||
} else {
|
|
||||||
xous::return_scalar(msg.sender, 0).unwrap();
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
Some(Opcode::FetchSsidList) => {
|
Some(Opcode::FetchSsidList) => {
|
||||||
let mut buffer = unsafe {
|
let mut buffer = unsafe {
|
||||||
Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap())
|
Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue