annotate win32-mingw/include/capnp/rpc-prelude.h @ 80:0b60a66de5e2

This Mac compatibility fix appears to work, resolving SourceForge issue #273 Port Audio Fail on MacOS Catalina (10.15) - merging back
author Chris Cannam
date Thu, 31 Oct 2019 13:20:41 +0000
parents eccd51b72864
children
rev   line source
Chris@64 1 // Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors
Chris@64 2 // Licensed under the MIT License:
Chris@64 3 //
Chris@64 4 // Permission is hereby granted, free of charge, to any person obtaining a copy
Chris@64 5 // of this software and associated documentation files (the "Software"), to deal
Chris@64 6 // in the Software without restriction, including without limitation the rights
Chris@64 7 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Chris@64 8 // copies of the Software, and to permit persons to whom the Software is
Chris@64 9 // furnished to do so, subject to the following conditions:
Chris@64 10 //
Chris@64 11 // The above copyright notice and this permission notice shall be included in
Chris@64 12 // all copies or substantial portions of the Software.
Chris@64 13 //
Chris@64 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Chris@64 15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Chris@64 16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Chris@64 17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Chris@64 18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Chris@64 19 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
Chris@64 20 // THE SOFTWARE.
Chris@64 21
Chris@64 22 // This file contains a bunch of internal declarations that must appear before rpc.h can start.
Chris@64 23 // We don't define these directly in rpc.h because it makes the file hard to read.
Chris@64 24
Chris@64 25 #ifndef CAPNP_RPC_PRELUDE_H_
Chris@64 26 #define CAPNP_RPC_PRELUDE_H_
Chris@64 27
Chris@64 28 #if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS)
Chris@64 29 #pragma GCC system_header
Chris@64 30 #endif
Chris@64 31
Chris@64 32 #include "capability.h"
Chris@64 33 #include "persistent.capnp.h"
Chris@64 34
Chris@64 35 namespace capnp {
Chris@64 36
Chris@64 37 class OutgoingRpcMessage;
Chris@64 38 class IncomingRpcMessage;
Chris@64 39
Chris@64 40 template <typename SturdyRefHostId>
Chris@64 41 class RpcSystem;
Chris@64 42
Chris@64 43 namespace _ { // private
Chris@64 44
Chris@64 45 class VatNetworkBase {
Chris@64 46 // Non-template version of VatNetwork. Ignore this class; see VatNetwork in rpc.h.
Chris@64 47
Chris@64 48 public:
Chris@64 49 class Connection;
Chris@64 50
Chris@64 51 struct ConnectionAndProvisionId {
Chris@64 52 kj::Own<Connection> connection;
Chris@64 53 kj::Own<OutgoingRpcMessage> firstMessage;
Chris@64 54 Orphan<AnyPointer> provisionId;
Chris@64 55 };
Chris@64 56
Chris@64 57 class Connection {
Chris@64 58 public:
Chris@64 59 virtual kj::Own<OutgoingRpcMessage> newOutgoingMessage(uint firstSegmentWordSize) = 0;
Chris@64 60 virtual kj::Promise<kj::Maybe<kj::Own<IncomingRpcMessage>>> receiveIncomingMessage() = 0;
Chris@64 61 virtual kj::Promise<void> shutdown() = 0;
Chris@64 62 virtual AnyStruct::Reader baseGetPeerVatId() = 0;
Chris@64 63 };
Chris@64 64 virtual kj::Maybe<kj::Own<Connection>> baseConnect(AnyStruct::Reader vatId) = 0;
Chris@64 65 virtual kj::Promise<kj::Own<Connection>> baseAccept() = 0;
Chris@64 66 };
Chris@64 67
Chris@64 68 class SturdyRefRestorerBase {
Chris@64 69 public:
Chris@64 70 virtual Capability::Client baseRestore(AnyPointer::Reader ref) = 0;
Chris@64 71 };
Chris@64 72
Chris@64 73 class BootstrapFactoryBase {
Chris@64 74 // Non-template version of BootstrapFactory. Ignore this class; see BootstrapFactory in rpc.h.
Chris@64 75 public:
Chris@64 76 virtual Capability::Client baseCreateFor(AnyStruct::Reader clientId) = 0;
Chris@64 77 };
Chris@64 78
Chris@64 79 class RpcSystemBase {
Chris@64 80 // Non-template version of RpcSystem. Ignore this class; see RpcSystem in rpc.h.
Chris@64 81
Chris@64 82 public:
Chris@64 83 RpcSystemBase(VatNetworkBase& network, kj::Maybe<Capability::Client> bootstrapInterface,
Chris@64 84 kj::Maybe<RealmGateway<>::Client> gateway);
Chris@64 85 RpcSystemBase(VatNetworkBase& network, BootstrapFactoryBase& bootstrapFactory,
Chris@64 86 kj::Maybe<RealmGateway<>::Client> gateway);
Chris@64 87 RpcSystemBase(VatNetworkBase& network, SturdyRefRestorerBase& restorer);
Chris@64 88 RpcSystemBase(RpcSystemBase&& other) noexcept;
Chris@64 89 ~RpcSystemBase() noexcept(false);
Chris@64 90
Chris@64 91 private:
Chris@64 92 class Impl;
Chris@64 93 kj::Own<Impl> impl;
Chris@64 94
Chris@64 95 Capability::Client baseBootstrap(AnyStruct::Reader vatId);
Chris@64 96 Capability::Client baseRestore(AnyStruct::Reader vatId, AnyPointer::Reader objectId);
Chris@64 97 void baseSetFlowLimit(size_t words);
Chris@64 98
Chris@64 99 template <typename>
Chris@64 100 friend class capnp::RpcSystem;
Chris@64 101 };
Chris@64 102
Chris@64 103 template <typename T> struct InternalRefFromRealmGateway_;
Chris@64 104 template <typename InternalRef, typename ExternalRef, typename InternalOwner,
Chris@64 105 typename ExternalOwner>
Chris@64 106 struct InternalRefFromRealmGateway_<RealmGateway<InternalRef, ExternalRef, InternalOwner,
Chris@64 107 ExternalOwner>> {
Chris@64 108 typedef InternalRef Type;
Chris@64 109 };
Chris@64 110 template <typename T>
Chris@64 111 using InternalRefFromRealmGateway = typename InternalRefFromRealmGateway_<T>::Type;
Chris@64 112 template <typename T>
Chris@64 113 using InternalRefFromRealmGatewayClient = InternalRefFromRealmGateway<typename T::Calls>;
Chris@64 114
Chris@64 115 template <typename T> struct ExternalRefFromRealmGateway_;
Chris@64 116 template <typename InternalRef, typename ExternalRef, typename InternalOwner,
Chris@64 117 typename ExternalOwner>
Chris@64 118 struct ExternalRefFromRealmGateway_<RealmGateway<InternalRef, ExternalRef, InternalOwner,
Chris@64 119 ExternalOwner>> {
Chris@64 120 typedef ExternalRef Type;
Chris@64 121 };
Chris@64 122 template <typename T>
Chris@64 123 using ExternalRefFromRealmGateway = typename ExternalRefFromRealmGateway_<T>::Type;
Chris@64 124 template <typename T>
Chris@64 125 using ExternalRefFromRealmGatewayClient = ExternalRefFromRealmGateway<typename T::Calls>;
Chris@64 126
Chris@64 127 } // namespace _ (private)
Chris@64 128 } // namespace capnp
Chris@64 129
Chris@64 130 #endif // CAPNP_RPC_PRELUDE_H_