Hack back in a URN missing from the internetgateway2 spec.
This commit is contained in:
parent
3232a79f99
commit
790e151b1e
@ -38,6 +38,7 @@ const (
|
|||||||
URN_WANEthernetLinkConfig_1 = "urn:schemas-upnp-org:service:WANEthernetLinkConfig:1"
|
URN_WANEthernetLinkConfig_1 = "urn:schemas-upnp-org:service:WANEthernetLinkConfig:1"
|
||||||
URN_WANIPConnection_1 = "urn:schemas-upnp-org:service:WANIPConnection:1"
|
URN_WANIPConnection_1 = "urn:schemas-upnp-org:service:WANIPConnection:1"
|
||||||
URN_WANIPConnection_2 = "urn:schemas-upnp-org:service:WANIPConnection:2"
|
URN_WANIPConnection_2 = "urn:schemas-upnp-org:service:WANIPConnection:2"
|
||||||
|
URN_WANIPv6FirewallControl_1 = "urn:schemas-upnp-org:service:WANIPv6FirewallControl:1"
|
||||||
URN_WANPOTSLinkConfig_1 = "urn:schemas-upnp-org:service:WANPOTSLinkConfig:1"
|
URN_WANPOTSLinkConfig_1 = "urn:schemas-upnp-org:service:WANPOTSLinkConfig:1"
|
||||||
URN_WANPPPConnection_1 = "urn:schemas-upnp-org:service:WANPPPConnection:1"
|
URN_WANPPPConnection_1 = "urn:schemas-upnp-org:service:WANPPPConnection:1"
|
||||||
)
|
)
|
||||||
|
@ -33,6 +33,8 @@ type DCPMetadata struct {
|
|||||||
OfficialName string // Official name for the DCP.
|
OfficialName string // Official name for the DCP.
|
||||||
DocURL string // Optional - URL for futher documentation about the DCP.
|
DocURL string // Optional - URL for futher documentation about the DCP.
|
||||||
XMLSpecURL string // Where to download the XML spec from.
|
XMLSpecURL string // Where to download the XML spec from.
|
||||||
|
// Any special-case functions to run against the DCP before writing it out.
|
||||||
|
Hacks []DCPHackFn
|
||||||
}
|
}
|
||||||
|
|
||||||
var dcpMetadata = []DCPMetadata{
|
var dcpMetadata = []DCPMetadata{
|
||||||
@ -47,6 +49,20 @@ var dcpMetadata = []DCPMetadata{
|
|||||||
OfficialName: "Internet Gateway Device v2",
|
OfficialName: "Internet Gateway Device v2",
|
||||||
DocURL: "http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v2-Device.pdf",
|
DocURL: "http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v2-Device.pdf",
|
||||||
XMLSpecURL: "http://upnp.org/specs/gw/UPnP-gw-IGD-Testfiles-20110224.zip",
|
XMLSpecURL: "http://upnp.org/specs/gw/UPnP-gw-IGD-Testfiles-20110224.zip",
|
||||||
|
Hacks: []DCPHackFn{
|
||||||
|
func(dcp *DCP) error {
|
||||||
|
missingURN := "urn:schemas-upnp-org:service:WANIPv6FirewallControl:1"
|
||||||
|
if _, ok := dcp.ServiceTypes[missingURN]; ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
urnParts, err := extractURNParts(missingURN, serviceURNPrefix)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
dcp.ServiceTypes[missingURN] = urnParts
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "av1",
|
Name: "av1",
|
||||||
@ -56,6 +72,8 @@ var dcpMetadata = []DCPMetadata{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DCPHackFn func(*DCP) error
|
||||||
|
|
||||||
// NAME
|
// NAME
|
||||||
// specgen - generates Go code from the UPnP specification files.
|
// specgen - generates Go code from the UPnP specification files.
|
||||||
//
|
//
|
||||||
@ -77,19 +95,29 @@ func TaskSpecgen(t *tasking.T) {
|
|||||||
outDir := fallbackStrValue("../dcps", t.Flags.String("out_dir"), t.Flags.String("o"))
|
outDir := fallbackStrValue("../dcps", t.Flags.String("out_dir"), t.Flags.String("o"))
|
||||||
useGofmt := !t.Flags.Bool("nogofmt")
|
useGofmt := !t.Flags.Bool("nogofmt")
|
||||||
|
|
||||||
|
NEXT_DCP:
|
||||||
for _, d := range dcpMetadata {
|
for _, d := range dcpMetadata {
|
||||||
specFilename := filepath.Join(specsDir, d.Name+".zip")
|
specFilename := filepath.Join(specsDir, d.Name+".zip")
|
||||||
err := acquireFile(specFilename, d.XMLSpecURL)
|
err := acquireFile(specFilename, d.XMLSpecURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Logf("Could not acquire spec for %s, skipping: %v\n", d.Name, err)
|
t.Logf("Could not acquire spec for %s, skipping: %v\n", d.Name, err)
|
||||||
|
continue NEXT_DCP
|
||||||
}
|
}
|
||||||
dcp := newDCP(d)
|
dcp := newDCP(d)
|
||||||
if err := dcp.processZipFile(specFilename); err != nil {
|
if err := dcp.processZipFile(specFilename); err != nil {
|
||||||
log.Printf("Error processing spec for %s in file %q: %v", d.Name, specFilename, err)
|
log.Printf("Error processing spec for %s in file %q: %v", d.Name, specFilename, err)
|
||||||
|
continue NEXT_DCP
|
||||||
|
}
|
||||||
|
for i, hack := range d.Hacks {
|
||||||
|
if err := hack(dcp); err != nil {
|
||||||
|
log.Printf("Error with Hack[%d] for %s: %v", i, d.Name, err)
|
||||||
|
continue NEXT_DCP
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dcp.writePackage(outDir, useGofmt)
|
dcp.writePackage(outDir, useGofmt)
|
||||||
if err := dcp.writePackage(outDir, useGofmt); err != nil {
|
if err := dcp.writePackage(outDir, useGofmt); err != nil {
|
||||||
log.Printf("Error writing package %q: %v", dcp.Metadata.Name, err)
|
log.Printf("Error writing package %q: %v", dcp.Metadata.Name, err)
|
||||||
|
continue NEXT_DCP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user