annotate osx/include/capnp/rpc-prelude.h @ 83:ae30d91d2ffe

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