| // Copyright 2018 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // |
| // WARNING: This file is machine generated by fidlgen. |
| |
| // +build fuchsia |
| |
| package net |
| |
| import ( |
| _bindings "syscall/zx/fidl" |
| _zx "syscall/zx" |
| ) |
| |
| const ( |
| ) |
| |
| type SocketDomain uint32 |
| const ( |
| SocketDomainInet SocketDomain = 2 |
| SocketDomainInet6 SocketDomain = 10 |
| ) |
| type SocketType uint32 |
| const ( |
| SocketTypeStream SocketType = 1 |
| SocketTypeDgram SocketType = 2 |
| ) |
| type SocketProtocol uint32 |
| const ( |
| SocketProtocolIp SocketProtocol = 0 |
| SocketProtocolIcmp SocketProtocol = 1 |
| SocketProtocolTcp SocketProtocol = 6 |
| SocketProtocolUdp SocketProtocol = 17 |
| SocketProtocolIpv6 SocketProtocol = 41 |
| SocketProtocolIcmpv6 SocketProtocol = 58 |
| ) |
| type AddrInfoStatus uint32 |
| const ( |
| AddrInfoStatusOk AddrInfoStatus = 0 |
| AddrInfoStatusBadFlags AddrInfoStatus = 1 |
| AddrInfoStatusNoName AddrInfoStatus = 2 |
| AddrInfoStatusAgain AddrInfoStatus = 3 |
| AddrInfoStatusFail AddrInfoStatus = 4 |
| AddrInfoStatusNoData AddrInfoStatus = 5 |
| AddrInfoStatusBufferOverflow AddrInfoStatus = 6 |
| AddrInfoStatusSystemError AddrInfoStatus = 7 |
| ) |
| type IPv4Address struct { |
| Addr [4]uint8 |
| } |
| |
| // Implements Payload. |
| func (_ *IPv4Address) InlineAlignment() int { |
| return 1 |
| } |
| |
| // Implements Payload. |
| func (_ *IPv4Address) InlineSize() int { |
| return 4 |
| } |
| type IPv6Address struct { |
| Addr [16]uint8 |
| } |
| |
| // Implements Payload. |
| func (_ *IPv6Address) InlineAlignment() int { |
| return 1 |
| } |
| |
| // Implements Payload. |
| func (_ *IPv6Address) InlineSize() int { |
| return 16 |
| } |
| type Subnet struct { |
| Addr IpAddress |
| PrefixLen uint8 |
| } |
| |
| // Implements Payload. |
| func (_ *Subnet) InlineAlignment() int { |
| return 4 |
| } |
| |
| // Implements Payload. |
| func (_ *Subnet) InlineSize() int { |
| return 24 |
| } |
| type MacAddress struct { |
| Addr [6]uint8 |
| } |
| |
| // Implements Payload. |
| func (_ *MacAddress) InlineAlignment() int { |
| return 1 |
| } |
| |
| // Implements Payload. |
| func (_ *MacAddress) InlineSize() int { |
| return 6 |
| } |
| type String struct { |
| Val [256]uint8 |
| Len uint32 |
| } |
| |
| // Implements Payload. |
| func (_ *String) InlineAlignment() int { |
| return 4 |
| } |
| |
| // Implements Payload. |
| func (_ *String) InlineSize() int { |
| return 260 |
| } |
| type AddrInfoHints struct { |
| Flags int32 |
| Family int32 |
| SockType int32 |
| Protocol int32 |
| } |
| |
| // Implements Payload. |
| func (_ *AddrInfoHints) InlineAlignment() int { |
| return 4 |
| } |
| |
| // Implements Payload. |
| func (_ *AddrInfoHints) InlineSize() int { |
| return 16 |
| } |
| type AddrStorage struct { |
| Val [16]uint8 |
| Len uint32 |
| } |
| |
| // Implements Payload. |
| func (_ *AddrStorage) InlineAlignment() int { |
| return 4 |
| } |
| |
| // Implements Payload. |
| func (_ *AddrStorage) InlineSize() int { |
| return 20 |
| } |
| type AddrInfo struct { |
| Flags int32 |
| Family int32 |
| SockType int32 |
| Protocol int32 |
| IpAddr AddrStorage |
| Port uint16 |
| } |
| |
| // Implements Payload. |
| func (_ *AddrInfo) InlineAlignment() int { |
| return 4 |
| } |
| |
| // Implements Payload. |
| func (_ *AddrInfo) InlineSize() int { |
| return 40 |
| } |
| type IpAddressTag uint32 |
| const ( |
| IpAddressIpv4 IpAddressTag = iota |
| IpAddressIpv6 IpAddressTag = iota |
| ) |
| |
| // IpAddress is a FIDL union. |
| type IpAddress struct { |
| IpAddressTag `fidl:"tag"` |
| Ipv4 IPv4Address |
| Ipv6 IPv6Address |
| } |
| |
| // Implements Payload. |
| func (_ *IpAddress) InlineAlignment() int { |
| return 4 |
| } |
| |
| // Implements Payload. |
| func (_ *IpAddress) InlineSize() int { |
| return 20 |
| } |
| |
| func (u *IpAddress) Which() IpAddressTag { |
| return u.IpAddressTag |
| } |
| |
| func (u *IpAddress) SetIpv4(ipv4 IPv4Address) { |
| u.IpAddressTag = IpAddressIpv4 |
| u.Ipv4 = ipv4 |
| } |
| |
| func (u *IpAddress) SetIpv6(ipv6 IPv6Address) { |
| u.IpAddressTag = IpAddressIpv6 |
| u.Ipv6 = ipv6 |
| } |
| const ( |
| ConnectivityOnNetworkReachableOrdinal uint32 = 1 |
| ) |
| // Request for OnNetworkReachable. |
| // OnNetworkReachable has no request. |
| // Response for OnNetworkReachable. |
| type ConnectivityOnNetworkReachableResponse struct { |
| Reachable bool |
| } |
| |
| // Implements Payload. |
| func (_ *ConnectivityOnNetworkReachableResponse) InlineAlignment() int { |
| return 0 |
| } |
| |
| // Implements Payload. |
| func (_ *ConnectivityOnNetworkReachableResponse) InlineSize() int { |
| return 4 |
| } |
| |
| type ConnectivityInterface _bindings.Proxy |
| |
| func (p *ConnectivityInterface) ExpectOnNetworkReachable() (bool, error) { |
| resp_ := ConnectivityOnNetworkReachableResponse{} |
| err := ((*_bindings.Proxy)(p)).Recv(ConnectivityOnNetworkReachableOrdinal, &resp_) |
| return resp_.Reachable, err |
| } |
| |
| // Connectivity server interface. |
| type Connectivity interface { |
| } |
| |
| type ConnectivityInterfaceRequest _bindings.InterfaceRequest |
| |
| func NewConnectivityInterfaceRequest() (ConnectivityInterfaceRequest, *ConnectivityInterface, error) { |
| req, cli, err := _bindings.NewInterfaceRequest() |
| return ConnectivityInterfaceRequest(req), (*ConnectivityInterface)(cli), err |
| } |
| // Implements ServiceRequest. |
| func (_ ConnectivityInterfaceRequest) Name() string { |
| return "fuchsia.net.Connectivity" |
| } |
| func (c ConnectivityInterfaceRequest) ToChannel() _zx.Channel { |
| return c.Channel |
| } |
| |
| const ConnectivityName = "fuchsia.net.Connectivity" |
| |
| type ConnectivityStub struct { |
| Impl Connectivity |
| } |
| |
| func (s *ConnectivityStub) Dispatch(ord uint32, b_ []byte, h_ []_zx.Handle) (_bindings.Payload, error) { |
| switch ord { |
| } |
| return nil, _bindings.ErrUnknownOrdinal |
| } |
| |
| type ConnectivityService struct { |
| _bindings.BindingSet |
| } |
| |
| func (s *ConnectivityService) Add(impl Connectivity, c _zx.Channel, onError func(error)) (_bindings.BindingKey, error) { |
| return s.BindingSet.Add(&ConnectivityStub{Impl: impl}, c, onError) |
| } |
| |
| func (s *ConnectivityService) EventProxyFor(key _bindings.BindingKey) (*ConnectivityEventProxy, bool) { |
| pxy, err := s.BindingSet.ProxyFor(key) |
| return (*ConnectivityEventProxy)(pxy), err |
| } |
| |
| type ConnectivityEventProxy _bindings.Proxy |
| |
| func (p *ConnectivityEventProxy) OnNetworkReachable(reachable bool) error { |
| event_ := ConnectivityOnNetworkReachableResponse{ |
| Reachable: reachable, |
| } |
| return ((*_bindings.Proxy)(p)).Send(ConnectivityOnNetworkReachableOrdinal, &event_) |
| } |
| |
| |
| const ( |
| LegacySocketProviderOpenSocketOrdinal uint32 = 1 |
| LegacySocketProviderGetAddrInfoOrdinal uint32 = 2 |
| ) |
| // Request for OpenSocket. |
| type LegacySocketProviderOpenSocketRequest struct { |
| Domain SocketDomain |
| Type SocketType |
| Protocol SocketProtocol |
| } |
| |
| // Implements Payload. |
| func (_ *LegacySocketProviderOpenSocketRequest) InlineAlignment() int { |
| return 0 |
| } |
| |
| // Implements Payload. |
| func (_ *LegacySocketProviderOpenSocketRequest) InlineSize() int { |
| return 12 |
| } |
| // Response for OpenSocket. |
| type LegacySocketProviderOpenSocketResponse struct { |
| S _zx.Socket |
| Status int32 |
| } |
| |
| // Implements Payload. |
| func (_ *LegacySocketProviderOpenSocketResponse) InlineAlignment() int { |
| return 0 |
| } |
| |
| // Implements Payload. |
| func (_ *LegacySocketProviderOpenSocketResponse) InlineSize() int { |
| return 8 |
| } |
| // Request for GetAddrInfo. |
| type LegacySocketProviderGetAddrInfoRequest struct { |
| Node *String |
| Service *String |
| Hints *AddrInfoHints |
| } |
| |
| // Implements Payload. |
| func (_ *LegacySocketProviderGetAddrInfoRequest) InlineAlignment() int { |
| return 0 |
| } |
| |
| // Implements Payload. |
| func (_ *LegacySocketProviderGetAddrInfoRequest) InlineSize() int { |
| return 24 |
| } |
| // Response for GetAddrInfo. |
| type LegacySocketProviderGetAddrInfoResponse struct { |
| Status AddrInfoStatus |
| Nres int32 |
| Ai0 *AddrInfo |
| Ai1 *AddrInfo |
| Ai2 *AddrInfo |
| Ai3 *AddrInfo |
| } |
| |
| // Implements Payload. |
| func (_ *LegacySocketProviderGetAddrInfoResponse) InlineAlignment() int { |
| return 0 |
| } |
| |
| // Implements Payload. |
| func (_ *LegacySocketProviderGetAddrInfoResponse) InlineSize() int { |
| return 40 |
| } |
| |
| type LegacySocketProviderInterface _bindings.Proxy |
| |
| func (p *LegacySocketProviderInterface) OpenSocket(domain SocketDomain,type_ SocketType,protocol SocketProtocol) (_zx.Socket, int32, error) { |
| req_ := LegacySocketProviderOpenSocketRequest{ |
| Domain: domain, |
| Type: type_, |
| Protocol: protocol, |
| } |
| resp_ := LegacySocketProviderOpenSocketResponse{} |
| err := ((*_bindings.Proxy)(p)).Call(LegacySocketProviderOpenSocketOrdinal, &req_, &resp_) |
| return resp_.S, resp_.Status, err |
| } |
| func (p *LegacySocketProviderInterface) GetAddrInfo(node *String,service *String,hints *AddrInfoHints) (AddrInfoStatus, int32, *AddrInfo, *AddrInfo, *AddrInfo, *AddrInfo, error) { |
| req_ := LegacySocketProviderGetAddrInfoRequest{ |
| Node: node, |
| Service: service, |
| Hints: hints, |
| } |
| resp_ := LegacySocketProviderGetAddrInfoResponse{} |
| err := ((*_bindings.Proxy)(p)).Call(LegacySocketProviderGetAddrInfoOrdinal, &req_, &resp_) |
| return resp_.Status, resp_.Nres, resp_.Ai0, resp_.Ai1, resp_.Ai2, resp_.Ai3, err |
| } |
| |
| // LegacySocketProvider server interface. |
| type LegacySocketProvider interface { |
| OpenSocket(domain SocketDomain,type_ SocketType,protocol SocketProtocol) (_zx.Socket, int32, error) |
| GetAddrInfo(node *String,service *String,hints *AddrInfoHints) (AddrInfoStatus, int32, *AddrInfo, *AddrInfo, *AddrInfo, *AddrInfo, error) |
| } |
| |
| type LegacySocketProviderInterfaceRequest _bindings.InterfaceRequest |
| |
| func NewLegacySocketProviderInterfaceRequest() (LegacySocketProviderInterfaceRequest, *LegacySocketProviderInterface, error) { |
| req, cli, err := _bindings.NewInterfaceRequest() |
| return LegacySocketProviderInterfaceRequest(req), (*LegacySocketProviderInterface)(cli), err |
| } |
| // Implements ServiceRequest. |
| func (_ LegacySocketProviderInterfaceRequest) Name() string { |
| return "fuchsia.net.LegacySocketProvider" |
| } |
| func (c LegacySocketProviderInterfaceRequest) ToChannel() _zx.Channel { |
| return c.Channel |
| } |
| |
| const LegacySocketProviderName = "fuchsia.net.LegacySocketProvider" |
| |
| type LegacySocketProviderStub struct { |
| Impl LegacySocketProvider |
| } |
| |
| func (s *LegacySocketProviderStub) Dispatch(ord uint32, b_ []byte, h_ []_zx.Handle) (_bindings.Payload, error) { |
| switch ord { |
| case LegacySocketProviderOpenSocketOrdinal: |
| in_ := LegacySocketProviderOpenSocketRequest{} |
| if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil { |
| return nil, err_ |
| } |
| out_ := LegacySocketProviderOpenSocketResponse{} |
| s, status, err_ := s.Impl.OpenSocket(in_.Domain,in_.Type,in_.Protocol) |
| out_.S = s |
| out_.Status = status |
| return &out_, err_ |
| case LegacySocketProviderGetAddrInfoOrdinal: |
| in_ := LegacySocketProviderGetAddrInfoRequest{} |
| if err_ := _bindings.Unmarshal(b_, h_, &in_); err_ != nil { |
| return nil, err_ |
| } |
| out_ := LegacySocketProviderGetAddrInfoResponse{} |
| status, nres, ai0, ai1, ai2, ai3, err_ := s.Impl.GetAddrInfo(in_.Node,in_.Service,in_.Hints) |
| out_.Status = status |
| out_.Nres = nres |
| out_.Ai0 = ai0 |
| out_.Ai1 = ai1 |
| out_.Ai2 = ai2 |
| out_.Ai3 = ai3 |
| return &out_, err_ |
| } |
| return nil, _bindings.ErrUnknownOrdinal |
| } |
| |
| type LegacySocketProviderService struct { |
| _bindings.BindingSet |
| } |
| |
| func (s *LegacySocketProviderService) Add(impl LegacySocketProvider, c _zx.Channel, onError func(error)) (_bindings.BindingKey, error) { |
| return s.BindingSet.Add(&LegacySocketProviderStub{Impl: impl}, c, onError) |
| } |
| |
| func (s *LegacySocketProviderService) EventProxyFor(key _bindings.BindingKey) (*LegacySocketProviderEventProxy, bool) { |
| pxy, err := s.BindingSet.ProxyFor(key) |
| return (*LegacySocketProviderEventProxy)(pxy), err |
| } |
| |
| type LegacySocketProviderEventProxy _bindings.Proxy |
| |
| |
| |