Commit 36e5bafb authored by Mikio Hara's avatar Mikio Hara

go.net/ipv4: simplify protocol constants generator

Also updates IANA protocol constants.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/14588043
parent c2e426e4
......@@ -100,17 +100,13 @@ type icmpv4Parameters struct {
XMLName xml.Name `xml:"registry"`
Title string `xml:"title"`
Updated string `xml:"updated"`
Registries []icmpv4ParamRegistry `xml:"registry"`
}
type icmpv4ParamRegistry struct {
Registries []struct {
Title string `xml:"title"`
Records []icmpv4ParamRecord `xml:"record"`
}
type icmpv4ParamRecord struct {
Records []struct {
Value string `xml:"value"`
Descr string `xml:"description"`
} `xml:"record"`
} `xml:"registry"`
}
type canonICMPv4ParamRecord struct {
......@@ -198,13 +194,11 @@ type protocolNumbers struct {
Updated string `xml:"updated"`
RegTitle string `xml:"registry>title"`
Note string `xml:"registry>note"`
Records []protocolRecord `xml:"registry>record"`
}
type protocolRecord struct {
Records []struct {
Value string `xml:"value"`
Name string `xml:"name"`
Descr string `xml:"description"`
} `xml:"registry>record"`
}
type canonProtocolRecord struct {
......
......@@ -39,7 +39,7 @@ var registries = []struct {
func main() {
var bb bytes.Buffer
fmt.Fprintf(&bb, "// go run gentv.go\n")
fmt.Fprintf(&bb, "// go run gentest.go\n")
fmt.Fprintf(&bb, "// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT\n\n")
fmt.Fprintf(&bb, "package ipv4_test\n\n")
for _, r := range registries {
......@@ -90,13 +90,14 @@ type dscpRegistry struct {
Updated string `xml:"updated"`
Note string `xml:"note"`
RegTitle string `xml:"registry>title"`
PoolRecords []dscpRecord `xml:"registry>record"`
Records []dscpRecord `xml:"registry>registry>record"`
}
type dscpRecord struct {
PoolRecords []struct {
Name string `xml:"name"`
Space string `xml:"space"`
} `xml:"registry>record"`
Records []struct {
Name string `xml:"name"`
Space string `xml:"space"`
} `xml:"registry>registry>record"`
}
type canonDSCPRecord struct {
......@@ -150,12 +151,10 @@ type tosTCByte struct {
Updated string `xml:"updated"`
Note string `xml:"note"`
RegTitle string `xml:"registry>title"`
Records []tosTCByteRecord `xml:"registry>record"`
}
type tosTCByteRecord struct {
Records []struct {
Binary string `xml:"binary"`
Keyword string `xml:"keyword"`
} `xml:"registry>record"`
}
type canonTOSTCByteRecord struct {
......
// go run gentv.go
// go run gentest.go
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
package ipv4_test
// Differentiated Services Field Codepoints, Updated: 2010-05-11
// Differentiated Services Field Codepoints (DSCP), Updated: 2013-06-25
const (
DiffServCS0 = 0x0 // CS0
DiffServCS1 = 0x20 // CS1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment