summaryrefslogtreecommitdiffstats
path: root/binapi/gre/gre.ba.go
blob: d14c51e595674f604bfd86c18508ca70eeb5557f (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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
// 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/gre.api.json

// Package gre contains generated bindings for API file gre.api.
//
// Contents:
//   1 enum
//   1 struct
//   4 messages
//
package gre

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

const (
	APIFile    = "gre"
	APIVersion = "2.1.0"
	VersionCrc = 0xb9021569
)

// GreTunnelType defines enum 'gre_tunnel_type'.
type GreTunnelType uint8

const (
	GRE_API_TUNNEL_TYPE_L3     GreTunnelType = 0
	GRE_API_TUNNEL_TYPE_TEB    GreTunnelType = 1
	GRE_API_TUNNEL_TYPE_ERSPAN GreTunnelType = 2
)

var (
	GreTunnelType_name = map[uint8]string{
		0: "GRE_API_TUNNEL_TYPE_L3",
		1: "GRE_API_TUNNEL_TYPE_TEB",
		2: "GRE_API_TUNNEL_TYPE_ERSPAN",
	}
	GreTunnelType_value = map[string]uint8{
		"GRE_API_TUNNEL_TYPE_L3":     0,
		"GRE_API_TUNNEL_TYPE_TEB":    1,
		"GRE_API_TUNNEL_TYPE_ERSPAN": 2,
	}
)

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

// GreTunnel defines type 'gre_tunnel'.
type GreTunnel struct {
	Type         GreTunnelType                      `binapi:"gre_tunnel_type,name=type" json:"type,omitempty"`
	Mode         tunnel_types.TunnelMode            `binapi:"tunnel_mode,name=mode" json:"mode,omitempty"`
	Flags        tunnel_types.TunnelEncapDecapFlags `binapi:"tunnel_encap_decap_flags,name=flags" json:"flags,omitempty"`
	SessionID    uint16                             `binapi:"u16,name=session_id" json:"session_id,omitempty"`
	Instance     uint32                             `binapi:"u32,name=instance" json:"instance,omitempty"`
	OuterTableID uint32                             `binapi:"u32,name=outer_table_id" json:"outer_table_id,omitempty"`
	SwIfIndex    interface_types.InterfaceIndex     `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
	Src          ip_types.Address                   `binapi:"address,name=src" json:"src,omitempty"`
	Dst          ip_types.Address                   `binapi:"address,name=dst" json:"dst,omitempty"`
}

// GreTunnelAddDel defines message 'gre_tunnel_add_del'.
type GreTunnelAddDel struct {
	IsAdd  bool      `binapi:"bool,name=is_add" json:"is_add,omitempty"`
	Tunnel GreTunnel `binapi:"gre_tunnel,name=tunnel" json:"tunnel,omitempty"`
}

func (m *GreTunnelAddDel) Reset()               { *m = GreTunnelAddDel{} }
func (*GreTunnelAddDel) GetMessageName() string { return "gre_tunnel_add_del" }
func (*GreTunnelAddDel) GetCrcString() string   { return "6efc9c22" }
func (*GreTunnelAddDel) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *GreTunnelAddDel) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 1      // m.IsAdd
	size += 1      // m.Tunnel.Type
	size += 1      // m.Tunnel.Mode
	size += 1      // m.Tunnel.Flags
	size += 2      // m.Tunnel.SessionID
	size += 4      // m.Tunnel.Instance
	size += 4      // m.Tunnel.OuterTableID
	size += 4      // m.Tunnel.SwIfIndex
	size += 1      // m.Tunnel.Src.Af
	size += 1 * 16 // m.Tunnel.Src.Un
	size += 1      // m.Tunnel.Dst.Af
	size += 1 * 16 // m.Tunnel.Dst.Un
	return size
}
func (m *GreTunnelAddDel) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeBool(m.IsAdd)
	buf.EncodeUint8(uint8(m.Tunnel.Type))
	buf.EncodeUint8(uint8(m.Tunnel.Mode))
	buf.EncodeUint8(uint8(m.Tunnel.Flags))
	buf.EncodeUint16(m.Tunnel.SessionID)
	buf.EncodeUint32(m.Tunnel.Instance)
	buf.EncodeUint32(m.Tunnel.OuterTableID)
	buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
	buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
	buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
	buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
	buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
	return buf.Bytes(), nil
}
func (m *GreTunnelAddDel) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.IsAdd = buf.DecodeBool()
	m.Tunnel.Type = GreTunnelType(buf.DecodeUint8())
	m.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8())
	m.Tunnel.Flags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8())
	m.Tunnel.SessionID = buf.DecodeUint16()
	m.Tunnel.Instance = buf.DecodeUint32()
	m.Tunnel.OuterTableID = buf.DecodeUint32()
	m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
	m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8())
	copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16))
	m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8())
	copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16))
	return nil
}

// GreTunnelAddDelReply defines message 'gre_tunnel_add_del_reply'.
type GreTunnelAddDelReply struct {
	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
}

func (m *GreTunnelAddDelReply) Reset()               { *m = GreTunnelAddDelReply{} }
func (*GreTunnelAddDelReply) GetMessageName() string { return "gre_tunnel_add_del_reply" }
func (*GreTunnelAddDelReply) GetCrcString() string   { return "5383d31f" }
func (*GreTunnelAddDelReply) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func (m *GreTunnelAddDelReply) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4 // m.Retval
	size += 4 // m.SwIfIndex
	return size
}
func (m *GreTunnelAddDelReply) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeInt32(m.Retval)
	buf.EncodeUint32(uint32(m.SwIfIndex))
	return buf.Bytes(), nil
}
func (m *GreTunnelAddDelReply) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Retval = buf.DecodeInt32()
	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
	return nil
}

// GreTunnelDetails defines message 'gre_tunnel_details'.
type GreTunnelDetails struct {
	Tunnel GreTunnel `binapi:"gre_tunnel,name=tunnel" json:"tunnel,omitempty"`
}

func (m *GreTunnelDetails) Reset()               { *m = GreTunnelDetails{} }
func (*GreTunnelDetails) GetMessageName() string { return "gre_tunnel_details" }
func (*GreTunnelDetails) GetCrcString() string   { return "003bfbf1" }
func (*GreTunnelDetails) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func (m *GreTunnelDetails) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 1      // m.Tunnel.Type
	size += 1      // m.Tunnel.Mode
	size += 1      // m.Tunnel.Flags
	size += 2      // m.Tunnel.SessionID
	size += 4      // m.Tunnel.Instance
	size += 4      // m.Tunnel.OuterTableID
	size += 4      // m.Tunnel.SwIfIndex
	size += 1      // m.Tunnel.Src.Af
	size += 1 * 16 // m.Tunnel.Src.Un
	size += 1      // m.Tunnel.Dst.Af
	size += 1 * 16 // m.Tunnel.Dst.Un
	return size
}
func (m *GreTunnelDetails) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint8(uint8(m.Tunnel.Type))
	buf.EncodeUint8(uint8(m.Tunnel.Mode))
	buf.EncodeUint8(uint8(m.Tunnel.Flags))
	buf.EncodeUint16(m.Tunnel.SessionID)
	buf.EncodeUint32(m.Tunnel.Instance)
	buf.EncodeUint32(m.Tunnel.OuterTableID)
	buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
	buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
	buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
	buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
	buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
	return buf.Bytes(), nil
}
func (m *GreTunnelDetails) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Tunnel.Type = GreTunnelType(buf.DecodeUint8())
	m.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8())
	m.Tunnel.Flags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8())
	m.Tunnel.SessionID = buf.DecodeUint16()
	m.Tunnel.Instance = buf.DecodeUint32()
	m.Tunnel.OuterTableID = buf.DecodeUint32()
	m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
	m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8())
	copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16))
	m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8())
	copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16))
	return nil
}

// GreTunnelDump defines message 'gre_tunnel_dump'.
type GreTunnelDump struct {
	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
}

func (m *GreTunnelDump) Reset()               { *m = GreTunnelDump{} }
func (*GreTunnelDump) GetMessageName() string { return "gre_tunnel_dump" }
func (*GreTunnelDump) GetCrcString() string   { return "f9e6675e" }
func (*GreTunnelDump) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *GreTunnelDump) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4 // m.SwIfIndex
	return size
}
func (m *GreTunnelDump) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint32(uint32(m.SwIfIndex))
	return buf.Bytes(), nil
}
func (m *GreTunnelDump) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
	return nil
}

func init() { file_gre_binapi_init() }
func file_gre_binapi_init() {
	api.RegisterMessage((*GreTunnelAddDel)(nil), "gre_tunnel_add_del_6efc9c22")
	api.RegisterMessage((*GreTunnelAddDelReply)(nil), "gre_tunnel_add_del_reply_5383d31f")
	api.RegisterMessage((*GreTunnelDetails)(nil), "gre_tunnel_details_003bfbf1")
	api.RegisterMessage((*GreTunnelDump)(nil), "gre_tunnel_dump_f9e6675e")
}

// Messages returns list of all messages in this module.
func AllMessages() []api.Message {
	return []api.Message{
		(*GreTunnelAddDel)(nil),
		(*GreTunnelAddDelReply)(nil),
		(*GreTunnelDetails)(nil),
		(*GreTunnelDump)(nil),
	}
}