| // 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 ethernet |
| |
| import ( |
| _zx "syscall/zx" |
| _bindings "syscall/zx/fidl" |
| ) |
| |
| const ( |
| // Signal that is asserted on the RX fifo whenever the Device has a status |
| // change. This is ZX_USER_SIGNAL_0. |
| SignalStatus uint32 = 16777216 |
| // Max client name length |
| MaxClientNameLen uint32 = 15 |
| // For compatibility with a past revision, allow one extra byte for an optional |
| // null-terminator. |
| SetClientNameMaxLen uint32 = 16 |
| ) |
| |
| var _ _bindings.Bits = Features(0) |
| |
| // Features distinguishes between NICs with different features. |
| type Features uint32 |
| |
| const ( |
| FeaturesWlan Features = 1 |
| FeaturesSynthetic Features = 2 |
| FeaturesLoopback Features = 4 |
| Features_Mask Features = 7 |
| ) |
| |
| func (_ Features) I_BitsMask() Features { |
| return Features_Mask |
| } |
| |
| func (_ Features) I_BitsIsStrict() bool { |
| return true |
| } |
| |
| func (x Features) HasUnknownBits() bool { |
| return x.GetUnknownBits() != 0 |
| } |
| |
| func (x Features) GetUnknownBits() uint64 { |
| return uint64(^Features_Mask & x) |
| } |
| |
| func (x Features) InvertKnownBits() Features { |
| return (^Features_Mask & x) | (Features_Mask & ^x) |
| } |
| |
| // HasBits validates that all flipped bits in the mask are set. |
| func (x Features) HasBits(mask Features) bool { |
| return mask|x == x |
| } |
| |
| // ClearBits ensures all flipped bits in the mask are unset. |
| func (x Features) ClearBits(mask Features) Features { |
| return ^mask & x |
| } |
| |
| func (x Features) String() string { |
| switch x { |
| case 1: |
| return "Wlan" |
| case 2: |
| return "Synthetic" |
| case 4: |
| return "Loopback" |
| } |
| return "Unknown" |
| } |
| |
| var _ _bindings.Bits = DeviceStatus(0) |
| |
| type DeviceStatus uint32 |
| |
| const ( |
| DeviceStatusOnline DeviceStatus = 1 |
| DeviceStatus_Mask DeviceStatus = 1 |
| ) |
| |
| func (_ DeviceStatus) I_BitsMask() DeviceStatus { |
| return DeviceStatus_Mask |
| } |
| |
| func (_ DeviceStatus) I_BitsIsStrict() bool { |
| return true |
| } |
| |
| func (x DeviceStatus) HasUnknownBits() bool { |
| return x.GetUnknownBits() != 0 |
| } |
| |
| func (x DeviceStatus) GetUnknownBits() uint64 { |
| return uint64(^DeviceStatus_Mask & x) |
| } |
| |
| func (x DeviceStatus) InvertKnownBits() DeviceStatus { |
| return (^DeviceStatus_Mask & x) | (DeviceStatus_Mask & ^x) |
| } |
| |
| // HasBits validates that all flipped bits in the mask are set. |
| func (x DeviceStatus) HasBits(mask DeviceStatus) bool { |
| return mask|x == x |
| } |
| |
| // ClearBits ensures all flipped bits in the mask are unset. |
| func (x DeviceStatus) ClearBits(mask DeviceStatus) DeviceStatus { |
| return ^mask & x |
| } |
| |
| func (x DeviceStatus) String() string { |
| switch x { |
| case 1: |
| return "Online" |
| } |
| return "Unknown" |
| } |
| |
| type MacAddress struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"6" fidl_alignment_v1:"1"` |
| Octets [6]uint8 `fidl_offset_v1:"0"` |
| } |
| |
| var _mMacAddress = _bindings.CreateLazyMarshaler(MacAddress{}) |
| |
| func (msg *MacAddress) Marshaler() _bindings.Marshaler { |
| return _mMacAddress |
| } |
| |
| type Info struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"16" fidl_alignment_v1:"4"` |
| Features Features `fidl_offset_v1:"0"` |
| Mtu uint32 `fidl_offset_v1:"4"` |
| Mac MacAddress `fidl_offset_v1:"8"` |
| } |
| |
| var _mInfo = _bindings.CreateLazyMarshaler(Info{}) |
| |
| func (msg *Info) Marshaler() _bindings.Marshaler { |
| return _mInfo |
| } |
| |
| type Fifos struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"16" fidl_alignment_v1:"4"` |
| Rx _zx.Handle `fidl_offset_v1:"0" fidl_handle_subtype:"19" fidl_handle_rights:"2147483648" fidl_bounds:"0"` |
| Tx _zx.Handle `fidl_offset_v1:"4" fidl_handle_subtype:"19" fidl_handle_rights:"2147483648" fidl_bounds:"0"` |
| RxDepth uint32 `fidl_offset_v1:"8"` |
| TxDepth uint32 `fidl_offset_v1:"12"` |
| } |
| |
| var _mFifos = _bindings.CreateLazyMarshaler(Fifos{}) |
| |
| func (msg *Fifos) Marshaler() _bindings.Marshaler { |
| return _mFifos |
| } |
| |
| type deviceWithCtxGetInfoResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"16" fidl_alignment_v1:"8"` |
| Info Info `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxGetInfoResponse = _bindings.CreateLazyMarshaler(deviceWithCtxGetInfoResponse{}) |
| |
| func (msg *deviceWithCtxGetInfoResponse) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxGetInfoResponse |
| } |
| |
| type deviceWithCtxGetFifosResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"16" fidl_alignment_v1:"8"` |
| Status int32 `fidl_offset_v1:"0"` |
| Info *Fifos `fidl_offset_v1:"8"` |
| } |
| |
| var _mdeviceWithCtxGetFifosResponse = _bindings.CreateLazyMarshaler(deviceWithCtxGetFifosResponse{}) |
| |
| func (msg *deviceWithCtxGetFifosResponse) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxGetFifosResponse |
| } |
| |
| type deviceWithCtxSetIoBufferRequest struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| H _zx.VMO `fidl_offset_v1:"0" fidl_handle_subtype:"3" fidl_handle_rights:"2147483648" fidl_bounds:"0"` |
| } |
| |
| var _mdeviceWithCtxSetIoBufferRequest = _bindings.CreateLazyMarshaler(deviceWithCtxSetIoBufferRequest{}) |
| |
| func (msg *deviceWithCtxSetIoBufferRequest) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxSetIoBufferRequest |
| } |
| |
| type deviceWithCtxSetIoBufferResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| Status int32 `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxSetIoBufferResponse = _bindings.CreateLazyMarshaler(deviceWithCtxSetIoBufferResponse{}) |
| |
| func (msg *deviceWithCtxSetIoBufferResponse) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxSetIoBufferResponse |
| } |
| |
| type deviceWithCtxStartResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| Status int32 `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxStartResponse = _bindings.CreateLazyMarshaler(deviceWithCtxStartResponse{}) |
| |
| func (msg *deviceWithCtxStartResponse) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxStartResponse |
| } |
| |
| type deviceWithCtxListenStartResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| Status int32 `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxListenStartResponse = _bindings.CreateLazyMarshaler(deviceWithCtxListenStartResponse{}) |
| |
| func (msg *deviceWithCtxListenStartResponse) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxListenStartResponse |
| } |
| |
| type deviceWithCtxSetClientNameRequest struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"16" fidl_alignment_v1:"8"` |
| Name string `fidl_offset_v1:"0" fidl_bounds:"16"` |
| } |
| |
| var _mdeviceWithCtxSetClientNameRequest = _bindings.CreateLazyMarshaler(deviceWithCtxSetClientNameRequest{}) |
| |
| func (msg *deviceWithCtxSetClientNameRequest) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxSetClientNameRequest |
| } |
| |
| type deviceWithCtxSetClientNameResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| Status int32 `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxSetClientNameResponse = _bindings.CreateLazyMarshaler(deviceWithCtxSetClientNameResponse{}) |
| |
| func (msg *deviceWithCtxSetClientNameResponse) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxSetClientNameResponse |
| } |
| |
| type deviceWithCtxGetStatusResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| DeviceStatus DeviceStatus `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxGetStatusResponse = _bindings.CreateLazyMarshaler(deviceWithCtxGetStatusResponse{}) |
| |
| func (msg *deviceWithCtxGetStatusResponse) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxGetStatusResponse |
| } |
| |
| type deviceWithCtxSetPromiscuousModeRequest struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| Enabled bool `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxSetPromiscuousModeRequest = _bindings.CreateLazyMarshaler(deviceWithCtxSetPromiscuousModeRequest{}) |
| |
| func (msg *deviceWithCtxSetPromiscuousModeRequest) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxSetPromiscuousModeRequest |
| } |
| |
| type deviceWithCtxSetPromiscuousModeResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| Status int32 `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxSetPromiscuousModeResponse = _bindings.CreateLazyMarshaler(deviceWithCtxSetPromiscuousModeResponse{}) |
| |
| func (msg *deviceWithCtxSetPromiscuousModeResponse) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxSetPromiscuousModeResponse |
| } |
| |
| type deviceWithCtxConfigMulticastAddMacRequest struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| Addr MacAddress `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxConfigMulticastAddMacRequest = _bindings.CreateLazyMarshaler(deviceWithCtxConfigMulticastAddMacRequest{}) |
| |
| func (msg *deviceWithCtxConfigMulticastAddMacRequest) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxConfigMulticastAddMacRequest |
| } |
| |
| type deviceWithCtxConfigMulticastAddMacResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| Status int32 `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxConfigMulticastAddMacResponse = _bindings.CreateLazyMarshaler(deviceWithCtxConfigMulticastAddMacResponse{}) |
| |
| func (msg *deviceWithCtxConfigMulticastAddMacResponse) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxConfigMulticastAddMacResponse |
| } |
| |
| type deviceWithCtxConfigMulticastDeleteMacRequest struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| Addr MacAddress `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxConfigMulticastDeleteMacRequest = _bindings.CreateLazyMarshaler(deviceWithCtxConfigMulticastDeleteMacRequest{}) |
| |
| func (msg *deviceWithCtxConfigMulticastDeleteMacRequest) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxConfigMulticastDeleteMacRequest |
| } |
| |
| type deviceWithCtxConfigMulticastDeleteMacResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| Status int32 `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxConfigMulticastDeleteMacResponse = _bindings.CreateLazyMarshaler(deviceWithCtxConfigMulticastDeleteMacResponse{}) |
| |
| func (msg *deviceWithCtxConfigMulticastDeleteMacResponse) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxConfigMulticastDeleteMacResponse |
| } |
| |
| type deviceWithCtxConfigMulticastSetPromiscuousModeRequest struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| Enabled bool `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxConfigMulticastSetPromiscuousModeRequest = _bindings.CreateLazyMarshaler(deviceWithCtxConfigMulticastSetPromiscuousModeRequest{}) |
| |
| func (msg *deviceWithCtxConfigMulticastSetPromiscuousModeRequest) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxConfigMulticastSetPromiscuousModeRequest |
| } |
| |
| type deviceWithCtxConfigMulticastSetPromiscuousModeResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| Status int32 `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxConfigMulticastSetPromiscuousModeResponse = _bindings.CreateLazyMarshaler(deviceWithCtxConfigMulticastSetPromiscuousModeResponse{}) |
| |
| func (msg *deviceWithCtxConfigMulticastSetPromiscuousModeResponse) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxConfigMulticastSetPromiscuousModeResponse |
| } |
| |
| type deviceWithCtxConfigMulticastTestFilterResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| Status int32 `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxConfigMulticastTestFilterResponse = _bindings.CreateLazyMarshaler(deviceWithCtxConfigMulticastTestFilterResponse{}) |
| |
| func (msg *deviceWithCtxConfigMulticastTestFilterResponse) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxConfigMulticastTestFilterResponse |
| } |
| |
| type deviceWithCtxDumpRegistersResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"8" fidl_alignment_v1:"8"` |
| Status int32 `fidl_offset_v1:"0"` |
| } |
| |
| var _mdeviceWithCtxDumpRegistersResponse = _bindings.CreateLazyMarshaler(deviceWithCtxDumpRegistersResponse{}) |
| |
| func (msg *deviceWithCtxDumpRegistersResponse) Marshaler() _bindings.Marshaler { |
| return _mdeviceWithCtxDumpRegistersResponse |
| } |
| |
| const ( |
| DeviceGetInfoOrdinal uint64 = 0x7f8e9a8dda706422 |
| DeviceGetFifosOrdinal uint64 = 0x57924e13bf602360 |
| DeviceSetIoBufferOrdinal uint64 = 0x66af0a45e326fda8 |
| DeviceStartOrdinal uint64 = 0x6e59b9bb7123be35 |
| DeviceStopOrdinal uint64 = 0x4bea699d7725dffb |
| DeviceListenStartOrdinal uint64 = 0x2825d26aac1495d |
| DeviceListenStopOrdinal uint64 = 0x102cbf5639c2403a |
| DeviceSetClientNameOrdinal uint64 = 0x16226cf5bfe3a001 |
| DeviceGetStatusOrdinal uint64 = 0x379a5ed530acd140 |
| DeviceSetPromiscuousModeOrdinal uint64 = 0x6ae9e4516810f945 |
| DeviceConfigMulticastAddMacOrdinal uint64 = 0x5cdb4b0bd52337b8 |
| DeviceConfigMulticastDeleteMacOrdinal uint64 = 0x540f49129d9bfa07 |
| DeviceConfigMulticastSetPromiscuousModeOrdinal uint64 = 0x53d4ba4a14dbe91a |
| DeviceConfigMulticastTestFilterOrdinal uint64 = 0x5a83a0ecc3d952a3 |
| DeviceDumpRegistersOrdinal uint64 = 0x43a8fb0535f81274 |
| ) |
| |
| 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 a pair of fifos for queueing tx and rx operations |
| func (p *DeviceWithCtxInterface) GetFifos(ctx_ _bindings.Context) (int32, *Fifos, error) { |
| var req_ _bindings.Message |
| resp_ := &deviceWithCtxGetFifosResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceGetFifosOrdinal, req_, resp_) |
| return resp_.Status, resp_.Info, err_ |
| } |
| |
| // Set the IO Buffer that will provide the data buffers for tx and rx operations |
| func (p *DeviceWithCtxInterface) SetIoBuffer(ctx_ _bindings.Context, h _zx.VMO) (int32, error) { |
| req_ := &deviceWithCtxSetIoBufferRequest{ |
| H: h, |
| } |
| resp_ := &deviceWithCtxSetIoBufferResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceSetIoBufferOrdinal, req_, resp_) |
| return resp_.Status, err_ |
| } |
| |
| // Start transferring packets |
| // Start will not succeed (ZX_ERR_BAD_STATE) until the fifos have been |
| // obtained and an io buffer vmo has been registered. |
| func (p *DeviceWithCtxInterface) Start(ctx_ _bindings.Context) (int32, error) { |
| var req_ _bindings.Message |
| resp_ := &deviceWithCtxStartResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceStartOrdinal, req_, resp_) |
| return resp_.Status, err_ |
| } |
| |
| // Stop transferring packets |
| func (p *DeviceWithCtxInterface) Stop(ctx_ _bindings.Context) error { |
| var req_ _bindings.Message |
| var resp_ _bindings.Message |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceStopOrdinal, req_, resp_) |
| return err_ |
| } |
| |
| // Start listening to the packets that we're transmitting |
| // as well as the packets we're receiving. |
| func (p *DeviceWithCtxInterface) ListenStart(ctx_ _bindings.Context) (int32, error) { |
| var req_ _bindings.Message |
| resp_ := &deviceWithCtxListenStartResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceListenStartOrdinal, req_, resp_) |
| return resp_.Status, err_ |
| } |
| |
| // Stop listening to the packets that we're transmitting. |
| func (p *DeviceWithCtxInterface) ListenStop(ctx_ _bindings.Context) error { |
| var req_ _bindings.Message |
| var resp_ _bindings.Message |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceListenStopOrdinal, req_, resp_) |
| return err_ |
| } |
| |
| func (p *DeviceWithCtxInterface) SetClientName(ctx_ _bindings.Context, name string) (int32, error) { |
| req_ := &deviceWithCtxSetClientNameRequest{ |
| Name: name, |
| } |
| resp_ := &deviceWithCtxSetClientNameResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceSetClientNameOrdinal, req_, resp_) |
| return resp_.Status, err_ |
| } |
| |
| // Obtain the device status bits |
| // When these change, the signal SIGNAL_STATUS is asserted on the rx fifo. |
| // When these are read, the signal is deasserted. |
| func (p *DeviceWithCtxInterface) GetStatus(ctx_ _bindings.Context) (DeviceStatus, error) { |
| var req_ _bindings.Message |
| resp_ := &deviceWithCtxGetStatusResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceGetStatusOrdinal, req_, resp_) |
| return resp_.DeviceStatus, err_ |
| } |
| |
| func (p *DeviceWithCtxInterface) SetPromiscuousMode(ctx_ _bindings.Context, enabled bool) (int32, error) { |
| req_ := &deviceWithCtxSetPromiscuousModeRequest{ |
| Enabled: enabled, |
| } |
| resp_ := &deviceWithCtxSetPromiscuousModeResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceSetPromiscuousModeOrdinal, req_, resp_) |
| return resp_.Status, err_ |
| } |
| |
| func (p *DeviceWithCtxInterface) ConfigMulticastAddMac(ctx_ _bindings.Context, addr MacAddress) (int32, error) { |
| req_ := &deviceWithCtxConfigMulticastAddMacRequest{ |
| Addr: addr, |
| } |
| resp_ := &deviceWithCtxConfigMulticastAddMacResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceConfigMulticastAddMacOrdinal, req_, resp_) |
| return resp_.Status, err_ |
| } |
| |
| func (p *DeviceWithCtxInterface) ConfigMulticastDeleteMac(ctx_ _bindings.Context, addr MacAddress) (int32, error) { |
| req_ := &deviceWithCtxConfigMulticastDeleteMacRequest{ |
| Addr: addr, |
| } |
| resp_ := &deviceWithCtxConfigMulticastDeleteMacResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceConfigMulticastDeleteMacOrdinal, req_, resp_) |
| return resp_.Status, err_ |
| } |
| |
| func (p *DeviceWithCtxInterface) ConfigMulticastSetPromiscuousMode(ctx_ _bindings.Context, enabled bool) (int32, error) { |
| req_ := &deviceWithCtxConfigMulticastSetPromiscuousModeRequest{ |
| Enabled: enabled, |
| } |
| resp_ := &deviceWithCtxConfigMulticastSetPromiscuousModeResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceConfigMulticastSetPromiscuousModeOrdinal, req_, resp_) |
| return resp_.Status, err_ |
| } |
| |
| func (p *DeviceWithCtxInterface) ConfigMulticastTestFilter(ctx_ _bindings.Context) (int32, error) { |
| var req_ _bindings.Message |
| resp_ := &deviceWithCtxConfigMulticastTestFilterResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceConfigMulticastTestFilterOrdinal, req_, resp_) |
| return resp_.Status, err_ |
| } |
| |
| func (p *DeviceWithCtxInterface) DumpRegisters(ctx_ _bindings.Context) (int32, error) { |
| var req_ _bindings.Message |
| resp_ := &deviceWithCtxDumpRegistersResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(DeviceDumpRegistersOrdinal, req_, resp_) |
| return resp_.Status, err_ |
| } |
| |
| // Operation |
| // |
| // Packets are transmitted by writing data into the IO buffer and writing |
| // a FifoEntry referencing that data (offset + length) into the tx fifo. |
| // When the driver is done accessing the data, a FifoEntry with the same |
| // cookie value (opaque to the driver) will be readable from the tx fifo. |
| // |
| // Packets are received by writing a FifoEntry referencing an available |
| // buffer (offset + length) in the IO buffer. When a packet is received, |
| // a FifoEntry with the same cookie value (opaque to the driver) will be |
| // readable from the rx fifo. The offset field will be the same as was |
| // sent. The length field will reflect the actual size of the received |
| // packet. The flags field will indicate success or a specific failure |
| // condition. |
| // |
| // IMPORTANT: The driver *will not* buffer response messages. It is the |
| // client's responsibility to ensure that there is space in the reply side |
| // of each fifo for each outstanding tx or rx request. The fifo sizes |
| // are returned along with the fifo handles from GetFifos(). |
| // |
| // See //zircon/system/public/zircon/device/ethernet.h for fifo entry layout |
| // and request / response message bits. |
| type DeviceWithCtx interface { |
| // Obtain information about device |
| GetInfo(ctx_ _bindings.Context) (Info, error) |
| // Obtain a pair of fifos for queueing tx and rx operations |
| GetFifos(ctx_ _bindings.Context) (int32, *Fifos, error) |
| // Set the IO Buffer that will provide the data buffers for tx and rx operations |
| SetIoBuffer(ctx_ _bindings.Context, h _zx.VMO) (int32, error) |
| // Start transferring packets |
| // Start will not succeed (ZX_ERR_BAD_STATE) until the fifos have been |
| // obtained and an io buffer vmo has been registered. |
| Start(ctx_ _bindings.Context) (int32, error) |
| // Stop transferring packets |
| Stop(ctx_ _bindings.Context) error |
| // Start listening to the packets that we're transmitting |
| // as well as the packets we're receiving. |
| ListenStart(ctx_ _bindings.Context) (int32, error) |
| // Stop listening to the packets that we're transmitting. |
| ListenStop(ctx_ _bindings.Context) error |
| SetClientName(ctx_ _bindings.Context, name string) (int32, error) |
| // Obtain the device status bits |
| // When these change, the signal SIGNAL_STATUS is asserted on the rx fifo. |
| // When these are read, the signal is deasserted. |
| GetStatus(ctx_ _bindings.Context) (DeviceStatus, error) |
| SetPromiscuousMode(ctx_ _bindings.Context, enabled bool) (int32, error) |
| ConfigMulticastAddMac(ctx_ _bindings.Context, addr MacAddress) (int32, error) |
| ConfigMulticastDeleteMac(ctx_ _bindings.Context, addr MacAddress) (int32, error) |
| ConfigMulticastSetPromiscuousMode(ctx_ _bindings.Context, enabled bool) (int32, error) |
| ConfigMulticastTestFilter(ctx_ _bindings.Context) (int32, error) |
| DumpRegisters(ctx_ _bindings.Context) (int32, error) |
| } |
| |
| type DeviceWithCtxTransitionalBase struct{} |
| |
| type DeviceWithCtxInterfaceRequest _bindings.InterfaceRequest |
| |
| func NewDeviceWithCtxInterfaceRequest() (DeviceWithCtxInterfaceRequest, *DeviceWithCtxInterface, error) { |
| req, cli, err := _bindings.NewInterfaceRequest() |
| return DeviceWithCtxInterfaceRequest(req), (*DeviceWithCtxInterface)(cli), err |
| } |
| |
| 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 DeviceGetFifosOrdinal: |
| status, info, err_ := s_.Impl.GetFifos(args_.Ctx) |
| out_ := deviceWithCtxGetFifosResponse{} |
| out_.Status = status |
| out_.Info = info |
| return &out_, true, err_ |
| case DeviceSetIoBufferOrdinal: |
| in_ := deviceWithCtxSetIoBufferRequest{} |
| 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.SetIoBuffer(args_.Ctx, in_.H) |
| out_ := deviceWithCtxSetIoBufferResponse{} |
| out_.Status = status |
| return &out_, true, err_ |
| case DeviceStartOrdinal: |
| status, err_ := s_.Impl.Start(args_.Ctx) |
| out_ := deviceWithCtxStartResponse{} |
| out_.Status = status |
| return &out_, true, err_ |
| case DeviceStopOrdinal: |
| err_ := s_.Impl.Stop(args_.Ctx) |
| return nil, true, err_ |
| case DeviceListenStartOrdinal: |
| status, err_ := s_.Impl.ListenStart(args_.Ctx) |
| out_ := deviceWithCtxListenStartResponse{} |
| out_.Status = status |
| return &out_, true, err_ |
| case DeviceListenStopOrdinal: |
| err_ := s_.Impl.ListenStop(args_.Ctx) |
| return nil, true, err_ |
| case DeviceSetClientNameOrdinal: |
| in_ := deviceWithCtxSetClientNameRequest{} |
| 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.SetClientName(args_.Ctx, in_.Name) |
| out_ := deviceWithCtxSetClientNameResponse{} |
| out_.Status = status |
| return &out_, true, err_ |
| case DeviceGetStatusOrdinal: |
| deviceStatus, err_ := s_.Impl.GetStatus(args_.Ctx) |
| out_ := deviceWithCtxGetStatusResponse{} |
| out_.DeviceStatus = deviceStatus |
| return &out_, true, err_ |
| case DeviceSetPromiscuousModeOrdinal: |
| in_ := deviceWithCtxSetPromiscuousModeRequest{} |
| 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.SetPromiscuousMode(args_.Ctx, in_.Enabled) |
| out_ := deviceWithCtxSetPromiscuousModeResponse{} |
| out_.Status = status |
| return &out_, true, err_ |
| case DeviceConfigMulticastAddMacOrdinal: |
| in_ := deviceWithCtxConfigMulticastAddMacRequest{} |
| 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.ConfigMulticastAddMac(args_.Ctx, in_.Addr) |
| out_ := deviceWithCtxConfigMulticastAddMacResponse{} |
| out_.Status = status |
| return &out_, true, err_ |
| case DeviceConfigMulticastDeleteMacOrdinal: |
| in_ := deviceWithCtxConfigMulticastDeleteMacRequest{} |
| 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.ConfigMulticastDeleteMac(args_.Ctx, in_.Addr) |
| out_ := deviceWithCtxConfigMulticastDeleteMacResponse{} |
| out_.Status = status |
| return &out_, true, err_ |
| case DeviceConfigMulticastSetPromiscuousModeOrdinal: |
| in_ := deviceWithCtxConfigMulticastSetPromiscuousModeRequest{} |
| 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.ConfigMulticastSetPromiscuousMode(args_.Ctx, in_.Enabled) |
| out_ := deviceWithCtxConfigMulticastSetPromiscuousModeResponse{} |
| out_.Status = status |
| return &out_, true, err_ |
| case DeviceConfigMulticastTestFilterOrdinal: |
| status, err_ := s_.Impl.ConfigMulticastTestFilter(args_.Ctx) |
| out_ := deviceWithCtxConfigMulticastTestFilterResponse{} |
| out_.Status = status |
| return &out_, true, err_ |
| case DeviceDumpRegistersOrdinal: |
| status, err_ := s_.Impl.DumpRegisters(args_.Ctx) |
| out_ := deviceWithCtxDumpRegistersResponse{} |
| out_.Status = status |
| return &out_, true, err_ |
| } |
| return nil, false, _bindings.ErrUnknownOrdinal |
| } |
| |
| type DeviceEventProxy _bindings.ChannelProxy |