blob: 42df624770e88edda0e6a7b2a3f00017abbb02d6 [file] [log] [blame]
// Copyright 2019 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.
//
// GENERATED FILE: Do not edit!
//
// To rebuild this file, invoke third_party/go/regen-fidl.
// +build fuchsia
package mem
import (
_zx "syscall/zx"
_bindings "syscall/zx/fidl"
)
// A buffer for data whose size is not necessarily a multiple of the page
// size.
//
// VMO objects have a physical size that is always a multiple of the page
// size. As such, VMO alone cannot serve as a buffer for arbitrarly sized
// data. `fuchsia.mem.Buffer` is a standard struct that aggregate the VMO
// and its size.
type Buffer struct {
_ struct{} `fidl2:"s,16,8"`
// The vmo that contains the buffer.
Vmo _zx.VMO `fidl:"0" fidl2:"0"`
// The number of bytes in the buffer.
//
// The content of the buffer begin at the start of the VMO and continue
// for `size` bytes. To specify a range of bytes that do not start at
// the beginning of the VMO, use `Range` rather than buffer.
//
// This size must not be greater than the physical size of the VMO.
Size uint64
}
var _mBuffer = _bindings.CreateLazyMarshaler(Buffer{})
func (msg *Buffer) Marshaler() _bindings.Marshaler {
return _mBuffer
}
// A range of bytes within a VMO.
type Range struct {
_ struct{} `fidl2:"s,24,8"`
// The vmo that contains the bytes.
Vmo _zx.VMO `fidl:"0" fidl2:"0"`
// The offset of the first byte within the range relative to the start of
// the VMO.
//
// For example, if `offset` is zero, then the first byte in the range is
// the first byte in the VMO.
Offset uint64
// The number of bytes in the range.
//
// For example, if the offset is 3 and the size is 2, and the VMO starts
// with "abcdefg...", then the range contains "de".
//
// The sum of the offset and the size must not be greater than the
// physical size of the VMO.
Size uint64
}
var _mRange = _bindings.CreateLazyMarshaler(Range{})
func (msg *Range) Marshaler() _bindings.Marshaler {
return _mRange
}
type I_dataTag uint32
const (
Data_unknownData = 0 // 0x00000000
DataBytes = 835814982 // 0x31d18646
DataBuffer = 1925873109 // 0x72ca7dd5
)
// Binary data that might be stored inline or in a VMO.
//
// Useful for performance-sensitive protocols that sometimes receive small
// amounts of binary data (i.e., which is more efficient to provide using
// `bytes`) but also need to support arbitrary amounts of data (i.e., which
// need to be provided out-of-line in a `Buffer`).
type Data struct {
I_dataTag `fidl2:"x,24,8"`
I_unknownData []byte
// The binary data provided inline in the message.
Bytes []uint8 `fidl:"835814982," fidl2:"835814982,"`
// The binary data provided out-of-line in a `Buffer`.
Buffer Buffer `fidl:"1925873109" fidl2:"1925873109"`
}
func (_m *Data) Which() I_dataTag {
switch _m.I_dataTag {
case 835814982:
return DataBytes
case 1925873109:
return DataBuffer
default:
return Data_unknownData
}
}
func (_m *Data) Ordinal() uint32 {
return uint32(_m.I_dataTag)
}
func (_m *Data) SetBytes(bytes []uint8) {
_m.I_dataTag = DataBytes
_m.Bytes = bytes
}
func DataWithBytes(bytes []uint8) Data {
var _u Data
_u.SetBytes(bytes)
return _u
}
func (_m *Data) SetBuffer(buffer Buffer) {
_m.I_dataTag = DataBuffer
_m.Buffer = buffer
}
func DataWithBuffer(buffer Buffer) Data {
var _u Data
_u.SetBuffer(buffer)
return _u
}