From c4522fe10317b1729a0820dc880afc78c663f64d Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Thu, 6 Jun 2019 14:08:48 +0200 Subject: [PATCH] Add various generator improvements - generate service implementation for modules - generate conversion maps and String() method for enums - generate module name and version as constants - rename Union_data field to XXX_UnionData for consistency - generate constant GoVppAPIPackageIsVersionN for checking compatibility with API - add example for using service clients - add some documentation to socketclient adapter - cleanup gen.go file used for generating binapi - regenerate binapi with latest VPP release (19.04.1) - change global variables Messages into a function AllMessages Change-Id: Id1ef97764570759eaa3e5a4dc14ecda7a168ee39 Signed-off-by: Ondrej Fabry --- Makefile | 2 +- adapter/socketclient/doc.go | 33 + adapter/socketclient/socketclient.go | 2 +- cmd/binapi-generator/doc.go | 3 +- cmd/binapi-generator/generate.go | 197 +- cmd/binapi-generator/main.go | 84 +- cmd/binapi-generator/objects.go | 59 +- cmd/binapi-generator/parse.go | 82 +- cmd/binapi-generator/types.go | 4 +- core/channel_test.go | 8 +- core/connection_test.go | 4 +- examples/bin_api/VPP_VERSION | 1 - examples/bin_api/acl.api.json | 1055 ------- examples/bin_api/af_packet.api.json | 204 -- examples/bin_api/gen.go | 4 - examples/bin_api/interface.api.json | 1467 --------- examples/bin_api/ip.api.json | 3122 -------------------- examples/bin_api/map.api.json | 1022 ------- examples/bin_api/maps/maps.ba.go | 778 ----- examples/bin_api/memclnt.api.json | 598 ---- examples/bin_api/memif.api.json | 318 -- examples/bin_api/tap.api.json | 264 -- examples/bin_api/tap/tap.ba.go | 189 -- examples/bin_api/vpe.api.json | 490 --- examples/binapi/VPP_VERSION | 1 + examples/{bin_api => binapi}/acl/acl.ba.go | 360 ++- .../{bin_api => binapi}/af_packet/af_packet.ba.go | 118 +- examples/binapi/gen.go | 18 + .../interfaces/interfaces.ba.go | 443 ++- examples/{bin_api => binapi}/ip/ip.ba.go | 1017 +++++-- examples/{bin_api => binapi}/memclnt/memclnt.ba.go | 221 +- examples/{bin_api => binapi}/memif/memif.ba.go | 141 +- examples/{bin_api => binapi}/vpe/vpe.ba.go | 185 +- examples/perf-bench/perf-bench.go | 2 +- examples/service-client/service_client.go | 77 + examples/simple-client/simple_client.go | 6 +- examples/union-example/union_example.go | 2 +- 37 files changed, 2391 insertions(+), 10190 deletions(-) create mode 100644 adapter/socketclient/doc.go delete mode 100644 examples/bin_api/VPP_VERSION delete mode 100644 examples/bin_api/acl.api.json delete mode 100644 examples/bin_api/af_packet.api.json delete mode 100644 examples/bin_api/gen.go delete mode 100644 examples/bin_api/interface.api.json delete mode 100644 examples/bin_api/ip.api.json delete mode 100644 examples/bin_api/map.api.json delete mode 100644 examples/bin_api/maps/maps.ba.go delete mode 100644 examples/bin_api/memclnt.api.json delete mode 100644 examples/bin_api/memif.api.json delete mode 100644 examples/bin_api/tap.api.json delete mode 100644 examples/bin_api/tap/tap.ba.go delete mode 100644 examples/bin_api/vpe.api.json create mode 100644 examples/binapi/VPP_VERSION rename examples/{bin_api => binapi}/acl/acl.ba.go (68%) rename examples/{bin_api => binapi}/af_packet/af_packet.ba.go (60%) create mode 100644 examples/binapi/gen.go rename examples/{bin_api => binapi}/interfaces/interfaces.ba.go (69%) rename examples/{bin_api => binapi}/ip/ip.ba.go (68%) rename examples/{bin_api => binapi}/memclnt/memclnt.ba.go (67%) rename examples/{bin_api => binapi}/memif/memif.ba.go (62%) rename examples/{bin_api => binapi}/vpe/vpe.ba.go (67%) create mode 100644 examples/service-client/service_client.go diff --git a/Makefile b/Makefile index c4b742e..abc200b 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,7 @@ generate-binapi: generate: install @echo "=> generating code" - cd examples && go generate ./... + cd examples && go generate -x ./... update-vppapi: @echo "=> updating API JSON files using installed VPP ${VPP_VERSION}" diff --git a/adapter/socketclient/doc.go b/adapter/socketclient/doc.go new file mode 100644 index 0000000..0f93c56 --- /dev/null +++ b/adapter/socketclient/doc.go @@ -0,0 +1,33 @@ +// Copyright (c) 2018 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 socketclient is a pure Go implementation of adapter.VppAPI, which uses +// unix domain sockets as the transport for connecting to the VPP binary API. +// +// The current implementation only supports VPP binary API, the VPP stats API +// is not supported and clients still have to use vppapiclient for retrieving stats. +// +// +// Requirements +// +// The socketclient will connect to /run/vpp-api.sock by default. However this +// is not enabled in VPP configuration by default. +// +// To enable the socket in VPP, add following section to VPP config. +// +// socksvr { +// default +// } +// +package socketclient diff --git a/adapter/socketclient/socketclient.go b/adapter/socketclient/socketclient.go index 4a76df2..19fff7a 100644 --- a/adapter/socketclient/socketclient.go +++ b/adapter/socketclient/socketclient.go @@ -18,7 +18,7 @@ import ( "git.fd.io/govpp.git/adapter" "git.fd.io/govpp.git/codec" - "git.fd.io/govpp.git/examples/bin_api/memclnt" + "git.fd.io/govpp.git/examples/binapi/memclnt" ) const ( diff --git a/cmd/binapi-generator/doc.go b/cmd/binapi-generator/doc.go index e8556ec..d74d47b 100644 --- a/cmd/binapi-generator/doc.go +++ b/cmd/binapi-generator/doc.go @@ -7,7 +7,6 @@ // where each Go package will be placed into its own separate directory, // for example: // -// binapi-generator --input-file=examples/bin_api/acl.api.json --output-dir=examples/bin_api -// binapi-generator --input-dir=examples/bin_api --output-dir=examples/bin_api +// binapi-generator --input-file=/usr/share/vpp/api/core/interface.api.json --output-dir=. // package main diff --git a/cmd/binapi-generator/generate.go b/cmd/binapi-generator/generate.go index 4ffe88e..d9555e7 100644 --- a/cmd/binapi-generator/generate.go +++ b/cmd/binapi-generator/generate.go @@ -15,7 +15,6 @@ package main import ( - "bufio" "bytes" "fmt" "io" @@ -25,12 +24,23 @@ import ( "unicode" ) +// generatedCodeVersion indicates a version of the generated code. +// It is incremented whenever an incompatibility between the generated code and +// GoVPP api package is introduced; the generated code references +// a constant, api.GoVppAPIPackageIsVersionN (where N is generatedCodeVersion). +const generatedCodeVersion = 1 + const ( inputFileExt = ".api.json" // file extension of the VPP API files outputFileExt = ".ba.go" // file extension of the Go generated files govppApiImportPath = "git.fd.io/govpp.git/api" // import path of the govpp API package - constAPIVersionCrc = "APIVersionCrc" // name for the API version CRC constant + + constModuleName = "ModuleName" // module name constant + constAPIVersion = "APIVersion" // API version constant + constVersionCrc = "VersionCrc" // version CRC constant + + unionDataField = "XXX_UnionData" // name for the union data field ) // context is a structure storing data for code generation @@ -40,9 +50,10 @@ type context struct { inputData []byte // contents of the input file - includeAPIVersionCrc bool // include constant with API version CRC string - includeComments bool // include parts of original source in comments - includeBinapiNames bool // include binary API names as struct tag + includeAPIVersion bool // include constant with API version string + includeComments bool // include parts of original source in comments + includeBinapiNames bool // include binary API names as struct tag + includeServices bool // include service interface with client implementation moduleName string // name of the source VPP module packageName string // name of the Go package being generated @@ -83,25 +94,28 @@ func getContext(inputFile, outputDir string) (*context, error) { } // generatePackage generates code for the parsed package data and writes it into w -func generatePackage(ctx *context, w *bufio.Writer) error { +func generatePackage(ctx *context, w io.Writer) error { logf("generating package %q", ctx.packageName) // generate file header generateHeader(ctx, w) generateImports(ctx, w) - if ctx.includeAPIVersionCrc { - fmt.Fprintf(w, "// %s defines API version CRC of the VPP binary API module.\n", constAPIVersionCrc) - fmt.Fprintf(w, "const %s = %v\n", constAPIVersionCrc, ctx.packageData.APIVersion) - fmt.Fprintln(w) - } - - // generate services - if len(ctx.packageData.Services) > 0 { - generateServices(ctx, w, ctx.packageData.Services) + // generate module desc + fmt.Fprintln(w, "const (") + fmt.Fprintf(w, "\t// %s is the name of this module.\n", constModuleName) + fmt.Fprintf(w, "\t%s = \"%s\"\n", constModuleName, ctx.moduleName) - // TODO: generate implementation for Services interface + if ctx.includeAPIVersion { + if ctx.packageData.Version != "" { + fmt.Fprintf(w, "\t// %s is the API version of this module.\n", constAPIVersion) + fmt.Fprintf(w, "\t%s = \"%s\"\n", constAPIVersion, ctx.packageData.Version) + } + fmt.Fprintf(w, "\t// %s is the CRC of this module.\n", constVersionCrc) + fmt.Fprintf(w, "\t%s = %v\n", constVersionCrc, ctx.packageData.CRC) } + fmt.Fprintln(w, ")") + fmt.Fprintln(w) // generate enums if len(ctx.packageData.Enums) > 0 { @@ -156,17 +170,23 @@ func generatePackage(ctx *context, w *bufio.Writer) error { fmt.Fprintln(w, "}") fmt.Fprintln(w) - fmt.Fprintln(w, "var Messages = []api.Message{") + // 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.packageData.Messages { name := camelCaseName(msg.Name) fmt.Fprintf(w, "\t(*%s)(nil),\n", name) } fmt.Fprintln(w, "}") + fmt.Fprintln(w, "}") } - // flush the data: - if err := w.Flush(); err != nil { - return fmt.Errorf("flushing data to %s failed: %v", ctx.outputFile, err) + if ctx.includeServices { + // generate services + if len(ctx.packageData.Services) > 0 { + generateServices(ctx, w, ctx.packageData.Services) + } } return nil @@ -175,17 +195,18 @@ func generatePackage(ctx *context, w *bufio.Writer) error { // generateHeader writes generated package header into w func generateHeader(ctx *context, w io.Writer) { fmt.Fprintln(w, "// Code generated by GoVPP binapi-generator. DO NOT EDIT.") - fmt.Fprintf(w, "// source: %s\n", ctx.inputFile) + fmt.Fprintf(w, "// source: %s\n", ctx.inputFile) fmt.Fprintln(w) fmt.Fprintln(w, "/*") - fmt.Fprintf(w, " Package %s is a generated from VPP binary API module '%s'.\n", ctx.packageName, ctx.moduleName) + fmt.Fprintf(w, "Package %s is a generated from VPP binary API module '%s'.\n", ctx.packageName, ctx.moduleName) fmt.Fprintln(w) - fmt.Fprintln(w, " It contains following objects:") + fmt.Fprintf(w, " The %s module consists of:\n", ctx.moduleName) var printObjNum = func(obj string, num int) { if num > 0 { if num > 1 { if strings.HasSuffix(obj, "s") { + obj += "es" } else { obj += "s" @@ -195,13 +216,14 @@ func generateHeader(ctx *context, w io.Writer) { } } - printObjNum("service", len(ctx.packageData.Services)) printObjNum("enum", len(ctx.packageData.Enums)) printObjNum("alias", len(ctx.packageData.Aliases)) printObjNum("type", len(ctx.packageData.Types)) printObjNum("union", len(ctx.packageData.Unions)) printObjNum("message", len(ctx.packageData.Messages)) + printObjNum("service", len(ctx.packageData.Services)) fmt.Fprintln(w, "*/") + fmt.Fprintf(w, "package %s\n", ctx.packageName) fmt.Fprintln(w) } @@ -209,28 +231,32 @@ func generateHeader(ctx *context, w io.Writer) { // generateImports writes generated package imports into w func generateImports(ctx *context, w io.Writer) { fmt.Fprintf(w, "import api \"%s\"\n", govppApiImportPath) - fmt.Fprintf(w, "import struc \"%s\"\n", "github.com/lunixbochs/struc") fmt.Fprintf(w, "import bytes \"%s\"\n", "bytes") + fmt.Fprintf(w, "import context \"%s\"\n", "context") + fmt.Fprintf(w, "import strconv \"%s\"\n", "strconv") + fmt.Fprintf(w, "import struc \"%s\"\n", "github.com/lunixbochs/struc") fmt.Fprintln(w) 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 _ = struc.Pack\n") fmt.Fprintf(w, "var _ = bytes.NewBuffer\n") + fmt.Fprintf(w, "var _ = context.Background\n") + fmt.Fprintf(w, "var _ = strconv.Itoa\n") + fmt.Fprintf(w, "var _ = struc.Pack\n") fmt.Fprintln(w) - /*fmt.Fprintln(w, "// This is a compile-time assertion to ensure that this generated file") + 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.Fprintln(w, "const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package") - fmt.Fprintln(w)*/ + fmt.Fprintf(w, "const _ = api.GoVppAPIPackageIsVersion%d // please upgrade the GoVPP api package\n", generatedCodeVersion) + fmt.Fprintln(w) } // generateComment writes generated comment for the object into w func generateComment(ctx *context, w io.Writer, goName string, vppName string, objKind string) { if objKind == "service" { - fmt.Fprintf(w, "// %s represents VPP binary API services:\n", goName) + fmt.Fprintf(w, "// %s represents VPP binary API services in %s module.\n", ctx.moduleName, goName) } else { fmt.Fprintf(w, "// %s represents VPP binary API %s '%s':\n", goName, objKind, vppName) } @@ -290,22 +316,69 @@ func generateComment(ctx *context, w io.Writer, goName string, vppName string, o } // generateServices writes generated code for the Services interface into w -func generateServices(ctx *context, w *bufio.Writer, services []Service) { +func generateServices(ctx *context, w io.Writer, services []Service) { + const apiName = "Service" + const implName = "service" + // generate services comment - generateComment(ctx, w, "Services", "services", "service") + generateComment(ctx, w, apiName, "services", "service") // generate interface - fmt.Fprintf(w, "type %s interface {\n", "Services") + fmt.Fprintf(w, "type %s interface {\n", apiName) for _, svc := range services { - generateService(ctx, w, &svc) + generateServiceMethod(ctx, w, &svc) + fmt.Fprintln(w) } fmt.Fprintln(w, "}") + fmt.Fprintln(w) + + // generate client implementation + fmt.Fprintf(w, "type %s struct {\n", implName) + fmt.Fprintf(w, "\tch api.Channel\n") + fmt.Fprintln(w, "}") + fmt.Fprintln(w) + + fmt.Fprintf(w, "func New%[1]s(ch api.Channel) %[1]s {\n", apiName) + fmt.Fprintf(w, "\treturn &%s{ch}\n", implName) + fmt.Fprintln(w, "}") + fmt.Fprintln(w) + + for _, svc := range services { + fmt.Fprintf(w, "func (c *%s) ", implName) + generateServiceMethod(ctx, w, &svc) + fmt.Fprintln(w, " {") + if svc.Stream { + // TODO: stream responses + //fmt.Fprintf(w, "\tstream := make(chan *%s)\n", camelCaseName(svc.ReplyType)) + replyTyp := camelCaseName(svc.ReplyType) + fmt.Fprintf(w, "\tvar dump []*%s\n", replyTyp) + fmt.Fprintf(w, "\treq := c.ch.SendMultiRequest(in)\n") + fmt.Fprintf(w, "\tfor {\n") + fmt.Fprintf(w, "\tm := new(%s)\n", replyTyp) + fmt.Fprintf(w, "\tstop, err := req.ReceiveReply(m)\n") + fmt.Fprintf(w, "\tif stop { break }\n") + fmt.Fprintf(w, "\tif err != nil { return nil, err }\n") + fmt.Fprintf(w, "\tdump = append(dump, m)\n") + fmt.Fprintln(w, "}") + fmt.Fprintf(w, "\treturn dump, nil\n") + } else if replyTyp := camelCaseName(svc.ReplyType); 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") + fmt.Fprintf(w, "\treturn out, nil\n") + } else { + fmt.Fprintf(w, "\tc.ch.SendRequest(in)\n") + fmt.Fprintf(w, "\treturn nil\n") + } + fmt.Fprintln(w, "}") + fmt.Fprintln(w) + } fmt.Fprintln(w) } -// generateService writes generated code for the service into w -func generateService(ctx *context, w io.Writer, svc *Service) { +// generateServiceMethod writes generated code for the service into w +func generateServiceMethod(ctx *context, w io.Writer, svc *Service) { reqTyp := camelCaseName(svc.RequestType) // method name is same as parameter type name by default @@ -317,17 +390,19 @@ func generateService(ctx *context, w io.Writer, svc *Service) { } } - params := fmt.Sprintf("*%s", reqTyp) + params := fmt.Sprintf("in *%s", reqTyp) returns := "error" if replyType := camelCaseName(svc.ReplyType); replyType != "" { - repTyp := fmt.Sprintf("*%s", replyType) + replyTyp := fmt.Sprintf("*%s", replyType) if svc.Stream { - repTyp = fmt.Sprintf("[]%s", repTyp) + // TODO: stream responses + //replyTyp = fmt.Sprintf("<-chan %s", replyTyp) + replyTyp = fmt.Sprintf("[]%s", replyTyp) } - returns = fmt.Sprintf("(%s, error)", repTyp) + returns = fmt.Sprintf("(%s, error)", replyTyp) } - fmt.Fprintf(w, "\t%s(%s) %s\n", method, params, returns) + fmt.Fprintf(w, "\t%s(ctx context.Context, %s) %s", method, params, returns) } // generateEnum writes generated code for the enum into w @@ -344,15 +419,34 @@ func generateEnum(ctx *context, w io.Writer, enum *Enum) { fmt.Fprintf(w, "type %s %s\n", name, typ) fmt.Fprintln(w) - fmt.Fprintln(w, "const (") - // generate enum entries + fmt.Fprintln(w, "const (") for _, entry := range enum.Entries { fmt.Fprintf(w, "\t%s %s = %v\n", entry.Name, name, entry.Value) } - fmt.Fprintln(w, ")") + fmt.Fprintln(w) + // generate enum conversion maps + fmt.Fprintf(w, "var %s_name = map[%s]string{\n", name, typ) + for _, entry := range enum.Entries { + fmt.Fprintf(w, "\t%v: \"%s\",\n", entry.Value, entry.Name) + } + fmt.Fprintln(w, "}") + fmt.Fprintln(w) + + fmt.Fprintf(w, "var %s_value = map[string]%s{\n", name, typ) + for _, entry := range enum.Entries { + fmt.Fprintf(w, "\t\"%s\": %v,\n", entry.Name, entry.Value) + } + fmt.Fprintln(w, "}") + fmt.Fprintln(w) + + fmt.Fprintf(w, "func (x %s) String() string {\n", name) + fmt.Fprintf(w, "\ts, ok := %s_name[%s(x)]\n", name, typ) + fmt.Fprintf(w, "\tif ok { return s }\n") + fmt.Fprintf(w, "\treturn strconv.Itoa(int(x))\n") + fmt.Fprintln(w, "}") fmt.Fprintln(w) } @@ -394,8 +488,7 @@ func generateUnion(ctx *context, w io.Writer, union *Union) { maxSize := getUnionSize(ctx, union) // generate data field - fieldName := "Union_data" - fmt.Fprintf(w, "\t%s [%d]byte\n", fieldName, maxSize) + fmt.Fprintf(w, "\t%s [%d]byte\n", unionDataField, maxSize) // generate end of the struct fmt.Fprintln(w, "}") @@ -420,9 +513,9 @@ func generateUnion(ctx *context, w io.Writer, union *Union) { } // generateUnionMethods generates methods that implement struc.Custom -// interface to allow having Union_data field unexported +// interface to allow having XXX_uniondata field unexported // TODO: do more testing when unions are actually used in some messages -func generateUnionMethods(w io.Writer, structName string) { +/*func generateUnionMethods(w io.Writer, structName string) { // generate struc.Custom implementation for union fmt.Fprintf(w, ` func (u *%[1]s) Pack(p []byte, opt *struc.Options) (int, error) { @@ -443,7 +536,7 @@ func (u *%[1]s) String() string { return string(u.union_data[:]) } `, structName) -} +}*/ func generateUnionGetterSetter(w io.Writer, structName string, getterField, getterStruct string) { fmt.Fprintf(w, ` @@ -456,14 +549,14 @@ func (u *%[1]s) Set%[2]s(a %[3]s) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.%[4]s[:], b.Bytes()) } func (u *%[1]s) Get%[2]s() (a %[3]s) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.%[4]s[:]) struc.Unpack(b, &a) return } -`, structName, getterField, getterStruct) +`, structName, getterField, getterStruct, unionDataField) } // generateType writes generated code for the type into w diff --git a/cmd/binapi-generator/main.go b/cmd/binapi-generator/main.go index faed54f..75926e1 100644 --- a/cmd/binapi-generator/main.go +++ b/cmd/binapi-generator/main.go @@ -15,7 +15,7 @@ package main import ( - "bufio" + "bytes" "encoding/json" "flag" "fmt" @@ -33,21 +33,16 @@ var ( inputFile = flag.String("input-file", "", "Input file with VPP API in JSON format.") inputDir = flag.String("input-dir", ".", "Input directory with VPP API files in JSON format.") outputDir = flag.String("output-dir", ".", "Output directory where package folders will be generated.") - includeAPIVer = flag.Bool("include-apiver", false, "Include APIVersion constant for each module.") + includeAPIVer = flag.Bool("include-apiver", true, "Include APIVersion constant for each module.") includeComments = flag.Bool("include-comments", false, "Include JSON API source in comments for each object.") includeBinapiNames = flag.Bool("include-binapi-names", false, "Include binary API names in struct tag.") + includeServices = flag.Bool("include-services", false, "Include service interface with client implementation.") continueOnError = flag.Bool("continue-onerror", false, "Continue with next file on error.") debug = flag.Bool("debug", debugMode, "Enable debug mode.") ) var debugMode = os.Getenv("DEBUG_BINAPI_GENERATOR") != "" -var log = logrus.Logger{ - Level: logrus.InfoLevel, - Formatter: &logrus.TextFormatter{}, - Out: os.Stdout, -} - func main() { flag.Parse() if *debug { @@ -100,49 +95,51 @@ func getInputFiles(inputDir string) (res []string, err error) { // generateFromFile generates Go package from one input JSON file func generateFromFile(inputFile, outputDir string) error { - logf("generating from file: %q", inputFile) - defer logf("--------------------------------------") + logf("generating from file: %s", inputFile) + logf("------------------------------------------------------------") + defer logf("------------------------------------------------------------") ctx, err := getContext(inputFile, outputDir) if err != nil { return err } - ctx.includeAPIVersionCrc = *includeAPIVer + // prepare options + ctx.includeAPIVersion = *includeAPIVer ctx.includeComments = *includeComments ctx.includeBinapiNames = *includeBinapiNames + ctx.includeServices = *includeServices - // read input file contents - ctx.inputData, err = readFile(inputFile) + // read API definition from input file + ctx.inputData, err = ioutil.ReadFile(ctx.inputFile) if err != nil { - return err + return fmt.Errorf("reading input file %s failed: %v", ctx.inputFile, err) } + // parse JSON data into objects - jsonRoot, err := parseJSON(ctx.inputData) - if err != nil { - return err + jsonRoot := new(jsongo.JSONNode) + if err := json.Unmarshal(ctx.inputData, jsonRoot); err != nil { + return fmt.Errorf("unmarshalling JSON failed: %v", err) } ctx.packageData, err = parsePackage(ctx, jsonRoot) if err != nil { - return err + return fmt.Errorf("parsing package %s failed: %v", ctx.packageName, err) + } + + // generate Go package code + var buf bytes.Buffer + if err := generatePackage(ctx, &buf); err != nil { + return fmt.Errorf("generating code for package %s failed: %v", ctx.packageName, err) } // create output directory packageDir := filepath.Dir(ctx.outputFile) - if err := os.MkdirAll(packageDir, 0777); err != nil { - return fmt.Errorf("creating output directory %q failed: %v", packageDir, err) + if err := os.MkdirAll(packageDir, 06); err != nil { + return fmt.Errorf("creating output dir %s failed: %v", packageDir, err) } - // open output file - f, err := os.Create(ctx.outputFile) - if err != nil { - return fmt.Errorf("creating output file %q failed: %v", ctx.outputFile, err) - } - defer f.Close() - - // generate Go package code - w := bufio.NewWriter(f) - if err := generatePackage(ctx, w); err != nil { - return err + // write generated code to output file + if err := ioutil.WriteFile(ctx.outputFile, buf.Bytes(), 0666); err != nil { + return fmt.Errorf("writing to output file %s failed: %v", ctx.outputFile, err) } // go format the output file (fail probably means the output is not compilable) @@ -154,35 +151,14 @@ func generateFromFile(inputFile, outputDir string) error { // count number of lines in generated output file cmd = exec.Command("wc", "-l", ctx.outputFile) if output, err := cmd.CombinedOutput(); err != nil { - log.Warnf("wc command failed: %v\n%s", err, string(output)) + logf("wc command failed: %v\n%s", err, string(output)) } else { - logf("generated lines: %s", output) + logf("number of generated lines: %s", output) } return nil } -// readFile reads content of a file into memory -func readFile(inputFile string) ([]byte, error) { - inputData, err := ioutil.ReadFile(inputFile) - if err != nil { - return nil, fmt.Errorf("reading data from file failed: %v", err) - } - - return inputData, nil -} - -// parseJSON parses a JSON data into an in-memory tree -func parseJSON(inputData []byte) (*jsongo.JSONNode, error) { - root := jsongo.JSONNode{} - - if err := json.Unmarshal(inputData, &root); err != nil { - return nil, fmt.Errorf("unmarshalling JSON failed: %v", err) - } - - return &root, nil -} - func logf(f string, v ...interface{}) { if *debug { logrus.Debugf(f, v...) diff --git a/cmd/binapi-generator/objects.go b/cmd/binapi-generator/objects.go index 8f5e8ef..e3270de 100644 --- a/cmd/binapi-generator/objects.go +++ b/cmd/binapi-generator/objects.go @@ -1,15 +1,18 @@ package main +import "fmt" + // Package represents collection of objects parsed from VPP binary API JSON data type Package struct { - APIVersion string - Services []Service - Enums []Enum - Aliases []Alias - Types []Type - Unions []Union - Messages []Message - RefMap map[string]string + Version string + CRC string + Services []Service + Enums []Enum + Aliases []Alias + Types []Type + Unions []Union + Messages []Message + RefMap map[string]string } // Service represents VPP binary API service @@ -85,3 +88,43 @@ const ( eventMessage // VPP event message otherMessage // other VPP message ) + +// printPackage prints all loaded objects for package +func printPackage(pkg *Package) { + if len(pkg.Enums) > 0 { + logf("loaded %d enums:", len(pkg.Enums)) + for k, enum := range pkg.Enums { + logf(" - enum #%d\t%+v", k, enum) + } + } + if len(pkg.Unions) > 0 { + logf("loaded %d unions:", len(pkg.Unions)) + for k, union := range pkg.Unions { + logf(" - union #%d\t%+v", k, union) + } + } + if len(pkg.Types) > 0 { + logf("loaded %d types:", len(pkg.Types)) + for _, typ := range pkg.Types { + logf(" - type: %q (%d fields)", typ.Name, len(typ.Fields)) + } + } + if len(pkg.Messages) > 0 { + logf("loaded %d messages:", len(pkg.Messages)) + for _, msg := range pkg.Messages { + logf(" - message: %q (%d fields)", msg.Name, len(msg.Fields)) + } + } + if len(pkg.Services) > 0 { + logf("loaded %d services:", len(pkg.Services)) + for _, svc := range pkg.Services { + var info string + if svc.Stream { + info = "(STREAM)" + } else if len(svc.Events) > 0 { + info = fmt.Sprintf("(EVENTS: %v)", svc.Events) + } + logf(" - service: %s - %q -> %q %s", svc.Name, svc.RequestType, svc.ReplyType, info) + } + } +} diff --git a/cmd/binapi-generator/parse.go b/cmd/binapi-generator/parse.go index 662ed34..562abab 100644 --- a/cmd/binapi-generator/parse.go +++ b/cmd/binapi-generator/parse.go @@ -21,6 +21,7 @@ import ( "strings" "github.com/bennyscetbun/jsongo" + "github.com/sirupsen/logrus" ) // top level objects @@ -32,6 +33,7 @@ const ( objServices = "services" objAliases = "aliases" vlAPIVersion = "vl_api_version" + objOptions = "options" ) // various object fields @@ -64,11 +66,32 @@ const ( fieldMetaLimit = "limit" ) +// module options +const ( + versionOption = "version" +) + // parsePackage parses provided JSON data into objects prepared for code generation func parsePackage(ctx *context, jsonRoot *jsongo.JSONNode) (*Package, error) { - logf(" %s (version: %s) contains: %d services, %d messages, %d types, %d enums, %d unions, %d aliases", + pkg := Package{ + RefMap: make(map[string]string), + } + + // parse CRC for API version + if crc := jsonRoot.At(vlAPIVersion); crc.GetType() == jsongo.TypeValue { + pkg.CRC = crc.Get().(string) + } + + // parse version string + if opt := jsonRoot.Map(objOptions); opt.GetType() == jsongo.TypeMap { + if ver := opt.Map(versionOption); ver.GetType() == jsongo.TypeValue { + pkg.Version = ver.Get().(string) + } + } + + logf("parsing package %s (version: %s, CRC: %s) contains: %d services, %d messages, %d types, %d enums, %d unions, %d aliases", ctx.packageName, - jsonRoot.Map(vlAPIVersion).Get(), + pkg.Version, pkg.CRC, jsonRoot.Map(objServices).Len(), jsonRoot.Map(objMessages).Len(), jsonRoot.Map(objTypes).Len(), @@ -77,11 +100,6 @@ func parsePackage(ctx *context, jsonRoot *jsongo.JSONNode) (*Package, error) { jsonRoot.Map(objAliases).Len(), ) - pkg := Package{ - APIVersion: jsonRoot.Map(vlAPIVersion).Get().(string), - RefMap: make(map[string]string), - } - // parse enums enums := jsonRoot.Map(objEnums) pkg.Enums = make([]Enum, enums.Len()) @@ -201,46 +219,6 @@ func parsePackage(ctx *context, jsonRoot *jsongo.JSONNode) (*Package, error) { return &pkg, nil } -// printPackage prints all loaded objects for package -func printPackage(pkg *Package) { - if len(pkg.Enums) > 0 { - logf("loaded %d enums:", len(pkg.Enums)) - for k, enum := range pkg.Enums { - logf(" - enum #%d\t%+v", k, enum) - } - } - if len(pkg.Unions) > 0 { - logf("loaded %d unions:", len(pkg.Unions)) - for k, union := range pkg.Unions { - logf(" - union #%d\t%+v", k, union) - } - } - if len(pkg.Types) > 0 { - logf("loaded %d types:", len(pkg.Types)) - for _, typ := range pkg.Types { - logf(" - type: %q (%d fields)", typ.Name, len(typ.Fields)) - } - } - if len(pkg.Messages) > 0 { - logf("loaded %d messages:", len(pkg.Messages)) - for _, msg := range pkg.Messages { - logf(" - message: %q (%d fields)", msg.Name, len(msg.Fields)) - } - } - if len(pkg.Services) > 0 { - logf("loaded %d services:", len(pkg.Services)) - for _, svc := range pkg.Services { - var info string - if svc.Stream { - info = "(STREAM)" - } else if len(svc.Events) > 0 { - info = fmt.Sprintf("(EVENTS: %v)", svc.Events) - } - logf(" - service: %q -> %q %s", svc.RequestType, svc.ReplyType, info) - } - } -} - // parseEnum parses VPP binary API enum object from JSON node func parseEnum(ctx *context, enumNode *jsongo.JSONNode) (*Enum, error) { if enumNode.Len() == 0 || enumNode.At(0).GetType() != jsongo.TypeValue { @@ -466,7 +444,7 @@ func parseField(ctx *context, field *jsongo.JSONNode) (*Field, error) { case fieldMetaLimit: f.Meta.Limit = int(metaNode.Get().(float64)) default: - log.Warnf("unknown meta info (%s) for field (%s)", metaName, fieldName) + logrus.Warnf("unknown meta info (%s) for field (%s)", metaName, fieldName) } } } else { @@ -491,7 +469,7 @@ func parseService(ctx *context, svcName string, svcNode *jsongo.JSONNode) (*Serv } svc := Service{ - Name: ctx.moduleName + "." + svcName, + Name: svcName, RequestType: svcName, } @@ -526,7 +504,7 @@ func parseService(ctx *context, svcName string, svcNode *jsongo.JSONNode) (*Serv if len(svc.Events) > 0 { // EVENT service if !strings.HasPrefix(svc.RequestType, serviceEventPrefix) { - log.Debugf("unusual EVENTS service: %+v\n"+ + logrus.Debugf("unusual EVENTS service: %+v\n"+ "- events service %q does not have %q prefix in request.", svc, svc.Name, serviceEventPrefix) } @@ -534,7 +512,7 @@ func parseService(ctx *context, svcName string, svcNode *jsongo.JSONNode) (*Serv // STREAM service if !strings.HasSuffix(svc.RequestType, serviceDumpSuffix) || !strings.HasSuffix(svc.ReplyType, serviceDetailsSuffix) { - log.Debugf("unusual STREAM service: %+v\n"+ + logrus.Debugf("unusual STREAM service: %+v\n"+ "- stream service %q does not have %q suffix in request or reply does not have %q suffix.", svc, svc.Name, serviceDumpSuffix, serviceDetailsSuffix) } @@ -542,7 +520,7 @@ func parseService(ctx *context, svcName string, svcNode *jsongo.JSONNode) (*Serv // REQUEST service // some messages might have `null` reply (for example: memclnt) if !strings.HasSuffix(svc.ReplyType, serviceReplySuffix) { - log.Debugf("unusual REQUEST service: %+v\n"+ + logrus.Debugf("unusual REQUEST service: %+v\n"+ "- service %q does not have %q suffix in reply.", svc, svc.Name, serviceReplySuffix) } diff --git a/cmd/binapi-generator/types.go b/cmd/binapi-generator/types.go index d056251..90c890f 100644 --- a/cmd/binapi-generator/types.go +++ b/cmd/binapi-generator/types.go @@ -18,6 +18,8 @@ import ( "fmt" "strconv" "strings" + + "github.com/sirupsen/logrus" ) // toApiType returns name that is used as type reference in VPP binary API @@ -62,7 +64,7 @@ func convertToGoType(ctx *context, binapiType string) (typ string) { typ = binapiType default: // fallback type - log.Warnf("found unknown VPP binary API type %q, using byte", binapiType) + logrus.Warnf("found unknown VPP binary API type %q, using byte", binapiType) typ = "byte" } } diff --git a/core/channel_test.go b/core/channel_test.go index b06e3e9..ba761b3 100644 --- a/core/channel_test.go +++ b/core/channel_test.go @@ -19,10 +19,10 @@ import ( "time" "git.fd.io/govpp.git/adapter/mock" - "git.fd.io/govpp.git/examples/bin_api/interfaces" - "git.fd.io/govpp.git/examples/bin_api/memif" - "git.fd.io/govpp.git/examples/bin_api/tap" - "git.fd.io/govpp.git/examples/bin_api/vpe" + "git.fd.io/govpp.git/examples/binapi/interfaces" + "git.fd.io/govpp.git/examples/binapi/memif" + "git.fd.io/govpp.git/examples/binapi/tap" + "git.fd.io/govpp.git/examples/binapi/vpe" "git.fd.io/govpp.git/api" . "github.com/onsi/gomega" diff --git a/core/connection_test.go b/core/connection_test.go index 843c5ea..71f1a18 100644 --- a/core/connection_test.go +++ b/core/connection_test.go @@ -21,8 +21,8 @@ import ( "git.fd.io/govpp.git/api" "git.fd.io/govpp.git/codec" "git.fd.io/govpp.git/core" - "git.fd.io/govpp.git/examples/bin_api/interfaces" - "git.fd.io/govpp.git/examples/bin_api/vpe" + "git.fd.io/govpp.git/examples/binapi/interfaces" + "git.fd.io/govpp.git/examples/binapi/vpe" . "github.com/onsi/gomega" ) diff --git a/examples/bin_api/VPP_VERSION b/examples/bin_api/VPP_VERSION deleted file mode 100644 index fd1330c..0000000 --- a/examples/bin_api/VPP_VERSION +++ /dev/null @@ -1 +0,0 @@ -v19.01-2-gcd56f69af diff --git a/examples/bin_api/acl.api.json b/examples/bin_api/acl.api.json deleted file mode 100644 index 1aa8285..0000000 --- a/examples/bin_api/acl.api.json +++ /dev/null @@ -1,1055 +0,0 @@ -{ - "messages": [ - [ - "acl_plugin_get_version", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "acl_plugin_get_version_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "major" - ], - [ - "u32", - "minor" - ], - { - "crc": "0x9b32cf86" - } - ], - [ - "acl_plugin_control_ping", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "acl_plugin_control_ping_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "vpe_pid" - ], - { - "crc": "0xf6b0b8ca" - } - ], - [ - "acl_plugin_get_conn_table_max_entries", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "acl_plugin_get_conn_table_max_entries_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u64", - "conn_table_max_entries" - ], - { - "crc": "0x7a096d3d" - } - ], - [ - "acl_add_replace", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "acl_index" - ], - [ - "u8", - "tag", - 64 - ], - [ - "u32", - "count" - ], - [ - "vl_api_acl_rule_t", - "r", - 0, - "count" - ], - { - "crc": "0xe839997e" - } - ], - [ - "acl_add_replace_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "acl_index" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xac407b0c" - } - ], - [ - "acl_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "acl_index" - ], - { - "crc": "0xef34fea4" - } - ], - [ - "acl_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "acl_interface_add_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "is_add" - ], - [ - "u8", - "is_input" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "acl_index" - ], - { - "crc": "0x0b2aedd1" - } - ], - [ - "acl_interface_add_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "acl_interface_set_acl_list", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "count" - ], - [ - "u8", - "n_input" - ], - [ - "u32", - "acls", - 0, - "count" - ], - { - "crc": "0x8baece38" - } - ], - [ - "acl_interface_set_acl_list_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "acl_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "acl_index" - ], - { - "crc": "0xef34fea4" - } - ], - [ - "acl_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "acl_index" - ], - [ - "u8", - "tag", - 64 - ], - [ - "u32", - "count" - ], - [ - "vl_api_acl_rule_t", - "r", - 0, - "count" - ], - { - "crc": "0x5bd895be" - } - ], - [ - "acl_interface_list_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0x529cb13f" - } - ], - [ - "acl_interface_list_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "count" - ], - [ - "u8", - "n_input" - ], - [ - "u32", - "acls", - 0, - "count" - ], - { - "crc": "0xd5e80809" - } - ], - [ - "macip_acl_add", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "tag", - 64 - ], - [ - "u32", - "count" - ], - [ - "vl_api_macip_acl_rule_t", - "r", - 0, - "count" - ], - { - "crc": "0xb3d3d65a" - } - ], - [ - "macip_acl_add_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "acl_index" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xac407b0c" - } - ], - [ - "macip_acl_add_replace", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "acl_index" - ], - [ - "u8", - "tag", - 64 - ], - [ - "u32", - "count" - ], - [ - "vl_api_macip_acl_rule_t", - "r", - 0, - "count" - ], - { - "crc": "0xa0e8c01b" - } - ], - [ - "macip_acl_add_replace_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "acl_index" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xac407b0c" - } - ], - [ - "macip_acl_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "acl_index" - ], - { - "crc": "0xef34fea4" - } - ], - [ - "macip_acl_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "macip_acl_interface_add_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "is_add" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "acl_index" - ], - { - "crc": "0x6a6be97c" - } - ], - [ - "macip_acl_interface_add_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "macip_acl_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "acl_index" - ], - { - "crc": "0xef34fea4" - } - ], - [ - "macip_acl_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "acl_index" - ], - [ - "u8", - "tag", - 64 - ], - [ - "u32", - "count" - ], - [ - "vl_api_macip_acl_rule_t", - "r", - 0, - "count" - ], - { - "crc": "0xdd2b55ba" - } - ], - [ - "macip_acl_interface_get", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "macip_acl_interface_get_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "count" - ], - [ - "u32", - "acls", - 0, - "count" - ], - { - "crc": "0xaccf9b05" - } - ], - [ - "macip_acl_interface_list_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0x529cb13f" - } - ], - [ - "macip_acl_interface_list_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "count" - ], - [ - "u32", - "acls", - 0, - "count" - ], - { - "crc": "0x29783fa0" - } - ], - [ - "acl_interface_set_etype_whitelist", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "count" - ], - [ - "u8", - "n_input" - ], - [ - "u16", - "whitelist", - 0, - "count" - ], - { - "crc": "0xf515efc5" - } - ], - [ - "acl_interface_set_etype_whitelist_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "acl_interface_etype_whitelist_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0x529cb13f" - } - ], - [ - "acl_interface_etype_whitelist_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "count" - ], - [ - "u8", - "n_input" - ], - [ - "u16", - "whitelist", - 0, - "count" - ], - { - "crc": "0x6a5d4e81" - } - ] - ], - "vl_api_version": "0x8ed22cb9", - "unions": [], - "services": { - "acl_plugin_get_version": { - "reply": "acl_plugin_get_version_reply" - }, - "acl_dump": { - "reply": "acl_details", - "stream": true - }, - "acl_interface_add_del": { - "reply": "acl_interface_add_del_reply" - }, - "acl_del": { - "reply": "acl_del_reply" - }, - "macip_acl_del": { - "reply": "macip_acl_del_reply" - }, - "acl_plugin_control_ping": { - "reply": "acl_plugin_control_ping_reply" - }, - "macip_acl_interface_get": { - "reply": "macip_acl_interface_get_reply" - }, - "acl_interface_etype_whitelist_dump": { - "reply": "acl_interface_etype_whitelist_details", - "stream": true - }, - "macip_acl_interface_add_del": { - "reply": "macip_acl_interface_add_del_reply" - }, - "acl_add_replace": { - "reply": "acl_add_replace_reply" - }, - "acl_plugin_get_conn_table_max_entries": { - "reply": "acl_plugin_get_conn_table_max_entries_reply" - }, - "acl_interface_list_dump": { - "reply": "acl_interface_list_details", - "stream": true - }, - "acl_interface_set_acl_list": { - "reply": "acl_interface_set_acl_list_reply" - }, - "macip_acl_add": { - "reply": "macip_acl_add_reply" - }, - "acl_interface_set_etype_whitelist": { - "reply": "acl_interface_set_etype_whitelist_reply" - }, - "macip_acl_add_replace": { - "reply": "macip_acl_add_replace_reply" - }, - "macip_acl_dump": { - "reply": "macip_acl_details", - "stream": true - }, - "macip_acl_interface_list_dump": { - "reply": "macip_acl_interface_list_details", - "stream": true - } - }, - "enums": [], - "types": [ - [ - "acl_rule", - [ - "u8", - "is_permit" - ], - [ - "u8", - "is_ipv6" - ], - [ - "u8", - "src_ip_addr", - 16 - ], - [ - "u8", - "src_ip_prefix_len" - ], - [ - "u8", - "dst_ip_addr", - 16 - ], - [ - "u8", - "dst_ip_prefix_len" - ], - [ - "u8", - "proto" - ], - [ - "u16", - "srcport_or_icmptype_first" - ], - [ - "u16", - "srcport_or_icmptype_last" - ], - [ - "u16", - "dstport_or_icmpcode_first" - ], - [ - "u16", - "dstport_or_icmpcode_last" - ], - [ - "u8", - "tcp_flags_mask" - ], - [ - "u8", - "tcp_flags_value" - ], - { - "crc": "0x6f99bf4d" - } - ], - [ - "macip_acl_rule", - [ - "u8", - "is_permit" - ], - [ - "u8", - "is_ipv6" - ], - [ - "u8", - "src_mac", - 6 - ], - [ - "u8", - "src_mac_mask", - 6 - ], - [ - "u8", - "src_ip_addr", - 16 - ], - [ - "u8", - "src_ip_prefix_len" - ], - { - "crc": "0x70589f1e" - } - ] - ], - "aliases": {} -} diff --git a/examples/bin_api/af_packet.api.json b/examples/bin_api/af_packet.api.json deleted file mode 100644 index 0d57e38..0000000 --- a/examples/bin_api/af_packet.api.json +++ /dev/null @@ -1,204 +0,0 @@ -{ - "messages": [ - [ - "af_packet_create", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "host_if_name", - 64 - ], - [ - "u8", - "hw_addr", - 6 - ], - [ - "u8", - "use_random_hw_addr" - ], - { - "crc": "0x6d5d30d6" - } - ], - [ - "af_packet_create_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0xfda5941f" - } - ], - [ - "af_packet_delete", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "host_if_name", - 64 - ], - { - "crc": "0x3efceda3" - } - ], - [ - "af_packet_delete_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "af_packet_set_l4_cksum_offload", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "sw_if_index" - ], - [ - "u8", - "set" - ], - { - "crc": "0x86538585" - } - ], - [ - "af_packet_set_l4_cksum_offload_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "af_packet_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "af_packet_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "host_if_name", - 64 - ], - { - "crc": "0x057205fa" - } - ] - ], - "vl_api_version": "0x206563c", - "unions": [], - "services": { - "af_packet_dump": { - "reply": "af_packet_details", - "stream": true - }, - "af_packet_set_l4_cksum_offload": { - "reply": "af_packet_set_l4_cksum_offload_reply" - }, - "af_packet_delete": { - "reply": "af_packet_delete_reply" - }, - "af_packet_create": { - "reply": "af_packet_create_reply" - } - }, - "enums": [], - "types": [], - "aliases": {} -} diff --git a/examples/bin_api/gen.go b/examples/bin_api/gen.go deleted file mode 100644 index de6e275..0000000 --- a/examples/bin_api/gen.go +++ /dev/null @@ -1,4 +0,0 @@ -package bin_api - -// Generates Go bindings for all VPP APIs located in the json directory. -//go:generate binapi-generator --input-dir=. --output-dir=. diff --git a/examples/bin_api/interface.api.json b/examples/bin_api/interface.api.json deleted file mode 100644 index 41862d8..0000000 --- a/examples/bin_api/interface.api.json +++ /dev/null @@ -1,1467 +0,0 @@ -{ - "messages": [ - [ - "sw_interface_set_flags", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "admin_up_down" - ], - { - "crc": "0x555485f5" - } - ], - [ - "sw_interface_set_flags_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "hw_interface_set_mtu", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u16", - "mtu" - ], - { - "crc": "0x132da1e7" - } - ], - [ - "hw_interface_set_mtu_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_set_mtu", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "mtu", - 4 - ], - { - "crc": "0xd0008db8" - } - ], - [ - "sw_interface_set_mtu_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_set_ip_directed_broadcast", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "enable" - ], - { - "crc": "0xa36fadc0" - } - ], - [ - "sw_interface_set_ip_directed_broadcast_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_event", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "pid" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "admin_up_down" - ], - [ - "u8", - "link_up_down" - ], - [ - "u8", - "deleted" - ], - { - "crc": "0xbf9938e4" - } - ], - [ - "want_interface_events", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "enable_disable" - ], - [ - "u32", - "pid" - ], - { - "crc": "0x476f5a08" - } - ], - [ - "want_interface_events_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "sup_sw_if_index" - ], - [ - "u32", - "l2_address_length" - ], - [ - "u8", - "l2_address", - 8 - ], - [ - "u8", - "interface_name", - 64 - ], - [ - "u8", - "admin_up_down" - ], - [ - "u8", - "link_up_down" - ], - [ - "u8", - "link_duplex" - ], - [ - "u32", - "link_speed" - ], - [ - "u16", - "link_mtu" - ], - [ - "u32", - "mtu", - 4 - ], - [ - "u32", - "sub_id" - ], - [ - "u8", - "sub_dot1ad" - ], - [ - "u8", - "sub_dot1ah" - ], - [ - "u8", - "sub_number_of_tags" - ], - [ - "u16", - "sub_outer_vlan_id" - ], - [ - "u16", - "sub_inner_vlan_id" - ], - [ - "u8", - "sub_exact_match" - ], - [ - "u8", - "sub_default" - ], - [ - "u8", - "sub_outer_vlan_id_any" - ], - [ - "u8", - "sub_inner_vlan_id_any" - ], - [ - "u32", - "vtr_op" - ], - [ - "u32", - "vtr_push_dot1q" - ], - [ - "u32", - "vtr_tag1" - ], - [ - "u32", - "vtr_tag2" - ], - [ - "u8", - "tag", - 64 - ], - [ - "u16", - "outer_tag" - ], - [ - "u8", - "b_dmac", - 6 - ], - [ - "u8", - "b_smac", - 6 - ], - [ - "u16", - "b_vlanid" - ], - [ - "u32", - "i_sid" - ], - { - "crc": "0xe4ee7eb6" - } - ], - [ - "sw_interface_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "name_filter_valid" - ], - [ - "u8", - "name_filter", - 49 - ], - { - "crc": "0x63f5e3b7" - } - ], - [ - "sw_interface_add_del_address", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "is_add" - ], - [ - "u8", - "is_ipv6" - ], - [ - "u8", - "del_all" - ], - [ - "u8", - "address_length" - ], - [ - "u8", - "address", - 16 - ], - { - "crc": "0x7b583179" - } - ], - [ - "sw_interface_add_del_address_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_set_table", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "is_ipv6" - ], - [ - "u32", - "vrf_id" - ], - { - "crc": "0xacb25d89" - } - ], - [ - "sw_interface_set_table_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_get_table", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "is_ipv6" - ], - { - "crc": "0x6b7bcd0a" - } - ], - [ - "sw_interface_get_table_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "vrf_id" - ], - { - "crc": "0xa6eb0109" - } - ], - [ - "sw_interface_set_unnumbered", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "unnumbered_sw_if_index" - ], - [ - "u8", - "is_add" - ], - { - "crc": "0xa2c1bbda" - } - ], - [ - "sw_interface_set_unnumbered_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_clear_stats", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0x529cb13f" - } - ], - [ - "sw_interface_clear_stats_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_tag_add_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "is_add" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "tag", - 64 - ], - { - "crc": "0x14cc636c" - } - ], - [ - "sw_interface_tag_add_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_set_mac_address", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "mac_address", - 6 - ], - { - "crc": "0xeed5dfca" - } - ], - [ - "sw_interface_set_mac_address_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_get_mac_address", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0x529cb13f" - } - ], - [ - "sw_interface_get_mac_address_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u8", - "mac_address", - 6 - ], - { - "crc": "0x8ea538d3" - } - ], - [ - "sw_interface_set_rx_mode", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "queue_id_valid" - ], - [ - "u32", - "queue_id" - ], - [ - "u8", - "mode" - ], - { - "crc": "0x2a1cc58c" - } - ], - [ - "sw_interface_set_rx_mode_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_set_rx_placement", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "queue_id" - ], - [ - "u32", - "worker_id" - ], - [ - "u8", - "is_main" - ], - { - "crc": "0x4ef4377d" - } - ], - [ - "sw_interface_set_rx_placement_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_rx_placement_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0x529cb13f" - } - ], - [ - "sw_interface_rx_placement_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "queue_id" - ], - [ - "u32", - "worker_id" - ], - [ - "u8", - "mode" - ], - { - "crc": "0x0e9e33f4" - } - ], - [ - "interface_name_renumber", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "new_show_dev_instance" - ], - { - "crc": "0x39194269" - } - ], - [ - "interface_name_renumber_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "create_subif", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "sub_id" - ], - [ - "u8", - "no_tags" - ], - [ - "u8", - "one_tag" - ], - [ - "u8", - "two_tags" - ], - [ - "u8", - "dot1ad" - ], - [ - "u8", - "exact_match" - ], - [ - "u8", - "default_sub" - ], - [ - "u8", - "outer_vlan_id_any" - ], - [ - "u8", - "inner_vlan_id_any" - ], - [ - "u16", - "outer_vlan_id" - ], - [ - "u16", - "inner_vlan_id" - ], - { - "crc": "0x86cfe408" - } - ], - [ - "create_subif_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0xfda5941f" - } - ], - [ - "create_vlan_subif", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "vlan_id" - ], - { - "crc": "0x70cadeda" - } - ], - [ - "create_vlan_subif_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0xfda5941f" - } - ], - [ - "delete_subif", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0x529cb13f" - } - ], - [ - "delete_subif_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "create_loopback", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "mac_address", - 6 - ], - { - "crc": "0x3b54129c" - } - ], - [ - "create_loopback_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0xfda5941f" - } - ], - [ - "create_loopback_instance", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "mac_address", - 6 - ], - [ - "u8", - "is_specified" - ], - [ - "u32", - "user_instance" - ], - { - "crc": "0x7bbd53b6" - } - ], - [ - "create_loopback_instance_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0xfda5941f" - } - ], - [ - "delete_loopback", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0x529cb13f" - } - ], - [ - "delete_loopback_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "collect_detailed_interface_stats", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "enable_disable" - ], - { - "crc": "0x69d24598" - } - ], - [ - "collect_detailed_interface_stats_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ] - ], - "vl_api_version": "0x672de521", - "unions": [], - "services": { - "create_subif": { - "reply": "create_subif_reply" - }, - "sw_interface_set_ip_directed_broadcast": { - "reply": "sw_interface_set_ip_directed_broadcast_reply" - }, - "delete_subif": { - "reply": "delete_subif_reply" - }, - "sw_interface_get_mac_address": { - "reply": "sw_interface_get_mac_address_reply" - }, - "sw_interface_tag_add_del": { - "reply": "sw_interface_tag_add_del_reply" - }, - "collect_detailed_interface_stats": { - "reply": "collect_detailed_interface_stats_reply" - }, - "sw_interface_dump": { - "reply": "sw_interface_details", - "stream": true - }, - "sw_interface_set_rx_placement": { - "reply": "sw_interface_set_rx_placement_reply" - }, - "sw_interface_add_del_address": { - "reply": "sw_interface_add_del_address_reply" - }, - "sw_interface_get_table": { - "reply": "sw_interface_get_table_reply" - }, - "interface_name_renumber": { - "reply": "interface_name_renumber_reply" - }, - "create_loopback_instance": { - "reply": "create_loopback_instance_reply" - }, - "sw_interface_set_mtu": { - "reply": "sw_interface_set_mtu_reply" - }, - "want_interface_events": { - "reply": "want_interface_events_reply", - "events": [ - "sw_interface_event" - ] - }, - "create_loopback": { - "reply": "create_loopback_reply" - }, - "sw_interface_clear_stats": { - "reply": "sw_interface_clear_stats_reply" - }, - "hw_interface_set_mtu": { - "reply": "hw_interface_set_mtu_reply" - }, - "sw_interface_set_mac_address": { - "reply": "sw_interface_set_mac_address_reply" - }, - "sw_interface_set_unnumbered": { - "reply": "sw_interface_set_unnumbered_reply" - }, - "sw_interface_rx_placement_dump": { - "reply": "sw_interface_rx_placement_details", - "stream": true - }, - "sw_interface_set_flags": { - "reply": "sw_interface_set_flags_reply" - }, - "delete_loopback": { - "reply": "delete_loopback_reply" - }, - "sw_interface_set_rx_mode": { - "reply": "sw_interface_set_rx_mode_reply" - }, - "create_vlan_subif": { - "reply": "create_vlan_subif_reply" - }, - "sw_interface_set_table": { - "reply": "sw_interface_set_table_reply" - } - }, - "enums": [], - "types": [], - "aliases": { - "interface_index": { - "type": "u32" - } - } -} diff --git a/examples/bin_api/ip.api.json b/examples/bin_api/ip.api.json deleted file mode 100644 index 62c282b..0000000 --- a/examples/bin_api/ip.api.json +++ /dev/null @@ -1,3122 +0,0 @@ -{ - "messages": [ - [ - "ip_table_add_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "table_id" - ], - [ - "u8", - "is_ipv6" - ], - [ - "u8", - "is_add" - ], - [ - "u8", - "name", - 64 - ], - { - "crc": "0x0240c89d" - } - ], - [ - "ip_table_add_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip_fib_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "ip_fib_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "table_id" - ], - [ - "u8", - "table_name", - 64 - ], - [ - "u8", - "address_length" - ], - [ - "u8", - "address", - 4 - ], - [ - "u32", - "count" - ], - [ - "u32", - "stats_index" - ], - [ - "vl_api_fib_path_t", - "path", - 0, - "count" - ], - { - "crc": "0xf6a2fab3" - } - ], - [ - "ip6_fib_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "ip6_fib_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "table_id" - ], - [ - "u8", - "table_name", - 64 - ], - [ - "u8", - "address_length" - ], - [ - "u8", - "address", - 16 - ], - [ - "u32", - "count" - ], - [ - "u32", - "stats_index" - ], - [ - "vl_api_fib_path_t", - "path", - 0, - "count" - ], - { - "crc": "0xef11e94d" - } - ], - [ - "ip_neighbor_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "is_ipv6" - ], - { - "crc": "0x6b7bcd0a" - } - ], - [ - "ip_neighbor_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "stats_index" - ], - [ - "u8", - "is_static" - ], - [ - "u8", - "is_ipv6" - ], - [ - "u8", - "mac_address", - 6 - ], - [ - "u8", - "ip_address", - 16 - ], - { - "crc": "0xc7001770" - } - ], - [ - "ip_neighbor_add_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "is_add" - ], - [ - "u8", - "is_ipv6" - ], - [ - "u8", - "is_static" - ], - [ - "u8", - "is_no_adj_fib" - ], - [ - "u8", - "mac_address", - 6 - ], - [ - "u8", - "dst_address", - 16 - ], - { - "crc": "0x4711eb25" - } - ], - [ - "ip_neighbor_add_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "stats_index" - ], - { - "crc": "0x1992deab" - } - ], - [ - "set_ip_flow_hash", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "vrf_id" - ], - [ - "u8", - "is_ipv6" - ], - [ - "u8", - "src" - ], - [ - "u8", - "dst" - ], - [ - "u8", - "sport" - ], - [ - "u8", - "dport" - ], - [ - "u8", - "proto" - ], - [ - "u8", - "reverse" - ], - [ - "u8", - "symmetric" - ], - { - "crc": "0xa9084bfb" - } - ], - [ - "set_ip_flow_hash_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_ip6nd_ra_config", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "suppress" - ], - [ - "u8", - "managed" - ], - [ - "u8", - "other" - ], - [ - "u8", - "ll_option" - ], - [ - "u8", - "send_unicast" - ], - [ - "u8", - "cease" - ], - [ - "u8", - "is_no" - ], - [ - "u8", - "default_router" - ], - [ - "u32", - "max_interval" - ], - [ - "u32", - "min_interval" - ], - [ - "u32", - "lifetime" - ], - [ - "u32", - "initial_count" - ], - [ - "u32", - "initial_interval" - ], - { - "crc": "0xc3f02daa" - } - ], - [ - "sw_interface_ip6nd_ra_config_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_ip6nd_ra_prefix", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "address", - 16 - ], - [ - "u8", - "address_length" - ], - [ - "u8", - "use_default" - ], - [ - "u8", - "no_advertise" - ], - [ - "u8", - "off_link" - ], - [ - "u8", - "no_autoconfig" - ], - [ - "u8", - "no_onlink" - ], - [ - "u8", - "is_no" - ], - [ - "u32", - "val_lifetime" - ], - [ - "u32", - "pref_lifetime" - ], - { - "crc": "0xca763c9a" - } - ], - [ - "sw_interface_ip6nd_ra_prefix_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip6nd_proxy_add_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "is_del" - ], - [ - "u8", - "address", - 16 - ], - { - "crc": "0xd95f0fa0" - } - ], - [ - "ip6nd_proxy_add_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip6nd_proxy_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "address", - 16 - ], - { - "crc": "0x6a47c974" - } - ], - [ - "ip6nd_proxy_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "ip6nd_send_router_solicitation", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "irt" - ], - [ - "u32", - "mrt" - ], - [ - "u32", - "mrc" - ], - [ - "u32", - "mrd" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "stop" - ], - { - "crc": "0xbd968917" - } - ], - [ - "ip6nd_send_router_solicitation_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_ip6_enable_disable", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "enable" - ], - { - "crc": "0xa36fadc0" - } - ], - [ - "sw_interface_ip6_enable_disable_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip_add_del_route", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "next_hop_sw_if_index" - ], - [ - "u32", - "table_id" - ], - [ - "u32", - "classify_table_index" - ], - [ - "u32", - "next_hop_table_id" - ], - [ - "u32", - "next_hop_id" - ], - [ - "u8", - "is_add" - ], - [ - "u8", - "is_drop" - ], - [ - "u8", - "is_unreach" - ], - [ - "u8", - "is_prohibit" - ], - [ - "u8", - "is_ipv6" - ], - [ - "u8", - "is_local" - ], - [ - "u8", - "is_classify" - ], - [ - "u8", - "is_multipath" - ], - [ - "u8", - "is_resolve_host" - ], - [ - "u8", - "is_resolve_attached" - ], - [ - "u8", - "is_dvr" - ], - [ - "u8", - "is_source_lookup" - ], - [ - "u8", - "is_udp_encap" - ], - [ - "u8", - "next_hop_weight" - ], - [ - "u8", - "next_hop_preference" - ], - [ - "u8", - "next_hop_proto" - ], - [ - "u8", - "dst_address_length" - ], - [ - "u8", - "dst_address", - 16 - ], - [ - "u8", - "next_hop_address", - 16 - ], - [ - "u8", - "next_hop_n_out_labels" - ], - [ - "u32", - "next_hop_via_label" - ], - [ - "vl_api_fib_mpls_label_t", - "next_hop_out_label_stack", - 0, - "next_hop_n_out_labels" - ], - { - "crc": "0x4219d62d" - } - ], - [ - "ip_add_del_route_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "stats_index" - ], - { - "crc": "0x1992deab" - } - ], - [ - "ip_mroute_add_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "next_hop_sw_if_index" - ], - [ - "u32", - "table_id" - ], - [ - "u32", - "entry_flags" - ], - [ - "u32", - "itf_flags" - ], - [ - "u32", - "rpf_id" - ], - [ - "u32", - "bier_imp" - ], - [ - "u16", - "grp_address_length" - ], - [ - "u8", - "next_hop_afi" - ], - [ - "u8", - "is_add" - ], - [ - "u8", - "is_ipv6" - ], - [ - "u8", - "is_local" - ], - [ - "u8", - "grp_address", - 16 - ], - [ - "u8", - "src_address", - 16 - ], - [ - "u8", - "nh_address", - 16 - ], - { - "crc": "0xf44c17b1" - } - ], - [ - "ip_mroute_add_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "stats_index" - ], - { - "crc": "0x1992deab" - } - ], - [ - "ip_mfib_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "ip_mfib_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "table_id" - ], - [ - "u32", - "entry_flags" - ], - [ - "u32", - "rpf_id" - ], - [ - "u8", - "address_length" - ], - [ - "u8", - "grp_address", - 4 - ], - [ - "u8", - "src_address", - 4 - ], - [ - "u32", - "count" - ], - [ - "u32", - "stats_index" - ], - [ - "vl_api_mfib_path_t", - "path", - 0, - "count" - ], - { - "crc": "0x61faa26f" - } - ], - [ - "ip6_mfib_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "ip6_mfib_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "table_id" - ], - [ - "u8", - "address_length" - ], - [ - "u8", - "grp_address", - 16 - ], - [ - "u8", - "src_address", - 16 - ], - [ - "u32", - "count" - ], - [ - "vl_api_mfib_path_t", - "path", - 0, - "count" - ], - { - "crc": "0x738c546e" - } - ], - [ - "ip_address_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u8", - "ip", - 16 - ], - [ - "u8", - "prefix_length" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "is_ipv6" - ], - { - "crc": "0x9bc25966" - } - ], - [ - "ip_address_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "is_ipv6" - ], - { - "crc": "0x6b7bcd0a" - } - ], - [ - "ip_unnumbered_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "ip_sw_if_index" - ], - { - "crc": "0xae694cf4" - } - ], - [ - "ip_unnumbered_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0x529cb13f" - } - ], - [ - "ip_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "is_ipv6" - ], - { - "crc": "0x8bb37ec4" - } - ], - [ - "ip_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "is_ipv6" - ], - { - "crc": "0xde883da4" - } - ], - [ - "mfib_signal_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "mfib_signal_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "table_id" - ], - [ - "u16", - "grp_address_len" - ], - [ - "u8", - "grp_address", - 16 - ], - [ - "u8", - "src_address", - 16 - ], - [ - "u16", - "ip_packet_len" - ], - [ - "u8", - "ip_packet_data", - 256 - ], - { - "crc": "0x3f5f03f5" - } - ], - [ - "ip_punt_police", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "policer_index" - ], - [ - "u8", - "is_add" - ], - [ - "u8", - "is_ip6" - ], - { - "crc": "0x38691592" - } - ], - [ - "ip_punt_police_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip_punt_redirect", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "vl_api_punt_redirect_t", - "punt" - ], - [ - "u8", - "is_add" - ], - { - "crc": "0xa953495b" - } - ], - [ - "ip_punt_redirect_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip_punt_redirect_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "is_ipv6" - ], - { - "crc": "0x6b7bcd0a" - } - ], - [ - "ip_punt_redirect_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "vl_api_punt_redirect_t", - "punt" - ], - { - "crc": "0xa47f70da" - } - ], - [ - "ip_container_proxy_add_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "ip", - 16 - ], - [ - "u8", - "is_ip4" - ], - [ - "u8", - "plen" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "is_add" - ], - { - "crc": "0x0a355d39" - } - ], - [ - "ip_container_proxy_add_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip_container_proxy_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "ip_container_proxy_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "vl_api_prefix_t", - "prefix" - ], - { - "crc": "0xd528df63" - } - ], - [ - "ip_source_and_port_range_check_add_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "is_ipv6" - ], - [ - "u8", - "is_add" - ], - [ - "u8", - "mask_length" - ], - [ - "u8", - "address", - 16 - ], - [ - "u8", - "number_of_ranges" - ], - [ - "u16", - "low_ports", - 32 - ], - [ - "u16", - "high_ports", - 32 - ], - [ - "u32", - "vrf_id" - ], - { - "crc": "0x03d6b03a" - } - ], - [ - "ip_source_and_port_range_check_add_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip_source_and_port_range_check_interface_add_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "is_add" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "tcp_in_vrf_id" - ], - [ - "u32", - "tcp_out_vrf_id" - ], - [ - "u32", - "udp_in_vrf_id" - ], - [ - "u32", - "udp_out_vrf_id" - ], - { - "crc": "0x6966bc44" - } - ], - [ - "ip_source_and_port_range_check_interface_add_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip_source_check_interface_add_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "is_add" - ], - [ - "u8", - "loose" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0x0a60152a" - } - ], - [ - "ip_source_check_interface_add_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip_scan_neighbor_enable_disable", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "mode" - ], - [ - "u8", - "scan_interval" - ], - [ - "u8", - "max_proc_time" - ], - [ - "u8", - "max_update" - ], - [ - "u8", - "scan_int_delay" - ], - [ - "u8", - "stale_threshold" - ], - { - "crc": "0x0a6bf57a" - } - ], - [ - "ip_scan_neighbor_enable_disable_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip_probe_neighbor", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "dst_address", - 16 - ], - [ - "u8", - "is_ipv6" - ], - { - "crc": "0x1e44bfd7" - } - ], - [ - "ip_probe_neighbor_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "want_ip4_arp_events", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "enable_disable" - ], - [ - "u32", - "pid" - ], - [ - "u32", - "address" - ], - { - "crc": "0x77e06379" - } - ], - [ - "want_ip4_arp_events_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip4_arp_event", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "address" - ], - [ - "u32", - "pid" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "new_mac", - 6 - ], - [ - "u8", - "mac_ip" - ], - { - "crc": "0xef7235f7" - } - ], - [ - "want_ip6_nd_events", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "enable_disable" - ], - [ - "u32", - "pid" - ], - [ - "u8", - "address", - 16 - ], - { - "crc": "0x1cf65fbb" - } - ], - [ - "want_ip6_nd_events_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip6_nd_event", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "pid" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "address", - 16 - ], - [ - "u8", - "new_mac", - 6 - ], - [ - "u8", - "mac_ip" - ], - { - "crc": "0x96ab2fdd" - } - ], - [ - "want_ip6_ra_events", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "enable_disable" - ], - [ - "u32", - "pid" - ], - { - "crc": "0x05b454b5" - } - ], - [ - "want_ip6_ra_events_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip6_ra_event", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "pid" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "router_address", - 16 - ], - [ - "u8", - "current_hop_limit" - ], - [ - "u8", - "flags" - ], - [ - "u16", - "router_lifetime_in_sec" - ], - [ - "u32", - "neighbor_reachable_time_in_msec" - ], - [ - "u32", - "time_in_msec_between_retransmitted_neighbor_solicitations" - ], - [ - "u32", - "n_prefixes" - ], - [ - "vl_api_ip6_ra_prefix_info_t", - "prefixes", - 0, - "n_prefixes" - ], - { - "crc": "0xc5e54257" - } - ], - [ - "proxy_arp_add_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "is_add" - ], - [ - "vl_api_proxy_arp_t", - "proxy" - ], - { - "crc": "0x227988d9" - } - ], - [ - "proxy_arp_add_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "proxy_arp_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "proxy_arp_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "vl_api_proxy_arp_t", - "proxy" - ], - { - "crc": "0x9b707c77" - } - ], - [ - "proxy_arp_intfc_enable_disable", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "enable_disable" - ], - { - "crc": "0x69d24598" - } - ], - [ - "proxy_arp_intfc_enable_disable_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "proxy_arp_intfc_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "proxy_arp_intfc_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0xf6458e5f" - } - ], - [ - "reset_fib", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "vrf_id" - ], - [ - "u8", - "is_ipv6" - ], - { - "crc": "0x8553ebd9" - } - ], - [ - "reset_fib_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "set_arp_neighbor_limit", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "is_ipv6" - ], - [ - "u32", - "arp_neighbor_limit" - ], - { - "crc": "0x97d01fd6" - } - ], - [ - "set_arp_neighbor_limit_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ioam_enable", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u16", - "id" - ], - [ - "u8", - "seqno" - ], - [ - "u8", - "analyse" - ], - [ - "u8", - "pot_enable" - ], - [ - "u8", - "trace_enable" - ], - [ - "u32", - "node_id" - ], - { - "crc": "0x9392e032" - } - ], - [ - "ioam_enable_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ioam_disable", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u16", - "id" - ], - { - "crc": "0x6b16a45e" - } - ], - [ - "ioam_disable_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip_reassembly_set", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "timeout_ms" - ], - [ - "u32", - "max_reassemblies" - ], - [ - "u32", - "expire_walk_interval_ms" - ], - [ - "u8", - "is_ip6" - ], - { - "crc": "0x1db184de" - } - ], - [ - "ip_reassembly_set_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "ip_reassembly_get", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "is_ip6" - ], - { - "crc": "0x6fe91190" - } - ], - [ - "ip_reassembly_get_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "timeout_ms" - ], - [ - "u32", - "max_reassemblies" - ], - [ - "u32", - "expire_walk_interval_ms" - ], - [ - "u8", - "is_ip6" - ], - { - "crc": "0x1f90afd1" - } - ], - [ - "ip_reassembly_enable_disable", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "enable_ip4" - ], - [ - "u8", - "enable_ip6" - ], - { - "crc": "0xbb8dc5d0" - } - ], - [ - "ip_reassembly_enable_disable_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ] - ], - "vl_api_version": "0xa3532a2f", - "unions": [ - [ - "address_union", - [ - "vl_api_ip4_address_t", - "ip4" - ], - [ - "vl_api_ip6_address_t", - "ip6" - ], - { - "crc": "0xd68a2fb4" - } - ] - ], - "services": { - "ip_container_proxy_dump": { - "reply": "ip_container_proxy_details", - "stream": true - }, - "ip_address_dump": { - "reply": "ip_address_details", - "stream": true - }, - "ip_source_and_port_range_check_add_del": { - "reply": "ip_source_and_port_range_check_add_del_reply" - }, - "reset_fib": { - "reply": "reset_fib_reply" - }, - "ip_probe_neighbor": { - "reply": "ip_probe_neighbor_reply" - }, - "want_ip6_nd_events": { - "reply": "want_ip6_nd_events_reply", - "events": [ - "ip6_nd_event" - ] - }, - "ip_punt_police": { - "reply": "ip_punt_police_reply" - }, - "ip6nd_proxy_add_del": { - "reply": "ip6nd_proxy_add_del_reply" - }, - "set_arp_neighbor_limit": { - "reply": "set_arp_neighbor_limit_reply" - }, - "ip_reassembly_enable_disable": { - "reply": "ip_reassembly_enable_disable_reply" - }, - "ip6_fib_dump": { - "reply": "ip6_fib_details", - "stream": true - }, - "ip6nd_send_router_solicitation": { - "reply": "ip6nd_send_router_solicitation_reply" - }, - "ip_source_check_interface_add_del": { - "reply": "ip_source_check_interface_add_del_reply" - }, - "ip_table_add_del": { - "reply": "ip_table_add_del_reply" - }, - "ip_neighbor_dump": { - "reply": "ip_neighbor_details", - "stream": true - }, - "ip_punt_redirect": { - "reply": "ip_punt_redirect_reply" - }, - "sw_interface_ip6nd_ra_prefix": { - "reply": "sw_interface_ip6nd_ra_prefix_reply" - }, - "ip_reassembly_set": { - "reply": "ip_reassembly_set_reply" - }, - "ip6_mfib_dump": { - "reply": "ip6_mfib_details", - "stream": true - }, - "sw_interface_ip6nd_ra_config": { - "reply": "sw_interface_ip6nd_ra_config_reply" - }, - "proxy_arp_dump": { - "reply": "proxy_arp_details", - "stream": true - }, - "sw_interface_ip6_enable_disable": { - "reply": "sw_interface_ip6_enable_disable_reply" - }, - "ip_source_and_port_range_check_interface_add_del": { - "reply": "ip_source_and_port_range_check_interface_add_del_reply" - }, - "mfib_signal_dump": { - "reply": "mfib_signal_details", - "stream": true - }, - "ip_punt_redirect_dump": { - "reply": "ip_punt_redirect_details", - "stream": true - }, - "ip_container_proxy_add_del": { - "reply": "ip_container_proxy_add_del_reply" - }, - "ip_mfib_dump": { - "reply": "ip_mfib_details", - "stream": true - }, - "ip_unnumbered_dump": { - "reply": "ip_unnumbered_details", - "stream": true - }, - "ip_dump": { - "reply": "ip_details", - "stream": true - }, - "ip_neighbor_add_del": { - "reply": "ip_neighbor_add_del_reply" - }, - "proxy_arp_intfc_enable_disable": { - "reply": "proxy_arp_intfc_enable_disable_reply" - }, - "proxy_arp_add_del": { - "reply": "proxy_arp_add_del_reply" - }, - "ip_add_del_route": { - "reply": "ip_add_del_route_reply" - }, - "ip6nd_proxy_dump": { - "reply": "ip6nd_proxy_details", - "stream": true - }, - "want_ip6_ra_events": { - "reply": "want_ip6_ra_events_reply", - "events": [ - "ip6_ra_event" - ] - }, - "ip_fib_dump": { - "reply": "ip_fib_details", - "stream": true - }, - "ip_scan_neighbor_enable_disable": { - "reply": "ip_scan_neighbor_enable_disable_reply" - }, - "ioam_enable": { - "reply": "ioam_enable_reply" - }, - "ip_mroute_add_del": { - "reply": "ip_mroute_add_del_reply" - }, - "proxy_arp_intfc_dump": { - "reply": "proxy_arp_intfc_details", - "stream": true - }, - "want_ip4_arp_events": { - "reply": "want_ip4_arp_events_reply", - "events": [ - "ip4_arp_event" - ] - }, - "ip_reassembly_get": { - "reply": "ip_reassembly_get_reply" - }, - "set_ip_flow_hash": { - "reply": "set_ip_flow_hash_reply" - }, - "ioam_disable": { - "reply": "ioam_disable_reply" - } - }, - "enums": [ - [ - "address_family", - [ - "ADDRESS_IP4", - 0 - ], - [ - "ADDRESS_IP6", - 1 - ], - { - "enumtype": "u32" - } - ] - ], - "types": [ - [ - "address", - [ - "vl_api_address_family_t", - "af" - ], - [ - "vl_api_address_union_t", - "un" - ], - { - "crc": "0x09f11671" - } - ], - [ - "prefix", - [ - "vl_api_address_t", - "address" - ], - [ - "u8", - "address_length" - ], - { - "crc": "0x0403aebc" - } - ], - [ - "mprefix", - [ - "vl_api_address_family_t", - "af" - ], - [ - "u16", - "grp_address_length" - ], - [ - "vl_api_address_union_t", - "grp_address" - ], - [ - "vl_api_address_union_t", - "src_address" - ], - { - "crc": "0x1c4cba05" - } - ], - [ - "ip6_prefix", - [ - "vl_api_ip6_address_t", - "prefix" - ], - [ - "u8", - "len" - ], - { - "crc": "0x779fd64f" - } - ], - [ - "ip4_prefix", - [ - "vl_api_ip4_address_t", - "prefix" - ], - [ - "u8", - "len" - ], - { - "crc": "0xea8dc11d" - } - ], - [ - "fib_mpls_label", - [ - "u8", - "is_uniform" - ], - [ - "u32", - "label" - ], - [ - "u8", - "ttl" - ], - [ - "u8", - "exp" - ], - { - "crc": "0xc93bf35c" - } - ], - [ - "fib_path", - [ - "u32", - "sw_if_index" - ], - [ - "u32", - "table_id" - ], - [ - "u8", - "weight" - ], - [ - "u8", - "preference" - ], - [ - "u8", - "is_local" - ], - [ - "u8", - "is_drop" - ], - [ - "u8", - "is_udp_encap" - ], - [ - "u8", - "is_unreach" - ], - [ - "u8", - "is_prohibit" - ], - [ - "u8", - "is_resolve_host" - ], - [ - "u8", - "is_resolve_attached" - ], - [ - "u8", - "is_dvr" - ], - [ - "u8", - "is_source_lookup" - ], - [ - "u8", - "is_interface_rx" - ], - [ - "u8", - "afi" - ], - [ - "u8", - "next_hop", - 16 - ], - [ - "u32", - "next_hop_id" - ], - [ - "u32", - "rpf_id" - ], - [ - "u32", - "via_label" - ], - [ - "u8", - "n_labels" - ], - [ - "vl_api_fib_mpls_label_t", - "label_stack", - 16 - ], - { - "crc": "0xba7a81f0" - } - ], - [ - "mfib_path", - [ - "vl_api_fib_path_t", - "path" - ], - [ - "u32", - "itf_flags" - ], - { - "crc": "0x4ba77d32" - } - ], - [ - "punt_redirect", - [ - "u32", - "rx_sw_if_index" - ], - [ - "u32", - "tx_sw_if_index" - ], - [ - "vl_api_address_t", - "nh" - ], - { - "crc": "0x3e7a801f" - } - ], - [ - "ip6_ra_prefix_info", - [ - "u8", - "dst_address", - 16 - ], - [ - "u8", - "dst_address_length" - ], - [ - "u8", - "flags" - ], - [ - "u32", - "valid_time" - ], - [ - "u32", - "preferred_time" - ], - { - "crc": "0x83d7c6e5" - } - ], - [ - "proxy_arp", - [ - "u32", - "vrf_id" - ], - [ - "u8", - "low_address", - 4 - ], - [ - "u8", - "hi_address", - 4 - ], - { - "crc": "0x6d88106e" - } - ] - ], - "aliases": { - "ip6_address": { - "length": 16, - "type": "u8" - }, - "ip4_address": { - "length": 4, - "type": "u8" - }, - "mac_address": { - "length": 6, - "type": "u8" - } - } -} diff --git a/examples/bin_api/map.api.json b/examples/bin_api/map.api.json deleted file mode 100644 index a19bd3a..0000000 --- a/examples/bin_api/map.api.json +++ /dev/null @@ -1,1022 +0,0 @@ -{ - "messages": [ - [ - "map_add_domain", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "vl_api_ip6_prefix_t", - "ip6_prefix" - ], - [ - "vl_api_ip4_prefix_t", - "ip4_prefix" - ], - [ - "vl_api_ip6_prefix_t", - "ip6_src" - ], - [ - "u8", - "ea_bits_len" - ], - [ - "u8", - "psid_offset" - ], - [ - "u8", - "psid_length" - ], - [ - "u16", - "mtu" - ], - { - "crc": "0xa9358068" - } - ], - [ - "map_add_domain_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "index" - ], - [ - "i32", - "retval" - ], - { - "crc": "0x3e6d4e2c" - } - ], - [ - "map_del_domain", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "index" - ], - { - "crc": "0x8ac76db6" - } - ], - [ - "map_del_domain_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "map_add_del_rule", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "index" - ], - [ - "bool", - "is_add" - ], - [ - "vl_api_ip6_address_t", - "ip6_dst" - ], - [ - "u16", - "psid" - ], - { - "crc": "0xe6132040" - } - ], - [ - "map_add_del_rule_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "map_domain_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "map_domain_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "domain_index" - ], - [ - "vl_api_ip6_prefix_t", - "ip6_prefix" - ], - [ - "vl_api_ip4_prefix_t", - "ip4_prefix" - ], - [ - "vl_api_ip6_prefix_t", - "ip6_src" - ], - [ - "u8", - "ea_bits_len" - ], - [ - "u8", - "psid_offset" - ], - [ - "u8", - "psid_length" - ], - [ - "u8", - "flags" - ], - [ - "u16", - "mtu" - ], - { - "crc": "0x2a17dcb8" - } - ], - [ - "map_rule_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "domain_index" - ], - { - "crc": "0xe43e6ff6" - } - ], - [ - "map_rule_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "vl_api_ip6_address_t", - "ip6_dst" - ], - [ - "u16", - "psid" - ], - { - "crc": "0x4f932665" - } - ], - [ - "map_if_enable_disable", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "bool", - "is_enable" - ], - [ - "bool", - "is_translation" - ], - { - "crc": "0x61a30cd9" - } - ], - [ - "map_if_enable_disable_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "map_summary_stats", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "map_summary_stats_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u64", - "total_bindings" - ], - [ - "u64", - "total_pkts", - 2 - ], - [ - "u64", - "total_bytes", - 2 - ], - [ - "u64", - "total_ip4_fragments" - ], - [ - "u64", - "total_security_check", - 2 - ], - { - "crc": "0x0e4ace0e" - } - ], - [ - "map_param_set_fragmentation", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "bool", - "inner" - ], - [ - "bool", - "ignore_df" - ], - { - "crc": "0x9ff54d90" - } - ], - [ - "map_param_set_fragmentation_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "map_param_set_icmp", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "vl_api_ip4_address_t", - "ip4_err_relay_src" - ], - { - "crc": "0x4c0a4fd2" - } - ], - [ - "map_param_set_icmp_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "map_param_set_icmp6", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "bool", - "enable_unreachable" - ], - { - "crc": "0x5d01f8c1" - } - ], - [ - "map_param_set_icmp6_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "map_param_add_del_pre_resolve", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "bool", - "is_add" - ], - [ - "vl_api_ip4_address_t", - "ip4_nh_address" - ], - [ - "vl_api_ip6_address_t", - "ip6_nh_address" - ], - { - "crc": "0xea9a9a4a" - } - ], - [ - "map_param_add_del_pre_resolve_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "map_param_set_reassembly", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "bool", - "is_ip6" - ], - [ - "u16", - "lifetime_ms" - ], - [ - "u16", - "pool_size" - ], - [ - "u32", - "buffers" - ], - [ - "f64", - "ht_ratio" - ], - { - "crc": "0x54172b10" - } - ], - [ - "map_param_set_reassembly_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "map_param_set_security_check", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "bool", - "enable" - ], - [ - "bool", - "fragments" - ], - { - "crc": "0x6abe9836" - } - ], - [ - "map_param_set_security_check_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "map_param_set_traffic_class", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "bool", - "copy" - ], - [ - "u8", - "class" - ], - { - "crc": "0x007ee563" - } - ], - [ - "map_param_set_traffic_class_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "map_param_set_tcp", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u16", - "tcp_mss" - ], - { - "crc": "0x87a825d9" - } - ], - [ - "map_param_set_tcp_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "map_param_get", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "map_param_get_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u8", - "frag_inner" - ], - [ - "u8", - "frag_ignore_df" - ], - [ - "vl_api_ip4_address_t", - "icmp_ip4_err_relay_src" - ], - [ - "bool", - "icmp6_enable_unreachable" - ], - [ - "vl_api_ip4_address_t", - "ip4_nh_address" - ], - [ - "vl_api_ip6_address_t", - "ip6_nh_address" - ], - [ - "u16", - "ip4_lifetime_ms" - ], - [ - "u16", - "ip4_pool_size" - ], - [ - "u32", - "ip4_buffers" - ], - [ - "f64", - "ip4_ht_ratio" - ], - [ - "u16", - "ip6_lifetime_ms" - ], - [ - "u16", - "ip6_pool_size" - ], - [ - "u32", - "ip6_buffers" - ], - [ - "f64", - "ip6_ht_ratio" - ], - [ - "bool", - "sec_check_enable" - ], - [ - "bool", - "sec_check_fragments" - ], - [ - "bool", - "tc_copy" - ], - [ - "u8", - "tc_class" - ], - { - "crc": "0xb40e9226" - } - ] - ], - "vl_api_version": "0x75de78c3", - "unions": [ - [ - "address_union", - [ - "vl_api_ip4_address_t", - "ip4" - ], - [ - "vl_api_ip6_address_t", - "ip6" - ], - { - "crc": "0xd68a2fb4" - } - ] - ], - "services": { - "map_param_set_fragmentation": { - "reply": "map_param_set_fragmentation_reply" - }, - "map_param_add_del_pre_resolve": { - "reply": "map_param_add_del_pre_resolve_reply" - }, - "map_param_set_tcp": { - "reply": "map_param_set_tcp_reply" - }, - "map_rule_dump": { - "reply": "map_rule_details", - "stream": true - }, - "map_if_enable_disable": { - "reply": "map_if_enable_disable_reply" - }, - "map_param_set_icmp6": { - "reply": "map_param_set_icmp6_reply" - }, - "map_add_del_rule": { - "reply": "map_add_del_rule_reply" - }, - "map_domain_dump": { - "reply": "map_domain_details", - "stream": true - }, - "map_param_get": { - "reply": "map_param_get_reply" - }, - "map_param_set_icmp": { - "reply": "map_param_set_icmp_reply" - }, - "map_add_domain": { - "reply": "map_add_domain_reply" - }, - "map_summary_stats": { - "reply": "map_summary_stats_reply" - }, - "map_param_set_traffic_class": { - "reply": "map_param_set_traffic_class_reply" - }, - "map_del_domain": { - "reply": "map_del_domain_reply" - }, - "map_param_set_reassembly": { - "reply": "map_param_set_reassembly_reply" - }, - "map_param_set_security_check": { - "reply": "map_param_set_security_check_reply" - } - }, - "enums": [ - [ - "address_family", - [ - "ADDRESS_IP4", - 0 - ], - [ - "ADDRESS_IP6", - 1 - ], - { - "enumtype": "u32" - } - ] - ], - "types": [ - [ - "address", - [ - "vl_api_address_family_t", - "af" - ], - [ - "vl_api_address_union_t", - "un" - ], - { - "crc": "0x09f11671" - } - ], - [ - "prefix", - [ - "vl_api_address_t", - "address" - ], - [ - "u8", - "address_length" - ], - { - "crc": "0x0403aebc" - } - ], - [ - "mprefix", - [ - "vl_api_address_family_t", - "af" - ], - [ - "u16", - "grp_address_length" - ], - [ - "vl_api_address_union_t", - "grp_address" - ], - [ - "vl_api_address_union_t", - "src_address" - ], - { - "crc": "0x1c4cba05" - } - ], - [ - "ip6_prefix", - [ - "vl_api_ip6_address_t", - "prefix" - ], - [ - "u8", - "len" - ], - { - "crc": "0x779fd64f" - } - ], - [ - "ip4_prefix", - [ - "vl_api_ip4_address_t", - "prefix" - ], - [ - "u8", - "len" - ], - { - "crc": "0xea8dc11d" - } - ] - ], - "aliases": { - "ip6_address": { - "length": 16, - "type": "u8" - }, - "ip4_address": { - "length": 4, - "type": "u8" - } - } -} diff --git a/examples/bin_api/maps/maps.ba.go b/examples/bin_api/maps/maps.ba.go deleted file mode 100644 index 366b822..0000000 --- a/examples/bin_api/maps/maps.ba.go +++ /dev/null @@ -1,778 +0,0 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: map.api.json - -/* - Package maps is a generated from VPP binary API module 'map'. - - It contains following objects: - 16 services - 1 enum - 2 aliases - 5 types - 1 union - 32 messages -*/ -package maps - -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpMapDomain(*MapDomainDump) ([]*MapDomainDetails, error) - DumpMapRule(*MapRuleDump) ([]*MapRuleDetails, error) - MapAddDelRule(*MapAddDelRule) (*MapAddDelRuleReply, error) - MapAddDomain(*MapAddDomain) (*MapAddDomainReply, error) - MapDelDomain(*MapDelDomain) (*MapDelDomainReply, error) - MapIfEnableDisable(*MapIfEnableDisable) (*MapIfEnableDisableReply, error) - MapParamAddDelPreResolve(*MapParamAddDelPreResolve) (*MapParamAddDelPreResolveReply, error) - MapParamGet(*MapParamGet) (*MapParamGetReply, error) - MapParamSetFragmentation(*MapParamSetFragmentation) (*MapParamSetFragmentationReply, error) - MapParamSetICMP(*MapParamSetICMP) (*MapParamSetICMPReply, error) - MapParamSetICMP6(*MapParamSetICMP6) (*MapParamSetICMP6Reply, error) - MapParamSetReassembly(*MapParamSetReassembly) (*MapParamSetReassemblyReply, error) - MapParamSetSecurityCheck(*MapParamSetSecurityCheck) (*MapParamSetSecurityCheckReply, error) - MapParamSetTCP(*MapParamSetTCP) (*MapParamSetTCPReply, error) - MapParamSetTrafficClass(*MapParamSetTrafficClass) (*MapParamSetTrafficClassReply, error) - MapSummaryStats(*MapSummaryStats) (*MapSummaryStatsReply, error) -} - -/* Enums */ - -// AddressFamily represents VPP binary API enum 'address_family': -type AddressFamily uint32 - -const ( - ADDRESS_IP4 AddressFamily = 0 - ADDRESS_IP6 AddressFamily = 1 -) - -/* Aliases */ - -// IP4Address represents VPP binary API alias 'ip4_address': -type IP4Address [4]uint8 - -// IP6Address represents VPP binary API alias 'ip6_address': -type IP6Address [16]uint8 - -/* Types */ - -// Address represents VPP binary API type 'address': -type Address struct { - Af AddressFamily - Un AddressUnion -} - -func (*Address) GetTypeName() string { - return "address" -} -func (*Address) GetCrcString() string { - return "09f11671" -} - -// IP4Prefix represents VPP binary API type 'ip4_prefix': -type IP4Prefix struct { - Prefix IP4Address - Len uint8 -} - -func (*IP4Prefix) GetTypeName() string { - return "ip4_prefix" -} -func (*IP4Prefix) GetCrcString() string { - return "ea8dc11d" -} - -// IP6Prefix represents VPP binary API type 'ip6_prefix': -type IP6Prefix struct { - Prefix IP6Address - Len uint8 -} - -func (*IP6Prefix) GetTypeName() string { - return "ip6_prefix" -} -func (*IP6Prefix) GetCrcString() string { - return "779fd64f" -} - -// Mprefix represents VPP binary API type 'mprefix': -type Mprefix struct { - Af AddressFamily - GrpAddressLength uint16 - GrpAddress AddressUnion - SrcAddress AddressUnion -} - -func (*Mprefix) GetTypeName() string { - return "mprefix" -} -func (*Mprefix) GetCrcString() string { - return "1c4cba05" -} - -// Prefix represents VPP binary API type 'prefix': -type Prefix struct { - Address Address - AddressLength uint8 -} - -func (*Prefix) GetTypeName() string { - return "prefix" -} -func (*Prefix) GetCrcString() string { - return "0403aebc" -} - -/* Unions */ - -// AddressUnion represents VPP binary API union 'address_union': -type AddressUnion struct { - Union_data [16]byte -} - -func (*AddressUnion) GetTypeName() string { - return "address_union" -} -func (*AddressUnion) GetCrcString() string { - return "d68a2fb4" -} - -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.Union_data[:], b.Bytes()) -} -func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.Union_data[:]) - 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.Union_data[:], b.Bytes()) -} -func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.Union_data[:]) - struc.Unpack(b, &a) - return -} - -/* Messages */ - -// MapAddDelRule represents VPP binary API message 'map_add_del_rule': -type MapAddDelRule struct { - Index uint32 - IsAdd bool - IP6Dst IP6Address - Psid uint16 -} - -func (*MapAddDelRule) GetMessageName() string { - return "map_add_del_rule" -} -func (*MapAddDelRule) GetCrcString() string { - return "e6132040" -} -func (*MapAddDelRule) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapAddDelRuleReply represents VPP binary API message 'map_add_del_rule_reply': -type MapAddDelRuleReply struct { - Retval int32 -} - -func (*MapAddDelRuleReply) GetMessageName() string { - return "map_add_del_rule_reply" -} -func (*MapAddDelRuleReply) GetCrcString() string { - return "e8d4e804" -} -func (*MapAddDelRuleReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapAddDomain represents VPP binary API message 'map_add_domain': -type MapAddDomain struct { - IP6Prefix IP6Prefix - IP4Prefix IP4Prefix - IP6Src IP6Prefix - EaBitsLen uint8 - PsidOffset uint8 - PsidLength uint8 - Mtu uint16 -} - -func (*MapAddDomain) GetMessageName() string { - return "map_add_domain" -} -func (*MapAddDomain) GetCrcString() string { - return "a9358068" -} -func (*MapAddDomain) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapAddDomainReply represents VPP binary API message 'map_add_domain_reply': -type MapAddDomainReply struct { - Index uint32 - Retval int32 -} - -func (*MapAddDomainReply) GetMessageName() string { - return "map_add_domain_reply" -} -func (*MapAddDomainReply) GetCrcString() string { - return "3e6d4e2c" -} -func (*MapAddDomainReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapDelDomain represents VPP binary API message 'map_del_domain': -type MapDelDomain struct { - Index uint32 -} - -func (*MapDelDomain) GetMessageName() string { - return "map_del_domain" -} -func (*MapDelDomain) GetCrcString() string { - return "8ac76db6" -} -func (*MapDelDomain) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapDelDomainReply represents VPP binary API message 'map_del_domain_reply': -type MapDelDomainReply struct { - Retval int32 -} - -func (*MapDelDomainReply) GetMessageName() string { - return "map_del_domain_reply" -} -func (*MapDelDomainReply) GetCrcString() string { - return "e8d4e804" -} -func (*MapDelDomainReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapDomainDetails represents VPP binary API message 'map_domain_details': -type MapDomainDetails struct { - DomainIndex uint32 - IP6Prefix IP6Prefix - IP4Prefix IP4Prefix - IP6Src IP6Prefix - EaBitsLen uint8 - PsidOffset uint8 - PsidLength uint8 - Flags uint8 - Mtu uint16 -} - -func (*MapDomainDetails) GetMessageName() string { - return "map_domain_details" -} -func (*MapDomainDetails) GetCrcString() string { - return "2a17dcb8" -} -func (*MapDomainDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapDomainDump represents VPP binary API message 'map_domain_dump': -type MapDomainDump struct{} - -func (*MapDomainDump) GetMessageName() string { - return "map_domain_dump" -} -func (*MapDomainDump) GetCrcString() string { - return "51077d14" -} -func (*MapDomainDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapIfEnableDisable represents VPP binary API message 'map_if_enable_disable': -type MapIfEnableDisable struct { - SwIfIndex uint32 - IsEnable bool - IsTranslation bool -} - -func (*MapIfEnableDisable) GetMessageName() string { - return "map_if_enable_disable" -} -func (*MapIfEnableDisable) GetCrcString() string { - return "61a30cd9" -} -func (*MapIfEnableDisable) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapIfEnableDisableReply represents VPP binary API message 'map_if_enable_disable_reply': -type MapIfEnableDisableReply struct { - Retval int32 -} - -func (*MapIfEnableDisableReply) GetMessageName() string { - return "map_if_enable_disable_reply" -} -func (*MapIfEnableDisableReply) GetCrcString() string { - return "e8d4e804" -} -func (*MapIfEnableDisableReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapParamAddDelPreResolve represents VPP binary API message 'map_param_add_del_pre_resolve': -type MapParamAddDelPreResolve struct { - IsAdd bool - IP4NhAddress IP4Address - IP6NhAddress IP6Address -} - -func (*MapParamAddDelPreResolve) GetMessageName() string { - return "map_param_add_del_pre_resolve" -} -func (*MapParamAddDelPreResolve) GetCrcString() string { - return "ea9a9a4a" -} -func (*MapParamAddDelPreResolve) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapParamAddDelPreResolveReply represents VPP binary API message 'map_param_add_del_pre_resolve_reply': -type MapParamAddDelPreResolveReply struct { - Retval int32 -} - -func (*MapParamAddDelPreResolveReply) GetMessageName() string { - return "map_param_add_del_pre_resolve_reply" -} -func (*MapParamAddDelPreResolveReply) GetCrcString() string { - return "e8d4e804" -} -func (*MapParamAddDelPreResolveReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapParamGet represents VPP binary API message 'map_param_get': -type MapParamGet struct{} - -func (*MapParamGet) GetMessageName() string { - return "map_param_get" -} -func (*MapParamGet) GetCrcString() string { - return "51077d14" -} -func (*MapParamGet) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapParamGetReply represents VPP binary API message 'map_param_get_reply': -type MapParamGetReply struct { - Retval int32 - FragInner uint8 - FragIgnoreDf uint8 - ICMPIP4ErrRelaySrc IP4Address - ICMP6EnableUnreachable bool - IP4NhAddress IP4Address - IP6NhAddress IP6Address - IP4LifetimeMs uint16 - IP4PoolSize uint16 - IP4Buffers uint32 - IP4HtRatio float64 - IP6LifetimeMs uint16 - IP6PoolSize uint16 - IP6Buffers uint32 - IP6HtRatio float64 - SecCheckEnable bool - SecCheckFragments bool - TcCopy bool - TcClass uint8 -} - -func (*MapParamGetReply) GetMessageName() string { - return "map_param_get_reply" -} -func (*MapParamGetReply) GetCrcString() string { - return "b40e9226" -} -func (*MapParamGetReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapParamSetFragmentation represents VPP binary API message 'map_param_set_fragmentation': -type MapParamSetFragmentation struct { - Inner bool - IgnoreDf bool -} - -func (*MapParamSetFragmentation) GetMessageName() string { - return "map_param_set_fragmentation" -} -func (*MapParamSetFragmentation) GetCrcString() string { - return "9ff54d90" -} -func (*MapParamSetFragmentation) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapParamSetFragmentationReply represents VPP binary API message 'map_param_set_fragmentation_reply': -type MapParamSetFragmentationReply struct { - Retval int32 -} - -func (*MapParamSetFragmentationReply) GetMessageName() string { - return "map_param_set_fragmentation_reply" -} -func (*MapParamSetFragmentationReply) GetCrcString() string { - return "e8d4e804" -} -func (*MapParamSetFragmentationReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapParamSetICMP represents VPP binary API message 'map_param_set_icmp': -type MapParamSetICMP struct { - IP4ErrRelaySrc IP4Address -} - -func (*MapParamSetICMP) GetMessageName() string { - return "map_param_set_icmp" -} -func (*MapParamSetICMP) GetCrcString() string { - return "4c0a4fd2" -} -func (*MapParamSetICMP) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapParamSetICMP6 represents VPP binary API message 'map_param_set_icmp6': -type MapParamSetICMP6 struct { - EnableUnreachable bool -} - -func (*MapParamSetICMP6) GetMessageName() string { - return "map_param_set_icmp6" -} -func (*MapParamSetICMP6) GetCrcString() string { - return "5d01f8c1" -} -func (*MapParamSetICMP6) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapParamSetICMP6Reply represents VPP binary API message 'map_param_set_icmp6_reply': -type MapParamSetICMP6Reply struct { - Retval int32 -} - -func (*MapParamSetICMP6Reply) GetMessageName() string { - return "map_param_set_icmp6_reply" -} -func (*MapParamSetICMP6Reply) GetCrcString() string { - return "e8d4e804" -} -func (*MapParamSetICMP6Reply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapParamSetICMPReply represents VPP binary API message 'map_param_set_icmp_reply': -type MapParamSetICMPReply struct { - Retval int32 -} - -func (*MapParamSetICMPReply) GetMessageName() string { - return "map_param_set_icmp_reply" -} -func (*MapParamSetICMPReply) GetCrcString() string { - return "e8d4e804" -} -func (*MapParamSetICMPReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapParamSetReassembly represents VPP binary API message 'map_param_set_reassembly': -type MapParamSetReassembly struct { - IsIP6 bool - LifetimeMs uint16 - PoolSize uint16 - Buffers uint32 - HtRatio float64 -} - -func (*MapParamSetReassembly) GetMessageName() string { - return "map_param_set_reassembly" -} -func (*MapParamSetReassembly) GetCrcString() string { - return "54172b10" -} -func (*MapParamSetReassembly) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapParamSetReassemblyReply represents VPP binary API message 'map_param_set_reassembly_reply': -type MapParamSetReassemblyReply struct { - Retval int32 -} - -func (*MapParamSetReassemblyReply) GetMessageName() string { - return "map_param_set_reassembly_reply" -} -func (*MapParamSetReassemblyReply) GetCrcString() string { - return "e8d4e804" -} -func (*MapParamSetReassemblyReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapParamSetSecurityCheck represents VPP binary API message 'map_param_set_security_check': -type MapParamSetSecurityCheck struct { - Enable bool - Fragments bool -} - -func (*MapParamSetSecurityCheck) GetMessageName() string { - return "map_param_set_security_check" -} -func (*MapParamSetSecurityCheck) GetCrcString() string { - return "6abe9836" -} -func (*MapParamSetSecurityCheck) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapParamSetSecurityCheckReply represents VPP binary API message 'map_param_set_security_check_reply': -type MapParamSetSecurityCheckReply struct { - Retval int32 -} - -func (*MapParamSetSecurityCheckReply) GetMessageName() string { - return "map_param_set_security_check_reply" -} -func (*MapParamSetSecurityCheckReply) GetCrcString() string { - return "e8d4e804" -} -func (*MapParamSetSecurityCheckReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapParamSetTCP represents VPP binary API message 'map_param_set_tcp': -type MapParamSetTCP struct { - TCPMss uint16 -} - -func (*MapParamSetTCP) GetMessageName() string { - return "map_param_set_tcp" -} -func (*MapParamSetTCP) GetCrcString() string { - return "87a825d9" -} -func (*MapParamSetTCP) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapParamSetTCPReply represents VPP binary API message 'map_param_set_tcp_reply': -type MapParamSetTCPReply struct { - Retval int32 -} - -func (*MapParamSetTCPReply) GetMessageName() string { - return "map_param_set_tcp_reply" -} -func (*MapParamSetTCPReply) GetCrcString() string { - return "e8d4e804" -} -func (*MapParamSetTCPReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapParamSetTrafficClass represents VPP binary API message 'map_param_set_traffic_class': -type MapParamSetTrafficClass struct { - Copy bool - Class uint8 -} - -func (*MapParamSetTrafficClass) GetMessageName() string { - return "map_param_set_traffic_class" -} -func (*MapParamSetTrafficClass) GetCrcString() string { - return "007ee563" -} -func (*MapParamSetTrafficClass) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapParamSetTrafficClassReply represents VPP binary API message 'map_param_set_traffic_class_reply': -type MapParamSetTrafficClassReply struct { - Retval int32 -} - -func (*MapParamSetTrafficClassReply) GetMessageName() string { - return "map_param_set_traffic_class_reply" -} -func (*MapParamSetTrafficClassReply) GetCrcString() string { - return "e8d4e804" -} -func (*MapParamSetTrafficClassReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapRuleDetails represents VPP binary API message 'map_rule_details': -type MapRuleDetails struct { - IP6Dst IP6Address - Psid uint16 -} - -func (*MapRuleDetails) GetMessageName() string { - return "map_rule_details" -} -func (*MapRuleDetails) GetCrcString() string { - return "4f932665" -} -func (*MapRuleDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// MapRuleDump represents VPP binary API message 'map_rule_dump': -type MapRuleDump struct { - DomainIndex uint32 -} - -func (*MapRuleDump) GetMessageName() string { - return "map_rule_dump" -} -func (*MapRuleDump) GetCrcString() string { - return "e43e6ff6" -} -func (*MapRuleDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapSummaryStats represents VPP binary API message 'map_summary_stats': -type MapSummaryStats struct{} - -func (*MapSummaryStats) GetMessageName() string { - return "map_summary_stats" -} -func (*MapSummaryStats) GetCrcString() string { - return "51077d14" -} -func (*MapSummaryStats) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// MapSummaryStatsReply represents VPP binary API message 'map_summary_stats_reply': -type MapSummaryStatsReply struct { - Retval int32 - TotalBindings uint64 - TotalPkts []uint64 `struc:"[2]uint64"` - TotalBytes []uint64 `struc:"[2]uint64"` - TotalIP4Fragments uint64 - TotalSecurityCheck []uint64 `struc:"[2]uint64"` -} - -func (*MapSummaryStatsReply) GetMessageName() string { - return "map_summary_stats_reply" -} -func (*MapSummaryStatsReply) GetCrcString() string { - return "0e4ace0e" -} -func (*MapSummaryStatsReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func init() { - api.RegisterMessage((*MapAddDelRule)(nil), "map.MapAddDelRule") - api.RegisterMessage((*MapAddDelRuleReply)(nil), "map.MapAddDelRuleReply") - api.RegisterMessage((*MapAddDomain)(nil), "map.MapAddDomain") - api.RegisterMessage((*MapAddDomainReply)(nil), "map.MapAddDomainReply") - api.RegisterMessage((*MapDelDomain)(nil), "map.MapDelDomain") - api.RegisterMessage((*MapDelDomainReply)(nil), "map.MapDelDomainReply") - api.RegisterMessage((*MapDomainDetails)(nil), "map.MapDomainDetails") - api.RegisterMessage((*MapDomainDump)(nil), "map.MapDomainDump") - api.RegisterMessage((*MapIfEnableDisable)(nil), "map.MapIfEnableDisable") - api.RegisterMessage((*MapIfEnableDisableReply)(nil), "map.MapIfEnableDisableReply") - api.RegisterMessage((*MapParamAddDelPreResolve)(nil), "map.MapParamAddDelPreResolve") - api.RegisterMessage((*MapParamAddDelPreResolveReply)(nil), "map.MapParamAddDelPreResolveReply") - api.RegisterMessage((*MapParamGet)(nil), "map.MapParamGet") - api.RegisterMessage((*MapParamGetReply)(nil), "map.MapParamGetReply") - api.RegisterMessage((*MapParamSetFragmentation)(nil), "map.MapParamSetFragmentation") - api.RegisterMessage((*MapParamSetFragmentationReply)(nil), "map.MapParamSetFragmentationReply") - api.RegisterMessage((*MapParamSetICMP)(nil), "map.MapParamSetICMP") - api.RegisterMessage((*MapParamSetICMP6)(nil), "map.MapParamSetICMP6") - api.RegisterMessage((*MapParamSetICMP6Reply)(nil), "map.MapParamSetICMP6Reply") - api.RegisterMessage((*MapParamSetICMPReply)(nil), "map.MapParamSetICMPReply") - api.RegisterMessage((*MapParamSetReassembly)(nil), "map.MapParamSetReassembly") - api.RegisterMessage((*MapParamSetReassemblyReply)(nil), "map.MapParamSetReassemblyReply") - api.RegisterMessage((*MapParamSetSecurityCheck)(nil), "map.MapParamSetSecurityCheck") - api.RegisterMessage((*MapParamSetSecurityCheckReply)(nil), "map.MapParamSetSecurityCheckReply") - api.RegisterMessage((*MapParamSetTCP)(nil), "map.MapParamSetTCP") - api.RegisterMessage((*MapParamSetTCPReply)(nil), "map.MapParamSetTCPReply") - api.RegisterMessage((*MapParamSetTrafficClass)(nil), "map.MapParamSetTrafficClass") - api.RegisterMessage((*MapParamSetTrafficClassReply)(nil), "map.MapParamSetTrafficClassReply") - api.RegisterMessage((*MapRuleDetails)(nil), "map.MapRuleDetails") - api.RegisterMessage((*MapRuleDump)(nil), "map.MapRuleDump") - api.RegisterMessage((*MapSummaryStats)(nil), "map.MapSummaryStats") - api.RegisterMessage((*MapSummaryStatsReply)(nil), "map.MapSummaryStatsReply") -} - -var Messages = []api.Message{ - (*MapAddDelRule)(nil), - (*MapAddDelRuleReply)(nil), - (*MapAddDomain)(nil), - (*MapAddDomainReply)(nil), - (*MapDelDomain)(nil), - (*MapDelDomainReply)(nil), - (*MapDomainDetails)(nil), - (*MapDomainDump)(nil), - (*MapIfEnableDisable)(nil), - (*MapIfEnableDisableReply)(nil), - (*MapParamAddDelPreResolve)(nil), - (*MapParamAddDelPreResolveReply)(nil), - (*MapParamGet)(nil), - (*MapParamGetReply)(nil), - (*MapParamSetFragmentation)(nil), - (*MapParamSetFragmentationReply)(nil), - (*MapParamSetICMP)(nil), - (*MapParamSetICMP6)(nil), - (*MapParamSetICMP6Reply)(nil), - (*MapParamSetICMPReply)(nil), - (*MapParamSetReassembly)(nil), - (*MapParamSetReassemblyReply)(nil), - (*MapParamSetSecurityCheck)(nil), - (*MapParamSetSecurityCheckReply)(nil), - (*MapParamSetTCP)(nil), - (*MapParamSetTCPReply)(nil), - (*MapParamSetTrafficClass)(nil), - (*MapParamSetTrafficClassReply)(nil), - (*MapRuleDetails)(nil), - (*MapRuleDump)(nil), - (*MapSummaryStats)(nil), - (*MapSummaryStatsReply)(nil), -} diff --git a/examples/bin_api/memclnt.api.json b/examples/bin_api/memclnt.api.json deleted file mode 100644 index 8014a26..0000000 --- a/examples/bin_api/memclnt.api.json +++ /dev/null @@ -1,598 +0,0 @@ -{ - "messages": [ - [ - "memclnt_create", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "ctx_quota" - ], - [ - "u64", - "input_queue" - ], - [ - "u8", - "name", - 64 - ], - [ - "u32", - "api_versions", - 8 - ], - { - "crc": "0x6d33c5ea" - } - ], - [ - "memclnt_create_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "response" - ], - [ - "u64", - "handle" - ], - [ - "u32", - "index" - ], - [ - "u64", - "message_table" - ], - { - "crc": "0x42ec4560" - } - ], - [ - "memclnt_delete", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "index" - ], - [ - "u64", - "handle" - ], - [ - "u8", - "do_cleanup" - ], - { - "crc": "0x4dd351e9" - } - ], - [ - "memclnt_delete_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "i32", - "response" - ], - [ - "u64", - "handle" - ], - { - "crc": "0x3d3b6312" - } - ], - [ - "rx_thread_exit", - [ - "u16", - "_vl_msg_id" - ], - [ - "u8", - "dummy" - ], - { - "crc": "0xc3a3a452" - } - ], - [ - "memclnt_rx_thread_suspend", - [ - "u16", - "_vl_msg_id" - ], - [ - "u8", - "dummy" - ], - { - "crc": "0xc3a3a452" - } - ], - [ - "memclnt_read_timeout", - [ - "u16", - "_vl_msg_id" - ], - [ - "u8", - "dummy" - ], - { - "crc": "0xc3a3a452" - } - ], - [ - "rpc_call", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u64", - "function" - ], - [ - "u8", - "multicast" - ], - [ - "u8", - "need_barrier_sync" - ], - [ - "u8", - "send_reply" - ], - [ - "u32", - "data_len" - ], - [ - "u8", - "data", - 0, - "data_len" - ], - { - "crc": "0x7e8a2c95" - } - ], - [ - "rpc_call_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "get_first_msg_id", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "name", - 64 - ], - { - "crc": "0x0cb71b0e" - } - ], - [ - "get_first_msg_id_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u16", - "first_msg_id" - ], - { - "crc": "0x7d337472" - } - ], - [ - "api_versions", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "api_versions_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "count" - ], - [ - "vl_api_module_version_t", - "api_versions", - 0, - "count" - ], - { - "crc": "0x90a39195" - } - ], - [ - "trace_plugin_msg_ids", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "plugin_name", - 128 - ], - [ - "u16", - "first_msg_id" - ], - [ - "u16", - "last_msg_id" - ], - { - "crc": "0x64af79f9" - } - ], - [ - "sockclnt_create", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u8", - "name", - 64 - ], - { - "crc": "0xdf2cf94d" - } - ], - [ - "sockclnt_create_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "i32", - "response" - ], - [ - "u32", - "index" - ], - [ - "u16", - "count" - ], - [ - "vl_api_message_table_entry_t", - "message_table", - 0, - "count" - ], - { - "crc": "0xa134a8a8" - } - ], - [ - "sockclnt_delete", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "index" - ], - { - "crc": "0x8ac76db6" - } - ], - [ - "sockclnt_delete_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "response" - ], - { - "crc": "0x8f38b1ee" - } - ], - [ - "sock_init_shm", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "requested_size" - ], - [ - "u8", - "nitems" - ], - [ - "u64", - "configs", - 0, - "nitems" - ], - { - "crc": "0x51646d92" - } - ], - [ - "sock_init_shm_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "memclnt_keepalive", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "memclnt_keepalive_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ] - ], - "vl_api_version": "0xb619530", - "unions": [], - "services": { - "api_versions": { - "reply": "api_versions_reply" - }, - "memclnt_keepalive": { - "reply": "memclnt_keepalive_reply" - }, - "memclnt_rx_thread_suspend": { - "reply": "null" - }, - "sockclnt_delete": { - "reply": "sockclnt_delete_reply" - }, - "memclnt_create": { - "reply": "memclnt_create_reply" - }, - "get_first_msg_id": { - "reply": "get_first_msg_id_reply" - }, - "memclnt_read_timeout": { - "reply": "null" - }, - "rpc_call": { - "reply": "rpc_call_reply" - }, - "rx_thread_exit": { - "reply": "null" - }, - "sock_init_shm": { - "reply": "sock_init_shm_reply" - }, - "memclnt_delete": { - "reply": "memclnt_delete_reply" - }, - "sockclnt_create": { - "reply": "sockclnt_create_reply" - }, - "trace_plugin_msg_ids": { - "reply": "null" - } - }, - "enums": [], - "types": [ - [ - "module_version", - [ - "u32", - "major" - ], - [ - "u32", - "minor" - ], - [ - "u32", - "patch" - ], - [ - "u8", - "name", - 64 - ], - { - "crc": "0x4b6da11a" - } - ], - [ - "message_table_entry", - [ - "u16", - "index" - ], - [ - "u8", - "name", - 64 - ], - { - "crc": "0x913bf1c6" - } - ] - ], - "aliases": {} -} diff --git a/examples/bin_api/memif.api.json b/examples/bin_api/memif.api.json deleted file mode 100644 index 4399f1c..0000000 --- a/examples/bin_api/memif.api.json +++ /dev/null @@ -1,318 +0,0 @@ -{ - "messages": [ - [ - "memif_socket_filename_add_del", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "is_add" - ], - [ - "u32", - "socket_id" - ], - [ - "u8", - "socket_filename", - 128 - ], - { - "crc": "0x30e3929d" - } - ], - [ - "memif_socket_filename_add_del_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "memif_create", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "role" - ], - [ - "u8", - "mode" - ], - [ - "u8", - "rx_queues" - ], - [ - "u8", - "tx_queues" - ], - [ - "u32", - "id" - ], - [ - "u32", - "socket_id" - ], - [ - "u8", - "secret", - 24 - ], - [ - "u32", - "ring_size" - ], - [ - "u16", - "buffer_size" - ], - [ - "u8", - "hw_addr", - 6 - ], - { - "crc": "0x6597cdb2" - } - ], - [ - "memif_create_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0xfda5941f" - } - ], - [ - "memif_delete", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0x529cb13f" - } - ], - [ - "memif_delete_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "memif_socket_filename_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "socket_id" - ], - [ - "u8", - "socket_filename", - 128 - ], - { - "crc": "0xe347e32f" - } - ], - [ - "memif_socket_filename_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "memif_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "if_name", - 64 - ], - [ - "u8", - "hw_addr", - 6 - ], - [ - "u32", - "id" - ], - [ - "u8", - "role" - ], - [ - "u8", - "mode" - ], - [ - "u32", - "socket_id" - ], - [ - "u32", - "ring_size" - ], - [ - "u16", - "buffer_size" - ], - [ - "u8", - "admin_up_down" - ], - [ - "u8", - "link_up_down" - ], - { - "crc": "0x4f5a3397" - } - ], - [ - "memif_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ] - ], - "vl_api_version": "0x31b42e17", - "unions": [], - "services": { - "memif_delete": { - "reply": "memif_delete_reply" - }, - "memif_socket_filename_add_del": { - "reply": "memif_socket_filename_add_del_reply" - }, - "memif_create": { - "reply": "memif_create_reply" - }, - "memif_socket_filename_dump": { - "reply": "memif_socket_filename_details", - "stream": true - }, - "memif_dump": { - "reply": "memif_details", - "stream": true - } - }, - "enums": [], - "types": [], - "aliases": {} -} diff --git a/examples/bin_api/tap.api.json b/examples/bin_api/tap.api.json deleted file mode 100644 index 45edc6a..0000000 --- a/examples/bin_api/tap.api.json +++ /dev/null @@ -1,264 +0,0 @@ -{ - "messages": [ - [ - "tap_connect", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "use_random_mac" - ], - [ - "u8", - "tap_name", - 64 - ], - [ - "u8", - "mac_address", - 6 - ], - [ - "u8", - "renumber" - ], - [ - "u32", - "custom_dev_instance" - ], - [ - "u8", - "ip4_address_set" - ], - [ - "u8", - "ip4_address", - 4 - ], - [ - "u8", - "ip4_mask_width" - ], - [ - "u8", - "ip6_address_set" - ], - [ - "u8", - "ip6_address", - 16 - ], - [ - "u8", - "ip6_mask_width" - ], - [ - "u8", - "tag", - 64 - ], - { - "crc": "0x9b9c396f" - } - ], - [ - "tap_connect_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0xfda5941f" - } - ], - [ - "tap_modify", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "use_random_mac" - ], - [ - "u8", - "tap_name", - 64 - ], - [ - "u8", - "mac_address", - 6 - ], - [ - "u8", - "renumber" - ], - [ - "u32", - "custom_dev_instance" - ], - { - "crc": "0x8047ae5c" - } - ], - [ - "tap_modify_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0xfda5941f" - } - ], - [ - "tap_delete", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - { - "crc": "0x529cb13f" - } - ], - [ - "tap_delete_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - { - "crc": "0xe8d4e804" - } - ], - [ - "sw_interface_tap_dump", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "sw_interface_tap_details", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "u32", - "sw_if_index" - ], - [ - "u8", - "dev_name", - 64 - ], - { - "crc": "0x76229a57" - } - ] - ], - "vl_api_version": "0xacec1ba1", - "unions": [], - "services": { - "tap_delete": { - "reply": "tap_delete_reply" - }, - "sw_interface_tap_dump": { - "reply": "sw_interface_tap_details", - "stream": true - }, - "tap_modify": { - "reply": "tap_modify_reply" - }, - "tap_connect": { - "reply": "tap_connect_reply" - } - }, - "enums": [], - "types": [], - "aliases": {} -} diff --git a/examples/bin_api/tap/tap.ba.go b/examples/bin_api/tap/tap.ba.go deleted file mode 100644 index 04ae411..0000000 --- a/examples/bin_api/tap/tap.ba.go +++ /dev/null @@ -1,189 +0,0 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: tap.api.json - -/* - Package tap is a generated from VPP binary API module 'tap'. - - It contains following objects: - 4 services - 8 messages -*/ -package tap - -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpSwInterfaceTap(*SwInterfaceTapDump) ([]*SwInterfaceTapDetails, error) - TapConnect(*TapConnect) (*TapConnectReply, error) - TapDelete(*TapDelete) (*TapDeleteReply, error) - TapModify(*TapModify) (*TapModifyReply, error) -} - -/* Messages */ - -// SwInterfaceTapDetails represents VPP binary API message 'sw_interface_tap_details': -type SwInterfaceTapDetails struct { - SwIfIndex uint32 - DevName []byte `struc:"[64]byte"` -} - -func (*SwInterfaceTapDetails) GetMessageName() string { - return "sw_interface_tap_details" -} -func (*SwInterfaceTapDetails) GetCrcString() string { - return "76229a57" -} -func (*SwInterfaceTapDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// SwInterfaceTapDump represents VPP binary API message 'sw_interface_tap_dump': -type SwInterfaceTapDump struct{} - -func (*SwInterfaceTapDump) GetMessageName() string { - return "sw_interface_tap_dump" -} -func (*SwInterfaceTapDump) GetCrcString() string { - return "51077d14" -} -func (*SwInterfaceTapDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// TapConnect represents VPP binary API message 'tap_connect': -type TapConnect struct { - UseRandomMac uint8 - TapName []byte `struc:"[64]byte"` - MacAddress []byte `struc:"[6]byte"` - Renumber uint8 - CustomDevInstance uint32 - IP4AddressSet uint8 - IP4Address []byte `struc:"[4]byte"` - IP4MaskWidth uint8 - IP6AddressSet uint8 - IP6Address []byte `struc:"[16]byte"` - IP6MaskWidth uint8 - Tag []byte `struc:"[64]byte"` -} - -func (*TapConnect) GetMessageName() string { - return "tap_connect" -} -func (*TapConnect) GetCrcString() string { - return "9b9c396f" -} -func (*TapConnect) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// TapConnectReply represents VPP binary API message 'tap_connect_reply': -type TapConnectReply struct { - Retval int32 - SwIfIndex uint32 -} - -func (*TapConnectReply) GetMessageName() string { - return "tap_connect_reply" -} -func (*TapConnectReply) GetCrcString() string { - return "fda5941f" -} -func (*TapConnectReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// TapDelete represents VPP binary API message 'tap_delete': -type TapDelete struct { - SwIfIndex uint32 -} - -func (*TapDelete) GetMessageName() string { - return "tap_delete" -} -func (*TapDelete) GetCrcString() string { - return "529cb13f" -} -func (*TapDelete) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// TapDeleteReply represents VPP binary API message 'tap_delete_reply': -type TapDeleteReply struct { - Retval int32 -} - -func (*TapDeleteReply) GetMessageName() string { - return "tap_delete_reply" -} -func (*TapDeleteReply) GetCrcString() string { - return "e8d4e804" -} -func (*TapDeleteReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -// TapModify represents VPP binary API message 'tap_modify': -type TapModify struct { - SwIfIndex uint32 - UseRandomMac uint8 - TapName []byte `struc:"[64]byte"` - MacAddress []byte `struc:"[6]byte"` - Renumber uint8 - CustomDevInstance uint32 -} - -func (*TapModify) GetMessageName() string { - return "tap_modify" -} -func (*TapModify) GetCrcString() string { - return "8047ae5c" -} -func (*TapModify) GetMessageType() api.MessageType { - return api.RequestMessage -} - -// TapModifyReply represents VPP binary API message 'tap_modify_reply': -type TapModifyReply struct { - Retval int32 - SwIfIndex uint32 -} - -func (*TapModifyReply) GetMessageName() string { - return "tap_modify_reply" -} -func (*TapModifyReply) GetCrcString() string { - return "fda5941f" -} -func (*TapModifyReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func init() { - api.RegisterMessage((*SwInterfaceTapDetails)(nil), "tap.SwInterfaceTapDetails") - api.RegisterMessage((*SwInterfaceTapDump)(nil), "tap.SwInterfaceTapDump") - api.RegisterMessage((*TapConnect)(nil), "tap.TapConnect") - api.RegisterMessage((*TapConnectReply)(nil), "tap.TapConnectReply") - api.RegisterMessage((*TapDelete)(nil), "tap.TapDelete") - api.RegisterMessage((*TapDeleteReply)(nil), "tap.TapDeleteReply") - api.RegisterMessage((*TapModify)(nil), "tap.TapModify") - api.RegisterMessage((*TapModifyReply)(nil), "tap.TapModifyReply") -} - -var Messages = []api.Message{ - (*SwInterfaceTapDetails)(nil), - (*SwInterfaceTapDump)(nil), - (*TapConnect)(nil), - (*TapConnectReply)(nil), - (*TapDelete)(nil), - (*TapDeleteReply)(nil), - (*TapModify)(nil), - (*TapModifyReply)(nil), -} diff --git a/examples/bin_api/vpe.api.json b/examples/bin_api/vpe.api.json deleted file mode 100644 index cc5ddee..0000000 --- a/examples/bin_api/vpe.api.json +++ /dev/null @@ -1,490 +0,0 @@ -{ - "messages": [ - [ - "control_ping", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "control_ping_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "vpe_pid" - ], - { - "crc": "0xf6b0b8ca" - } - ], - [ - "cli", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u64", - "cmd_in_shmem" - ], - { - "crc": "0x23bfbfff" - } - ], - [ - "cli_inband", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "string", - "cmd" - ], - { - "crc": "0xb1ad59b3" - } - ], - [ - "cli_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u64", - "reply_in_shmem" - ], - { - "crc": "0x06d68297" - } - ], - [ - "cli_inband_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "string", - "reply" - ], - { - "crc": "0x6d3c80a4" - } - ], - [ - "get_node_index", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "node_name", - 64 - ], - { - "crc": "0x6c9a495d" - } - ], - [ - "get_node_index_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "node_index" - ], - { - "crc": "0xa8600b89" - } - ], - [ - "add_node_next", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "node_name", - 64 - ], - [ - "u8", - "next_name", - 64 - ], - { - "crc": "0x9ab92f7a" - } - ], - [ - "add_node_next_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "next_index" - ], - { - "crc": "0x2ed75f32" - } - ], - [ - "show_version", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "show_version_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "string", - "program" - ], - [ - "string", - "version" - ], - [ - "string", - "build_date" - ], - [ - "string", - "build_directory" - ], - { - "crc": "0xb9bcf6df" - } - ], - [ - "show_threads", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "show_threads_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "count" - ], - [ - "vl_api_thread_data_t", - "thread_data", - 0, - "count" - ], - { - "crc": "0x6942fb35" - } - ], - [ - "get_node_graph", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - { - "crc": "0x51077d14" - } - ], - [ - "get_node_graph_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u64", - "reply_in_shmem" - ], - { - "crc": "0x06d68297" - } - ], - [ - "get_next_index", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "client_index" - ], - [ - "u32", - "context" - ], - [ - "u8", - "node_name", - 64 - ], - [ - "u8", - "next_name", - 64 - ], - { - "crc": "0x9ab92f7a" - } - ], - [ - "get_next_index_reply", - [ - "u16", - "_vl_msg_id" - ], - [ - "u32", - "context" - ], - [ - "i32", - "retval" - ], - [ - "u32", - "next_index" - ], - { - "crc": "0x2ed75f32" - } - ] - ], - "vl_api_version": "0x2cc8d629", - "unions": [], - "services": { - "cli_inband": { - "reply": "cli_inband_reply" - }, - "get_node_index": { - "reply": "get_node_index_reply" - }, - "cli": { - "reply": "cli_reply" - }, - "show_version": { - "reply": "show_version_reply" - }, - "get_node_graph": { - "reply": "get_node_graph_reply" - }, - "get_next_index": { - "reply": "get_next_index_reply" - }, - "show_threads": { - "reply": "show_threads_reply" - }, - "add_node_next": { - "reply": "add_node_next_reply" - }, - "control_ping": { - "reply": "control_ping_reply" - } - }, - "enums": [], - "types": [ - [ - "thread_data", - [ - "u32", - "id" - ], - [ - "u8", - "name", - 64 - ], - [ - "u8", - "type", - 64 - ], - [ - "u32", - "pid" - ], - [ - "u32", - "cpu_id" - ], - [ - "u32", - "core" - ], - [ - "u32", - "cpu_socket" - ], - { - "crc": "0x0f57094e" - } - ] - ], - "aliases": {} -} diff --git a/examples/binapi/VPP_VERSION b/examples/binapi/VPP_VERSION new file mode 100644 index 0000000..c12c3c9 --- /dev/null +++ b/examples/binapi/VPP_VERSION @@ -0,0 +1 @@ +19.04.1-rc0~15-g85ff80645~b56 \ No newline at end of file diff --git a/examples/bin_api/acl/acl.ba.go b/examples/binapi/acl/acl.ba.go similarity index 68% rename from examples/bin_api/acl/acl.ba.go rename to examples/binapi/acl/acl.ba.go index 54fe26d..a00918e 100644 --- a/examples/bin_api/acl/acl.ba.go +++ b/examples/binapi/acl/acl.ba.go @@ -1,46 +1,43 @@ // Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: acl.api.json +// source: /usr/share/vpp/api/plugins/acl.api.json /* - Package acl is a generated from VPP binary API module 'acl'. +Package acl is a generated from VPP binary API module 'acl'. - It contains following objects: - 18 services + The acl module consists of: 2 types 36 messages + 18 services */ package acl import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" import bytes "bytes" +import context "context" +import strconv "strconv" +import struc "github.com/lunixbochs/struc" // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage -var _ = struc.Pack var _ = bytes.NewBuffer +var _ = context.Background +var _ = strconv.Itoa +var _ = struc.Pack -// Services represents VPP binary API services: -type Services interface { - DumpACL(*ACLDump) ([]*ACLDetails, error) - DumpACLInterfaceEtypeWhitelist(*ACLInterfaceEtypeWhitelistDump) ([]*ACLInterfaceEtypeWhitelistDetails, error) - DumpACLInterfaceList(*ACLInterfaceListDump) ([]*ACLInterfaceListDetails, error) - DumpMacipACL(*MacipACLDump) ([]*MacipACLDetails, error) - DumpMacipACLInterfaceList(*MacipACLInterfaceListDump) ([]*MacipACLInterfaceListDetails, error) - ACLAddReplace(*ACLAddReplace) (*ACLAddReplaceReply, error) - ACLDel(*ACLDel) (*ACLDelReply, error) - ACLInterfaceAddDel(*ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) - ACLInterfaceSetACLList(*ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) - ACLInterfaceSetEtypeWhitelist(*ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) - ACLPluginControlPing(*ACLPluginControlPing) (*ACLPluginControlPingReply, error) - ACLPluginGetConnTableMaxEntries(*ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) - ACLPluginGetVersion(*ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) - MacipACLAdd(*MacipACLAdd) (*MacipACLAddReply, error) - MacipACLAddReplace(*MacipACLAddReplace) (*MacipACLAddReplaceReply, error) - MacipACLDel(*MacipACLDel) (*MacipACLDelReply, error) - MacipACLInterfaceAddDel(*MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) - MacipACLInterfaceGet(*MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) -} +// 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.GoVppAPIPackageIsVersion1 // 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 = 0x8ed22cb9 +) /* Types */ @@ -698,41 +695,276 @@ func init() { api.RegisterMessage((*MacipACLInterfaceListDump)(nil), "acl.MacipACLInterfaceListDump") } -var Messages = []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), - (*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), +// 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), + (*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), + } +} + +// Service represents services in VPP binary API. +type Service interface { + DumpACL(ctx context.Context, in *ACLDump) ([]*ACLDetails, error) + DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) ([]*ACLInterfaceEtypeWhitelistDetails, error) + DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) ([]*ACLInterfaceListDetails, error) + DumpMacipACL(ctx context.Context, in *MacipACLDump) ([]*MacipACLDetails, error) + DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) ([]*MacipACLInterfaceListDetails, 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) + 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 service struct { + ch api.Channel +} + +func NewService(ch api.Channel) Service { + return &service{ch} +} + +func (c *service) DumpACL(ctx context.Context, in *ACLDump) ([]*ACLDetails, error) { + var dump []*ACLDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(ACLDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) ([]*ACLInterfaceEtypeWhitelistDetails, error) { + var dump []*ACLInterfaceEtypeWhitelistDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(ACLInterfaceEtypeWhitelistDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) ([]*ACLInterfaceListDetails, error) { + var dump []*ACLInterfaceListDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(ACLInterfaceListDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpMacipACL(ctx context.Context, in *MacipACLDump) ([]*MacipACLDetails, error) { + var dump []*MacipACLDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(MacipACLDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) ([]*MacipACLInterfaceListDetails, error) { + var dump []*MacipACLInterfaceListDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(MacipACLInterfaceListDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 } diff --git a/examples/bin_api/af_packet/af_packet.ba.go b/examples/binapi/af_packet/af_packet.ba.go similarity index 60% rename from examples/bin_api/af_packet/af_packet.ba.go rename to examples/binapi/af_packet/af_packet.ba.go index 5197a5b..96fd02a 100644 --- a/examples/bin_api/af_packet/af_packet.ba.go +++ b/examples/binapi/af_packet/af_packet.ba.go @@ -1,31 +1,42 @@ // Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: af_packet.api.json +// source: /usr/share/vpp/api/core/af_packet.api.json /* - Package af_packet is a generated from VPP binary API module 'af_packet'. +Package af_packet is a generated from VPP binary API module 'af_packet'. - It contains following objects: - 4 services + The af_packet module consists of: 8 messages + 4 services */ package af_packet import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" import bytes "bytes" +import context "context" +import strconv "strconv" +import struc "github.com/lunixbochs/struc" // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage -var _ = struc.Pack var _ = bytes.NewBuffer +var _ = context.Background +var _ = strconv.Itoa +var _ = struc.Pack -// Services represents VPP binary API services: -type Services interface { - DumpAfPacket(*AfPacketDump) ([]*AfPacketDetails, error) - AfPacketCreate(*AfPacketCreate) (*AfPacketCreateReply, error) - AfPacketDelete(*AfPacketDelete) (*AfPacketDeleteReply, error) - AfPacketSetL4CksumOffload(*AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) -} +// 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.GoVppAPIPackageIsVersion1 // 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 = "1.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x206563c +) /* Messages */ @@ -163,13 +174,76 @@ func init() { api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet.AfPacketSetL4CksumOffloadReply") } -var Messages = []api.Message{ - (*AfPacketCreate)(nil), - (*AfPacketCreateReply)(nil), - (*AfPacketDelete)(nil), - (*AfPacketDeleteReply)(nil), - (*AfPacketDetails)(nil), - (*AfPacketDump)(nil), - (*AfPacketSetL4CksumOffload)(nil), - (*AfPacketSetL4CksumOffloadReply)(nil), +// 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), + } +} + +// Service represents services in VPP binary API. +type Service interface { + DumpAfPacket(ctx context.Context, in *AfPacketDump) ([]*AfPacketDetails, 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 service struct { + ch api.Channel +} + +func NewService(ch api.Channel) Service { + return &service{ch} +} + +func (c *service) DumpAfPacket(ctx context.Context, in *AfPacketDump) ([]*AfPacketDetails, error) { + var dump []*AfPacketDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(AfPacketDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) 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 *service) 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 *service) 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 } diff --git a/examples/binapi/gen.go b/examples/binapi/gen.go new file mode 100644 index 0000000..40fb25d --- /dev/null +++ b/examples/binapi/gen.go @@ -0,0 +1,18 @@ +package binapi + +// Generate Go code from the VPP APIs located in the /usr/share/vpp/api directory. +//go:generate -command binapigen binapi-generator --output-dir=. --include-services + +// Core +//go:generate binapigen --input-file=/usr/share/vpp/api/core/af_packet.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/interface.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/ip.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/memclnt.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/vpe.api.json + +// Plugins +//go:generate binapigen --input-file=/usr/share/vpp/api/plugins/acl.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/plugins/memif.api.json + +// VPP version +//go:generate sh -ec "dpkg-query -f '$DOLLAR{Version}' -W vpp > VPP_VERSION" diff --git a/examples/bin_api/interfaces/interfaces.ba.go b/examples/binapi/interfaces/interfaces.ba.go similarity index 69% rename from examples/bin_api/interfaces/interfaces.ba.go rename to examples/binapi/interfaces/interfaces.ba.go index dfdea00..1f369de 100644 --- a/examples/bin_api/interfaces/interfaces.ba.go +++ b/examples/binapi/interfaces/interfaces.ba.go @@ -1,53 +1,43 @@ // Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: interface.api.json +// source: /usr/share/vpp/api/core/interface.api.json /* - Package interfaces is a generated from VPP binary API module 'interface'. +Package interfaces is a generated from VPP binary API module 'interface'. - It contains following objects: - 25 services + The interface module consists of: 1 alias 51 messages + 25 services */ package interfaces import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" import bytes "bytes" +import context "context" +import strconv "strconv" +import struc "github.com/lunixbochs/struc" // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage -var _ = struc.Pack var _ = bytes.NewBuffer +var _ = context.Background +var _ = strconv.Itoa +var _ = struc.Pack -// Services represents VPP binary API services: -type Services interface { - DumpSwInterface(*SwInterfaceDump) ([]*SwInterfaceDetails, error) - DumpSwInterfaceRxPlacement(*SwInterfaceRxPlacementDump) ([]*SwInterfaceRxPlacementDetails, error) - CollectDetailedInterfaceStats(*CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) - CreateLoopback(*CreateLoopback) (*CreateLoopbackReply, error) - CreateLoopbackInstance(*CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) - CreateSubif(*CreateSubif) (*CreateSubifReply, error) - CreateVlanSubif(*CreateVlanSubif) (*CreateVlanSubifReply, error) - DeleteLoopback(*DeleteLoopback) (*DeleteLoopbackReply, error) - DeleteSubif(*DeleteSubif) (*DeleteSubifReply, error) - HwInterfaceSetMtu(*HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) - InterfaceNameRenumber(*InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) - SwInterfaceAddDelAddress(*SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) - SwInterfaceClearStats(*SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) - SwInterfaceGetMacAddress(*SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) - SwInterfaceGetTable(*SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) - SwInterfaceSetFlags(*SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) - SwInterfaceSetIPDirectedBroadcast(*SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) - SwInterfaceSetMacAddress(*SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) - SwInterfaceSetMtu(*SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) - SwInterfaceSetRxMode(*SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) - SwInterfaceSetRxPlacement(*SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) - SwInterfaceSetTable(*SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) - SwInterfaceSetUnnumbered(*SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) - SwInterfaceTagAddDel(*SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) - WantInterfaceEvents(*WantInterfaceEvents) (*WantInterfaceEventsReply, error) -} +// 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.GoVppAPIPackageIsVersion1 // 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 = "2.2.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x672de521 +) /* Aliases */ @@ -959,56 +949,337 @@ func init() { api.RegisterMessage((*WantInterfaceEventsReply)(nil), "interface.WantInterfaceEventsReply") } -var Messages = []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), - (*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), +// 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), + (*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), + } +} + +// Service represents services in VPP binary API. +type Service interface { + DumpSwInterface(ctx context.Context, in *SwInterfaceDump) ([]*SwInterfaceDetails, error) + DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) ([]*SwInterfaceRxPlacementDetails, 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) + 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 service struct { + ch api.Channel +} + +func NewService(ch api.Channel) Service { + return &service{ch} +} + +func (c *service) DumpSwInterface(ctx context.Context, in *SwInterfaceDump) ([]*SwInterfaceDetails, error) { + var dump []*SwInterfaceDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(SwInterfaceDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) ([]*SwInterfaceRxPlacementDetails, error) { + var dump []*SwInterfaceRxPlacementDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(SwInterfaceRxPlacementDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 } diff --git a/examples/bin_api/ip/ip.ba.go b/examples/binapi/ip/ip.ba.go similarity index 68% rename from examples/bin_api/ip/ip.ba.go rename to examples/binapi/ip/ip.ba.go index b566608..71a6476 100644 --- a/examples/bin_api/ip/ip.ba.go +++ b/examples/binapi/ip/ip.ba.go @@ -1,75 +1,46 @@ // Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: ip.api.json +// source: /usr/share/vpp/api/core/ip.api.json /* - Package ip is a generated from VPP binary API module 'ip'. +Package ip is a generated from VPP binary API module 'ip'. - It contains following objects: - 44 services - 1 enum + The ip module consists of: + 2 enums 3 aliases - 11 types + 12 types 1 union 91 messages + 44 services */ package ip import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" import bytes "bytes" +import context "context" +import strconv "strconv" +import struc "github.com/lunixbochs/struc" // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage -var _ = struc.Pack var _ = bytes.NewBuffer +var _ = context.Background +var _ = strconv.Itoa +var _ = struc.Pack -// Services represents VPP binary API services: -type Services interface { - DumpIP6Fib(*IP6FibDump) ([]*IP6FibDetails, error) - DumpIP6Mfib(*IP6MfibDump) ([]*IP6MfibDetails, error) - DumpIP6ndProxy(*IP6ndProxyDump) ([]*IP6ndProxyDetails, error) - DumpIPAddress(*IPAddressDump) ([]*IPAddressDetails, error) - DumpIPContainerProxy(*IPContainerProxyDump) ([]*IPContainerProxyDetails, error) - DumpIP(*IPDump) ([]*IPDetails, error) - DumpIPFib(*IPFibDump) ([]*IPFibDetails, error) - DumpIPMfib(*IPMfibDump) ([]*IPMfibDetails, error) - DumpIPNeighbor(*IPNeighborDump) ([]*IPNeighborDetails, error) - DumpIPPuntRedirect(*IPPuntRedirectDump) ([]*IPPuntRedirectDetails, error) - DumpIPUnnumbered(*IPUnnumberedDump) ([]*IPUnnumberedDetails, error) - DumpMfibSignal(*MfibSignalDump) ([]*MfibSignalDetails, error) - DumpProxyArp(*ProxyArpDump) ([]*ProxyArpDetails, error) - DumpProxyArpIntfc(*ProxyArpIntfcDump) ([]*ProxyArpIntfcDetails, error) - IoamDisable(*IoamDisable) (*IoamDisableReply, error) - IoamEnable(*IoamEnable) (*IoamEnableReply, error) - IP6ndProxyAddDel(*IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) - IP6ndSendRouterSolicitation(*IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) - IPAddDelRoute(*IPAddDelRoute) (*IPAddDelRouteReply, error) - IPContainerProxyAddDel(*IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) - IPMrouteAddDel(*IPMrouteAddDel) (*IPMrouteAddDelReply, error) - IPNeighborAddDel(*IPNeighborAddDel) (*IPNeighborAddDelReply, error) - IPProbeNeighbor(*IPProbeNeighbor) (*IPProbeNeighborReply, error) - IPPuntPolice(*IPPuntPolice) (*IPPuntPoliceReply, error) - IPPuntRedirect(*IPPuntRedirect) (*IPPuntRedirectReply, error) - IPReassemblyEnableDisable(*IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) - IPReassemblyGet(*IPReassemblyGet) (*IPReassemblyGetReply, error) - IPReassemblySet(*IPReassemblySet) (*IPReassemblySetReply, error) - IPScanNeighborEnableDisable(*IPScanNeighborEnableDisable) (*IPScanNeighborEnableDisableReply, error) - IPSourceAndPortRangeCheckAddDel(*IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) - IPSourceAndPortRangeCheckInterfaceAddDel(*IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) - IPSourceCheckInterfaceAddDel(*IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) - IPTableAddDel(*IPTableAddDel) (*IPTableAddDelReply, error) - ProxyArpAddDel(*ProxyArpAddDel) (*ProxyArpAddDelReply, error) - ProxyArpIntfcEnableDisable(*ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) - ResetFib(*ResetFib) (*ResetFibReply, error) - SetArpNeighborLimit(*SetArpNeighborLimit) (*SetArpNeighborLimitReply, error) - SetIPFlowHash(*SetIPFlowHash) (*SetIPFlowHashReply, error) - SwInterfaceIP6EnableDisable(*SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) - SwInterfaceIP6ndRaConfig(*SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) - SwInterfaceIP6ndRaPrefix(*SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) - WantIP4ArpEvents(*WantIP4ArpEvents) (*WantIP4ArpEventsReply, error) - WantIP6NdEvents(*WantIP6NdEvents) (*WantIP6NdEventsReply, error) - WantIP6RaEvents(*WantIP6RaEvents) (*WantIP6RaEventsReply, error) -} +// 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.GoVppAPIPackageIsVersion1 // 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 = "2.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x51ac4ce0 +) /* Enums */ @@ -81,6 +52,53 @@ const ( ADDRESS_IP6 AddressFamily = 1 ) +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var 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 strconv.Itoa(int(x)) +} + +// IPNeighborFlags represents VPP binary API enum 'ip_neighbor_flags': +type IPNeighborFlags uint32 + +const ( + IP_API_NEIGHBOR_FLAG_NONE IPNeighborFlags = 0 + IP_API_NEIGHBOR_FLAG_STATIC IPNeighborFlags = 1 + IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY IPNeighborFlags = 2 +) + +var IPNeighborFlags_name = map[uint32]string{ + 0: "IP_API_NEIGHBOR_FLAG_NONE", + 1: "IP_API_NEIGHBOR_FLAG_STATIC", + 2: "IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY", +} + +var IPNeighborFlags_value = map[string]uint32{ + "IP_API_NEIGHBOR_FLAG_NONE": 0, + "IP_API_NEIGHBOR_FLAG_STATIC": 1, + "IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY": 2, +} + +func (x IPNeighborFlags) String() string { + s, ok := IPNeighborFlags_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + /* Aliases */ // IP4Address represents VPP binary API alias 'ip4_address': @@ -182,18 +200,32 @@ func (*IP6Prefix) GetCrcString() string { // IP6RaPrefixInfo represents VPP binary API type 'ip6_ra_prefix_info': type IP6RaPrefixInfo struct { - DstAddress []byte `struc:"[16]byte"` - DstAddressLength uint8 - Flags uint8 - ValidTime uint32 - PreferredTime uint32 + Prefix Prefix + Flags uint8 + ValidTime uint32 + PreferredTime uint32 } func (*IP6RaPrefixInfo) GetTypeName() string { return "ip6_ra_prefix_info" } func (*IP6RaPrefixInfo) GetCrcString() string { - return "83d7c6e5" + return "fa025b72" +} + +// IPNeighbor represents VPP binary API type 'ip_neighbor': +type IPNeighbor struct { + SwIfIndex uint32 + Flags IPNeighborFlags + MacAddress MacAddress + IPAddress Address +} + +func (*IPNeighbor) GetTypeName() string { + return "ip_neighbor" +} +func (*IPNeighbor) GetCrcString() string { + return "4bf82d5d" } // MfibPath represents VPP binary API type 'mfib_path': @@ -239,16 +271,16 @@ func (*Prefix) GetCrcString() string { // ProxyArp represents VPP binary API type 'proxy_arp': type ProxyArp struct { - VrfID uint32 - LowAddress []byte `struc:"[4]byte"` - HiAddress []byte `struc:"[4]byte"` + TableID uint32 + Low IP4Address + Hi IP4Address } func (*ProxyArp) GetTypeName() string { return "proxy_arp" } func (*ProxyArp) GetCrcString() string { - return "6d88106e" + return "e9067693" } // PuntRedirect represents VPP binary API type 'punt_redirect': @@ -269,7 +301,7 @@ func (*PuntRedirect) GetCrcString() string { // AddressUnion represents VPP binary API union 'address_union': type AddressUnion struct { - Union_data [16]byte + XXX_UnionData [16]byte } func (*AddressUnion) GetTypeName() string { @@ -288,10 +320,10 @@ func (u *AddressUnion) SetIP4(a IP4Address) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.XXX_UnionData[:], b.Bytes()) } func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.XXX_UnionData[:]) struc.Unpack(b, &a) return } @@ -305,10 +337,10 @@ func (u *AddressUnion) SetIP6(a IP6Address) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.XXX_UnionData[:], b.Bytes()) } func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.XXX_UnionData[:]) struc.Unpack(b, &a) return } @@ -382,10 +414,10 @@ func (*IoamEnableReply) GetMessageType() api.MessageType { // IP4ArpEvent represents VPP binary API message 'ip4_arp_event': type IP4ArpEvent struct { - Address uint32 + IP IP4Address PID uint32 SwIfIndex uint32 - NewMac []byte `struc:"[6]byte"` + Mac MacAddress MacIP uint8 } @@ -393,7 +425,7 @@ func (*IP4ArpEvent) GetMessageName() string { return "ip4_arp_event" } func (*IP4ArpEvent) GetCrcString() string { - return "ef7235f7" + return "72cdde7c" } func (*IP4ArpEvent) GetMessageType() api.MessageType { return api.EventMessage @@ -470,8 +502,8 @@ func (*IP6MfibDump) GetMessageType() api.MessageType { type IP6NdEvent struct { PID uint32 SwIfIndex uint32 - Address []byte `struc:"[16]byte"` - NewMac []byte `struc:"[6]byte"` + IP IP6Address + Mac MacAddress MacIP uint8 } @@ -479,7 +511,7 @@ func (*IP6NdEvent) GetMessageName() string { return "ip6_nd_event" } func (*IP6NdEvent) GetCrcString() string { - return "96ab2fdd" + return "3a23e7d4" } func (*IP6NdEvent) GetMessageType() api.MessageType { return api.EventMessage @@ -489,7 +521,7 @@ func (*IP6NdEvent) GetMessageType() api.MessageType { type IP6RaEvent struct { PID uint32 SwIfIndex uint32 - RouterAddress []byte `struc:"[16]byte"` + RouterAddr IP6Address CurrentHopLimit uint8 Flags uint8 RouterLifetimeInSec uint16 @@ -503,7 +535,7 @@ func (*IP6RaEvent) GetMessageName() string { return "ip6_ra_event" } func (*IP6RaEvent) GetCrcString() string { - return "c5e54257" + return "2e718fcc" } func (*IP6RaEvent) GetMessageType() api.MessageType { return api.EventMessage @@ -513,14 +545,14 @@ func (*IP6RaEvent) GetMessageType() api.MessageType { type IP6ndProxyAddDel struct { SwIfIndex uint32 IsDel uint8 - Address []byte `struc:"[16]byte"` + IP IP6Address } func (*IP6ndProxyAddDel) GetMessageName() string { return "ip6nd_proxy_add_del" } func (*IP6ndProxyAddDel) GetCrcString() string { - return "d95f0fa0" + return "bff10d55" } func (*IP6ndProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage @@ -544,14 +576,14 @@ func (*IP6ndProxyAddDelReply) GetMessageType() api.MessageType { // IP6ndProxyDetails represents VPP binary API message 'ip6nd_proxy_details': type IP6ndProxyDetails struct { SwIfIndex uint32 - Address []byte `struc:"[16]byte"` + IP IP6Address } func (*IP6ndProxyDetails) GetMessageName() string { return "ip6nd_proxy_details" } func (*IP6ndProxyDetails) GetCrcString() string { - return "6a47c974" + return "bbbd7894" } func (*IP6ndProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage @@ -698,9 +730,7 @@ func (*IPAddressDump) GetMessageType() api.MessageType { // IPContainerProxyAddDel represents VPP binary API message 'ip_container_proxy_add_del': type IPContainerProxyAddDel struct { - IP []byte `struc:"[16]byte"` - IsIP4 uint8 - Plen uint8 + Pfx Prefix SwIfIndex uint32 IsAdd uint8 } @@ -709,7 +739,7 @@ func (*IPContainerProxyAddDel) GetMessageName() string { return "ip_container_proxy_add_del" } func (*IPContainerProxyAddDel) GetCrcString() string { - return "0a355d39" + return "5938e73a" } func (*IPContainerProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage @@ -906,20 +936,15 @@ func (*IPMrouteAddDelReply) GetMessageType() api.MessageType { // IPNeighborAddDel represents VPP binary API message 'ip_neighbor_add_del': type IPNeighborAddDel struct { - SwIfIndex uint32 - IsAdd uint8 - IsIPv6 uint8 - IsStatic uint8 - IsNoAdjFib uint8 - MacAddress []byte `struc:"[6]byte"` - DstAddress []byte `struc:"[16]byte"` + IsAdd uint8 + Neighbor IPNeighbor } func (*IPNeighborAddDel) GetMessageName() string { return "ip_neighbor_add_del" } func (*IPNeighborAddDel) GetCrcString() string { - return "4711eb25" + return "adea3ef4" } func (*IPNeighborAddDel) GetMessageType() api.MessageType { return api.RequestMessage @@ -943,19 +968,14 @@ func (*IPNeighborAddDelReply) GetMessageType() api.MessageType { // IPNeighborDetails represents VPP binary API message 'ip_neighbor_details': type IPNeighborDetails struct { - SwIfIndex uint32 - StatsIndex uint32 - IsStatic uint8 - IsIPv6 uint8 - MacAddress []byte `struc:"[6]byte"` - IPAddress []byte `struc:"[16]byte"` + Neighbor IPNeighbor } func (*IPNeighborDetails) GetMessageName() string { return "ip_neighbor_details" } func (*IPNeighborDetails) GetCrcString() string { - return "c7001770" + return "512fb08d" } func (*IPNeighborDetails) GetMessageType() api.MessageType { return api.ReplyMessage @@ -979,16 +999,15 @@ func (*IPNeighborDump) GetMessageType() api.MessageType { // IPProbeNeighbor represents VPP binary API message 'ip_probe_neighbor': type IPProbeNeighbor struct { - SwIfIndex uint32 - DstAddress []byte `struc:"[16]byte"` - IsIPv6 uint8 + SwIfIndex uint32 + Dst Address } func (*IPProbeNeighbor) GetMessageName() string { return "ip_probe_neighbor" } func (*IPProbeNeighbor) GetCrcString() string { - return "1e44bfd7" + return "1e6c0a77" } func (*IPProbeNeighbor) GetMessageType() api.MessageType { return api.RequestMessage @@ -1239,10 +1258,8 @@ func (*IPScanNeighborEnableDisableReply) GetMessageType() api.MessageType { // IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del': type IPSourceAndPortRangeCheckAddDel struct { - IsIPv6 uint8 IsAdd uint8 - MaskLength uint8 - Address []byte `struc:"[16]byte"` + Prefix Prefix NumberOfRanges uint8 LowPorts []uint16 `struc:"[32]uint16"` HighPorts []uint16 `struc:"[32]uint16"` @@ -1253,7 +1270,7 @@ func (*IPSourceAndPortRangeCheckAddDel) GetMessageName() string { return "ip_source_and_port_range_check_add_del" } func (*IPSourceAndPortRangeCheckAddDel) GetCrcString() string { - return "03d6b03a" + return "ea07c429" } func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType { return api.RequestMessage @@ -1733,24 +1750,23 @@ func (*SwInterfaceIP6ndRaConfigReply) GetMessageType() api.MessageType { // SwInterfaceIP6ndRaPrefix represents VPP binary API message 'sw_interface_ip6nd_ra_prefix': type SwInterfaceIP6ndRaPrefix struct { - SwIfIndex uint32 - Address []byte `struc:"[16]byte"` - AddressLength uint8 - UseDefault uint8 - NoAdvertise uint8 - OffLink uint8 - NoAutoconfig uint8 - NoOnlink uint8 - IsNo uint8 - ValLifetime uint32 - PrefLifetime uint32 + SwIfIndex uint32 + Prefix Prefix + UseDefault uint8 + NoAdvertise uint8 + OffLink uint8 + NoAutoconfig uint8 + NoOnlink uint8 + IsNo uint8 + ValLifetime uint32 + PrefLifetime uint32 } func (*SwInterfaceIP6ndRaPrefix) GetMessageName() string { return "sw_interface_ip6nd_ra_prefix" } func (*SwInterfaceIP6ndRaPrefix) GetCrcString() string { - return "ca763c9a" + return "59934d3b" } func (*SwInterfaceIP6ndRaPrefix) GetMessageType() api.MessageType { return api.RequestMessage @@ -1775,14 +1791,14 @@ func (*SwInterfaceIP6ndRaPrefixReply) GetMessageType() api.MessageType { type WantIP4ArpEvents struct { EnableDisable uint8 PID uint32 - Address uint32 + IP IP4Address } func (*WantIP4ArpEvents) GetMessageName() string { return "want_ip4_arp_events" } func (*WantIP4ArpEvents) GetCrcString() string { - return "77e06379" + return "70fd7195" } func (*WantIP4ArpEvents) GetMessageType() api.MessageType { return api.RequestMessage @@ -1807,14 +1823,14 @@ func (*WantIP4ArpEventsReply) GetMessageType() api.MessageType { type WantIP6NdEvents struct { EnableDisable uint8 PID uint32 - Address []byte `struc:"[16]byte"` + IP IP6Address } func (*WantIP6NdEvents) GetMessageName() string { return "want_ip6_nd_events" } func (*WantIP6NdEvents) GetCrcString() string { - return "1cf65fbb" + return "ba330719" } func (*WantIP6NdEvents) GetMessageType() api.MessageType { return api.RequestMessage @@ -1960,96 +1976,663 @@ func init() { api.RegisterMessage((*WantIP6RaEventsReply)(nil), "ip.WantIP6RaEventsReply") } -var Messages = []api.Message{ - (*IoamDisable)(nil), - (*IoamDisableReply)(nil), - (*IoamEnable)(nil), - (*IoamEnableReply)(nil), - (*IP4ArpEvent)(nil), - (*IP6FibDetails)(nil), - (*IP6FibDump)(nil), - (*IP6MfibDetails)(nil), - (*IP6MfibDump)(nil), - (*IP6NdEvent)(nil), - (*IP6RaEvent)(nil), - (*IP6ndProxyAddDel)(nil), - (*IP6ndProxyAddDelReply)(nil), - (*IP6ndProxyDetails)(nil), - (*IP6ndProxyDump)(nil), - (*IP6ndSendRouterSolicitation)(nil), - (*IP6ndSendRouterSolicitationReply)(nil), - (*IPAddDelRoute)(nil), - (*IPAddDelRouteReply)(nil), - (*IPAddressDetails)(nil), - (*IPAddressDump)(nil), - (*IPContainerProxyAddDel)(nil), - (*IPContainerProxyAddDelReply)(nil), - (*IPContainerProxyDetails)(nil), - (*IPContainerProxyDump)(nil), - (*IPDetails)(nil), - (*IPDump)(nil), - (*IPFibDetails)(nil), - (*IPFibDump)(nil), - (*IPMfibDetails)(nil), - (*IPMfibDump)(nil), - (*IPMrouteAddDel)(nil), - (*IPMrouteAddDelReply)(nil), - (*IPNeighborAddDel)(nil), - (*IPNeighborAddDelReply)(nil), - (*IPNeighborDetails)(nil), - (*IPNeighborDump)(nil), - (*IPProbeNeighbor)(nil), - (*IPProbeNeighborReply)(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), - (*IPScanNeighborEnableDisable)(nil), - (*IPScanNeighborEnableDisableReply)(nil), - (*IPSourceAndPortRangeCheckAddDel)(nil), - (*IPSourceAndPortRangeCheckAddDelReply)(nil), - (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), - (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), - (*IPSourceCheckInterfaceAddDel)(nil), - (*IPSourceCheckInterfaceAddDelReply)(nil), - (*IPTableAddDel)(nil), - (*IPTableAddDelReply)(nil), - (*IPUnnumberedDetails)(nil), - (*IPUnnumberedDump)(nil), - (*MfibSignalDetails)(nil), - (*MfibSignalDump)(nil), - (*ProxyArpAddDel)(nil), - (*ProxyArpAddDelReply)(nil), - (*ProxyArpDetails)(nil), - (*ProxyArpDump)(nil), - (*ProxyArpIntfcDetails)(nil), - (*ProxyArpIntfcDump)(nil), - (*ProxyArpIntfcEnableDisable)(nil), - (*ProxyArpIntfcEnableDisableReply)(nil), - (*ResetFib)(nil), - (*ResetFibReply)(nil), - (*SetArpNeighborLimit)(nil), - (*SetArpNeighborLimitReply)(nil), - (*SetIPFlowHash)(nil), - (*SetIPFlowHashReply)(nil), - (*SwInterfaceIP6EnableDisable)(nil), - (*SwInterfaceIP6EnableDisableReply)(nil), - (*SwInterfaceIP6ndRaConfig)(nil), - (*SwInterfaceIP6ndRaConfigReply)(nil), - (*SwInterfaceIP6ndRaPrefix)(nil), - (*SwInterfaceIP6ndRaPrefixReply)(nil), - (*WantIP4ArpEvents)(nil), - (*WantIP4ArpEventsReply)(nil), - (*WantIP6NdEvents)(nil), - (*WantIP6NdEventsReply)(nil), - (*WantIP6RaEvents)(nil), - (*WantIP6RaEventsReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IoamDisable)(nil), + (*IoamDisableReply)(nil), + (*IoamEnable)(nil), + (*IoamEnableReply)(nil), + (*IP4ArpEvent)(nil), + (*IP6FibDetails)(nil), + (*IP6FibDump)(nil), + (*IP6MfibDetails)(nil), + (*IP6MfibDump)(nil), + (*IP6NdEvent)(nil), + (*IP6RaEvent)(nil), + (*IP6ndProxyAddDel)(nil), + (*IP6ndProxyAddDelReply)(nil), + (*IP6ndProxyDetails)(nil), + (*IP6ndProxyDump)(nil), + (*IP6ndSendRouterSolicitation)(nil), + (*IP6ndSendRouterSolicitationReply)(nil), + (*IPAddDelRoute)(nil), + (*IPAddDelRouteReply)(nil), + (*IPAddressDetails)(nil), + (*IPAddressDump)(nil), + (*IPContainerProxyAddDel)(nil), + (*IPContainerProxyAddDelReply)(nil), + (*IPContainerProxyDetails)(nil), + (*IPContainerProxyDump)(nil), + (*IPDetails)(nil), + (*IPDump)(nil), + (*IPFibDetails)(nil), + (*IPFibDump)(nil), + (*IPMfibDetails)(nil), + (*IPMfibDump)(nil), + (*IPMrouteAddDel)(nil), + (*IPMrouteAddDelReply)(nil), + (*IPNeighborAddDel)(nil), + (*IPNeighborAddDelReply)(nil), + (*IPNeighborDetails)(nil), + (*IPNeighborDump)(nil), + (*IPProbeNeighbor)(nil), + (*IPProbeNeighborReply)(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), + (*IPScanNeighborEnableDisable)(nil), + (*IPScanNeighborEnableDisableReply)(nil), + (*IPSourceAndPortRangeCheckAddDel)(nil), + (*IPSourceAndPortRangeCheckAddDelReply)(nil), + (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), + (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), + (*IPSourceCheckInterfaceAddDel)(nil), + (*IPSourceCheckInterfaceAddDelReply)(nil), + (*IPTableAddDel)(nil), + (*IPTableAddDelReply)(nil), + (*IPUnnumberedDetails)(nil), + (*IPUnnumberedDump)(nil), + (*MfibSignalDetails)(nil), + (*MfibSignalDump)(nil), + (*ProxyArpAddDel)(nil), + (*ProxyArpAddDelReply)(nil), + (*ProxyArpDetails)(nil), + (*ProxyArpDump)(nil), + (*ProxyArpIntfcDetails)(nil), + (*ProxyArpIntfcDump)(nil), + (*ProxyArpIntfcEnableDisable)(nil), + (*ProxyArpIntfcEnableDisableReply)(nil), + (*ResetFib)(nil), + (*ResetFibReply)(nil), + (*SetArpNeighborLimit)(nil), + (*SetArpNeighborLimitReply)(nil), + (*SetIPFlowHash)(nil), + (*SetIPFlowHashReply)(nil), + (*SwInterfaceIP6EnableDisable)(nil), + (*SwInterfaceIP6EnableDisableReply)(nil), + (*SwInterfaceIP6ndRaConfig)(nil), + (*SwInterfaceIP6ndRaConfigReply)(nil), + (*SwInterfaceIP6ndRaPrefix)(nil), + (*SwInterfaceIP6ndRaPrefixReply)(nil), + (*WantIP4ArpEvents)(nil), + (*WantIP4ArpEventsReply)(nil), + (*WantIP6NdEvents)(nil), + (*WantIP6NdEventsReply)(nil), + (*WantIP6RaEvents)(nil), + (*WantIP6RaEventsReply)(nil), + } +} + +// Service represents services in VPP binary API. +type Service interface { + DumpIP6Fib(ctx context.Context, in *IP6FibDump) ([]*IP6FibDetails, error) + DumpIP6Mfib(ctx context.Context, in *IP6MfibDump) ([]*IP6MfibDetails, error) + DumpIP6ndProxy(ctx context.Context, in *IP6ndProxyDump) ([]*IP6ndProxyDetails, error) + DumpIPAddress(ctx context.Context, in *IPAddressDump) ([]*IPAddressDetails, error) + DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) ([]*IPContainerProxyDetails, error) + DumpIP(ctx context.Context, in *IPDump) ([]*IPDetails, error) + DumpIPFib(ctx context.Context, in *IPFibDump) ([]*IPFibDetails, error) + DumpIPMfib(ctx context.Context, in *IPMfibDump) ([]*IPMfibDetails, error) + DumpIPNeighbor(ctx context.Context, in *IPNeighborDump) ([]*IPNeighborDetails, error) + DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) ([]*IPPuntRedirectDetails, error) + DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) ([]*IPUnnumberedDetails, error) + DumpMfibSignal(ctx context.Context, in *MfibSignalDump) ([]*MfibSignalDetails, error) + DumpProxyArp(ctx context.Context, in *ProxyArpDump) ([]*ProxyArpDetails, error) + DumpProxyArpIntfc(ctx context.Context, in *ProxyArpIntfcDump) ([]*ProxyArpIntfcDetails, error) + IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) + IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) + IP6ndProxyAddDel(ctx context.Context, in *IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) + IP6ndSendRouterSolicitation(ctx context.Context, in *IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) + IPAddDelRoute(ctx context.Context, in *IPAddDelRoute) (*IPAddDelRouteReply, error) + IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) + IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) + IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) + IPProbeNeighbor(ctx context.Context, in *IPProbeNeighbor) (*IPProbeNeighborReply, 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) + IPScanNeighborEnableDisable(ctx context.Context, in *IPScanNeighborEnableDisable) (*IPScanNeighborEnableDisableReply, 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) + ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) + ProxyArpIntfcEnableDisable(ctx context.Context, in *ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) + ResetFib(ctx context.Context, in *ResetFib) (*ResetFibReply, error) + SetArpNeighborLimit(ctx context.Context, in *SetArpNeighborLimit) (*SetArpNeighborLimitReply, error) + SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) + SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) + SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) + SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) + WantIP4ArpEvents(ctx context.Context, in *WantIP4ArpEvents) (*WantIP4ArpEventsReply, error) + WantIP6NdEvents(ctx context.Context, in *WantIP6NdEvents) (*WantIP6NdEventsReply, error) + WantIP6RaEvents(ctx context.Context, in *WantIP6RaEvents) (*WantIP6RaEventsReply, error) +} + +type service struct { + ch api.Channel +} + +func NewService(ch api.Channel) Service { + return &service{ch} +} + +func (c *service) DumpIP6Fib(ctx context.Context, in *IP6FibDump) ([]*IP6FibDetails, error) { + var dump []*IP6FibDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(IP6FibDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpIP6Mfib(ctx context.Context, in *IP6MfibDump) ([]*IP6MfibDetails, error) { + var dump []*IP6MfibDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(IP6MfibDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpIP6ndProxy(ctx context.Context, in *IP6ndProxyDump) ([]*IP6ndProxyDetails, error) { + var dump []*IP6ndProxyDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(IP6ndProxyDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpIPAddress(ctx context.Context, in *IPAddressDump) ([]*IPAddressDetails, error) { + var dump []*IPAddressDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(IPAddressDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) ([]*IPContainerProxyDetails, error) { + var dump []*IPContainerProxyDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(IPContainerProxyDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpIP(ctx context.Context, in *IPDump) ([]*IPDetails, error) { + var dump []*IPDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(IPDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpIPFib(ctx context.Context, in *IPFibDump) ([]*IPFibDetails, error) { + var dump []*IPFibDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(IPFibDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpIPMfib(ctx context.Context, in *IPMfibDump) ([]*IPMfibDetails, error) { + var dump []*IPMfibDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(IPMfibDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpIPNeighbor(ctx context.Context, in *IPNeighborDump) ([]*IPNeighborDetails, error) { + var dump []*IPNeighborDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(IPNeighborDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) ([]*IPPuntRedirectDetails, error) { + var dump []*IPPuntRedirectDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(IPPuntRedirectDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) ([]*IPUnnumberedDetails, error) { + var dump []*IPUnnumberedDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(IPUnnumberedDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpMfibSignal(ctx context.Context, in *MfibSignalDump) ([]*MfibSignalDetails, error) { + var dump []*MfibSignalDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(MfibSignalDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpProxyArp(ctx context.Context, in *ProxyArpDump) ([]*ProxyArpDetails, error) { + var dump []*ProxyArpDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(ProxyArpDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpProxyArpIntfc(ctx context.Context, in *ProxyArpIntfcDump) ([]*ProxyArpIntfcDetails, error) { + var dump []*ProxyArpIntfcDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(ProxyArpIntfcDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) 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 *service) 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 *service) IP6ndProxyAddDel(ctx context.Context, in *IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) { + out := new(IP6ndProxyAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *service) IP6ndSendRouterSolicitation(ctx context.Context, in *IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) { + out := new(IP6ndSendRouterSolicitationReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *service) IPAddDelRoute(ctx context.Context, in *IPAddDelRoute) (*IPAddDelRouteReply, error) { + out := new(IPAddDelRouteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *service) 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 *service) 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 *service) IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) { + out := new(IPNeighborAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *service) IPProbeNeighbor(ctx context.Context, in *IPProbeNeighbor) (*IPProbeNeighborReply, error) { + out := new(IPProbeNeighborReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) IPScanNeighborEnableDisable(ctx context.Context, in *IPScanNeighborEnableDisable) (*IPScanNeighborEnableDisableReply, error) { + out := new(IPScanNeighborEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *service) 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 *service) 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 *service) 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 *service) 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 *service) ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) { + out := new(ProxyArpAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *service) ProxyArpIntfcEnableDisable(ctx context.Context, in *ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) { + out := new(ProxyArpIntfcEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *service) ResetFib(ctx context.Context, in *ResetFib) (*ResetFibReply, error) { + out := new(ResetFibReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *service) SetArpNeighborLimit(ctx context.Context, in *SetArpNeighborLimit) (*SetArpNeighborLimitReply, error) { + out := new(SetArpNeighborLimitReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *service) 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 *service) 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 *service) SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) { + out := new(SwInterfaceIP6ndRaConfigReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *service) SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) { + out := new(SwInterfaceIP6ndRaPrefixReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *service) WantIP4ArpEvents(ctx context.Context, in *WantIP4ArpEvents) (*WantIP4ArpEventsReply, error) { + out := new(WantIP4ArpEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *service) WantIP6NdEvents(ctx context.Context, in *WantIP6NdEvents) (*WantIP6NdEventsReply, error) { + out := new(WantIP6NdEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *service) WantIP6RaEvents(ctx context.Context, in *WantIP6RaEvents) (*WantIP6RaEventsReply, error) { + out := new(WantIP6RaEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } diff --git a/examples/bin_api/memclnt/memclnt.ba.go b/examples/binapi/memclnt/memclnt.ba.go similarity index 67% rename from examples/bin_api/memclnt/memclnt.ba.go rename to examples/binapi/memclnt/memclnt.ba.go index 68ff320..e7395c7 100644 --- a/examples/bin_api/memclnt/memclnt.ba.go +++ b/examples/binapi/memclnt/memclnt.ba.go @@ -1,41 +1,43 @@ // Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: memclnt.api.json +// source: /usr/share/vpp/api/core/memclnt.api.json /* - Package memclnt is a generated from VPP binary API module 'memclnt'. +Package memclnt is a generated from VPP binary API module 'memclnt'. - It contains following objects: - 13 services + The memclnt module consists of: 2 types 22 messages + 13 services */ package memclnt import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" import bytes "bytes" +import context "context" +import strconv "strconv" +import struc "github.com/lunixbochs/struc" // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage -var _ = struc.Pack var _ = bytes.NewBuffer +var _ = context.Background +var _ = strconv.Itoa +var _ = struc.Pack -// Services represents VPP binary API services: -type Services interface { - APIVersions(*APIVersions) (*APIVersionsReply, error) - GetFirstMsgID(*GetFirstMsgID) (*GetFirstMsgIDReply, error) - MemclntCreate(*MemclntCreate) (*MemclntCreateReply, error) - MemclntDelete(*MemclntDelete) (*MemclntDeleteReply, error) - MemclntKeepalive(*MemclntKeepalive) (*MemclntKeepaliveReply, error) - MemclntReadTimeout(*MemclntReadTimeout) error - MemclntRxThreadSuspend(*MemclntRxThreadSuspend) error - RPCCall(*RPCCall) (*RPCCallReply, error) - RxThreadExit(*RxThreadExit) error - SockInitShm(*SockInitShm) (*SockInitShmReply, error) - SockclntCreate(*SockclntCreate) (*SockclntCreateReply, error) - SockclntDelete(*SockclntDelete) (*SockclntDeleteReply, error) - TracePluginMsgIds(*TracePluginMsgIds) error -} +// 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.GoVppAPIPackageIsVersion1 // 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 = 0xb619530 +) /* Types */ @@ -444,27 +446,156 @@ func init() { api.RegisterMessage((*TracePluginMsgIds)(nil), "memclnt.TracePluginMsgIds") } -var Messages = []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), +// 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), + } +} + +// Service represents services in VPP binary API. +type Service 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 service struct { + ch api.Channel +} + +func NewService(ch api.Channel) Service { + return &service{ch} +} + +func (c *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error { + c.ch.SendRequest(in) + return nil +} + +func (c *service) MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error { + c.ch.SendRequest(in) + return nil +} + +func (c *service) 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 *service) RxThreadExit(ctx context.Context, in *RxThreadExit) error { + c.ch.SendRequest(in) + return nil +} + +func (c *service) 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 *service) 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 *service) 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 *service) TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error { + c.ch.SendRequest(in) + return nil } diff --git a/examples/bin_api/memif/memif.ba.go b/examples/binapi/memif/memif.ba.go similarity index 62% rename from examples/bin_api/memif/memif.ba.go rename to examples/binapi/memif/memif.ba.go index 58c466e..1ac0b0a 100644 --- a/examples/bin_api/memif/memif.ba.go +++ b/examples/binapi/memif/memif.ba.go @@ -1,32 +1,42 @@ // Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: memif.api.json +// source: /usr/share/vpp/api/plugins/memif.api.json /* - Package memif is a generated from VPP binary API module 'memif'. +Package memif is a generated from VPP binary API module 'memif'. - It contains following objects: - 5 services + The memif module consists of: 10 messages + 5 services */ package memif import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" import bytes "bytes" +import context "context" +import strconv "strconv" +import struc "github.com/lunixbochs/struc" // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage -var _ = struc.Pack var _ = bytes.NewBuffer +var _ = context.Background +var _ = strconv.Itoa +var _ = struc.Pack -// Services represents VPP binary API services: -type Services interface { - DumpMemif(*MemifDump) ([]*MemifDetails, error) - DumpMemifSocketFilename(*MemifSocketFilenameDump) ([]*MemifSocketFilenameDetails, error) - MemifCreate(*MemifCreate) (*MemifCreateReply, error) - MemifDelete(*MemifDelete) (*MemifDeleteReply, error) - MemifSocketFilenameAddDel(*MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) -} +// 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.GoVppAPIPackageIsVersion1 // 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 = "2.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x31b42e17 +) /* Messages */ @@ -212,15 +222,96 @@ func init() { api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump") } -var Messages = []api.Message{ - (*MemifCreate)(nil), - (*MemifCreateReply)(nil), - (*MemifDelete)(nil), - (*MemifDeleteReply)(nil), - (*MemifDetails)(nil), - (*MemifDump)(nil), - (*MemifSocketFilenameAddDel)(nil), - (*MemifSocketFilenameAddDelReply)(nil), - (*MemifSocketFilenameDetails)(nil), - (*MemifSocketFilenameDump)(nil), +// 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), + } +} + +// Service represents services in VPP binary API. +type Service interface { + DumpMemif(ctx context.Context, in *MemifDump) ([]*MemifDetails, error) + DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) ([]*MemifSocketFilenameDetails, 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 service struct { + ch api.Channel +} + +func NewService(ch api.Channel) Service { + return &service{ch} +} + +func (c *service) DumpMemif(ctx context.Context, in *MemifDump) ([]*MemifDetails, error) { + var dump []*MemifDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(MemifDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) ([]*MemifSocketFilenameDetails, error) { + var dump []*MemifSocketFilenameDetails + req := c.ch.SendMultiRequest(in) + for { + m := new(MemifSocketFilenameDetails) + stop, err := req.ReceiveReply(m) + if stop { + break + } + if err != nil { + return nil, err + } + dump = append(dump, m) + } + return dump, nil +} + +func (c *service) 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 *service) 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 *service) 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 } diff --git a/examples/bin_api/vpe/vpe.ba.go b/examples/binapi/vpe/vpe.ba.go similarity index 67% rename from examples/bin_api/vpe/vpe.ba.go rename to examples/binapi/vpe/vpe.ba.go index 486f1a0..25707fc 100644 --- a/examples/bin_api/vpe/vpe.ba.go +++ b/examples/binapi/vpe/vpe.ba.go @@ -1,37 +1,43 @@ // Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: vpe.api.json +// source: /usr/share/vpp/api/core/vpe.api.json /* - Package vpe is a generated from VPP binary API module 'vpe'. +Package vpe is a generated from VPP binary API module 'vpe'. - It contains following objects: - 9 services + The vpe module consists of: 1 type 18 messages + 9 services */ package vpe import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" import bytes "bytes" +import context "context" +import strconv "strconv" +import struc "github.com/lunixbochs/struc" // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage -var _ = struc.Pack var _ = bytes.NewBuffer +var _ = context.Background +var _ = strconv.Itoa +var _ = struc.Pack -// Services represents VPP binary API services: -type Services interface { - AddNodeNext(*AddNodeNext) (*AddNodeNextReply, error) - Cli(*Cli) (*CliReply, error) - CliInband(*CliInband) (*CliInbandReply, error) - ControlPing(*ControlPing) (*ControlPingReply, error) - GetNextIndex(*GetNextIndex) (*GetNextIndexReply, error) - GetNodeGraph(*GetNodeGraph) (*GetNodeGraphReply, error) - GetNodeIndex(*GetNodeIndex) (*GetNodeIndexReply, error) - ShowThreads(*ShowThreads) (*ShowThreadsReply, error) - ShowVersion(*ShowVersion) (*ShowVersionReply, error) -} +// 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.GoVppAPIPackageIsVersion1 // 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.1.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x2cc8d629 +) /* Types */ @@ -360,23 +366,128 @@ func init() { api.RegisterMessage((*ShowVersionReply)(nil), "vpe.ShowVersionReply") } -var Messages = []api.Message{ - (*AddNodeNext)(nil), - (*AddNodeNextReply)(nil), - (*Cli)(nil), - (*CliInband)(nil), - (*CliInbandReply)(nil), - (*CliReply)(nil), - (*ControlPing)(nil), - (*ControlPingReply)(nil), - (*GetNextIndex)(nil), - (*GetNextIndexReply)(nil), - (*GetNodeGraph)(nil), - (*GetNodeGraphReply)(nil), - (*GetNodeIndex)(nil), - (*GetNodeIndexReply)(nil), - (*ShowThreads)(nil), - (*ShowThreadsReply)(nil), - (*ShowVersion)(nil), - (*ShowVersionReply)(nil), +// 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), + (*GetNextIndex)(nil), + (*GetNextIndexReply)(nil), + (*GetNodeGraph)(nil), + (*GetNodeGraphReply)(nil), + (*GetNodeIndex)(nil), + (*GetNodeIndexReply)(nil), + (*ShowThreads)(nil), + (*ShowThreadsReply)(nil), + (*ShowVersion)(nil), + (*ShowVersionReply)(nil), + } +} + +// Service represents services in VPP binary API. +type Service interface { + 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) + 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) +} + +type service struct { + ch api.Channel +} + +func NewService(ch api.Channel) Service { + return &service{ch} +} + +func (c *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 *service) 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 } diff --git a/examples/perf-bench/perf-bench.go b/examples/perf-bench/perf-bench.go index e5b0926..b246e6c 100644 --- a/examples/perf-bench/perf-bench.go +++ b/examples/perf-bench/perf-bench.go @@ -30,7 +30,7 @@ import ( "git.fd.io/govpp.git/adapter/vppapiclient" "git.fd.io/govpp.git/api" "git.fd.io/govpp.git/core" - "git.fd.io/govpp.git/examples/bin_api/vpe" + "git.fd.io/govpp.git/examples/binapi/vpe" ) const ( diff --git a/examples/service-client/service_client.go b/examples/service-client/service_client.go new file mode 100644 index 0000000..9aa07db --- /dev/null +++ b/examples/service-client/service_client.go @@ -0,0 +1,77 @@ +// Copyright (c) 2017 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. + +// service-client is an example VPP management application that exercises the +// govpp API using generated service client. +package main + +import ( + "bytes" + "context" + "fmt" + "log" + + "git.fd.io/govpp.git" + "git.fd.io/govpp.git/api" + "git.fd.io/govpp.git/examples/binapi/interfaces" + "git.fd.io/govpp.git/examples/binapi/vpe" +) + +func main() { + fmt.Println("Starting VPP service client...") + + // connect to VPP + conn, err := govpp.Connect("") + if err != nil { + log.Fatalln("failed to connect:", err) + } + defer conn.Disconnect() + + // create an API channel + ch, err := conn.NewAPIChannel() + if err != nil { + log.Fatalln("failed to create channel:", err) + } + defer ch.Close() + + showVersion(ch) + interfaceDump(ch) +} + +// showVersion shows an example of simple request with services. +func showVersion(ch api.Channel) { + c := vpe.NewService(ch) + + version, err := c.ShowVersion(context.Background(), &vpe.ShowVersion{}) + if err != nil { + log.Fatalln("ShowVersion failed:", err) + } + + fmt.Printf("Version: %v\n", version.Version) +} + +// interfaceDump shows an example of multi request with services. +func interfaceDump(ch api.Channel) { + c := interfaces.NewService(ch) + + ifaces, err := c.DumpSwInterface(context.Background(), &interfaces.SwInterfaceDump{}) + if err != nil { + log.Fatalln("DumpSwInterface failed:", err) + } + + fmt.Printf("Listing %d interfaces:\n", len(ifaces)) + for _, d := range ifaces { + fmt.Printf("- interface: %s\n", bytes.Trim(d.InterfaceName, "\x00")) + } +} diff --git a/examples/simple-client/simple_client.go b/examples/simple-client/simple_client.go index a494e81..f3ee412 100644 --- a/examples/simple-client/simple_client.go +++ b/examples/simple-client/simple_client.go @@ -26,9 +26,9 @@ import ( "git.fd.io/govpp.git" "git.fd.io/govpp.git/api" "git.fd.io/govpp.git/core" - "git.fd.io/govpp.git/examples/bin_api/acl" - "git.fd.io/govpp.git/examples/bin_api/interfaces" - "git.fd.io/govpp.git/examples/bin_api/ip" + "git.fd.io/govpp.git/examples/binapi/acl" + "git.fd.io/govpp.git/examples/binapi/interfaces" + "git.fd.io/govpp.git/examples/binapi/ip" ) func main() { diff --git a/examples/union-example/union_example.go b/examples/union-example/union_example.go index d4563c6..22fb362 100644 --- a/examples/union-example/union_example.go +++ b/examples/union-example/union_example.go @@ -21,7 +21,7 @@ import ( "log" "net" - "git.fd.io/govpp.git/examples/bin_api/ip" + "git.fd.io/govpp.git/examples/binapi/ip" "github.com/lunixbochs/struc" ) -- 2.16.6