fuchsia.posix.socket

PROTOCOLS

Control

Defined in fuchsia.posix.socket/socket.fidl

The control plane for a network socket.

Once a socket has been retrieved from a Provider, this interface is then used to further configure and use the socket. This interface is essentially POSIX. Its implementation must support Linux-specific arguments to {Get,Set}SockOpt.

Warning: This protocol is not yet ready for direct use by clients. Instead, clients should use the BSD sockets API to interact with sockets. We plan to change this protocol substantially and clients that couple directly to this protocol will make those changes more difficult.

Clone

Create another connection to the same remote object.

flags may be any of:

  • OPEN_RIGHT_*
  • OPEN_FLAG_APPEND
  • OPEN_FLAG_NO_REMOTE
  • OPEN_FLAG_DESCRIBE
  • CLONE_FLAG_SAME_RIGHTS

All other flags are ignored.

The OPEN_RIGHT_* bits in flags request corresponding rights over the resulting cloned object. The cloned object must have rights less than or equal to the original object. Alternatively, pass CLONE_FLAG_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OPEN_RIGHT_* flags together with CLONE_FLAG_SAME_RIGHTS.

Request

NameType
flags uint32
object request<fuchsia.io/Node>

Close

Terminates connection with object.

This method does not require any rights.

Request

NameType

Response

NameType
s zx/status

Describe

Returns extra information about the type of the object. If the Describe operation fails, the connection is closed.

This method does not require any rights.

Request

NameType

Response

NameType
info fuchsia.io/NodeInfo

OnOpen

An event produced eagerly by a FIDL server if requested by OPEN_FLAG_DESCRIBE.

Indicates the success or failure of the open operation, and optionally describes the object. If the status is ZX_OK, info contains descriptive information about the object (the same as would be returned by Describe).

Response

NameType
s zx/status
info fuchsia.io/NodeInfo?

Sync

Synchronizes updates to the node to the underlying media, if it exists.

This method does not require any rights.

Request

NameType

Response

NameType
s zx/status

GetAttr

Acquires information about the node.

This method does not require any rights.

Request

NameType

Response

NameType
s zx/status
attributes fuchsia.io/NodeAttributes

SetAttr

Updates information about the node. flags may be any of NODE_ATTRIBUTE_FLAG_*.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

NameType
flags uint32
attributes fuchsia.io/NodeAttributes

Response

NameType
s zx/status

NodeGetFlags

Acquires the Directory.Open rights and flags used to access this file.

This method does not require any rights. This method has the same functionality as GetFlags for File and is meant as an in-progress replacement.

Request

NameType

Response

NameType
s zx/status
flags uint32

NodeSetFlags

Changes the Directory.Open flags used to access the file. Supported flags which can be turned on / off:

  • OPEN_FLAG_APPEND

This method does not require any rights. This method has the same functionality as SetFlags for File and is meant as an in-progress replacement.

Request

NameType
flags uint32

Response

NameType
s zx/status

Bind

Sets the local address used for the socket.

Request

NameType
addr sockaddr

Response

NameType
code int16

Connect

Initiates a connection to a remote address.

Request

NameType
addr sockaddr

Response

NameType
code int16

Listen

Begins listening for new incoming connections. At most backlog connections will be buffered.

Request

NameType
backlog int16

Response

NameType
code int16

Accept

Accepts a buffered incoming connection.

Request

NameType
flags int16

Response

NameType
code int16
s Control?

GetSockName

Retrieves the local socket address.

Request

NameType

Response

NameType
code int16
addr sockaddr

GetPeerName

Retrieves the remote socket address.

Request

NameType

Response

NameType
code int16
addr sockaddr

SetSockOpt

Sets the value of a socket option.

Request

NameType
level int16
optname int16
optval sockopt

Response

NameType
code int16

GetSockOpt

Retrieves the value of a socket option.

Request

NameType
level int16
optname int16

Response

NameType
code int16
optval sockopt

Provider

Defined in fuchsia.posix.socket/socket.fidl

Provider implements the POSIX sockets API.

Socket

Requests a socket with the specified parameters. Values for code are defined in errno.h.

Request

NameType
domain int16
type int16
protocol int16

Response

NameType
code int16
s Control?

TYPE ALIASES

NameValueDescription
sockaddr vector

Chosen to match sizeof(struct sockaddr_storage).

sockopt vector

Chosen to be large enough to hold whatever we might want to cram in it. So long as we support socket options, we don't have a good sense of what we might want to send as payload.