| /* |
| * Copyright © 2019 Google, LLC |
| * |
| * Permission is hereby granted, free of charge, to any person obtaining a |
| * copy of this software and associated documentation files (the "Software"), |
| * to deal in the Software without restriction, including without limitation |
| * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| * and/or sell copies of the Software, and to permit persons to whom the |
| * Software is furnished to do so, subject to the following conditions: |
| * |
| * The above copyright notice and this permission notice (including the next |
| * paragraph) shall be included in all copies or substantial portions of the |
| * Software. |
| * |
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| * IN THE SOFTWARE. |
| */ |
| |
| #ifndef _FUCHSIA_H_ |
| #define _FUCHSIA_H_ |
| |
| #include <stdbool.h> |
| #include <stdio.h> |
| #include <zircon/types.h> |
| #include <lib/syslog/global.h> |
| |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
| |
| #if DEBUG |
| static inline void fuchsia_dlog(const char* msg, ...) { |
| va_list args; |
| va_start(args, msg); |
| FX_LOGVF(INFO, "mesa", msg, args); |
| va_end(args); |
| } |
| #define FUCHSIA_DLOG(...) fuchsia_dlog(__VA_ARGS__) |
| #else |
| #define FUCHSIA_DLOG(...) |
| #endif |
| |
| typedef int (*fuchsia_open_callback_t)(const char* name, zx_handle_t handle); |
| |
| void fuchsia_init(fuchsia_open_callback_t open_callback); |
| |
| // Open a channel to the given namespace element, returns a channel handle |
| // to the backing service. |
| bool fuchsia_open(const char* name, zx_handle_t* channel_out); |
| |
| #ifdef __cplusplus |
| } |
| #endif |
| |
| #endif // _FUCHSIA_H_ |