blob: 7f6a2f4251a13c1bc988f6b0961a97fa31a0dbbd [file] [log] [blame]
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Code generated by third_party/go/regen-fidl; DO NOT EDIT.
package network
import (
_zx "syscall/zx"
_bindings "syscall/zx/fidl"
fuchsianet "syscall/zx/net"
)
const (
// Maximum numbers of supported frame types for rx or tx.
MaxFrameTypes uint32 = 4
// Maximum length of session label.
MaxSessionName uint32 = 64
// Maximum number of acceleration flags.
// Each descriptor has 16 bits of space for acceleration flags
// ([`fuchsia.hardware.network/RxFlags`] and [`fuchsia.hardware.network/TxFlags`]) thus the maximum
// number of reported accelerations is 16. Each descriptor reports which accelerations were applied
// (`RxFlags`) or are requested (`TxFlags`) by mapping indexes in the vector of supported
// accelerations ([`fuchsia.hardware.network/Info.rx_accel`] and
// ([`fuchsia.hardware.network/Info.tx_accel`]) to bits in the respective acceleration flags
// bitfield.
MaxAccelFlags uint32 = 16
// The maximum number of status samples that can be buffered by a
// [`fuchsia.hardware.network/StatusWatcher`].
MaxStatusBuffer uint32 = 50
// Blanket definition for raw frames. Devices that do not perform any sort of parsing of outbound
// traffic should define `FRAME_FEATURES_RAW` in the [`fuchsia.hardware.network/FrameTypeSupport`]
// entry.
FrameFeaturesRaw uint32 = 1
// Maximum number of chained descriptors that describe a single frame.
MaxDescriptorChain uint8 = 4
)
var _ _bindings.Enum = DeviceClass(0)
// Network device class.
// The network device's class is part of its [`fuchsia.hardware.network/Info`] reporting and can be
// used by tools that enumerate network devices to present human-readable types, so it is easier
// for a user to identify the listed devices. The [`fuchsia.hardware.network/Info.class`] value
// does not imply any kind of capabilities or behavior.
type DeviceClass uint16
const (
DeviceClassUnknown DeviceClass = 0
DeviceClassEthernet DeviceClass = 1
DeviceClassWlan DeviceClass = 2
DeviceClassPpp DeviceClass = 3
DeviceClassBridge DeviceClass = 4
)
func (_ DeviceClass) I_EnumValues() []DeviceClass {
return []DeviceClass{
DeviceClassUnknown,
DeviceClassEthernet,
DeviceClassWlan,
DeviceClassPpp,
DeviceClassBridge,
}
}
func (_ DeviceClass) I_EnumIsStrict() bool {
return true
}
func (x DeviceClass) IsUnknown() bool {
switch x {
case 0:
return true
case 1:
return true
case 2:
return true
case 3:
return true
case 4:
return true
default:
return false
}
}
func (x DeviceClass) String() string {
switch x {
case 0:
return "Unknown"
case 1:
return "Ethernet"
case 2:
return "Wlan"
case 3:
return "Ppp"
case 4:
return "Bridge"
}
return "Unknown"
}
var _ _bindings.Enum = FrameType(0)
// Types of frames.
type FrameType uint8
const (
FrameTypeEthernet FrameType = 1
FrameTypeIpv4 FrameType = 2
FrameTypeIpv6 FrameType = 3
)
func (_ FrameType) I_EnumValues() []FrameType {
return []FrameType{
FrameTypeEthernet,
FrameTypeIpv4,
FrameTypeIpv6,
}
}
func (_ FrameType) I_EnumIsStrict() bool {
return true
}
func (x FrameType) IsUnknown() bool {
switch x {
case 1:
return true
case 2:
return true
case 3:
return true
default:
return false
}
}
func (x FrameType) String() string {
switch x {
case 1:
return "Ethernet"
case 2:
return "Ipv4"
case 3:
return "Ipv6"
}
return "Unknown"
}
var _ _bindings.Enum = InfoType(0)
// The type of metadata information appended to a frame, included in the descriptors VMO.
type InfoType uint32
const (
// No extra information is available.
InfoTypeNoInfo InfoType = 0
)
func (_ InfoType) I_EnumValues() []InfoType {
return []InfoType{
InfoTypeNoInfo,
}
}
func (_ InfoType) I_EnumIsStrict() bool {
return true
}
func (x InfoType) IsUnknown() bool {
switch x {
case 0:
return true
default:
return false
}
}
func (x InfoType) String() string {
switch x {
case 0:
return "NoInfo"
}
return "Unknown"
}
var _ _bindings.Enum = RxAcceleration(0)
// Available rx acceleration features. Features are mapped to the `RX_ACCEL_*` bits in descriptors
// by the available values reported in [`fuchsia.hardware.network/Info.rx_accel`].
type RxAcceleration uint8
const (
// Inbound rx frame validated the Ethernet Frame Check Sequence.
RxAccelerationValidatedEthernetFcs RxAcceleration = 0
// Inbound rx frame validated the IPv4 checksum.
RxAccelerationValidatedIpv4Checksum RxAcceleration = 1
// Inbound rx frame validated the TCP checksum.
RxAccelerationValidatedTcpChecksum RxAcceleration = 2
// Inbound rx frame validated the UDP checksum.
RxAccelerationValidatedUdpChecksum RxAcceleration = 3
)
func (_ RxAcceleration) I_EnumValues() []RxAcceleration {
return []RxAcceleration{
RxAccelerationValidatedEthernetFcs,
RxAccelerationValidatedIpv4Checksum,
RxAccelerationValidatedTcpChecksum,
RxAccelerationValidatedUdpChecksum,
}
}
func (_ RxAcceleration) I_EnumIsStrict() bool {
return true
}
func (x RxAcceleration) IsUnknown() bool {
switch x {
case 0:
return true
case 1:
return true
case 2:
return true
case 3:
return true
default:
return false
}
}
func (x RxAcceleration) String() string {
switch x {
case 0:
return "ValidatedEthernetFcs"
case 1:
return "ValidatedIpv4Checksum"
case 2:
return "ValidatedTcpChecksum"
case 3:
return "ValidatedUdpChecksum"
}
return "Unknown"
}
var _ _bindings.Enum = TxAcceleration(0)
// Available tx acceleration features. Features are mapped to the `TX_ACCEL_*` bits in descriptors
// by the available values reported in [`fuchsia.hardware.network/Info.tx_accel`].
type TxAcceleration uint8
const (
// Request that device calculate the Ethernet Frame Check Sequence and write it in place.
TxAccelerationComputeEthernetFcs TxAcceleration = 0
// Request that the device calculate the IPv4 checksum and write it in place.
TxAccelerationComputeIpv4Checksum TxAcceleration = 1
// Request that the device calculate the TCP checksum and write it in place.
TxAccelerationComputeTcpChecksum TxAcceleration = 2
// Request that the device calculate the UDP checksum and write it in place.
TxAccelerationComputeUdpChecksum TxAcceleration = 3
)
func (_ TxAcceleration) I_EnumValues() []TxAcceleration {
return []TxAcceleration{
TxAccelerationComputeEthernetFcs,
TxAccelerationComputeIpv4Checksum,
TxAccelerationComputeTcpChecksum,
TxAccelerationComputeUdpChecksum,
}
}
func (_ TxAcceleration) I_EnumIsStrict() bool {
return true
}
func (x TxAcceleration) IsUnknown() bool {
switch x {
case 0:
return true
case 1:
return true
case 2:
return true
case 3:
return true
default:
return false
}
}
func (x TxAcceleration) String() string {
switch x {
case 0:
return "ComputeEthernetFcs"
case 1:
return "ComputeIpv4Checksum"
case 2:
return "ComputeTcpChecksum"
case 3:
return "ComputeUdpChecksum"
}
return "Unknown"
}
var _ _bindings.Enum = MacFilterMode(0)
// The address filtering mode supported by MAC devices.
type MacFilterMode uint32
const (
// Device accepts only unicast frames addressed to its own unicast address, or multicast frames
// that are part of the multicast address filter list.
MacFilterModeMulticastFilter MacFilterMode = 0
// Device accepts unicast frames addressed to its own unicast address, or any multicast frames.
MacFilterModeMulticastPromiscuous MacFilterMode = 1
// Device accepts all frames.
MacFilterModePromiscuous MacFilterMode = 2
)
func (_ MacFilterMode) I_EnumValues() []MacFilterMode {
return []MacFilterMode{
MacFilterModeMulticastFilter,
MacFilterModeMulticastPromiscuous,
MacFilterModePromiscuous,
}
}
func (_ MacFilterMode) I_EnumIsStrict() bool {
return true
}
func (x MacFilterMode) IsUnknown() bool {
switch x {
case 0:
return true
case 1:
return true
case 2:
return true
default:
return false
}
}
func (x MacFilterMode) String() string {
switch x {
case 0:
return "MulticastFilter"
case 1:
return "MulticastPromiscuous"
case 2:
return "Promiscuous"
}
return "Unknown"
}
var _ _bindings.Bits = StatusFlags(0)
// Device status bits, reported in [`fuchsia.hardware.network/Info`].
type StatusFlags uint32
const (
StatusFlagsOnline StatusFlags = 1
StatusFlags_Mask StatusFlags = 1
)
func (_ StatusFlags) I_BitsMask() StatusFlags {
return StatusFlags_Mask
}
func (_ StatusFlags) I_BitsIsStrict() bool {
return true
}
func (x StatusFlags) HasUnknownBits() bool {
return x.GetUnknownBits() != 0
}
func (x StatusFlags) GetUnknownBits() uint64 {
return uint64(^StatusFlags_Mask & x)
}
func (x StatusFlags) String() string {
switch x {
case 1:
return "Online"
}
return "Unknown"
}
var _ _bindings.Bits = EthernetFeatures(0)
// Ethernet frame sub-types and features.
type EthernetFeatures uint32
const (
EthernetFeaturesRaw EthernetFeatures = 1
EthernetFeaturesEthernetIi EthernetFeatures = 2
EthernetFeaturesE8021Q EthernetFeatures = 4
EthernetFeaturesE8021QInQ EthernetFeatures = 8
EthernetFeaturesE8023LlcSnap EthernetFeatures = 16
EthernetFeatures_Mask EthernetFeatures = 31
)
func (_ EthernetFeatures) I_BitsMask() EthernetFeatures {
return EthernetFeatures_Mask
}
func (_ EthernetFeatures) I_BitsIsStrict() bool {
return true
}
func (x EthernetFeatures) HasUnknownBits() bool {
return x.GetUnknownBits() != 0
}
func (x EthernetFeatures) GetUnknownBits() uint64 {
return uint64(^EthernetFeatures_Mask & x)
}
func (x EthernetFeatures) String() string {
switch x {
case 1:
return "Raw"
case 2:
return "EthernetIi"
case 4:
return "E8021Q"
case 8:
return "E8021QInQ"
case 16:
return "E8023LlcSnap"
}
return "Unknown"
}
var _ _bindings.Bits = RxFlags(0)
// Flags set by a Device when handing a buffer to a client on the rx path. Set by devices on the
// `inbound_flags` field of an rx descriptor.
type RxFlags uint32
const (
RxFlagsRxAccel0 RxFlags = 1
RxFlagsRxAccel1 RxFlags = 2
RxFlagsRxAccel2 RxFlags = 4
RxFlagsRxAccel3 RxFlags = 8
RxFlagsRxAccel4 RxFlags = 16
RxFlagsRxAccel5 RxFlags = 32
RxFlagsRxAccel6 RxFlags = 64
RxFlagsRxAccel7 RxFlags = 128
RxFlagsRxAccel8 RxFlags = 256
RxFlagsRxAccel9 RxFlags = 512
RxFlagsRxAccel10 RxFlags = 1024
RxFlagsRxAccel11 RxFlags = 2048
RxFlagsRxAccel12 RxFlags = 4096
RxFlagsRxAccel13 RxFlags = 8192
RxFlagsRxAccel14 RxFlags = 16384
RxFlagsRxAccel15 RxFlags = 32768
RxFlagsRxOverrun RxFlags = 536870912
RxFlagsRxValidationError RxFlags = 1073741824
RxFlagsRxEchoedTx RxFlags = 2147483648
RxFlags_Mask RxFlags = 3758161919
)
func (_ RxFlags) I_BitsMask() RxFlags {
return RxFlags_Mask
}
func (_ RxFlags) I_BitsIsStrict() bool {
return true
}
func (x RxFlags) HasUnknownBits() bool {
return x.GetUnknownBits() != 0
}
func (x RxFlags) GetUnknownBits() uint64 {
return uint64(^RxFlags_Mask & x)
}
func (x RxFlags) String() string {
switch x {
case 1:
return "RxAccel0"
case 2:
return "RxAccel1"
case 4:
return "RxAccel2"
case 8:
return "RxAccel3"
case 16:
return "RxAccel4"
case 32:
return "RxAccel5"
case 64:
return "RxAccel6"
case 128:
return "RxAccel7"
case 256:
return "RxAccel8"
case 512:
return "RxAccel9"
case 1024:
return "RxAccel10"
case 2048:
return "RxAccel11"
case 4096:
return "RxAccel12"
case 8192:
return "RxAccel13"
case 16384:
return "RxAccel14"
case 32768:
return "RxAccel15"
case 536870912:
return "RxOverrun"
case 1073741824:
return "RxValidationError"
case 2147483648:
return "RxEchoedTx"
}
return "Unknown"
}
var _ _bindings.Bits = TxFlags(0)
// Flags set by a Client when handing a buffer to a client on the tx path. Set by Clients on the
// `inbound_flags` field of a tx descriptor.
type TxFlags uint32
const (
TxFlagsTxAccel0 TxFlags = 1
TxFlagsTxAccel1 TxFlags = 2
TxFlagsTxAccel2 TxFlags = 4
TxFlagsTxAccel3 TxFlags = 8
TxFlagsTxAccel4 TxFlags = 16
TxFlagsTxAccel5 TxFlags = 32
TxFlagsTxAccel6 TxFlags = 64
TxFlagsTxAccel7 TxFlags = 128
TxFlagsTxAccel8 TxFlags = 256
TxFlagsTxAccel9 TxFlags = 512
TxFlagsTxAccel10 TxFlags = 1024
TxFlagsTxAccel11 TxFlags = 2048
TxFlagsTxAccel12 TxFlags = 4096
TxFlagsTxAccel13 TxFlags = 8192
TxFlagsTxAccel14 TxFlags = 16384
TxFlagsTxAccel15 TxFlags = 32768
TxFlags_Mask TxFlags = 65535
)
func (_ TxFlags) I_BitsMask() TxFlags {
return TxFlags_Mask
}
func (_ TxFlags) I_BitsIsStrict() bool {
return true
}
func (x TxFlags) HasUnknownBits() bool {
return x.GetUnknownBits() != 0
}
func (x TxFlags) GetUnknownBits() uint64 {
return uint64(^TxFlags_Mask & x)
}
func (x TxFlags) String() string {
switch x {
case 1:
return "TxAccel0"
case 2:
return "TxAccel1"
case 4:
return "TxAccel2"
case 8:
return "TxAccel3"
case 16:
return "TxAccel4"
case 32:
return "TxAccel5"
case 64:
return "TxAccel6"
case 128:
return "TxAccel7"
case 256:
return "TxAccel8"
case 512:
return "TxAccel9"
case 1024:
return "TxAccel10"
case 2048:
return "TxAccel11"
case 4096:
return "TxAccel12"
case 8192:
return "TxAccel13"
case 16384:
return "TxAccel14"
case 32768:
return "TxAccel15"
}
return "Unknown"
}
var _ _bindings.Bits = TxReturnFlags(0)
// Flags set by a Device when returning a tx buffer back to a client. Set by Devices on the
// `return_flags` field of a tx descriptor.
type TxReturnFlags uint32
const (
TxReturnFlagsTxRetNotSupported TxReturnFlags = 1
TxReturnFlagsTxRetOutOfResources TxReturnFlags = 2
TxReturnFlagsTxRetNotAvailable TxReturnFlags = 4
TxReturnFlagsTxRetError TxReturnFlags = 2147483648
TxReturnFlags_Mask TxReturnFlags = 2147483655
)
func (_ TxReturnFlags) I_BitsMask() TxReturnFlags {
return TxReturnFlags_Mask
}
func (_ TxReturnFlags) I_BitsIsStrict() bool {
return true
}
func (x TxReturnFlags) HasUnknownBits() bool {
return x.GetUnknownBits() != 0
}
func (x TxReturnFlags) GetUnknownBits() uint64 {
return uint64(^TxReturnFlags_Mask & x)
}
func (x TxReturnFlags) String() string {
switch x {
case 1:
return "TxRetNotSupported"
case 2:
return "TxRetOutOfResources"
case 4:
return "TxRetNotAvailable"
case 2147483648:
return "TxRetError"
}
return "Unknown"
}
var _ _bindings.Bits = SessionFlags(0)
// Additional session options.
type SessionFlags uint16
const (
SessionFlagsPrimary SessionFlags = 1
SessionFlagsListenTx SessionFlags = 2
SessionFlagsReportInvalidRx SessionFlags = 4
SessionFlags_Mask SessionFlags = 7
)
func (_ SessionFlags) I_BitsMask() SessionFlags {
return SessionFlags_Mask
}
func (_ SessionFlags) I_BitsIsStrict() bool {
return true
}
func (x SessionFlags) HasUnknownBits() bool {
return x.GetUnknownBits() != 0
}
func (x SessionFlags) GetUnknownBits() uint64 {
return uint64(^SessionFlags_Mask & x)
}
func (x SessionFlags) String() string {
switch x {
case 1:
return "Primary"
case 2:
return "ListenTx"
case 4:
return "ReportInvalidRx"
}
return "Unknown"
}
type DeviceOpenSessionResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"12" fidl_alignment_v1:"4"`
Session SessionWithCtxInterface `fidl_offset_v1:"0" fidl_handle_subtype:"4"`
Fifos Fifos `fidl_offset_v1:"4"`
}
var _mDeviceOpenSessionResponse = _bindings.CreateLazyMarshaler(DeviceOpenSessionResponse{})
func (msg *DeviceOpenSessionResponse) Marshaler() _bindings.Marshaler {
return _mDeviceOpenSessionResponse
}
// Network device information.
type Info struct {
_ struct{} `fidl:"s" fidl_size_v1:"96" fidl_alignment_v1:"8"`
// Device's class, defined in [`fuchsia.hardware.network/DeviceClass`].
Class DeviceClass `fidl_offset_v1:"0"`
// Minimum descriptor length, in 64-bit words.
// Expresses the minimum length that each buffer descriptor must have for correct operation
// with this device. Devices that support extra frame metadata inform larger minimum descriptor
// lengths that reflect the minimum space needed to be able to store frame metadata.
MinDescriptorLength uint8 `fidl_offset_v1:"2"`
// Accepted descriptor version.
DescriptorVersion uint8 `fidl_offset_v1:"3"`
// Maximum number of items in rx FIFO (per session).
// `rx_depth` is calculated based on the size of the actual backing hardware rx queue.
RxDepth uint16 `fidl_offset_v1:"4"`
// Maximum number of items in tx FIFO (per session).
// `tx_depth` is calculated based on the size of the actual backing hardware tx queue.
TxDepth uint16 `fidl_offset_v1:"6"`
// Alignment requirement for buffers in the data VMO. All buffers in the data VMO *must* be
// aligned to `buffer_alignment` relative to the start of the VMO. `buffer_alignment == 0` is
// never reported.
BufferAlignment uint32 `fidl_offset_v1:"8"`
// Maximum supported length of buffers in the data VMO, in bytes.
MaxBufferLength uint32 `fidl_offset_v1:"12"`
// The minimum rx buffer length required for device.
MinRxBufferLength uint32 `fidl_offset_v1:"16"`
// The minimum tx buffer length required for the device.
//
// This value accounts only for tx payload length, `min_tx_buffer_head` and
// `min_tx_buffer_tail` are not part of this value.
//
// Clients must zero pad outgoing frames to meet the required minimum length.
MinTxBufferLength uint32 `fidl_offset_v1:"20"`
// The number of bytes the device requests be free as `head` space in a tx buffer.
MinTxBufferHead uint16 `fidl_offset_v1:"24"`
// The amount of bytes the device requests be free as `tail` space in a tx buffer.
MinTxBufferTail uint16 `fidl_offset_v1:"26"`
// Supported rx frame types on this device.
//
// Clients may open sessions subscribing to a subset of `rx_types` frame types on this device.
// Clients will only receive the frame types they are subscribed to in this session
RxTypes []FrameType `fidl_offset_v1:"32" fidl_bounds:"4"`
// Supported tx frame types on this device.
//
// A client is free to send any frame type on an open session, as long as the frame type is
// part of `tx_types`. Some network devices may need to perform partial frame parsing and
// serialization and, for that reason, `tx_types` is a vector of
// [`fuchsia.hardware.network/FrameTypeSupport`] which includes specific features per frame
// type.
//
// For example, a device that supports Ethernet frames but needs to convert the Ethernet header
// may only support standard EthernetII frames, and not any "raw" Ethernet frame.
TxTypes []FrameTypeSupport `fidl_offset_v1:"48" fidl_bounds:"4"`
// Available rx acceleration flags for this device. `rx_accel` maps the `RX_ACCEL_*` flags in
// the frame descriptors with semantic acceleration features described by
// [`fuchsia.hardware.network/RxAcceleration`]. Position `n` of `rx_accel` conveys the meaning
// of the `RX_ACCEL_n` flag.
RxAccel []RxAcceleration `fidl_offset_v1:"64" fidl_bounds:"16"`
// Available tx acceleration flags for this device. `tx_accel` maps the `TX_ACCEL_*` flags in
// the frame descriptors with semantic acceleration features described by
// [`fuchsia.hardware.network/TxAcceleration]`. Position `n` of `tx_accel` conveys the meaning
// of the `TX_ACCEL_n` flag.
TxAccel []TxAcceleration `fidl_offset_v1:"80" fidl_bounds:"16"`
}
var _mInfo = _bindings.CreateLazyMarshaler(Info{})
func (msg *Info) Marshaler() _bindings.Marshaler {
return _mInfo
}
// Specifies a frame type and features and supported flags associated with that type.
// This is used by clients to read the supported frames on the tx path for a given
// Network Device.
// Some Network Devices may parse outgoing frames to perform frame transformation or specific
// hardware support. Each frame type has an associated
// [`fuchsia.hardware.network/FrameTypeSupport.features`] bits enumeration that lists
// FrameType-specific features that may or may not be supported. Devices that do not perform
// parsing are encouraged to just use the [`fuchsia.hardware.network/FRAME_FEATURES_RAW`] bit in
// `features`, which will inform the client that all frame features are allowed.
type FrameTypeSupport struct {
_ struct{} `fidl:"s" fidl_size_v1:"12" fidl_alignment_v1:"4"`
// The frame type this support entry refers to.
Type FrameType `fidl_offset_v1:"0"`
// The frame type-specific features supported.
Features uint32 `fidl_offset_v1:"4"`
// The flags supported for the given frame type.
SupportedFlags TxFlags `fidl_offset_v1:"8"`
}
var _mFrameTypeSupport = _bindings.CreateLazyMarshaler(FrameTypeSupport{})
func (msg *FrameTypeSupport) Marshaler() _bindings.Marshaler {
return _mFrameTypeSupport
}
// Data-plane FIFOs.
type Fifos struct {
_ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"4"`
// Handle for the rx FIFO.
// Clients must write 16-bit descriptor indexes to this FIFO to be able to receive
// frames.
Rx _zx.Handle `fidl_offset_v1:"0" fidl_handle_subtype:"19" fidl_handle_rights:"2147483648" fidl_bounds:"0"`
// Handle for the tx FIFO.
// Clients write 16-bit descriptor indexes to this FIFO to enqueue outgoing frames.
Tx _zx.Handle `fidl_offset_v1:"4" fidl_handle_subtype:"19" fidl_handle_rights:"2147483648" fidl_bounds:"0"`
}
var _mFifos = _bindings.CreateLazyMarshaler(Fifos{})
func (msg *Fifos) Marshaler() _bindings.Marshaler {
return _mFifos
}
// Session configuration.
type SessionInfo struct {
_ struct{} `fidl:"s" fidl_size_v1:"32" fidl_alignment_v1:"8"`
// VMO containing the descriptors. 16-bit indices transmitted over the FIFOs index a descriptor
// in this VMO (byte offset = descriptor_length * 8 * index).
Descriptors _zx.VMO `fidl_offset_v1:"0" fidl_handle_subtype:"3" fidl_handle_rights:"2147483648" fidl_bounds:"0"`
// VMO containing frame data. Descriptors contain byte-offsets that are used to index
// arbitrary regions in `data`.
Data _zx.VMO `fidl_offset_v1:"4" fidl_handle_subtype:"3" fidl_handle_rights:"2147483648" fidl_bounds:"0"`
// Requested descriptor version. If the network device does not support the requested
// descriptor version, [`fuchsia.hardware.network/Device.OpenSession`] will fail with
// `ZX_ERR_NOT_SUPPORTED`.
DescriptorVersion uint8 `fidl_offset_v1:"8"`
// Descriptor length, in 64-bit words. The length of each descriptor in the `descriptors` VMO.
// This is used as a multiplier to find byte offsets in `descriptors` given a descriptor index
// passed through the rx or tx FIFOs.
DescriptorLength uint8 `fidl_offset_v1:"9"`
// Total number of descriptors that can be used by this session. Descriptor indices transferred
// through either the rx or tx FIFO must be in the range [0, `descriptor_count`).
DescriptorCount uint16 `fidl_offset_v1:"10"`
// Extra options.
Options SessionFlags `fidl_offset_v1:"12"`
// List of frame types the client is subscribing to.
RxFrames []FrameType `fidl_offset_v1:"16" fidl_bounds:"4"`
}
var _mSessionInfo = _bindings.CreateLazyMarshaler(SessionInfo{})
func (msg *SessionInfo) Marshaler() _bindings.Marshaler {
return _mSessionInfo
}
type statusWatcherWithCtxWatchStatusResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"16" fidl_alignment_v1:"8"`
DeviceStatus Status `fidl_offset_v1:"0"`
}
var _mstatusWatcherWithCtxWatchStatusResponse = _bindings.CreateLazyMarshaler(statusWatcherWithCtxWatchStatusResponse{})
func (msg *statusWatcherWithCtxWatchStatusResponse) Marshaler() _bindings.Marshaler {
return _mstatusWatcherWithCtxWatchStatusResponse
}
type deviceWithCtxGetInfoResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"96" fidl_alignment_v1:"8"`
Info Info `fidl_offset_v1:"0"`
}
var _mdeviceWithCtxGetInfoResponse = _bindings.CreateLazyMarshaler(deviceWithCtxGetInfoResponse{})
func (msg *deviceWithCtxGetInfoResponse) Marshaler() _bindings.Marshaler {
return _mdeviceWithCtxGetInfoResponse
}
type deviceWithCtxGetStatusResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"16" fidl_alignment_v1:"8"`
DeviceStatus Status `fidl_offset_v1:"0"`
}
var _mdeviceWithCtxGetStatusResponse = _bindings.CreateLazyMarshaler(deviceWithCtxGetStatusResponse{})
func (msg *deviceWithCtxGetStatusResponse) Marshaler() _bindings.Marshaler {
return _mdeviceWithCtxGetStatusResponse
}
type deviceWithCtxGetStatusWatcherRequest struct {
_ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"`
Watcher StatusWatcherWithCtxInterfaceRequest `fidl_offset_v1:"0" fidl_handle_subtype:"4" fidl_bounds:"0"`
Buffer uint32 `fidl_offset_v1:"4"`
}
var _mdeviceWithCtxGetStatusWatcherRequest = _bindings.CreateLazyMarshaler(deviceWithCtxGetStatusWatcherRequest{})
func (msg *deviceWithCtxGetStatusWatcherRequest) Marshaler() _bindings.Marshaler {
return _mdeviceWithCtxGetStatusWatcherRequest
}
type deviceWithCtxOpenSessionRequest struct {
_ struct{} `fidl:"s" fidl_size_v1:"48" fidl_alignment_v1:"8"`
SessionName string `fidl_offset_v1:"0" fidl_bounds:"64"`
SessionInfo SessionInfo `fidl_offset_v1:"16"`
}
var _mdeviceWithCtxOpenSessionRequest = _bindings.CreateLazyMarshaler(deviceWithCtxOpenSessionRequest{})
func (msg *deviceWithCtxOpenSessionRequest) Marshaler() _bindings.Marshaler {
return _mdeviceWithCtxOpenSessionRequest
}
type deviceWithCtxOpenSessionResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"24" fidl_alignment_v1:"8"`
Result DeviceOpenSessionResult `fidl_offset_v1:"0"`
}
var _mdeviceWithCtxOpenSessionResponse = _bindings.CreateLazyMarshaler(deviceWithCtxOpenSessionResponse{})
func (msg *deviceWithCtxOpenSessionResponse) Marshaler() _bindings.Marshaler {
return _mdeviceWithCtxOpenSessionResponse
}
type deviceInstanceWithCtxGetDeviceRequest struct {
_ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"`
Device DeviceWithCtxInterfaceRequest `fidl_offset_v1:"0" fidl_handle_subtype:"4" fidl_bounds:"0"`
}
var _mdeviceInstanceWithCtxGetDeviceRequest = _bindings.CreateLazyMarshaler(deviceInstanceWithCtxGetDeviceRequest{})
func (msg *deviceInstanceWithCtxGetDeviceRequest) Marshaler() _bindings.Marshaler {
return _mdeviceInstanceWithCtxGetDeviceRequest
}
type deviceInstanceWithCtxGetMacAddressingRequest struct {
_ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"`
Mac MacAddressingWithCtxInterfaceRequest `fidl_offset_v1:"0" fidl_handle_subtype:"4" fidl_bounds:"0"`
}
var _mdeviceInstanceWithCtxGetMacAddressingRequest = _bindings.CreateLazyMarshaler(deviceInstanceWithCtxGetMacAddressingRequest{})
func (msg *deviceInstanceWithCtxGetMacAddressingRequest) Marshaler() _bindings.Marshaler {
return _mdeviceInstanceWithCtxGetMacAddressingRequest
}
type macAddressingWithCtxGetUnicastAddressResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"`
Address fuchsianet.MacAddress `fidl_offset_v1:"0"`
}
var _mmacAddressingWithCtxGetUnicastAddressResponse = _bindings.CreateLazyMarshaler(macAddressingWithCtxGetUnicastAddressResponse{})
func (msg *macAddressingWithCtxGetUnicastAddressResponse) Marshaler() _bindings.Marshaler {
return _mmacAddressingWithCtxGetUnicastAddressResponse
}
type macAddressingWithCtxSetModeRequest struct {
_ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"`
Mode MacFilterMode `fidl_offset_v1:"0"`
}
var _mmacAddressingWithCtxSetModeRequest = _bindings.CreateLazyMarshaler(macAddressingWithCtxSetModeRequest{})
func (msg *macAddressingWithCtxSetModeRequest) Marshaler() _bindings.Marshaler {
return _mmacAddressingWithCtxSetModeRequest
}
type macAddressingWithCtxSetModeResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"`
Status int32 `fidl_offset_v1:"0"`
}
var _mmacAddressingWithCtxSetModeResponse = _bindings.CreateLazyMarshaler(macAddressingWithCtxSetModeResponse{})
func (msg *macAddressingWithCtxSetModeResponse) Marshaler() _bindings.Marshaler {
return _mmacAddressingWithCtxSetModeResponse
}
type macAddressingWithCtxAddMulticastAddressRequest struct {
_ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"`
Address fuchsianet.MacAddress `fidl_offset_v1:"0"`
}
var _mmacAddressingWithCtxAddMulticastAddressRequest = _bindings.CreateLazyMarshaler(macAddressingWithCtxAddMulticastAddressRequest{})
func (msg *macAddressingWithCtxAddMulticastAddressRequest) Marshaler() _bindings.Marshaler {
return _mmacAddressingWithCtxAddMulticastAddressRequest
}
type macAddressingWithCtxAddMulticastAddressResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"`
Status int32 `fidl_offset_v1:"0"`
}
var _mmacAddressingWithCtxAddMulticastAddressResponse = _bindings.CreateLazyMarshaler(macAddressingWithCtxAddMulticastAddressResponse{})
func (msg *macAddressingWithCtxAddMulticastAddressResponse) Marshaler() _bindings.Marshaler {
return _mmacAddressingWithCtxAddMulticastAddressResponse
}
type macAddressingWithCtxRemoveMulticastAddressRequest struct {
_ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"`
Address fuchsianet.MacAddress `fidl_offset_v1:"0"`
}
var _mmacAddressingWithCtxRemoveMulticastAddressRequest = _bindings.CreateLazyMarshaler(macAddressingWithCtxRemoveMulticastAddressRequest{})
func (msg *macAddressingWithCtxRemoveMulticastAddressRequest) Marshaler() _bindings.Marshaler {
return _mmacAddressingWithCtxRemoveMulticastAddressRequest
}
type macAddressingWithCtxRemoveMulticastAddressResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"`
Status int32 `fidl_offset_v1:"0"`
}
var _mmacAddressingWithCtxRemoveMulticastAddressResponse = _bindings.CreateLazyMarshaler(macAddressingWithCtxRemoveMulticastAddressResponse{})
func (msg *macAddressingWithCtxRemoveMulticastAddressResponse) Marshaler() _bindings.Marshaler {
return _mmacAddressingWithCtxRemoveMulticastAddressResponse
}
type sessionWithCtxSetPausedRequest struct {
_ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"`
Paused bool `fidl_offset_v1:"0"`
}
var _msessionWithCtxSetPausedRequest = _bindings.CreateLazyMarshaler(sessionWithCtxSetPausedRequest{})
func (msg *sessionWithCtxSetPausedRequest) Marshaler() _bindings.Marshaler {
return _msessionWithCtxSetPausedRequest
}
type I_deviceOpenSessionResultTag uint64
const (
DeviceOpenSessionResultResponse = 1 // 0x00000001
DeviceOpenSessionResultErr = 2 // 0x00000002
)
type DeviceOpenSessionResult struct {
I_deviceOpenSessionResultTag `fidl:"x!" fidl_size_v1:"24" fidl_alignment_v1:"8"`
Response DeviceOpenSessionResponse `fidl_ordinal:"1"`
Err int32 `fidl_ordinal:"2"`
}
func (_m *DeviceOpenSessionResult) Which() I_deviceOpenSessionResultTag {
return _m.I_deviceOpenSessionResultTag
}
func (_m *DeviceOpenSessionResult) Ordinal() uint64 {
return uint64(_m.I_deviceOpenSessionResultTag)
}
func (_m *DeviceOpenSessionResult) SetResponse(response DeviceOpenSessionResponse) {
_m.I_deviceOpenSessionResultTag = DeviceOpenSessionResultResponse
_m.Response = response
}
func DeviceOpenSessionResultWithResponse(response DeviceOpenSessionResponse) DeviceOpenSessionResult {
var _u DeviceOpenSessionResult
_u.SetResponse(response)
return _u
}
func (_m *DeviceOpenSessionResult) SetErr(err int32) {
_m.I_deviceOpenSessionResultTag = DeviceOpenSessionResultErr
_m.Err = err
}
func DeviceOpenSessionResultWithErr(err int32) DeviceOpenSessionResult {
var _u DeviceOpenSessionResult
_u.SetErr(err)
return _u
}
// Dynamic device information.
type Status struct {
_ struct{} `fidl:"t" fidl_size_v1:"16" fidl_alignment_v1:"8"`
I_unknownData interface{}
// Device status flags.
Flags StatusFlags `fidl_ordinal:"1"`
FlagsPresent bool
// Maximum transmit unit for this device, in bytes. The reported `MTU` is the size of an ENTIRE
// frame, including any header and trailer bytes for whatever protocol the
// [`fuchsia.hardware.network/FrameType`]s of this device support.
Mtu uint32 `fidl_ordinal:"2"`
MtuPresent bool
}
func (u *Status) SetFlags(flags StatusFlags) {
u.Flags = flags
u.FlagsPresent = true
}
func (u *Status) GetFlags() StatusFlags {
return u.Flags
}
func (u *Status) GetFlagsWithDefault(_default StatusFlags) StatusFlags {
if !u.HasFlags() {
return _default
}
return u.Flags
}
func (u *Status) HasFlags() bool {
return u.FlagsPresent
}
func (u *Status) ClearFlags() {
u.FlagsPresent = false
}
func (u *Status) SetMtu(mtu uint32) {
u.Mtu = mtu
u.MtuPresent = true
}
func (u *Status) GetMtu() uint32 {
return u.Mtu
}
func (u *Status) GetMtuWithDefault(_default uint32) uint32 {
if !u.HasMtu() {
return _default
}
return u.Mtu
}
func (u *Status) HasMtu() bool {
return u.MtuPresent
}
func (u *Status) ClearMtu() {
u.MtuPresent = false
}
func (u *Status) HasUnknownData() bool {
return u.I_unknownData != nil
}
func (u *Status) GetUnknownData() map[uint64]_bindings.UnknownData {
return u.I_unknownData.(map[uint64]_bindings.UnknownData)
}
const (
StatusWatcherWatchStatusOrdinal uint64 = 0x1369a8125c0862b9
)
type StatusWatcherWithCtxInterface _bindings.ChannelProxy
// `WatchStatus` will block until the device's status has changed.
// The first call to `WatchStatus` will always return immediately with the current device
// status, subsequent calls will only complete when the device status differs from the last one
// that was returned through this `StatusWatcher`.
// If `StatusWatcher` was created with a buffer value larger than 1, `WatchStatus` may return a
// queued status change, depending on how many status changed happened since the last call to
// `WatchStatus`.
func (p *StatusWatcherWithCtxInterface) WatchStatus(ctx_ _bindings.Context) (Status, error) {
var req_ _bindings.Message
resp_ := &statusWatcherWithCtxWatchStatusResponse{}
err_ := ((*_bindings.ChannelProxy)(p)).Call(StatusWatcherWatchStatusOrdinal, req_, resp_)
return resp_.DeviceStatus, err_
}
// Provides a way to receive updates on device status changes.
type StatusWatcherWithCtx interface {
// `WatchStatus` will block until the device's status has changed.
// The first call to `WatchStatus` will always return immediately with the current device
// status, subsequent calls will only complete when the device status differs from the last one
// that was returned through this `StatusWatcher`.
// If `StatusWatcher` was created with a buffer value larger than 1, `WatchStatus` may return a
// queued status change, depending on how many status changed happened since the last call to
// `WatchStatus`.
WatchStatus(ctx_ _bindings.Context) (Status, error)
}
type StatusWatcherWithCtxTransitionalBase struct{}
type StatusWatcherWithCtxInterfaceRequest _bindings.InterfaceRequest
func NewStatusWatcherWithCtxInterfaceRequest() (StatusWatcherWithCtxInterfaceRequest, *StatusWatcherWithCtxInterface, error) {
req, cli, err := _bindings.NewInterfaceRequest()
return StatusWatcherWithCtxInterfaceRequest(req), (*StatusWatcherWithCtxInterface)(cli), err
}
type StatusWatcherWithCtxStub struct {
Impl StatusWatcherWithCtx
}
func (s_ *StatusWatcherWithCtxStub) Dispatch(args_ _bindings.DispatchArgs) (_bindings.Message, bool, error) {
switch args_.Ordinal {
case StatusWatcherWatchStatusOrdinal:
deviceStatus, err_ := s_.Impl.WatchStatus(args_.Ctx)
out_ := statusWatcherWithCtxWatchStatusResponse{}
out_.DeviceStatus = deviceStatus
return &out_, true, err_
}
return nil, false, _bindings.ErrUnknownOrdinal
}
type StatusWatcherEventProxy _bindings.ChannelProxy
const (
DeviceGetInfoOrdinal uint64 = 0x3c500ca9341e8f56
DeviceGetStatusOrdinal uint64 = 0x3e15c944b7e06ced
DeviceGetStatusWatcherOrdinal uint64 = 0x65079698371e1163
DeviceOpenSessionOrdinal uint64 = 0x25940b82146dcf67
)
type DeviceWithCtxInterface _bindings.ChannelProxy
// Obtain information about device
func (p *DeviceWithCtxInterface) GetInfo(ctx_ _bindings.Context) (Info, error) {
var req_ _bindings.Message
resp_ := &deviceWithCtxGetInfoResponse{}
err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceGetInfoOrdinal, req_, resp_)
return resp_.Info, err_
}
// Obtain the operating device status.
func (p *DeviceWithCtxInterface) GetStatus(ctx_ _bindings.Context) (Status, error) {
var req_ _bindings.Message
resp_ := &deviceWithCtxGetStatusResponse{}
err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceGetStatusOrdinal, req_, resp_)
return resp_.DeviceStatus, err_
}
// Connects to a [`fuchsia.hardware.network/StatusWatcher`] to observe device status changes.
//
// `buffer` is the number of status changes that the client requests to be stored by
// `StatusWatcher`, limited to [`fuchsia.hardware.network/MAX_STATUS_BUFFER`]. A value of 0 or
// 1 will cause the `StatusWatcher` to not keep any buffers on status changed. Clients that
// need to observe all changes to status (as opposed to only the current state) are encouraged
// to set a buffer value larger than 1, so that all edges can be observed. If `StatusWatcher`'s
// internal queue is filled and new status changes occur, the oldest samples will be dropped to
// make room for new ones.
func (p *DeviceWithCtxInterface) GetStatusWatcher(ctx_ _bindings.Context, watcher StatusWatcherWithCtxInterfaceRequest, buffer uint32) error {
req_ := &deviceWithCtxGetStatusWatcherRequest{
Watcher: watcher,
Buffer: buffer,
}
err_ := ((*_bindings.ChannelProxy)(p)).Send(DeviceGetStatusWatcherOrdinal, req_)
return err_
}
// Opens a new session with the network device.
// `session_name` is used only as a debug label.
// `session_info` contains the necessary information to setup the session's data exchange.
func (p *DeviceWithCtxInterface) OpenSession(ctx_ _bindings.Context, sessionName string, sessionInfo SessionInfo) (DeviceOpenSessionResult, error) {
req_ := &deviceWithCtxOpenSessionRequest{
SessionName: sessionName,
SessionInfo: sessionInfo,
}
resp_ := &deviceWithCtxOpenSessionResponse{}
err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceOpenSessionOrdinal, req_, resp_)
return resp_.Result, err_
}
// A Network Device.
type DeviceWithCtx interface {
// Obtain information about device
GetInfo(ctx_ _bindings.Context) (Info, error)
// Obtain the operating device status.
GetStatus(ctx_ _bindings.Context) (Status, error)
// Connects to a [`fuchsia.hardware.network/StatusWatcher`] to observe device status changes.
//
// `buffer` is the number of status changes that the client requests to be stored by
// `StatusWatcher`, limited to [`fuchsia.hardware.network/MAX_STATUS_BUFFER`]. A value of 0 or
// 1 will cause the `StatusWatcher` to not keep any buffers on status changed. Clients that
// need to observe all changes to status (as opposed to only the current state) are encouraged
// to set a buffer value larger than 1, so that all edges can be observed. If `StatusWatcher`'s
// internal queue is filled and new status changes occur, the oldest samples will be dropped to
// make room for new ones.
GetStatusWatcher(ctx_ _bindings.Context, watcher StatusWatcherWithCtxInterfaceRequest, buffer uint32) error
// Opens a new session with the network device.
// `session_name` is used only as a debug label.
// `session_info` contains the necessary information to setup the session's data exchange.
OpenSession(ctx_ _bindings.Context, sessionName string, sessionInfo SessionInfo) (DeviceOpenSessionResult, error)
}
type DeviceWithCtxTransitionalBase struct{}
type DeviceWithCtxInterfaceRequest _bindings.InterfaceRequest
func NewDeviceWithCtxInterfaceRequest() (DeviceWithCtxInterfaceRequest, *DeviceWithCtxInterface, error) {
req, cli, err := _bindings.NewInterfaceRequest()
return DeviceWithCtxInterfaceRequest(req), (*DeviceWithCtxInterface)(cli), err
}
// Implements ServiceRequest.
func (_ DeviceWithCtxInterfaceRequest) Name() string {
return "fuchsia.hardware.network.Device"
}
func (c DeviceWithCtxInterfaceRequest) ToChannel() _zx.Channel {
return c.Channel
}
const DeviceName = "fuchsia.hardware.network.Device"
type DeviceWithCtxStub struct {
Impl DeviceWithCtx
}
func (s_ *DeviceWithCtxStub) Dispatch(args_ _bindings.DispatchArgs) (_bindings.Message, bool, error) {
switch args_.Ordinal {
case DeviceGetInfoOrdinal:
info, err_ := s_.Impl.GetInfo(args_.Ctx)
out_ := deviceWithCtxGetInfoResponse{}
out_.Info = info
return &out_, true, err_
case DeviceGetStatusOrdinal:
deviceStatus, err_ := s_.Impl.GetStatus(args_.Ctx)
out_ := deviceWithCtxGetStatusResponse{}
out_.DeviceStatus = deviceStatus
return &out_, true, err_
case DeviceGetStatusWatcherOrdinal:
in_ := deviceWithCtxGetStatusWatcherRequest{}
marshalerCtx, ok := _bindings.GetMarshalerContext(args_.Ctx)
if !ok {
return nil, false, _bindings.ErrMissingMarshalerContext
}
if _, _, err_ := _bindings.UnmarshalWithContext2(marshalerCtx, args_.Bytes, args_.HandleInfos, &in_); err_ != nil {
return nil, false, err_
}
err_ := s_.Impl.GetStatusWatcher(args_.Ctx, in_.Watcher, in_.Buffer)
return nil, false, err_
case DeviceOpenSessionOrdinal:
in_ := deviceWithCtxOpenSessionRequest{}
marshalerCtx, ok := _bindings.GetMarshalerContext(args_.Ctx)
if !ok {
return nil, false, _bindings.ErrMissingMarshalerContext
}
if _, _, err_ := _bindings.UnmarshalWithContext2(marshalerCtx, args_.Bytes, args_.HandleInfos, &in_); err_ != nil {
return nil, false, err_
}
result, err_ := s_.Impl.OpenSession(args_.Ctx, in_.SessionName, in_.SessionInfo)
out_ := deviceWithCtxOpenSessionResponse{}
out_.Result = result
return &out_, true, err_
}
return nil, false, _bindings.ErrUnknownOrdinal
}
type DeviceEventProxy _bindings.ChannelProxy
const (
DeviceInstanceGetDeviceOrdinal uint64 = 0x775270585575cef7
DeviceInstanceGetMacAddressingOrdinal uint64 = 0x545e6ef5d5737c62
)
type DeviceInstanceWithCtxInterface _bindings.ChannelProxy
// Connects to the [`fuchsia.hardware.network/Device`] implementation, giving access to
// data-plane features.
func (p *DeviceInstanceWithCtxInterface) GetDevice(ctx_ _bindings.Context, device DeviceWithCtxInterfaceRequest) error {
req_ := &deviceInstanceWithCtxGetDeviceRequest{
Device: device,
}
err_ := ((*_bindings.ChannelProxy)(p)).Send(DeviceInstanceGetDeviceOrdinal, req_)
return err_
}
// Connects to the [`fuchsia.hardware.network/MacAddressing`] implementation, giving access to
// MAC filtering control. `DeviceInstance`s that do not support `MacAddressing` will have the
// request immediately closed.
func (p *DeviceInstanceWithCtxInterface) GetMacAddressing(ctx_ _bindings.Context, mac MacAddressingWithCtxInterfaceRequest) error {
req_ := &deviceInstanceWithCtxGetMacAddressingRequest{
Mac: mac,
}
err_ := ((*_bindings.ChannelProxy)(p)).Send(DeviceInstanceGetMacAddressingOrdinal, req_)
return err_
}
// An instance of a network device that may be capable of MAC address filtering.
type DeviceInstanceWithCtx interface {
// Connects to the [`fuchsia.hardware.network/Device`] implementation, giving access to
// data-plane features.
GetDevice(ctx_ _bindings.Context, device DeviceWithCtxInterfaceRequest) error
// Connects to the [`fuchsia.hardware.network/MacAddressing`] implementation, giving access to
// MAC filtering control. `DeviceInstance`s that do not support `MacAddressing` will have the
// request immediately closed.
GetMacAddressing(ctx_ _bindings.Context, mac MacAddressingWithCtxInterfaceRequest) error
}
type DeviceInstanceWithCtxTransitionalBase struct{}
type DeviceInstanceWithCtxInterfaceRequest _bindings.InterfaceRequest
func NewDeviceInstanceWithCtxInterfaceRequest() (DeviceInstanceWithCtxInterfaceRequest, *DeviceInstanceWithCtxInterface, error) {
req, cli, err := _bindings.NewInterfaceRequest()
return DeviceInstanceWithCtxInterfaceRequest(req), (*DeviceInstanceWithCtxInterface)(cli), err
}
type DeviceInstanceWithCtxStub struct {
Impl DeviceInstanceWithCtx
}
func (s_ *DeviceInstanceWithCtxStub) Dispatch(args_ _bindings.DispatchArgs) (_bindings.Message, bool, error) {
switch args_.Ordinal {
case DeviceInstanceGetDeviceOrdinal:
in_ := deviceInstanceWithCtxGetDeviceRequest{}
marshalerCtx, ok := _bindings.GetMarshalerContext(args_.Ctx)
if !ok {
return nil, false, _bindings.ErrMissingMarshalerContext
}
if _, _, err_ := _bindings.UnmarshalWithContext2(marshalerCtx, args_.Bytes, args_.HandleInfos, &in_); err_ != nil {
return nil, false, err_
}
err_ := s_.Impl.GetDevice(args_.Ctx, in_.Device)
return nil, false, err_
case DeviceInstanceGetMacAddressingOrdinal:
in_ := deviceInstanceWithCtxGetMacAddressingRequest{}
marshalerCtx, ok := _bindings.GetMarshalerContext(args_.Ctx)
if !ok {
return nil, false, _bindings.ErrMissingMarshalerContext
}
if _, _, err_ := _bindings.UnmarshalWithContext2(marshalerCtx, args_.Bytes, args_.HandleInfos, &in_); err_ != nil {
return nil, false, err_
}
err_ := s_.Impl.GetMacAddressing(args_.Ctx, in_.Mac)
return nil, false, err_
}
return nil, false, _bindings.ErrUnknownOrdinal
}
type DeviceInstanceEventProxy _bindings.ChannelProxy
const (
MacAddressingGetUnicastAddressOrdinal uint64 = 0x2c60b82a4ecfaebe
MacAddressingSetModeOrdinal uint64 = 0x6297b8dbf03c58c
MacAddressingAddMulticastAddressOrdinal uint64 = 0xf5637ff11cf0c25
MacAddressingRemoveMulticastAddressOrdinal uint64 = 0x5dddf4e3ba4e2560
)
type MacAddressingWithCtxInterface _bindings.ChannelProxy
// Gets the Device's current unicast MAC address.
// Implementers of this API do not need to return a uniquely identifiable MAC; the unicast
// address returned is the one that is *currently* in use to filter unicast frames, or that
// identifies the device on a link it's *currently* on. Users of this API must not rely on the
// stability or uniqueness of the returned value to identify or disambiguate device instances.
func (p *MacAddressingWithCtxInterface) GetUnicastAddress(ctx_ _bindings.Context) (fuchsianet.MacAddress, error) {
var req_ _bindings.Message
resp_ := &macAddressingWithCtxGetUnicastAddressResponse{}
err_ := ((*_bindings.ChannelProxy)(p)).Call(MacAddressingGetUnicastAddressOrdinal, req_, resp_)
return resp_.Address, err_
}
// Sets requested operating mode of this device to `mode`.
//
// The requested mode is attached to the current client connection to the device. Because
// multiple clients can be attached to the same device at once, the mode with the least
// restrictions will be the one actively put into effect into the underlying device
// implementation.
//
// If the device does not support the requested mode, but supports a mode that is more open
// than the requested one, `SetMode` will succeed regardless. Otherwise, if the device only
// supports *more restrictive* modes than the one requested, `SetMode` returns
// `ZX_ERR_NOT_SUPPORTED`.
//
// Clients must be aware that the resource being accessed is shared, and that the device may be
// effectively operating at a more open level than the one that was requested (although never
// at one more restrictive).
func (p *MacAddressingWithCtxInterface) SetMode(ctx_ _bindings.Context, mode MacFilterMode) (int32, error) {
req_ := &macAddressingWithCtxSetModeRequest{
Mode: mode,
}
resp_ := &macAddressingWithCtxSetModeResponse{}
err_ := ((*_bindings.ChannelProxy)(p)).Call(MacAddressingSetModeOrdinal, req_, resp_)
return resp_.Status, err_
}
// Adds multicast address to the list of multicast groups.
//
// The list of multicast addresses kept is untouched by calls to `SetMode`. If the device's
// mode is not `MULTICAST_FILTER`, the list of multicast addresses is ignored.
//
// Returns `ZX_ERR_INVALID_ARGS` if the provided `address` is not a multicast address.
func (p *MacAddressingWithCtxInterface) AddMulticastAddress(ctx_ _bindings.Context, address fuchsianet.MacAddress) (int32, error) {
req_ := &macAddressingWithCtxAddMulticastAddressRequest{
Address: address,
}
resp_ := &macAddressingWithCtxAddMulticastAddressResponse{}
err_ := ((*_bindings.ChannelProxy)(p)).Call(MacAddressingAddMulticastAddressOrdinal, req_, resp_)
return resp_.Status, err_
}
// Removes multicast address from the list of multicast groups.
//
// Returns `ZX_ERR_INVALID_ARGS` if the provided `address` is not a multicast address.
func (p *MacAddressingWithCtxInterface) RemoveMulticastAddress(ctx_ _bindings.Context, address fuchsianet.MacAddress) (int32, error) {
req_ := &macAddressingWithCtxRemoveMulticastAddressRequest{
Address: address,
}
resp_ := &macAddressingWithCtxRemoveMulticastAddressResponse{}
err_ := ((*_bindings.ChannelProxy)(p)).Call(MacAddressingRemoveMulticastAddressOrdinal, req_, resp_)
return resp_.Status, err_
}
type MacAddressingWithCtx interface {
// Gets the Device's current unicast MAC address.
// Implementers of this API do not need to return a uniquely identifiable MAC; the unicast
// address returned is the one that is *currently* in use to filter unicast frames, or that
// identifies the device on a link it's *currently* on. Users of this API must not rely on the
// stability or uniqueness of the returned value to identify or disambiguate device instances.
GetUnicastAddress(ctx_ _bindings.Context) (fuchsianet.MacAddress, error)
// Sets requested operating mode of this device to `mode`.
//
// The requested mode is attached to the current client connection to the device. Because
// multiple clients can be attached to the same device at once, the mode with the least
// restrictions will be the one actively put into effect into the underlying device
// implementation.
//
// If the device does not support the requested mode, but supports a mode that is more open
// than the requested one, `SetMode` will succeed regardless. Otherwise, if the device only
// supports *more restrictive* modes than the one requested, `SetMode` returns
// `ZX_ERR_NOT_SUPPORTED`.
//
// Clients must be aware that the resource being accessed is shared, and that the device may be
// effectively operating at a more open level than the one that was requested (although never
// at one more restrictive).
SetMode(ctx_ _bindings.Context, mode MacFilterMode) (int32, error)
// Adds multicast address to the list of multicast groups.
//
// The list of multicast addresses kept is untouched by calls to `SetMode`. If the device's
// mode is not `MULTICAST_FILTER`, the list of multicast addresses is ignored.
//
// Returns `ZX_ERR_INVALID_ARGS` if the provided `address` is not a multicast address.
AddMulticastAddress(ctx_ _bindings.Context, address fuchsianet.MacAddress) (int32, error)
// Removes multicast address from the list of multicast groups.
//
// Returns `ZX_ERR_INVALID_ARGS` if the provided `address` is not a multicast address.
RemoveMulticastAddress(ctx_ _bindings.Context, address fuchsianet.MacAddress) (int32, error)
}
type MacAddressingWithCtxTransitionalBase struct{}
type MacAddressingWithCtxInterfaceRequest _bindings.InterfaceRequest
func NewMacAddressingWithCtxInterfaceRequest() (MacAddressingWithCtxInterfaceRequest, *MacAddressingWithCtxInterface, error) {
req, cli, err := _bindings.NewInterfaceRequest()
return MacAddressingWithCtxInterfaceRequest(req), (*MacAddressingWithCtxInterface)(cli), err
}
// Implements ServiceRequest.
func (_ MacAddressingWithCtxInterfaceRequest) Name() string {
return "fuchsia.hardware.network.MacAddressing"
}
func (c MacAddressingWithCtxInterfaceRequest) ToChannel() _zx.Channel {
return c.Channel
}
const MacAddressingName = "fuchsia.hardware.network.MacAddressing"
type MacAddressingWithCtxStub struct {
Impl MacAddressingWithCtx
}
func (s_ *MacAddressingWithCtxStub) Dispatch(args_ _bindings.DispatchArgs) (_bindings.Message, bool, error) {
switch args_.Ordinal {
case MacAddressingGetUnicastAddressOrdinal:
address, err_ := s_.Impl.GetUnicastAddress(args_.Ctx)
out_ := macAddressingWithCtxGetUnicastAddressResponse{}
out_.Address = address
return &out_, true, err_
case MacAddressingSetModeOrdinal:
in_ := macAddressingWithCtxSetModeRequest{}
marshalerCtx, ok := _bindings.GetMarshalerContext(args_.Ctx)
if !ok {
return nil, false, _bindings.ErrMissingMarshalerContext
}
if _, _, err_ := _bindings.UnmarshalWithContext2(marshalerCtx, args_.Bytes, args_.HandleInfos, &in_); err_ != nil {
return nil, false, err_
}
status, err_ := s_.Impl.SetMode(args_.Ctx, in_.Mode)
out_ := macAddressingWithCtxSetModeResponse{}
out_.Status = status
return &out_, true, err_
case MacAddressingAddMulticastAddressOrdinal:
in_ := macAddressingWithCtxAddMulticastAddressRequest{}
marshalerCtx, ok := _bindings.GetMarshalerContext(args_.Ctx)
if !ok {
return nil, false, _bindings.ErrMissingMarshalerContext
}
if _, _, err_ := _bindings.UnmarshalWithContext2(marshalerCtx, args_.Bytes, args_.HandleInfos, &in_); err_ != nil {
return nil, false, err_
}
status, err_ := s_.Impl.AddMulticastAddress(args_.Ctx, in_.Address)
out_ := macAddressingWithCtxAddMulticastAddressResponse{}
out_.Status = status
return &out_, true, err_
case MacAddressingRemoveMulticastAddressOrdinal:
in_ := macAddressingWithCtxRemoveMulticastAddressRequest{}
marshalerCtx, ok := _bindings.GetMarshalerContext(args_.Ctx)
if !ok {
return nil, false, _bindings.ErrMissingMarshalerContext
}
if _, _, err_ := _bindings.UnmarshalWithContext2(marshalerCtx, args_.Bytes, args_.HandleInfos, &in_); err_ != nil {
return nil, false, err_
}
status, err_ := s_.Impl.RemoveMulticastAddress(args_.Ctx, in_.Address)
out_ := macAddressingWithCtxRemoveMulticastAddressResponse{}
out_.Status = status
return &out_, true, err_
}
return nil, false, _bindings.ErrUnknownOrdinal
}
type MacAddressingEventProxy _bindings.ChannelProxy
const (
SessionSetPausedOrdinal uint64 = 0x463e604fa765a658
SessionCloseOrdinal uint64 = 0x393d5070394a92f6
)
type SessionWithCtxInterface _bindings.ChannelProxy
// Pauses or unpauses reception of frames on this session.
func (p *SessionWithCtxInterface) SetPaused(ctx_ _bindings.Context, paused bool) error {
req_ := &sessionWithCtxSetPausedRequest{
Paused: paused,
}
err_ := ((*_bindings.ChannelProxy)(p)).Send(SessionSetPausedOrdinal, req_)
return err_
}
// Cleanly closes a session. This will cause the session to send a `ZX_ERR_CANCELLED` epitaph
// and proceed to close the Session channel. Clients may only assume that they own all the
// buffers that are currently owned by the session (sent over either the rx or tx FIFOs) once
// the epitaph is received. Closing the rx or tx FIFO is equivalent to calling `Close`.
func (p *SessionWithCtxInterface) Close(ctx_ _bindings.Context) error {
var req_ _bindings.Message
err_ := ((*_bindings.ChannelProxy)(p)).Send(SessionCloseOrdinal, req_)
return err_
}
// Represents a session with a Network device.
//
// A session has a data plane and a control plane. The `Session` protocol represents the control
// plane of the session and the FIFOs and VMOs exchanged during the
// [`fuchsia.hardware.network/Device.OpenSession`] call are the data plane. Lifetime of the session
// is controlled by a `Session` protocol handle. Sessions are always created in a paused state.
//
// The session will be closed with an error epitaph if an invalid buffer descriptor is sent over
// either the tx or rx FIFOs. Invalid descriptors include:
// - Descriptor index larger than [`fuchsia.hardware.network/SessionInfo.descriptor_count`].
// - Descriptor chains larger than [`fuchsia.hardware.network/MAX_DESCRIPTOR_CHAIN`].
// - rx buffers smaller than [`fuchsia.hardware.network/Info.min_rx_buffer_length`].
// - tx buffers smaller than [`fuchsia.hardware.network/Info.min_tx_buffer_length`].
// - tx buffers not respecting [`fuchsia.hardware.network/Info.min_tx_buffer_head`] or
// [`fuchsia.hardware.network/Info.min_tx_buffer_tail`].
type SessionWithCtx interface {
// Pauses or unpauses reception of frames on this session.
SetPaused(ctx_ _bindings.Context, paused bool) error
// Cleanly closes a session. This will cause the session to send a `ZX_ERR_CANCELLED` epitaph
// and proceed to close the Session channel. Clients may only assume that they own all the
// buffers that are currently owned by the session (sent over either the rx or tx FIFOs) once
// the epitaph is received. Closing the rx or tx FIFO is equivalent to calling `Close`.
Close(ctx_ _bindings.Context) error
}
type SessionWithCtxTransitionalBase struct{}
type SessionWithCtxInterfaceRequest _bindings.InterfaceRequest
func NewSessionWithCtxInterfaceRequest() (SessionWithCtxInterfaceRequest, *SessionWithCtxInterface, error) {
req, cli, err := _bindings.NewInterfaceRequest()
return SessionWithCtxInterfaceRequest(req), (*SessionWithCtxInterface)(cli), err
}
type SessionWithCtxStub struct {
Impl SessionWithCtx
}
func (s_ *SessionWithCtxStub) Dispatch(args_ _bindings.DispatchArgs) (_bindings.Message, bool, error) {
switch args_.Ordinal {
case SessionSetPausedOrdinal:
in_ := sessionWithCtxSetPausedRequest{}
marshalerCtx, ok := _bindings.GetMarshalerContext(args_.Ctx)
if !ok {
return nil, false, _bindings.ErrMissingMarshalerContext
}
if _, _, err_ := _bindings.UnmarshalWithContext2(marshalerCtx, args_.Bytes, args_.HandleInfos, &in_); err_ != nil {
return nil, false, err_
}
err_ := s_.Impl.SetPaused(args_.Ctx, in_.Paused)
return nil, false, err_
case SessionCloseOrdinal:
err_ := s_.Impl.Close(args_.Ctx)
return nil, false, err_
}
return nil, false, _bindings.ErrUnknownOrdinal
}
type SessionEventProxy _bindings.ChannelProxy