Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 1 | // This file was auto-generated by the veyron vdl tool. |
| 2 | // Source: discharger.vdl |
| 3 | |
Ali Ghassemi | 46bb7e0 | 2014-06-19 15:38:48 -0700 | [diff] [blame] | 4 | package security |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 5 | |
| 6 | import ( |
Jiri Simsa | 519c507 | 2014-09-17 21:37:57 -0700 | [diff] [blame] | 7 | "veyron.io/veyron/veyron2/security" |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 8 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 9 | // 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 Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 15 | ) |
| 16 | |
Jing Jin | 896d776 | 2014-11-03 11:18:52 -0800 | [diff] [blame] | 17 | // TODO(toddw): Remove this line once the new signature support is done. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 18 | // It corrects a bug where __wiretype is unused in VDL pacakges where only |
Jing Jin | 896d776 | 2014-11-03 11:18:52 -0800 | [diff] [blame] | 19 | // bootstrap types are used on interfaces. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 20 | const _ = __wiretype.TypeIDInvalid |
Shyam Jayaraman | c4aed6e | 2014-07-22 14:25:06 -0700 | [diff] [blame] | 21 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 22 | // DischargerClientMethods is the client interface |
| 23 | // containing Discharger methods. |
| 24 | // |
Asim Shankar | a94e507 | 2014-08-19 18:18:36 -0700 | [diff] [blame] | 25 | // Discharger is the interface for obtaining discharges for ThirdPartyCaveats. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 26 | type DischargerClientMethods interface { |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 27 | // 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 Shankar | a94e507 | 2014-08-19 18:18:36 -0700 | [diff] [blame] | 30 | // |
Ankur | f044a8d | 2014-09-05 17:05:24 -0700 | [diff] [blame] | 31 | // Caveat and Discharge are of type ThirdPartyCaveat and Discharge |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 32 | // 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 Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 35 | Discharge(ctx __context.T, Caveat __vdlutil.Any, Impetus security.DischargeImpetus, opts ...__ipc.CallOpt) (Discharge __vdlutil.Any, err error) |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 36 | } |
| 37 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 38 | // DischargerClientStub adds universal methods to DischargerClientMethods. |
| 39 | type DischargerClientStub interface { |
| 40 | DischargerClientMethods |
| 41 | __ipc.UniversalServiceMethods |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 42 | } |
| 43 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 44 | // DischargerClient returns a client stub for Discharger. |
| 45 | func 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 Rosencrantz | bf85d54 | 2014-08-22 13:31:14 -0700 | [diff] [blame] | 49 | client = clientOpt |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 50 | } |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 51 | } |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 52 | return implDischargerClientStub{name, client} |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 53 | } |
| 54 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 55 | type implDischargerClientStub struct { |
| 56 | name string |
| 57 | client __ipc.Client |
| 58 | } |
| 59 | |
| 60 | func (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 | |
| 67 | func (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 | |
| 78 | func (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 Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 89 | // DischargerServerMethods is the interface a server writer |
| 90 | // implements for Discharger. |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 91 | // |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 92 | // Discharger is the interface for obtaining discharges for ThirdPartyCaveats. |
| 93 | type 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 Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 106 | // Discharger methods, as expected by ipc.Server. |
| 107 | // There is no difference between this interface and DischargerServerMethods |
| 108 | // since there are no streaming methods. |
| 109 | type DischargerServerStubMethods DischargerServerMethods |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 110 | |
| 111 | // DischargerServerStub adds universal methods to DischargerServerStubMethods. |
| 112 | type DischargerServerStub interface { |
| 113 | DischargerServerStubMethods |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 114 | // Describe the Discharger interfaces. |
| 115 | Describe__() []__ipc.InterfaceDesc |
| 116 | // Signature will be replaced with Describe__. |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 117 | Signature(ctx __ipc.ServerContext) (__ipc.ServiceSignature, error) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 118 | } |
| 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. |
| 123 | func DischargerServer(impl DischargerServerMethods) DischargerServerStub { |
| 124 | stub := implDischargerServerStub{ |
| 125 | impl: impl, |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 126 | } |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 127 | // 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 Thellend | 94bc464 | 2014-11-05 18:05:08 -0800 | [diff] [blame] | 133 | } |
Robin Thellend | 94bc464 | 2014-11-05 18:05:08 -0800 | [diff] [blame] | 134 | return stub |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 135 | } |
| 136 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 137 | type implDischargerServerStub struct { |
| 138 | impl DischargerServerMethods |
| 139 | gs *__ipc.GlobState |
Matt Rosencrantz | bf85d54 | 2014-08-22 13:31:14 -0700 | [diff] [blame] | 140 | } |
| 141 | |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 142 | func (s implDischargerServerStub) Discharge(ctx __ipc.ServerContext, i0 __vdlutil.Any, i1 security.DischargeImpetus) (__vdlutil.Any, error) { |
| 143 | return s.impl.Discharge(ctx, i0, i1) |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 144 | } |
| 145 | |
Robin Thellend | 39ac323 | 2014-12-02 09:50:41 -0800 | [diff] [blame] | 146 | func (s implDischargerServerStub) Globber() *__ipc.GlobState { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 147 | return s.gs |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 148 | } |
| 149 | |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 150 | func (s implDischargerServerStub) Describe__() []__ipc.InterfaceDesc { |
| 151 | return []__ipc.InterfaceDesc{DischargerDesc} |
| 152 | } |
| 153 | |
| 154 | // DischargerDesc describes the Discharger interface. |
| 155 | var DischargerDesc __ipc.InterfaceDesc = descDischarger |
| 156 | |
| 157 | // descDischarger hides the desc to keep godoc clean. |
| 158 | var 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 Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 174 | }, |
| 175 | }, |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 176 | } |
| 177 | |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 178 | func (s implDischargerServerStub) Signature(ctx __ipc.ServerContext) (__ipc.ServiceSignature, error) { |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 179 | // TODO(toddw): Replace with new Describe__ implementation. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 180 | result := __ipc.ServiceSignature{Methods: make(map[string]__ipc.MethodSignature)} |
| 181 | result.Methods["Discharge"] = __ipc.MethodSignature{ |
| 182 | InArgs: []__ipc.MethodArgument{ |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 183 | {Name: "Caveat", Type: 65}, |
Asim Shankar | 61e1003 | 2014-09-15 13:52:34 -0700 | [diff] [blame] | 184 | {Name: "Impetus", Type: 69}, |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 185 | }, |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 186 | OutArgs: []__ipc.MethodArgument{ |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 187 | {Name: "Discharge", Type: 65}, |
Asim Shankar | 61e1003 | 2014-09-15 13:52:34 -0700 | [diff] [blame] | 188 | {Name: "err", Type: 70}, |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 189 | }, |
| 190 | } |
| 191 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 192 | 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 Shankar | a94e507 | 2014-08-19 18:18:36 -0700 | [diff] [blame] | 198 | }, |
Jiri Simsa | 519c507 | 2014-09-17 21:37:57 -0700 | [diff] [blame] | 199 | "veyron.io/veyron/veyron2/security.DischargeImpetus", []string(nil)}, |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 200 | __wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}} |
Andres Erbsen | 975c883 | 2014-06-18 12:06:07 -0700 | [diff] [blame] | 201 | |
| 202 | return result, nil |
| 203 | } |