blob: 529cb3724045d4b745fc3eb3b235d89f3bb3d3f8 [file] [log] [blame]
// Copyright 2016 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.
using zx;
// Reader with seek semantics.
// TODO(dalesat): Report problems using Problem rather than SeekingReaderResult.
protocol SeekingReader {
// Describes the content. If there’s a problem accessing the content, this
// is expressed by using result. The size_in_bytes may be reported as
// UNKNOWN_SIZE if the size of the content is unknown.
Describe() -> (struct {
status zx.status;
size uint64;
can_seek bool;
// Reads the content. If there’s a problem performing the read, this is
// expressed using result. If the read succeeded, the reply must contain a
// valid socket from which the content can be read.
ReadAt(struct {
position uint64;
}) -> (resource struct {
status zx.status;
socket zx.handle:<SOCKET, optional>;
/// Distinguished value for the `size` value returned by `SeekingReader.Describe`
/// Indicating that the size isn't known.
const UNKNOWN_SIZE uint64 = 0xffffffffffffffff;