| // Copyright 2017 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. |
| |
| #pragma once |
| |
| #include "private.h" |
| |
| typedef struct zxrio zxrio_t; |
| struct zxrio { |
| // base fdio io object |
| fdio_t io; |
| |
| // channel handle for rpc |
| zx_handle_t h; |
| |
| // event handle for device state signals, or socket handle |
| zx_handle_t h2; |
| |
| // transaction id used for synchronous remoteio calls |
| _Atomic zx_txid_t txid; |
| }; |
| |
| // These are for the benefit of namespace.c |
| // which needs lower level access to remoteio internals |
| |
| // open operation directly on remoteio handle |
| zx_status_t zxrio_open_handle(zx_handle_t h, const char* path, int32_t flags, |
| uint32_t mode, fdio_t** out); |
| |
| // open operation directly on remoteio handle |
| // returns new remoteio handle on success |
| // fails and discards non-REMOTE protocols |
| zx_status_t zxrio_open_handle_raw(zx_handle_t h, const char* path, int32_t flags, |
| uint32_t mode, zx_handle_t *out); |
| |
| // open operation directly on remoteio fdio_t |
| zx_status_t zxrio_open(fdio_t* io, const char* path, int32_t flags, |
| uint32_t mode, fdio_t** out); |
| |
| // misc operation directly on remoteio fdio_t |
| zx_status_t zxrio_misc(fdio_t* io, uint32_t op, int64_t off, |
| uint32_t maxreply, void* ptr, size_t len); |
| |
| |
| // Shared with remotesocket.c |
| |
| zx_status_t zxrio_close(fdio_t* io); |
| |
| ssize_t zxrio_ioctl(fdio_t* io, uint32_t op, const void* in_buf, |
| size_t in_len, void* out_buf, size_t out_len); |
| |
| zx_status_t zxrio_getobject(zx_handle_t rio_h, uint32_t op, const char* name, |
| int32_t flags, uint32_t mode, |
| zxrio_object_t* info); |