Include allowed string values in generated services.
This commit is contained in:
		@@ -23,7 +23,9 @@ import (
 | 
			
		||||
	"github.com/huin/goupnp/v2alpha/description/typedesc"
 | 
			
		||||
	"github.com/huin/goupnp/v2alpha/description/xmlsrvdesc"
 | 
			
		||||
	"github.com/huin/goupnp/v2alpha/soap"
 | 
			
		||||
	"github.com/huin/goupnp/v2alpha/soap/types"
 | 
			
		||||
	"golang.org/x/exp/maps"
 | 
			
		||||
 | 
			
		||||
	soaptypes "github.com/huin/goupnp/v2alpha/soap/types"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
@@ -93,7 +95,7 @@ func run() error {
 | 
			
		||||
 | 
			
		||||
	// Use default type map for now. Addtional types could be use instead or
 | 
			
		||||
	// as well as necessary for extended types.
 | 
			
		||||
	typeMap := types.TypeMap().Clone()
 | 
			
		||||
	typeMap := soaptypes.TypeMap().Clone()
 | 
			
		||||
	typeMap[soapActionInterface] = typedesc.TypeDesc{
 | 
			
		||||
		GoType: reflect.TypeOf((*soap.Action)(nil)).Elem(),
 | 
			
		||||
	}
 | 
			
		||||
@@ -160,7 +162,8 @@ func processService(
 | 
			
		||||
		return fmt.Errorf("transforming service description: %w", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	imps, err := accumulateImports(sd, typeMap)
 | 
			
		||||
	imps := newImports()
 | 
			
		||||
	types, err := accumulateTypes(sd, typeMap, imps)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
@@ -169,6 +172,7 @@ func processService(
 | 
			
		||||
	err = tmpl.ExecuteTemplate(buf, "service", tmplArgs{
 | 
			
		||||
		Manifest: srvManifest,
 | 
			
		||||
		Imps:     imps,
 | 
			
		||||
		Types:    types,
 | 
			
		||||
		SCPD:     sd,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@@ -221,14 +225,44 @@ type ServiceManifest struct {
 | 
			
		||||
type tmplArgs struct {
 | 
			
		||||
	Manifest *ServiceManifest
 | 
			
		||||
	Imps     *imports
 | 
			
		||||
	Types    *types
 | 
			
		||||
	SCPD     *srvdesc.SCPD
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type imports struct {
 | 
			
		||||
	// Maps from a type name like "ui4" to the `alias.name` for the import.
 | 
			
		||||
	TypeByName map[string]typeDesc
 | 
			
		||||
	// Each required import line, ordered by path.
 | 
			
		||||
	ImportLines []importItem
 | 
			
		||||
	// aliasByPath maps from import path to its imported alias.
 | 
			
		||||
	aliasByPath map[string]string
 | 
			
		||||
	// nextAlias is the number for the next import alias.
 | 
			
		||||
	nextAlias int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func newImports() *imports {
 | 
			
		||||
	return &imports{
 | 
			
		||||
		aliasByPath: make(map[string]string),
 | 
			
		||||
		nextAlias:   1,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (imps *imports) getAliasForPath(path string) string {
 | 
			
		||||
	if alias, ok := imps.aliasByPath[path]; ok {
 | 
			
		||||
		return alias
 | 
			
		||||
	}
 | 
			
		||||
	alias := fmt.Sprintf("pkg%d", imps.nextAlias)
 | 
			
		||||
	imps.nextAlias++
 | 
			
		||||
	imps.ImportLines = append(imps.ImportLines, importItem{
 | 
			
		||||
		Alias: alias,
 | 
			
		||||
		Path:  path,
 | 
			
		||||
	})
 | 
			
		||||
	imps.aliasByPath[path] = alias
 | 
			
		||||
	return alias
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type types struct {
 | 
			
		||||
	// Maps from a type name like "ui4" to the `alias.name` for the import.
 | 
			
		||||
	TypeByName    map[string]typeDesc
 | 
			
		||||
	StringVarDefs []stringVarDef
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type typeDesc struct {
 | 
			
		||||
@@ -241,17 +275,41 @@ type typeDesc struct {
 | 
			
		||||
	Name string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type stringVarDef struct {
 | 
			
		||||
	Name          string
 | 
			
		||||
	AllowedValues []string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type importItem struct {
 | 
			
		||||
	Alias string
 | 
			
		||||
	Path  string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func accumulateImports(srvDesc *srvdesc.SCPD, typeMap typedesc.TypeMap) (*imports, error) {
 | 
			
		||||
	typeNames := make(map[string]bool)
 | 
			
		||||
	typeNames[soapActionInterface] = true
 | 
			
		||||
// accumulateTypes creates type information, and adds any required imports for
 | 
			
		||||
// them.
 | 
			
		||||
func accumulateTypes(
 | 
			
		||||
	srvDesc *srvdesc.SCPD,
 | 
			
		||||
	typeMap typedesc.TypeMap,
 | 
			
		||||
	imps *imports,
 | 
			
		||||
) (*types, error) {
 | 
			
		||||
	typeNames := make(map[string]struct{})
 | 
			
		||||
	typeNames[soapActionInterface] = struct{}{}
 | 
			
		||||
 | 
			
		||||
	err := visitTypesSCPD(srvDesc, func(typeName string) {
 | 
			
		||||
		typeNames[typeName] = true
 | 
			
		||||
	var stringVarDefs []stringVarDef
 | 
			
		||||
	sortedVarNames := maps.Keys(srvDesc.VariableByName)
 | 
			
		||||
	sort.Strings(sortedVarNames)
 | 
			
		||||
	for _, svName := range sortedVarNames {
 | 
			
		||||
		sv := srvDesc.VariableByName[svName]
 | 
			
		||||
		if sv.DataType == "string" && len(sv.AllowedValues) > 0 {
 | 
			
		||||
			stringVarDefs = append(stringVarDefs, stringVarDef{
 | 
			
		||||
				Name:          svName,
 | 
			
		||||
				AllowedValues: srvDesc.VariableByName[svName].AllowedValues,
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err := visitTypesSCPD(srvDesc, func(sv *srvdesc.StateVariable) {
 | 
			
		||||
		typeNames[sv.DataType] = struct{}{}
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
@@ -259,7 +317,7 @@ func accumulateImports(srvDesc *srvdesc.SCPD, typeMap typedesc.TypeMap) (*import
 | 
			
		||||
 | 
			
		||||
	// Have sorted list of import package paths. Partly for aesthetics of generated code, but also
 | 
			
		||||
	// to have stable-generated aliases.
 | 
			
		||||
	paths := make(map[string]bool)
 | 
			
		||||
	paths := make(map[string]struct{})
 | 
			
		||||
	for typeName := range typeNames {
 | 
			
		||||
		t, ok := typeMap[typeName]
 | 
			
		||||
		if !ok {
 | 
			
		||||
@@ -267,29 +325,17 @@ func accumulateImports(srvDesc *srvdesc.SCPD, typeMap typedesc.TypeMap) (*import
 | 
			
		||||
		}
 | 
			
		||||
		pkgPath := t.GoType.PkgPath()
 | 
			
		||||
		if pkgPath == "" {
 | 
			
		||||
			// Builtin type, ignore.
 | 
			
		||||
			// Builtin type, no import needed.
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		paths[pkgPath] = true
 | 
			
		||||
	}
 | 
			
		||||
	sortedPaths := make([]string, 0, len(paths))
 | 
			
		||||
	for path := range paths {
 | 
			
		||||
		sortedPaths = append(sortedPaths, path)
 | 
			
		||||
		paths[pkgPath] = struct{}{}
 | 
			
		||||
	}
 | 
			
		||||
	sortedPaths := maps.Keys(paths)
 | 
			
		||||
	sort.Strings(sortedPaths)
 | 
			
		||||
 | 
			
		||||
	// Generate import aliases.
 | 
			
		||||
	index := 1
 | 
			
		||||
	aliasByPath := make(map[string]string, len(paths))
 | 
			
		||||
	importLines := make([]importItem, 0, len(paths))
 | 
			
		||||
	// Generate import aliases in deterministic order.
 | 
			
		||||
	for _, path := range sortedPaths {
 | 
			
		||||
		alias := fmt.Sprintf("pkg%d", index)
 | 
			
		||||
		index++
 | 
			
		||||
		importLines = append(importLines, importItem{
 | 
			
		||||
			Alias: alias,
 | 
			
		||||
			Path:  path,
 | 
			
		||||
		})
 | 
			
		||||
		aliasByPath[path] = alias
 | 
			
		||||
		imps.getAliasForPath(path)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Populate typeByName.
 | 
			
		||||
@@ -297,28 +343,27 @@ func accumulateImports(srvDesc *srvdesc.SCPD, typeMap typedesc.TypeMap) (*import
 | 
			
		||||
	for typeName := range typeNames {
 | 
			
		||||
		goType := typeMap[typeName]
 | 
			
		||||
		pkgPath := goType.GoType.PkgPath()
 | 
			
		||||
		alias := aliasByPath[pkgPath]
 | 
			
		||||
		td := typeDesc{
 | 
			
		||||
			Name: goType.GoType.Name(),
 | 
			
		||||
		}
 | 
			
		||||
		if alias == "" {
 | 
			
		||||
		if pkgPath == "" {
 | 
			
		||||
			// Builtin type.
 | 
			
		||||
			td.AbsRef = td.Name
 | 
			
		||||
			td.Ref = td.Name
 | 
			
		||||
		} else {
 | 
			
		||||
			td.AbsRef = strconv.Quote(pkgPath) + "." + td.Name
 | 
			
		||||
			td.Ref = alias + "." + td.Name
 | 
			
		||||
			td.Ref = imps.getAliasForPath(pkgPath) + "." + td.Name
 | 
			
		||||
		}
 | 
			
		||||
		typeByName[typeName] = td
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &imports{
 | 
			
		||||
		TypeByName:  typeByName,
 | 
			
		||||
		ImportLines: importLines,
 | 
			
		||||
	return &types{
 | 
			
		||||
		TypeByName:    typeByName,
 | 
			
		||||
		StringVarDefs: stringVarDefs,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type typeVisitor func(typeName string)
 | 
			
		||||
type typeVisitor func(sv *srvdesc.StateVariable)
 | 
			
		||||
 | 
			
		||||
// visitTypesSCPD calls `visitor` with each data type name (e.g. "ui4") referenced
 | 
			
		||||
// by action arguments.`
 | 
			
		||||
@@ -337,14 +382,14 @@ func visitTypesAction(action *srvdesc.Action, visitor typeVisitor) error {
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		visitor(sv.DataType)
 | 
			
		||||
		visitor(sv)
 | 
			
		||||
	}
 | 
			
		||||
	for _, arg := range action.OutArgs {
 | 
			
		||||
		sv, err := arg.RelatedStateVariable()
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		visitor(sv.DataType)
 | 
			
		||||
		visitor(sv)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -140,6 +140,8 @@ func (arg *Argument) RelatedStateVariable() (*StateVariable, error) {
 | 
			
		||||
type StateVariable struct {
 | 
			
		||||
	Name     string
 | 
			
		||||
	DataType string
 | 
			
		||||
 | 
			
		||||
	AllowedValues []string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func stateVariableFromXML(xmlSV *xmlsrvdesc.StateVariable) (*StateVariable, error) {
 | 
			
		||||
@@ -150,8 +152,13 @@ func stateVariableFromXML(xmlSV *xmlsrvdesc.StateVariable) (*StateVariable, erro
 | 
			
		||||
		return nil, fmt.Errorf("%w: unsupported data type %q",
 | 
			
		||||
			ErrUnsupportedDescription, xmlSV.DataType.Type)
 | 
			
		||||
	}
 | 
			
		||||
	if xmlSV.DataType.Name != "string" && len(xmlSV.AllowedValues) > 0 {
 | 
			
		||||
		return nil, fmt.Errorf("%w: allowedValueList is currently unsupported for type %q",
 | 
			
		||||
			ErrUnsupportedDescription, xmlSV.DataType.Name)
 | 
			
		||||
	}
 | 
			
		||||
	return &StateVariable{
 | 
			
		||||
		Name:     xmlSV.Name,
 | 
			
		||||
		DataType: xmlSV.DataType.Name,
 | 
			
		||||
		Name:          xmlSV.Name,
 | 
			
		||||
		DataType:      xmlSV.DataType.Name,
 | 
			
		||||
		AllowedValues: xmlSV.AllowedValues,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,8 @@ module github.com/huin/goupnp/v2alpha
 | 
			
		||||
 | 
			
		||||
go 1.18
 | 
			
		||||
 | 
			
		||||
require github.com/google/go-cmp v0.5.7
 | 
			
		||||
require github.com/google/go-cmp v0.5.8
 | 
			
		||||
 | 
			
		||||
require github.com/BurntSushi/toml v1.1.0
 | 
			
		||||
 | 
			
		||||
require golang.org/x/exp v0.0.0-20230307190834-24139beb5833 // indirect
 | 
			
		||||
 
 | 
			
		||||
@@ -2,5 +2,9 @@ github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I
 | 
			
		||||
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
 | 
			
		||||
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
 | 
			
		||||
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
 | 
			
		||||
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
 | 
			
		||||
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
 | 
			
		||||
golang.org/x/exp v0.0.0-20230307190834-24139beb5833 h1:SChBja7BCQewoTAU7IgvucQKMIXrEpFxNMs0spT3/5s=
 | 
			
		||||
golang.org/x/exp v0.0.0-20230307190834-24139beb5833/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
 | 
			
		||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
 | 
			
		||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 | 
			
		||||
 
 | 
			
		||||
@@ -34,6 +34,7 @@ func (a *DeleteDNSServer) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// DeleteDNSServerRequest contains the "in" args for the "DeleteDNSServer" action.
 | 
			
		||||
type DeleteDNSServerRequest struct {
 | 
			
		||||
	// NewDNSServers relates to state variable DNSServers.
 | 
			
		||||
	NewDNSServers string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -64,6 +65,7 @@ func (a *DeleteIPRouter) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// DeleteIPRouterRequest contains the "in" args for the "DeleteIPRouter" action.
 | 
			
		||||
type DeleteIPRouterRequest struct {
 | 
			
		||||
	// NewIPRouters relates to state variable IPRouters.
 | 
			
		||||
	NewIPRouters string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -94,6 +96,7 @@ func (a *DeleteReservedAddress) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// DeleteReservedAddressRequest contains the "in" args for the "DeleteReservedAddress" action.
 | 
			
		||||
type DeleteReservedAddressRequest struct {
 | 
			
		||||
	// NewReservedAddresses relates to state variable ReservedAddresses.
 | 
			
		||||
	NewReservedAddresses string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -127,7 +130,9 @@ type GetAddressRangeRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetAddressRangeResponse contains the "out" args for the "GetAddressRange" action.
 | 
			
		||||
type GetAddressRangeResponse struct {
 | 
			
		||||
	// NewMinAddress relates to state variable MinAddress.
 | 
			
		||||
	NewMinAddress string
 | 
			
		||||
	// NewMaxAddress relates to state variable MaxAddress.
 | 
			
		||||
	NewMaxAddress string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -158,6 +163,7 @@ type GetDHCPRelayRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetDHCPRelayResponse contains the "out" args for the "GetDHCPRelay" action.
 | 
			
		||||
type GetDHCPRelayResponse struct {
 | 
			
		||||
	// NewDHCPRelay relates to state variable DHCPRelay.
 | 
			
		||||
	NewDHCPRelay pkg2.Boolean
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -188,6 +194,7 @@ type GetDHCPServerConfigurableRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetDHCPServerConfigurableResponse contains the "out" args for the "GetDHCPServerConfigurable" action.
 | 
			
		||||
type GetDHCPServerConfigurableResponse struct {
 | 
			
		||||
	// NewDHCPServerConfigurable relates to state variable DHCPServerConfigurable.
 | 
			
		||||
	NewDHCPServerConfigurable pkg2.Boolean
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -218,6 +225,7 @@ type GetDNSServersRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetDNSServersResponse contains the "out" args for the "GetDNSServers" action.
 | 
			
		||||
type GetDNSServersResponse struct {
 | 
			
		||||
	// NewDNSServers relates to state variable DNSServers.
 | 
			
		||||
	NewDNSServers string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -248,6 +256,7 @@ type GetDomainNameRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetDomainNameResponse contains the "out" args for the "GetDomainName" action.
 | 
			
		||||
type GetDomainNameResponse struct {
 | 
			
		||||
	// NewDomainName relates to state variable DomainName.
 | 
			
		||||
	NewDomainName string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -278,6 +287,7 @@ type GetIPRoutersListRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetIPRoutersListResponse contains the "out" args for the "GetIPRoutersList" action.
 | 
			
		||||
type GetIPRoutersListResponse struct {
 | 
			
		||||
	// NewIPRouters relates to state variable IPRouters.
 | 
			
		||||
	NewIPRouters string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -308,6 +318,7 @@ type GetReservedAddressesRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetReservedAddressesResponse contains the "out" args for the "GetReservedAddresses" action.
 | 
			
		||||
type GetReservedAddressesResponse struct {
 | 
			
		||||
	// NewReservedAddresses relates to state variable ReservedAddresses.
 | 
			
		||||
	NewReservedAddresses string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -338,6 +349,7 @@ type GetSubnetMaskRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetSubnetMaskResponse contains the "out" args for the "GetSubnetMask" action.
 | 
			
		||||
type GetSubnetMaskResponse struct {
 | 
			
		||||
	// NewSubnetMask relates to state variable SubnetMask.
 | 
			
		||||
	NewSubnetMask string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -365,7 +377,9 @@ func (a *SetAddressRange) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// SetAddressRangeRequest contains the "in" args for the "SetAddressRange" action.
 | 
			
		||||
type SetAddressRangeRequest struct {
 | 
			
		||||
	// NewMinAddress relates to state variable MinAddress.
 | 
			
		||||
	NewMinAddress string
 | 
			
		||||
	// NewMaxAddress relates to state variable MaxAddress.
 | 
			
		||||
	NewMaxAddress string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -396,6 +410,7 @@ func (a *SetDHCPRelay) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// SetDHCPRelayRequest contains the "in" args for the "SetDHCPRelay" action.
 | 
			
		||||
type SetDHCPRelayRequest struct {
 | 
			
		||||
	// NewDHCPRelay relates to state variable DHCPRelay.
 | 
			
		||||
	NewDHCPRelay pkg2.Boolean
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -426,6 +441,7 @@ func (a *SetDHCPServerConfigurable) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// SetDHCPServerConfigurableRequest contains the "in" args for the "SetDHCPServerConfigurable" action.
 | 
			
		||||
type SetDHCPServerConfigurableRequest struct {
 | 
			
		||||
	// NewDHCPServerConfigurable relates to state variable DHCPServerConfigurable.
 | 
			
		||||
	NewDHCPServerConfigurable pkg2.Boolean
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -456,6 +472,7 @@ func (a *SetDNSServer) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// SetDNSServerRequest contains the "in" args for the "SetDNSServer" action.
 | 
			
		||||
type SetDNSServerRequest struct {
 | 
			
		||||
	// NewDNSServers relates to state variable DNSServers.
 | 
			
		||||
	NewDNSServers string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -486,6 +503,7 @@ func (a *SetDomainName) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// SetDomainNameRequest contains the "in" args for the "SetDomainName" action.
 | 
			
		||||
type SetDomainNameRequest struct {
 | 
			
		||||
	// NewDomainName relates to state variable DomainName.
 | 
			
		||||
	NewDomainName string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -516,6 +534,7 @@ func (a *SetIPRouter) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// SetIPRouterRequest contains the "in" args for the "SetIPRouter" action.
 | 
			
		||||
type SetIPRouterRequest struct {
 | 
			
		||||
	// NewIPRouters relates to state variable IPRouters.
 | 
			
		||||
	NewIPRouters string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -546,6 +565,7 @@ func (a *SetReservedAddress) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// SetReservedAddressRequest contains the "in" args for the "SetReservedAddress" action.
 | 
			
		||||
type SetReservedAddressRequest struct {
 | 
			
		||||
	// NewReservedAddresses relates to state variable ReservedAddresses.
 | 
			
		||||
	NewReservedAddresses string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -576,6 +596,7 @@ func (a *SetSubnetMask) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// SetSubnetMaskRequest contains the "in" args for the "SetSubnetMask" action.
 | 
			
		||||
type SetSubnetMaskRequest struct {
 | 
			
		||||
	// NewSubnetMask relates to state variable SubnetMask.
 | 
			
		||||
	NewSubnetMask string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,35 @@ import (
 | 
			
		||||
	pkg2 "github.com/huin/goupnp/v2alpha/soap/types"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Allowed values for state variable ConnectionStatus.
 | 
			
		||||
const (
 | 
			
		||||
	ConnectionStatus_Unconfigured = "Unconfigured"
 | 
			
		||||
	ConnectionStatus_Connected    = "Connected"
 | 
			
		||||
	ConnectionStatus_Disconnected = "Disconnected"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Allowed values for state variable LastConnectionError.
 | 
			
		||||
const (
 | 
			
		||||
	LastConnectionError_ERROR_NONE = "ERROR_NONE"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Allowed values for state variable PortMappingProtocol.
 | 
			
		||||
const (
 | 
			
		||||
	PortMappingProtocol_TCP = "TCP"
 | 
			
		||||
	PortMappingProtocol_UDP = "UDP"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Allowed values for state variable PossibleConnectionTypes.
 | 
			
		||||
const (
 | 
			
		||||
	PossibleConnectionTypes_Unconfigured  = "Unconfigured"
 | 
			
		||||
	PossibleConnectionTypes_IP_Routed     = "IP_Routed"
 | 
			
		||||
	PossibleConnectionTypes_DHCP_Spoofed  = "DHCP_Spoofed"
 | 
			
		||||
	PossibleConnectionTypes_PPPoE_Bridged = "PPPoE_Bridged"
 | 
			
		||||
	PossibleConnectionTypes_PPTP_Relay    = "PPTP_Relay"
 | 
			
		||||
	PossibleConnectionTypes_L2TP_Relay    = "L2TP_Relay"
 | 
			
		||||
	PossibleConnectionTypes_PPPoE_Relay   = "PPPoE_Relay"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const ServiceType = "urn:schemas-upnp-org:service:WANPPPConnection:1"
 | 
			
		||||
 | 
			
		||||
// AddPortMapping provides request and response for the action.
 | 
			
		||||
@@ -34,14 +63,22 @@ func (a *AddPortMapping) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// AddPortMappingRequest contains the "in" args for the "AddPortMapping" action.
 | 
			
		||||
type AddPortMappingRequest struct {
 | 
			
		||||
	NewRemoteHost             string
 | 
			
		||||
	NewExternalPort           pkg2.UI2
 | 
			
		||||
	NewProtocol               string
 | 
			
		||||
	NewInternalPort           pkg2.UI2
 | 
			
		||||
	NewInternalClient         string
 | 
			
		||||
	NewEnabled                pkg2.Boolean
 | 
			
		||||
	// NewRemoteHost relates to state variable RemoteHost.
 | 
			
		||||
	NewRemoteHost string
 | 
			
		||||
	// NewExternalPort relates to state variable ExternalPort.
 | 
			
		||||
	NewExternalPort pkg2.UI2
 | 
			
		||||
	// NewProtocol relates to state variable PortMappingProtocol (2 standard allowed values).
 | 
			
		||||
	NewProtocol string
 | 
			
		||||
	// NewInternalPort relates to state variable InternalPort.
 | 
			
		||||
	NewInternalPort pkg2.UI2
 | 
			
		||||
	// NewInternalClient relates to state variable InternalClient.
 | 
			
		||||
	NewInternalClient string
 | 
			
		||||
	// NewEnabled relates to state variable PortMappingEnabled.
 | 
			
		||||
	NewEnabled pkg2.Boolean
 | 
			
		||||
	// NewPortMappingDescription relates to state variable PortMappingDescription.
 | 
			
		||||
	NewPortMappingDescription string
 | 
			
		||||
	NewLeaseDuration          pkg2.UI4
 | 
			
		||||
	// NewLeaseDuration relates to state variable PortMappingLeaseDuration.
 | 
			
		||||
	NewLeaseDuration pkg2.UI4
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AddPortMappingResponse contains the "out" args for the "AddPortMapping" action.
 | 
			
		||||
@@ -71,7 +108,9 @@ func (a *ConfigureConnection) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// ConfigureConnectionRequest contains the "in" args for the "ConfigureConnection" action.
 | 
			
		||||
type ConfigureConnectionRequest struct {
 | 
			
		||||
	// NewUserName relates to state variable UserName.
 | 
			
		||||
	NewUserName string
 | 
			
		||||
	// NewPassword relates to state variable Password.
 | 
			
		||||
	NewPassword string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -102,9 +141,12 @@ func (a *DeletePortMapping) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// DeletePortMappingRequest contains the "in" args for the "DeletePortMapping" action.
 | 
			
		||||
type DeletePortMappingRequest struct {
 | 
			
		||||
	NewRemoteHost   string
 | 
			
		||||
	// NewRemoteHost relates to state variable RemoteHost.
 | 
			
		||||
	NewRemoteHost string
 | 
			
		||||
	// NewExternalPort relates to state variable ExternalPort.
 | 
			
		||||
	NewExternalPort pkg2.UI2
 | 
			
		||||
	NewProtocol     string
 | 
			
		||||
	// NewProtocol relates to state variable PortMappingProtocol (2 standard allowed values).
 | 
			
		||||
	NewProtocol string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeletePortMappingResponse contains the "out" args for the "DeletePortMapping" action.
 | 
			
		||||
@@ -165,6 +207,7 @@ type GetAutoDisconnectTimeRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetAutoDisconnectTimeResponse contains the "out" args for the "GetAutoDisconnectTime" action.
 | 
			
		||||
type GetAutoDisconnectTimeResponse struct {
 | 
			
		||||
	// NewAutoDisconnectTime relates to state variable AutoDisconnectTime.
 | 
			
		||||
	NewAutoDisconnectTime pkg2.UI4
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -195,7 +238,9 @@ type GetConnectionTypeInfoRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetConnectionTypeInfoResponse contains the "out" args for the "GetConnectionTypeInfo" action.
 | 
			
		||||
type GetConnectionTypeInfoResponse struct {
 | 
			
		||||
	NewConnectionType          string
 | 
			
		||||
	// NewConnectionType relates to state variable ConnectionType.
 | 
			
		||||
	NewConnectionType string
 | 
			
		||||
	// NewPossibleConnectionTypes relates to state variable PossibleConnectionTypes (7 standard allowed values).
 | 
			
		||||
	NewPossibleConnectionTypes string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -226,6 +271,7 @@ type GetExternalIPAddressRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetExternalIPAddressResponse contains the "out" args for the "GetExternalIPAddress" action.
 | 
			
		||||
type GetExternalIPAddressResponse struct {
 | 
			
		||||
	// NewExternalIPAddress relates to state variable ExternalIPAddress.
 | 
			
		||||
	NewExternalIPAddress string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -253,19 +299,28 @@ func (a *GetGenericPortMappingEntry) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// GetGenericPortMappingEntryRequest contains the "in" args for the "GetGenericPortMappingEntry" action.
 | 
			
		||||
type GetGenericPortMappingEntryRequest struct {
 | 
			
		||||
	// NewPortMappingIndex relates to state variable PortMappingNumberOfEntries.
 | 
			
		||||
	NewPortMappingIndex pkg2.UI2
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetGenericPortMappingEntryResponse contains the "out" args for the "GetGenericPortMappingEntry" action.
 | 
			
		||||
type GetGenericPortMappingEntryResponse struct {
 | 
			
		||||
	NewRemoteHost             string
 | 
			
		||||
	NewExternalPort           pkg2.UI2
 | 
			
		||||
	NewProtocol               string
 | 
			
		||||
	NewInternalPort           pkg2.UI2
 | 
			
		||||
	NewInternalClient         string
 | 
			
		||||
	NewEnabled                pkg2.Boolean
 | 
			
		||||
	// NewRemoteHost relates to state variable RemoteHost.
 | 
			
		||||
	NewRemoteHost string
 | 
			
		||||
	// NewExternalPort relates to state variable ExternalPort.
 | 
			
		||||
	NewExternalPort pkg2.UI2
 | 
			
		||||
	// NewProtocol relates to state variable PortMappingProtocol (2 standard allowed values).
 | 
			
		||||
	NewProtocol string
 | 
			
		||||
	// NewInternalPort relates to state variable InternalPort.
 | 
			
		||||
	NewInternalPort pkg2.UI2
 | 
			
		||||
	// NewInternalClient relates to state variable InternalClient.
 | 
			
		||||
	NewInternalClient string
 | 
			
		||||
	// NewEnabled relates to state variable PortMappingEnabled.
 | 
			
		||||
	NewEnabled pkg2.Boolean
 | 
			
		||||
	// NewPortMappingDescription relates to state variable PortMappingDescription.
 | 
			
		||||
	NewPortMappingDescription string
 | 
			
		||||
	NewLeaseDuration          pkg2.UI4
 | 
			
		||||
	// NewLeaseDuration relates to state variable PortMappingLeaseDuration.
 | 
			
		||||
	NewLeaseDuration pkg2.UI4
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetIdleDisconnectTime provides request and response for the action.
 | 
			
		||||
@@ -295,6 +350,7 @@ type GetIdleDisconnectTimeRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetIdleDisconnectTimeResponse contains the "out" args for the "GetIdleDisconnectTime" action.
 | 
			
		||||
type GetIdleDisconnectTimeResponse struct {
 | 
			
		||||
	// NewIdleDisconnectTime relates to state variable IdleDisconnectTime.
 | 
			
		||||
	NewIdleDisconnectTime pkg2.UI4
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -325,7 +381,9 @@ type GetLinkLayerMaxBitRatesRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetLinkLayerMaxBitRatesResponse contains the "out" args for the "GetLinkLayerMaxBitRates" action.
 | 
			
		||||
type GetLinkLayerMaxBitRatesResponse struct {
 | 
			
		||||
	NewUpstreamMaxBitRate   pkg2.UI4
 | 
			
		||||
	// NewUpstreamMaxBitRate relates to state variable UpstreamMaxBitRate.
 | 
			
		||||
	NewUpstreamMaxBitRate pkg2.UI4
 | 
			
		||||
	// NewDownstreamMaxBitRate relates to state variable DownstreamMaxBitRate.
 | 
			
		||||
	NewDownstreamMaxBitRate pkg2.UI4
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -356,8 +414,10 @@ type GetNATRSIPStatusRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetNATRSIPStatusResponse contains the "out" args for the "GetNATRSIPStatus" action.
 | 
			
		||||
type GetNATRSIPStatusResponse struct {
 | 
			
		||||
	// NewRSIPAvailable relates to state variable RSIPAvailable.
 | 
			
		||||
	NewRSIPAvailable pkg2.Boolean
 | 
			
		||||
	NewNATEnabled    pkg2.Boolean
 | 
			
		||||
	// NewNATEnabled relates to state variable NATEnabled.
 | 
			
		||||
	NewNATEnabled pkg2.Boolean
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetPPPAuthenticationProtocol provides request and response for the action.
 | 
			
		||||
@@ -387,6 +447,7 @@ type GetPPPAuthenticationProtocolRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetPPPAuthenticationProtocolResponse contains the "out" args for the "GetPPPAuthenticationProtocol" action.
 | 
			
		||||
type GetPPPAuthenticationProtocolResponse struct {
 | 
			
		||||
	// NewPPPAuthenticationProtocol relates to state variable PPPAuthenticationProtocol.
 | 
			
		||||
	NewPPPAuthenticationProtocol string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -417,6 +478,7 @@ type GetPPPCompressionProtocolRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetPPPCompressionProtocolResponse contains the "out" args for the "GetPPPCompressionProtocol" action.
 | 
			
		||||
type GetPPPCompressionProtocolResponse struct {
 | 
			
		||||
	// NewPPPCompressionProtocol relates to state variable PPPCompressionProtocol.
 | 
			
		||||
	NewPPPCompressionProtocol string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -447,6 +509,7 @@ type GetPPPEncryptionProtocolRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetPPPEncryptionProtocolResponse contains the "out" args for the "GetPPPEncryptionProtocol" action.
 | 
			
		||||
type GetPPPEncryptionProtocolResponse struct {
 | 
			
		||||
	// NewPPPEncryptionProtocol relates to state variable PPPEncryptionProtocol.
 | 
			
		||||
	NewPPPEncryptionProtocol string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -477,6 +540,7 @@ type GetPasswordRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetPasswordResponse contains the "out" args for the "GetPassword" action.
 | 
			
		||||
type GetPasswordResponse struct {
 | 
			
		||||
	// NewPassword relates to state variable Password.
 | 
			
		||||
	NewPassword string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -504,18 +568,26 @@ func (a *GetSpecificPortMappingEntry) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// GetSpecificPortMappingEntryRequest contains the "in" args for the "GetSpecificPortMappingEntry" action.
 | 
			
		||||
type GetSpecificPortMappingEntryRequest struct {
 | 
			
		||||
	NewRemoteHost   string
 | 
			
		||||
	// NewRemoteHost relates to state variable RemoteHost.
 | 
			
		||||
	NewRemoteHost string
 | 
			
		||||
	// NewExternalPort relates to state variable ExternalPort.
 | 
			
		||||
	NewExternalPort pkg2.UI2
 | 
			
		||||
	NewProtocol     string
 | 
			
		||||
	// NewProtocol relates to state variable PortMappingProtocol (2 standard allowed values).
 | 
			
		||||
	NewProtocol string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetSpecificPortMappingEntryResponse contains the "out" args for the "GetSpecificPortMappingEntry" action.
 | 
			
		||||
type GetSpecificPortMappingEntryResponse struct {
 | 
			
		||||
	NewInternalPort           pkg2.UI2
 | 
			
		||||
	NewInternalClient         string
 | 
			
		||||
	NewEnabled                pkg2.Boolean
 | 
			
		||||
	// NewInternalPort relates to state variable InternalPort.
 | 
			
		||||
	NewInternalPort pkg2.UI2
 | 
			
		||||
	// NewInternalClient relates to state variable InternalClient.
 | 
			
		||||
	NewInternalClient string
 | 
			
		||||
	// NewEnabled relates to state variable PortMappingEnabled.
 | 
			
		||||
	NewEnabled pkg2.Boolean
 | 
			
		||||
	// NewPortMappingDescription relates to state variable PortMappingDescription.
 | 
			
		||||
	NewPortMappingDescription string
 | 
			
		||||
	NewLeaseDuration          pkg2.UI4
 | 
			
		||||
	// NewLeaseDuration relates to state variable PortMappingLeaseDuration.
 | 
			
		||||
	NewLeaseDuration pkg2.UI4
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetStatusInfo provides request and response for the action.
 | 
			
		||||
@@ -545,9 +617,12 @@ type GetStatusInfoRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetStatusInfoResponse contains the "out" args for the "GetStatusInfo" action.
 | 
			
		||||
type GetStatusInfoResponse struct {
 | 
			
		||||
	NewConnectionStatus    string
 | 
			
		||||
	// NewConnectionStatus relates to state variable ConnectionStatus (3 standard allowed values).
 | 
			
		||||
	NewConnectionStatus string
 | 
			
		||||
	// NewLastConnectionError relates to state variable LastConnectionError (1 standard allowed values).
 | 
			
		||||
	NewLastConnectionError string
 | 
			
		||||
	NewUptime              pkg2.UI4
 | 
			
		||||
	// NewUptime relates to state variable Uptime.
 | 
			
		||||
	NewUptime pkg2.UI4
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetUserName provides request and response for the action.
 | 
			
		||||
@@ -577,6 +652,7 @@ type GetUserNameRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetUserNameResponse contains the "out" args for the "GetUserName" action.
 | 
			
		||||
type GetUserNameResponse struct {
 | 
			
		||||
	// NewUserName relates to state variable UserName.
 | 
			
		||||
	NewUserName string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -607,6 +683,7 @@ type GetWarnDisconnectDelayRequest struct{}
 | 
			
		||||
 | 
			
		||||
// GetWarnDisconnectDelayResponse contains the "out" args for the "GetWarnDisconnectDelay" action.
 | 
			
		||||
type GetWarnDisconnectDelayResponse struct {
 | 
			
		||||
	// NewWarnDisconnectDelay relates to state variable WarnDisconnectDelay.
 | 
			
		||||
	NewWarnDisconnectDelay pkg2.UI4
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -690,6 +767,7 @@ func (a *SetAutoDisconnectTime) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// SetAutoDisconnectTimeRequest contains the "in" args for the "SetAutoDisconnectTime" action.
 | 
			
		||||
type SetAutoDisconnectTimeRequest struct {
 | 
			
		||||
	// NewAutoDisconnectTime relates to state variable AutoDisconnectTime.
 | 
			
		||||
	NewAutoDisconnectTime pkg2.UI4
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -720,6 +798,7 @@ func (a *SetConnectionType) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// SetConnectionTypeRequest contains the "in" args for the "SetConnectionType" action.
 | 
			
		||||
type SetConnectionTypeRequest struct {
 | 
			
		||||
	// NewConnectionType relates to state variable ConnectionType.
 | 
			
		||||
	NewConnectionType string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -750,6 +829,7 @@ func (a *SetIdleDisconnectTime) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// SetIdleDisconnectTimeRequest contains the "in" args for the "SetIdleDisconnectTime" action.
 | 
			
		||||
type SetIdleDisconnectTimeRequest struct {
 | 
			
		||||
	// NewIdleDisconnectTime relates to state variable IdleDisconnectTime.
 | 
			
		||||
	NewIdleDisconnectTime pkg2.UI4
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -780,6 +860,7 @@ func (a *SetWarnDisconnectDelay) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// SetWarnDisconnectDelayRequest contains the "in" args for the "SetWarnDisconnectDelay" action.
 | 
			
		||||
type SetWarnDisconnectDelayRequest struct {
 | 
			
		||||
	// NewWarnDisconnectDelay relates to state variable WarnDisconnectDelay.
 | 
			
		||||
	NewWarnDisconnectDelay pkg2.UI4
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
{{define "service"}}
 | 
			
		||||
{{- $Imps := .Imps -}}
 | 
			
		||||
{{- $Types := .Types -}}
 | 
			
		||||
// Package {{.Manifest.Package}} provides types for the {{quote .Manifest.ServiceType}} service.
 | 
			
		||||
{{- with .Manifest.DocumentURL}}
 | 
			
		||||
//
 | 
			
		||||
@@ -13,15 +14,28 @@ import (
 | 
			
		||||
{{- end}}
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
{{range .Types.StringVarDefs}}
 | 
			
		||||
{{- $Name := .Name}}
 | 
			
		||||
{{- with .AllowedValues}}
 | 
			
		||||
// Allowed values for state variable {{$Name}}.
 | 
			
		||||
const (
 | 
			
		||||
{{- range .}}
 | 
			
		||||
  {{$Name}}_{{.}} = "{{.}}"
 | 
			
		||||
{{- end}}
 | 
			
		||||
)
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{- end}}
 | 
			
		||||
 | 
			
		||||
const ServiceType = {{quote .Manifest.ServiceType}}
 | 
			
		||||
{{range .SCPD.SortedActions}}
 | 
			
		||||
{{- template "action" args "Action" . "Imps" $Imps}}
 | 
			
		||||
{{- template "action" args "Action" . "Imps" $Imps "Types" $Types}}
 | 
			
		||||
{{end}}
 | 
			
		||||
{{- end}}
 | 
			
		||||
 | 
			
		||||
{{define "action"}}
 | 
			
		||||
{{- $Imps := .Imps}}
 | 
			
		||||
{{- $soapActionType := index $Imps.TypeByName "SOAPActionInterface"}}
 | 
			
		||||
{{- $Types := .Types}}
 | 
			
		||||
{{- $soapActionType := index $Types.TypeByName "SOAPActionInterface"}}
 | 
			
		||||
// {{.Action.Name}} provides request and response for the action.
 | 
			
		||||
//
 | 
			
		||||
// ServiceType implements {{$soapActionType.AbsRef}}, self-describing the SOAP action.
 | 
			
		||||
@@ -43,18 +57,23 @@ func (a *{{.Action.Name}}) RefResponse() any { return &a.Response }
 | 
			
		||||
 | 
			
		||||
// {{.Action.Name}}Request contains the "in" args for the {{quote .Action.Name}} action.
 | 
			
		||||
type {{.Action.Name}}Request struct
 | 
			
		||||
{{- template "args" args "Args" .Action.InArgs "Imps" $Imps}}
 | 
			
		||||
{{- template "args" args "Args" .Action.InArgs "Imps" $Imps "Types" $Types}}
 | 
			
		||||
 | 
			
		||||
// {{.Action.Name}}Response contains the "out" args for the {{quote .Action.Name}} action.
 | 
			
		||||
type {{.Action.Name}}Response struct
 | 
			
		||||
{{- template "args" args "Args" .Action.OutArgs "Imps" $Imps}}
 | 
			
		||||
{{- template "args" args "Args" .Action.OutArgs "Imps" $Imps "Types" $Types}}
 | 
			
		||||
{{- end}}
 | 
			
		||||
 | 
			
		||||
{{define "args"}}
 | 
			
		||||
{{- $Imps := .Imps -}}
 | 
			
		||||
{{- $Types := .Types -}}
 | 
			
		||||
{ {{- with .Args}}
 | 
			
		||||
{{- range .}}
 | 
			
		||||
{{- $fieldType := index $Imps.TypeByName .RelatedStateVariable.DataType}}
 | 
			
		||||
{{- $fieldType := index $Types.TypeByName .RelatedStateVariable.DataType}}
 | 
			
		||||
  // {{.Name}} relates to state variable {{.RelatedStateVariable.Name}}
 | 
			
		||||
{{- with .RelatedStateVariable.AllowedValues}}
 | 
			
		||||
{{- ""}} ({{len .}} standard allowed values)
 | 
			
		||||
{{- end }}.
 | 
			
		||||
  {{.Name}} {{$fieldType.Ref}}
 | 
			
		||||
{{- end}}
 | 
			
		||||
{{end -}} }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user