1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.4.0
4 // VPP: 20.05.1-release
5 // source: /usr/share/vpp/api/core/tapv2.api.json
7 // Package tapv2 contains generated bindings for API file tapv2.api.
18 api "git.fd.io/govpp.git/api"
19 ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types"
20 interface_types "git.fd.io/govpp.git/binapi/interface_types"
21 ip_types "git.fd.io/govpp.git/binapi/ip_types"
22 codec "git.fd.io/govpp.git/codec"
25 // This is a compile-time assertion to ensure that this generated file
26 // is compatible with the GoVPP api package it is being compiled against.
27 // A compilation error at this line likely means your copy of the
28 // GoVPP api package needs to be updated.
29 const _ = api.GoVppAPIPackageIsVersion2
34 VersionCrc = 0x3ed7c42d
37 // TapFlags defines enum 'tap_flags'.
41 TAP_API_FLAG_GSO TapFlags = 1
42 TAP_API_FLAG_CSUM_OFFLOAD TapFlags = 2
43 TAP_API_FLAG_PERSIST TapFlags = 4
44 TAP_API_FLAG_ATTACH TapFlags = 8
45 TAP_API_FLAG_TUN TapFlags = 16
46 TAP_API_FLAG_GRO_COALESCE TapFlags = 32
50 TapFlags_name = map[uint32]string{
51 1: "TAP_API_FLAG_GSO",
52 2: "TAP_API_FLAG_CSUM_OFFLOAD",
53 4: "TAP_API_FLAG_PERSIST",
54 8: "TAP_API_FLAG_ATTACH",
55 16: "TAP_API_FLAG_TUN",
56 32: "TAP_API_FLAG_GRO_COALESCE",
58 TapFlags_value = map[string]uint32{
59 "TAP_API_FLAG_GSO": 1,
60 "TAP_API_FLAG_CSUM_OFFLOAD": 2,
61 "TAP_API_FLAG_PERSIST": 4,
62 "TAP_API_FLAG_ATTACH": 8,
63 "TAP_API_FLAG_TUN": 16,
64 "TAP_API_FLAG_GRO_COALESCE": 32,
68 func (x TapFlags) String() string {
69 s, ok := TapFlags_name[uint32(x)]
73 str := func(n uint32) string {
74 s, ok := TapFlags_name[uint32(n)]
78 return "TapFlags(" + strconv.Itoa(int(n)) + ")"
80 for i := uint32(0); i <= 32; i++ {
95 // SwInterfaceTapV2Details defines message 'sw_interface_tap_v2_details'.
96 type SwInterfaceTapV2Details struct {
97 SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
98 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
99 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"`
100 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"`
101 HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"`
102 HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"`
103 HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"`
104 HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"`
105 TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"`
106 DevName string `binapi:"string[64],name=dev_name" json:"dev_name,omitempty"`
107 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
108 HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"`
109 HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"`
112 func (m *SwInterfaceTapV2Details) Reset() { *m = SwInterfaceTapV2Details{} }
113 func (*SwInterfaceTapV2Details) GetMessageName() string { return "sw_interface_tap_v2_details" }
114 func (*SwInterfaceTapV2Details) GetCrcString() string { return "e53c16de" }
115 func (*SwInterfaceTapV2Details) GetMessageType() api.MessageType {
116 return api.ReplyMessage
119 func (m *SwInterfaceTapV2Details) Size() (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) {
142 b = make([]byte, m.Size())
144 buf := codec.NewBuffer(b)
145 buf.EncodeUint32(m.SwIfIndex)
146 buf.EncodeUint32(m.ID)
147 buf.EncodeUint16(m.TxRingSz)
148 buf.EncodeUint16(m.RxRingSz)
149 buf.EncodeUint32(m.HostMtuSize)
150 buf.EncodeBytes(m.HostMacAddr[:], 6)
151 buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4)
152 buf.EncodeUint8(m.HostIP4Prefix.Len)
153 buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16)
154 buf.EncodeUint8(m.HostIP6Prefix.Len)
155 buf.EncodeUint32(uint32(m.TapFlags))
156 buf.EncodeString(m.DevName, 64)
157 buf.EncodeString(m.HostIfName, 64)
158 buf.EncodeString(m.HostNamespace, 64)
159 buf.EncodeString(m.HostBridge, 64)
160 return buf.Bytes(), nil
162 func (m *SwInterfaceTapV2Details) Unmarshal(b []byte) error {
163 buf := codec.NewBuffer(b)
164 m.SwIfIndex = buf.DecodeUint32()
165 m.ID = buf.DecodeUint32()
166 m.TxRingSz = buf.DecodeUint16()
167 m.RxRingSz = buf.DecodeUint16()
168 m.HostMtuSize = buf.DecodeUint32()
169 copy(m.HostMacAddr[:], buf.DecodeBytes(6))
170 copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4))
171 m.HostIP4Prefix.Len = buf.DecodeUint8()
172 copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16))
173 m.HostIP6Prefix.Len = buf.DecodeUint8()
174 m.TapFlags = TapFlags(buf.DecodeUint32())
175 m.DevName = buf.DecodeString(64)
176 m.HostIfName = buf.DecodeString(64)
177 m.HostNamespace = buf.DecodeString(64)
178 m.HostBridge = buf.DecodeString(64)
182 // SwInterfaceTapV2Dump defines message 'sw_interface_tap_v2_dump'.
183 type SwInterfaceTapV2Dump struct {
184 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
187 func (m *SwInterfaceTapV2Dump) Reset() { *m = SwInterfaceTapV2Dump{} }
188 func (*SwInterfaceTapV2Dump) GetMessageName() string { return "sw_interface_tap_v2_dump" }
189 func (*SwInterfaceTapV2Dump) GetCrcString() string { return "f9e6675e" }
190 func (*SwInterfaceTapV2Dump) GetMessageType() api.MessageType {
191 return api.RequestMessage
194 func (m *SwInterfaceTapV2Dump) Size() (size int) {
198 size += 4 // m.SwIfIndex
201 func (m *SwInterfaceTapV2Dump) Marshal(b []byte) ([]byte, error) {
203 b = make([]byte, m.Size())
205 buf := codec.NewBuffer(b)
206 buf.EncodeUint32(uint32(m.SwIfIndex))
207 return buf.Bytes(), nil
209 func (m *SwInterfaceTapV2Dump) Unmarshal(b []byte) error {
210 buf := codec.NewBuffer(b)
211 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
215 // TapCreateV2 defines message 'tap_create_v2'.
216 type TapCreateV2 struct {
217 ID uint32 `binapi:"u32,name=id,default=4294967295" json:"id,omitempty"`
218 UseRandomMac bool `binapi:"bool,name=use_random_mac,default=true" json:"use_random_mac,omitempty"`
219 MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
220 NumRxQueues uint8 `binapi:"u8,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"`
221 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz,default=256" json:"tx_ring_sz,omitempty"`
222 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz,default=256" json:"rx_ring_sz,omitempty"`
223 HostMtuSet bool `binapi:"bool,name=host_mtu_set" json:"host_mtu_set,omitempty"`
224 HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"`
225 HostMacAddrSet bool `binapi:"bool,name=host_mac_addr_set" json:"host_mac_addr_set,omitempty"`
226 HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"`
227 HostIP4PrefixSet bool `binapi:"bool,name=host_ip4_prefix_set" json:"host_ip4_prefix_set,omitempty"`
228 HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"`
229 HostIP6PrefixSet bool `binapi:"bool,name=host_ip6_prefix_set" json:"host_ip6_prefix_set,omitempty"`
230 HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"`
231 HostIP4GwSet bool `binapi:"bool,name=host_ip4_gw_set" json:"host_ip4_gw_set,omitempty"`
232 HostIP4Gw ip_types.IP4Address `binapi:"ip4_address,name=host_ip4_gw" json:"host_ip4_gw,omitempty"`
233 HostIP6GwSet bool `binapi:"bool,name=host_ip6_gw_set" json:"host_ip6_gw_set,omitempty"`
234 HostIP6Gw ip_types.IP6Address `binapi:"ip6_address,name=host_ip6_gw" json:"host_ip6_gw,omitempty"`
235 TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"`
236 HostNamespaceSet bool `binapi:"bool,name=host_namespace_set" json:"host_namespace_set,omitempty"`
237 HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"`
238 HostIfNameSet bool `binapi:"bool,name=host_if_name_set" json:"host_if_name_set,omitempty"`
239 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
240 HostBridgeSet bool `binapi:"bool,name=host_bridge_set" json:"host_bridge_set,omitempty"`
241 HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"`
242 Tag string `binapi:"string[],name=tag" json:"tag,omitempty"`
245 func (m *TapCreateV2) Reset() { *m = TapCreateV2{} }
246 func (*TapCreateV2) GetMessageName() string { return "tap_create_v2" }
247 func (*TapCreateV2) GetCrcString() string { return "445835fd" }
248 func (*TapCreateV2) GetMessageType() api.MessageType {
249 return api.RequestMessage
252 func (m *TapCreateV2) Size() (size int) {
257 size += 1 // m.UseRandomMac
258 size += 1 * 6 // m.MacAddress
259 size += 1 // m.NumRxQueues
260 size += 2 // m.TxRingSz
261 size += 2 // m.RxRingSz
262 size += 1 // m.HostMtuSet
263 size += 4 // m.HostMtuSize
264 size += 1 // m.HostMacAddrSet
265 size += 1 * 6 // m.HostMacAddr
266 size += 1 // m.HostIP4PrefixSet
267 size += 1 * 4 // m.HostIP4Prefix.Address
268 size += 1 // m.HostIP4Prefix.Len
269 size += 1 // m.HostIP6PrefixSet
270 size += 1 * 16 // m.HostIP6Prefix.Address
271 size += 1 // m.HostIP6Prefix.Len
272 size += 1 // m.HostIP4GwSet
273 size += 1 * 4 // m.HostIP4Gw
274 size += 1 // m.HostIP6GwSet
275 size += 1 * 16 // m.HostIP6Gw
276 size += 4 // m.TapFlags
277 size += 1 // m.HostNamespaceSet
278 size += 64 // m.HostNamespace
279 size += 1 // m.HostIfNameSet
280 size += 64 // m.HostIfName
281 size += 1 // m.HostBridgeSet
282 size += 64 // m.HostBridge
283 size += 4 + len(m.Tag) // m.Tag
286 func (m *TapCreateV2) Marshal(b []byte) ([]byte, error) {
288 b = make([]byte, m.Size())
290 buf := codec.NewBuffer(b)
291 buf.EncodeUint32(m.ID)
292 buf.EncodeBool(m.UseRandomMac)
293 buf.EncodeBytes(m.MacAddress[:], 6)
294 buf.EncodeUint8(m.NumRxQueues)
295 buf.EncodeUint16(m.TxRingSz)
296 buf.EncodeUint16(m.RxRingSz)
297 buf.EncodeBool(m.HostMtuSet)
298 buf.EncodeUint32(m.HostMtuSize)
299 buf.EncodeBool(m.HostMacAddrSet)
300 buf.EncodeBytes(m.HostMacAddr[:], 6)
301 buf.EncodeBool(m.HostIP4PrefixSet)
302 buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4)
303 buf.EncodeUint8(m.HostIP4Prefix.Len)
304 buf.EncodeBool(m.HostIP6PrefixSet)
305 buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16)
306 buf.EncodeUint8(m.HostIP6Prefix.Len)
307 buf.EncodeBool(m.HostIP4GwSet)
308 buf.EncodeBytes(m.HostIP4Gw[:], 4)
309 buf.EncodeBool(m.HostIP6GwSet)
310 buf.EncodeBytes(m.HostIP6Gw[:], 16)
311 buf.EncodeUint32(uint32(m.TapFlags))
312 buf.EncodeBool(m.HostNamespaceSet)
313 buf.EncodeString(m.HostNamespace, 64)
314 buf.EncodeBool(m.HostIfNameSet)
315 buf.EncodeString(m.HostIfName, 64)
316 buf.EncodeBool(m.HostBridgeSet)
317 buf.EncodeString(m.HostBridge, 64)
318 buf.EncodeString(m.Tag, 0)
319 return buf.Bytes(), nil
321 func (m *TapCreateV2) Unmarshal(b []byte) error {
322 buf := codec.NewBuffer(b)
323 m.ID = buf.DecodeUint32()
324 m.UseRandomMac = buf.DecodeBool()
325 copy(m.MacAddress[:], buf.DecodeBytes(6))
326 m.NumRxQueues = buf.DecodeUint8()
327 m.TxRingSz = buf.DecodeUint16()
328 m.RxRingSz = buf.DecodeUint16()
329 m.HostMtuSet = buf.DecodeBool()
330 m.HostMtuSize = buf.DecodeUint32()
331 m.HostMacAddrSet = buf.DecodeBool()
332 copy(m.HostMacAddr[:], buf.DecodeBytes(6))
333 m.HostIP4PrefixSet = buf.DecodeBool()
334 copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4))
335 m.HostIP4Prefix.Len = buf.DecodeUint8()
336 m.HostIP6PrefixSet = buf.DecodeBool()
337 copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16))
338 m.HostIP6Prefix.Len = buf.DecodeUint8()
339 m.HostIP4GwSet = buf.DecodeBool()
340 copy(m.HostIP4Gw[:], buf.DecodeBytes(4))
341 m.HostIP6GwSet = buf.DecodeBool()
342 copy(m.HostIP6Gw[:], buf.DecodeBytes(16))
343 m.TapFlags = TapFlags(buf.DecodeUint32())
344 m.HostNamespaceSet = buf.DecodeBool()
345 m.HostNamespace = buf.DecodeString(64)
346 m.HostIfNameSet = buf.DecodeBool()
347 m.HostIfName = buf.DecodeString(64)
348 m.HostBridgeSet = buf.DecodeBool()
349 m.HostBridge = buf.DecodeString(64)
350 m.Tag = buf.DecodeString(0)
354 // TapCreateV2Reply defines message 'tap_create_v2_reply'.
355 type TapCreateV2Reply struct {
356 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
357 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
360 func (m *TapCreateV2Reply) Reset() { *m = TapCreateV2Reply{} }
361 func (*TapCreateV2Reply) GetMessageName() string { return "tap_create_v2_reply" }
362 func (*TapCreateV2Reply) GetCrcString() string { return "5383d31f" }
363 func (*TapCreateV2Reply) GetMessageType() api.MessageType {
364 return api.ReplyMessage
367 func (m *TapCreateV2Reply) Size() (size int) {
371 size += 4 // m.Retval
372 size += 4 // m.SwIfIndex
375 func (m *TapCreateV2Reply) Marshal(b []byte) ([]byte, error) {
377 b = make([]byte, m.Size())
379 buf := codec.NewBuffer(b)
380 buf.EncodeInt32(m.Retval)
381 buf.EncodeUint32(uint32(m.SwIfIndex))
382 return buf.Bytes(), nil
384 func (m *TapCreateV2Reply) Unmarshal(b []byte) error {
385 buf := codec.NewBuffer(b)
386 m.Retval = buf.DecodeInt32()
387 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
391 // TapDeleteV2 defines message 'tap_delete_v2'.
392 type TapDeleteV2 struct {
393 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
396 func (m *TapDeleteV2) Reset() { *m = TapDeleteV2{} }
397 func (*TapDeleteV2) GetMessageName() string { return "tap_delete_v2" }
398 func (*TapDeleteV2) GetCrcString() string { return "f9e6675e" }
399 func (*TapDeleteV2) GetMessageType() api.MessageType {
400 return api.RequestMessage
403 func (m *TapDeleteV2) Size() (size int) {
407 size += 4 // m.SwIfIndex
410 func (m *TapDeleteV2) Marshal(b []byte) ([]byte, error) {
412 b = make([]byte, m.Size())
414 buf := codec.NewBuffer(b)
415 buf.EncodeUint32(uint32(m.SwIfIndex))
416 return buf.Bytes(), nil
418 func (m *TapDeleteV2) Unmarshal(b []byte) error {
419 buf := codec.NewBuffer(b)
420 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
424 // TapDeleteV2Reply defines message 'tap_delete_v2_reply'.
425 type TapDeleteV2Reply struct {
426 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
429 func (m *TapDeleteV2Reply) Reset() { *m = TapDeleteV2Reply{} }
430 func (*TapDeleteV2Reply) GetMessageName() string { return "tap_delete_v2_reply" }
431 func (*TapDeleteV2Reply) GetCrcString() string { return "e8d4e804" }
432 func (*TapDeleteV2Reply) GetMessageType() api.MessageType {
433 return api.ReplyMessage
436 func (m *TapDeleteV2Reply) Size() (size int) {
440 size += 4 // m.Retval
443 func (m *TapDeleteV2Reply) Marshal(b []byte) ([]byte, error) {
445 b = make([]byte, m.Size())
447 buf := codec.NewBuffer(b)
448 buf.EncodeInt32(m.Retval)
449 return buf.Bytes(), nil
451 func (m *TapDeleteV2Reply) Unmarshal(b []byte) error {
452 buf := codec.NewBuffer(b)
453 m.Retval = buf.DecodeInt32()
457 func init() { file_tapv2_binapi_init() }
458 func file_tapv2_binapi_init() {
459 api.RegisterMessage((*SwInterfaceTapV2Details)(nil), "sw_interface_tap_v2_details_e53c16de")
460 api.RegisterMessage((*SwInterfaceTapV2Dump)(nil), "sw_interface_tap_v2_dump_f9e6675e")
461 api.RegisterMessage((*TapCreateV2)(nil), "tap_create_v2_445835fd")
462 api.RegisterMessage((*TapCreateV2Reply)(nil), "tap_create_v2_reply_5383d31f")
463 api.RegisterMessage((*TapDeleteV2)(nil), "tap_delete_v2_f9e6675e")
464 api.RegisterMessage((*TapDeleteV2Reply)(nil), "tap_delete_v2_reply_e8d4e804")
467 // Messages returns list of all messages in this module.
468 func AllMessages() []api.Message {
469 return []api.Message{
470 (*SwInterfaceTapV2Details)(nil),
471 (*SwInterfaceTapV2Dump)(nil),
473 (*TapCreateV2Reply)(nil),
475 (*TapDeleteV2Reply)(nil),