| // 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. |
| library banjo.examples.protocolhandle; |
| |
| // TODO(surajmalhotra): Reference for handles. |
| |
| using zx; |
| |
| @transport("Banjo") |
| @banjo_layout("ddk-protocol") |
| protocol SynchronousHandle { |
| Handle(resource struct { |
| h zx.handle; |
| }) -> (resource struct { |
| h zx.handle; |
| h2 zx.handle; |
| }); |
| Process(resource struct { |
| h zx.handle:PROCESS; |
| }) -> (resource struct { |
| h zx.handle:PROCESS; |
| h2 zx.handle:PROCESS; |
| }); |
| Thread(resource struct { |
| h zx.handle:THREAD; |
| }) -> (resource struct { |
| h zx.handle:THREAD; |
| h2 zx.handle:THREAD; |
| }); |
| Vmo(resource struct { |
| h zx.handle:VMO; |
| }) -> (resource struct { |
| h zx.handle:VMO; |
| h2 zx.handle:VMO; |
| }); |
| Channel(resource struct { |
| h zx.handle:CHANNEL; |
| }) -> (resource struct { |
| h zx.handle:CHANNEL; |
| h2 zx.handle:CHANNEL; |
| }); |
| Event(resource struct { |
| h zx.handle:EVENT; |
| }) -> (resource struct { |
| h zx.handle:EVENT; |
| h2 zx.handle:EVENT; |
| }); |
| Port(resource struct { |
| h zx.handle:PORT; |
| }) -> (resource struct { |
| h zx.handle:PORT; |
| h2 zx.handle:PORT; |
| }); |
| Interrupt(resource struct { |
| h zx.handle:INTERRUPT; |
| }) -> (resource struct { |
| h zx.handle:INTERRUPT; |
| h2 zx.handle:INTERRUPT; |
| }); |
| Socket(resource struct { |
| h zx.handle:SOCKET; |
| }) -> (resource struct { |
| h zx.handle:SOCKET; |
| h2 zx.handle:SOCKET; |
| }); |
| Resource(resource struct { |
| h zx.handle:RESOURCE; |
| }) -> (resource struct { |
| h zx.handle:RESOURCE; |
| h2 zx.handle:RESOURCE; |
| }); |
| EventPair(resource struct { |
| h zx.handle:EVENTPAIR; |
| }) -> (resource struct { |
| h zx.handle:EVENTPAIR; |
| h2 zx.handle:EVENTPAIR; |
| }); |
| Job(resource struct { |
| h zx.handle:JOB; |
| }) -> (resource struct { |
| h zx.handle:JOB; |
| h2 zx.handle:JOB; |
| }); |
| Vmar(resource struct { |
| h zx.handle:VMAR; |
| }) -> (resource struct { |
| h zx.handle:VMAR; |
| h2 zx.handle:VMAR; |
| }); |
| Fifo(resource struct { |
| h zx.handle:FIFO; |
| }) -> (resource struct { |
| h zx.handle:FIFO; |
| h2 zx.handle:FIFO; |
| }); |
| Guest(resource struct { |
| h zx.handle:GUEST; |
| }) -> (resource struct { |
| h zx.handle:GUEST; |
| h2 zx.handle:GUEST; |
| }); |
| Timer(resource struct { |
| h zx.handle:TIMER; |
| }) -> (resource struct { |
| h zx.handle:TIMER; |
| h2 zx.handle:TIMER; |
| }); |
| Profile(resource struct { |
| h zx.handle:PROFILE; |
| }) -> (resource struct { |
| h zx.handle:PROFILE; |
| h2 zx.handle:PROFILE; |
| }); |
| }; |
| |
| @transport("Banjo") |
| @banjo_layout("ddk-protocol") |
| protocol AnotherSynchronousHandle { |
| Handle(resource struct { |
| h zx.handle; |
| }) -> (resource struct { |
| h zx.handle; |
| h2 zx.handle; |
| }); |
| }; |
| |
| @transport("Banjo") |
| @banjo_layout("ddk-protocol") |
| protocol AsyncHandle { |
| @async |
| Handle(resource struct { |
| h zx.handle; |
| }) -> (resource struct { |
| h zx.handle; |
| h2 zx.handle; |
| }); |
| @async |
| Process(resource struct { |
| h zx.handle:PROCESS; |
| }) -> (resource struct { |
| h zx.handle:PROCESS; |
| h2 zx.handle:PROCESS; |
| }); |
| @async |
| Thread(resource struct { |
| h zx.handle:THREAD; |
| }) -> (resource struct { |
| h zx.handle:THREAD; |
| h2 zx.handle:THREAD; |
| }); |
| @async |
| Vmo(resource struct { |
| h zx.handle:VMO; |
| }) -> (resource struct { |
| h zx.handle:VMO; |
| h2 zx.handle:VMO; |
| }); |
| @async |
| Channel(resource struct { |
| h zx.handle:CHANNEL; |
| }) -> (resource struct { |
| h zx.handle:CHANNEL; |
| h2 zx.handle:CHANNEL; |
| }); |
| @async |
| Event(resource struct { |
| h zx.handle:EVENT; |
| }) -> (resource struct { |
| h zx.handle:EVENT; |
| h2 zx.handle:EVENT; |
| }); |
| @async |
| Port(resource struct { |
| h zx.handle:PORT; |
| }) -> (resource struct { |
| h zx.handle:PORT; |
| h2 zx.handle:PORT; |
| }); |
| @async |
| Interrupt(resource struct { |
| h zx.handle:INTERRUPT; |
| }) -> (resource struct { |
| h zx.handle:INTERRUPT; |
| h2 zx.handle:INTERRUPT; |
| }); |
| @async |
| Socket(resource struct { |
| h zx.handle:SOCKET; |
| }) -> (resource struct { |
| h zx.handle:SOCKET; |
| h2 zx.handle:SOCKET; |
| }); |
| @async |
| Resource(resource struct { |
| h zx.handle:RESOURCE; |
| }) -> (resource struct { |
| h zx.handle:RESOURCE; |
| h2 zx.handle:RESOURCE; |
| }); |
| @async |
| EventPair(resource struct { |
| h zx.handle:EVENTPAIR; |
| }) -> (resource struct { |
| h zx.handle:EVENTPAIR; |
| h2 zx.handle:EVENTPAIR; |
| }); |
| @async |
| Job(resource struct { |
| h zx.handle:JOB; |
| }) -> (resource struct { |
| h zx.handle:JOB; |
| h2 zx.handle:JOB; |
| }); |
| @async |
| Vmar(resource struct { |
| h zx.handle:VMAR; |
| }) -> (resource struct { |
| h zx.handle:VMAR; |
| h2 zx.handle:VMAR; |
| }); |
| @async |
| Fifo(resource struct { |
| h zx.handle:FIFO; |
| }) -> (resource struct { |
| h zx.handle:FIFO; |
| h2 zx.handle:FIFO; |
| }); |
| @async |
| Guest(resource struct { |
| h zx.handle:GUEST; |
| }) -> (resource struct { |
| h zx.handle:GUEST; |
| h2 zx.handle:GUEST; |
| }); |
| @async |
| Timer(resource struct { |
| h zx.handle:TIMER; |
| }) -> (resource struct { |
| h zx.handle:TIMER; |
| h2 zx.handle:TIMER; |
| }); |
| @async |
| Profile(resource struct { |
| h zx.handle:PROFILE; |
| }) -> (resource struct { |
| h zx.handle:PROFILE; |
| h2 zx.handle:PROFILE; |
| }); |
| }; |