Trait sidevm_env::OcallFuncs
source · [−]pub trait OcallFuncs {
Show 25 methods
fn close(&mut self, resource_id: i32) -> Result<()>;
fn poll(&mut self, waker_id: i32, resource_id: i32) -> Result<Vec<u8>>;
fn poll_read(
&mut self,
waker_id: i32,
resource_id: i32,
data: &mut [u8]
) -> Result<u32>;
fn poll_write(
&mut self,
waker_id: i32,
resource_id: i32,
data: &[u8]
) -> Result<u32>;
fn poll_shutdown(&mut self, waker_id: i32, resource_id: i32) -> Result<()>;
fn poll_res(&mut self, waker_id: i32, resource_id: i32) -> Result<i32>;
fn mark_task_ready(&mut self, task_id: i32) -> Result<()>;
fn next_ready_task(&mut self) -> Result<i32>;
fn enable_ocall_trace(&mut self, enable: bool) -> Result<()>;
fn awake_wakers(&mut self) -> Result<Vec<i32>>;
fn getrandom(&mut self, buf: &mut [u8]) -> Result<()>;
fn create_timer(&mut self, timeout: i32) -> Result<i32>;
fn oneshot_send(&mut self, resource_id: i32, data: &[u8]) -> Result<()>;
fn gas_remaining(&mut self) -> Result<u8>;
fn tcp_listen(
&mut self,
addr: Cow<'_, str>,
tls_config: Option<TlsServerConfig>
) -> Result<i32>;
fn tcp_accept(
&mut self,
waker_id: i32,
resource_id: i32
) -> Result<(i32, String)>;
fn tcp_accept_no_addr(
&mut self,
waker_id: i32,
resource_id: i32
) -> Result<i32>;
fn tcp_connect(&mut self, host: &str, port: u16) -> Result<i32>;
fn tcp_connect_tls(
&mut self,
host: String,
port: u16,
config: TlsClientConfig
) -> Result<i32>;
fn log(&mut self, level: Level, message: &str) -> Result<()>;
fn local_cache_get(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>>;
fn local_cache_set(&mut self, key: &[u8], value: &[u8]) -> Result<()>;
fn local_cache_set_expiration(
&mut self,
key: &[u8],
expire_after_secs: u64
) -> Result<()>;
fn local_cache_remove(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>>;
fn create_input_channel(&mut self, ch: InputChannel) -> Result<i32>;
}
Expand description
All ocall definitions for pink Sidevm.
Required Methods
Poll given resource by id and return a dynamic sized data.
Poll given resource to read data. Low level support for AsyncRead.
Poll given resource to write data. Low level support for AsyncWrite.
Poll given resource to generate a new resource id.
sourcefn mark_task_ready(&mut self, task_id: i32) -> Result<()>
fn mark_task_ready(&mut self, task_id: i32) -> Result<()>
Mark a task as ready for next polling
sourcefn next_ready_task(&mut self) -> Result<i32>
fn next_ready_task(&mut self) -> Result<i32>
Get the next waken up task id.
sourcefn enable_ocall_trace(&mut self, enable: bool) -> Result<()>
fn enable_ocall_trace(&mut self, enable: bool) -> Result<()>
Enable logging for ocalls
sourcefn awake_wakers(&mut self) -> Result<Vec<i32>>
fn awake_wakers(&mut self) -> Result<Vec<i32>>
Get awake wakers
sourcefn create_timer(&mut self, timeout: i32) -> Result<i32>
fn create_timer(&mut self, timeout: i32) -> Result<i32>
Create a timer given a duration of time in milliseconds.
Send data to a oneshot channel.
sourcefn gas_remaining(&mut self) -> Result<u8>
fn gas_remaining(&mut self) -> Result<u8>
Percentage of the gas remaining to the next breath
sourcefn tcp_listen(
&mut self,
addr: Cow<'_, str>,
tls_config: Option<TlsServerConfig>
) -> Result<i32>
fn tcp_listen(
&mut self,
addr: Cow<'_, str>,
tls_config: Option<TlsServerConfig>
) -> Result<i32>
Create a TCP socket, bind to given address and listen to incoming connections.
If tls_config
is not None
, then the socket will be TLS encrypted.
Invoke tcp_accept on the returned resource_id to accept incoming connections.
Accept incoming TCP connections.
Accept incoming TCP connections without returning the remote address.
Initiate a TCP connection to a remote endpoint.
sourcefn tcp_connect_tls(
&mut self,
host: String,
port: u16,
config: TlsClientConfig
) -> Result<i32>
fn tcp_connect_tls(
&mut self,
host: String,
port: u16,
config: TlsClientConfig
) -> Result<i32>
Initiate a TLS/TCP connection to a remote endpoint.
Get value from the local cache.
Set value to the local cache.
Set expiration time for a key in the local cache.
Remove a value from the local cache.
Returns the previous value if it existed.
sourcefn create_input_channel(&mut self, ch: InputChannel) -> Result<i32>
fn create_input_channel(&mut self, ch: InputChannel) -> Result<i32>
Create input channel