blob: 4c914e7d223fd6d765af7da76b88bad57cd39728 [file] [log] [blame]
Andres Erbsen975c8832014-06-18 12:06:07 -07001// This file was auto-generated by the veyron vdl tool.
2// Source: discharger.vdl
3
Ali Ghassemi46bb7e02014-06-19 15:38:48 -07004package security
Andres Erbsen975c8832014-06-18 12:06:07 -07005
6import (
Jiri Simsa519c5072014-09-17 21:37:57 -07007 "veyron.io/veyron/veyron2/security"
Andres Erbsen975c8832014-06-18 12:06:07 -07008
Todd Wang702385a2014-11-07 01:54:08 -08009 // The non-user imports are prefixed with "__" to prevent collisions.
10 __veyron2 "veyron.io/veyron/veyron2"
11 __context "veyron.io/veyron/veyron2/context"
12 __ipc "veyron.io/veyron/veyron2/ipc"
13 __vdlutil "veyron.io/veyron/veyron2/vdl/vdlutil"
14 __wiretype "veyron.io/veyron/veyron2/wiretype"
Andres Erbsen975c8832014-06-18 12:06:07 -070015)
16
Jing Jin896d7762014-11-03 11:18:52 -080017// TODO(toddw): Remove this line once the new signature support is done.
Todd Wang702385a2014-11-07 01:54:08 -080018// It corrects a bug where __wiretype is unused in VDL pacakges where only
Jing Jin896d7762014-11-03 11:18:52 -080019// bootstrap types are used on interfaces.
Todd Wang702385a2014-11-07 01:54:08 -080020const _ = __wiretype.TypeIDInvalid
Shyam Jayaramanc4aed6e2014-07-22 14:25:06 -070021
Todd Wang702385a2014-11-07 01:54:08 -080022// DischargerClientMethods is the client interface
23// containing Discharger methods.
24//
Asim Shankara94e5072014-08-19 18:18:36 -070025// Discharger is the interface for obtaining discharges for ThirdPartyCaveats.
Todd Wang702385a2014-11-07 01:54:08 -080026type DischargerClientMethods interface {
Andres Erbsen975c8832014-06-18 12:06:07 -070027 // Discharge is called by a principal that holds a blessing with a third
28 // party caveat and seeks to get a discharge that proves the fulfillment of
29 // this caveat.
Asim Shankara94e5072014-08-19 18:18:36 -070030 //
Ankurf044a8d2014-09-05 17:05:24 -070031 // Caveat and Discharge are of type ThirdPartyCaveat and Discharge
Andres Erbsen975c8832014-06-18 12:06:07 -070032 // respectively. (not enforced here because vdl does not know these types)
33 // TODO(ataly,ashankar): Figure out a VDL representation for ThirdPartyCaveat
34 // and Discharge and use those here?
Todd Wang702385a2014-11-07 01:54:08 -080035 Discharge(ctx __context.T, Caveat __vdlutil.Any, Impetus security.DischargeImpetus, opts ...__ipc.CallOpt) (Discharge __vdlutil.Any, err error)
Andres Erbsen975c8832014-06-18 12:06:07 -070036}
37
Todd Wang702385a2014-11-07 01:54:08 -080038// DischargerClientStub adds universal methods to DischargerClientMethods.
39type DischargerClientStub interface {
40 DischargerClientMethods
41 __ipc.UniversalServiceMethods
Andres Erbsen975c8832014-06-18 12:06:07 -070042}
43
Todd Wang702385a2014-11-07 01:54:08 -080044// DischargerClient returns a client stub for Discharger.
45func DischargerClient(name string, opts ...__ipc.BindOpt) DischargerClientStub {
46 var client __ipc.Client
47 for _, opt := range opts {
48 if clientOpt, ok := opt.(__ipc.Client); ok {
Matt Rosencrantzbf85d542014-08-22 13:31:14 -070049 client = clientOpt
Andres Erbsen975c8832014-06-18 12:06:07 -070050 }
Andres Erbsen975c8832014-06-18 12:06:07 -070051 }
Todd Wang702385a2014-11-07 01:54:08 -080052 return implDischargerClientStub{name, client}
Andres Erbsen975c8832014-06-18 12:06:07 -070053}
54
Todd Wang702385a2014-11-07 01:54:08 -080055type implDischargerClientStub struct {
56 name string
57 client __ipc.Client
58}
59
60func (c implDischargerClientStub) c(ctx __context.T) __ipc.Client {
61 if c.client != nil {
62 return c.client
63 }
64 return __veyron2.RuntimeFromContext(ctx).Client()
65}
66
67func (c implDischargerClientStub) Discharge(ctx __context.T, i0 __vdlutil.Any, i1 security.DischargeImpetus, opts ...__ipc.CallOpt) (o0 __vdlutil.Any, err error) {
68 var call __ipc.Call
69 if call, err = c.c(ctx).StartCall(ctx, c.name, "Discharge", []interface{}{i0, i1}, opts...); err != nil {
70 return
71 }
72 if ierr := call.Finish(&o0, &err); ierr != nil {
73 err = ierr
74 }
75 return
76}
77
78func (c implDischargerClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
79 var call __ipc.Call
80 if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
81 return
82 }
83 if ierr := call.Finish(&o0, &err); ierr != nil {
84 err = ierr
85 }
86 return
87}
88
Todd Wang702385a2014-11-07 01:54:08 -080089// DischargerServerMethods is the interface a server writer
90// implements for Discharger.
Andres Erbsen975c8832014-06-18 12:06:07 -070091//
Todd Wang702385a2014-11-07 01:54:08 -080092// Discharger is the interface for obtaining discharges for ThirdPartyCaveats.
93type DischargerServerMethods interface {
94 // Discharge is called by a principal that holds a blessing with a third
95 // party caveat and seeks to get a discharge that proves the fulfillment of
96 // this caveat.
97 //
98 // Caveat and Discharge are of type ThirdPartyCaveat and Discharge
99 // respectively. (not enforced here because vdl does not know these types)
100 // TODO(ataly,ashankar): Figure out a VDL representation for ThirdPartyCaveat
101 // and Discharge and use those here?
102 Discharge(ctx __ipc.ServerContext, Caveat __vdlutil.Any, Impetus security.DischargeImpetus) (Discharge __vdlutil.Any, err error)
103}
104
105// DischargerServerStubMethods is the server interface containing
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800106// Discharger methods, as expected by ipc.Server.
107// There is no difference between this interface and DischargerServerMethods
108// since there are no streaming methods.
109type DischargerServerStubMethods DischargerServerMethods
Todd Wang702385a2014-11-07 01:54:08 -0800110
111// DischargerServerStub adds universal methods to DischargerServerStubMethods.
112type DischargerServerStub interface {
113 DischargerServerStubMethods
Todd Wang5739dda2014-11-16 22:44:02 -0800114 // Describe the Discharger interfaces.
115 Describe__() []__ipc.InterfaceDesc
116 // Signature will be replaced with Describe__.
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800117 Signature(ctx __ipc.ServerContext) (__ipc.ServiceSignature, error)
Todd Wang702385a2014-11-07 01:54:08 -0800118}
119
120// DischargerServer returns a server stub for Discharger.
121// It converts an implementation of DischargerServerMethods into
122// an object that may be used by ipc.Server.
123func DischargerServer(impl DischargerServerMethods) DischargerServerStub {
124 stub := implDischargerServerStub{
125 impl: impl,
Andres Erbsen975c8832014-06-18 12:06:07 -0700126 }
Todd Wang702385a2014-11-07 01:54:08 -0800127 // Initialize GlobState; always check the stub itself first, to handle the
128 // case where the user has the Glob method defined in their VDL source.
129 if gs := __ipc.NewGlobState(stub); gs != nil {
130 stub.gs = gs
131 } else if gs := __ipc.NewGlobState(impl); gs != nil {
132 stub.gs = gs
Robin Thellend94bc4642014-11-05 18:05:08 -0800133 }
Robin Thellend94bc4642014-11-05 18:05:08 -0800134 return stub
Andres Erbsen975c8832014-06-18 12:06:07 -0700135}
136
Todd Wang702385a2014-11-07 01:54:08 -0800137type implDischargerServerStub struct {
138 impl DischargerServerMethods
139 gs *__ipc.GlobState
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700140}
141
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800142func (s implDischargerServerStub) Discharge(ctx __ipc.ServerContext, i0 __vdlutil.Any, i1 security.DischargeImpetus) (__vdlutil.Any, error) {
143 return s.impl.Discharge(ctx, i0, i1)
Andres Erbsen975c8832014-06-18 12:06:07 -0700144}
145
Robin Thellend39ac3232014-12-02 09:50:41 -0800146func (s implDischargerServerStub) Globber() *__ipc.GlobState {
Todd Wang702385a2014-11-07 01:54:08 -0800147 return s.gs
Andres Erbsen975c8832014-06-18 12:06:07 -0700148}
149
Todd Wang5739dda2014-11-16 22:44:02 -0800150func (s implDischargerServerStub) Describe__() []__ipc.InterfaceDesc {
151 return []__ipc.InterfaceDesc{DischargerDesc}
152}
153
154// DischargerDesc describes the Discharger interface.
155var DischargerDesc __ipc.InterfaceDesc = descDischarger
156
157// descDischarger hides the desc to keep godoc clean.
158var descDischarger = __ipc.InterfaceDesc{
159 Name: "Discharger",
160 PkgPath: "veyron.io/veyron/veyron/services/security",
161 Doc: "// Discharger is the interface for obtaining discharges for ThirdPartyCaveats.",
162 Methods: []__ipc.MethodDesc{
163 {
164 Name: "Discharge",
165 Doc: "// Discharge is called by a principal that holds a blessing with a third\n// party caveat and seeks to get a discharge that proves the fulfillment of\n// this caveat.\n//\n// Caveat and Discharge are of type ThirdPartyCaveat and Discharge\n// respectively. (not enforced here because vdl does not know these types)\n// TODO(ataly,ashankar): Figure out a VDL representation for ThirdPartyCaveat\n// and Discharge and use those here?",
166 InArgs: []__ipc.ArgDesc{
167 {"Caveat", ``}, // __vdlutil.Any
168 {"Impetus", ``}, // security.DischargeImpetus
169 },
170 OutArgs: []__ipc.ArgDesc{
171 {"Discharge", ``}, // __vdlutil.Any
172 {"err", ``}, // error
173 },
Todd Wang5739dda2014-11-16 22:44:02 -0800174 },
175 },
Andres Erbsen975c8832014-06-18 12:06:07 -0700176}
177
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800178func (s implDischargerServerStub) Signature(ctx __ipc.ServerContext) (__ipc.ServiceSignature, error) {
Todd Wang5739dda2014-11-16 22:44:02 -0800179 // TODO(toddw): Replace with new Describe__ implementation.
Todd Wang702385a2014-11-07 01:54:08 -0800180 result := __ipc.ServiceSignature{Methods: make(map[string]__ipc.MethodSignature)}
181 result.Methods["Discharge"] = __ipc.MethodSignature{
182 InArgs: []__ipc.MethodArgument{
Andres Erbsen975c8832014-06-18 12:06:07 -0700183 {Name: "Caveat", Type: 65},
Asim Shankar61e10032014-09-15 13:52:34 -0700184 {Name: "Impetus", Type: 69},
Andres Erbsen975c8832014-06-18 12:06:07 -0700185 },
Todd Wang702385a2014-11-07 01:54:08 -0800186 OutArgs: []__ipc.MethodArgument{
Andres Erbsen975c8832014-06-18 12:06:07 -0700187 {Name: "Discharge", Type: 65},
Asim Shankar61e10032014-09-15 13:52:34 -0700188 {Name: "err", Type: 70},
Andres Erbsen975c8832014-06-18 12:06:07 -0700189 },
190 }
191
Todd Wang702385a2014-11-07 01:54:08 -0800192 result.TypeDefs = []__vdlutil.Any{
193 __wiretype.NamedPrimitiveType{Type: 0x1, Name: "anydata", Tags: []string(nil)}, __wiretype.NamedPrimitiveType{Type: 0x3, Name: "veyron.io/veyron/veyron2/security.BlessingPattern", Tags: []string(nil)}, __wiretype.SliceType{Elem: 0x42, Name: "", Tags: []string(nil)}, __wiretype.SliceType{Elem: 0x41, Name: "", Tags: []string(nil)}, __wiretype.StructType{
194 []__wiretype.FieldType{
195 __wiretype.FieldType{Type: 0x43, Name: "Server"},
196 __wiretype.FieldType{Type: 0x3, Name: "Method"},
197 __wiretype.FieldType{Type: 0x44, Name: "Arguments"},
Asim Shankara94e5072014-08-19 18:18:36 -0700198 },
Jiri Simsa519c5072014-09-17 21:37:57 -0700199 "veyron.io/veyron/veyron2/security.DischargeImpetus", []string(nil)},
Todd Wang702385a2014-11-07 01:54:08 -0800200 __wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}}
Andres Erbsen975c8832014-06-18 12:06:07 -0700201
202 return result, nil
203}