| // Copyright 2020 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| // |
| // Code generated by third_party/go/regen-fidl; DO NOT EDIT. |
| |
| package bindingstest |
| |
| import ( |
| _zx "syscall/zx" |
| _bindings "syscall/zx/fidl" |
| ) |
| |
| type HasClientEnd struct { |
| _ struct{} `fidl:"s" fidl_size_v2:"4" fidl_alignment_v2:"4"` |
| ClientEnd ExampleProtocolWithCtxInterface `fidl_offset_v2:"0" fidl_handle_subtype:"4"` |
| } |
| |
| var _mHasClientEnd = _bindings.CreateLazyMarshaler(HasClientEnd{}) |
| |
| func (msg *HasClientEnd) Marshaler() _bindings.Marshaler { |
| return _mHasClientEnd |
| } |
| |
| type HasServerEnd struct { |
| _ struct{} `fidl:"s" fidl_size_v2:"4" fidl_alignment_v2:"4"` |
| ServerEnd ExampleProtocolWithCtxInterfaceRequest `fidl_offset_v2:"0" fidl_handle_subtype:"4" fidl_bounds:"0"` |
| } |
| |
| var _mHasServerEnd = _bindings.CreateLazyMarshaler(HasServerEnd{}) |
| |
| func (msg *HasServerEnd) Marshaler() _bindings.Marshaler { |
| return _mHasServerEnd |
| } |
| |
| type TestInterface1 struct { |
| _ struct{} `fidl:"s" fidl_size_v2:"16" fidl_alignment_v2:"4"` |
| A Test1WithCtxInterface `fidl_offset_v2:"0" fidl_handle_subtype:"4"` |
| B Test1WithCtxInterface `fidl_offset_v2:"4" fidl_handle_subtype:"4"` |
| C Test1WithCtxInterfaceRequest `fidl_offset_v2:"8" fidl_handle_subtype:"4" fidl_bounds:"0"` |
| D Test1WithCtxInterfaceRequest `fidl_offset_v2:"12" fidl_handle_subtype:"4" fidl_bounds:"1"` |
| } |
| |
| var _mTestInterface1 = _bindings.CreateLazyMarshaler(TestInterface1{}) |
| |
| func (msg *TestInterface1) Marshaler() _bindings.Marshaler { |
| return _mTestInterface1 |
| } |
| |
| type test1WithCtxEchoRequest struct { |
| _ struct{} `fidl:"s" fidl_size_v2:"16" fidl_alignment_v2:"8"` |
| In *string `fidl_offset_v2:"0" fidl_bounds:""` |
| } |
| |
| var _mtest1WithCtxEchoRequest = _bindings.CreateLazyMarshaler(test1WithCtxEchoRequest{}) |
| |
| func (msg *test1WithCtxEchoRequest) Marshaler() _bindings.Marshaler { |
| return _mtest1WithCtxEchoRequest |
| } |
| |
| type test1WithCtxEchoResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v2:"16" fidl_alignment_v2:"8"` |
| Out *string `fidl_offset_v2:"0" fidl_bounds:""` |
| } |
| |
| var _mtest1WithCtxEchoResponse = _bindings.CreateLazyMarshaler(test1WithCtxEchoResponse{}) |
| |
| func (msg *test1WithCtxEchoResponse) Marshaler() _bindings.Marshaler { |
| return _mtest1WithCtxEchoResponse |
| } |
| |
| type test1WithCtxSurpriseResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v2:"16" fidl_alignment_v2:"8"` |
| Foo string `fidl_offset_v2:"0" fidl_bounds:""` |
| } |
| |
| var _mtest1WithCtxSurpriseResponse = _bindings.CreateLazyMarshaler(test1WithCtxSurpriseResponse{}) |
| |
| func (msg *test1WithCtxSurpriseResponse) Marshaler() _bindings.Marshaler { |
| return _mtest1WithCtxSurpriseResponse |
| } |
| |
| type test1WithCtxEchoHandleRightsRequest struct { |
| _ struct{} `fidl:"s" fidl_size_v2:"4" fidl_alignment_v2:"4"` |
| H _zx.Port `fidl_offset_v2:"0" fidl_handle_subtype:"6" fidl_handle_rights:"7" fidl_bounds:"0"` |
| } |
| |
| var _mtest1WithCtxEchoHandleRightsRequest = _bindings.CreateLazyMarshaler(test1WithCtxEchoHandleRightsRequest{}) |
| |
| func (msg *test1WithCtxEchoHandleRightsRequest) Marshaler() _bindings.Marshaler { |
| return _mtest1WithCtxEchoHandleRightsRequest |
| } |
| |
| type test1WithCtxEchoHandleRightsResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v2:"4" fidl_alignment_v2:"4"` |
| Rights uint32 `fidl_offset_v2:"0"` |
| } |
| |
| var _mtest1WithCtxEchoHandleRightsResponse = _bindings.CreateLazyMarshaler(test1WithCtxEchoHandleRightsResponse{}) |
| |
| func (msg *test1WithCtxEchoHandleRightsResponse) Marshaler() _bindings.Marshaler { |
| return _mtest1WithCtxEchoHandleRightsResponse |
| } |
| |
| type SimpleTable struct { |
| _ struct{} `fidl:"t" fidl_size_v2:"16" fidl_alignment_v2:"8" fidl_resource:"false"` |
| I_unknownData interface{} |
| X int64 `fidl_ordinal:"1"` |
| XPresent bool |
| Y int64 `fidl_ordinal:"5"` |
| YPresent bool |
| } |
| |
| var _mSimpleTable = _bindings.CreateLazyMarshaler(SimpleTable{}) |
| |
| func (msg *SimpleTable) Marshaler() _bindings.Marshaler { |
| return _mSimpleTable |
| } |
| |
| func (u *SimpleTable) SetX(x int64) { |
| u.X = x |
| u.XPresent = true |
| } |
| |
| func (u *SimpleTable) GetX() int64 { |
| return u.X |
| } |
| |
| func (u *SimpleTable) GetXWithDefault(_default int64) int64 { |
| if !u.HasX() { |
| return _default |
| } |
| return u.X |
| } |
| |
| func (u *SimpleTable) HasX() bool { |
| return u.XPresent |
| } |
| |
| func (u *SimpleTable) ClearX() { |
| u.XPresent = false |
| } |
| |
| func (u *SimpleTable) SetY(y int64) { |
| u.Y = y |
| u.YPresent = true |
| } |
| |
| func (u *SimpleTable) GetY() int64 { |
| return u.Y |
| } |
| |
| func (u *SimpleTable) GetYWithDefault(_default int64) int64 { |
| if !u.HasY() { |
| return _default |
| } |
| return u.Y |
| } |
| |
| func (u *SimpleTable) HasY() bool { |
| return u.YPresent |
| } |
| |
| func (u *SimpleTable) ClearY() { |
| u.YPresent = false |
| } |
| |
| func (u *SimpleTable) HasUnknownData() bool { |
| return u.I_unknownData != nil |
| } |
| |
| func (u *SimpleTable) GetUnknownData() map[uint64]_bindings.UnknownData { |
| return u.I_unknownData.(map[uint64]_bindings.UnknownData) |
| } |
| |
| const ( |
| Test1EchoOrdinal uint64 = 0x4adc92c9e871ae62 |
| Test1NoResponseOrdinal uint64 = 0x584f4d438578f337 |
| Test1EmptyResponseOrdinal uint64 = 0x12ee80a1f8a85427 |
| Test1SurpriseOrdinal uint64 = 0xf93fd4731796fd9 |
| Test1EchoHandleRightsOrdinal uint64 = 0x53b1df24e93e434e |
| ) |
| |
| type Test1WithCtxInterface _bindings.ChannelProxy |
| |
| func (p *Test1WithCtxInterface) Echo(ctx_ _bindings.Context, in *string) (*string, error) { |
| req_ := &test1WithCtxEchoRequest{In: in} |
| resp_ := &test1WithCtxEchoResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(Test1EchoOrdinal, req_, resp_) |
| return (*resp_).Out, err_ |
| } |
| |
| func (p *Test1WithCtxInterface) NoResponse(ctx_ _bindings.Context) error { |
| var req_ _bindings.Message |
| err_ := ((*_bindings.ChannelProxy)(p)).Send(Test1NoResponseOrdinal, req_) |
| return err_ |
| } |
| |
| func (p *Test1WithCtxInterface) EmptyResponse(ctx_ _bindings.Context) error { |
| var req_ _bindings.Message |
| var resp_ _bindings.Message |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(Test1EmptyResponseOrdinal, req_, resp_) |
| return err_ |
| } |
| |
| func (p *Test1WithCtxInterface) ExpectSurprise(ctx_ _bindings.Context) (string, error) { |
| resp_ := &test1WithCtxSurpriseResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Recv(Test1SurpriseOrdinal, resp_) |
| return (*resp_).Foo, err_ |
| } |
| |
| func (p *Test1WithCtxInterface) EchoHandleRights(ctx_ _bindings.Context, h _zx.Port) (uint32, error) { |
| req_ := &test1WithCtxEchoHandleRightsRequest{H: h} |
| resp_ := &test1WithCtxEchoHandleRightsResponse{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(Test1EchoHandleRightsOrdinal, req_, resp_) |
| return (*resp_).Rights, err_ |
| } |
| |
| type Test1WithCtx interface { |
| Echo(ctx_ _bindings.Context, in *string) (*string, error) |
| NoResponse(ctx_ _bindings.Context) error |
| EmptyResponse(ctx_ _bindings.Context) error |
| EchoHandleRights(ctx_ _bindings.Context, h _zx.Port) (uint32, error) |
| } |
| |
| type Test1WithCtxTransitionalBase struct{} |
| |
| type Test1WithCtxInterfaceRequest _bindings.InterfaceRequest |
| |
| func NewTest1WithCtxInterfaceRequest() (Test1WithCtxInterfaceRequest, *Test1WithCtxInterface, error) { |
| req, cli, err := _bindings.NewInterfaceRequest() |
| return Test1WithCtxInterfaceRequest(req), (*Test1WithCtxInterface)(cli), err |
| } |
| |
| type Test1WithCtxStub struct { |
| Impl Test1WithCtx |
| } |
| |
| func (s_ *Test1WithCtxStub) Dispatch(args_ _bindings.DispatchArgs) (_bindings.Message, bool, error) { |
| switch args_.Ordinal { |
| case Test1EchoOrdinal: |
| in_ := &test1WithCtxEchoRequest{} |
| marshalerCtx, ok := _bindings.GetMarshalerContext(args_.Ctx) |
| if !ok { |
| return nil, false, _bindings.ErrMissingMarshalerContext |
| } |
| if err_ := _bindings.Unmarshal(marshalerCtx, args_.Bytes, args_.HandleInfos, in_); err_ != nil { |
| return nil, false, err_ |
| } |
| out, err_ := s_.Impl.Echo(args_.Ctx, (*in_).In) |
| out_ := &test1WithCtxEchoResponse{Out: out} |
| return out_, true, err_ |
| case Test1NoResponseOrdinal: |
| err_ := s_.Impl.NoResponse(args_.Ctx) |
| return nil, false, err_ |
| case Test1EmptyResponseOrdinal: |
| err_ := s_.Impl.EmptyResponse(args_.Ctx) |
| return nil, true, err_ |
| case Test1EchoHandleRightsOrdinal: |
| in_ := &test1WithCtxEchoHandleRightsRequest{} |
| marshalerCtx, ok := _bindings.GetMarshalerContext(args_.Ctx) |
| if !ok { |
| return nil, false, _bindings.ErrMissingMarshalerContext |
| } |
| if err_ := _bindings.Unmarshal(marshalerCtx, args_.Bytes, args_.HandleInfos, in_); err_ != nil { |
| return nil, false, err_ |
| } |
| rights, err_ := s_.Impl.EchoHandleRights(args_.Ctx, (*in_).H) |
| out_ := &test1WithCtxEchoHandleRightsResponse{Rights: rights} |
| return out_, true, err_ |
| } |
| return nil, false, _bindings.ErrUnknownOrdinal |
| } |
| |
| type Test1EventProxy _bindings.ChannelProxy |
| |
| func (p *Test1EventProxy) Surprise(foo string) error { |
| event_ := &test1WithCtxSurpriseResponse{Foo: foo} |
| return ((*_bindings.ChannelProxy)(p)).Send(Test1SurpriseOrdinal, event_) |
| } |
| |
| type ExampleProtocolWithCtxInterface _bindings.ChannelProxy |
| |
| type ExampleProtocolWithCtx interface { |
| } |
| |
| type ExampleProtocolWithCtxTransitionalBase struct{} |
| |
| type ExampleProtocolWithCtxInterfaceRequest _bindings.InterfaceRequest |
| |
| func NewExampleProtocolWithCtxInterfaceRequest() (ExampleProtocolWithCtxInterfaceRequest, *ExampleProtocolWithCtxInterface, error) { |
| req, cli, err := _bindings.NewInterfaceRequest() |
| return ExampleProtocolWithCtxInterfaceRequest(req), (*ExampleProtocolWithCtxInterface)(cli), err |
| } |
| |
| type ExampleProtocolWithCtxStub struct { |
| Impl ExampleProtocolWithCtx |
| } |
| |
| func (s_ *ExampleProtocolWithCtxStub) Dispatch(args_ _bindings.DispatchArgs) (_bindings.Message, bool, error) { |
| switch args_.Ordinal { |
| } |
| return nil, false, _bindings.ErrUnknownOrdinal |
| } |
| |
| type ExampleProtocolEventProxy _bindings.ChannelProxy |