aboutsummaryrefslogtreecommitdiffstats
path: root/binapi/ip_types/ip_types.ba.go
diff options
context:
space:
mode:
Diffstat (limited to 'binapi/ip_types/ip_types.ba.go')
-rw-r--r--binapi/ip_types/ip_types.ba.go103
1 files changed, 94 insertions, 9 deletions
diff --git a/binapi/ip_types/ip_types.ba.go b/binapi/ip_types/ip_types.ba.go
index 9cb2e13..fb36a4a 100644
--- a/binapi/ip_types/ip_types.ba.go
+++ b/binapi/ip_types/ip_types.ba.go
@@ -1,26 +1,27 @@
// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
// versions:
-// binapi-generator: v0.4.0-dev
-// VPP: 20.05-release
+// binapi-generator: v0.6.0-dev
+// VPP: 22.02-release
// source: /usr/share/vpp/api/core/ip_types.api.json
// Package ip_types contains generated bindings for API file ip_types.api.
//
// Contents:
// 5 aliases
-// 4 enums
-// 6 structs
+// 5 enums
+// 8 structs
// 1 union
//
package ip_types
import (
"fmt"
- api "git.fd.io/govpp.git/api"
- codec "git.fd.io/govpp.git/codec"
"net"
"strconv"
"strings"
+
+ api "go.fd.io/govpp/api"
+ codec "go.fd.io/govpp/codec"
)
// This is a compile-time assertion to ensure that this generated file
@@ -29,6 +30,12 @@ import (
// GoVPP api package needs to be updated.
const _ = api.GoVppAPIPackageIsVersion2
+const (
+ APIFile = "ip_types"
+ APIVersion = "3.0.0"
+ VersionCrc = 0xfee023ed
+)
+
// AddressFamily defines enum 'address_family'.
type AddressFamily uint8
@@ -173,6 +180,42 @@ func (x IPEcn) String() string {
return "IPEcn(" + strconv.Itoa(int(x)) + ")"
}
+// IPFeatureLocation defines enum 'ip_feature_location'.
+type IPFeatureLocation uint8
+
+const (
+ IP_API_FEATURE_INPUT IPFeatureLocation = 0
+ IP_API_FEATURE_OUTPUT IPFeatureLocation = 1
+ IP_API_FEATURE_LOCAL IPFeatureLocation = 2
+ IP_API_FEATURE_PUNT IPFeatureLocation = 3
+ IP_API_FEATURE_DROP IPFeatureLocation = 4
+)
+
+var (
+ IPFeatureLocation_name = map[uint8]string{
+ 0: "IP_API_FEATURE_INPUT",
+ 1: "IP_API_FEATURE_OUTPUT",
+ 2: "IP_API_FEATURE_LOCAL",
+ 3: "IP_API_FEATURE_PUNT",
+ 4: "IP_API_FEATURE_DROP",
+ }
+ IPFeatureLocation_value = map[string]uint8{
+ "IP_API_FEATURE_INPUT": 0,
+ "IP_API_FEATURE_OUTPUT": 1,
+ "IP_API_FEATURE_LOCAL": 2,
+ "IP_API_FEATURE_PUNT": 3,
+ "IP_API_FEATURE_DROP": 4,
+ }
+)
+
+func (x IPFeatureLocation) String() string {
+ s, ok := IPFeatureLocation_name[uint8(x)]
+ if ok {
+ return s
+ }
+ return "IPFeatureLocation(" + strconv.Itoa(int(x)) + ")"
+}
+
// IPProto defines enum 'ip_proto'.
type IPProto uint8
@@ -243,12 +286,15 @@ func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
}
return AddressWithPrefix(prefix), nil
}
+
func (x AddressWithPrefix) String() string {
return Prefix(x).String()
}
+
func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
return []byte(x.String()), nil
}
+
func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
prefix, err := ParseAddressWithPrefix(string(text))
if err != nil {
@@ -274,12 +320,15 @@ func ParseIP4Address(s string) (IP4Address, error) {
func (x IP4Address) ToIP() net.IP {
return net.IP(x[:]).To4()
}
+
func (x IP4Address) String() string {
return x.ToIP().String()
}
+
func (x *IP4Address) MarshalText() ([]byte, error) {
return []byte(x.String()), nil
}
+
func (x *IP4Address) UnmarshalText(text []byte) error {
ipaddr, err := ParseIP4Address(string(text))
if err != nil {
@@ -308,12 +357,15 @@ func ParseIP6Address(s string) (IP6Address, error) {
func (x IP6Address) ToIP() net.IP {
return net.IP(x[:]).To16()
}
+
func (x IP6Address) String() string {
return x.ToIP().String()
}
+
func (x *IP6Address) MarshalText() ([]byte, error) {
return []byte(x.String()), nil
}
+
func (x *IP6Address) UnmarshalText(text []byte) error {
ipaddr, err := ParseIP6Address(string(text))
if err != nil {
@@ -337,6 +389,10 @@ func ParseAddress(s string) (Address, error) {
if ip == nil {
return Address{}, fmt.Errorf("invalid address: %s", s)
}
+ return AddressFromIP(ip), nil
+}
+
+func AddressFromIP(ip net.IP) Address {
var addr Address
if ip.To4() == nil {
addr.Af = ADDRESS_IP6
@@ -349,8 +405,9 @@ func ParseAddress(s string) (Address, error) {
copy(ip4[:], ip.To4())
addr.Un.SetIP4(ip4)
}
- return addr, nil
+ return addr
}
+
func (x Address) ToIP() net.IP {
if x.Af == ADDRESS_IP6 {
ip6 := x.Un.GetIP6()
@@ -360,12 +417,15 @@ func (x Address) ToIP() net.IP {
return net.IP(ip4[:]).To4()
}
}
+
func (x Address) String() string {
return x.ToIP().String()
}
+
func (x *Address) MarshalText() ([]byte, error) {
return []byte(x.String()), nil
}
+
func (x *Address) UnmarshalText(text []byte) error {
addr, err := ParseAddress(string(text))
if err != nil {
@@ -375,6 +435,12 @@ func (x *Address) UnmarshalText(text []byte) error {
return nil
}
+// IP4AddressAndMask defines type 'ip4_address_and_mask'.
+type IP4AddressAndMask struct {
+ Addr IP4Address `binapi:"ip4_address,name=addr" json:"addr,omitempty"`
+ Mask IP4Address `binapi:"ip4_address,name=mask" json:"mask,omitempty"`
+}
+
// IP4Prefix defines type 'ip4_prefix'.
type IP4Prefix struct {
Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
@@ -408,18 +474,22 @@ func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
}
return prefix, nil
}
+
func (x IP4Prefix) ToIPNet() *net.IPNet {
mask := net.CIDRMask(int(x.Len), 32)
ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
return ipnet
}
+
func (x IP4Prefix) String() string {
ip := x.Address.String()
return ip + "/" + strconv.Itoa(int(x.Len))
}
+
func (x *IP4Prefix) MarshalText() ([]byte, error) {
return []byte(x.String()), nil
}
+
func (x *IP4Prefix) UnmarshalText(text []byte) error {
prefix, err := ParseIP4Prefix(string(text))
if err != nil {
@@ -429,6 +499,12 @@ func (x *IP4Prefix) UnmarshalText(text []byte) error {
return nil
}
+// IP6AddressAndMask defines type 'ip6_address_and_mask'.
+type IP6AddressAndMask struct {
+ Addr IP6Address `binapi:"ip6_address,name=addr" json:"addr,omitempty"`
+ Mask IP6Address `binapi:"ip6_address,name=mask" json:"mask,omitempty"`
+}
+
// IP6Prefix defines type 'ip6_prefix'.
type IP6Prefix struct {
Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
@@ -462,18 +538,22 @@ func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
}
return prefix, nil
}
+
func (x IP6Prefix) ToIPNet() *net.IPNet {
mask := net.CIDRMask(int(x.Len), 128)
ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
return ipnet
}
+
func (x IP6Prefix) String() string {
ip := x.Address.String()
return ip + "/" + strconv.Itoa(int(x.Len))
}
+
func (x *IP6Prefix) MarshalText() ([]byte, error) {
return []byte(x.String()), nil
}
+
func (x *IP6Prefix) UnmarshalText(text []byte) error {
prefix, err := ParseIP6Prefix(string(text))
if err != nil {
@@ -524,6 +604,7 @@ func ParsePrefix(ip string) (prefix Prefix, err error) {
}
return prefix, nil
}
+
func (x Prefix) ToIPNet() *net.IPNet {
var mask net.IPMask
if x.Address.Af == ADDRESS_IP4 {
@@ -534,13 +615,16 @@ func (x Prefix) ToIPNet() *net.IPNet {
ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
return ipnet
}
+
func (x Prefix) String() string {
ip := x.Address.String()
return ip + "/" + strconv.Itoa(int(x.Len))
}
+
func (x *Prefix) MarshalText() ([]byte, error) {
return []byte(x.String()), nil
}
+
func (x *Prefix) UnmarshalText(text []byte) error {
prefix, err := ParsePrefix(string(text))
if err != nil {
@@ -558,8 +642,9 @@ type PrefixMatcher struct {
// AddressUnion defines union 'address_union'.
type AddressUnion struct {
- // IP4 *IP4Address
- // IP6 *IP6Address
+ // AddressUnion can be one of:
+ // - IP4 *IP4Address
+ // - IP6 *IP6Address
XXX_UnionData [16]byte
}