annotate win64-msvc/include/capnp/rpc-prelude.h @ 74:2f2b27544483

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