blob: 8458db9752def53d9561d2ed8e7673fb4cd906de [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.
library fuchsia.security.codelabsmartdoor;
const TOKEN_ID_SIZE uint8 = 32;
type Token = table {
1: id string:TOKEN_ID_SIZE;
};
@discoverable
protocol Memory {
// Generate a random token that could be used to initialize a reader/writer.
GenerateToken() -> (struct {
token Token;
}) error Error;
// Get a reader to read from smart door memory. The memory must have been
// previously written to using a writer obtained with the same token.
GetReader(resource struct {
token Token;
request server_end:Reader;
}) -> (struct {}) error Error;
// Get a writer to write to smart door memory. The token would be used to
// identify the storage that could be written to.
GetWriter(resource struct {
token Token;
request server_end:Writer;
}) -> (struct {}) error Error;
};
@discoverable
protocol MemoryReset {
// Reset all the smart door memory state. For test purposes.
Reset() -> ();
};
@discoverable
protocol Reader {
// Read all content in the smart door memory.
Read() -> (struct {
bytes bytes:MAX;
}) error Error;
};
@discoverable
protocol Writer {
// Write the bytes into the smart door memory.
// If success, following reads should read the same bytes out.
Write(struct {
bytes bytes:MAX;
}) -> (struct {
bytes_written uint32;
}) error Error;
};