wa-lang.org/wazero@v1.0.2/imports/wasi_snapshot_preview1/sock.go (about) 1 package wasi_snapshot_preview1 2 3 import "wa-lang.org/wazero/internal/wasm" 4 5 const ( 6 functionSockAccept = "sock_accept" 7 functionSockRecv = "sock_recv" 8 functionSockSend = "sock_send" 9 functionSockShutdown = "sock_shutdown" 10 ) 11 12 // sockAccept is the WASI function named functionSockAccept which accepts a new 13 // incoming connection. 14 // 15 // See: https://github.com/WebAssembly/WASI/blob/0ba0c5e2e37625ca5a6d3e4255a998dfaa3efc52/phases/snapshot/docs.md#sock_accept 16 // and https://github.com/WebAssembly/WASI/pull/458 17 var sockAccept = stubFunction( 18 functionSockAccept, 19 []wasm.ValueType{i32, i32, i32}, 20 []string{"fd", "flags", "result.fd"}, 21 ) 22 23 // sockRecv is the WASI function named functionSockRecv which receives a 24 // message from a socket. 25 // 26 // See: https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-sock_recvfd-fd-ri_data-iovec_array-ri_flags-riflags---errno-size-roflags 27 var sockRecv = stubFunction( 28 functionSockRecv, 29 []wasm.ValueType{i32, i32, i32, i32, i32, i32}, 30 []string{"fd", "ri_data", "ri_data_count", "ri_flags", "result.ro_datalen", "result.ro_flags"}, 31 ) 32 33 // sockSend is the WASI function named functionSockSend which sends a message 34 // on a socket. 35 // 36 // See: https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-sock_sendfd-fd-si_data-ciovec_array-si_flags-siflags---errno-size 37 var sockSend = stubFunction( 38 functionSockSend, 39 []wasm.ValueType{i32, i32, i32, i32, i32}, 40 []string{"fd", "si_data", "si_data_count", "si_flags", "result.so_datalen"}, 41 ) 42 43 // sockShutdown is the WASI function named functionSockShutdown which shuts 44 // down socket send and receive channels. 45 // 46 // See: https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-sock_shutdownfd-fd-how-sdflags---errno 47 var sockShutdown = stubFunction( 48 functionSockShutdown, 49 []wasm.ValueType{i32, i32}, 50 []string{"fd", "how"}, 51 )