From a08bbabd4d4af78915afe628b3d01ba2f5fd6de3 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Tue, 2 Feb 2016 12:43:33 +0100 Subject: [PATCH] Use v2 of XDR package (deps) --- Godeps/Godeps.json | 5 +- .../src/github.com/calmh/xdr/README.md | 6 +- .../github.com/calmh/xdr/cmd/genxdr/main.go | 382 ++++++++++-------- .../src/github.com/calmh/xdr/common.go | 59 +++ .../src/github.com/calmh/xdr/debug.go | 16 - .../src/github.com/calmh/xdr/doc.go | 2 +- .../src/github.com/calmh/xdr/marshaller.go | 123 ++++++ .../src/github.com/calmh/xdr/pad_ipdr.go | 10 - .../src/github.com/calmh/xdr/pad_xdr.go | 14 - .../src/github.com/calmh/xdr/reader.go | 171 -------- .../src/github.com/calmh/xdr/reader_ipdr.go | 49 --- .../src/github.com/calmh/xdr/reader_xdr.go | 15 - .../src/github.com/calmh/xdr/unmarshal.go | 147 +++++++ .../src/github.com/calmh/xdr/writer.go | 146 ------- .../src/github.com/calmh/xdr/writer_ipdr.go | 41 -- .../src/github.com/calmh/xdr/writer_xdr.go | 14 - .../src/github.com/syndtr/goleveldb/LICENSE | 24 ++ .../src/github.com/vitrun/qart/LICENSE | 201 +++++++++ .../src/golang.org/x/crypto/LICENSE | 27 ++ .../src/golang.org/x/crypto/PATENTS | 22 + .../_workspace/src/golang.org/x/net/LICENSE | 27 ++ .../_workspace/src/golang.org/x/net/PATENTS | 22 + .../x/net/ipv6/zsys_linux_mips64.go | 156 +++++++ .../x/net/ipv6/zsys_linux_mips64le.go | 156 +++++++ .../_workspace/src/golang.org/x/text/LICENSE | 27 ++ .../_workspace/src/golang.org/x/text/PATENTS | 22 + 26 files changed, 1239 insertions(+), 645 deletions(-) create mode 100644 Godeps/_workspace/src/github.com/calmh/xdr/common.go delete mode 100644 Godeps/_workspace/src/github.com/calmh/xdr/debug.go create mode 100644 Godeps/_workspace/src/github.com/calmh/xdr/marshaller.go delete mode 100644 Godeps/_workspace/src/github.com/calmh/xdr/pad_ipdr.go delete mode 100644 Godeps/_workspace/src/github.com/calmh/xdr/pad_xdr.go delete mode 100644 Godeps/_workspace/src/github.com/calmh/xdr/reader.go delete mode 100644 Godeps/_workspace/src/github.com/calmh/xdr/reader_ipdr.go delete mode 100644 Godeps/_workspace/src/github.com/calmh/xdr/reader_xdr.go create mode 100644 Godeps/_workspace/src/github.com/calmh/xdr/unmarshal.go delete mode 100644 Godeps/_workspace/src/github.com/calmh/xdr/writer.go delete mode 100644 Godeps/_workspace/src/github.com/calmh/xdr/writer_ipdr.go delete mode 100644 Godeps/_workspace/src/github.com/calmh/xdr/writer_xdr.go create mode 100644 Godeps/_workspace/src/github.com/syndtr/goleveldb/LICENSE create mode 100644 Godeps/_workspace/src/github.com/vitrun/qart/LICENSE create mode 100644 Godeps/_workspace/src/golang.org/x/crypto/LICENSE create mode 100644 Godeps/_workspace/src/golang.org/x/crypto/PATENTS create mode 100644 Godeps/_workspace/src/golang.org/x/net/LICENSE create mode 100644 Godeps/_workspace/src/golang.org/x/net/PATENTS create mode 100644 Godeps/_workspace/src/golang.org/x/net/ipv6/zsys_linux_mips64.go create mode 100644 Godeps/_workspace/src/golang.org/x/net/ipv6/zsys_linux_mips64le.go create mode 100644 Godeps/_workspace/src/golang.org/x/text/LICENSE create mode 100644 Godeps/_workspace/src/golang.org/x/text/PATENTS diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 5909ea93..325b3759 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -11,15 +11,18 @@ }, { "ImportPath": "github.com/calmh/du", + "Comment": "v1.0.0", "Rev": "3c0690cca16228b97741327b1b6781397afbdb24" }, { "ImportPath": "github.com/calmh/luhn", + "Comment": "v1.0.0", "Rev": "0c8388ff95fa92d4094011e5a04fc99dea3d1632" }, { "ImportPath": "github.com/calmh/xdr", - "Rev": "9eb3e1a622d9364deb39c831f7e5f164393d7e37" + "Comment": "v2.0.0", + "Rev": "b6e0c321c9b5b28ba5ee21e828323e4b982c6976" }, { "ImportPath": "github.com/golang/snappy", diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/README.md b/Godeps/_workspace/src/github.com/calmh/xdr/README.md index f4ebae78..ae9cd316 100644 --- a/Godeps/_workspace/src/github.com/calmh/xdr/README.md +++ b/Godeps/_workspace/src/github.com/calmh/xdr/README.md @@ -6,7 +6,5 @@ xdr [![API Documentation](http://img.shields.io/badge/api-Godoc-blue.svg?style=flat)](http://godoc.org/github.com/calmh/xdr) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://opensource.org/licenses/MIT) -This is an XDR encoding/decoding library. It uses code generation and -not reflection. It supports the IPDR bastardized XDR format when built -with `-tags ipdr`. - +This is an XDR marshalling/unmarshalling library. It uses code generation and +not reflection. diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/cmd/genxdr/main.go b/Godeps/_workspace/src/github.com/calmh/xdr/cmd/genxdr/main.go index dbca9b7e..feebbfdf 100644 --- a/Godeps/_workspace/src/github.com/calmh/xdr/cmd/genxdr/main.go +++ b/Godeps/_workspace/src/github.com/calmh/xdr/cmd/genxdr/main.go @@ -36,31 +36,73 @@ type structInfo struct { Fields []fieldInfo } -var headerTpl = template.Must(template.New("header").Parse(`// ************************************************************ +func (i structInfo) SizeExpr() string { + var xdrSizes = map[string]int{ + "int8": 4, + "uint8": 4, + "int16": 4, + "uint16": 4, + "int32": 4, + "uint32": 4, + "int64": 8, + "uint64": 8, + "int": 8, + "bool": 4, + } + + var terms []string + nl := "" + for _, f := range i.Fields { + if size := xdrSizes[f.FieldType]; size > 0 { + if f.IsSlice { + terms = append(terms, nl+"4+len(o."+f.Name+")*"+strconv.Itoa(size)) + } else { + terms = append(terms, strconv.Itoa(size)) + } + } else { + switch f.FieldType { + case "string", "[]byte": + if f.IsSlice { + terms = append(terms, nl+"4+xdr.SizeOfSlice(o."+f.Name+")") + } else { + terms = append(terms, nl+"4+len(o."+f.Name+")+xdr.Padding(len(o."+f.Name+"))") + } + default: + if f.IsSlice { + terms = append(terms, nl+"4+xdr.SizeOfSlice(o."+f.Name+")") + } else { + terms = append(terms, nl+"o."+f.Name+".XDRSize()") + } + } + } + nl = "\n" + } + return strings.Join(terms, "+") +} + +var headerData = `// ************************************************************ // This file is automatically generated by genxdr. Do not edit. // ************************************************************ package {{.Package}} import ( - "bytes" - "io" - "github.com/calmh/xdr" ) -`)) +` -var encodeTpl = template.Must(template.New("encoder").Parse(` -func (o {{.TypeName}}) EncodeXDR(w io.Writer) (int, error) { - var xw = xdr.NewWriter(w) - return o.EncodeXDRInto(xw) +var encoderData = ` +func (o {{.Name}}) XDRSize() int { + return {{.SizeExpr}} }//+n -func (o {{.TypeName}}) MarshalXDR() ([]byte, error) { - return o.AppendXDR(make([]byte, 0, 128)) +func (o {{.Name}}) MarshalXDR() ([]byte, error) { + buf:= make([]byte, o.XDRSize()) + m := &xdr.Marshaller{Data: buf} + return buf, o.MarshalXDRInto(m) }//+n -func (o {{.TypeName}}) MustMarshalXDR() []byte { +func (o {{.Name}}) MustMarshalXDR() []byte { bs, err := o.MarshalXDR() if err != nil { panic(err) @@ -68,141 +110,155 @@ func (o {{.TypeName}}) MustMarshalXDR() []byte { return bs }//+n -func (o {{.TypeName}}) AppendXDR(bs []byte) ([]byte, error) { - var aw = xdr.AppendWriter(bs) - var xw = xdr.NewWriter(&aw) - _, err := o.EncodeXDRInto(xw) - return []byte(aw), err -}//+n - -func (o {{.TypeName}}) EncodeXDRInto(xw *xdr.Writer) (int, error) { - {{range $fieldInfo := .Fields}} - {{if not $fieldInfo.IsSlice}} - {{if ne $fieldInfo.Convert ""}} - xw.Write{{$fieldInfo.Encoder}}({{$fieldInfo.Convert}}(o.{{$fieldInfo.Name}})) - {{else if $fieldInfo.IsBasic}} - {{if ge $fieldInfo.Max 1}} - if l := len(o.{{$fieldInfo.Name}}); l > {{$fieldInfo.Max}} { - return xw.Tot(), xdr.ElementSizeExceeded("{{$fieldInfo.Name}}", l, {{$fieldInfo.Max}}) - } - {{end}} - xw.Write{{$fieldInfo.Encoder}}(o.{{$fieldInfo.Name}}) - {{else}} - _, err := o.{{$fieldInfo.Name}}.EncodeXDRInto(xw) - if err != nil { - return xw.Tot(), err - } - {{end}} +func (o {{.Name}}) MarshalXDRInto(m *xdr.Marshaller) error { + {{range $fi := .Fields}} + {{if $fi.IsSlice}} + {{template "marshalSlice" $fi}} {{else}} - {{if ge $fieldInfo.Max 1}} - if l := len(o.{{$fieldInfo.Name}}); l > {{$fieldInfo.Max}} { - return xw.Tot(), xdr.ElementSizeExceeded("{{$fieldInfo.Name}}", l, {{$fieldInfo.Max}}) - } - {{end}} - xw.WriteUint32(uint32(len(o.{{$fieldInfo.Name}}))) - for i := range o.{{$fieldInfo.Name}} { - {{if ne $fieldInfo.Convert ""}} - xw.Write{{$fieldInfo.Encoder}}({{$fieldInfo.Convert}}(o.{{$fieldInfo.Name}}[i])) - {{else if $fieldInfo.IsBasic}} - xw.Write{{$fieldInfo.Encoder}}(o.{{$fieldInfo.Name}}[i]) - {{else}} - _, err := o.{{$fieldInfo.Name}}[i].EncodeXDRInto(xw) - if err != nil { - return xw.Tot(), err - } - {{end}} - } + {{template "marshalValue" $fi}} {{end}} {{end}} - return xw.Tot(), xw.Error() + return m.Error }//+n -func (o *{{.TypeName}}) DecodeXDR(r io.Reader) error { - xr := xdr.NewReader(r) - return o.DecodeXDRFrom(xr) -}//+n - -func (o *{{.TypeName}}) UnmarshalXDR(bs []byte) error { - var br = bytes.NewReader(bs) - var xr = xdr.NewReader(br) - return o.DecodeXDRFrom(xr) -}//+n - -func (o *{{.TypeName}}) DecodeXDRFrom(xr *xdr.Reader) error { - {{range $fieldInfo := .Fields}} - {{if not $fieldInfo.IsSlice}} - {{if ne $fieldInfo.Convert ""}} - o.{{$fieldInfo.Name}} = {{$fieldInfo.FieldType}}(xr.Read{{$fieldInfo.Encoder}}()) - {{else if $fieldInfo.IsBasic}} - {{if ge $fieldInfo.Max 1}} - o.{{$fieldInfo.Name}} = xr.Read{{$fieldInfo.Encoder}}Max({{$fieldInfo.Max}}) - {{else}} - o.{{$fieldInfo.Name}} = xr.Read{{$fieldInfo.Encoder}}() - {{end}} - {{else}} - (&o.{{$fieldInfo.Name}}).DecodeXDRFrom(xr) - {{end}} - {{else}} - _{{$fieldInfo.Name}}Size := int(xr.ReadUint32()) - if _{{$fieldInfo.Name}}Size < 0 { - return xdr.ElementSizeExceeded("{{$fieldInfo.Name}}", _{{$fieldInfo.Name}}Size, {{$fieldInfo.Max}}) - } - {{if ge $fieldInfo.Max 1}} - if _{{$fieldInfo.Name}}Size > {{$fieldInfo.Max}} { - return xdr.ElementSizeExceeded("{{$fieldInfo.Name}}", _{{$fieldInfo.Name}}Size, {{$fieldInfo.Max}}) - } - {{end}} - o.{{$fieldInfo.Name}} = make([]{{$fieldInfo.FieldType}}, _{{$fieldInfo.Name}}Size) - for i := range o.{{$fieldInfo.Name}} { - {{if ne $fieldInfo.Convert ""}} - o.{{$fieldInfo.Name}}[i] = {{$fieldInfo.FieldType}}(xr.Read{{$fieldInfo.Encoder}}()) - {{else if $fieldInfo.IsBasic}} - {{if ge $fieldInfo.Submax 1}} - o.{{$fieldInfo.Name}}[i] = xr.Read{{$fieldInfo.Encoder}}Max({{$fieldInfo.Submax}}) - {{else}} - o.{{$fieldInfo.Name}}[i] = xr.Read{{$fieldInfo.Encoder}}() - {{end}} - {{else}} - (&o.{{$fieldInfo.Name}}[i]).DecodeXDRFrom(xr) - {{end}} +{{define "marshalValue"}} + {{if ne .Convert ""}} + m.Marshal{{.Encoder}}({{.Convert}}(o.{{.Name}})) + {{else if .IsBasic}} + {{if ge .Max 1}} + if l := len(o.{{.Name}}); l > {{.Max}} { + return xdr.ElementSizeExceeded("{{.Name}}", l, {{.Max}}) } {{end}} + m.Marshal{{.Encoder}}(o.{{.Name}}) + {{else}} + if err := o.{{.Name}}.MarshalXDRInto(m); err != nil { + return err + } {{end}} - return xr.Error() -}`)) +{{end}} + +{{define "marshalSlice"}} + {{if ge .Max 1}} + if l := len(o.{{.Name}}); l > {{.Max}} { + return xdr.ElementSizeExceeded("{{.Name}}", l, {{.Max}}) + } + {{end}} + + m.MarshalUint32(uint32(len(o.{{.Name}}))) + for i := range o.{{.Name}} { + {{if ne .Convert ""}} + m.Marshal{{.Encoder}}({{.Convert}}(o.{{.Name}}[i])) + {{else if .IsBasic}} + m.Marshal{{.Encoder}}(o.{{.Name}}[i]) + {{else}} + if err := o.{{.Name}}[i].MarshalXDRInto(m); err != nil { + return err + } + {{end}} + } +{{end}} + +func (o *{{.Name}}) UnmarshalXDR(bs []byte) error { + u := &xdr.Unmarshaller{Data: bs} + return o.UnmarshalXDRFrom(u) +} + +func (o *{{.Name}}) UnmarshalXDRFrom(u *xdr.Unmarshaller) error { + {{range $fi := .Fields}} + {{if $fi.IsSlice}} + {{template "unmarshalSlice" $fi}} + {{else}} + {{template "unmarshalValue" $fi}} + {{end}} + {{end}} + return u.Error +}//+n + +{{define "unmarshalValue"}} + {{if ne .Convert ""}} + o.{{.Name}} = {{.FieldType}}(u.Unmarshal{{.Encoder}}()) + {{else if .IsBasic}} + {{if ge .Max 1}} + o.{{.Name}} = u.Unmarshal{{.Encoder}}Max({{.Max}}) + {{else}} + o.{{.Name}} = u.Unmarshal{{.Encoder}}() + {{end}} + {{else}} + (&o.{{.Name}}).UnmarshalXDRFrom(u) + {{end}} +{{end}} + +{{define "unmarshalSlice"}} + _{{.Name}}Size := int(u.UnmarshalUint32()) + if _{{.Name}}Size < 0 { + return xdr.ElementSizeExceeded("{{.Name}}", _{{.Name}}Size, {{.Max}}) + } else if _{{.Name}}Size == 0 { + o.{{.Name}} = nil + } else { + {{if ge .Max 1}} + if _{{.Name}}Size > {{.Max}} { + return xdr.ElementSizeExceeded("{{.Name}}", _{{.Name}}Size, {{.Max}}) + } + {{end}} + if _{{.Name}}Size <= len(o.{{.Name}}) { + {{if eq .FieldType "string"}} + for i := _{{.Name}}Size; i < len(o.{{.Name}}); i++ { o.{{.Name}}[i] = "" } + {{end}} + {{if eq .FieldType "[]byte"}} + for i := _{{.Name}}Size; i < len(o.{{.Name}}); i++ { o.{{.Name}}[i] = nil } + {{end}} + o.{{.Name}} = o.{{.Name}}[:_{{.Name}}Size] + } else { + o.{{.Name}} = make([]{{.FieldType}}, _{{.Name}}Size) + } + for i := range o.{{.Name}} { + {{if ne .Convert ""}} + o.{{.Name}}[i] = {{.FieldType}}(u.Unmarshal{{.Encoder}}()) + {{else if .IsBasic}} + {{if ge .Submax 1}} + o.{{.Name}}[i] = u.Unmarshal{{.Encoder}}Max({{.Submax}}) + {{else}} + o.{{.Name}}[i] = u.Unmarshal{{.Encoder}}() + {{end}} + {{else}} + (&o.{{.Name}}[i]).UnmarshalXDRFrom(u) + {{end}} + } + } +{{end}} +` + +var ( + encodeTpl = template.Must(template.New("encoder").Parse(encoderData)) + headerTpl = template.Must(template.New("header").Parse(headerData)) +) var emptyTypeTpl = template.Must(template.New("encoder").Parse(` -func (o {{.TypeName}}) EncodeXDR(w io.Writer) (int, error) { - return 0, nil -}//+n +func (o {{.Name}}) XDRSize() int { + return 0 +} -func (o {{.TypeName}}) MarshalXDR() ([]byte, error) { +func (o {{.Name}}) MarshalXDR() ([]byte, error) { return nil, nil }//+n -func (o {{.TypeName}}) MustMarshalXDR() []byte { +func (o {{.Name}}) MustMarshalXDR() []byte { return nil }//+n -func (o {{.TypeName}}) AppendXDR(bs []byte) ([]byte, error) { - return bs, nil -}//+n - -func (o {{.TypeName}}) EncodeXDRInto(xw *xdr.Writer) (int, error) { - return xw.Tot(), xw.Error() -}//+n - -func (o *{{.TypeName}}) DecodeXDR(r io.Reader) error { +func (o {{.Name}}) MarshalXDRInto(m *xdr.Marshaller) error { return nil }//+n -func (o *{{.TypeName}}) UnmarshalXDR(bs []byte) error { +func (o *{{.Name}}) UnmarshalXDR(bs []byte) error { return nil }//+n -func (o *{{.TypeName}}) DecodeXDRFrom(xr *xdr.Reader) error { - return xr.Error() -}`)) +func (o *{{.Name}}) UnmarshalXDRFrom(u *xdr.Unmarshaller) error { + return nil +}//+n +`)) var maxRe = regexp.MustCompile(`(?:\Wmax:)(\d+)(?:\s*,\s*(\d+))?`) @@ -286,7 +342,7 @@ func handleStruct(t *ast.StructType) []fieldInfo { f = fieldInfo{ Name: fn, IsBasic: true, - FieldType: tn, + FieldType: "[]" + tn, Encoder: enc.Encoder, Convert: enc.Type, Max: max1, @@ -329,17 +385,14 @@ func handleStruct(t *ast.StructType) []fieldInfo { } func generateCode(output io.Writer, s structInfo) { - name := s.Name - fs := s.Fields - var buf bytes.Buffer var err error - if len(fs) == 0 { + if len(s.Fields) == 0 { // This is an empty type. We can create a quite simple codec for it. - err = emptyTypeTpl.Execute(&buf, map[string]interface{}{"TypeName": name}) + err = emptyTypeTpl.Execute(&buf, s) } else { // Generate with the default template. - err = encodeTpl.Execute(&buf, map[string]interface{}{"TypeName": name, "Fields": fs}) + err = encodeTpl.Execute(&buf, s) } if err != nil { panic(err) @@ -347,12 +400,7 @@ func generateCode(output io.Writer, s structInfo) { bs := regexp.MustCompile(`(\s*\n)+`).ReplaceAll(buf.Bytes(), []byte("\n")) bs = bytes.Replace(bs, []byte("//+n"), []byte("\n"), -1) - - bs, err = format.Source(bs) - if err != nil { - panic(err) - } - fmt.Fprintln(output, string(bs)) + output.Write(bs) } func uncamelize(s string) string { @@ -384,46 +432,46 @@ func generateDiagram(output io.Writer, s structInfo) { tn := f.FieldType name := uncamelize(f.Name) + suffix := "" if f.IsSlice { fmt.Fprintf(output, "| %s |\n", center("Number of "+name, 61)) fmt.Fprintln(output, line) + suffix = " (n items)" + fmt.Fprintf(output, "/ %s /\n", center("", 61)) } switch tn { case "bool": fmt.Fprintf(output, "| %s |V|\n", center(name+" (V=0 or 1)", 59)) - fmt.Fprintln(output, line) case "int16", "uint16": - fmt.Fprintf(output, "| %s | %s |\n", center("0x0000", 29), center(name, 29)) - fmt.Fprintln(output, line) + fmt.Fprintf(output, "| %s | %s |\n", center("16 zero bits", 29), center(name, 29)) + case "int8", "uint8": + fmt.Fprintf(output, "| %s | %s |\n", center("24 zero bits", 45), center(name, 13)) case "int32", "uint32": - fmt.Fprintf(output, "| %s |\n", center(name, 61)) - fmt.Fprintln(output, line) + fmt.Fprintf(output, "| %s |\n", center(name+suffix, 61)) case "int64", "uint64": fmt.Fprintf(output, "| %-61s |\n", "") fmt.Fprintf(output, "+ %s +\n", center(name+" (64 bits)", 61)) fmt.Fprintf(output, "| %-61s |\n", "") - fmt.Fprintln(output, line) - case "string", "byte": // XXX We assume slice of byte! - fmt.Fprintf(output, "| %s |\n", center("Length of "+name, 61)) - fmt.Fprintln(output, line) + case "string", "[]byte": fmt.Fprintf(output, "/ %61s /\n", "") - fmt.Fprintf(output, "\\ %s \\\n", center(name+" (variable length)", 61)) + fmt.Fprintf(output, "\\ %s \\\n", center(name+" (length + padded data)", 61)) fmt.Fprintf(output, "/ %61s /\n", "") - fmt.Fprintln(output, line) default: if f.IsSlice { tn = "Zero or more " + tn + " Structures" - fmt.Fprintf(output, "/ %s /\n", center("", 61)) fmt.Fprintf(output, "\\ %s \\\n", center(tn, 61)) - fmt.Fprintf(output, "/ %s /\n", center("", 61)) } else { tn = tn + " Structure" fmt.Fprintf(output, "/ %s /\n", center("", 61)) fmt.Fprintf(output, "\\ %s \\\n", center(tn, 61)) fmt.Fprintf(output, "/ %s /\n", center("", 61)) } - fmt.Fprintln(output, line) } + + if f.IsSlice { + fmt.Fprintf(output, "/ %s /\n", center("", 61)) + } + fmt.Fprintln(output, line) } fmt.Fprintln(output) fmt.Fprintln(output) @@ -448,9 +496,9 @@ func generateXdr(output io.Writer, s structInfo) { } switch tn { - case "int16", "int32": + case "int8", "int16", "int32": fmt.Fprintf(output, "\tint %s%s;\n", fn, suf) - case "uint16", "uint32": + case "uint8", "uint16", "uint32": fmt.Fprintf(output, "\tunsigned int %s%s;\n", fn, suf) case "int64": fmt.Fprintf(output, "\thyper %s%s;\n", fn, suf) @@ -458,7 +506,7 @@ func generateXdr(output io.Writer, s structInfo) { fmt.Fprintf(output, "\tunsigned hyper %s%s;\n", fn, suf) case "string": fmt.Fprintf(output, "\tstring %s<%s>;\n", fn, l) - case "byte": + case "[]byte": fmt.Fprintf(output, "\topaque %s<%s>;\n", fn, l) default: fmt.Fprintf(output, "\t%s %s%s;\n", tn, fn, suf) @@ -510,6 +558,22 @@ func main() { i := inspector(&structs) ast.Inspect(f, i) + buf := new(bytes.Buffer) + headerTpl.Execute(buf, map[string]string{"Package": f.Name.Name}) + for _, s := range structs { + fmt.Fprintf(buf, "\n/*\n\n") + generateDiagram(buf, s) + generateXdr(buf, s) + fmt.Fprintf(buf, "*/\n") + generateCode(buf, s) + } + + bs, err := format.Source(buf.Bytes()) + if err != nil { + log.Print(buf.String()) + log.Fatal(err) + } + var output io.Writer = os.Stdout if *outputFile != "" { fd, err := os.Create(*outputFile) @@ -518,13 +582,5 @@ func main() { } output = fd } - - headerTpl.Execute(output, map[string]string{"Package": f.Name.Name}) - for _, s := range structs { - fmt.Fprintf(output, "\n/*\n\n") - generateDiagram(output, s) - generateXdr(output, s) - fmt.Fprintf(output, "*/\n") - generateCode(output, s) - } + output.Write(bs) } diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/common.go b/Godeps/_workspace/src/github.com/calmh/xdr/common.go new file mode 100644 index 00000000..1100a61f --- /dev/null +++ b/Godeps/_workspace/src/github.com/calmh/xdr/common.go @@ -0,0 +1,59 @@ +// Copyright (C) 2014 Jakob Borg. All rights reserved. Use of this source code +// is governed by an MIT-style license that can be found in the LICENSE file. + +package xdr + +import ( + "fmt" + "reflect" +) + +var padBytes = []byte{0, 0, 0} + +// Pad returns the number of bytes that should be added to an item of length l +// bytes to conform to the XDR padding standard. This function is used by the +// generated marshalling code. +func Padding(l int) int { + d := l % 4 + if d == 0 { + return 0 + } + return 4 - d +} + +// ElementSizeExceeded returns an error describing the violated size +// constraint. This function is used by the generated marshalling code. +func ElementSizeExceeded(field string, size, limit int) error { + return fmt.Errorf("%s exceeds size limit; %d > %d", field, size, limit) +} + +type XDRSizer interface { + XDRSize() int +} + +// SizeOfSlice returns the XDR encoded size of the given []T. Supported types +// for T are string, []byte and types implementing XDRSizer. SizeOfSlice +// panics if the parameter is not a slice or if T is not one of the supported +// types. This function is used by the generated marshalling code. +func SizeOfSlice(ss interface{}) int { + l := 0 + switch ss := ss.(type) { + case []string: + for _, s := range ss { + l += 4 + len(s) + Padding(len(s)) + } + + case [][]byte: + for _, s := range ss { + l += 4 + len(s) + Padding(len(s)) + } + + default: + v := reflect.ValueOf(ss) + for i := 0; i < v.Len(); i++ { + l += v.Index(i).Interface().(XDRSizer).XDRSize() + } + } + + return l +} diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/debug.go b/Godeps/_workspace/src/github.com/calmh/xdr/debug.go deleted file mode 100644 index be3f092b..00000000 --- a/Godeps/_workspace/src/github.com/calmh/xdr/debug.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2014 Jakob Borg. All rights reserved. Use of this source code -// is governed by an MIT-style license that can be found in the LICENSE file. - -package xdr - -import ( - "log" - "os" -) - -var ( - debug = len(os.Getenv("XDRTRACE")) > 0 - dl = log.New(os.Stdout, "xdr: ", log.Lshortfile|log.Ltime|log.Lmicroseconds) -) - -const maxDebugBytes = 32 diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/doc.go b/Godeps/_workspace/src/github.com/calmh/xdr/doc.go index 41b59bc1..550d1d5f 100644 --- a/Godeps/_workspace/src/github.com/calmh/xdr/doc.go +++ b/Godeps/_workspace/src/github.com/calmh/xdr/doc.go @@ -1,5 +1,5 @@ // Copyright (C) 2014 Jakob Borg. All rights reserved. Use of this source code // is governed by an MIT-style license that can be found in the LICENSE file. -// Package xdr implements an XDR (RFC 4506) encoder/decoder. +// Package xdr implements an XDR (RFC 4506) marshaller/unmarshaller. package xdr diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/marshaller.go b/Godeps/_workspace/src/github.com/calmh/xdr/marshaller.go new file mode 100644 index 00000000..27aff824 --- /dev/null +++ b/Godeps/_workspace/src/github.com/calmh/xdr/marshaller.go @@ -0,0 +1,123 @@ +// Copyright (C) 2014 Jakob Borg. All rights reserved. Use of this source code +// is governed by an MIT-style license that can be found in the LICENSE file. + +package xdr + +import "io" + +// The Marshaller is a thin wrapper around a byte buffer. The buffer must be +// of sufficient size to hold the complete marshalled object, or an +// io.ErrShortBuffer error will result. The Marshal... methods don't +// individually return an error - the intention is that multiple fields are +// marshalled in rapid succession, followed by a check of the Error field on +// the Marshaller. +type Marshaller struct { + Data []byte + Error error + + offset int +} + +// MarshalRaw copies the raw bytes to the buffer, without a size prefix or +// padding. This is suitable for appending data already in XDR format from +// another source. +func (m *Marshaller) MarshalRaw(bs []byte) { + if m.Error != nil { + return + } + if len(m.Data) < m.offset+len(bs) { + m.Error = io.ErrShortBuffer + return + } + + m.offset += copy(m.Data[m.offset:], bs) +} + +// MarshalString appends the string to the buffer, with a size prefix and +// correct padding. +func (m *Marshaller) MarshalString(s string) { + if m.Error != nil { + return + } + if len(m.Data) < m.offset+4+len(s)+Padding(len(s)) { + m.Error = io.ErrShortBuffer + return + } + + m.MarshalUint32(uint32(len(s))) + m.offset += copy(m.Data[m.offset:], s) + m.offset += copy(m.Data[m.offset:], padBytes[:Padding(len(s))]) +} + +// MarshalString appends the bytes to the buffer, with a size prefix and +// correct padding. +func (m *Marshaller) MarshalBytes(bs []byte) { + if m.Error != nil { + return + } + if len(m.Data) < m.offset+4+len(bs)+Padding(len(bs)) { + m.Error = io.ErrShortBuffer + return + } + + m.MarshalUint32(uint32(len(bs))) + m.offset += copy(m.Data[m.offset:], bs) + m.offset += copy(m.Data[m.offset:], padBytes[:Padding(len(bs))]) +} + +// MarshalString appends the bool to the buffer, as an uint32. +func (m *Marshaller) MarshalBool(v bool) { + if v { + m.MarshalUint8(1) + } else { + m.MarshalUint8(0) + } +} + +// MarshalString appends the uint8 to the buffer, as an uint32. +func (m *Marshaller) MarshalUint8(v uint8) { + m.MarshalUint32(uint32(v)) +} + +// MarshalString appends the uint16 to the buffer, as an uint32. +func (m *Marshaller) MarshalUint16(v uint16) { + m.MarshalUint32(uint32(v)) +} + +// MarshalString appends the uint32 to the buffer. +func (m *Marshaller) MarshalUint32(v uint32) { + if m.Error != nil { + return + } + if len(m.Data) < m.offset+4 { + m.Error = io.ErrShortBuffer + return + } + + m.Data[m.offset+0] = byte(v >> 24) + m.Data[m.offset+1] = byte(v >> 16) + m.Data[m.offset+2] = byte(v >> 8) + m.Data[m.offset+3] = byte(v) + m.offset += 4 +} + +// MarshalString appends the uint64 to the buffer. +func (m *Marshaller) MarshalUint64(v uint64) { + if m.Error != nil { + return + } + if len(m.Data) < m.offset+8 { + m.Error = io.ErrShortBuffer + return + } + + m.Data[m.offset+0] = byte(v >> 56) + m.Data[m.offset+1] = byte(v >> 48) + m.Data[m.offset+2] = byte(v >> 40) + m.Data[m.offset+3] = byte(v >> 32) + m.Data[m.offset+4] = byte(v >> 24) + m.Data[m.offset+5] = byte(v >> 16) + m.Data[m.offset+6] = byte(v >> 8) + m.Data[m.offset+7] = byte(v) + m.offset += 8 +} diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/pad_ipdr.go b/Godeps/_workspace/src/github.com/calmh/xdr/pad_ipdr.go deleted file mode 100644 index 813a9b61..00000000 --- a/Godeps/_workspace/src/github.com/calmh/xdr/pad_ipdr.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (C) 2014 Jakob Borg. All rights reserved. Use of this source code -// is governed by an MIT-style license that can be found in the LICENSE file. - -// +build ipdr - -package xdr - -func pad(l int) int { - return 0 -} diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/pad_xdr.go b/Godeps/_workspace/src/github.com/calmh/xdr/pad_xdr.go deleted file mode 100644 index b1cac864..00000000 --- a/Godeps/_workspace/src/github.com/calmh/xdr/pad_xdr.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (C) 2014 Jakob Borg. All rights reserved. Use of this source code -// is governed by an MIT-style license that can be found in the LICENSE file. - -// +build !ipdr - -package xdr - -func pad(l int) int { - d := l % 4 - if d == 0 { - return 0 - } - return 4 - d -} diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/reader.go b/Godeps/_workspace/src/github.com/calmh/xdr/reader.go deleted file mode 100644 index feb3cd31..00000000 --- a/Godeps/_workspace/src/github.com/calmh/xdr/reader.go +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file). -// All rights reserved. Use of this source code is governed by an MIT-style -// license that can be found in the LICENSE file. - -package xdr - -import ( - "fmt" - "io" - "reflect" - "unsafe" -) - -type Reader struct { - r io.Reader - err error - b [8]byte -} - -func NewReader(r io.Reader) *Reader { - return &Reader{ - r: r, - } -} - -func (r *Reader) ReadRaw(bs []byte) (int, error) { - if r.err != nil { - return 0, r.err - } - - var n int - n, r.err = io.ReadFull(r.r, bs) - return n, r.err -} - -func (r *Reader) ReadString() string { - return r.ReadStringMax(0) -} - -func (r *Reader) ReadStringMax(max int) string { - buf := r.ReadBytesMaxInto(max, nil) - bh := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) - sh := reflect.StringHeader{ - Data: bh.Data, - Len: bh.Len, - } - return *((*string)(unsafe.Pointer(&sh))) -} - -func (r *Reader) ReadBytes() []byte { - return r.ReadBytesInto(nil) -} - -func (r *Reader) ReadBytesMax(max int) []byte { - return r.ReadBytesMaxInto(max, nil) -} - -func (r *Reader) ReadBytesInto(dst []byte) []byte { - return r.ReadBytesMaxInto(0, dst) -} - -func (r *Reader) ReadBytesMaxInto(max int, dst []byte) []byte { - if r.err != nil { - return nil - } - - l := int(r.ReadUint32()) - if r.err != nil { - return nil - } - if l < 0 || max > 0 && l > max { - // l may be negative on 32 bit builds - r.err = ElementSizeExceeded("bytes field", l, max) - return nil - } - - if fullLen := l + pad(l); fullLen > len(dst) { - dst = make([]byte, fullLen) - } else { - dst = dst[:fullLen] - } - - var n int - n, r.err = io.ReadFull(r.r, dst) - if r.err != nil { - if debug { - dl.Printf("rd bytes (%d): %v", len(dst), r.err) - } - return nil - } - - if debug { - if n > maxDebugBytes { - dl.Printf("rd bytes (%d): %x...", len(dst), dst[:maxDebugBytes]) - } else { - dl.Printf("rd bytes (%d): %x", len(dst), dst) - } - } - return dst[:l] -} - -func (r *Reader) ReadBool() bool { - return r.ReadUint8() != 0 -} - -func (r *Reader) ReadUint32() uint32 { - if r.err != nil { - return 0 - } - - _, r.err = io.ReadFull(r.r, r.b[:4]) - if r.err != nil { - if debug { - dl.Printf("rd uint32: %v", r.err) - } - return 0 - } - - v := uint32(r.b[3]) | uint32(r.b[2])<<8 | uint32(r.b[1])<<16 | uint32(r.b[0])<<24 - - if debug { - dl.Printf("rd uint32=%d (0x%08x)", v, v) - } - return v -} - -func (r *Reader) ReadUint64() uint64 { - if r.err != nil { - return 0 - } - - _, r.err = io.ReadFull(r.r, r.b[:8]) - if r.err != nil { - if debug { - dl.Printf("rd uint64: %v", r.err) - } - return 0 - } - - v := uint64(r.b[7]) | uint64(r.b[6])<<8 | uint64(r.b[5])<<16 | uint64(r.b[4])<<24 | - uint64(r.b[3])<<32 | uint64(r.b[2])<<40 | uint64(r.b[1])<<48 | uint64(r.b[0])<<56 - - if debug { - dl.Printf("rd uint64=%d (0x%016x)", v, v) - } - return v -} - -type XDRError struct { - op string - err error -} - -func (e XDRError) Error() string { - return "xdr " + e.op + ": " + e.err.Error() -} - -func (e XDRError) IsEOF() bool { - return e.err == io.EOF -} - -func (r *Reader) Error() error { - if r.err == nil { - return nil - } - return XDRError{"read", r.err} -} - -func ElementSizeExceeded(field string, size, limit int) error { - return fmt.Errorf("%s exceeds size limit; %d > %d", field, size, limit) -} diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/reader_ipdr.go b/Godeps/_workspace/src/github.com/calmh/xdr/reader_ipdr.go deleted file mode 100644 index 28e0b56a..00000000 --- a/Godeps/_workspace/src/github.com/calmh/xdr/reader_ipdr.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file). -// All rights reserved. Use of this source code is governed by an MIT-style -// license that can be found in the LICENSE file. - -// +build ipdr - -package xdr - -import "io" - -func (r *Reader) ReadUint8() uint8 { - if r.err != nil { - return 0 - } - - _, r.err = io.ReadFull(r.r, r.b[:1]) - if r.err != nil { - if debug { - dl.Printf("rd uint8: %v", r.err) - } - return 0 - } - - if debug { - dl.Printf("rd uint8=%d (0x%02x)", r.b[0], r.b[0]) - } - return r.b[0] -} - -func (r *Reader) ReadUint16() uint16 { - if r.err != nil { - return 0 - } - - _, r.err = io.ReadFull(r.r, r.b[:2]) - if r.err != nil { - if debug { - dl.Printf("rd uint16: %v", r.err) - } - return 0 - } - - v := uint16(r.b[1]) | uint16(r.b[0])<<8 - - if debug { - dl.Printf("rd uint16=%d (0x%04x)", v, v) - } - return v -} diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/reader_xdr.go b/Godeps/_workspace/src/github.com/calmh/xdr/reader_xdr.go deleted file mode 100644 index 4ac629a0..00000000 --- a/Godeps/_workspace/src/github.com/calmh/xdr/reader_xdr.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file). -// All rights reserved. Use of this source code is governed by an MIT-style -// license that can be found in the LICENSE file. - -// +build !ipdr - -package xdr - -func (r *Reader) ReadUint8() uint8 { - return uint8(r.ReadUint32()) -} - -func (r *Reader) ReadUint16() uint16 { - return uint16(r.ReadUint32()) -} diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/unmarshal.go b/Godeps/_workspace/src/github.com/calmh/xdr/unmarshal.go new file mode 100644 index 00000000..3115d555 --- /dev/null +++ b/Godeps/_workspace/src/github.com/calmh/xdr/unmarshal.go @@ -0,0 +1,147 @@ +// Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file). +// All rights reserved. Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file. + +package xdr + +import ( + "io" + "reflect" + "unsafe" +) + +type Unmarshaller struct { + Error error + Data []byte +} + +func (u *Unmarshaller) UnmarshalRaw(l int) []byte { + if u.Error != nil { + return nil + } + if len(u.Data) < l { + u.Error = io.ErrUnexpectedEOF + return nil + } + + v := u.Data[:l] + u.Data = u.Data[l:] + + return v +} + +func (u *Unmarshaller) UnmarshalString() string { + return u.UnmarshalStringMax(0) +} + +func (u *Unmarshaller) UnmarshalStringMax(max int) string { + buf := u.UnmarshalBytesMax(max) + if len(buf) == 0 || u.Error != nil { + return "" + } + + var v string + p := (*reflect.StringHeader)(unsafe.Pointer(&v)) + p.Data = uintptr(unsafe.Pointer(&buf[0])) + p.Len = len(buf) + return v +} + +func (u *Unmarshaller) UnmarshalBytes() []byte { + return u.UnmarshalBytesMax(0) +} + +func (u *Unmarshaller) UnmarshalBytesMax(max int) []byte { + if u.Error != nil { + return nil + } + if len(u.Data) < 4 { + u.Error = io.ErrUnexpectedEOF + return nil + } + + l := int(u.Data[3]) | int(u.Data[2])<<8 | int(u.Data[1])<<16 | int(u.Data[0])<<24 + if l == 0 { + u.Data = u.Data[4:] + return nil + } + if l < 0 || max > 0 && l > max { + // l may be negative on 32 bit builds + u.Error = ElementSizeExceeded("bytes field", l, max) + return nil + } + if len(u.Data) < l+4 { + u.Error = io.ErrUnexpectedEOF + return nil + } + + v := u.Data[4 : 4+l] + u.Data = u.Data[4+l+Padding(l):] + + return v +} + +func (u *Unmarshaller) UnmarshalBool() bool { + return u.UnmarshalUint8() != 0 +} + +func (u *Unmarshaller) UnmarshalUint8() uint8 { + if u.Error != nil { + return 0 + } + if len(u.Data) < 4 { + u.Error = io.ErrUnexpectedEOF + return 0 + } + + v := uint8(u.Data[3]) + u.Data = u.Data[4:] + + return v +} + +func (u *Unmarshaller) UnmarshalUint16() uint16 { + if u.Error != nil { + return 0 + } + if len(u.Data) < 4 { + u.Error = io.ErrUnexpectedEOF + return 0 + } + + v := uint16(u.Data[3]) | uint16(u.Data[2])<<8 + u.Data = u.Data[4:] + + return v +} + +func (u *Unmarshaller) UnmarshalUint32() uint32 { + if u.Error != nil { + return 0 + } + if len(u.Data) < 4 { + u.Error = io.ErrUnexpectedEOF + return 0 + } + + v := uint32(u.Data[3]) | uint32(u.Data[2])<<8 | uint32(u.Data[1])<<16 | uint32(u.Data[0])<<24 + u.Data = u.Data[4:] + + return v +} + +func (u *Unmarshaller) UnmarshalUint64() uint64 { + if u.Error != nil { + return 0 + } + if len(u.Data) < 8 { + u.Error = io.ErrUnexpectedEOF + return 0 + } + + v := uint64(u.Data[7]) | uint64(u.Data[6])<<8 | uint64(u.Data[5])<<16 | uint64(u.Data[4])<<24 | + uint64(u.Data[3])<<32 | uint64(u.Data[2])<<40 | uint64(u.Data[1])<<48 | uint64(u.Data[0])<<56 + u.Data = u.Data[8:] + + return v +} diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/writer.go b/Godeps/_workspace/src/github.com/calmh/xdr/writer.go deleted file mode 100644 index d1ec47bc..00000000 --- a/Godeps/_workspace/src/github.com/calmh/xdr/writer.go +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (C) 2014 Jakob Borg. All rights reserved. Use of this source code -// is governed by an MIT-style license that can be found in the LICENSE file. - -package xdr - -import ( - "io" - "reflect" - "unsafe" -) - -var padBytes = []byte{0, 0, 0} - -type Writer struct { - w io.Writer - tot int - err error - b [8]byte -} - -type AppendWriter []byte - -func (w *AppendWriter) Write(bs []byte) (int, error) { - *w = append(*w, bs...) - return len(bs), nil -} - -func NewWriter(w io.Writer) *Writer { - return &Writer{ - w: w, - } -} - -func (w *Writer) WriteRaw(bs []byte) (int, error) { - if w.err != nil { - return 0, w.err - } - - var n int - n, w.err = w.w.Write(bs) - return n, w.err -} - -func (w *Writer) WriteString(s string) (int, error) { - sh := *((*reflect.StringHeader)(unsafe.Pointer(&s))) - bh := reflect.SliceHeader{ - Data: sh.Data, - Len: sh.Len, - Cap: sh.Len, - } - return w.WriteBytes(*(*[]byte)(unsafe.Pointer(&bh))) -} - -func (w *Writer) WriteBytes(bs []byte) (int, error) { - if w.err != nil { - return 0, w.err - } - - w.WriteUint32(uint32(len(bs))) - if w.err != nil { - return 0, w.err - } - - if debug { - if len(bs) > maxDebugBytes { - dl.Printf("wr bytes (%d): %x...", len(bs), bs[:maxDebugBytes]) - } else { - dl.Printf("wr bytes (%d): %x", len(bs), bs) - } - } - - var l, n int - n, w.err = w.w.Write(bs) - l += n - - if p := pad(len(bs)); w.err == nil && p > 0 { - n, w.err = w.w.Write(padBytes[:p]) - l += n - } - - w.tot += l - return l, w.err -} - -func (w *Writer) WriteBool(v bool) (int, error) { - if v { - return w.WriteUint8(1) - } else { - return w.WriteUint8(0) - } -} - -func (w *Writer) WriteUint32(v uint32) (int, error) { - if w.err != nil { - return 0, w.err - } - - if debug { - dl.Printf("wr uint32=%d", v) - } - - w.b[0] = byte(v >> 24) - w.b[1] = byte(v >> 16) - w.b[2] = byte(v >> 8) - w.b[3] = byte(v) - - var l int - l, w.err = w.w.Write(w.b[:4]) - w.tot += l - return l, w.err -} - -func (w *Writer) WriteUint64(v uint64) (int, error) { - if w.err != nil { - return 0, w.err - } - - if debug { - dl.Printf("wr uint64=%d", v) - } - - w.b[0] = byte(v >> 56) - w.b[1] = byte(v >> 48) - w.b[2] = byte(v >> 40) - w.b[3] = byte(v >> 32) - w.b[4] = byte(v >> 24) - w.b[5] = byte(v >> 16) - w.b[6] = byte(v >> 8) - w.b[7] = byte(v) - - var l int - l, w.err = w.w.Write(w.b[:8]) - w.tot += l - return l, w.err -} - -func (w *Writer) Tot() int { - return w.tot -} - -func (w *Writer) Error() error { - if w.err == nil { - return nil - } - return XDRError{"write", w.err} -} diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/writer_ipdr.go b/Godeps/_workspace/src/github.com/calmh/xdr/writer_ipdr.go deleted file mode 100644 index df803ae3..00000000 --- a/Godeps/_workspace/src/github.com/calmh/xdr/writer_ipdr.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2014 Jakob Borg. All rights reserved. Use of this source code -// is governed by an MIT-style license that can be found in the LICENSE file. - -// +build ipdr - -package xdr - -func (w *Writer) WriteUint8(v uint8) (int, error) { - if w.err != nil { - return 0, w.err - } - - if debug { - dl.Printf("wr uint8=%d", v) - } - - w.b[0] = byte(v) - - var l int - l, w.err = w.w.Write(w.b[:1]) - w.tot += l - return l, w.err -} - -func (w *Writer) WriteUint16(v uint16) (int, error) { - if w.err != nil { - return 0, w.err - } - - if debug { - dl.Printf("wr uint8=%d", v) - } - - w.b[0] = byte(v >> 8) - w.b[1] = byte(v) - - var l int - l, w.err = w.w.Write(w.b[:2]) - w.tot += l - return l, w.err -} diff --git a/Godeps/_workspace/src/github.com/calmh/xdr/writer_xdr.go b/Godeps/_workspace/src/github.com/calmh/xdr/writer_xdr.go deleted file mode 100644 index 190fd549..00000000 --- a/Godeps/_workspace/src/github.com/calmh/xdr/writer_xdr.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (C) 2014 Jakob Borg. All rights reserved. Use of this source code -// is governed by an MIT-style license that can be found in the LICENSE file. - -// +build !ipdr - -package xdr - -func (w *Writer) WriteUint8(v uint8) (int, error) { - return w.WriteUint32(uint32(v)) -} - -func (w *Writer) WriteUint16(v uint16) (int, error) { - return w.WriteUint32(uint32(v)) -} diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/LICENSE b/Godeps/_workspace/src/github.com/syndtr/goleveldb/LICENSE new file mode 100644 index 00000000..4a772d1a --- /dev/null +++ b/Godeps/_workspace/src/github.com/syndtr/goleveldb/LICENSE @@ -0,0 +1,24 @@ +Copyright 2012 Suryandaru Triandana +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Godeps/_workspace/src/github.com/vitrun/qart/LICENSE b/Godeps/_workspace/src/github.com/vitrun/qart/LICENSE new file mode 100644 index 00000000..ad410e11 --- /dev/null +++ b/Godeps/_workspace/src/github.com/vitrun/qart/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/Godeps/_workspace/src/golang.org/x/crypto/LICENSE b/Godeps/_workspace/src/golang.org/x/crypto/LICENSE new file mode 100644 index 00000000..6a66aea5 --- /dev/null +++ b/Godeps/_workspace/src/golang.org/x/crypto/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Godeps/_workspace/src/golang.org/x/crypto/PATENTS b/Godeps/_workspace/src/golang.org/x/crypto/PATENTS new file mode 100644 index 00000000..73309904 --- /dev/null +++ b/Godeps/_workspace/src/golang.org/x/crypto/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/Godeps/_workspace/src/golang.org/x/net/LICENSE b/Godeps/_workspace/src/golang.org/x/net/LICENSE new file mode 100644 index 00000000..6a66aea5 --- /dev/null +++ b/Godeps/_workspace/src/golang.org/x/net/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Godeps/_workspace/src/golang.org/x/net/PATENTS b/Godeps/_workspace/src/golang.org/x/net/PATENTS new file mode 100644 index 00000000..73309904 --- /dev/null +++ b/Godeps/_workspace/src/golang.org/x/net/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/Godeps/_workspace/src/golang.org/x/net/ipv6/zsys_linux_mips64.go b/Godeps/_workspace/src/golang.org/x/net/ipv6/zsys_linux_mips64.go new file mode 100644 index 00000000..ec8ce157 --- /dev/null +++ b/Godeps/_workspace/src/golang.org/x/net/ipv6/zsys_linux_mips64.go @@ -0,0 +1,156 @@ +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs defs_linux.go + +// +build linux,mips64 + +package ipv6 + +const ( + sysIPV6_ADDRFORM = 0x1 + sysIPV6_2292PKTINFO = 0x2 + sysIPV6_2292HOPOPTS = 0x3 + sysIPV6_2292DSTOPTS = 0x4 + sysIPV6_2292RTHDR = 0x5 + sysIPV6_2292PKTOPTIONS = 0x6 + sysIPV6_CHECKSUM = 0x7 + sysIPV6_2292HOPLIMIT = 0x8 + sysIPV6_NEXTHOP = 0x9 + sysIPV6_FLOWINFO = 0xb + + sysIPV6_UNICAST_HOPS = 0x10 + sysIPV6_MULTICAST_IF = 0x11 + sysIPV6_MULTICAST_HOPS = 0x12 + sysIPV6_MULTICAST_LOOP = 0x13 + sysIPV6_ADD_MEMBERSHIP = 0x14 + sysIPV6_DROP_MEMBERSHIP = 0x15 + sysMCAST_JOIN_GROUP = 0x2a + sysMCAST_LEAVE_GROUP = 0x2d + sysMCAST_JOIN_SOURCE_GROUP = 0x2e + sysMCAST_LEAVE_SOURCE_GROUP = 0x2f + sysMCAST_BLOCK_SOURCE = 0x2b + sysMCAST_UNBLOCK_SOURCE = 0x2c + sysMCAST_MSFILTER = 0x30 + sysIPV6_ROUTER_ALERT = 0x16 + sysIPV6_MTU_DISCOVER = 0x17 + sysIPV6_MTU = 0x18 + sysIPV6_RECVERR = 0x19 + sysIPV6_V6ONLY = 0x1a + sysIPV6_JOIN_ANYCAST = 0x1b + sysIPV6_LEAVE_ANYCAST = 0x1c + + sysIPV6_FLOWLABEL_MGR = 0x20 + sysIPV6_FLOWINFO_SEND = 0x21 + + sysIPV6_IPSEC_POLICY = 0x22 + sysIPV6_XFRM_POLICY = 0x23 + + sysIPV6_RECVPKTINFO = 0x31 + sysIPV6_PKTINFO = 0x32 + sysIPV6_RECVHOPLIMIT = 0x33 + sysIPV6_HOPLIMIT = 0x34 + sysIPV6_RECVHOPOPTS = 0x35 + sysIPV6_HOPOPTS = 0x36 + sysIPV6_RTHDRDSTOPTS = 0x37 + sysIPV6_RECVRTHDR = 0x38 + sysIPV6_RTHDR = 0x39 + sysIPV6_RECVDSTOPTS = 0x3a + sysIPV6_DSTOPTS = 0x3b + sysIPV6_RECVPATHMTU = 0x3c + sysIPV6_PATHMTU = 0x3d + sysIPV6_DONTFRAG = 0x3e + + sysIPV6_RECVTCLASS = 0x42 + sysIPV6_TCLASS = 0x43 + + sysIPV6_ADDR_PREFERENCES = 0x48 + + sysIPV6_PREFER_SRC_TMP = 0x1 + sysIPV6_PREFER_SRC_PUBLIC = 0x2 + sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 + sysIPV6_PREFER_SRC_COA = 0x4 + sysIPV6_PREFER_SRC_HOME = 0x400 + sysIPV6_PREFER_SRC_CGA = 0x8 + sysIPV6_PREFER_SRC_NONCGA = 0x800 + + sysIPV6_MINHOPCOUNT = 0x49 + + sysIPV6_ORIGDSTADDR = 0x4a + sysIPV6_RECVORIGDSTADDR = 0x4a + sysIPV6_TRANSPARENT = 0x4b + sysIPV6_UNICAST_IF = 0x4c + + sysICMPV6_FILTER = 0x1 + + sysICMPV6_FILTER_BLOCK = 0x1 + sysICMPV6_FILTER_PASS = 0x2 + sysICMPV6_FILTER_BLOCKOTHERS = 0x3 + sysICMPV6_FILTER_PASSONLY = 0x4 + + sysSizeofKernelSockaddrStorage = 0x80 + sysSizeofSockaddrInet6 = 0x1c + sysSizeofInet6Pktinfo = 0x14 + sysSizeofIPv6Mtuinfo = 0x20 + sysSizeofIPv6FlowlabelReq = 0x20 + + sysSizeofIPv6Mreq = 0x14 + sysSizeofGroupReq = 0x88 + sysSizeofGroupSourceReq = 0x108 + + sysSizeofICMPv6Filter = 0x20 +) + +type sysKernelSockaddrStorage struct { + Family uint16 + X__data [126]int8 +} + +type sysSockaddrInet6 struct { + Family uint16 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 +} + +type sysInet6Pktinfo struct { + Addr [16]byte /* in6_addr */ + Ifindex int32 +} + +type sysIPv6Mtuinfo struct { + Addr sysSockaddrInet6 + Mtu uint32 +} + +type sysIPv6FlowlabelReq struct { + Dst [16]byte /* in6_addr */ + Label uint32 + Action uint8 + Share uint8 + Flags uint16 + Expires uint16 + Linger uint16 + X__flr_pad uint32 +} + +type sysIPv6Mreq struct { + Multiaddr [16]byte /* in6_addr */ + Ifindex int32 +} + +type sysGroupReq struct { + Interface uint32 + Pad_cgo_0 [4]byte + Group sysKernelSockaddrStorage +} + +type sysGroupSourceReq struct { + Interface uint32 + Pad_cgo_0 [4]byte + Group sysKernelSockaddrStorage + Source sysKernelSockaddrStorage +} + +type sysICMPv6Filter struct { + Data [8]uint32 +} diff --git a/Godeps/_workspace/src/golang.org/x/net/ipv6/zsys_linux_mips64le.go b/Godeps/_workspace/src/golang.org/x/net/ipv6/zsys_linux_mips64le.go new file mode 100644 index 00000000..2341ae67 --- /dev/null +++ b/Godeps/_workspace/src/golang.org/x/net/ipv6/zsys_linux_mips64le.go @@ -0,0 +1,156 @@ +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs defs_linux.go + +// +build linux,mips64le + +package ipv6 + +const ( + sysIPV6_ADDRFORM = 0x1 + sysIPV6_2292PKTINFO = 0x2 + sysIPV6_2292HOPOPTS = 0x3 + sysIPV6_2292DSTOPTS = 0x4 + sysIPV6_2292RTHDR = 0x5 + sysIPV6_2292PKTOPTIONS = 0x6 + sysIPV6_CHECKSUM = 0x7 + sysIPV6_2292HOPLIMIT = 0x8 + sysIPV6_NEXTHOP = 0x9 + sysIPV6_FLOWINFO = 0xb + + sysIPV6_UNICAST_HOPS = 0x10 + sysIPV6_MULTICAST_IF = 0x11 + sysIPV6_MULTICAST_HOPS = 0x12 + sysIPV6_MULTICAST_LOOP = 0x13 + sysIPV6_ADD_MEMBERSHIP = 0x14 + sysIPV6_DROP_MEMBERSHIP = 0x15 + sysMCAST_JOIN_GROUP = 0x2a + sysMCAST_LEAVE_GROUP = 0x2d + sysMCAST_JOIN_SOURCE_GROUP = 0x2e + sysMCAST_LEAVE_SOURCE_GROUP = 0x2f + sysMCAST_BLOCK_SOURCE = 0x2b + sysMCAST_UNBLOCK_SOURCE = 0x2c + sysMCAST_MSFILTER = 0x30 + sysIPV6_ROUTER_ALERT = 0x16 + sysIPV6_MTU_DISCOVER = 0x17 + sysIPV6_MTU = 0x18 + sysIPV6_RECVERR = 0x19 + sysIPV6_V6ONLY = 0x1a + sysIPV6_JOIN_ANYCAST = 0x1b + sysIPV6_LEAVE_ANYCAST = 0x1c + + sysIPV6_FLOWLABEL_MGR = 0x20 + sysIPV6_FLOWINFO_SEND = 0x21 + + sysIPV6_IPSEC_POLICY = 0x22 + sysIPV6_XFRM_POLICY = 0x23 + + sysIPV6_RECVPKTINFO = 0x31 + sysIPV6_PKTINFO = 0x32 + sysIPV6_RECVHOPLIMIT = 0x33 + sysIPV6_HOPLIMIT = 0x34 + sysIPV6_RECVHOPOPTS = 0x35 + sysIPV6_HOPOPTS = 0x36 + sysIPV6_RTHDRDSTOPTS = 0x37 + sysIPV6_RECVRTHDR = 0x38 + sysIPV6_RTHDR = 0x39 + sysIPV6_RECVDSTOPTS = 0x3a + sysIPV6_DSTOPTS = 0x3b + sysIPV6_RECVPATHMTU = 0x3c + sysIPV6_PATHMTU = 0x3d + sysIPV6_DONTFRAG = 0x3e + + sysIPV6_RECVTCLASS = 0x42 + sysIPV6_TCLASS = 0x43 + + sysIPV6_ADDR_PREFERENCES = 0x48 + + sysIPV6_PREFER_SRC_TMP = 0x1 + sysIPV6_PREFER_SRC_PUBLIC = 0x2 + sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 + sysIPV6_PREFER_SRC_COA = 0x4 + sysIPV6_PREFER_SRC_HOME = 0x400 + sysIPV6_PREFER_SRC_CGA = 0x8 + sysIPV6_PREFER_SRC_NONCGA = 0x800 + + sysIPV6_MINHOPCOUNT = 0x49 + + sysIPV6_ORIGDSTADDR = 0x4a + sysIPV6_RECVORIGDSTADDR = 0x4a + sysIPV6_TRANSPARENT = 0x4b + sysIPV6_UNICAST_IF = 0x4c + + sysICMPV6_FILTER = 0x1 + + sysICMPV6_FILTER_BLOCK = 0x1 + sysICMPV6_FILTER_PASS = 0x2 + sysICMPV6_FILTER_BLOCKOTHERS = 0x3 + sysICMPV6_FILTER_PASSONLY = 0x4 + + sysSizeofKernelSockaddrStorage = 0x80 + sysSizeofSockaddrInet6 = 0x1c + sysSizeofInet6Pktinfo = 0x14 + sysSizeofIPv6Mtuinfo = 0x20 + sysSizeofIPv6FlowlabelReq = 0x20 + + sysSizeofIPv6Mreq = 0x14 + sysSizeofGroupReq = 0x88 + sysSizeofGroupSourceReq = 0x108 + + sysSizeofICMPv6Filter = 0x20 +) + +type sysKernelSockaddrStorage struct { + Family uint16 + X__data [126]int8 +} + +type sysSockaddrInet6 struct { + Family uint16 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 +} + +type sysInet6Pktinfo struct { + Addr [16]byte /* in6_addr */ + Ifindex int32 +} + +type sysIPv6Mtuinfo struct { + Addr sysSockaddrInet6 + Mtu uint32 +} + +type sysIPv6FlowlabelReq struct { + Dst [16]byte /* in6_addr */ + Label uint32 + Action uint8 + Share uint8 + Flags uint16 + Expires uint16 + Linger uint16 + X__flr_pad uint32 +} + +type sysIPv6Mreq struct { + Multiaddr [16]byte /* in6_addr */ + Ifindex int32 +} + +type sysGroupReq struct { + Interface uint32 + Pad_cgo_0 [4]byte + Group sysKernelSockaddrStorage +} + +type sysGroupSourceReq struct { + Interface uint32 + Pad_cgo_0 [4]byte + Group sysKernelSockaddrStorage + Source sysKernelSockaddrStorage +} + +type sysICMPv6Filter struct { + Data [8]uint32 +} diff --git a/Godeps/_workspace/src/golang.org/x/text/LICENSE b/Godeps/_workspace/src/golang.org/x/text/LICENSE new file mode 100644 index 00000000..6a66aea5 --- /dev/null +++ b/Godeps/_workspace/src/golang.org/x/text/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Godeps/_workspace/src/golang.org/x/text/PATENTS b/Godeps/_workspace/src/golang.org/x/text/PATENTS new file mode 100644 index 00000000..73309904 --- /dev/null +++ b/Godeps/_workspace/src/golang.org/x/text/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed.