| // Copyright 2018 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. |
| // |
| // GENERATED FILE: Do not edit! |
| // |
| // To rebuild this file, invoke third_party/go/regen-fidl. |
| |
| // +build fuchsia |
| |
| package net |
| |
| import ( |
| _zx "syscall/zx" |
| _bindings "syscall/zx/fidl" |
| fuchsiaio "syscall/zx/io" |
| ) |
| |
| const ( |
| ControlCloneGenOrdinal uint64 = 0x17fe6a4c00000000 |
| ControlCloseGenOrdinal uint64 = 0x52b9568700000000 |
| ControlDescribeGenOrdinal uint64 = 0x1f62df5e00000000 |
| ControlOnOpenGenOrdinal uint64 = 0x4700a7bd00000000 |
| ControlSyncGenOrdinal uint64 = 0x62423faa00000000 |
| ControlGetAttrGenOrdinal uint64 = 0x4585e7c800000000 |
| ControlSetAttrGenOrdinal uint64 = 0xbd5559a00000000 |
| ControlIoctlGenOrdinal uint64 = 0x35f3aca700000000 |
| ControlBindGenOrdinal uint64 = 0x147441ed00000000 |
| ControlConnectGenOrdinal uint64 = 0x237ed33800000000 |
| ControlListenGenOrdinal uint64 = 0x2e63628600000000 |
| ControlAcceptGenOrdinal uint64 = 0x11ed297300000000 |
| ControlGetSockNameGenOrdinal uint64 = 0x63c1368200000000 |
| ControlGetPeerNameGenOrdinal uint64 = 0x58787bb600000000 |
| ControlSetSockOptGenOrdinal uint64 = 0x4ba217a700000000 |
| ControlGetSockOptGenOrdinal uint64 = 0x3685367800000000 |
| ControlIoctlPosixGenOrdinal uint64 = 0x50a8f69d00000000 |
| ) |
| |
| type controlCloneRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Flags uint32 |
| Object fuchsiaio.NodeInterfaceRequest `fidl2:"0"` |
| } |
| |
| var _mcontrolCloneRequest = _bindings.CreateLazyMarshaler(controlCloneRequest{}) |
| |
| func (msg *controlCloneRequest) Marshaler() _bindings.Marshaler { |
| return _mcontrolCloneRequest |
| } |
| |
| type controlCloseResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mcontrolCloseResponse = _bindings.CreateLazyMarshaler(controlCloseResponse{}) |
| |
| func (msg *controlCloseResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolCloseResponse |
| } |
| |
| type controlDescribeResponse struct { |
| _ struct{} `fidl2:"s,32,0"` |
| Info fuchsiaio.NodeInfo |
| } |
| |
| var _mcontrolDescribeResponse = _bindings.CreateLazyMarshaler(controlDescribeResponse{}) |
| |
| func (msg *controlDescribeResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolDescribeResponse |
| } |
| |
| type controlOnOpenResponse struct { |
| _ struct{} `fidl2:"s,16,0"` |
| S int32 |
| Info *fuchsiaio.NodeInfo |
| } |
| |
| var _mcontrolOnOpenResponse = _bindings.CreateLazyMarshaler(controlOnOpenResponse{}) |
| |
| func (msg *controlOnOpenResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolOnOpenResponse |
| } |
| |
| type controlSyncResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mcontrolSyncResponse = _bindings.CreateLazyMarshaler(controlSyncResponse{}) |
| |
| func (msg *controlSyncResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolSyncResponse |
| } |
| |
| type controlGetAttrResponse struct { |
| _ struct{} `fidl2:"s,64,0"` |
| S int32 |
| Attributes fuchsiaio.NodeAttributes |
| } |
| |
| var _mcontrolGetAttrResponse = _bindings.CreateLazyMarshaler(controlGetAttrResponse{}) |
| |
| func (msg *controlGetAttrResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolGetAttrResponse |
| } |
| |
| type controlSetAttrRequest struct { |
| _ struct{} `fidl2:"s,64,0"` |
| Flags uint32 |
| Attributes fuchsiaio.NodeAttributes |
| } |
| |
| var _mcontrolSetAttrRequest = _bindings.CreateLazyMarshaler(controlSetAttrRequest{}) |
| |
| func (msg *controlSetAttrRequest) Marshaler() _bindings.Marshaler { |
| return _mcontrolSetAttrRequest |
| } |
| |
| type controlSetAttrResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| S int32 |
| } |
| |
| var _mcontrolSetAttrResponse = _bindings.CreateLazyMarshaler(controlSetAttrResponse{}) |
| |
| func (msg *controlSetAttrResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolSetAttrResponse |
| } |
| |
| type controlIoctlRequest struct { |
| _ struct{} `fidl2:"s,48,0"` |
| Opcode uint32 |
| MaxOut uint64 |
| Handles []_zx.Handle `fidl:"2" fidl2:"2,0"` |
| In []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mcontrolIoctlRequest = _bindings.CreateLazyMarshaler(controlIoctlRequest{}) |
| |
| func (msg *controlIoctlRequest) Marshaler() _bindings.Marshaler { |
| return _mcontrolIoctlRequest |
| } |
| |
| type controlIoctlResponse struct { |
| _ struct{} `fidl2:"s,40,0"` |
| S int32 |
| Handles []_zx.Handle `fidl:"2" fidl2:"2,0"` |
| Out []uint8 `fidl:"8192" fidl2:"8192"` |
| } |
| |
| var _mcontrolIoctlResponse = _bindings.CreateLazyMarshaler(controlIoctlResponse{}) |
| |
| func (msg *controlIoctlResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolIoctlResponse |
| } |
| |
| type controlBindRequest struct { |
| _ struct{} `fidl2:"s,16,0"` |
| Addr []uint8 |
| } |
| |
| var _mcontrolBindRequest = _bindings.CreateLazyMarshaler(controlBindRequest{}) |
| |
| func (msg *controlBindRequest) Marshaler() _bindings.Marshaler { |
| return _mcontrolBindRequest |
| } |
| |
| type controlBindResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Code int16 |
| } |
| |
| var _mcontrolBindResponse = _bindings.CreateLazyMarshaler(controlBindResponse{}) |
| |
| func (msg *controlBindResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolBindResponse |
| } |
| |
| type controlConnectRequest struct { |
| _ struct{} `fidl2:"s,16,0"` |
| Addr []uint8 |
| } |
| |
| var _mcontrolConnectRequest = _bindings.CreateLazyMarshaler(controlConnectRequest{}) |
| |
| func (msg *controlConnectRequest) Marshaler() _bindings.Marshaler { |
| return _mcontrolConnectRequest |
| } |
| |
| type controlConnectResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Code int16 |
| } |
| |
| var _mcontrolConnectResponse = _bindings.CreateLazyMarshaler(controlConnectResponse{}) |
| |
| func (msg *controlConnectResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolConnectResponse |
| } |
| |
| type controlListenRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Backlog int16 |
| } |
| |
| var _mcontrolListenRequest = _bindings.CreateLazyMarshaler(controlListenRequest{}) |
| |
| func (msg *controlListenRequest) Marshaler() _bindings.Marshaler { |
| return _mcontrolListenRequest |
| } |
| |
| type controlListenResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Code int16 |
| } |
| |
| var _mcontrolListenResponse = _bindings.CreateLazyMarshaler(controlListenResponse{}) |
| |
| func (msg *controlListenResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolListenResponse |
| } |
| |
| type controlAcceptRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Flags int16 |
| } |
| |
| var _mcontrolAcceptRequest = _bindings.CreateLazyMarshaler(controlAcceptRequest{}) |
| |
| func (msg *controlAcceptRequest) Marshaler() _bindings.Marshaler { |
| return _mcontrolAcceptRequest |
| } |
| |
| type controlAcceptResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Code int16 |
| S ControlInterface `fidl:"*"` |
| } |
| |
| var _mcontrolAcceptResponse = _bindings.CreateLazyMarshaler(controlAcceptResponse{}) |
| |
| func (msg *controlAcceptResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolAcceptResponse |
| } |
| |
| type controlGetSockNameResponse struct { |
| _ struct{} `fidl2:"s,24,0"` |
| Code int16 |
| Addr []uint8 |
| } |
| |
| var _mcontrolGetSockNameResponse = _bindings.CreateLazyMarshaler(controlGetSockNameResponse{}) |
| |
| func (msg *controlGetSockNameResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolGetSockNameResponse |
| } |
| |
| type controlGetPeerNameResponse struct { |
| _ struct{} `fidl2:"s,24,0"` |
| Code int16 |
| Addr []uint8 |
| } |
| |
| var _mcontrolGetPeerNameResponse = _bindings.CreateLazyMarshaler(controlGetPeerNameResponse{}) |
| |
| func (msg *controlGetPeerNameResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolGetPeerNameResponse |
| } |
| |
| type controlSetSockOptRequest struct { |
| _ struct{} `fidl2:"s,24,0"` |
| Level int16 |
| Optname int16 |
| Optval []uint8 |
| } |
| |
| var _mcontrolSetSockOptRequest = _bindings.CreateLazyMarshaler(controlSetSockOptRequest{}) |
| |
| func (msg *controlSetSockOptRequest) Marshaler() _bindings.Marshaler { |
| return _mcontrolSetSockOptRequest |
| } |
| |
| type controlSetSockOptResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Code int16 |
| } |
| |
| var _mcontrolSetSockOptResponse = _bindings.CreateLazyMarshaler(controlSetSockOptResponse{}) |
| |
| func (msg *controlSetSockOptResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolSetSockOptResponse |
| } |
| |
| type controlGetSockOptRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Level int16 |
| Optname int16 |
| } |
| |
| var _mcontrolGetSockOptRequest = _bindings.CreateLazyMarshaler(controlGetSockOptRequest{}) |
| |
| func (msg *controlGetSockOptRequest) Marshaler() _bindings.Marshaler { |
| return _mcontrolGetSockOptRequest |
| } |
| |
| type controlGetSockOptResponse struct { |
| _ struct{} `fidl2:"s,24,0"` |
| Code int16 |
| Optval []uint8 |
| } |
| |
| var _mcontrolGetSockOptResponse = _bindings.CreateLazyMarshaler(controlGetSockOptResponse{}) |
| |
| func (msg *controlGetSockOptResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolGetSockOptResponse |
| } |
| |
| type controlIoctlPosixRequest struct { |
| _ struct{} `fidl2:"s,24,0"` |
| Req int16 |
| In []uint8 |
| } |
| |
| var _mcontrolIoctlPosixRequest = _bindings.CreateLazyMarshaler(controlIoctlPosixRequest{}) |
| |
| func (msg *controlIoctlPosixRequest) Marshaler() _bindings.Marshaler { |
| return _mcontrolIoctlPosixRequest |
| } |
| |
| type controlIoctlPosixResponse struct { |
| _ struct{} `fidl2:"s,24,0"` |
| Code int16 |
| Out []uint8 |
| } |
| |
| var _mcontrolIoctlPosixResponse = _bindings.CreateLazyMarshaler(controlIoctlPosixResponse{}) |
| |
| func (msg *controlIoctlPosixResponse) Marshaler() _bindings.Marshaler { |
| return _mcontrolIoctlPosixResponse |
| } |
| |
| type ControlInterface _bindings.ChannelProxy |
| |
| // Create another connection to the same remote object. |
| // |
| // `flags` may be any of: |
| // - `OPEN_RIGHT_*` |
| // - `OPEN_FLAG_APPEND` |
| // - `OPEN_FLAG_NO_REMOTE` |
| // - `OPEN_FLAG_DESCRIBE` |
| // - `CLONE_FLAG_SAME_RIGHTS` |
| // |
| // All other flags are ignored. |
| // |
| // The `OPEN_RIGHT_*` bits in `flags` request corresponding rights over the resulting |
| // cloned object. |
| // The cloned object must have rights less than or equal to the original object. |
| // Alternatively, pass `CLONE_FLAG_SAME_RIGHTS` to inherit the rights on the source connection. |
| // It is invalid to pass any of the `OPEN_RIGHT_*` flags together with `CLONE_FLAG_SAME_RIGHTS`. |
| func (p *ControlInterface) Clone(flags uint32, object fuchsiaio.NodeInterfaceRequest) error { |
| req_ := &controlCloneRequest{ |
| Flags: flags, |
| Object: object, |
| } |
| err := ((*_bindings.ChannelProxy)(p)).Send(ControlCloneGenOrdinal, req_) |
| return err |
| } |
| |
| // Terminates connection with object. |
| // |
| // This method does not require any rights. |
| func (p *ControlInterface) Close() (int32, error) { |
| var req_ _bindings.Message |
| resp_ := &controlCloseResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlCloseGenOrdinal, req_, resp_) |
| return resp_.S, err |
| } |
| |
| // Returns extra information about the type of the object. |
| // If the `Describe` operation fails, the connection is closed. |
| // |
| // This method does not require any rights. |
| func (p *ControlInterface) Describe() (fuchsiaio.NodeInfo, error) { |
| var req_ _bindings.Message |
| resp_ := &controlDescribeResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlDescribeGenOrdinal, req_, resp_) |
| return resp_.Info, err |
| } |
| |
| // An event produced eagerly by a FIDL server if requested by `OPEN_FLAG_DESCRIBE`. |
| // |
| // Indicates the success or failure of the open operation, and optionally describes the |
| // object. If the status is `ZX_OK`, `info` contains descriptive information about the object |
| // (the same as would be returned by `Describe`). |
| func (p *ControlInterface) ExpectOnOpen() (int32, *fuchsiaio.NodeInfo, error) { |
| resp_ := &controlOnOpenResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Recv(ControlOnOpenGenOrdinal, resp_) |
| return resp_.S, resp_.Info, err |
| } |
| |
| // Synchronizes updates to the node to the underlying media, if it exists. |
| // |
| // This method does not require any rights. |
| func (p *ControlInterface) Sync() (int32, error) { |
| var req_ _bindings.Message |
| resp_ := &controlSyncResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlSyncGenOrdinal, req_, resp_) |
| return resp_.S, err |
| } |
| |
| // Acquires information about the node. |
| // |
| // This method does not require any rights. |
| func (p *ControlInterface) GetAttr() (int32, fuchsiaio.NodeAttributes, error) { |
| var req_ _bindings.Message |
| resp_ := &controlGetAttrResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlGetAttrGenOrdinal, req_, resp_) |
| return resp_.S, resp_.Attributes, err |
| } |
| |
| // Updates information about the node. |
| // `flags` may be any of `NODE_ATTRIBUTE_FLAG_*`. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| func (p *ControlInterface) SetAttr(flags uint32, attributes fuchsiaio.NodeAttributes) (int32, error) { |
| req_ := &controlSetAttrRequest{ |
| Flags: flags, |
| Attributes: attributes, |
| } |
| resp_ := &controlSetAttrResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlSetAttrGenOrdinal, req_, resp_) |
| return resp_.S, err |
| } |
| |
| // Deprecated. Only for use with compatibility with devhost. |
| func (p *ControlInterface) Ioctl(opcode uint32, maxOut uint64, handles []_zx.Handle, in []uint8) (int32, []_zx.Handle, []uint8, error) { |
| req_ := &controlIoctlRequest{ |
| Opcode: opcode, |
| MaxOut: maxOut, |
| Handles: handles, |
| In: in, |
| } |
| resp_ := &controlIoctlResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlIoctlGenOrdinal, req_, resp_) |
| return resp_.S, resp_.Handles, resp_.Out, err |
| } |
| |
| // Sets the local address used for the socket. |
| func (p *ControlInterface) Bind(addr []uint8) (int16, error) { |
| req_ := &controlBindRequest{ |
| Addr: addr, |
| } |
| resp_ := &controlBindResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlBindGenOrdinal, req_, resp_) |
| return resp_.Code, err |
| } |
| |
| // Initiates a connection to a network endpoint. |
| func (p *ControlInterface) Connect(addr []uint8) (int16, error) { |
| req_ := &controlConnectRequest{ |
| Addr: addr, |
| } |
| resp_ := &controlConnectResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlConnectGenOrdinal, req_, resp_) |
| return resp_.Code, err |
| } |
| |
| // Begin listening for new connections from network endpoints. At most `backlog` connections |
| // will be buffered. |
| func (p *ControlInterface) Listen(backlog int16) (int16, error) { |
| req_ := &controlListenRequest{ |
| Backlog: backlog, |
| } |
| resp_ := &controlListenResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlListenGenOrdinal, req_, resp_) |
| return resp_.Code, err |
| } |
| |
| // Accepts an incoming connection from a network endpoint. |
| func (p *ControlInterface) Accept(flags int16) (int16, ControlInterface, error) { |
| req_ := &controlAcceptRequest{ |
| Flags: flags, |
| } |
| resp_ := &controlAcceptResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlAcceptGenOrdinal, req_, resp_) |
| return resp_.Code, resp_.S, err |
| } |
| |
| // Retrieves the local socket address. |
| func (p *ControlInterface) GetSockName() (int16, []uint8, error) { |
| var req_ _bindings.Message |
| resp_ := &controlGetSockNameResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlGetSockNameGenOrdinal, req_, resp_) |
| return resp_.Code, resp_.Addr, err |
| } |
| |
| // Retrieves the remote socket address. |
| func (p *ControlInterface) GetPeerName() (int16, []uint8, error) { |
| var req_ _bindings.Message |
| resp_ := &controlGetPeerNameResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlGetPeerNameGenOrdinal, req_, resp_) |
| return resp_.Code, resp_.Addr, err |
| } |
| |
| // Sets a socket option. TODO(NET-1699): link to description of supported socket options. |
| func (p *ControlInterface) SetSockOpt(level int16, optname int16, optval []uint8) (int16, error) { |
| req_ := &controlSetSockOptRequest{ |
| Level: level, |
| Optname: optname, |
| Optval: optval, |
| } |
| resp_ := &controlSetSockOptResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlSetSockOptGenOrdinal, req_, resp_) |
| return resp_.Code, err |
| } |
| |
| // Retrieves the current value of a socket option. |
| func (p *ControlInterface) GetSockOpt(level int16, optname int16) (int16, []uint8, error) { |
| req_ := &controlGetSockOptRequest{ |
| Level: level, |
| Optname: optname, |
| } |
| resp_ := &controlGetSockOptResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlGetSockOptGenOrdinal, req_, resp_) |
| return resp_.Code, resp_.Optval, err |
| } |
| |
| // Runs operations (e.g., get the receive timestamp of the last packet) on the socket. |
| func (p *ControlInterface) IoctlPosix(req int16, in []uint8) (int16, []uint8, error) { |
| req_ := &controlIoctlPosixRequest{ |
| Req: req, |
| In: in, |
| } |
| resp_ := &controlIoctlPosixResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ControlIoctlPosixGenOrdinal, req_, resp_) |
| return resp_.Code, resp_.Out, err |
| } |
| |
| // The control plane for a network socket. Once a socket has been retrieved from a |
| // `Provider`, this interface is then used to further configure and use the socket. |
| // This interface is essentially POSIX. Its implementation must support Linux-specific arguments |
| // to {Get,Set}SockOpt. |
| type Control interface { |
| // Create another connection to the same remote object. |
| // |
| // `flags` may be any of: |
| // - `OPEN_RIGHT_*` |
| // - `OPEN_FLAG_APPEND` |
| // - `OPEN_FLAG_NO_REMOTE` |
| // - `OPEN_FLAG_DESCRIBE` |
| // - `CLONE_FLAG_SAME_RIGHTS` |
| // |
| // All other flags are ignored. |
| // |
| // The `OPEN_RIGHT_*` bits in `flags` request corresponding rights over the resulting |
| // cloned object. |
| // The cloned object must have rights less than or equal to the original object. |
| // Alternatively, pass `CLONE_FLAG_SAME_RIGHTS` to inherit the rights on the source connection. |
| // It is invalid to pass any of the `OPEN_RIGHT_*` flags together with `CLONE_FLAG_SAME_RIGHTS`. |
| Clone(flags uint32, object fuchsiaio.NodeInterfaceRequest) error |
| // Terminates connection with object. |
| // |
| // This method does not require any rights. |
| Close() (int32, error) |
| // Returns extra information about the type of the object. |
| // If the `Describe` operation fails, the connection is closed. |
| // |
| // This method does not require any rights. |
| Describe() (fuchsiaio.NodeInfo, error) |
| // An event produced eagerly by a FIDL server if requested by `OPEN_FLAG_DESCRIBE`. |
| // |
| // Indicates the success or failure of the open operation, and optionally describes the |
| // object. If the status is `ZX_OK`, `info` contains descriptive information about the object |
| // (the same as would be returned by `Describe`). |
| // Synchronizes updates to the node to the underlying media, if it exists. |
| // |
| // This method does not require any rights. |
| Sync() (int32, error) |
| // Acquires information about the node. |
| // |
| // This method does not require any rights. |
| GetAttr() (int32, fuchsiaio.NodeAttributes, error) |
| // Updates information about the node. |
| // `flags` may be any of `NODE_ATTRIBUTE_FLAG_*`. |
| // |
| // This method requires following rights: `OPEN_RIGHT_WRITABLE`. |
| SetAttr(flags uint32, attributes fuchsiaio.NodeAttributes) (int32, error) |
| // Deprecated. Only for use with compatibility with devhost. |
| Ioctl(opcode uint32, maxOut uint64, handles []_zx.Handle, in []uint8) (int32, []_zx.Handle, []uint8, error) |
| // Sets the local address used for the socket. |
| Bind(addr []uint8) (int16, error) |
| // Initiates a connection to a network endpoint. |
| Connect(addr []uint8) (int16, error) |
| // Begin listening for new connections from network endpoints. At most `backlog` connections |
| // will be buffered. |
| Listen(backlog int16) (int16, error) |
| // Accepts an incoming connection from a network endpoint. |
| Accept(flags int16) (int16, ControlInterface, error) |
| // Retrieves the local socket address. |
| GetSockName() (int16, []uint8, error) |
| // Retrieves the remote socket address. |
| GetPeerName() (int16, []uint8, error) |
| // Sets a socket option. TODO(NET-1699): link to description of supported socket options. |
| SetSockOpt(level int16, optname int16, optval []uint8) (int16, error) |
| // Retrieves the current value of a socket option. |
| GetSockOpt(level int16, optname int16) (int16, []uint8, error) |
| // Runs operations (e.g., get the receive timestamp of the last packet) on the socket. |
| IoctlPosix(req int16, in []uint8) (int16, []uint8, error) |
| } |
| |
| type ControlTransitionalBase struct{} |
| |
| type ControlInterfaceRequest _bindings.InterfaceRequest |
| |
| func NewControlInterfaceRequest() (ControlInterfaceRequest, *ControlInterface, error) { |
| req, cli, err := _bindings.NewInterfaceRequest() |
| return ControlInterfaceRequest(req), (*ControlInterface)(cli), err |
| } |
| |
| type ControlStub struct { |
| Impl Control |
| } |
| |
| func (s_ *ControlStub) Dispatch(ordinal_ uint64, data_ []byte, handles_ []_zx.Handle) (_bindings.Message, error) { |
| switch ordinal_ { |
| case ControlCloneGenOrdinal: |
| in_ := controlCloneRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, err_ |
| } |
| err_ := s_.Impl.Clone(in_.Flags, in_.Object) |
| return nil, err_ |
| case ControlCloseGenOrdinal: |
| s, err_ := s_.Impl.Close() |
| out_ := controlCloseResponse{} |
| out_.S = s |
| return &out_, err_ |
| case ControlDescribeGenOrdinal: |
| info, err_ := s_.Impl.Describe() |
| out_ := controlDescribeResponse{} |
| out_.Info = info |
| return &out_, err_ |
| case ControlSyncGenOrdinal: |
| s, err_ := s_.Impl.Sync() |
| out_ := controlSyncResponse{} |
| out_.S = s |
| return &out_, err_ |
| case ControlGetAttrGenOrdinal: |
| s, attributes, err_ := s_.Impl.GetAttr() |
| out_ := controlGetAttrResponse{} |
| out_.S = s |
| out_.Attributes = attributes |
| return &out_, err_ |
| case ControlSetAttrGenOrdinal: |
| in_ := controlSetAttrRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, err_ |
| } |
| s, err_ := s_.Impl.SetAttr(in_.Flags, in_.Attributes) |
| out_ := controlSetAttrResponse{} |
| out_.S = s |
| return &out_, err_ |
| case ControlIoctlGenOrdinal: |
| in_ := controlIoctlRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, err_ |
| } |
| s, handles, out, err_ := s_.Impl.Ioctl(in_.Opcode, in_.MaxOut, in_.Handles, in_.In) |
| out_ := controlIoctlResponse{} |
| out_.S = s |
| out_.Handles = handles |
| out_.Out = out |
| return &out_, err_ |
| case ControlBindGenOrdinal: |
| in_ := controlBindRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, err_ |
| } |
| code, err_ := s_.Impl.Bind(in_.Addr) |
| out_ := controlBindResponse{} |
| out_.Code = code |
| return &out_, err_ |
| case ControlConnectGenOrdinal: |
| in_ := controlConnectRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, err_ |
| } |
| code, err_ := s_.Impl.Connect(in_.Addr) |
| out_ := controlConnectResponse{} |
| out_.Code = code |
| return &out_, err_ |
| case ControlListenGenOrdinal: |
| in_ := controlListenRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, err_ |
| } |
| code, err_ := s_.Impl.Listen(in_.Backlog) |
| out_ := controlListenResponse{} |
| out_.Code = code |
| return &out_, err_ |
| case ControlAcceptGenOrdinal: |
| in_ := controlAcceptRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, err_ |
| } |
| code, s, err_ := s_.Impl.Accept(in_.Flags) |
| out_ := controlAcceptResponse{} |
| out_.Code = code |
| out_.S = s |
| return &out_, err_ |
| case ControlGetSockNameGenOrdinal: |
| code, addr, err_ := s_.Impl.GetSockName() |
| out_ := controlGetSockNameResponse{} |
| out_.Code = code |
| out_.Addr = addr |
| return &out_, err_ |
| case ControlGetPeerNameGenOrdinal: |
| code, addr, err_ := s_.Impl.GetPeerName() |
| out_ := controlGetPeerNameResponse{} |
| out_.Code = code |
| out_.Addr = addr |
| return &out_, err_ |
| case ControlSetSockOptGenOrdinal: |
| in_ := controlSetSockOptRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, err_ |
| } |
| code, err_ := s_.Impl.SetSockOpt(in_.Level, in_.Optname, in_.Optval) |
| out_ := controlSetSockOptResponse{} |
| out_.Code = code |
| return &out_, err_ |
| case ControlGetSockOptGenOrdinal: |
| in_ := controlGetSockOptRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, err_ |
| } |
| code, optval, err_ := s_.Impl.GetSockOpt(in_.Level, in_.Optname) |
| out_ := controlGetSockOptResponse{} |
| out_.Code = code |
| out_.Optval = optval |
| return &out_, err_ |
| case ControlIoctlPosixGenOrdinal: |
| in_ := controlIoctlPosixRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, err_ |
| } |
| code, out, err_ := s_.Impl.IoctlPosix(in_.Req, in_.In) |
| out_ := controlIoctlPosixResponse{} |
| out_.Code = code |
| out_.Out = out |
| return &out_, err_ |
| } |
| return nil, _bindings.ErrUnknownOrdinal |
| } |
| |
| type ControlService struct { |
| _bindings.BindingSet |
| } |
| |
| func (s *ControlService) Add(impl Control, c _zx.Channel, onError func(error)) (_bindings.BindingKey, error) { |
| return s.BindingSet.Add(&ControlStub{Impl: impl}, c, onError) |
| } |
| |
| func (s *ControlService) EventProxyFor(key _bindings.BindingKey) (*ControlEventProxy, bool) { |
| pxy, err := s.BindingSet.ProxyFor(key) |
| return (*ControlEventProxy)(pxy), err |
| } |
| |
| type ControlEventProxy _bindings.ChannelProxy |
| |
| func (p *ControlEventProxy) OnOpen(s int32, info *fuchsiaio.NodeInfo) error { |
| event_ := &controlOnOpenResponse{ |
| S: s, |
| Info: info, |
| } |
| return ((*_bindings.ChannelProxy)(p)).Send(ControlOnOpenGenOrdinal, event_) |
| } |
| |
| const ( |
| ProviderSocketGenOrdinal uint64 = 0x4d07378200000000 |
| ) |
| |
| type providerSocketRequest struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Domain int16 |
| Type int16 |
| Protocol int16 |
| } |
| |
| var _mproviderSocketRequest = _bindings.CreateLazyMarshaler(providerSocketRequest{}) |
| |
| func (msg *providerSocketRequest) Marshaler() _bindings.Marshaler { |
| return _mproviderSocketRequest |
| } |
| |
| type providerSocketResponse struct { |
| _ struct{} `fidl2:"s,8,0"` |
| Code int16 |
| S ControlInterface `fidl:"*"` |
| } |
| |
| var _mproviderSocketResponse = _bindings.CreateLazyMarshaler(providerSocketResponse{}) |
| |
| func (msg *providerSocketResponse) Marshaler() _bindings.Marshaler { |
| return _mproviderSocketResponse |
| } |
| |
| type ProviderInterface _bindings.ChannelProxy |
| |
| // Requests a socket with the specified parameters. Values for `code` are defined in |
| // errno.h. |
| func (p *ProviderInterface) Socket(domain int16, type_ int16, protocol int16) (int16, ControlInterface, error) { |
| req_ := &providerSocketRequest{ |
| Domain: domain, |
| Type: type_, |
| Protocol: protocol, |
| } |
| resp_ := &providerSocketResponse{} |
| err := ((*_bindings.ChannelProxy)(p)).Call(ProviderSocketGenOrdinal, req_, resp_) |
| return resp_.Code, resp_.S, err |
| } |
| |
| // Provider implements the POSIX sockets API. |
| type Provider interface { |
| // Requests a socket with the specified parameters. Values for `code` are defined in |
| // errno.h. |
| Socket(domain int16, type_ int16, protocol int16) (int16, ControlInterface, error) |
| } |
| |
| type ProviderTransitionalBase struct{} |
| |
| type ProviderInterfaceRequest _bindings.InterfaceRequest |
| |
| func NewProviderInterfaceRequest() (ProviderInterfaceRequest, *ProviderInterface, error) { |
| req, cli, err := _bindings.NewInterfaceRequest() |
| return ProviderInterfaceRequest(req), (*ProviderInterface)(cli), err |
| } |
| |
| // Implements ServiceRequest. |
| func (_ ProviderInterfaceRequest) Name() string { |
| return "fuchsia.posix.socket.Provider" |
| } |
| func (c ProviderInterfaceRequest) ToChannel() _zx.Channel { |
| return c.Channel |
| } |
| |
| const ProviderName = "fuchsia.posix.socket.Provider" |
| |
| type ProviderStub struct { |
| Impl Provider |
| } |
| |
| func (s_ *ProviderStub) Dispatch(ordinal_ uint64, data_ []byte, handles_ []_zx.Handle) (_bindings.Message, error) { |
| switch ordinal_ { |
| case ProviderSocketGenOrdinal: |
| in_ := providerSocketRequest{} |
| if _, _, err_ := _bindings.Unmarshal(data_, handles_, &in_); err_ != nil { |
| return nil, err_ |
| } |
| code, s, err_ := s_.Impl.Socket(in_.Domain, in_.Type, in_.Protocol) |
| out_ := providerSocketResponse{} |
| out_.Code = code |
| out_.S = s |
| return &out_, err_ |
| } |
| return nil, _bindings.ErrUnknownOrdinal |
| } |
| |
| type ProviderService struct { |
| _bindings.BindingSet |
| } |
| |
| func (s *ProviderService) Add(impl Provider, c _zx.Channel, onError func(error)) (_bindings.BindingKey, error) { |
| return s.BindingSet.Add(&ProviderStub{Impl: impl}, c, onError) |
| } |
| |
| func (s *ProviderService) EventProxyFor(key _bindings.BindingKey) (*ProviderEventProxy, bool) { |
| pxy, err := s.BindingSet.ProxyFor(key) |
| return (*ProviderEventProxy)(pxy), err |
| } |
| |
| type ProviderEventProxy _bindings.ChannelProxy |