blob: e80eaa65ae3c323231caf9680f3daef8ca2fc3ad [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 name
import (
_zx "syscall/zx"
_bindings "syscall/zx/fidl"
fuchsianet "syscall/zx/net"
)
type LookupAdminSetDnsServersResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"1" fidl_alignment_v1:"1"`
}
var _mLookupAdminSetDnsServersResponse = _bindings.CreateLazyMarshaler(LookupAdminSetDnsServersResponse{})
func (msg *LookupAdminSetDnsServersResponse) Marshaler() _bindings.Marshaler {
return _mLookupAdminSetDnsServersResponse
}
type lookupAdminWithCtxSetDnsServersRequest struct {
_ struct{} `fidl:"s" fidl_size_v1:"16" fidl_alignment_v1:"8"`
Servers []fuchsianet.SocketAddress `fidl_offset_v1:"0" fidl_bounds:""`
}
var _mlookupAdminWithCtxSetDnsServersRequest = _bindings.CreateLazyMarshaler(lookupAdminWithCtxSetDnsServersRequest{})
func (msg *lookupAdminWithCtxSetDnsServersRequest) Marshaler() _bindings.Marshaler {
return _mlookupAdminWithCtxSetDnsServersRequest
}
type lookupAdminWithCtxSetDnsServersResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"24" fidl_alignment_v1:"8"`
Result LookupAdminSetDnsServersResult `fidl_offset_v1:"0"`
}
var _mlookupAdminWithCtxSetDnsServersResponse = _bindings.CreateLazyMarshaler(lookupAdminWithCtxSetDnsServersResponse{})
func (msg *lookupAdminWithCtxSetDnsServersResponse) Marshaler() _bindings.Marshaler {
return _mlookupAdminWithCtxSetDnsServersResponse
}
type lookupAdminWithCtxGetDnsServersResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"16" fidl_alignment_v1:"8"`
Servers []fuchsianet.SocketAddress `fidl_offset_v1:"0" fidl_bounds:""`
}
var _mlookupAdminWithCtxGetDnsServersResponse = _bindings.CreateLazyMarshaler(lookupAdminWithCtxGetDnsServersResponse{})
func (msg *lookupAdminWithCtxGetDnsServersResponse) Marshaler() _bindings.Marshaler {
return _mlookupAdminWithCtxGetDnsServersResponse
}
type dnsServerWatcherWithCtxWatchServersResponse struct {
_ struct{} `fidl:"s" fidl_size_v1:"16" fidl_alignment_v1:"8"`
Servers []DnsServer `fidl_offset_v1:"0" fidl_bounds:""`
}
var _mdnsServerWatcherWithCtxWatchServersResponse = _bindings.CreateLazyMarshaler(dnsServerWatcherWithCtxWatchServersResponse{})
func (msg *dnsServerWatcherWithCtxWatchServersResponse) Marshaler() _bindings.Marshaler {
return _mdnsServerWatcherWithCtxWatchServersResponse
}
type I_dnsServerSourceTag uint64
const (
DnsServerSourceStaticSource = 1 // 0x00000001
DnsServerSourceDhcp = 2 // 0x00000002
DnsServerSourceNdp = 3 // 0x00000003
DnsServerSourceDhcpv6 = 4 // 0x00000004
)
// The configuration source for a [`fuchsia.net.name/DnsServer`].
type DnsServerSource struct {
I_dnsServerSourceTag `fidl:"x!" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_resource:"false"`
// The server is statically configured through
// [`fuchsia.net.name/LookupAdmin.SetDefaultServers`].
StaticSource StaticDnsServerSource `fidl_ordinal:"1"`
// The server was discovered through DHCPv4.
Dhcp DhcpDnsServerSource `fidl_ordinal:"2"`
// The server was discovered through an NDP Router Advertisement.
Ndp NdpDnsServerSource `fidl_ordinal:"3"`
// The server was discovered through DHCPv6.
Dhcpv6 Dhcpv6DnsServerSource `fidl_ordinal:"4"`
}
func (_m *DnsServerSource) Which() I_dnsServerSourceTag {
return _m.I_dnsServerSourceTag
}
func (_m *DnsServerSource) Ordinal() uint64 {
return uint64(_m.I_dnsServerSourceTag)
}
func (_m *DnsServerSource) SetStaticSource(staticSource StaticDnsServerSource) {
_m.I_dnsServerSourceTag = DnsServerSourceStaticSource
_m.StaticSource = staticSource
}
func DnsServerSourceWithStaticSource(staticSource StaticDnsServerSource) DnsServerSource {
var _u DnsServerSource
_u.SetStaticSource(staticSource)
return _u
}
func (_m *DnsServerSource) SetDhcp(dhcp DhcpDnsServerSource) {
_m.I_dnsServerSourceTag = DnsServerSourceDhcp
_m.Dhcp = dhcp
}
func DnsServerSourceWithDhcp(dhcp DhcpDnsServerSource) DnsServerSource {
var _u DnsServerSource
_u.SetDhcp(dhcp)
return _u
}
func (_m *DnsServerSource) SetNdp(ndp NdpDnsServerSource) {
_m.I_dnsServerSourceTag = DnsServerSourceNdp
_m.Ndp = ndp
}
func DnsServerSourceWithNdp(ndp NdpDnsServerSource) DnsServerSource {
var _u DnsServerSource
_u.SetNdp(ndp)
return _u
}
func (_m *DnsServerSource) SetDhcpv6(dhcpv6 Dhcpv6DnsServerSource) {
_m.I_dnsServerSourceTag = DnsServerSourceDhcpv6
_m.Dhcpv6 = dhcpv6
}
func DnsServerSourceWithDhcpv6(dhcpv6 Dhcpv6DnsServerSource) DnsServerSource {
var _u DnsServerSource
_u.SetDhcpv6(dhcpv6)
return _u
}
type I_lookupAdminSetDnsServersResultTag uint64
const (
LookupAdminSetDnsServersResultResponse = 1 // 0x00000001
LookupAdminSetDnsServersResultErr = 2 // 0x00000002
)
type LookupAdminSetDnsServersResult struct {
I_lookupAdminSetDnsServersResultTag `fidl:"x!" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_resource:"true"`
Response LookupAdminSetDnsServersResponse `fidl_ordinal:"1"`
Err int32 `fidl_ordinal:"2"`
}
func (_m *LookupAdminSetDnsServersResult) Which() I_lookupAdminSetDnsServersResultTag {
return _m.I_lookupAdminSetDnsServersResultTag
}
func (_m *LookupAdminSetDnsServersResult) Ordinal() uint64 {
return uint64(_m.I_lookupAdminSetDnsServersResultTag)
}
func (_m *LookupAdminSetDnsServersResult) SetResponse(response LookupAdminSetDnsServersResponse) {
_m.I_lookupAdminSetDnsServersResultTag = LookupAdminSetDnsServersResultResponse
_m.Response = response
}
func LookupAdminSetDnsServersResultWithResponse(response LookupAdminSetDnsServersResponse) LookupAdminSetDnsServersResult {
var _u LookupAdminSetDnsServersResult
_u.SetResponse(response)
return _u
}
func (_m *LookupAdminSetDnsServersResult) SetErr(err int32) {
_m.I_lookupAdminSetDnsServersResultTag = LookupAdminSetDnsServersResultErr
_m.Err = err
}
func LookupAdminSetDnsServersResultWithErr(err int32) LookupAdminSetDnsServersResult {
var _u LookupAdminSetDnsServersResult
_u.SetErr(err)
return _u
}
// Extra information about statically set DNS servers.
type StaticDnsServerSource struct {
_ struct{} `fidl:"t" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_resource:"false"`
I_unknownData interface{}
}
func (u *StaticDnsServerSource) HasUnknownData() bool {
return u.I_unknownData != nil
}
func (u *StaticDnsServerSource) GetUnknownData() map[uint64]_bindings.UnknownData {
return u.I_unknownData.(map[uint64]_bindings.UnknownData)
}
// Extra information about DNS servers discovered through DHCPv4.
type DhcpDnsServerSource struct {
_ struct{} `fidl:"t" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_resource:"false"`
I_unknownData interface{}
// The interface index over which this server was discovered.
SourceInterface uint64 `fidl_ordinal:"1"`
SourceInterfacePresent bool
}
func (u *DhcpDnsServerSource) SetSourceInterface(sourceInterface uint64) {
u.SourceInterface = sourceInterface
u.SourceInterfacePresent = true
}
func (u *DhcpDnsServerSource) GetSourceInterface() uint64 {
return u.SourceInterface
}
func (u *DhcpDnsServerSource) GetSourceInterfaceWithDefault(_default uint64) uint64 {
if !u.HasSourceInterface() {
return _default
}
return u.SourceInterface
}
func (u *DhcpDnsServerSource) HasSourceInterface() bool {
return u.SourceInterfacePresent
}
func (u *DhcpDnsServerSource) ClearSourceInterface() {
u.SourceInterfacePresent = false
}
func (u *DhcpDnsServerSource) HasUnknownData() bool {
return u.I_unknownData != nil
}
func (u *DhcpDnsServerSource) GetUnknownData() map[uint64]_bindings.UnknownData {
return u.I_unknownData.(map[uint64]_bindings.UnknownData)
}
// Extra information about DNS servers discovered through NDP.
type NdpDnsServerSource struct {
_ struct{} `fidl:"t" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_resource:"false"`
I_unknownData interface{}
// The interface index over which this server was discovered.
SourceInterface uint64 `fidl_ordinal:"1"`
SourceInterfacePresent bool
}
func (u *NdpDnsServerSource) SetSourceInterface(sourceInterface uint64) {
u.SourceInterface = sourceInterface
u.SourceInterfacePresent = true
}
func (u *NdpDnsServerSource) GetSourceInterface() uint64 {
return u.SourceInterface
}
func (u *NdpDnsServerSource) GetSourceInterfaceWithDefault(_default uint64) uint64 {
if !u.HasSourceInterface() {
return _default
}
return u.SourceInterface
}
func (u *NdpDnsServerSource) HasSourceInterface() bool {
return u.SourceInterfacePresent
}
func (u *NdpDnsServerSource) ClearSourceInterface() {
u.SourceInterfacePresent = false
}
func (u *NdpDnsServerSource) HasUnknownData() bool {
return u.I_unknownData != nil
}
func (u *NdpDnsServerSource) GetUnknownData() map[uint64]_bindings.UnknownData {
return u.I_unknownData.(map[uint64]_bindings.UnknownData)
}
// Extra information about DNS servers discovered through DHCPv6.
type Dhcpv6DnsServerSource struct {
_ struct{} `fidl:"t" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_resource:"false"`
I_unknownData interface{}
// The interface index over which this server was discovered.
SourceInterface uint64 `fidl_ordinal:"1"`
SourceInterfacePresent bool
}
func (u *Dhcpv6DnsServerSource) SetSourceInterface(sourceInterface uint64) {
u.SourceInterface = sourceInterface
u.SourceInterfacePresent = true
}
func (u *Dhcpv6DnsServerSource) GetSourceInterface() uint64 {
return u.SourceInterface
}
func (u *Dhcpv6DnsServerSource) GetSourceInterfaceWithDefault(_default uint64) uint64 {
if !u.HasSourceInterface() {
return _default
}
return u.SourceInterface
}
func (u *Dhcpv6DnsServerSource) HasSourceInterface() bool {
return u.SourceInterfacePresent
}
func (u *Dhcpv6DnsServerSource) ClearSourceInterface() {
u.SourceInterfacePresent = false
}
func (u *Dhcpv6DnsServerSource) HasUnknownData() bool {
return u.I_unknownData != nil
}
func (u *Dhcpv6DnsServerSource) GetUnknownData() map[uint64]_bindings.UnknownData {
return u.I_unknownData.(map[uint64]_bindings.UnknownData)
}
// A DNS server configuration.
type DnsServer struct {
_ struct{} `fidl:"t" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_resource:"false"`
I_unknownData interface{}
// The server's address, must be provided.
Address fuchsianet.SocketAddress `fidl_ordinal:"1"`
AddressPresent bool
// The configuration source for this server. Defaults to
// [`fuchsia.net.name/DnsServerSource.static_source`].
Source DnsServerSource `fidl_ordinal:"2"`
SourcePresent bool
}
func (u *DnsServer) SetAddress(address fuchsianet.SocketAddress) {
u.Address = address
u.AddressPresent = true
}
func (u *DnsServer) GetAddress() fuchsianet.SocketAddress {
return u.Address
}
func (u *DnsServer) GetAddressWithDefault(_default fuchsianet.SocketAddress) fuchsianet.SocketAddress {
if !u.HasAddress() {
return _default
}
return u.Address
}
func (u *DnsServer) HasAddress() bool {
return u.AddressPresent
}
func (u *DnsServer) ClearAddress() {
u.AddressPresent = false
}
func (u *DnsServer) SetSource(source DnsServerSource) {
u.Source = source
u.SourcePresent = true
}
func (u *DnsServer) GetSource() DnsServerSource {
return u.Source
}
func (u *DnsServer) GetSourceWithDefault(_default DnsServerSource) DnsServerSource {
if !u.HasSource() {
return _default
}
return u.Source
}
func (u *DnsServer) HasSource() bool {
return u.SourcePresent
}
func (u *DnsServer) ClearSource() {
u.SourcePresent = false
}
func (u *DnsServer) HasUnknownData() bool {
return u.I_unknownData != nil
}
func (u *DnsServer) GetUnknownData() map[uint64]_bindings.UnknownData {
return u.I_unknownData.(map[uint64]_bindings.UnknownData)
}
const (
LookupAdminSetDnsServersOrdinal uint64 = 0x55e2b9fcc777be96
LookupAdminGetDnsServersOrdinal uint64 = 0x614303bf6e72f80f
)
type LookupAdminWithCtxInterface _bindings.ChannelProxy
// Sets the DNS servers to `servers`
//
// + request `servers` The list of servers to use for domain name resolution, in priority
// order. An empty list means no servers will be used and name resolution may fail. Each
// `SocketAddress` in `servers` must be a valid unicast socket address. The list of servers
// will be deduplicated.
// * error Returns `ZX_ERR_INVALID_ARGS` if any of the provided addresses does not meet the
// conditions above.
func (p *LookupAdminWithCtxInterface) SetDnsServers(ctx_ _bindings.Context, servers []fuchsianet.SocketAddress) (LookupAdminSetDnsServersResult, error) {
req_ := &lookupAdminWithCtxSetDnsServersRequest{
Servers: servers,
}
resp_ := &lookupAdminWithCtxSetDnsServersResponse{}
err_ := ((*_bindings.ChannelProxy)(p)).Call(LookupAdminSetDnsServersOrdinal, req_, resp_)
return resp_.Result, err_
}
// Gets the DNS servers currently in use to resolve name lookups.
// - response `servers` The list of servers in use by `LookupAdmin`, in priority order.
func (p *LookupAdminWithCtxInterface) GetDnsServers(ctx_ _bindings.Context) ([]fuchsianet.SocketAddress, error) {
var req_ _bindings.Message
resp_ := &lookupAdminWithCtxGetDnsServersResponse{}
err_ := ((*_bindings.ChannelProxy)(p)).Call(LookupAdminGetDnsServersOrdinal, req_, resp_)
return resp_.Servers, err_
}
// Provides administration controls over name resolution settings.
type LookupAdminWithCtx interface {
// Sets the DNS servers to `servers`
//
// + request `servers` The list of servers to use for domain name resolution, in priority
// order. An empty list means no servers will be used and name resolution may fail. Each
// `SocketAddress` in `servers` must be a valid unicast socket address. The list of servers
// will be deduplicated.
// * error Returns `ZX_ERR_INVALID_ARGS` if any of the provided addresses does not meet the
// conditions above.
SetDnsServers(ctx_ _bindings.Context, servers []fuchsianet.SocketAddress) (LookupAdminSetDnsServersResult, error)
// Gets the DNS servers currently in use to resolve name lookups.
// - response `servers` The list of servers in use by `LookupAdmin`, in priority order.
GetDnsServers(ctx_ _bindings.Context) ([]fuchsianet.SocketAddress, error)
}
type LookupAdminWithCtxTransitionalBase struct{}
type LookupAdminWithCtxInterfaceRequest _bindings.InterfaceRequest
func NewLookupAdminWithCtxInterfaceRequest() (LookupAdminWithCtxInterfaceRequest, *LookupAdminWithCtxInterface, error) {
req, cli, err := _bindings.NewInterfaceRequest()
return LookupAdminWithCtxInterfaceRequest(req), (*LookupAdminWithCtxInterface)(cli), err
}
// Implements ServiceRequest.
func (_ LookupAdminWithCtxInterfaceRequest) Name() string {
return "fuchsia.net.name.LookupAdmin"
}
func (c LookupAdminWithCtxInterfaceRequest) ToChannel() _zx.Channel {
return c.Channel
}
const LookupAdminName = "fuchsia.net.name.LookupAdmin"
type LookupAdminWithCtxStub struct {
Impl LookupAdminWithCtx
}
func (s_ *LookupAdminWithCtxStub) Dispatch(args_ _bindings.DispatchArgs) (_bindings.Message, bool, error) {
switch args_.Ordinal {
case LookupAdminSetDnsServersOrdinal:
in_ := lookupAdminWithCtxSetDnsServersRequest{}
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.SetDnsServers(args_.Ctx, in_.Servers)
out_ := lookupAdminWithCtxSetDnsServersResponse{}
out_.Result = result
return &out_, true, err_
case LookupAdminGetDnsServersOrdinal:
servers, err_ := s_.Impl.GetDnsServers(args_.Ctx)
out_ := lookupAdminWithCtxGetDnsServersResponse{}
out_.Servers = servers
return &out_, true, err_
}
return nil, false, _bindings.ErrUnknownOrdinal
}
type LookupAdminEventProxy _bindings.ChannelProxy
const (
DnsServerWatcherWatchServersOrdinal uint64 = 0x5748907e7f11b632
)
type DnsServerWatcherWithCtxInterface _bindings.ChannelProxy
// Returns a list of DNS servers.
//
// First call always returns a snapshot of the current list of servers or blocks if an empty
// list would be returned. Subsequent calls will block until the list of servers changes.
//
// The list of servers changes over time by configuration or network topology changes,
// expiration, etc. Callers must repeatedly call `WatchServers` and replace any previously
// returned `servers` with new ones to avoid using stale or expired entries.
//
// It is invalid to call `WatchServers` while a previous call is still pending. Doing so will
// cause the `DnsServerWatcher` channel to be closed.
//
// - response `servers` The list of servers to use for DNS resolution, in priority order.
func (p *DnsServerWatcherWithCtxInterface) WatchServers(ctx_ _bindings.Context) ([]DnsServer, error) {
var req_ _bindings.Message
resp_ := &dnsServerWatcherWithCtxWatchServersResponse{}
err_ := ((*_bindings.ChannelProxy)(p)).Call(DnsServerWatcherWatchServersOrdinal, req_, resp_)
return resp_.Servers, err_
}
// Provides a hanging get interface to watch for DNS servers configuration.
type DnsServerWatcherWithCtx interface {
// Returns a list of DNS servers.
//
// First call always returns a snapshot of the current list of servers or blocks if an empty
// list would be returned. Subsequent calls will block until the list of servers changes.
//
// The list of servers changes over time by configuration or network topology changes,
// expiration, etc. Callers must repeatedly call `WatchServers` and replace any previously
// returned `servers` with new ones to avoid using stale or expired entries.
//
// It is invalid to call `WatchServers` while a previous call is still pending. Doing so will
// cause the `DnsServerWatcher` channel to be closed.
//
// - response `servers` The list of servers to use for DNS resolution, in priority order.
WatchServers(ctx_ _bindings.Context) ([]DnsServer, error)
}
type DnsServerWatcherWithCtxTransitionalBase struct{}
type DnsServerWatcherWithCtxInterfaceRequest _bindings.InterfaceRequest
func NewDnsServerWatcherWithCtxInterfaceRequest() (DnsServerWatcherWithCtxInterfaceRequest, *DnsServerWatcherWithCtxInterface, error) {
req, cli, err := _bindings.NewInterfaceRequest()
return DnsServerWatcherWithCtxInterfaceRequest(req), (*DnsServerWatcherWithCtxInterface)(cli), err
}
type DnsServerWatcherWithCtxStub struct {
Impl DnsServerWatcherWithCtx
}
func (s_ *DnsServerWatcherWithCtxStub) Dispatch(args_ _bindings.DispatchArgs) (_bindings.Message, bool, error) {
switch args_.Ordinal {
case DnsServerWatcherWatchServersOrdinal:
servers, err_ := s_.Impl.WatchServers(args_.Ctx)
out_ := dnsServerWatcherWithCtxWatchServersResponse{}
out_.Servers = servers
return &out_, true, err_
}
return nil, false, _bindings.ErrUnknownOrdinal
}
type DnsServerWatcherEventProxy _bindings.ChannelProxy