pub enum SocketRequest {
Show 37 variants
Clone2 {
request: ServerEnd<CloneableMarker>,
control_handle: SocketControlHandle,
},
Close {
responder: SocketCloseResponder,
},
Query {
responder: SocketQueryResponder,
},
SetReuseAddress {
value: bool,
responder: SocketSetReuseAddressResponder,
},
GetReuseAddress {
responder: SocketGetReuseAddressResponder,
},
GetError {
responder: SocketGetErrorResponder,
},
SetBroadcast {
value: bool,
responder: SocketSetBroadcastResponder,
},
GetBroadcast {
responder: SocketGetBroadcastResponder,
},
SetSendBuffer {
value_bytes: u64,
responder: SocketSetSendBufferResponder,
},
GetSendBuffer {
responder: SocketGetSendBufferResponder,
},
SetReceiveBuffer {
value_bytes: u64,
responder: SocketSetReceiveBufferResponder,
},
GetReceiveBuffer {
responder: SocketGetReceiveBufferResponder,
},
SetKeepAlive {
value: bool,
responder: SocketSetKeepAliveResponder,
},
GetKeepAlive {
responder: SocketGetKeepAliveResponder,
},
SetOutOfBandInline {
value: bool,
responder: SocketSetOutOfBandInlineResponder,
},
GetOutOfBandInline {
responder: SocketGetOutOfBandInlineResponder,
},
SetNoCheck {
value: bool,
responder: SocketSetNoCheckResponder,
},
GetNoCheck {
responder: SocketGetNoCheckResponder,
},
SetLinger {
linger: bool,
length_secs: u32,
responder: SocketSetLingerResponder,
},
GetLinger {
responder: SocketGetLingerResponder,
},
SetReusePort {
value: bool,
responder: SocketSetReusePortResponder,
},
GetReusePort {
responder: SocketGetReusePortResponder,
},
GetAcceptConn {
responder: SocketGetAcceptConnResponder,
},
SetBindToDevice {
value: String,
responder: SocketSetBindToDeviceResponder,
},
GetBindToDevice {
responder: SocketGetBindToDeviceResponder,
},
SetBindToInterfaceIndex {
value: u64,
responder: SocketSetBindToInterfaceIndexResponder,
},
GetBindToInterfaceIndex {
responder: SocketGetBindToInterfaceIndexResponder,
},
SetTimestamp {
value: TimestampOption,
responder: SocketSetTimestampResponder,
},
GetTimestamp {
responder: SocketGetTimestampResponder,
},
SetMark {
domain: MarkDomain,
mark: OptionalUint32,
responder: SocketSetMarkResponder,
},
GetMark {
domain: MarkDomain,
responder: SocketGetMarkResponder,
},
Describe {
responder: SocketDescribeResponder,
},
Bind {
protocol: Option<Box<ProtocolAssociation>>,
bound_interface_id: BoundInterfaceId,
responder: SocketBindResponder,
},
GetInfo {
responder: SocketGetInfoResponder,
},
RecvMsg {
want_packet_info: bool,
data_len: u32,
want_control: bool,
flags: RecvMsgFlags,
responder: SocketRecvMsgResponder,
},
SendMsg {
packet_info: Option<Box<PacketInfo>>,
data: Vec<u8>,
control: SendControlData,
flags: SendMsgFlags,
responder: SocketSendMsgResponder,
},
AttachBpfFilterUnsafe {
code: Vec<u64>,
responder: SocketAttachBpfFilterUnsafeResponder,
},
}
Expand description
A packet socket.
This interface is essentially POSIX.
All methods on this type are nonblocking; their exact behaviors match their Linux counterparts.
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.
Variants§
Clone2
Close
Terminates the connection.
After calling Close
, the client must not send any other requests.
Servers, after sending the status response, should close the connection regardless of status and without sending an epitaph.
Closing the client end of the channel should be semantically equivalent
to calling Close
without knowing when the close has completed or its
status.
Fields
responder: SocketCloseResponder
Query
Fields
responder: SocketQueryResponder
SetReuseAddress
Set SOL_SOCKET
-> SO_REUSEADDR
.
GetReuseAddress
Get SOL_SOCKET
-> SO_REUSEADDR
.
Fields
responder: SocketGetReuseAddressResponder
GetError
Get SOL_SOCKET
-> SO_ERROR
.
Returns the last error if there is an error set on the socket.
Fields
responder: SocketGetErrorResponder
SetBroadcast
Set SOL_SOCKET
-> SO_BROADCAST
.
GetBroadcast
Get SOL_SOCKET
-> SO_BROADCAST
.
Fields
responder: SocketGetBroadcastResponder
SetSendBuffer
Set SOL_SOCKET
-> SO_SNDBUF
.
GetSendBuffer
Get SOL_SOCKET
-> SO_SNDBUF
.
Fields
responder: SocketGetSendBufferResponder
SetReceiveBuffer
Set SOL_SOCKET
-> SO_RCVBUF
.
GetReceiveBuffer
Get SOL_SOCKET
-> SO_RCVBUF
.
Fields
responder: SocketGetReceiveBufferResponder
SetKeepAlive
Set SOL_SOCKET
-> SO_KEEPALIVE
.
GetKeepAlive
Get SOL_SOCKET
-> SO_KEEPALIVE
.
Fields
responder: SocketGetKeepAliveResponder
SetOutOfBandInline
Set SOL_SOCKET
-> SO_OOBINLINE
.
GetOutOfBandInline
Get SOL_SOCKET
-> SO_OOBINLINE
.
Fields
responder: SocketGetOutOfBandInlineResponder
SetNoCheck
Set SOL_SOCKET
-> SO_NO_CHECK
.
GetNoCheck
Get SOL_SOCKET
-> SO_NO_CHECK
.
Fields
responder: SocketGetNoCheckResponder
SetLinger
Set SOL_SOCKET
-> SO_LINGER
.
GetLinger
Get SOL_SOCKET
-> SO_LINGER
.
Fields
responder: SocketGetLingerResponder
SetReusePort
Set SOL_SOCKET
-> SO_REUSEPORT
.
GetReusePort
Get SOL_SOCKET
-> SO_REUSEPORT
.
Fields
responder: SocketGetReusePortResponder
GetAcceptConn
Get SOL_SOCKET
-> SO_ACCEPTCONN
.
Fields
responder: SocketGetAcceptConnResponder
SetBindToDevice
Set SOL_SOCKET
-> SO_BINDTODEVICE
.
GetBindToDevice
Get SOL_SOCKET
-> SO_BINDTODEVICE
.
Fields
responder: SocketGetBindToDeviceResponder
SetBindToInterfaceIndex
Set SOL_SOCKET
-> SO_BINDTOIFINDEX
.
If value
is 0, this clears the bound interface.
GetBindToInterfaceIndex
Get SOL_SOCKET
-> SO_BINDTOIFINDEX
.
Fields
responder: SocketGetBindToInterfaceIndexResponder
SetTimestamp
Set SOL_SOCKET
-> SO_TIMESTAMP
or SO_TIMESTAMPNS
.
GetTimestamp
Get SOL_SOCKET
-> SO_TIMESTAMP
or SO_TIMESTAMPNS
.
Fields
responder: SocketGetTimestampResponder
SetMark
Like setting SOL_SOCKET
-> SO_MARK
. The major difference is that
unlike the standard SO_MARK, this API has multiple mark domains and each
mark can be set independently in each domain.
GetMark
Like getting SOL_SOCKET
-> SO_MARK
. The major difference is that
unlike the standard SO_MARK, this API has multiple mark domains and each
mark can be retrieved independently in each domain.
Describe
Fields
responder: SocketDescribeResponder
Bind
Bind the socket to a protocol and/or interface.
- request
protocol
the socket’s new protocol association. - request
bound_interface_id
the socket’s new interface binding.
Fields
protocol: Option<Box<ProtocolAssociation>>
bound_interface_id: BoundInterfaceId
responder: SocketBindResponder
GetInfo
Returns the the socket’s properties.
- response
kind
the socket’sKind
. - response
protocol
the socket’s protocol association, if associated. - response
bound_interface
properties of the socket’s interface binding.
Fields
responder: SocketGetInfoResponder
RecvMsg
Receives a message from the socket.
- request
want_packet_info
request information about the packet to be returned. - request
data_len
the maximum allowed length of the response data buffer. - request
want_control
request ancillary data to be returned. - request
flags
flags for the receive request.
- response
packet_info
information about the packet, if requested. - response
data
the message. - response
control
control messages, if requested. - response
truncated
indicates whether or not the returned message was truncated.
SendMsg
Sends a message on the socket.
- request
packet_info
information about the packet. - request
data
the message. - request
control
ancillary data. - request
flags
flags for the send request.
Fields
packet_info: Option<Box<PacketInfo>>
control: SendControlData
flags: SendMsgFlags
responder: SocketSendMsgResponder
AttachBpfFilterUnsafe
Attaches the specified eBPF filter. The filter is assumed to be verified with 2 arguments
- Pointer to the packet of size 0, i.e. not accessed directly (only using cBPF packet load instructions).
- Packet size (BPF_LOAD). Helper functions and maps are not supported.
Implementations§
Source§impl SocketRequest
impl SocketRequest
pub fn into_clone2( self, ) -> Option<(ServerEnd<CloneableMarker>, SocketControlHandle)>
pub fn into_close(self) -> Option<SocketCloseResponder>
pub fn into_query(self) -> Option<SocketQueryResponder>
pub fn into_set_reuse_address( self, ) -> Option<(bool, SocketSetReuseAddressResponder)>
pub fn into_get_reuse_address(self) -> Option<SocketGetReuseAddressResponder>
pub fn into_get_error(self) -> Option<SocketGetErrorResponder>
pub fn into_set_broadcast(self) -> Option<(bool, SocketSetBroadcastResponder)>
pub fn into_get_broadcast(self) -> Option<SocketGetBroadcastResponder>
pub fn into_set_send_buffer(self) -> Option<(u64, SocketSetSendBufferResponder)>
pub fn into_get_send_buffer(self) -> Option<SocketGetSendBufferResponder>
pub fn into_set_receive_buffer( self, ) -> Option<(u64, SocketSetReceiveBufferResponder)>
pub fn into_get_receive_buffer(self) -> Option<SocketGetReceiveBufferResponder>
pub fn into_set_keep_alive(self) -> Option<(bool, SocketSetKeepAliveResponder)>
pub fn into_get_keep_alive(self) -> Option<SocketGetKeepAliveResponder>
pub fn into_set_out_of_band_inline( self, ) -> Option<(bool, SocketSetOutOfBandInlineResponder)>
pub fn into_get_out_of_band_inline( self, ) -> Option<SocketGetOutOfBandInlineResponder>
pub fn into_set_no_check(self) -> Option<(bool, SocketSetNoCheckResponder)>
pub fn into_get_no_check(self) -> Option<SocketGetNoCheckResponder>
pub fn into_set_linger(self) -> Option<(bool, u32, SocketSetLingerResponder)>
pub fn into_get_linger(self) -> Option<SocketGetLingerResponder>
pub fn into_set_reuse_port(self) -> Option<(bool, SocketSetReusePortResponder)>
pub fn into_get_reuse_port(self) -> Option<SocketGetReusePortResponder>
pub fn into_get_accept_conn(self) -> Option<SocketGetAcceptConnResponder>
pub fn into_set_bind_to_device( self, ) -> Option<(String, SocketSetBindToDeviceResponder)>
pub fn into_get_bind_to_device(self) -> Option<SocketGetBindToDeviceResponder>
pub fn into_set_bind_to_interface_index( self, ) -> Option<(u64, SocketSetBindToInterfaceIndexResponder)>
pub fn into_get_bind_to_interface_index( self, ) -> Option<SocketGetBindToInterfaceIndexResponder>
pub fn into_set_timestamp( self, ) -> Option<(TimestampOption, SocketSetTimestampResponder)>
pub fn into_get_timestamp(self) -> Option<SocketGetTimestampResponder>
pub fn into_set_mark( self, ) -> Option<(MarkDomain, OptionalUint32, SocketSetMarkResponder)>
pub fn into_get_mark(self) -> Option<(MarkDomain, SocketGetMarkResponder)>
pub fn into_describe(self) -> Option<SocketDescribeResponder>
pub fn into_bind( self, ) -> Option<(Option<Box<ProtocolAssociation>>, BoundInterfaceId, SocketBindResponder)>
pub fn into_get_info(self) -> Option<SocketGetInfoResponder>
pub fn into_recv_msg( self, ) -> Option<(bool, u32, bool, RecvMsgFlags, SocketRecvMsgResponder)>
pub fn into_send_msg( self, ) -> Option<(Option<Box<PacketInfo>>, Vec<u8>, SendControlData, SendMsgFlags, SocketSendMsgResponder)>
pub fn into_attach_bpf_filter_unsafe( self, ) -> Option<(Vec<u64>, SocketAttachBpfFilterUnsafeResponder)>
Sourcepub fn method_name(&self) -> &'static str
pub fn method_name(&self) -> &'static str
Name of the method defined in FIDL