Jiri Simsa | 67b8a26 | 2015-03-24 21:14:07 -0700 | [diff] [blame] | 1 | // Copyright 2015 The Vanadium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
Suharsh Sivakumar | a4ac50a | 2015-03-13 16:13:50 -0700 | [diff] [blame] | 5 | // This file was auto-generated by the vanadium vdl tool. |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 6 | // Source: wire.vdl |
| 7 | |
Todd Wang | 8850968 | 2015-04-10 10:28:24 -0700 | [diff] [blame] | 8 | // Package agent defines an interface to keep a private key in memory, and for |
| 9 | // clients to have access to the private key. |
| 10 | // |
| 11 | // Protocol |
| 12 | // |
| 13 | // The agent starts processes with the VEYRON_AGENT_FD set to one end of a |
| 14 | // unix domain socket. To connect to the agent, a client should create |
| 15 | // a unix domain socket pair. Then send one end of the socket to the agent |
| 16 | // with 1 byte of data. The agent will then serve the Agent service on |
| 17 | // the received socket, using SecurityNone. |
| 18 | // |
| 19 | // The agent also supports an optional mode where it can manage multiple principals. |
| 20 | // Typically this is only used by Device Manager. In this mode, VEYRON_AGENT_FD |
| 21 | // will be 3, and there will be another socket at fd 4. |
| 22 | // Creating a new principal is similar to connecting to to agent: create a socket |
| 23 | // pair and send one end on fd 4 with 1 byte of data. |
| 24 | // Set the data to 1 to request the principal only be stored in memory. |
| 25 | // The agent will create a new principal and respond with a principal handle on fd 4. |
| 26 | // To connect using a previously created principal, create a socket pair and send |
| 27 | // one end with the principal handle as data on fd 4. The agent will not send a |
| 28 | // response on fd 4. |
| 29 | // In either, you can use the normal process to connect to an agent over the |
| 30 | // other end of the pair. Typically you would pass the other end to a child |
| 31 | // process and set VEYRON_AGENT_FD so it knows to connect. |
| 32 | // |
| 33 | // The protocol also has limited support for caching: A client can |
| 34 | // request notification when any other client modifies the principal so it |
| 35 | // can flush the cache. See NotifyWhenChanged for details. |
| 36 | package agent |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 37 | |
| 38 | import ( |
Todd Wang | b0d5dce | 2015-02-05 14:07:55 -0800 | [diff] [blame] | 39 | // VDL system imports |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 40 | "io" |
Jiri Simsa | 6ac9522 | 2015-02-23 16:11:49 -0800 | [diff] [blame] | 41 | "v.io/v23" |
| 42 | "v.io/v23/context" |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 43 | "v.io/v23/rpc" |
Ryan Brown | 6a6768c | 2015-08-04 11:22:33 -0700 | [diff] [blame] | 44 | "v.io/v23/vdl" |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 45 | |
Todd Wang | b0d5dce | 2015-02-05 14:07:55 -0800 | [diff] [blame] | 46 | // VDL user imports |
Jiri Simsa | 6ac9522 | 2015-02-23 16:11:49 -0800 | [diff] [blame] | 47 | "v.io/v23/security" |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 48 | ) |
| 49 | |
Ryan Brown | 6a6768c | 2015-08-04 11:22:33 -0700 | [diff] [blame] | 50 | type ConnInfo struct { |
| 51 | MinVersion int32 |
| 52 | MaxVersion int32 |
| 53 | } |
| 54 | |
| 55 | func (ConnInfo) __VDLReflect(struct { |
| 56 | Name string `vdl:"v.io/x/ref/services/agent.ConnInfo"` |
| 57 | }) { |
| 58 | } |
| 59 | |
| 60 | type RpcRequest struct { |
| 61 | Id uint64 |
| 62 | Method string |
| 63 | NumArgs uint32 |
| 64 | } |
| 65 | |
| 66 | func (RpcRequest) __VDLReflect(struct { |
| 67 | Name string `vdl:"v.io/x/ref/services/agent.RpcRequest"` |
| 68 | }) { |
| 69 | } |
| 70 | |
| 71 | type RpcResponse struct { |
| 72 | Id uint64 |
| 73 | Err error |
| 74 | NumArgs uint32 |
| 75 | } |
| 76 | |
| 77 | func (RpcResponse) __VDLReflect(struct { |
| 78 | Name string `vdl:"v.io/x/ref/services/agent.RpcResponse"` |
| 79 | }) { |
| 80 | } |
| 81 | |
| 82 | type ( |
| 83 | // RpcMessage represents any single field of the RpcMessage union type. |
| 84 | RpcMessage interface { |
| 85 | // Index returns the field index. |
| 86 | Index() int |
| 87 | // Interface returns the field value as an interface. |
| 88 | Interface() interface{} |
| 89 | // Name returns the field name. |
| 90 | Name() string |
| 91 | // __VDLReflect describes the RpcMessage union type. |
| 92 | __VDLReflect(__RpcMessageReflect) |
| 93 | } |
| 94 | // RpcMessageReq represents field Req of the RpcMessage union type. |
| 95 | RpcMessageReq struct{ Value RpcRequest } |
| 96 | // RpcMessageResp represents field Resp of the RpcMessage union type. |
| 97 | RpcMessageResp struct{ Value RpcResponse } |
| 98 | // __RpcMessageReflect describes the RpcMessage union type. |
| 99 | __RpcMessageReflect struct { |
| 100 | Name string `vdl:"v.io/x/ref/services/agent.RpcMessage"` |
| 101 | Type RpcMessage |
| 102 | Union struct { |
| 103 | Req RpcMessageReq |
| 104 | Resp RpcMessageResp |
| 105 | } |
| 106 | } |
| 107 | ) |
| 108 | |
| 109 | func (x RpcMessageReq) Index() int { return 0 } |
| 110 | func (x RpcMessageReq) Interface() interface{} { return x.Value } |
| 111 | func (x RpcMessageReq) Name() string { return "Req" } |
| 112 | func (x RpcMessageReq) __VDLReflect(__RpcMessageReflect) {} |
| 113 | |
| 114 | func (x RpcMessageResp) Index() int { return 1 } |
| 115 | func (x RpcMessageResp) Interface() interface{} { return x.Value } |
| 116 | func (x RpcMessageResp) Name() string { return "Resp" } |
| 117 | func (x RpcMessageResp) __VDLReflect(__RpcMessageReflect) {} |
| 118 | |
| 119 | func init() { |
| 120 | vdl.Register((*ConnInfo)(nil)) |
| 121 | vdl.Register((*RpcRequest)(nil)) |
| 122 | vdl.Register((*RpcResponse)(nil)) |
| 123 | vdl.Register((*RpcMessage)(nil)) |
| 124 | } |
| 125 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 126 | // AgentClientMethods is the client interface |
| 127 | // containing Agent methods. |
| 128 | type AgentClientMethods interface { |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 129 | Bless(ctx *context.T, key []byte, wit security.Blessings, extension string, caveat security.Caveat, additionalCaveats []security.Caveat, opts ...rpc.CallOpt) (security.Blessings, error) |
| 130 | BlessSelf(ctx *context.T, name string, caveats []security.Caveat, opts ...rpc.CallOpt) (security.Blessings, error) |
| 131 | Sign(ctx *context.T, message []byte, opts ...rpc.CallOpt) (security.Signature, error) |
| 132 | MintDischarge(ctx *context.T, forCaveat security.Caveat, caveatOnDischarge security.Caveat, additionalCaveatsOnDischarge []security.Caveat, opts ...rpc.CallOpt) (security.Discharge, error) |
| 133 | PublicKey(*context.T, ...rpc.CallOpt) ([]byte, error) |
| 134 | BlessingsByName(ctx *context.T, name security.BlessingPattern, opts ...rpc.CallOpt) ([]security.Blessings, error) |
| 135 | BlessingsInfo(ctx *context.T, blessings security.Blessings, opts ...rpc.CallOpt) (map[string][]security.Caveat, error) |
| 136 | AddToRoots(ctx *context.T, blessing security.Blessings, opts ...rpc.CallOpt) error |
| 137 | BlessingStoreSet(ctx *context.T, blessings security.Blessings, forPeers security.BlessingPattern, opts ...rpc.CallOpt) (security.Blessings, error) |
| 138 | BlessingStoreForPeer(ctx *context.T, peerBlessings []string, opts ...rpc.CallOpt) (security.Blessings, error) |
| 139 | BlessingStoreSetDefault(ctx *context.T, blessings security.Blessings, opts ...rpc.CallOpt) error |
| 140 | BlessingStoreDefault(*context.T, ...rpc.CallOpt) (security.Blessings, error) |
| 141 | BlessingStorePeerBlessings(*context.T, ...rpc.CallOpt) (map[security.BlessingPattern]security.Blessings, error) |
| 142 | BlessingStoreDebugString(*context.T, ...rpc.CallOpt) (string, error) |
Suharsh Sivakumar | d7d4e22 | 2015-06-22 11:10:44 -0700 | [diff] [blame] | 143 | BlessingStoreCacheDischarge(ctx *context.T, discharge security.Discharge, caveat security.Caveat, impetus security.DischargeImpetus, opts ...rpc.CallOpt) error |
| 144 | BlessingStoreClearDischarges(ctx *context.T, discharges []security.Discharge, opts ...rpc.CallOpt) error |
| 145 | BlessingStoreDischarge(ctx *context.T, caveat security.Caveat, impetus security.DischargeImpetus, opts ...rpc.CallOpt) (wd security.Discharge, err error) |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 146 | BlessingRootsAdd(ctx *context.T, root []byte, pattern security.BlessingPattern, opts ...rpc.CallOpt) error |
| 147 | BlessingRootsRecognized(ctx *context.T, root []byte, blessing string, opts ...rpc.CallOpt) error |
Ankur | 9e5b772 | 2015-04-28 15:00:25 -0700 | [diff] [blame] | 148 | BlessingRootsDump(*context.T, ...rpc.CallOpt) (map[security.BlessingPattern][][]byte, error) |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 149 | BlessingRootsDebugString(*context.T, ...rpc.CallOpt) (string, error) |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 150 | // Clients using caching should call NotifyWhenChanged upon connecting to |
| 151 | // the server. The server will stream back values whenever the client should |
| 152 | // flush the cache. The streamed value is arbitrary, simply flush whenever |
| 153 | // recieving a new item. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 154 | NotifyWhenChanged(*context.T, ...rpc.CallOpt) (AgentNotifyWhenChangedClientCall, error) |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 155 | } |
| 156 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 157 | // AgentClientStub adds universal methods to AgentClientMethods. |
| 158 | type AgentClientStub interface { |
| 159 | AgentClientMethods |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 160 | rpc.UniversalServiceMethods |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 161 | } |
| 162 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 163 | // AgentClient returns a client stub for Agent. |
Asim Shankar | 69fa69f | 2015-04-01 11:34:32 -0700 | [diff] [blame] | 164 | func AgentClient(name string) AgentClientStub { |
| 165 | return implAgentClientStub{name} |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 166 | } |
| 167 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 168 | type implAgentClientStub struct { |
Asim Shankar | 69fa69f | 2015-04-01 11:34:32 -0700 | [diff] [blame] | 169 | name string |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 170 | } |
| 171 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 172 | func (c implAgentClientStub) Bless(ctx *context.T, i0 []byte, i1 security.Blessings, i2 string, i3 security.Caveat, i4 []security.Caveat, opts ...rpc.CallOpt) (o0 security.Blessings, err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 173 | err = v23.GetClient(ctx).Call(ctx, c.name, "Bless", []interface{}{i0, i1, i2, i3, i4}, []interface{}{&o0}, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 174 | return |
| 175 | } |
| 176 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 177 | func (c implAgentClientStub) BlessSelf(ctx *context.T, i0 string, i1 []security.Caveat, opts ...rpc.CallOpt) (o0 security.Blessings, err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 178 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessSelf", []interface{}{i0, i1}, []interface{}{&o0}, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 179 | return |
| 180 | } |
| 181 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 182 | func (c implAgentClientStub) Sign(ctx *context.T, i0 []byte, opts ...rpc.CallOpt) (o0 security.Signature, err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 183 | err = v23.GetClient(ctx).Call(ctx, c.name, "Sign", []interface{}{i0}, []interface{}{&o0}, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 184 | return |
| 185 | } |
| 186 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 187 | func (c implAgentClientStub) MintDischarge(ctx *context.T, i0 security.Caveat, i1 security.Caveat, i2 []security.Caveat, opts ...rpc.CallOpt) (o0 security.Discharge, err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 188 | err = v23.GetClient(ctx).Call(ctx, c.name, "MintDischarge", []interface{}{i0, i1, i2}, []interface{}{&o0}, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 189 | return |
| 190 | } |
| 191 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 192 | func (c implAgentClientStub) PublicKey(ctx *context.T, opts ...rpc.CallOpt) (o0 []byte, err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 193 | err = v23.GetClient(ctx).Call(ctx, c.name, "PublicKey", nil, []interface{}{&o0}, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 194 | return |
| 195 | } |
| 196 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 197 | func (c implAgentClientStub) BlessingsByName(ctx *context.T, i0 security.BlessingPattern, opts ...rpc.CallOpt) (o0 []security.Blessings, err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 198 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingsByName", []interface{}{i0}, []interface{}{&o0}, opts...) |
gauthamt | f826393 | 2014-12-16 10:59:09 -0800 | [diff] [blame] | 199 | return |
| 200 | } |
| 201 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 202 | func (c implAgentClientStub) BlessingsInfo(ctx *context.T, i0 security.Blessings, opts ...rpc.CallOpt) (o0 map[string][]security.Caveat, err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 203 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingsInfo", []interface{}{i0}, []interface{}{&o0}, opts...) |
gauthamt | f826393 | 2014-12-16 10:59:09 -0800 | [diff] [blame] | 204 | return |
| 205 | } |
| 206 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 207 | func (c implAgentClientStub) AddToRoots(ctx *context.T, i0 security.Blessings, opts ...rpc.CallOpt) (err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 208 | err = v23.GetClient(ctx).Call(ctx, c.name, "AddToRoots", []interface{}{i0}, nil, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 209 | return |
| 210 | } |
| 211 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 212 | func (c implAgentClientStub) BlessingStoreSet(ctx *context.T, i0 security.Blessings, i1 security.BlessingPattern, opts ...rpc.CallOpt) (o0 security.Blessings, err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 213 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingStoreSet", []interface{}{i0, i1}, []interface{}{&o0}, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 214 | return |
| 215 | } |
| 216 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 217 | func (c implAgentClientStub) BlessingStoreForPeer(ctx *context.T, i0 []string, opts ...rpc.CallOpt) (o0 security.Blessings, err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 218 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingStoreForPeer", []interface{}{i0}, []interface{}{&o0}, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 219 | return |
| 220 | } |
| 221 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 222 | func (c implAgentClientStub) BlessingStoreSetDefault(ctx *context.T, i0 security.Blessings, opts ...rpc.CallOpt) (err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 223 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingStoreSetDefault", []interface{}{i0}, nil, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 224 | return |
| 225 | } |
| 226 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 227 | func (c implAgentClientStub) BlessingStoreDefault(ctx *context.T, opts ...rpc.CallOpt) (o0 security.Blessings, err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 228 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingStoreDefault", nil, []interface{}{&o0}, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 229 | return |
| 230 | } |
| 231 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 232 | func (c implAgentClientStub) BlessingStorePeerBlessings(ctx *context.T, opts ...rpc.CallOpt) (o0 map[security.BlessingPattern]security.Blessings, err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 233 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingStorePeerBlessings", nil, []interface{}{&o0}, opts...) |
gauthamt | f826393 | 2014-12-16 10:59:09 -0800 | [diff] [blame] | 234 | return |
| 235 | } |
| 236 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 237 | func (c implAgentClientStub) BlessingStoreDebugString(ctx *context.T, opts ...rpc.CallOpt) (o0 string, err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 238 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingStoreDebugString", nil, []interface{}{&o0}, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 239 | return |
| 240 | } |
| 241 | |
Suharsh Sivakumar | d7d4e22 | 2015-06-22 11:10:44 -0700 | [diff] [blame] | 242 | func (c implAgentClientStub) BlessingStoreCacheDischarge(ctx *context.T, i0 security.Discharge, i1 security.Caveat, i2 security.DischargeImpetus, opts ...rpc.CallOpt) (err error) { |
| 243 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingStoreCacheDischarge", []interface{}{i0, i1, i2}, nil, opts...) |
| 244 | return |
| 245 | } |
| 246 | |
| 247 | func (c implAgentClientStub) BlessingStoreClearDischarges(ctx *context.T, i0 []security.Discharge, opts ...rpc.CallOpt) (err error) { |
| 248 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingStoreClearDischarges", []interface{}{i0}, nil, opts...) |
| 249 | return |
| 250 | } |
| 251 | |
| 252 | func (c implAgentClientStub) BlessingStoreDischarge(ctx *context.T, i0 security.Caveat, i1 security.DischargeImpetus, opts ...rpc.CallOpt) (o0 security.Discharge, err error) { |
| 253 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingStoreDischarge", []interface{}{i0, i1}, []interface{}{&o0}, opts...) |
| 254 | return |
| 255 | } |
| 256 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 257 | func (c implAgentClientStub) BlessingRootsAdd(ctx *context.T, i0 []byte, i1 security.BlessingPattern, opts ...rpc.CallOpt) (err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 258 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingRootsAdd", []interface{}{i0, i1}, nil, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 259 | return |
| 260 | } |
| 261 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 262 | func (c implAgentClientStub) BlessingRootsRecognized(ctx *context.T, i0 []byte, i1 string, opts ...rpc.CallOpt) (err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 263 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingRootsRecognized", []interface{}{i0, i1}, nil, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 264 | return |
| 265 | } |
| 266 | |
Ankur | 9e5b772 | 2015-04-28 15:00:25 -0700 | [diff] [blame] | 267 | func (c implAgentClientStub) BlessingRootsDump(ctx *context.T, opts ...rpc.CallOpt) (o0 map[security.BlessingPattern][][]byte, err error) { |
| 268 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingRootsDump", nil, []interface{}{&o0}, opts...) |
| 269 | return |
| 270 | } |
| 271 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 272 | func (c implAgentClientStub) BlessingRootsDebugString(ctx *context.T, opts ...rpc.CallOpt) (o0 string, err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 273 | err = v23.GetClient(ctx).Call(ctx, c.name, "BlessingRootsDebugString", nil, []interface{}{&o0}, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 274 | return |
| 275 | } |
| 276 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 277 | func (c implAgentClientStub) NotifyWhenChanged(ctx *context.T, opts ...rpc.CallOpt) (ocall AgentNotifyWhenChangedClientCall, err error) { |
| 278 | var call rpc.ClientCall |
Asim Shankar | 69fa69f | 2015-04-01 11:34:32 -0700 | [diff] [blame] | 279 | if call, err = v23.GetClient(ctx).StartCall(ctx, c.name, "NotifyWhenChanged", nil, opts...); err != nil { |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 280 | return |
| 281 | } |
Matt Rosencrantz | 5c7ed21 | 2015-02-27 22:42:35 -0800 | [diff] [blame] | 282 | ocall = &implAgentNotifyWhenChangedClientCall{ClientCall: call} |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 283 | return |
| 284 | } |
| 285 | |
| 286 | // AgentNotifyWhenChangedClientStream is the client stream for Agent.NotifyWhenChanged. |
| 287 | type AgentNotifyWhenChangedClientStream interface { |
| 288 | // RecvStream returns the receiver side of the Agent.NotifyWhenChanged client stream. |
| 289 | RecvStream() interface { |
| 290 | // Advance stages an item so that it may be retrieved via Value. Returns |
| 291 | // true iff there is an item to retrieve. Advance must be called before |
| 292 | // Value is called. May block if an item is not available. |
| 293 | Advance() bool |
| 294 | // Value returns the item that was staged by Advance. May panic if Advance |
| 295 | // returned false or was not called. Never blocks. |
| 296 | Value() bool |
| 297 | // Err returns any error encountered by Advance. Never blocks. |
| 298 | Err() error |
| 299 | } |
| 300 | } |
| 301 | |
Matt Rosencrantz | 5c7ed21 | 2015-02-27 22:42:35 -0800 | [diff] [blame] | 302 | // AgentNotifyWhenChangedClientCall represents the call returned from Agent.NotifyWhenChanged. |
| 303 | type AgentNotifyWhenChangedClientCall interface { |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 304 | AgentNotifyWhenChangedClientStream |
| 305 | // Finish blocks until the server is done, and returns the positional return |
| 306 | // values for call. |
| 307 | // |
| 308 | // Finish returns immediately if the call has been canceled; depending on the |
| 309 | // timing the output could either be an error signaling cancelation, or the |
| 310 | // valid positional return values from the server. |
| 311 | // |
| 312 | // Calling Finish is mandatory for releasing stream resources, unless the call |
| 313 | // has been canceled or any of the other methods return an error. Finish should |
| 314 | // be called at most once. |
| 315 | Finish() error |
| 316 | } |
| 317 | |
Matt Rosencrantz | 5c7ed21 | 2015-02-27 22:42:35 -0800 | [diff] [blame] | 318 | type implAgentNotifyWhenChangedClientCall struct { |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 319 | rpc.ClientCall |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 320 | valRecv bool |
| 321 | errRecv error |
| 322 | } |
| 323 | |
Matt Rosencrantz | 5c7ed21 | 2015-02-27 22:42:35 -0800 | [diff] [blame] | 324 | func (c *implAgentNotifyWhenChangedClientCall) RecvStream() interface { |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 325 | Advance() bool |
| 326 | Value() bool |
| 327 | Err() error |
| 328 | } { |
Suharsh Sivakumar | 31f4985 | 2015-03-03 16:13:20 -0800 | [diff] [blame] | 329 | return implAgentNotifyWhenChangedClientCallRecv{c} |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 330 | } |
| 331 | |
Suharsh Sivakumar | 31f4985 | 2015-03-03 16:13:20 -0800 | [diff] [blame] | 332 | type implAgentNotifyWhenChangedClientCallRecv struct { |
Matt Rosencrantz | 5c7ed21 | 2015-02-27 22:42:35 -0800 | [diff] [blame] | 333 | c *implAgentNotifyWhenChangedClientCall |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 334 | } |
| 335 | |
Suharsh Sivakumar | 31f4985 | 2015-03-03 16:13:20 -0800 | [diff] [blame] | 336 | func (c implAgentNotifyWhenChangedClientCallRecv) Advance() bool { |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 337 | c.c.errRecv = c.c.Recv(&c.c.valRecv) |
| 338 | return c.c.errRecv == nil |
| 339 | } |
Suharsh Sivakumar | 31f4985 | 2015-03-03 16:13:20 -0800 | [diff] [blame] | 340 | func (c implAgentNotifyWhenChangedClientCallRecv) Value() bool { |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 341 | return c.c.valRecv |
| 342 | } |
Suharsh Sivakumar | 31f4985 | 2015-03-03 16:13:20 -0800 | [diff] [blame] | 343 | func (c implAgentNotifyWhenChangedClientCallRecv) Err() error { |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 344 | if c.c.errRecv == io.EOF { |
| 345 | return nil |
| 346 | } |
| 347 | return c.c.errRecv |
| 348 | } |
Matt Rosencrantz | 5c7ed21 | 2015-02-27 22:42:35 -0800 | [diff] [blame] | 349 | func (c *implAgentNotifyWhenChangedClientCall) Finish() (err error) { |
| 350 | err = c.ClientCall.Finish() |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 351 | return |
| 352 | } |
| 353 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 354 | // AgentServerMethods is the interface a server writer |
| 355 | // implements for Agent. |
| 356 | type AgentServerMethods interface { |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 357 | Bless(ctx *context.T, call rpc.ServerCall, key []byte, wit security.Blessings, extension string, caveat security.Caveat, additionalCaveats []security.Caveat) (security.Blessings, error) |
| 358 | BlessSelf(ctx *context.T, call rpc.ServerCall, name string, caveats []security.Caveat) (security.Blessings, error) |
| 359 | Sign(ctx *context.T, call rpc.ServerCall, message []byte) (security.Signature, error) |
| 360 | MintDischarge(ctx *context.T, call rpc.ServerCall, forCaveat security.Caveat, caveatOnDischarge security.Caveat, additionalCaveatsOnDischarge []security.Caveat) (security.Discharge, error) |
| 361 | PublicKey(*context.T, rpc.ServerCall) ([]byte, error) |
| 362 | BlessingsByName(ctx *context.T, call rpc.ServerCall, name security.BlessingPattern) ([]security.Blessings, error) |
| 363 | BlessingsInfo(ctx *context.T, call rpc.ServerCall, blessings security.Blessings) (map[string][]security.Caveat, error) |
| 364 | AddToRoots(ctx *context.T, call rpc.ServerCall, blessing security.Blessings) error |
| 365 | BlessingStoreSet(ctx *context.T, call rpc.ServerCall, blessings security.Blessings, forPeers security.BlessingPattern) (security.Blessings, error) |
| 366 | BlessingStoreForPeer(ctx *context.T, call rpc.ServerCall, peerBlessings []string) (security.Blessings, error) |
| 367 | BlessingStoreSetDefault(ctx *context.T, call rpc.ServerCall, blessings security.Blessings) error |
| 368 | BlessingStoreDefault(*context.T, rpc.ServerCall) (security.Blessings, error) |
| 369 | BlessingStorePeerBlessings(*context.T, rpc.ServerCall) (map[security.BlessingPattern]security.Blessings, error) |
| 370 | BlessingStoreDebugString(*context.T, rpc.ServerCall) (string, error) |
Suharsh Sivakumar | d7d4e22 | 2015-06-22 11:10:44 -0700 | [diff] [blame] | 371 | BlessingStoreCacheDischarge(ctx *context.T, call rpc.ServerCall, discharge security.Discharge, caveat security.Caveat, impetus security.DischargeImpetus) error |
| 372 | BlessingStoreClearDischarges(ctx *context.T, call rpc.ServerCall, discharges []security.Discharge) error |
| 373 | BlessingStoreDischarge(ctx *context.T, call rpc.ServerCall, caveat security.Caveat, impetus security.DischargeImpetus) (wd security.Discharge, err error) |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 374 | BlessingRootsAdd(ctx *context.T, call rpc.ServerCall, root []byte, pattern security.BlessingPattern) error |
| 375 | BlessingRootsRecognized(ctx *context.T, call rpc.ServerCall, root []byte, blessing string) error |
Ankur | 9e5b772 | 2015-04-28 15:00:25 -0700 | [diff] [blame] | 376 | BlessingRootsDump(*context.T, rpc.ServerCall) (map[security.BlessingPattern][][]byte, error) |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 377 | BlessingRootsDebugString(*context.T, rpc.ServerCall) (string, error) |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 378 | // Clients using caching should call NotifyWhenChanged upon connecting to |
| 379 | // the server. The server will stream back values whenever the client should |
| 380 | // flush the cache. The streamed value is arbitrary, simply flush whenever |
| 381 | // recieving a new item. |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 382 | NotifyWhenChanged(*context.T, AgentNotifyWhenChangedServerCall) error |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 383 | } |
| 384 | |
| 385 | // AgentServerStubMethods is the server interface containing |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 386 | // Agent methods, as expected by rpc.Server. |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 387 | // The only difference between this interface and AgentServerMethods |
| 388 | // is the streaming methods. |
| 389 | type AgentServerStubMethods interface { |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 390 | Bless(ctx *context.T, call rpc.ServerCall, key []byte, wit security.Blessings, extension string, caveat security.Caveat, additionalCaveats []security.Caveat) (security.Blessings, error) |
| 391 | BlessSelf(ctx *context.T, call rpc.ServerCall, name string, caveats []security.Caveat) (security.Blessings, error) |
| 392 | Sign(ctx *context.T, call rpc.ServerCall, message []byte) (security.Signature, error) |
| 393 | MintDischarge(ctx *context.T, call rpc.ServerCall, forCaveat security.Caveat, caveatOnDischarge security.Caveat, additionalCaveatsOnDischarge []security.Caveat) (security.Discharge, error) |
| 394 | PublicKey(*context.T, rpc.ServerCall) ([]byte, error) |
| 395 | BlessingsByName(ctx *context.T, call rpc.ServerCall, name security.BlessingPattern) ([]security.Blessings, error) |
| 396 | BlessingsInfo(ctx *context.T, call rpc.ServerCall, blessings security.Blessings) (map[string][]security.Caveat, error) |
| 397 | AddToRoots(ctx *context.T, call rpc.ServerCall, blessing security.Blessings) error |
| 398 | BlessingStoreSet(ctx *context.T, call rpc.ServerCall, blessings security.Blessings, forPeers security.BlessingPattern) (security.Blessings, error) |
| 399 | BlessingStoreForPeer(ctx *context.T, call rpc.ServerCall, peerBlessings []string) (security.Blessings, error) |
| 400 | BlessingStoreSetDefault(ctx *context.T, call rpc.ServerCall, blessings security.Blessings) error |
| 401 | BlessingStoreDefault(*context.T, rpc.ServerCall) (security.Blessings, error) |
| 402 | BlessingStorePeerBlessings(*context.T, rpc.ServerCall) (map[security.BlessingPattern]security.Blessings, error) |
| 403 | BlessingStoreDebugString(*context.T, rpc.ServerCall) (string, error) |
Suharsh Sivakumar | d7d4e22 | 2015-06-22 11:10:44 -0700 | [diff] [blame] | 404 | BlessingStoreCacheDischarge(ctx *context.T, call rpc.ServerCall, discharge security.Discharge, caveat security.Caveat, impetus security.DischargeImpetus) error |
| 405 | BlessingStoreClearDischarges(ctx *context.T, call rpc.ServerCall, discharges []security.Discharge) error |
| 406 | BlessingStoreDischarge(ctx *context.T, call rpc.ServerCall, caveat security.Caveat, impetus security.DischargeImpetus) (wd security.Discharge, err error) |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 407 | BlessingRootsAdd(ctx *context.T, call rpc.ServerCall, root []byte, pattern security.BlessingPattern) error |
| 408 | BlessingRootsRecognized(ctx *context.T, call rpc.ServerCall, root []byte, blessing string) error |
Ankur | 9e5b772 | 2015-04-28 15:00:25 -0700 | [diff] [blame] | 409 | BlessingRootsDump(*context.T, rpc.ServerCall) (map[security.BlessingPattern][][]byte, error) |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 410 | BlessingRootsDebugString(*context.T, rpc.ServerCall) (string, error) |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 411 | // Clients using caching should call NotifyWhenChanged upon connecting to |
| 412 | // the server. The server will stream back values whenever the client should |
| 413 | // flush the cache. The streamed value is arbitrary, simply flush whenever |
| 414 | // recieving a new item. |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 415 | NotifyWhenChanged(*context.T, *AgentNotifyWhenChangedServerCallStub) error |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 416 | } |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 417 | |
| 418 | // AgentServerStub adds universal methods to AgentServerStubMethods. |
| 419 | type AgentServerStub interface { |
| 420 | AgentServerStubMethods |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 421 | // Describe the Agent interfaces. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 422 | Describe__() []rpc.InterfaceDesc |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 423 | } |
| 424 | |
| 425 | // AgentServer returns a server stub for Agent. |
| 426 | // It converts an implementation of AgentServerMethods into |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 427 | // an object that may be used by rpc.Server. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 428 | func AgentServer(impl AgentServerMethods) AgentServerStub { |
| 429 | stub := implAgentServerStub{ |
| 430 | impl: impl, |
| 431 | } |
| 432 | // Initialize GlobState; always check the stub itself first, to handle the |
| 433 | // case where the user has the Glob method defined in their VDL source. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 434 | if gs := rpc.NewGlobState(stub); gs != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 435 | stub.gs = gs |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 436 | } else if gs := rpc.NewGlobState(impl); gs != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 437 | stub.gs = gs |
| 438 | } |
Robin Thellend | 94bc464 | 2014-11-05 18:05:08 -0800 | [diff] [blame] | 439 | return stub |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 440 | } |
| 441 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 442 | type implAgentServerStub struct { |
| 443 | impl AgentServerMethods |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 444 | gs *rpc.GlobState |
Ken Ashcraft | e027b5c | 2014-09-16 14:20:20 -0700 | [diff] [blame] | 445 | } |
| 446 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 447 | func (s implAgentServerStub) Bless(ctx *context.T, call rpc.ServerCall, i0 []byte, i1 security.Blessings, i2 string, i3 security.Caveat, i4 []security.Caveat) (security.Blessings, error) { |
| 448 | return s.impl.Bless(ctx, call, i0, i1, i2, i3, i4) |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 449 | } |
| 450 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 451 | func (s implAgentServerStub) BlessSelf(ctx *context.T, call rpc.ServerCall, i0 string, i1 []security.Caveat) (security.Blessings, error) { |
| 452 | return s.impl.BlessSelf(ctx, call, i0, i1) |
Suharsh Sivakumar | 8a7fba4 | 2014-10-27 12:40:48 -0700 | [diff] [blame] | 453 | } |
| 454 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 455 | func (s implAgentServerStub) Sign(ctx *context.T, call rpc.ServerCall, i0 []byte) (security.Signature, error) { |
| 456 | return s.impl.Sign(ctx, call, i0) |
Suharsh Sivakumar | 8a7fba4 | 2014-10-27 12:40:48 -0700 | [diff] [blame] | 457 | } |
| 458 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 459 | func (s implAgentServerStub) MintDischarge(ctx *context.T, call rpc.ServerCall, i0 security.Caveat, i1 security.Caveat, i2 []security.Caveat) (security.Discharge, error) { |
| 460 | return s.impl.MintDischarge(ctx, call, i0, i1, i2) |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 461 | } |
| 462 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 463 | func (s implAgentServerStub) PublicKey(ctx *context.T, call rpc.ServerCall) ([]byte, error) { |
| 464 | return s.impl.PublicKey(ctx, call) |
Suharsh Sivakumar | 8a7fba4 | 2014-10-27 12:40:48 -0700 | [diff] [blame] | 465 | } |
| 466 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 467 | func (s implAgentServerStub) BlessingsByName(ctx *context.T, call rpc.ServerCall, i0 security.BlessingPattern) ([]security.Blessings, error) { |
| 468 | return s.impl.BlessingsByName(ctx, call, i0) |
gauthamt | f826393 | 2014-12-16 10:59:09 -0800 | [diff] [blame] | 469 | } |
| 470 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 471 | func (s implAgentServerStub) BlessingsInfo(ctx *context.T, call rpc.ServerCall, i0 security.Blessings) (map[string][]security.Caveat, error) { |
| 472 | return s.impl.BlessingsInfo(ctx, call, i0) |
gauthamt | f826393 | 2014-12-16 10:59:09 -0800 | [diff] [blame] | 473 | } |
| 474 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 475 | func (s implAgentServerStub) AddToRoots(ctx *context.T, call rpc.ServerCall, i0 security.Blessings) error { |
| 476 | return s.impl.AddToRoots(ctx, call, i0) |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 477 | } |
| 478 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 479 | func (s implAgentServerStub) BlessingStoreSet(ctx *context.T, call rpc.ServerCall, i0 security.Blessings, i1 security.BlessingPattern) (security.Blessings, error) { |
| 480 | return s.impl.BlessingStoreSet(ctx, call, i0, i1) |
Suharsh Sivakumar | 8a7fba4 | 2014-10-27 12:40:48 -0700 | [diff] [blame] | 481 | } |
| 482 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 483 | func (s implAgentServerStub) BlessingStoreForPeer(ctx *context.T, call rpc.ServerCall, i0 []string) (security.Blessings, error) { |
| 484 | return s.impl.BlessingStoreForPeer(ctx, call, i0) |
Suharsh Sivakumar | 8a7fba4 | 2014-10-27 12:40:48 -0700 | [diff] [blame] | 485 | } |
| 486 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 487 | func (s implAgentServerStub) BlessingStoreSetDefault(ctx *context.T, call rpc.ServerCall, i0 security.Blessings) error { |
| 488 | return s.impl.BlessingStoreSetDefault(ctx, call, i0) |
Suharsh Sivakumar | 8a7fba4 | 2014-10-27 12:40:48 -0700 | [diff] [blame] | 489 | } |
| 490 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 491 | func (s implAgentServerStub) BlessingStoreDefault(ctx *context.T, call rpc.ServerCall) (security.Blessings, error) { |
| 492 | return s.impl.BlessingStoreDefault(ctx, call) |
Suharsh Sivakumar | 8a7fba4 | 2014-10-27 12:40:48 -0700 | [diff] [blame] | 493 | } |
| 494 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 495 | func (s implAgentServerStub) BlessingStorePeerBlessings(ctx *context.T, call rpc.ServerCall) (map[security.BlessingPattern]security.Blessings, error) { |
| 496 | return s.impl.BlessingStorePeerBlessings(ctx, call) |
gauthamt | f826393 | 2014-12-16 10:59:09 -0800 | [diff] [blame] | 497 | } |
| 498 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 499 | func (s implAgentServerStub) BlessingStoreDebugString(ctx *context.T, call rpc.ServerCall) (string, error) { |
| 500 | return s.impl.BlessingStoreDebugString(ctx, call) |
Suharsh Sivakumar | 8a7fba4 | 2014-10-27 12:40:48 -0700 | [diff] [blame] | 501 | } |
| 502 | |
Suharsh Sivakumar | d7d4e22 | 2015-06-22 11:10:44 -0700 | [diff] [blame] | 503 | func (s implAgentServerStub) BlessingStoreCacheDischarge(ctx *context.T, call rpc.ServerCall, i0 security.Discharge, i1 security.Caveat, i2 security.DischargeImpetus) error { |
| 504 | return s.impl.BlessingStoreCacheDischarge(ctx, call, i0, i1, i2) |
| 505 | } |
| 506 | |
| 507 | func (s implAgentServerStub) BlessingStoreClearDischarges(ctx *context.T, call rpc.ServerCall, i0 []security.Discharge) error { |
| 508 | return s.impl.BlessingStoreClearDischarges(ctx, call, i0) |
| 509 | } |
| 510 | |
| 511 | func (s implAgentServerStub) BlessingStoreDischarge(ctx *context.T, call rpc.ServerCall, i0 security.Caveat, i1 security.DischargeImpetus) (security.Discharge, error) { |
| 512 | return s.impl.BlessingStoreDischarge(ctx, call, i0, i1) |
| 513 | } |
| 514 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 515 | func (s implAgentServerStub) BlessingRootsAdd(ctx *context.T, call rpc.ServerCall, i0 []byte, i1 security.BlessingPattern) error { |
| 516 | return s.impl.BlessingRootsAdd(ctx, call, i0, i1) |
Suharsh Sivakumar | 8a7fba4 | 2014-10-27 12:40:48 -0700 | [diff] [blame] | 517 | } |
| 518 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 519 | func (s implAgentServerStub) BlessingRootsRecognized(ctx *context.T, call rpc.ServerCall, i0 []byte, i1 string) error { |
| 520 | return s.impl.BlessingRootsRecognized(ctx, call, i0, i1) |
Suharsh Sivakumar | 8a7fba4 | 2014-10-27 12:40:48 -0700 | [diff] [blame] | 521 | } |
| 522 | |
Ankur | 9e5b772 | 2015-04-28 15:00:25 -0700 | [diff] [blame] | 523 | func (s implAgentServerStub) BlessingRootsDump(ctx *context.T, call rpc.ServerCall) (map[security.BlessingPattern][][]byte, error) { |
| 524 | return s.impl.BlessingRootsDump(ctx, call) |
| 525 | } |
| 526 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 527 | func (s implAgentServerStub) BlessingRootsDebugString(ctx *context.T, call rpc.ServerCall) (string, error) { |
| 528 | return s.impl.BlessingRootsDebugString(ctx, call) |
Suharsh Sivakumar | 8a7fba4 | 2014-10-27 12:40:48 -0700 | [diff] [blame] | 529 | } |
| 530 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 531 | func (s implAgentServerStub) NotifyWhenChanged(ctx *context.T, call *AgentNotifyWhenChangedServerCallStub) error { |
| 532 | return s.impl.NotifyWhenChanged(ctx, call) |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 533 | } |
| 534 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 535 | func (s implAgentServerStub) Globber() *rpc.GlobState { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 536 | return s.gs |
Suharsh Sivakumar | 8a7fba4 | 2014-10-27 12:40:48 -0700 | [diff] [blame] | 537 | } |
| 538 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 539 | func (s implAgentServerStub) Describe__() []rpc.InterfaceDesc { |
| 540 | return []rpc.InterfaceDesc{AgentDesc} |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 541 | } |
| 542 | |
| 543 | // AgentDesc describes the Agent interface. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 544 | var AgentDesc rpc.InterfaceDesc = descAgent |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 545 | |
| 546 | // descAgent hides the desc to keep godoc clean. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 547 | var descAgent = rpc.InterfaceDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 548 | Name: "Agent", |
Todd Wang | 8850968 | 2015-04-10 10:28:24 -0700 | [diff] [blame] | 549 | PkgPath: "v.io/x/ref/services/agent", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 550 | Methods: []rpc.MethodDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 551 | { |
| 552 | Name: "Bless", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 553 | InArgs: []rpc.ArgDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 554 | {"key", ``}, // []byte |
Asim Shankar | b07ec69 | 2015-02-27 23:40:44 -0800 | [diff] [blame] | 555 | {"wit", ``}, // security.Blessings |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 556 | {"extension", ``}, // string |
| 557 | {"caveat", ``}, // security.Caveat |
| 558 | {"additionalCaveats", ``}, // []security.Caveat |
| 559 | }, |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 560 | OutArgs: []rpc.ArgDesc{ |
Asim Shankar | b07ec69 | 2015-02-27 23:40:44 -0800 | [diff] [blame] | 561 | {"", ``}, // security.Blessings |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 562 | }, |
| 563 | }, |
| 564 | { |
| 565 | Name: "BlessSelf", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 566 | InArgs: []rpc.ArgDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 567 | {"name", ``}, // string |
| 568 | {"caveats", ``}, // []security.Caveat |
| 569 | }, |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 570 | OutArgs: []rpc.ArgDesc{ |
Asim Shankar | b07ec69 | 2015-02-27 23:40:44 -0800 | [diff] [blame] | 571 | {"", ``}, // security.Blessings |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 572 | }, |
| 573 | }, |
| 574 | { |
| 575 | Name: "Sign", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 576 | InArgs: []rpc.ArgDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 577 | {"message", ``}, // []byte |
| 578 | }, |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 579 | OutArgs: []rpc.ArgDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 580 | {"", ``}, // security.Signature |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 581 | }, |
| 582 | }, |
| 583 | { |
| 584 | Name: "MintDischarge", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 585 | InArgs: []rpc.ArgDesc{ |
Asim Shankar | 19da818 | 2015-02-06 01:41:16 -0800 | [diff] [blame] | 586 | {"forCaveat", ``}, // security.Caveat |
| 587 | {"caveatOnDischarge", ``}, // security.Caveat |
| 588 | {"additionalCaveatsOnDischarge", ``}, // []security.Caveat |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 589 | }, |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 590 | OutArgs: []rpc.ArgDesc{ |
Asim Shankar | 0864282 | 2015-03-02 21:21:09 -0800 | [diff] [blame] | 591 | {"", ``}, // security.Discharge |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 592 | }, |
| 593 | }, |
| 594 | { |
| 595 | Name: "PublicKey", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 596 | OutArgs: []rpc.ArgDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 597 | {"", ``}, // []byte |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 598 | }, |
| 599 | }, |
| 600 | { |
gauthamt | f826393 | 2014-12-16 10:59:09 -0800 | [diff] [blame] | 601 | Name: "BlessingsByName", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 602 | InArgs: []rpc.ArgDesc{ |
gauthamt | f826393 | 2014-12-16 10:59:09 -0800 | [diff] [blame] | 603 | {"name", ``}, // security.BlessingPattern |
| 604 | }, |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 605 | OutArgs: []rpc.ArgDesc{ |
Asim Shankar | b07ec69 | 2015-02-27 23:40:44 -0800 | [diff] [blame] | 606 | {"", ``}, // []security.Blessings |
gauthamt | f826393 | 2014-12-16 10:59:09 -0800 | [diff] [blame] | 607 | }, |
| 608 | }, |
| 609 | { |
| 610 | Name: "BlessingsInfo", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 611 | InArgs: []rpc.ArgDesc{ |
Asim Shankar | b07ec69 | 2015-02-27 23:40:44 -0800 | [diff] [blame] | 612 | {"blessings", ``}, // security.Blessings |
gauthamt | f826393 | 2014-12-16 10:59:09 -0800 | [diff] [blame] | 613 | }, |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 614 | OutArgs: []rpc.ArgDesc{ |
gauthamt | 8dc9a18 | 2015-01-08 18:03:18 -0800 | [diff] [blame] | 615 | {"", ``}, // map[string][]security.Caveat |
gauthamt | f826393 | 2014-12-16 10:59:09 -0800 | [diff] [blame] | 616 | }, |
| 617 | }, |
| 618 | { |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 619 | Name: "AddToRoots", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 620 | InArgs: []rpc.ArgDesc{ |
Asim Shankar | b07ec69 | 2015-02-27 23:40:44 -0800 | [diff] [blame] | 621 | {"blessing", ``}, // security.Blessings |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 622 | }, |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 623 | }, |
| 624 | { |
| 625 | Name: "BlessingStoreSet", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 626 | InArgs: []rpc.ArgDesc{ |
Asim Shankar | b07ec69 | 2015-02-27 23:40:44 -0800 | [diff] [blame] | 627 | {"blessings", ``}, // security.Blessings |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 628 | {"forPeers", ``}, // security.BlessingPattern |
| 629 | }, |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 630 | OutArgs: []rpc.ArgDesc{ |
Asim Shankar | b07ec69 | 2015-02-27 23:40:44 -0800 | [diff] [blame] | 631 | {"", ``}, // security.Blessings |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 632 | }, |
| 633 | }, |
| 634 | { |
| 635 | Name: "BlessingStoreForPeer", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 636 | InArgs: []rpc.ArgDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 637 | {"peerBlessings", ``}, // []string |
| 638 | }, |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 639 | OutArgs: []rpc.ArgDesc{ |
Asim Shankar | b07ec69 | 2015-02-27 23:40:44 -0800 | [diff] [blame] | 640 | {"", ``}, // security.Blessings |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 641 | }, |
| 642 | }, |
| 643 | { |
| 644 | Name: "BlessingStoreSetDefault", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 645 | InArgs: []rpc.ArgDesc{ |
Asim Shankar | b07ec69 | 2015-02-27 23:40:44 -0800 | [diff] [blame] | 646 | {"blessings", ``}, // security.Blessings |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 647 | }, |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 648 | }, |
| 649 | { |
| 650 | Name: "BlessingStoreDefault", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 651 | OutArgs: []rpc.ArgDesc{ |
Asim Shankar | b07ec69 | 2015-02-27 23:40:44 -0800 | [diff] [blame] | 652 | {"", ``}, // security.Blessings |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 653 | }, |
| 654 | }, |
| 655 | { |
gauthamt | f826393 | 2014-12-16 10:59:09 -0800 | [diff] [blame] | 656 | Name: "BlessingStorePeerBlessings", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 657 | OutArgs: []rpc.ArgDesc{ |
Asim Shankar | b07ec69 | 2015-02-27 23:40:44 -0800 | [diff] [blame] | 658 | {"", ``}, // map[security.BlessingPattern]security.Blessings |
gauthamt | f826393 | 2014-12-16 10:59:09 -0800 | [diff] [blame] | 659 | }, |
| 660 | }, |
| 661 | { |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 662 | Name: "BlessingStoreDebugString", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 663 | OutArgs: []rpc.ArgDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 664 | {"", ``}, // string |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 665 | }, |
| 666 | }, |
| 667 | { |
Suharsh Sivakumar | d7d4e22 | 2015-06-22 11:10:44 -0700 | [diff] [blame] | 668 | Name: "BlessingStoreCacheDischarge", |
| 669 | InArgs: []rpc.ArgDesc{ |
| 670 | {"discharge", ``}, // security.Discharge |
| 671 | {"caveat", ``}, // security.Caveat |
| 672 | {"impetus", ``}, // security.DischargeImpetus |
| 673 | }, |
| 674 | }, |
| 675 | { |
| 676 | Name: "BlessingStoreClearDischarges", |
| 677 | InArgs: []rpc.ArgDesc{ |
| 678 | {"discharges", ``}, // []security.Discharge |
| 679 | }, |
| 680 | }, |
| 681 | { |
| 682 | Name: "BlessingStoreDischarge", |
| 683 | InArgs: []rpc.ArgDesc{ |
| 684 | {"caveat", ``}, // security.Caveat |
| 685 | {"impetus", ``}, // security.DischargeImpetus |
| 686 | }, |
| 687 | OutArgs: []rpc.ArgDesc{ |
| 688 | {"wd", ``}, // security.Discharge |
| 689 | }, |
| 690 | }, |
| 691 | { |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 692 | Name: "BlessingRootsAdd", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 693 | InArgs: []rpc.ArgDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 694 | {"root", ``}, // []byte |
| 695 | {"pattern", ``}, // security.BlessingPattern |
| 696 | }, |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 697 | }, |
| 698 | { |
| 699 | Name: "BlessingRootsRecognized", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 700 | InArgs: []rpc.ArgDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 701 | {"root", ``}, // []byte |
| 702 | {"blessing", ``}, // string |
| 703 | }, |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 704 | }, |
| 705 | { |
Ankur | 9e5b772 | 2015-04-28 15:00:25 -0700 | [diff] [blame] | 706 | Name: "BlessingRootsDump", |
| 707 | OutArgs: []rpc.ArgDesc{ |
| 708 | {"", ``}, // map[security.BlessingPattern][][]byte |
| 709 | }, |
| 710 | }, |
| 711 | { |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 712 | Name: "BlessingRootsDebugString", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 713 | OutArgs: []rpc.ArgDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 714 | {"", ``}, // string |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 715 | }, |
| 716 | }, |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 717 | { |
| 718 | Name: "NotifyWhenChanged", |
| 719 | Doc: "// Clients using caching should call NotifyWhenChanged upon connecting to\n// the server. The server will stream back values whenever the client should\n// flush the cache. The streamed value is arbitrary, simply flush whenever\n// recieving a new item.", |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 720 | }, |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 721 | }, |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 722 | } |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 723 | |
| 724 | // AgentNotifyWhenChangedServerStream is the server stream for Agent.NotifyWhenChanged. |
| 725 | type AgentNotifyWhenChangedServerStream interface { |
| 726 | // SendStream returns the send side of the Agent.NotifyWhenChanged server stream. |
| 727 | SendStream() interface { |
| 728 | // Send places the item onto the output stream. Returns errors encountered |
| 729 | // while sending. Blocks if there is no buffer space; will unblock when |
| 730 | // buffer space is available. |
| 731 | Send(item bool) error |
| 732 | } |
| 733 | } |
| 734 | |
Suharsh Sivakumar | 31f4985 | 2015-03-03 16:13:20 -0800 | [diff] [blame] | 735 | // AgentNotifyWhenChangedServerCall represents the context passed to Agent.NotifyWhenChanged. |
| 736 | type AgentNotifyWhenChangedServerCall interface { |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 737 | rpc.ServerCall |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 738 | AgentNotifyWhenChangedServerStream |
| 739 | } |
| 740 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 741 | // AgentNotifyWhenChangedServerCallStub is a wrapper that converts rpc.StreamServerCall into |
Suharsh Sivakumar | 31f4985 | 2015-03-03 16:13:20 -0800 | [diff] [blame] | 742 | // a typesafe stub that implements AgentNotifyWhenChangedServerCall. |
| 743 | type AgentNotifyWhenChangedServerCallStub struct { |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 744 | rpc.StreamServerCall |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 745 | } |
| 746 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 747 | // Init initializes AgentNotifyWhenChangedServerCallStub from rpc.StreamServerCall. |
| 748 | func (s *AgentNotifyWhenChangedServerCallStub) Init(call rpc.StreamServerCall) { |
Matt Rosencrantz | 1dcd0a9 | 2015-02-27 11:05:59 -0800 | [diff] [blame] | 749 | s.StreamServerCall = call |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 750 | } |
| 751 | |
| 752 | // SendStream returns the send side of the Agent.NotifyWhenChanged server stream. |
Suharsh Sivakumar | 31f4985 | 2015-03-03 16:13:20 -0800 | [diff] [blame] | 753 | func (s *AgentNotifyWhenChangedServerCallStub) SendStream() interface { |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 754 | Send(item bool) error |
| 755 | } { |
Suharsh Sivakumar | 31f4985 | 2015-03-03 16:13:20 -0800 | [diff] [blame] | 756 | return implAgentNotifyWhenChangedServerCallSend{s} |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 757 | } |
| 758 | |
Suharsh Sivakumar | 31f4985 | 2015-03-03 16:13:20 -0800 | [diff] [blame] | 759 | type implAgentNotifyWhenChangedServerCallSend struct { |
| 760 | s *AgentNotifyWhenChangedServerCallStub |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 761 | } |
| 762 | |
Suharsh Sivakumar | 31f4985 | 2015-03-03 16:13:20 -0800 | [diff] [blame] | 763 | func (s implAgentNotifyWhenChangedServerCallSend) Send(item bool) error { |
Ryan Brown | 81bcb3a | 2015-02-11 10:58:01 -0800 | [diff] [blame] | 764 | return s.s.Send(item) |
| 765 | } |