aboutsummaryrefslogtreecommitdiffstats
path: root/binapi/lisp_types/lisp_types.ba.go
blob: 6bae4b7102ecde0dc51a954d2468b5eef1de85d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
// versions:
//  binapi-generator: v0.4.0-dev
//  VPP:              20.05-release
// source: /usr/share/vpp/api/core/lisp_types.api.json

// Package lisp_types contains generated bindings for API file lisp_types.api.
//
// Contents:
//   2 enums
//   5 structs
//   1 union
//
package lisp_types

import (
	api "git.fd.io/govpp.git/api"
	ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types"
	interface_types "git.fd.io/govpp.git/binapi/interface_types"
	ip_types "git.fd.io/govpp.git/binapi/ip_types"
	codec "git.fd.io/govpp.git/codec"
	"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

// EidType defines enum 'eid_type'.
type EidType uint8

const (
	EID_TYPE_API_PREFIX EidType = 0
	EID_TYPE_API_MAC    EidType = 1
	EID_TYPE_API_NSH    EidType = 2
)

var (
	EidType_name = map[uint8]string{
		0: "EID_TYPE_API_PREFIX",
		1: "EID_TYPE_API_MAC",
		2: "EID_TYPE_API_NSH",
	}
	EidType_value = map[string]uint8{
		"EID_TYPE_API_PREFIX": 0,
		"EID_TYPE_API_MAC":    1,
		"EID_TYPE_API_NSH":    2,
	}
)

func (x EidType) String() string {
	s, ok := EidType_name[uint8(x)]
	if ok {
		return s
	}
	return "EidType(" + strconv.Itoa(int(x)) + ")"
}

// HmacKeyID defines enum 'hmac_key_id'.
type HmacKeyID uint8

const (
	KEY_ID_API_HMAC_NO_KEY      HmacKeyID = 0
	KEY_ID_API_HMAC_SHA_1_96    HmacKeyID = 1
	KEY_ID_API_HMAC_SHA_256_128 HmacKeyID = 2
)

var (
	HmacKeyID_name = map[uint8]string{
		0: "KEY_ID_API_HMAC_NO_KEY",
		1: "KEY_ID_API_HMAC_SHA_1_96",
		2: "KEY_ID_API_HMAC_SHA_256_128",
	}
	HmacKeyID_value = map[string]uint8{
		"KEY_ID_API_HMAC_NO_KEY":      0,
		"KEY_ID_API_HMAC_SHA_1_96":    1,
		"KEY_ID_API_HMAC_SHA_256_128": 2,
	}
)

func (x HmacKeyID) String() string {
	s, ok := HmacKeyID_name[uint8(x)]
	if ok {
		return s
	}
	return "HmacKeyID(" + strconv.Itoa(int(x)) + ")"
}

// Eid defines type 'eid'.
type Eid struct {
	Type    EidType    `binapi:"eid_type,name=type" json:"type,omitempty"`
	Address EidAddress `binapi:"eid_address,name=address" json:"address,omitempty"`
}

// HmacKey defines type 'hmac_key'.
type HmacKey struct {
	ID  HmacKeyID `binapi:"hmac_key_id,name=id" json:"id,omitempty"`
	Key []byte    `binapi:"u8[64],name=key" json:"key,omitempty"`
}

// LocalLocator defines type 'local_locator'.
type LocalLocator struct {
	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
	Priority  uint8                          `binapi:"u8,name=priority" json:"priority,omitempty"`
	Weight    uint8                          `binapi:"u8,name=weight" json:"weight,omitempty"`
}

// Nsh defines type 'nsh'.
type Nsh struct {
	Spi uint32 `binapi:"u32,name=spi" json:"spi,omitempty"`
	Si  uint8  `binapi:"u8,name=si" json:"si,omitempty"`
}

// RemoteLocator defines type 'remote_locator'.
type RemoteLocator struct {
	Priority  uint8            `binapi:"u8,name=priority" json:"priority,omitempty"`
	Weight    uint8            `binapi:"u8,name=weight" json:"weight,omitempty"`
	IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"`
}

// EidAddress defines union 'eid_address'.
type EidAddress struct {
	// Prefix *ip_types.Prefix
	// Mac *ethernet_types.MacAddress
	// Nsh *Nsh
	XXX_UnionData [6]byte
}

func EidAddressPrefix(a ip_types.Prefix) (u EidAddress) {
	u.SetPrefix(a)
	return
}
func (u *EidAddress) SetPrefix(a ip_types.Prefix) {
	var buf = codec.NewBuffer(u.XXX_UnionData[:])
	buf.EncodeUint8(uint8(a.Address.Af))
	buf.EncodeBytes(a.Address.Un.XXX_UnionData[:], 0)
	buf.EncodeUint8(uint8(a.Len))
}
func (u *EidAddress) GetPrefix() (a ip_types.Prefix) {
	var buf = codec.NewBuffer(u.XXX_UnionData[:])
	a.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
	copy(a.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
	a.Len = buf.DecodeUint8()
	return
}

func EidAddressMac(a ethernet_types.MacAddress) (u EidAddress) {
	u.SetMac(a)
	return
}
func (u *EidAddress) SetMac(a ethernet_types.MacAddress) {
	var buf = codec.NewBuffer(u.XXX_UnionData[:])
	buf.EncodeBytes(a[:], 6)
}
func (u *EidAddress) GetMac() (a ethernet_types.MacAddress) {
	var buf = codec.NewBuffer(u.XXX_UnionData[:])
	copy(a[:], buf.DecodeBytes(6))
	return
}

func EidAddressNsh(a Nsh) (u EidAddress) {
	u.SetNsh(a)
	return
}
func (u *EidAddress) SetNsh(a Nsh) {
	var buf = codec.NewBuffer(u.XXX_UnionData[:])
	buf.EncodeUint32(uint32(a.Spi))
	buf.EncodeUint8(uint8(a.Si))
}
func (u *EidAddress) GetNsh() (a Nsh) {
	var buf = codec.NewBuffer(u.XXX_UnionData[:])
	a.Spi = buf.DecodeUint32()
	a.Si = buf.DecodeUint8()
	return
}