blob: 3c75d5825a5ca408f10483e9488cd7c7d8b7a983 [file] [log] [blame]
// 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 net
import (
_zx "syscall/zx"
_bindings "syscall/zx/fidl"
)
const (
// The maximum length of a hostname, as per [RFC 1035 section 2.3.4](https://tools.ietf.org/html/rfc1035#section-2.3.4).
MaxHostnameSize uint64 = 255
)
var _ _bindings.Enum = LookupError(0)
type LookupError uint32
const (
// No result was found for this query.
LookupErrorNotFound LookupError = 1
// The lookup failed, but may succeed at a later time. For instance, the
// network or DNS server may be unreachable.
LookupErrorTransient LookupError = 2
// The lookup failed due to an invalid argument (for instance, the hostname was not encoded
// correctly, or was too long).
LookupErrorInvalidArgs LookupError = 3
// The lookup failed due to an internal error.
LookupErrorInternalError LookupError = 4
)
func (_ LookupError) I_EnumValues() []LookupError {
return []LookupError{
LookupErrorNotFound,
LookupErrorTransient,
LookupErrorInvalidArgs,
LookupErrorInternalError,
}
}
func (_ LookupError) I_EnumIsStrict() bool {
return true
}
func (x LookupError) IsUnknown() bool {
switch x {
case 1:
return true
case 2:
return true
case 3:
return true
case 4:
return true
default:
return false
}
}
func (x LookupError) String() string {
switch x {
case 1:
return "NotFound"
case 2:
return "Transient"
case 3:
return "InvalidArgs"
case 4:
return "InternalError"
}
return "Unknown"
}
var _ _bindings.Bits = LookupIpOptions(0)
type LookupIpOptions uint8
const (
LookupIpOptionsV4Addrs LookupIpOptions = 1
LookupIpOptionsV6Addrs LookupIpOptions = 2
LookupIpOptionsCnameLookup LookupIpOptions = 4
LookupIpOptions_Mask LookupIpOptions = 7
)
func (_ LookupIpOptions) I_BitsMask() LookupIpOptions {
return LookupIpOptions_Mask
}
func (_ LookupIpOptions) I_BitsIsStrict() bool {
return true
}
func (x LookupIpOptions) HasUnknownBits() bool {
return x.GetUnknownBits() != 0
}
func (x LookupIpOptions) GetUnknownBits() uint64 {
return uint64(^LookupIpOptions_Mask & x)
}
func (x LookupIpOptions) String() string {
switch x {
case 1:
return "V4Addrs"
case 2:
return "V6Addrs"
case 4:
return "CnameLookup"
}
return "Unknown"
}
type NameLookupLookupIpResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"48" fidl_alignment_v1:"8"`
Addr IpAddressInfo `fidl_offset_v1:"0"`
}
var _mNameLookupLookupIpResponse = _bindings.CreateLazyMarshaler(NameLookupLookupIpResponse{})
func (msg *NameLookupLookupIpResponse) Marshaler() _bindings.Marshaler {
return _mNameLookupLookupIpResponse
}
type NameLookupLookupHostnameResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"16" fidl_alignment_v1:"8"`
Hostname string `fidl_offset_v1:"0" fidl_bounds:"255"`
}
var _mNameLookupLookupHostnameResponse = _bindings.CreateLazyMarshaler(NameLookupLookupHostnameResponse{})
func (msg *NameLookupLookupHostnameResponse) Marshaler() _bindings.Marshaler {
return _mNameLookupLookupHostnameResponse
}
type IpAddressInfo struct {
_ struct{} `fidl:"s" fidl_size_v1:"48" fidl_alignment_v1:"8"`
// All of the IPv4 addresses for the requested hostname.
Ipv4Addrs []Ipv4Address `fidl_offset_v1:"0" fidl_bounds:"256"`
// All of the IPv6 addresses for the requested hostname.
Ipv6Addrs []Ipv6Address `fidl_offset_v1:"16" fidl_bounds:"256"`
// The canonical name of the requested hostname (usually the DNS CNAME record, if one exists).
CanonicalName *string `fidl_offset_v1:"32" fidl_bounds:"256"`
}
var _mIpAddressInfo = _bindings.CreateLazyMarshaler(IpAddressInfo{})
func (msg *IpAddressInfo) Marshaler() _bindings.Marshaler {
return _mIpAddressInfo
}
// Ipv4Address is expressed in network byte order, so the most significant byte
// ("127" in the address "127.0.0.1") will be at index 0.
type Ipv4Address struct {
_ struct{} `fidl:"s" fidl_size_v1:"4" fidl_alignment_v1:"1"`
Addr [4]uint8 `fidl_offset_v1:"0"`
}
var _mIpv4Address = _bindings.CreateLazyMarshaler(Ipv4Address{})
func (msg *Ipv4Address) Marshaler() _bindings.Marshaler {
return _mIpv4Address
}
// Ipv6Address is expressed in network byte order, so the most significant byte
// ("ff" in the address "ff02::1") will be at index 0.
type Ipv6Address struct {
_ struct{} `fidl:"s" fidl_size_v1:"16" fidl_alignment_v1:"1"`
Addr [16]uint8 `fidl_offset_v1:"0"`
}
var _mIpv6Address = _bindings.CreateLazyMarshaler(Ipv6Address{})
func (msg *Ipv6Address) Marshaler() _bindings.Marshaler {
return _mIpv6Address
}
// An IP address with its subnet prefix length.
type Subnet struct {
_ struct{} `fidl:"s" fidl_size_v1:"32" fidl_alignment_v1:"8"`
// The Ipv4 or Ipv6 address.
Addr IpAddress `fidl_offset_v1:"0"`
// The prefix length of the netmask. E.g. for 192.168.1.0/24, the prefix
// length is 24, corresponding to a netmask of 255.255.255.0.
// For Ipv4, prefix_len must be in the range [0, 32].
// For Ipv6, prefix_len must be in the range [0, 128].
PrefixLen uint8 `fidl_offset_v1:"24"`
}
var _mSubnet = _bindings.CreateLazyMarshaler(Subnet{})
func (msg *Subnet) Marshaler() _bindings.Marshaler {
return _mSubnet
}
// A MAC address used to identify a network interface on the data link layer within the network.
type MacAddress struct {
_ struct{} `fidl:"s" fidl_size_v1:"6" fidl_alignment_v1:"1"`
Octets [6]uint8 `fidl_offset_v1:"0"`
}
var _mMacAddress = _bindings.CreateLazyMarshaler(MacAddress{})
func (msg *MacAddress) Marshaler() _bindings.Marshaler {
return _mMacAddress
}
// An IPv4 socket address, composed of an IPv4 address and a port.
//
// Inspired by the address definition in the [POSIX specification].
//
// [POSIX specification]: https://pubs.opengroup.org/onlinepubs/9699919799/
type Ipv4SocketAddress struct {
_ struct{} `fidl:"s" fidl_size_v1:"6" fidl_alignment_v1:"2"`
// IPv4 Address.
Address Ipv4Address `fidl_offset_v1:"0"`
// Transport-layer port.
Port uint16 `fidl_offset_v1:"4"`
}
var _mIpv4SocketAddress = _bindings.CreateLazyMarshaler(Ipv4SocketAddress{})
func (msg *Ipv4SocketAddress) Marshaler() _bindings.Marshaler {
return _mIpv4SocketAddress
}
// An IPV6 socket address, composed of an IPv6 address, a port, and a scope identifier.
//
// Inspired by the address definition in the [POSIX specification].
//
// [POSIX specification]: https://pubs.opengroup.org/onlinepubs/9699919799/
type Ipv6SocketAddress struct {
_ struct{} `fidl:"s" fidl_size_v1:"32" fidl_alignment_v1:"8"`
// IPv6 Address.
Address Ipv6Address `fidl_offset_v1:"0"`
// Transport-layer port.
Port uint16 `fidl_offset_v1:"16"`
// Provides a means to identify to which zone a non-global address belongs.
//
// A node may have interfaces attached to different zones of the same scope, for example
// different link-local zones are disambiguated by the use of a `zone_index` providing the
// interface identifier.
//
// `zone_index` 0 is the default zone.
//
// See [RFC 4007] for terminology and examples.
//
// [RFC 4007]: https://tools.ietf.org/html/rfc4007
ZoneIndex uint64 `fidl_offset_v1:"24"`
}
var _mIpv6SocketAddress = _bindings.CreateLazyMarshaler(Ipv6SocketAddress{})
func (msg *Ipv6SocketAddress) Marshaler() _bindings.Marshaler {
return _mIpv6SocketAddress
}
type nameLookupWithCtxLookupIpRequest struct {
_ struct{} `fidl:"s" fidl_size_v1:"24" fidl_alignment_v1:"8"`
Hostname string `fidl_offset_v1:"0" fidl_bounds:"255"`
Options LookupIpOptions `fidl_offset_v1:"16"`
}
var _mnameLookupWithCtxLookupIpRequest = _bindings.CreateLazyMarshaler(nameLookupWithCtxLookupIpRequest{})
func (msg *nameLookupWithCtxLookupIpRequest) Marshaler() _bindings.Marshaler {
return _mnameLookupWithCtxLookupIpRequest
}
type nameLookupWithCtxLookupIpResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"24" fidl_alignment_v1:"8"`
Result NameLookupLookupIpResult `fidl_offset_v1:"0"`
}
var _mnameLookupWithCtxLookupIpResponse = _bindings.CreateLazyMarshaler(nameLookupWithCtxLookupIpResponse{})
func (msg *nameLookupWithCtxLookupIpResponse) Marshaler() _bindings.Marshaler {
return _mnameLookupWithCtxLookupIpResponse
}
type nameLookupWithCtxLookupHostnameRequest struct {
_ struct{} `fidl:"s" fidl_size_v1:"24" fidl_alignment_v1:"8"`
Addr IpAddress `fidl_offset_v1:"0"`
}
var _mnameLookupWithCtxLookupHostnameRequest = _bindings.CreateLazyMarshaler(nameLookupWithCtxLookupHostnameRequest{})
func (msg *nameLookupWithCtxLookupHostnameRequest) Marshaler() _bindings.Marshaler {
return _mnameLookupWithCtxLookupHostnameRequest
}
type nameLookupWithCtxLookupHostnameResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"24" fidl_alignment_v1:"8"`
Result NameLookupLookupHostnameResult `fidl_offset_v1:"0"`
}
var _mnameLookupWithCtxLookupHostnameResponse = _bindings.CreateLazyMarshaler(nameLookupWithCtxLookupHostnameResponse{})
func (msg *nameLookupWithCtxLookupHostnameResponse) Marshaler() _bindings.Marshaler {
return _mnameLookupWithCtxLookupHostnameResponse
}
type I_nameLookupLookupIpResultTag uint64
const (
NameLookupLookupIpResultResponse = 1 // 0x00000001
NameLookupLookupIpResultErr = 2 // 0x00000002
)
type NameLookupLookupIpResult struct {
I_nameLookupLookupIpResultTag `fidl:"x!" fidl_size_v1:"24" fidl_alignment_v1:"8"`
Response NameLookupLookupIpResponse `fidl_ordinal:"1"`
Err LookupError `fidl_ordinal:"2"`
}
func (_m *NameLookupLookupIpResult) Which() I_nameLookupLookupIpResultTag {
return _m.I_nameLookupLookupIpResultTag
}
func (_m *NameLookupLookupIpResult) Ordinal() uint64 {
return uint64(_m.I_nameLookupLookupIpResultTag)
}
func (_m *NameLookupLookupIpResult) SetResponse(response NameLookupLookupIpResponse) {
_m.I_nameLookupLookupIpResultTag = NameLookupLookupIpResultResponse
_m.Response = response
}
func NameLookupLookupIpResultWithResponse(response NameLookupLookupIpResponse) NameLookupLookupIpResult {
var _u NameLookupLookupIpResult
_u.SetResponse(response)
return _u
}
func (_m *NameLookupLookupIpResult) SetErr(err LookupError) {
_m.I_nameLookupLookupIpResultTag = NameLookupLookupIpResultErr
_m.Err = err
}
func NameLookupLookupIpResultWithErr(err LookupError) NameLookupLookupIpResult {
var _u NameLookupLookupIpResult
_u.SetErr(err)
return _u
}
type I_nameLookupLookupHostnameResultTag uint64
const (
NameLookupLookupHostnameResultResponse = 1 // 0x00000001
NameLookupLookupHostnameResultErr = 2 // 0x00000002
)
type NameLookupLookupHostnameResult struct {
I_nameLookupLookupHostnameResultTag `fidl:"x!" fidl_size_v1:"24" fidl_alignment_v1:"8"`
Response NameLookupLookupHostnameResponse `fidl_ordinal:"1"`
Err LookupError `fidl_ordinal:"2"`
}
func (_m *NameLookupLookupHostnameResult) Which() I_nameLookupLookupHostnameResultTag {
return _m.I_nameLookupLookupHostnameResultTag
}
func (_m *NameLookupLookupHostnameResult) Ordinal() uint64 {
return uint64(_m.I_nameLookupLookupHostnameResultTag)
}
func (_m *NameLookupLookupHostnameResult) SetResponse(response NameLookupLookupHostnameResponse) {
_m.I_nameLookupLookupHostnameResultTag = NameLookupLookupHostnameResultResponse
_m.Response = response
}
func NameLookupLookupHostnameResultWithResponse(response NameLookupLookupHostnameResponse) NameLookupLookupHostnameResult {
var _u NameLookupLookupHostnameResult
_u.SetResponse(response)
return _u
}
func (_m *NameLookupLookupHostnameResult) SetErr(err LookupError) {
_m.I_nameLookupLookupHostnameResultTag = NameLookupLookupHostnameResultErr
_m.Err = err
}
func NameLookupLookupHostnameResultWithErr(err LookupError) NameLookupLookupHostnameResult {
var _u NameLookupLookupHostnameResult
_u.SetErr(err)
return _u
}
type I_ipAddressTag uint64
const (
IpAddressIpv4 = 1 // 0x00000001
IpAddressIpv6 = 2 // 0x00000002
)
// Represents an IP address that may be either v4 or v6.
type IpAddress struct {
I_ipAddressTag `fidl:"x!" fidl_size_v1:"24" fidl_alignment_v1:"8"`
Ipv4 Ipv4Address `fidl_ordinal:"1"`
Ipv6 Ipv6Address `fidl_ordinal:"2"`
}
func (_m *IpAddress) Which() I_ipAddressTag {
return _m.I_ipAddressTag
}
func (_m *IpAddress) Ordinal() uint64 {
return uint64(_m.I_ipAddressTag)
}
func (_m *IpAddress) SetIpv4(ipv4 Ipv4Address) {
_m.I_ipAddressTag = IpAddressIpv4
_m.Ipv4 = ipv4
}
func IpAddressWithIpv4(ipv4 Ipv4Address) IpAddress {
var _u IpAddress
_u.SetIpv4(ipv4)
return _u
}
func (_m *IpAddress) SetIpv6(ipv6 Ipv6Address) {
_m.I_ipAddressTag = IpAddressIpv6
_m.Ipv6 = ipv6
}
func IpAddressWithIpv6(ipv6 Ipv6Address) IpAddress {
var _u IpAddress
_u.SetIpv6(ipv6)
return _u
}
type I_socketAddressTag uint64
const (
SocketAddressIpv4 = 1 // 0x00000001
SocketAddressIpv6 = 2 // 0x00000002
)
// Represents an IP socket address that may be either v4 or v6.
type SocketAddress struct {
I_socketAddressTag `fidl:"x!" fidl_size_v1:"24" fidl_alignment_v1:"8"`
Ipv4 Ipv4SocketAddress `fidl_ordinal:"1"`
Ipv6 Ipv6SocketAddress `fidl_ordinal:"2"`
}
func (_m *SocketAddress) Which() I_socketAddressTag {
return _m.I_socketAddressTag
}
func (_m *SocketAddress) Ordinal() uint64 {
return uint64(_m.I_socketAddressTag)
}
func (_m *SocketAddress) SetIpv4(ipv4 Ipv4SocketAddress) {
_m.I_socketAddressTag = SocketAddressIpv4
_m.Ipv4 = ipv4
}
func SocketAddressWithIpv4(ipv4 Ipv4SocketAddress) SocketAddress {
var _u SocketAddress
_u.SetIpv4(ipv4)
return _u
}
func (_m *SocketAddress) SetIpv6(ipv6 Ipv6SocketAddress) {
_m.I_socketAddressTag = SocketAddressIpv6
_m.Ipv6 = ipv6
}
func SocketAddressWithIpv6(ipv6 Ipv6SocketAddress) SocketAddress {
var _u SocketAddress
_u.SetIpv6(ipv6)
return _u
}
const (
NameLookupLookupIpOrdinal uint64 = 0x58576c7210cd0f32
NameLookupLookupHostnameOrdinal uint64 = 0x5dfea9b2c92f510a
)
type NameLookupWithCtxInterface _bindings.ChannelProxy
// Look up a list of IP addresses by hostname.
//
// If `hostname` is an Internationalized Domain Name, it must be encoded as per RFC 3490.
func (p *NameLookupWithCtxInterface) LookupIp(ctx_ _bindings.Context, hostname string, options LookupIpOptions) (NameLookupLookupIpResult, error) {
req_ := &nameLookupWithCtxLookupIpRequest{
Hostname: hostname,
Options: options,
}
resp_ := &nameLookupWithCtxLookupIpResponse{}
err_ := ((*_bindings.ChannelProxy)(p)).Call(NameLookupLookupIpOrdinal, req_, resp_)
return resp_.Result, err_
}
// Look up a hostname by IP address.
func (p *NameLookupWithCtxInterface) LookupHostname(ctx_ _bindings.Context, addr IpAddress) (NameLookupLookupHostnameResult, error) {
req_ := &nameLookupWithCtxLookupHostnameRequest{
Addr: addr,
}
resp_ := &nameLookupWithCtxLookupHostnameResponse{}
err_ := ((*_bindings.ChannelProxy)(p)).Call(NameLookupLookupHostnameOrdinal, req_, resp_)
return resp_.Result, err_
}
type NameLookupWithCtx interface {
// Look up a list of IP addresses by hostname.
//
// If `hostname` is an Internationalized Domain Name, it must be encoded as per RFC 3490.
LookupIp(ctx_ _bindings.Context, hostname string, options LookupIpOptions) (NameLookupLookupIpResult, error)
// Look up a hostname by IP address.
LookupHostname(ctx_ _bindings.Context, addr IpAddress) (NameLookupLookupHostnameResult, error)
}
type NameLookupWithCtxTransitionalBase struct{}
type NameLookupWithCtxInterfaceRequest _bindings.InterfaceRequest
func NewNameLookupWithCtxInterfaceRequest() (NameLookupWithCtxInterfaceRequest, *NameLookupWithCtxInterface, error) {
req, cli, err := _bindings.NewInterfaceRequest()
return NameLookupWithCtxInterfaceRequest(req), (*NameLookupWithCtxInterface)(cli), err
}
// Implements ServiceRequest.
func (_ NameLookupWithCtxInterfaceRequest) Name() string {
return "fuchsia.net.NameLookup"
}
func (c NameLookupWithCtxInterfaceRequest) ToChannel() _zx.Channel {
return c.Channel
}
const NameLookupName = "fuchsia.net.NameLookup"
type NameLookupWithCtxStub struct {
Impl NameLookupWithCtx
}
func (s_ *NameLookupWithCtxStub) Dispatch(args_ _bindings.DispatchArgs) (_bindings.Message, bool, error) {
switch args_.Ordinal {
case NameLookupLookupIpOrdinal:
in_ := nameLookupWithCtxLookupIpRequest{}
marshalerCtx, ok := _bindings.GetMarshalerContext(args_.Ctx)
if !ok {
return nil, false, _bindings.ErrMissingMarshalerContext
}
if _, _, err_ := _bindings.UnmarshalWithContext2(marshalerCtx, args_.Bytes, args_.HandleInfos, &in_); err_ != nil {
return nil, false, err_
}
result, err_ := s_.Impl.LookupIp(args_.Ctx, in_.Hostname, in_.Options)
out_ := nameLookupWithCtxLookupIpResponse{}
out_.Result = result
return &out_, true, err_
case NameLookupLookupHostnameOrdinal:
in_ := nameLookupWithCtxLookupHostnameRequest{}
marshalerCtx, ok := _bindings.GetMarshalerContext(args_.Ctx)
if !ok {
return nil, false, _bindings.ErrMissingMarshalerContext
}
if _, _, err_ := _bindings.UnmarshalWithContext2(marshalerCtx, args_.Bytes, args_.HandleInfos, &in_); err_ != nil {
return nil, false, err_
}
result, err_ := s_.Impl.LookupHostname(args_.Ctx, in_.Addr)
out_ := nameLookupWithCtxLookupHostnameResponse{}
out_.Result = result
return &out_, true, err_
}
return nil, false, _bindings.ErrUnknownOrdinal
}
type NameLookupEventProxy _bindings.ChannelProxy