| // 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 false |
| case 2: |
| return false |
| case 3: |
| return false |
| case 4: |
| return false |
| default: |
| return true |
| } |
| } |
| |
| 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.Enum = IpVersion(0) |
| |
| // IpVersion is an IP version. |
| type IpVersion uint32 |
| |
| const ( |
| IpVersionV4 IpVersion = 1 |
| IpVersionV6 IpVersion = 2 |
| ) |
| |
| func (_ IpVersion) I_EnumValues() []IpVersion { |
| return []IpVersion{ |
| IpVersionV4, |
| IpVersionV6, |
| } |
| } |
| |
| func (_ IpVersion) I_EnumIsStrict() bool { |
| return true |
| } |
| |
| func (x IpVersion) IsUnknown() bool { |
| switch x { |
| case 1: |
| return false |
| case 2: |
| return false |
| default: |
| return true |
| } |
| } |
| |
| func (x IpVersion) String() string { |
| switch x { |
| case 1: |
| return "V4" |
| case 2: |
| return "V6" |
| } |
| return "Unknown" |
| } |
| |
| type NameLookupLookupIp2Response struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v2:"16" fidl_alignment_v2:"8"` |
| Result LookupResult `fidl_offset_v1:"0" fidl_offset_v2:"0"` |
| } |
| |
| var _mNameLookupLookupIp2Response = _bindings.CreateLazyMarshaler(NameLookupLookupIp2Response{}) |
| |
| func (msg *NameLookupLookupIp2Response) Marshaler() _bindings.Marshaler { |
| return _mNameLookupLookupIp2Response |
| } |
| |
| type NameLookupLookupHostnameResponse struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v2:"16" fidl_alignment_v2:"8"` |
| Hostname string `fidl_offset_v1:"0" fidl_offset_v2:"0" fidl_bounds:"255"` |
| } |
| |
| var _mNameLookupLookupHostnameResponse = _bindings.CreateLazyMarshaler(NameLookupLookupHostnameResponse{}) |
| |
| func (msg *NameLookupLookupHostnameResponse) Marshaler() _bindings.Marshaler { |
| return _mNameLookupLookupHostnameResponse |
| } |
| |
| // 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" fidl_size_v2:"4" fidl_alignment_v2:"1"` |
| Addr [4]uint8 `fidl_offset_v1:"0" fidl_offset_v2:"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" fidl_size_v2:"16" fidl_alignment_v2:"1"` |
| Addr [16]uint8 `fidl_offset_v1:"0" fidl_offset_v2:"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" fidl_size_v2:"24" fidl_alignment_v2:"8"` |
| // The Ipv4 or Ipv6 address. |
| Addr IpAddress `fidl_offset_v1:"0" fidl_offset_v2:"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" fidl_offset_v2:"16"` |
| } |
| |
| 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" fidl_size_v2:"6" fidl_alignment_v2:"1"` |
| Octets [6]uint8 `fidl_offset_v1:"0" fidl_offset_v2:"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" fidl_size_v2:"6" fidl_alignment_v2:"2"` |
| // IPv4 Address. |
| Address Ipv4Address `fidl_offset_v1:"0" fidl_offset_v2:"0"` |
| // Transport-layer port. |
| Port uint16 `fidl_offset_v1:"4" fidl_offset_v2:"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" fidl_size_v2:"32" fidl_alignment_v2:"8"` |
| // IPv6 Address. |
| Address Ipv6Address `fidl_offset_v1:"0" fidl_offset_v2:"0"` |
| // Transport-layer port. |
| Port uint16 `fidl_offset_v1:"16" fidl_offset_v2:"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" fidl_offset_v2:"24"` |
| } |
| |
| var _mIpv6SocketAddress = _bindings.CreateLazyMarshaler(Ipv6SocketAddress{}) |
| |
| func (msg *Ipv6SocketAddress) Marshaler() _bindings.Marshaler { |
| return _mIpv6SocketAddress |
| } |
| |
| type nameLookupWithCtxLookupIp2Request struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"32" fidl_alignment_v1:"8" fidl_size_v2:"32" fidl_alignment_v2:"8"` |
| Hostname string `fidl_offset_v1:"0" fidl_offset_v2:"0" fidl_bounds:"255"` |
| Options LookupIpOptions2 `fidl_offset_v1:"16" fidl_offset_v2:"16"` |
| } |
| |
| var _mnameLookupWithCtxLookupIp2Request = _bindings.CreateLazyMarshaler(nameLookupWithCtxLookupIp2Request{}) |
| |
| func (msg *nameLookupWithCtxLookupIp2Request) Marshaler() _bindings.Marshaler { |
| return _mnameLookupWithCtxLookupIp2Request |
| } |
| |
| type nameLookupWithCtxLookupIp2Response struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v2:"16" fidl_alignment_v2:"8"` |
| Result NameLookupLookupIp2Result `fidl_offset_v1:"0" fidl_offset_v2:"0"` |
| } |
| |
| var _mnameLookupWithCtxLookupIp2Response = _bindings.CreateLazyMarshaler(nameLookupWithCtxLookupIp2Response{}) |
| |
| func (msg *nameLookupWithCtxLookupIp2Response) Marshaler() _bindings.Marshaler { |
| return _mnameLookupWithCtxLookupIp2Response |
| } |
| |
| type nameLookupWithCtxLookupHostnameRequest struct { |
| _ struct{} `fidl:"s" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v2:"16" fidl_alignment_v2:"8"` |
| Addr IpAddress `fidl_offset_v1:"0" fidl_offset_v2:"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" fidl_size_v2:"16" fidl_alignment_v2:"8"` |
| Result NameLookupLookupHostnameResult `fidl_offset_v1:"0" fidl_offset_v2:"0"` |
| } |
| |
| var _mnameLookupWithCtxLookupHostnameResponse = _bindings.CreateLazyMarshaler(nameLookupWithCtxLookupHostnameResponse{}) |
| |
| func (msg *nameLookupWithCtxLookupHostnameResponse) Marshaler() _bindings.Marshaler { |
| return _mnameLookupWithCtxLookupHostnameResponse |
| } |
| |
| type I_nameLookupLookupIp2ResultTag uint64 |
| |
| const ( |
| NameLookupLookupIp2ResultResponse = 1 // 0x00000001 |
| NameLookupLookupIp2ResultErr = 2 // 0x00000002 |
| ) |
| |
| type NameLookupLookupIp2Result struct { |
| I_nameLookupLookupIp2ResultTag `fidl:"x!" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v2:"16" fidl_alignment_v2:"8" fidl_resource:"false"` |
| Response NameLookupLookupIp2Response `fidl_ordinal:"1"` |
| Err LookupError `fidl_ordinal:"2"` |
| } |
| |
| func (_m *NameLookupLookupIp2Result) reset() { |
| switch _m.I_nameLookupLookupIp2ResultTag { |
| case 1: |
| var _zeroed NameLookupLookupIp2Response |
| _m.Response = _zeroed |
| case 2: |
| var _zeroed LookupError |
| _m.Err = _zeroed |
| } |
| } |
| |
| func (_m *NameLookupLookupIp2Result) Which() I_nameLookupLookupIp2ResultTag { |
| return _m.I_nameLookupLookupIp2ResultTag |
| } |
| |
| func (_m *NameLookupLookupIp2Result) Ordinal() uint64 { |
| return uint64(_m.I_nameLookupLookupIp2ResultTag) |
| } |
| |
| func (_m *NameLookupLookupIp2Result) SetResponse(response NameLookupLookupIp2Response) { |
| _m.reset() |
| _m.I_nameLookupLookupIp2ResultTag = NameLookupLookupIp2ResultResponse |
| _m.Response = response |
| } |
| |
| func NameLookupLookupIp2ResultWithResponse(response NameLookupLookupIp2Response) NameLookupLookupIp2Result { |
| var _u NameLookupLookupIp2Result |
| _u.SetResponse(response) |
| return _u |
| } |
| |
| func (_m *NameLookupLookupIp2Result) SetErr(err LookupError) { |
| _m.reset() |
| _m.I_nameLookupLookupIp2ResultTag = NameLookupLookupIp2ResultErr |
| _m.Err = err |
| } |
| |
| func NameLookupLookupIp2ResultWithErr(err LookupError) NameLookupLookupIp2Result { |
| var _u NameLookupLookupIp2Result |
| _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" fidl_size_v2:"16" fidl_alignment_v2:"8" fidl_resource:"false"` |
| Response NameLookupLookupHostnameResponse `fidl_ordinal:"1"` |
| Err LookupError `fidl_ordinal:"2"` |
| } |
| |
| func (_m *NameLookupLookupHostnameResult) reset() { |
| switch _m.I_nameLookupLookupHostnameResultTag { |
| case 1: |
| var _zeroed NameLookupLookupHostnameResponse |
| _m.Response = _zeroed |
| case 2: |
| var _zeroed LookupError |
| _m.Err = _zeroed |
| } |
| } |
| |
| 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.reset() |
| _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.reset() |
| _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" fidl_size_v2:"16" fidl_alignment_v2:"8" fidl_resource:"false"` |
| Ipv4 Ipv4Address `fidl_ordinal:"1"` |
| Ipv6 Ipv6Address `fidl_ordinal:"2"` |
| } |
| |
| func (_m *IpAddress) reset() { |
| switch _m.I_ipAddressTag { |
| case 1: |
| var _zeroed Ipv4Address |
| _m.Ipv4 = _zeroed |
| case 2: |
| var _zeroed Ipv6Address |
| _m.Ipv6 = _zeroed |
| } |
| } |
| |
| 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.reset() |
| _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.reset() |
| _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" fidl_size_v2:"16" fidl_alignment_v2:"8" fidl_resource:"false"` |
| Ipv4 Ipv4SocketAddress `fidl_ordinal:"1"` |
| Ipv6 Ipv6SocketAddress `fidl_ordinal:"2"` |
| } |
| |
| func (_m *SocketAddress) reset() { |
| switch _m.I_socketAddressTag { |
| case 1: |
| var _zeroed Ipv4SocketAddress |
| _m.Ipv4 = _zeroed |
| case 2: |
| var _zeroed Ipv6SocketAddress |
| _m.Ipv6 = _zeroed |
| } |
| } |
| |
| 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.reset() |
| _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.reset() |
| _m.I_socketAddressTag = SocketAddressIpv6 |
| _m.Ipv6 = ipv6 |
| } |
| |
| func SocketAddressWithIpv6(ipv6 Ipv6SocketAddress) SocketAddress { |
| var _u SocketAddress |
| _u.SetIpv6(ipv6) |
| return _u |
| } |
| |
| // Lookup operation options. |
| type LookupIpOptions2 struct { |
| _ struct{} `fidl:"t" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v2:"16" fidl_alignment_v2:"8" fidl_resource:"false"` |
| I_unknownData interface{} |
| // Include IPv4 results. Defaults to false. |
| Ipv4Lookup bool `fidl_ordinal:"1"` |
| Ipv4LookupPresent bool |
| // Include IPv6 results. Defaults to false. |
| Ipv6Lookup bool `fidl_ordinal:"2"` |
| Ipv6LookupPresent bool |
| // Sort addresses in order of preference. |
| // |
| // It true, Addresses are sorted according to destination address selection described in [RFC |
| // 6724 Section 6](https://tools.ietf.org/html/rfc6724#section-6). |
| // |
| // Defaults to false. |
| SortAddresses bool `fidl_ordinal:"3"` |
| SortAddressesPresent bool |
| } |
| |
| func (u *LookupIpOptions2) SetIpv4Lookup(ipv4Lookup bool) { |
| u.Ipv4Lookup = ipv4Lookup |
| u.Ipv4LookupPresent = true |
| } |
| |
| func (u *LookupIpOptions2) GetIpv4Lookup() bool { |
| return u.Ipv4Lookup |
| } |
| |
| func (u *LookupIpOptions2) GetIpv4LookupWithDefault(_default bool) bool { |
| if !u.HasIpv4Lookup() { |
| return _default |
| } |
| return u.Ipv4Lookup |
| } |
| |
| func (u *LookupIpOptions2) HasIpv4Lookup() bool { |
| return u.Ipv4LookupPresent |
| } |
| |
| func (u *LookupIpOptions2) ClearIpv4Lookup() { |
| u.Ipv4LookupPresent = false |
| } |
| |
| func (u *LookupIpOptions2) SetIpv6Lookup(ipv6Lookup bool) { |
| u.Ipv6Lookup = ipv6Lookup |
| u.Ipv6LookupPresent = true |
| } |
| |
| func (u *LookupIpOptions2) GetIpv6Lookup() bool { |
| return u.Ipv6Lookup |
| } |
| |
| func (u *LookupIpOptions2) GetIpv6LookupWithDefault(_default bool) bool { |
| if !u.HasIpv6Lookup() { |
| return _default |
| } |
| return u.Ipv6Lookup |
| } |
| |
| func (u *LookupIpOptions2) HasIpv6Lookup() bool { |
| return u.Ipv6LookupPresent |
| } |
| |
| func (u *LookupIpOptions2) ClearIpv6Lookup() { |
| u.Ipv6LookupPresent = false |
| } |
| |
| func (u *LookupIpOptions2) SetSortAddresses(sortAddresses bool) { |
| u.SortAddresses = sortAddresses |
| u.SortAddressesPresent = true |
| } |
| |
| func (u *LookupIpOptions2) GetSortAddresses() bool { |
| return u.SortAddresses |
| } |
| |
| func (u *LookupIpOptions2) GetSortAddressesWithDefault(_default bool) bool { |
| if !u.HasSortAddresses() { |
| return _default |
| } |
| return u.SortAddresses |
| } |
| |
| func (u *LookupIpOptions2) HasSortAddresses() bool { |
| return u.SortAddressesPresent |
| } |
| |
| func (u *LookupIpOptions2) ClearSortAddresses() { |
| u.SortAddressesPresent = false |
| } |
| |
| func (u *LookupIpOptions2) HasUnknownData() bool { |
| return u.I_unknownData != nil |
| } |
| |
| func (u *LookupIpOptions2) GetUnknownData() map[uint64]_bindings.UnknownData { |
| return u.I_unknownData.(map[uint64]_bindings.UnknownData) |
| } |
| |
| // The result of a lookup operation. |
| type LookupResult struct { |
| _ struct{} `fidl:"t" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v2:"16" fidl_alignment_v2:"8" fidl_resource:"false"` |
| I_unknownData interface{} |
| // The IP addresses resulting from a lookup. |
| // |
| // If sorting was requested, `addresses` is sorted in order of preference, most preferred |
| // destination address first. |
| Addresses []IpAddress `fidl_bounds:"" fidl_ordinal:"1"` |
| AddressesPresent bool |
| } |
| |
| func (u *LookupResult) SetAddresses(addresses []IpAddress) { |
| u.Addresses = addresses |
| u.AddressesPresent = true |
| } |
| |
| func (u *LookupResult) GetAddresses() []IpAddress { |
| return u.Addresses |
| } |
| |
| func (u *LookupResult) GetAddressesWithDefault(_default []IpAddress) []IpAddress { |
| if !u.HasAddresses() { |
| return _default |
| } |
| return u.Addresses |
| } |
| |
| func (u *LookupResult) HasAddresses() bool { |
| return u.AddressesPresent |
| } |
| |
| func (u *LookupResult) ClearAddresses() { |
| u.AddressesPresent = false |
| } |
| |
| func (u *LookupResult) HasUnknownData() bool { |
| return u.I_unknownData != nil |
| } |
| |
| func (u *LookupResult) GetUnknownData() map[uint64]_bindings.UnknownData { |
| return u.I_unknownData.(map[uint64]_bindings.UnknownData) |
| } |
| |
| const ( |
| NameLookupLookupIp2Ordinal uint64 = 0x6d89c37498abf754 |
| NameLookupLookupHostnameOrdinal uint64 = 0x5dfea9b2c92f510a |
| ) |
| |
| type NameLookupWithCtxInterface _bindings.ChannelProxy |
| |
| // Lookup 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) LookupIp2(ctx_ _bindings.Context, hostname string, options LookupIpOptions2) (NameLookupLookupIp2Result, error) { |
| req_ := &nameLookupWithCtxLookupIp2Request{ |
| Hostname: hostname, |
| Options: options, |
| } |
| resp_ := &nameLookupWithCtxLookupIp2Response{} |
| err_ := ((*_bindings.ChannelProxy)(p)).Call(NameLookupLookupIp2Ordinal, 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 { |
| // Lookup a list of IP addresses by hostname. |
| // |
| // If `hostname` is an Internationalized Domain Name, it must be encoded as per RFC 3490. |
| LookupIp2(ctx_ _bindings.Context, hostname string, options LookupIpOptions2) (NameLookupLookupIp2Result, 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 NameLookupLookupIp2Ordinal: |
| in_ := nameLookupWithCtxLookupIp2Request{} |
| 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.LookupIp2(args_.Ctx, in_.Hostname, in_.Options) |
| out_ := nameLookupWithCtxLookupIp2Response{} |
| 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 |