port_gateway_set()
Adds a default gateway to the port.
Description
The port_gateway_set() function sets the default gateway for the local port to the specified address.
Syntax
;;; Adds a default gateway to the local port
(@interface func (export "port_gateway_set")
;;; Address of the default gateway
(param $addr (@witx const_pointer $addr))
(result $error (expected (error $errno)))
)Parameters
ctx: A mutable reference to the function environment.ip: AWasmPtrpointing to the memory location where the IP address of the default gateway is stored.
Return Value
The function returns a Result indicating the outcome of the operation. If the operation is successful, Ok(Errno::Success) is returned. If an error occurs, an appropriate WasiError is returned.
Notes
- The
port_gateway_set()function sets the default gateway for the local port, which is the address that is used for routing packets when the destination IP address is outside of the local network. - The IP address of the default gateway is provided through the
ipparameter, which should point to a memory location that stores the IP address in the__wasi_addr_tformat. - The behavior and limitations of the
port_gateway_set()function may vary depending on the specific runtime environment and underlying networking implementation. It is important to consult the documentation or specifications of the specific environment to understand its behavior in that context.