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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
|
// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
// versions:
// binapi-generator: v0.4.0-dev
// VPP: 20.05-release
// Package tapv2 contains generated bindings for API file tapv2.api.
//
// Contents:
// 1 enum
// 6 messages
//
package tapv2
import (
"strconv"
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"
)
// 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 = "tapv2"
APIVersion = "4.0.0"
VersionCrc = 0x3ed7c42d
)
// TapFlags defines enum 'tap_flags'.
type TapFlags uint32
const (
TAP_API_FLAG_GSO TapFlags = 1
TAP_API_FLAG_CSUM_OFFLOAD TapFlags = 2
TAP_API_FLAG_PERSIST TapFlags = 4
TAP_API_FLAG_ATTACH TapFlags = 8
TAP_API_FLAG_TUN TapFlags = 16
TAP_API_FLAG_GRO_COALESCE TapFlags = 32
)
var (
TapFlags_name = map[uint32]string{
1: "TAP_API_FLAG_GSO",
2: "TAP_API_FLAG_CSUM_OFFLOAD",
4: "TAP_API_FLAG_PERSIST",
8: "TAP_API_FLAG_ATTACH",
16: "TAP_API_FLAG_TUN",
32: "TAP_API_FLAG_GRO_COALESCE",
}
TapFlags_value = map[string]uint32{
"TAP_API_FLAG_GSO": 1,
"TAP_API_FLAG_CSUM_OFFLOAD": 2,
"TAP_API_FLAG_PERSIST": 4,
"TAP_API_FLAG_ATTACH": 8,
"TAP_API_FLAG_TUN": 16,
"TAP_API_FLAG_GRO_COALESCE": 32,
}
)
func (x TapFlags) String() string {
s, ok := TapFlags_name[uint32(x)]
if ok {
return s
}
str := func(n uint32) string {
s, ok := TapFlags_name[uint32(n)]
if ok {
return s
}
return "TapFlags(" + 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
}
// SwInterfaceTapV2Details defines message 'sw_interface_tap_v2_details'.
type SwInterfaceTapV2Details struct {
SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
TxRingSz uint16 `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"`
RxRingSz uint16 `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"`
HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"`
HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"`
HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"`
HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"`
TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"`
DevName string `binapi:"string[64],name=dev_name" json:"dev_name,omitempty"`
HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"`
HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"`
}
func (m *SwInterfaceTapV2Details) Reset() { *m = SwInterfaceTapV2Details{} }
func (*SwInterfaceTapV2Details) GetMessageName() string { return "sw_interface_tap_v2_details" }
func (*SwInterfaceTapV2Details) GetCrcString() string { return "e53c16de" }
func (*SwInterfaceTapV2Details) GetMessageType() api.MessageType {
return api.ReplyMessage
}
func (m *SwInterfaceTapV2Details) Size() (size int) {
if m == nil {
return 0
}
size += 4 // m.SwIfIndex
size += 4 // m.ID
size += 2 // m.TxRingSz
size += 2 // m.RxRingSz
size += 4 // m.HostMtuSize
size += 1 * 6 // m.HostMacAddr
size += 1 * 4 // m.HostIP4Prefix.Address
size += 1 // m.HostIP4Prefix.Len
size += 1 * 16 // m.HostIP6Prefix.Address
size += 1 // m.HostIP6Prefix.Len
size += 4 // m.TapFlags
size += 64 // m.DevName
size += 64 // m.HostIfName
size += 64 // m.HostNamespace
size += 64 // m.HostBridge
return size
}
func (m *SwInterfaceTapV2Details) Marshal(b []byte) ([]byte, error) {
if b == nil {
b = make([]byte, m.Size())
}
buf := codec.NewBuffer(b)
buf.EncodeUint32(m.SwIfIndex)
buf.EncodeUint32(m.ID)
buf.EncodeUint16(m.TxRingSz)
buf.EncodeUint16(m.RxRingSz)
buf.EncodeUint32(m.HostMtuSize)
buf.EncodeBytes(m.HostMacAddr[:], 6)
buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4)
buf.EncodeUint8(m.HostIP4Prefix.Len)
buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16)
buf.EncodeUint8(m.HostIP6Prefix.Len)
buf.EncodeUint32(uint32(m.TapFlags))
buf.EncodeString(m.DevName, 64)
buf.EncodeString(m.HostIfName, 64)
buf.EncodeString(m.HostNamespace, 64)
buf.EncodeString(m.HostBridge, 64)
return buf.Bytes(), nil
}
func (m *SwInterfaceTapV2Details) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.SwIfIndex = buf.DecodeUint32()
m.ID = buf.DecodeUint32()
m.TxRingSz = buf.DecodeUint16()
m.RxRingSz = buf.DecodeUint16()
m.HostMtuSize = buf.DecodeUint32()
copy(m.HostMacAddr[:], buf.DecodeBytes(6))
copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4))
m.HostIP4Prefix.Len = buf.DecodeUint8()
copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16))
m.HostIP6Prefix.Len = buf.DecodeUint8()
m.TapFlags = TapFlags(buf.DecodeUint32())
m.DevName = buf.DecodeString(64)
m.HostIfName = buf.DecodeString(64)
m.HostNamespace = buf.DecodeString(64)
m.HostBridge = buf.DecodeString(64)
return nil
}
// SwInterfaceTapV2Dump defines message 'sw_interface_tap_v2_dump'.
type SwInterfaceTapV2Dump struct {
SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
}
func (m *SwInterfaceTapV2Dump) Reset() { *m = SwInterfaceTapV2Dump{} }
func (*SwInterfaceTapV2Dump) GetMessageName() string { return "sw_interface_tap_v2_dump" }
func (*SwInterfaceTapV2Dump) GetCrcString() string { return "f9e6675e" }
func (*SwInterfaceTapV2Dump) GetMessageType() api.MessageType {
return api.RequestMessage
}
func (m *SwInterfaceTapV2Dump) Size() (size int) {
if m == nil {
return 0
}
size += 4 // m.SwIfIndex
return size
}
func (m *SwInterfaceTapV2Dump) 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 *SwInterfaceTapV2Dump) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
// TapCreateV2 defines message 'tap_create_v2'.
type TapCreateV2 struct {
ID uint32 `binapi:"u32,name=id,default=4294967295" json:"id,omitempty"`
UseRandomMac bool `binapi:"bool,name=use_random_mac,default=true" json:"use_random_mac,omitempty"`
MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
NumRxQueues uint8 `binapi:"u8,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"`
TxRingSz uint16 `binapi:"u16,name=tx_ring_sz,default=256" json:"tx_ring_sz,omitempty"`
RxRingSz uint16 `binapi:"u16,name=rx_ring_sz,default=256" json:"rx_ring_sz,omitempty"`
HostMtuSet bool `binapi:"bool,name=host_mtu_set" json:"host_mtu_set,omitempty"`
HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"`
HostMacAddrSet bool `binapi:"bool,name=host_mac_addr_set" json:"host_mac_addr_set,omitempty"`
HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"`
HostIP4PrefixSet bool `binapi:"bool,name=host_ip4_prefix_set" json:"host_ip4_prefix_set,omitempty"`
HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"`
HostIP6PrefixSet bool `binapi:"bool,name=host_ip6_prefix_set" json:"host_ip6_prefix_set,omitempty"`
HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"`
HostIP4GwSet bool `binapi:"bool,name=host_ip4_gw_set" json:"host_ip4_gw_set,omitempty"`
HostIP4Gw ip_types.IP4Address `binapi:"ip4_address,name=host_ip4_gw" json:"host_ip4_gw,omitempty"`
HostIP6GwSet bool `binapi:"bool,name=host_ip6_gw_set" json:"host_ip6_gw_set,omitempty"`
HostIP6Gw ip_types.IP6Address `binapi:"ip6_address,name=host_ip6_gw" json:"host_ip6_gw,omitempty"`
TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"`
HostNamespaceSet bool `binapi:"bool,name=host_namespace_set" json:"host_namespace_set,omitempty"`
HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"`
HostIfNameSet bool `binapi:"bool,name=host_if_name_set" json:"host_if_name_set,omitempty"`
HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
HostBridgeSet bool `binapi:"bool,name=host_bridge_set" json:"host_bridge_set,omitempty"`
HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"`
Tag string `binapi:"string[],name=tag" json:"tag,omitempty"`
}
func (m *TapCreateV2) Reset() { *m = TapCreateV2{} }
func (*TapCreateV2) GetMessageName() string { return "tap_create_v2" }
func (*TapCreateV2) GetCrcString() string { return "445835fd" }
func (*TapCreateV2) GetMessageType() api.MessageType {
return api.RequestMessage
}
func (m *TapCreateV2) Size() (size int) {
if m == nil {
return 0
}
size += 4 // m.ID
size += 1 // m.UseRandomMac
size += 1 * 6 // m.MacAddress
size += 1 // m.NumRxQueues
size += 2 // m.TxRingSz
size += 2 // m.RxRingSz
size += 1 // m.HostMtuSet
size += 4 // m.HostMtuSize
size += 1 // m.HostMacAddrSet
size += 1 * 6 // m.HostMacAddr
size += 1 // m.HostIP4PrefixSet
size += 1 * 4 // m.HostIP4Prefix.Address
size += 1 // m.HostIP4Prefix.Len
size += 1 // m.HostIP6PrefixSet
size += 1 * 16 // m.HostIP6Prefix.Address
size += 1 // m.HostIP6Prefix.Len
size += 1 // m.HostIP4GwSet
size += 1 * 4 // m.HostIP4Gw
size += 1 // m.HostIP6GwSet
size += 1 * 16 // m.HostIP6Gw
size += 4 // m.TapFlags
size += 1 // m.HostNamespaceSet
size += 64 // m.HostNamespace
size += 1 // m.HostIfNameSet
size += 64 // m.HostIfName
size += 1 // m.HostBridgeSet
size += 64 // m.HostBridge
size += 4 + len(m.Tag) // m.Tag
return size
}
func (m *TapCreateV2) Marshal(b []byte) ([]byte, error) {
if b == nil {
b = make([]byte, m.Size())
}
buf := codec.NewBuffer(b)
buf.EncodeUint32(m.ID)
buf.EncodeBool(m.UseRandomMac)
buf.EncodeBytes(m.MacAddress[:], 6)
buf.EncodeUint8(m.NumRxQueues)
buf.EncodeUint16(m.TxRingSz)
buf.EncodeUint16(m.RxRingSz)
buf.EncodeBool(m.HostMtuSet)
buf.EncodeUint32(m.HostMtuSize)
buf.EncodeBool(m.HostMacAddrSet)
buf.EncodeBytes(m.HostMacAddr[:], 6)
buf.EncodeBool(m.HostIP4PrefixSet)
buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4)
buf.EncodeUint8(m.HostIP4Prefix.Len)
buf.EncodeBool(m.HostIP6PrefixSet)
buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16)
buf.EncodeUint8(m.HostIP6Prefix.Len)
buf.EncodeBool(m.HostIP4GwSet)
buf.EncodeBytes(m.HostIP4Gw[:], 4)
buf.EncodeBool(m.HostIP6GwSet)
buf.EncodeBytes(m.HostIP6Gw[:], 16)
buf.EncodeUint32(uint32(m.TapFlags))
buf.EncodeBool(m.HostNamespaceSet)
buf.EncodeString(m.HostNamespace, 64)
buf.EncodeBool(m.HostIfNameSet)
buf.EncodeString(m.HostIfName, 64)
buf.EncodeBool(m.HostBridgeSet)
buf.EncodeString(m.HostBridge, 64)
buf.EncodeString(m.Tag, 0)
return buf.Bytes(), nil
}
func (m *TapCreateV2) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.ID = buf.DecodeUint32()
m.UseRandomMac = buf.DecodeBool()
copy(m.MacAddress[:], buf.DecodeBytes(6))
m.NumRxQueues = buf.DecodeUint8()
m.TxRingSz = buf.DecodeUint16()
m.RxRingSz = buf.DecodeUint16()
m.HostMtuSet = buf.DecodeBool()
m.HostMtuSize = buf.DecodeUint32()
m.HostMacAddrSet = buf.DecodeBool()
copy(m.HostMacAddr[:], buf.DecodeBytes(6))
m.HostIP4PrefixSet = buf.DecodeBool()
copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4))
m.HostIP4Prefix.Len = buf.DecodeUint8()
m.HostIP6PrefixSet = buf.DecodeBool()
copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16))
m.HostIP6Prefix.Len = buf.DecodeUint8()
m.HostIP4GwSet = buf.DecodeBool()
copy(m.HostIP4Gw[:], buf.DecodeBytes(4))
m.HostIP6GwSet = buf.DecodeBool()
copy(m.HostIP6Gw[:], buf.DecodeBytes(16))
m.TapFlags = TapFlags(buf.DecodeUint32())
m.HostNamespaceSet = buf.DecodeBool()
m.HostNamespace = buf.DecodeString(64)
m.HostIfNameSet = buf.DecodeBool()
m.HostIfName = buf.DecodeString(64)
m.HostBridgeSet = buf.DecodeBool()
m.HostBridge = buf.DecodeString(64)
m.Tag = buf.DecodeString(0)
return nil
}
// TapCreateV2Reply defines message 'tap_create_v2_reply'.
type TapCreateV2Reply 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 *TapCreateV2Reply) Reset() { *m = TapCreateV2Reply{} }
func (*TapCreateV2Reply) GetMessageName() string { return "tap_create_v2_reply" }
func (*TapCreateV2Reply) GetCrcString() string { return "5383d31f" }
func (*TapCreateV2Reply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
func (m *TapCreateV2Reply) Size() (size int) {
if m == nil {
return 0
}
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *TapCreateV2Reply) 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 *TapCreateV2Reply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
// TapDeleteV2 defines message 'tap_delete_v2'.
type TapDeleteV2 struct {
SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
}
func (m *TapDeleteV2) Reset() { *m = TapDeleteV2{} }
func (*TapDeleteV2) GetMessageName() string { return "tap_delete_v2" }
func (*TapDeleteV2) GetCrcString() string { return "f9e6675e" }
func (*TapDeleteV2) GetMessageType() api.MessageType {
return api.RequestMessage
}
func (m *TapDeleteV2) Size() (size int) {
if m == nil {
return 0
}
size += 4 // m.SwIfIndex
return size
}
func (m *TapDeleteV2) 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 *TapDeleteV2) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
// TapDeleteV2Reply defines message 'tap_delete_v2_reply'.
type TapDeleteV2Reply struct {
Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
}
func (m *TapDeleteV2Reply) Reset() { *m = TapDeleteV2Reply{} }
func (*TapDeleteV2Reply) GetMessageName() string { return "tap_delete_v2_reply" }
func (*TapDeleteV2Reply) GetCrcString() string { return "e8d4e804" }
func (*TapDeleteV2Reply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
func (m *TapDeleteV2Reply) Size() (size int) {
if m == nil {
return 0
}
size += 4 // m.Retval
return size
}
func (m *TapDeleteV2Reply) Marshal(b []byte) ([]byte, error) {
if b == nil {
b = make([]byte, m.Size())
}
buf := codec.NewBuffer(b)
buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *TapDeleteV2Reply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.Retval = buf.DecodeInt32()
return nil
}
func init() { file_tapv2_binapi_init() }
func file_tapv2_binapi_init() {
api.RegisterMessage((*SwInterfaceTapV2Details)(nil), "sw_interface_tap_v2_details_e53c16de")
api.RegisterMessage((*SwInterfaceTapV2Dump)(nil), "sw_interface_tap_v2_dump_f9e6675e")
api.RegisterMessage((*TapCreateV2)(nil), "tap_create_v2_445835fd")
api.RegisterMessage((*TapCreateV2Reply)(nil), "tap_create_v2_reply_5383d31f")
api.RegisterMessage((*TapDeleteV2)(nil), "tap_delete_v2_f9e6675e")
api.RegisterMessage((*TapDeleteV2Reply)(nil), "tap_delete_v2_reply_e8d4e804")
}
// Messages returns list of all messages in this module.
func AllMessages() []api.Message {
return []api.Message{
(*SwInterfaceTapV2Details)(nil),
(*SwInterfaceTapV2Dump)(nil),
(*TapCreateV2)(nil),
(*TapCreateV2Reply)(nil),
(*TapDeleteV2)(nil),
(*TapDeleteV2Reply)(nil),
}
}
|