Improve binapi generator
[govpp.git] / binapi / interface_types / interface_types.ba.go
@@ -4,47 +4,26 @@
 //  VPP:              20.05-release
 // source: /usr/share/vpp/api/core/interface_types.api.json
 
-/*
-Package interface_types contains generated code for VPP API file interface_types.api ().
-
-It consists of:
-         1 alias
-         6 enums
-*/
+// Package interface_types contains generated bindings for API file interface_types.api.
+//
+// Contents:
+//   1 alias
+//   6 enums
+//
 package interface_types
 
 import (
-       "bytes"
-       "context"
-       "encoding/binary"
-       "fmt"
-       "io"
-       "math"
-       "net"
-       "strconv"
-       "strings"
-
        api "git.fd.io/govpp.git/api"
-       codec "git.fd.io/govpp.git/codec"
-       struc "github.com/lunixbochs/struc"
+       "strconv"
 )
 
 // This is a compile-time assertion to ensure that this generated file
 // is compatible with the GoVPP api package it is being compiled against.
 // A compilation error at this line likely means your copy of the
 // GoVPP api package needs to be updated.
-const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package
-
-const (
-       // ModuleName is the name of this module.
-       ModuleName = "interface_types"
-       // APIVersion is the API version of this module.
-       APIVersion = ""
-       // VersionCrc is the CRC of this module.
-       VersionCrc = 0x23822dac
-)
+const _ = api.GoVppAPIPackageIsVersion2
 
-// IfStatusFlags represents VPP binary API enum 'if_status_flags'.
+// IfStatusFlags defines enum 'if_status_flags'.
 type IfStatusFlags uint32
 
 const (
@@ -68,10 +47,29 @@ func (x IfStatusFlags) String() string {
        if ok {
                return s
        }
-       return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")"
+       str := func(n uint32) string {
+               s, ok := IfStatusFlags_name[uint32(n)]
+               if ok {
+                       return s
+               }
+               return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
+       }
+       for i := uint32(0); i <= 32; i++ {
+               val := uint32(x)
+               if val&(1<<i) != 0 {
+                       if s != "" {
+                               s += "|"
+                       }
+                       s += str(1 << i)
+               }
+       }
+       if s == "" {
+               return str(uint32(x))
+       }
+       return s
 }
 
-// IfType represents VPP binary API enum 'if_type'.
+// IfType defines enum 'if_type'.
 type IfType uint32
 
 const (
@@ -104,7 +102,7 @@ func (x IfType) String() string {
        return "IfType(" + strconv.Itoa(int(x)) + ")"
 }
 
-// LinkDuplex represents VPP binary API enum 'link_duplex'.
+// LinkDuplex defines enum 'link_duplex'.
 type LinkDuplex uint32
 
 const (
@@ -134,7 +132,7 @@ func (x LinkDuplex) String() string {
        return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
 }
 
-// MtuProto represents VPP binary API enum 'mtu_proto'.
+// MtuProto defines enum 'mtu_proto'.
 type MtuProto uint32
 
 const (
@@ -167,7 +165,7 @@ func (x MtuProto) String() string {
        return "MtuProto(" + strconv.Itoa(int(x)) + ")"
 }
 
-// RxMode represents VPP binary API enum 'rx_mode'.
+// RxMode defines enum 'rx_mode'.
 type RxMode uint32
 
 const (
@@ -203,7 +201,7 @@ func (x RxMode) String() string {
        return "RxMode(" + strconv.Itoa(int(x)) + ")"
 }
 
-// SubIfFlags represents VPP binary API enum 'sub_if_flags'.
+// SubIfFlags defines enum 'sub_if_flags'.
 type SubIfFlags uint32
 
 const (
@@ -251,22 +249,27 @@ func (x SubIfFlags) String() string {
        if ok {
                return s
        }
-       return "SubIfFlags(" + strconv.Itoa(int(x)) + ")"
+       str := func(n uint32) string {
+               s, ok := SubIfFlags_name[uint32(n)]
+               if ok {
+                       return s
+               }
+               return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
+       }
+       for i := uint32(0); i <= 32; i++ {
+               val := uint32(x)
+               if val&(1<<i) != 0 {
+                       if s != "" {
+                               s += "|"
+                       }
+                       s += str(1 << i)
+               }
+       }
+       if s == "" {
+               return str(uint32(x))
+       }
+       return s
 }
 
-// InterfaceIndex represents VPP binary API alias 'interface_index'.
+// InterfaceIndex defines alias 'interface_index'.
 type InterfaceIndex uint32
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = api.RegisterMessage
-var _ = codec.DecodeString
-var _ = bytes.NewBuffer
-var _ = context.Background
-var _ = io.Copy
-var _ = strconv.Itoa
-var _ = strings.Contains
-var _ = struc.Pack
-var _ = binary.BigEndian
-var _ = math.Float32bits
-var _ = net.ParseIP
-var _ = fmt.Errorf