annotate win64-msvc/include/capnp/rpc-prelude.h @ 58:eab3b14ddc95

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