提交 4f9067d9 编写于 作者: Y Yi Huang 提交者: hydai

[Doc] Add `recvfrom` and `sendto` to socket API.

上级 28660790
...@@ -280,8 +280,12 @@ ...@@ -280,8 +280,12 @@
$poll_fd_readwrite $poll_fd_readwrite
;;; The right to invoke `sock_recv`. ;;; The right to invoke `sock_recv`.
$sock_recv $sock_recv
;;; The right to invoke `sock_recv_from`.
$sock_recv_from
;;; The right to invoke `sock_send`. ;;; The right to invoke `sock_send`.
$sock_send $sock_send
;;; The right to invoke `sock_send_to`.
$sock_send_to
;;; The right to invoke `sock_shutdown`. ;;; The right to invoke `sock_shutdown`.
$sock_shutdown $sock_shutdown
) )
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
;;; Receive a message from a socket. ;;; Receive a message from a socket.
;;; Note: This is similar to `recv` in POSIX. ;;; Note: This is similar to `recv` in POSIX.
;;; Note: This is identical to `recvfrom` with a null pointer passed as its
;;; as its address in POSIX.
(@interface func (export "recv") (@interface func (export "recv")
(param $fd $fd) (param $fd $fd)
;;; The pointer to and length of the buffer for data received. ;;; The pointer to and length of the buffer for data received.
...@@ -27,8 +29,26 @@ ...@@ -27,8 +29,26 @@
(result $bufused $size) (result $bufused $size)
) )
;;; Receive a message from a socket.
;;; Note: This is similar to `recvfrom` in POSIX.
(@interface func (export "recv_from")
(param $fd $fd)
;;; The pointer to and length of the buffer for data received.
(param $buf (@witx pointer u8))
(param $buf_len $size)
;;; The pointer to and length of the buffer for source address.
(param $addr_buf (@witx pointer u8))
(param $addr_buf_len $size)
;;; Message flags.
(param $flags $riflags)
(result $error $errno)
;;; Number of bytes used in the buffer.
(result $bufused $size)
)
;;; Send a message from a socket. ;;; Send a message from a socket.
;;; Note: This is similar to `send` in POSIX. ;;; Note: This is similar to `send` in POSIX.
;;; Note: This may be used only when the socket is in a connected state.
(@interface func (export "send") (@interface func (export "send")
(param $fd $fd) (param $fd $fd)
;;; The pointer to and length of the buffer for data. ;;; The pointer to and length of the buffer for data.
...@@ -41,6 +61,23 @@ ...@@ -41,6 +61,23 @@
(result $bufused $size) (result $bufused $size)
) )
;;; Send a message from a socket.
;;; Note: This is similar to `sendto` in POSIX.
(@interface func (export "send_to")
(param $fd $fd)
;;; The pointer to and length of the buffer for data.
(param $buf (@witx pointer u8))
(param $buf_len $size)
;;; The pointer to and length of the buffer for destination address.
(param $addr_buf (@witx pointer u8))
(param $addr_buf_len $size)
;;; Message flags.
(param $_flags $siflags)
(result $error $errno)
;;; Number of bytes transmitted.
(result $bufused $size)
)
;;; Shut down socket send and receive channels. ;;; Shut down socket send and receive channels.
;;; Note: This is similar to `shutdown` in POSIX. ;;; Note: This is similar to `shutdown` in POSIX.
(@interface func (export "shutdown") (@interface func (export "shutdown")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册