diff --git a/v2alpha/cmd/goupnp2dcpgen/main.go b/v2alpha/cmd/goupnp2dcpgen/main.go index b33d335..eefbf9d 100644 --- a/v2alpha/cmd/goupnp2dcpgen/main.go +++ b/v2alpha/cmd/goupnp2dcpgen/main.go @@ -9,8 +9,8 @@ import ( "strings" "github.com/huin/goupnp/v2alpha/cmd/goupnp2dcpgen/zipread" - "github.com/huin/goupnp/v2alpha/description/scpd" - "github.com/huin/goupnp/v2alpha/description/xmlscpd" + "github.com/huin/goupnp/v2alpha/description/srvdesc" + "github.com/huin/goupnp/v2alpha/description/xmlsrvdesc" ) var ( @@ -89,7 +89,7 @@ func processService( d := xml.NewDecoder(f) - xmlSCPD := &xmlscpd.SCPD{} + xmlSCPD := &xmlsrvdesc.SCPD{} if err := d.Decode(xmlSCPD); err != nil { return err } @@ -108,7 +108,7 @@ func processService( } } - _, err = scpd.FromXML(xmlSCPD) + _, err = srvdesc.FromXML(xmlSCPD) if err != nil { return err } diff --git a/v2alpha/description/scpd/scpd.go b/v2alpha/description/srvdesc/srvdesc.go similarity index 90% rename from v2alpha/description/scpd/scpd.go rename to v2alpha/description/srvdesc/srvdesc.go index 64f90af..fd57bd1 100644 --- a/v2alpha/description/scpd/scpd.go +++ b/v2alpha/description/srvdesc/srvdesc.go @@ -1,12 +1,12 @@ -// Package scpd contains data structures that represent an SCPD at a higher level than XML. -package scpd +// Package srvdesc contains data structures that represent an SCPD at a higher level than XML. +package srvdesc import ( "errors" "fmt" "sort" - "github.com/huin/goupnp/v2alpha/description/xmlscpd" + "github.com/huin/goupnp/v2alpha/description/xmlsrvdesc" ) var ( @@ -23,7 +23,7 @@ type SCPD struct { // FromXML creates an SCPD from XML data. // // It assumes that xmlDesc.Clean() has been called. -func FromXML(xmlDesc *xmlscpd.SCPD) (*SCPD, error) { +func FromXML(xmlDesc *xmlsrvdesc.SCPD) (*SCPD, error) { stateVariables := make(map[string]*StateVariable, len(xmlDesc.StateVariables)) for _, xmlSV := range xmlDesc.StateVariables { sv, err := stateVariableFromXML(xmlSV) @@ -82,7 +82,7 @@ type Action struct { } // actionFromXML creates an Action from the given XML description. -func actionFromXML(xmlAction *xmlscpd.Action) (*Action, error) { +func actionFromXML(xmlAction *xmlsrvdesc.Action) (*Action, error) { if xmlAction.Name == "" { return nil, fmt.Errorf("%w: empty action name", BadDescriptionError) } @@ -117,7 +117,7 @@ type Argument struct { } // argumentFromXML creates an Argument from the XML description. -func argumentFromXML(xmlArg *xmlscpd.Argument) (*Argument, error) { +func argumentFromXML(xmlArg *xmlsrvdesc.Argument) (*Argument, error) { if xmlArg.Name == "" { return nil, fmt.Errorf("%w: empty argument name", BadDescriptionError) } @@ -144,7 +144,7 @@ type StateVariable struct { dataType string } -func stateVariableFromXML(xmlSV *xmlscpd.StateVariable) (*StateVariable, error) { +func stateVariableFromXML(xmlSV *xmlsrvdesc.StateVariable) (*StateVariable, error) { if xmlSV.Name == "" { return nil, fmt.Errorf("%w: empty state variable name", BadDescriptionError) } diff --git a/v2alpha/description/xmlscpd/xmlscpd.go b/v2alpha/description/xmlsrvdesc/xmlsrvdesc.go similarity index 97% rename from v2alpha/description/xmlscpd/xmlscpd.go rename to v2alpha/description/xmlsrvdesc/xmlsrvdesc.go index de8db7e..bce4bd3 100644 --- a/v2alpha/description/xmlscpd/xmlscpd.go +++ b/v2alpha/description/xmlsrvdesc/xmlsrvdesc.go @@ -1,8 +1,9 @@ -// Package xmlscpd contains the XML data structures used in SCPD (Service Control Protocol Description). +// Package xmlsrvdesc contains the XML data structures used in SCPD (Service Control Protocol +// Description). // // Described in section 2.5 of // https://openconnectivity.org/upnp-specs/UPnP-arch-DeviceArchitecture-v2.0-20200417.pdf. -package xmlscpd +package xmlsrvdesc import ( "bytes"