mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
net: add StdTcp calls
These calls have been tested to work to create tcp connections. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
e91705c0ae
commit
89442ff4cc
2 changed files with 1119 additions and 377 deletions
|
|
@ -1,26 +1,28 @@
|
||||||
pub(crate) mod udp;
|
pub(crate) mod udp;
|
||||||
#[allow(unused_imports)] // needed to keep hosted mode quiet, since the Udp implementation is a bodge
|
// needed to keep hosted mode quiet, since the Udp implementation is a bodge
|
||||||
|
#[allow(unused_imports)]
|
||||||
pub(crate) use udp::*;
|
pub(crate) use udp::*;
|
||||||
pub(crate) mod ping;
|
pub(crate) mod ping;
|
||||||
pub(crate) use ping::*;
|
pub(crate) use ping::*;
|
||||||
pub(crate) mod tcp;
|
pub(crate) mod tcp;
|
||||||
#[allow(unused_imports)] // needed to keep hosted mode quiet, since the Tcp implementation is a bodge
|
|
||||||
pub(crate) use tcp::*;
|
|
||||||
pub use ping::NetPingCallback;
|
pub use ping::NetPingCallback;
|
||||||
|
// needed to keep hosted mode quiet, since the Tcp implementation is a bodge
|
||||||
|
#[allow(unused_imports)]
|
||||||
|
pub(crate) use tcp::*;
|
||||||
|
|
||||||
|
use com::SsidRecord;
|
||||||
use rkyv::{Archive, Deserialize, Serialize};
|
use rkyv::{Archive, Deserialize, Serialize};
|
||||||
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
|
|
||||||
use smoltcp::wire::IpAddress;
|
use smoltcp::wire::IpAddress;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use com::SsidRecord;
|
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
|
||||||
|
|
||||||
// republish this so we can decode the icmpv4 error codes
|
// republish this so we can decode the icmpv4 error codes
|
||||||
pub use smoltcp::wire::Icmpv4DstUnreachable;
|
pub use smoltcp::wire::Icmpv4DstUnreachable;
|
||||||
|
|
||||||
pub(crate) const SERVER_NAME_NET: &str = "_Middleware Network Server_";
|
pub(crate) const SERVER_NAME_NET: &str = "_Middleware Network Server_";
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub const AP_DICT_NAME: &'static str = "wlan.networks";
|
pub const AP_DICT_NAME: &'static str = "wlan.networks";
|
||||||
|
|
||||||
|
|
@ -30,54 +32,121 @@ pub const MIN_EC_REV: u32 = 0x00_09_06_00;
|
||||||
|
|
||||||
/// Dispatch opcodes to the Net crate main loop.
|
/// Dispatch opcodes to the Net crate main loop.
|
||||||
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
||||||
|
#[repr(C)]
|
||||||
pub(crate) enum Opcode {
|
pub(crate) enum Opcode {
|
||||||
/// Calls for UDP implementation
|
/// Calls for UDP implementation
|
||||||
UdpBind,
|
UdpBind = 0,
|
||||||
UdpClose,
|
UdpClose = 1,
|
||||||
UdpTx,
|
UdpTx = 2,
|
||||||
UdpSetTtl,
|
UdpSetTtl = 3,
|
||||||
UdpGetTtl,
|
UdpGetTtl = 4,
|
||||||
|
|
||||||
/// Calls for TCP implementation
|
/// Calls for TCP implementation
|
||||||
TcpConnect,
|
TcpConnect = 5,
|
||||||
TcpTx,
|
TcpTx = 6,
|
||||||
TcpClose,
|
TcpClose = 7,
|
||||||
TcpManage,
|
TcpManage = 8,
|
||||||
TcpListen,
|
TcpListen = 9,
|
||||||
TcpManageListener,
|
TcpManageListener = 10,
|
||||||
|
|
||||||
// The DNS server can hook the Net crate for notifications on config updates
|
// The DNS server can hook the Net crate for notifications on config updates
|
||||||
/// Adds an Ipv4 as a DNS server
|
/// Adds an Ipv4 as a DNS server
|
||||||
DnsHookAddIpv4,
|
DnsHookAddIpv4 = 11,
|
||||||
/// Adds an Ipv6 as a DNS server. Separate messages because max scalar arg is 128 bits.
|
/// Adds an Ipv6 as a DNS server. Separate messages because max scalar arg is 128 bits.
|
||||||
DnsHookAddIpv6,
|
DnsHookAddIpv6 = 12,
|
||||||
/// Called on IP config update -- clears all DNS servers.
|
/// Called on IP config update -- clears all DNS servers.
|
||||||
DnsHookAllClear,
|
DnsHookAllClear = 13,
|
||||||
DnsUnhookAll,
|
DnsUnhookAll = 14,
|
||||||
|
|
||||||
/// Ping stack
|
/// Ping stack
|
||||||
Ping,
|
Ping = 15,
|
||||||
PingSetTtl,
|
PingSetTtl = 16,
|
||||||
PingGetTtl,
|
PingGetTtl = 17,
|
||||||
PingSetTimeout,
|
PingSetTimeout = 18,
|
||||||
PingGetTimeout,
|
PingGetTimeout = 19,
|
||||||
|
|
||||||
/// Link Management,
|
/// Link Management,
|
||||||
GetIpv4Config,
|
GetIpv4Config = 20,
|
||||||
Reset,
|
Reset = 21,
|
||||||
SubscribeWifiStats,
|
SubscribeWifiStats = 22,
|
||||||
UnsubWifiStats,
|
UnsubWifiStats = 23,
|
||||||
FetchSsidList,
|
FetchSsidList = 24,
|
||||||
ConnMgrStartStop,
|
ConnMgrStartStop = 25,
|
||||||
|
|
||||||
/// [Internal] com llio interrupt callback
|
/// [Internal] com llio interrupt callback
|
||||||
ComInterrupt,
|
ComInterrupt = 26,
|
||||||
/// [Internal] run the network stack code
|
/// [Internal] run the network stack code
|
||||||
NetPump,
|
NetPump = 27,
|
||||||
/// Suspend/resume callback
|
/// Suspend/resume callback
|
||||||
SuspendResume,
|
SuspendResume = 28,
|
||||||
/// Quit the server
|
/// Quit the server
|
||||||
Quit
|
Quit = 29,
|
||||||
|
|
||||||
|
/// Create a connection to the target address
|
||||||
|
///
|
||||||
|
/// # Arguments
|
||||||
|
///
|
||||||
|
/// u8 array
|
||||||
|
/// -------|---------
|
||||||
|
/// offset | Contents
|
||||||
|
/// =======|=========
|
||||||
|
/// 0 | port number, low byte
|
||||||
|
/// 1 | port number, high byte
|
||||||
|
/// 2 | address type -- 4 = ipv4, 6 = ipv6
|
||||||
|
/// ... | remaining bytes are the address
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
///
|
||||||
|
/// u16 array
|
||||||
|
/// -------|---------
|
||||||
|
/// offset | Contents
|
||||||
|
/// =======|=========
|
||||||
|
/// 0 | 0 indicating success
|
||||||
|
/// 1 | Connection index
|
||||||
|
/// 2 | local port
|
||||||
|
/// 3 | remote port
|
||||||
|
///
|
||||||
|
/// # Errors
|
||||||
|
///
|
||||||
|
/// u8 array
|
||||||
|
/// -------|---------
|
||||||
|
/// offset | Contents
|
||||||
|
/// =======|=========
|
||||||
|
/// 0 | 1 indicating error
|
||||||
|
/// 1 | 1 indicating error (duplicated)
|
||||||
|
/// 2 | 1 indicating error (duplicated)
|
||||||
|
/// 3 | 1 indicating error (duplicated)
|
||||||
|
/// 4 | Error code
|
||||||
|
StdTcpConnect = 30,
|
||||||
|
|
||||||
|
/// Transmit data to the specified TCP Connection
|
||||||
|
///
|
||||||
|
/// # Arguments
|
||||||
|
///
|
||||||
|
/// The connection ID is OR-ed into the top 16 bits of the opcode. The payload
|
||||||
|
/// is pointed to by the data buffer, and the `Valid` and Offset` flags indicate
|
||||||
|
/// which regions inside the memory are valid.
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
///
|
||||||
|
/// u32 array
|
||||||
|
/// -------|---------
|
||||||
|
/// offset | Contents
|
||||||
|
/// =======|=========
|
||||||
|
/// 0 | 0 if no error, 1 if error
|
||||||
|
/// 1 | Number of bytes transferred, or code of the error
|
||||||
|
///
|
||||||
|
StdTcpTx = 31,
|
||||||
|
|
||||||
|
/// Receives data from the specified TCP Connection. The TCP connection number is
|
||||||
|
/// passed in the upper 16 bits of the opcode, and the number of received bytes
|
||||||
|
/// is returned as part of the `Valid` parameter.
|
||||||
|
StdTcpRx = 32,
|
||||||
|
|
||||||
|
/// Close the TCP connection. The connection ID is specified in the upper 16 bits
|
||||||
|
/// of the opcode. This may be any kind of message (scalar, blockingscalar, memory,
|
||||||
|
/// etc.)
|
||||||
|
StdTcpClose = 33,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Archive, Serialize, Deserialize, Copy, Clone, Default)]
|
#[derive(Debug, Archive, Serialize, Deserialize, Copy, Clone, Default)]
|
||||||
|
|
@ -94,7 +163,7 @@ pub enum XousServerId {
|
||||||
PrivateSid([u32; 4]),
|
PrivateSid([u32; 4]),
|
||||||
/// A name that needs to be looked up with XousNames. Easier to implement, but less secure as it requires
|
/// A name that needs to be looked up with XousNames. Easier to implement, but less secure as it requires
|
||||||
/// an open connection slot that could be abused by other processes.
|
/// an open connection slot that could be abused by other processes.
|
||||||
ServerName(xous_ipc::String::<64>),
|
ServerName(xous_ipc::String<64>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// These opcodes are reserved for private SIDs shared from a DNS server to
|
/// These opcodes are reserved for private SIDs shared from a DNS server to
|
||||||
|
|
@ -127,6 +196,7 @@ pub(crate) enum NetCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Archive, Serialize, Deserialize, Copy, Clone, PartialEq, Eq)]
|
#[derive(Debug, Archive, Serialize, Deserialize, Copy, Clone, PartialEq, Eq)]
|
||||||
|
#[repr(C, u16)]
|
||||||
pub(crate) enum NetMemResponse {
|
pub(crate) enum NetMemResponse {
|
||||||
Ok,
|
Ok,
|
||||||
Sent(u16),
|
Sent(u16),
|
||||||
|
|
@ -139,9 +209,21 @@ pub(crate) enum NetMemResponse {
|
||||||
AlreadyUsed,
|
AlreadyUsed,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
pub enum NetError {
|
||||||
|
Ok = 0,
|
||||||
|
OutOfMemory = 1,
|
||||||
|
SocketInUse = 2,
|
||||||
|
AccessDenied = 3,
|
||||||
|
Invalid = 4,
|
||||||
|
Finished = 5,
|
||||||
|
LibraryError = 6,
|
||||||
|
AlreadyUsed = 7,
|
||||||
|
}
|
||||||
|
|
||||||
/////// a bunch of structures are re-derived here so we can infer `rkyv` traits on them
|
/////// a bunch of structures are re-derived here so we can infer `rkyv` traits on them
|
||||||
#[derive(Debug, Archive, Serialize, Deserialize, Copy, Clone)]
|
#[derive(Debug, Archive, Serialize, Deserialize, Copy, Clone)]
|
||||||
pub (crate) struct NetSocketAddr {
|
pub(crate) struct NetSocketAddr {
|
||||||
pub(crate) addr: NetIpAddr,
|
pub(crate) addr: NetIpAddr,
|
||||||
pub(crate) port: u16,
|
pub(crate) port: u16,
|
||||||
}
|
}
|
||||||
|
|
@ -162,24 +244,16 @@ pub enum NetIpAddr {
|
||||||
impl From<SocketAddr> for NetIpAddr {
|
impl From<SocketAddr> for NetIpAddr {
|
||||||
fn from(other: SocketAddr) -> NetIpAddr {
|
fn from(other: SocketAddr) -> NetIpAddr {
|
||||||
match other {
|
match other {
|
||||||
SocketAddr::V4(sav4) => {
|
SocketAddr::V4(sav4) => NetIpAddr::Ipv4(sav4.ip().octets()),
|
||||||
NetIpAddr::Ipv4(sav4.ip().octets())
|
SocketAddr::V6(sav6) => NetIpAddr::Ipv6(sav6.ip().octets()),
|
||||||
},
|
|
||||||
SocketAddr::V6(sav6) => {
|
|
||||||
NetIpAddr::Ipv6(sav6.ip().octets())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<IpAddress> for NetIpAddr {
|
impl From<IpAddress> for NetIpAddr {
|
||||||
fn from(other: IpAddress) -> NetIpAddr {
|
fn from(other: IpAddress) -> NetIpAddr {
|
||||||
match other {
|
match other {
|
||||||
IpAddress::Ipv4(ipv4) => {
|
IpAddress::Ipv4(ipv4) => NetIpAddr::Ipv4(ipv4.0),
|
||||||
NetIpAddr::Ipv4(ipv4.0)
|
IpAddress::Ipv6(ipv6) => NetIpAddr::Ipv6(ipv6.0),
|
||||||
},
|
|
||||||
IpAddress::Ipv6(ipv6) => {
|
|
||||||
NetIpAddr::Ipv6(ipv6.0)
|
|
||||||
},
|
|
||||||
_ => {
|
_ => {
|
||||||
panic!("Invalid IpAddress")
|
panic!("Invalid IpAddress")
|
||||||
}
|
}
|
||||||
|
|
@ -189,24 +263,16 @@ impl From<IpAddress> for NetIpAddr {
|
||||||
impl From<IpAddr> for NetIpAddr {
|
impl From<IpAddr> for NetIpAddr {
|
||||||
fn from(other: IpAddr) -> NetIpAddr {
|
fn from(other: IpAddr) -> NetIpAddr {
|
||||||
match other {
|
match other {
|
||||||
IpAddr::V4(ipv4) => {
|
IpAddr::V4(ipv4) => NetIpAddr::Ipv4(ipv4.octets()),
|
||||||
NetIpAddr::Ipv4(ipv4.octets())
|
IpAddr::V6(ipv6) => NetIpAddr::Ipv6(ipv6.octets()),
|
||||||
},
|
|
||||||
IpAddr::V6(ipv6) => {
|
|
||||||
NetIpAddr::Ipv6(ipv6.octets())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<NetIpAddr> for IpAddr {
|
impl From<NetIpAddr> for IpAddr {
|
||||||
fn from(other: NetIpAddr) -> IpAddr {
|
fn from(other: NetIpAddr) -> IpAddr {
|
||||||
match other {
|
match other {
|
||||||
NetIpAddr::Ipv4(octets) => {
|
NetIpAddr::Ipv4(octets) => IpAddr::V4(Ipv4Addr::from(octets)),
|
||||||
IpAddr::V4(Ipv4Addr::from(octets))
|
NetIpAddr::Ipv6(octets) => IpAddr::V6(Ipv6Addr::from(octets)),
|
||||||
}
|
|
||||||
NetIpAddr::Ipv6(octets) => {
|
|
||||||
IpAddr::V6(Ipv6Addr::from(octets))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -216,19 +282,16 @@ impl From<NetIpAddr> for IpAddress {
|
||||||
NetIpAddr::Ipv4([a, b, c, d]) => {
|
NetIpAddr::Ipv4([a, b, c, d]) => {
|
||||||
IpAddress::Ipv4(smoltcp::wire::Ipv4Address::new(a, b, c, d))
|
IpAddress::Ipv4(smoltcp::wire::Ipv4Address::new(a, b, c, d))
|
||||||
}
|
}
|
||||||
NetIpAddr::Ipv6(ipv6) => {
|
NetIpAddr::Ipv6(ipv6) => IpAddress::Ipv6(smoltcp::wire::Ipv6Address::new(
|
||||||
IpAddress::Ipv6(smoltcp::wire::Ipv6Address::new(
|
u16::from_be_bytes(ipv6[0..1].try_into().unwrap()),
|
||||||
u16::from_be_bytes(ipv6[0..1].try_into().unwrap()),
|
u16::from_be_bytes(ipv6[2..3].try_into().unwrap()),
|
||||||
u16::from_be_bytes(ipv6[2..3].try_into().unwrap()),
|
u16::from_be_bytes(ipv6[4..5].try_into().unwrap()),
|
||||||
u16::from_be_bytes(ipv6[4..5].try_into().unwrap()),
|
u16::from_be_bytes(ipv6[6..7].try_into().unwrap()),
|
||||||
u16::from_be_bytes(ipv6[6..7].try_into().unwrap()),
|
u16::from_be_bytes(ipv6[8..9].try_into().unwrap()),
|
||||||
u16::from_be_bytes(ipv6[8..9].try_into().unwrap()),
|
u16::from_be_bytes(ipv6[10..11].try_into().unwrap()),
|
||||||
u16::from_be_bytes(ipv6[10..11].try_into().unwrap()),
|
u16::from_be_bytes(ipv6[12..13].try_into().unwrap()),
|
||||||
u16::from_be_bytes(ipv6[12..13].try_into().unwrap()),
|
u16::from_be_bytes(ipv6[14..15].try_into().unwrap()),
|
||||||
u16::from_be_bytes(ipv6[14..15].try_into().unwrap()),
|
)),
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -243,7 +306,7 @@ pub fn ipaddress_to_ipaddr(other: IpAddress) -> IpAddr {
|
||||||
let octets = ipv6.0;
|
let octets = ipv6.0;
|
||||||
IpAddr::V6(Ipv6Addr::from(octets))
|
IpAddr::V6(Ipv6Addr::from(octets))
|
||||||
}
|
}
|
||||||
_ => unimplemented!()
|
_ => unimplemented!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -253,21 +316,30 @@ impl fmt::Display for NetIpAddr {
|
||||||
NetIpAddr::Ipv4(octets) => {
|
NetIpAddr::Ipv4(octets) => {
|
||||||
// Fast Path: if there's no alignment stuff, write directly to the buffer
|
// Fast Path: if there's no alignment stuff, write directly to the buffer
|
||||||
if fmt.precision().is_none() && fmt.width().is_none() {
|
if fmt.precision().is_none() && fmt.width().is_none() {
|
||||||
write!(fmt, "{}.{}.{}.{}", octets[0], octets[1], octets[2], octets[3])
|
write!(
|
||||||
|
fmt,
|
||||||
|
"{}.{}.{}.{}",
|
||||||
|
octets[0], octets[1], octets[2], octets[3]
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
const IPV4_BUF_LEN: usize = 15; // Long enough for the longest possible IPv4 address
|
const IPV4_BUF_LEN: usize = 15; // Long enough for the longest possible IPv4 address
|
||||||
let mut buf = [0u8; IPV4_BUF_LEN];
|
let mut buf = [0u8; IPV4_BUF_LEN];
|
||||||
let mut buf_slice = &mut buf[..];
|
let mut buf_slice = &mut buf[..];
|
||||||
|
|
||||||
// Note: The call to write should never fail, hence the unwrap
|
// Note: The call to write should never fail, hence the unwrap
|
||||||
write!(buf_slice, "{}.{}.{}.{}", octets[0], octets[1], octets[2], octets[3]).unwrap();
|
write!(
|
||||||
|
buf_slice,
|
||||||
|
"{}.{}.{}.{}",
|
||||||
|
octets[0], octets[1], octets[2], octets[3]
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
let len = IPV4_BUF_LEN - buf_slice.len();
|
let len = IPV4_BUF_LEN - buf_slice.len();
|
||||||
|
|
||||||
// This unsafe is OK because we know what is being written to the buffer
|
// This unsafe is OK because we know what is being written to the buffer
|
||||||
let buf = unsafe { std::str::from_utf8_unchecked(&buf[..len]) };
|
let buf = unsafe { std::str::from_utf8_unchecked(&buf[..len]) };
|
||||||
fmt.pad(buf)
|
fmt.pad(buf)
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
NetIpAddr::Ipv6(ip) => ip.fmt(fmt),
|
NetIpAddr::Ipv6(ip) => ip.fmt(fmt),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -307,7 +379,7 @@ impl XousScalarEndpoint {
|
||||||
XousScalarEndpoint {
|
XousScalarEndpoint {
|
||||||
cid: None,
|
cid: None,
|
||||||
op: None,
|
op: None,
|
||||||
args: [None; 4]
|
args: [None; 4],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub(crate) fn get(&self) -> (Option<xous::CID>, Option<usize>, [Option<usize>; 4]) {
|
pub(crate) fn get(&self) -> (Option<xous::CID>, Option<usize>, [Option<usize>; 4]) {
|
||||||
|
|
@ -333,11 +405,11 @@ impl XousScalarEndpoint {
|
||||||
cid,
|
cid,
|
||||||
xous::Message::new_scalar(
|
xous::Message::new_scalar(
|
||||||
op,
|
op,
|
||||||
if let Some(a) = self.args[0] {a} else {0},
|
self.args[0].unwrap_or_default(),
|
||||||
if let Some(a) = self.args[1] {a} else {0},
|
self.args[1].unwrap_or_default(),
|
||||||
if let Some(a) = self.args[2] {a} else {0},
|
self.args[2].unwrap_or_default(),
|
||||||
if let Some(a) = self.args[3] {a} else {0},
|
self.args[3].unwrap_or_default(),
|
||||||
)
|
),
|
||||||
) {
|
) {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
@ -356,18 +428,63 @@ impl XousScalarEndpoint {
|
||||||
log::trace!("custom args");
|
log::trace!("custom args");
|
||||||
if let Some(cid) = self.cid {
|
if let Some(cid) = self.cid {
|
||||||
if let Some(op) = self.op {
|
if let Some(op) = self.op {
|
||||||
log::trace!("ca: {} {} cust{:?} self{:?} 0:{}", cid, op, custom, self.args,
|
log::trace!(
|
||||||
if let Some(b) = custom[0] {b as usize} else { if let Some(a) = self.args[0] {a} else {0} }
|
"ca: {} {} cust{:?} self{:?} 0:{}",
|
||||||
|
cid,
|
||||||
|
op,
|
||||||
|
custom,
|
||||||
|
self.args,
|
||||||
|
if let Some(b) = custom[0] {
|
||||||
|
b as usize
|
||||||
|
} else {
|
||||||
|
if let Some(a) = self.args[0] {
|
||||||
|
a
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
match xous::send_message(
|
match xous::send_message(
|
||||||
cid,
|
cid,
|
||||||
xous::Message::new_scalar(
|
xous::Message::new_scalar(
|
||||||
op,
|
op,
|
||||||
if let Some(b) = custom[0] {b as usize} else { if let Some(a) = self.args[0] {a} else {0} },
|
if let Some(b) = custom[0] {
|
||||||
if let Some(b) = custom[1] {b as usize} else { if let Some(a) = self.args[1] {a} else {0} },
|
b as usize
|
||||||
if let Some(b) = custom[2] {b as usize} else { if let Some(a) = self.args[2] {a} else {0} },
|
} else {
|
||||||
if let Some(b) = custom[3] {b as usize} else { if let Some(a) = self.args[3] {a} else {0} },
|
if let Some(a) = self.args[0] {
|
||||||
)
|
a
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
if let Some(b) = custom[1] {
|
||||||
|
b as usize
|
||||||
|
} else {
|
||||||
|
if let Some(a) = self.args[1] {
|
||||||
|
a
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
if let Some(b) = custom[2] {
|
||||||
|
b as usize
|
||||||
|
} else {
|
||||||
|
if let Some(a) = self.args[2] {
|
||||||
|
a
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
if let Some(b) = custom[3] {
|
||||||
|
b as usize
|
||||||
|
} else {
|
||||||
|
if let Some(a) = self.args[3] {
|
||||||
|
a
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
) {
|
) {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
@ -380,7 +497,6 @@ impl XousScalarEndpoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// This is a "generic" object for registering a hook between a remote, potentially
|
/// This is a "generic" object for registering a hook between a remote, potentially
|
||||||
/// untrusted server and my process. The SID filled into the hook should be a
|
/// untrusted server and my process. The SID filled into the hook should be a
|
||||||
/// "one time" (or perhaps better phrased as "single purpose") SID. In other words, it's
|
/// "one time" (or perhaps better phrased as "single purpose") SID. In other words, it's
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue