1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.4.0-dev
5 // source: /usr/share/vpp/api/core/tapv2.api.json
7 // Package tapv2 contains generated bindings for API file tapv2.api.
16 api "git.fd.io/govpp.git/api"
17 ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types"
18 interface_types "git.fd.io/govpp.git/binapi/interface_types"
19 ip_types "git.fd.io/govpp.git/binapi/ip_types"
20 codec "git.fd.io/govpp.git/codec"
24 // This is a compile-time assertion to ensure that this generated file
25 // is compatible with the GoVPP api package it is being compiled against.
26 // A compilation error at this line likely means your copy of the
27 // GoVPP api package needs to be updated.
28 const _ = api.GoVppAPIPackageIsVersion2
33 VersionCrc = 0x3ed7c42d
36 // TapFlags defines enum 'tap_flags'.
40 TAP_API_FLAG_GSO TapFlags = 1
41 TAP_API_FLAG_CSUM_OFFLOAD TapFlags = 2
42 TAP_API_FLAG_PERSIST TapFlags = 4
43 TAP_API_FLAG_ATTACH TapFlags = 8
44 TAP_API_FLAG_TUN TapFlags = 16
45 TAP_API_FLAG_GRO_COALESCE TapFlags = 32
49 TapFlags_name = map[uint32]string{
50 1: "TAP_API_FLAG_GSO",
51 2: "TAP_API_FLAG_CSUM_OFFLOAD",
52 4: "TAP_API_FLAG_PERSIST",
53 8: "TAP_API_FLAG_ATTACH",
54 16: "TAP_API_FLAG_TUN",
55 32: "TAP_API_FLAG_GRO_COALESCE",
57 TapFlags_value = map[string]uint32{
58 "TAP_API_FLAG_GSO": 1,
59 "TAP_API_FLAG_CSUM_OFFLOAD": 2,
60 "TAP_API_FLAG_PERSIST": 4,
61 "TAP_API_FLAG_ATTACH": 8,
62 "TAP_API_FLAG_TUN": 16,
63 "TAP_API_FLAG_GRO_COALESCE": 32,
67 func (x TapFlags) String() string {
68 s, ok := TapFlags_name[uint32(x)]
72 str := func(n uint32) string {
73 s, ok := TapFlags_name[uint32(n)]
77 return "TapFlags(" + strconv.Itoa(int(n)) + ")"
79 for i := uint32(0); i <= 32; i++ {
94 // SwInterfaceTapV2Details defines message 'sw_interface_tap_v2_details'.
95 type SwInterfaceTapV2Details struct {
96 SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
97 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
98 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"`
99 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"`
100 HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"`
101 HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"`
102 HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"`
103 HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"`
104 TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"`
105 DevName string `binapi:"string[64],name=dev_name" json:"dev_name,omitempty"`
106 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
107 HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"`
108 HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"`
111 func (m *SwInterfaceTapV2Details) Reset() { *m = SwInterfaceTapV2Details{} }
112 func (*SwInterfaceTapV2Details) GetMessageName() string { return "sw_interface_tap_v2_details" }
113 func (*SwInterfaceTapV2Details) GetCrcString() string { return "e53c16de" }
114 func (*SwInterfaceTapV2Details) GetMessageType() api.MessageType {
115 return api.ReplyMessage
118 func (m *SwInterfaceTapV2Details) Size() int {
123 size += 4 // m.SwIfIndex
125 size += 2 // m.TxRingSz
126 size += 2 // m.RxRingSz
127 size += 4 // m.HostMtuSize
128 size += 1 * 6 // m.HostMacAddr
129 size += 1 * 4 // m.HostIP4Prefix.Address
130 size += 1 // m.HostIP4Prefix.Len
131 size += 1 * 16 // m.HostIP6Prefix.Address
132 size += 1 // m.HostIP6Prefix.Len
133 size += 4 // m.TapFlags
134 size += 64 // m.DevName
135 size += 64 // m.HostIfName
136 size += 64 // m.HostNamespace
137 size += 64 // m.HostBridge
140 func (m *SwInterfaceTapV2Details) Marshal(b []byte) ([]byte, error) {
141 var buf *codec.Buffer
143 buf = codec.NewBuffer(make([]byte, m.Size()))
145 buf = codec.NewBuffer(b)
147 buf.EncodeUint32(uint32(m.SwIfIndex))
148 buf.EncodeUint32(uint32(m.ID))
149 buf.EncodeUint16(uint16(m.TxRingSz))
150 buf.EncodeUint16(uint16(m.RxRingSz))
151 buf.EncodeUint32(uint32(m.HostMtuSize))
152 buf.EncodeBytes(m.HostMacAddr[:], 6)
153 buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4)
154 buf.EncodeUint8(uint8(m.HostIP4Prefix.Len))
155 buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16)
156 buf.EncodeUint8(uint8(m.HostIP6Prefix.Len))
157 buf.EncodeUint32(uint32(m.TapFlags))
158 buf.EncodeString(m.DevName, 64)
159 buf.EncodeString(m.HostIfName, 64)
160 buf.EncodeString(m.HostNamespace, 64)
161 buf.EncodeString(m.HostBridge, 64)
162 return buf.Bytes(), nil
164 func (m *SwInterfaceTapV2Details) Unmarshal(b []byte) error {
165 buf := codec.NewBuffer(b)
166 m.SwIfIndex = buf.DecodeUint32()
167 m.ID = buf.DecodeUint32()
168 m.TxRingSz = buf.DecodeUint16()
169 m.RxRingSz = buf.DecodeUint16()
170 m.HostMtuSize = buf.DecodeUint32()
171 copy(m.HostMacAddr[:], buf.DecodeBytes(6))
172 copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4))
173 m.HostIP4Prefix.Len = buf.DecodeUint8()
174 copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16))
175 m.HostIP6Prefix.Len = buf.DecodeUint8()
176 m.TapFlags = TapFlags(buf.DecodeUint32())
177 m.DevName = buf.DecodeString(64)
178 m.HostIfName = buf.DecodeString(64)
179 m.HostNamespace = buf.DecodeString(64)
180 m.HostBridge = buf.DecodeString(64)
184 // SwInterfaceTapV2Dump defines message 'sw_interface_tap_v2_dump'.
185 type SwInterfaceTapV2Dump struct {
186 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"`
189 func (m *SwInterfaceTapV2Dump) Reset() { *m = SwInterfaceTapV2Dump{} }
190 func (*SwInterfaceTapV2Dump) GetMessageName() string { return "sw_interface_tap_v2_dump" }
191 func (*SwInterfaceTapV2Dump) GetCrcString() string { return "f9e6675e" }
192 func (*SwInterfaceTapV2Dump) GetMessageType() api.MessageType {
193 return api.RequestMessage
196 func (m *SwInterfaceTapV2Dump) Size() int {
201 size += 4 // m.SwIfIndex
204 func (m *SwInterfaceTapV2Dump) Marshal(b []byte) ([]byte, error) {
205 var buf *codec.Buffer
207 buf = codec.NewBuffer(make([]byte, m.Size()))
209 buf = codec.NewBuffer(b)
211 buf.EncodeUint32(uint32(m.SwIfIndex))
212 return buf.Bytes(), nil
214 func (m *SwInterfaceTapV2Dump) Unmarshal(b []byte) error {
215 buf := codec.NewBuffer(b)
216 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
220 // TapCreateV2 defines message 'tap_create_v2'.
221 type TapCreateV2 struct {
222 ID uint32 `binapi:"u32,name=id,default=%!s(float64=4.294967295e+09)" json:"id,omitempty"`
223 UseRandomMac bool `binapi:"bool,name=use_random_mac,default=true" json:"use_random_mac,omitempty"`
224 MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
225 NumRxQueues uint8 `binapi:"u8,name=num_rx_queues,default=%!s(float64=1)" json:"num_rx_queues,omitempty"`
226 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz,default=%!s(float64=256)" json:"tx_ring_sz,omitempty"`
227 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz,default=%!s(float64=256)" json:"rx_ring_sz,omitempty"`
228 HostMtuSet bool `binapi:"bool,name=host_mtu_set" json:"host_mtu_set,omitempty"`
229 HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"`
230 HostMacAddrSet bool `binapi:"bool,name=host_mac_addr_set" json:"host_mac_addr_set,omitempty"`
231 HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"`
232 HostIP4PrefixSet bool `binapi:"bool,name=host_ip4_prefix_set" json:"host_ip4_prefix_set,omitempty"`
233 HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"`
234 HostIP6PrefixSet bool `binapi:"bool,name=host_ip6_prefix_set" json:"host_ip6_prefix_set,omitempty"`
235 HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"`
236 HostIP4GwSet bool `binapi:"bool,name=host_ip4_gw_set" json:"host_ip4_gw_set,omitempty"`
237 HostIP4Gw ip_types.IP4Address `binapi:"ip4_address,name=host_ip4_gw" json:"host_ip4_gw,omitempty"`
238 HostIP6GwSet bool `binapi:"bool,name=host_ip6_gw_set" json:"host_ip6_gw_set,omitempty"`
239 HostIP6Gw ip_types.IP6Address `binapi:"ip6_address,name=host_ip6_gw" json:"host_ip6_gw,omitempty"`
240 TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"`
241 HostNamespaceSet bool `binapi:"bool,name=host_namespace_set" json:"host_namespace_set,omitempty"`
242 HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"`
243 HostIfNameSet bool `binapi:"bool,name=host_if_name_set" json:"host_if_name_set,omitempty"`
244 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
245 HostBridgeSet bool `binapi:"bool,name=host_bridge_set" json:"host_bridge_set,omitempty"`
246 HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"`
247 Tag string `binapi:"string[],name=tag" json:"tag,omitempty"`
250 func (m *TapCreateV2) Reset() { *m = TapCreateV2{} }
251 func (*TapCreateV2) GetMessageName() string { return "tap_create_v2" }
252 func (*TapCreateV2) GetCrcString() string { return "445835fd" }
253 func (*TapCreateV2) GetMessageType() api.MessageType {
254 return api.RequestMessage
257 func (m *TapCreateV2) Size() int {
263 size += 1 // m.UseRandomMac
264 size += 1 * 6 // m.MacAddress
265 size += 1 // m.NumRxQueues
266 size += 2 // m.TxRingSz
267 size += 2 // m.RxRingSz
268 size += 1 // m.HostMtuSet
269 size += 4 // m.HostMtuSize
270 size += 1 // m.HostMacAddrSet
271 size += 1 * 6 // m.HostMacAddr
272 size += 1 // m.HostIP4PrefixSet
273 size += 1 * 4 // m.HostIP4Prefix.Address
274 size += 1 // m.HostIP4Prefix.Len
275 size += 1 // m.HostIP6PrefixSet
276 size += 1 * 16 // m.HostIP6Prefix.Address
277 size += 1 // m.HostIP6Prefix.Len
278 size += 1 // m.HostIP4GwSet
279 size += 1 * 4 // m.HostIP4Gw
280 size += 1 // m.HostIP6GwSet
281 size += 1 * 16 // m.HostIP6Gw
282 size += 4 // m.TapFlags
283 size += 1 // m.HostNamespaceSet
284 size += 64 // m.HostNamespace
285 size += 1 // m.HostIfNameSet
286 size += 64 // m.HostIfName
287 size += 1 // m.HostBridgeSet
288 size += 64 // m.HostBridge
289 size += 4 + len(m.Tag) // m.Tag
292 func (m *TapCreateV2) Marshal(b []byte) ([]byte, error) {
293 var buf *codec.Buffer
295 buf = codec.NewBuffer(make([]byte, m.Size()))
297 buf = codec.NewBuffer(b)
299 buf.EncodeUint32(uint32(m.ID))
300 buf.EncodeBool(m.UseRandomMac)
301 buf.EncodeBytes(m.MacAddress[:], 6)
302 buf.EncodeUint8(uint8(m.NumRxQueues))
303 buf.EncodeUint16(uint16(m.TxRingSz))
304 buf.EncodeUint16(uint16(m.RxRingSz))
305 buf.EncodeBool(m.HostMtuSet)
306 buf.EncodeUint32(uint32(m.HostMtuSize))
307 buf.EncodeBool(m.HostMacAddrSet)
308 buf.EncodeBytes(m.HostMacAddr[:], 6)
309 buf.EncodeBool(m.HostIP4PrefixSet)
310 buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4)
311 buf.EncodeUint8(uint8(m.HostIP4Prefix.Len))
312 buf.EncodeBool(m.HostIP6PrefixSet)
313 buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16)
314 buf.EncodeUint8(uint8(m.HostIP6Prefix.Len))
315 buf.EncodeBool(m.HostIP4GwSet)
316 buf.EncodeBytes(m.HostIP4Gw[:], 4)
317 buf.EncodeBool(m.HostIP6GwSet)
318 buf.EncodeBytes(m.HostIP6Gw[:], 16)
319 buf.EncodeUint32(uint32(m.TapFlags))
320 buf.EncodeBool(m.HostNamespaceSet)
321 buf.EncodeString(m.HostNamespace, 64)
322 buf.EncodeBool(m.HostIfNameSet)
323 buf.EncodeString(m.HostIfName, 64)
324 buf.EncodeBool(m.HostBridgeSet)
325 buf.EncodeString(m.HostBridge, 64)
326 buf.EncodeString(m.Tag, 0)
327 return buf.Bytes(), nil
329 func (m *TapCreateV2) Unmarshal(b []byte) error {
330 buf := codec.NewBuffer(b)
331 m.ID = buf.DecodeUint32()
332 m.UseRandomMac = buf.DecodeBool()
333 copy(m.MacAddress[:], buf.DecodeBytes(6))
334 m.NumRxQueues = buf.DecodeUint8()
335 m.TxRingSz = buf.DecodeUint16()
336 m.RxRingSz = buf.DecodeUint16()
337 m.HostMtuSet = buf.DecodeBool()
338 m.HostMtuSize = buf.DecodeUint32()
339 m.HostMacAddrSet = buf.DecodeBool()
340 copy(m.HostMacAddr[:], buf.DecodeBytes(6))
341 m.HostIP4PrefixSet = buf.DecodeBool()
342 copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4))
343 m.HostIP4Prefix.Len = buf.DecodeUint8()
344 m.HostIP6PrefixSet = buf.DecodeBool()
345 copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16))
346 m.HostIP6Prefix.Len = buf.DecodeUint8()
347 m.HostIP4GwSet = buf.DecodeBool()
348 copy(m.HostIP4Gw[:], buf.DecodeBytes(4))
349 m.HostIP6GwSet = buf.DecodeBool()
350 copy(m.HostIP6Gw[:], buf.DecodeBytes(16))
351 m.TapFlags = TapFlags(buf.DecodeUint32())
352 m.HostNamespaceSet = buf.DecodeBool()
353 m.HostNamespace = buf.DecodeString(64)
354 m.HostIfNameSet = buf.DecodeBool()
355 m.HostIfName = buf.DecodeString(64)
356 m.HostBridgeSet = buf.DecodeBool()
357 m.HostBridge = buf.DecodeString(64)
358 m.Tag = buf.DecodeString(0)
362 // TapCreateV2Reply defines message 'tap_create_v2_reply'.
363 type TapCreateV2Reply struct {
364 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
365 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
368 func (m *TapCreateV2Reply) Reset() { *m = TapCreateV2Reply{} }
369 func (*TapCreateV2Reply) GetMessageName() string { return "tap_create_v2_reply" }
370 func (*TapCreateV2Reply) GetCrcString() string { return "5383d31f" }
371 func (*TapCreateV2Reply) GetMessageType() api.MessageType {
372 return api.ReplyMessage
375 func (m *TapCreateV2Reply) Size() int {
380 size += 4 // m.Retval
381 size += 4 // m.SwIfIndex
384 func (m *TapCreateV2Reply) Marshal(b []byte) ([]byte, error) {
385 var buf *codec.Buffer
387 buf = codec.NewBuffer(make([]byte, m.Size()))
389 buf = codec.NewBuffer(b)
391 buf.EncodeUint32(uint32(m.Retval))
392 buf.EncodeUint32(uint32(m.SwIfIndex))
393 return buf.Bytes(), nil
395 func (m *TapCreateV2Reply) Unmarshal(b []byte) error {
396 buf := codec.NewBuffer(b)
397 m.Retval = int32(buf.DecodeUint32())
398 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
402 // TapDeleteV2 defines message 'tap_delete_v2'.
403 type TapDeleteV2 struct {
404 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
407 func (m *TapDeleteV2) Reset() { *m = TapDeleteV2{} }
408 func (*TapDeleteV2) GetMessageName() string { return "tap_delete_v2" }
409 func (*TapDeleteV2) GetCrcString() string { return "f9e6675e" }
410 func (*TapDeleteV2) GetMessageType() api.MessageType {
411 return api.RequestMessage
414 func (m *TapDeleteV2) Size() int {
419 size += 4 // m.SwIfIndex
422 func (m *TapDeleteV2) Marshal(b []byte) ([]byte, error) {
423 var buf *codec.Buffer
425 buf = codec.NewBuffer(make([]byte, m.Size()))
427 buf = codec.NewBuffer(b)
429 buf.EncodeUint32(uint32(m.SwIfIndex))
430 return buf.Bytes(), nil
432 func (m *TapDeleteV2) Unmarshal(b []byte) error {
433 buf := codec.NewBuffer(b)
434 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
438 // TapDeleteV2Reply defines message 'tap_delete_v2_reply'.
439 type TapDeleteV2Reply struct {
440 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
443 func (m *TapDeleteV2Reply) Reset() { *m = TapDeleteV2Reply{} }
444 func (*TapDeleteV2Reply) GetMessageName() string { return "tap_delete_v2_reply" }
445 func (*TapDeleteV2Reply) GetCrcString() string { return "e8d4e804" }
446 func (*TapDeleteV2Reply) GetMessageType() api.MessageType {
447 return api.ReplyMessage
450 func (m *TapDeleteV2Reply) Size() int {
455 size += 4 // m.Retval
458 func (m *TapDeleteV2Reply) Marshal(b []byte) ([]byte, error) {
459 var buf *codec.Buffer
461 buf = codec.NewBuffer(make([]byte, m.Size()))
463 buf = codec.NewBuffer(b)
465 buf.EncodeUint32(uint32(m.Retval))
466 return buf.Bytes(), nil
468 func (m *TapDeleteV2Reply) Unmarshal(b []byte) error {
469 buf := codec.NewBuffer(b)
470 m.Retval = int32(buf.DecodeUint32())
474 func init() { file_tapv2_binapi_init() }
475 func file_tapv2_binapi_init() {
476 api.RegisterMessage((*SwInterfaceTapV2Details)(nil), "sw_interface_tap_v2_details_e53c16de")
477 api.RegisterMessage((*SwInterfaceTapV2Dump)(nil), "sw_interface_tap_v2_dump_f9e6675e")
478 api.RegisterMessage((*TapCreateV2)(nil), "tap_create_v2_445835fd")
479 api.RegisterMessage((*TapCreateV2Reply)(nil), "tap_create_v2_reply_5383d31f")
480 api.RegisterMessage((*TapDeleteV2)(nil), "tap_delete_v2_f9e6675e")
481 api.RegisterMessage((*TapDeleteV2Reply)(nil), "tap_delete_v2_reply_e8d4e804")
484 // Messages returns list of all messages in this module.
485 func AllMessages() []api.Message {
486 return []api.Message{
487 (*SwInterfaceTapV2Details)(nil),
488 (*SwInterfaceTapV2Dump)(nil),
490 (*TapCreateV2Reply)(nil),
492 (*TapDeleteV2Reply)(nil),