From ceed73403bdb61387d04be8b47183e9c4a970749 Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Tue, 23 Jun 2020 14:10:53 +0200 Subject: Fix codec fallback and generate type imports Change-Id: Idd76c7f19d952939caf153928ac60175845078ff Signed-off-by: Ondrej Fabry --- CHANGELOG.md | 14 +- Makefile | 2 +- adapter/socketclient/socketclient.go | 4 +- binapigen/binapigen.go | 9 - binapigen/generate.go | 306 +- binapigen/generate_rpc.go | 49 +- binapigen/generate_test.go | 25 +- binapigen/generator.go | 127 +- binapigen/generator_test.go | 9 + binapigen/run.go | 65 +- binapigen/validate.go | 3 +- binapigen/vppapi/integration_test.go | 2 - cmd/binapi-generator/main.go | 10 +- codec/bench_test.go | 31 +- codec/codec.go | 78 + codec/marshaler.go | 193 +- codec/marshaler_test.go | 139 +- codec/msg_codec.go | 113 +- codec/msg_codec_test.go | 49 +- codec/testdata/binapi2001/acl/acl.ba.go | 2885 ++++++++++ codec/testdata/binapi2001/acl/acl_rpc.ba.go | 302 ++ .../testdata/binapi2001/af_packet/af_packet.ba.go | 725 +++ .../binapi2001/af_packet/af_packet_rpc.ba.go | 84 + .../binapi2001/interfaces/interfaces.ba.go | 3961 ++++++++++++++ .../binapi2001/interfaces/interfaces_rpc.ba.go | 321 ++ codec/testdata/binapi2001/ip/ip.ba.go | 5730 ++++++++++++++++++++ codec/testdata/binapi2001/ip/ip_rpc.ba.go | 497 ++ codec/testdata/binapi2001/memclnt/memclnt.ba.go | 1450 +++++ .../testdata/binapi2001/memclnt/memclnt_rpc.ba.go | 141 + codec/testdata/binapi2001/memif/memif.ba.go | 1052 ++++ codec/testdata/binapi2001/memif/memif_rpc.ba.go | 111 + codec/testdata/binapi2001/sr/sr.ba.go | 1716 ++++++ codec/testdata/binapi2001/sr/sr_rpc.ba.go | 178 + codec/testdata/binapi2001/vpe/vpe.ba.go | 1701 ++++++ codec/testdata/binapi2001/vpe/vpe_rpc.ba.go | 174 + core/connection.go | 2 +- core/connection_test.go | 6 +- examples/binapi/acl/acl.ba.go | 737 +-- examples/binapi/af_packet/af_packet.ba.go | 226 +- examples/binapi/fib_types/fib_types.ba.go | 317 +- examples/binapi/gen.go | 2 +- .../binapi/interface_types/interface_types.ba.go | 266 + examples/binapi/interfaces/interfaces.ba.go | 726 +-- examples/binapi/interfaces/interfaces_rpc.ba.go | 20 + examples/binapi/ip/ip.ba.go | 1320 ++--- examples/binapi/ip/ip_rpc.ba.go | 14 +- examples/binapi/ip_types/ip_types.ba.go | 39 +- examples/binapi/memclnt/memclnt.ba.go | 6 +- examples/binapi/memif/memif.ba.go | 226 +- examples/binapi/sr/sr.ba.go | 688 ++- examples/binapi/vpe/vpe.ba.go | 158 +- examples/simple-client/simple_client.go | 8 +- examples/union-example/union_example.go | 2 +- 53 files changed, 23546 insertions(+), 3473 deletions(-) create mode 100644 codec/codec.go create mode 100644 codec/testdata/binapi2001/acl/acl.ba.go create mode 100644 codec/testdata/binapi2001/acl/acl_rpc.ba.go create mode 100644 codec/testdata/binapi2001/af_packet/af_packet.ba.go create mode 100644 codec/testdata/binapi2001/af_packet/af_packet_rpc.ba.go create mode 100644 codec/testdata/binapi2001/interfaces/interfaces.ba.go create mode 100644 codec/testdata/binapi2001/interfaces/interfaces_rpc.ba.go create mode 100644 codec/testdata/binapi2001/ip/ip.ba.go create mode 100644 codec/testdata/binapi2001/ip/ip_rpc.ba.go create mode 100644 codec/testdata/binapi2001/memclnt/memclnt.ba.go create mode 100644 codec/testdata/binapi2001/memclnt/memclnt_rpc.ba.go create mode 100644 codec/testdata/binapi2001/memif/memif.ba.go create mode 100644 codec/testdata/binapi2001/memif/memif_rpc.ba.go create mode 100644 codec/testdata/binapi2001/sr/sr.ba.go create mode 100644 codec/testdata/binapi2001/sr/sr_rpc.ba.go create mode 100644 codec/testdata/binapi2001/vpe/vpe.ba.go create mode 100644 codec/testdata/binapi2001/vpe/vpe_rpc.ba.go create mode 100644 examples/binapi/interface_types/interface_types.ba.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 86e3edc..2c0ca09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,13 +14,23 @@ This file lists changes for the GoVPP releases. ## 0.4.0 (in development) > _NOT RELEASED YET_ +### Binapi Generator +- generator code has been split into multiple packages: + - [vppapi](binapigen/vppapi) - parses VPP API (`.api.json`) files + - [binapigen](binapigen) - processes parsed VPP API and handles code generation +- previously required manual patches for generated code should not longer be needed +- any types imported from other VPP API (`*_types.api`) files are now automatically resolved for generated Go code +- dependency on `github.com/lunixbochs/struc` was removed and message un/marshaling is now part of generated code +- generated code now contains comment with information about versions of VPP and binapi-generator +- RPC service code is now generated into a separated file (`*_rpc.ba.go`) in same directory + ### Features - optimized [socketclient](adapter/socketclient) adapter and add method to set client name - added list of compatible messages to `CompatibilityError` ### Fixes -- `MsgCodec` will recover panic occurring during a message decoding -- calling `Unsubscibe` will close the notification channel +- `MsgCodec` will recover panic occurring during a message decoding +- calling `Unsubscibe` will close the notification channel ### Other - improved log messages to provide more relevant info diff --git a/Makefile b/Makefile index 7c6a03b..c2ae179 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ endif GO_BUILD_TAGS ?= novpp -GO_BUILD_ARGS = -ldflags "${LDFLAGS}" +GO_BUILD_ARGS = -ldflags "$(LDFLAGS)" ifneq ($(GO_BUILD_TAGS),) GO_BUILD_ARGS += -tags="${GO_BUILD_TAGS}" endif diff --git a/adapter/socketclient/socketclient.go b/adapter/socketclient/socketclient.go index 1ee067f..867278b 100644 --- a/adapter/socketclient/socketclient.go +++ b/adapter/socketclient/socketclient.go @@ -322,7 +322,7 @@ const ( ) func (c *socketClient) open() error { - var msgCodec codec.MsgCodec + var msgCodec = codec.DefaultCodec // Request socket client create req := &SockclntCreate{ @@ -375,7 +375,7 @@ func (c *socketClient) open() error { } func (c *socketClient) close() error { - msgCodec := new(codec.MsgCodec) + var msgCodec = codec.DefaultCodec req := &SockclntDelete{ Index: c.clientIndex, diff --git a/binapigen/binapigen.go b/binapigen/binapigen.go index 0178476..c5a976b 100644 --- a/binapigen/binapigen.go +++ b/binapigen/binapigen.go @@ -98,9 +98,7 @@ func (file *File) importedFiles(gen *Generator) []*File { logf("file %s import %s not found API files", file.Name, imp) continue } - //if gen.ImportTypes || impFile.Generate { files = append(files, impFile) - //} } return files } @@ -302,13 +300,6 @@ func newField(gen *Generator, file *File, apitype vppapi.Field) *Field { return typ } -func (f *Field) resolveType(gen *Generator) error { - switch { - - } - return nil -} - type Service = vppapi.Service type RPC = vppapi.RPC diff --git a/binapigen/generate.go b/binapigen/generate.go index 1f9b89a..8a34445 100644 --- a/binapigen/generate.go +++ b/binapigen/generate.go @@ -15,16 +15,13 @@ package binapigen import ( - "bytes" "fmt" "io" - "os/exec" - "path" - "path/filepath" "sort" "strings" "git.fd.io/govpp.git/version" + "github.com/sirupsen/logrus" ) // generatedCodeVersion indicates a version of the generated code. @@ -33,7 +30,7 @@ import ( // a constant, api.GoVppAPIPackageIsVersionN (where N is generatedCodeVersion). const generatedCodeVersion = 2 -// message field names +// common message fields const ( msgIdField = "_vl_msg_id" clientIndexField = "client_index" @@ -41,23 +38,16 @@ const ( retvalField = "retval" ) +// global API info const ( - outputFileExt = ".ba.go" // file extension of the Go generated files - rpcFileSuffix = "_rpc" // file name suffix for the RPC services - constModuleName = "ModuleName" // module name constant constAPIVersion = "APIVersion" // API version constant constVersionCrc = "VersionCrc" // version CRC constant +) +// generated fiels +const ( unionDataField = "XXX_UnionData" // name for the union data field - - serviceApiName = "RPCService" // name for the RPC service interface - serviceImplName = "serviceClient" // name for the RPC service implementation - serviceClientName = "ServiceClient" // name for the RPC service client - - // TODO: register service descriptor - //serviceDescType = "ServiceDesc" // name for service descriptor type - //serviceDescName = "_ServiceRPC_serviceDesc" // name for service descriptor var ) // MessageType represents the type of a VPP message @@ -70,22 +60,90 @@ const ( otherMessage // other VPP message ) -type GenFile struct { - *Generator - filename string - file *File - packageDir string - buf bytes.Buffer -} - -func generatePackage(ctx *GenFile, w io.Writer) { +func generateFileBinapi(ctx *GenFile, w io.Writer) { logf("----------------------------") - logf("generating binapi package: %q", ctx.file.PackageName) + logf("generating BINAPI file package: %q", ctx.file.PackageName) logf("----------------------------") - generateHeader(ctx, w) + // generate file header + fmt.Fprintln(w, "// Code generated by GoVPP's binapi-generator. DO NOT EDIT.") + fmt.Fprintln(w, "// versions:") + fmt.Fprintf(w, "// binapi-generator: %s\n", version.Version()) + if ctx.IncludeVppVersion { + fmt.Fprintf(w, "// VPP: %s\n", ctx.VPPVersion) + } + fmt.Fprintf(w, "// source: %s\n", ctx.file.Path) + fmt.Fprintln(w) + + generatePackageHeader(ctx, w) generateImports(ctx, w) + generateApiInfo(ctx, w) + generateTypes(ctx, w) + generateMessages(ctx, w) + + generateImportRefs(ctx, w) +} + +func generatePackageHeader(ctx *GenFile, w io.Writer) { + fmt.Fprintln(w, "/*") + fmt.Fprintf(w, "Package %s contains generated code for VPP API file %s.api (%s).\n", + ctx.file.PackageName, ctx.file.Name, ctx.file.Version()) + fmt.Fprintln(w) + fmt.Fprintln(w, "It consists of:") + printObjNum := func(obj string, num int) { + if num > 0 { + if num > 1 { + if strings.HasSuffix(obj, "s") { + obj += "es" + } else { + obj += "s" + } + } + fmt.Fprintf(w, "\t%3d %s\n", num, obj) + } + } + printObjNum("alias", len(ctx.file.Aliases)) + printObjNum("enum", len(ctx.file.Enums)) + printObjNum("message", len(ctx.file.Messages)) + printObjNum("type", len(ctx.file.Structs)) + printObjNum("union", len(ctx.file.Unions)) + fmt.Fprintln(w, "*/") + fmt.Fprintf(w, "package %s\n", ctx.file.PackageName) + fmt.Fprintln(w) +} + +func generateImports(ctx *GenFile, w io.Writer) { + fmt.Fprintln(w, "import (") + fmt.Fprintln(w, ` "bytes"`) + fmt.Fprintln(w, ` "context"`) + fmt.Fprintln(w, ` "encoding/binary"`) + fmt.Fprintln(w, ` "io"`) + fmt.Fprintln(w, ` "math"`) + fmt.Fprintln(w, ` "strconv"`) + fmt.Fprintln(w) + fmt.Fprintf(w, "\tapi \"%s\"\n", "git.fd.io/govpp.git/api") + fmt.Fprintf(w, "\tcodec \"%s\"\n", "git.fd.io/govpp.git/codec") + fmt.Fprintf(w, "\tstruc \"%s\"\n", "github.com/lunixbochs/struc") + imports := listImports(ctx) + if len(imports) > 0 { + fmt.Fprintln(w) + for imp, importPath := range imports { + fmt.Fprintf(w, "\t%s \"%s\"\n", imp, importPath) + } + } + fmt.Fprintln(w, ")") + fmt.Fprintln(w) + + fmt.Fprintln(w, "// This is a compile-time assertion to ensure that this generated file") + fmt.Fprintln(w, "// is compatible with the GoVPP api package it is being compiled against.") + fmt.Fprintln(w, "// A compilation error at this line likely means your copy of the") + fmt.Fprintln(w, "// GoVPP api package needs to be updated.") + fmt.Fprintf(w, "const _ = api.GoVppAPIPackageIsVersion%d // please upgrade the GoVPP api package\n", generatedCodeVersion) + fmt.Fprintln(w) +} + +func generateApiInfo(ctx *GenFile, w io.Writer) { // generate module desc fmt.Fprintln(w, "const (") fmt.Fprintf(w, "\t// %s is the name of this module.\n", constModuleName) @@ -99,7 +157,9 @@ func generatePackage(ctx *GenFile, w io.Writer) { } fmt.Fprintln(w, ")") fmt.Fprintln(w) +} +func generateTypes(ctx *GenFile, w io.Writer) { // generate enums if len(ctx.file.Enums) > 0 { for _, enum := range ctx.file.Enums { @@ -143,129 +203,41 @@ func generatePackage(ctx *GenFile, w io.Writer) { generateUnion(ctx, w, union) } } - - // generate messages - if len(ctx.file.Messages) > 0 { - for _, msg := range ctx.file.Messages { - generateMessage(ctx, w, msg) - } - - initFnName := fmt.Sprintf("file_%s_binapi_init", ctx.file.PackageName) - - // generate message registrations - fmt.Fprintf(w, "func init() { %s() }\n", initFnName) - fmt.Fprintf(w, "func %s() {\n", initFnName) - for _, msg := range ctx.file.Messages { - fmt.Fprintf(w, "\tapi.RegisterMessage((*%s)(nil), \"%s\")\n", - msg.GoName, ctx.file.Name+"."+msg.GoName) - } - fmt.Fprintln(w, "}") - fmt.Fprintln(w) - - // generate list of messages - fmt.Fprintf(w, "// Messages returns list of all messages in this module.\n") - fmt.Fprintln(w, "func AllMessages() []api.Message {") - fmt.Fprintln(w, "\treturn []api.Message{") - for _, msg := range ctx.file.Messages { - fmt.Fprintf(w, "\t(*%s)(nil),\n", msg.GoName) - } - fmt.Fprintln(w, "}") - fmt.Fprintln(w, "}") - } - - generateFooter(ctx, w) - } -func generateHeader(ctx *GenFile, w io.Writer) { - fmt.Fprintln(w, "// Code generated by GoVPP's binapi-generator. DO NOT EDIT.") - fmt.Fprintln(w, "// versions:") - fmt.Fprintf(w, "// binapi-generator: %s\n", version.Version()) - if ctx.IncludeVppVersion { - fmt.Fprintf(w, "// VPP: %s\n", ctx.VPPVersion) +func generateMessages(ctx *GenFile, w io.Writer) { + if len(ctx.file.Messages) == 0 { + return } - fmt.Fprintf(w, "// source: %s\n", ctx.file.Path) - fmt.Fprintln(w) - - fmt.Fprintln(w, "/*") - fmt.Fprintf(w, "Package %s contains generated code for VPP binary API defined by %s.api (version %s).\n", - ctx.file.PackageName, ctx.file.Name, ctx.file.Version()) - fmt.Fprintln(w) - fmt.Fprintln(w, "It consists of:") - printObjNum := func(obj string, num int) { - if num > 0 { - if num > 1 { - if strings.HasSuffix(obj, "s") { - obj += "es" - } else { - obj += "s" - } - } - fmt.Fprintf(w, "\t%3d %s\n", num, obj) - } + for _, msg := range ctx.file.Messages { + generateMessage(ctx, w, msg) } - //printObjNum("RPC", len(ctx.file.Service.RPCs)) - printObjNum("alias", len(ctx.file.Aliases)) - printObjNum("enum", len(ctx.file.Enums)) - printObjNum("message", len(ctx.file.Messages)) - printObjNum("type", len(ctx.file.Structs)) - printObjNum("union", len(ctx.file.Unions)) - fmt.Fprintln(w, "*/") - fmt.Fprintf(w, "package %s\n", ctx.file.PackageName) - fmt.Fprintln(w) -} -func generateImports(ctx *GenFile, w io.Writer) { - fmt.Fprintln(w, "import (") - fmt.Fprintln(w, ` "bytes"`) - fmt.Fprintln(w, ` "context"`) - fmt.Fprintln(w, ` "encoding/binary"`) - fmt.Fprintln(w, ` "io"`) - fmt.Fprintln(w, ` "math"`) - fmt.Fprintln(w, ` "strconv"`) - fmt.Fprintln(w) - fmt.Fprintf(w, "\tapi \"%s\"\n", "git.fd.io/govpp.git/api") - fmt.Fprintf(w, "\tcodec \"%s\"\n", "git.fd.io/govpp.git/codec") - fmt.Fprintf(w, "\tstruc \"%s\"\n", "github.com/lunixbochs/struc") - if len(ctx.file.Imports) > 0 { - fmt.Fprintln(w) - for _, imp := range ctx.file.Imports { - importPath := path.Join(ctx.ImportPrefix, imp) - if ctx.ImportPrefix == "" { - importPath = getImportPath(ctx.packageDir, imp) - } - fmt.Fprintf(w, "\t%s \"%s\"\n", imp, strings.TrimSpace(importPath)) - } - } - fmt.Fprintln(w, ")") - fmt.Fprintln(w) + // generate message registrations + initFnName := fmt.Sprintf("file_%s_binapi_init", ctx.file.PackageName) - fmt.Fprintln(w, "// This is a compile-time assertion to ensure that this generated file") - fmt.Fprintln(w, "// is compatible with the GoVPP api package it is being compiled against.") - fmt.Fprintln(w, "// A compilation error at this line likely means your copy of the") - fmt.Fprintln(w, "// GoVPP api package needs to be updated.") - fmt.Fprintf(w, "const _ = api.GoVppAPIPackageIsVersion%d // please upgrade the GoVPP api package\n", generatedCodeVersion) + fmt.Fprintf(w, "func init() { %s() }\n", initFnName) + fmt.Fprintf(w, "func %s() {\n", initFnName) + for _, msg := range ctx.file.Messages { + fmt.Fprintf(w, "\tapi.RegisterMessage((*%s)(nil), \"%s\")\n", + msg.GoName, ctx.file.Name+"."+msg.GoName) + } + fmt.Fprintln(w, "}") fmt.Fprintln(w) -} -func getImportPath(outputDir string, pkg string) string { - absPath, err := filepath.Abs(filepath.Join(outputDir, "..", pkg)) - if err != nil { - panic(err) - } - cmd := exec.Command("go", "list", absPath) - var errbuf, outbuf bytes.Buffer - cmd.Stdout = &outbuf - cmd.Stderr = &errbuf - if err := cmd.Run(); err != nil { - fmt.Printf("ERR: %v\n", errbuf.String()) - panic(err) + // generate list of messages + fmt.Fprintf(w, "// Messages returns list of all messages in this module.\n") + fmt.Fprintln(w, "func AllMessages() []api.Message {") + fmt.Fprintln(w, "\treturn []api.Message{") + for _, msg := range ctx.file.Messages { + fmt.Fprintf(w, "\t(*%s)(nil),\n", msg.GoName) } - return outbuf.String() + fmt.Fprintln(w, "}") + fmt.Fprintln(w, "}") } -func generateFooter(ctx *GenFile, w io.Writer) { +func generateImportRefs(ctx *GenFile, w io.Writer) { fmt.Fprintf(w, "// Reference imports to suppress errors if they are not otherwise used.\n") fmt.Fprintf(w, "var _ = api.RegisterMessage\n") fmt.Fprintf(w, "var _ = codec.DecodeString\n") @@ -522,7 +494,7 @@ func generateMessage(ctx *GenFile, w io.Writer, msg *Message) { // skip internal fields switch strings.ToLower(field.Name) { - case /*crcField,*/ msgIdField: + case msgIdField: continue case clientIndexField, contextField: if n == 0 { @@ -590,20 +562,22 @@ func generateMessageSize(ctx *GenFile, w io.Writer, name string, fields []*Field } lvl := 0 - var encodeFields func(fields []*Field, parentName string) - encodeFields = func(fields []*Field, parentName string) { + var sizeFields func(fields []*Field, parentName string) + sizeFields = func(fields []*Field, parentName string) { lvl++ defer func() { lvl-- }() n := 0 for _, field := range fields { - // skip internal fields - switch strings.ToLower(field.Name) { - case /*crcField,*/ msgIdField: - continue - case clientIndexField, contextField: - if n == 0 { + if field.ParentMessage != nil { + // skip internal fields + switch strings.ToLower(field.Name) { + case msgIdField: continue + case clientIndexField, contextField: + if n == 0 { + continue + } } } n++ @@ -646,12 +620,12 @@ func generateMessageSize(ctx *GenFile, w io.Writer, name string, fields []*Field } else if alias := getAliasByRef(ctx.file, field.Type); alias != nil { if encodeBaseType(alias.Type, name, alias.Length, "") { } else if typ := getTypeByRef(ctx.file, alias.Type); typ != nil { - encodeFields(typ.Fields, name) + sizeFields(typ.Fields, name) } else { fmt.Fprintf(w, "\t// ??? ALIAS %s %s\n", name, alias.Type) } } else if typ := getTypeByRef(ctx.file, field.Type); typ != nil { - encodeFields(typ.Fields, name) + sizeFields(typ.Fields, name) } else if union := getUnionByRef(ctx.file, field.Type); union != nil { maxSize := getUnionSize(ctx.file, union) fmt.Fprintf(w, "\tsize += %d\n", maxSize) @@ -665,7 +639,7 @@ func generateMessageSize(ctx *GenFile, w io.Writer, name string, fields []*Field } } - encodeFields(fields, "m") + sizeFields(fields, "m") fmt.Fprintf(w, "return size\n") @@ -786,13 +760,15 @@ func generateMessageMarshal(ctx *GenFile, w io.Writer, name string, fields []*Fi n := 0 for _, field := range fields { - // skip internal fields - switch strings.ToLower(field.Name) { - case /*crcField,*/ msgIdField: - continue - case clientIndexField, contextField: - if n == 0 { + if field.ParentMessage != nil { + // skip internal fields + switch strings.ToLower(field.Name) { + case msgIdField: continue + case clientIndexField, contextField: + if n == 0 { + continue + } } } n++ @@ -1004,13 +980,15 @@ func generateMessageUnmarshal(ctx *GenFile, w io.Writer, name string, fields []* n := 0 for _, field := range fields { - // skip internal fields - switch strings.ToLower(field.Name) { - case /*crcField,*/ msgIdField: - continue - case clientIndexField, contextField: - if n == 0 { + if field.ParentMessage != nil { + // skip internal fields + switch strings.ToLower(field.Name) { + case msgIdField: continue + case clientIndexField, contextField: + if n == 0 { + continue + } } } n++ @@ -1239,3 +1217,7 @@ func generateMessageTypeGetter(w io.Writer, structName string, msgType MessageTy fmt.Fprintln(w, "}") fmt.Fprintln(w) } + +func logf(f string, v ...interface{}) { + logrus.Debugf(f, v...) +} diff --git a/binapigen/generate_rpc.go b/binapigen/generate_rpc.go index b480f4a..4beec04 100644 --- a/binapigen/generate_rpc.go +++ b/binapigen/generate_rpc.go @@ -20,17 +20,31 @@ import ( "strings" ) -func generatePackageRPC(ctx *GenFile, w io.Writer) { +// generated service names +const ( + serviceApiName = "RPCService" // name for the RPC service interface + serviceImplName = "serviceClient" // name for the RPC service implementation + serviceClientName = "ServiceClient" // name for the RPC service client + + // TODO: register service descriptor + //serviceDescType = "ServiceDesc" // name for service descriptor type + //serviceDescName = "_ServiceRPC_serviceDesc" // name for service descriptor var +) + +func generateFileRPC(ctx *GenFile, w io.Writer) { logf("----------------------------") - logf("generating RPC package: %q", ctx.file.PackageName) + logf("generating RPC file package: %q", ctx.file.PackageName) logf("----------------------------") + // generate file header fmt.Fprintln(w, "// Code generated by GoVPP's binapi-generator. DO NOT EDIT.") fmt.Fprintln(w) + // generate package header fmt.Fprintf(w, "package %s\n", ctx.file.PackageName) fmt.Fprintln(w) + // generate imports fmt.Fprintln(w, "import (") fmt.Fprintln(w, ` "context"`) fmt.Fprintln(w, ` "io"`) @@ -39,9 +53,9 @@ func generatePackageRPC(ctx *GenFile, w io.Writer) { fmt.Fprintln(w, ")") fmt.Fprintln(w) - // generate services + // generate RPC service if ctx.file.Service != nil && len(ctx.file.Service.RPCs) > 0 { - generateServiceMethods(ctx, w, ctx.file.Service.RPCs) + generateService(ctx, w, ctx.file.Service) } // generate message registrations @@ -50,6 +64,7 @@ func generatePackageRPC(ctx *GenFile, w io.Writer) { fmt.Fprintln(w, "}") fmt.Fprintln(w)*/ + // generate import refs fmt.Fprintf(w, "// Reference imports to suppress errors if they are not otherwise used.\n") fmt.Fprintf(w, "var _ = api.RegisterMessage\n") fmt.Fprintf(w, "var _ = context.Background\n") @@ -57,14 +72,14 @@ func generatePackageRPC(ctx *GenFile, w io.Writer) { } -func generateServiceMethods(ctx *GenFile, w io.Writer, methods []RPC) { +func generateService(ctx *GenFile, w io.Writer, svc *Service) { // generate services comment generateComment(ctx, w, serviceApiName, "services", "service") // generate service api fmt.Fprintf(w, "type %s interface {\n", serviceApiName) - for _, svc := range methods { - generateServiceMethod(ctx, w, &svc) + for _, rpc := range svc.RPCs { + generateRPCMethod(ctx, w, &rpc) fmt.Fprintln(w) } fmt.Fprintln(w, "}") @@ -82,21 +97,21 @@ func generateServiceMethods(ctx *GenFile, w io.Writer, methods []RPC) { fmt.Fprintln(w, "}") fmt.Fprintln(w) - for _, met := range methods { - method := camelCaseName(met.RequestMsg) + for _, rpc := range svc.RPCs { + method := camelCaseName(rpc.RequestMsg) if m := strings.TrimSuffix(method, "Dump"); method != m { method = "Dump" + m } fmt.Fprintf(w, "func (c *%s) ", serviceImplName) - generateServiceMethod(ctx, w, &met) + generateRPCMethod(ctx, w, &rpc) fmt.Fprintln(w, " {") - if met.Stream { + if rpc.Stream { streamImpl := fmt.Sprintf("%s_%sClient", serviceImplName, method) fmt.Fprintf(w, "\tstream := c.ch.SendMultiRequest(in)\n") fmt.Fprintf(w, "\tx := &%s{stream}\n", streamImpl) fmt.Fprintf(w, "\treturn x, nil\n") - } else if replyTyp := camelCaseName(met.ReplyMsg); replyTyp != "" { + } else if replyTyp := camelCaseName(rpc.ReplyMsg); replyTyp != "" { fmt.Fprintf(w, "\tout := new(%s)\n", replyTyp) fmt.Fprintf(w, "\terr:= c.ch.SendRequest(in).ReceiveReply(out)\n") fmt.Fprintf(w, "\tif err != nil { return nil, err }\n") @@ -108,9 +123,9 @@ func generateServiceMethods(ctx *GenFile, w io.Writer, methods []RPC) { fmt.Fprintln(w, "}") fmt.Fprintln(w) - if met.Stream { - replyTyp := camelCaseName(met.ReplyMsg) - method := camelCaseName(met.RequestMsg) + if rpc.Stream { + replyTyp := camelCaseName(rpc.ReplyMsg) + method := camelCaseName(rpc.RequestMsg) if m := strings.TrimSuffix(method, "Dump"); method != m { method = "Dump" + m } @@ -143,7 +158,7 @@ func generateServiceMethods(ctx *GenFile, w io.Writer, methods []RPC) { fmt.Fprintf(w, "\tServiceName: \"%s\",\n", ctx.moduleName) fmt.Fprintf(w, "\tHandlerType: (*%s)(nil),\n", serviceApiName) fmt.Fprintf(w, "\tMethods: []api.MethodDesc{\n") - for _, method := range methods { + for _, method := range rpcs { fmt.Fprintf(w, "\t {\n") fmt.Fprintf(w, "\t MethodName: \"%s\",\n", method.Name) fmt.Fprintf(w, "\t },\n") @@ -157,7 +172,7 @@ func generateServiceMethods(ctx *GenFile, w io.Writer, methods []RPC) { fmt.Fprintln(w) } -func generateServiceMethod(ctx *GenFile, w io.Writer, rpc *RPC) { +func generateRPCMethod(ctx *GenFile, w io.Writer, rpc *RPC) { reqTyp := camelCaseName(rpc.RequestMsg) logf(" writing RPC: %+v", reqTyp) diff --git a/binapigen/generate_test.go b/binapigen/generate_test.go index 5a2a07a..aab62cd 100644 --- a/binapigen/generate_test.go +++ b/binapigen/generate_test.go @@ -25,14 +25,13 @@ import ( const testOutputDir = "test_output_directory" -func GenerateFromFile(apiDir, outputDir string, opts Options) error { - // parse API files - apifiles, err := vppapi.ParseDir(apiDir) +func GenerateFromFile(file, outputDir string, opts Options) error { + apifile, err := vppapi.ParseFile(file) if err != nil { return err } - g, err := New(opts, apifiles) + g, err := New(opts, []*vppapi.File{apifile}) if err != nil { return err } @@ -40,7 +39,7 @@ func GenerateFromFile(apiDir, outputDir string, opts Options) error { if !file.Generate { continue } - GenerateBinapiFile(g, file, outputDir) + GenerateBinapi(g, file, outputDir) if file.Service != nil { GenerateRPC(g, file, outputDir) } @@ -59,7 +58,7 @@ func TestGenerateFromFile(t *testing.T) { // remove directory created during test defer os.RemoveAll(testOutputDir) - err := GenerateFromFile("testdata/acl.api.json", testOutputDir, Options{}) + err := GenerateFromFile("vppapi/testdata/acl.api.json", testOutputDir, Options{FilesToGenerate: []string{"acl"}}) Expect(err).ShouldNot(HaveOccurred()) fileInfo, err := os.Stat(testOutputDir + "/acl/acl.ba.go") Expect(err).ShouldNot(HaveOccurred()) @@ -70,17 +69,17 @@ func TestGenerateFromFile(t *testing.T) { func TestGenerateFromFileInputError(t *testing.T) { RegisterTestingT(t) - err := GenerateFromFile("testdata/nonexisting.json", testOutputDir, Options{}) + err := GenerateFromFile("vppapi/testdata/nonexisting.json", testOutputDir, Options{}) Expect(err).Should(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("invalid input file name")) + Expect(err.Error()).To(ContainSubstring("unsupported")) } func TestGenerateFromFileReadJsonError(t *testing.T) { RegisterTestingT(t) - err := GenerateFromFile("testdata/input-read-json-error.json", testOutputDir, Options{}) + err := GenerateFromFile("vppapi/testdata/input-read-json-error.json", testOutputDir, Options{}) Expect(err).Should(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("invalid input file name")) + Expect(err.Error()).To(ContainSubstring("unsupported")) } func TestGenerateFromFileGeneratePackageError(t *testing.T) { @@ -94,7 +93,7 @@ func TestGenerateFromFileGeneratePackageError(t *testing.T) { os.RemoveAll(testOutputDir) }() - err := GenerateFromFile("testdata/input-generate-error.json", testOutputDir, Options{}) + err := GenerateFromFile("vppapi/testdata/input-generate-error.json", testOutputDir, Options{}) Expect(err).Should(HaveOccurred()) } @@ -147,7 +146,7 @@ func TestGetContextInterfaceJson(t *testing.T) { // prepare writer writer := bufio.NewWriter(outFile) Expect(writer.Buffered()).To(BeZero()) - err = generatePackage(testCtx, writer) + err = generateFileBinapi(testCtx, writer) Expect(err).ShouldNot(HaveOccurred()) } @@ -313,7 +312,7 @@ func TestGeneratePackageHeader(t *testing.T) { // prepare writer writer := bufio.NewWriter(outFile) Expect(writer.Buffered()).To(BeZero()) - generateHeader(testCtx, writer, inFile) + generatePackageHeader(testCtx, writer, inFile) Expect(writer.Buffered()).ToNot(BeZero()) } diff --git a/binapigen/generator.go b/binapigen/generator.go index 9471462..07c1b13 100644 --- a/binapigen/generator.go +++ b/binapigen/generator.go @@ -20,7 +20,9 @@ import ( "go/format" "io/ioutil" "os" + "path" "path/filepath" + "regexp" "github.com/sirupsen/logrus" @@ -94,29 +96,45 @@ func New(opts Options, apifiles []*vppapi.File) (*Generator, error) { } } - logrus.Debugf("Checking %d files to generate: %v", len(opts.FilesToGenerate), opts.FilesToGenerate) - for _, genfile := range opts.FilesToGenerate { - file, ok := g.FilesByPath[genfile] - if !ok { - file, ok = g.FilesByName[genfile] + if len(opts.FilesToGenerate) > 0 { + logrus.Debugf("Checking %d files to generate: %v", len(opts.FilesToGenerate), opts.FilesToGenerate) + for _, genfile := range opts.FilesToGenerate { + file, ok := g.FilesByPath[genfile] if !ok { - return nil, fmt.Errorf("no API file found for: %v", genfile) + file, ok = g.FilesByName[genfile] + if !ok { + return nil, fmt.Errorf("no API file found for: %v", genfile) + } } - } - file.Generate = true - if opts.ImportTypes { - for _, impFile := range file.importedFiles(g) { - impFile.Generate = true + file.Generate = true + if opts.ImportTypes { + // generate all imported files + for _, impFile := range file.importedFiles(g) { + impFile.Generate = true + } } } + } else { + logrus.Debugf("Files to generate not specified, marking all %d files to generate", len(g.Files)) + for _, file := range g.Files { + file.Generate = true + } } logrus.Debugf("Resolving imported types") for _, file := range g.Files { if !file.Generate { + // skip resolving for non-generated files continue } - importedFiles := file.importedFiles(g) + var importedFiles []*File + for _, impFile := range file.importedFiles(g) { + if !impFile.Generate { + // exclude imports of non-generated files + continue + } + importedFiles = append(importedFiles, impFile) + } file.loadTypeImports(g, importedFiles) } @@ -130,13 +148,21 @@ func (g *Generator) Generate() error { logrus.Infof("Generating %d files", len(g.genfiles)) for _, genfile := range g.genfiles { - if err := writeSourceTo(genfile.filename, genfile.buf.Bytes()); err != nil { + if err := writeSourceTo(genfile.filename, genfile.Content()); err != nil { return fmt.Errorf("writing source for RPC package %s failed: %v", genfile.filename, err) } } return nil } +type GenFile struct { + *Generator + filename string + file *File + outputDir string + buf bytes.Buffer +} + func (g *Generator) NewGenFile(filename string) *GenFile { f := &GenFile{ Generator: g, @@ -146,6 +172,10 @@ func (g *Generator) NewGenFile(filename string) *GenFile { return f } +func (f *GenFile) Content() []byte { + return f.buf.Bytes() +} + func writeSourceTo(outputFile string, b []byte) error { // create output directory packageDir := filepath.Dir(outputFile) @@ -170,3 +200,74 @@ func writeSourceTo(outputFile string, b []byte) error { return nil } + +func listImports(genfile *GenFile) map[string]string { + var importPath = genfile.ImportPrefix + if importPath == "" { + importPath = resolveImportPath(genfile.outputDir) + logrus.Debugf("resolved import path: %s", importPath) + } + imports := map[string]string{} + for _, imp := range genfile.file.imports { + if _, ok := imports[imp]; !ok { + imports[imp] = path.Join(importPath, imp) + } + } + return imports +} + +func resolveImportPath(outputDir string) string { + absPath, err := filepath.Abs(outputDir) + if err != nil { + panic(err) + } + modRoot := findModuleRoot(absPath) + if modRoot == "" { + logrus.Fatalf("module root not found at: %s", absPath) + } + modPath := findModulePath(path.Join(modRoot, "go.mod")) + if modPath == "" { + logrus.Fatalf("module path not found") + } + relDir, err := filepath.Rel(modRoot, absPath) + if err != nil { + panic(err) + } + return filepath.Join(modPath, relDir) +} + +func findModuleRoot(dir string) (root string) { + if dir == "" { + panic("dir not set") + } + dir = filepath.Clean(dir) + + // Look for enclosing go.mod. + for { + if fi, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil && !fi.IsDir() { + return dir + } + d := filepath.Dir(dir) + if d == dir { + break + } + dir = d + } + return "" +} + +var ( + modulePathRE = regexp.MustCompile(`module[ \t]+([^ \t\r\n]+)`) +) + +func findModulePath(file string) string { + data, err := ioutil.ReadFile(file) + if err != nil { + return "" + } + m := modulePathRE.FindSubmatch(data) + if m == nil { + return "" + } + return string(m[1]) +} diff --git a/binapigen/generator_test.go b/binapigen/generator_test.go index ddbda99..9e5b342 100644 --- a/binapigen/generator_test.go +++ b/binapigen/generator_test.go @@ -18,6 +18,15 @@ import ( "testing" ) +func TestModule(t *testing.T) { + const expected = "git.fd.io/govpp.git/examples/binapi" + + impPath := resolveImportPath("../examples/binapi") + if impPath != expected { + t.Fatalf("expected: %q, got: %q", expected, impPath) + } +} + func TestBinapiTypeSizes(t *testing.T) { tests := []struct { name string diff --git a/binapigen/run.go b/binapigen/run.go index 441c43d..e6086ee 100644 --- a/binapigen/run.go +++ b/binapigen/run.go @@ -19,44 +19,13 @@ import ( "os" "path/filepath" - "github.com/sirupsen/logrus" - "git.fd.io/govpp.git/binapigen/vppapi" ) -var debugMode = true - -func logf(f string, v ...interface{}) { - if debugMode { - logrus.Debugf(f, v...) - } -} - -func GenerateBinapiFile(gen *Generator, file *File, outputDir string) *GenFile { - packageDir := filepath.Join(outputDir, file.PackageName) - filename := filepath.Join(packageDir, file.PackageName+outputFileExt) - - g := gen.NewGenFile(filename) - g.file = file - g.packageDir = filepath.Join(outputDir, file.PackageName) - - generatePackage(g, &g.buf) - - return g -} - -func GenerateRPC(gen *Generator, file *File, outputDir string) *GenFile { - packageDir := filepath.Join(outputDir, file.PackageName) - filename := filepath.Join(packageDir, file.PackageName+rpcFileSuffix+outputFileExt) - - g := gen.NewGenFile(filename) - g.file = file - g.packageDir = filepath.Join(outputDir, file.PackageName) - - generatePackageRPC(g, &g.buf) - - return g -} +const ( + outputFileExt = ".ba.go" // file extension of the Go generated files + rpcFileSuffix = "_rpc" // file name suffix for the RPC services +) func Run(apiDir string, opts Options, f func(*Generator) error) { if err := run(apiDir, opts, f); err != nil { @@ -87,3 +56,29 @@ func run(apiDir string, opts Options, f func(*Generator) error) error { return nil } + +func GenerateBinapi(gen *Generator, file *File, outputDir string) *GenFile { + packageDir := filepath.Join(outputDir, file.PackageName) + filename := filepath.Join(packageDir, file.PackageName+outputFileExt) + + g := gen.NewGenFile(filename) + g.file = file + g.outputDir = outputDir + + generateFileBinapi(g, &g.buf) + + return g +} + +func GenerateRPC(gen *Generator, file *File, outputDir string) *GenFile { + packageDir := filepath.Join(outputDir, file.PackageName) + filename := filepath.Join(packageDir, file.PackageName+rpcFileSuffix+outputFileExt) + + g := gen.NewGenFile(filename) + g.file = file + g.outputDir = outputDir + + generateFileRPC(g, &g.buf) + + return g +} diff --git a/binapigen/validate.go b/binapigen/validate.go index 2dae903..a79e148 100644 --- a/binapigen/validate.go +++ b/binapigen/validate.go @@ -17,8 +17,9 @@ package binapigen import ( "strings" - "git.fd.io/govpp.git/binapigen/vppapi" "github.com/sirupsen/logrus" + + "git.fd.io/govpp.git/binapigen/vppapi" ) const ( diff --git a/binapigen/vppapi/integration_test.go b/binapigen/vppapi/integration_test.go index 142017a..9d619b8 100644 --- a/binapigen/vppapi/integration_test.go +++ b/binapigen/vppapi/integration_test.go @@ -30,7 +30,6 @@ func TestParse(t *testing.T) { } for _, file := range files { - //t.Logf(" - %s: %+v", path, module) b, err := json.MarshalIndent(file, "\t", " ") if err != nil { t.Fatal(err) @@ -39,5 +38,4 @@ func TestParse(t *testing.T) { } t.Logf("parsed %d files", len(files)) - } diff --git a/cmd/binapi-generator/main.go b/cmd/binapi-generator/main.go index c0bdbb9..e30aaf2 100644 --- a/cmd/binapi-generator/main.go +++ b/cmd/binapi-generator/main.go @@ -44,7 +44,7 @@ func main() { theOutputDir = flag.String("output-dir", ".", "Output directory where code will be generated.") importPrefix = flag.String("import-prefix", "", "Define import path prefix to be used to import types.") - importTypes = flag.Bool("import-types", false, "Generate packages for imported types.") + importTypes = flag.Bool("import-types", true, "Generate packages for imported types.") includeAPIVer = flag.Bool("include-apiver", true, "Include APIVersion constant for each module.") includeServices = flag.Bool("include-services", true, "Include RPC service api and client implementation.") includeComments = flag.Bool("include-comments", false, "Include JSON API source in comments for each object.") @@ -55,19 +55,17 @@ func main() { printVersion = flag.Bool("version", false, "Prints version and exits.") ) flag.Parse() - if *printVersion { fmt.Fprintln(os.Stdout, version.Info()) os.Exit(0) } - if flag.NArg() == 1 && flag.Arg(0) == "version" { fmt.Fprintln(os.Stdout, version.Verbose()) os.Exit(0) } + // prepare options var opts binapigen.Options - if *theInputFile != "" { if flag.NArg() > 0 { fmt.Fprintln(os.Stderr, "input-file cannot be combined with files to generate in arguments") @@ -77,8 +75,6 @@ func main() { } else { opts.FilesToGenerate = append(opts.FilesToGenerate, flag.Args()...) } - - // prepare options if ver := os.Getenv("VPP_API_VERSION"); ver != "" { // use version from env var if set opts.VPPVersion = ver @@ -106,7 +102,7 @@ func main() { if !file.Generate { continue } - binapigen.GenerateBinapiFile(g, file, outputDir) + binapigen.GenerateBinapi(g, file, outputDir) if g.IncludeServices && file.Service != nil { binapigen.GenerateRPC(g, file, outputDir) } diff --git a/codec/bench_test.go b/codec/bench_test.go index 6889fa7..54d0219 100644 --- a/codec/bench_test.go +++ b/codec/bench_test.go @@ -15,7 +15,6 @@ package codec_test import ( - "fmt" "testing" "git.fd.io/govpp.git/codec" @@ -23,14 +22,15 @@ import ( var Data []byte -func BenchmarkEncode(b *testing.B) { +func BenchmarkEncodeNew(b *testing.B) { m := NewTestAllMsg() + c := codec.DefaultCodec var err error var data []byte + b.ResetTimer() for i := 0; i < b.N; i++ { - c := codec.MsgCodec{} data, err = c.EncodeMsg(m, 100) if err != nil { b.Fatalf("expected nil error, got: %v", err) @@ -39,39 +39,23 @@ func BenchmarkEncode(b *testing.B) { Data = data } -func BenchmarkEncodeStruc(b *testing.B) { - m := NewTestAllMsg() - c := codec.OldCodec{} +func BenchmarkEncodeWrapper(b *testing.B) { + m := codec.Wrapper{NewTestAllMsg()} + c := codec.DefaultCodec var err error var data []byte b.ResetTimer() for i := 0; i < b.N; i++ { - data, err = c.Marshal(m) + data, err = c.EncodeMsg(m, 100) if err != nil { b.Fatalf("expected nil error, got: %v", err) } } Data = data - fmt.Printf("DATA(%d): % 0X\n", len(Data), Data) } -/*func BenchmarkEncodeNew(b *testing.B) { - m := NewTestAllMsg() - - var err error - var data []byte - - for i := 0; i < b.N; i++ { - c := CodecNew{} - data, err = c.Marshal(m) - if err != nil { - b.Fatalf("expected nil error, got: %v", err) - } - } - Data = data -}*/ func BenchmarkEncodeHard(b *testing.B) { m := NewTestAllMsg() @@ -86,5 +70,4 @@ func BenchmarkEncodeHard(b *testing.B) { } } Data = data - fmt.Printf("DATA(%d): % 0X\n", len(Data), Data) } diff --git a/codec/codec.go b/codec/codec.go new file mode 100644 index 0000000..e968a6b --- /dev/null +++ b/codec/codec.go @@ -0,0 +1,78 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// 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. + +package codec + +import ( + "encoding/binary" + "math" + "reflect" + "unsafe" +) + +var order = binary.BigEndian + +type Buffer struct { + pos int + buf []byte +} + +func (b *Buffer) Bytes() []byte { + return b.buf[:b.pos] +} + +func (b *Buffer) EncodeBool(v bool) { + if v { + b.buf[b.pos] = 1 + } else { + b.buf[b.pos] = 0 + } + b.pos += 1 +} + +func (b *Buffer) EncodeUint8(v uint8) { + b.buf[b.pos] = v + b.pos += 1 +} + +func (b *Buffer) EncodeUint16(v uint16) { + order.PutUint16(b.buf[b.pos:b.pos+2], v) + b.pos += 2 +} + +func (b *Buffer) EncodeUint32(v uint32) { + order.PutUint32(b.buf[b.pos:b.pos+4], v) + b.pos += 4 +} + +func (b *Buffer) EncodeUint64(v uint64) { + order.PutUint64(b.buf[b.pos:b.pos+8], v) + b.pos += 8 +} + +func (b *Buffer) EncodeFloat64(v float64) { + order.PutUint64(b.buf[b.pos:b.pos+8], math.Float64bits(v)) + b.pos += 8 +} + +func (b *Buffer) EncodeString(v string, length int) { + copy(b.buf[b.pos:b.pos+length], v) + b.pos += length +} + +func DecodeString(b []byte) string { + sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&b)) + stringHeader := reflect.StringHeader{Data: sliceHeader.Data, Len: sliceHeader.Len} + return *(*string)(unsafe.Pointer(&stringHeader)) +} diff --git a/codec/marshaler.go b/codec/marshaler.go index c6d33a3..803b0f5 100644 --- a/codec/marshaler.go +++ b/codec/marshaler.go @@ -16,20 +16,13 @@ package codec import ( "bytes" - "encoding/binary" - "errors" - "fmt" - "math" "reflect" - "unsafe" "github.com/lunixbochs/struc" "git.fd.io/govpp.git/api" ) -var DefaultCodec = &NewCodec{} // &MsgCodec{} - // Marshaler is the interface implemented by the binary API messages that can // marshal itself into binary form for the wire. type Marshaler interface { @@ -43,187 +36,35 @@ type Unmarshaler interface { Unmarshal([]byte) error } -type NewCodec struct{} - -func (*NewCodec) EncodeMsg(msg api.Message, msgID uint16) (data []byte, err error) { - if msg == nil { - return nil, errors.New("nil message passed in") - } - marshaller, ok := msg.(Marshaler) - if !ok { - return nil, fmt.Errorf("message %s does not implement marshaller", msg.GetMessageName()) - } - - size := marshaller.Size() - offset := getOffset(msg) - //fmt.Printf("size=%d offset=%d\n", size, offset) - - b := make([]byte, size+offset) - b[0] = byte(msgID >> 8) - b[1] = byte(msgID) - - //fmt.Printf("len(b)=%d cap(b)=%d\n", len(b), cap(b)) - //b = append(b, byte(msgID>>8), byte(msgID)) - - //buf := new(bytes.Buffer) - //buf.Grow(size) - - // encode msg ID - //buf.WriteByte(byte(msgID >> 8)) - //buf.WriteByte(byte(msgID)) - - data, err = marshaller.Marshal(b[offset:]) - if err != nil { - return nil, err - } - //buf.Write(b) - - return b[0:len(b):len(b)], nil -} - -func getOffset(msg api.Message) (offset int) { - switch msg.GetMessageType() { - case api.RequestMessage: - return 10 - case api.ReplyMessage: - return 6 - case api.EventMessage: - return 6 - } - return 2 -} - -func (*NewCodec) DecodeMsg(data []byte, msg api.Message) (err error) { - if msg == nil { - return errors.New("nil message passed in") - } - marshaller, ok := msg.(Unmarshaler) - if !ok { - return fmt.Errorf("message %s does not implement marshaller", msg.GetMessageName()) - } - - offset := getOffset(msg) - - err = marshaller.Unmarshal(data[offset:len(data)]) - if err != nil { - return err - } - - return nil +type Wrapper struct { + api.Message } -func (*NewCodec) DecodeMsgContext(data []byte, msg api.Message) (context uint32, err error) { - if msg == nil { - return 0, errors.New("nil message passed in") - } - - switch msg.GetMessageType() { - case api.RequestMessage: - return order.Uint32(data[6:10]), nil - case api.ReplyMessage: - return order.Uint32(data[2:6]), nil +func (w Wrapper) Size() int { + if size, err := struc.Sizeof(w.Message); err != nil { + return 0 + } else { + return size } - - return 0, nil } -type OldCodec struct{} - -func (c *OldCodec) Marshal(v interface{}) (b []byte, err error) { +func (w Wrapper) Marshal(b []byte) ([]byte, error) { buf := new(bytes.Buffer) - if err := struc.Pack(buf, v); err != nil { - return nil, err + if reflect.TypeOf(w.Message).Elem().NumField() > 0 { + if err := struc.Pack(buf, w.Message); err != nil { + return nil, err + } + } + if b != nil { + copy(b, buf.Bytes()) } return buf.Bytes(), nil } -func (c *OldCodec) Unmarshal(data []byte, v interface{}) error { +func (w Wrapper) Unmarshal(data []byte) error { buf := bytes.NewReader(data) - if err := struc.Unpack(buf, v); err != nil { + if err := struc.Unpack(buf, w.Message); err != nil { return err } return nil } - -/*type CodecNew struct{} - -func (c *CodecNew) Marshal(v interface{}) (b []byte, err error) { - buf := new(bytes.Buffer) - if err := binary.Write(buf, binary.BigEndian, v); err != nil { - return nil, err - } - return buf.Bytes(), nil -}*/ - -func EncodeBool(b bool) byte { - if b { - return 1 - } - return 0 -} - -func MarshalValue(value interface{}) []byte { - switch value.(type) { - case int8: - return []byte{byte(value.(int8))} - case uint8: - return []byte{byte(value.(uint8))} - } - return nil -} - -var order = binary.BigEndian - -type Buffer struct { - pos int - buf []byte -} - -func (b *Buffer) Bytes() []byte { - return b.buf[:b.pos] -} - -func (b *Buffer) EncodeUint8(v uint8) { - b.buf[b.pos] = v - b.pos += 1 -} - -func (b *Buffer) EncodeUint16(v uint16) { - order.PutUint16(b.buf[b.pos:b.pos+2], v) - b.pos += 2 -} - -func (b *Buffer) EncodeUint32(v uint32) { - order.PutUint32(b.buf[b.pos:b.pos+4], v) - b.pos += 4 -} - -func (b *Buffer) EncodeUint64(v uint64) { - order.PutUint64(b.buf[b.pos:b.pos+8], v) - b.pos += 8 -} - -func (b *Buffer) EncodeFloat64(v float64) { - order.PutUint64(b.buf[b.pos:b.pos+8], math.Float64bits(v)) - b.pos += 8 -} - -func (b *Buffer) EncodeBool(v bool) { - if v { - b.buf[b.pos] = 1 - } else { - b.buf[b.pos] = 0 - } - b.pos += 1 -} - -func (b *Buffer) EncodeString(v string) { - - b.pos += 1 -} - -func DecodeString(b []byte) string { - sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - stringHeader := reflect.StringHeader{Data: sliceHeader.Data, Len: sliceHeader.Len} - return *(*string)(unsafe.Pointer(&stringHeader)) -} diff --git a/codec/marshaler_test.go b/codec/marshaler_test.go index 9a1887b..95b1e89 100644 --- a/codec/marshaler_test.go +++ b/codec/marshaler_test.go @@ -24,14 +24,83 @@ import ( "git.fd.io/govpp.git/api" "git.fd.io/govpp.git/codec" - "git.fd.io/govpp.git/examples/binapi/fib_types" - "git.fd.io/govpp.git/examples/binapi/interface_types" - "git.fd.io/govpp.git/examples/binapi/interfaces" - "git.fd.io/govpp.git/examples/binapi/ip" - "git.fd.io/govpp.git/examples/binapi/ip_types" - "git.fd.io/govpp.git/examples/binapi/sr" + "git.fd.io/govpp.git/codec/testdata/binapi2001/interfaces" + "git.fd.io/govpp.git/codec/testdata/binapi2001/ip" ) +// CliInband represents VPP binary API message 'cli_inband'. +type CliInband struct { + XXX_CmdLen uint32 `struc:"sizeof=Cmd"` + Cmd string +} + +func (m *CliInband) Reset() { *m = CliInband{} } +func (*CliInband) GetMessageName() string { return "cli_inband" } +func (*CliInband) GetCrcString() string { return "f8377302" } +func (*CliInband) GetMessageType() api.MessageType { return api.RequestMessage } + +// CliInbandReply represents VPP binary API message 'cli_inband_reply'. +type CliInbandReply struct { + Retval int32 + XXX_ReplyLen uint32 `struc:"sizeof=Reply"` + Reply string +} + +func (m *CliInbandReply) Reset() { *m = CliInbandReply{} } +func (*CliInbandReply) GetMessageName() string { return "cli_inband_reply" } +func (*CliInbandReply) GetCrcString() string { return "05879051" } +func (*CliInbandReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func TestWrapperEncode(t *testing.T) { + msg := &CliInband{ + XXX_CmdLen: 5, + Cmd: "abcde", + } + expectedData := []byte{ + 0x00, 0x64, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, + 0x61, 0x62, 0x63, 0x64, 0x65, + } + + c := codec.DefaultCodec + + data, err := c.EncodeMsg(msg, 100) + if err != nil { + t.Fatalf("EncodeMsg failed: %v", err) + } + if !bytes.Equal(data, expectedData) { + t.Fatalf("unexpected encoded data,\nexpected: % 02x\n got: % 02x\n", expectedData, data) + } +} + +func TestWrapperDecode(t *testing.T) { + data := []byte{ + 0x00, 0x64, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, + 0x61, 0x62, 0x63, 0x64, 0x65, + } + expectedMsg := &CliInbandReply{ + Retval: 0, + XXX_ReplyLen: 5, + Reply: "abcde", + } + + c := codec.DefaultCodec + + msg := new(CliInbandReply) + err := c.DecodeMsg(data, msg) + if err != nil { + t.Fatalf("DecodeMsg failed: %v", err) + } + if !reflect.DeepEqual(msg, expectedMsg) { + t.Fatalf("unexpected decoded msg,\nexpected: %+v\n got: %+v\n", expectedMsg, msg) + } +} + /*func TestNewCodecEncodeDecode(t *testing.T) { tests := []struct { name string @@ -136,6 +205,7 @@ func TestNewCodecEncodeDecode_(t *testing.T) { func TestNewCodecEncodeDecode3(t *testing.T) { m := NewTestAllMsg() + data, err := m.Marshal(nil) if err != nil { t.Fatalf("expected nil error, got: %v", err) @@ -154,7 +224,7 @@ func TestNewCodecEncodeDecode3(t *testing.T) { } func TestNewCodecEncodeDecode4(t *testing.T) { m := &interfaces.SwInterfaceSetRxMode{ - Mode: interface_types.RX_MODE_API_POLLING, + Mode: interfaces.RX_MODE_API_POLLING, QueueID: 70000, QueueIDValid: true, SwIfIndex: 300, @@ -180,7 +250,8 @@ func TestNewCodecEncodeDecode4(t *testing.T) { t.Fatalf("newData differs from oldData") } } -func TestNewCodecEncodeDecode2(t *testing.T) { + +/*func TestNewCodecEncodeDecode2(t *testing.T) { m := &sr.SrPoliciesDetails{ Bsid: sr.IP6Address{00, 11, 22, 33, 44, 55, 66, 77, 88, 99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, IsSpray: true, @@ -199,7 +270,7 @@ func TestNewCodecEncodeDecode2(t *testing.T) { }, } - b := make([]byte, 0, m.Size()) + b := make([]byte, m.Size()) data, err := m.Marshal(b) if err != nil { t.Fatalf("expected nil error, got: %v", err) @@ -217,11 +288,11 @@ func TestNewCodecEncodeDecode2(t *testing.T) { if !reflect.DeepEqual(m, &m2) { t.Fatalf("newData differs from oldData") } -} +}*/ func TestNewCodecEncode(t *testing.T) { - //m := NewIPRouteLookupReply() - m := &sr.SrPoliciesDetails{ + m := NewIPRouteLookupReply() + /*m := &sr.SrPoliciesDetails{ Bsid: sr.IP6Address{00, 11, 22, 33, 44, 55, 66, 77, 88, 99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, IsSpray: true, IsEncap: false, @@ -237,21 +308,22 @@ func TestNewCodecEncode(t *testing.T) { }, }, }, - } - - size := m.Size() - t.Logf("size: %d", size) + }*/ var err error var oldData, newData []byte { - var c codec.OldCodec - oldData, err = c.Marshal(m) + w := codec.Wrapper{m} + size := m.Size() + t.Logf("wrapper size: %d", size) + oldData, err = w.Marshal(nil) if err != nil { t.Fatalf("expected nil error, got: %v", err) } } { + size := m.Size() + t.Logf("size: %d", size) newData, err = m.Marshal(nil) if err != nil { t.Fatalf("expected nil error, got: %v", err) @@ -265,9 +337,6 @@ func TestNewCodecEncode(t *testing.T) { } func TestNewCodecDecode(t *testing.T) { - /*m := &ip.IPRouteLookupReply{} - size := m.Size() - t.Logf("size: %d", size)*/ data := []byte{ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, @@ -297,10 +366,10 @@ func TestNewCodecDecode(t *testing.T) { } var err error - var oldData, newData ip.IPRouteLookupReply + var oldData, newData ip.IPRouteAddDel { - var c codec.OldCodec - err = c.Unmarshal(data, &oldData) + w := codec.Wrapper{&oldData} + err = w.Unmarshal(data) if err != nil { t.Errorf("expected nil error, got: %v", err) } @@ -318,16 +387,15 @@ func TestNewCodecDecode(t *testing.T) { } } -func NewIPRouteLookupReply() *ip.IPRouteLookupReply { - return &ip.IPRouteLookupReply{ - Retval: 1, +func NewIPRouteLookupReply() *ip.IPRouteAddDel { + return &ip.IPRouteAddDel{ Route: ip.IPRoute{ TableID: 3, StatsIndex: 5, Prefix: ip.Prefix{ - Address: ip_types.Address{ - Af: fib_types.ADDRESS_IP6, - Un: ip_types.AddressUnion{}, + Address: ip.Address{ + Af: ip.ADDRESS_IP6, + Un: ip.AddressUnion{}, }, Len: 24, }, @@ -472,12 +540,6 @@ func (m *TestAllMsg) Marshal(b []byte) ([]byte, error) { pos += 16 return tmp, nil - - /*_, err := buf.Write(tmp) - if err != nil { - return nil, err - } - return buf.Bytes(), nil*/ } func (m *TestAllMsg) Unmarshal(tmp []byte) error { @@ -578,11 +640,6 @@ func (m *TestAllMsg) Unmarshal(tmp []byte) error { pos += 16 return nil - /*_, err := buf.Write(tmp) - if err != nil { - return nil, err - } - return buf.Bytes(), nil*/ } func boolToUint(b bool) uint8 { diff --git a/codec/msg_codec.go b/codec/msg_codec.go index 3f60cae..920366e 100644 --- a/codec/msg_codec.go +++ b/codec/msg_codec.go @@ -15,19 +15,13 @@ package codec import ( - "bytes" "errors" "fmt" - "reflect" - - "github.com/lunixbochs/struc" "git.fd.io/govpp.git/api" ) -// MsgCodec provides encoding and decoding functionality of `api.Message` structs into/from -// binary format as accepted by VPP. -type MsgCodec struct{} +var DefaultCodec = new(MsgCodec) // VppRequestHeader struct contains header fields implemented by all VPP requests. type VppRequestHeader struct { @@ -53,13 +47,16 @@ type VppOtherHeader struct { VlMsgID uint16 } -// EncodeMsg encodes provided `Message` structure into its binary-encoded data representation. +// MsgCodec provides encoding and decoding functionality of `api.Message` structs into/from +// binary format as accepted by VPP. +type MsgCodec struct{} + func (*MsgCodec) EncodeMsg(msg api.Message, msgID uint16) (data []byte, err error) { if msg == nil { return nil, errors.New("nil message passed in") } - // try to recover panic which might possibly occur in struc.Pack call + // try to recover panic which might possibly occur defer func() { if r := recover(); r != nil { var ok bool @@ -70,38 +67,27 @@ func (*MsgCodec) EncodeMsg(msg api.Message, msgID uint16) (data []byte, err erro } }() - var header interface{} - - // encode message header - switch msg.GetMessageType() { - case api.RequestMessage: - header = &VppRequestHeader{VlMsgID: msgID} - case api.ReplyMessage: - header = &VppReplyHeader{VlMsgID: msgID} - case api.EventMessage: - header = &VppEventHeader{VlMsgID: msgID} - default: - header = &VppOtherHeader{VlMsgID: msgID} + marshaller, ok := msg.(Marshaler) + if !ok { + marshaller = Wrapper{msg} } - buf := new(bytes.Buffer) + size := marshaller.Size() + offset := getOffset(msg) - // encode message header - if err := struc.Pack(buf, header); err != nil { - return nil, fmt.Errorf("failed to encode message header: %+v, error: %v", header, err) - } + // encode msg ID + b := make([]byte, size+offset) + b[0] = byte(msgID >> 8) + b[1] = byte(msgID) - // encode message content - if reflect.TypeOf(msg).Elem().NumField() > 0 { - if err := struc.Pack(buf, msg); err != nil { - return nil, fmt.Errorf("failed to encode message data: %+v, error: %v", data, err) - } + data, err = marshaller.Marshal(b[offset:]) + if err != nil { + return nil, err } - return buf.Bytes(), nil + return b[0:len(b):len(b)], nil } -// DecodeMsg decodes binary-encoded data of a message into provided `Message` structure. func (*MsgCodec) DecodeMsg(data []byte, msg api.Message) (err error) { if msg == nil { return errors.New("nil message passed in") @@ -118,63 +104,44 @@ func (*MsgCodec) DecodeMsg(data []byte, msg api.Message) (err error) { } }() - var header interface{} - - // check which header is expected - switch msg.GetMessageType() { - case api.RequestMessage: - header = new(VppRequestHeader) - case api.ReplyMessage: - header = new(VppReplyHeader) - case api.EventMessage: - header = new(VppEventHeader) - default: - header = new(VppOtherHeader) + marshaller, ok := msg.(Unmarshaler) + if !ok { + marshaller = Wrapper{msg} } - buf := bytes.NewReader(data) - - // decode message header - if err = struc.Unpack(buf, header); err != nil { - return fmt.Errorf("failed to decode message header: %+v, error: %v", header, err) - } + offset := getOffset(msg) - // decode message content - if err := struc.Unpack(buf, msg); err != nil { - return fmt.Errorf("failed to decode message data: %+v, error: %v", data, err) + err = marshaller.Unmarshal(data[offset:len(data)]) + if err != nil { + return err } return nil } -func (*MsgCodec) DecodeMsgContext(data []byte, msg api.Message) (uint32, error) { +func (*MsgCodec) DecodeMsgContext(data []byte, msg api.Message) (context uint32, err error) { if msg == nil { return 0, errors.New("nil message passed in") } - var header interface{} - var getContext func() uint32 - - // check which header is expected switch msg.GetMessageType() { case api.RequestMessage: - header = new(VppRequestHeader) - getContext = func() uint32 { return header.(*VppRequestHeader).Context } - + return order.Uint32(data[6:10]), nil case api.ReplyMessage: - header = new(VppReplyHeader) - getContext = func() uint32 { return header.(*VppReplyHeader).Context } - - default: - return 0, nil + return order.Uint32(data[2:6]), nil } - buf := bytes.NewReader(data) + return 0, nil +} - // decode message header - if err := struc.Unpack(buf, header); err != nil { - return 0, fmt.Errorf("decoding message header failed: %v", err) +func getOffset(msg api.Message) (offset int) { + switch msg.GetMessageType() { + case api.RequestMessage: + return 10 + case api.ReplyMessage: + return 6 + case api.EventMessage: + return 6 } - - return getContext(), nil + return 2 } diff --git a/codec/msg_codec_test.go b/codec/msg_codec_test.go index bf0695d..7f06f0f 100644 --- a/codec/msg_codec_test.go +++ b/codec/msg_codec_test.go @@ -4,12 +4,9 @@ import ( "bytes" "testing" - "github.com/lunixbochs/struc" - "git.fd.io/govpp.git/api" "git.fd.io/govpp.git/codec" "git.fd.io/govpp.git/examples/binapi/ip" - "git.fd.io/govpp.git/examples/binapi/sr" "git.fd.io/govpp.git/examples/binapi/vpe" ) @@ -36,11 +33,11 @@ func TestEncode(t *testing.T) { msgID uint16 expData []byte }{ - /*{name: "basic", + {name: "basic", msg: &MyMsg{Index: 1, Label: []byte("Abcdef"), Port: 1000}, msgID: 100, expData: []byte{0x00, 0x64, 0x00, 0x01, 0x41, 0x62, 0x63, 0x64, 0x65, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xE8}, - },*/ + }, {name: "show version", msg: &vpe.ShowVersion{}, msgID: 743, @@ -55,32 +52,10 @@ func TestEncode(t *testing.T) { StatsIndex: 0, Prefix: ip.Prefix{}, NPaths: 0, - Paths: []ip.FibPath{ - { - SwIfIndex: 0, - TableID: 0, - RpfID: 0, - Weight: 0, - Preference: 0, - Type: 0, - Flags: 0, - Proto: 0, - Nh: ip.FibPathNh{}, - NLabels: 5, - LabelStack: [16]ip.FibMplsLabel{ - { - IsUniform: 1, - Label: 2, - TTL: 3, - Exp: 4, - }, - }, - }, - }, }, }, msgID: 743, - expData: []byte{0x02, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + expData: []byte{0x02, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, }, /*{name: "sr", msg: &sr.SrPolicyAdd{ @@ -97,8 +72,7 @@ func TestEncode(t *testing.T) { } for _, test := range tests { t.Run(test.name, func(t *testing.T) { - c := &codec.MsgCodec{} - //c := &codec.NewCodec{} + c := codec.DefaultCodec data, err := c.EncodeMsg(test.msg, test.msgID) if err != nil { @@ -112,7 +86,7 @@ func TestEncode(t *testing.T) { } func TestEncodePanic(t *testing.T) { - c := &codec.MsgCodec{} + c := codec.DefaultCodec msg := &MyMsg{Index: 1, Label: []byte("thisIsLongerThan16Bytes"), Port: 1000} @@ -121,16 +95,3 @@ func TestEncodePanic(t *testing.T) { t.Fatalf("expected non-nil error, got: %v", err) } } - -func TestEncodeSr(t *testing.T) { - msg := sr.Srv6SidList{ - NumSids: 0, - Weight: 0, - //Sids: nil, - } - buf := new(bytes.Buffer) - - if err := struc.Pack(buf, msg); err != nil { - t.Fatal(err) - } -} diff --git a/codec/testdata/binapi2001/acl/acl.ba.go b/codec/testdata/binapi2001/acl/acl.ba.go new file mode 100644 index 0000000..7253552 --- /dev/null +++ b/codec/testdata/binapi2001/acl/acl.ba.go @@ -0,0 +1,2885 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/plugins/acl.api.json + +/* +Package acl contains generated code for VPP binary API defined by acl.api (version 1.0.1). + +It consists of: + 38 messages + 2 types +*/ +package acl + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "acl" + // APIVersion is the API version of this module. + APIVersion = "1.0.1" + // VersionCrc is the CRC of this module. + VersionCrc = 0x11c5c1e5 +) + +// ACLRule represents VPP binary API type 'acl_rule'. +type ACLRule struct { + IsPermit uint8 `binapi:"u8,name=is_permit" json:"is_permit,omitempty"` + IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` + SrcIPAddr []byte `binapi:"u8[16],name=src_ip_addr" json:"src_ip_addr,omitempty" struc:"[16]byte"` + SrcIPPrefixLen uint8 `binapi:"u8,name=src_ip_prefix_len" json:"src_ip_prefix_len,omitempty"` + DstIPAddr []byte `binapi:"u8[16],name=dst_ip_addr" json:"dst_ip_addr,omitempty" struc:"[16]byte"` + DstIPPrefixLen uint8 `binapi:"u8,name=dst_ip_prefix_len" json:"dst_ip_prefix_len,omitempty"` + Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` + SrcportOrIcmptypeFirst uint16 `binapi:"u16,name=srcport_or_icmptype_first" json:"srcport_or_icmptype_first,omitempty"` + SrcportOrIcmptypeLast uint16 `binapi:"u16,name=srcport_or_icmptype_last" json:"srcport_or_icmptype_last,omitempty"` + DstportOrIcmpcodeFirst uint16 `binapi:"u16,name=dstport_or_icmpcode_first" json:"dstport_or_icmpcode_first,omitempty"` + DstportOrIcmpcodeLast uint16 `binapi:"u16,name=dstport_or_icmpcode_last" json:"dstport_or_icmpcode_last,omitempty"` + TCPFlagsMask uint8 `binapi:"u8,name=tcp_flags_mask" json:"tcp_flags_mask,omitempty"` + TCPFlagsValue uint8 `binapi:"u8,name=tcp_flags_value" json:"tcp_flags_value,omitempty"` +} + +func (*ACLRule) GetTypeName() string { return "acl_rule" } + +// MacipACLRule represents VPP binary API type 'macip_acl_rule'. +type MacipACLRule struct { + IsPermit uint8 `binapi:"u8,name=is_permit" json:"is_permit,omitempty"` + IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` + SrcMac []byte `binapi:"u8[6],name=src_mac" json:"src_mac,omitempty" struc:"[6]byte"` + SrcMacMask []byte `binapi:"u8[6],name=src_mac_mask" json:"src_mac_mask,omitempty" struc:"[6]byte"` + SrcIPAddr []byte `binapi:"u8[16],name=src_ip_addr" json:"src_ip_addr,omitempty" struc:"[16]byte"` + SrcIPPrefixLen uint8 `binapi:"u8,name=src_ip_prefix_len" json:"src_ip_prefix_len,omitempty"` +} + +func (*MacipACLRule) GetTypeName() string { return "macip_acl_rule" } + +// ACLAddReplace represents VPP binary API message 'acl_add_replace'. +type ACLAddReplace struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *ACLAddReplace) Reset() { *m = ACLAddReplace{} } +func (*ACLAddReplace) GetMessageName() string { return "acl_add_replace" } +func (*ACLAddReplace) GetCrcString() string { return "13bc8539" } +func (*ACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLAddReplace) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 ACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + // field[2] s1.DstIPAddr + size += 16 + // field[2] s1.DstIPPrefixLen + size += 1 + // field[2] s1.Proto + size += 1 + // field[2] s1.SrcportOrIcmptypeFirst + size += 2 + // field[2] s1.SrcportOrIcmptypeLast + size += 2 + // field[2] s1.DstportOrIcmpcodeFirst + size += 2 + // field[2] s1.DstportOrIcmpcodeLast + size += 2 + // field[2] s1.TCPFlagsMask + size += 1 + // field[2] s1.TCPFlagsValue + size += 1 + } + return size +} +func (m *ACLAddReplace) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 ACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + // field[2] v1.DstIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.DstIPAddr) { + x = uint8(v1.DstIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.DstIPPrefixLen + buf[pos] = uint8(v1.DstIPPrefixLen) + pos += 1 + // field[2] v1.Proto + buf[pos] = uint8(v1.Proto) + pos += 1 + // field[2] v1.SrcportOrIcmptypeFirst + o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeFirst)) + pos += 2 + // field[2] v1.SrcportOrIcmptypeLast + o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeLast)) + pos += 2 + // field[2] v1.DstportOrIcmpcodeFirst + o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeFirst)) + pos += 2 + // field[2] v1.DstportOrIcmpcodeLast + o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeLast)) + pos += 2 + // field[2] v1.TCPFlagsMask + buf[pos] = uint8(v1.TCPFlagsMask) + pos += 1 + // field[2] v1.TCPFlagsValue + buf[pos] = uint8(v1.TCPFlagsValue) + pos += 1 + } + return buf, nil +} +func (m *ACLAddReplace) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]ACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].DstIPAddr + m.R[j1].DstIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].DstIPAddr); i++ { + m.R[j1].DstIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].DstIPPrefixLen + m.R[j1].DstIPPrefixLen = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].Proto + m.R[j1].Proto = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcportOrIcmptypeFirst + m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].SrcportOrIcmptypeLast + m.R[j1].SrcportOrIcmptypeLast = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].DstportOrIcmpcodeFirst + m.R[j1].DstportOrIcmpcodeFirst = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].DstportOrIcmpcodeLast + m.R[j1].DstportOrIcmpcodeLast = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].TCPFlagsMask + m.R[j1].TCPFlagsMask = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].TCPFlagsValue + m.R[j1].TCPFlagsValue = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// ACLAddReplaceReply represents VPP binary API message 'acl_add_replace_reply'. +type ACLAddReplaceReply struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLAddReplaceReply) Reset() { *m = ACLAddReplaceReply{} } +func (*ACLAddReplaceReply) GetMessageName() string { return "acl_add_replace_reply" } +func (*ACLAddReplaceReply) GetCrcString() string { return "ac407b0c" } +func (*ACLAddReplaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLAddReplaceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLAddReplaceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLAddReplaceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLDel represents VPP binary API message 'acl_del'. +type ACLDel struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *ACLDel) Reset() { *m = ACLDel{} } +func (*ACLDel) GetMessageName() string { return "acl_del" } +func (*ACLDel) GetCrcString() string { return "ef34fea4" } +func (*ACLDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *ACLDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *ACLDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLDelReply represents VPP binary API message 'acl_del_reply'. +type ACLDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLDelReply) Reset() { *m = ACLDelReply{} } +func (*ACLDelReply) GetMessageName() string { return "acl_del_reply" } +func (*ACLDelReply) GetCrcString() string { return "e8d4e804" } +func (*ACLDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLDetails represents VPP binary API message 'acl_details'. +type ACLDetails struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *ACLDetails) Reset() { *m = ACLDetails{} } +func (*ACLDetails) GetMessageName() string { return "acl_details" } +func (*ACLDetails) GetCrcString() string { return "f89d7a88" } +func (*ACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 ACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + // field[2] s1.DstIPAddr + size += 16 + // field[2] s1.DstIPPrefixLen + size += 1 + // field[2] s1.Proto + size += 1 + // field[2] s1.SrcportOrIcmptypeFirst + size += 2 + // field[2] s1.SrcportOrIcmptypeLast + size += 2 + // field[2] s1.DstportOrIcmpcodeFirst + size += 2 + // field[2] s1.DstportOrIcmpcodeLast + size += 2 + // field[2] s1.TCPFlagsMask + size += 1 + // field[2] s1.TCPFlagsValue + size += 1 + } + return size +} +func (m *ACLDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 ACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + // field[2] v1.DstIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.DstIPAddr) { + x = uint8(v1.DstIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.DstIPPrefixLen + buf[pos] = uint8(v1.DstIPPrefixLen) + pos += 1 + // field[2] v1.Proto + buf[pos] = uint8(v1.Proto) + pos += 1 + // field[2] v1.SrcportOrIcmptypeFirst + o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeFirst)) + pos += 2 + // field[2] v1.SrcportOrIcmptypeLast + o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeLast)) + pos += 2 + // field[2] v1.DstportOrIcmpcodeFirst + o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeFirst)) + pos += 2 + // field[2] v1.DstportOrIcmpcodeLast + o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeLast)) + pos += 2 + // field[2] v1.TCPFlagsMask + buf[pos] = uint8(v1.TCPFlagsMask) + pos += 1 + // field[2] v1.TCPFlagsValue + buf[pos] = uint8(v1.TCPFlagsValue) + pos += 1 + } + return buf, nil +} +func (m *ACLDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]ACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].DstIPAddr + m.R[j1].DstIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].DstIPAddr); i++ { + m.R[j1].DstIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].DstIPPrefixLen + m.R[j1].DstIPPrefixLen = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].Proto + m.R[j1].Proto = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcportOrIcmptypeFirst + m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].SrcportOrIcmptypeLast + m.R[j1].SrcportOrIcmptypeLast = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].DstportOrIcmpcodeFirst + m.R[j1].DstportOrIcmpcodeFirst = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].DstportOrIcmpcodeLast + m.R[j1].DstportOrIcmpcodeLast = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].TCPFlagsMask + m.R[j1].TCPFlagsMask = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].TCPFlagsValue + m.R[j1].TCPFlagsValue = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// ACLDump represents VPP binary API message 'acl_dump'. +type ACLDump struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *ACLDump) Reset() { *m = ACLDump{} } +func (*ACLDump) GetMessageName() string { return "acl_dump" } +func (*ACLDump) GetCrcString() string { return "ef34fea4" } +func (*ACLDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *ACLDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *ACLDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLInterfaceAddDel represents VPP binary API message 'acl_interface_add_del'. +type ACLInterfaceAddDel struct { + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + IsInput uint8 `binapi:"u8,name=is_input" json:"is_input,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *ACLInterfaceAddDel) Reset() { *m = ACLInterfaceAddDel{} } +func (*ACLInterfaceAddDel) GetMessageName() string { return "acl_interface_add_del" } +func (*ACLInterfaceAddDel) GetCrcString() string { return "0b2aedd1" } +func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.IsInput + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *ACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + buf[pos] = uint8(m.IsAdd) + pos += 1 + // field[1] m.IsInput + buf[pos] = uint8(m.IsInput) + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = uint8(tmp[pos]) + pos += 1 + // field[1] m.IsInput + m.IsInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLInterfaceAddDelReply represents VPP binary API message 'acl_interface_add_del_reply'. +type ACLInterfaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLInterfaceAddDelReply) Reset() { *m = ACLInterfaceAddDelReply{} } +func (*ACLInterfaceAddDelReply) GetMessageName() string { return "acl_interface_add_del_reply" } +func (*ACLInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLInterfaceEtypeWhitelistDetails represents VPP binary API message 'acl_interface_etype_whitelist_details'. +type ACLInterfaceEtypeWhitelistDetails struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` +} + +func (m *ACLInterfaceEtypeWhitelistDetails) Reset() { *m = ACLInterfaceEtypeWhitelistDetails{} } +func (*ACLInterfaceEtypeWhitelistDetails) GetMessageName() string { + return "acl_interface_etype_whitelist_details" +} +func (*ACLInterfaceEtypeWhitelistDetails) GetCrcString() string { return "6a5d4e81" } +func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceEtypeWhitelistDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.NInput + size += 1 + // field[1] m.Whitelist + size += 2 * len(m.Whitelist) + return size +} +func (m *ACLInterfaceEtypeWhitelistDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Whitelist)) + pos += 1 + // field[1] m.NInput + buf[pos] = uint8(m.NInput) + pos += 1 + // field[1] m.Whitelist + for i := 0; i < len(m.Whitelist); i++ { + var x uint16 + if i < len(m.Whitelist) { + x = uint16(m.Whitelist[i]) + } + o.PutUint16(buf[pos:pos+2], uint16(x)) + pos += 2 + } + return buf, nil +} +func (m *ACLInterfaceEtypeWhitelistDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.NInput + m.NInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.Whitelist + m.Whitelist = make([]uint16, m.Count) + for i := 0; i < len(m.Whitelist); i++ { + m.Whitelist[i] = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + } + return nil +} + +// ACLInterfaceEtypeWhitelistDump represents VPP binary API message 'acl_interface_etype_whitelist_dump'. +type ACLInterfaceEtypeWhitelistDump struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *ACLInterfaceEtypeWhitelistDump) Reset() { *m = ACLInterfaceEtypeWhitelistDump{} } +func (*ACLInterfaceEtypeWhitelistDump) GetMessageName() string { + return "acl_interface_etype_whitelist_dump" +} +func (*ACLInterfaceEtypeWhitelistDump) GetCrcString() string { return "529cb13f" } +func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceEtypeWhitelistDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *ACLInterfaceEtypeWhitelistDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceEtypeWhitelistDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLInterfaceListDetails represents VPP binary API message 'acl_interface_list_details'. +type ACLInterfaceListDetails struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *ACLInterfaceListDetails) Reset() { *m = ACLInterfaceListDetails{} } +func (*ACLInterfaceListDetails) GetMessageName() string { return "acl_interface_list_details" } +func (*ACLInterfaceListDetails) GetCrcString() string { return "d5e80809" } +func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceListDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.NInput + size += 1 + // field[1] m.Acls + size += 4 * len(m.Acls) + return size +} +func (m *ACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Acls)) + pos += 1 + // field[1] m.NInput + buf[pos] = uint8(m.NInput) + pos += 1 + // field[1] m.Acls + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *ACLInterfaceListDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.NInput + m.NInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.Acls + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + +// ACLInterfaceListDump represents VPP binary API message 'acl_interface_list_dump'. +type ACLInterfaceListDump struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *ACLInterfaceListDump) Reset() { *m = ACLInterfaceListDump{} } +func (*ACLInterfaceListDump) GetMessageName() string { return "acl_interface_list_dump" } +func (*ACLInterfaceListDump) GetCrcString() string { return "529cb13f" } +func (*ACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceListDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *ACLInterfaceListDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceListDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLInterfaceSetACLList represents VPP binary API message 'acl_interface_set_acl_list'. +type ACLInterfaceSetACLList struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *ACLInterfaceSetACLList) Reset() { *m = ACLInterfaceSetACLList{} } +func (*ACLInterfaceSetACLList) GetMessageName() string { return "acl_interface_set_acl_list" } +func (*ACLInterfaceSetACLList) GetCrcString() string { return "8baece38" } +func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceSetACLList) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.NInput + size += 1 + // field[1] m.Acls + size += 4 * len(m.Acls) + return size +} +func (m *ACLInterfaceSetACLList) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Acls)) + pos += 1 + // field[1] m.NInput + buf[pos] = uint8(m.NInput) + pos += 1 + // field[1] m.Acls + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *ACLInterfaceSetACLList) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.NInput + m.NInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.Acls + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + +// ACLInterfaceSetACLListReply represents VPP binary API message 'acl_interface_set_acl_list_reply'. +type ACLInterfaceSetACLListReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLInterfaceSetACLListReply) Reset() { *m = ACLInterfaceSetACLListReply{} } +func (*ACLInterfaceSetACLListReply) GetMessageName() string { + return "acl_interface_set_acl_list_reply" +} +func (*ACLInterfaceSetACLListReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceSetACLListReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceSetACLListReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLInterfaceSetACLListReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceSetACLListReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLInterfaceSetEtypeWhitelist represents VPP binary API message 'acl_interface_set_etype_whitelist'. +type ACLInterfaceSetEtypeWhitelist struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` +} + +func (m *ACLInterfaceSetEtypeWhitelist) Reset() { *m = ACLInterfaceSetEtypeWhitelist{} } +func (*ACLInterfaceSetEtypeWhitelist) GetMessageName() string { + return "acl_interface_set_etype_whitelist" +} +func (*ACLInterfaceSetEtypeWhitelist) GetCrcString() string { return "f515efc5" } +func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceSetEtypeWhitelist) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.NInput + size += 1 + // field[1] m.Whitelist + size += 2 * len(m.Whitelist) + return size +} +func (m *ACLInterfaceSetEtypeWhitelist) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Whitelist)) + pos += 1 + // field[1] m.NInput + buf[pos] = uint8(m.NInput) + pos += 1 + // field[1] m.Whitelist + for i := 0; i < len(m.Whitelist); i++ { + var x uint16 + if i < len(m.Whitelist) { + x = uint16(m.Whitelist[i]) + } + o.PutUint16(buf[pos:pos+2], uint16(x)) + pos += 2 + } + return buf, nil +} +func (m *ACLInterfaceSetEtypeWhitelist) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.NInput + m.NInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.Whitelist + m.Whitelist = make([]uint16, m.Count) + for i := 0; i < len(m.Whitelist); i++ { + m.Whitelist[i] = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + } + return nil +} + +// ACLInterfaceSetEtypeWhitelistReply represents VPP binary API message 'acl_interface_set_etype_whitelist_reply'. +type ACLInterfaceSetEtypeWhitelistReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLInterfaceSetEtypeWhitelistReply) Reset() { *m = ACLInterfaceSetEtypeWhitelistReply{} } +func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageName() string { + return "acl_interface_set_etype_whitelist_reply" +} +func (*ACLInterfaceSetEtypeWhitelistReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceSetEtypeWhitelistReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLInterfaceSetEtypeWhitelistReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceSetEtypeWhitelistReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLPluginControlPing represents VPP binary API message 'acl_plugin_control_ping'. +type ACLPluginControlPing struct{} + +func (m *ACLPluginControlPing) Reset() { *m = ACLPluginControlPing{} } +func (*ACLPluginControlPing) GetMessageName() string { return "acl_plugin_control_ping" } +func (*ACLPluginControlPing) GetCrcString() string { return "51077d14" } +func (*ACLPluginControlPing) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLPluginControlPing) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginControlPing) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ACLPluginControlPing) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// ACLPluginControlPingReply represents VPP binary API message 'acl_plugin_control_ping_reply'. +type ACLPluginControlPingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` + VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` +} + +func (m *ACLPluginControlPingReply) Reset() { *m = ACLPluginControlPingReply{} } +func (*ACLPluginControlPingReply) GetMessageName() string { return "acl_plugin_control_ping_reply" } +func (*ACLPluginControlPingReply) GetCrcString() string { return "f6b0b8ca" } +func (*ACLPluginControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLPluginControlPingReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.ClientIndex + size += 4 + // field[1] m.VpePID + size += 4 + return size +} +func (m *ACLPluginControlPingReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.ClientIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ClientIndex)) + pos += 4 + // field[1] m.VpePID + o.PutUint32(buf[pos:pos+4], uint32(m.VpePID)) + pos += 4 + return buf, nil +} +func (m *ACLPluginControlPingReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ClientIndex + m.ClientIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VpePID + m.VpePID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLPluginGetConnTableMaxEntries represents VPP binary API message 'acl_plugin_get_conn_table_max_entries'. +type ACLPluginGetConnTableMaxEntries struct{} + +func (m *ACLPluginGetConnTableMaxEntries) Reset() { *m = ACLPluginGetConnTableMaxEntries{} } +func (*ACLPluginGetConnTableMaxEntries) GetMessageName() string { + return "acl_plugin_get_conn_table_max_entries" +} +func (*ACLPluginGetConnTableMaxEntries) GetCrcString() string { return "51077d14" } +func (*ACLPluginGetConnTableMaxEntries) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLPluginGetConnTableMaxEntries) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginGetConnTableMaxEntries) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ACLPluginGetConnTableMaxEntries) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// ACLPluginGetConnTableMaxEntriesReply represents VPP binary API message 'acl_plugin_get_conn_table_max_entries_reply'. +type ACLPluginGetConnTableMaxEntriesReply struct { + ConnTableMaxEntries uint64 `binapi:"u64,name=conn_table_max_entries" json:"conn_table_max_entries,omitempty"` +} + +func (m *ACLPluginGetConnTableMaxEntriesReply) Reset() { *m = ACLPluginGetConnTableMaxEntriesReply{} } +func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageName() string { + return "acl_plugin_get_conn_table_max_entries_reply" +} +func (*ACLPluginGetConnTableMaxEntriesReply) GetCrcString() string { return "7a096d3d" } +func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLPluginGetConnTableMaxEntriesReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ConnTableMaxEntries + size += 8 + return size +} +func (m *ACLPluginGetConnTableMaxEntriesReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ConnTableMaxEntries + o.PutUint64(buf[pos:pos+8], uint64(m.ConnTableMaxEntries)) + pos += 8 + return buf, nil +} +func (m *ACLPluginGetConnTableMaxEntriesReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ConnTableMaxEntries + m.ConnTableMaxEntries = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + +// ACLPluginGetVersion represents VPP binary API message 'acl_plugin_get_version'. +type ACLPluginGetVersion struct{} + +func (m *ACLPluginGetVersion) Reset() { *m = ACLPluginGetVersion{} } +func (*ACLPluginGetVersion) GetMessageName() string { return "acl_plugin_get_version" } +func (*ACLPluginGetVersion) GetCrcString() string { return "51077d14" } +func (*ACLPluginGetVersion) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLPluginGetVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginGetVersion) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ACLPluginGetVersion) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// ACLPluginGetVersionReply represents VPP binary API message 'acl_plugin_get_version_reply'. +type ACLPluginGetVersionReply struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` +} + +func (m *ACLPluginGetVersionReply) Reset() { *m = ACLPluginGetVersionReply{} } +func (*ACLPluginGetVersionReply) GetMessageName() string { return "acl_plugin_get_version_reply" } +func (*ACLPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } +func (*ACLPluginGetVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLPluginGetVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Major + size += 4 + // field[1] m.Minor + size += 4 + return size +} +func (m *ACLPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Major + o.PutUint32(buf[pos:pos+4], uint32(m.Major)) + pos += 4 + // field[1] m.Minor + o.PutUint32(buf[pos:pos+4], uint32(m.Minor)) + pos += 4 + return buf, nil +} +func (m *ACLPluginGetVersionReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Major + m.Major = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Minor + m.Minor = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLStatsIntfCountersEnable represents VPP binary API message 'acl_stats_intf_counters_enable'. +type ACLStatsIntfCountersEnable struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *ACLStatsIntfCountersEnable) Reset() { *m = ACLStatsIntfCountersEnable{} } +func (*ACLStatsIntfCountersEnable) GetMessageName() string { return "acl_stats_intf_counters_enable" } +func (*ACLStatsIntfCountersEnable) GetCrcString() string { return "b3e225d2" } +func (*ACLStatsIntfCountersEnable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLStatsIntfCountersEnable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Enable + size += 1 + return size +} +func (m *ACLStatsIntfCountersEnable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Enable + if m.Enable { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *ACLStatsIntfCountersEnable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Enable + m.Enable = tmp[pos] != 0 + pos += 1 + return nil +} + +// ACLStatsIntfCountersEnableReply represents VPP binary API message 'acl_stats_intf_counters_enable_reply'. +type ACLStatsIntfCountersEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLStatsIntfCountersEnableReply) Reset() { *m = ACLStatsIntfCountersEnableReply{} } +func (*ACLStatsIntfCountersEnableReply) GetMessageName() string { + return "acl_stats_intf_counters_enable_reply" +} +func (*ACLStatsIntfCountersEnableReply) GetCrcString() string { return "e8d4e804" } +func (*ACLStatsIntfCountersEnableReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLStatsIntfCountersEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLStatsIntfCountersEnableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLStatsIntfCountersEnableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLAdd represents VPP binary API message 'macip_acl_add'. +type MacipACLAdd struct { + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *MacipACLAdd) Reset() { *m = MacipACLAdd{} } +func (*MacipACLAdd) GetMessageName() string { return "macip_acl_add" } +func (*MacipACLAdd) GetCrcString() string { return "0c680ca5" } +func (*MacipACLAdd) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLAdd) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcMac + size += 6 + // field[2] s1.SrcMacMask + size += 6 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + } + return size +} +func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 MacipACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcMac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMac) { + x = uint8(v1.SrcMac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcMacMask + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMacMask) { + x = uint8(v1.SrcMacMask[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + } + return buf, nil +} +func (m *MacipACLAdd) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]MacipACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcMac + m.R[j1].SrcMac = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMac); i++ { + m.R[j1].SrcMac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcMacMask + m.R[j1].SrcMacMask = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMacMask); i++ { + m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// MacipACLAddReplace represents VPP binary API message 'macip_acl_add_replace'. +type MacipACLAddReplace struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *MacipACLAddReplace) Reset() { *m = MacipACLAddReplace{} } +func (*MacipACLAddReplace) GetMessageName() string { return "macip_acl_add_replace" } +func (*MacipACLAddReplace) GetCrcString() string { return "d3d313e7" } +func (*MacipACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLAddReplace) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcMac + size += 6 + // field[2] s1.SrcMacMask + size += 6 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + } + return size +} +func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 MacipACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcMac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMac) { + x = uint8(v1.SrcMac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcMacMask + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMacMask) { + x = uint8(v1.SrcMacMask[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + } + return buf, nil +} +func (m *MacipACLAddReplace) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]MacipACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcMac + m.R[j1].SrcMac = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMac); i++ { + m.R[j1].SrcMac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcMacMask + m.R[j1].SrcMacMask = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMacMask); i++ { + m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// MacipACLAddReplaceReply represents VPP binary API message 'macip_acl_add_replace_reply'. +type MacipACLAddReplaceReply struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLAddReplaceReply) Reset() { *m = MacipACLAddReplaceReply{} } +func (*MacipACLAddReplaceReply) GetMessageName() string { return "macip_acl_add_replace_reply" } +func (*MacipACLAddReplaceReply) GetCrcString() string { return "ac407b0c" } +func (*MacipACLAddReplaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLAddReplaceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Retval + size += 4 + return size +} +func (m *MacipACLAddReplaceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MacipACLAddReplaceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLAddReply represents VPP binary API message 'macip_acl_add_reply'. +type MacipACLAddReply struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLAddReply) Reset() { *m = MacipACLAddReply{} } +func (*MacipACLAddReply) GetMessageName() string { return "macip_acl_add_reply" } +func (*MacipACLAddReply) GetCrcString() string { return "ac407b0c" } +func (*MacipACLAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLAddReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Retval + size += 4 + return size +} +func (m *MacipACLAddReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MacipACLAddReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLDel represents VPP binary API message 'macip_acl_del'. +type MacipACLDel struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *MacipACLDel) Reset() { *m = MacipACLDel{} } +func (*MacipACLDel) GetMessageName() string { return "macip_acl_del" } +func (*MacipACLDel) GetCrcString() string { return "ef34fea4" } +func (*MacipACLDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *MacipACLDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *MacipACLDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLDelReply represents VPP binary API message 'macip_acl_del_reply'. +type MacipACLDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLDelReply) Reset() { *m = MacipACLDelReply{} } +func (*MacipACLDelReply) GetMessageName() string { return "macip_acl_del_reply" } +func (*MacipACLDelReply) GetCrcString() string { return "e8d4e804" } +func (*MacipACLDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MacipACLDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MacipACLDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLDetails represents VPP binary API message 'macip_acl_details'. +type MacipACLDetails struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *MacipACLDetails) Reset() { *m = MacipACLDetails{} } +func (*MacipACLDetails) GetMessageName() string { return "macip_acl_details" } +func (*MacipACLDetails) GetCrcString() string { return "e164e69a" } +func (*MacipACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcMac + size += 6 + // field[2] s1.SrcMacMask + size += 6 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + } + return size +} +func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 MacipACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcMac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMac) { + x = uint8(v1.SrcMac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcMacMask + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMacMask) { + x = uint8(v1.SrcMacMask[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + } + return buf, nil +} +func (m *MacipACLDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]MacipACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcMac + m.R[j1].SrcMac = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMac); i++ { + m.R[j1].SrcMac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcMacMask + m.R[j1].SrcMacMask = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMacMask); i++ { + m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// MacipACLDump represents VPP binary API message 'macip_acl_dump'. +type MacipACLDump struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *MacipACLDump) Reset() { *m = MacipACLDump{} } +func (*MacipACLDump) GetMessageName() string { return "macip_acl_dump" } +func (*MacipACLDump) GetCrcString() string { return "ef34fea4" } +func (*MacipACLDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *MacipACLDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *MacipACLDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLInterfaceAddDel represents VPP binary API message 'macip_acl_interface_add_del'. +type MacipACLInterfaceAddDel struct { + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *MacipACLInterfaceAddDel) Reset() { *m = MacipACLInterfaceAddDel{} } +func (*MacipACLInterfaceAddDel) GetMessageName() string { return "macip_acl_interface_add_del" } +func (*MacipACLInterfaceAddDel) GetCrcString() string { return "6a6be97c" } +func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *MacipACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + buf[pos] = uint8(m.IsAdd) + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *MacipACLInterfaceAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = uint8(tmp[pos]) + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLInterfaceAddDelReply represents VPP binary API message 'macip_acl_interface_add_del_reply'. +type MacipACLInterfaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLInterfaceAddDelReply) Reset() { *m = MacipACLInterfaceAddDelReply{} } +func (*MacipACLInterfaceAddDelReply) GetMessageName() string { + return "macip_acl_interface_add_del_reply" +} +func (*MacipACLInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*MacipACLInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MacipACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MacipACLInterfaceAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLInterfaceGet represents VPP binary API message 'macip_acl_interface_get'. +type MacipACLInterfaceGet struct{} + +func (m *MacipACLInterfaceGet) Reset() { *m = MacipACLInterfaceGet{} } +func (*MacipACLInterfaceGet) GetMessageName() string { return "macip_acl_interface_get" } +func (*MacipACLInterfaceGet) GetCrcString() string { return "51077d14" } +func (*MacipACLInterfaceGet) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLInterfaceGet) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MacipACLInterfaceGet) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *MacipACLInterfaceGet) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// MacipACLInterfaceGetReply represents VPP binary API message 'macip_acl_interface_get_reply'. +type MacipACLInterfaceGetReply struct { + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *MacipACLInterfaceGetReply) Reset() { *m = MacipACLInterfaceGetReply{} } +func (*MacipACLInterfaceGetReply) GetMessageName() string { return "macip_acl_interface_get_reply" } +func (*MacipACLInterfaceGetReply) GetCrcString() string { return "accf9b05" } +func (*MacipACLInterfaceGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLInterfaceGetReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Count + size += 4 + // field[1] m.Acls + size += 4 * len(m.Acls) + return size +} +func (m *MacipACLInterfaceGetReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.Acls))) + pos += 4 + // field[1] m.Acls + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *MacipACLInterfaceGetReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Acls + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + +// MacipACLInterfaceListDetails represents VPP binary API message 'macip_acl_interface_list_details'. +type MacipACLInterfaceListDetails struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *MacipACLInterfaceListDetails) Reset() { *m = MacipACLInterfaceListDetails{} } +func (*MacipACLInterfaceListDetails) GetMessageName() string { + return "macip_acl_interface_list_details" +} +func (*MacipACLInterfaceListDetails) GetCrcString() string { return "29783fa0" } +func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLInterfaceListDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.Acls + size += 4 * len(m.Acls) + return size +} +func (m *MacipACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Acls)) + pos += 1 + // field[1] m.Acls + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *MacipACLInterfaceListDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.Acls + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + +// MacipACLInterfaceListDump represents VPP binary API message 'macip_acl_interface_list_dump'. +type MacipACLInterfaceListDump struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *MacipACLInterfaceListDump) Reset() { *m = MacipACLInterfaceListDump{} } +func (*MacipACLInterfaceListDump) GetMessageName() string { return "macip_acl_interface_list_dump" } +func (*MacipACLInterfaceListDump) GetCrcString() string { return "529cb13f" } +func (*MacipACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLInterfaceListDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *MacipACLInterfaceListDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *MacipACLInterfaceListDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +func init() { file_acl_binapi_init() } +func file_acl_binapi_init() { + api.RegisterMessage((*ACLAddReplace)(nil), "acl.ACLAddReplace") + api.RegisterMessage((*ACLAddReplaceReply)(nil), "acl.ACLAddReplaceReply") + api.RegisterMessage((*ACLDel)(nil), "acl.ACLDel") + api.RegisterMessage((*ACLDelReply)(nil), "acl.ACLDelReply") + api.RegisterMessage((*ACLDetails)(nil), "acl.ACLDetails") + api.RegisterMessage((*ACLDump)(nil), "acl.ACLDump") + api.RegisterMessage((*ACLInterfaceAddDel)(nil), "acl.ACLInterfaceAddDel") + api.RegisterMessage((*ACLInterfaceAddDelReply)(nil), "acl.ACLInterfaceAddDelReply") + api.RegisterMessage((*ACLInterfaceEtypeWhitelistDetails)(nil), "acl.ACLInterfaceEtypeWhitelistDetails") + api.RegisterMessage((*ACLInterfaceEtypeWhitelistDump)(nil), "acl.ACLInterfaceEtypeWhitelistDump") + api.RegisterMessage((*ACLInterfaceListDetails)(nil), "acl.ACLInterfaceListDetails") + api.RegisterMessage((*ACLInterfaceListDump)(nil), "acl.ACLInterfaceListDump") + api.RegisterMessage((*ACLInterfaceSetACLList)(nil), "acl.ACLInterfaceSetACLList") + api.RegisterMessage((*ACLInterfaceSetACLListReply)(nil), "acl.ACLInterfaceSetACLListReply") + api.RegisterMessage((*ACLInterfaceSetEtypeWhitelist)(nil), "acl.ACLInterfaceSetEtypeWhitelist") + api.RegisterMessage((*ACLInterfaceSetEtypeWhitelistReply)(nil), "acl.ACLInterfaceSetEtypeWhitelistReply") + api.RegisterMessage((*ACLPluginControlPing)(nil), "acl.ACLPluginControlPing") + api.RegisterMessage((*ACLPluginControlPingReply)(nil), "acl.ACLPluginControlPingReply") + api.RegisterMessage((*ACLPluginGetConnTableMaxEntries)(nil), "acl.ACLPluginGetConnTableMaxEntries") + api.RegisterMessage((*ACLPluginGetConnTableMaxEntriesReply)(nil), "acl.ACLPluginGetConnTableMaxEntriesReply") + api.RegisterMessage((*ACLPluginGetVersion)(nil), "acl.ACLPluginGetVersion") + api.RegisterMessage((*ACLPluginGetVersionReply)(nil), "acl.ACLPluginGetVersionReply") + api.RegisterMessage((*ACLStatsIntfCountersEnable)(nil), "acl.ACLStatsIntfCountersEnable") + api.RegisterMessage((*ACLStatsIntfCountersEnableReply)(nil), "acl.ACLStatsIntfCountersEnableReply") + api.RegisterMessage((*MacipACLAdd)(nil), "acl.MacipACLAdd") + api.RegisterMessage((*MacipACLAddReplace)(nil), "acl.MacipACLAddReplace") + api.RegisterMessage((*MacipACLAddReplaceReply)(nil), "acl.MacipACLAddReplaceReply") + api.RegisterMessage((*MacipACLAddReply)(nil), "acl.MacipACLAddReply") + api.RegisterMessage((*MacipACLDel)(nil), "acl.MacipACLDel") + api.RegisterMessage((*MacipACLDelReply)(nil), "acl.MacipACLDelReply") + api.RegisterMessage((*MacipACLDetails)(nil), "acl.MacipACLDetails") + api.RegisterMessage((*MacipACLDump)(nil), "acl.MacipACLDump") + api.RegisterMessage((*MacipACLInterfaceAddDel)(nil), "acl.MacipACLInterfaceAddDel") + api.RegisterMessage((*MacipACLInterfaceAddDelReply)(nil), "acl.MacipACLInterfaceAddDelReply") + api.RegisterMessage((*MacipACLInterfaceGet)(nil), "acl.MacipACLInterfaceGet") + api.RegisterMessage((*MacipACLInterfaceGetReply)(nil), "acl.MacipACLInterfaceGetReply") + api.RegisterMessage((*MacipACLInterfaceListDetails)(nil), "acl.MacipACLInterfaceListDetails") + api.RegisterMessage((*MacipACLInterfaceListDump)(nil), "acl.MacipACLInterfaceListDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*ACLAddReplace)(nil), + (*ACLAddReplaceReply)(nil), + (*ACLDel)(nil), + (*ACLDelReply)(nil), + (*ACLDetails)(nil), + (*ACLDump)(nil), + (*ACLInterfaceAddDel)(nil), + (*ACLInterfaceAddDelReply)(nil), + (*ACLInterfaceEtypeWhitelistDetails)(nil), + (*ACLInterfaceEtypeWhitelistDump)(nil), + (*ACLInterfaceListDetails)(nil), + (*ACLInterfaceListDump)(nil), + (*ACLInterfaceSetACLList)(nil), + (*ACLInterfaceSetACLListReply)(nil), + (*ACLInterfaceSetEtypeWhitelist)(nil), + (*ACLInterfaceSetEtypeWhitelistReply)(nil), + (*ACLPluginControlPing)(nil), + (*ACLPluginControlPingReply)(nil), + (*ACLPluginGetConnTableMaxEntries)(nil), + (*ACLPluginGetConnTableMaxEntriesReply)(nil), + (*ACLPluginGetVersion)(nil), + (*ACLPluginGetVersionReply)(nil), + (*ACLStatsIntfCountersEnable)(nil), + (*ACLStatsIntfCountersEnableReply)(nil), + (*MacipACLAdd)(nil), + (*MacipACLAddReplace)(nil), + (*MacipACLAddReplaceReply)(nil), + (*MacipACLAddReply)(nil), + (*MacipACLDel)(nil), + (*MacipACLDelReply)(nil), + (*MacipACLDetails)(nil), + (*MacipACLDump)(nil), + (*MacipACLInterfaceAddDel)(nil), + (*MacipACLInterfaceAddDelReply)(nil), + (*MacipACLInterfaceGet)(nil), + (*MacipACLInterfaceGetReply)(nil), + (*MacipACLInterfaceListDetails)(nil), + (*MacipACLInterfaceListDump)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/acl/acl_rpc.ba.go b/codec/testdata/binapi2001/acl/acl_rpc.ba.go new file mode 100644 index 0000000..62b10c3 --- /dev/null +++ b/codec/testdata/binapi2001/acl/acl_rpc.ba.go @@ -0,0 +1,302 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package acl + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for acl module. +type RPCService interface { + DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) + DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) + DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) + DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) + DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) + ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) + ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) + ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) + ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) + ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) + ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) + ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) + ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) + ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) + MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) + MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) + MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) + MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) + MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLClient{stream} + return x, nil +} + +type RPCService_DumpACLClient interface { + Recv() (*ACLDetails, error) +} + +type serviceClient_DumpACLClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLClient) Recv() (*ACLDetails, error) { + m := new(ACLDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLInterfaceEtypeWhitelistClient{stream} + return x, nil +} + +type RPCService_DumpACLInterfaceEtypeWhitelistClient interface { + Recv() (*ACLInterfaceEtypeWhitelistDetails, error) +} + +type serviceClient_DumpACLInterfaceEtypeWhitelistClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLInterfaceEtypeWhitelistClient) Recv() (*ACLInterfaceEtypeWhitelistDetails, error) { + m := new(ACLInterfaceEtypeWhitelistDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLInterfaceListClient{stream} + return x, nil +} + +type RPCService_DumpACLInterfaceListClient interface { + Recv() (*ACLInterfaceListDetails, error) +} + +type serviceClient_DumpACLInterfaceListClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLInterfaceListClient) Recv() (*ACLInterfaceListDetails, error) { + m := new(ACLInterfaceListDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMacipACLClient{stream} + return x, nil +} + +type RPCService_DumpMacipACLClient interface { + Recv() (*MacipACLDetails, error) +} + +type serviceClient_DumpMacipACLClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMacipACLClient) Recv() (*MacipACLDetails, error) { + m := new(MacipACLDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMacipACLInterfaceListClient{stream} + return x, nil +} + +type RPCService_DumpMacipACLInterfaceListClient interface { + Recv() (*MacipACLInterfaceListDetails, error) +} + +type serviceClient_DumpMacipACLInterfaceListClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMacipACLInterfaceListClient) Recv() (*MacipACLInterfaceListDetails, error) { + m := new(MacipACLInterfaceListDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) { + out := new(ACLAddReplaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) { + out := new(ACLDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) { + out := new(ACLInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) { + out := new(ACLInterfaceSetACLListReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) { + out := new(ACLInterfaceSetEtypeWhitelistReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) { + out := new(ACLPluginControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) { + out := new(ACLPluginGetConnTableMaxEntriesReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) { + out := new(ACLPluginGetVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) { + out := new(ACLStatsIntfCountersEnableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) { + out := new(MacipACLAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) { + out := new(MacipACLAddReplaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) { + out := new(MacipACLDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) { + out := new(MacipACLInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) { + out := new(MacipACLInterfaceGetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/codec/testdata/binapi2001/af_packet/af_packet.ba.go b/codec/testdata/binapi2001/af_packet/af_packet.ba.go new file mode 100644 index 0000000..82b89b3 --- /dev/null +++ b/codec/testdata/binapi2001/af_packet/af_packet.ba.go @@ -0,0 +1,725 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/af_packet.api.json + +/* +Package af_packet contains generated code for VPP binary API defined by af_packet.api (version 2.0.0). + +It consists of: + 2 aliases + 6 enums + 8 messages +*/ +package af_packet + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "af_packet" + // APIVersion is the API version of this module. + APIVersion = "2.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xba745e20 +) + +// IfStatusFlags represents VPP binary API enum 'if_status_flags'. +type IfStatusFlags uint32 + +const ( + IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 + IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 +) + +var ( + IfStatusFlags_name = map[uint32]string{ + 1: "IF_STATUS_API_FLAG_ADMIN_UP", + 2: "IF_STATUS_API_FLAG_LINK_UP", + } + IfStatusFlags_value = map[string]uint32{ + "IF_STATUS_API_FLAG_ADMIN_UP": 1, + "IF_STATUS_API_FLAG_LINK_UP": 2, + } +) + +func (x IfStatusFlags) String() string { + s, ok := IfStatusFlags_name[uint32(x)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" +} + +// IfType represents VPP binary API enum 'if_type'. +type IfType uint32 + +const ( + IF_API_TYPE_HARDWARE IfType = 1 + IF_API_TYPE_SUB IfType = 2 + IF_API_TYPE_P2P IfType = 3 + IF_API_TYPE_PIPE IfType = 4 +) + +var ( + IfType_name = map[uint32]string{ + 1: "IF_API_TYPE_HARDWARE", + 2: "IF_API_TYPE_SUB", + 3: "IF_API_TYPE_P2P", + 4: "IF_API_TYPE_PIPE", + } + IfType_value = map[string]uint32{ + "IF_API_TYPE_HARDWARE": 1, + "IF_API_TYPE_SUB": 2, + "IF_API_TYPE_P2P": 3, + "IF_API_TYPE_PIPE": 4, + } +) + +func (x IfType) String() string { + s, ok := IfType_name[uint32(x)] + if ok { + return s + } + return "IfType(" + strconv.Itoa(int(x)) + ")" +} + +// LinkDuplex represents VPP binary API enum 'link_duplex'. +type LinkDuplex uint32 + +const ( + LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 + LINK_DUPLEX_API_HALF LinkDuplex = 1 + LINK_DUPLEX_API_FULL LinkDuplex = 2 +) + +var ( + LinkDuplex_name = map[uint32]string{ + 0: "LINK_DUPLEX_API_UNKNOWN", + 1: "LINK_DUPLEX_API_HALF", + 2: "LINK_DUPLEX_API_FULL", + } + LinkDuplex_value = map[string]uint32{ + "LINK_DUPLEX_API_UNKNOWN": 0, + "LINK_DUPLEX_API_HALF": 1, + "LINK_DUPLEX_API_FULL": 2, + } +) + +func (x LinkDuplex) String() string { + s, ok := LinkDuplex_name[uint32(x)] + if ok { + return s + } + return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" +} + +// MtuProto represents VPP binary API enum 'mtu_proto'. +type MtuProto uint32 + +const ( + MTU_PROTO_API_L3 MtuProto = 1 + MTU_PROTO_API_IP4 MtuProto = 2 + MTU_PROTO_API_IP6 MtuProto = 3 + MTU_PROTO_API_MPLS MtuProto = 4 + MTU_PROTO_API_N MtuProto = 5 +) + +var ( + MtuProto_name = map[uint32]string{ + 1: "MTU_PROTO_API_L3", + 2: "MTU_PROTO_API_IP4", + 3: "MTU_PROTO_API_IP6", + 4: "MTU_PROTO_API_MPLS", + 5: "MTU_PROTO_API_N", + } + MtuProto_value = map[string]uint32{ + "MTU_PROTO_API_L3": 1, + "MTU_PROTO_API_IP4": 2, + "MTU_PROTO_API_IP6": 3, + "MTU_PROTO_API_MPLS": 4, + "MTU_PROTO_API_N": 5, + } +) + +func (x MtuProto) String() string { + s, ok := MtuProto_name[uint32(x)] + if ok { + return s + } + return "MtuProto(" + strconv.Itoa(int(x)) + ")" +} + +// RxMode represents VPP binary API enum 'rx_mode'. +type RxMode uint32 + +const ( + RX_MODE_API_UNKNOWN RxMode = 0 + RX_MODE_API_POLLING RxMode = 1 + RX_MODE_API_INTERRUPT RxMode = 2 + RX_MODE_API_ADAPTIVE RxMode = 3 + RX_MODE_API_DEFAULT RxMode = 4 +) + +var ( + RxMode_name = map[uint32]string{ + 0: "RX_MODE_API_UNKNOWN", + 1: "RX_MODE_API_POLLING", + 2: "RX_MODE_API_INTERRUPT", + 3: "RX_MODE_API_ADAPTIVE", + 4: "RX_MODE_API_DEFAULT", + } + RxMode_value = map[string]uint32{ + "RX_MODE_API_UNKNOWN": 0, + "RX_MODE_API_POLLING": 1, + "RX_MODE_API_INTERRUPT": 2, + "RX_MODE_API_ADAPTIVE": 3, + "RX_MODE_API_DEFAULT": 4, + } +) + +func (x RxMode) String() string { + s, ok := RxMode_name[uint32(x)] + if ok { + return s + } + return "RxMode(" + strconv.Itoa(int(x)) + ")" +} + +// SubIfFlags represents VPP binary API enum 'sub_if_flags'. +type SubIfFlags uint32 + +const ( + SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 + SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 + SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 + SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 + SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 + SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 + SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 + SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 + SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 + SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 +) + +var ( + SubIfFlags_name = map[uint32]string{ + 1: "SUB_IF_API_FLAG_NO_TAGS", + 2: "SUB_IF_API_FLAG_ONE_TAG", + 4: "SUB_IF_API_FLAG_TWO_TAGS", + 8: "SUB_IF_API_FLAG_DOT1AD", + 16: "SUB_IF_API_FLAG_EXACT_MATCH", + 32: "SUB_IF_API_FLAG_DEFAULT", + 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", + 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", + 254: "SUB_IF_API_FLAG_MASK_VNET", + 256: "SUB_IF_API_FLAG_DOT1AH", + } + SubIfFlags_value = map[string]uint32{ + "SUB_IF_API_FLAG_NO_TAGS": 1, + "SUB_IF_API_FLAG_ONE_TAG": 2, + "SUB_IF_API_FLAG_TWO_TAGS": 4, + "SUB_IF_API_FLAG_DOT1AD": 8, + "SUB_IF_API_FLAG_EXACT_MATCH": 16, + "SUB_IF_API_FLAG_DEFAULT": 32, + "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, + "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, + "SUB_IF_API_FLAG_MASK_VNET": 254, + "SUB_IF_API_FLAG_DOT1AH": 256, + } +) + +func (x SubIfFlags) String() string { + s, ok := SubIfFlags_name[uint32(x)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" +} + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 + +// AfPacketCreate represents VPP binary API message 'af_packet_create'. +type AfPacketCreate struct { + HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + UseRandomHwAddr bool `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` +} + +func (m *AfPacketCreate) Reset() { *m = AfPacketCreate{} } +func (*AfPacketCreate) GetMessageName() string { return "af_packet_create" } +func (*AfPacketCreate) GetCrcString() string { return "a190415f" } +func (*AfPacketCreate) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *AfPacketCreate) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.HwAddr + size += 6 + // field[1] m.UseRandomHwAddr + size += 1 + // field[1] m.HostIfName + size += 64 + return size +} +func (m *AfPacketCreate) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.HwAddr + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.HwAddr) { + x = uint8(m.HwAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.UseRandomHwAddr + if m.UseRandomHwAddr { + buf[pos] = 1 + } + pos += 1 + // field[1] m.HostIfName + copy(buf[pos:pos+64], m.HostIfName) + pos += 64 + return buf, nil +} +func (m *AfPacketCreate) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.HwAddr + for i := 0; i < len(m.HwAddr); i++ { + m.HwAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.UseRandomHwAddr + m.UseRandomHwAddr = tmp[pos] != 0 + pos += 1 + // field[1] m.HostIfName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// AfPacketCreateReply represents VPP binary API message 'af_packet_create_reply'. +type AfPacketCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *AfPacketCreateReply) Reset() { *m = AfPacketCreateReply{} } +func (*AfPacketCreateReply) GetMessageName() string { return "af_packet_create_reply" } +func (*AfPacketCreateReply) GetCrcString() string { return "5383d31f" } +func (*AfPacketCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *AfPacketCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *AfPacketCreateReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *AfPacketCreateReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// AfPacketDelete represents VPP binary API message 'af_packet_delete'. +type AfPacketDelete struct { + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` +} + +func (m *AfPacketDelete) Reset() { *m = AfPacketDelete{} } +func (*AfPacketDelete) GetMessageName() string { return "af_packet_delete" } +func (*AfPacketDelete) GetCrcString() string { return "863fa648" } +func (*AfPacketDelete) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *AfPacketDelete) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.HostIfName + size += 64 + return size +} +func (m *AfPacketDelete) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.HostIfName + copy(buf[pos:pos+64], m.HostIfName) + pos += 64 + return buf, nil +} +func (m *AfPacketDelete) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.HostIfName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// AfPacketDeleteReply represents VPP binary API message 'af_packet_delete_reply'. +type AfPacketDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AfPacketDeleteReply) Reset() { *m = AfPacketDeleteReply{} } +func (*AfPacketDeleteReply) GetMessageName() string { return "af_packet_delete_reply" } +func (*AfPacketDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*AfPacketDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *AfPacketDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *AfPacketDeleteReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *AfPacketDeleteReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// AfPacketDetails represents VPP binary API message 'af_packet_details'. +type AfPacketDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` +} + +func (m *AfPacketDetails) Reset() { *m = AfPacketDetails{} } +func (*AfPacketDetails) GetMessageName() string { return "af_packet_details" } +func (*AfPacketDetails) GetCrcString() string { return "58c7c042" } +func (*AfPacketDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *AfPacketDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.HostIfName + size += 64 + return size +} +func (m *AfPacketDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.HostIfName + copy(buf[pos:pos+64], m.HostIfName) + pos += 64 + return buf, nil +} +func (m *AfPacketDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.HostIfName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// AfPacketDump represents VPP binary API message 'af_packet_dump'. +type AfPacketDump struct{} + +func (m *AfPacketDump) Reset() { *m = AfPacketDump{} } +func (*AfPacketDump) GetMessageName() string { return "af_packet_dump" } +func (*AfPacketDump) GetCrcString() string { return "51077d14" } +func (*AfPacketDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *AfPacketDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *AfPacketDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *AfPacketDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// AfPacketSetL4CksumOffload represents VPP binary API message 'af_packet_set_l4_cksum_offload'. +type AfPacketSetL4CksumOffload struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Set bool `binapi:"bool,name=set" json:"set,omitempty"` +} + +func (m *AfPacketSetL4CksumOffload) Reset() { *m = AfPacketSetL4CksumOffload{} } +func (*AfPacketSetL4CksumOffload) GetMessageName() string { return "af_packet_set_l4_cksum_offload" } +func (*AfPacketSetL4CksumOffload) GetCrcString() string { return "319cd5c8" } +func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *AfPacketSetL4CksumOffload) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Set + size += 1 + return size +} +func (m *AfPacketSetL4CksumOffload) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Set + if m.Set { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *AfPacketSetL4CksumOffload) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Set + m.Set = tmp[pos] != 0 + pos += 1 + return nil +} + +// AfPacketSetL4CksumOffloadReply represents VPP binary API message 'af_packet_set_l4_cksum_offload_reply'. +type AfPacketSetL4CksumOffloadReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AfPacketSetL4CksumOffloadReply) Reset() { *m = AfPacketSetL4CksumOffloadReply{} } +func (*AfPacketSetL4CksumOffloadReply) GetMessageName() string { + return "af_packet_set_l4_cksum_offload_reply" +} +func (*AfPacketSetL4CksumOffloadReply) GetCrcString() string { return "e8d4e804" } +func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *AfPacketSetL4CksumOffloadReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *AfPacketSetL4CksumOffloadReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *AfPacketSetL4CksumOffloadReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +func init() { file_af_packet_binapi_init() } +func file_af_packet_binapi_init() { + api.RegisterMessage((*AfPacketCreate)(nil), "af_packet.AfPacketCreate") + api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet.AfPacketCreateReply") + api.RegisterMessage((*AfPacketDelete)(nil), "af_packet.AfPacketDelete") + api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet.AfPacketDeleteReply") + api.RegisterMessage((*AfPacketDetails)(nil), "af_packet.AfPacketDetails") + api.RegisterMessage((*AfPacketDump)(nil), "af_packet.AfPacketDump") + api.RegisterMessage((*AfPacketSetL4CksumOffload)(nil), "af_packet.AfPacketSetL4CksumOffload") + api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet.AfPacketSetL4CksumOffloadReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AfPacketCreate)(nil), + (*AfPacketCreateReply)(nil), + (*AfPacketDelete)(nil), + (*AfPacketDeleteReply)(nil), + (*AfPacketDetails)(nil), + (*AfPacketDump)(nil), + (*AfPacketSetL4CksumOffload)(nil), + (*AfPacketSetL4CksumOffloadReply)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/af_packet/af_packet_rpc.ba.go b/codec/testdata/binapi2001/af_packet/af_packet_rpc.ba.go new file mode 100644 index 0000000..d2df47a --- /dev/null +++ b/codec/testdata/binapi2001/af_packet/af_packet_rpc.ba.go @@ -0,0 +1,84 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package af_packet + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for af_packet module. +type RPCService interface { + DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) + AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) + AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) + AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpAfPacketClient{stream} + return x, nil +} + +type RPCService_DumpAfPacketClient interface { + Recv() (*AfPacketDetails, error) +} + +type serviceClient_DumpAfPacketClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpAfPacketClient) Recv() (*AfPacketDetails, error) { + m := new(AfPacketDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) { + out := new(AfPacketCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) { + out := new(AfPacketDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) { + out := new(AfPacketSetL4CksumOffloadReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/codec/testdata/binapi2001/interfaces/interfaces.ba.go b/codec/testdata/binapi2001/interfaces/interfaces.ba.go new file mode 100644 index 0000000..0c6ff3e --- /dev/null +++ b/codec/testdata/binapi2001/interfaces/interfaces.ba.go @@ -0,0 +1,3961 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/interface.api.json + +/* +Package interfaces contains generated code for VPP binary API defined by interface.api (version 3.2.2). + +It consists of: + 7 aliases + 10 enums + 53 messages + 6 types + 1 union +*/ +package interfaces + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "interface" + // APIVersion is the API version of this module. + APIVersion = "3.2.2" + // VersionCrc is the CRC of this module. + VersionCrc = 0xfebc3ffa +) + +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var ( + AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", + } + AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, + } +) + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return "AddressFamily(" + strconv.Itoa(int(x)) + ")" +} + +// IfStatusFlags represents VPP binary API enum 'if_status_flags'. +type IfStatusFlags uint32 + +const ( + IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 + IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 +) + +var ( + IfStatusFlags_name = map[uint32]string{ + 1: "IF_STATUS_API_FLAG_ADMIN_UP", + 2: "IF_STATUS_API_FLAG_LINK_UP", + } + IfStatusFlags_value = map[string]uint32{ + "IF_STATUS_API_FLAG_ADMIN_UP": 1, + "IF_STATUS_API_FLAG_LINK_UP": 2, + } +) + +func (x IfStatusFlags) String() string { + s, ok := IfStatusFlags_name[uint32(x)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" +} + +// IfType represents VPP binary API enum 'if_type'. +type IfType uint32 + +const ( + IF_API_TYPE_HARDWARE IfType = 1 + IF_API_TYPE_SUB IfType = 2 + IF_API_TYPE_P2P IfType = 3 + IF_API_TYPE_PIPE IfType = 4 +) + +var ( + IfType_name = map[uint32]string{ + 1: "IF_API_TYPE_HARDWARE", + 2: "IF_API_TYPE_SUB", + 3: "IF_API_TYPE_P2P", + 4: "IF_API_TYPE_PIPE", + } + IfType_value = map[string]uint32{ + "IF_API_TYPE_HARDWARE": 1, + "IF_API_TYPE_SUB": 2, + "IF_API_TYPE_P2P": 3, + "IF_API_TYPE_PIPE": 4, + } +) + +func (x IfType) String() string { + s, ok := IfType_name[uint32(x)] + if ok { + return s + } + return "IfType(" + strconv.Itoa(int(x)) + ")" +} + +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var ( + IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", + } + IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, + } +) + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return "IPDscp(" + strconv.Itoa(int(x)) + ")" +} + +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var ( + IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", + } + IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, + } +) + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return "IPEcn(" + strconv.Itoa(int(x)) + ")" +} + +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var ( + IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", + } + IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, + } +) + +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return "IPProto(" + strconv.Itoa(int(x)) + ")" +} + +// LinkDuplex represents VPP binary API enum 'link_duplex'. +type LinkDuplex uint32 + +const ( + LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 + LINK_DUPLEX_API_HALF LinkDuplex = 1 + LINK_DUPLEX_API_FULL LinkDuplex = 2 +) + +var ( + LinkDuplex_name = map[uint32]string{ + 0: "LINK_DUPLEX_API_UNKNOWN", + 1: "LINK_DUPLEX_API_HALF", + 2: "LINK_DUPLEX_API_FULL", + } + LinkDuplex_value = map[string]uint32{ + "LINK_DUPLEX_API_UNKNOWN": 0, + "LINK_DUPLEX_API_HALF": 1, + "LINK_DUPLEX_API_FULL": 2, + } +) + +func (x LinkDuplex) String() string { + s, ok := LinkDuplex_name[uint32(x)] + if ok { + return s + } + return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" +} + +// MtuProto represents VPP binary API enum 'mtu_proto'. +type MtuProto uint32 + +const ( + MTU_PROTO_API_L3 MtuProto = 1 + MTU_PROTO_API_IP4 MtuProto = 2 + MTU_PROTO_API_IP6 MtuProto = 3 + MTU_PROTO_API_MPLS MtuProto = 4 + MTU_PROTO_API_N MtuProto = 5 +) + +var ( + MtuProto_name = map[uint32]string{ + 1: "MTU_PROTO_API_L3", + 2: "MTU_PROTO_API_IP4", + 3: "MTU_PROTO_API_IP6", + 4: "MTU_PROTO_API_MPLS", + 5: "MTU_PROTO_API_N", + } + MtuProto_value = map[string]uint32{ + "MTU_PROTO_API_L3": 1, + "MTU_PROTO_API_IP4": 2, + "MTU_PROTO_API_IP6": 3, + "MTU_PROTO_API_MPLS": 4, + "MTU_PROTO_API_N": 5, + } +) + +func (x MtuProto) String() string { + s, ok := MtuProto_name[uint32(x)] + if ok { + return s + } + return "MtuProto(" + strconv.Itoa(int(x)) + ")" +} + +// RxMode represents VPP binary API enum 'rx_mode'. +type RxMode uint32 + +const ( + RX_MODE_API_UNKNOWN RxMode = 0 + RX_MODE_API_POLLING RxMode = 1 + RX_MODE_API_INTERRUPT RxMode = 2 + RX_MODE_API_ADAPTIVE RxMode = 3 + RX_MODE_API_DEFAULT RxMode = 4 +) + +var ( + RxMode_name = map[uint32]string{ + 0: "RX_MODE_API_UNKNOWN", + 1: "RX_MODE_API_POLLING", + 2: "RX_MODE_API_INTERRUPT", + 3: "RX_MODE_API_ADAPTIVE", + 4: "RX_MODE_API_DEFAULT", + } + RxMode_value = map[string]uint32{ + "RX_MODE_API_UNKNOWN": 0, + "RX_MODE_API_POLLING": 1, + "RX_MODE_API_INTERRUPT": 2, + "RX_MODE_API_ADAPTIVE": 3, + "RX_MODE_API_DEFAULT": 4, + } +) + +func (x RxMode) String() string { + s, ok := RxMode_name[uint32(x)] + if ok { + return s + } + return "RxMode(" + strconv.Itoa(int(x)) + ")" +} + +// SubIfFlags represents VPP binary API enum 'sub_if_flags'. +type SubIfFlags uint32 + +const ( + SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 + SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 + SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 + SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 + SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 + SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 + SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 + SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 + SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 + SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 +) + +var ( + SubIfFlags_name = map[uint32]string{ + 1: "SUB_IF_API_FLAG_NO_TAGS", + 2: "SUB_IF_API_FLAG_ONE_TAG", + 4: "SUB_IF_API_FLAG_TWO_TAGS", + 8: "SUB_IF_API_FLAG_DOT1AD", + 16: "SUB_IF_API_FLAG_EXACT_MATCH", + 32: "SUB_IF_API_FLAG_DEFAULT", + 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", + 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", + 254: "SUB_IF_API_FLAG_MASK_VNET", + 256: "SUB_IF_API_FLAG_DOT1AH", + } + SubIfFlags_value = map[string]uint32{ + "SUB_IF_API_FLAG_NO_TAGS": 1, + "SUB_IF_API_FLAG_ONE_TAG": 2, + "SUB_IF_API_FLAG_TWO_TAGS": 4, + "SUB_IF_API_FLAG_DOT1AD": 8, + "SUB_IF_API_FLAG_EXACT_MATCH": 16, + "SUB_IF_API_FLAG_DEFAULT": 32, + "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, + "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, + "SUB_IF_API_FLAG_MASK_VNET": 254, + "SUB_IF_API_FLAG_DOT1AH": 256, + } +) + +func (x SubIfFlags) String() string { + s, ok := SubIfFlags_name[uint32(x)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" +} + +// AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. +type AddressWithPrefix Prefix + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 + +// IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'. +type IP4AddressWithPrefix IP4Prefix + +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 + +// IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'. +type IP6AddressWithPrefix IP6Prefix + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 + +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` +} + +func (*Address) GetTypeName() string { return "address" } + +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" } + +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" } + +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` + GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` + SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` +} + +func (*Mprefix) GetTypeName() string { return "mprefix" } + +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address `binapi:"address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*Prefix) GetTypeName() string { return "prefix" } + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` + Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` +} + +func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" } + +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { return "address_union" } + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +// CollectDetailedInterfaceStats represents VPP binary API message 'collect_detailed_interface_stats'. +type CollectDetailedInterfaceStats struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` +} + +func (m *CollectDetailedInterfaceStats) Reset() { *m = CollectDetailedInterfaceStats{} } +func (*CollectDetailedInterfaceStats) GetMessageName() string { + return "collect_detailed_interface_stats" +} +func (*CollectDetailedInterfaceStats) GetCrcString() string { return "5501adee" } +func (*CollectDetailedInterfaceStats) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *CollectDetailedInterfaceStats) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.EnableDisable + size += 1 + return size +} +func (m *CollectDetailedInterfaceStats) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.EnableDisable + if m.EnableDisable { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *CollectDetailedInterfaceStats) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.EnableDisable + m.EnableDisable = tmp[pos] != 0 + pos += 1 + return nil +} + +// CollectDetailedInterfaceStatsReply represents VPP binary API message 'collect_detailed_interface_stats_reply'. +type CollectDetailedInterfaceStatsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CollectDetailedInterfaceStatsReply) Reset() { *m = CollectDetailedInterfaceStatsReply{} } +func (*CollectDetailedInterfaceStatsReply) GetMessageName() string { + return "collect_detailed_interface_stats_reply" +} +func (*CollectDetailedInterfaceStatsReply) GetCrcString() string { return "e8d4e804" } +func (*CollectDetailedInterfaceStatsReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *CollectDetailedInterfaceStatsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *CollectDetailedInterfaceStatsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *CollectDetailedInterfaceStatsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// CreateLoopback represents VPP binary API message 'create_loopback'. +type CreateLoopback struct { + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` +} + +func (m *CreateLoopback) Reset() { *m = CreateLoopback{} } +func (*CreateLoopback) GetMessageName() string { return "create_loopback" } +func (*CreateLoopback) GetCrcString() string { return "42bb5d22" } +func (*CreateLoopback) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *CreateLoopback) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.MacAddress + size += 6 + return size +} +func (m *CreateLoopback) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.MacAddress + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.MacAddress) { + x = uint8(m.MacAddress[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *CreateLoopback) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.MacAddress + for i := 0; i < len(m.MacAddress); i++ { + m.MacAddress[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// CreateLoopbackInstance represents VPP binary API message 'create_loopback_instance'. +type CreateLoopbackInstance struct { + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + IsSpecified bool `binapi:"bool,name=is_specified" json:"is_specified,omitempty"` + UserInstance uint32 `binapi:"u32,name=user_instance" json:"user_instance,omitempty"` +} + +func (m *CreateLoopbackInstance) Reset() { *m = CreateLoopbackInstance{} } +func (*CreateLoopbackInstance) GetMessageName() string { return "create_loopback_instance" } +func (*CreateLoopbackInstance) GetCrcString() string { return "d36a3ee2" } +func (*CreateLoopbackInstance) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *CreateLoopbackInstance) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.MacAddress + size += 6 + // field[1] m.IsSpecified + size += 1 + // field[1] m.UserInstance + size += 4 + return size +} +func (m *CreateLoopbackInstance) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.MacAddress + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.MacAddress) { + x = uint8(m.MacAddress[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.IsSpecified + if m.IsSpecified { + buf[pos] = 1 + } + pos += 1 + // field[1] m.UserInstance + o.PutUint32(buf[pos:pos+4], uint32(m.UserInstance)) + pos += 4 + return buf, nil +} +func (m *CreateLoopbackInstance) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.MacAddress + for i := 0; i < len(m.MacAddress); i++ { + m.MacAddress[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.IsSpecified + m.IsSpecified = tmp[pos] != 0 + pos += 1 + // field[1] m.UserInstance + m.UserInstance = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// CreateLoopbackInstanceReply represents VPP binary API message 'create_loopback_instance_reply'. +type CreateLoopbackInstanceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateLoopbackInstanceReply) Reset() { *m = CreateLoopbackInstanceReply{} } +func (*CreateLoopbackInstanceReply) GetMessageName() string { return "create_loopback_instance_reply" } +func (*CreateLoopbackInstanceReply) GetCrcString() string { return "5383d31f" } +func (*CreateLoopbackInstanceReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *CreateLoopbackInstanceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *CreateLoopbackInstanceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *CreateLoopbackInstanceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// CreateLoopbackReply represents VPP binary API message 'create_loopback_reply'. +type CreateLoopbackReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateLoopbackReply) Reset() { *m = CreateLoopbackReply{} } +func (*CreateLoopbackReply) GetMessageName() string { return "create_loopback_reply" } +func (*CreateLoopbackReply) GetCrcString() string { return "5383d31f" } +func (*CreateLoopbackReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *CreateLoopbackReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *CreateLoopbackReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *CreateLoopbackReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// CreateSubif represents VPP binary API message 'create_subif'. +type CreateSubif struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` + SubIfFlags SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` + OuterVlanID uint16 `binapi:"u16,name=outer_vlan_id" json:"outer_vlan_id,omitempty"` + InnerVlanID uint16 `binapi:"u16,name=inner_vlan_id" json:"inner_vlan_id,omitempty"` +} + +func (m *CreateSubif) Reset() { *m = CreateSubif{} } +func (*CreateSubif) GetMessageName() string { return "create_subif" } +func (*CreateSubif) GetCrcString() string { return "cb371063" } +func (*CreateSubif) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *CreateSubif) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.SubID + size += 4 + // field[1] m.SubIfFlags + size += 4 + // field[1] m.OuterVlanID + size += 2 + // field[1] m.InnerVlanID + size += 2 + return size +} +func (m *CreateSubif) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.SubID + o.PutUint32(buf[pos:pos+4], uint32(m.SubID)) + pos += 4 + // field[1] m.SubIfFlags + o.PutUint32(buf[pos:pos+4], uint32(m.SubIfFlags)) + pos += 4 + // field[1] m.OuterVlanID + o.PutUint16(buf[pos:pos+2], uint16(m.OuterVlanID)) + pos += 2 + // field[1] m.InnerVlanID + o.PutUint16(buf[pos:pos+2], uint16(m.InnerVlanID)) + pos += 2 + return buf, nil +} +func (m *CreateSubif) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SubID + m.SubID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SubIfFlags + m.SubIfFlags = SubIfFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.OuterVlanID + m.OuterVlanID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.InnerVlanID + m.InnerVlanID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + +// CreateSubifReply represents VPP binary API message 'create_subif_reply'. +type CreateSubifReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateSubifReply) Reset() { *m = CreateSubifReply{} } +func (*CreateSubifReply) GetMessageName() string { return "create_subif_reply" } +func (*CreateSubifReply) GetCrcString() string { return "5383d31f" } +func (*CreateSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *CreateSubifReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *CreateSubifReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *CreateSubifReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// CreateVlanSubif represents VPP binary API message 'create_vlan_subif'. +type CreateVlanSubif struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VlanID uint32 `binapi:"u32,name=vlan_id" json:"vlan_id,omitempty"` +} + +func (m *CreateVlanSubif) Reset() { *m = CreateVlanSubif{} } +func (*CreateVlanSubif) GetMessageName() string { return "create_vlan_subif" } +func (*CreateVlanSubif) GetCrcString() string { return "af34ac8b" } +func (*CreateVlanSubif) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *CreateVlanSubif) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.VlanID + size += 4 + return size +} +func (m *CreateVlanSubif) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.VlanID + o.PutUint32(buf[pos:pos+4], uint32(m.VlanID)) + pos += 4 + return buf, nil +} +func (m *CreateVlanSubif) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VlanID + m.VlanID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// CreateVlanSubifReply represents VPP binary API message 'create_vlan_subif_reply'. +type CreateVlanSubifReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateVlanSubifReply) Reset() { *m = CreateVlanSubifReply{} } +func (*CreateVlanSubifReply) GetMessageName() string { return "create_vlan_subif_reply" } +func (*CreateVlanSubifReply) GetCrcString() string { return "5383d31f" } +func (*CreateVlanSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *CreateVlanSubifReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *CreateVlanSubifReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *CreateVlanSubifReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// DeleteLoopback represents VPP binary API message 'delete_loopback'. +type DeleteLoopback struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *DeleteLoopback) Reset() { *m = DeleteLoopback{} } +func (*DeleteLoopback) GetMessageName() string { return "delete_loopback" } +func (*DeleteLoopback) GetCrcString() string { return "f9e6675e" } +func (*DeleteLoopback) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *DeleteLoopback) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *DeleteLoopback) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *DeleteLoopback) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// DeleteLoopbackReply represents VPP binary API message 'delete_loopback_reply'. +type DeleteLoopbackReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DeleteLoopbackReply) Reset() { *m = DeleteLoopbackReply{} } +func (*DeleteLoopbackReply) GetMessageName() string { return "delete_loopback_reply" } +func (*DeleteLoopbackReply) GetCrcString() string { return "e8d4e804" } +func (*DeleteLoopbackReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *DeleteLoopbackReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *DeleteLoopbackReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *DeleteLoopbackReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// DeleteSubif represents VPP binary API message 'delete_subif'. +type DeleteSubif struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *DeleteSubif) Reset() { *m = DeleteSubif{} } +func (*DeleteSubif) GetMessageName() string { return "delete_subif" } +func (*DeleteSubif) GetCrcString() string { return "f9e6675e" } +func (*DeleteSubif) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *DeleteSubif) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *DeleteSubif) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *DeleteSubif) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// DeleteSubifReply represents VPP binary API message 'delete_subif_reply'. +type DeleteSubifReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DeleteSubifReply) Reset() { *m = DeleteSubifReply{} } +func (*DeleteSubifReply) GetMessageName() string { return "delete_subif_reply" } +func (*DeleteSubifReply) GetCrcString() string { return "e8d4e804" } +func (*DeleteSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *DeleteSubifReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *DeleteSubifReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *DeleteSubifReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// HwInterfaceSetMtu represents VPP binary API message 'hw_interface_set_mtu'. +type HwInterfaceSetMtu struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mtu uint16 `binapi:"u16,name=mtu" json:"mtu,omitempty"` +} + +func (m *HwInterfaceSetMtu) Reset() { *m = HwInterfaceSetMtu{} } +func (*HwInterfaceSetMtu) GetMessageName() string { return "hw_interface_set_mtu" } +func (*HwInterfaceSetMtu) GetCrcString() string { return "e6746899" } +func (*HwInterfaceSetMtu) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *HwInterfaceSetMtu) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Mtu + size += 2 + return size +} +func (m *HwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Mtu + o.PutUint16(buf[pos:pos+2], uint16(m.Mtu)) + pos += 2 + return buf, nil +} +func (m *HwInterfaceSetMtu) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mtu + m.Mtu = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + +// HwInterfaceSetMtuReply represents VPP binary API message 'hw_interface_set_mtu_reply'. +type HwInterfaceSetMtuReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *HwInterfaceSetMtuReply) Reset() { *m = HwInterfaceSetMtuReply{} } +func (*HwInterfaceSetMtuReply) GetMessageName() string { return "hw_interface_set_mtu_reply" } +func (*HwInterfaceSetMtuReply) GetCrcString() string { return "e8d4e804" } +func (*HwInterfaceSetMtuReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *HwInterfaceSetMtuReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *HwInterfaceSetMtuReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *HwInterfaceSetMtuReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// InterfaceNameRenumber represents VPP binary API message 'interface_name_renumber'. +type InterfaceNameRenumber struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + NewShowDevInstance uint32 `binapi:"u32,name=new_show_dev_instance" json:"new_show_dev_instance,omitempty"` +} + +func (m *InterfaceNameRenumber) Reset() { *m = InterfaceNameRenumber{} } +func (*InterfaceNameRenumber) GetMessageName() string { return "interface_name_renumber" } +func (*InterfaceNameRenumber) GetCrcString() string { return "2b8858b8" } +func (*InterfaceNameRenumber) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *InterfaceNameRenumber) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.NewShowDevInstance + size += 4 + return size +} +func (m *InterfaceNameRenumber) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.NewShowDevInstance + o.PutUint32(buf[pos:pos+4], uint32(m.NewShowDevInstance)) + pos += 4 + return buf, nil +} +func (m *InterfaceNameRenumber) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NewShowDevInstance + m.NewShowDevInstance = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// InterfaceNameRenumberReply represents VPP binary API message 'interface_name_renumber_reply'. +type InterfaceNameRenumberReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *InterfaceNameRenumberReply) Reset() { *m = InterfaceNameRenumberReply{} } +func (*InterfaceNameRenumberReply) GetMessageName() string { return "interface_name_renumber_reply" } +func (*InterfaceNameRenumberReply) GetCrcString() string { return "e8d4e804" } +func (*InterfaceNameRenumberReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *InterfaceNameRenumberReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *InterfaceNameRenumberReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *InterfaceNameRenumberReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceAddDelAddress represents VPP binary API message 'sw_interface_add_del_address'. +type SwInterfaceAddDelAddress struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + DelAll bool `binapi:"bool,name=del_all" json:"del_all,omitempty"` + Prefix AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` +} + +func (m *SwInterfaceAddDelAddress) Reset() { *m = SwInterfaceAddDelAddress{} } +func (*SwInterfaceAddDelAddress) GetMessageName() string { return "sw_interface_add_del_address" } +func (*SwInterfaceAddDelAddress) GetCrcString() string { return "5803d5c4" } +func (*SwInterfaceAddDelAddress) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceAddDelAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsAdd + size += 1 + // field[1] m.DelAll + size += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 4 + // field[3] m.Prefix.Address.Un + size += 16 + // field[2] m.Prefix.Len + size += 1 + return size +} +func (m *SwInterfaceAddDelAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.DelAll + if m.DelAll { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 + return buf, nil +} +func (m *SwInterfaceAddDelAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.DelAll + m.DelAll = tmp[pos] != 0 + pos += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 + return nil +} + +// SwInterfaceAddDelAddressReply represents VPP binary API message 'sw_interface_add_del_address_reply'. +type SwInterfaceAddDelAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceAddDelAddressReply) Reset() { *m = SwInterfaceAddDelAddressReply{} } +func (*SwInterfaceAddDelAddressReply) GetMessageName() string { + return "sw_interface_add_del_address_reply" +} +func (*SwInterfaceAddDelAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceAddDelAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceAddDelAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceAddDelAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceAddDelAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceAddDelMacAddress represents VPP binary API message 'sw_interface_add_del_mac_address'. +type SwInterfaceAddDelMacAddress struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Addr MacAddress `binapi:"mac_address,name=addr" json:"addr,omitempty"` + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` +} + +func (m *SwInterfaceAddDelMacAddress) Reset() { *m = SwInterfaceAddDelMacAddress{} } +func (*SwInterfaceAddDelMacAddress) GetMessageName() string { + return "sw_interface_add_del_mac_address" +} +func (*SwInterfaceAddDelMacAddress) GetCrcString() string { return "638bb9f4" } +func (*SwInterfaceAddDelMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceAddDelMacAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Addr + size += 6 + // field[1] m.IsAdd + size += 1 + return size +} +func (m *SwInterfaceAddDelMacAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Addr + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.Addr) { + x = uint8(m.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.IsAdd + buf[pos] = uint8(m.IsAdd) + pos += 1 + return buf, nil +} +func (m *SwInterfaceAddDelMacAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Addr + for i := 0; i < len(m.Addr); i++ { + m.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.IsAdd + m.IsAdd = uint8(tmp[pos]) + pos += 1 + return nil +} + +// SwInterfaceAddDelMacAddressReply represents VPP binary API message 'sw_interface_add_del_mac_address_reply'. +type SwInterfaceAddDelMacAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceAddDelMacAddressReply) Reset() { *m = SwInterfaceAddDelMacAddressReply{} } +func (*SwInterfaceAddDelMacAddressReply) GetMessageName() string { + return "sw_interface_add_del_mac_address_reply" +} +func (*SwInterfaceAddDelMacAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceAddDelMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceAddDelMacAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceAddDelMacAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceAddDelMacAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceClearStats represents VPP binary API message 'sw_interface_clear_stats'. +type SwInterfaceClearStats struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceClearStats) Reset() { *m = SwInterfaceClearStats{} } +func (*SwInterfaceClearStats) GetMessageName() string { return "sw_interface_clear_stats" } +func (*SwInterfaceClearStats) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceClearStats) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceClearStats) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *SwInterfaceClearStats) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceClearStats) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceClearStatsReply represents VPP binary API message 'sw_interface_clear_stats_reply'. +type SwInterfaceClearStatsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceClearStatsReply) Reset() { *m = SwInterfaceClearStatsReply{} } +func (*SwInterfaceClearStatsReply) GetMessageName() string { return "sw_interface_clear_stats_reply" } +func (*SwInterfaceClearStatsReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceClearStatsReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceClearStatsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceClearStatsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceClearStatsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceDetails represents VPP binary API message 'sw_interface_details'. +type SwInterfaceDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SupSwIfIndex uint32 `binapi:"u32,name=sup_sw_if_index" json:"sup_sw_if_index,omitempty"` + L2Address MacAddress `binapi:"mac_address,name=l2_address" json:"l2_address,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + Type IfType `binapi:"if_type,name=type" json:"type,omitempty"` + LinkDuplex LinkDuplex `binapi:"link_duplex,name=link_duplex" json:"link_duplex,omitempty"` + LinkSpeed uint32 `binapi:"u32,name=link_speed" json:"link_speed,omitempty"` + LinkMtu uint16 `binapi:"u16,name=link_mtu" json:"link_mtu,omitempty"` + Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty" struc:"[4]uint32"` + SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` + SubNumberOfTags uint8 `binapi:"u8,name=sub_number_of_tags" json:"sub_number_of_tags,omitempty"` + SubOuterVlanID uint16 `binapi:"u16,name=sub_outer_vlan_id" json:"sub_outer_vlan_id,omitempty"` + SubInnerVlanID uint16 `binapi:"u16,name=sub_inner_vlan_id" json:"sub_inner_vlan_id,omitempty"` + SubIfFlags SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` + VtrOp uint32 `binapi:"u32,name=vtr_op" json:"vtr_op,omitempty"` + VtrPushDot1q uint32 `binapi:"u32,name=vtr_push_dot1q" json:"vtr_push_dot1q,omitempty"` + VtrTag1 uint32 `binapi:"u32,name=vtr_tag1" json:"vtr_tag1,omitempty"` + VtrTag2 uint32 `binapi:"u32,name=vtr_tag2" json:"vtr_tag2,omitempty"` + OuterTag uint16 `binapi:"u16,name=outer_tag" json:"outer_tag,omitempty"` + BDmac MacAddress `binapi:"mac_address,name=b_dmac" json:"b_dmac,omitempty"` + BSmac MacAddress `binapi:"mac_address,name=b_smac" json:"b_smac,omitempty"` + BVlanid uint16 `binapi:"u16,name=b_vlanid" json:"b_vlanid,omitempty"` + ISid uint32 `binapi:"u32,name=i_sid" json:"i_sid,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty" struc:"[64]byte"` + InterfaceDevType string `binapi:"string[64],name=interface_dev_type" json:"interface_dev_type,omitempty" struc:"[64]byte"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` +} + +func (m *SwInterfaceDetails) Reset() { *m = SwInterfaceDetails{} } +func (*SwInterfaceDetails) GetMessageName() string { return "sw_interface_details" } +func (*SwInterfaceDetails) GetCrcString() string { return "17b69fa2" } +func (*SwInterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.SupSwIfIndex + size += 4 + // field[1] m.L2Address + size += 6 + // field[1] m.Flags + size += 4 + // field[1] m.Type + size += 4 + // field[1] m.LinkDuplex + size += 4 + // field[1] m.LinkSpeed + size += 4 + // field[1] m.LinkMtu + size += 2 + // field[1] m.Mtu + size += 16 + // field[1] m.SubID + size += 4 + // field[1] m.SubNumberOfTags + size += 1 + // field[1] m.SubOuterVlanID + size += 2 + // field[1] m.SubInnerVlanID + size += 2 + // field[1] m.SubIfFlags + size += 4 + // field[1] m.VtrOp + size += 4 + // field[1] m.VtrPushDot1q + size += 4 + // field[1] m.VtrTag1 + size += 4 + // field[1] m.VtrTag2 + size += 4 + // field[1] m.OuterTag + size += 2 + // field[1] m.BDmac + size += 6 + // field[1] m.BSmac + size += 6 + // field[1] m.BVlanid + size += 2 + // field[1] m.ISid + size += 4 + // field[1] m.InterfaceName + size += 64 + // field[1] m.InterfaceDevType + size += 64 + // field[1] m.Tag + size += 64 + return size +} +func (m *SwInterfaceDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.SupSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SupSwIfIndex)) + pos += 4 + // field[1] m.L2Address + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.L2Address) { + x = uint8(m.L2Address[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Flags + o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) + pos += 4 + // field[1] m.Type + o.PutUint32(buf[pos:pos+4], uint32(m.Type)) + pos += 4 + // field[1] m.LinkDuplex + o.PutUint32(buf[pos:pos+4], uint32(m.LinkDuplex)) + pos += 4 + // field[1] m.LinkSpeed + o.PutUint32(buf[pos:pos+4], uint32(m.LinkSpeed)) + pos += 4 + // field[1] m.LinkMtu + o.PutUint16(buf[pos:pos+2], uint16(m.LinkMtu)) + pos += 2 + // field[1] m.Mtu + for i := 0; i < 4; i++ { + var x uint32 + if i < len(m.Mtu) { + x = uint32(m.Mtu[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + // field[1] m.SubID + o.PutUint32(buf[pos:pos+4], uint32(m.SubID)) + pos += 4 + // field[1] m.SubNumberOfTags + buf[pos] = uint8(m.SubNumberOfTags) + pos += 1 + // field[1] m.SubOuterVlanID + o.PutUint16(buf[pos:pos+2], uint16(m.SubOuterVlanID)) + pos += 2 + // field[1] m.SubInnerVlanID + o.PutUint16(buf[pos:pos+2], uint16(m.SubInnerVlanID)) + pos += 2 + // field[1] m.SubIfFlags + o.PutUint32(buf[pos:pos+4], uint32(m.SubIfFlags)) + pos += 4 + // field[1] m.VtrOp + o.PutUint32(buf[pos:pos+4], uint32(m.VtrOp)) + pos += 4 + // field[1] m.VtrPushDot1q + o.PutUint32(buf[pos:pos+4], uint32(m.VtrPushDot1q)) + pos += 4 + // field[1] m.VtrTag1 + o.PutUint32(buf[pos:pos+4], uint32(m.VtrTag1)) + pos += 4 + // field[1] m.VtrTag2 + o.PutUint32(buf[pos:pos+4], uint32(m.VtrTag2)) + pos += 4 + // field[1] m.OuterTag + o.PutUint16(buf[pos:pos+2], uint16(m.OuterTag)) + pos += 2 + // field[1] m.BDmac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.BDmac) { + x = uint8(m.BDmac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.BSmac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.BSmac) { + x = uint8(m.BSmac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.BVlanid + o.PutUint16(buf[pos:pos+2], uint16(m.BVlanid)) + pos += 2 + // field[1] m.ISid + o.PutUint32(buf[pos:pos+4], uint32(m.ISid)) + pos += 4 + // field[1] m.InterfaceName + copy(buf[pos:pos+64], m.InterfaceName) + pos += 64 + // field[1] m.InterfaceDevType + copy(buf[pos:pos+64], m.InterfaceDevType) + pos += 64 + // field[1] m.Tag + copy(buf[pos:pos+64], m.Tag) + pos += 64 + return buf, nil +} +func (m *SwInterfaceDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SupSwIfIndex + m.SupSwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.L2Address + for i := 0; i < len(m.L2Address); i++ { + m.L2Address[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Flags + m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Type + m.Type = IfType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.LinkDuplex + m.LinkDuplex = LinkDuplex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.LinkSpeed + m.LinkSpeed = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.LinkMtu + m.LinkMtu = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.Mtu + m.Mtu = make([]uint32, 4) + for i := 0; i < len(m.Mtu); i++ { + m.Mtu[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + // field[1] m.SubID + m.SubID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SubNumberOfTags + m.SubNumberOfTags = uint8(tmp[pos]) + pos += 1 + // field[1] m.SubOuterVlanID + m.SubOuterVlanID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.SubInnerVlanID + m.SubInnerVlanID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.SubIfFlags + m.SubIfFlags = SubIfFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VtrOp + m.VtrOp = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VtrPushDot1q + m.VtrPushDot1q = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VtrTag1 + m.VtrTag1 = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VtrTag2 + m.VtrTag2 = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.OuterTag + m.OuterTag = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.BDmac + for i := 0; i < len(m.BDmac); i++ { + m.BDmac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.BSmac + for i := 0; i < len(m.BSmac); i++ { + m.BSmac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.BVlanid + m.BVlanid = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.ISid + m.ISid = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.InterfaceName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.InterfaceName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + // field[1] m.InterfaceDevType + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.InterfaceDevType = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + // field[1] m.Tag + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// SwInterfaceDump represents VPP binary API message 'sw_interface_dump'. +type SwInterfaceDump struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` + NameFilterValid bool `binapi:"bool,name=name_filter_valid" json:"name_filter_valid,omitempty"` + XXX_NameFilterLen uint32 `struc:"sizeof=NameFilter"` + NameFilter string `json:"name_filter,omitempty"` +} + +func (m *SwInterfaceDump) Reset() { *m = SwInterfaceDump{} } +func (*SwInterfaceDump) GetMessageName() string { return "sw_interface_dump" } +func (*SwInterfaceDump) GetCrcString() string { return "aa610c27" } +func (*SwInterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.NameFilterValid + size += 1 + // field[1] m.NameFilter + size += 4 + len(m.NameFilter) + return size +} +func (m *SwInterfaceDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.NameFilterValid + if m.NameFilterValid { + buf[pos] = 1 + } + pos += 1 + // field[1] m.NameFilter + o.PutUint32(buf[pos:pos+4], uint32(len(m.NameFilter))) + pos += 4 + copy(buf[pos:pos+len(m.NameFilter)], m.NameFilter[:]) + pos += len(m.NameFilter) + return buf, nil +} +func (m *SwInterfaceDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NameFilterValid + m.NameFilterValid = tmp[pos] != 0 + pos += 1 + // field[1] m.NameFilter + { + siz := o.Uint32(tmp[pos : pos+4]) + pos += 4 + m.NameFilter = codec.DecodeString(tmp[pos : pos+int(siz)]) + pos += len(m.NameFilter) + } + return nil +} + +// SwInterfaceEvent represents VPP binary API message 'sw_interface_event'. +type SwInterfaceEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + Deleted bool `binapi:"bool,name=deleted" json:"deleted,omitempty"` +} + +func (m *SwInterfaceEvent) Reset() { *m = SwInterfaceEvent{} } +func (*SwInterfaceEvent) GetMessageName() string { return "sw_interface_event" } +func (*SwInterfaceEvent) GetCrcString() string { return "f709f78d" } +func (*SwInterfaceEvent) GetMessageType() api.MessageType { return api.EventMessage } + +func (m *SwInterfaceEvent) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.PID + size += 4 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Flags + size += 4 + // field[1] m.Deleted + size += 1 + return size +} +func (m *SwInterfaceEvent) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.PID + o.PutUint32(buf[pos:pos+4], uint32(m.PID)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Flags + o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) + pos += 4 + // field[1] m.Deleted + if m.Deleted { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceEvent) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.PID + m.PID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Flags + m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Deleted + m.Deleted = tmp[pos] != 0 + pos += 1 + return nil +} + +// SwInterfaceGetMacAddress represents VPP binary API message 'sw_interface_get_mac_address'. +type SwInterfaceGetMacAddress struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceGetMacAddress) Reset() { *m = SwInterfaceGetMacAddress{} } +func (*SwInterfaceGetMacAddress) GetMessageName() string { return "sw_interface_get_mac_address" } +func (*SwInterfaceGetMacAddress) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceGetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceGetMacAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *SwInterfaceGetMacAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceGetMacAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceGetMacAddressReply represents VPP binary API message 'sw_interface_get_mac_address_reply'. +type SwInterfaceGetMacAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` +} + +func (m *SwInterfaceGetMacAddressReply) Reset() { *m = SwInterfaceGetMacAddressReply{} } +func (*SwInterfaceGetMacAddressReply) GetMessageName() string { + return "sw_interface_get_mac_address_reply" +} +func (*SwInterfaceGetMacAddressReply) GetCrcString() string { return "40ef2c08" } +func (*SwInterfaceGetMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceGetMacAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.MacAddress + size += 6 + return size +} +func (m *SwInterfaceGetMacAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.MacAddress + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.MacAddress) { + x = uint8(m.MacAddress[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SwInterfaceGetMacAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MacAddress + for i := 0; i < len(m.MacAddress); i++ { + m.MacAddress[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SwInterfaceGetTable represents VPP binary API message 'sw_interface_get_table'. +type SwInterfaceGetTable struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *SwInterfaceGetTable) Reset() { *m = SwInterfaceGetTable{} } +func (*SwInterfaceGetTable) GetMessageName() string { return "sw_interface_get_table" } +func (*SwInterfaceGetTable) GetCrcString() string { return "2d033de4" } +func (*SwInterfaceGetTable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceGetTable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *SwInterfaceGetTable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceGetTable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + +// SwInterfaceGetTableReply represents VPP binary API message 'sw_interface_get_table_reply'. +type SwInterfaceGetTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *SwInterfaceGetTableReply) Reset() { *m = SwInterfaceGetTableReply{} } +func (*SwInterfaceGetTableReply) GetMessageName() string { return "sw_interface_get_table_reply" } +func (*SwInterfaceGetTableReply) GetCrcString() string { return "a6eb0109" } +func (*SwInterfaceGetTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceGetTableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.VrfID + size += 4 + return size +} +func (m *SwInterfaceGetTableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.VrfID + o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceGetTableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VrfID + m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceRxPlacementDetails represents VPP binary API message 'sw_interface_rx_placement_details'. +type SwInterfaceRxPlacementDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` + Mode RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` +} + +func (m *SwInterfaceRxPlacementDetails) Reset() { *m = SwInterfaceRxPlacementDetails{} } +func (*SwInterfaceRxPlacementDetails) GetMessageName() string { + return "sw_interface_rx_placement_details" +} +func (*SwInterfaceRxPlacementDetails) GetCrcString() string { return "f6d7d024" } +func (*SwInterfaceRxPlacementDetails) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceRxPlacementDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.QueueID + size += 4 + // field[1] m.WorkerID + size += 4 + // field[1] m.Mode + size += 4 + return size +} +func (m *SwInterfaceRxPlacementDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.QueueID + o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) + pos += 4 + // field[1] m.WorkerID + o.PutUint32(buf[pos:pos+4], uint32(m.WorkerID)) + pos += 4 + // field[1] m.Mode + o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceRxPlacementDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.QueueID + m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.WorkerID + m.WorkerID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mode + m.Mode = RxMode(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceRxPlacementDump represents VPP binary API message 'sw_interface_rx_placement_dump'. +type SwInterfaceRxPlacementDump struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceRxPlacementDump) Reset() { *m = SwInterfaceRxPlacementDump{} } +func (*SwInterfaceRxPlacementDump) GetMessageName() string { return "sw_interface_rx_placement_dump" } +func (*SwInterfaceRxPlacementDump) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceRxPlacementDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceRxPlacementDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *SwInterfaceRxPlacementDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceRxPlacementDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetFlags represents VPP binary API message 'sw_interface_set_flags'. +type SwInterfaceSetFlags struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` +} + +func (m *SwInterfaceSetFlags) Reset() { *m = SwInterfaceSetFlags{} } +func (*SwInterfaceSetFlags) GetMessageName() string { return "sw_interface_set_flags" } +func (*SwInterfaceSetFlags) GetCrcString() string { return "6a2b491a" } +func (*SwInterfaceSetFlags) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetFlags) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Flags + size += 4 + return size +} +func (m *SwInterfaceSetFlags) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Flags + o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetFlags) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Flags + m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetFlagsReply represents VPP binary API message 'sw_interface_set_flags_reply'. +type SwInterfaceSetFlagsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetFlagsReply) Reset() { *m = SwInterfaceSetFlagsReply{} } +func (*SwInterfaceSetFlagsReply) GetMessageName() string { return "sw_interface_set_flags_reply" } +func (*SwInterfaceSetFlagsReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetFlagsReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceSetFlagsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetFlagsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetFlagsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetIPDirectedBroadcast represents VPP binary API message 'sw_interface_set_ip_directed_broadcast'. +type SwInterfaceSetIPDirectedBroadcast struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *SwInterfaceSetIPDirectedBroadcast) Reset() { *m = SwInterfaceSetIPDirectedBroadcast{} } +func (*SwInterfaceSetIPDirectedBroadcast) GetMessageName() string { + return "sw_interface_set_ip_directed_broadcast" +} +func (*SwInterfaceSetIPDirectedBroadcast) GetCrcString() string { return "ae6cfcfb" } +func (*SwInterfaceSetIPDirectedBroadcast) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetIPDirectedBroadcast) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Enable + size += 1 + return size +} +func (m *SwInterfaceSetIPDirectedBroadcast) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Enable + if m.Enable { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceSetIPDirectedBroadcast) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Enable + m.Enable = tmp[pos] != 0 + pos += 1 + return nil +} + +// SwInterfaceSetIPDirectedBroadcastReply represents VPP binary API message 'sw_interface_set_ip_directed_broadcast_reply'. +type SwInterfaceSetIPDirectedBroadcastReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetIPDirectedBroadcastReply) Reset() { + *m = SwInterfaceSetIPDirectedBroadcastReply{} +} +func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageName() string { + return "sw_interface_set_ip_directed_broadcast_reply" +} +func (*SwInterfaceSetIPDirectedBroadcastReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetIPDirectedBroadcastReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetIPDirectedBroadcastReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetIPDirectedBroadcastReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetMacAddress represents VPP binary API message 'sw_interface_set_mac_address'. +type SwInterfaceSetMacAddress struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` +} + +func (m *SwInterfaceSetMacAddress) Reset() { *m = SwInterfaceSetMacAddress{} } +func (*SwInterfaceSetMacAddress) GetMessageName() string { return "sw_interface_set_mac_address" } +func (*SwInterfaceSetMacAddress) GetCrcString() string { return "6aca746a" } +func (*SwInterfaceSetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetMacAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.MacAddress + size += 6 + return size +} +func (m *SwInterfaceSetMacAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.MacAddress + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.MacAddress) { + x = uint8(m.MacAddress[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SwInterfaceSetMacAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MacAddress + for i := 0; i < len(m.MacAddress); i++ { + m.MacAddress[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SwInterfaceSetMacAddressReply represents VPP binary API message 'sw_interface_set_mac_address_reply'. +type SwInterfaceSetMacAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetMacAddressReply) Reset() { *m = SwInterfaceSetMacAddressReply{} } +func (*SwInterfaceSetMacAddressReply) GetMessageName() string { + return "sw_interface_set_mac_address_reply" +} +func (*SwInterfaceSetMacAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceSetMacAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetMacAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetMacAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetMtu represents VPP binary API message 'sw_interface_set_mtu'. +type SwInterfaceSetMtu struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty" struc:"[4]uint32"` +} + +func (m *SwInterfaceSetMtu) Reset() { *m = SwInterfaceSetMtu{} } +func (*SwInterfaceSetMtu) GetMessageName() string { return "sw_interface_set_mtu" } +func (*SwInterfaceSetMtu) GetCrcString() string { return "5cbe85e5" } +func (*SwInterfaceSetMtu) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetMtu) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Mtu + size += 16 + return size +} +func (m *SwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Mtu + for i := 0; i < 4; i++ { + var x uint32 + if i < len(m.Mtu) { + x = uint32(m.Mtu[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *SwInterfaceSetMtu) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mtu + m.Mtu = make([]uint32, 4) + for i := 0; i < len(m.Mtu); i++ { + m.Mtu[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + +// SwInterfaceSetMtuReply represents VPP binary API message 'sw_interface_set_mtu_reply'. +type SwInterfaceSetMtuReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetMtuReply) Reset() { *m = SwInterfaceSetMtuReply{} } +func (*SwInterfaceSetMtuReply) GetMessageName() string { return "sw_interface_set_mtu_reply" } +func (*SwInterfaceSetMtuReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetMtuReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceSetMtuReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetMtuReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetMtuReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetRxMode represents VPP binary API message 'sw_interface_set_rx_mode'. +type SwInterfaceSetRxMode struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueIDValid bool `binapi:"bool,name=queue_id_valid" json:"queue_id_valid,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + Mode RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` +} + +func (m *SwInterfaceSetRxMode) Reset() { *m = SwInterfaceSetRxMode{} } +func (*SwInterfaceSetRxMode) GetMessageName() string { return "sw_interface_set_rx_mode" } +func (*SwInterfaceSetRxMode) GetCrcString() string { return "780f5cee" } +func (*SwInterfaceSetRxMode) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetRxMode) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.QueueIDValid + size += 1 + // field[1] m.QueueID + size += 4 + // field[1] m.Mode + size += 4 + return size +} +func (m *SwInterfaceSetRxMode) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.QueueIDValid + if m.QueueIDValid { + buf[pos] = 1 + } + pos += 1 + // field[1] m.QueueID + o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) + pos += 4 + // field[1] m.Mode + o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetRxMode) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.QueueIDValid + m.QueueIDValid = tmp[pos] != 0 + pos += 1 + // field[1] m.QueueID + m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mode + m.Mode = RxMode(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetRxModeReply represents VPP binary API message 'sw_interface_set_rx_mode_reply'. +type SwInterfaceSetRxModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetRxModeReply) Reset() { *m = SwInterfaceSetRxModeReply{} } +func (*SwInterfaceSetRxModeReply) GetMessageName() string { return "sw_interface_set_rx_mode_reply" } +func (*SwInterfaceSetRxModeReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetRxModeReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceSetRxModeReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetRxModeReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetRxModeReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetRxPlacement represents VPP binary API message 'sw_interface_set_rx_placement'. +type SwInterfaceSetRxPlacement struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` + IsMain bool `binapi:"bool,name=is_main" json:"is_main,omitempty"` +} + +func (m *SwInterfaceSetRxPlacement) Reset() { *m = SwInterfaceSetRxPlacement{} } +func (*SwInterfaceSetRxPlacement) GetMessageName() string { return "sw_interface_set_rx_placement" } +func (*SwInterfaceSetRxPlacement) GetCrcString() string { return "db65f3c9" } +func (*SwInterfaceSetRxPlacement) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetRxPlacement) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.QueueID + size += 4 + // field[1] m.WorkerID + size += 4 + // field[1] m.IsMain + size += 1 + return size +} +func (m *SwInterfaceSetRxPlacement) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.QueueID + o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) + pos += 4 + // field[1] m.WorkerID + o.PutUint32(buf[pos:pos+4], uint32(m.WorkerID)) + pos += 4 + // field[1] m.IsMain + if m.IsMain { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceSetRxPlacement) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.QueueID + m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.WorkerID + m.WorkerID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsMain + m.IsMain = tmp[pos] != 0 + pos += 1 + return nil +} + +// SwInterfaceSetRxPlacementReply represents VPP binary API message 'sw_interface_set_rx_placement_reply'. +type SwInterfaceSetRxPlacementReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetRxPlacementReply) Reset() { *m = SwInterfaceSetRxPlacementReply{} } +func (*SwInterfaceSetRxPlacementReply) GetMessageName() string { + return "sw_interface_set_rx_placement_reply" +} +func (*SwInterfaceSetRxPlacementReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetRxPlacementReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceSetRxPlacementReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetRxPlacementReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetRxPlacementReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetTable represents VPP binary API message 'sw_interface_set_table'. +type SwInterfaceSetTable struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *SwInterfaceSetTable) Reset() { *m = SwInterfaceSetTable{} } +func (*SwInterfaceSetTable) GetMessageName() string { return "sw_interface_set_table" } +func (*SwInterfaceSetTable) GetCrcString() string { return "df42a577" } +func (*SwInterfaceSetTable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetTable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + // field[1] m.VrfID + size += 4 + return size +} +func (m *SwInterfaceSetTable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.VrfID + o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetTable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + // field[1] m.VrfID + m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetTableReply represents VPP binary API message 'sw_interface_set_table_reply'. +type SwInterfaceSetTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetTableReply) Reset() { *m = SwInterfaceSetTableReply{} } +func (*SwInterfaceSetTableReply) GetMessageName() string { return "sw_interface_set_table_reply" } +func (*SwInterfaceSetTableReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceSetTableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetTableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetTableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetUnnumbered represents VPP binary API message 'sw_interface_set_unnumbered'. +type SwInterfaceSetUnnumbered struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + UnnumberedSwIfIndex InterfaceIndex `binapi:"interface_index,name=unnumbered_sw_if_index" json:"unnumbered_sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *SwInterfaceSetUnnumbered) Reset() { *m = SwInterfaceSetUnnumbered{} } +func (*SwInterfaceSetUnnumbered) GetMessageName() string { return "sw_interface_set_unnumbered" } +func (*SwInterfaceSetUnnumbered) GetCrcString() string { return "938ef33b" } +func (*SwInterfaceSetUnnumbered) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetUnnumbered) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.UnnumberedSwIfIndex + size += 4 + // field[1] m.IsAdd + size += 1 + return size +} +func (m *SwInterfaceSetUnnumbered) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.UnnumberedSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.UnnumberedSwIfIndex)) + pos += 4 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceSetUnnumbered) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.UnnumberedSwIfIndex + m.UnnumberedSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + return nil +} + +// SwInterfaceSetUnnumberedReply represents VPP binary API message 'sw_interface_set_unnumbered_reply'. +type SwInterfaceSetUnnumberedReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetUnnumberedReply) Reset() { *m = SwInterfaceSetUnnumberedReply{} } +func (*SwInterfaceSetUnnumberedReply) GetMessageName() string { + return "sw_interface_set_unnumbered_reply" +} +func (*SwInterfaceSetUnnumberedReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetUnnumberedReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceSetUnnumberedReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetUnnumberedReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetUnnumberedReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceTagAddDel represents VPP binary API message 'sw_interface_tag_add_del'. +type SwInterfaceTagAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` +} + +func (m *SwInterfaceTagAddDel) Reset() { *m = SwInterfaceTagAddDel{} } +func (*SwInterfaceTagAddDel) GetMessageName() string { return "sw_interface_tag_add_del" } +func (*SwInterfaceTagAddDel) GetCrcString() string { return "426f8bc1" } +func (*SwInterfaceTagAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceTagAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Tag + size += 64 + return size +} +func (m *SwInterfaceTagAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Tag + copy(buf[pos:pos+64], m.Tag) + pos += 64 + return buf, nil +} +func (m *SwInterfaceTagAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// SwInterfaceTagAddDelReply represents VPP binary API message 'sw_interface_tag_add_del_reply'. +type SwInterfaceTagAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceTagAddDelReply) Reset() { *m = SwInterfaceTagAddDelReply{} } +func (*SwInterfaceTagAddDelReply) GetMessageName() string { return "sw_interface_tag_add_del_reply" } +func (*SwInterfaceTagAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceTagAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceTagAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceTagAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceTagAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// WantInterfaceEvents represents VPP binary API message 'want_interface_events'. +type WantInterfaceEvents struct { + EnableDisable uint32 `binapi:"u32,name=enable_disable" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantInterfaceEvents) Reset() { *m = WantInterfaceEvents{} } +func (*WantInterfaceEvents) GetMessageName() string { return "want_interface_events" } +func (*WantInterfaceEvents) GetCrcString() string { return "476f5a08" } +func (*WantInterfaceEvents) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *WantInterfaceEvents) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.EnableDisable + size += 4 + // field[1] m.PID + size += 4 + return size +} +func (m *WantInterfaceEvents) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.EnableDisable + o.PutUint32(buf[pos:pos+4], uint32(m.EnableDisable)) + pos += 4 + // field[1] m.PID + o.PutUint32(buf[pos:pos+4], uint32(m.PID)) + pos += 4 + return buf, nil +} +func (m *WantInterfaceEvents) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.EnableDisable + m.EnableDisable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.PID + m.PID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// WantInterfaceEventsReply represents VPP binary API message 'want_interface_events_reply'. +type WantInterfaceEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantInterfaceEventsReply) Reset() { *m = WantInterfaceEventsReply{} } +func (*WantInterfaceEventsReply) GetMessageName() string { return "want_interface_events_reply" } +func (*WantInterfaceEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantInterfaceEventsReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *WantInterfaceEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *WantInterfaceEventsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *WantInterfaceEventsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +func init() { file_interfaces_binapi_init() } +func file_interfaces_binapi_init() { + api.RegisterMessage((*CollectDetailedInterfaceStats)(nil), "interface.CollectDetailedInterfaceStats") + api.RegisterMessage((*CollectDetailedInterfaceStatsReply)(nil), "interface.CollectDetailedInterfaceStatsReply") + api.RegisterMessage((*CreateLoopback)(nil), "interface.CreateLoopback") + api.RegisterMessage((*CreateLoopbackInstance)(nil), "interface.CreateLoopbackInstance") + api.RegisterMessage((*CreateLoopbackInstanceReply)(nil), "interface.CreateLoopbackInstanceReply") + api.RegisterMessage((*CreateLoopbackReply)(nil), "interface.CreateLoopbackReply") + api.RegisterMessage((*CreateSubif)(nil), "interface.CreateSubif") + api.RegisterMessage((*CreateSubifReply)(nil), "interface.CreateSubifReply") + api.RegisterMessage((*CreateVlanSubif)(nil), "interface.CreateVlanSubif") + api.RegisterMessage((*CreateVlanSubifReply)(nil), "interface.CreateVlanSubifReply") + api.RegisterMessage((*DeleteLoopback)(nil), "interface.DeleteLoopback") + api.RegisterMessage((*DeleteLoopbackReply)(nil), "interface.DeleteLoopbackReply") + api.RegisterMessage((*DeleteSubif)(nil), "interface.DeleteSubif") + api.RegisterMessage((*DeleteSubifReply)(nil), "interface.DeleteSubifReply") + api.RegisterMessage((*HwInterfaceSetMtu)(nil), "interface.HwInterfaceSetMtu") + api.RegisterMessage((*HwInterfaceSetMtuReply)(nil), "interface.HwInterfaceSetMtuReply") + api.RegisterMessage((*InterfaceNameRenumber)(nil), "interface.InterfaceNameRenumber") + api.RegisterMessage((*InterfaceNameRenumberReply)(nil), "interface.InterfaceNameRenumberReply") + api.RegisterMessage((*SwInterfaceAddDelAddress)(nil), "interface.SwInterfaceAddDelAddress") + api.RegisterMessage((*SwInterfaceAddDelAddressReply)(nil), "interface.SwInterfaceAddDelAddressReply") + api.RegisterMessage((*SwInterfaceAddDelMacAddress)(nil), "interface.SwInterfaceAddDelMacAddress") + api.RegisterMessage((*SwInterfaceAddDelMacAddressReply)(nil), "interface.SwInterfaceAddDelMacAddressReply") + api.RegisterMessage((*SwInterfaceClearStats)(nil), "interface.SwInterfaceClearStats") + api.RegisterMessage((*SwInterfaceClearStatsReply)(nil), "interface.SwInterfaceClearStatsReply") + api.RegisterMessage((*SwInterfaceDetails)(nil), "interface.SwInterfaceDetails") + api.RegisterMessage((*SwInterfaceDump)(nil), "interface.SwInterfaceDump") + api.RegisterMessage((*SwInterfaceEvent)(nil), "interface.SwInterfaceEvent") + api.RegisterMessage((*SwInterfaceGetMacAddress)(nil), "interface.SwInterfaceGetMacAddress") + api.RegisterMessage((*SwInterfaceGetMacAddressReply)(nil), "interface.SwInterfaceGetMacAddressReply") + api.RegisterMessage((*SwInterfaceGetTable)(nil), "interface.SwInterfaceGetTable") + api.RegisterMessage((*SwInterfaceGetTableReply)(nil), "interface.SwInterfaceGetTableReply") + api.RegisterMessage((*SwInterfaceRxPlacementDetails)(nil), "interface.SwInterfaceRxPlacementDetails") + api.RegisterMessage((*SwInterfaceRxPlacementDump)(nil), "interface.SwInterfaceRxPlacementDump") + api.RegisterMessage((*SwInterfaceSetFlags)(nil), "interface.SwInterfaceSetFlags") + api.RegisterMessage((*SwInterfaceSetFlagsReply)(nil), "interface.SwInterfaceSetFlagsReply") + api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcast)(nil), "interface.SwInterfaceSetIPDirectedBroadcast") + api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcastReply)(nil), "interface.SwInterfaceSetIPDirectedBroadcastReply") + api.RegisterMessage((*SwInterfaceSetMacAddress)(nil), "interface.SwInterfaceSetMacAddress") + api.RegisterMessage((*SwInterfaceSetMacAddressReply)(nil), "interface.SwInterfaceSetMacAddressReply") + api.RegisterMessage((*SwInterfaceSetMtu)(nil), "interface.SwInterfaceSetMtu") + api.RegisterMessage((*SwInterfaceSetMtuReply)(nil), "interface.SwInterfaceSetMtuReply") + api.RegisterMessage((*SwInterfaceSetRxMode)(nil), "interface.SwInterfaceSetRxMode") + api.RegisterMessage((*SwInterfaceSetRxModeReply)(nil), "interface.SwInterfaceSetRxModeReply") + api.RegisterMessage((*SwInterfaceSetRxPlacement)(nil), "interface.SwInterfaceSetRxPlacement") + api.RegisterMessage((*SwInterfaceSetRxPlacementReply)(nil), "interface.SwInterfaceSetRxPlacementReply") + api.RegisterMessage((*SwInterfaceSetTable)(nil), "interface.SwInterfaceSetTable") + api.RegisterMessage((*SwInterfaceSetTableReply)(nil), "interface.SwInterfaceSetTableReply") + api.RegisterMessage((*SwInterfaceSetUnnumbered)(nil), "interface.SwInterfaceSetUnnumbered") + api.RegisterMessage((*SwInterfaceSetUnnumberedReply)(nil), "interface.SwInterfaceSetUnnumberedReply") + api.RegisterMessage((*SwInterfaceTagAddDel)(nil), "interface.SwInterfaceTagAddDel") + api.RegisterMessage((*SwInterfaceTagAddDelReply)(nil), "interface.SwInterfaceTagAddDelReply") + api.RegisterMessage((*WantInterfaceEvents)(nil), "interface.WantInterfaceEvents") + api.RegisterMessage((*WantInterfaceEventsReply)(nil), "interface.WantInterfaceEventsReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CollectDetailedInterfaceStats)(nil), + (*CollectDetailedInterfaceStatsReply)(nil), + (*CreateLoopback)(nil), + (*CreateLoopbackInstance)(nil), + (*CreateLoopbackInstanceReply)(nil), + (*CreateLoopbackReply)(nil), + (*CreateSubif)(nil), + (*CreateSubifReply)(nil), + (*CreateVlanSubif)(nil), + (*CreateVlanSubifReply)(nil), + (*DeleteLoopback)(nil), + (*DeleteLoopbackReply)(nil), + (*DeleteSubif)(nil), + (*DeleteSubifReply)(nil), + (*HwInterfaceSetMtu)(nil), + (*HwInterfaceSetMtuReply)(nil), + (*InterfaceNameRenumber)(nil), + (*InterfaceNameRenumberReply)(nil), + (*SwInterfaceAddDelAddress)(nil), + (*SwInterfaceAddDelAddressReply)(nil), + (*SwInterfaceAddDelMacAddress)(nil), + (*SwInterfaceAddDelMacAddressReply)(nil), + (*SwInterfaceClearStats)(nil), + (*SwInterfaceClearStatsReply)(nil), + (*SwInterfaceDetails)(nil), + (*SwInterfaceDump)(nil), + (*SwInterfaceEvent)(nil), + (*SwInterfaceGetMacAddress)(nil), + (*SwInterfaceGetMacAddressReply)(nil), + (*SwInterfaceGetTable)(nil), + (*SwInterfaceGetTableReply)(nil), + (*SwInterfaceRxPlacementDetails)(nil), + (*SwInterfaceRxPlacementDump)(nil), + (*SwInterfaceSetFlags)(nil), + (*SwInterfaceSetFlagsReply)(nil), + (*SwInterfaceSetIPDirectedBroadcast)(nil), + (*SwInterfaceSetIPDirectedBroadcastReply)(nil), + (*SwInterfaceSetMacAddress)(nil), + (*SwInterfaceSetMacAddressReply)(nil), + (*SwInterfaceSetMtu)(nil), + (*SwInterfaceSetMtuReply)(nil), + (*SwInterfaceSetRxMode)(nil), + (*SwInterfaceSetRxModeReply)(nil), + (*SwInterfaceSetRxPlacement)(nil), + (*SwInterfaceSetRxPlacementReply)(nil), + (*SwInterfaceSetTable)(nil), + (*SwInterfaceSetTableReply)(nil), + (*SwInterfaceSetUnnumbered)(nil), + (*SwInterfaceSetUnnumberedReply)(nil), + (*SwInterfaceTagAddDel)(nil), + (*SwInterfaceTagAddDelReply)(nil), + (*WantInterfaceEvents)(nil), + (*WantInterfaceEventsReply)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/interfaces/interfaces_rpc.ba.go b/codec/testdata/binapi2001/interfaces/interfaces_rpc.ba.go new file mode 100644 index 0000000..e30aed9 --- /dev/null +++ b/codec/testdata/binapi2001/interfaces/interfaces_rpc.ba.go @@ -0,0 +1,321 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package interfaces + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for interface module. +type RPCService interface { + DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) + DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) + CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) + CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) + CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) + CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) + CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) + DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) + DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) + HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) + InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) + SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) + SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) + SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) + SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) + SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) + SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) + SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) + SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) + SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) + SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) + SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) + SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) + SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) + SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) + WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceClient interface { + Recv() (*SwInterfaceDetails, error) +} + +type serviceClient_DumpSwInterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceClient) Recv() (*SwInterfaceDetails, error) { + m := new(SwInterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceRxPlacementClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceRxPlacementClient interface { + Recv() (*SwInterfaceRxPlacementDetails, error) +} + +type serviceClient_DumpSwInterfaceRxPlacementClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceRxPlacementClient) Recv() (*SwInterfaceRxPlacementDetails, error) { + m := new(SwInterfaceRxPlacementDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) { + out := new(CollectDetailedInterfaceStatsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) { + out := new(CreateLoopbackReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) { + out := new(CreateLoopbackInstanceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) { + out := new(CreateSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) { + out := new(CreateVlanSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) { + out := new(DeleteLoopbackReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) { + out := new(DeleteSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) { + out := new(HwInterfaceSetMtuReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) { + out := new(InterfaceNameRenumberReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) { + out := new(SwInterfaceAddDelAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) { + out := new(SwInterfaceAddDelMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) { + out := new(SwInterfaceClearStatsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) { + out := new(SwInterfaceGetMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) { + out := new(SwInterfaceGetTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) { + out := new(SwInterfaceSetFlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) { + out := new(SwInterfaceSetIPDirectedBroadcastReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) { + out := new(SwInterfaceSetMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) { + out := new(SwInterfaceSetMtuReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) { + out := new(SwInterfaceSetRxModeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) { + out := new(SwInterfaceSetRxPlacementReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) { + out := new(SwInterfaceSetTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) { + out := new(SwInterfaceSetUnnumberedReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) { + out := new(SwInterfaceTagAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) { + out := new(WantInterfaceEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/codec/testdata/binapi2001/ip/ip.ba.go b/codec/testdata/binapi2001/ip/ip.ba.go new file mode 100644 index 0000000..ca717ca --- /dev/null +++ b/codec/testdata/binapi2001/ip/ip.ba.go @@ -0,0 +1,5730 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/ip.api.json + +/* +Package ip contains generated code for VPP binary API defined by ip.api (version 3.0.1). + +It consists of: + 7 aliases + 15 enums + 60 messages + 14 types + 1 union +*/ +package ip + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "ip" + // APIVersion is the API version of this module. + APIVersion = "3.0.1" + // VersionCrc is the CRC of this module. + VersionCrc = 0xfc3fea46 +) + +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var ( + AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", + } + AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, + } +) + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return "AddressFamily(" + strconv.Itoa(int(x)) + ")" +} + +// FibPathFlags represents VPP binary API enum 'fib_path_flags'. +type FibPathFlags uint32 + +const ( + FIB_API_PATH_FLAG_NONE FibPathFlags = 0 + FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1 + FIB_API_PATH_FLAG_RESOLVE_VIA_HOST FibPathFlags = 2 + FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4 +) + +var ( + FibPathFlags_name = map[uint32]string{ + 0: "FIB_API_PATH_FLAG_NONE", + 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED", + 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST", + 4: "FIB_API_PATH_FLAG_POP_PW_CW", + } + FibPathFlags_value = map[string]uint32{ + "FIB_API_PATH_FLAG_NONE": 0, + "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1, + "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2, + "FIB_API_PATH_FLAG_POP_PW_CW": 4, + } +) + +func (x FibPathFlags) String() string { + s, ok := FibPathFlags_name[uint32(x)] + if ok { + return s + } + return "FibPathFlags(" + strconv.Itoa(int(x)) + ")" +} + +// FibPathNhProto represents VPP binary API enum 'fib_path_nh_proto'. +type FibPathNhProto uint32 + +const ( + FIB_API_PATH_NH_PROTO_IP4 FibPathNhProto = 0 + FIB_API_PATH_NH_PROTO_IP6 FibPathNhProto = 1 + FIB_API_PATH_NH_PROTO_MPLS FibPathNhProto = 2 + FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3 + FIB_API_PATH_NH_PROTO_BIER FibPathNhProto = 4 +) + +var ( + FibPathNhProto_name = map[uint32]string{ + 0: "FIB_API_PATH_NH_PROTO_IP4", + 1: "FIB_API_PATH_NH_PROTO_IP6", + 2: "FIB_API_PATH_NH_PROTO_MPLS", + 3: "FIB_API_PATH_NH_PROTO_ETHERNET", + 4: "FIB_API_PATH_NH_PROTO_BIER", + } + FibPathNhProto_value = map[string]uint32{ + "FIB_API_PATH_NH_PROTO_IP4": 0, + "FIB_API_PATH_NH_PROTO_IP6": 1, + "FIB_API_PATH_NH_PROTO_MPLS": 2, + "FIB_API_PATH_NH_PROTO_ETHERNET": 3, + "FIB_API_PATH_NH_PROTO_BIER": 4, + } +) + +func (x FibPathNhProto) String() string { + s, ok := FibPathNhProto_name[uint32(x)] + if ok { + return s + } + return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")" +} + +// FibPathType represents VPP binary API enum 'fib_path_type'. +type FibPathType uint32 + +const ( + FIB_API_PATH_TYPE_NORMAL FibPathType = 0 + FIB_API_PATH_TYPE_LOCAL FibPathType = 1 + FIB_API_PATH_TYPE_DROP FibPathType = 2 + FIB_API_PATH_TYPE_UDP_ENCAP FibPathType = 3 + FIB_API_PATH_TYPE_BIER_IMP FibPathType = 4 + FIB_API_PATH_TYPE_ICMP_UNREACH FibPathType = 5 + FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6 + FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7 + FIB_API_PATH_TYPE_DVR FibPathType = 8 + FIB_API_PATH_TYPE_INTERFACE_RX FibPathType = 9 + FIB_API_PATH_TYPE_CLASSIFY FibPathType = 10 +) + +var ( + FibPathType_name = map[uint32]string{ + 0: "FIB_API_PATH_TYPE_NORMAL", + 1: "FIB_API_PATH_TYPE_LOCAL", + 2: "FIB_API_PATH_TYPE_DROP", + 3: "FIB_API_PATH_TYPE_UDP_ENCAP", + 4: "FIB_API_PATH_TYPE_BIER_IMP", + 5: "FIB_API_PATH_TYPE_ICMP_UNREACH", + 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT", + 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP", + 8: "FIB_API_PATH_TYPE_DVR", + 9: "FIB_API_PATH_TYPE_INTERFACE_RX", + 10: "FIB_API_PATH_TYPE_CLASSIFY", + } + FibPathType_value = map[string]uint32{ + "FIB_API_PATH_TYPE_NORMAL": 0, + "FIB_API_PATH_TYPE_LOCAL": 1, + "FIB_API_PATH_TYPE_DROP": 2, + "FIB_API_PATH_TYPE_UDP_ENCAP": 3, + "FIB_API_PATH_TYPE_BIER_IMP": 4, + "FIB_API_PATH_TYPE_ICMP_UNREACH": 5, + "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6, + "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7, + "FIB_API_PATH_TYPE_DVR": 8, + "FIB_API_PATH_TYPE_INTERFACE_RX": 9, + "FIB_API_PATH_TYPE_CLASSIFY": 10, + } +) + +func (x FibPathType) String() string { + s, ok := FibPathType_name[uint32(x)] + if ok { + return s + } + return "FibPathType(" + strconv.Itoa(int(x)) + ")" +} + +// IfStatusFlags represents VPP binary API enum 'if_status_flags'. +type IfStatusFlags uint32 + +const ( + IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 + IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 +) + +var ( + IfStatusFlags_name = map[uint32]string{ + 1: "IF_STATUS_API_FLAG_ADMIN_UP", + 2: "IF_STATUS_API_FLAG_LINK_UP", + } + IfStatusFlags_value = map[string]uint32{ + "IF_STATUS_API_FLAG_ADMIN_UP": 1, + "IF_STATUS_API_FLAG_LINK_UP": 2, + } +) + +func (x IfStatusFlags) String() string { + s, ok := IfStatusFlags_name[uint32(x)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" +} + +// IfType represents VPP binary API enum 'if_type'. +type IfType uint32 + +const ( + IF_API_TYPE_HARDWARE IfType = 1 + IF_API_TYPE_SUB IfType = 2 + IF_API_TYPE_P2P IfType = 3 + IF_API_TYPE_PIPE IfType = 4 +) + +var ( + IfType_name = map[uint32]string{ + 1: "IF_API_TYPE_HARDWARE", + 2: "IF_API_TYPE_SUB", + 3: "IF_API_TYPE_P2P", + 4: "IF_API_TYPE_PIPE", + } + IfType_value = map[string]uint32{ + "IF_API_TYPE_HARDWARE": 1, + "IF_API_TYPE_SUB": 2, + "IF_API_TYPE_P2P": 3, + "IF_API_TYPE_PIPE": 4, + } +) + +func (x IfType) String() string { + s, ok := IfType_name[uint32(x)] + if ok { + return s + } + return "IfType(" + strconv.Itoa(int(x)) + ")" +} + +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var ( + IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", + } + IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, + } +) + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return "IPDscp(" + strconv.Itoa(int(x)) + ")" +} + +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var ( + IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", + } + IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, + } +) + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return "IPEcn(" + strconv.Itoa(int(x)) + ")" +} + +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var ( + IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", + } + IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, + } +) + +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return "IPProto(" + strconv.Itoa(int(x)) + ")" +} + +// IPReassType represents VPP binary API enum 'ip_reass_type'. +type IPReassType uint32 + +const ( + IP_REASS_TYPE_FULL IPReassType = 0 + IP_REASS_TYPE_SHALLOW_VIRTUAL IPReassType = 1 +) + +var ( + IPReassType_name = map[uint32]string{ + 0: "IP_REASS_TYPE_FULL", + 1: "IP_REASS_TYPE_SHALLOW_VIRTUAL", + } + IPReassType_value = map[string]uint32{ + "IP_REASS_TYPE_FULL": 0, + "IP_REASS_TYPE_SHALLOW_VIRTUAL": 1, + } +) + +func (x IPReassType) String() string { + s, ok := IPReassType_name[uint32(x)] + if ok { + return s + } + return "IPReassType(" + strconv.Itoa(int(x)) + ")" +} + +// LinkDuplex represents VPP binary API enum 'link_duplex'. +type LinkDuplex uint32 + +const ( + LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 + LINK_DUPLEX_API_HALF LinkDuplex = 1 + LINK_DUPLEX_API_FULL LinkDuplex = 2 +) + +var ( + LinkDuplex_name = map[uint32]string{ + 0: "LINK_DUPLEX_API_UNKNOWN", + 1: "LINK_DUPLEX_API_HALF", + 2: "LINK_DUPLEX_API_FULL", + } + LinkDuplex_value = map[string]uint32{ + "LINK_DUPLEX_API_UNKNOWN": 0, + "LINK_DUPLEX_API_HALF": 1, + "LINK_DUPLEX_API_FULL": 2, + } +) + +func (x LinkDuplex) String() string { + s, ok := LinkDuplex_name[uint32(x)] + if ok { + return s + } + return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" +} + +// MfibItfFlags represents VPP binary API enum 'mfib_itf_flags'. +type MfibItfFlags uint32 + +const ( + MFIB_API_ITF_FLAG_NONE MfibItfFlags = 0 + MFIB_API_ITF_FLAG_NEGATE_SIGNAL MfibItfFlags = 1 + MFIB_API_ITF_FLAG_ACCEPT MfibItfFlags = 2 + MFIB_API_ITF_FLAG_FORWARD MfibItfFlags = 4 + MFIB_API_ITF_FLAG_SIGNAL_PRESENT MfibItfFlags = 8 + MFIB_API_ITF_FLAG_DONT_PRESERVE MfibItfFlags = 16 +) + +var ( + MfibItfFlags_name = map[uint32]string{ + 0: "MFIB_API_ITF_FLAG_NONE", + 1: "MFIB_API_ITF_FLAG_NEGATE_SIGNAL", + 2: "MFIB_API_ITF_FLAG_ACCEPT", + 4: "MFIB_API_ITF_FLAG_FORWARD", + 8: "MFIB_API_ITF_FLAG_SIGNAL_PRESENT", + 16: "MFIB_API_ITF_FLAG_DONT_PRESERVE", + } + MfibItfFlags_value = map[string]uint32{ + "MFIB_API_ITF_FLAG_NONE": 0, + "MFIB_API_ITF_FLAG_NEGATE_SIGNAL": 1, + "MFIB_API_ITF_FLAG_ACCEPT": 2, + "MFIB_API_ITF_FLAG_FORWARD": 4, + "MFIB_API_ITF_FLAG_SIGNAL_PRESENT": 8, + "MFIB_API_ITF_FLAG_DONT_PRESERVE": 16, + } +) + +func (x MfibItfFlags) String() string { + s, ok := MfibItfFlags_name[uint32(x)] + if ok { + return s + } + return "MfibItfFlags(" + strconv.Itoa(int(x)) + ")" +} + +// MtuProto represents VPP binary API enum 'mtu_proto'. +type MtuProto uint32 + +const ( + MTU_PROTO_API_L3 MtuProto = 1 + MTU_PROTO_API_IP4 MtuProto = 2 + MTU_PROTO_API_IP6 MtuProto = 3 + MTU_PROTO_API_MPLS MtuProto = 4 + MTU_PROTO_API_N MtuProto = 5 +) + +var ( + MtuProto_name = map[uint32]string{ + 1: "MTU_PROTO_API_L3", + 2: "MTU_PROTO_API_IP4", + 3: "MTU_PROTO_API_IP6", + 4: "MTU_PROTO_API_MPLS", + 5: "MTU_PROTO_API_N", + } + MtuProto_value = map[string]uint32{ + "MTU_PROTO_API_L3": 1, + "MTU_PROTO_API_IP4": 2, + "MTU_PROTO_API_IP6": 3, + "MTU_PROTO_API_MPLS": 4, + "MTU_PROTO_API_N": 5, + } +) + +func (x MtuProto) String() string { + s, ok := MtuProto_name[uint32(x)] + if ok { + return s + } + return "MtuProto(" + strconv.Itoa(int(x)) + ")" +} + +// RxMode represents VPP binary API enum 'rx_mode'. +type RxMode uint32 + +const ( + RX_MODE_API_UNKNOWN RxMode = 0 + RX_MODE_API_POLLING RxMode = 1 + RX_MODE_API_INTERRUPT RxMode = 2 + RX_MODE_API_ADAPTIVE RxMode = 3 + RX_MODE_API_DEFAULT RxMode = 4 +) + +var ( + RxMode_name = map[uint32]string{ + 0: "RX_MODE_API_UNKNOWN", + 1: "RX_MODE_API_POLLING", + 2: "RX_MODE_API_INTERRUPT", + 3: "RX_MODE_API_ADAPTIVE", + 4: "RX_MODE_API_DEFAULT", + } + RxMode_value = map[string]uint32{ + "RX_MODE_API_UNKNOWN": 0, + "RX_MODE_API_POLLING": 1, + "RX_MODE_API_INTERRUPT": 2, + "RX_MODE_API_ADAPTIVE": 3, + "RX_MODE_API_DEFAULT": 4, + } +) + +func (x RxMode) String() string { + s, ok := RxMode_name[uint32(x)] + if ok { + return s + } + return "RxMode(" + strconv.Itoa(int(x)) + ")" +} + +// SubIfFlags represents VPP binary API enum 'sub_if_flags'. +type SubIfFlags uint32 + +const ( + SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 + SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 + SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 + SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 + SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 + SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 + SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 + SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 + SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 + SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 +) + +var ( + SubIfFlags_name = map[uint32]string{ + 1: "SUB_IF_API_FLAG_NO_TAGS", + 2: "SUB_IF_API_FLAG_ONE_TAG", + 4: "SUB_IF_API_FLAG_TWO_TAGS", + 8: "SUB_IF_API_FLAG_DOT1AD", + 16: "SUB_IF_API_FLAG_EXACT_MATCH", + 32: "SUB_IF_API_FLAG_DEFAULT", + 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", + 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", + 254: "SUB_IF_API_FLAG_MASK_VNET", + 256: "SUB_IF_API_FLAG_DOT1AH", + } + SubIfFlags_value = map[string]uint32{ + "SUB_IF_API_FLAG_NO_TAGS": 1, + "SUB_IF_API_FLAG_ONE_TAG": 2, + "SUB_IF_API_FLAG_TWO_TAGS": 4, + "SUB_IF_API_FLAG_DOT1AD": 8, + "SUB_IF_API_FLAG_EXACT_MATCH": 16, + "SUB_IF_API_FLAG_DEFAULT": 32, + "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, + "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, + "SUB_IF_API_FLAG_MASK_VNET": 254, + "SUB_IF_API_FLAG_DOT1AH": 256, + } +) + +func (x SubIfFlags) String() string { + s, ok := SubIfFlags_name[uint32(x)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" +} + +// AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. +type AddressWithPrefix Prefix + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 + +// IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'. +type IP4AddressWithPrefix IP4Prefix + +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 + +// IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'. +type IP6AddressWithPrefix IP6Prefix + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 + +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` +} + +func (*Address) GetTypeName() string { return "address" } + +// FibMplsLabel represents VPP binary API type 'fib_mpls_label'. +type FibMplsLabel struct { + IsUniform uint8 `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"` + Label uint32 `binapi:"u32,name=label" json:"label,omitempty"` + TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"` + Exp uint8 `binapi:"u8,name=exp" json:"exp,omitempty"` +} + +func (*FibMplsLabel) GetTypeName() string { return "fib_mpls_label" } + +// FibPath represents VPP binary API type 'fib_path'. +type FibPath struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` + Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` + Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` + Type FibPathType `binapi:"fib_path_type,name=type" json:"type,omitempty"` + Flags FibPathFlags `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"` + Proto FibPathNhProto `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"` + Nh FibPathNh `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"` + NLabels uint8 `binapi:"u8,name=n_labels" json:"n_labels,omitempty"` + LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty" struc:"[16]FibMplsLabel"` +} + +func (*FibPath) GetTypeName() string { return "fib_path" } + +// FibPathNh represents VPP binary API type 'fib_path_nh'. +type FibPathNh struct { + Address AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"` + ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"` + ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"` + ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"` +} + +func (*FibPathNh) GetTypeName() string { return "fib_path_nh" } + +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" } + +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" } + +// IPMroute represents VPP binary API type 'ip_mroute'. +type IPMroute struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + EntryFlags uint32 `binapi:"u32,name=entry_flags" json:"entry_flags,omitempty"` + RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` + Prefix Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"n_paths,omitempty" struc:"sizeof=Paths"` + Paths []MfibPath `binapi:"mfib_path[n_paths],name=paths" json:"paths,omitempty"` +} + +func (*IPMroute) GetTypeName() string { return "ip_mroute" } + +// IPRoute represents VPP binary API type 'ip_route'. +type IPRoute struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` + Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"n_paths,omitempty" struc:"sizeof=Paths"` + Paths []FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` +} + +func (*IPRoute) GetTypeName() string { return "ip_route" } + +// IPTable represents VPP binary API type 'ip_table'. +type IPTable struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` +} + +func (*IPTable) GetTypeName() string { return "ip_table" } + +// MfibPath represents VPP binary API type 'mfib_path'. +type MfibPath struct { + ItfFlags MfibItfFlags `binapi:"mfib_itf_flags,name=itf_flags" json:"itf_flags,omitempty"` + Path FibPath `binapi:"fib_path,name=path" json:"path,omitempty"` +} + +func (*MfibPath) GetTypeName() string { return "mfib_path" } + +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` + GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` + SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` +} + +func (*Mprefix) GetTypeName() string { return "mprefix" } + +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address `binapi:"address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*Prefix) GetTypeName() string { return "prefix" } + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` + Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` +} + +func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" } + +// PuntRedirect represents VPP binary API type 'punt_redirect'. +type PuntRedirect struct { + RxSwIfIndex InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` + TxSwIfIndex InterfaceIndex `binapi:"interface_index,name=tx_sw_if_index" json:"tx_sw_if_index,omitempty"` + Nh Address `binapi:"address,name=nh" json:"nh,omitempty"` +} + +func (*PuntRedirect) GetTypeName() string { return "punt_redirect" } + +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { return "address_union" } + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +// IoamDisable represents VPP binary API message 'ioam_disable'. +type IoamDisable struct { + ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` +} + +func (m *IoamDisable) Reset() { *m = IoamDisable{} } +func (*IoamDisable) GetMessageName() string { return "ioam_disable" } +func (*IoamDisable) GetCrcString() string { return "6b16a45e" } +func (*IoamDisable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IoamDisable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ID + size += 2 + return size +} +func (m *IoamDisable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ID + o.PutUint16(buf[pos:pos+2], uint16(m.ID)) + pos += 2 + return buf, nil +} +func (m *IoamDisable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ID + m.ID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + +// IoamDisableReply represents VPP binary API message 'ioam_disable_reply'. +type IoamDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IoamDisableReply) Reset() { *m = IoamDisableReply{} } +func (*IoamDisableReply) GetMessageName() string { return "ioam_disable_reply" } +func (*IoamDisableReply) GetCrcString() string { return "e8d4e804" } +func (*IoamDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IoamDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IoamDisableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IoamDisableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IoamEnable represents VPP binary API message 'ioam_enable'. +type IoamEnable struct { + ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` + Seqno bool `binapi:"bool,name=seqno" json:"seqno,omitempty"` + Analyse bool `binapi:"bool,name=analyse" json:"analyse,omitempty"` + PotEnable bool `binapi:"bool,name=pot_enable" json:"pot_enable,omitempty"` + TraceEnable bool `binapi:"bool,name=trace_enable" json:"trace_enable,omitempty"` + NodeID uint32 `binapi:"u32,name=node_id" json:"node_id,omitempty"` +} + +func (m *IoamEnable) Reset() { *m = IoamEnable{} } +func (*IoamEnable) GetMessageName() string { return "ioam_enable" } +func (*IoamEnable) GetCrcString() string { return "51ccd868" } +func (*IoamEnable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IoamEnable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ID + size += 2 + // field[1] m.Seqno + size += 1 + // field[1] m.Analyse + size += 1 + // field[1] m.PotEnable + size += 1 + // field[1] m.TraceEnable + size += 1 + // field[1] m.NodeID + size += 4 + return size +} +func (m *IoamEnable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ID + o.PutUint16(buf[pos:pos+2], uint16(m.ID)) + pos += 2 + // field[1] m.Seqno + if m.Seqno { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Analyse + if m.Analyse { + buf[pos] = 1 + } + pos += 1 + // field[1] m.PotEnable + if m.PotEnable { + buf[pos] = 1 + } + pos += 1 + // field[1] m.TraceEnable + if m.TraceEnable { + buf[pos] = 1 + } + pos += 1 + // field[1] m.NodeID + o.PutUint32(buf[pos:pos+4], uint32(m.NodeID)) + pos += 4 + return buf, nil +} +func (m *IoamEnable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ID + m.ID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.Seqno + m.Seqno = tmp[pos] != 0 + pos += 1 + // field[1] m.Analyse + m.Analyse = tmp[pos] != 0 + pos += 1 + // field[1] m.PotEnable + m.PotEnable = tmp[pos] != 0 + pos += 1 + // field[1] m.TraceEnable + m.TraceEnable = tmp[pos] != 0 + pos += 1 + // field[1] m.NodeID + m.NodeID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IoamEnableReply represents VPP binary API message 'ioam_enable_reply'. +type IoamEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IoamEnableReply) Reset() { *m = IoamEnableReply{} } +func (*IoamEnableReply) GetMessageName() string { return "ioam_enable_reply" } +func (*IoamEnableReply) GetCrcString() string { return "e8d4e804" } +func (*IoamEnableReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IoamEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IoamEnableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IoamEnableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPAddressDetails represents VPP binary API message 'ip_address_details'. +type IPAddressDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Prefix AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` +} + +func (m *IPAddressDetails) Reset() { *m = IPAddressDetails{} } +func (*IPAddressDetails) GetMessageName() string { return "ip_address_details" } +func (*IPAddressDetails) GetCrcString() string { return "b1199745" } +func (*IPAddressDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPAddressDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 4 + // field[3] m.Prefix.Address.Un + size += 16 + // field[2] m.Prefix.Len + size += 1 + return size +} +func (m *IPAddressDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 + return buf, nil +} +func (m *IPAddressDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 + return nil +} + +// IPAddressDump represents VPP binary API message 'ip_address_dump'. +type IPAddressDump struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *IPAddressDump) Reset() { *m = IPAddressDump{} } +func (*IPAddressDump) GetMessageName() string { return "ip_address_dump" } +func (*IPAddressDump) GetCrcString() string { return "2d033de4" } +func (*IPAddressDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPAddressDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *IPAddressDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPAddressDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPContainerProxyAddDel represents VPP binary API message 'ip_container_proxy_add_del'. +type IPContainerProxyAddDel struct { + Pfx Prefix `binapi:"prefix,name=pfx" json:"pfx,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` +} + +func (m *IPContainerProxyAddDel) Reset() { *m = IPContainerProxyAddDel{} } +func (*IPContainerProxyAddDel) GetMessageName() string { return "ip_container_proxy_add_del" } +func (*IPContainerProxyAddDel) GetCrcString() string { return "91189f40" } +func (*IPContainerProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPContainerProxyAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Pfx + // field[2] m.Pfx.Address + // field[3] m.Pfx.Address.Af + size += 4 + // field[3] m.Pfx.Address.Un + size += 16 + // field[2] m.Pfx.Len + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsAdd + size += 1 + return size +} +func (m *IPContainerProxyAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Pfx + // field[2] m.Pfx.Address + // field[3] m.Pfx.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Pfx.Address.Af)) + pos += 4 + // field[3] m.Pfx.Address.Un + copy(buf[pos:pos+16], m.Pfx.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Pfx.Len + buf[pos] = uint8(m.Pfx.Len) + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPContainerProxyAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Pfx + // field[2] m.Pfx.Address + // field[3] m.Pfx.Address.Af + m.Pfx.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Pfx.Address.Un + copy(m.Pfx.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Pfx.Len + m.Pfx.Len = uint8(tmp[pos]) + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPContainerProxyAddDelReply represents VPP binary API message 'ip_container_proxy_add_del_reply'. +type IPContainerProxyAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPContainerProxyAddDelReply) Reset() { *m = IPContainerProxyAddDelReply{} } +func (*IPContainerProxyAddDelReply) GetMessageName() string { + return "ip_container_proxy_add_del_reply" +} +func (*IPContainerProxyAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IPContainerProxyAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPContainerProxyAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPContainerProxyAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPContainerProxyAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPContainerProxyDetails represents VPP binary API message 'ip_container_proxy_details'. +type IPContainerProxyDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` +} + +func (m *IPContainerProxyDetails) Reset() { *m = IPContainerProxyDetails{} } +func (*IPContainerProxyDetails) GetMessageName() string { return "ip_container_proxy_details" } +func (*IPContainerProxyDetails) GetCrcString() string { return "0ee460e8" } +func (*IPContainerProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPContainerProxyDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 4 + // field[3] m.Prefix.Address.Un + size += 16 + // field[2] m.Prefix.Len + size += 1 + return size +} +func (m *IPContainerProxyDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 + return buf, nil +} +func (m *IPContainerProxyDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 + return nil +} + +// IPContainerProxyDump represents VPP binary API message 'ip_container_proxy_dump'. +type IPContainerProxyDump struct{} + +func (m *IPContainerProxyDump) Reset() { *m = IPContainerProxyDump{} } +func (*IPContainerProxyDump) GetMessageName() string { return "ip_container_proxy_dump" } +func (*IPContainerProxyDump) GetCrcString() string { return "51077d14" } +func (*IPContainerProxyDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPContainerProxyDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IPContainerProxyDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *IPContainerProxyDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// IPDetails represents VPP binary API message 'ip_details'. +type IPDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *IPDetails) Reset() { *m = IPDetails{} } +func (*IPDetails) GetMessageName() string { return "ip_details" } +func (*IPDetails) GetCrcString() string { return "eb152d07" } +func (*IPDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *IPDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPDump represents VPP binary API message 'ip_dump'. +type IPDump struct { + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *IPDump) Reset() { *m = IPDump{} } +func (*IPDump) GetMessageName() string { return "ip_dump" } +func (*IPDump) GetCrcString() string { return "98d231ca" } +func (*IPDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *IPDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPMrouteAddDel represents VPP binary API message 'ip_mroute_add_del'. +type IPMrouteAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsMultipath bool `binapi:"bool,name=is_multipath" json:"is_multipath,omitempty"` + Route IPMroute `binapi:"ip_mroute,name=route" json:"route,omitempty"` +} + +func (m *IPMrouteAddDel) Reset() { *m = IPMrouteAddDel{} } +func (*IPMrouteAddDel) GetMessageName() string { return "ip_mroute_add_del" } +func (*IPMrouteAddDel) GetCrcString() string { return "f6627d17" } +func (*IPMrouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPMrouteAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.IsMultipath + size += 1 + // field[1] m.Route + // field[2] m.Route.TableID + size += 4 + // field[2] m.Route.EntryFlags + size += 4 + // field[2] m.Route.RpfID + size += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + size += 4 + // field[3] m.Route.Prefix.GrpAddressLength + size += 2 + // field[3] m.Route.Prefix.GrpAddress + size += 16 + // field[3] m.Route.Prefix.SrcAddress + size += 16 + // field[2] m.Route.NPaths + size += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 MfibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + // field[3] s2.ItfFlags + size += 4 + // field[3] s2.Path + // field[4] s2.Path.SwIfIndex + size += 4 + // field[4] s2.Path.TableID + size += 4 + // field[4] s2.Path.RpfID + size += 4 + // field[4] s2.Path.Weight + size += 1 + // field[4] s2.Path.Preference + size += 1 + // field[4] s2.Path.Type + size += 4 + // field[4] s2.Path.Flags + size += 4 + // field[4] s2.Path.Proto + size += 4 + // field[4] s2.Path.Nh + // field[5] s2.Path.Nh.Address + size += 16 + // field[5] s2.Path.Nh.ViaLabel + size += 4 + // field[5] s2.Path.Nh.ObjID + size += 4 + // field[5] s2.Path.Nh.ClassifyTableIndex + size += 4 + // field[4] s2.Path.NLabels + size += 1 + // field[4] s2.Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + var s4 FibMplsLabel + _ = s4 + if j4 < len(s2.Path.LabelStack) { + s4 = s2.Path.LabelStack[j4] + } + // field[5] s4.IsUniform + size += 1 + // field[5] s4.Label + size += 4 + // field[5] s4.TTL + size += 1 + // field[5] s4.Exp + size += 1 + } + } + return size +} +func (m *IPMrouteAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.IsMultipath + if m.IsMultipath { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Route + // field[2] m.Route.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) + pos += 4 + // field[2] m.Route.EntryFlags + o.PutUint32(buf[pos:pos+4], uint32(m.Route.EntryFlags)) + pos += 4 + // field[2] m.Route.RpfID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.RpfID)) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Af)) + pos += 4 + // field[3] m.Route.Prefix.GrpAddressLength + o.PutUint16(buf[pos:pos+2], uint16(m.Route.Prefix.GrpAddressLength)) + pos += 2 + // field[3] m.Route.Prefix.GrpAddress + copy(buf[pos:pos+16], m.Route.Prefix.GrpAddress.XXX_UnionData[:]) + pos += 16 + // field[3] m.Route.Prefix.SrcAddress + copy(buf[pos:pos+16], m.Route.Prefix.SrcAddress.XXX_UnionData[:]) + pos += 16 + // field[2] m.Route.NPaths + buf[pos] = uint8(len(m.Route.Paths)) + pos += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var v2 MfibPath + if j2 < len(m.Route.Paths) { + v2 = m.Route.Paths[j2] + } + // field[3] v2.ItfFlags + o.PutUint32(buf[pos:pos+4], uint32(v2.ItfFlags)) + pos += 4 + // field[3] v2.Path + // field[4] v2.Path.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.SwIfIndex)) + pos += 4 + // field[4] v2.Path.TableID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.TableID)) + pos += 4 + // field[4] v2.Path.RpfID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.RpfID)) + pos += 4 + // field[4] v2.Path.Weight + buf[pos] = uint8(v2.Path.Weight) + pos += 1 + // field[4] v2.Path.Preference + buf[pos] = uint8(v2.Path.Preference) + pos += 1 + // field[4] v2.Path.Type + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Type)) + pos += 4 + // field[4] v2.Path.Flags + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Flags)) + pos += 4 + // field[4] v2.Path.Proto + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Proto)) + pos += 4 + // field[4] v2.Path.Nh + // field[5] v2.Path.Nh.Address + copy(buf[pos:pos+16], v2.Path.Nh.Address.XXX_UnionData[:]) + pos += 16 + // field[5] v2.Path.Nh.ViaLabel + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ViaLabel)) + pos += 4 + // field[5] v2.Path.Nh.ObjID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ObjID)) + pos += 4 + // field[5] v2.Path.Nh.ClassifyTableIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ClassifyTableIndex)) + pos += 4 + // field[4] v2.Path.NLabels + buf[pos] = uint8(v2.Path.NLabels) + pos += 1 + // field[4] v2.Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + var v4 FibMplsLabel + if j4 < len(v2.Path.LabelStack) { + v4 = v2.Path.LabelStack[j4] + } + // field[5] v4.IsUniform + buf[pos] = uint8(v4.IsUniform) + pos += 1 + // field[5] v4.Label + o.PutUint32(buf[pos:pos+4], uint32(v4.Label)) + pos += 4 + // field[5] v4.TTL + buf[pos] = uint8(v4.TTL) + pos += 1 + // field[5] v4.Exp + buf[pos] = uint8(v4.Exp) + pos += 1 + } + } + return buf, nil +} +func (m *IPMrouteAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.IsMultipath + m.IsMultipath = tmp[pos] != 0 + pos += 1 + // field[1] m.Route + // field[2] m.Route.TableID + m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.EntryFlags + m.Route.EntryFlags = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.RpfID + m.Route.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + m.Route.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Prefix.GrpAddressLength + m.Route.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[3] m.Route.Prefix.GrpAddress + copy(m.Route.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.Route.Prefix.SrcAddress + copy(m.Route.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Route.NPaths + m.Route.NPaths = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.Paths + m.Route.Paths = make([]MfibPath, int(m.Route.NPaths)) + for j2 := 0; j2 < int(m.Route.NPaths); j2++ { + // field[3] m.Route.Paths[j2].ItfFlags + m.Route.Paths[j2].ItfFlags = MfibItfFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Path + // field[4] m.Route.Paths[j2].Path.SwIfIndex + m.Route.Paths[j2].Path.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.TableID + m.Route.Paths[j2].Path.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.RpfID + m.Route.Paths[j2].Path.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Weight + m.Route.Paths[j2].Path.Weight = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.Preference + m.Route.Paths[j2].Path.Preference = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.Type + m.Route.Paths[j2].Path.Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Flags + m.Route.Paths[j2].Path.Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Proto + m.Route.Paths[j2].Path.Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Nh + // field[5] m.Route.Paths[j2].Path.Nh.Address + copy(m.Route.Paths[j2].Path.Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[5] m.Route.Paths[j2].Path.Nh.ViaLabel + m.Route.Paths[j2].Path.Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.Nh.ObjID + m.Route.Paths[j2].Path.Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.Nh.ClassifyTableIndex + m.Route.Paths[j2].Path.Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.NLabels + m.Route.Paths[j2].Path.NLabels = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].IsUniform + m.Route.Paths[j2].Path.LabelStack[j4].IsUniform = uint8(tmp[pos]) + pos += 1 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Label + m.Route.Paths[j2].Path.LabelStack[j4].Label = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].TTL + m.Route.Paths[j2].Path.LabelStack[j4].TTL = uint8(tmp[pos]) + pos += 1 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Exp + m.Route.Paths[j2].Path.LabelStack[j4].Exp = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// IPMrouteAddDelReply represents VPP binary API message 'ip_mroute_add_del_reply'. +type IPMrouteAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` +} + +func (m *IPMrouteAddDelReply) Reset() { *m = IPMrouteAddDelReply{} } +func (*IPMrouteAddDelReply) GetMessageName() string { return "ip_mroute_add_del_reply" } +func (*IPMrouteAddDelReply) GetCrcString() string { return "1992deab" } +func (*IPMrouteAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPMrouteAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.StatsIndex + size += 4 + return size +} +func (m *IPMrouteAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.StatsIndex + o.PutUint32(buf[pos:pos+4], uint32(m.StatsIndex)) + pos += 4 + return buf, nil +} +func (m *IPMrouteAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.StatsIndex + m.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPMrouteDetails represents VPP binary API message 'ip_mroute_details'. +type IPMrouteDetails struct { + Route IPMroute `binapi:"ip_mroute,name=route" json:"route,omitempty"` +} + +func (m *IPMrouteDetails) Reset() { *m = IPMrouteDetails{} } +func (*IPMrouteDetails) GetMessageName() string { return "ip_mroute_details" } +func (*IPMrouteDetails) GetCrcString() string { return "c1cb4b44" } +func (*IPMrouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPMrouteDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Route + // field[2] m.Route.TableID + size += 4 + // field[2] m.Route.EntryFlags + size += 4 + // field[2] m.Route.RpfID + size += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + size += 4 + // field[3] m.Route.Prefix.GrpAddressLength + size += 2 + // field[3] m.Route.Prefix.GrpAddress + size += 16 + // field[3] m.Route.Prefix.SrcAddress + size += 16 + // field[2] m.Route.NPaths + size += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 MfibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + // field[3] s2.ItfFlags + size += 4 + // field[3] s2.Path + // field[4] s2.Path.SwIfIndex + size += 4 + // field[4] s2.Path.TableID + size += 4 + // field[4] s2.Path.RpfID + size += 4 + // field[4] s2.Path.Weight + size += 1 + // field[4] s2.Path.Preference + size += 1 + // field[4] s2.Path.Type + size += 4 + // field[4] s2.Path.Flags + size += 4 + // field[4] s2.Path.Proto + size += 4 + // field[4] s2.Path.Nh + // field[5] s2.Path.Nh.Address + size += 16 + // field[5] s2.Path.Nh.ViaLabel + size += 4 + // field[5] s2.Path.Nh.ObjID + size += 4 + // field[5] s2.Path.Nh.ClassifyTableIndex + size += 4 + // field[4] s2.Path.NLabels + size += 1 + // field[4] s2.Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + var s4 FibMplsLabel + _ = s4 + if j4 < len(s2.Path.LabelStack) { + s4 = s2.Path.LabelStack[j4] + } + // field[5] s4.IsUniform + size += 1 + // field[5] s4.Label + size += 4 + // field[5] s4.TTL + size += 1 + // field[5] s4.Exp + size += 1 + } + } + return size +} +func (m *IPMrouteDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Route + // field[2] m.Route.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) + pos += 4 + // field[2] m.Route.EntryFlags + o.PutUint32(buf[pos:pos+4], uint32(m.Route.EntryFlags)) + pos += 4 + // field[2] m.Route.RpfID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.RpfID)) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Af)) + pos += 4 + // field[3] m.Route.Prefix.GrpAddressLength + o.PutUint16(buf[pos:pos+2], uint16(m.Route.Prefix.GrpAddressLength)) + pos += 2 + // field[3] m.Route.Prefix.GrpAddress + copy(buf[pos:pos+16], m.Route.Prefix.GrpAddress.XXX_UnionData[:]) + pos += 16 + // field[3] m.Route.Prefix.SrcAddress + copy(buf[pos:pos+16], m.Route.Prefix.SrcAddress.XXX_UnionData[:]) + pos += 16 + // field[2] m.Route.NPaths + buf[pos] = uint8(len(m.Route.Paths)) + pos += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var v2 MfibPath + if j2 < len(m.Route.Paths) { + v2 = m.Route.Paths[j2] + } + // field[3] v2.ItfFlags + o.PutUint32(buf[pos:pos+4], uint32(v2.ItfFlags)) + pos += 4 + // field[3] v2.Path + // field[4] v2.Path.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.SwIfIndex)) + pos += 4 + // field[4] v2.Path.TableID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.TableID)) + pos += 4 + // field[4] v2.Path.RpfID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.RpfID)) + pos += 4 + // field[4] v2.Path.Weight + buf[pos] = uint8(v2.Path.Weight) + pos += 1 + // field[4] v2.Path.Preference + buf[pos] = uint8(v2.Path.Preference) + pos += 1 + // field[4] v2.Path.Type + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Type)) + pos += 4 + // field[4] v2.Path.Flags + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Flags)) + pos += 4 + // field[4] v2.Path.Proto + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Proto)) + pos += 4 + // field[4] v2.Path.Nh + // field[5] v2.Path.Nh.Address + copy(buf[pos:pos+16], v2.Path.Nh.Address.XXX_UnionData[:]) + pos += 16 + // field[5] v2.Path.Nh.ViaLabel + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ViaLabel)) + pos += 4 + // field[5] v2.Path.Nh.ObjID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ObjID)) + pos += 4 + // field[5] v2.Path.Nh.ClassifyTableIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ClassifyTableIndex)) + pos += 4 + // field[4] v2.Path.NLabels + buf[pos] = uint8(v2.Path.NLabels) + pos += 1 + // field[4] v2.Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + var v4 FibMplsLabel + if j4 < len(v2.Path.LabelStack) { + v4 = v2.Path.LabelStack[j4] + } + // field[5] v4.IsUniform + buf[pos] = uint8(v4.IsUniform) + pos += 1 + // field[5] v4.Label + o.PutUint32(buf[pos:pos+4], uint32(v4.Label)) + pos += 4 + // field[5] v4.TTL + buf[pos] = uint8(v4.TTL) + pos += 1 + // field[5] v4.Exp + buf[pos] = uint8(v4.Exp) + pos += 1 + } + } + return buf, nil +} +func (m *IPMrouteDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Route + // field[2] m.Route.TableID + m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.EntryFlags + m.Route.EntryFlags = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.RpfID + m.Route.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + m.Route.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Prefix.GrpAddressLength + m.Route.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[3] m.Route.Prefix.GrpAddress + copy(m.Route.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.Route.Prefix.SrcAddress + copy(m.Route.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Route.NPaths + m.Route.NPaths = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.Paths + m.Route.Paths = make([]MfibPath, int(m.Route.NPaths)) + for j2 := 0; j2 < int(m.Route.NPaths); j2++ { + // field[3] m.Route.Paths[j2].ItfFlags + m.Route.Paths[j2].ItfFlags = MfibItfFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Path + // field[4] m.Route.Paths[j2].Path.SwIfIndex + m.Route.Paths[j2].Path.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.TableID + m.Route.Paths[j2].Path.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.RpfID + m.Route.Paths[j2].Path.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Weight + m.Route.Paths[j2].Path.Weight = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.Preference + m.Route.Paths[j2].Path.Preference = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.Type + m.Route.Paths[j2].Path.Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Flags + m.Route.Paths[j2].Path.Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Proto + m.Route.Paths[j2].Path.Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Nh + // field[5] m.Route.Paths[j2].Path.Nh.Address + copy(m.Route.Paths[j2].Path.Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[5] m.Route.Paths[j2].Path.Nh.ViaLabel + m.Route.Paths[j2].Path.Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.Nh.ObjID + m.Route.Paths[j2].Path.Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.Nh.ClassifyTableIndex + m.Route.Paths[j2].Path.Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.NLabels + m.Route.Paths[j2].Path.NLabels = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].IsUniform + m.Route.Paths[j2].Path.LabelStack[j4].IsUniform = uint8(tmp[pos]) + pos += 1 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Label + m.Route.Paths[j2].Path.LabelStack[j4].Label = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].TTL + m.Route.Paths[j2].Path.LabelStack[j4].TTL = uint8(tmp[pos]) + pos += 1 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Exp + m.Route.Paths[j2].Path.LabelStack[j4].Exp = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// IPMrouteDump represents VPP binary API message 'ip_mroute_dump'. +type IPMrouteDump struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPMrouteDump) Reset() { *m = IPMrouteDump{} } +func (*IPMrouteDump) GetMessageName() string { return "ip_mroute_dump" } +func (*IPMrouteDump) GetCrcString() string { return "b9d2e09e" } +func (*IPMrouteDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPMrouteDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPMrouteDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPMrouteDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPMtableDetails represents VPP binary API message 'ip_mtable_details'. +type IPMtableDetails struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPMtableDetails) Reset() { *m = IPMtableDetails{} } +func (*IPMtableDetails) GetMessageName() string { return "ip_mtable_details" } +func (*IPMtableDetails) GetCrcString() string { return "b9d2e09e" } +func (*IPMtableDetails) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPMtableDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPMtableDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPMtableDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPMtableDump represents VPP binary API message 'ip_mtable_dump'. +type IPMtableDump struct{} + +func (m *IPMtableDump) Reset() { *m = IPMtableDump{} } +func (*IPMtableDump) GetMessageName() string { return "ip_mtable_dump" } +func (*IPMtableDump) GetCrcString() string { return "51077d14" } +func (*IPMtableDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPMtableDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IPMtableDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *IPMtableDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// IPPuntPolice represents VPP binary API message 'ip_punt_police'. +type IPPuntPolice struct { + PolicerIndex uint32 `binapi:"u32,name=policer_index" json:"policer_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` +} + +func (m *IPPuntPolice) Reset() { *m = IPPuntPolice{} } +func (*IPPuntPolice) GetMessageName() string { return "ip_punt_police" } +func (*IPPuntPolice) GetCrcString() string { return "db867cea" } +func (*IPPuntPolice) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPPuntPolice) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.PolicerIndex + size += 4 + // field[1] m.IsAdd + size += 1 + // field[1] m.IsIP6 + size += 1 + return size +} +func (m *IPPuntPolice) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.PolicerIndex + o.PutUint32(buf[pos:pos+4], uint32(m.PolicerIndex)) + pos += 4 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.IsIP6 + if m.IsIP6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPPuntPolice) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.PolicerIndex + m.PolicerIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.IsIP6 + m.IsIP6 = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPPuntPoliceReply represents VPP binary API message 'ip_punt_police_reply'. +type IPPuntPoliceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPPuntPoliceReply) Reset() { *m = IPPuntPoliceReply{} } +func (*IPPuntPoliceReply) GetMessageName() string { return "ip_punt_police_reply" } +func (*IPPuntPoliceReply) GetCrcString() string { return "e8d4e804" } +func (*IPPuntPoliceReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPPuntPoliceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPPuntPoliceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPPuntPoliceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPPuntRedirect represents VPP binary API message 'ip_punt_redirect'. +type IPPuntRedirect struct { + Punt PuntRedirect `binapi:"punt_redirect,name=punt" json:"punt,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` +} + +func (m *IPPuntRedirect) Reset() { *m = IPPuntRedirect{} } +func (*IPPuntRedirect) GetMessageName() string { return "ip_punt_redirect" } +func (*IPPuntRedirect) GetCrcString() string { return "a9a5592c" } +func (*IPPuntRedirect) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPPuntRedirect) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + size += 4 + // field[2] m.Punt.TxSwIfIndex + size += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + size += 4 + // field[3] m.Punt.Nh.Un + size += 16 + // field[1] m.IsAdd + size += 1 + return size +} +func (m *IPPuntRedirect) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.RxSwIfIndex)) + pos += 4 + // field[2] m.Punt.TxSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.TxSwIfIndex)) + pos += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.Nh.Af)) + pos += 4 + // field[3] m.Punt.Nh.Un + copy(buf[pos:pos+16], m.Punt.Nh.Un.XXX_UnionData[:]) + pos += 16 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPPuntRedirect) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + m.Punt.RxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Punt.TxSwIfIndex + m.Punt.TxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + m.Punt.Nh.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Punt.Nh.Un + copy(m.Punt.Nh.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPPuntRedirectDetails represents VPP binary API message 'ip_punt_redirect_details'. +type IPPuntRedirectDetails struct { + Punt PuntRedirect `binapi:"punt_redirect,name=punt" json:"punt,omitempty"` +} + +func (m *IPPuntRedirectDetails) Reset() { *m = IPPuntRedirectDetails{} } +func (*IPPuntRedirectDetails) GetMessageName() string { return "ip_punt_redirect_details" } +func (*IPPuntRedirectDetails) GetCrcString() string { return "3924f5d3" } +func (*IPPuntRedirectDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPPuntRedirectDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + size += 4 + // field[2] m.Punt.TxSwIfIndex + size += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + size += 4 + // field[3] m.Punt.Nh.Un + size += 16 + return size +} +func (m *IPPuntRedirectDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.RxSwIfIndex)) + pos += 4 + // field[2] m.Punt.TxSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.TxSwIfIndex)) + pos += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.Nh.Af)) + pos += 4 + // field[3] m.Punt.Nh.Un + copy(buf[pos:pos+16], m.Punt.Nh.Un.XXX_UnionData[:]) + pos += 16 + return buf, nil +} +func (m *IPPuntRedirectDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + m.Punt.RxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Punt.TxSwIfIndex + m.Punt.TxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + m.Punt.Nh.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Punt.Nh.Un + copy(m.Punt.Nh.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + return nil +} + +// IPPuntRedirectDump represents VPP binary API message 'ip_punt_redirect_dump'. +type IPPuntRedirectDump struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *IPPuntRedirectDump) Reset() { *m = IPPuntRedirectDump{} } +func (*IPPuntRedirectDump) GetMessageName() string { return "ip_punt_redirect_dump" } +func (*IPPuntRedirectDump) GetCrcString() string { return "2d033de4" } +func (*IPPuntRedirectDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPPuntRedirectDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *IPPuntRedirectDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPPuntRedirectDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPPuntRedirectReply represents VPP binary API message 'ip_punt_redirect_reply'. +type IPPuntRedirectReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPPuntRedirectReply) Reset() { *m = IPPuntRedirectReply{} } +func (*IPPuntRedirectReply) GetMessageName() string { return "ip_punt_redirect_reply" } +func (*IPPuntRedirectReply) GetCrcString() string { return "e8d4e804" } +func (*IPPuntRedirectReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPPuntRedirectReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPPuntRedirectReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPPuntRedirectReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPReassemblyEnableDisable represents VPP binary API message 'ip_reassembly_enable_disable'. +type IPReassemblyEnableDisable struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableIP4 bool `binapi:"bool,name=enable_ip4" json:"enable_ip4,omitempty"` + EnableIP6 bool `binapi:"bool,name=enable_ip6" json:"enable_ip6,omitempty"` + Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` +} + +func (m *IPReassemblyEnableDisable) Reset() { *m = IPReassemblyEnableDisable{} } +func (*IPReassemblyEnableDisable) GetMessageName() string { return "ip_reassembly_enable_disable" } +func (*IPReassemblyEnableDisable) GetCrcString() string { return "885c85a6" } +func (*IPReassemblyEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPReassemblyEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.EnableIP4 + size += 1 + // field[1] m.EnableIP6 + size += 1 + // field[1] m.Type + size += 4 + return size +} +func (m *IPReassemblyEnableDisable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.EnableIP4 + if m.EnableIP4 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.EnableIP6 + if m.EnableIP6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Type + o.PutUint32(buf[pos:pos+4], uint32(m.Type)) + pos += 4 + return buf, nil +} +func (m *IPReassemblyEnableDisable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.EnableIP4 + m.EnableIP4 = tmp[pos] != 0 + pos += 1 + // field[1] m.EnableIP6 + m.EnableIP6 = tmp[pos] != 0 + pos += 1 + // field[1] m.Type + m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPReassemblyEnableDisableReply represents VPP binary API message 'ip_reassembly_enable_disable_reply'. +type IPReassemblyEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPReassemblyEnableDisableReply) Reset() { *m = IPReassemblyEnableDisableReply{} } +func (*IPReassemblyEnableDisableReply) GetMessageName() string { + return "ip_reassembly_enable_disable_reply" +} +func (*IPReassemblyEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*IPReassemblyEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPReassemblyEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPReassemblyEnableDisableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPReassemblyEnableDisableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPReassemblyGet represents VPP binary API message 'ip_reassembly_get'. +type IPReassemblyGet struct { + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` + Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` +} + +func (m *IPReassemblyGet) Reset() { *m = IPReassemblyGet{} } +func (*IPReassemblyGet) GetMessageName() string { return "ip_reassembly_get" } +func (*IPReassemblyGet) GetCrcString() string { return "ea13ff63" } +func (*IPReassemblyGet) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPReassemblyGet) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsIP6 + size += 1 + // field[1] m.Type + size += 4 + return size +} +func (m *IPReassemblyGet) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsIP6 + if m.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Type + o.PutUint32(buf[pos:pos+4], uint32(m.Type)) + pos += 4 + return buf, nil +} +func (m *IPReassemblyGet) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsIP6 + m.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[1] m.Type + m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPReassemblyGetReply represents VPP binary API message 'ip_reassembly_get_reply'. +type IPReassemblyGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TimeoutMs uint32 `binapi:"u32,name=timeout_ms" json:"timeout_ms,omitempty"` + MaxReassemblies uint32 `binapi:"u32,name=max_reassemblies" json:"max_reassemblies,omitempty"` + MaxReassemblyLength uint32 `binapi:"u32,name=max_reassembly_length" json:"max_reassembly_length,omitempty"` + ExpireWalkIntervalMs uint32 `binapi:"u32,name=expire_walk_interval_ms" json:"expire_walk_interval_ms,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` +} + +func (m *IPReassemblyGetReply) Reset() { *m = IPReassemblyGetReply{} } +func (*IPReassemblyGetReply) GetMessageName() string { return "ip_reassembly_get_reply" } +func (*IPReassemblyGetReply) GetCrcString() string { return "d5eb8d34" } +func (*IPReassemblyGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPReassemblyGetReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.TimeoutMs + size += 4 + // field[1] m.MaxReassemblies + size += 4 + // field[1] m.MaxReassemblyLength + size += 4 + // field[1] m.ExpireWalkIntervalMs + size += 4 + // field[1] m.IsIP6 + size += 1 + return size +} +func (m *IPReassemblyGetReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.TimeoutMs + o.PutUint32(buf[pos:pos+4], uint32(m.TimeoutMs)) + pos += 4 + // field[1] m.MaxReassemblies + o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblies)) + pos += 4 + // field[1] m.MaxReassemblyLength + o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblyLength)) + pos += 4 + // field[1] m.ExpireWalkIntervalMs + o.PutUint32(buf[pos:pos+4], uint32(m.ExpireWalkIntervalMs)) + pos += 4 + // field[1] m.IsIP6 + if m.IsIP6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPReassemblyGetReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TimeoutMs + m.TimeoutMs = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MaxReassemblies + m.MaxReassemblies = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MaxReassemblyLength + m.MaxReassemblyLength = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ExpireWalkIntervalMs + m.ExpireWalkIntervalMs = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIP6 + m.IsIP6 = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPReassemblySet represents VPP binary API message 'ip_reassembly_set'. +type IPReassemblySet struct { + TimeoutMs uint32 `binapi:"u32,name=timeout_ms" json:"timeout_ms,omitempty"` + MaxReassemblies uint32 `binapi:"u32,name=max_reassemblies" json:"max_reassemblies,omitempty"` + MaxReassemblyLength uint32 `binapi:"u32,name=max_reassembly_length" json:"max_reassembly_length,omitempty"` + ExpireWalkIntervalMs uint32 `binapi:"u32,name=expire_walk_interval_ms" json:"expire_walk_interval_ms,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` + Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` +} + +func (m *IPReassemblySet) Reset() { *m = IPReassemblySet{} } +func (*IPReassemblySet) GetMessageName() string { return "ip_reassembly_set" } +func (*IPReassemblySet) GetCrcString() string { return "16467d25" } +func (*IPReassemblySet) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPReassemblySet) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.TimeoutMs + size += 4 + // field[1] m.MaxReassemblies + size += 4 + // field[1] m.MaxReassemblyLength + size += 4 + // field[1] m.ExpireWalkIntervalMs + size += 4 + // field[1] m.IsIP6 + size += 1 + // field[1] m.Type + size += 4 + return size +} +func (m *IPReassemblySet) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.TimeoutMs + o.PutUint32(buf[pos:pos+4], uint32(m.TimeoutMs)) + pos += 4 + // field[1] m.MaxReassemblies + o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblies)) + pos += 4 + // field[1] m.MaxReassemblyLength + o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblyLength)) + pos += 4 + // field[1] m.ExpireWalkIntervalMs + o.PutUint32(buf[pos:pos+4], uint32(m.ExpireWalkIntervalMs)) + pos += 4 + // field[1] m.IsIP6 + if m.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Type + o.PutUint32(buf[pos:pos+4], uint32(m.Type)) + pos += 4 + return buf, nil +} +func (m *IPReassemblySet) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.TimeoutMs + m.TimeoutMs = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MaxReassemblies + m.MaxReassemblies = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MaxReassemblyLength + m.MaxReassemblyLength = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ExpireWalkIntervalMs + m.ExpireWalkIntervalMs = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIP6 + m.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[1] m.Type + m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPReassemblySetReply represents VPP binary API message 'ip_reassembly_set_reply'. +type IPReassemblySetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPReassemblySetReply) Reset() { *m = IPReassemblySetReply{} } +func (*IPReassemblySetReply) GetMessageName() string { return "ip_reassembly_set_reply" } +func (*IPReassemblySetReply) GetCrcString() string { return "e8d4e804" } +func (*IPReassemblySetReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPReassemblySetReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPReassemblySetReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPReassemblySetReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPRouteAddDel represents VPP binary API message 'ip_route_add_del'. +type IPRouteAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsMultipath bool `binapi:"bool,name=is_multipath" json:"is_multipath,omitempty"` + Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` +} + +func (m *IPRouteAddDel) Reset() { *m = IPRouteAddDel{} } +func (*IPRouteAddDel) GetMessageName() string { return "ip_route_add_del" } +func (*IPRouteAddDel) GetCrcString() string { return "c1ff832d" } +func (*IPRouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPRouteAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.IsMultipath + size += 1 + // field[1] m.Route + // field[2] m.Route.TableID + size += 4 + // field[2] m.Route.StatsIndex + size += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + size += 4 + // field[4] m.Route.Prefix.Address.Un + size += 16 + // field[3] m.Route.Prefix.Len + size += 1 + // field[2] m.Route.NPaths + size += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 FibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + // field[3] s2.SwIfIndex + size += 4 + // field[3] s2.TableID + size += 4 + // field[3] s2.RpfID + size += 4 + // field[3] s2.Weight + size += 1 + // field[3] s2.Preference + size += 1 + // field[3] s2.Type + size += 4 + // field[3] s2.Flags + size += 4 + // field[3] s2.Proto + size += 4 + // field[3] s2.Nh + // field[4] s2.Nh.Address + size += 16 + // field[4] s2.Nh.ViaLabel + size += 4 + // field[4] s2.Nh.ObjID + size += 4 + // field[4] s2.Nh.ClassifyTableIndex + size += 4 + // field[3] s2.NLabels + size += 1 + // field[3] s2.LabelStack + for j3 := 0; j3 < 16; j3++ { + var s3 FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + // field[4] s3.IsUniform + size += 1 + // field[4] s3.Label + size += 4 + // field[4] s3.TTL + size += 1 + // field[4] s3.Exp + size += 1 + } + } + return size +} +func (m *IPRouteAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.IsMultipath + if m.IsMultipath { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Route + // field[2] m.Route.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) + pos += 4 + // field[2] m.Route.StatsIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Route.StatsIndex)) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Address.Af)) + pos += 4 + // field[4] m.Route.Prefix.Address.Un + copy(buf[pos:pos+16], m.Route.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] m.Route.Prefix.Len + buf[pos] = uint8(m.Route.Prefix.Len) + pos += 1 + // field[2] m.Route.NPaths + buf[pos] = uint8(len(m.Route.Paths)) + pos += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var v2 FibPath + if j2 < len(m.Route.Paths) { + v2 = m.Route.Paths[j2] + } + // field[3] v2.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.SwIfIndex)) + pos += 4 + // field[3] v2.TableID + o.PutUint32(buf[pos:pos+4], uint32(v2.TableID)) + pos += 4 + // field[3] v2.RpfID + o.PutUint32(buf[pos:pos+4], uint32(v2.RpfID)) + pos += 4 + // field[3] v2.Weight + buf[pos] = uint8(v2.Weight) + pos += 1 + // field[3] v2.Preference + buf[pos] = uint8(v2.Preference) + pos += 1 + // field[3] v2.Type + o.PutUint32(buf[pos:pos+4], uint32(v2.Type)) + pos += 4 + // field[3] v2.Flags + o.PutUint32(buf[pos:pos+4], uint32(v2.Flags)) + pos += 4 + // field[3] v2.Proto + o.PutUint32(buf[pos:pos+4], uint32(v2.Proto)) + pos += 4 + // field[3] v2.Nh + // field[4] v2.Nh.Address + copy(buf[pos:pos+16], v2.Nh.Address.XXX_UnionData[:]) + pos += 16 + // field[4] v2.Nh.ViaLabel + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ViaLabel)) + pos += 4 + // field[4] v2.Nh.ObjID + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ObjID)) + pos += 4 + // field[4] v2.Nh.ClassifyTableIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ClassifyTableIndex)) + pos += 4 + // field[3] v2.NLabels + buf[pos] = uint8(v2.NLabels) + pos += 1 + // field[3] v2.LabelStack + for j3 := 0; j3 < 16; j3++ { + var v3 FibMplsLabel + if j3 < len(v2.LabelStack) { + v3 = v2.LabelStack[j3] + } + // field[4] v3.IsUniform + buf[pos] = uint8(v3.IsUniform) + pos += 1 + // field[4] v3.Label + o.PutUint32(buf[pos:pos+4], uint32(v3.Label)) + pos += 4 + // field[4] v3.TTL + buf[pos] = uint8(v3.TTL) + pos += 1 + // field[4] v3.Exp + buf[pos] = uint8(v3.Exp) + pos += 1 + } + } + return buf, nil +} +func (m *IPRouteAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.IsMultipath + m.IsMultipath = tmp[pos] != 0 + pos += 1 + // field[1] m.Route + // field[2] m.Route.TableID + m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.StatsIndex + m.Route.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + m.Route.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Prefix.Address.Un + copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.Route.Prefix.Len + m.Route.Prefix.Len = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.NPaths + m.Route.NPaths = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.Paths + m.Route.Paths = make([]FibPath, int(m.Route.NPaths)) + for j2 := 0; j2 < int(m.Route.NPaths); j2++ { + // field[3] m.Route.Paths[j2].SwIfIndex + m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].TableID + m.Route.Paths[j2].TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].RpfID + m.Route.Paths[j2].RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Weight + m.Route.Paths[j2].Weight = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].Preference + m.Route.Paths[j2].Preference = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].Type + m.Route.Paths[j2].Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Flags + m.Route.Paths[j2].Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Proto + m.Route.Paths[j2].Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Nh + // field[4] m.Route.Paths[j2].Nh.Address + copy(m.Route.Paths[j2].Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[4] m.Route.Paths[j2].Nh.ViaLabel + m.Route.Paths[j2].Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Nh.ObjID + m.Route.Paths[j2].Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Nh.ClassifyTableIndex + m.Route.Paths[j2].Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].NLabels + m.Route.Paths[j2].NLabels = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].LabelStack + for j3 := 0; j3 < 16; j3++ { + // field[4] m.Route.Paths[j2].LabelStack[j3].IsUniform + m.Route.Paths[j2].LabelStack[j3].IsUniform = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].LabelStack[j3].Label + m.Route.Paths[j2].LabelStack[j3].Label = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].LabelStack[j3].TTL + m.Route.Paths[j2].LabelStack[j3].TTL = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].LabelStack[j3].Exp + m.Route.Paths[j2].LabelStack[j3].Exp = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// IPRouteAddDelReply represents VPP binary API message 'ip_route_add_del_reply'. +type IPRouteAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` +} + +func (m *IPRouteAddDelReply) Reset() { *m = IPRouteAddDelReply{} } +func (*IPRouteAddDelReply) GetMessageName() string { return "ip_route_add_del_reply" } +func (*IPRouteAddDelReply) GetCrcString() string { return "1992deab" } +func (*IPRouteAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPRouteAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.StatsIndex + size += 4 + return size +} +func (m *IPRouteAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.StatsIndex + o.PutUint32(buf[pos:pos+4], uint32(m.StatsIndex)) + pos += 4 + return buf, nil +} +func (m *IPRouteAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.StatsIndex + m.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPRouteDetails represents VPP binary API message 'ip_route_details'. +type IPRouteDetails struct { + Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` +} + +func (m *IPRouteDetails) Reset() { *m = IPRouteDetails{} } +func (*IPRouteDetails) GetMessageName() string { return "ip_route_details" } +func (*IPRouteDetails) GetCrcString() string { return "d1ffaae1" } +func (*IPRouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPRouteDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Route + // field[2] m.Route.TableID + size += 4 + // field[2] m.Route.StatsIndex + size += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + size += 4 + // field[4] m.Route.Prefix.Address.Un + size += 16 + // field[3] m.Route.Prefix.Len + size += 1 + // field[2] m.Route.NPaths + size += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 FibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + // field[3] s2.SwIfIndex + size += 4 + // field[3] s2.TableID + size += 4 + // field[3] s2.RpfID + size += 4 + // field[3] s2.Weight + size += 1 + // field[3] s2.Preference + size += 1 + // field[3] s2.Type + size += 4 + // field[3] s2.Flags + size += 4 + // field[3] s2.Proto + size += 4 + // field[3] s2.Nh + // field[4] s2.Nh.Address + size += 16 + // field[4] s2.Nh.ViaLabel + size += 4 + // field[4] s2.Nh.ObjID + size += 4 + // field[4] s2.Nh.ClassifyTableIndex + size += 4 + // field[3] s2.NLabels + size += 1 + // field[3] s2.LabelStack + for j3 := 0; j3 < 16; j3++ { + var s3 FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + // field[4] s3.IsUniform + size += 1 + // field[4] s3.Label + size += 4 + // field[4] s3.TTL + size += 1 + // field[4] s3.Exp + size += 1 + } + } + return size +} +func (m *IPRouteDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Route + // field[2] m.Route.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) + pos += 4 + // field[2] m.Route.StatsIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Route.StatsIndex)) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Address.Af)) + pos += 4 + // field[4] m.Route.Prefix.Address.Un + copy(buf[pos:pos+16], m.Route.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] m.Route.Prefix.Len + buf[pos] = uint8(m.Route.Prefix.Len) + pos += 1 + // field[2] m.Route.NPaths + buf[pos] = uint8(len(m.Route.Paths)) + pos += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var v2 FibPath + if j2 < len(m.Route.Paths) { + v2 = m.Route.Paths[j2] + } + // field[3] v2.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.SwIfIndex)) + pos += 4 + // field[3] v2.TableID + o.PutUint32(buf[pos:pos+4], uint32(v2.TableID)) + pos += 4 + // field[3] v2.RpfID + o.PutUint32(buf[pos:pos+4], uint32(v2.RpfID)) + pos += 4 + // field[3] v2.Weight + buf[pos] = uint8(v2.Weight) + pos += 1 + // field[3] v2.Preference + buf[pos] = uint8(v2.Preference) + pos += 1 + // field[3] v2.Type + o.PutUint32(buf[pos:pos+4], uint32(v2.Type)) + pos += 4 + // field[3] v2.Flags + o.PutUint32(buf[pos:pos+4], uint32(v2.Flags)) + pos += 4 + // field[3] v2.Proto + o.PutUint32(buf[pos:pos+4], uint32(v2.Proto)) + pos += 4 + // field[3] v2.Nh + // field[4] v2.Nh.Address + copy(buf[pos:pos+16], v2.Nh.Address.XXX_UnionData[:]) + pos += 16 + // field[4] v2.Nh.ViaLabel + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ViaLabel)) + pos += 4 + // field[4] v2.Nh.ObjID + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ObjID)) + pos += 4 + // field[4] v2.Nh.ClassifyTableIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ClassifyTableIndex)) + pos += 4 + // field[3] v2.NLabels + buf[pos] = uint8(v2.NLabels) + pos += 1 + // field[3] v2.LabelStack + for j3 := 0; j3 < 16; j3++ { + var v3 FibMplsLabel + if j3 < len(v2.LabelStack) { + v3 = v2.LabelStack[j3] + } + // field[4] v3.IsUniform + buf[pos] = uint8(v3.IsUniform) + pos += 1 + // field[4] v3.Label + o.PutUint32(buf[pos:pos+4], uint32(v3.Label)) + pos += 4 + // field[4] v3.TTL + buf[pos] = uint8(v3.TTL) + pos += 1 + // field[4] v3.Exp + buf[pos] = uint8(v3.Exp) + pos += 1 + } + } + return buf, nil +} +func (m *IPRouteDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Route + // field[2] m.Route.TableID + m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.StatsIndex + m.Route.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + m.Route.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Prefix.Address.Un + copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.Route.Prefix.Len + m.Route.Prefix.Len = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.NPaths + m.Route.NPaths = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.Paths + m.Route.Paths = make([]FibPath, int(m.Route.NPaths)) + for j2 := 0; j2 < int(m.Route.NPaths); j2++ { + // field[3] m.Route.Paths[j2].SwIfIndex + m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].TableID + m.Route.Paths[j2].TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].RpfID + m.Route.Paths[j2].RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Weight + m.Route.Paths[j2].Weight = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].Preference + m.Route.Paths[j2].Preference = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].Type + m.Route.Paths[j2].Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Flags + m.Route.Paths[j2].Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Proto + m.Route.Paths[j2].Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Nh + // field[4] m.Route.Paths[j2].Nh.Address + copy(m.Route.Paths[j2].Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[4] m.Route.Paths[j2].Nh.ViaLabel + m.Route.Paths[j2].Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Nh.ObjID + m.Route.Paths[j2].Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Nh.ClassifyTableIndex + m.Route.Paths[j2].Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].NLabels + m.Route.Paths[j2].NLabels = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].LabelStack + for j3 := 0; j3 < 16; j3++ { + // field[4] m.Route.Paths[j2].LabelStack[j3].IsUniform + m.Route.Paths[j2].LabelStack[j3].IsUniform = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].LabelStack[j3].Label + m.Route.Paths[j2].LabelStack[j3].Label = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].LabelStack[j3].TTL + m.Route.Paths[j2].LabelStack[j3].TTL = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].LabelStack[j3].Exp + m.Route.Paths[j2].LabelStack[j3].Exp = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// IPRouteDump represents VPP binary API message 'ip_route_dump'. +type IPRouteDump struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPRouteDump) Reset() { *m = IPRouteDump{} } +func (*IPRouteDump) GetMessageName() string { return "ip_route_dump" } +func (*IPRouteDump) GetCrcString() string { return "b9d2e09e" } +func (*IPRouteDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPRouteDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPRouteDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPRouteDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del'. +type IPSourceAndPortRangeCheckAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + NumberOfRanges uint8 `binapi:"u8,name=number_of_ranges" json:"number_of_ranges,omitempty"` + LowPorts []uint16 `binapi:"u16[32],name=low_ports" json:"low_ports,omitempty" struc:"[32]uint16"` + HighPorts []uint16 `binapi:"u16[32],name=high_ports" json:"high_ports,omitempty" struc:"[32]uint16"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *IPSourceAndPortRangeCheckAddDel) Reset() { *m = IPSourceAndPortRangeCheckAddDel{} } +func (*IPSourceAndPortRangeCheckAddDel) GetMessageName() string { + return "ip_source_and_port_range_check_add_del" +} +func (*IPSourceAndPortRangeCheckAddDel) GetCrcString() string { return "8bfc76f2" } +func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPSourceAndPortRangeCheckAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 4 + // field[3] m.Prefix.Address.Un + size += 16 + // field[2] m.Prefix.Len + size += 1 + // field[1] m.NumberOfRanges + size += 1 + // field[1] m.LowPorts + size += 64 + // field[1] m.HighPorts + size += 64 + // field[1] m.VrfID + size += 4 + return size +} +func (m *IPSourceAndPortRangeCheckAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 + // field[1] m.NumberOfRanges + buf[pos] = uint8(m.NumberOfRanges) + pos += 1 + // field[1] m.LowPorts + for i := 0; i < 32; i++ { + var x uint16 + if i < len(m.LowPorts) { + x = uint16(m.LowPorts[i]) + } + o.PutUint16(buf[pos:pos+2], uint16(x)) + pos += 2 + } + // field[1] m.HighPorts + for i := 0; i < 32; i++ { + var x uint16 + if i < len(m.HighPorts) { + x = uint16(m.HighPorts[i]) + } + o.PutUint16(buf[pos:pos+2], uint16(x)) + pos += 2 + } + // field[1] m.VrfID + o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) + pos += 4 + return buf, nil +} +func (m *IPSourceAndPortRangeCheckAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 + // field[1] m.NumberOfRanges + m.NumberOfRanges = uint8(tmp[pos]) + pos += 1 + // field[1] m.LowPorts + m.LowPorts = make([]uint16, 32) + for i := 0; i < len(m.LowPorts); i++ { + m.LowPorts[i] = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + } + // field[1] m.HighPorts + m.HighPorts = make([]uint16, 32) + for i := 0; i < len(m.HighPorts); i++ { + m.HighPorts[i] = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + } + // field[1] m.VrfID + m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPSourceAndPortRangeCheckAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_add_del_reply'. +type IPSourceAndPortRangeCheckAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPSourceAndPortRangeCheckAddDelReply) Reset() { *m = IPSourceAndPortRangeCheckAddDelReply{} } +func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageName() string { + return "ip_source_and_port_range_check_add_del_reply" +} +func (*IPSourceAndPortRangeCheckAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPSourceAndPortRangeCheckAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPSourceAndPortRangeCheckAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPSourceAndPortRangeCheckAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPSourceAndPortRangeCheckInterfaceAddDel represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del'. +type IPSourceAndPortRangeCheckInterfaceAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TCPInVrfID uint32 `binapi:"u32,name=tcp_in_vrf_id" json:"tcp_in_vrf_id,omitempty"` + TCPOutVrfID uint32 `binapi:"u32,name=tcp_out_vrf_id" json:"tcp_out_vrf_id,omitempty"` + UDPInVrfID uint32 `binapi:"u32,name=udp_in_vrf_id" json:"udp_in_vrf_id,omitempty"` + UDPOutVrfID uint32 `binapi:"u32,name=udp_out_vrf_id" json:"udp_out_vrf_id,omitempty"` +} + +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Reset() { + *m = IPSourceAndPortRangeCheckInterfaceAddDel{} +} +func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageName() string { + return "ip_source_and_port_range_check_interface_add_del" +} +func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetCrcString() string { return "e1ba8987" } +func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.TCPInVrfID + size += 4 + // field[1] m.TCPOutVrfID + size += 4 + // field[1] m.UDPInVrfID + size += 4 + // field[1] m.UDPOutVrfID + size += 4 + return size +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.TCPInVrfID + o.PutUint32(buf[pos:pos+4], uint32(m.TCPInVrfID)) + pos += 4 + // field[1] m.TCPOutVrfID + o.PutUint32(buf[pos:pos+4], uint32(m.TCPOutVrfID)) + pos += 4 + // field[1] m.UDPInVrfID + o.PutUint32(buf[pos:pos+4], uint32(m.UDPInVrfID)) + pos += 4 + // field[1] m.UDPOutVrfID + o.PutUint32(buf[pos:pos+4], uint32(m.UDPOutVrfID)) + pos += 4 + return buf, nil +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TCPInVrfID + m.TCPInVrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TCPOutVrfID + m.TCPOutVrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.UDPInVrfID + m.UDPInVrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.UDPOutVrfID + m.UDPOutVrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPSourceAndPortRangeCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del_reply'. +type IPSourceAndPortRangeCheckInterfaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Reset() { + *m = IPSourceAndPortRangeCheckInterfaceAddDelReply{} +} +func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageName() string { + return "ip_source_and_port_range_check_interface_add_del_reply" +} +func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPSourceCheckInterfaceAddDel represents VPP binary API message 'ip_source_check_interface_add_del'. +type IPSourceCheckInterfaceAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Loose bool `binapi:"bool,name=loose" json:"loose,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IPSourceCheckInterfaceAddDel) Reset() { *m = IPSourceCheckInterfaceAddDel{} } +func (*IPSourceCheckInterfaceAddDel) GetMessageName() string { + return "ip_source_check_interface_add_del" +} +func (*IPSourceCheckInterfaceAddDel) GetCrcString() string { return "6612356b" } +func (*IPSourceCheckInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPSourceCheckInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.Loose + size += 1 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *IPSourceCheckInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Loose + if m.Loose { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *IPSourceCheckInterfaceAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.Loose + m.Loose = tmp[pos] != 0 + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPSourceCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_check_interface_add_del_reply'. +type IPSourceCheckInterfaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPSourceCheckInterfaceAddDelReply) Reset() { *m = IPSourceCheckInterfaceAddDelReply{} } +func (*IPSourceCheckInterfaceAddDelReply) GetMessageName() string { + return "ip_source_check_interface_add_del_reply" +} +func (*IPSourceCheckInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IPSourceCheckInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPSourceCheckInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPSourceCheckInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPSourceCheckInterfaceAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPTableAddDel represents VPP binary API message 'ip_table_add_del'. +type IPTableAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableAddDel) Reset() { *m = IPTableAddDel{} } +func (*IPTableAddDel) GetMessageName() string { return "ip_table_add_del" } +func (*IPTableAddDel) GetCrcString() string { return "0ffdaec0" } +func (*IPTableAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPTableAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPTableAddDelReply represents VPP binary API message 'ip_table_add_del_reply'. +type IPTableAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPTableAddDelReply) Reset() { *m = IPTableAddDelReply{} } +func (*IPTableAddDelReply) GetMessageName() string { return "ip_table_add_del_reply" } +func (*IPTableAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IPTableAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPTableAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPTableAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPTableAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPTableDetails represents VPP binary API message 'ip_table_details'. +type IPTableDetails struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableDetails) Reset() { *m = IPTableDetails{} } +func (*IPTableDetails) GetMessageName() string { return "ip_table_details" } +func (*IPTableDetails) GetCrcString() string { return "c79fca0f" } +func (*IPTableDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPTableDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPTableDump represents VPP binary API message 'ip_table_dump'. +type IPTableDump struct{} + +func (m *IPTableDump) Reset() { *m = IPTableDump{} } +func (*IPTableDump) GetMessageName() string { return "ip_table_dump" } +func (*IPTableDump) GetCrcString() string { return "51077d14" } +func (*IPTableDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPTableDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IPTableDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *IPTableDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// IPTableFlush represents VPP binary API message 'ip_table_flush'. +type IPTableFlush struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableFlush) Reset() { *m = IPTableFlush{} } +func (*IPTableFlush) GetMessageName() string { return "ip_table_flush" } +func (*IPTableFlush) GetCrcString() string { return "b9d2e09e" } +func (*IPTableFlush) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPTableFlush) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableFlush) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableFlush) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPTableFlushReply represents VPP binary API message 'ip_table_flush_reply'. +type IPTableFlushReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPTableFlushReply) Reset() { *m = IPTableFlushReply{} } +func (*IPTableFlushReply) GetMessageName() string { return "ip_table_flush_reply" } +func (*IPTableFlushReply) GetCrcString() string { return "e8d4e804" } +func (*IPTableFlushReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPTableFlushReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPTableFlushReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPTableFlushReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPTableReplaceBegin represents VPP binary API message 'ip_table_replace_begin'. +type IPTableReplaceBegin struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableReplaceBegin) Reset() { *m = IPTableReplaceBegin{} } +func (*IPTableReplaceBegin) GetMessageName() string { return "ip_table_replace_begin" } +func (*IPTableReplaceBegin) GetCrcString() string { return "b9d2e09e" } +func (*IPTableReplaceBegin) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPTableReplaceBegin) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableReplaceBegin) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableReplaceBegin) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPTableReplaceBeginReply represents VPP binary API message 'ip_table_replace_begin_reply'. +type IPTableReplaceBeginReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPTableReplaceBeginReply) Reset() { *m = IPTableReplaceBeginReply{} } +func (*IPTableReplaceBeginReply) GetMessageName() string { return "ip_table_replace_begin_reply" } +func (*IPTableReplaceBeginReply) GetCrcString() string { return "e8d4e804" } +func (*IPTableReplaceBeginReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPTableReplaceBeginReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPTableReplaceBeginReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPTableReplaceBeginReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPTableReplaceEnd represents VPP binary API message 'ip_table_replace_end'. +type IPTableReplaceEnd struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableReplaceEnd) Reset() { *m = IPTableReplaceEnd{} } +func (*IPTableReplaceEnd) GetMessageName() string { return "ip_table_replace_end" } +func (*IPTableReplaceEnd) GetCrcString() string { return "b9d2e09e" } +func (*IPTableReplaceEnd) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPTableReplaceEnd) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableReplaceEnd) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableReplaceEnd) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPTableReplaceEndReply represents VPP binary API message 'ip_table_replace_end_reply'. +type IPTableReplaceEndReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPTableReplaceEndReply) Reset() { *m = IPTableReplaceEndReply{} } +func (*IPTableReplaceEndReply) GetMessageName() string { return "ip_table_replace_end_reply" } +func (*IPTableReplaceEndReply) GetCrcString() string { return "e8d4e804" } +func (*IPTableReplaceEndReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPTableReplaceEndReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPTableReplaceEndReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPTableReplaceEndReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPUnnumberedDetails represents VPP binary API message 'ip_unnumbered_details'. +type IPUnnumberedDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IPSwIfIndex InterfaceIndex `binapi:"interface_index,name=ip_sw_if_index" json:"ip_sw_if_index,omitempty"` +} + +func (m *IPUnnumberedDetails) Reset() { *m = IPUnnumberedDetails{} } +func (*IPUnnumberedDetails) GetMessageName() string { return "ip_unnumbered_details" } +func (*IPUnnumberedDetails) GetCrcString() string { return "aa12a483" } +func (*IPUnnumberedDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPUnnumberedDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IPSwIfIndex + size += 4 + return size +} +func (m *IPUnnumberedDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IPSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.IPSwIfIndex)) + pos += 4 + return buf, nil +} +func (m *IPUnnumberedDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IPSwIfIndex + m.IPSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPUnnumberedDump represents VPP binary API message 'ip_unnumbered_dump'. +type IPUnnumberedDump struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IPUnnumberedDump) Reset() { *m = IPUnnumberedDump{} } +func (*IPUnnumberedDump) GetMessageName() string { return "ip_unnumbered_dump" } +func (*IPUnnumberedDump) GetCrcString() string { return "f9e6675e" } +func (*IPUnnumberedDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPUnnumberedDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *IPUnnumberedDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *IPUnnumberedDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MfibSignalDetails represents VPP binary API message 'mfib_signal_details'. +type MfibSignalDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Prefix Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` + IPPacketLen uint16 `binapi:"u16,name=ip_packet_len" json:"ip_packet_len,omitempty"` + IPPacketData []byte `binapi:"u8[256],name=ip_packet_data" json:"ip_packet_data,omitempty" struc:"[256]byte"` +} + +func (m *MfibSignalDetails) Reset() { *m = MfibSignalDetails{} } +func (*MfibSignalDetails) GetMessageName() string { return "mfib_signal_details" } +func (*MfibSignalDetails) GetCrcString() string { return "64398a9a" } +func (*MfibSignalDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MfibSignalDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.TableID + size += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Af + size += 4 + // field[2] m.Prefix.GrpAddressLength + size += 2 + // field[2] m.Prefix.GrpAddress + size += 16 + // field[2] m.Prefix.SrcAddress + size += 16 + // field[1] m.IPPacketLen + size += 2 + // field[1] m.IPPacketData + size += 256 + return size +} +func (m *MfibSignalDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.TableID)) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Af)) + pos += 4 + // field[2] m.Prefix.GrpAddressLength + o.PutUint16(buf[pos:pos+2], uint16(m.Prefix.GrpAddressLength)) + pos += 2 + // field[2] m.Prefix.GrpAddress + copy(buf[pos:pos+16], m.Prefix.GrpAddress.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.SrcAddress + copy(buf[pos:pos+16], m.Prefix.SrcAddress.XXX_UnionData[:]) + pos += 16 + // field[1] m.IPPacketLen + o.PutUint16(buf[pos:pos+2], uint16(m.IPPacketLen)) + pos += 2 + // field[1] m.IPPacketData + for i := 0; i < 256; i++ { + var x uint8 + if i < len(m.IPPacketData) { + x = uint8(m.IPPacketData[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *MfibSignalDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TableID + m.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Af + m.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Prefix.GrpAddressLength + m.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.Prefix.GrpAddress + copy(m.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.SrcAddress + copy(m.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[1] m.IPPacketLen + m.IPPacketLen = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.IPPacketData + m.IPPacketData = make([]uint8, 256) + for i := 0; i < len(m.IPPacketData); i++ { + m.IPPacketData[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// MfibSignalDump represents VPP binary API message 'mfib_signal_dump'. +type MfibSignalDump struct{} + +func (m *MfibSignalDump) Reset() { *m = MfibSignalDump{} } +func (*MfibSignalDump) GetMessageName() string { return "mfib_signal_dump" } +func (*MfibSignalDump) GetCrcString() string { return "51077d14" } +func (*MfibSignalDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MfibSignalDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MfibSignalDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *MfibSignalDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// SetIPFlowHash represents VPP binary API message 'set_ip_flow_hash'. +type SetIPFlowHash struct { + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + Src bool `binapi:"bool,name=src" json:"src,omitempty"` + Dst bool `binapi:"bool,name=dst" json:"dst,omitempty"` + Sport bool `binapi:"bool,name=sport" json:"sport,omitempty"` + Dport bool `binapi:"bool,name=dport" json:"dport,omitempty"` + Proto bool `binapi:"bool,name=proto" json:"proto,omitempty"` + Reverse bool `binapi:"bool,name=reverse" json:"reverse,omitempty"` + Symmetric bool `binapi:"bool,name=symmetric" json:"symmetric,omitempty"` +} + +func (m *SetIPFlowHash) Reset() { *m = SetIPFlowHash{} } +func (*SetIPFlowHash) GetMessageName() string { return "set_ip_flow_hash" } +func (*SetIPFlowHash) GetCrcString() string { return "084ee09e" } +func (*SetIPFlowHash) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SetIPFlowHash) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.VrfID + size += 4 + // field[1] m.IsIPv6 + size += 1 + // field[1] m.Src + size += 1 + // field[1] m.Dst + size += 1 + // field[1] m.Sport + size += 1 + // field[1] m.Dport + size += 1 + // field[1] m.Proto + size += 1 + // field[1] m.Reverse + size += 1 + // field[1] m.Symmetric + size += 1 + return size +} +func (m *SetIPFlowHash) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.VrfID + o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Src + if m.Src { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Dst + if m.Dst { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Sport + if m.Sport { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Dport + if m.Dport { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Proto + if m.Proto { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Reverse + if m.Reverse { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Symmetric + if m.Symmetric { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SetIPFlowHash) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.VrfID + m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + // field[1] m.Src + m.Src = tmp[pos] != 0 + pos += 1 + // field[1] m.Dst + m.Dst = tmp[pos] != 0 + pos += 1 + // field[1] m.Sport + m.Sport = tmp[pos] != 0 + pos += 1 + // field[1] m.Dport + m.Dport = tmp[pos] != 0 + pos += 1 + // field[1] m.Proto + m.Proto = tmp[pos] != 0 + pos += 1 + // field[1] m.Reverse + m.Reverse = tmp[pos] != 0 + pos += 1 + // field[1] m.Symmetric + m.Symmetric = tmp[pos] != 0 + pos += 1 + return nil +} + +// SetIPFlowHashReply represents VPP binary API message 'set_ip_flow_hash_reply'. +type SetIPFlowHashReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SetIPFlowHashReply) Reset() { *m = SetIPFlowHashReply{} } +func (*SetIPFlowHashReply) GetMessageName() string { return "set_ip_flow_hash_reply" } +func (*SetIPFlowHashReply) GetCrcString() string { return "e8d4e804" } +func (*SetIPFlowHashReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SetIPFlowHashReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SetIPFlowHashReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SetIPFlowHashReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceIP6EnableDisable represents VPP binary API message 'sw_interface_ip6_enable_disable'. +type SwInterfaceIP6EnableDisable struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *SwInterfaceIP6EnableDisable) Reset() { *m = SwInterfaceIP6EnableDisable{} } +func (*SwInterfaceIP6EnableDisable) GetMessageName() string { return "sw_interface_ip6_enable_disable" } +func (*SwInterfaceIP6EnableDisable) GetCrcString() string { return "ae6cfcfb" } +func (*SwInterfaceIP6EnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceIP6EnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Enable + size += 1 + return size +} +func (m *SwInterfaceIP6EnableDisable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Enable + if m.Enable { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceIP6EnableDisable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Enable + m.Enable = tmp[pos] != 0 + pos += 1 + return nil +} + +// SwInterfaceIP6EnableDisableReply represents VPP binary API message 'sw_interface_ip6_enable_disable_reply'. +type SwInterfaceIP6EnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceIP6EnableDisableReply) Reset() { *m = SwInterfaceIP6EnableDisableReply{} } +func (*SwInterfaceIP6EnableDisableReply) GetMessageName() string { + return "sw_interface_ip6_enable_disable_reply" +} +func (*SwInterfaceIP6EnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceIP6EnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceIP6EnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceIP6EnableDisableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceIP6EnableDisableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceIP6SetLinkLocalAddress represents VPP binary API message 'sw_interface_ip6_set_link_local_address'. +type SwInterfaceIP6SetLinkLocalAddress struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP IP6Address `binapi:"ip6_address,name=ip" json:"ip,omitempty"` +} + +func (m *SwInterfaceIP6SetLinkLocalAddress) Reset() { *m = SwInterfaceIP6SetLinkLocalAddress{} } +func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageName() string { + return "sw_interface_ip6_set_link_local_address" +} +func (*SwInterfaceIP6SetLinkLocalAddress) GetCrcString() string { return "2931d9fa" } +func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceIP6SetLinkLocalAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IP + size += 16 + return size +} +func (m *SwInterfaceIP6SetLinkLocalAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IP + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.IP) { + x = uint8(m.IP[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SwInterfaceIP6SetLinkLocalAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IP + for i := 0; i < len(m.IP); i++ { + m.IP[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SwInterfaceIP6SetLinkLocalAddressReply represents VPP binary API message 'sw_interface_ip6_set_link_local_address_reply'. +type SwInterfaceIP6SetLinkLocalAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Reset() { + *m = SwInterfaceIP6SetLinkLocalAddressReply{} +} +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageName() string { + return "sw_interface_ip6_set_link_local_address_reply" +} +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +func init() { file_ip_binapi_init() } +func file_ip_binapi_init() { + api.RegisterMessage((*IoamDisable)(nil), "ip.IoamDisable") + api.RegisterMessage((*IoamDisableReply)(nil), "ip.IoamDisableReply") + api.RegisterMessage((*IoamEnable)(nil), "ip.IoamEnable") + api.RegisterMessage((*IoamEnableReply)(nil), "ip.IoamEnableReply") + api.RegisterMessage((*IPAddressDetails)(nil), "ip.IPAddressDetails") + api.RegisterMessage((*IPAddressDump)(nil), "ip.IPAddressDump") + api.RegisterMessage((*IPContainerProxyAddDel)(nil), "ip.IPContainerProxyAddDel") + api.RegisterMessage((*IPContainerProxyAddDelReply)(nil), "ip.IPContainerProxyAddDelReply") + api.RegisterMessage((*IPContainerProxyDetails)(nil), "ip.IPContainerProxyDetails") + api.RegisterMessage((*IPContainerProxyDump)(nil), "ip.IPContainerProxyDump") + api.RegisterMessage((*IPDetails)(nil), "ip.IPDetails") + api.RegisterMessage((*IPDump)(nil), "ip.IPDump") + api.RegisterMessage((*IPMrouteAddDel)(nil), "ip.IPMrouteAddDel") + api.RegisterMessage((*IPMrouteAddDelReply)(nil), "ip.IPMrouteAddDelReply") + api.RegisterMessage((*IPMrouteDetails)(nil), "ip.IPMrouteDetails") + api.RegisterMessage((*IPMrouteDump)(nil), "ip.IPMrouteDump") + api.RegisterMessage((*IPMtableDetails)(nil), "ip.IPMtableDetails") + api.RegisterMessage((*IPMtableDump)(nil), "ip.IPMtableDump") + api.RegisterMessage((*IPPuntPolice)(nil), "ip.IPPuntPolice") + api.RegisterMessage((*IPPuntPoliceReply)(nil), "ip.IPPuntPoliceReply") + api.RegisterMessage((*IPPuntRedirect)(nil), "ip.IPPuntRedirect") + api.RegisterMessage((*IPPuntRedirectDetails)(nil), "ip.IPPuntRedirectDetails") + api.RegisterMessage((*IPPuntRedirectDump)(nil), "ip.IPPuntRedirectDump") + api.RegisterMessage((*IPPuntRedirectReply)(nil), "ip.IPPuntRedirectReply") + api.RegisterMessage((*IPReassemblyEnableDisable)(nil), "ip.IPReassemblyEnableDisable") + api.RegisterMessage((*IPReassemblyEnableDisableReply)(nil), "ip.IPReassemblyEnableDisableReply") + api.RegisterMessage((*IPReassemblyGet)(nil), "ip.IPReassemblyGet") + api.RegisterMessage((*IPReassemblyGetReply)(nil), "ip.IPReassemblyGetReply") + api.RegisterMessage((*IPReassemblySet)(nil), "ip.IPReassemblySet") + api.RegisterMessage((*IPReassemblySetReply)(nil), "ip.IPReassemblySetReply") + api.RegisterMessage((*IPRouteAddDel)(nil), "ip.IPRouteAddDel") + api.RegisterMessage((*IPRouteAddDelReply)(nil), "ip.IPRouteAddDelReply") + api.RegisterMessage((*IPRouteDetails)(nil), "ip.IPRouteDetails") + api.RegisterMessage((*IPRouteDump)(nil), "ip.IPRouteDump") + api.RegisterMessage((*IPSourceAndPortRangeCheckAddDel)(nil), "ip.IPSourceAndPortRangeCheckAddDel") + api.RegisterMessage((*IPSourceAndPortRangeCheckAddDelReply)(nil), "ip.IPSourceAndPortRangeCheckAddDelReply") + api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), "ip.IPSourceAndPortRangeCheckInterfaceAddDel") + api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), "ip.IPSourceAndPortRangeCheckInterfaceAddDelReply") + api.RegisterMessage((*IPSourceCheckInterfaceAddDel)(nil), "ip.IPSourceCheckInterfaceAddDel") + api.RegisterMessage((*IPSourceCheckInterfaceAddDelReply)(nil), "ip.IPSourceCheckInterfaceAddDelReply") + api.RegisterMessage((*IPTableAddDel)(nil), "ip.IPTableAddDel") + api.RegisterMessage((*IPTableAddDelReply)(nil), "ip.IPTableAddDelReply") + api.RegisterMessage((*IPTableDetails)(nil), "ip.IPTableDetails") + api.RegisterMessage((*IPTableDump)(nil), "ip.IPTableDump") + api.RegisterMessage((*IPTableFlush)(nil), "ip.IPTableFlush") + api.RegisterMessage((*IPTableFlushReply)(nil), "ip.IPTableFlushReply") + api.RegisterMessage((*IPTableReplaceBegin)(nil), "ip.IPTableReplaceBegin") + api.RegisterMessage((*IPTableReplaceBeginReply)(nil), "ip.IPTableReplaceBeginReply") + api.RegisterMessage((*IPTableReplaceEnd)(nil), "ip.IPTableReplaceEnd") + api.RegisterMessage((*IPTableReplaceEndReply)(nil), "ip.IPTableReplaceEndReply") + api.RegisterMessage((*IPUnnumberedDetails)(nil), "ip.IPUnnumberedDetails") + api.RegisterMessage((*IPUnnumberedDump)(nil), "ip.IPUnnumberedDump") + api.RegisterMessage((*MfibSignalDetails)(nil), "ip.MfibSignalDetails") + api.RegisterMessage((*MfibSignalDump)(nil), "ip.MfibSignalDump") + api.RegisterMessage((*SetIPFlowHash)(nil), "ip.SetIPFlowHash") + api.RegisterMessage((*SetIPFlowHashReply)(nil), "ip.SetIPFlowHashReply") + api.RegisterMessage((*SwInterfaceIP6EnableDisable)(nil), "ip.SwInterfaceIP6EnableDisable") + api.RegisterMessage((*SwInterfaceIP6EnableDisableReply)(nil), "ip.SwInterfaceIP6EnableDisableReply") + api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddress)(nil), "ip.SwInterfaceIP6SetLinkLocalAddress") + api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddressReply)(nil), "ip.SwInterfaceIP6SetLinkLocalAddressReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IoamDisable)(nil), + (*IoamDisableReply)(nil), + (*IoamEnable)(nil), + (*IoamEnableReply)(nil), + (*IPAddressDetails)(nil), + (*IPAddressDump)(nil), + (*IPContainerProxyAddDel)(nil), + (*IPContainerProxyAddDelReply)(nil), + (*IPContainerProxyDetails)(nil), + (*IPContainerProxyDump)(nil), + (*IPDetails)(nil), + (*IPDump)(nil), + (*IPMrouteAddDel)(nil), + (*IPMrouteAddDelReply)(nil), + (*IPMrouteDetails)(nil), + (*IPMrouteDump)(nil), + (*IPMtableDetails)(nil), + (*IPMtableDump)(nil), + (*IPPuntPolice)(nil), + (*IPPuntPoliceReply)(nil), + (*IPPuntRedirect)(nil), + (*IPPuntRedirectDetails)(nil), + (*IPPuntRedirectDump)(nil), + (*IPPuntRedirectReply)(nil), + (*IPReassemblyEnableDisable)(nil), + (*IPReassemblyEnableDisableReply)(nil), + (*IPReassemblyGet)(nil), + (*IPReassemblyGetReply)(nil), + (*IPReassemblySet)(nil), + (*IPReassemblySetReply)(nil), + (*IPRouteAddDel)(nil), + (*IPRouteAddDelReply)(nil), + (*IPRouteDetails)(nil), + (*IPRouteDump)(nil), + (*IPSourceAndPortRangeCheckAddDel)(nil), + (*IPSourceAndPortRangeCheckAddDelReply)(nil), + (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), + (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), + (*IPSourceCheckInterfaceAddDel)(nil), + (*IPSourceCheckInterfaceAddDelReply)(nil), + (*IPTableAddDel)(nil), + (*IPTableAddDelReply)(nil), + (*IPTableDetails)(nil), + (*IPTableDump)(nil), + (*IPTableFlush)(nil), + (*IPTableFlushReply)(nil), + (*IPTableReplaceBegin)(nil), + (*IPTableReplaceBeginReply)(nil), + (*IPTableReplaceEnd)(nil), + (*IPTableReplaceEndReply)(nil), + (*IPUnnumberedDetails)(nil), + (*IPUnnumberedDump)(nil), + (*MfibSignalDetails)(nil), + (*MfibSignalDump)(nil), + (*SetIPFlowHash)(nil), + (*SetIPFlowHashReply)(nil), + (*SwInterfaceIP6EnableDisable)(nil), + (*SwInterfaceIP6EnableDisableReply)(nil), + (*SwInterfaceIP6SetLinkLocalAddress)(nil), + (*SwInterfaceIP6SetLinkLocalAddressReply)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/ip/ip_rpc.ba.go b/codec/testdata/binapi2001/ip/ip_rpc.ba.go new file mode 100644 index 0000000..e0580d5 --- /dev/null +++ b/codec/testdata/binapi2001/ip/ip_rpc.ba.go @@ -0,0 +1,497 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ip + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for ip module. +type RPCService interface { + DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) + DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) + DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) + DumpIPMroute(ctx context.Context, in *IPMrouteDump) (RPCService_DumpIPMrouteClient, error) + DumpIPMtable(ctx context.Context, in *IPMtableDump) (RPCService_DumpIPMtableClient, error) + DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) + DumpIPRoute(ctx context.Context, in *IPRouteDump) (RPCService_DumpIPRouteClient, error) + DumpIPTable(ctx context.Context, in *IPTableDump) (RPCService_DumpIPTableClient, error) + DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) + DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) + IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) + IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) + IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) + IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) + IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) + IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) + IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) + IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) + IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) + IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) + IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) + IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) + IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) + IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) + IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) + IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) + IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) + SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) + SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) + SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPAddressClient{stream} + return x, nil +} + +type RPCService_DumpIPAddressClient interface { + Recv() (*IPAddressDetails, error) +} + +type serviceClient_DumpIPAddressClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPAddressClient) Recv() (*IPAddressDetails, error) { + m := new(IPAddressDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPContainerProxyClient{stream} + return x, nil +} + +type RPCService_DumpIPContainerProxyClient interface { + Recv() (*IPContainerProxyDetails, error) +} + +type serviceClient_DumpIPContainerProxyClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPContainerProxyClient) Recv() (*IPContainerProxyDetails, error) { + m := new(IPContainerProxyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPClient{stream} + return x, nil +} + +type RPCService_DumpIPClient interface { + Recv() (*IPDetails, error) +} + +type serviceClient_DumpIPClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPClient) Recv() (*IPDetails, error) { + m := new(IPDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPMroute(ctx context.Context, in *IPMrouteDump) (RPCService_DumpIPMrouteClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPMrouteClient{stream} + return x, nil +} + +type RPCService_DumpIPMrouteClient interface { + Recv() (*IPMrouteDetails, error) +} + +type serviceClient_DumpIPMrouteClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPMrouteClient) Recv() (*IPMrouteDetails, error) { + m := new(IPMrouteDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPMtable(ctx context.Context, in *IPMtableDump) (RPCService_DumpIPMtableClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPMtableClient{stream} + return x, nil +} + +type RPCService_DumpIPMtableClient interface { + Recv() (*IPMtableDetails, error) +} + +type serviceClient_DumpIPMtableClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPMtableClient) Recv() (*IPMtableDetails, error) { + m := new(IPMtableDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPPuntRedirectClient{stream} + return x, nil +} + +type RPCService_DumpIPPuntRedirectClient interface { + Recv() (*IPPuntRedirectDetails, error) +} + +type serviceClient_DumpIPPuntRedirectClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPPuntRedirectClient) Recv() (*IPPuntRedirectDetails, error) { + m := new(IPPuntRedirectDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPRoute(ctx context.Context, in *IPRouteDump) (RPCService_DumpIPRouteClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPRouteClient{stream} + return x, nil +} + +type RPCService_DumpIPRouteClient interface { + Recv() (*IPRouteDetails, error) +} + +type serviceClient_DumpIPRouteClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPRouteClient) Recv() (*IPRouteDetails, error) { + m := new(IPRouteDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPTable(ctx context.Context, in *IPTableDump) (RPCService_DumpIPTableClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPTableClient{stream} + return x, nil +} + +type RPCService_DumpIPTableClient interface { + Recv() (*IPTableDetails, error) +} + +type serviceClient_DumpIPTableClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPTableClient) Recv() (*IPTableDetails, error) { + m := new(IPTableDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPUnnumberedClient{stream} + return x, nil +} + +type RPCService_DumpIPUnnumberedClient interface { + Recv() (*IPUnnumberedDetails, error) +} + +type serviceClient_DumpIPUnnumberedClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPUnnumberedClient) Recv() (*IPUnnumberedDetails, error) { + m := new(IPUnnumberedDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMfibSignalClient{stream} + return x, nil +} + +type RPCService_DumpMfibSignalClient interface { + Recv() (*MfibSignalDetails, error) +} + +type serviceClient_DumpMfibSignalClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMfibSignalClient) Recv() (*MfibSignalDetails, error) { + m := new(MfibSignalDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) { + out := new(IoamDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) { + out := new(IoamEnableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) { + out := new(IPContainerProxyAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) { + out := new(IPMrouteAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) { + out := new(IPPuntPoliceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) { + out := new(IPPuntRedirectReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) { + out := new(IPReassemblyEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) { + out := new(IPReassemblyGetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) { + out := new(IPReassemblySetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) { + out := new(IPRouteAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) { + out := new(IPSourceCheckInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) { + out := new(IPTableAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) { + out := new(IPTableFlushReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) { + out := new(IPTableReplaceBeginReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) { + out := new(IPTableReplaceEndReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) { + out := new(SetIPFlowHashReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) { + out := new(SwInterfaceIP6EnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) { + out := new(SwInterfaceIP6SetLinkLocalAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/codec/testdata/binapi2001/memclnt/memclnt.ba.go b/codec/testdata/binapi2001/memclnt/memclnt.ba.go new file mode 100644 index 0000000..0b251ce --- /dev/null +++ b/codec/testdata/binapi2001/memclnt/memclnt.ba.go @@ -0,0 +1,1450 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/memclnt.api.json + +/* +Package memclnt contains generated code for VPP binary API defined by memclnt.api (version 2.1.0). + +It consists of: + 22 messages + 2 types +*/ +package memclnt + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "memclnt" + // APIVersion is the API version of this module. + APIVersion = "2.1.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x8d3dd881 +) + +// MessageTableEntry represents VPP binary API type 'message_table_entry'. +type MessageTableEntry struct { + Index uint16 `binapi:"u16,name=index" json:"index,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` +} + +func (*MessageTableEntry) GetTypeName() string { return "message_table_entry" } + +// ModuleVersion represents VPP binary API type 'module_version'. +type ModuleVersion struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` + Patch uint32 `binapi:"u32,name=patch" json:"patch,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` +} + +func (*ModuleVersion) GetTypeName() string { return "module_version" } + +// APIVersions represents VPP binary API message 'api_versions'. +type APIVersions struct{} + +func (m *APIVersions) Reset() { *m = APIVersions{} } +func (*APIVersions) GetMessageName() string { return "api_versions" } +func (*APIVersions) GetCrcString() string { return "51077d14" } +func (*APIVersions) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *APIVersions) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *APIVersions) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *APIVersions) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// APIVersionsReply represents VPP binary API message 'api_versions_reply'. +type APIVersionsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=APIVersions"` + APIVersions []ModuleVersion `binapi:"module_version[count],name=api_versions" json:"api_versions,omitempty"` +} + +func (m *APIVersionsReply) Reset() { *m = APIVersionsReply{} } +func (*APIVersionsReply) GetMessageName() string { return "api_versions_reply" } +func (*APIVersionsReply) GetCrcString() string { return "5f0d99d6" } +func (*APIVersionsReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *APIVersionsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.Count + size += 4 + // field[1] m.APIVersions + for j1 := 0; j1 < len(m.APIVersions); j1++ { + var s1 ModuleVersion + _ = s1 + if j1 < len(m.APIVersions) { + s1 = m.APIVersions[j1] + } + // field[2] s1.Major + size += 4 + // field[2] s1.Minor + size += 4 + // field[2] s1.Patch + size += 4 + // field[2] s1.Name + size += 64 + } + return size +} +func (m *APIVersionsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.APIVersions))) + pos += 4 + // field[1] m.APIVersions + for j1 := 0; j1 < len(m.APIVersions); j1++ { + var v1 ModuleVersion + if j1 < len(m.APIVersions) { + v1 = m.APIVersions[j1] + } + // field[2] v1.Major + o.PutUint32(buf[pos:pos+4], uint32(v1.Major)) + pos += 4 + // field[2] v1.Minor + o.PutUint32(buf[pos:pos+4], uint32(v1.Minor)) + pos += 4 + // field[2] v1.Patch + o.PutUint32(buf[pos:pos+4], uint32(v1.Patch)) + pos += 4 + // field[2] v1.Name + copy(buf[pos:pos+64], v1.Name) + pos += 64 + } + return buf, nil +} +func (m *APIVersionsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.APIVersions + m.APIVersions = make([]ModuleVersion, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.APIVersions[j1].Major + m.APIVersions[j1].Major = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.APIVersions[j1].Minor + m.APIVersions[j1].Minor = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.APIVersions[j1].Patch + m.APIVersions[j1].Patch = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.APIVersions[j1].Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.APIVersions[j1].Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + } + return nil +} + +// GetFirstMsgID represents VPP binary API message 'get_first_msg_id'. +type GetFirstMsgID struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` +} + +func (m *GetFirstMsgID) Reset() { *m = GetFirstMsgID{} } +func (*GetFirstMsgID) GetMessageName() string { return "get_first_msg_id" } +func (*GetFirstMsgID) GetCrcString() string { return "ebf79a66" } +func (*GetFirstMsgID) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *GetFirstMsgID) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Name + size += 64 + return size +} +func (m *GetFirstMsgID) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Name + copy(buf[pos:pos+64], m.Name) + pos += 64 + return buf, nil +} +func (m *GetFirstMsgID) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// GetFirstMsgIDReply represents VPP binary API message 'get_first_msg_id_reply'. +type GetFirstMsgIDReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + FirstMsgID uint16 `binapi:"u16,name=first_msg_id" json:"first_msg_id,omitempty"` +} + +func (m *GetFirstMsgIDReply) Reset() { *m = GetFirstMsgIDReply{} } +func (*GetFirstMsgIDReply) GetMessageName() string { return "get_first_msg_id_reply" } +func (*GetFirstMsgIDReply) GetCrcString() string { return "7d337472" } +func (*GetFirstMsgIDReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *GetFirstMsgIDReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.FirstMsgID + size += 2 + return size +} +func (m *GetFirstMsgIDReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.FirstMsgID + o.PutUint16(buf[pos:pos+2], uint16(m.FirstMsgID)) + pos += 2 + return buf, nil +} +func (m *GetFirstMsgIDReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.FirstMsgID + m.FirstMsgID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + +// MemclntCreate represents VPP binary API message 'memclnt_create'. +type MemclntCreate struct { + CtxQuota int32 `binapi:"i32,name=ctx_quota" json:"ctx_quota,omitempty"` + InputQueue uint64 `binapi:"u64,name=input_queue" json:"input_queue,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` + APIVersions []uint32 `binapi:"u32[8],name=api_versions" json:"api_versions,omitempty" struc:"[8]uint32"` +} + +func (m *MemclntCreate) Reset() { *m = MemclntCreate{} } +func (*MemclntCreate) GetMessageName() string { return "memclnt_create" } +func (*MemclntCreate) GetCrcString() string { return "9c5e1c2f" } +func (*MemclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemclntCreate) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.CtxQuota + size += 4 + // field[1] m.InputQueue + size += 8 + // field[1] m.Name + size += 64 + // field[1] m.APIVersions + size += 32 + return size +} +func (m *MemclntCreate) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.CtxQuota + o.PutUint32(buf[pos:pos+4], uint32(m.CtxQuota)) + pos += 4 + // field[1] m.InputQueue + o.PutUint64(buf[pos:pos+8], uint64(m.InputQueue)) + pos += 8 + // field[1] m.Name + copy(buf[pos:pos+64], m.Name) + pos += 64 + // field[1] m.APIVersions + for i := 0; i < 8; i++ { + var x uint32 + if i < len(m.APIVersions) { + x = uint32(m.APIVersions[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *MemclntCreate) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.CtxQuota + m.CtxQuota = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.InputQueue + m.InputQueue = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + // field[1] m.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + // field[1] m.APIVersions + m.APIVersions = make([]uint32, 8) + for i := 0; i < len(m.APIVersions); i++ { + m.APIVersions[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + +// MemclntCreateReply represents VPP binary API message 'memclnt_create_reply'. +type MemclntCreateReply struct { + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` + Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + MessageTable uint64 `binapi:"u64,name=message_table" json:"message_table,omitempty"` +} + +func (m *MemclntCreateReply) Reset() { *m = MemclntCreateReply{} } +func (*MemclntCreateReply) GetMessageName() string { return "memclnt_create_reply" } +func (*MemclntCreateReply) GetCrcString() string { return "42ec4560" } +func (*MemclntCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemclntCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Response + size += 4 + // field[1] m.Handle + size += 8 + // field[1] m.Index + size += 4 + // field[1] m.MessageTable + size += 8 + return size +} +func (m *MemclntCreateReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Response + o.PutUint32(buf[pos:pos+4], uint32(m.Response)) + pos += 4 + // field[1] m.Handle + o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) + pos += 8 + // field[1] m.Index + o.PutUint32(buf[pos:pos+4], uint32(m.Index)) + pos += 4 + // field[1] m.MessageTable + o.PutUint64(buf[pos:pos+8], uint64(m.MessageTable)) + pos += 8 + return buf, nil +} +func (m *MemclntCreateReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Response + m.Response = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Handle + m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + // field[1] m.Index + m.Index = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MessageTable + m.MessageTable = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + +// MemclntDelete represents VPP binary API message 'memclnt_delete'. +type MemclntDelete struct { + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` + DoCleanup bool `binapi:"bool,name=do_cleanup" json:"do_cleanup,omitempty"` +} + +func (m *MemclntDelete) Reset() { *m = MemclntDelete{} } +func (*MemclntDelete) GetMessageName() string { return "memclnt_delete" } +func (*MemclntDelete) GetCrcString() string { return "7e1c04e3" } +func (*MemclntDelete) GetMessageType() api.MessageType { return api.OtherMessage } + +func (m *MemclntDelete) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Index + size += 4 + // field[1] m.Handle + size += 8 + // field[1] m.DoCleanup + size += 1 + return size +} +func (m *MemclntDelete) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Index + o.PutUint32(buf[pos:pos+4], uint32(m.Index)) + pos += 4 + // field[1] m.Handle + o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) + pos += 8 + // field[1] m.DoCleanup + if m.DoCleanup { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *MemclntDelete) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Index + m.Index = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Handle + m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + // field[1] m.DoCleanup + m.DoCleanup = tmp[pos] != 0 + pos += 1 + return nil +} + +// MemclntDeleteReply represents VPP binary API message 'memclnt_delete_reply'. +type MemclntDeleteReply struct { + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` + Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` +} + +func (m *MemclntDeleteReply) Reset() { *m = MemclntDeleteReply{} } +func (*MemclntDeleteReply) GetMessageName() string { return "memclnt_delete_reply" } +func (*MemclntDeleteReply) GetCrcString() string { return "3d3b6312" } +func (*MemclntDeleteReply) GetMessageType() api.MessageType { return api.OtherMessage } + +func (m *MemclntDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Response + size += 4 + // field[1] m.Handle + size += 8 + return size +} +func (m *MemclntDeleteReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Response + o.PutUint32(buf[pos:pos+4], uint32(m.Response)) + pos += 4 + // field[1] m.Handle + o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) + pos += 8 + return buf, nil +} +func (m *MemclntDeleteReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Response + m.Response = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Handle + m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + +// MemclntKeepalive represents VPP binary API message 'memclnt_keepalive'. +type MemclntKeepalive struct{} + +func (m *MemclntKeepalive) Reset() { *m = MemclntKeepalive{} } +func (*MemclntKeepalive) GetMessageName() string { return "memclnt_keepalive" } +func (*MemclntKeepalive) GetCrcString() string { return "51077d14" } +func (*MemclntKeepalive) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MemclntKeepalive) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MemclntKeepalive) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *MemclntKeepalive) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// MemclntKeepaliveReply represents VPP binary API message 'memclnt_keepalive_reply'. +type MemclntKeepaliveReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MemclntKeepaliveReply) Reset() { *m = MemclntKeepaliveReply{} } +func (*MemclntKeepaliveReply) GetMessageName() string { return "memclnt_keepalive_reply" } +func (*MemclntKeepaliveReply) GetCrcString() string { return "e8d4e804" } +func (*MemclntKeepaliveReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemclntKeepaliveReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MemclntKeepaliveReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MemclntKeepaliveReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MemclntReadTimeout represents VPP binary API message 'memclnt_read_timeout'. +type MemclntReadTimeout struct { + Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` +} + +func (m *MemclntReadTimeout) Reset() { *m = MemclntReadTimeout{} } +func (*MemclntReadTimeout) GetMessageName() string { return "memclnt_read_timeout" } +func (*MemclntReadTimeout) GetCrcString() string { return "c3a3a452" } +func (*MemclntReadTimeout) GetMessageType() api.MessageType { return api.OtherMessage } + +func (m *MemclntReadTimeout) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Dummy + size += 1 + return size +} +func (m *MemclntReadTimeout) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Dummy + buf[pos] = uint8(m.Dummy) + pos += 1 + return buf, nil +} +func (m *MemclntReadTimeout) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Dummy + m.Dummy = uint8(tmp[pos]) + pos += 1 + return nil +} + +// MemclntRxThreadSuspend represents VPP binary API message 'memclnt_rx_thread_suspend'. +type MemclntRxThreadSuspend struct { + Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` +} + +func (m *MemclntRxThreadSuspend) Reset() { *m = MemclntRxThreadSuspend{} } +func (*MemclntRxThreadSuspend) GetMessageName() string { return "memclnt_rx_thread_suspend" } +func (*MemclntRxThreadSuspend) GetCrcString() string { return "c3a3a452" } +func (*MemclntRxThreadSuspend) GetMessageType() api.MessageType { return api.OtherMessage } + +func (m *MemclntRxThreadSuspend) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Dummy + size += 1 + return size +} +func (m *MemclntRxThreadSuspend) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Dummy + buf[pos] = uint8(m.Dummy) + pos += 1 + return buf, nil +} +func (m *MemclntRxThreadSuspend) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Dummy + m.Dummy = uint8(tmp[pos]) + pos += 1 + return nil +} + +// RPCCall represents VPP binary API message 'rpc_call'. +type RPCCall struct { + Function uint64 `binapi:"u64,name=function" json:"function,omitempty"` + Multicast uint8 `binapi:"u8,name=multicast" json:"multicast,omitempty"` + NeedBarrierSync uint8 `binapi:"u8,name=need_barrier_sync" json:"need_barrier_sync,omitempty"` + SendReply uint8 `binapi:"u8,name=send_reply" json:"send_reply,omitempty"` + DataLen uint32 `binapi:"u32,name=data_len" json:"data_len,omitempty" struc:"sizeof=Data"` + Data []byte `binapi:"u8[data_len],name=data" json:"data,omitempty"` +} + +func (m *RPCCall) Reset() { *m = RPCCall{} } +func (*RPCCall) GetMessageName() string { return "rpc_call" } +func (*RPCCall) GetCrcString() string { return "7e8a2c95" } +func (*RPCCall) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *RPCCall) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Function + size += 8 + // field[1] m.Multicast + size += 1 + // field[1] m.NeedBarrierSync + size += 1 + // field[1] m.SendReply + size += 1 + // field[1] m.DataLen + size += 4 + // field[1] m.Data + size += 1 * len(m.Data) + return size +} +func (m *RPCCall) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Function + o.PutUint64(buf[pos:pos+8], uint64(m.Function)) + pos += 8 + // field[1] m.Multicast + buf[pos] = uint8(m.Multicast) + pos += 1 + // field[1] m.NeedBarrierSync + buf[pos] = uint8(m.NeedBarrierSync) + pos += 1 + // field[1] m.SendReply + buf[pos] = uint8(m.SendReply) + pos += 1 + // field[1] m.DataLen + o.PutUint32(buf[pos:pos+4], uint32(len(m.Data))) + pos += 4 + // field[1] m.Data + for i := 0; i < len(m.Data); i++ { + var x uint8 + if i < len(m.Data) { + x = uint8(m.Data[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *RPCCall) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Function + m.Function = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + // field[1] m.Multicast + m.Multicast = uint8(tmp[pos]) + pos += 1 + // field[1] m.NeedBarrierSync + m.NeedBarrierSync = uint8(tmp[pos]) + pos += 1 + // field[1] m.SendReply + m.SendReply = uint8(tmp[pos]) + pos += 1 + // field[1] m.DataLen + m.DataLen = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Data + m.Data = make([]uint8, m.DataLen) + for i := 0; i < len(m.Data); i++ { + m.Data[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// RPCCallReply represents VPP binary API message 'rpc_call_reply'. +type RPCCallReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *RPCCallReply) Reset() { *m = RPCCallReply{} } +func (*RPCCallReply) GetMessageName() string { return "rpc_call_reply" } +func (*RPCCallReply) GetCrcString() string { return "e8d4e804" } +func (*RPCCallReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *RPCCallReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *RPCCallReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *RPCCallReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// RxThreadExit represents VPP binary API message 'rx_thread_exit'. +type RxThreadExit struct { + Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` +} + +func (m *RxThreadExit) Reset() { *m = RxThreadExit{} } +func (*RxThreadExit) GetMessageName() string { return "rx_thread_exit" } +func (*RxThreadExit) GetCrcString() string { return "c3a3a452" } +func (*RxThreadExit) GetMessageType() api.MessageType { return api.OtherMessage } + +func (m *RxThreadExit) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Dummy + size += 1 + return size +} +func (m *RxThreadExit) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Dummy + buf[pos] = uint8(m.Dummy) + pos += 1 + return buf, nil +} +func (m *RxThreadExit) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Dummy + m.Dummy = uint8(tmp[pos]) + pos += 1 + return nil +} + +// SockInitShm represents VPP binary API message 'sock_init_shm'. +type SockInitShm struct { + RequestedSize uint32 `binapi:"u32,name=requested_size" json:"requested_size,omitempty"` + Nitems uint8 `binapi:"u8,name=nitems" json:"nitems,omitempty" struc:"sizeof=Configs"` + Configs []uint64 `binapi:"u64[nitems],name=configs" json:"configs,omitempty"` +} + +func (m *SockInitShm) Reset() { *m = SockInitShm{} } +func (*SockInitShm) GetMessageName() string { return "sock_init_shm" } +func (*SockInitShm) GetCrcString() string { return "51646d92" } +func (*SockInitShm) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SockInitShm) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.RequestedSize + size += 4 + // field[1] m.Nitems + size += 1 + // field[1] m.Configs + size += 8 * len(m.Configs) + return size +} +func (m *SockInitShm) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.RequestedSize + o.PutUint32(buf[pos:pos+4], uint32(m.RequestedSize)) + pos += 4 + // field[1] m.Nitems + buf[pos] = uint8(len(m.Configs)) + pos += 1 + // field[1] m.Configs + for i := 0; i < len(m.Configs); i++ { + var x uint64 + if i < len(m.Configs) { + x = uint64(m.Configs[i]) + } + o.PutUint64(buf[pos:pos+8], uint64(x)) + pos += 8 + } + return buf, nil +} +func (m *SockInitShm) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.RequestedSize + m.RequestedSize = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Nitems + m.Nitems = uint8(tmp[pos]) + pos += 1 + // field[1] m.Configs + m.Configs = make([]uint64, m.Nitems) + for i := 0; i < len(m.Configs); i++ { + m.Configs[i] = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + } + return nil +} + +// SockInitShmReply represents VPP binary API message 'sock_init_shm_reply'. +type SockInitShmReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SockInitShmReply) Reset() { *m = SockInitShmReply{} } +func (*SockInitShmReply) GetMessageName() string { return "sock_init_shm_reply" } +func (*SockInitShmReply) GetCrcString() string { return "e8d4e804" } +func (*SockInitShmReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SockInitShmReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SockInitShmReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SockInitShmReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SockclntCreate represents VPP binary API message 'sockclnt_create'. +type SockclntCreate struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` +} + +func (m *SockclntCreate) Reset() { *m = SockclntCreate{} } +func (*SockclntCreate) GetMessageName() string { return "sockclnt_create" } +func (*SockclntCreate) GetCrcString() string { return "455fb9c4" } +func (*SockclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SockclntCreate) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Name + size += 64 + return size +} +func (m *SockclntCreate) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Name + copy(buf[pos:pos+64], m.Name) + pos += 64 + return buf, nil +} +func (m *SockclntCreate) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// SockclntCreateReply represents VPP binary API message 'sockclnt_create_reply'. +type SockclntCreateReply struct { + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + Count uint16 `binapi:"u16,name=count" json:"count,omitempty" struc:"sizeof=MessageTable"` + MessageTable []MessageTableEntry `binapi:"message_table_entry[count],name=message_table" json:"message_table,omitempty"` +} + +func (m *SockclntCreateReply) Reset() { *m = SockclntCreateReply{} } +func (*SockclntCreateReply) GetMessageName() string { return "sockclnt_create_reply" } +func (*SockclntCreateReply) GetCrcString() string { return "35166268" } +func (*SockclntCreateReply) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SockclntCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Response + size += 4 + // field[1] m.Index + size += 4 + // field[1] m.Count + size += 2 + // field[1] m.MessageTable + for j1 := 0; j1 < len(m.MessageTable); j1++ { + var s1 MessageTableEntry + _ = s1 + if j1 < len(m.MessageTable) { + s1 = m.MessageTable[j1] + } + // field[2] s1.Index + size += 2 + // field[2] s1.Name + size += 64 + } + return size +} +func (m *SockclntCreateReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Response + o.PutUint32(buf[pos:pos+4], uint32(m.Response)) + pos += 4 + // field[1] m.Index + o.PutUint32(buf[pos:pos+4], uint32(m.Index)) + pos += 4 + // field[1] m.Count + o.PutUint16(buf[pos:pos+2], uint16(len(m.MessageTable))) + pos += 2 + // field[1] m.MessageTable + for j1 := 0; j1 < len(m.MessageTable); j1++ { + var v1 MessageTableEntry + if j1 < len(m.MessageTable) { + v1 = m.MessageTable[j1] + } + // field[2] v1.Index + o.PutUint16(buf[pos:pos+2], uint16(v1.Index)) + pos += 2 + // field[2] v1.Name + copy(buf[pos:pos+64], v1.Name) + pos += 64 + } + return buf, nil +} +func (m *SockclntCreateReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Response + m.Response = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Index + m.Index = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.MessageTable + m.MessageTable = make([]MessageTableEntry, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.MessageTable[j1].Index + m.MessageTable[j1].Index = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.MessageTable[j1].Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.MessageTable[j1].Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + } + return nil +} + +// SockclntDelete represents VPP binary API message 'sockclnt_delete'. +type SockclntDelete struct { + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` +} + +func (m *SockclntDelete) Reset() { *m = SockclntDelete{} } +func (*SockclntDelete) GetMessageName() string { return "sockclnt_delete" } +func (*SockclntDelete) GetCrcString() string { return "8ac76db6" } +func (*SockclntDelete) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SockclntDelete) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Index + size += 4 + return size +} +func (m *SockclntDelete) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Index + o.PutUint32(buf[pos:pos+4], uint32(m.Index)) + pos += 4 + return buf, nil +} +func (m *SockclntDelete) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Index + m.Index = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SockclntDeleteReply represents VPP binary API message 'sockclnt_delete_reply'. +type SockclntDeleteReply struct { + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` +} + +func (m *SockclntDeleteReply) Reset() { *m = SockclntDeleteReply{} } +func (*SockclntDeleteReply) GetMessageName() string { return "sockclnt_delete_reply" } +func (*SockclntDeleteReply) GetCrcString() string { return "8f38b1ee" } +func (*SockclntDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SockclntDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Response + size += 4 + return size +} +func (m *SockclntDeleteReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Response + o.PutUint32(buf[pos:pos+4], uint32(m.Response)) + pos += 4 + return buf, nil +} +func (m *SockclntDeleteReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Response + m.Response = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// TracePluginMsgIds represents VPP binary API message 'trace_plugin_msg_ids'. +type TracePluginMsgIds struct { + PluginName string `binapi:"string[128],name=plugin_name" json:"plugin_name,omitempty" struc:"[128]byte"` + FirstMsgID uint16 `binapi:"u16,name=first_msg_id" json:"first_msg_id,omitempty"` + LastMsgID uint16 `binapi:"u16,name=last_msg_id" json:"last_msg_id,omitempty"` +} + +func (m *TracePluginMsgIds) Reset() { *m = TracePluginMsgIds{} } +func (*TracePluginMsgIds) GetMessageName() string { return "trace_plugin_msg_ids" } +func (*TracePluginMsgIds) GetCrcString() string { return "f476d3ce" } +func (*TracePluginMsgIds) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *TracePluginMsgIds) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.PluginName + size += 128 + // field[1] m.FirstMsgID + size += 2 + // field[1] m.LastMsgID + size += 2 + return size +} +func (m *TracePluginMsgIds) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.PluginName + copy(buf[pos:pos+128], m.PluginName) + pos += 128 + // field[1] m.FirstMsgID + o.PutUint16(buf[pos:pos+2], uint16(m.FirstMsgID)) + pos += 2 + // field[1] m.LastMsgID + o.PutUint16(buf[pos:pos+2], uint16(m.LastMsgID)) + pos += 2 + return buf, nil +} +func (m *TracePluginMsgIds) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.PluginName + { + nul := bytes.Index(tmp[pos:pos+128], []byte{0x00}) + m.PluginName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 128 + } + // field[1] m.FirstMsgID + m.FirstMsgID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.LastMsgID + m.LastMsgID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + +func init() { file_memclnt_binapi_init() } +func file_memclnt_binapi_init() { + api.RegisterMessage((*APIVersions)(nil), "memclnt.APIVersions") + api.RegisterMessage((*APIVersionsReply)(nil), "memclnt.APIVersionsReply") + api.RegisterMessage((*GetFirstMsgID)(nil), "memclnt.GetFirstMsgID") + api.RegisterMessage((*GetFirstMsgIDReply)(nil), "memclnt.GetFirstMsgIDReply") + api.RegisterMessage((*MemclntCreate)(nil), "memclnt.MemclntCreate") + api.RegisterMessage((*MemclntCreateReply)(nil), "memclnt.MemclntCreateReply") + api.RegisterMessage((*MemclntDelete)(nil), "memclnt.MemclntDelete") + api.RegisterMessage((*MemclntDeleteReply)(nil), "memclnt.MemclntDeleteReply") + api.RegisterMessage((*MemclntKeepalive)(nil), "memclnt.MemclntKeepalive") + api.RegisterMessage((*MemclntKeepaliveReply)(nil), "memclnt.MemclntKeepaliveReply") + api.RegisterMessage((*MemclntReadTimeout)(nil), "memclnt.MemclntReadTimeout") + api.RegisterMessage((*MemclntRxThreadSuspend)(nil), "memclnt.MemclntRxThreadSuspend") + api.RegisterMessage((*RPCCall)(nil), "memclnt.RPCCall") + api.RegisterMessage((*RPCCallReply)(nil), "memclnt.RPCCallReply") + api.RegisterMessage((*RxThreadExit)(nil), "memclnt.RxThreadExit") + api.RegisterMessage((*SockInitShm)(nil), "memclnt.SockInitShm") + api.RegisterMessage((*SockInitShmReply)(nil), "memclnt.SockInitShmReply") + api.RegisterMessage((*SockclntCreate)(nil), "memclnt.SockclntCreate") + api.RegisterMessage((*SockclntCreateReply)(nil), "memclnt.SockclntCreateReply") + api.RegisterMessage((*SockclntDelete)(nil), "memclnt.SockclntDelete") + api.RegisterMessage((*SockclntDeleteReply)(nil), "memclnt.SockclntDeleteReply") + api.RegisterMessage((*TracePluginMsgIds)(nil), "memclnt.TracePluginMsgIds") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*APIVersions)(nil), + (*APIVersionsReply)(nil), + (*GetFirstMsgID)(nil), + (*GetFirstMsgIDReply)(nil), + (*MemclntCreate)(nil), + (*MemclntCreateReply)(nil), + (*MemclntDelete)(nil), + (*MemclntDeleteReply)(nil), + (*MemclntKeepalive)(nil), + (*MemclntKeepaliveReply)(nil), + (*MemclntReadTimeout)(nil), + (*MemclntRxThreadSuspend)(nil), + (*RPCCall)(nil), + (*RPCCallReply)(nil), + (*RxThreadExit)(nil), + (*SockInitShm)(nil), + (*SockInitShmReply)(nil), + (*SockclntCreate)(nil), + (*SockclntCreateReply)(nil), + (*SockclntDelete)(nil), + (*SockclntDeleteReply)(nil), + (*TracePluginMsgIds)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/memclnt/memclnt_rpc.ba.go b/codec/testdata/binapi2001/memclnt/memclnt_rpc.ba.go new file mode 100644 index 0000000..05dfc28 --- /dev/null +++ b/codec/testdata/binapi2001/memclnt/memclnt_rpc.ba.go @@ -0,0 +1,141 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package memclnt + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for memclnt module. +type RPCService interface { + APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) + GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) + MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) + MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) + MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) + MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error + MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error + RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) + RxThreadExit(ctx context.Context, in *RxThreadExit) error + SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) + SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) + SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) + TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) { + out := new(APIVersionsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) { + out := new(GetFirstMsgIDReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) { + out := new(MemclntCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) { + out := new(MemclntDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) { + out := new(MemclntKeepaliveReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) { + out := new(RPCCallReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) RxThreadExit(ctx context.Context, in *RxThreadExit) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) { + out := new(SockInitShmReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) { + out := new(SockclntCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) { + out := new(SockclntDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error { + c.ch.SendRequest(in) + return nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/codec/testdata/binapi2001/memif/memif.ba.go b/codec/testdata/binapi2001/memif/memif.ba.go new file mode 100644 index 0000000..4964117 --- /dev/null +++ b/codec/testdata/binapi2001/memif/memif.ba.go @@ -0,0 +1,1052 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/plugins/memif.api.json + +/* +Package memif contains generated code for VPP binary API defined by memif.api (version 3.0.0). + +It consists of: + 2 aliases + 8 enums + 10 messages +*/ +package memif + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "memif" + // APIVersion is the API version of this module. + APIVersion = "3.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x88dc56c9 +) + +// IfStatusFlags represents VPP binary API enum 'if_status_flags'. +type IfStatusFlags uint32 + +const ( + IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 + IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 +) + +var ( + IfStatusFlags_name = map[uint32]string{ + 1: "IF_STATUS_API_FLAG_ADMIN_UP", + 2: "IF_STATUS_API_FLAG_LINK_UP", + } + IfStatusFlags_value = map[string]uint32{ + "IF_STATUS_API_FLAG_ADMIN_UP": 1, + "IF_STATUS_API_FLAG_LINK_UP": 2, + } +) + +func (x IfStatusFlags) String() string { + s, ok := IfStatusFlags_name[uint32(x)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" +} + +// IfType represents VPP binary API enum 'if_type'. +type IfType uint32 + +const ( + IF_API_TYPE_HARDWARE IfType = 1 + IF_API_TYPE_SUB IfType = 2 + IF_API_TYPE_P2P IfType = 3 + IF_API_TYPE_PIPE IfType = 4 +) + +var ( + IfType_name = map[uint32]string{ + 1: "IF_API_TYPE_HARDWARE", + 2: "IF_API_TYPE_SUB", + 3: "IF_API_TYPE_P2P", + 4: "IF_API_TYPE_PIPE", + } + IfType_value = map[string]uint32{ + "IF_API_TYPE_HARDWARE": 1, + "IF_API_TYPE_SUB": 2, + "IF_API_TYPE_P2P": 3, + "IF_API_TYPE_PIPE": 4, + } +) + +func (x IfType) String() string { + s, ok := IfType_name[uint32(x)] + if ok { + return s + } + return "IfType(" + strconv.Itoa(int(x)) + ")" +} + +// LinkDuplex represents VPP binary API enum 'link_duplex'. +type LinkDuplex uint32 + +const ( + LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 + LINK_DUPLEX_API_HALF LinkDuplex = 1 + LINK_DUPLEX_API_FULL LinkDuplex = 2 +) + +var ( + LinkDuplex_name = map[uint32]string{ + 0: "LINK_DUPLEX_API_UNKNOWN", + 1: "LINK_DUPLEX_API_HALF", + 2: "LINK_DUPLEX_API_FULL", + } + LinkDuplex_value = map[string]uint32{ + "LINK_DUPLEX_API_UNKNOWN": 0, + "LINK_DUPLEX_API_HALF": 1, + "LINK_DUPLEX_API_FULL": 2, + } +) + +func (x LinkDuplex) String() string { + s, ok := LinkDuplex_name[uint32(x)] + if ok { + return s + } + return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" +} + +// MemifMode represents VPP binary API enum 'memif_mode'. +type MemifMode uint32 + +const ( + MEMIF_MODE_API_ETHERNET MemifMode = 0 + MEMIF_MODE_API_IP MemifMode = 1 + MEMIF_MODE_API_PUNT_INJECT MemifMode = 2 +) + +var ( + MemifMode_name = map[uint32]string{ + 0: "MEMIF_MODE_API_ETHERNET", + 1: "MEMIF_MODE_API_IP", + 2: "MEMIF_MODE_API_PUNT_INJECT", + } + MemifMode_value = map[string]uint32{ + "MEMIF_MODE_API_ETHERNET": 0, + "MEMIF_MODE_API_IP": 1, + "MEMIF_MODE_API_PUNT_INJECT": 2, + } +) + +func (x MemifMode) String() string { + s, ok := MemifMode_name[uint32(x)] + if ok { + return s + } + return "MemifMode(" + strconv.Itoa(int(x)) + ")" +} + +// MemifRole represents VPP binary API enum 'memif_role'. +type MemifRole uint32 + +const ( + MEMIF_ROLE_API_MASTER MemifRole = 0 + MEMIF_ROLE_API_SLAVE MemifRole = 1 +) + +var ( + MemifRole_name = map[uint32]string{ + 0: "MEMIF_ROLE_API_MASTER", + 1: "MEMIF_ROLE_API_SLAVE", + } + MemifRole_value = map[string]uint32{ + "MEMIF_ROLE_API_MASTER": 0, + "MEMIF_ROLE_API_SLAVE": 1, + } +) + +func (x MemifRole) String() string { + s, ok := MemifRole_name[uint32(x)] + if ok { + return s + } + return "MemifRole(" + strconv.Itoa(int(x)) + ")" +} + +// MtuProto represents VPP binary API enum 'mtu_proto'. +type MtuProto uint32 + +const ( + MTU_PROTO_API_L3 MtuProto = 1 + MTU_PROTO_API_IP4 MtuProto = 2 + MTU_PROTO_API_IP6 MtuProto = 3 + MTU_PROTO_API_MPLS MtuProto = 4 + MTU_PROTO_API_N MtuProto = 5 +) + +var ( + MtuProto_name = map[uint32]string{ + 1: "MTU_PROTO_API_L3", + 2: "MTU_PROTO_API_IP4", + 3: "MTU_PROTO_API_IP6", + 4: "MTU_PROTO_API_MPLS", + 5: "MTU_PROTO_API_N", + } + MtuProto_value = map[string]uint32{ + "MTU_PROTO_API_L3": 1, + "MTU_PROTO_API_IP4": 2, + "MTU_PROTO_API_IP6": 3, + "MTU_PROTO_API_MPLS": 4, + "MTU_PROTO_API_N": 5, + } +) + +func (x MtuProto) String() string { + s, ok := MtuProto_name[uint32(x)] + if ok { + return s + } + return "MtuProto(" + strconv.Itoa(int(x)) + ")" +} + +// RxMode represents VPP binary API enum 'rx_mode'. +type RxMode uint32 + +const ( + RX_MODE_API_UNKNOWN RxMode = 0 + RX_MODE_API_POLLING RxMode = 1 + RX_MODE_API_INTERRUPT RxMode = 2 + RX_MODE_API_ADAPTIVE RxMode = 3 + RX_MODE_API_DEFAULT RxMode = 4 +) + +var ( + RxMode_name = map[uint32]string{ + 0: "RX_MODE_API_UNKNOWN", + 1: "RX_MODE_API_POLLING", + 2: "RX_MODE_API_INTERRUPT", + 3: "RX_MODE_API_ADAPTIVE", + 4: "RX_MODE_API_DEFAULT", + } + RxMode_value = map[string]uint32{ + "RX_MODE_API_UNKNOWN": 0, + "RX_MODE_API_POLLING": 1, + "RX_MODE_API_INTERRUPT": 2, + "RX_MODE_API_ADAPTIVE": 3, + "RX_MODE_API_DEFAULT": 4, + } +) + +func (x RxMode) String() string { + s, ok := RxMode_name[uint32(x)] + if ok { + return s + } + return "RxMode(" + strconv.Itoa(int(x)) + ")" +} + +// SubIfFlags represents VPP binary API enum 'sub_if_flags'. +type SubIfFlags uint32 + +const ( + SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 + SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 + SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 + SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 + SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 + SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 + SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 + SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 + SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 + SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 +) + +var ( + SubIfFlags_name = map[uint32]string{ + 1: "SUB_IF_API_FLAG_NO_TAGS", + 2: "SUB_IF_API_FLAG_ONE_TAG", + 4: "SUB_IF_API_FLAG_TWO_TAGS", + 8: "SUB_IF_API_FLAG_DOT1AD", + 16: "SUB_IF_API_FLAG_EXACT_MATCH", + 32: "SUB_IF_API_FLAG_DEFAULT", + 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", + 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", + 254: "SUB_IF_API_FLAG_MASK_VNET", + 256: "SUB_IF_API_FLAG_DOT1AH", + } + SubIfFlags_value = map[string]uint32{ + "SUB_IF_API_FLAG_NO_TAGS": 1, + "SUB_IF_API_FLAG_ONE_TAG": 2, + "SUB_IF_API_FLAG_TWO_TAGS": 4, + "SUB_IF_API_FLAG_DOT1AD": 8, + "SUB_IF_API_FLAG_EXACT_MATCH": 16, + "SUB_IF_API_FLAG_DEFAULT": 32, + "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, + "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, + "SUB_IF_API_FLAG_MASK_VNET": 254, + "SUB_IF_API_FLAG_DOT1AH": 256, + } +) + +func (x SubIfFlags) String() string { + s, ok := SubIfFlags_name[uint32(x)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" +} + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 + +// MemifCreate represents VPP binary API message 'memif_create'. +type MemifCreate struct { + Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` + Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` + RxQueues uint8 `binapi:"u8,name=rx_queues" json:"rx_queues,omitempty"` + TxQueues uint8 `binapi:"u8,name=tx_queues" json:"tx_queues,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` + BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` + NoZeroCopy bool `binapi:"bool,name=no_zero_copy" json:"no_zero_copy,omitempty"` + HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + Secret string `binapi:"string[24],name=secret" json:"secret,omitempty" struc:"[24]byte"` +} + +func (m *MemifCreate) Reset() { *m = MemifCreate{} } +func (*MemifCreate) GetMessageName() string { return "memif_create" } +func (*MemifCreate) GetCrcString() string { return "b1b25061" } +func (*MemifCreate) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MemifCreate) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Role + size += 4 + // field[1] m.Mode + size += 4 + // field[1] m.RxQueues + size += 1 + // field[1] m.TxQueues + size += 1 + // field[1] m.ID + size += 4 + // field[1] m.SocketID + size += 4 + // field[1] m.RingSize + size += 4 + // field[1] m.BufferSize + size += 2 + // field[1] m.NoZeroCopy + size += 1 + // field[1] m.HwAddr + size += 6 + // field[1] m.Secret + size += 24 + return size +} +func (m *MemifCreate) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Role + o.PutUint32(buf[pos:pos+4], uint32(m.Role)) + pos += 4 + // field[1] m.Mode + o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) + pos += 4 + // field[1] m.RxQueues + buf[pos] = uint8(m.RxQueues) + pos += 1 + // field[1] m.TxQueues + buf[pos] = uint8(m.TxQueues) + pos += 1 + // field[1] m.ID + o.PutUint32(buf[pos:pos+4], uint32(m.ID)) + pos += 4 + // field[1] m.SocketID + o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) + pos += 4 + // field[1] m.RingSize + o.PutUint32(buf[pos:pos+4], uint32(m.RingSize)) + pos += 4 + // field[1] m.BufferSize + o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize)) + pos += 2 + // field[1] m.NoZeroCopy + if m.NoZeroCopy { + buf[pos] = 1 + } + pos += 1 + // field[1] m.HwAddr + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.HwAddr) { + x = uint8(m.HwAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Secret + copy(buf[pos:pos+24], m.Secret) + pos += 24 + return buf, nil +} +func (m *MemifCreate) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Role + m.Role = MemifRole(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mode + m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.RxQueues + m.RxQueues = uint8(tmp[pos]) + pos += 1 + // field[1] m.TxQueues + m.TxQueues = uint8(tmp[pos]) + pos += 1 + // field[1] m.ID + m.ID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SocketID + m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.RingSize + m.RingSize = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.BufferSize + m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.NoZeroCopy + m.NoZeroCopy = tmp[pos] != 0 + pos += 1 + // field[1] m.HwAddr + for i := 0; i < len(m.HwAddr); i++ { + m.HwAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Secret + { + nul := bytes.Index(tmp[pos:pos+24], []byte{0x00}) + m.Secret = codec.DecodeString(tmp[pos : pos+nul]) + pos += 24 + } + return nil +} + +// MemifCreateReply represents VPP binary API message 'memif_create_reply'. +type MemifCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *MemifCreateReply) Reset() { *m = MemifCreateReply{} } +func (*MemifCreateReply) GetMessageName() string { return "memif_create_reply" } +func (*MemifCreateReply) GetCrcString() string { return "5383d31f" } +func (*MemifCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemifCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *MemifCreateReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *MemifCreateReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MemifDelete represents VPP binary API message 'memif_delete'. +type MemifDelete struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *MemifDelete) Reset() { *m = MemifDelete{} } +func (*MemifDelete) GetMessageName() string { return "memif_delete" } +func (*MemifDelete) GetCrcString() string { return "f9e6675e" } +func (*MemifDelete) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MemifDelete) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *MemifDelete) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *MemifDelete) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MemifDeleteReply represents VPP binary API message 'memif_delete_reply'. +type MemifDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MemifDeleteReply) Reset() { *m = MemifDeleteReply{} } +func (*MemifDeleteReply) GetMessageName() string { return "memif_delete_reply" } +func (*MemifDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*MemifDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemifDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MemifDeleteReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MemifDeleteReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MemifDetails represents VPP binary API message 'memif_details'. +type MemifDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` + Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` + ZeroCopy bool `binapi:"bool,name=zero_copy" json:"zero_copy,omitempty"` + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` + BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty" struc:"[64]byte"` +} + +func (m *MemifDetails) Reset() { *m = MemifDetails{} } +func (*MemifDetails) GetMessageName() string { return "memif_details" } +func (*MemifDetails) GetCrcString() string { return "d0382c4c" } +func (*MemifDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemifDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.HwAddr + size += 6 + // field[1] m.ID + size += 4 + // field[1] m.Role + size += 4 + // field[1] m.Mode + size += 4 + // field[1] m.ZeroCopy + size += 1 + // field[1] m.SocketID + size += 4 + // field[1] m.RingSize + size += 4 + // field[1] m.BufferSize + size += 2 + // field[1] m.Flags + size += 4 + // field[1] m.IfName + size += 64 + return size +} +func (m *MemifDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.HwAddr + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.HwAddr) { + x = uint8(m.HwAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.ID + o.PutUint32(buf[pos:pos+4], uint32(m.ID)) + pos += 4 + // field[1] m.Role + o.PutUint32(buf[pos:pos+4], uint32(m.Role)) + pos += 4 + // field[1] m.Mode + o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) + pos += 4 + // field[1] m.ZeroCopy + if m.ZeroCopy { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SocketID + o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) + pos += 4 + // field[1] m.RingSize + o.PutUint32(buf[pos:pos+4], uint32(m.RingSize)) + pos += 4 + // field[1] m.BufferSize + o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize)) + pos += 2 + // field[1] m.Flags + o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) + pos += 4 + // field[1] m.IfName + copy(buf[pos:pos+64], m.IfName) + pos += 64 + return buf, nil +} +func (m *MemifDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.HwAddr + for i := 0; i < len(m.HwAddr); i++ { + m.HwAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.ID + m.ID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Role + m.Role = MemifRole(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mode + m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ZeroCopy + m.ZeroCopy = tmp[pos] != 0 + pos += 1 + // field[1] m.SocketID + m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.RingSize + m.RingSize = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.BufferSize + m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.Flags + m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IfName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.IfName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// MemifDump represents VPP binary API message 'memif_dump'. +type MemifDump struct{} + +func (m *MemifDump) Reset() { *m = MemifDump{} } +func (*MemifDump) GetMessageName() string { return "memif_dump" } +func (*MemifDump) GetCrcString() string { return "51077d14" } +func (*MemifDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MemifDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MemifDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *MemifDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del'. +type MemifSocketFilenameAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"` +} + +func (m *MemifSocketFilenameAddDel) Reset() { *m = MemifSocketFilenameAddDel{} } +func (*MemifSocketFilenameAddDel) GetMessageName() string { return "memif_socket_filename_add_del" } +func (*MemifSocketFilenameAddDel) GetCrcString() string { return "a2ce1a10" } +func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MemifSocketFilenameAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.SocketID + size += 4 + // field[1] m.SocketFilename + size += 108 + return size +} +func (m *MemifSocketFilenameAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SocketID + o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) + pos += 4 + // field[1] m.SocketFilename + copy(buf[pos:pos+108], m.SocketFilename) + pos += 108 + return buf, nil +} +func (m *MemifSocketFilenameAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.SocketID + m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SocketFilename + { + nul := bytes.Index(tmp[pos:pos+108], []byte{0x00}) + m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul]) + pos += 108 + } + return nil +} + +// MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply'. +type MemifSocketFilenameAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MemifSocketFilenameAddDelReply) Reset() { *m = MemifSocketFilenameAddDelReply{} } +func (*MemifSocketFilenameAddDelReply) GetMessageName() string { + return "memif_socket_filename_add_del_reply" +} +func (*MemifSocketFilenameAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemifSocketFilenameAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MemifSocketFilenameAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MemifSocketFilenameAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details'. +type MemifSocketFilenameDetails struct { + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"` +} + +func (m *MemifSocketFilenameDetails) Reset() { *m = MemifSocketFilenameDetails{} } +func (*MemifSocketFilenameDetails) GetMessageName() string { return "memif_socket_filename_details" } +func (*MemifSocketFilenameDetails) GetCrcString() string { return "7ff326f7" } +func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemifSocketFilenameDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SocketID + size += 4 + // field[1] m.SocketFilename + size += 108 + return size +} +func (m *MemifSocketFilenameDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SocketID + o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) + pos += 4 + // field[1] m.SocketFilename + copy(buf[pos:pos+108], m.SocketFilename) + pos += 108 + return buf, nil +} +func (m *MemifSocketFilenameDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SocketID + m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SocketFilename + { + nul := bytes.Index(tmp[pos:pos+108], []byte{0x00}) + m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul]) + pos += 108 + } + return nil +} + +// MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump'. +type MemifSocketFilenameDump struct{} + +func (m *MemifSocketFilenameDump) Reset() { *m = MemifSocketFilenameDump{} } +func (*MemifSocketFilenameDump) GetMessageName() string { return "memif_socket_filename_dump" } +func (*MemifSocketFilenameDump) GetCrcString() string { return "51077d14" } +func (*MemifSocketFilenameDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MemifSocketFilenameDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MemifSocketFilenameDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *MemifSocketFilenameDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +func init() { file_memif_binapi_init() } +func file_memif_binapi_init() { + api.RegisterMessage((*MemifCreate)(nil), "memif.MemifCreate") + api.RegisterMessage((*MemifCreateReply)(nil), "memif.MemifCreateReply") + api.RegisterMessage((*MemifDelete)(nil), "memif.MemifDelete") + api.RegisterMessage((*MemifDeleteReply)(nil), "memif.MemifDeleteReply") + api.RegisterMessage((*MemifDetails)(nil), "memif.MemifDetails") + api.RegisterMessage((*MemifDump)(nil), "memif.MemifDump") + api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif.MemifSocketFilenameAddDel") + api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif.MemifSocketFilenameAddDelReply") + api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif.MemifSocketFilenameDetails") + api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*MemifCreate)(nil), + (*MemifCreateReply)(nil), + (*MemifDelete)(nil), + (*MemifDeleteReply)(nil), + (*MemifDetails)(nil), + (*MemifDump)(nil), + (*MemifSocketFilenameAddDel)(nil), + (*MemifSocketFilenameAddDelReply)(nil), + (*MemifSocketFilenameDetails)(nil), + (*MemifSocketFilenameDump)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/memif/memif_rpc.ba.go b/codec/testdata/binapi2001/memif/memif_rpc.ba.go new file mode 100644 index 0000000..8eda8f1 --- /dev/null +++ b/codec/testdata/binapi2001/memif/memif_rpc.ba.go @@ -0,0 +1,111 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package memif + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for memif module. +type RPCService interface { + DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) + DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) + MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) + MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) + MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMemifClient{stream} + return x, nil +} + +type RPCService_DumpMemifClient interface { + Recv() (*MemifDetails, error) +} + +type serviceClient_DumpMemifClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMemifClient) Recv() (*MemifDetails, error) { + m := new(MemifDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMemifSocketFilenameClient{stream} + return x, nil +} + +type RPCService_DumpMemifSocketFilenameClient interface { + Recv() (*MemifSocketFilenameDetails, error) +} + +type serviceClient_DumpMemifSocketFilenameClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMemifSocketFilenameClient) Recv() (*MemifSocketFilenameDetails, error) { + m := new(MemifSocketFilenameDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) { + out := new(MemifCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) { + out := new(MemifDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) { + out := new(MemifSocketFilenameAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/codec/testdata/binapi2001/sr/sr.ba.go b/codec/testdata/binapi2001/sr/sr.ba.go new file mode 100644 index 0000000..b0e423b --- /dev/null +++ b/codec/testdata/binapi2001/sr/sr.ba.go @@ -0,0 +1,1716 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/sr.api.json + +/* +Package sr contains generated code for VPP binary API defined by sr.api (version 1.2.0). + +It consists of: + 20 messages + 3 types +*/ +package sr + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "sr" + // APIVersion is the API version of this module. + APIVersion = "1.2.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xbf277f96 +) + +// SrIP6Address represents VPP binary API type 'sr_ip6_address'. +type SrIP6Address struct { + Data []byte `binapi:"u8[16],name=data" json:"data,omitempty" struc:"[16]byte"` +} + +func (*SrIP6Address) GetTypeName() string { return "sr_ip6_address" } + +// Srv6Sid represents VPP binary API type 'srv6_sid'. +type Srv6Sid struct { + Addr []byte `binapi:"u8[16],name=addr" json:"addr,omitempty" struc:"[16]byte"` +} + +func (*Srv6Sid) GetTypeName() string { return "srv6_sid" } + +// Srv6SidList represents VPP binary API type 'srv6_sid_list'. +type Srv6SidList struct { + NumSids uint8 `binapi:"u8,name=num_sids" json:"num_sids,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + Sids [16]Srv6Sid `binapi:"srv6_sid[16],name=sids" json:"sids,omitempty" struc:"[16]Srv6Sid"` +} + +func (*Srv6SidList) GetTypeName() string { return "srv6_sid_list" } + +// SrLocalsidAddDel represents VPP binary API message 'sr_localsid_add_del'. +type SrLocalsidAddDel struct { + IsDel uint8 `binapi:"u8,name=is_del" json:"is_del,omitempty"` + Localsid Srv6Sid `binapi:"srv6_sid,name=localsid" json:"localsid,omitempty"` + EndPsp uint8 `binapi:"u8,name=end_psp" json:"end_psp,omitempty"` + Behavior uint8 `binapi:"u8,name=behavior" json:"behavior,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + NhAddr6 []byte `binapi:"u8[16],name=nh_addr6" json:"nh_addr6,omitempty" struc:"[16]byte"` + NhAddr4 []byte `binapi:"u8[4],name=nh_addr4" json:"nh_addr4,omitempty" struc:"[4]byte"` +} + +func (m *SrLocalsidAddDel) Reset() { *m = SrLocalsidAddDel{} } +func (*SrLocalsidAddDel) GetMessageName() string { return "sr_localsid_add_del" } +func (*SrLocalsidAddDel) GetCrcString() string { return "b30489eb" } +func (*SrLocalsidAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrLocalsidAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsDel + size += 1 + // field[1] m.Localsid + // field[2] m.Localsid.Addr + size += 16 + // field[1] m.EndPsp + size += 1 + // field[1] m.Behavior + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.VlanIndex + size += 4 + // field[1] m.FibTable + size += 4 + // field[1] m.NhAddr6 + size += 16 + // field[1] m.NhAddr4 + size += 4 + return size +} +func (m *SrLocalsidAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsDel + buf[pos] = uint8(m.IsDel) + pos += 1 + // field[1] m.Localsid + // field[2] m.Localsid.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Localsid.Addr) { + x = uint8(m.Localsid.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.EndPsp + buf[pos] = uint8(m.EndPsp) + pos += 1 + // field[1] m.Behavior + buf[pos] = uint8(m.Behavior) + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.VlanIndex + o.PutUint32(buf[pos:pos+4], uint32(m.VlanIndex)) + pos += 4 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.NhAddr6 + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.NhAddr6) { + x = uint8(m.NhAddr6[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.NhAddr4 + for i := 0; i < 4; i++ { + var x uint8 + if i < len(m.NhAddr4) { + x = uint8(m.NhAddr4[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SrLocalsidAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsDel + m.IsDel = uint8(tmp[pos]) + pos += 1 + // field[1] m.Localsid + // field[2] m.Localsid.Addr + m.Localsid.Addr = make([]uint8, 16) + for i := 0; i < len(m.Localsid.Addr); i++ { + m.Localsid.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.EndPsp + m.EndPsp = uint8(tmp[pos]) + pos += 1 + // field[1] m.Behavior + m.Behavior = uint8(tmp[pos]) + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VlanIndex + m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NhAddr6 + m.NhAddr6 = make([]uint8, 16) + for i := 0; i < len(m.NhAddr6); i++ { + m.NhAddr6[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.NhAddr4 + m.NhAddr4 = make([]uint8, 4) + for i := 0; i < len(m.NhAddr4); i++ { + m.NhAddr4[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SrLocalsidAddDelReply represents VPP binary API message 'sr_localsid_add_del_reply'. +type SrLocalsidAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrLocalsidAddDelReply) Reset() { *m = SrLocalsidAddDelReply{} } +func (*SrLocalsidAddDelReply) GetMessageName() string { return "sr_localsid_add_del_reply" } +func (*SrLocalsidAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrLocalsidAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrLocalsidAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrLocalsidAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrLocalsidAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrLocalsidsDetails represents VPP binary API message 'sr_localsids_details'. +type SrLocalsidsDetails struct { + Addr Srv6Sid `binapi:"srv6_sid,name=addr" json:"addr,omitempty"` + EndPsp uint8 `binapi:"u8,name=end_psp" json:"end_psp,omitempty"` + Behavior uint16 `binapi:"u16,name=behavior" json:"behavior,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` + XconnectNhAddr6 []byte `binapi:"u8[16],name=xconnect_nh_addr6" json:"xconnect_nh_addr6,omitempty" struc:"[16]byte"` + XconnectNhAddr4 []byte `binapi:"u8[4],name=xconnect_nh_addr4" json:"xconnect_nh_addr4,omitempty" struc:"[4]byte"` + XconnectIfaceOrVrfTable uint32 `binapi:"u32,name=xconnect_iface_or_vrf_table" json:"xconnect_iface_or_vrf_table,omitempty"` +} + +func (m *SrLocalsidsDetails) Reset() { *m = SrLocalsidsDetails{} } +func (*SrLocalsidsDetails) GetMessageName() string { return "sr_localsids_details" } +func (*SrLocalsidsDetails) GetCrcString() string { return "0791babc" } +func (*SrLocalsidsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrLocalsidsDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Addr + // field[2] m.Addr.Addr + size += 16 + // field[1] m.EndPsp + size += 1 + // field[1] m.Behavior + size += 2 + // field[1] m.FibTable + size += 4 + // field[1] m.VlanIndex + size += 4 + // field[1] m.XconnectNhAddr6 + size += 16 + // field[1] m.XconnectNhAddr4 + size += 4 + // field[1] m.XconnectIfaceOrVrfTable + size += 4 + return size +} +func (m *SrLocalsidsDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Addr + // field[2] m.Addr.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Addr.Addr) { + x = uint8(m.Addr.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.EndPsp + buf[pos] = uint8(m.EndPsp) + pos += 1 + // field[1] m.Behavior + o.PutUint16(buf[pos:pos+2], uint16(m.Behavior)) + pos += 2 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.VlanIndex + o.PutUint32(buf[pos:pos+4], uint32(m.VlanIndex)) + pos += 4 + // field[1] m.XconnectNhAddr6 + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.XconnectNhAddr6) { + x = uint8(m.XconnectNhAddr6[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.XconnectNhAddr4 + for i := 0; i < 4; i++ { + var x uint8 + if i < len(m.XconnectNhAddr4) { + x = uint8(m.XconnectNhAddr4[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.XconnectIfaceOrVrfTable + o.PutUint32(buf[pos:pos+4], uint32(m.XconnectIfaceOrVrfTable)) + pos += 4 + return buf, nil +} +func (m *SrLocalsidsDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Addr + // field[2] m.Addr.Addr + m.Addr.Addr = make([]uint8, 16) + for i := 0; i < len(m.Addr.Addr); i++ { + m.Addr.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.EndPsp + m.EndPsp = uint8(tmp[pos]) + pos += 1 + // field[1] m.Behavior + m.Behavior = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VlanIndex + m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.XconnectNhAddr6 + m.XconnectNhAddr6 = make([]uint8, 16) + for i := 0; i < len(m.XconnectNhAddr6); i++ { + m.XconnectNhAddr6[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.XconnectNhAddr4 + m.XconnectNhAddr4 = make([]uint8, 4) + for i := 0; i < len(m.XconnectNhAddr4); i++ { + m.XconnectNhAddr4[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.XconnectIfaceOrVrfTable + m.XconnectIfaceOrVrfTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrLocalsidsDump represents VPP binary API message 'sr_localsids_dump'. +type SrLocalsidsDump struct{} + +func (m *SrLocalsidsDump) Reset() { *m = SrLocalsidsDump{} } +func (*SrLocalsidsDump) GetMessageName() string { return "sr_localsids_dump" } +func (*SrLocalsidsDump) GetCrcString() string { return "51077d14" } +func (*SrLocalsidsDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrLocalsidsDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrLocalsidsDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *SrLocalsidsDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// SrPoliciesDetails represents VPP binary API message 'sr_policies_details'. +type SrPoliciesDetails struct { + Bsid Srv6Sid `binapi:"srv6_sid,name=bsid" json:"bsid,omitempty"` + Type uint8 `binapi:"u8,name=type" json:"type,omitempty"` + IsEncap uint8 `binapi:"u8,name=is_encap" json:"is_encap,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + NumSidLists uint8 `binapi:"u8,name=num_sid_lists" json:"num_sid_lists,omitempty" struc:"sizeof=SidLists"` + SidLists []Srv6SidList `binapi:"srv6_sid_list[num_sid_lists],name=sid_lists" json:"sid_lists,omitempty"` +} + +func (m *SrPoliciesDetails) Reset() { *m = SrPoliciesDetails{} } +func (*SrPoliciesDetails) GetMessageName() string { return "sr_policies_details" } +func (*SrPoliciesDetails) GetCrcString() string { return "5087f460" } +func (*SrPoliciesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPoliciesDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Bsid + // field[2] m.Bsid.Addr + size += 16 + // field[1] m.Type + size += 1 + // field[1] m.IsEncap + size += 1 + // field[1] m.FibTable + size += 4 + // field[1] m.NumSidLists + size += 1 + // field[1] m.SidLists + for j1 := 0; j1 < len(m.SidLists); j1++ { + var s1 Srv6SidList + _ = s1 + if j1 < len(m.SidLists) { + s1 = m.SidLists[j1] + } + // field[2] s1.NumSids + size += 1 + // field[2] s1.Weight + size += 4 + // field[2] s1.Sids + for j2 := 0; j2 < 16; j2++ { + var s2 Srv6Sid + _ = s2 + if j2 < len(s1.Sids) { + s2 = s1.Sids[j2] + } + // field[3] s2.Addr + size += 16 + } + } + return size +} +func (m *SrPoliciesDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Bsid + // field[2] m.Bsid.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Bsid.Addr) { + x = uint8(m.Bsid.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Type + buf[pos] = uint8(m.Type) + pos += 1 + // field[1] m.IsEncap + buf[pos] = uint8(m.IsEncap) + pos += 1 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.NumSidLists + buf[pos] = uint8(len(m.SidLists)) + pos += 1 + // field[1] m.SidLists + for j1 := 0; j1 < len(m.SidLists); j1++ { + var v1 Srv6SidList + if j1 < len(m.SidLists) { + v1 = m.SidLists[j1] + } + // field[2] v1.NumSids + buf[pos] = uint8(v1.NumSids) + pos += 1 + // field[2] v1.Weight + o.PutUint32(buf[pos:pos+4], uint32(v1.Weight)) + pos += 4 + // field[2] v1.Sids + for j2 := 0; j2 < 16; j2++ { + var v2 Srv6Sid + if j2 < len(v1.Sids) { + v2 = v1.Sids[j2] + } + // field[3] v2.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v2.Addr) { + x = uint8(v2.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + } + } + return buf, nil +} +func (m *SrPoliciesDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Bsid + // field[2] m.Bsid.Addr + m.Bsid.Addr = make([]uint8, 16) + for i := 0; i < len(m.Bsid.Addr); i++ { + m.Bsid.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Type + m.Type = uint8(tmp[pos]) + pos += 1 + // field[1] m.IsEncap + m.IsEncap = uint8(tmp[pos]) + pos += 1 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NumSidLists + m.NumSidLists = uint8(tmp[pos]) + pos += 1 + // field[1] m.SidLists + m.SidLists = make([]Srv6SidList, int(m.NumSidLists)) + for j1 := 0; j1 < int(m.NumSidLists); j1++ { + // field[2] m.SidLists[j1].NumSids + m.SidLists[j1].NumSids = uint8(tmp[pos]) + pos += 1 + // field[2] m.SidLists[j1].Weight + m.SidLists[j1].Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.SidLists[j1].Sids + for j2 := 0; j2 < 16; j2++ { + // field[3] m.SidLists[j1].Sids[j2].Addr + m.SidLists[j1].Sids[j2].Addr = make([]uint8, 16) + for i := 0; i < len(m.SidLists[j1].Sids[j2].Addr); i++ { + m.SidLists[j1].Sids[j2].Addr[i] = uint8(tmp[pos]) + pos += 1 + } + } + } + return nil +} + +// SrPoliciesDump represents VPP binary API message 'sr_policies_dump'. +type SrPoliciesDump struct{} + +func (m *SrPoliciesDump) Reset() { *m = SrPoliciesDump{} } +func (*SrPoliciesDump) GetMessageName() string { return "sr_policies_dump" } +func (*SrPoliciesDump) GetCrcString() string { return "51077d14" } +func (*SrPoliciesDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPoliciesDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrPoliciesDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *SrPoliciesDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// SrPolicyAdd represents VPP binary API message 'sr_policy_add'. +type SrPolicyAdd struct { + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + IsEncap uint8 `binapi:"u8,name=is_encap" json:"is_encap,omitempty"` + Type uint8 `binapi:"u8,name=type" json:"type,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` +} + +func (m *SrPolicyAdd) Reset() { *m = SrPolicyAdd{} } +func (*SrPolicyAdd) GetMessageName() string { return "sr_policy_add" } +func (*SrPolicyAdd) GetCrcString() string { return "4b6e2484" } +func (*SrPolicyAdd) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPolicyAdd) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.BsidAddr + size += 16 + // field[1] m.Weight + size += 4 + // field[1] m.IsEncap + size += 1 + // field[1] m.Type + size += 1 + // field[1] m.FibTable + size += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + size += 1 + // field[2] m.Sids.Weight + size += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var s2 Srv6Sid + _ = s2 + if j2 < len(m.Sids.Sids) { + s2 = m.Sids.Sids[j2] + } + // field[3] s2.Addr + size += 16 + } + return size +} +func (m *SrPolicyAdd) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.BsidAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr) { + x = uint8(m.BsidAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Weight)) + pos += 4 + // field[1] m.IsEncap + buf[pos] = uint8(m.IsEncap) + pos += 1 + // field[1] m.Type + buf[pos] = uint8(m.Type) + pos += 1 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + buf[pos] = uint8(m.Sids.NumSids) + pos += 1 + // field[2] m.Sids.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Sids.Weight)) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var v2 Srv6Sid + if j2 < len(m.Sids.Sids) { + v2 = m.Sids.Sids[j2] + } + // field[3] v2.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v2.Addr) { + x = uint8(v2.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + } + return buf, nil +} +func (m *SrPolicyAdd) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.BsidAddr + m.BsidAddr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr); i++ { + m.BsidAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Weight + m.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsEncap + m.IsEncap = uint8(tmp[pos]) + pos += 1 + // field[1] m.Type + m.Type = uint8(tmp[pos]) + pos += 1 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + m.Sids.NumSids = uint8(tmp[pos]) + pos += 1 + // field[2] m.Sids.Weight + m.Sids.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + // field[3] m.Sids.Sids[j2].Addr + m.Sids.Sids[j2].Addr = make([]uint8, 16) + for i := 0; i < len(m.Sids.Sids[j2].Addr); i++ { + m.Sids.Sids[j2].Addr[i] = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// SrPolicyAddReply represents VPP binary API message 'sr_policy_add_reply'. +type SrPolicyAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyAddReply) Reset() { *m = SrPolicyAddReply{} } +func (*SrPolicyAddReply) GetMessageName() string { return "sr_policy_add_reply" } +func (*SrPolicyAddReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPolicyAddReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrPolicyAddReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrPolicyAddReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrPolicyDel represents VPP binary API message 'sr_policy_del'. +type SrPolicyDel struct { + BsidAddr Srv6Sid `binapi:"srv6_sid,name=bsid_addr" json:"bsid_addr,omitempty"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` +} + +func (m *SrPolicyDel) Reset() { *m = SrPolicyDel{} } +func (*SrPolicyDel) GetMessageName() string { return "sr_policy_del" } +func (*SrPolicyDel) GetCrcString() string { return "e4133171" } +func (*SrPolicyDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPolicyDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.BsidAddr + // field[2] m.BsidAddr.Addr + size += 16 + // field[1] m.SrPolicyIndex + size += 4 + return size +} +func (m *SrPolicyDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.BsidAddr + // field[2] m.BsidAddr.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr.Addr) { + x = uint8(m.BsidAddr.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.SrPolicyIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) + pos += 4 + return buf, nil +} +func (m *SrPolicyDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.BsidAddr + // field[2] m.BsidAddr.Addr + m.BsidAddr.Addr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr.Addr); i++ { + m.BsidAddr.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.SrPolicyIndex + m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrPolicyDelReply represents VPP binary API message 'sr_policy_del_reply'. +type SrPolicyDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyDelReply) Reset() { *m = SrPolicyDelReply{} } +func (*SrPolicyDelReply) GetMessageName() string { return "sr_policy_del_reply" } +func (*SrPolicyDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPolicyDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrPolicyDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrPolicyDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrPolicyMod represents VPP binary API message 'sr_policy_mod'. +type SrPolicyMod struct { + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + Operation uint8 `binapi:"u8,name=operation" json:"operation,omitempty"` + SlIndex uint32 `binapi:"u32,name=sl_index" json:"sl_index,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` +} + +func (m *SrPolicyMod) Reset() { *m = SrPolicyMod{} } +func (*SrPolicyMod) GetMessageName() string { return "sr_policy_mod" } +func (*SrPolicyMod) GetCrcString() string { return "c1dfaee0" } +func (*SrPolicyMod) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPolicyMod) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.BsidAddr + size += 16 + // field[1] m.SrPolicyIndex + size += 4 + // field[1] m.FibTable + size += 4 + // field[1] m.Operation + size += 1 + // field[1] m.SlIndex + size += 4 + // field[1] m.Weight + size += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + size += 1 + // field[2] m.Sids.Weight + size += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var s2 Srv6Sid + _ = s2 + if j2 < len(m.Sids.Sids) { + s2 = m.Sids.Sids[j2] + } + // field[3] s2.Addr + size += 16 + } + return size +} +func (m *SrPolicyMod) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.BsidAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr) { + x = uint8(m.BsidAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.SrPolicyIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) + pos += 4 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.Operation + buf[pos] = uint8(m.Operation) + pos += 1 + // field[1] m.SlIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SlIndex)) + pos += 4 + // field[1] m.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Weight)) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + buf[pos] = uint8(m.Sids.NumSids) + pos += 1 + // field[2] m.Sids.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Sids.Weight)) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var v2 Srv6Sid + if j2 < len(m.Sids.Sids) { + v2 = m.Sids.Sids[j2] + } + // field[3] v2.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v2.Addr) { + x = uint8(v2.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + } + return buf, nil +} +func (m *SrPolicyMod) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.BsidAddr + m.BsidAddr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr); i++ { + m.BsidAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.SrPolicyIndex + m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Operation + m.Operation = uint8(tmp[pos]) + pos += 1 + // field[1] m.SlIndex + m.SlIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Weight + m.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + m.Sids.NumSids = uint8(tmp[pos]) + pos += 1 + // field[2] m.Sids.Weight + m.Sids.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + // field[3] m.Sids.Sids[j2].Addr + m.Sids.Sids[j2].Addr = make([]uint8, 16) + for i := 0; i < len(m.Sids.Sids[j2].Addr); i++ { + m.Sids.Sids[j2].Addr[i] = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// SrPolicyModReply represents VPP binary API message 'sr_policy_mod_reply'. +type SrPolicyModReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyModReply) Reset() { *m = SrPolicyModReply{} } +func (*SrPolicyModReply) GetMessageName() string { return "sr_policy_mod_reply" } +func (*SrPolicyModReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyModReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPolicyModReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrPolicyModReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrPolicyModReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSetEncapHopLimit represents VPP binary API message 'sr_set_encap_hop_limit'. +type SrSetEncapHopLimit struct { + HopLimit uint8 `binapi:"u8,name=hop_limit" json:"hop_limit,omitempty"` +} + +func (m *SrSetEncapHopLimit) Reset() { *m = SrSetEncapHopLimit{} } +func (*SrSetEncapHopLimit) GetMessageName() string { return "sr_set_encap_hop_limit" } +func (*SrSetEncapHopLimit) GetCrcString() string { return "aa75d7d0" } +func (*SrSetEncapHopLimit) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSetEncapHopLimit) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.HopLimit + size += 1 + return size +} +func (m *SrSetEncapHopLimit) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.HopLimit + buf[pos] = uint8(m.HopLimit) + pos += 1 + return buf, nil +} +func (m *SrSetEncapHopLimit) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.HopLimit + m.HopLimit = uint8(tmp[pos]) + pos += 1 + return nil +} + +// SrSetEncapHopLimitReply represents VPP binary API message 'sr_set_encap_hop_limit_reply'. +type SrSetEncapHopLimitReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSetEncapHopLimitReply) Reset() { *m = SrSetEncapHopLimitReply{} } +func (*SrSetEncapHopLimitReply) GetMessageName() string { return "sr_set_encap_hop_limit_reply" } +func (*SrSetEncapHopLimitReply) GetCrcString() string { return "e8d4e804" } +func (*SrSetEncapHopLimitReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSetEncapHopLimitReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrSetEncapHopLimitReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrSetEncapHopLimitReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSetEncapSource represents VPP binary API message 'sr_set_encap_source'. +type SrSetEncapSource struct { + EncapsSource []byte `binapi:"u8[16],name=encaps_source" json:"encaps_source,omitempty" struc:"[16]byte"` +} + +func (m *SrSetEncapSource) Reset() { *m = SrSetEncapSource{} } +func (*SrSetEncapSource) GetMessageName() string { return "sr_set_encap_source" } +func (*SrSetEncapSource) GetCrcString() string { return "d05bb4de" } +func (*SrSetEncapSource) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSetEncapSource) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.EncapsSource + size += 16 + return size +} +func (m *SrSetEncapSource) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.EncapsSource + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.EncapsSource) { + x = uint8(m.EncapsSource[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SrSetEncapSource) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.EncapsSource + m.EncapsSource = make([]uint8, 16) + for i := 0; i < len(m.EncapsSource); i++ { + m.EncapsSource[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SrSetEncapSourceReply represents VPP binary API message 'sr_set_encap_source_reply'. +type SrSetEncapSourceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSetEncapSourceReply) Reset() { *m = SrSetEncapSourceReply{} } +func (*SrSetEncapSourceReply) GetMessageName() string { return "sr_set_encap_source_reply" } +func (*SrSetEncapSourceReply) GetCrcString() string { return "e8d4e804" } +func (*SrSetEncapSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSetEncapSourceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrSetEncapSourceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrSetEncapSourceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSteeringAddDel represents VPP binary API message 'sr_steering_add_del'. +type SrSteeringAddDel struct { + IsDel uint8 `binapi:"u8,name=is_del" json:"is_del,omitempty"` + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + PrefixAddr []byte `binapi:"u8[16],name=prefix_addr" json:"prefix_addr,omitempty" struc:"[16]byte"` + MaskWidth uint32 `binapi:"u32,name=mask_width" json:"mask_width,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + TrafficType uint8 `binapi:"u8,name=traffic_type" json:"traffic_type,omitempty"` +} + +func (m *SrSteeringAddDel) Reset() { *m = SrSteeringAddDel{} } +func (*SrSteeringAddDel) GetMessageName() string { return "sr_steering_add_del" } +func (*SrSteeringAddDel) GetCrcString() string { return "28b5dcab" } +func (*SrSteeringAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSteeringAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsDel + size += 1 + // field[1] m.BsidAddr + size += 16 + // field[1] m.SrPolicyIndex + size += 4 + // field[1] m.TableID + size += 4 + // field[1] m.PrefixAddr + size += 16 + // field[1] m.MaskWidth + size += 4 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.TrafficType + size += 1 + return size +} +func (m *SrSteeringAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsDel + buf[pos] = uint8(m.IsDel) + pos += 1 + // field[1] m.BsidAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr) { + x = uint8(m.BsidAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.SrPolicyIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) + pos += 4 + // field[1] m.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.TableID)) + pos += 4 + // field[1] m.PrefixAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.PrefixAddr) { + x = uint8(m.PrefixAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.MaskWidth + o.PutUint32(buf[pos:pos+4], uint32(m.MaskWidth)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.TrafficType + buf[pos] = uint8(m.TrafficType) + pos += 1 + return buf, nil +} +func (m *SrSteeringAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsDel + m.IsDel = uint8(tmp[pos]) + pos += 1 + // field[1] m.BsidAddr + m.BsidAddr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr); i++ { + m.BsidAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.SrPolicyIndex + m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TableID + m.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.PrefixAddr + m.PrefixAddr = make([]uint8, 16) + for i := 0; i < len(m.PrefixAddr); i++ { + m.PrefixAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.MaskWidth + m.MaskWidth = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TrafficType + m.TrafficType = uint8(tmp[pos]) + pos += 1 + return nil +} + +// SrSteeringAddDelReply represents VPP binary API message 'sr_steering_add_del_reply'. +type SrSteeringAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSteeringAddDelReply) Reset() { *m = SrSteeringAddDelReply{} } +func (*SrSteeringAddDelReply) GetMessageName() string { return "sr_steering_add_del_reply" } +func (*SrSteeringAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrSteeringAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSteeringAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrSteeringAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrSteeringAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSteeringPolDetails represents VPP binary API message 'sr_steering_pol_details'. +type SrSteeringPolDetails struct { + TrafficType uint8 `binapi:"u8,name=traffic_type" json:"traffic_type,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + PrefixAddr []byte `binapi:"u8[16],name=prefix_addr" json:"prefix_addr,omitempty" struc:"[16]byte"` + MaskWidth uint32 `binapi:"u32,name=mask_width" json:"mask_width,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Bsid Srv6Sid `binapi:"srv6_sid,name=bsid" json:"bsid,omitempty"` +} + +func (m *SrSteeringPolDetails) Reset() { *m = SrSteeringPolDetails{} } +func (*SrSteeringPolDetails) GetMessageName() string { return "sr_steering_pol_details" } +func (*SrSteeringPolDetails) GetCrcString() string { return "5627d483" } +func (*SrSteeringPolDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSteeringPolDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.TrafficType + size += 1 + // field[1] m.FibTable + size += 4 + // field[1] m.PrefixAddr + size += 16 + // field[1] m.MaskWidth + size += 4 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Bsid + // field[2] m.Bsid.Addr + size += 16 + return size +} +func (m *SrSteeringPolDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.TrafficType + buf[pos] = uint8(m.TrafficType) + pos += 1 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.PrefixAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.PrefixAddr) { + x = uint8(m.PrefixAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.MaskWidth + o.PutUint32(buf[pos:pos+4], uint32(m.MaskWidth)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Bsid + // field[2] m.Bsid.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Bsid.Addr) { + x = uint8(m.Bsid.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SrSteeringPolDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.TrafficType + m.TrafficType = uint8(tmp[pos]) + pos += 1 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.PrefixAddr + m.PrefixAddr = make([]uint8, 16) + for i := 0; i < len(m.PrefixAddr); i++ { + m.PrefixAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.MaskWidth + m.MaskWidth = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Bsid + // field[2] m.Bsid.Addr + m.Bsid.Addr = make([]uint8, 16) + for i := 0; i < len(m.Bsid.Addr); i++ { + m.Bsid.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SrSteeringPolDump represents VPP binary API message 'sr_steering_pol_dump'. +type SrSteeringPolDump struct{} + +func (m *SrSteeringPolDump) Reset() { *m = SrSteeringPolDump{} } +func (*SrSteeringPolDump) GetMessageName() string { return "sr_steering_pol_dump" } +func (*SrSteeringPolDump) GetCrcString() string { return "51077d14" } +func (*SrSteeringPolDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSteeringPolDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrSteeringPolDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *SrSteeringPolDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +func init() { file_sr_binapi_init() } +func file_sr_binapi_init() { + api.RegisterMessage((*SrLocalsidAddDel)(nil), "sr.SrLocalsidAddDel") + api.RegisterMessage((*SrLocalsidAddDelReply)(nil), "sr.SrLocalsidAddDelReply") + api.RegisterMessage((*SrLocalsidsDetails)(nil), "sr.SrLocalsidsDetails") + api.RegisterMessage((*SrLocalsidsDump)(nil), "sr.SrLocalsidsDump") + api.RegisterMessage((*SrPoliciesDetails)(nil), "sr.SrPoliciesDetails") + api.RegisterMessage((*SrPoliciesDump)(nil), "sr.SrPoliciesDump") + api.RegisterMessage((*SrPolicyAdd)(nil), "sr.SrPolicyAdd") + api.RegisterMessage((*SrPolicyAddReply)(nil), "sr.SrPolicyAddReply") + api.RegisterMessage((*SrPolicyDel)(nil), "sr.SrPolicyDel") + api.RegisterMessage((*SrPolicyDelReply)(nil), "sr.SrPolicyDelReply") + api.RegisterMessage((*SrPolicyMod)(nil), "sr.SrPolicyMod") + api.RegisterMessage((*SrPolicyModReply)(nil), "sr.SrPolicyModReply") + api.RegisterMessage((*SrSetEncapHopLimit)(nil), "sr.SrSetEncapHopLimit") + api.RegisterMessage((*SrSetEncapHopLimitReply)(nil), "sr.SrSetEncapHopLimitReply") + api.RegisterMessage((*SrSetEncapSource)(nil), "sr.SrSetEncapSource") + api.RegisterMessage((*SrSetEncapSourceReply)(nil), "sr.SrSetEncapSourceReply") + api.RegisterMessage((*SrSteeringAddDel)(nil), "sr.SrSteeringAddDel") + api.RegisterMessage((*SrSteeringAddDelReply)(nil), "sr.SrSteeringAddDelReply") + api.RegisterMessage((*SrSteeringPolDetails)(nil), "sr.SrSteeringPolDetails") + api.RegisterMessage((*SrSteeringPolDump)(nil), "sr.SrSteeringPolDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SrLocalsidAddDel)(nil), + (*SrLocalsidAddDelReply)(nil), + (*SrLocalsidsDetails)(nil), + (*SrLocalsidsDump)(nil), + (*SrPoliciesDetails)(nil), + (*SrPoliciesDump)(nil), + (*SrPolicyAdd)(nil), + (*SrPolicyAddReply)(nil), + (*SrPolicyDel)(nil), + (*SrPolicyDelReply)(nil), + (*SrPolicyMod)(nil), + (*SrPolicyModReply)(nil), + (*SrSetEncapHopLimit)(nil), + (*SrSetEncapHopLimitReply)(nil), + (*SrSetEncapSource)(nil), + (*SrSetEncapSourceReply)(nil), + (*SrSteeringAddDel)(nil), + (*SrSteeringAddDelReply)(nil), + (*SrSteeringPolDetails)(nil), + (*SrSteeringPolDump)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/sr/sr_rpc.ba.go b/codec/testdata/binapi2001/sr/sr_rpc.ba.go new file mode 100644 index 0000000..aeb3cde --- /dev/null +++ b/codec/testdata/binapi2001/sr/sr_rpc.ba.go @@ -0,0 +1,178 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package sr + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for sr module. +type RPCService interface { + DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) + DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) + DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) + SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) + SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) + SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) + SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) + SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) + SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) + SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrLocalsidsClient{stream} + return x, nil +} + +type RPCService_DumpSrLocalsidsClient interface { + Recv() (*SrLocalsidsDetails, error) +} + +type serviceClient_DumpSrLocalsidsClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrLocalsidsClient) Recv() (*SrLocalsidsDetails, error) { + m := new(SrLocalsidsDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrPoliciesClient{stream} + return x, nil +} + +type RPCService_DumpSrPoliciesClient interface { + Recv() (*SrPoliciesDetails, error) +} + +type serviceClient_DumpSrPoliciesClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrPoliciesClient) Recv() (*SrPoliciesDetails, error) { + m := new(SrPoliciesDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrSteeringPolClient{stream} + return x, nil +} + +type RPCService_DumpSrSteeringPolClient interface { + Recv() (*SrSteeringPolDetails, error) +} + +type serviceClient_DumpSrSteeringPolClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrSteeringPolClient) Recv() (*SrSteeringPolDetails, error) { + m := new(SrSteeringPolDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) { + out := new(SrLocalsidAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) { + out := new(SrPolicyAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) { + out := new(SrPolicyDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) { + out := new(SrPolicyModReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) { + out := new(SrSetEncapHopLimitReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) { + out := new(SrSetEncapSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) { + out := new(SrSteeringAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/codec/testdata/binapi2001/vpe/vpe.ba.go b/codec/testdata/binapi2001/vpe/vpe.ba.go new file mode 100644 index 0000000..e12bca4 --- /dev/null +++ b/codec/testdata/binapi2001/vpe/vpe.ba.go @@ -0,0 +1,1701 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/vpe.api.json + +/* +Package vpe contains generated code for VPP binary API defined by vpe.api (version 1.6.0). + +It consists of: + 2 aliases + 1 enum + 26 messages + 2 types +*/ +package vpe + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "vpe" + // APIVersion is the API version of this module. + APIVersion = "1.6.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xc6c0bcf6 +) + +// LogLevel represents VPP binary API enum 'log_level'. +type LogLevel uint32 + +const ( + VPE_API_LOG_LEVEL_EMERG LogLevel = 0 + VPE_API_LOG_LEVEL_ALERT LogLevel = 1 + VPE_API_LOG_LEVEL_CRIT LogLevel = 2 + VPE_API_LOG_LEVEL_ERR LogLevel = 3 + VPE_API_LOG_LEVEL_WARNING LogLevel = 4 + VPE_API_LOG_LEVEL_NOTICE LogLevel = 5 + VPE_API_LOG_LEVEL_INFO LogLevel = 6 + VPE_API_LOG_LEVEL_DEBUG LogLevel = 7 + VPE_API_LOG_LEVEL_DISABLED LogLevel = 8 +) + +var ( + LogLevel_name = map[uint32]string{ + 0: "VPE_API_LOG_LEVEL_EMERG", + 1: "VPE_API_LOG_LEVEL_ALERT", + 2: "VPE_API_LOG_LEVEL_CRIT", + 3: "VPE_API_LOG_LEVEL_ERR", + 4: "VPE_API_LOG_LEVEL_WARNING", + 5: "VPE_API_LOG_LEVEL_NOTICE", + 6: "VPE_API_LOG_LEVEL_INFO", + 7: "VPE_API_LOG_LEVEL_DEBUG", + 8: "VPE_API_LOG_LEVEL_DISABLED", + } + LogLevel_value = map[string]uint32{ + "VPE_API_LOG_LEVEL_EMERG": 0, + "VPE_API_LOG_LEVEL_ALERT": 1, + "VPE_API_LOG_LEVEL_CRIT": 2, + "VPE_API_LOG_LEVEL_ERR": 3, + "VPE_API_LOG_LEVEL_WARNING": 4, + "VPE_API_LOG_LEVEL_NOTICE": 5, + "VPE_API_LOG_LEVEL_INFO": 6, + "VPE_API_LOG_LEVEL_DEBUG": 7, + "VPE_API_LOG_LEVEL_DISABLED": 8, + } +) + +func (x LogLevel) String() string { + s, ok := LogLevel_name[uint32(x)] + if ok { + return s + } + return "LogLevel(" + strconv.Itoa(int(x)) + ")" +} + +// Timedelta represents VPP binary API alias 'timedelta'. +type Timedelta float64 + +// Timestamp represents VPP binary API alias 'timestamp'. +type Timestamp float64 + +// ThreadData represents VPP binary API type 'thread_data'. +type ThreadData struct { + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Name []byte `binapi:"u8[64],name=name" json:"name,omitempty" struc:"[64]byte"` + Type []byte `binapi:"u8[64],name=type" json:"type,omitempty" struc:"[64]byte"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + CPUID uint32 `binapi:"u32,name=cpu_id" json:"cpu_id,omitempty"` + Core uint32 `binapi:"u32,name=core" json:"core,omitempty"` + CPUSocket uint32 `binapi:"u32,name=cpu_socket" json:"cpu_socket,omitempty"` +} + +func (*ThreadData) GetTypeName() string { return "thread_data" } + +// Version represents VPP binary API type 'version'. +type Version struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` + Patch uint32 `binapi:"u32,name=patch" json:"patch,omitempty"` + PreRelease []byte `binapi:"u8[17],name=pre_release" json:"pre_release,omitempty" struc:"[17]byte"` + BuildMetadata []byte `binapi:"u8[17],name=build_metadata" json:"build_metadata,omitempty" struc:"[17]byte"` +} + +func (*Version) GetTypeName() string { return "version" } + +// AddNodeNext represents VPP binary API message 'add_node_next'. +type AddNodeNext struct { + NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` + NextName []byte `binapi:"u8[64],name=next_name" json:"next_name,omitempty" struc:"[64]byte"` +} + +func (m *AddNodeNext) Reset() { *m = AddNodeNext{} } +func (*AddNodeNext) GetMessageName() string { return "add_node_next" } +func (*AddNodeNext) GetCrcString() string { return "9ab92f7a" } +func (*AddNodeNext) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *AddNodeNext) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.NodeName + size += 64 + // field[1] m.NextName + size += 64 + return size +} +func (m *AddNodeNext) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.NodeName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NodeName) { + x = uint8(m.NodeName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.NextName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NextName) { + x = uint8(m.NextName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *AddNodeNext) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.NodeName + m.NodeName = make([]uint8, 64) + for i := 0; i < len(m.NodeName); i++ { + m.NodeName[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.NextName + m.NextName = make([]uint8, 64) + for i := 0; i < len(m.NextName); i++ { + m.NextName[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// AddNodeNextReply represents VPP binary API message 'add_node_next_reply'. +type AddNodeNextReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` +} + +func (m *AddNodeNextReply) Reset() { *m = AddNodeNextReply{} } +func (*AddNodeNextReply) GetMessageName() string { return "add_node_next_reply" } +func (*AddNodeNextReply) GetCrcString() string { return "2ed75f32" } +func (*AddNodeNextReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *AddNodeNextReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.NextIndex + size += 4 + return size +} +func (m *AddNodeNextReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.NextIndex + o.PutUint32(buf[pos:pos+4], uint32(m.NextIndex)) + pos += 4 + return buf, nil +} +func (m *AddNodeNextReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NextIndex + m.NextIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// Cli represents VPP binary API message 'cli'. +type Cli struct { + CmdInShmem uint64 `binapi:"u64,name=cmd_in_shmem" json:"cmd_in_shmem,omitempty"` +} + +func (m *Cli) Reset() { *m = Cli{} } +func (*Cli) GetMessageName() string { return "cli" } +func (*Cli) GetCrcString() string { return "23bfbfff" } +func (*Cli) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *Cli) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.CmdInShmem + size += 8 + return size +} +func (m *Cli) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.CmdInShmem + o.PutUint64(buf[pos:pos+8], uint64(m.CmdInShmem)) + pos += 8 + return buf, nil +} +func (m *Cli) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.CmdInShmem + m.CmdInShmem = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + +// CliInband represents VPP binary API message 'cli_inband'. +type CliInband struct { + XXX_CmdLen uint32 `struc:"sizeof=Cmd"` + Cmd string `json:"cmd,omitempty"` +} + +func (m *CliInband) Reset() { *m = CliInband{} } +func (*CliInband) GetMessageName() string { return "cli_inband" } +func (*CliInband) GetCrcString() string { return "f8377302" } +func (*CliInband) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *CliInband) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Cmd + size += 4 + len(m.Cmd) + return size +} +func (m *CliInband) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Cmd + o.PutUint32(buf[pos:pos+4], uint32(len(m.Cmd))) + pos += 4 + copy(buf[pos:pos+len(m.Cmd)], m.Cmd[:]) + pos += len(m.Cmd) + return buf, nil +} +func (m *CliInband) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Cmd + { + siz := o.Uint32(tmp[pos : pos+4]) + pos += 4 + m.Cmd = codec.DecodeString(tmp[pos : pos+int(siz)]) + pos += len(m.Cmd) + } + return nil +} + +// CliInbandReply represents VPP binary API message 'cli_inband_reply'. +type CliInbandReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + XXX_ReplyLen uint32 `struc:"sizeof=Reply"` + Reply string `json:"reply,omitempty"` +} + +func (m *CliInbandReply) Reset() { *m = CliInbandReply{} } +func (*CliInbandReply) GetMessageName() string { return "cli_inband_reply" } +func (*CliInbandReply) GetCrcString() string { return "05879051" } +func (*CliInbandReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *CliInbandReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.Reply + size += 4 + len(m.Reply) + return size +} +func (m *CliInbandReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.Reply + o.PutUint32(buf[pos:pos+4], uint32(len(m.Reply))) + pos += 4 + copy(buf[pos:pos+len(m.Reply)], m.Reply[:]) + pos += len(m.Reply) + return buf, nil +} +func (m *CliInbandReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Reply + { + siz := o.Uint32(tmp[pos : pos+4]) + pos += 4 + m.Reply = codec.DecodeString(tmp[pos : pos+int(siz)]) + pos += len(m.Reply) + } + return nil +} + +// CliReply represents VPP binary API message 'cli_reply'. +type CliReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` +} + +func (m *CliReply) Reset() { *m = CliReply{} } +func (*CliReply) GetMessageName() string { return "cli_reply" } +func (*CliReply) GetCrcString() string { return "06d68297" } +func (*CliReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *CliReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.ReplyInShmem + size += 8 + return size +} +func (m *CliReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.ReplyInShmem + o.PutUint64(buf[pos:pos+8], uint64(m.ReplyInShmem)) + pos += 8 + return buf, nil +} +func (m *CliReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ReplyInShmem + m.ReplyInShmem = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + +// ControlPing represents VPP binary API message 'control_ping'. +type ControlPing struct{} + +func (m *ControlPing) Reset() { *m = ControlPing{} } +func (*ControlPing) GetMessageName() string { return "control_ping" } +func (*ControlPing) GetCrcString() string { return "51077d14" } +func (*ControlPing) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ControlPing) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ControlPing) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ControlPing) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// ControlPingReply represents VPP binary API message 'control_ping_reply'. +type ControlPingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` + VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` +} + +func (m *ControlPingReply) Reset() { *m = ControlPingReply{} } +func (*ControlPingReply) GetMessageName() string { return "control_ping_reply" } +func (*ControlPingReply) GetCrcString() string { return "f6b0b8ca" } +func (*ControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ControlPingReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.ClientIndex + size += 4 + // field[1] m.VpePID + size += 4 + return size +} +func (m *ControlPingReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.ClientIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ClientIndex)) + pos += 4 + // field[1] m.VpePID + o.PutUint32(buf[pos:pos+4], uint32(m.VpePID)) + pos += 4 + return buf, nil +} +func (m *ControlPingReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ClientIndex + m.ClientIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VpePID + m.VpePID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// GetF64EndianValue represents VPP binary API message 'get_f64_endian_value'. +type GetF64EndianValue struct { + F64One float64 `binapi:"f64,name=f64_one,default=1" json:"f64_one,omitempty"` +} + +func (m *GetF64EndianValue) Reset() { *m = GetF64EndianValue{} } +func (*GetF64EndianValue) GetMessageName() string { return "get_f64_endian_value" } +func (*GetF64EndianValue) GetCrcString() string { return "809fcd44" } +func (*GetF64EndianValue) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *GetF64EndianValue) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.F64One + size += 8 + return size +} +func (m *GetF64EndianValue) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.F64One + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64One))) + pos += 8 + return buf, nil +} +func (m *GetF64EndianValue) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.F64One + m.F64One = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + +// GetF64EndianValueReply represents VPP binary API message 'get_f64_endian_value_reply'. +type GetF64EndianValueReply struct { + Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` + F64OneResult float64 `binapi:"f64,name=f64_one_result" json:"f64_one_result,omitempty"` +} + +func (m *GetF64EndianValueReply) Reset() { *m = GetF64EndianValueReply{} } +func (*GetF64EndianValueReply) GetMessageName() string { return "get_f64_endian_value_reply" } +func (*GetF64EndianValueReply) GetCrcString() string { return "7e02e404" } +func (*GetF64EndianValueReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *GetF64EndianValueReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.F64OneResult + size += 8 + return size +} +func (m *GetF64EndianValueReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.F64OneResult + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64OneResult))) + pos += 8 + return buf, nil +} +func (m *GetF64EndianValueReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.F64OneResult + m.F64OneResult = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + +// GetF64IncrementByOne represents VPP binary API message 'get_f64_increment_by_one'. +type GetF64IncrementByOne struct { + F64Value float64 `binapi:"f64,name=f64_value,default=1" json:"f64_value,omitempty"` +} + +func (m *GetF64IncrementByOne) Reset() { *m = GetF64IncrementByOne{} } +func (*GetF64IncrementByOne) GetMessageName() string { return "get_f64_increment_by_one" } +func (*GetF64IncrementByOne) GetCrcString() string { return "b64f027e" } +func (*GetF64IncrementByOne) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *GetF64IncrementByOne) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.F64Value + size += 8 + return size +} +func (m *GetF64IncrementByOne) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.F64Value + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64Value))) + pos += 8 + return buf, nil +} +func (m *GetF64IncrementByOne) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.F64Value + m.F64Value = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + +// GetF64IncrementByOneReply represents VPP binary API message 'get_f64_increment_by_one_reply'. +type GetF64IncrementByOneReply struct { + Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` + F64Value float64 `binapi:"f64,name=f64_value" json:"f64_value,omitempty"` +} + +func (m *GetF64IncrementByOneReply) Reset() { *m = GetF64IncrementByOneReply{} } +func (*GetF64IncrementByOneReply) GetMessageName() string { return "get_f64_increment_by_one_reply" } +func (*GetF64IncrementByOneReply) GetCrcString() string { return "d25dbaa3" } +func (*GetF64IncrementByOneReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *GetF64IncrementByOneReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.F64Value + size += 8 + return size +} +func (m *GetF64IncrementByOneReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.F64Value + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64Value))) + pos += 8 + return buf, nil +} +func (m *GetF64IncrementByOneReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.F64Value + m.F64Value = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + +// GetNextIndex represents VPP binary API message 'get_next_index'. +type GetNextIndex struct { + NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` + NextName []byte `binapi:"u8[64],name=next_name" json:"next_name,omitempty" struc:"[64]byte"` +} + +func (m *GetNextIndex) Reset() { *m = GetNextIndex{} } +func (*GetNextIndex) GetMessageName() string { return "get_next_index" } +func (*GetNextIndex) GetCrcString() string { return "9ab92f7a" } +func (*GetNextIndex) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *GetNextIndex) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.NodeName + size += 64 + // field[1] m.NextName + size += 64 + return size +} +func (m *GetNextIndex) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.NodeName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NodeName) { + x = uint8(m.NodeName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.NextName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NextName) { + x = uint8(m.NextName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *GetNextIndex) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.NodeName + m.NodeName = make([]uint8, 64) + for i := 0; i < len(m.NodeName); i++ { + m.NodeName[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.NextName + m.NextName = make([]uint8, 64) + for i := 0; i < len(m.NextName); i++ { + m.NextName[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// GetNextIndexReply represents VPP binary API message 'get_next_index_reply'. +type GetNextIndexReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` +} + +func (m *GetNextIndexReply) Reset() { *m = GetNextIndexReply{} } +func (*GetNextIndexReply) GetMessageName() string { return "get_next_index_reply" } +func (*GetNextIndexReply) GetCrcString() string { return "2ed75f32" } +func (*GetNextIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *GetNextIndexReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.NextIndex + size += 4 + return size +} +func (m *GetNextIndexReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.NextIndex + o.PutUint32(buf[pos:pos+4], uint32(m.NextIndex)) + pos += 4 + return buf, nil +} +func (m *GetNextIndexReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NextIndex + m.NextIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// GetNodeGraph represents VPP binary API message 'get_node_graph'. +type GetNodeGraph struct{} + +func (m *GetNodeGraph) Reset() { *m = GetNodeGraph{} } +func (*GetNodeGraph) GetMessageName() string { return "get_node_graph" } +func (*GetNodeGraph) GetCrcString() string { return "51077d14" } +func (*GetNodeGraph) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *GetNodeGraph) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GetNodeGraph) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *GetNodeGraph) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// GetNodeGraphReply represents VPP binary API message 'get_node_graph_reply'. +type GetNodeGraphReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` +} + +func (m *GetNodeGraphReply) Reset() { *m = GetNodeGraphReply{} } +func (*GetNodeGraphReply) GetMessageName() string { return "get_node_graph_reply" } +func (*GetNodeGraphReply) GetCrcString() string { return "06d68297" } +func (*GetNodeGraphReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *GetNodeGraphReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.ReplyInShmem + size += 8 + return size +} +func (m *GetNodeGraphReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.ReplyInShmem + o.PutUint64(buf[pos:pos+8], uint64(m.ReplyInShmem)) + pos += 8 + return buf, nil +} +func (m *GetNodeGraphReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ReplyInShmem + m.ReplyInShmem = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + +// GetNodeIndex represents VPP binary API message 'get_node_index'. +type GetNodeIndex struct { + NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` +} + +func (m *GetNodeIndex) Reset() { *m = GetNodeIndex{} } +func (*GetNodeIndex) GetMessageName() string { return "get_node_index" } +func (*GetNodeIndex) GetCrcString() string { return "6c9a495d" } +func (*GetNodeIndex) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *GetNodeIndex) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.NodeName + size += 64 + return size +} +func (m *GetNodeIndex) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.NodeName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NodeName) { + x = uint8(m.NodeName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *GetNodeIndex) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.NodeName + m.NodeName = make([]uint8, 64) + for i := 0; i < len(m.NodeName); i++ { + m.NodeName[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// GetNodeIndexReply represents VPP binary API message 'get_node_index_reply'. +type GetNodeIndexReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NodeIndex uint32 `binapi:"u32,name=node_index" json:"node_index,omitempty"` +} + +func (m *GetNodeIndexReply) Reset() { *m = GetNodeIndexReply{} } +func (*GetNodeIndexReply) GetMessageName() string { return "get_node_index_reply" } +func (*GetNodeIndexReply) GetCrcString() string { return "a8600b89" } +func (*GetNodeIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *GetNodeIndexReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.NodeIndex + size += 4 + return size +} +func (m *GetNodeIndexReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.NodeIndex + o.PutUint32(buf[pos:pos+4], uint32(m.NodeIndex)) + pos += 4 + return buf, nil +} +func (m *GetNodeIndexReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NodeIndex + m.NodeIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// LogDetails represents VPP binary API message 'log_details'. +type LogDetails struct { + Timestamp Timestamp `binapi:"timestamp,name=timestamp" json:"timestamp,omitempty"` + Level LogLevel `binapi:"log_level,name=level" json:"level,omitempty"` + MsgClass string `binapi:"string[32],name=msg_class" json:"msg_class,omitempty" struc:"[32]byte"` + Message string `binapi:"string[256],name=message" json:"message,omitempty" struc:"[256]byte"` +} + +func (m *LogDetails) Reset() { *m = LogDetails{} } +func (*LogDetails) GetMessageName() string { return "log_details" } +func (*LogDetails) GetCrcString() string { return "255827a1" } +func (*LogDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *LogDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Timestamp + size += 8 + // field[1] m.Level + size += 4 + // field[1] m.MsgClass + size += 32 + // field[1] m.Message + size += 256 + return size +} +func (m *LogDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Timestamp + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.Timestamp))) + pos += 8 + // field[1] m.Level + o.PutUint32(buf[pos:pos+4], uint32(m.Level)) + pos += 4 + // field[1] m.MsgClass + copy(buf[pos:pos+32], m.MsgClass) + pos += 32 + // field[1] m.Message + copy(buf[pos:pos+256], m.Message) + pos += 256 + return buf, nil +} +func (m *LogDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Timestamp + m.Timestamp = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + // field[1] m.Level + m.Level = LogLevel(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MsgClass + { + nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) + m.MsgClass = codec.DecodeString(tmp[pos : pos+nul]) + pos += 32 + } + // field[1] m.Message + { + nul := bytes.Index(tmp[pos:pos+256], []byte{0x00}) + m.Message = codec.DecodeString(tmp[pos : pos+nul]) + pos += 256 + } + return nil +} + +// LogDump represents VPP binary API message 'log_dump'. +type LogDump struct { + StartTimestamp Timestamp `binapi:"timestamp,name=start_timestamp" json:"start_timestamp,omitempty"` +} + +func (m *LogDump) Reset() { *m = LogDump{} } +func (*LogDump) GetMessageName() string { return "log_dump" } +func (*LogDump) GetCrcString() string { return "6ab31753" } +func (*LogDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *LogDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.StartTimestamp + size += 8 + return size +} +func (m *LogDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.StartTimestamp + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.StartTimestamp))) + pos += 8 + return buf, nil +} +func (m *LogDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.StartTimestamp + m.StartTimestamp = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + +// ShowThreads represents VPP binary API message 'show_threads'. +type ShowThreads struct{} + +func (m *ShowThreads) Reset() { *m = ShowThreads{} } +func (*ShowThreads) GetMessageName() string { return "show_threads" } +func (*ShowThreads) GetCrcString() string { return "51077d14" } +func (*ShowThreads) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ShowThreads) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowThreads) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ShowThreads) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// ShowThreadsReply represents VPP binary API message 'show_threads_reply'. +type ShowThreadsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=ThreadData"` + ThreadData []ThreadData `binapi:"thread_data[count],name=thread_data" json:"thread_data,omitempty"` +} + +func (m *ShowThreadsReply) Reset() { *m = ShowThreadsReply{} } +func (*ShowThreadsReply) GetMessageName() string { return "show_threads_reply" } +func (*ShowThreadsReply) GetCrcString() string { return "f5e0b66f" } +func (*ShowThreadsReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ShowThreadsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.Count + size += 4 + // field[1] m.ThreadData + for j1 := 0; j1 < len(m.ThreadData); j1++ { + var s1 ThreadData + _ = s1 + if j1 < len(m.ThreadData) { + s1 = m.ThreadData[j1] + } + // field[2] s1.ID + size += 4 + // field[2] s1.Name + size += 64 + // field[2] s1.Type + size += 64 + // field[2] s1.PID + size += 4 + // field[2] s1.CPUID + size += 4 + // field[2] s1.Core + size += 4 + // field[2] s1.CPUSocket + size += 4 + } + return size +} +func (m *ShowThreadsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.ThreadData))) + pos += 4 + // field[1] m.ThreadData + for j1 := 0; j1 < len(m.ThreadData); j1++ { + var v1 ThreadData + if j1 < len(m.ThreadData) { + v1 = m.ThreadData[j1] + } + // field[2] v1.ID + o.PutUint32(buf[pos:pos+4], uint32(v1.ID)) + pos += 4 + // field[2] v1.Name + for i := 0; i < 64; i++ { + var x uint8 + if i < len(v1.Name) { + x = uint8(v1.Name[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.Type + for i := 0; i < 64; i++ { + var x uint8 + if i < len(v1.Type) { + x = uint8(v1.Type[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.PID + o.PutUint32(buf[pos:pos+4], uint32(v1.PID)) + pos += 4 + // field[2] v1.CPUID + o.PutUint32(buf[pos:pos+4], uint32(v1.CPUID)) + pos += 4 + // field[2] v1.Core + o.PutUint32(buf[pos:pos+4], uint32(v1.Core)) + pos += 4 + // field[2] v1.CPUSocket + o.PutUint32(buf[pos:pos+4], uint32(v1.CPUSocket)) + pos += 4 + } + return buf, nil +} +func (m *ShowThreadsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ThreadData + m.ThreadData = make([]ThreadData, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.ThreadData[j1].ID + m.ThreadData[j1].ID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.ThreadData[j1].Name + m.ThreadData[j1].Name = make([]uint8, 64) + for i := 0; i < len(m.ThreadData[j1].Name); i++ { + m.ThreadData[j1].Name[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.ThreadData[j1].Type + m.ThreadData[j1].Type = make([]uint8, 64) + for i := 0; i < len(m.ThreadData[j1].Type); i++ { + m.ThreadData[j1].Type[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.ThreadData[j1].PID + m.ThreadData[j1].PID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.ThreadData[j1].CPUID + m.ThreadData[j1].CPUID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.ThreadData[j1].Core + m.ThreadData[j1].Core = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.ThreadData[j1].CPUSocket + m.ThreadData[j1].CPUSocket = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + +// ShowVersion represents VPP binary API message 'show_version'. +type ShowVersion struct{} + +func (m *ShowVersion) Reset() { *m = ShowVersion{} } +func (*ShowVersion) GetMessageName() string { return "show_version" } +func (*ShowVersion) GetCrcString() string { return "51077d14" } +func (*ShowVersion) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ShowVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowVersion) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ShowVersion) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// ShowVersionReply represents VPP binary API message 'show_version_reply'. +type ShowVersionReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Program string `binapi:"string[32],name=program" json:"program,omitempty" struc:"[32]byte"` + Version string `binapi:"string[32],name=version" json:"version,omitempty" struc:"[32]byte"` + BuildDate string `binapi:"string[32],name=build_date" json:"build_date,omitempty" struc:"[32]byte"` + BuildDirectory string `binapi:"string[256],name=build_directory" json:"build_directory,omitempty" struc:"[256]byte"` +} + +func (m *ShowVersionReply) Reset() { *m = ShowVersionReply{} } +func (*ShowVersionReply) GetMessageName() string { return "show_version_reply" } +func (*ShowVersionReply) GetCrcString() string { return "c919bde1" } +func (*ShowVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ShowVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.Program + size += 32 + // field[1] m.Version + size += 32 + // field[1] m.BuildDate + size += 32 + // field[1] m.BuildDirectory + size += 256 + return size +} +func (m *ShowVersionReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.Program + copy(buf[pos:pos+32], m.Program) + pos += 32 + // field[1] m.Version + copy(buf[pos:pos+32], m.Version) + pos += 32 + // field[1] m.BuildDate + copy(buf[pos:pos+32], m.BuildDate) + pos += 32 + // field[1] m.BuildDirectory + copy(buf[pos:pos+256], m.BuildDirectory) + pos += 256 + return buf, nil +} +func (m *ShowVersionReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Program + { + nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) + m.Program = codec.DecodeString(tmp[pos : pos+nul]) + pos += 32 + } + // field[1] m.Version + { + nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) + m.Version = codec.DecodeString(tmp[pos : pos+nul]) + pos += 32 + } + // field[1] m.BuildDate + { + nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) + m.BuildDate = codec.DecodeString(tmp[pos : pos+nul]) + pos += 32 + } + // field[1] m.BuildDirectory + { + nul := bytes.Index(tmp[pos:pos+256], []byte{0x00}) + m.BuildDirectory = codec.DecodeString(tmp[pos : pos+nul]) + pos += 256 + } + return nil +} + +// ShowVpeSystemTime represents VPP binary API message 'show_vpe_system_time'. +type ShowVpeSystemTime struct{} + +func (m *ShowVpeSystemTime) Reset() { *m = ShowVpeSystemTime{} } +func (*ShowVpeSystemTime) GetMessageName() string { return "show_vpe_system_time" } +func (*ShowVpeSystemTime) GetCrcString() string { return "51077d14" } +func (*ShowVpeSystemTime) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ShowVpeSystemTime) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowVpeSystemTime) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ShowVpeSystemTime) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// ShowVpeSystemTimeReply represents VPP binary API message 'show_vpe_system_time_reply'. +type ShowVpeSystemTimeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + VpeSystemTime Timestamp `binapi:"timestamp,name=vpe_system_time" json:"vpe_system_time,omitempty"` +} + +func (m *ShowVpeSystemTimeReply) Reset() { *m = ShowVpeSystemTimeReply{} } +func (*ShowVpeSystemTimeReply) GetMessageName() string { return "show_vpe_system_time_reply" } +func (*ShowVpeSystemTimeReply) GetCrcString() string { return "7ffd8193" } +func (*ShowVpeSystemTimeReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ShowVpeSystemTimeReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.VpeSystemTime + size += 8 + return size +} +func (m *ShowVpeSystemTimeReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.VpeSystemTime + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.VpeSystemTime))) + pos += 8 + return buf, nil +} +func (m *ShowVpeSystemTimeReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VpeSystemTime + m.VpeSystemTime = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + +func init() { file_vpe_binapi_init() } +func file_vpe_binapi_init() { + api.RegisterMessage((*AddNodeNext)(nil), "vpe.AddNodeNext") + api.RegisterMessage((*AddNodeNextReply)(nil), "vpe.AddNodeNextReply") + api.RegisterMessage((*Cli)(nil), "vpe.Cli") + api.RegisterMessage((*CliInband)(nil), "vpe.CliInband") + api.RegisterMessage((*CliInbandReply)(nil), "vpe.CliInbandReply") + api.RegisterMessage((*CliReply)(nil), "vpe.CliReply") + api.RegisterMessage((*ControlPing)(nil), "vpe.ControlPing") + api.RegisterMessage((*ControlPingReply)(nil), "vpe.ControlPingReply") + api.RegisterMessage((*GetF64EndianValue)(nil), "vpe.GetF64EndianValue") + api.RegisterMessage((*GetF64EndianValueReply)(nil), "vpe.GetF64EndianValueReply") + api.RegisterMessage((*GetF64IncrementByOne)(nil), "vpe.GetF64IncrementByOne") + api.RegisterMessage((*GetF64IncrementByOneReply)(nil), "vpe.GetF64IncrementByOneReply") + api.RegisterMessage((*GetNextIndex)(nil), "vpe.GetNextIndex") + api.RegisterMessage((*GetNextIndexReply)(nil), "vpe.GetNextIndexReply") + api.RegisterMessage((*GetNodeGraph)(nil), "vpe.GetNodeGraph") + api.RegisterMessage((*GetNodeGraphReply)(nil), "vpe.GetNodeGraphReply") + api.RegisterMessage((*GetNodeIndex)(nil), "vpe.GetNodeIndex") + api.RegisterMessage((*GetNodeIndexReply)(nil), "vpe.GetNodeIndexReply") + api.RegisterMessage((*LogDetails)(nil), "vpe.LogDetails") + api.RegisterMessage((*LogDump)(nil), "vpe.LogDump") + api.RegisterMessage((*ShowThreads)(nil), "vpe.ShowThreads") + api.RegisterMessage((*ShowThreadsReply)(nil), "vpe.ShowThreadsReply") + api.RegisterMessage((*ShowVersion)(nil), "vpe.ShowVersion") + api.RegisterMessage((*ShowVersionReply)(nil), "vpe.ShowVersionReply") + api.RegisterMessage((*ShowVpeSystemTime)(nil), "vpe.ShowVpeSystemTime") + api.RegisterMessage((*ShowVpeSystemTimeReply)(nil), "vpe.ShowVpeSystemTimeReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AddNodeNext)(nil), + (*AddNodeNextReply)(nil), + (*Cli)(nil), + (*CliInband)(nil), + (*CliInbandReply)(nil), + (*CliReply)(nil), + (*ControlPing)(nil), + (*ControlPingReply)(nil), + (*GetF64EndianValue)(nil), + (*GetF64EndianValueReply)(nil), + (*GetF64IncrementByOne)(nil), + (*GetF64IncrementByOneReply)(nil), + (*GetNextIndex)(nil), + (*GetNextIndexReply)(nil), + (*GetNodeGraph)(nil), + (*GetNodeGraphReply)(nil), + (*GetNodeIndex)(nil), + (*GetNodeIndexReply)(nil), + (*LogDetails)(nil), + (*LogDump)(nil), + (*ShowThreads)(nil), + (*ShowThreadsReply)(nil), + (*ShowVersion)(nil), + (*ShowVersionReply)(nil), + (*ShowVpeSystemTime)(nil), + (*ShowVpeSystemTimeReply)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/vpe/vpe_rpc.ba.go b/codec/testdata/binapi2001/vpe/vpe_rpc.ba.go new file mode 100644 index 0000000..e81fb91 --- /dev/null +++ b/codec/testdata/binapi2001/vpe/vpe_rpc.ba.go @@ -0,0 +1,174 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vpe + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for vpe module. +type RPCService interface { + DumpLog(ctx context.Context, in *LogDump) (RPCService_DumpLogClient, error) + AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) + Cli(ctx context.Context, in *Cli) (*CliReply, error) + CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) + ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) + GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) + GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) + GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) + GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) + GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) + ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) + ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) + ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpLog(ctx context.Context, in *LogDump) (RPCService_DumpLogClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpLogClient{stream} + return x, nil +} + +type RPCService_DumpLogClient interface { + Recv() (*LogDetails, error) +} + +type serviceClient_DumpLogClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpLogClient) Recv() (*LogDetails, error) { + m := new(LogDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) { + out := new(AddNodeNextReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { + out := new(CliReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { + out := new(CliInbandReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { + out := new(ControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) { + out := new(GetF64EndianValueReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) { + out := new(GetF64IncrementByOneReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { + out := new(GetNextIndexReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { + out := new(GetNodeGraphReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { + out := new(GetNodeIndexReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) { + out := new(ShowThreadsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { + out := new(ShowVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) { + out := new(ShowVpeSystemTimeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/core/connection.go b/core/connection.go index 917f1cb..cfa94ee 100644 --- a/core/connection.go +++ b/core/connection.go @@ -128,7 +128,7 @@ func newConnection(binapi adapter.VppAPI, attempts int, interval time.Duration) vppClient: binapi, maxAttempts: attempts, recInterval: interval, - codec: &codec.MsgCodec{}, + codec: codec.DefaultCodec, msgIDs: make(map[string]uint16), msgMap: make(map[uint16]api.Message), channels: make(map[uint16]*Channel), diff --git a/core/connection_test.go b/core/connection_test.go index e6ef5d5..643d4a3 100644 --- a/core/connection_test.go +++ b/core/connection_test.go @@ -92,7 +92,7 @@ func TestAsyncConnection(t *testing.T) { func TestCodec(t *testing.T) { RegisterTestingT(t) - msgCodec := &codec.MsgCodec{} + var msgCodec = codec.DefaultCodec // request data, err := msgCodec.EncodeMsg(&interfaces.CreateLoopback{MacAddress: interfaces.MacAddress{1, 2, 3, 4, 5, 6}}, 11) @@ -118,7 +118,7 @@ func TestCodec(t *testing.T) { func TestCodecNegative(t *testing.T) { RegisterTestingT(t) - msgCodec := &codec.MsgCodec{} + var msgCodec = codec.DefaultCodec // nil message for encoding data, err := msgCodec.EncodeMsg(nil, 15) @@ -134,7 +134,7 @@ func TestCodecNegative(t *testing.T) { // nil data for decoding err = msgCodec.DecodeMsg(nil, &vpe.ControlPingReply{}) Expect(err).Should(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("EOF")) + Expect(err.Error()).To(ContainSubstring("panic")) } func TestSimpleRequestsWithSequenceNumbers(t *testing.T) { diff --git a/examples/binapi/acl/acl.ba.go b/examples/binapi/acl/acl.ba.go index b42fb5f..604b352 100644 --- a/examples/binapi/acl/acl.ba.go +++ b/examples/binapi/acl/acl.ba.go @@ -1,15 +1,18 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty -// VPP: 20.01-45~g7a071e370~b63 +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release // source: /usr/share/vpp/api/plugins/acl.api.json /* -Package acl contains generated code for VPP binary API defined by acl.api (version 1.0.1). +Package acl contains generated code for VPP API file acl.api (2.0.0). It consists of: + 7 aliases + 11 enums 38 messages - 2 types + 8 types + 1 union */ package acl @@ -24,6 +27,9 @@ import ( api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" + + interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" + ip_types "git.fd.io/govpp.git/examples/binapi/ip_types" ) // This is a compile-time assertion to ensure that this generated file @@ -36,53 +42,127 @@ const ( // ModuleName is the name of this module. ModuleName = "acl" // APIVersion is the API version of this module. - APIVersion = "1.0.1" + APIVersion = "2.0.0" // VersionCrc is the CRC of this module. - VersionCrc = 0x11c5c1e5 + VersionCrc = 0x68c4cb37 +) + +// ACLAction represents VPP binary API enum 'acl_action'. +type ACLAction uint8 + +const ( + ACL_ACTION_API_DENY ACLAction = 0 + ACL_ACTION_API_PERMIT ACLAction = 1 + ACL_ACTION_API_PERMIT_REFLECT ACLAction = 2 +) + +var ( + ACLAction_name = map[uint8]string{ + 0: "ACL_ACTION_API_DENY", + 1: "ACL_ACTION_API_PERMIT", + 2: "ACL_ACTION_API_PERMIT_REFLECT", + } + ACLAction_value = map[string]uint8{ + "ACL_ACTION_API_DENY": 0, + "ACL_ACTION_API_PERMIT": 1, + "ACL_ACTION_API_PERMIT_REFLECT": 2, + } ) +func (x ACLAction) String() string { + s, ok := ACLAction_name[uint8(x)] + if ok { + return s + } + return "ACLAction(" + strconv.Itoa(int(x)) + ")" +} + +type AddressFamily = ip_types.AddressFamily + +type IfStatusFlags = interface_types.IfStatusFlags + +type IfType = interface_types.IfType + +type IPDscp = ip_types.IPDscp + +type IPEcn = ip_types.IPEcn + +type IPProto = ip_types.IPProto + +type LinkDuplex = interface_types.LinkDuplex + +type MtuProto = interface_types.MtuProto + +type RxMode = interface_types.RxMode + +type SubIfFlags = interface_types.SubIfFlags + +type AddressWithPrefix = ip_types.AddressWithPrefix + +type InterfaceIndex = interface_types.InterfaceIndex + +type IP4Address = ip_types.IP4Address + +type IP4AddressWithPrefix = ip_types.IP4AddressWithPrefix + +type IP6Address = ip_types.IP6Address + +type IP6AddressWithPrefix = ip_types.IP6AddressWithPrefix + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 + // ACLRule represents VPP binary API type 'acl_rule'. type ACLRule struct { - IsPermit uint8 `binapi:"u8,name=is_permit" json:"is_permit,omitempty"` - IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` - SrcIPAddr []byte `binapi:"u8[16],name=src_ip_addr" json:"src_ip_addr,omitempty" struc:"[16]byte"` - SrcIPPrefixLen uint8 `binapi:"u8,name=src_ip_prefix_len" json:"src_ip_prefix_len,omitempty"` - DstIPAddr []byte `binapi:"u8[16],name=dst_ip_addr" json:"dst_ip_addr,omitempty" struc:"[16]byte"` - DstIPPrefixLen uint8 `binapi:"u8,name=dst_ip_prefix_len" json:"dst_ip_prefix_len,omitempty"` - Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` - SrcportOrIcmptypeFirst uint16 `binapi:"u16,name=srcport_or_icmptype_first" json:"srcport_or_icmptype_first,omitempty"` - SrcportOrIcmptypeLast uint16 `binapi:"u16,name=srcport_or_icmptype_last" json:"srcport_or_icmptype_last,omitempty"` - DstportOrIcmpcodeFirst uint16 `binapi:"u16,name=dstport_or_icmpcode_first" json:"dstport_or_icmpcode_first,omitempty"` - DstportOrIcmpcodeLast uint16 `binapi:"u16,name=dstport_or_icmpcode_last" json:"dstport_or_icmpcode_last,omitempty"` - TCPFlagsMask uint8 `binapi:"u8,name=tcp_flags_mask" json:"tcp_flags_mask,omitempty"` - TCPFlagsValue uint8 `binapi:"u8,name=tcp_flags_value" json:"tcp_flags_value,omitempty"` + IsPermit ACLAction `binapi:"acl_action,name=is_permit" json:"is_permit,omitempty"` + SrcPrefix Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` + DstPrefix Prefix `binapi:"prefix,name=dst_prefix" json:"dst_prefix,omitempty"` + Proto IPProto `binapi:"ip_proto,name=proto" json:"proto,omitempty"` + SrcportOrIcmptypeFirst uint16 `binapi:"u16,name=srcport_or_icmptype_first" json:"srcport_or_icmptype_first,omitempty"` + SrcportOrIcmptypeLast uint16 `binapi:"u16,name=srcport_or_icmptype_last" json:"srcport_or_icmptype_last,omitempty"` + DstportOrIcmpcodeFirst uint16 `binapi:"u16,name=dstport_or_icmpcode_first" json:"dstport_or_icmpcode_first,omitempty"` + DstportOrIcmpcodeLast uint16 `binapi:"u16,name=dstport_or_icmpcode_last" json:"dstport_or_icmpcode_last,omitempty"` + TCPFlagsMask uint8 `binapi:"u8,name=tcp_flags_mask" json:"tcp_flags_mask,omitempty"` + TCPFlagsValue uint8 `binapi:"u8,name=tcp_flags_value" json:"tcp_flags_value,omitempty"` } func (*ACLRule) GetTypeName() string { return "acl_rule" } +type Address = ip_types.Address + +type IP4Prefix = ip_types.IP4Prefix + +type IP6Prefix = ip_types.IP6Prefix + // MacipACLRule represents VPP binary API type 'macip_acl_rule'. type MacipACLRule struct { - IsPermit uint8 `binapi:"u8,name=is_permit" json:"is_permit,omitempty"` - IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` - SrcMac []byte `binapi:"u8[6],name=src_mac" json:"src_mac,omitempty" struc:"[6]byte"` - SrcMacMask []byte `binapi:"u8[6],name=src_mac_mask" json:"src_mac_mask,omitempty" struc:"[6]byte"` - SrcIPAddr []byte `binapi:"u8[16],name=src_ip_addr" json:"src_ip_addr,omitempty" struc:"[16]byte"` - SrcIPPrefixLen uint8 `binapi:"u8,name=src_ip_prefix_len" json:"src_ip_prefix_len,omitempty"` + IsPermit ACLAction `binapi:"acl_action,name=is_permit" json:"is_permit,omitempty"` + SrcMac MacAddress `binapi:"mac_address,name=src_mac" json:"src_mac,omitempty"` + SrcMacMask MacAddress `binapi:"mac_address,name=src_mac_mask" json:"src_mac_mask,omitempty"` + SrcPrefix Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` } func (*MacipACLRule) GetTypeName() string { return "macip_acl_rule" } +type Mprefix = ip_types.Mprefix + +type Prefix = ip_types.Prefix + +type PrefixMatcher = ip_types.PrefixMatcher + +type AddressUnion = ip_types.AddressUnion + // ACLAddReplace represents VPP binary API message 'acl_add_replace'. type ACLAddReplace struct { ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` R []ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` } func (m *ACLAddReplace) Reset() { *m = ACLAddReplace{} } func (*ACLAddReplace) GetMessageName() string { return "acl_add_replace" } -func (*ACLAddReplace) GetCrcString() string { return "13bc8539" } +func (*ACLAddReplace) GetCrcString() string { return "1cabdeab" } func (*ACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } func (m *ACLAddReplace) Size() int { @@ -105,15 +185,21 @@ func (m *ACLAddReplace) Size() int { } // field[2] s1.IsPermit size += 1 - // field[2] s1.IsIPv6 + // field[2] s1.SrcPrefix + // field[3] s1.SrcPrefix.Address + // field[4] s1.SrcPrefix.Address.Af size += 1 - // field[2] s1.SrcIPAddr + // field[4] s1.SrcPrefix.Address.Un size += 16 - // field[2] s1.SrcIPPrefixLen + // field[3] s1.SrcPrefix.Len + size += 1 + // field[2] s1.DstPrefix + // field[3] s1.DstPrefix.Address + // field[4] s1.DstPrefix.Address.Af size += 1 - // field[2] s1.DstIPAddr + // field[4] s1.DstPrefix.Address.Un size += 16 - // field[2] s1.DstIPPrefixLen + // field[3] s1.DstPrefix.Len size += 1 // field[2] s1.Proto size += 1 @@ -147,14 +233,8 @@ func (m *ACLAddReplace) Marshal(b []byte) ([]byte, error) { o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) pos += 4 // field[1] m.Tag - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.Tag) { - x = uint8(m.Tag[i]) - } - buf[pos] = uint8(x) - pos += 1 - } + copy(buf[pos:pos+64], m.Tag) + pos += 64 // field[1] m.Count o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) pos += 4 @@ -167,32 +247,27 @@ func (m *ACLAddReplace) Marshal(b []byte) ([]byte, error) { // field[2] v1.IsPermit buf[pos] = uint8(v1.IsPermit) pos += 1 - // field[2] v1.IsIPv6 - buf[pos] = uint8(v1.IsIPv6) + // field[2] v1.SrcPrefix + // field[3] v1.SrcPrefix.Address + // field[4] v1.SrcPrefix.Address.Af + buf[pos] = uint8(v1.SrcPrefix.Address.Af) pos += 1 - // field[2] v1.SrcIPAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v1.SrcIPAddr) { - x = uint8(v1.SrcIPAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcIPPrefixLen - buf[pos] = uint8(v1.SrcIPPrefixLen) + // field[4] v1.SrcPrefix.Address.Un + copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] v1.SrcPrefix.Len + buf[pos] = uint8(v1.SrcPrefix.Len) pos += 1 - // field[2] v1.DstIPAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v1.DstIPAddr) { - x = uint8(v1.DstIPAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.DstIPPrefixLen - buf[pos] = uint8(v1.DstIPPrefixLen) + // field[2] v1.DstPrefix + // field[3] v1.DstPrefix.Address + // field[4] v1.DstPrefix.Address.Af + buf[pos] = uint8(v1.DstPrefix.Address.Af) + pos += 1 + // field[4] v1.DstPrefix.Address.Un + copy(buf[pos:pos+16], v1.DstPrefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] v1.DstPrefix.Len + buf[pos] = uint8(v1.DstPrefix.Len) pos += 1 // field[2] v1.Proto buf[pos] = uint8(v1.Proto) @@ -227,10 +302,10 @@ func (m *ACLAddReplace) Unmarshal(tmp []byte) error { m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Tag - m.Tag = make([]uint8, 64) - for i := 0; i < len(m.Tag); i++ { - m.Tag[i] = uint8(tmp[pos]) - pos += 1 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } // field[1] m.Count m.Count = uint32(o.Uint32(tmp[pos : pos+4])) @@ -239,31 +314,32 @@ func (m *ACLAddReplace) Unmarshal(tmp []byte) error { m.R = make([]ACLRule, int(m.Count)) for j1 := 0; j1 < int(m.Count); j1++ { // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = uint8(tmp[pos]) + m.R[j1].IsPermit = ACLAction(tmp[pos]) pos += 1 - // field[2] m.R[j1].IsIPv6 - m.R[j1].IsIPv6 = uint8(tmp[pos]) + // field[2] m.R[j1].SrcPrefix + // field[3] m.R[j1].SrcPrefix.Address + // field[4] m.R[j1].SrcPrefix.Address.Af + m.R[j1].SrcPrefix.Address.Af = AddressFamily(tmp[pos]) pos += 1 - // field[2] m.R[j1].SrcIPAddr - m.R[j1].SrcIPAddr = make([]uint8, 16) - for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { - m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcIPPrefixLen - m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + // field[4] m.R[j1].SrcPrefix.Address.Un + copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.R[j1].SrcPrefix.Len + m.R[j1].SrcPrefix.Len = uint8(tmp[pos]) pos += 1 - // field[2] m.R[j1].DstIPAddr - m.R[j1].DstIPAddr = make([]uint8, 16) - for i := 0; i < len(m.R[j1].DstIPAddr); i++ { - m.R[j1].DstIPAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].DstIPPrefixLen - m.R[j1].DstIPPrefixLen = uint8(tmp[pos]) + // field[2] m.R[j1].DstPrefix + // field[3] m.R[j1].DstPrefix.Address + // field[4] m.R[j1].DstPrefix.Address.Af + m.R[j1].DstPrefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 + // field[4] m.R[j1].DstPrefix.Address.Un + copy(m.R[j1].DstPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.R[j1].DstPrefix.Len + m.R[j1].DstPrefix.Len = uint8(tmp[pos]) pos += 1 // field[2] m.R[j1].Proto - m.R[j1].Proto = uint8(tmp[pos]) + m.R[j1].Proto = IPProto(tmp[pos]) pos += 1 // field[2] m.R[j1].SrcportOrIcmptypeFirst m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) @@ -437,14 +513,14 @@ func (m *ACLDelReply) Unmarshal(tmp []byte) error { // ACLDetails represents VPP binary API message 'acl_details'. type ACLDetails struct { ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` R []ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` } func (m *ACLDetails) Reset() { *m = ACLDetails{} } func (*ACLDetails) GetMessageName() string { return "acl_details" } -func (*ACLDetails) GetCrcString() string { return "f89d7a88" } +func (*ACLDetails) GetCrcString() string { return "7a97f21c" } func (*ACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *ACLDetails) Size() int { @@ -467,15 +543,21 @@ func (m *ACLDetails) Size() int { } // field[2] s1.IsPermit size += 1 - // field[2] s1.IsIPv6 + // field[2] s1.SrcPrefix + // field[3] s1.SrcPrefix.Address + // field[4] s1.SrcPrefix.Address.Af size += 1 - // field[2] s1.SrcIPAddr + // field[4] s1.SrcPrefix.Address.Un size += 16 - // field[2] s1.SrcIPPrefixLen + // field[3] s1.SrcPrefix.Len size += 1 - // field[2] s1.DstIPAddr + // field[2] s1.DstPrefix + // field[3] s1.DstPrefix.Address + // field[4] s1.DstPrefix.Address.Af + size += 1 + // field[4] s1.DstPrefix.Address.Un size += 16 - // field[2] s1.DstIPPrefixLen + // field[3] s1.DstPrefix.Len size += 1 // field[2] s1.Proto size += 1 @@ -509,14 +591,8 @@ func (m *ACLDetails) Marshal(b []byte) ([]byte, error) { o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) pos += 4 // field[1] m.Tag - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.Tag) { - x = uint8(m.Tag[i]) - } - buf[pos] = uint8(x) - pos += 1 - } + copy(buf[pos:pos+64], m.Tag) + pos += 64 // field[1] m.Count o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) pos += 4 @@ -529,32 +605,27 @@ func (m *ACLDetails) Marshal(b []byte) ([]byte, error) { // field[2] v1.IsPermit buf[pos] = uint8(v1.IsPermit) pos += 1 - // field[2] v1.IsIPv6 - buf[pos] = uint8(v1.IsIPv6) + // field[2] v1.SrcPrefix + // field[3] v1.SrcPrefix.Address + // field[4] v1.SrcPrefix.Address.Af + buf[pos] = uint8(v1.SrcPrefix.Address.Af) pos += 1 - // field[2] v1.SrcIPAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v1.SrcIPAddr) { - x = uint8(v1.SrcIPAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcIPPrefixLen - buf[pos] = uint8(v1.SrcIPPrefixLen) + // field[4] v1.SrcPrefix.Address.Un + copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] v1.SrcPrefix.Len + buf[pos] = uint8(v1.SrcPrefix.Len) pos += 1 - // field[2] v1.DstIPAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v1.DstIPAddr) { - x = uint8(v1.DstIPAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.DstIPPrefixLen - buf[pos] = uint8(v1.DstIPPrefixLen) + // field[2] v1.DstPrefix + // field[3] v1.DstPrefix.Address + // field[4] v1.DstPrefix.Address.Af + buf[pos] = uint8(v1.DstPrefix.Address.Af) + pos += 1 + // field[4] v1.DstPrefix.Address.Un + copy(buf[pos:pos+16], v1.DstPrefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] v1.DstPrefix.Len + buf[pos] = uint8(v1.DstPrefix.Len) pos += 1 // field[2] v1.Proto buf[pos] = uint8(v1.Proto) @@ -589,10 +660,10 @@ func (m *ACLDetails) Unmarshal(tmp []byte) error { m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Tag - m.Tag = make([]uint8, 64) - for i := 0; i < len(m.Tag); i++ { - m.Tag[i] = uint8(tmp[pos]) - pos += 1 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } // field[1] m.Count m.Count = uint32(o.Uint32(tmp[pos : pos+4])) @@ -601,31 +672,32 @@ func (m *ACLDetails) Unmarshal(tmp []byte) error { m.R = make([]ACLRule, int(m.Count)) for j1 := 0; j1 < int(m.Count); j1++ { // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = uint8(tmp[pos]) + m.R[j1].IsPermit = ACLAction(tmp[pos]) pos += 1 - // field[2] m.R[j1].IsIPv6 - m.R[j1].IsIPv6 = uint8(tmp[pos]) + // field[2] m.R[j1].SrcPrefix + // field[3] m.R[j1].SrcPrefix.Address + // field[4] m.R[j1].SrcPrefix.Address.Af + m.R[j1].SrcPrefix.Address.Af = AddressFamily(tmp[pos]) pos += 1 - // field[2] m.R[j1].SrcIPAddr - m.R[j1].SrcIPAddr = make([]uint8, 16) - for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { - m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcIPPrefixLen - m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + // field[4] m.R[j1].SrcPrefix.Address.Un + copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.R[j1].SrcPrefix.Len + m.R[j1].SrcPrefix.Len = uint8(tmp[pos]) pos += 1 - // field[2] m.R[j1].DstIPAddr - m.R[j1].DstIPAddr = make([]uint8, 16) - for i := 0; i < len(m.R[j1].DstIPAddr); i++ { - m.R[j1].DstIPAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].DstIPPrefixLen - m.R[j1].DstIPPrefixLen = uint8(tmp[pos]) + // field[2] m.R[j1].DstPrefix + // field[3] m.R[j1].DstPrefix.Address + // field[4] m.R[j1].DstPrefix.Address.Af + m.R[j1].DstPrefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 + // field[4] m.R[j1].DstPrefix.Address.Un + copy(m.R[j1].DstPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.R[j1].DstPrefix.Len + m.R[j1].DstPrefix.Len = uint8(tmp[pos]) pos += 1 // field[2] m.R[j1].Proto - m.R[j1].Proto = uint8(tmp[pos]) + m.R[j1].Proto = IPProto(tmp[pos]) pos += 1 // field[2] m.R[j1].SrcportOrIcmptypeFirst m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) @@ -697,15 +769,15 @@ func (m *ACLDump) Unmarshal(tmp []byte) error { // ACLInterfaceAddDel represents VPP binary API message 'acl_interface_add_del'. type ACLInterfaceAddDel struct { - IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` - IsInput uint8 `binapi:"u8,name=is_input" json:"is_input,omitempty"` - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsInput bool `binapi:"bool,name=is_input" json:"is_input,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` } func (m *ACLInterfaceAddDel) Reset() { *m = ACLInterfaceAddDel{} } func (*ACLInterfaceAddDel) GetMessageName() string { return "acl_interface_add_del" } -func (*ACLInterfaceAddDel) GetCrcString() string { return "0b2aedd1" } +func (*ACLInterfaceAddDel) GetCrcString() string { return "4b54bebd" } func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } func (m *ACLInterfaceAddDel) Size() int { @@ -735,10 +807,14 @@ func (m *ACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { buf = b } // field[1] m.IsAdd - buf[pos] = uint8(m.IsAdd) + if m.IsAdd { + buf[pos] = 1 + } pos += 1 // field[1] m.IsInput - buf[pos] = uint8(m.IsInput) + if m.IsInput { + buf[pos] = 1 + } pos += 1 // field[1] m.SwIfIndex o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) @@ -754,13 +830,13 @@ func (m *ACLInterfaceAddDel) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.IsAdd - m.IsAdd = uint8(tmp[pos]) + m.IsAdd = tmp[pos] != 0 pos += 1 // field[1] m.IsInput - m.IsInput = uint8(tmp[pos]) + m.IsInput = tmp[pos] != 0 pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.ACLIndex m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -816,17 +892,17 @@ func (m *ACLInterfaceAddDelReply) Unmarshal(tmp []byte) error { // ACLInterfaceEtypeWhitelistDetails represents VPP binary API message 'acl_interface_etype_whitelist_details'. type ACLInterfaceEtypeWhitelistDetails struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` } func (m *ACLInterfaceEtypeWhitelistDetails) Reset() { *m = ACLInterfaceEtypeWhitelistDetails{} } func (*ACLInterfaceEtypeWhitelistDetails) GetMessageName() string { return "acl_interface_etype_whitelist_details" } -func (*ACLInterfaceEtypeWhitelistDetails) GetCrcString() string { return "6a5d4e81" } +func (*ACLInterfaceEtypeWhitelistDetails) GetCrcString() string { return "cc2bfded" } func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *ACLInterfaceEtypeWhitelistDetails) Size() int { @@ -881,7 +957,7 @@ func (m *ACLInterfaceEtypeWhitelistDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -900,14 +976,14 @@ func (m *ACLInterfaceEtypeWhitelistDetails) Unmarshal(tmp []byte) error { // ACLInterfaceEtypeWhitelistDump represents VPP binary API message 'acl_interface_etype_whitelist_dump'. type ACLInterfaceEtypeWhitelistDump struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *ACLInterfaceEtypeWhitelistDump) Reset() { *m = ACLInterfaceEtypeWhitelistDump{} } func (*ACLInterfaceEtypeWhitelistDump) GetMessageName() string { return "acl_interface_etype_whitelist_dump" } -func (*ACLInterfaceEtypeWhitelistDump) GetCrcString() string { return "529cb13f" } +func (*ACLInterfaceEtypeWhitelistDump) GetCrcString() string { return "f9e6675e" } func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType { return api.RequestMessage } func (m *ACLInterfaceEtypeWhitelistDump) Size() int { @@ -941,22 +1017,22 @@ func (m *ACLInterfaceEtypeWhitelistDump) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } // ACLInterfaceListDetails represents VPP binary API message 'acl_interface_list_details'. type ACLInterfaceListDetails struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` } func (m *ACLInterfaceListDetails) Reset() { *m = ACLInterfaceListDetails{} } func (*ACLInterfaceListDetails) GetMessageName() string { return "acl_interface_list_details" } -func (*ACLInterfaceListDetails) GetCrcString() string { return "d5e80809" } +func (*ACLInterfaceListDetails) GetCrcString() string { return "e695d256" } func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *ACLInterfaceListDetails) Size() int { @@ -1011,7 +1087,7 @@ func (m *ACLInterfaceListDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -1030,12 +1106,12 @@ func (m *ACLInterfaceListDetails) Unmarshal(tmp []byte) error { // ACLInterfaceListDump represents VPP binary API message 'acl_interface_list_dump'. type ACLInterfaceListDump struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` } func (m *ACLInterfaceListDump) Reset() { *m = ACLInterfaceListDump{} } func (*ACLInterfaceListDump) GetMessageName() string { return "acl_interface_list_dump" } -func (*ACLInterfaceListDump) GetCrcString() string { return "529cb13f" } +func (*ACLInterfaceListDump) GetCrcString() string { return "f9e6675e" } func (*ACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } func (m *ACLInterfaceListDump) Size() int { @@ -1069,22 +1145,22 @@ func (m *ACLInterfaceListDump) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } // ACLInterfaceSetACLList represents VPP binary API message 'acl_interface_set_acl_list'. type ACLInterfaceSetACLList struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` } func (m *ACLInterfaceSetACLList) Reset() { *m = ACLInterfaceSetACLList{} } func (*ACLInterfaceSetACLList) GetMessageName() string { return "acl_interface_set_acl_list" } -func (*ACLInterfaceSetACLList) GetCrcString() string { return "8baece38" } +func (*ACLInterfaceSetACLList) GetCrcString() string { return "473982bd" } func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { return api.RequestMessage } func (m *ACLInterfaceSetACLList) Size() int { @@ -1139,7 +1215,7 @@ func (m *ACLInterfaceSetACLList) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -1206,17 +1282,17 @@ func (m *ACLInterfaceSetACLListReply) Unmarshal(tmp []byte) error { // ACLInterfaceSetEtypeWhitelist represents VPP binary API message 'acl_interface_set_etype_whitelist'. type ACLInterfaceSetEtypeWhitelist struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` } func (m *ACLInterfaceSetEtypeWhitelist) Reset() { *m = ACLInterfaceSetEtypeWhitelist{} } func (*ACLInterfaceSetEtypeWhitelist) GetMessageName() string { return "acl_interface_set_etype_whitelist" } -func (*ACLInterfaceSetEtypeWhitelist) GetCrcString() string { return "f515efc5" } +func (*ACLInterfaceSetEtypeWhitelist) GetCrcString() string { return "3f5c2d2d" } func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType { return api.RequestMessage } func (m *ACLInterfaceSetEtypeWhitelist) Size() int { @@ -1271,7 +1347,7 @@ func (m *ACLInterfaceSetEtypeWhitelist) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -1713,14 +1789,14 @@ func (m *ACLStatsIntfCountersEnableReply) Unmarshal(tmp []byte) error { // MacipACLAdd represents VPP binary API message 'macip_acl_add'. type MacipACLAdd struct { - Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` } func (m *MacipACLAdd) Reset() { *m = MacipACLAdd{} } func (*MacipACLAdd) GetMessageName() string { return "macip_acl_add" } -func (*MacipACLAdd) GetCrcString() string { return "0c680ca5" } +func (*MacipACLAdd) GetCrcString() string { return "d648fd0a" } func (*MacipACLAdd) GetMessageType() api.MessageType { return api.RequestMessage } func (m *MacipACLAdd) Size() int { @@ -1741,15 +1817,17 @@ func (m *MacipACLAdd) Size() int { } // field[2] s1.IsPermit size += 1 - // field[2] s1.IsIPv6 - size += 1 // field[2] s1.SrcMac size += 6 // field[2] s1.SrcMacMask size += 6 - // field[2] s1.SrcIPAddr + // field[2] s1.SrcPrefix + // field[3] s1.SrcPrefix.Address + // field[4] s1.SrcPrefix.Address.Af + size += 1 + // field[4] s1.SrcPrefix.Address.Un size += 16 - // field[2] s1.SrcIPPrefixLen + // field[3] s1.SrcPrefix.Len size += 1 } return size @@ -1766,14 +1844,8 @@ func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) { buf = b } // field[1] m.Tag - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.Tag) { - x = uint8(m.Tag[i]) - } - buf[pos] = uint8(x) - pos += 1 - } + copy(buf[pos:pos+64], m.Tag) + pos += 64 // field[1] m.Count o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) pos += 4 @@ -1786,9 +1858,6 @@ func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) { // field[2] v1.IsPermit buf[pos] = uint8(v1.IsPermit) pos += 1 - // field[2] v1.IsIPv6 - buf[pos] = uint8(v1.IsIPv6) - pos += 1 // field[2] v1.SrcMac for i := 0; i < 6; i++ { var x uint8 @@ -1807,17 +1876,16 @@ func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) { buf[pos] = uint8(x) pos += 1 } - // field[2] v1.SrcIPAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v1.SrcIPAddr) { - x = uint8(v1.SrcIPAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcIPPrefixLen - buf[pos] = uint8(v1.SrcIPPrefixLen) + // field[2] v1.SrcPrefix + // field[3] v1.SrcPrefix.Address + // field[4] v1.SrcPrefix.Address.Af + buf[pos] = uint8(v1.SrcPrefix.Address.Af) + pos += 1 + // field[4] v1.SrcPrefix.Address.Un + copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] v1.SrcPrefix.Len + buf[pos] = uint8(v1.SrcPrefix.Len) pos += 1 } return buf, nil @@ -1828,10 +1896,10 @@ func (m *MacipACLAdd) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.Tag - m.Tag = make([]uint8, 64) - for i := 0; i < len(m.Tag); i++ { - m.Tag[i] = uint8(tmp[pos]) - pos += 1 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } // field[1] m.Count m.Count = uint32(o.Uint32(tmp[pos : pos+4])) @@ -1840,31 +1908,28 @@ func (m *MacipACLAdd) Unmarshal(tmp []byte) error { m.R = make([]MacipACLRule, int(m.Count)) for j1 := 0; j1 < int(m.Count); j1++ { // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].IsIPv6 - m.R[j1].IsIPv6 = uint8(tmp[pos]) + m.R[j1].IsPermit = ACLAction(tmp[pos]) pos += 1 // field[2] m.R[j1].SrcMac - m.R[j1].SrcMac = make([]uint8, 6) for i := 0; i < len(m.R[j1].SrcMac); i++ { m.R[j1].SrcMac[i] = uint8(tmp[pos]) pos += 1 } // field[2] m.R[j1].SrcMacMask - m.R[j1].SrcMacMask = make([]uint8, 6) for i := 0; i < len(m.R[j1].SrcMacMask); i++ { m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) pos += 1 } - // field[2] m.R[j1].SrcIPAddr - m.R[j1].SrcIPAddr = make([]uint8, 16) - for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { - m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcIPPrefixLen - m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + // field[2] m.R[j1].SrcPrefix + // field[3] m.R[j1].SrcPrefix.Address + // field[4] m.R[j1].SrcPrefix.Address.Af + m.R[j1].SrcPrefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 + // field[4] m.R[j1].SrcPrefix.Address.Un + copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.R[j1].SrcPrefix.Len + m.R[j1].SrcPrefix.Len = uint8(tmp[pos]) pos += 1 } return nil @@ -1872,15 +1937,15 @@ func (m *MacipACLAdd) Unmarshal(tmp []byte) error { // MacipACLAddReplace represents VPP binary API message 'macip_acl_add_replace'. type MacipACLAddReplace struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + ACLIndex uint32 `binapi:"u32,name=acl_index,default=4.294967295e+09" json:"acl_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` } func (m *MacipACLAddReplace) Reset() { *m = MacipACLAddReplace{} } func (*MacipACLAddReplace) GetMessageName() string { return "macip_acl_add_replace" } -func (*MacipACLAddReplace) GetCrcString() string { return "d3d313e7" } +func (*MacipACLAddReplace) GetCrcString() string { return "e34402a7" } func (*MacipACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } func (m *MacipACLAddReplace) Size() int { @@ -1903,15 +1968,17 @@ func (m *MacipACLAddReplace) Size() int { } // field[2] s1.IsPermit size += 1 - // field[2] s1.IsIPv6 - size += 1 // field[2] s1.SrcMac size += 6 // field[2] s1.SrcMacMask size += 6 - // field[2] s1.SrcIPAddr + // field[2] s1.SrcPrefix + // field[3] s1.SrcPrefix.Address + // field[4] s1.SrcPrefix.Address.Af + size += 1 + // field[4] s1.SrcPrefix.Address.Un size += 16 - // field[2] s1.SrcIPPrefixLen + // field[3] s1.SrcPrefix.Len size += 1 } return size @@ -1931,14 +1998,8 @@ func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) { o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) pos += 4 // field[1] m.Tag - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.Tag) { - x = uint8(m.Tag[i]) - } - buf[pos] = uint8(x) - pos += 1 - } + copy(buf[pos:pos+64], m.Tag) + pos += 64 // field[1] m.Count o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) pos += 4 @@ -1951,9 +2012,6 @@ func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) { // field[2] v1.IsPermit buf[pos] = uint8(v1.IsPermit) pos += 1 - // field[2] v1.IsIPv6 - buf[pos] = uint8(v1.IsIPv6) - pos += 1 // field[2] v1.SrcMac for i := 0; i < 6; i++ { var x uint8 @@ -1972,17 +2030,16 @@ func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) { buf[pos] = uint8(x) pos += 1 } - // field[2] v1.SrcIPAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v1.SrcIPAddr) { - x = uint8(v1.SrcIPAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcIPPrefixLen - buf[pos] = uint8(v1.SrcIPPrefixLen) + // field[2] v1.SrcPrefix + // field[3] v1.SrcPrefix.Address + // field[4] v1.SrcPrefix.Address.Af + buf[pos] = uint8(v1.SrcPrefix.Address.Af) + pos += 1 + // field[4] v1.SrcPrefix.Address.Un + copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] v1.SrcPrefix.Len + buf[pos] = uint8(v1.SrcPrefix.Len) pos += 1 } return buf, nil @@ -1996,10 +2053,10 @@ func (m *MacipACLAddReplace) Unmarshal(tmp []byte) error { m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Tag - m.Tag = make([]uint8, 64) - for i := 0; i < len(m.Tag); i++ { - m.Tag[i] = uint8(tmp[pos]) - pos += 1 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } // field[1] m.Count m.Count = uint32(o.Uint32(tmp[pos : pos+4])) @@ -2008,31 +2065,28 @@ func (m *MacipACLAddReplace) Unmarshal(tmp []byte) error { m.R = make([]MacipACLRule, int(m.Count)) for j1 := 0; j1 < int(m.Count); j1++ { // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].IsIPv6 - m.R[j1].IsIPv6 = uint8(tmp[pos]) + m.R[j1].IsPermit = ACLAction(tmp[pos]) pos += 1 // field[2] m.R[j1].SrcMac - m.R[j1].SrcMac = make([]uint8, 6) for i := 0; i < len(m.R[j1].SrcMac); i++ { m.R[j1].SrcMac[i] = uint8(tmp[pos]) pos += 1 } // field[2] m.R[j1].SrcMacMask - m.R[j1].SrcMacMask = make([]uint8, 6) for i := 0; i < len(m.R[j1].SrcMacMask); i++ { m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) pos += 1 } - // field[2] m.R[j1].SrcIPAddr - m.R[j1].SrcIPAddr = make([]uint8, 16) - for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { - m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcIPPrefixLen - m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + // field[2] m.R[j1].SrcPrefix + // field[3] m.R[j1].SrcPrefix.Address + // field[4] m.R[j1].SrcPrefix.Address.Af + m.R[j1].SrcPrefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 + // field[4] m.R[j1].SrcPrefix.Address.Un + copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.R[j1].SrcPrefix.Len + m.R[j1].SrcPrefix.Len = uint8(tmp[pos]) pos += 1 } return nil @@ -2243,14 +2297,14 @@ func (m *MacipACLDelReply) Unmarshal(tmp []byte) error { // MacipACLDetails represents VPP binary API message 'macip_acl_details'. type MacipACLDetails struct { ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` } func (m *MacipACLDetails) Reset() { *m = MacipACLDetails{} } func (*MacipACLDetails) GetMessageName() string { return "macip_acl_details" } -func (*MacipACLDetails) GetCrcString() string { return "e164e69a" } +func (*MacipACLDetails) GetCrcString() string { return "57c7482f" } func (*MacipACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *MacipACLDetails) Size() int { @@ -2273,15 +2327,17 @@ func (m *MacipACLDetails) Size() int { } // field[2] s1.IsPermit size += 1 - // field[2] s1.IsIPv6 - size += 1 // field[2] s1.SrcMac size += 6 // field[2] s1.SrcMacMask size += 6 - // field[2] s1.SrcIPAddr + // field[2] s1.SrcPrefix + // field[3] s1.SrcPrefix.Address + // field[4] s1.SrcPrefix.Address.Af + size += 1 + // field[4] s1.SrcPrefix.Address.Un size += 16 - // field[2] s1.SrcIPPrefixLen + // field[3] s1.SrcPrefix.Len size += 1 } return size @@ -2301,14 +2357,8 @@ func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) { o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) pos += 4 // field[1] m.Tag - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.Tag) { - x = uint8(m.Tag[i]) - } - buf[pos] = uint8(x) - pos += 1 - } + copy(buf[pos:pos+64], m.Tag) + pos += 64 // field[1] m.Count o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) pos += 4 @@ -2321,9 +2371,6 @@ func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) { // field[2] v1.IsPermit buf[pos] = uint8(v1.IsPermit) pos += 1 - // field[2] v1.IsIPv6 - buf[pos] = uint8(v1.IsIPv6) - pos += 1 // field[2] v1.SrcMac for i := 0; i < 6; i++ { var x uint8 @@ -2342,17 +2389,16 @@ func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) { buf[pos] = uint8(x) pos += 1 } - // field[2] v1.SrcIPAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v1.SrcIPAddr) { - x = uint8(v1.SrcIPAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcIPPrefixLen - buf[pos] = uint8(v1.SrcIPPrefixLen) + // field[2] v1.SrcPrefix + // field[3] v1.SrcPrefix.Address + // field[4] v1.SrcPrefix.Address.Af + buf[pos] = uint8(v1.SrcPrefix.Address.Af) + pos += 1 + // field[4] v1.SrcPrefix.Address.Un + copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] v1.SrcPrefix.Len + buf[pos] = uint8(v1.SrcPrefix.Len) pos += 1 } return buf, nil @@ -2366,10 +2412,10 @@ func (m *MacipACLDetails) Unmarshal(tmp []byte) error { m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Tag - m.Tag = make([]uint8, 64) - for i := 0; i < len(m.Tag); i++ { - m.Tag[i] = uint8(tmp[pos]) - pos += 1 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } // field[1] m.Count m.Count = uint32(o.Uint32(tmp[pos : pos+4])) @@ -2378,31 +2424,28 @@ func (m *MacipACLDetails) Unmarshal(tmp []byte) error { m.R = make([]MacipACLRule, int(m.Count)) for j1 := 0; j1 < int(m.Count); j1++ { // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].IsIPv6 - m.R[j1].IsIPv6 = uint8(tmp[pos]) + m.R[j1].IsPermit = ACLAction(tmp[pos]) pos += 1 // field[2] m.R[j1].SrcMac - m.R[j1].SrcMac = make([]uint8, 6) for i := 0; i < len(m.R[j1].SrcMac); i++ { m.R[j1].SrcMac[i] = uint8(tmp[pos]) pos += 1 } // field[2] m.R[j1].SrcMacMask - m.R[j1].SrcMacMask = make([]uint8, 6) for i := 0; i < len(m.R[j1].SrcMacMask); i++ { m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) pos += 1 } - // field[2] m.R[j1].SrcIPAddr - m.R[j1].SrcIPAddr = make([]uint8, 16) - for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { - m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcIPPrefixLen - m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + // field[2] m.R[j1].SrcPrefix + // field[3] m.R[j1].SrcPrefix.Address + // field[4] m.R[j1].SrcPrefix.Address.Af + m.R[j1].SrcPrefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 + // field[4] m.R[j1].SrcPrefix.Address.Un + copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.R[j1].SrcPrefix.Len + m.R[j1].SrcPrefix.Len = uint8(tmp[pos]) pos += 1 } return nil @@ -2410,7 +2453,7 @@ func (m *MacipACLDetails) Unmarshal(tmp []byte) error { // MacipACLDump represents VPP binary API message 'macip_acl_dump'. type MacipACLDump struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index,default=4.294967295e+09" json:"acl_index,omitempty"` } func (m *MacipACLDump) Reset() { *m = MacipACLDump{} } @@ -2456,14 +2499,14 @@ func (m *MacipACLDump) Unmarshal(tmp []byte) error { // MacipACLInterfaceAddDel represents VPP binary API message 'macip_acl_interface_add_del'. type MacipACLInterfaceAddDel struct { - IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` } func (m *MacipACLInterfaceAddDel) Reset() { *m = MacipACLInterfaceAddDel{} } func (*MacipACLInterfaceAddDel) GetMessageName() string { return "macip_acl_interface_add_del" } -func (*MacipACLInterfaceAddDel) GetCrcString() string { return "6a6be97c" } +func (*MacipACLInterfaceAddDel) GetCrcString() string { return "4b8690b1" } func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } func (m *MacipACLInterfaceAddDel) Size() int { @@ -2491,7 +2534,9 @@ func (m *MacipACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { buf = b } // field[1] m.IsAdd - buf[pos] = uint8(m.IsAdd) + if m.IsAdd { + buf[pos] = 1 + } pos += 1 // field[1] m.SwIfIndex o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) @@ -2507,10 +2552,10 @@ func (m *MacipACLInterfaceAddDel) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.IsAdd - m.IsAdd = uint8(tmp[pos]) + m.IsAdd = tmp[pos] != 0 pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.ACLIndex m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -2668,16 +2713,16 @@ func (m *MacipACLInterfaceGetReply) Unmarshal(tmp []byte) error { // MacipACLInterfaceListDetails represents VPP binary API message 'macip_acl_interface_list_details'. type MacipACLInterfaceListDetails struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` - Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` } func (m *MacipACLInterfaceListDetails) Reset() { *m = MacipACLInterfaceListDetails{} } func (*MacipACLInterfaceListDetails) GetMessageName() string { return "macip_acl_interface_list_details" } -func (*MacipACLInterfaceListDetails) GetCrcString() string { return "29783fa0" } +func (*MacipACLInterfaceListDetails) GetCrcString() string { return "a0c5d56d" } func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *MacipACLInterfaceListDetails) Size() int { @@ -2727,7 +2772,7 @@ func (m *MacipACLInterfaceListDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -2743,12 +2788,12 @@ func (m *MacipACLInterfaceListDetails) Unmarshal(tmp []byte) error { // MacipACLInterfaceListDump represents VPP binary API message 'macip_acl_interface_list_dump'. type MacipACLInterfaceListDump struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *MacipACLInterfaceListDump) Reset() { *m = MacipACLInterfaceListDump{} } func (*MacipACLInterfaceListDump) GetMessageName() string { return "macip_acl_interface_list_dump" } -func (*MacipACLInterfaceListDump) GetCrcString() string { return "529cb13f" } +func (*MacipACLInterfaceListDump) GetCrcString() string { return "f9e6675e" } func (*MacipACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } func (m *MacipACLInterfaceListDump) Size() int { @@ -2782,7 +2827,7 @@ func (m *MacipACLInterfaceListDump) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } diff --git a/examples/binapi/af_packet/af_packet.ba.go b/examples/binapi/af_packet/af_packet.ba.go index ab57c62..d2cc52b 100644 --- a/examples/binapi/af_packet/af_packet.ba.go +++ b/examples/binapi/af_packet/af_packet.ba.go @@ -1,11 +1,11 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty -// VPP: 20.01-45~g7a071e370~b63 +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release // source: /usr/share/vpp/api/core/af_packet.api.json /* -Package af_packet contains generated code for VPP binary API defined by af_packet.api (version 2.0.0). +Package af_packet contains generated code for VPP API file af_packet.api (2.0.0). It consists of: 2 aliases @@ -25,6 +25,8 @@ import ( api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" + + interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" ) // This is a compile-time assertion to ensure that this generated file @@ -39,224 +41,22 @@ const ( // APIVersion is the API version of this module. APIVersion = "2.0.0" // VersionCrc is the CRC of this module. - VersionCrc = 0xba745e20 -) - -// IfStatusFlags represents VPP binary API enum 'if_status_flags'. -type IfStatusFlags uint32 - -const ( - IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 - IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 + VersionCrc = 0xe0b6c022 ) -var ( - IfStatusFlags_name = map[uint32]string{ - 1: "IF_STATUS_API_FLAG_ADMIN_UP", - 2: "IF_STATUS_API_FLAG_LINK_UP", - } - IfStatusFlags_value = map[string]uint32{ - "IF_STATUS_API_FLAG_ADMIN_UP": 1, - "IF_STATUS_API_FLAG_LINK_UP": 2, - } -) +type IfStatusFlags = interface_types.IfStatusFlags -func (x IfStatusFlags) String() string { - s, ok := IfStatusFlags_name[uint32(x)] - if ok { - return s - } - return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" -} +type IfType = interface_types.IfType -// IfType represents VPP binary API enum 'if_type'. -type IfType uint32 +type LinkDuplex = interface_types.LinkDuplex -const ( - IF_API_TYPE_HARDWARE IfType = 1 - IF_API_TYPE_SUB IfType = 2 - IF_API_TYPE_P2P IfType = 3 - IF_API_TYPE_PIPE IfType = 4 -) +type MtuProto = interface_types.MtuProto -var ( - IfType_name = map[uint32]string{ - 1: "IF_API_TYPE_HARDWARE", - 2: "IF_API_TYPE_SUB", - 3: "IF_API_TYPE_P2P", - 4: "IF_API_TYPE_PIPE", - } - IfType_value = map[string]uint32{ - "IF_API_TYPE_HARDWARE": 1, - "IF_API_TYPE_SUB": 2, - "IF_API_TYPE_P2P": 3, - "IF_API_TYPE_PIPE": 4, - } -) +type RxMode = interface_types.RxMode -func (x IfType) String() string { - s, ok := IfType_name[uint32(x)] - if ok { - return s - } - return "IfType(" + strconv.Itoa(int(x)) + ")" -} - -// LinkDuplex represents VPP binary API enum 'link_duplex'. -type LinkDuplex uint32 - -const ( - LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 - LINK_DUPLEX_API_HALF LinkDuplex = 1 - LINK_DUPLEX_API_FULL LinkDuplex = 2 -) - -var ( - LinkDuplex_name = map[uint32]string{ - 0: "LINK_DUPLEX_API_UNKNOWN", - 1: "LINK_DUPLEX_API_HALF", - 2: "LINK_DUPLEX_API_FULL", - } - LinkDuplex_value = map[string]uint32{ - "LINK_DUPLEX_API_UNKNOWN": 0, - "LINK_DUPLEX_API_HALF": 1, - "LINK_DUPLEX_API_FULL": 2, - } -) - -func (x LinkDuplex) String() string { - s, ok := LinkDuplex_name[uint32(x)] - if ok { - return s - } - return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" -} - -// MtuProto represents VPP binary API enum 'mtu_proto'. -type MtuProto uint32 - -const ( - MTU_PROTO_API_L3 MtuProto = 1 - MTU_PROTO_API_IP4 MtuProto = 2 - MTU_PROTO_API_IP6 MtuProto = 3 - MTU_PROTO_API_MPLS MtuProto = 4 - MTU_PROTO_API_N MtuProto = 5 -) - -var ( - MtuProto_name = map[uint32]string{ - 1: "MTU_PROTO_API_L3", - 2: "MTU_PROTO_API_IP4", - 3: "MTU_PROTO_API_IP6", - 4: "MTU_PROTO_API_MPLS", - 5: "MTU_PROTO_API_N", - } - MtuProto_value = map[string]uint32{ - "MTU_PROTO_API_L3": 1, - "MTU_PROTO_API_IP4": 2, - "MTU_PROTO_API_IP6": 3, - "MTU_PROTO_API_MPLS": 4, - "MTU_PROTO_API_N": 5, - } -) - -func (x MtuProto) String() string { - s, ok := MtuProto_name[uint32(x)] - if ok { - return s - } - return "MtuProto(" + strconv.Itoa(int(x)) + ")" -} - -// RxMode represents VPP binary API enum 'rx_mode'. -type RxMode uint32 - -const ( - RX_MODE_API_UNKNOWN RxMode = 0 - RX_MODE_API_POLLING RxMode = 1 - RX_MODE_API_INTERRUPT RxMode = 2 - RX_MODE_API_ADAPTIVE RxMode = 3 - RX_MODE_API_DEFAULT RxMode = 4 -) - -var ( - RxMode_name = map[uint32]string{ - 0: "RX_MODE_API_UNKNOWN", - 1: "RX_MODE_API_POLLING", - 2: "RX_MODE_API_INTERRUPT", - 3: "RX_MODE_API_ADAPTIVE", - 4: "RX_MODE_API_DEFAULT", - } - RxMode_value = map[string]uint32{ - "RX_MODE_API_UNKNOWN": 0, - "RX_MODE_API_POLLING": 1, - "RX_MODE_API_INTERRUPT": 2, - "RX_MODE_API_ADAPTIVE": 3, - "RX_MODE_API_DEFAULT": 4, - } -) - -func (x RxMode) String() string { - s, ok := RxMode_name[uint32(x)] - if ok { - return s - } - return "RxMode(" + strconv.Itoa(int(x)) + ")" -} - -// SubIfFlags represents VPP binary API enum 'sub_if_flags'. -type SubIfFlags uint32 - -const ( - SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 - SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 - SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 - SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 - SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 - SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 - SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 - SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 - SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 - SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 -) - -var ( - SubIfFlags_name = map[uint32]string{ - 1: "SUB_IF_API_FLAG_NO_TAGS", - 2: "SUB_IF_API_FLAG_ONE_TAG", - 4: "SUB_IF_API_FLAG_TWO_TAGS", - 8: "SUB_IF_API_FLAG_DOT1AD", - 16: "SUB_IF_API_FLAG_EXACT_MATCH", - 32: "SUB_IF_API_FLAG_DEFAULT", - 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", - 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", - 254: "SUB_IF_API_FLAG_MASK_VNET", - 256: "SUB_IF_API_FLAG_DOT1AH", - } - SubIfFlags_value = map[string]uint32{ - "SUB_IF_API_FLAG_NO_TAGS": 1, - "SUB_IF_API_FLAG_ONE_TAG": 2, - "SUB_IF_API_FLAG_TWO_TAGS": 4, - "SUB_IF_API_FLAG_DOT1AD": 8, - "SUB_IF_API_FLAG_EXACT_MATCH": 16, - "SUB_IF_API_FLAG_DEFAULT": 32, - "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, - "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, - "SUB_IF_API_FLAG_MASK_VNET": 254, - "SUB_IF_API_FLAG_DOT1AH": 256, - } -) - -func (x SubIfFlags) String() string { - s, ok := SubIfFlags_name[uint32(x)] - if ok { - return s - } - return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" -} +type SubIfFlags = interface_types.SubIfFlags -// InterfaceIndex represents VPP binary API alias 'interface_index'. -type InterfaceIndex uint32 +type InterfaceIndex = interface_types.InterfaceIndex // MacAddress represents VPP binary API alias 'mac_address'. type MacAddress [6]uint8 diff --git a/examples/binapi/fib_types/fib_types.ba.go b/examples/binapi/fib_types/fib_types.ba.go index dd725b6..1d824e5 100644 --- a/examples/binapi/fib_types/fib_types.ba.go +++ b/examples/binapi/fib_types/fib_types.ba.go @@ -1,11 +1,11 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty -// VPP: 20.01-45~g7a071e370~b63 +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release // source: /usr/share/vpp/api/core/fib_types.api.json /* -Package fib_types contains generated code for VPP binary API defined by fib_types.api (version 2.0.0). +Package fib_types contains generated code for VPP API file fib_types.api (2.0.0). It consists of: 5 aliases @@ -26,6 +26,8 @@ import ( api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" + + ip_types "git.fd.io/govpp.git/examples/binapi/ip_types" ) // This is a compile-time assertion to ensure that this generated file @@ -40,35 +42,10 @@ const ( // APIVersion is the API version of this module. APIVersion = "2.0.0" // VersionCrc is the CRC of this module. - VersionCrc = 0x57387845 -) - -// AddressFamily represents VPP binary API enum 'address_family'. -type AddressFamily uint32 - -const ( - ADDRESS_IP4 AddressFamily = 0 - ADDRESS_IP6 AddressFamily = 1 -) - -var ( - AddressFamily_name = map[uint32]string{ - 0: "ADDRESS_IP4", - 1: "ADDRESS_IP6", - } - AddressFamily_value = map[string]uint32{ - "ADDRESS_IP4": 0, - "ADDRESS_IP6": 1, - } + VersionCrc = 0xd6a5938 ) -func (x AddressFamily) String() string { - s, ok := AddressFamily_name[uint32(x)] - if ok { - return s - } - return "AddressFamily(" + strconv.Itoa(int(x)) + ")" -} +type AddressFamily = ip_types.AddressFamily // FibPathFlags represents VPP binary API enum 'fib_path_flags'. type FibPathFlags uint32 @@ -193,202 +170,23 @@ func (x FibPathType) String() string { return "FibPathType(" + strconv.Itoa(int(x)) + ")" } -// IPDscp represents VPP binary API enum 'ip_dscp'. -type IPDscp uint8 +type IPDscp = ip_types.IPDscp -const ( - IP_API_DSCP_CS0 IPDscp = 0 - IP_API_DSCP_CS1 IPDscp = 8 - IP_API_DSCP_AF11 IPDscp = 10 - IP_API_DSCP_AF12 IPDscp = 12 - IP_API_DSCP_AF13 IPDscp = 14 - IP_API_DSCP_CS2 IPDscp = 16 - IP_API_DSCP_AF21 IPDscp = 18 - IP_API_DSCP_AF22 IPDscp = 20 - IP_API_DSCP_AF23 IPDscp = 22 - IP_API_DSCP_CS3 IPDscp = 24 - IP_API_DSCP_AF31 IPDscp = 26 - IP_API_DSCP_AF32 IPDscp = 28 - IP_API_DSCP_AF33 IPDscp = 30 - IP_API_DSCP_CS4 IPDscp = 32 - IP_API_DSCP_AF41 IPDscp = 34 - IP_API_DSCP_AF42 IPDscp = 36 - IP_API_DSCP_AF43 IPDscp = 38 - IP_API_DSCP_CS5 IPDscp = 40 - IP_API_DSCP_EF IPDscp = 46 - IP_API_DSCP_CS6 IPDscp = 48 - IP_API_DSCP_CS7 IPDscp = 50 -) +type IPEcn = ip_types.IPEcn -var ( - IPDscp_name = map[uint8]string{ - 0: "IP_API_DSCP_CS0", - 8: "IP_API_DSCP_CS1", - 10: "IP_API_DSCP_AF11", - 12: "IP_API_DSCP_AF12", - 14: "IP_API_DSCP_AF13", - 16: "IP_API_DSCP_CS2", - 18: "IP_API_DSCP_AF21", - 20: "IP_API_DSCP_AF22", - 22: "IP_API_DSCP_AF23", - 24: "IP_API_DSCP_CS3", - 26: "IP_API_DSCP_AF31", - 28: "IP_API_DSCP_AF32", - 30: "IP_API_DSCP_AF33", - 32: "IP_API_DSCP_CS4", - 34: "IP_API_DSCP_AF41", - 36: "IP_API_DSCP_AF42", - 38: "IP_API_DSCP_AF43", - 40: "IP_API_DSCP_CS5", - 46: "IP_API_DSCP_EF", - 48: "IP_API_DSCP_CS6", - 50: "IP_API_DSCP_CS7", - } - IPDscp_value = map[string]uint8{ - "IP_API_DSCP_CS0": 0, - "IP_API_DSCP_CS1": 8, - "IP_API_DSCP_AF11": 10, - "IP_API_DSCP_AF12": 12, - "IP_API_DSCP_AF13": 14, - "IP_API_DSCP_CS2": 16, - "IP_API_DSCP_AF21": 18, - "IP_API_DSCP_AF22": 20, - "IP_API_DSCP_AF23": 22, - "IP_API_DSCP_CS3": 24, - "IP_API_DSCP_AF31": 26, - "IP_API_DSCP_AF32": 28, - "IP_API_DSCP_AF33": 30, - "IP_API_DSCP_CS4": 32, - "IP_API_DSCP_AF41": 34, - "IP_API_DSCP_AF42": 36, - "IP_API_DSCP_AF43": 38, - "IP_API_DSCP_CS5": 40, - "IP_API_DSCP_EF": 46, - "IP_API_DSCP_CS6": 48, - "IP_API_DSCP_CS7": 50, - } -) +type IPProto = ip_types.IPProto -func (x IPDscp) String() string { - s, ok := IPDscp_name[uint8(x)] - if ok { - return s - } - return "IPDscp(" + strconv.Itoa(int(x)) + ")" -} +type AddressWithPrefix = ip_types.AddressWithPrefix -// IPEcn represents VPP binary API enum 'ip_ecn'. -type IPEcn uint8 +type IP4Address = ip_types.IP4Address -const ( - IP_API_ECN_NONE IPEcn = 0 - IP_API_ECN_ECT0 IPEcn = 1 - IP_API_ECN_ECT1 IPEcn = 2 - IP_API_ECN_CE IPEcn = 3 -) +type IP4AddressWithPrefix = ip_types.IP4AddressWithPrefix -var ( - IPEcn_name = map[uint8]string{ - 0: "IP_API_ECN_NONE", - 1: "IP_API_ECN_ECT0", - 2: "IP_API_ECN_ECT1", - 3: "IP_API_ECN_CE", - } - IPEcn_value = map[string]uint8{ - "IP_API_ECN_NONE": 0, - "IP_API_ECN_ECT0": 1, - "IP_API_ECN_ECT1": 2, - "IP_API_ECN_CE": 3, - } -) +type IP6Address = ip_types.IP6Address -func (x IPEcn) String() string { - s, ok := IPEcn_name[uint8(x)] - if ok { - return s - } - return "IPEcn(" + strconv.Itoa(int(x)) + ")" -} +type IP6AddressWithPrefix = ip_types.IP6AddressWithPrefix -// IPProto represents VPP binary API enum 'ip_proto'. -type IPProto uint32 - -const ( - IP_API_PROTO_HOPOPT IPProto = 0 - IP_API_PROTO_ICMP IPProto = 1 - IP_API_PROTO_IGMP IPProto = 2 - IP_API_PROTO_TCP IPProto = 6 - IP_API_PROTO_UDP IPProto = 17 - IP_API_PROTO_GRE IPProto = 47 - IP_API_PROTO_AH IPProto = 50 - IP_API_PROTO_ESP IPProto = 51 - IP_API_PROTO_EIGRP IPProto = 88 - IP_API_PROTO_OSPF IPProto = 89 - IP_API_PROTO_SCTP IPProto = 132 - IP_API_PROTO_RESERVED IPProto = 255 -) - -var ( - IPProto_name = map[uint32]string{ - 0: "IP_API_PROTO_HOPOPT", - 1: "IP_API_PROTO_ICMP", - 2: "IP_API_PROTO_IGMP", - 6: "IP_API_PROTO_TCP", - 17: "IP_API_PROTO_UDP", - 47: "IP_API_PROTO_GRE", - 50: "IP_API_PROTO_AH", - 51: "IP_API_PROTO_ESP", - 88: "IP_API_PROTO_EIGRP", - 89: "IP_API_PROTO_OSPF", - 132: "IP_API_PROTO_SCTP", - 255: "IP_API_PROTO_RESERVED", - } - IPProto_value = map[string]uint32{ - "IP_API_PROTO_HOPOPT": 0, - "IP_API_PROTO_ICMP": 1, - "IP_API_PROTO_IGMP": 2, - "IP_API_PROTO_TCP": 6, - "IP_API_PROTO_UDP": 17, - "IP_API_PROTO_GRE": 47, - "IP_API_PROTO_AH": 50, - "IP_API_PROTO_ESP": 51, - "IP_API_PROTO_EIGRP": 88, - "IP_API_PROTO_OSPF": 89, - "IP_API_PROTO_SCTP": 132, - "IP_API_PROTO_RESERVED": 255, - } -) - -func (x IPProto) String() string { - s, ok := IPProto_name[uint32(x)] - if ok { - return s - } - return "IPProto(" + strconv.Itoa(int(x)) + ")" -} - -// AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. -type AddressWithPrefix Prefix - -// IP4Address represents VPP binary API alias 'ip4_address'. -type IP4Address [4]uint8 - -// IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'. -type IP4AddressWithPrefix IP4Prefix - -// IP6Address represents VPP binary API alias 'ip6_address'. -type IP6Address [16]uint8 - -// IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'. -type IP6AddressWithPrefix IP6Prefix - -// Address represents VPP binary API type 'address'. -type Address struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` -} - -func (*Address) GetTypeName() string { return "address" } +type Address = ip_types.Address // FibMplsLabel represents VPP binary API type 'fib_mpls_label'. type FibMplsLabel struct { @@ -427,88 +225,17 @@ type FibPathNh struct { func (*FibPathNh) GetTypeName() string { return "fib_path_nh" } -// IP4Prefix represents VPP binary API type 'ip4_prefix'. -type IP4Prefix struct { - Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" } - -// IP6Prefix represents VPP binary API type 'ip6_prefix'. -type IP6Prefix struct { - Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" } - -// Mprefix represents VPP binary API type 'mprefix'. -type Mprefix struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` - GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` - SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` -} - -func (*Mprefix) GetTypeName() string { return "mprefix" } +type IP4Prefix = ip_types.IP4Prefix -// Prefix represents VPP binary API type 'prefix'. -type Prefix struct { - Address Address `binapi:"address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*Prefix) GetTypeName() string { return "prefix" } +type IP6Prefix = ip_types.IP6Prefix -// PrefixMatcher represents VPP binary API type 'prefix_matcher'. -type PrefixMatcher struct { - Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` - Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` -} +type Mprefix = ip_types.Mprefix -func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" } - -// AddressUnion represents VPP binary API union 'address_union'. -type AddressUnion struct { - XXX_UnionData [16]byte -} +type Prefix = ip_types.Prefix -func (*AddressUnion) GetTypeName() string { return "address_union" } +type PrefixMatcher = ip_types.PrefixMatcher -func AddressUnionIP4(a IP4Address) (u AddressUnion) { - u.SetIP4(a) - return -} -func (u *AddressUnion) SetIP4(a IP4Address) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.XXX_UnionData[:], b.Bytes()) -} -func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.XXX_UnionData[:]) - struc.Unpack(b, &a) - return -} - -func AddressUnionIP6(a IP6Address) (u AddressUnion) { - u.SetIP6(a) - return -} -func (u *AddressUnion) SetIP6(a IP6Address) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.XXX_UnionData[:], b.Bytes()) -} -func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.XXX_UnionData[:]) - struc.Unpack(b, &a) - return -} +type AddressUnion = ip_types.AddressUnion // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage diff --git a/examples/binapi/gen.go b/examples/binapi/gen.go index a19ca34..7849d8d 100644 --- a/examples/binapi/gen.go +++ b/examples/binapi/gen.go @@ -2,4 +2,4 @@ package binapi // Generate Go code from the VPP APIs located in the /usr/share/vpp/api directory. -//go:generate binapi-generator --import-prefix=git.fd.io/govpp.git/examples/binapi af_packet interface ip memclnt vpe sr acl memif ip_types fib_types +//go:generate binapi-generator --import-types=false af_packet interface interface_types ip memclnt vpe sr acl memif ip_types fib_types diff --git a/examples/binapi/interface_types/interface_types.ba.go b/examples/binapi/interface_types/interface_types.ba.go new file mode 100644 index 0000000..0191e5f --- /dev/null +++ b/examples/binapi/interface_types/interface_types.ba.go @@ -0,0 +1,266 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/interface_types.api.json + +/* +Package interface_types contains generated code for VPP API file interface_types.api (). + +It consists of: + 1 alias + 6 enums +*/ +package interface_types + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "interface_types" + // APIVersion is the API version of this module. + APIVersion = "" + // VersionCrc is the CRC of this module. + VersionCrc = 0x23822dac +) + +// IfStatusFlags represents VPP binary API enum 'if_status_flags'. +type IfStatusFlags uint32 + +const ( + IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 + IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 +) + +var ( + IfStatusFlags_name = map[uint32]string{ + 1: "IF_STATUS_API_FLAG_ADMIN_UP", + 2: "IF_STATUS_API_FLAG_LINK_UP", + } + IfStatusFlags_value = map[string]uint32{ + "IF_STATUS_API_FLAG_ADMIN_UP": 1, + "IF_STATUS_API_FLAG_LINK_UP": 2, + } +) + +func (x IfStatusFlags) String() string { + s, ok := IfStatusFlags_name[uint32(x)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" +} + +// IfType represents VPP binary API enum 'if_type'. +type IfType uint32 + +const ( + IF_API_TYPE_HARDWARE IfType = 0 + IF_API_TYPE_SUB IfType = 1 + IF_API_TYPE_P2P IfType = 2 + IF_API_TYPE_PIPE IfType = 3 +) + +var ( + IfType_name = map[uint32]string{ + 0: "IF_API_TYPE_HARDWARE", + 1: "IF_API_TYPE_SUB", + 2: "IF_API_TYPE_P2P", + 3: "IF_API_TYPE_PIPE", + } + IfType_value = map[string]uint32{ + "IF_API_TYPE_HARDWARE": 0, + "IF_API_TYPE_SUB": 1, + "IF_API_TYPE_P2P": 2, + "IF_API_TYPE_PIPE": 3, + } +) + +func (x IfType) String() string { + s, ok := IfType_name[uint32(x)] + if ok { + return s + } + return "IfType(" + strconv.Itoa(int(x)) + ")" +} + +// LinkDuplex represents VPP binary API enum 'link_duplex'. +type LinkDuplex uint32 + +const ( + LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 + LINK_DUPLEX_API_HALF LinkDuplex = 1 + LINK_DUPLEX_API_FULL LinkDuplex = 2 +) + +var ( + LinkDuplex_name = map[uint32]string{ + 0: "LINK_DUPLEX_API_UNKNOWN", + 1: "LINK_DUPLEX_API_HALF", + 2: "LINK_DUPLEX_API_FULL", + } + LinkDuplex_value = map[string]uint32{ + "LINK_DUPLEX_API_UNKNOWN": 0, + "LINK_DUPLEX_API_HALF": 1, + "LINK_DUPLEX_API_FULL": 2, + } +) + +func (x LinkDuplex) String() string { + s, ok := LinkDuplex_name[uint32(x)] + if ok { + return s + } + return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" +} + +// MtuProto represents VPP binary API enum 'mtu_proto'. +type MtuProto uint32 + +const ( + MTU_PROTO_API_L3 MtuProto = 0 + MTU_PROTO_API_IP4 MtuProto = 1 + MTU_PROTO_API_IP6 MtuProto = 2 + MTU_PROTO_API_MPLS MtuProto = 3 +) + +var ( + MtuProto_name = map[uint32]string{ + 0: "MTU_PROTO_API_L3", + 1: "MTU_PROTO_API_IP4", + 2: "MTU_PROTO_API_IP6", + 3: "MTU_PROTO_API_MPLS", + } + MtuProto_value = map[string]uint32{ + "MTU_PROTO_API_L3": 0, + "MTU_PROTO_API_IP4": 1, + "MTU_PROTO_API_IP6": 2, + "MTU_PROTO_API_MPLS": 3, + } +) + +func (x MtuProto) String() string { + s, ok := MtuProto_name[uint32(x)] + if ok { + return s + } + return "MtuProto(" + strconv.Itoa(int(x)) + ")" +} + +// RxMode represents VPP binary API enum 'rx_mode'. +type RxMode uint32 + +const ( + RX_MODE_API_UNKNOWN RxMode = 0 + RX_MODE_API_POLLING RxMode = 1 + RX_MODE_API_INTERRUPT RxMode = 2 + RX_MODE_API_ADAPTIVE RxMode = 3 + RX_MODE_API_DEFAULT RxMode = 4 +) + +var ( + RxMode_name = map[uint32]string{ + 0: "RX_MODE_API_UNKNOWN", + 1: "RX_MODE_API_POLLING", + 2: "RX_MODE_API_INTERRUPT", + 3: "RX_MODE_API_ADAPTIVE", + 4: "RX_MODE_API_DEFAULT", + } + RxMode_value = map[string]uint32{ + "RX_MODE_API_UNKNOWN": 0, + "RX_MODE_API_POLLING": 1, + "RX_MODE_API_INTERRUPT": 2, + "RX_MODE_API_ADAPTIVE": 3, + "RX_MODE_API_DEFAULT": 4, + } +) + +func (x RxMode) String() string { + s, ok := RxMode_name[uint32(x)] + if ok { + return s + } + return "RxMode(" + strconv.Itoa(int(x)) + ")" +} + +// SubIfFlags represents VPP binary API enum 'sub_if_flags'. +type SubIfFlags uint32 + +const ( + SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 + SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 + SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 + SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 + SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 + SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 + SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 + SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 + SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 + SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 +) + +var ( + SubIfFlags_name = map[uint32]string{ + 1: "SUB_IF_API_FLAG_NO_TAGS", + 2: "SUB_IF_API_FLAG_ONE_TAG", + 4: "SUB_IF_API_FLAG_TWO_TAGS", + 8: "SUB_IF_API_FLAG_DOT1AD", + 16: "SUB_IF_API_FLAG_EXACT_MATCH", + 32: "SUB_IF_API_FLAG_DEFAULT", + 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", + 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", + 254: "SUB_IF_API_FLAG_MASK_VNET", + 256: "SUB_IF_API_FLAG_DOT1AH", + } + SubIfFlags_value = map[string]uint32{ + "SUB_IF_API_FLAG_NO_TAGS": 1, + "SUB_IF_API_FLAG_ONE_TAG": 2, + "SUB_IF_API_FLAG_TWO_TAGS": 4, + "SUB_IF_API_FLAG_DOT1AD": 8, + "SUB_IF_API_FLAG_EXACT_MATCH": 16, + "SUB_IF_API_FLAG_DEFAULT": 32, + "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, + "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, + "SUB_IF_API_FLAG_MASK_VNET": 254, + "SUB_IF_API_FLAG_DOT1AH": 256, + } +) + +func (x SubIfFlags) String() string { + s, ok := SubIfFlags_name[uint32(x)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" +} + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/examples/binapi/interfaces/interfaces.ba.go b/examples/binapi/interfaces/interfaces.ba.go index 82e8f3c..fea1079 100644 --- a/examples/binapi/interfaces/interfaces.ba.go +++ b/examples/binapi/interfaces/interfaces.ba.go @@ -1,16 +1,16 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty -// VPP: 20.01-45~g7a071e370~b63 +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release // source: /usr/share/vpp/api/core/interface.api.json /* -Package interfaces contains generated code for VPP binary API defined by interface.api (version 3.2.2). +Package interfaces contains generated code for VPP API file interface.api (3.2.2). It consists of: 7 aliases 10 enums - 53 messages + 57 messages 6 types 1 union */ @@ -27,6 +27,9 @@ import ( api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" + + interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" + ip_types "git.fd.io/govpp.git/examples/binapi/ip_types" ) // This is a compile-time assertion to ensure that this generated file @@ -41,534 +44,57 @@ const ( // APIVersion is the API version of this module. APIVersion = "3.2.2" // VersionCrc is the CRC of this module. - VersionCrc = 0xfebc3ffa + VersionCrc = 0x58d4cf5a ) -// AddressFamily represents VPP binary API enum 'address_family'. -type AddressFamily uint32 +type AddressFamily = ip_types.AddressFamily -const ( - ADDRESS_IP4 AddressFamily = 0 - ADDRESS_IP6 AddressFamily = 1 -) +type IfStatusFlags = interface_types.IfStatusFlags -var ( - AddressFamily_name = map[uint32]string{ - 0: "ADDRESS_IP4", - 1: "ADDRESS_IP6", - } - AddressFamily_value = map[string]uint32{ - "ADDRESS_IP4": 0, - "ADDRESS_IP6": 1, - } -) +type IfType = interface_types.IfType -func (x AddressFamily) String() string { - s, ok := AddressFamily_name[uint32(x)] - if ok { - return s - } - return "AddressFamily(" + strconv.Itoa(int(x)) + ")" -} +type IPDscp = ip_types.IPDscp -// IfStatusFlags represents VPP binary API enum 'if_status_flags'. -type IfStatusFlags uint32 +type IPEcn = ip_types.IPEcn -const ( - IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 - IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 -) +type IPProto = ip_types.IPProto -var ( - IfStatusFlags_name = map[uint32]string{ - 1: "IF_STATUS_API_FLAG_ADMIN_UP", - 2: "IF_STATUS_API_FLAG_LINK_UP", - } - IfStatusFlags_value = map[string]uint32{ - "IF_STATUS_API_FLAG_ADMIN_UP": 1, - "IF_STATUS_API_FLAG_LINK_UP": 2, - } -) +type LinkDuplex = interface_types.LinkDuplex -func (x IfStatusFlags) String() string { - s, ok := IfStatusFlags_name[uint32(x)] - if ok { - return s - } - return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" -} +type MtuProto = interface_types.MtuProto -// IfType represents VPP binary API enum 'if_type'. -type IfType uint32 +type RxMode = interface_types.RxMode -const ( - IF_API_TYPE_HARDWARE IfType = 1 - IF_API_TYPE_SUB IfType = 2 - IF_API_TYPE_P2P IfType = 3 - IF_API_TYPE_PIPE IfType = 4 -) +type SubIfFlags = interface_types.SubIfFlags -var ( - IfType_name = map[uint32]string{ - 1: "IF_API_TYPE_HARDWARE", - 2: "IF_API_TYPE_SUB", - 3: "IF_API_TYPE_P2P", - 4: "IF_API_TYPE_PIPE", - } - IfType_value = map[string]uint32{ - "IF_API_TYPE_HARDWARE": 1, - "IF_API_TYPE_SUB": 2, - "IF_API_TYPE_P2P": 3, - "IF_API_TYPE_PIPE": 4, - } -) - -func (x IfType) String() string { - s, ok := IfType_name[uint32(x)] - if ok { - return s - } - return "IfType(" + strconv.Itoa(int(x)) + ")" -} +type AddressWithPrefix = ip_types.AddressWithPrefix -// IPDscp represents VPP binary API enum 'ip_dscp'. -type IPDscp uint8 - -const ( - IP_API_DSCP_CS0 IPDscp = 0 - IP_API_DSCP_CS1 IPDscp = 8 - IP_API_DSCP_AF11 IPDscp = 10 - IP_API_DSCP_AF12 IPDscp = 12 - IP_API_DSCP_AF13 IPDscp = 14 - IP_API_DSCP_CS2 IPDscp = 16 - IP_API_DSCP_AF21 IPDscp = 18 - IP_API_DSCP_AF22 IPDscp = 20 - IP_API_DSCP_AF23 IPDscp = 22 - IP_API_DSCP_CS3 IPDscp = 24 - IP_API_DSCP_AF31 IPDscp = 26 - IP_API_DSCP_AF32 IPDscp = 28 - IP_API_DSCP_AF33 IPDscp = 30 - IP_API_DSCP_CS4 IPDscp = 32 - IP_API_DSCP_AF41 IPDscp = 34 - IP_API_DSCP_AF42 IPDscp = 36 - IP_API_DSCP_AF43 IPDscp = 38 - IP_API_DSCP_CS5 IPDscp = 40 - IP_API_DSCP_EF IPDscp = 46 - IP_API_DSCP_CS6 IPDscp = 48 - IP_API_DSCP_CS7 IPDscp = 50 -) +type InterfaceIndex = interface_types.InterfaceIndex -var ( - IPDscp_name = map[uint8]string{ - 0: "IP_API_DSCP_CS0", - 8: "IP_API_DSCP_CS1", - 10: "IP_API_DSCP_AF11", - 12: "IP_API_DSCP_AF12", - 14: "IP_API_DSCP_AF13", - 16: "IP_API_DSCP_CS2", - 18: "IP_API_DSCP_AF21", - 20: "IP_API_DSCP_AF22", - 22: "IP_API_DSCP_AF23", - 24: "IP_API_DSCP_CS3", - 26: "IP_API_DSCP_AF31", - 28: "IP_API_DSCP_AF32", - 30: "IP_API_DSCP_AF33", - 32: "IP_API_DSCP_CS4", - 34: "IP_API_DSCP_AF41", - 36: "IP_API_DSCP_AF42", - 38: "IP_API_DSCP_AF43", - 40: "IP_API_DSCP_CS5", - 46: "IP_API_DSCP_EF", - 48: "IP_API_DSCP_CS6", - 50: "IP_API_DSCP_CS7", - } - IPDscp_value = map[string]uint8{ - "IP_API_DSCP_CS0": 0, - "IP_API_DSCP_CS1": 8, - "IP_API_DSCP_AF11": 10, - "IP_API_DSCP_AF12": 12, - "IP_API_DSCP_AF13": 14, - "IP_API_DSCP_CS2": 16, - "IP_API_DSCP_AF21": 18, - "IP_API_DSCP_AF22": 20, - "IP_API_DSCP_AF23": 22, - "IP_API_DSCP_CS3": 24, - "IP_API_DSCP_AF31": 26, - "IP_API_DSCP_AF32": 28, - "IP_API_DSCP_AF33": 30, - "IP_API_DSCP_CS4": 32, - "IP_API_DSCP_AF41": 34, - "IP_API_DSCP_AF42": 36, - "IP_API_DSCP_AF43": 38, - "IP_API_DSCP_CS5": 40, - "IP_API_DSCP_EF": 46, - "IP_API_DSCP_CS6": 48, - "IP_API_DSCP_CS7": 50, - } -) +type IP4Address = ip_types.IP4Address -func (x IPDscp) String() string { - s, ok := IPDscp_name[uint8(x)] - if ok { - return s - } - return "IPDscp(" + strconv.Itoa(int(x)) + ")" -} +type IP4AddressWithPrefix = ip_types.IP4AddressWithPrefix -// IPEcn represents VPP binary API enum 'ip_ecn'. -type IPEcn uint8 +type IP6Address = ip_types.IP6Address -const ( - IP_API_ECN_NONE IPEcn = 0 - IP_API_ECN_ECT0 IPEcn = 1 - IP_API_ECN_ECT1 IPEcn = 2 - IP_API_ECN_CE IPEcn = 3 -) - -var ( - IPEcn_name = map[uint8]string{ - 0: "IP_API_ECN_NONE", - 1: "IP_API_ECN_ECT0", - 2: "IP_API_ECN_ECT1", - 3: "IP_API_ECN_CE", - } - IPEcn_value = map[string]uint8{ - "IP_API_ECN_NONE": 0, - "IP_API_ECN_ECT0": 1, - "IP_API_ECN_ECT1": 2, - "IP_API_ECN_CE": 3, - } -) - -func (x IPEcn) String() string { - s, ok := IPEcn_name[uint8(x)] - if ok { - return s - } - return "IPEcn(" + strconv.Itoa(int(x)) + ")" -} - -// IPProto represents VPP binary API enum 'ip_proto'. -type IPProto uint32 - -const ( - IP_API_PROTO_HOPOPT IPProto = 0 - IP_API_PROTO_ICMP IPProto = 1 - IP_API_PROTO_IGMP IPProto = 2 - IP_API_PROTO_TCP IPProto = 6 - IP_API_PROTO_UDP IPProto = 17 - IP_API_PROTO_GRE IPProto = 47 - IP_API_PROTO_AH IPProto = 50 - IP_API_PROTO_ESP IPProto = 51 - IP_API_PROTO_EIGRP IPProto = 88 - IP_API_PROTO_OSPF IPProto = 89 - IP_API_PROTO_SCTP IPProto = 132 - IP_API_PROTO_RESERVED IPProto = 255 -) - -var ( - IPProto_name = map[uint32]string{ - 0: "IP_API_PROTO_HOPOPT", - 1: "IP_API_PROTO_ICMP", - 2: "IP_API_PROTO_IGMP", - 6: "IP_API_PROTO_TCP", - 17: "IP_API_PROTO_UDP", - 47: "IP_API_PROTO_GRE", - 50: "IP_API_PROTO_AH", - 51: "IP_API_PROTO_ESP", - 88: "IP_API_PROTO_EIGRP", - 89: "IP_API_PROTO_OSPF", - 132: "IP_API_PROTO_SCTP", - 255: "IP_API_PROTO_RESERVED", - } - IPProto_value = map[string]uint32{ - "IP_API_PROTO_HOPOPT": 0, - "IP_API_PROTO_ICMP": 1, - "IP_API_PROTO_IGMP": 2, - "IP_API_PROTO_TCP": 6, - "IP_API_PROTO_UDP": 17, - "IP_API_PROTO_GRE": 47, - "IP_API_PROTO_AH": 50, - "IP_API_PROTO_ESP": 51, - "IP_API_PROTO_EIGRP": 88, - "IP_API_PROTO_OSPF": 89, - "IP_API_PROTO_SCTP": 132, - "IP_API_PROTO_RESERVED": 255, - } -) - -func (x IPProto) String() string { - s, ok := IPProto_name[uint32(x)] - if ok { - return s - } - return "IPProto(" + strconv.Itoa(int(x)) + ")" -} - -// LinkDuplex represents VPP binary API enum 'link_duplex'. -type LinkDuplex uint32 - -const ( - LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 - LINK_DUPLEX_API_HALF LinkDuplex = 1 - LINK_DUPLEX_API_FULL LinkDuplex = 2 -) - -var ( - LinkDuplex_name = map[uint32]string{ - 0: "LINK_DUPLEX_API_UNKNOWN", - 1: "LINK_DUPLEX_API_HALF", - 2: "LINK_DUPLEX_API_FULL", - } - LinkDuplex_value = map[string]uint32{ - "LINK_DUPLEX_API_UNKNOWN": 0, - "LINK_DUPLEX_API_HALF": 1, - "LINK_DUPLEX_API_FULL": 2, - } -) - -func (x LinkDuplex) String() string { - s, ok := LinkDuplex_name[uint32(x)] - if ok { - return s - } - return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" -} - -// MtuProto represents VPP binary API enum 'mtu_proto'. -type MtuProto uint32 - -const ( - MTU_PROTO_API_L3 MtuProto = 1 - MTU_PROTO_API_IP4 MtuProto = 2 - MTU_PROTO_API_IP6 MtuProto = 3 - MTU_PROTO_API_MPLS MtuProto = 4 - MTU_PROTO_API_N MtuProto = 5 -) - -var ( - MtuProto_name = map[uint32]string{ - 1: "MTU_PROTO_API_L3", - 2: "MTU_PROTO_API_IP4", - 3: "MTU_PROTO_API_IP6", - 4: "MTU_PROTO_API_MPLS", - 5: "MTU_PROTO_API_N", - } - MtuProto_value = map[string]uint32{ - "MTU_PROTO_API_L3": 1, - "MTU_PROTO_API_IP4": 2, - "MTU_PROTO_API_IP6": 3, - "MTU_PROTO_API_MPLS": 4, - "MTU_PROTO_API_N": 5, - } -) - -func (x MtuProto) String() string { - s, ok := MtuProto_name[uint32(x)] - if ok { - return s - } - return "MtuProto(" + strconv.Itoa(int(x)) + ")" -} - -// RxMode represents VPP binary API enum 'rx_mode'. -type RxMode uint32 - -const ( - RX_MODE_API_UNKNOWN RxMode = 0 - RX_MODE_API_POLLING RxMode = 1 - RX_MODE_API_INTERRUPT RxMode = 2 - RX_MODE_API_ADAPTIVE RxMode = 3 - RX_MODE_API_DEFAULT RxMode = 4 -) - -var ( - RxMode_name = map[uint32]string{ - 0: "RX_MODE_API_UNKNOWN", - 1: "RX_MODE_API_POLLING", - 2: "RX_MODE_API_INTERRUPT", - 3: "RX_MODE_API_ADAPTIVE", - 4: "RX_MODE_API_DEFAULT", - } - RxMode_value = map[string]uint32{ - "RX_MODE_API_UNKNOWN": 0, - "RX_MODE_API_POLLING": 1, - "RX_MODE_API_INTERRUPT": 2, - "RX_MODE_API_ADAPTIVE": 3, - "RX_MODE_API_DEFAULT": 4, - } -) - -func (x RxMode) String() string { - s, ok := RxMode_name[uint32(x)] - if ok { - return s - } - return "RxMode(" + strconv.Itoa(int(x)) + ")" -} - -// SubIfFlags represents VPP binary API enum 'sub_if_flags'. -type SubIfFlags uint32 - -const ( - SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 - SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 - SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 - SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 - SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 - SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 - SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 - SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 - SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 - SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 -) - -var ( - SubIfFlags_name = map[uint32]string{ - 1: "SUB_IF_API_FLAG_NO_TAGS", - 2: "SUB_IF_API_FLAG_ONE_TAG", - 4: "SUB_IF_API_FLAG_TWO_TAGS", - 8: "SUB_IF_API_FLAG_DOT1AD", - 16: "SUB_IF_API_FLAG_EXACT_MATCH", - 32: "SUB_IF_API_FLAG_DEFAULT", - 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", - 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", - 254: "SUB_IF_API_FLAG_MASK_VNET", - 256: "SUB_IF_API_FLAG_DOT1AH", - } - SubIfFlags_value = map[string]uint32{ - "SUB_IF_API_FLAG_NO_TAGS": 1, - "SUB_IF_API_FLAG_ONE_TAG": 2, - "SUB_IF_API_FLAG_TWO_TAGS": 4, - "SUB_IF_API_FLAG_DOT1AD": 8, - "SUB_IF_API_FLAG_EXACT_MATCH": 16, - "SUB_IF_API_FLAG_DEFAULT": 32, - "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, - "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, - "SUB_IF_API_FLAG_MASK_VNET": 254, - "SUB_IF_API_FLAG_DOT1AH": 256, - } -) - -func (x SubIfFlags) String() string { - s, ok := SubIfFlags_name[uint32(x)] - if ok { - return s - } - return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" -} - -// AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. -type AddressWithPrefix Prefix - -// InterfaceIndex represents VPP binary API alias 'interface_index'. -type InterfaceIndex uint32 - -// IP4Address represents VPP binary API alias 'ip4_address'. -type IP4Address [4]uint8 - -// IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'. -type IP4AddressWithPrefix IP4Prefix - -// IP6Address represents VPP binary API alias 'ip6_address'. -type IP6Address [16]uint8 - -// IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'. -type IP6AddressWithPrefix IP6Prefix +type IP6AddressWithPrefix = ip_types.IP6AddressWithPrefix // MacAddress represents VPP binary API alias 'mac_address'. type MacAddress [6]uint8 -// Address represents VPP binary API type 'address'. -type Address struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` -} - -func (*Address) GetTypeName() string { return "address" } - -// IP4Prefix represents VPP binary API type 'ip4_prefix'. -type IP4Prefix struct { - Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" } - -// IP6Prefix represents VPP binary API type 'ip6_prefix'. -type IP6Prefix struct { - Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" } - -// Mprefix represents VPP binary API type 'mprefix'. -type Mprefix struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` - GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` - SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` -} - -func (*Mprefix) GetTypeName() string { return "mprefix" } - -// Prefix represents VPP binary API type 'prefix'. -type Prefix struct { - Address Address `binapi:"address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} +type Address = ip_types.Address -func (*Prefix) GetTypeName() string { return "prefix" } +type IP4Prefix = ip_types.IP4Prefix -// PrefixMatcher represents VPP binary API type 'prefix_matcher'. -type PrefixMatcher struct { - Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` - Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` -} - -func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" } +type IP6Prefix = ip_types.IP6Prefix -// AddressUnion represents VPP binary API union 'address_union'. -type AddressUnion struct { - XXX_UnionData [16]byte -} +type Mprefix = ip_types.Mprefix -func (*AddressUnion) GetTypeName() string { return "address_union" } +type Prefix = ip_types.Prefix -func AddressUnionIP4(a IP4Address) (u AddressUnion) { - u.SetIP4(a) - return -} -func (u *AddressUnion) SetIP4(a IP4Address) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.XXX_UnionData[:], b.Bytes()) -} -func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.XXX_UnionData[:]) - struc.Unpack(b, &a) - return -} +type PrefixMatcher = ip_types.PrefixMatcher -func AddressUnionIP6(a IP6Address) (u AddressUnion) { - u.SetIP6(a) - return -} -func (u *AddressUnion) SetIP6(a IP6Address) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.XXX_UnionData[:], b.Bytes()) -} -func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.XXX_UnionData[:]) - struc.Unpack(b, &a) - return -} +type AddressUnion = ip_types.AddressUnion // CollectDetailedInterfaceStats represents VPP binary API message 'collect_detailed_interface_stats'. type CollectDetailedInterfaceStats struct { @@ -1575,7 +1101,7 @@ func (m *SwInterfaceAddDelAddress) Size() int { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - size += 4 + size += 1 // field[3] m.Prefix.Address.Un size += 16 // field[2] m.Prefix.Len @@ -1609,8 +1135,8 @@ func (m *SwInterfaceAddDelAddress) Marshal(b []byte) ([]byte, error) { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) - pos += 4 + buf[pos] = uint8(m.Prefix.Address.Af) + pos += 1 // field[3] m.Prefix.Address.Un copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) pos += 16 @@ -1636,8 +1162,8 @@ func (m *SwInterfaceAddDelAddress) Unmarshal(tmp []byte) error { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 + m.Prefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 // field[3] m.Prefix.Address.Un copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) pos += 16 @@ -1817,6 +1343,178 @@ func (m *SwInterfaceAddDelMacAddressReply) Unmarshal(tmp []byte) error { return nil } +// SwInterfaceAddressReplaceBegin represents VPP binary API message 'sw_interface_address_replace_begin'. +type SwInterfaceAddressReplaceBegin struct{} + +func (m *SwInterfaceAddressReplaceBegin) Reset() { *m = SwInterfaceAddressReplaceBegin{} } +func (*SwInterfaceAddressReplaceBegin) GetMessageName() string { + return "sw_interface_address_replace_begin" +} +func (*SwInterfaceAddressReplaceBegin) GetCrcString() string { return "51077d14" } +func (*SwInterfaceAddressReplaceBegin) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceAddressReplaceBegin) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SwInterfaceAddressReplaceBegin) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *SwInterfaceAddressReplaceBegin) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// SwInterfaceAddressReplaceBeginReply represents VPP binary API message 'sw_interface_address_replace_begin_reply'. +type SwInterfaceAddressReplaceBeginReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceAddressReplaceBeginReply) Reset() { *m = SwInterfaceAddressReplaceBeginReply{} } +func (*SwInterfaceAddressReplaceBeginReply) GetMessageName() string { + return "sw_interface_address_replace_begin_reply" +} +func (*SwInterfaceAddressReplaceBeginReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceAddressReplaceBeginReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceAddressReplaceBeginReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceAddressReplaceBeginReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceAddressReplaceBeginReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceAddressReplaceEnd represents VPP binary API message 'sw_interface_address_replace_end'. +type SwInterfaceAddressReplaceEnd struct{} + +func (m *SwInterfaceAddressReplaceEnd) Reset() { *m = SwInterfaceAddressReplaceEnd{} } +func (*SwInterfaceAddressReplaceEnd) GetMessageName() string { + return "sw_interface_address_replace_end" +} +func (*SwInterfaceAddressReplaceEnd) GetCrcString() string { return "51077d14" } +func (*SwInterfaceAddressReplaceEnd) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceAddressReplaceEnd) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SwInterfaceAddressReplaceEnd) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *SwInterfaceAddressReplaceEnd) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// SwInterfaceAddressReplaceEndReply represents VPP binary API message 'sw_interface_address_replace_end_reply'. +type SwInterfaceAddressReplaceEndReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceAddressReplaceEndReply) Reset() { *m = SwInterfaceAddressReplaceEndReply{} } +func (*SwInterfaceAddressReplaceEndReply) GetMessageName() string { + return "sw_interface_address_replace_end_reply" +} +func (*SwInterfaceAddressReplaceEndReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceAddressReplaceEndReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceAddressReplaceEndReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceAddressReplaceEndReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceAddressReplaceEndReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceClearStats represents VPP binary API message 'sw_interface_clear_stats'. type SwInterfaceClearStats struct { SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -3857,6 +3555,10 @@ func file_interfaces_binapi_init() { api.RegisterMessage((*SwInterfaceAddDelAddressReply)(nil), "interface.SwInterfaceAddDelAddressReply") api.RegisterMessage((*SwInterfaceAddDelMacAddress)(nil), "interface.SwInterfaceAddDelMacAddress") api.RegisterMessage((*SwInterfaceAddDelMacAddressReply)(nil), "interface.SwInterfaceAddDelMacAddressReply") + api.RegisterMessage((*SwInterfaceAddressReplaceBegin)(nil), "interface.SwInterfaceAddressReplaceBegin") + api.RegisterMessage((*SwInterfaceAddressReplaceBeginReply)(nil), "interface.SwInterfaceAddressReplaceBeginReply") + api.RegisterMessage((*SwInterfaceAddressReplaceEnd)(nil), "interface.SwInterfaceAddressReplaceEnd") + api.RegisterMessage((*SwInterfaceAddressReplaceEndReply)(nil), "interface.SwInterfaceAddressReplaceEndReply") api.RegisterMessage((*SwInterfaceClearStats)(nil), "interface.SwInterfaceClearStats") api.RegisterMessage((*SwInterfaceClearStatsReply)(nil), "interface.SwInterfaceClearStatsReply") api.RegisterMessage((*SwInterfaceDetails)(nil), "interface.SwInterfaceDetails") @@ -3915,6 +3617,10 @@ func AllMessages() []api.Message { (*SwInterfaceAddDelAddressReply)(nil), (*SwInterfaceAddDelMacAddress)(nil), (*SwInterfaceAddDelMacAddressReply)(nil), + (*SwInterfaceAddressReplaceBegin)(nil), + (*SwInterfaceAddressReplaceBeginReply)(nil), + (*SwInterfaceAddressReplaceEnd)(nil), + (*SwInterfaceAddressReplaceEndReply)(nil), (*SwInterfaceClearStats)(nil), (*SwInterfaceClearStatsReply)(nil), (*SwInterfaceDetails)(nil), diff --git a/examples/binapi/interfaces/interfaces_rpc.ba.go b/examples/binapi/interfaces/interfaces_rpc.ba.go index e30aed9..a7235a8 100644 --- a/examples/binapi/interfaces/interfaces_rpc.ba.go +++ b/examples/binapi/interfaces/interfaces_rpc.ba.go @@ -24,6 +24,8 @@ type RPCService interface { InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) + SwInterfaceAddressReplaceBegin(ctx context.Context, in *SwInterfaceAddressReplaceBegin) (*SwInterfaceAddressReplaceBeginReply, error) + SwInterfaceAddressReplaceEnd(ctx context.Context, in *SwInterfaceAddressReplaceEnd) (*SwInterfaceAddressReplaceEndReply, error) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) @@ -198,6 +200,24 @@ func (c *serviceClient) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwI return out, nil } +func (c *serviceClient) SwInterfaceAddressReplaceBegin(ctx context.Context, in *SwInterfaceAddressReplaceBegin) (*SwInterfaceAddressReplaceBeginReply, error) { + out := new(SwInterfaceAddressReplaceBeginReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddressReplaceEnd(ctx context.Context, in *SwInterfaceAddressReplaceEnd) (*SwInterfaceAddressReplaceEndReply, error) { + out := new(SwInterfaceAddressReplaceEndReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) { out := new(SwInterfaceClearStatsReply) err := c.ch.SendRequest(in).ReceiveReply(out) diff --git a/examples/binapi/ip/ip.ba.go b/examples/binapi/ip/ip.ba.go index b15a489..183ed99 100644 --- a/examples/binapi/ip/ip.ba.go +++ b/examples/binapi/ip/ip.ba.go @@ -1,11 +1,11 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty -// VPP: 20.01-45~g7a071e370~b63 +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release // source: /usr/share/vpp/api/core/ip.api.json /* -Package ip contains generated code for VPP binary API defined by ip.api (version 3.0.1). +Package ip contains generated code for VPP API file ip.api (3.0.1). It consists of: 7 aliases @@ -27,6 +27,9 @@ import ( api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" + + fib_types "git.fd.io/govpp.git/examples/binapi/fib_types" + interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" ) // This is a compile-time assertion to ensure that this generated file @@ -41,392 +44,26 @@ const ( // APIVersion is the API version of this module. APIVersion = "3.0.1" // VersionCrc is the CRC of this module. - VersionCrc = 0xfc3fea46 -) - -// AddressFamily represents VPP binary API enum 'address_family'. -type AddressFamily uint32 - -const ( - ADDRESS_IP4 AddressFamily = 0 - ADDRESS_IP6 AddressFamily = 1 -) - -var ( - AddressFamily_name = map[uint32]string{ - 0: "ADDRESS_IP4", - 1: "ADDRESS_IP6", - } - AddressFamily_value = map[string]uint32{ - "ADDRESS_IP4": 0, - "ADDRESS_IP6": 1, - } -) - -func (x AddressFamily) String() string { - s, ok := AddressFamily_name[uint32(x)] - if ok { - return s - } - return "AddressFamily(" + strconv.Itoa(int(x)) + ")" -} - -// FibPathFlags represents VPP binary API enum 'fib_path_flags'. -type FibPathFlags uint32 - -const ( - FIB_API_PATH_FLAG_NONE FibPathFlags = 0 - FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1 - FIB_API_PATH_FLAG_RESOLVE_VIA_HOST FibPathFlags = 2 - FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4 -) - -var ( - FibPathFlags_name = map[uint32]string{ - 0: "FIB_API_PATH_FLAG_NONE", - 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED", - 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST", - 4: "FIB_API_PATH_FLAG_POP_PW_CW", - } - FibPathFlags_value = map[string]uint32{ - "FIB_API_PATH_FLAG_NONE": 0, - "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1, - "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2, - "FIB_API_PATH_FLAG_POP_PW_CW": 4, - } -) - -func (x FibPathFlags) String() string { - s, ok := FibPathFlags_name[uint32(x)] - if ok { - return s - } - return "FibPathFlags(" + strconv.Itoa(int(x)) + ")" -} - -// FibPathNhProto represents VPP binary API enum 'fib_path_nh_proto'. -type FibPathNhProto uint32 - -const ( - FIB_API_PATH_NH_PROTO_IP4 FibPathNhProto = 0 - FIB_API_PATH_NH_PROTO_IP6 FibPathNhProto = 1 - FIB_API_PATH_NH_PROTO_MPLS FibPathNhProto = 2 - FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3 - FIB_API_PATH_NH_PROTO_BIER FibPathNhProto = 4 -) - -var ( - FibPathNhProto_name = map[uint32]string{ - 0: "FIB_API_PATH_NH_PROTO_IP4", - 1: "FIB_API_PATH_NH_PROTO_IP6", - 2: "FIB_API_PATH_NH_PROTO_MPLS", - 3: "FIB_API_PATH_NH_PROTO_ETHERNET", - 4: "FIB_API_PATH_NH_PROTO_BIER", - } - FibPathNhProto_value = map[string]uint32{ - "FIB_API_PATH_NH_PROTO_IP4": 0, - "FIB_API_PATH_NH_PROTO_IP6": 1, - "FIB_API_PATH_NH_PROTO_MPLS": 2, - "FIB_API_PATH_NH_PROTO_ETHERNET": 3, - "FIB_API_PATH_NH_PROTO_BIER": 4, - } -) - -func (x FibPathNhProto) String() string { - s, ok := FibPathNhProto_name[uint32(x)] - if ok { - return s - } - return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")" -} - -// FibPathType represents VPP binary API enum 'fib_path_type'. -type FibPathType uint32 - -const ( - FIB_API_PATH_TYPE_NORMAL FibPathType = 0 - FIB_API_PATH_TYPE_LOCAL FibPathType = 1 - FIB_API_PATH_TYPE_DROP FibPathType = 2 - FIB_API_PATH_TYPE_UDP_ENCAP FibPathType = 3 - FIB_API_PATH_TYPE_BIER_IMP FibPathType = 4 - FIB_API_PATH_TYPE_ICMP_UNREACH FibPathType = 5 - FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6 - FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7 - FIB_API_PATH_TYPE_DVR FibPathType = 8 - FIB_API_PATH_TYPE_INTERFACE_RX FibPathType = 9 - FIB_API_PATH_TYPE_CLASSIFY FibPathType = 10 -) - -var ( - FibPathType_name = map[uint32]string{ - 0: "FIB_API_PATH_TYPE_NORMAL", - 1: "FIB_API_PATH_TYPE_LOCAL", - 2: "FIB_API_PATH_TYPE_DROP", - 3: "FIB_API_PATH_TYPE_UDP_ENCAP", - 4: "FIB_API_PATH_TYPE_BIER_IMP", - 5: "FIB_API_PATH_TYPE_ICMP_UNREACH", - 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT", - 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP", - 8: "FIB_API_PATH_TYPE_DVR", - 9: "FIB_API_PATH_TYPE_INTERFACE_RX", - 10: "FIB_API_PATH_TYPE_CLASSIFY", - } - FibPathType_value = map[string]uint32{ - "FIB_API_PATH_TYPE_NORMAL": 0, - "FIB_API_PATH_TYPE_LOCAL": 1, - "FIB_API_PATH_TYPE_DROP": 2, - "FIB_API_PATH_TYPE_UDP_ENCAP": 3, - "FIB_API_PATH_TYPE_BIER_IMP": 4, - "FIB_API_PATH_TYPE_ICMP_UNREACH": 5, - "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6, - "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7, - "FIB_API_PATH_TYPE_DVR": 8, - "FIB_API_PATH_TYPE_INTERFACE_RX": 9, - "FIB_API_PATH_TYPE_CLASSIFY": 10, - } -) - -func (x FibPathType) String() string { - s, ok := FibPathType_name[uint32(x)] - if ok { - return s - } - return "FibPathType(" + strconv.Itoa(int(x)) + ")" -} - -// IfStatusFlags represents VPP binary API enum 'if_status_flags'. -type IfStatusFlags uint32 - -const ( - IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 - IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 -) - -var ( - IfStatusFlags_name = map[uint32]string{ - 1: "IF_STATUS_API_FLAG_ADMIN_UP", - 2: "IF_STATUS_API_FLAG_LINK_UP", - } - IfStatusFlags_value = map[string]uint32{ - "IF_STATUS_API_FLAG_ADMIN_UP": 1, - "IF_STATUS_API_FLAG_LINK_UP": 2, - } -) - -func (x IfStatusFlags) String() string { - s, ok := IfStatusFlags_name[uint32(x)] - if ok { - return s - } - return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" -} - -// IfType represents VPP binary API enum 'if_type'. -type IfType uint32 - -const ( - IF_API_TYPE_HARDWARE IfType = 1 - IF_API_TYPE_SUB IfType = 2 - IF_API_TYPE_P2P IfType = 3 - IF_API_TYPE_PIPE IfType = 4 -) - -var ( - IfType_name = map[uint32]string{ - 1: "IF_API_TYPE_HARDWARE", - 2: "IF_API_TYPE_SUB", - 3: "IF_API_TYPE_P2P", - 4: "IF_API_TYPE_PIPE", - } - IfType_value = map[string]uint32{ - "IF_API_TYPE_HARDWARE": 1, - "IF_API_TYPE_SUB": 2, - "IF_API_TYPE_P2P": 3, - "IF_API_TYPE_PIPE": 4, - } -) - -func (x IfType) String() string { - s, ok := IfType_name[uint32(x)] - if ok { - return s - } - return "IfType(" + strconv.Itoa(int(x)) + ")" -} - -// IPDscp represents VPP binary API enum 'ip_dscp'. -type IPDscp uint8 - -const ( - IP_API_DSCP_CS0 IPDscp = 0 - IP_API_DSCP_CS1 IPDscp = 8 - IP_API_DSCP_AF11 IPDscp = 10 - IP_API_DSCP_AF12 IPDscp = 12 - IP_API_DSCP_AF13 IPDscp = 14 - IP_API_DSCP_CS2 IPDscp = 16 - IP_API_DSCP_AF21 IPDscp = 18 - IP_API_DSCP_AF22 IPDscp = 20 - IP_API_DSCP_AF23 IPDscp = 22 - IP_API_DSCP_CS3 IPDscp = 24 - IP_API_DSCP_AF31 IPDscp = 26 - IP_API_DSCP_AF32 IPDscp = 28 - IP_API_DSCP_AF33 IPDscp = 30 - IP_API_DSCP_CS4 IPDscp = 32 - IP_API_DSCP_AF41 IPDscp = 34 - IP_API_DSCP_AF42 IPDscp = 36 - IP_API_DSCP_AF43 IPDscp = 38 - IP_API_DSCP_CS5 IPDscp = 40 - IP_API_DSCP_EF IPDscp = 46 - IP_API_DSCP_CS6 IPDscp = 48 - IP_API_DSCP_CS7 IPDscp = 50 -) - -var ( - IPDscp_name = map[uint8]string{ - 0: "IP_API_DSCP_CS0", - 8: "IP_API_DSCP_CS1", - 10: "IP_API_DSCP_AF11", - 12: "IP_API_DSCP_AF12", - 14: "IP_API_DSCP_AF13", - 16: "IP_API_DSCP_CS2", - 18: "IP_API_DSCP_AF21", - 20: "IP_API_DSCP_AF22", - 22: "IP_API_DSCP_AF23", - 24: "IP_API_DSCP_CS3", - 26: "IP_API_DSCP_AF31", - 28: "IP_API_DSCP_AF32", - 30: "IP_API_DSCP_AF33", - 32: "IP_API_DSCP_CS4", - 34: "IP_API_DSCP_AF41", - 36: "IP_API_DSCP_AF42", - 38: "IP_API_DSCP_AF43", - 40: "IP_API_DSCP_CS5", - 46: "IP_API_DSCP_EF", - 48: "IP_API_DSCP_CS6", - 50: "IP_API_DSCP_CS7", - } - IPDscp_value = map[string]uint8{ - "IP_API_DSCP_CS0": 0, - "IP_API_DSCP_CS1": 8, - "IP_API_DSCP_AF11": 10, - "IP_API_DSCP_AF12": 12, - "IP_API_DSCP_AF13": 14, - "IP_API_DSCP_CS2": 16, - "IP_API_DSCP_AF21": 18, - "IP_API_DSCP_AF22": 20, - "IP_API_DSCP_AF23": 22, - "IP_API_DSCP_CS3": 24, - "IP_API_DSCP_AF31": 26, - "IP_API_DSCP_AF32": 28, - "IP_API_DSCP_AF33": 30, - "IP_API_DSCP_CS4": 32, - "IP_API_DSCP_AF41": 34, - "IP_API_DSCP_AF42": 36, - "IP_API_DSCP_AF43": 38, - "IP_API_DSCP_CS5": 40, - "IP_API_DSCP_EF": 46, - "IP_API_DSCP_CS6": 48, - "IP_API_DSCP_CS7": 50, - } + VersionCrc = 0x765d74b1 ) -func (x IPDscp) String() string { - s, ok := IPDscp_name[uint8(x)] - if ok { - return s - } - return "IPDscp(" + strconv.Itoa(int(x)) + ")" -} +type AddressFamily = fib_types.AddressFamily -// IPEcn represents VPP binary API enum 'ip_ecn'. -type IPEcn uint8 +type FibPathFlags = fib_types.FibPathFlags -const ( - IP_API_ECN_NONE IPEcn = 0 - IP_API_ECN_ECT0 IPEcn = 1 - IP_API_ECN_ECT1 IPEcn = 2 - IP_API_ECN_CE IPEcn = 3 -) +type FibPathNhProto = fib_types.FibPathNhProto -var ( - IPEcn_name = map[uint8]string{ - 0: "IP_API_ECN_NONE", - 1: "IP_API_ECN_ECT0", - 2: "IP_API_ECN_ECT1", - 3: "IP_API_ECN_CE", - } - IPEcn_value = map[string]uint8{ - "IP_API_ECN_NONE": 0, - "IP_API_ECN_ECT0": 1, - "IP_API_ECN_ECT1": 2, - "IP_API_ECN_CE": 3, - } -) +type FibPathType = fib_types.FibPathType -func (x IPEcn) String() string { - s, ok := IPEcn_name[uint8(x)] - if ok { - return s - } - return "IPEcn(" + strconv.Itoa(int(x)) + ")" -} +type IfStatusFlags = interface_types.IfStatusFlags -// IPProto represents VPP binary API enum 'ip_proto'. -type IPProto uint32 +type IfType = interface_types.IfType -const ( - IP_API_PROTO_HOPOPT IPProto = 0 - IP_API_PROTO_ICMP IPProto = 1 - IP_API_PROTO_IGMP IPProto = 2 - IP_API_PROTO_TCP IPProto = 6 - IP_API_PROTO_UDP IPProto = 17 - IP_API_PROTO_GRE IPProto = 47 - IP_API_PROTO_AH IPProto = 50 - IP_API_PROTO_ESP IPProto = 51 - IP_API_PROTO_EIGRP IPProto = 88 - IP_API_PROTO_OSPF IPProto = 89 - IP_API_PROTO_SCTP IPProto = 132 - IP_API_PROTO_RESERVED IPProto = 255 -) +type IPDscp = fib_types.IPDscp -var ( - IPProto_name = map[uint32]string{ - 0: "IP_API_PROTO_HOPOPT", - 1: "IP_API_PROTO_ICMP", - 2: "IP_API_PROTO_IGMP", - 6: "IP_API_PROTO_TCP", - 17: "IP_API_PROTO_UDP", - 47: "IP_API_PROTO_GRE", - 50: "IP_API_PROTO_AH", - 51: "IP_API_PROTO_ESP", - 88: "IP_API_PROTO_EIGRP", - 89: "IP_API_PROTO_OSPF", - 132: "IP_API_PROTO_SCTP", - 255: "IP_API_PROTO_RESERVED", - } - IPProto_value = map[string]uint32{ - "IP_API_PROTO_HOPOPT": 0, - "IP_API_PROTO_ICMP": 1, - "IP_API_PROTO_IGMP": 2, - "IP_API_PROTO_TCP": 6, - "IP_API_PROTO_UDP": 17, - "IP_API_PROTO_GRE": 47, - "IP_API_PROTO_AH": 50, - "IP_API_PROTO_ESP": 51, - "IP_API_PROTO_EIGRP": 88, - "IP_API_PROTO_OSPF": 89, - "IP_API_PROTO_SCTP": 132, - "IP_API_PROTO_RESERVED": 255, - } -) +type IPEcn = fib_types.IPEcn -func (x IPProto) String() string { - s, ok := IPProto_name[uint32(x)] - if ok { - return s - } - return "IPProto(" + strconv.Itoa(int(x)) + ")" -} +type IPProto = fib_types.IPProto // IPReassType represents VPP binary API enum 'ip_reass_type'. type IPReassType uint32 @@ -455,35 +92,7 @@ func (x IPReassType) String() string { return "IPReassType(" + strconv.Itoa(int(x)) + ")" } -// LinkDuplex represents VPP binary API enum 'link_duplex'. -type LinkDuplex uint32 - -const ( - LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 - LINK_DUPLEX_API_HALF LinkDuplex = 1 - LINK_DUPLEX_API_FULL LinkDuplex = 2 -) - -var ( - LinkDuplex_name = map[uint32]string{ - 0: "LINK_DUPLEX_API_UNKNOWN", - 1: "LINK_DUPLEX_API_HALF", - 2: "LINK_DUPLEX_API_FULL", - } - LinkDuplex_value = map[string]uint32{ - "LINK_DUPLEX_API_UNKNOWN": 0, - "LINK_DUPLEX_API_HALF": 1, - "LINK_DUPLEX_API_FULL": 2, - } -) - -func (x LinkDuplex) String() string { - s, ok := LinkDuplex_name[uint32(x)] - if ok { - return s - } - return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" -} +type LinkDuplex = interface_types.LinkDuplex // MfibItfFlags represents VPP binary API enum 'mfib_itf_flags'. type MfibItfFlags uint32 @@ -524,210 +133,38 @@ func (x MfibItfFlags) String() string { return "MfibItfFlags(" + strconv.Itoa(int(x)) + ")" } -// MtuProto represents VPP binary API enum 'mtu_proto'. -type MtuProto uint32 - -const ( - MTU_PROTO_API_L3 MtuProto = 1 - MTU_PROTO_API_IP4 MtuProto = 2 - MTU_PROTO_API_IP6 MtuProto = 3 - MTU_PROTO_API_MPLS MtuProto = 4 - MTU_PROTO_API_N MtuProto = 5 -) - -var ( - MtuProto_name = map[uint32]string{ - 1: "MTU_PROTO_API_L3", - 2: "MTU_PROTO_API_IP4", - 3: "MTU_PROTO_API_IP6", - 4: "MTU_PROTO_API_MPLS", - 5: "MTU_PROTO_API_N", - } - MtuProto_value = map[string]uint32{ - "MTU_PROTO_API_L3": 1, - "MTU_PROTO_API_IP4": 2, - "MTU_PROTO_API_IP6": 3, - "MTU_PROTO_API_MPLS": 4, - "MTU_PROTO_API_N": 5, - } -) - -func (x MtuProto) String() string { - s, ok := MtuProto_name[uint32(x)] - if ok { - return s - } - return "MtuProto(" + strconv.Itoa(int(x)) + ")" -} - -// RxMode represents VPP binary API enum 'rx_mode'. -type RxMode uint32 - -const ( - RX_MODE_API_UNKNOWN RxMode = 0 - RX_MODE_API_POLLING RxMode = 1 - RX_MODE_API_INTERRUPT RxMode = 2 - RX_MODE_API_ADAPTIVE RxMode = 3 - RX_MODE_API_DEFAULT RxMode = 4 -) - -var ( - RxMode_name = map[uint32]string{ - 0: "RX_MODE_API_UNKNOWN", - 1: "RX_MODE_API_POLLING", - 2: "RX_MODE_API_INTERRUPT", - 3: "RX_MODE_API_ADAPTIVE", - 4: "RX_MODE_API_DEFAULT", - } - RxMode_value = map[string]uint32{ - "RX_MODE_API_UNKNOWN": 0, - "RX_MODE_API_POLLING": 1, - "RX_MODE_API_INTERRUPT": 2, - "RX_MODE_API_ADAPTIVE": 3, - "RX_MODE_API_DEFAULT": 4, - } -) - -func (x RxMode) String() string { - s, ok := RxMode_name[uint32(x)] - if ok { - return s - } - return "RxMode(" + strconv.Itoa(int(x)) + ")" -} - -// SubIfFlags represents VPP binary API enum 'sub_if_flags'. -type SubIfFlags uint32 - -const ( - SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 - SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 - SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 - SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 - SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 - SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 - SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 - SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 - SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 - SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 -) +type MtuProto = interface_types.MtuProto -var ( - SubIfFlags_name = map[uint32]string{ - 1: "SUB_IF_API_FLAG_NO_TAGS", - 2: "SUB_IF_API_FLAG_ONE_TAG", - 4: "SUB_IF_API_FLAG_TWO_TAGS", - 8: "SUB_IF_API_FLAG_DOT1AD", - 16: "SUB_IF_API_FLAG_EXACT_MATCH", - 32: "SUB_IF_API_FLAG_DEFAULT", - 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", - 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", - 254: "SUB_IF_API_FLAG_MASK_VNET", - 256: "SUB_IF_API_FLAG_DOT1AH", - } - SubIfFlags_value = map[string]uint32{ - "SUB_IF_API_FLAG_NO_TAGS": 1, - "SUB_IF_API_FLAG_ONE_TAG": 2, - "SUB_IF_API_FLAG_TWO_TAGS": 4, - "SUB_IF_API_FLAG_DOT1AD": 8, - "SUB_IF_API_FLAG_EXACT_MATCH": 16, - "SUB_IF_API_FLAG_DEFAULT": 32, - "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, - "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, - "SUB_IF_API_FLAG_MASK_VNET": 254, - "SUB_IF_API_FLAG_DOT1AH": 256, - } -) +type RxMode = interface_types.RxMode -func (x SubIfFlags) String() string { - s, ok := SubIfFlags_name[uint32(x)] - if ok { - return s - } - return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" -} +type SubIfFlags = interface_types.SubIfFlags -// AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. -type AddressWithPrefix Prefix +type AddressWithPrefix = fib_types.AddressWithPrefix -// InterfaceIndex represents VPP binary API alias 'interface_index'. -type InterfaceIndex uint32 +type InterfaceIndex = interface_types.InterfaceIndex -// IP4Address represents VPP binary API alias 'ip4_address'. -type IP4Address [4]uint8 +type IP4Address = fib_types.IP4Address -// IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'. -type IP4AddressWithPrefix IP4Prefix +type IP4AddressWithPrefix = fib_types.IP4AddressWithPrefix -// IP6Address represents VPP binary API alias 'ip6_address'. -type IP6Address [16]uint8 +type IP6Address = fib_types.IP6Address -// IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'. -type IP6AddressWithPrefix IP6Prefix +type IP6AddressWithPrefix = fib_types.IP6AddressWithPrefix // MacAddress represents VPP binary API alias 'mac_address'. type MacAddress [6]uint8 -// Address represents VPP binary API type 'address'. -type Address struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` -} - -func (*Address) GetTypeName() string { return "address" } - -// FibMplsLabel represents VPP binary API type 'fib_mpls_label'. -type FibMplsLabel struct { - IsUniform uint8 `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"` - Label uint32 `binapi:"u32,name=label" json:"label,omitempty"` - TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"` - Exp uint8 `binapi:"u8,name=exp" json:"exp,omitempty"` -} - -func (*FibMplsLabel) GetTypeName() string { return "fib_mpls_label" } - -// FibPath represents VPP binary API type 'fib_path'. -type FibPath struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` - Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` - Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` - Type FibPathType `binapi:"fib_path_type,name=type" json:"type,omitempty"` - Flags FibPathFlags `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"` - Proto FibPathNhProto `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"` - Nh FibPathNh `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"` - NLabels uint8 `binapi:"u8,name=n_labels" json:"n_labels,omitempty"` - LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty" struc:"[16]FibMplsLabel"` -} - -func (*FibPath) GetTypeName() string { return "fib_path" } +type Address = fib_types.Address -// FibPathNh represents VPP binary API type 'fib_path_nh'. -type FibPathNh struct { - Address AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"` - ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"` - ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"` - ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"` -} - -func (*FibPathNh) GetTypeName() string { return "fib_path_nh" } +type FibMplsLabel = fib_types.FibMplsLabel -// IP4Prefix represents VPP binary API type 'ip4_prefix'. -type IP4Prefix struct { - Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} +type FibPath = fib_types.FibPath -func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" } +type FibPathNh = fib_types.FibPathNh -// IP6Prefix represents VPP binary API type 'ip6_prefix'. -type IP6Prefix struct { - Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} +type IP4Prefix = fib_types.IP4Prefix -func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" } +type IP6Prefix = fib_types.IP6Prefix // IPMroute represents VPP binary API type 'ip_mroute'. type IPMroute struct { @@ -769,31 +206,11 @@ type MfibPath struct { func (*MfibPath) GetTypeName() string { return "mfib_path" } -// Mprefix represents VPP binary API type 'mprefix'. -type Mprefix struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` - GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` - SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` -} - -func (*Mprefix) GetTypeName() string { return "mprefix" } - -// Prefix represents VPP binary API type 'prefix'. -type Prefix struct { - Address Address `binapi:"address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*Prefix) GetTypeName() string { return "prefix" } +type Mprefix = fib_types.Mprefix -// PrefixMatcher represents VPP binary API type 'prefix_matcher'. -type PrefixMatcher struct { - Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` - Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` -} +type Prefix = fib_types.Prefix -func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" } +type PrefixMatcher = fib_types.PrefixMatcher // PuntRedirect represents VPP binary API type 'punt_redirect'. type PuntRedirect struct { @@ -804,46 +221,7 @@ type PuntRedirect struct { func (*PuntRedirect) GetTypeName() string { return "punt_redirect" } -// AddressUnion represents VPP binary API union 'address_union'. -type AddressUnion struct { - XXX_UnionData [16]byte -} - -func (*AddressUnion) GetTypeName() string { return "address_union" } - -func AddressUnionIP4(a IP4Address) (u AddressUnion) { - u.SetIP4(a) - return -} -func (u *AddressUnion) SetIP4(a IP4Address) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.XXX_UnionData[:], b.Bytes()) -} -func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.XXX_UnionData[:]) - struc.Unpack(b, &a) - return -} - -func AddressUnionIP6(a IP6Address) (u AddressUnion) { - u.SetIP6(a) - return -} -func (u *AddressUnion) SetIP6(a IP6Address) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.XXX_UnionData[:], b.Bytes()) -} -func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.XXX_UnionData[:]) - struc.Unpack(b, &a) - return -} +type AddressUnion = fib_types.AddressUnion // IoamDisable represents VPP binary API message 'ioam_disable'. type IoamDisable struct { @@ -1103,7 +481,7 @@ func (m *IPAddressDetails) Size() int { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - size += 4 + size += 1 // field[3] m.Prefix.Address.Un size += 16 // field[2] m.Prefix.Len @@ -1127,8 +505,8 @@ func (m *IPAddressDetails) Marshal(b []byte) ([]byte, error) { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) - pos += 4 + buf[pos] = uint8(m.Prefix.Address.Af) + pos += 1 // field[3] m.Prefix.Address.Un copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) pos += 16 @@ -1148,8 +526,8 @@ func (m *IPAddressDetails) Unmarshal(tmp []byte) error { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 + m.Prefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 // field[3] m.Prefix.Address.Un copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) pos += 16 @@ -1236,7 +614,7 @@ func (m *IPContainerProxyAddDel) Size() int { // field[1] m.Pfx // field[2] m.Pfx.Address // field[3] m.Pfx.Address.Af - size += 4 + size += 1 // field[3] m.Pfx.Address.Un size += 16 // field[2] m.Pfx.Len @@ -1261,8 +639,8 @@ func (m *IPContainerProxyAddDel) Marshal(b []byte) ([]byte, error) { // field[1] m.Pfx // field[2] m.Pfx.Address // field[3] m.Pfx.Address.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Pfx.Address.Af)) - pos += 4 + buf[pos] = uint8(m.Pfx.Address.Af) + pos += 1 // field[3] m.Pfx.Address.Un copy(buf[pos:pos+16], m.Pfx.Address.Un.XXX_UnionData[:]) pos += 16 @@ -1287,8 +665,8 @@ func (m *IPContainerProxyAddDel) Unmarshal(tmp []byte) error { // field[1] m.Pfx // field[2] m.Pfx.Address // field[3] m.Pfx.Address.Af - m.Pfx.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 + m.Pfx.Address.Af = AddressFamily(tmp[pos]) + pos += 1 // field[3] m.Pfx.Address.Un copy(m.Pfx.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) pos += 16 @@ -1373,7 +751,7 @@ func (m *IPContainerProxyDetails) Size() int { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - size += 4 + size += 1 // field[3] m.Prefix.Address.Un size += 16 // field[2] m.Prefix.Len @@ -1397,8 +775,8 @@ func (m *IPContainerProxyDetails) Marshal(b []byte) ([]byte, error) { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) - pos += 4 + buf[pos] = uint8(m.Prefix.Address.Af) + pos += 1 // field[3] m.Prefix.Address.Un copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) pos += 16 @@ -1418,8 +796,8 @@ func (m *IPContainerProxyDetails) Unmarshal(tmp []byte) error { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 + m.Prefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 // field[3] m.Prefix.Address.Un copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) pos += 16 @@ -1600,7 +978,7 @@ func (m *IPMrouteAddDel) Size() int { size += 4 // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Af - size += 4 + size += 1 // field[3] m.Route.Prefix.GrpAddressLength size += 2 // field[3] m.Route.Prefix.GrpAddress @@ -1698,8 +1076,8 @@ func (m *IPMrouteAddDel) Marshal(b []byte) ([]byte, error) { pos += 4 // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Af)) - pos += 4 + buf[pos] = uint8(m.Route.Prefix.Af) + pos += 1 // field[3] m.Route.Prefix.GrpAddressLength o.PutUint16(buf[pos:pos+2], uint16(m.Route.Prefix.GrpAddressLength)) pos += 2 @@ -1807,8 +1185,8 @@ func (m *IPMrouteAddDel) Unmarshal(tmp []byte) error { pos += 4 // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Af - m.Route.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 + m.Route.Prefix.Af = AddressFamily(tmp[pos]) + pos += 1 // field[3] m.Route.Prefix.GrpAddressLength m.Route.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) pos += 2 @@ -1966,7 +1344,7 @@ func (m *IPMrouteDetails) Size() int { size += 4 // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Af - size += 4 + size += 1 // field[3] m.Route.Prefix.GrpAddressLength size += 2 // field[3] m.Route.Prefix.GrpAddress @@ -2054,8 +1432,8 @@ func (m *IPMrouteDetails) Marshal(b []byte) ([]byte, error) { pos += 4 // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Af)) - pos += 4 + buf[pos] = uint8(m.Route.Prefix.Af) + pos += 1 // field[3] m.Route.Prefix.GrpAddressLength o.PutUint16(buf[pos:pos+2], uint16(m.Route.Prefix.GrpAddressLength)) pos += 2 @@ -2157,8 +1535,8 @@ func (m *IPMrouteDetails) Unmarshal(tmp []byte) error { pos += 4 // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Af - m.Route.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 + m.Route.Prefix.Af = AddressFamily(tmp[pos]) + pos += 1 // field[3] m.Route.Prefix.GrpAddressLength m.Route.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) pos += 2 @@ -2550,7 +1928,7 @@ func (m *IPPuntRedirect) Size() int { size += 4 // field[2] m.Punt.Nh // field[3] m.Punt.Nh.Af - size += 4 + size += 1 // field[3] m.Punt.Nh.Un size += 16 // field[1] m.IsAdd @@ -2577,8 +1955,8 @@ func (m *IPPuntRedirect) Marshal(b []byte) ([]byte, error) { pos += 4 // field[2] m.Punt.Nh // field[3] m.Punt.Nh.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Punt.Nh.Af)) - pos += 4 + buf[pos] = uint8(m.Punt.Nh.Af) + pos += 1 // field[3] m.Punt.Nh.Un copy(buf[pos:pos+16], m.Punt.Nh.Un.XXX_UnionData[:]) pos += 16 @@ -2603,8 +1981,8 @@ func (m *IPPuntRedirect) Unmarshal(tmp []byte) error { pos += 4 // field[2] m.Punt.Nh // field[3] m.Punt.Nh.Af - m.Punt.Nh.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 + m.Punt.Nh.Af = AddressFamily(tmp[pos]) + pos += 1 // field[3] m.Punt.Nh.Un copy(m.Punt.Nh.Un.XXX_UnionData[:], tmp[pos:pos+16]) pos += 16 @@ -2636,7 +2014,7 @@ func (m *IPPuntRedirectDetails) Size() int { size += 4 // field[2] m.Punt.Nh // field[3] m.Punt.Nh.Af - size += 4 + size += 1 // field[3] m.Punt.Nh.Un size += 16 return size @@ -2661,8 +2039,8 @@ func (m *IPPuntRedirectDetails) Marshal(b []byte) ([]byte, error) { pos += 4 // field[2] m.Punt.Nh // field[3] m.Punt.Nh.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Punt.Nh.Af)) - pos += 4 + buf[pos] = uint8(m.Punt.Nh.Af) + pos += 1 // field[3] m.Punt.Nh.Un copy(buf[pos:pos+16], m.Punt.Nh.Un.XXX_UnionData[:]) pos += 16 @@ -2682,8 +2060,8 @@ func (m *IPPuntRedirectDetails) Unmarshal(tmp []byte) error { pos += 4 // field[2] m.Punt.Nh // field[3] m.Punt.Nh.Af - m.Punt.Nh.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 + m.Punt.Nh.Af = AddressFamily(tmp[pos]) + pos += 1 // field[3] m.Punt.Nh.Un copy(m.Punt.Nh.Un.XXX_UnionData[:], tmp[pos:pos+16]) pos += 16 @@ -3236,7 +2614,7 @@ func (m *IPRouteAddDel) Size() int { // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Address // field[4] m.Route.Prefix.Address.Af - size += 4 + size += 1 // field[4] m.Route.Prefix.Address.Un size += 16 // field[3] m.Route.Prefix.Len @@ -3327,8 +2705,8 @@ func (m *IPRouteAddDel) Marshal(b []byte) ([]byte, error) { // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Address // field[4] m.Route.Prefix.Address.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Address.Af)) - pos += 4 + buf[pos] = uint8(m.Route.Prefix.Address.Af) + pos += 1 // field[4] m.Route.Prefix.Address.Un copy(buf[pos:pos+16], m.Route.Prefix.Address.Un.XXX_UnionData[:]) pos += 16 @@ -3427,8 +2805,8 @@ func (m *IPRouteAddDel) Unmarshal(tmp []byte) error { // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Address // field[4] m.Route.Prefix.Address.Af - m.Route.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 + m.Route.Prefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 // field[4] m.Route.Prefix.Address.Un copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) pos += 16 @@ -3578,7 +2956,7 @@ func (m *IPRouteDetails) Size() int { // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Address // field[4] m.Route.Prefix.Address.Af - size += 4 + size += 1 // field[4] m.Route.Prefix.Address.Un size += 16 // field[3] m.Route.Prefix.Len @@ -3659,8 +3037,8 @@ func (m *IPRouteDetails) Marshal(b []byte) ([]byte, error) { // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Address // field[4] m.Route.Prefix.Address.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Address.Af)) - pos += 4 + buf[pos] = uint8(m.Route.Prefix.Address.Af) + pos += 1 // field[4] m.Route.Prefix.Address.Un copy(buf[pos:pos+16], m.Route.Prefix.Address.Un.XXX_UnionData[:]) pos += 16 @@ -3753,8 +3131,8 @@ func (m *IPRouteDetails) Unmarshal(tmp []byte) error { // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Address // field[4] m.Route.Prefix.Address.Af - m.Route.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 + m.Route.Prefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 // field[4] m.Route.Prefix.Address.Un copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) pos += 16 @@ -3896,19 +3274,385 @@ func (m *IPRouteDump) Unmarshal(tmp []byte) error { return nil } -// IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del'. -type IPSourceAndPortRangeCheckAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` - NumberOfRanges uint8 `binapi:"u8,name=number_of_ranges" json:"number_of_ranges,omitempty"` - LowPorts []uint16 `binapi:"u16[32],name=low_ports" json:"low_ports,omitempty" struc:"[32]uint16"` - HighPorts []uint16 `binapi:"u16[32],name=high_ports" json:"high_ports,omitempty" struc:"[32]uint16"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +// IPRouteLookup represents VPP binary API message 'ip_route_lookup'. +type IPRouteLookup struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Exact uint8 `binapi:"u8,name=exact" json:"exact,omitempty"` + Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` } -func (m *IPSourceAndPortRangeCheckAddDel) Reset() { *m = IPSourceAndPortRangeCheckAddDel{} } -func (*IPSourceAndPortRangeCheckAddDel) GetMessageName() string { - return "ip_source_and_port_range_check_add_del" +func (m *IPRouteLookup) Reset() { *m = IPRouteLookup{} } +func (*IPRouteLookup) GetMessageName() string { return "ip_route_lookup" } +func (*IPRouteLookup) GetCrcString() string { return "e2986185" } +func (*IPRouteLookup) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPRouteLookup) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.TableID + size += 4 + // field[1] m.Exact + size += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 1 + // field[3] m.Prefix.Address.Un + size += 16 + // field[2] m.Prefix.Len + size += 1 + return size +} +func (m *IPRouteLookup) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.TableID)) + pos += 4 + // field[1] m.Exact + buf[pos] = uint8(m.Exact) + pos += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + buf[pos] = uint8(m.Prefix.Address.Af) + pos += 1 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 + return buf, nil +} +func (m *IPRouteLookup) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.TableID + m.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Exact + m.Exact = uint8(tmp[pos]) + pos += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 + return nil +} + +// IPRouteLookupReply represents VPP binary API message 'ip_route_lookup_reply'. +type IPRouteLookupReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` +} + +func (m *IPRouteLookupReply) Reset() { *m = IPRouteLookupReply{} } +func (*IPRouteLookupReply) GetMessageName() string { return "ip_route_lookup_reply" } +func (*IPRouteLookupReply) GetCrcString() string { return "ae99de8e" } +func (*IPRouteLookupReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPRouteLookupReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.Route + // field[2] m.Route.TableID + size += 4 + // field[2] m.Route.StatsIndex + size += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + size += 1 + // field[4] m.Route.Prefix.Address.Un + size += 16 + // field[3] m.Route.Prefix.Len + size += 1 + // field[2] m.Route.NPaths + size += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 FibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + // field[3] s2.SwIfIndex + size += 4 + // field[3] s2.TableID + size += 4 + // field[3] s2.RpfID + size += 4 + // field[3] s2.Weight + size += 1 + // field[3] s2.Preference + size += 1 + // field[3] s2.Type + size += 4 + // field[3] s2.Flags + size += 4 + // field[3] s2.Proto + size += 4 + // field[3] s2.Nh + // field[4] s2.Nh.Address + size += 16 + // field[4] s2.Nh.ViaLabel + size += 4 + // field[4] s2.Nh.ObjID + size += 4 + // field[4] s2.Nh.ClassifyTableIndex + size += 4 + // field[3] s2.NLabels + size += 1 + // field[3] s2.LabelStack + for j3 := 0; j3 < 16; j3++ { + var s3 FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + // field[4] s3.IsUniform + size += 1 + // field[4] s3.Label + size += 4 + // field[4] s3.TTL + size += 1 + // field[4] s3.Exp + size += 1 + } + } + return size +} +func (m *IPRouteLookupReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.Route + // field[2] m.Route.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) + pos += 4 + // field[2] m.Route.StatsIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Route.StatsIndex)) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + buf[pos] = uint8(m.Route.Prefix.Address.Af) + pos += 1 + // field[4] m.Route.Prefix.Address.Un + copy(buf[pos:pos+16], m.Route.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] m.Route.Prefix.Len + buf[pos] = uint8(m.Route.Prefix.Len) + pos += 1 + // field[2] m.Route.NPaths + buf[pos] = uint8(len(m.Route.Paths)) + pos += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var v2 FibPath + if j2 < len(m.Route.Paths) { + v2 = m.Route.Paths[j2] + } + // field[3] v2.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.SwIfIndex)) + pos += 4 + // field[3] v2.TableID + o.PutUint32(buf[pos:pos+4], uint32(v2.TableID)) + pos += 4 + // field[3] v2.RpfID + o.PutUint32(buf[pos:pos+4], uint32(v2.RpfID)) + pos += 4 + // field[3] v2.Weight + buf[pos] = uint8(v2.Weight) + pos += 1 + // field[3] v2.Preference + buf[pos] = uint8(v2.Preference) + pos += 1 + // field[3] v2.Type + o.PutUint32(buf[pos:pos+4], uint32(v2.Type)) + pos += 4 + // field[3] v2.Flags + o.PutUint32(buf[pos:pos+4], uint32(v2.Flags)) + pos += 4 + // field[3] v2.Proto + o.PutUint32(buf[pos:pos+4], uint32(v2.Proto)) + pos += 4 + // field[3] v2.Nh + // field[4] v2.Nh.Address + copy(buf[pos:pos+16], v2.Nh.Address.XXX_UnionData[:]) + pos += 16 + // field[4] v2.Nh.ViaLabel + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ViaLabel)) + pos += 4 + // field[4] v2.Nh.ObjID + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ObjID)) + pos += 4 + // field[4] v2.Nh.ClassifyTableIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ClassifyTableIndex)) + pos += 4 + // field[3] v2.NLabels + buf[pos] = uint8(v2.NLabels) + pos += 1 + // field[3] v2.LabelStack + for j3 := 0; j3 < 16; j3++ { + var v3 FibMplsLabel + if j3 < len(v2.LabelStack) { + v3 = v2.LabelStack[j3] + } + // field[4] v3.IsUniform + buf[pos] = uint8(v3.IsUniform) + pos += 1 + // field[4] v3.Label + o.PutUint32(buf[pos:pos+4], uint32(v3.Label)) + pos += 4 + // field[4] v3.TTL + buf[pos] = uint8(v3.TTL) + pos += 1 + // field[4] v3.Exp + buf[pos] = uint8(v3.Exp) + pos += 1 + } + } + return buf, nil +} +func (m *IPRouteLookupReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Route + // field[2] m.Route.TableID + m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.StatsIndex + m.Route.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + m.Route.Prefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 + // field[4] m.Route.Prefix.Address.Un + copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.Route.Prefix.Len + m.Route.Prefix.Len = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.NPaths + m.Route.NPaths = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.Paths + m.Route.Paths = make([]FibPath, int(m.Route.NPaths)) + for j2 := 0; j2 < int(m.Route.NPaths); j2++ { + // field[3] m.Route.Paths[j2].SwIfIndex + m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].TableID + m.Route.Paths[j2].TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].RpfID + m.Route.Paths[j2].RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Weight + m.Route.Paths[j2].Weight = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].Preference + m.Route.Paths[j2].Preference = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].Type + m.Route.Paths[j2].Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Flags + m.Route.Paths[j2].Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Proto + m.Route.Paths[j2].Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Nh + // field[4] m.Route.Paths[j2].Nh.Address + copy(m.Route.Paths[j2].Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[4] m.Route.Paths[j2].Nh.ViaLabel + m.Route.Paths[j2].Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Nh.ObjID + m.Route.Paths[j2].Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Nh.ClassifyTableIndex + m.Route.Paths[j2].Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].NLabels + m.Route.Paths[j2].NLabels = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].LabelStack + for j3 := 0; j3 < 16; j3++ { + // field[4] m.Route.Paths[j2].LabelStack[j3].IsUniform + m.Route.Paths[j2].LabelStack[j3].IsUniform = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].LabelStack[j3].Label + m.Route.Paths[j2].LabelStack[j3].Label = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].LabelStack[j3].TTL + m.Route.Paths[j2].LabelStack[j3].TTL = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].LabelStack[j3].Exp + m.Route.Paths[j2].LabelStack[j3].Exp = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del'. +type IPSourceAndPortRangeCheckAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + NumberOfRanges uint8 `binapi:"u8,name=number_of_ranges" json:"number_of_ranges,omitempty"` + LowPorts []uint16 `binapi:"u16[32],name=low_ports" json:"low_ports,omitempty" struc:"[32]uint16"` + HighPorts []uint16 `binapi:"u16[32],name=high_ports" json:"high_ports,omitempty" struc:"[32]uint16"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *IPSourceAndPortRangeCheckAddDel) Reset() { *m = IPSourceAndPortRangeCheckAddDel{} } +func (*IPSourceAndPortRangeCheckAddDel) GetMessageName() string { + return "ip_source_and_port_range_check_add_del" } func (*IPSourceAndPortRangeCheckAddDel) GetCrcString() string { return "8bfc76f2" } func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType { return api.RequestMessage } @@ -3923,7 +3667,7 @@ func (m *IPSourceAndPortRangeCheckAddDel) Size() int { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - size += 4 + size += 1 // field[3] m.Prefix.Address.Un size += 16 // field[2] m.Prefix.Len @@ -3957,8 +3701,8 @@ func (m *IPSourceAndPortRangeCheckAddDel) Marshal(b []byte) ([]byte, error) { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) - pos += 4 + buf[pos] = uint8(m.Prefix.Address.Af) + pos += 1 // field[3] m.Prefix.Address.Un copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) pos += 16 @@ -4002,8 +3746,8 @@ func (m *IPSourceAndPortRangeCheckAddDel) Unmarshal(tmp []byte) error { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 + m.Prefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 // field[3] m.Prefix.Address.Un copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) pos += 16 @@ -4232,124 +3976,6 @@ func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Unmarshal(tmp []byte) er return nil } -// IPSourceCheckInterfaceAddDel represents VPP binary API message 'ip_source_check_interface_add_del'. -type IPSourceCheckInterfaceAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - Loose bool `binapi:"bool,name=loose" json:"loose,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *IPSourceCheckInterfaceAddDel) Reset() { *m = IPSourceCheckInterfaceAddDel{} } -func (*IPSourceCheckInterfaceAddDel) GetMessageName() string { - return "ip_source_check_interface_add_del" -} -func (*IPSourceCheckInterfaceAddDel) GetCrcString() string { return "6612356b" } -func (*IPSourceCheckInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPSourceCheckInterfaceAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.Loose - size += 1 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *IPSourceCheckInterfaceAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Loose - if m.Loose { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *IPSourceCheckInterfaceAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.Loose - m.Loose = tmp[pos] != 0 - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPSourceCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_check_interface_add_del_reply'. -type IPSourceCheckInterfaceAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPSourceCheckInterfaceAddDelReply) Reset() { *m = IPSourceCheckInterfaceAddDelReply{} } -func (*IPSourceCheckInterfaceAddDelReply) GetMessageName() string { - return "ip_source_check_interface_add_del_reply" -} -func (*IPSourceCheckInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*IPSourceCheckInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPSourceCheckInterfaceAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPSourceCheckInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPSourceCheckInterfaceAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - // IPTableAddDel represents VPP binary API message 'ip_table_add_del'. type IPTableAddDel struct { IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` @@ -4988,7 +4614,7 @@ func (m *IPUnnumberedDetails) Unmarshal(tmp []byte) error { // IPUnnumberedDump represents VPP binary API message 'ip_unnumbered_dump'. type IPUnnumberedDump struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` } func (m *IPUnnumberedDump) Reset() { *m = IPUnnumberedDump{} } @@ -5057,7 +4683,7 @@ func (m *MfibSignalDetails) Size() int { size += 4 // field[1] m.Prefix // field[2] m.Prefix.Af - size += 4 + size += 1 // field[2] m.Prefix.GrpAddressLength size += 2 // field[2] m.Prefix.GrpAddress @@ -5089,8 +4715,8 @@ func (m *MfibSignalDetails) Marshal(b []byte) ([]byte, error) { pos += 4 // field[1] m.Prefix // field[2] m.Prefix.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Af)) - pos += 4 + buf[pos] = uint8(m.Prefix.Af) + pos += 1 // field[2] m.Prefix.GrpAddressLength o.PutUint16(buf[pos:pos+2], uint16(m.Prefix.GrpAddressLength)) pos += 2 @@ -5127,8 +4753,8 @@ func (m *MfibSignalDetails) Unmarshal(tmp []byte) error { pos += 4 // field[1] m.Prefix // field[2] m.Prefix.Af - m.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 + m.Prefix.Af = AddressFamily(tmp[pos]) + pos += 1 // field[2] m.Prefix.GrpAddressLength m.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) pos += 2 @@ -5624,12 +5250,12 @@ func file_ip_binapi_init() { api.RegisterMessage((*IPRouteAddDelReply)(nil), "ip.IPRouteAddDelReply") api.RegisterMessage((*IPRouteDetails)(nil), "ip.IPRouteDetails") api.RegisterMessage((*IPRouteDump)(nil), "ip.IPRouteDump") + api.RegisterMessage((*IPRouteLookup)(nil), "ip.IPRouteLookup") + api.RegisterMessage((*IPRouteLookupReply)(nil), "ip.IPRouteLookupReply") api.RegisterMessage((*IPSourceAndPortRangeCheckAddDel)(nil), "ip.IPSourceAndPortRangeCheckAddDel") api.RegisterMessage((*IPSourceAndPortRangeCheckAddDelReply)(nil), "ip.IPSourceAndPortRangeCheckAddDelReply") api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), "ip.IPSourceAndPortRangeCheckInterfaceAddDel") api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), "ip.IPSourceAndPortRangeCheckInterfaceAddDelReply") - api.RegisterMessage((*IPSourceCheckInterfaceAddDel)(nil), "ip.IPSourceCheckInterfaceAddDel") - api.RegisterMessage((*IPSourceCheckInterfaceAddDelReply)(nil), "ip.IPSourceCheckInterfaceAddDelReply") api.RegisterMessage((*IPTableAddDel)(nil), "ip.IPTableAddDel") api.RegisterMessage((*IPTableAddDelReply)(nil), "ip.IPTableAddDelReply") api.RegisterMessage((*IPTableDetails)(nil), "ip.IPTableDetails") @@ -5689,12 +5315,12 @@ func AllMessages() []api.Message { (*IPRouteAddDelReply)(nil), (*IPRouteDetails)(nil), (*IPRouteDump)(nil), + (*IPRouteLookup)(nil), + (*IPRouteLookupReply)(nil), (*IPSourceAndPortRangeCheckAddDel)(nil), (*IPSourceAndPortRangeCheckAddDelReply)(nil), (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), - (*IPSourceCheckInterfaceAddDel)(nil), - (*IPSourceCheckInterfaceAddDelReply)(nil), (*IPTableAddDel)(nil), (*IPTableAddDelReply)(nil), (*IPTableDetails)(nil), diff --git a/examples/binapi/ip/ip_rpc.ba.go b/examples/binapi/ip/ip_rpc.ba.go index e0580d5..d1bbd08 100644 --- a/examples/binapi/ip/ip_rpc.ba.go +++ b/examples/binapi/ip/ip_rpc.ba.go @@ -31,9 +31,9 @@ type RPCService interface { IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) + IPRouteLookup(ctx context.Context, in *IPRouteLookup) (*IPRouteLookupReply, error) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) - IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) @@ -401,8 +401,8 @@ func (c *serviceClient) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (* return out, nil } -func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) { - out := new(IPSourceAndPortRangeCheckAddDelReply) +func (c *serviceClient) IPRouteLookup(ctx context.Context, in *IPRouteLookup) (*IPRouteLookupReply, error) { + out := new(IPRouteLookupReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { return nil, err @@ -410,8 +410,8 @@ func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in return out, nil } -func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) { - out := new(IPSourceAndPortRangeCheckInterfaceAddDelReply) +func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckAddDelReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { return nil, err @@ -419,8 +419,8 @@ func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Con return out, nil } -func (c *serviceClient) IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) { - out := new(IPSourceCheckInterfaceAddDelReply) +func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckInterfaceAddDelReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { return nil, err diff --git a/examples/binapi/ip_types/ip_types.ba.go b/examples/binapi/ip_types/ip_types.ba.go index 9335060..23ae315 100644 --- a/examples/binapi/ip_types/ip_types.ba.go +++ b/examples/binapi/ip_types/ip_types.ba.go @@ -1,11 +1,11 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty -// VPP: 20.01-45~g7a071e370~b63 +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release // source: /usr/share/vpp/api/core/ip_types.api.json /* -Package ip_types contains generated code for VPP binary API defined by ip_types.api (version 3.0.0). +Package ip_types contains generated code for VPP API file ip_types.api (3.0.0). It consists of: 5 aliases @@ -40,11 +40,11 @@ const ( // APIVersion is the API version of this module. APIVersion = "3.0.0" // VersionCrc is the CRC of this module. - VersionCrc = 0x80424562 + VersionCrc = 0x9cb1c2e2 ) // AddressFamily represents VPP binary API enum 'address_family'. -type AddressFamily uint32 +type AddressFamily uint8 const ( ADDRESS_IP4 AddressFamily = 0 @@ -52,18 +52,18 @@ const ( ) var ( - AddressFamily_name = map[uint32]string{ + AddressFamily_name = map[uint8]string{ 0: "ADDRESS_IP4", 1: "ADDRESS_IP6", } - AddressFamily_value = map[string]uint32{ + AddressFamily_value = map[string]uint8{ "ADDRESS_IP4": 0, "ADDRESS_IP6": 1, } ) func (x AddressFamily) String() string { - s, ok := AddressFamily_name[uint32(x)] + s, ok := AddressFamily_name[uint8(x)] if ok { return s } @@ -188,7 +188,7 @@ func (x IPEcn) String() string { } // IPProto represents VPP binary API enum 'ip_proto'. -type IPProto uint32 +type IPProto uint8 const ( IP_API_PROTO_HOPOPT IPProto = 0 @@ -197,8 +197,9 @@ const ( IP_API_PROTO_TCP IPProto = 6 IP_API_PROTO_UDP IPProto = 17 IP_API_PROTO_GRE IPProto = 47 - IP_API_PROTO_AH IPProto = 50 - IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_ESP IPProto = 50 + IP_API_PROTO_AH IPProto = 51 + IP_API_PROTO_ICMP6 IPProto = 58 IP_API_PROTO_EIGRP IPProto = 88 IP_API_PROTO_OSPF IPProto = 89 IP_API_PROTO_SCTP IPProto = 132 @@ -206,29 +207,31 @@ const ( ) var ( - IPProto_name = map[uint32]string{ + IPProto_name = map[uint8]string{ 0: "IP_API_PROTO_HOPOPT", 1: "IP_API_PROTO_ICMP", 2: "IP_API_PROTO_IGMP", 6: "IP_API_PROTO_TCP", 17: "IP_API_PROTO_UDP", 47: "IP_API_PROTO_GRE", - 50: "IP_API_PROTO_AH", - 51: "IP_API_PROTO_ESP", + 50: "IP_API_PROTO_ESP", + 51: "IP_API_PROTO_AH", + 58: "IP_API_PROTO_ICMP6", 88: "IP_API_PROTO_EIGRP", 89: "IP_API_PROTO_OSPF", 132: "IP_API_PROTO_SCTP", 255: "IP_API_PROTO_RESERVED", } - IPProto_value = map[string]uint32{ + IPProto_value = map[string]uint8{ "IP_API_PROTO_HOPOPT": 0, "IP_API_PROTO_ICMP": 1, "IP_API_PROTO_IGMP": 2, "IP_API_PROTO_TCP": 6, "IP_API_PROTO_UDP": 17, "IP_API_PROTO_GRE": 47, - "IP_API_PROTO_AH": 50, - "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_ESP": 50, + "IP_API_PROTO_AH": 51, + "IP_API_PROTO_ICMP6": 58, "IP_API_PROTO_EIGRP": 88, "IP_API_PROTO_OSPF": 89, "IP_API_PROTO_SCTP": 132, @@ -237,7 +240,7 @@ var ( ) func (x IPProto) String() string { - s, ok := IPProto_name[uint32(x)] + s, ok := IPProto_name[uint8(x)] if ok { return s } diff --git a/examples/binapi/memclnt/memclnt.ba.go b/examples/binapi/memclnt/memclnt.ba.go index c6b1256..d57cc6c 100644 --- a/examples/binapi/memclnt/memclnt.ba.go +++ b/examples/binapi/memclnt/memclnt.ba.go @@ -1,11 +1,11 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty -// VPP: 20.01-45~g7a071e370~b63 +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release // source: /usr/share/vpp/api/core/memclnt.api.json /* -Package memclnt contains generated code for VPP binary API defined by memclnt.api (version 2.1.0). +Package memclnt contains generated code for VPP API file memclnt.api (2.1.0). It consists of: 22 messages diff --git a/examples/binapi/memif/memif.ba.go b/examples/binapi/memif/memif.ba.go index 60aadf3..4fe2f75 100644 --- a/examples/binapi/memif/memif.ba.go +++ b/examples/binapi/memif/memif.ba.go @@ -1,11 +1,11 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty -// VPP: 20.01-45~g7a071e370~b63 +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release // source: /usr/share/vpp/api/plugins/memif.api.json /* -Package memif contains generated code for VPP binary API defined by memif.api (version 3.0.0). +Package memif contains generated code for VPP API file memif.api (3.0.0). It consists of: 2 aliases @@ -25,6 +25,8 @@ import ( api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" + + interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" ) // This is a compile-time assertion to ensure that this generated file @@ -39,98 +41,14 @@ const ( // APIVersion is the API version of this module. APIVersion = "3.0.0" // VersionCrc is the CRC of this module. - VersionCrc = 0x88dc56c9 -) - -// IfStatusFlags represents VPP binary API enum 'if_status_flags'. -type IfStatusFlags uint32 - -const ( - IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 - IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 -) - -var ( - IfStatusFlags_name = map[uint32]string{ - 1: "IF_STATUS_API_FLAG_ADMIN_UP", - 2: "IF_STATUS_API_FLAG_LINK_UP", - } - IfStatusFlags_value = map[string]uint32{ - "IF_STATUS_API_FLAG_ADMIN_UP": 1, - "IF_STATUS_API_FLAG_LINK_UP": 2, - } -) - -func (x IfStatusFlags) String() string { - s, ok := IfStatusFlags_name[uint32(x)] - if ok { - return s - } - return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" -} - -// IfType represents VPP binary API enum 'if_type'. -type IfType uint32 - -const ( - IF_API_TYPE_HARDWARE IfType = 1 - IF_API_TYPE_SUB IfType = 2 - IF_API_TYPE_P2P IfType = 3 - IF_API_TYPE_PIPE IfType = 4 -) - -var ( - IfType_name = map[uint32]string{ - 1: "IF_API_TYPE_HARDWARE", - 2: "IF_API_TYPE_SUB", - 3: "IF_API_TYPE_P2P", - 4: "IF_API_TYPE_PIPE", - } - IfType_value = map[string]uint32{ - "IF_API_TYPE_HARDWARE": 1, - "IF_API_TYPE_SUB": 2, - "IF_API_TYPE_P2P": 3, - "IF_API_TYPE_PIPE": 4, - } + VersionCrc = 0x1a1c95b8 ) -func (x IfType) String() string { - s, ok := IfType_name[uint32(x)] - if ok { - return s - } - return "IfType(" + strconv.Itoa(int(x)) + ")" -} - -// LinkDuplex represents VPP binary API enum 'link_duplex'. -type LinkDuplex uint32 - -const ( - LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 - LINK_DUPLEX_API_HALF LinkDuplex = 1 - LINK_DUPLEX_API_FULL LinkDuplex = 2 -) +type IfStatusFlags = interface_types.IfStatusFlags -var ( - LinkDuplex_name = map[uint32]string{ - 0: "LINK_DUPLEX_API_UNKNOWN", - 1: "LINK_DUPLEX_API_HALF", - 2: "LINK_DUPLEX_API_FULL", - } - LinkDuplex_value = map[string]uint32{ - "LINK_DUPLEX_API_UNKNOWN": 0, - "LINK_DUPLEX_API_HALF": 1, - "LINK_DUPLEX_API_FULL": 2, - } -) +type IfType = interface_types.IfType -func (x LinkDuplex) String() string { - s, ok := LinkDuplex_name[uint32(x)] - if ok { - return s - } - return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" -} +type LinkDuplex = interface_types.LinkDuplex // MemifMode represents VPP binary API enum 'memif_mode'. type MemifMode uint32 @@ -189,131 +107,13 @@ func (x MemifRole) String() string { return "MemifRole(" + strconv.Itoa(int(x)) + ")" } -// MtuProto represents VPP binary API enum 'mtu_proto'. -type MtuProto uint32 +type MtuProto = interface_types.MtuProto -const ( - MTU_PROTO_API_L3 MtuProto = 1 - MTU_PROTO_API_IP4 MtuProto = 2 - MTU_PROTO_API_IP6 MtuProto = 3 - MTU_PROTO_API_MPLS MtuProto = 4 - MTU_PROTO_API_N MtuProto = 5 -) - -var ( - MtuProto_name = map[uint32]string{ - 1: "MTU_PROTO_API_L3", - 2: "MTU_PROTO_API_IP4", - 3: "MTU_PROTO_API_IP6", - 4: "MTU_PROTO_API_MPLS", - 5: "MTU_PROTO_API_N", - } - MtuProto_value = map[string]uint32{ - "MTU_PROTO_API_L3": 1, - "MTU_PROTO_API_IP4": 2, - "MTU_PROTO_API_IP6": 3, - "MTU_PROTO_API_MPLS": 4, - "MTU_PROTO_API_N": 5, - } -) - -func (x MtuProto) String() string { - s, ok := MtuProto_name[uint32(x)] - if ok { - return s - } - return "MtuProto(" + strconv.Itoa(int(x)) + ")" -} - -// RxMode represents VPP binary API enum 'rx_mode'. -type RxMode uint32 - -const ( - RX_MODE_API_UNKNOWN RxMode = 0 - RX_MODE_API_POLLING RxMode = 1 - RX_MODE_API_INTERRUPT RxMode = 2 - RX_MODE_API_ADAPTIVE RxMode = 3 - RX_MODE_API_DEFAULT RxMode = 4 -) +type RxMode = interface_types.RxMode -var ( - RxMode_name = map[uint32]string{ - 0: "RX_MODE_API_UNKNOWN", - 1: "RX_MODE_API_POLLING", - 2: "RX_MODE_API_INTERRUPT", - 3: "RX_MODE_API_ADAPTIVE", - 4: "RX_MODE_API_DEFAULT", - } - RxMode_value = map[string]uint32{ - "RX_MODE_API_UNKNOWN": 0, - "RX_MODE_API_POLLING": 1, - "RX_MODE_API_INTERRUPT": 2, - "RX_MODE_API_ADAPTIVE": 3, - "RX_MODE_API_DEFAULT": 4, - } -) - -func (x RxMode) String() string { - s, ok := RxMode_name[uint32(x)] - if ok { - return s - } - return "RxMode(" + strconv.Itoa(int(x)) + ")" -} - -// SubIfFlags represents VPP binary API enum 'sub_if_flags'. -type SubIfFlags uint32 - -const ( - SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 - SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 - SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 - SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 - SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 - SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 - SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 - SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 - SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 - SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 -) - -var ( - SubIfFlags_name = map[uint32]string{ - 1: "SUB_IF_API_FLAG_NO_TAGS", - 2: "SUB_IF_API_FLAG_ONE_TAG", - 4: "SUB_IF_API_FLAG_TWO_TAGS", - 8: "SUB_IF_API_FLAG_DOT1AD", - 16: "SUB_IF_API_FLAG_EXACT_MATCH", - 32: "SUB_IF_API_FLAG_DEFAULT", - 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", - 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", - 254: "SUB_IF_API_FLAG_MASK_VNET", - 256: "SUB_IF_API_FLAG_DOT1AH", - } - SubIfFlags_value = map[string]uint32{ - "SUB_IF_API_FLAG_NO_TAGS": 1, - "SUB_IF_API_FLAG_ONE_TAG": 2, - "SUB_IF_API_FLAG_TWO_TAGS": 4, - "SUB_IF_API_FLAG_DOT1AD": 8, - "SUB_IF_API_FLAG_EXACT_MATCH": 16, - "SUB_IF_API_FLAG_DEFAULT": 32, - "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, - "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, - "SUB_IF_API_FLAG_MASK_VNET": 254, - "SUB_IF_API_FLAG_DOT1AH": 256, - } -) - -func (x SubIfFlags) String() string { - s, ok := SubIfFlags_name[uint32(x)] - if ok { - return s - } - return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" -} +type SubIfFlags = interface_types.SubIfFlags -// InterfaceIndex represents VPP binary API alias 'interface_index'. -type InterfaceIndex uint32 +type InterfaceIndex = interface_types.InterfaceIndex // MacAddress represents VPP binary API alias 'mac_address'. type MacAddress [6]uint8 diff --git a/examples/binapi/sr/sr.ba.go b/examples/binapi/sr/sr.ba.go index b870456..336cfe2 100644 --- a/examples/binapi/sr/sr.ba.go +++ b/examples/binapi/sr/sr.ba.go @@ -1,15 +1,18 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty -// VPP: 20.01-45~g7a071e370~b63 +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release // source: /usr/share/vpp/api/core/sr.api.json /* -Package sr contains generated code for VPP binary API defined by sr.api (version 1.2.0). +Package sr contains generated code for VPP API file sr.api (2.0.0). It consists of: + 6 aliases + 13 enums 20 messages - 3 types + 7 types + 1 union */ package sr @@ -24,6 +27,9 @@ import ( api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" + + interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" + ip_types "git.fd.io/govpp.git/examples/binapi/ip_types" ) // This is a compile-time assertion to ensure that this generated file @@ -36,50 +42,195 @@ const ( // ModuleName is the name of this module. ModuleName = "sr" // APIVersion is the API version of this module. - APIVersion = "1.2.0" + APIVersion = "2.0.0" // VersionCrc is the CRC of this module. - VersionCrc = 0xbf277f96 + VersionCrc = 0xd85c77ca +) + +type AddressFamily = ip_types.AddressFamily + +type IfStatusFlags = interface_types.IfStatusFlags + +type IfType = interface_types.IfType + +type IPDscp = ip_types.IPDscp + +type IPEcn = ip_types.IPEcn + +type IPProto = ip_types.IPProto + +type LinkDuplex = interface_types.LinkDuplex + +type MtuProto = interface_types.MtuProto + +type RxMode = interface_types.RxMode + +// SrBehavior represents VPP binary API enum 'sr_behavior'. +type SrBehavior uint8 + +const ( + SR_BEHAVIOR_API_END SrBehavior = 1 + SR_BEHAVIOR_API_X SrBehavior = 2 + SR_BEHAVIOR_API_T SrBehavior = 3 + SR_BEHAVIOR_API_D_FIRST SrBehavior = 4 + SR_BEHAVIOR_API_DX2 SrBehavior = 5 + SR_BEHAVIOR_API_DX6 SrBehavior = 6 + SR_BEHAVIOR_API_DX4 SrBehavior = 7 + SR_BEHAVIOR_API_DT6 SrBehavior = 8 + SR_BEHAVIOR_API_DT4 SrBehavior = 9 + SR_BEHAVIOR_API_LAST SrBehavior = 10 ) -// SrIP6Address represents VPP binary API type 'sr_ip6_address'. -type SrIP6Address struct { - Data []byte `binapi:"u8[16],name=data" json:"data,omitempty" struc:"[16]byte"` +var ( + SrBehavior_name = map[uint8]string{ + 1: "SR_BEHAVIOR_API_END", + 2: "SR_BEHAVIOR_API_X", + 3: "SR_BEHAVIOR_API_T", + 4: "SR_BEHAVIOR_API_D_FIRST", + 5: "SR_BEHAVIOR_API_DX2", + 6: "SR_BEHAVIOR_API_DX6", + 7: "SR_BEHAVIOR_API_DX4", + 8: "SR_BEHAVIOR_API_DT6", + 9: "SR_BEHAVIOR_API_DT4", + 10: "SR_BEHAVIOR_API_LAST", + } + SrBehavior_value = map[string]uint8{ + "SR_BEHAVIOR_API_END": 1, + "SR_BEHAVIOR_API_X": 2, + "SR_BEHAVIOR_API_T": 3, + "SR_BEHAVIOR_API_D_FIRST": 4, + "SR_BEHAVIOR_API_DX2": 5, + "SR_BEHAVIOR_API_DX6": 6, + "SR_BEHAVIOR_API_DX4": 7, + "SR_BEHAVIOR_API_DT6": 8, + "SR_BEHAVIOR_API_DT4": 9, + "SR_BEHAVIOR_API_LAST": 10, + } +) + +func (x SrBehavior) String() string { + s, ok := SrBehavior_name[uint8(x)] + if ok { + return s + } + return "SrBehavior(" + strconv.Itoa(int(x)) + ")" } -func (*SrIP6Address) GetTypeName() string { return "sr_ip6_address" } +// SrPolicyOp represents VPP binary API enum 'sr_policy_op'. +type SrPolicyOp uint8 -// Srv6Sid represents VPP binary API type 'srv6_sid'. -type Srv6Sid struct { - Addr []byte `binapi:"u8[16],name=addr" json:"addr,omitempty" struc:"[16]byte"` +const ( + SR_POLICY_OP_API_NONE SrPolicyOp = 0 + SR_POLICY_OP_API_ADD SrPolicyOp = 1 + SR_POLICY_OP_API_DEL SrPolicyOp = 2 + SR_POLICY_OP_API_MOD SrPolicyOp = 3 +) + +var ( + SrPolicyOp_name = map[uint8]string{ + 0: "SR_POLICY_OP_API_NONE", + 1: "SR_POLICY_OP_API_ADD", + 2: "SR_POLICY_OP_API_DEL", + 3: "SR_POLICY_OP_API_MOD", + } + SrPolicyOp_value = map[string]uint8{ + "SR_POLICY_OP_API_NONE": 0, + "SR_POLICY_OP_API_ADD": 1, + "SR_POLICY_OP_API_DEL": 2, + "SR_POLICY_OP_API_MOD": 3, + } +) + +func (x SrPolicyOp) String() string { + s, ok := SrPolicyOp_name[uint8(x)] + if ok { + return s + } + return "SrPolicyOp(" + strconv.Itoa(int(x)) + ")" } -func (*Srv6Sid) GetTypeName() string { return "srv6_sid" } +// SrSteer represents VPP binary API enum 'sr_steer'. +type SrSteer uint8 + +const ( + SR_STEER_API_L2 SrSteer = 2 + SR_STEER_API_IPV4 SrSteer = 4 + SR_STEER_API_IPV6 SrSteer = 6 +) + +var ( + SrSteer_name = map[uint8]string{ + 2: "SR_STEER_API_L2", + 4: "SR_STEER_API_IPV4", + 6: "SR_STEER_API_IPV6", + } + SrSteer_value = map[string]uint8{ + "SR_STEER_API_L2": 2, + "SR_STEER_API_IPV4": 4, + "SR_STEER_API_IPV6": 6, + } +) + +func (x SrSteer) String() string { + s, ok := SrSteer_name[uint8(x)] + if ok { + return s + } + return "SrSteer(" + strconv.Itoa(int(x)) + ")" +} + +type SubIfFlags = interface_types.SubIfFlags + +type AddressWithPrefix = ip_types.AddressWithPrefix + +type InterfaceIndex = interface_types.InterfaceIndex + +type IP4Address = ip_types.IP4Address + +type IP4AddressWithPrefix = ip_types.IP4AddressWithPrefix + +type IP6Address = ip_types.IP6Address + +type IP6AddressWithPrefix = ip_types.IP6AddressWithPrefix + +type Address = ip_types.Address + +type IP4Prefix = ip_types.IP4Prefix + +type IP6Prefix = ip_types.IP6Prefix + +type Mprefix = ip_types.Mprefix + +type Prefix = ip_types.Prefix + +type PrefixMatcher = ip_types.PrefixMatcher // Srv6SidList represents VPP binary API type 'srv6_sid_list'. type Srv6SidList struct { - NumSids uint8 `binapi:"u8,name=num_sids" json:"num_sids,omitempty"` - Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` - Sids [16]Srv6Sid `binapi:"srv6_sid[16],name=sids" json:"sids,omitempty" struc:"[16]Srv6Sid"` + NumSids uint8 `binapi:"u8,name=num_sids" json:"num_sids,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + Sids [16]IP6Address `binapi:"ip6_address[16],name=sids" json:"sids,omitempty" struc:"[16]IP6Address"` } func (*Srv6SidList) GetTypeName() string { return "srv6_sid_list" } +type AddressUnion = ip_types.AddressUnion + // SrLocalsidAddDel represents VPP binary API message 'sr_localsid_add_del'. type SrLocalsidAddDel struct { - IsDel uint8 `binapi:"u8,name=is_del" json:"is_del,omitempty"` - Localsid Srv6Sid `binapi:"srv6_sid,name=localsid" json:"localsid,omitempty"` - EndPsp uint8 `binapi:"u8,name=end_psp" json:"end_psp,omitempty"` - Behavior uint8 `binapi:"u8,name=behavior" json:"behavior,omitempty"` - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - NhAddr6 []byte `binapi:"u8[16],name=nh_addr6" json:"nh_addr6,omitempty" struc:"[16]byte"` - NhAddr4 []byte `binapi:"u8[4],name=nh_addr4" json:"nh_addr4,omitempty" struc:"[4]byte"` + IsDel bool `binapi:"bool,name=is_del,default=false" json:"is_del,omitempty"` + Localsid IP6Address `binapi:"ip6_address,name=localsid" json:"localsid,omitempty"` + EndPsp bool `binapi:"bool,name=end_psp" json:"end_psp,omitempty"` + Behavior SrBehavior `binapi:"sr_behavior,name=behavior" json:"behavior,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` + VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + NhAddr Address `binapi:"address,name=nh_addr" json:"nh_addr,omitempty"` } func (m *SrLocalsidAddDel) Reset() { *m = SrLocalsidAddDel{} } func (*SrLocalsidAddDel) GetMessageName() string { return "sr_localsid_add_del" } -func (*SrLocalsidAddDel) GetCrcString() string { return "b30489eb" } +func (*SrLocalsidAddDel) GetCrcString() string { return "26fa3309" } func (*SrLocalsidAddDel) GetMessageType() api.MessageType { return api.RequestMessage } func (m *SrLocalsidAddDel) Size() int { @@ -90,7 +241,6 @@ func (m *SrLocalsidAddDel) Size() int { // field[1] m.IsDel size += 1 // field[1] m.Localsid - // field[2] m.Localsid.Addr size += 16 // field[1] m.EndPsp size += 1 @@ -102,10 +252,11 @@ func (m *SrLocalsidAddDel) Size() int { size += 4 // field[1] m.FibTable size += 4 - // field[1] m.NhAddr6 + // field[1] m.NhAddr + // field[2] m.NhAddr.Af + size += 1 + // field[2] m.NhAddr.Un size += 16 - // field[1] m.NhAddr4 - size += 4 return size } func (m *SrLocalsidAddDel) Marshal(b []byte) ([]byte, error) { @@ -120,20 +271,23 @@ func (m *SrLocalsidAddDel) Marshal(b []byte) ([]byte, error) { buf = b } // field[1] m.IsDel - buf[pos] = uint8(m.IsDel) + if m.IsDel { + buf[pos] = 1 + } pos += 1 // field[1] m.Localsid - // field[2] m.Localsid.Addr for i := 0; i < 16; i++ { var x uint8 - if i < len(m.Localsid.Addr) { - x = uint8(m.Localsid.Addr[i]) + if i < len(m.Localsid) { + x = uint8(m.Localsid[i]) } buf[pos] = uint8(x) pos += 1 } // field[1] m.EndPsp - buf[pos] = uint8(m.EndPsp) + if m.EndPsp { + buf[pos] = 1 + } pos += 1 // field[1] m.Behavior buf[pos] = uint8(m.Behavior) @@ -147,24 +301,13 @@ func (m *SrLocalsidAddDel) Marshal(b []byte) ([]byte, error) { // field[1] m.FibTable o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) pos += 4 - // field[1] m.NhAddr6 - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.NhAddr6) { - x = uint8(m.NhAddr6[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.NhAddr4 - for i := 0; i < 4; i++ { - var x uint8 - if i < len(m.NhAddr4) { - x = uint8(m.NhAddr4[i]) - } - buf[pos] = uint8(x) - pos += 1 - } + // field[1] m.NhAddr + // field[2] m.NhAddr.Af + buf[pos] = uint8(m.NhAddr.Af) + pos += 1 + // field[2] m.NhAddr.Un + copy(buf[pos:pos+16], m.NhAddr.Un.XXX_UnionData[:]) + pos += 16 return buf, nil } func (m *SrLocalsidAddDel) Unmarshal(tmp []byte) error { @@ -173,23 +316,21 @@ func (m *SrLocalsidAddDel) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.IsDel - m.IsDel = uint8(tmp[pos]) + m.IsDel = tmp[pos] != 0 pos += 1 // field[1] m.Localsid - // field[2] m.Localsid.Addr - m.Localsid.Addr = make([]uint8, 16) - for i := 0; i < len(m.Localsid.Addr); i++ { - m.Localsid.Addr[i] = uint8(tmp[pos]) + for i := 0; i < len(m.Localsid); i++ { + m.Localsid[i] = uint8(tmp[pos]) pos += 1 } // field[1] m.EndPsp - m.EndPsp = uint8(tmp[pos]) + m.EndPsp = tmp[pos] != 0 pos += 1 // field[1] m.Behavior - m.Behavior = uint8(tmp[pos]) + m.Behavior = SrBehavior(tmp[pos]) pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.VlanIndex m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -197,18 +338,13 @@ func (m *SrLocalsidAddDel) Unmarshal(tmp []byte) error { // field[1] m.FibTable m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 - // field[1] m.NhAddr6 - m.NhAddr6 = make([]uint8, 16) - for i := 0; i < len(m.NhAddr6); i++ { - m.NhAddr6[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.NhAddr4 - m.NhAddr4 = make([]uint8, 4) - for i := 0; i < len(m.NhAddr4); i++ { - m.NhAddr4[i] = uint8(tmp[pos]) - pos += 1 - } + // field[1] m.NhAddr + // field[2] m.NhAddr.Af + m.NhAddr.Af = AddressFamily(tmp[pos]) + pos += 1 + // field[2] m.NhAddr.Un + copy(m.NhAddr.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 return nil } @@ -260,19 +396,18 @@ func (m *SrLocalsidAddDelReply) Unmarshal(tmp []byte) error { // SrLocalsidsDetails represents VPP binary API message 'sr_localsids_details'. type SrLocalsidsDetails struct { - Addr Srv6Sid `binapi:"srv6_sid,name=addr" json:"addr,omitempty"` - EndPsp uint8 `binapi:"u8,name=end_psp" json:"end_psp,omitempty"` - Behavior uint16 `binapi:"u16,name=behavior" json:"behavior,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` - XconnectNhAddr6 []byte `binapi:"u8[16],name=xconnect_nh_addr6" json:"xconnect_nh_addr6,omitempty" struc:"[16]byte"` - XconnectNhAddr4 []byte `binapi:"u8[4],name=xconnect_nh_addr4" json:"xconnect_nh_addr4,omitempty" struc:"[4]byte"` - XconnectIfaceOrVrfTable uint32 `binapi:"u32,name=xconnect_iface_or_vrf_table" json:"xconnect_iface_or_vrf_table,omitempty"` + Addr IP6Address `binapi:"ip6_address,name=addr" json:"addr,omitempty"` + EndPsp bool `binapi:"bool,name=end_psp" json:"end_psp,omitempty"` + Behavior SrBehavior `binapi:"sr_behavior,name=behavior" json:"behavior,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` + XconnectNhAddr Address `binapi:"address,name=xconnect_nh_addr" json:"xconnect_nh_addr,omitempty"` + XconnectIfaceOrVrfTable uint32 `binapi:"u32,name=xconnect_iface_or_vrf_table" json:"xconnect_iface_or_vrf_table,omitempty"` } func (m *SrLocalsidsDetails) Reset() { *m = SrLocalsidsDetails{} } func (*SrLocalsidsDetails) GetMessageName() string { return "sr_localsids_details" } -func (*SrLocalsidsDetails) GetCrcString() string { return "0791babc" } +func (*SrLocalsidsDetails) GetCrcString() string { return "6a6c0265" } func (*SrLocalsidsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *SrLocalsidsDetails) Size() int { @@ -281,20 +416,20 @@ func (m *SrLocalsidsDetails) Size() int { } var size int // field[1] m.Addr - // field[2] m.Addr.Addr size += 16 // field[1] m.EndPsp size += 1 // field[1] m.Behavior - size += 2 + size += 1 // field[1] m.FibTable size += 4 // field[1] m.VlanIndex size += 4 - // field[1] m.XconnectNhAddr6 + // field[1] m.XconnectNhAddr + // field[2] m.XconnectNhAddr.Af + size += 1 + // field[2] m.XconnectNhAddr.Un size += 16 - // field[1] m.XconnectNhAddr4 - size += 4 // field[1] m.XconnectIfaceOrVrfTable size += 4 return size @@ -311,45 +446,35 @@ func (m *SrLocalsidsDetails) Marshal(b []byte) ([]byte, error) { buf = b } // field[1] m.Addr - // field[2] m.Addr.Addr for i := 0; i < 16; i++ { var x uint8 - if i < len(m.Addr.Addr) { - x = uint8(m.Addr.Addr[i]) + if i < len(m.Addr) { + x = uint8(m.Addr[i]) } buf[pos] = uint8(x) pos += 1 } // field[1] m.EndPsp - buf[pos] = uint8(m.EndPsp) + if m.EndPsp { + buf[pos] = 1 + } pos += 1 // field[1] m.Behavior - o.PutUint16(buf[pos:pos+2], uint16(m.Behavior)) - pos += 2 + buf[pos] = uint8(m.Behavior) + pos += 1 // field[1] m.FibTable o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) pos += 4 // field[1] m.VlanIndex o.PutUint32(buf[pos:pos+4], uint32(m.VlanIndex)) pos += 4 - // field[1] m.XconnectNhAddr6 - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.XconnectNhAddr6) { - x = uint8(m.XconnectNhAddr6[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.XconnectNhAddr4 - for i := 0; i < 4; i++ { - var x uint8 - if i < len(m.XconnectNhAddr4) { - x = uint8(m.XconnectNhAddr4[i]) - } - buf[pos] = uint8(x) - pos += 1 - } + // field[1] m.XconnectNhAddr + // field[2] m.XconnectNhAddr.Af + buf[pos] = uint8(m.XconnectNhAddr.Af) + pos += 1 + // field[2] m.XconnectNhAddr.Un + copy(buf[pos:pos+16], m.XconnectNhAddr.Un.XXX_UnionData[:]) + pos += 16 // field[1] m.XconnectIfaceOrVrfTable o.PutUint32(buf[pos:pos+4], uint32(m.XconnectIfaceOrVrfTable)) pos += 4 @@ -361,36 +486,29 @@ func (m *SrLocalsidsDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.Addr - // field[2] m.Addr.Addr - m.Addr.Addr = make([]uint8, 16) - for i := 0; i < len(m.Addr.Addr); i++ { - m.Addr.Addr[i] = uint8(tmp[pos]) + for i := 0; i < len(m.Addr); i++ { + m.Addr[i] = uint8(tmp[pos]) pos += 1 } // field[1] m.EndPsp - m.EndPsp = uint8(tmp[pos]) + m.EndPsp = tmp[pos] != 0 pos += 1 // field[1] m.Behavior - m.Behavior = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 + m.Behavior = SrBehavior(tmp[pos]) + pos += 1 // field[1] m.FibTable m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.VlanIndex m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 - // field[1] m.XconnectNhAddr6 - m.XconnectNhAddr6 = make([]uint8, 16) - for i := 0; i < len(m.XconnectNhAddr6); i++ { - m.XconnectNhAddr6[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.XconnectNhAddr4 - m.XconnectNhAddr4 = make([]uint8, 4) - for i := 0; i < len(m.XconnectNhAddr4); i++ { - m.XconnectNhAddr4[i] = uint8(tmp[pos]) - pos += 1 - } + // field[1] m.XconnectNhAddr + // field[2] m.XconnectNhAddr.Af + m.XconnectNhAddr.Af = AddressFamily(tmp[pos]) + pos += 1 + // field[2] m.XconnectNhAddr.Un + copy(m.XconnectNhAddr.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 // field[1] m.XconnectIfaceOrVrfTable m.XconnectIfaceOrVrfTable = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 @@ -435,9 +553,9 @@ func (m *SrLocalsidsDump) Unmarshal(tmp []byte) error { // SrPoliciesDetails represents VPP binary API message 'sr_policies_details'. type SrPoliciesDetails struct { - Bsid Srv6Sid `binapi:"srv6_sid,name=bsid" json:"bsid,omitempty"` - Type uint8 `binapi:"u8,name=type" json:"type,omitempty"` - IsEncap uint8 `binapi:"u8,name=is_encap" json:"is_encap,omitempty"` + Bsid IP6Address `binapi:"ip6_address,name=bsid" json:"bsid,omitempty"` + IsSpray bool `binapi:"bool,name=is_spray" json:"is_spray,omitempty"` + IsEncap bool `binapi:"bool,name=is_encap" json:"is_encap,omitempty"` FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` NumSidLists uint8 `binapi:"u8,name=num_sid_lists" json:"num_sid_lists,omitempty" struc:"sizeof=SidLists"` SidLists []Srv6SidList `binapi:"srv6_sid_list[num_sid_lists],name=sid_lists" json:"sid_lists,omitempty"` @@ -445,7 +563,7 @@ type SrPoliciesDetails struct { func (m *SrPoliciesDetails) Reset() { *m = SrPoliciesDetails{} } func (*SrPoliciesDetails) GetMessageName() string { return "sr_policies_details" } -func (*SrPoliciesDetails) GetCrcString() string { return "5087f460" } +func (*SrPoliciesDetails) GetCrcString() string { return "07ec2d93" } func (*SrPoliciesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *SrPoliciesDetails) Size() int { @@ -454,9 +572,8 @@ func (m *SrPoliciesDetails) Size() int { } var size int // field[1] m.Bsid - // field[2] m.Bsid.Addr size += 16 - // field[1] m.Type + // field[1] m.IsSpray size += 1 // field[1] m.IsEncap size += 1 @@ -477,12 +594,11 @@ func (m *SrPoliciesDetails) Size() int { size += 4 // field[2] s1.Sids for j2 := 0; j2 < 16; j2++ { - var s2 Srv6Sid + var s2 IP6Address _ = s2 if j2 < len(s1.Sids) { s2 = s1.Sids[j2] } - // field[3] s2.Addr size += 16 } } @@ -500,20 +616,23 @@ func (m *SrPoliciesDetails) Marshal(b []byte) ([]byte, error) { buf = b } // field[1] m.Bsid - // field[2] m.Bsid.Addr for i := 0; i < 16; i++ { var x uint8 - if i < len(m.Bsid.Addr) { - x = uint8(m.Bsid.Addr[i]) + if i < len(m.Bsid) { + x = uint8(m.Bsid[i]) } buf[pos] = uint8(x) pos += 1 } - // field[1] m.Type - buf[pos] = uint8(m.Type) + // field[1] m.IsSpray + if m.IsSpray { + buf[pos] = 1 + } pos += 1 // field[1] m.IsEncap - buf[pos] = uint8(m.IsEncap) + if m.IsEncap { + buf[pos] = 1 + } pos += 1 // field[1] m.FibTable o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) @@ -535,15 +654,14 @@ func (m *SrPoliciesDetails) Marshal(b []byte) ([]byte, error) { pos += 4 // field[2] v1.Sids for j2 := 0; j2 < 16; j2++ { - var v2 Srv6Sid + var v2 IP6Address if j2 < len(v1.Sids) { v2 = v1.Sids[j2] } - // field[3] v2.Addr for i := 0; i < 16; i++ { var x uint8 - if i < len(v2.Addr) { - x = uint8(v2.Addr[i]) + if i < len(v2) { + x = uint8(v2[i]) } buf[pos] = uint8(x) pos += 1 @@ -558,17 +676,15 @@ func (m *SrPoliciesDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.Bsid - // field[2] m.Bsid.Addr - m.Bsid.Addr = make([]uint8, 16) - for i := 0; i < len(m.Bsid.Addr); i++ { - m.Bsid.Addr[i] = uint8(tmp[pos]) + for i := 0; i < len(m.Bsid); i++ { + m.Bsid[i] = uint8(tmp[pos]) pos += 1 } - // field[1] m.Type - m.Type = uint8(tmp[pos]) + // field[1] m.IsSpray + m.IsSpray = tmp[pos] != 0 pos += 1 // field[1] m.IsEncap - m.IsEncap = uint8(tmp[pos]) + m.IsEncap = tmp[pos] != 0 pos += 1 // field[1] m.FibTable m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) @@ -587,10 +703,8 @@ func (m *SrPoliciesDetails) Unmarshal(tmp []byte) error { pos += 4 // field[2] m.SidLists[j1].Sids for j2 := 0; j2 < 16; j2++ { - // field[3] m.SidLists[j1].Sids[j2].Addr - m.SidLists[j1].Sids[j2].Addr = make([]uint8, 16) - for i := 0; i < len(m.SidLists[j1].Sids[j2].Addr); i++ { - m.SidLists[j1].Sids[j2].Addr[i] = uint8(tmp[pos]) + for i := 0; i < len(m.SidLists[j1].Sids[j2]); i++ { + m.SidLists[j1].Sids[j2][i] = uint8(tmp[pos]) pos += 1 } } @@ -636,17 +750,17 @@ func (m *SrPoliciesDump) Unmarshal(tmp []byte) error { // SrPolicyAdd represents VPP binary API message 'sr_policy_add'. type SrPolicyAdd struct { - BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + BsidAddr IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` - IsEncap uint8 `binapi:"u8,name=is_encap" json:"is_encap,omitempty"` - Type uint8 `binapi:"u8,name=type" json:"type,omitempty"` + IsEncap bool `binapi:"bool,name=is_encap" json:"is_encap,omitempty"` + IsSpray bool `binapi:"bool,name=is_spray" json:"is_spray,omitempty"` FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` } func (m *SrPolicyAdd) Reset() { *m = SrPolicyAdd{} } func (*SrPolicyAdd) GetMessageName() string { return "sr_policy_add" } -func (*SrPolicyAdd) GetCrcString() string { return "4b6e2484" } +func (*SrPolicyAdd) GetCrcString() string { return "ec79ee6a" } func (*SrPolicyAdd) GetMessageType() api.MessageType { return api.RequestMessage } func (m *SrPolicyAdd) Size() int { @@ -660,7 +774,7 @@ func (m *SrPolicyAdd) Size() int { size += 4 // field[1] m.IsEncap size += 1 - // field[1] m.Type + // field[1] m.IsSpray size += 1 // field[1] m.FibTable size += 4 @@ -671,12 +785,11 @@ func (m *SrPolicyAdd) Size() int { size += 4 // field[2] m.Sids.Sids for j2 := 0; j2 < 16; j2++ { - var s2 Srv6Sid + var s2 IP6Address _ = s2 if j2 < len(m.Sids.Sids) { s2 = m.Sids.Sids[j2] } - // field[3] s2.Addr size += 16 } return size @@ -705,10 +818,14 @@ func (m *SrPolicyAdd) Marshal(b []byte) ([]byte, error) { o.PutUint32(buf[pos:pos+4], uint32(m.Weight)) pos += 4 // field[1] m.IsEncap - buf[pos] = uint8(m.IsEncap) + if m.IsEncap { + buf[pos] = 1 + } pos += 1 - // field[1] m.Type - buf[pos] = uint8(m.Type) + // field[1] m.IsSpray + if m.IsSpray { + buf[pos] = 1 + } pos += 1 // field[1] m.FibTable o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) @@ -722,15 +839,14 @@ func (m *SrPolicyAdd) Marshal(b []byte) ([]byte, error) { pos += 4 // field[2] m.Sids.Sids for j2 := 0; j2 < 16; j2++ { - var v2 Srv6Sid + var v2 IP6Address if j2 < len(m.Sids.Sids) { v2 = m.Sids.Sids[j2] } - // field[3] v2.Addr for i := 0; i < 16; i++ { var x uint8 - if i < len(v2.Addr) { - x = uint8(v2.Addr[i]) + if i < len(v2) { + x = uint8(v2[i]) } buf[pos] = uint8(x) pos += 1 @@ -744,7 +860,6 @@ func (m *SrPolicyAdd) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.BsidAddr - m.BsidAddr = make([]uint8, 16) for i := 0; i < len(m.BsidAddr); i++ { m.BsidAddr[i] = uint8(tmp[pos]) pos += 1 @@ -753,10 +868,10 @@ func (m *SrPolicyAdd) Unmarshal(tmp []byte) error { m.Weight = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.IsEncap - m.IsEncap = uint8(tmp[pos]) + m.IsEncap = tmp[pos] != 0 pos += 1 - // field[1] m.Type - m.Type = uint8(tmp[pos]) + // field[1] m.IsSpray + m.IsSpray = tmp[pos] != 0 pos += 1 // field[1] m.FibTable m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) @@ -770,10 +885,8 @@ func (m *SrPolicyAdd) Unmarshal(tmp []byte) error { pos += 4 // field[2] m.Sids.Sids for j2 := 0; j2 < 16; j2++ { - // field[3] m.Sids.Sids[j2].Addr - m.Sids.Sids[j2].Addr = make([]uint8, 16) - for i := 0; i < len(m.Sids.Sids[j2].Addr); i++ { - m.Sids.Sids[j2].Addr[i] = uint8(tmp[pos]) + for i := 0; i < len(m.Sids.Sids[j2]); i++ { + m.Sids.Sids[j2][i] = uint8(tmp[pos]) pos += 1 } } @@ -828,13 +941,13 @@ func (m *SrPolicyAddReply) Unmarshal(tmp []byte) error { // SrPolicyDel represents VPP binary API message 'sr_policy_del'. type SrPolicyDel struct { - BsidAddr Srv6Sid `binapi:"srv6_sid,name=bsid_addr" json:"bsid_addr,omitempty"` - SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` + BsidAddr IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` } func (m *SrPolicyDel) Reset() { *m = SrPolicyDel{} } func (*SrPolicyDel) GetMessageName() string { return "sr_policy_del" } -func (*SrPolicyDel) GetCrcString() string { return "e4133171" } +func (*SrPolicyDel) GetCrcString() string { return "cb4d48d5" } func (*SrPolicyDel) GetMessageType() api.MessageType { return api.RequestMessage } func (m *SrPolicyDel) Size() int { @@ -843,7 +956,6 @@ func (m *SrPolicyDel) Size() int { } var size int // field[1] m.BsidAddr - // field[2] m.BsidAddr.Addr size += 16 // field[1] m.SrPolicyIndex size += 4 @@ -861,11 +973,10 @@ func (m *SrPolicyDel) Marshal(b []byte) ([]byte, error) { buf = b } // field[1] m.BsidAddr - // field[2] m.BsidAddr.Addr for i := 0; i < 16; i++ { var x uint8 - if i < len(m.BsidAddr.Addr) { - x = uint8(m.BsidAddr.Addr[i]) + if i < len(m.BsidAddr) { + x = uint8(m.BsidAddr[i]) } buf[pos] = uint8(x) pos += 1 @@ -881,10 +992,8 @@ func (m *SrPolicyDel) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.BsidAddr - // field[2] m.BsidAddr.Addr - m.BsidAddr.Addr = make([]uint8, 16) - for i := 0; i < len(m.BsidAddr.Addr); i++ { - m.BsidAddr.Addr[i] = uint8(tmp[pos]) + for i := 0; i < len(m.BsidAddr); i++ { + m.BsidAddr[i] = uint8(tmp[pos]) pos += 1 } // field[1] m.SrPolicyIndex @@ -941,10 +1050,10 @@ func (m *SrPolicyDelReply) Unmarshal(tmp []byte) error { // SrPolicyMod represents VPP binary API message 'sr_policy_mod'. type SrPolicyMod struct { - BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + BsidAddr IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - Operation uint8 `binapi:"u8,name=operation" json:"operation,omitempty"` + Operation SrPolicyOp `binapi:"sr_policy_op,name=operation" json:"operation,omitempty"` SlIndex uint32 `binapi:"u32,name=sl_index" json:"sl_index,omitempty"` Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` @@ -952,7 +1061,7 @@ type SrPolicyMod struct { func (m *SrPolicyMod) Reset() { *m = SrPolicyMod{} } func (*SrPolicyMod) GetMessageName() string { return "sr_policy_mod" } -func (*SrPolicyMod) GetCrcString() string { return "c1dfaee0" } +func (*SrPolicyMod) GetCrcString() string { return "e531a102" } func (*SrPolicyMod) GetMessageType() api.MessageType { return api.RequestMessage } func (m *SrPolicyMod) Size() int { @@ -979,12 +1088,11 @@ func (m *SrPolicyMod) Size() int { size += 4 // field[2] m.Sids.Sids for j2 := 0; j2 < 16; j2++ { - var s2 Srv6Sid + var s2 IP6Address _ = s2 if j2 < len(m.Sids.Sids) { s2 = m.Sids.Sids[j2] } - // field[3] s2.Addr size += 16 } return size @@ -1033,15 +1141,14 @@ func (m *SrPolicyMod) Marshal(b []byte) ([]byte, error) { pos += 4 // field[2] m.Sids.Sids for j2 := 0; j2 < 16; j2++ { - var v2 Srv6Sid + var v2 IP6Address if j2 < len(m.Sids.Sids) { v2 = m.Sids.Sids[j2] } - // field[3] v2.Addr for i := 0; i < 16; i++ { var x uint8 - if i < len(v2.Addr) { - x = uint8(v2.Addr[i]) + if i < len(v2) { + x = uint8(v2[i]) } buf[pos] = uint8(x) pos += 1 @@ -1055,7 +1162,6 @@ func (m *SrPolicyMod) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.BsidAddr - m.BsidAddr = make([]uint8, 16) for i := 0; i < len(m.BsidAddr); i++ { m.BsidAddr[i] = uint8(tmp[pos]) pos += 1 @@ -1067,7 +1173,7 @@ func (m *SrPolicyMod) Unmarshal(tmp []byte) error { m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Operation - m.Operation = uint8(tmp[pos]) + m.Operation = SrPolicyOp(tmp[pos]) pos += 1 // field[1] m.SlIndex m.SlIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -1084,10 +1190,8 @@ func (m *SrPolicyMod) Unmarshal(tmp []byte) error { pos += 4 // field[2] m.Sids.Sids for j2 := 0; j2 < 16; j2++ { - // field[3] m.Sids.Sids[j2].Addr - m.Sids.Sids[j2].Addr = make([]uint8, 16) - for i := 0; i < len(m.Sids.Sids[j2].Addr); i++ { - m.Sids.Sids[j2].Addr[i] = uint8(tmp[pos]) + for i := 0; i < len(m.Sids.Sids[j2]); i++ { + m.Sids.Sids[j2][i] = uint8(tmp[pos]) pos += 1 } } @@ -1234,12 +1338,12 @@ func (m *SrSetEncapHopLimitReply) Unmarshal(tmp []byte) error { // SrSetEncapSource represents VPP binary API message 'sr_set_encap_source'. type SrSetEncapSource struct { - EncapsSource []byte `binapi:"u8[16],name=encaps_source" json:"encaps_source,omitempty" struc:"[16]byte"` + EncapsSource IP6Address `binapi:"ip6_address,name=encaps_source" json:"encaps_source,omitempty"` } func (m *SrSetEncapSource) Reset() { *m = SrSetEncapSource{} } func (*SrSetEncapSource) GetMessageName() string { return "sr_set_encap_source" } -func (*SrSetEncapSource) GetCrcString() string { return "d05bb4de" } +func (*SrSetEncapSource) GetCrcString() string { return "d3bad5e1" } func (*SrSetEncapSource) GetMessageType() api.MessageType { return api.RequestMessage } func (m *SrSetEncapSource) Size() int { @@ -1279,7 +1383,6 @@ func (m *SrSetEncapSource) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.EncapsSource - m.EncapsSource = make([]uint8, 16) for i := 0; i < len(m.EncapsSource); i++ { m.EncapsSource[i] = uint8(tmp[pos]) pos += 1 @@ -1335,19 +1438,18 @@ func (m *SrSetEncapSourceReply) Unmarshal(tmp []byte) error { // SrSteeringAddDel represents VPP binary API message 'sr_steering_add_del'. type SrSteeringAddDel struct { - IsDel uint8 `binapi:"u8,name=is_del" json:"is_del,omitempty"` - BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` - SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - PrefixAddr []byte `binapi:"u8[16],name=prefix_addr" json:"prefix_addr,omitempty" struc:"[16]byte"` - MaskWidth uint32 `binapi:"u32,name=mask_width" json:"mask_width,omitempty"` - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - TrafficType uint8 `binapi:"u8,name=traffic_type" json:"traffic_type,omitempty"` + IsDel bool `binapi:"bool,name=is_del,default=false" json:"is_del,omitempty"` + BsidAddr IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TrafficType SrSteer `binapi:"sr_steer,name=traffic_type" json:"traffic_type,omitempty"` } func (m *SrSteeringAddDel) Reset() { *m = SrSteeringAddDel{} } func (*SrSteeringAddDel) GetMessageName() string { return "sr_steering_add_del" } -func (*SrSteeringAddDel) GetCrcString() string { return "28b5dcab" } +func (*SrSteeringAddDel) GetCrcString() string { return "3711dace" } func (*SrSteeringAddDel) GetMessageType() api.MessageType { return api.RequestMessage } func (m *SrSteeringAddDel) Size() int { @@ -1363,10 +1465,14 @@ func (m *SrSteeringAddDel) Size() int { size += 4 // field[1] m.TableID size += 4 - // field[1] m.PrefixAddr + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 1 + // field[3] m.Prefix.Address.Un size += 16 - // field[1] m.MaskWidth - size += 4 + // field[2] m.Prefix.Len + size += 1 // field[1] m.SwIfIndex size += 4 // field[1] m.TrafficType @@ -1385,7 +1491,9 @@ func (m *SrSteeringAddDel) Marshal(b []byte) ([]byte, error) { buf = b } // field[1] m.IsDel - buf[pos] = uint8(m.IsDel) + if m.IsDel { + buf[pos] = 1 + } pos += 1 // field[1] m.BsidAddr for i := 0; i < 16; i++ { @@ -1402,18 +1510,17 @@ func (m *SrSteeringAddDel) Marshal(b []byte) ([]byte, error) { // field[1] m.TableID o.PutUint32(buf[pos:pos+4], uint32(m.TableID)) pos += 4 - // field[1] m.PrefixAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.PrefixAddr) { - x = uint8(m.PrefixAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.MaskWidth - o.PutUint32(buf[pos:pos+4], uint32(m.MaskWidth)) - pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + buf[pos] = uint8(m.Prefix.Address.Af) + pos += 1 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 // field[1] m.SwIfIndex o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) pos += 4 @@ -1428,10 +1535,9 @@ func (m *SrSteeringAddDel) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.IsDel - m.IsDel = uint8(tmp[pos]) + m.IsDel = tmp[pos] != 0 pos += 1 // field[1] m.BsidAddr - m.BsidAddr = make([]uint8, 16) for i := 0; i < len(m.BsidAddr); i++ { m.BsidAddr[i] = uint8(tmp[pos]) pos += 1 @@ -1442,20 +1548,22 @@ func (m *SrSteeringAddDel) Unmarshal(tmp []byte) error { // field[1] m.TableID m.TableID = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 - // field[1] m.PrefixAddr - m.PrefixAddr = make([]uint8, 16) - for i := 0; i < len(m.PrefixAddr); i++ { - m.PrefixAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.MaskWidth - m.MaskWidth = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.TrafficType - m.TrafficType = uint8(tmp[pos]) + m.TrafficType = SrSteer(tmp[pos]) pos += 1 return nil } @@ -1508,17 +1616,16 @@ func (m *SrSteeringAddDelReply) Unmarshal(tmp []byte) error { // SrSteeringPolDetails represents VPP binary API message 'sr_steering_pol_details'. type SrSteeringPolDetails struct { - TrafficType uint8 `binapi:"u8,name=traffic_type" json:"traffic_type,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - PrefixAddr []byte `binapi:"u8[16],name=prefix_addr" json:"prefix_addr,omitempty" struc:"[16]byte"` - MaskWidth uint32 `binapi:"u32,name=mask_width" json:"mask_width,omitempty"` - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - Bsid Srv6Sid `binapi:"srv6_sid,name=bsid" json:"bsid,omitempty"` + TrafficType SrSteer `binapi:"sr_steer,name=traffic_type" json:"traffic_type,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Bsid IP6Address `binapi:"ip6_address,name=bsid" json:"bsid,omitempty"` } func (m *SrSteeringPolDetails) Reset() { *m = SrSteeringPolDetails{} } func (*SrSteeringPolDetails) GetMessageName() string { return "sr_steering_pol_details" } -func (*SrSteeringPolDetails) GetCrcString() string { return "5627d483" } +func (*SrSteeringPolDetails) GetCrcString() string { return "1c1ee786" } func (*SrSteeringPolDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *SrSteeringPolDetails) Size() int { @@ -1530,14 +1637,17 @@ func (m *SrSteeringPolDetails) Size() int { size += 1 // field[1] m.FibTable size += 4 - // field[1] m.PrefixAddr + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 1 + // field[3] m.Prefix.Address.Un size += 16 - // field[1] m.MaskWidth - size += 4 + // field[2] m.Prefix.Len + size += 1 // field[1] m.SwIfIndex size += 4 // field[1] m.Bsid - // field[2] m.Bsid.Addr size += 16 return size } @@ -1558,27 +1668,25 @@ func (m *SrSteeringPolDetails) Marshal(b []byte) ([]byte, error) { // field[1] m.FibTable o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) pos += 4 - // field[1] m.PrefixAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.PrefixAddr) { - x = uint8(m.PrefixAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.MaskWidth - o.PutUint32(buf[pos:pos+4], uint32(m.MaskWidth)) - pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + buf[pos] = uint8(m.Prefix.Address.Af) + pos += 1 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 // field[1] m.SwIfIndex o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) pos += 4 // field[1] m.Bsid - // field[2] m.Bsid.Addr for i := 0; i < 16; i++ { var x uint8 - if i < len(m.Bsid.Addr) { - x = uint8(m.Bsid.Addr[i]) + if i < len(m.Bsid) { + x = uint8(m.Bsid[i]) } buf[pos] = uint8(x) pos += 1 @@ -1591,28 +1699,28 @@ func (m *SrSteeringPolDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.TrafficType - m.TrafficType = uint8(tmp[pos]) + m.TrafficType = SrSteer(tmp[pos]) pos += 1 // field[1] m.FibTable m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 - // field[1] m.PrefixAddr - m.PrefixAddr = make([]uint8, 16) - for i := 0; i < len(m.PrefixAddr); i++ { - m.PrefixAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.MaskWidth - m.MaskWidth = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(tmp[pos]) + pos += 1 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Bsid - // field[2] m.Bsid.Addr - m.Bsid.Addr = make([]uint8, 16) - for i := 0; i < len(m.Bsid.Addr); i++ { - m.Bsid.Addr[i] = uint8(tmp[pos]) + for i := 0; i < len(m.Bsid); i++ { + m.Bsid[i] = uint8(tmp[pos]) pos += 1 } return nil diff --git a/examples/binapi/vpe/vpe.ba.go b/examples/binapi/vpe/vpe.ba.go index 4c00c86..b682d9f 100644 --- a/examples/binapi/vpe/vpe.ba.go +++ b/examples/binapi/vpe/vpe.ba.go @@ -1,11 +1,11 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty -// VPP: 20.01-45~g7a071e370~b63 +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release // source: /usr/share/vpp/api/core/vpe.api.json /* -Package vpe contains generated code for VPP binary API defined by vpe.api (version 1.6.0). +Package vpe contains generated code for VPP API file vpe.api (1.6.1). It consists of: 2 aliases @@ -38,9 +38,9 @@ const ( // ModuleName is the name of this module. ModuleName = "vpe" // APIVersion is the API version of this module. - APIVersion = "1.6.0" + APIVersion = "1.6.1" // VersionCrc is the CRC of this module. - VersionCrc = 0xc6c0bcf6 + VersionCrc = 0xbd2c94f4 ) // LogLevel represents VPP binary API enum 'log_level'. @@ -100,8 +100,8 @@ type Timestamp float64 // ThreadData represents VPP binary API type 'thread_data'. type ThreadData struct { ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` - Name []byte `binapi:"u8[64],name=name" json:"name,omitempty" struc:"[64]byte"` - Type []byte `binapi:"u8[64],name=type" json:"type,omitempty" struc:"[64]byte"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` + Type string `binapi:"string[64],name=type" json:"type,omitempty" struc:"[64]byte"` PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` CPUID uint32 `binapi:"u32,name=cpu_id" json:"cpu_id,omitempty"` Core uint32 `binapi:"u32,name=core" json:"core,omitempty"` @@ -123,13 +123,13 @@ func (*Version) GetTypeName() string { return "version" } // AddNodeNext represents VPP binary API message 'add_node_next'. type AddNodeNext struct { - NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` - NextName []byte `binapi:"u8[64],name=next_name" json:"next_name,omitempty" struc:"[64]byte"` + NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` + NextName string `binapi:"string[64],name=next_name" json:"next_name,omitempty" struc:"[64]byte"` } func (m *AddNodeNext) Reset() { *m = AddNodeNext{} } func (*AddNodeNext) GetMessageName() string { return "add_node_next" } -func (*AddNodeNext) GetCrcString() string { return "9ab92f7a" } +func (*AddNodeNext) GetCrcString() string { return "2457116d" } func (*AddNodeNext) GetMessageType() api.MessageType { return api.RequestMessage } func (m *AddNodeNext) Size() int { @@ -155,23 +155,11 @@ func (m *AddNodeNext) Marshal(b []byte) ([]byte, error) { buf = b } // field[1] m.NodeName - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.NodeName) { - x = uint8(m.NodeName[i]) - } - buf[pos] = uint8(x) - pos += 1 - } + copy(buf[pos:pos+64], m.NodeName) + pos += 64 // field[1] m.NextName - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.NextName) { - x = uint8(m.NextName[i]) - } - buf[pos] = uint8(x) - pos += 1 - } + copy(buf[pos:pos+64], m.NextName) + pos += 64 return buf, nil } func (m *AddNodeNext) Unmarshal(tmp []byte) error { @@ -180,16 +168,16 @@ func (m *AddNodeNext) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.NodeName - m.NodeName = make([]uint8, 64) - for i := 0; i < len(m.NodeName); i++ { - m.NodeName[i] = uint8(tmp[pos]) - pos += 1 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.NodeName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } // field[1] m.NextName - m.NextName = make([]uint8, 64) - for i := 0; i < len(m.NextName); i++ { - m.NextName[i] = uint8(tmp[pos]) - pos += 1 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.NextName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } return nil } @@ -769,13 +757,13 @@ func (m *GetF64IncrementByOneReply) Unmarshal(tmp []byte) error { // GetNextIndex represents VPP binary API message 'get_next_index'. type GetNextIndex struct { - NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` - NextName []byte `binapi:"u8[64],name=next_name" json:"next_name,omitempty" struc:"[64]byte"` + NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` + NextName string `binapi:"string[64],name=next_name" json:"next_name,omitempty" struc:"[64]byte"` } func (m *GetNextIndex) Reset() { *m = GetNextIndex{} } func (*GetNextIndex) GetMessageName() string { return "get_next_index" } -func (*GetNextIndex) GetCrcString() string { return "9ab92f7a" } +func (*GetNextIndex) GetCrcString() string { return "2457116d" } func (*GetNextIndex) GetMessageType() api.MessageType { return api.RequestMessage } func (m *GetNextIndex) Size() int { @@ -801,23 +789,11 @@ func (m *GetNextIndex) Marshal(b []byte) ([]byte, error) { buf = b } // field[1] m.NodeName - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.NodeName) { - x = uint8(m.NodeName[i]) - } - buf[pos] = uint8(x) - pos += 1 - } + copy(buf[pos:pos+64], m.NodeName) + pos += 64 // field[1] m.NextName - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.NextName) { - x = uint8(m.NextName[i]) - } - buf[pos] = uint8(x) - pos += 1 - } + copy(buf[pos:pos+64], m.NextName) + pos += 64 return buf, nil } func (m *GetNextIndex) Unmarshal(tmp []byte) error { @@ -826,16 +802,16 @@ func (m *GetNextIndex) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.NodeName - m.NodeName = make([]uint8, 64) - for i := 0; i < len(m.NodeName); i++ { - m.NodeName[i] = uint8(tmp[pos]) - pos += 1 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.NodeName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } // field[1] m.NextName - m.NextName = make([]uint8, 64) - for i := 0; i < len(m.NextName); i++ { - m.NextName[i] = uint8(tmp[pos]) - pos += 1 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.NextName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } return nil } @@ -988,12 +964,12 @@ func (m *GetNodeGraphReply) Unmarshal(tmp []byte) error { // GetNodeIndex represents VPP binary API message 'get_node_index'. type GetNodeIndex struct { - NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` + NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` } func (m *GetNodeIndex) Reset() { *m = GetNodeIndex{} } func (*GetNodeIndex) GetMessageName() string { return "get_node_index" } -func (*GetNodeIndex) GetCrcString() string { return "6c9a495d" } +func (*GetNodeIndex) GetCrcString() string { return "f1984c64" } func (*GetNodeIndex) GetMessageType() api.MessageType { return api.RequestMessage } func (m *GetNodeIndex) Size() int { @@ -1017,14 +993,8 @@ func (m *GetNodeIndex) Marshal(b []byte) ([]byte, error) { buf = b } // field[1] m.NodeName - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.NodeName) { - x = uint8(m.NodeName[i]) - } - buf[pos] = uint8(x) - pos += 1 - } + copy(buf[pos:pos+64], m.NodeName) + pos += 64 return buf, nil } func (m *GetNodeIndex) Unmarshal(tmp []byte) error { @@ -1033,10 +1003,10 @@ func (m *GetNodeIndex) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.NodeName - m.NodeName = make([]uint8, 64) - for i := 0; i < len(m.NodeName); i++ { - m.NodeName[i] = uint8(tmp[pos]) - pos += 1 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.NodeName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } return nil } @@ -1266,7 +1236,7 @@ type ShowThreadsReply struct { func (m *ShowThreadsReply) Reset() { *m = ShowThreadsReply{} } func (*ShowThreadsReply) GetMessageName() string { return "show_threads_reply" } -func (*ShowThreadsReply) GetCrcString() string { return "f5e0b66f" } +func (*ShowThreadsReply) GetCrcString() string { return "efd78e83" } func (*ShowThreadsReply) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *ShowThreadsReply) Size() int { @@ -1329,23 +1299,11 @@ func (m *ShowThreadsReply) Marshal(b []byte) ([]byte, error) { o.PutUint32(buf[pos:pos+4], uint32(v1.ID)) pos += 4 // field[2] v1.Name - for i := 0; i < 64; i++ { - var x uint8 - if i < len(v1.Name) { - x = uint8(v1.Name[i]) - } - buf[pos] = uint8(x) - pos += 1 - } + copy(buf[pos:pos+64], v1.Name) + pos += 64 // field[2] v1.Type - for i := 0; i < 64; i++ { - var x uint8 - if i < len(v1.Type) { - x = uint8(v1.Type[i]) - } - buf[pos] = uint8(x) - pos += 1 - } + copy(buf[pos:pos+64], v1.Type) + pos += 64 // field[2] v1.PID o.PutUint32(buf[pos:pos+4], uint32(v1.PID)) pos += 4 @@ -1379,16 +1337,16 @@ func (m *ShowThreadsReply) Unmarshal(tmp []byte) error { m.ThreadData[j1].ID = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[2] m.ThreadData[j1].Name - m.ThreadData[j1].Name = make([]uint8, 64) - for i := 0; i < len(m.ThreadData[j1].Name); i++ { - m.ThreadData[j1].Name[i] = uint8(tmp[pos]) - pos += 1 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.ThreadData[j1].Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } // field[2] m.ThreadData[j1].Type - m.ThreadData[j1].Type = make([]uint8, 64) - for i := 0; i < len(m.ThreadData[j1].Type); i++ { - m.ThreadData[j1].Type[i] = uint8(tmp[pos]) - pos += 1 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.ThreadData[j1].Type = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } // field[2] m.ThreadData[j1].PID m.ThreadData[j1].PID = uint32(o.Uint32(tmp[pos : pos+4])) diff --git a/examples/simple-client/simple_client.go b/examples/simple-client/simple_client.go index 0017eac..096c222 100644 --- a/examples/simple-client/simple_client.go +++ b/examples/simple-client/simple_client.go @@ -27,8 +27,10 @@ import ( "git.fd.io/govpp.git/adapter/socketclient" "git.fd.io/govpp.git/api" "git.fd.io/govpp.git/core" + "git.fd.io/govpp.git/examples/binapi/interface_types" "git.fd.io/govpp.git/examples/binapi/interfaces" "git.fd.io/govpp.git/examples/binapi/ip" + "git.fd.io/govpp.git/examples/binapi/ip_types" "git.fd.io/govpp.git/examples/binapi/vpe" ) @@ -166,8 +168,8 @@ func addIPAddress(ch api.Channel, index interfaces.InterfaceIndex) { IsAdd: true, Prefix: interfaces.AddressWithPrefix{ Address: interfaces.Address{ - Af: interfaces.ADDRESS_IP4, - Un: interfaces.AddressUnionIP4(interfaces.IP4Address{10, 10, 0, uint8(index)}), + Af: ip_types.ADDRESS_IP4, + Un: ip_types.AddressUnionIP4(interfaces.IP4Address{10, 10, 0, uint8(index)}), }, Len: 32, }, @@ -244,7 +246,7 @@ func interfaceNotifications(ch api.Channel, index interfaces.InterfaceIndex) { // generate some events in VPP err = ch.SendRequest(&interfaces.SwInterfaceSetFlags{ SwIfIndex: index, - Flags: interfaces.IF_STATUS_API_FLAG_ADMIN_UP, + Flags: interface_types.IF_STATUS_API_FLAG_ADMIN_UP, }).ReceiveReply(&interfaces.SwInterfaceSetFlagsReply{}) if err != nil { logError(err, "setting interface flags") diff --git a/examples/union-example/union_example.go b/examples/union-example/union_example.go index 9993ee1..6d4619d 100644 --- a/examples/union-example/union_example.go +++ b/examples/union-example/union_example.go @@ -53,7 +53,7 @@ func constructExample() { } func encodingExample() { - var c codec.MsgCodec + var c = codec.DefaultCodec // encode this message var msg = ip.IPPuntRedirect{ -- cgit 1.2.3-korg