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.
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 = 0xc20c291f
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
47 TAP_API_FLAG_PACKED TapFlags = 64
48 TAP_API_FLAG_IN_ORDER TapFlags = 128
52 TapFlags_name = map[uint32]string{
53 1: "TAP_API_FLAG_GSO",
54 2: "TAP_API_FLAG_CSUM_OFFLOAD",
55 4: "TAP_API_FLAG_PERSIST",
56 8: "TAP_API_FLAG_ATTACH",
57 16: "TAP_API_FLAG_TUN",
58 32: "TAP_API_FLAG_GRO_COALESCE",
59 64: "TAP_API_FLAG_PACKED",
60 128: "TAP_API_FLAG_IN_ORDER",
62 TapFlags_value = map[string]uint32{
63 "TAP_API_FLAG_GSO": 1,
64 "TAP_API_FLAG_CSUM_OFFLOAD": 2,
65 "TAP_API_FLAG_PERSIST": 4,
66 "TAP_API_FLAG_ATTACH": 8,
67 "TAP_API_FLAG_TUN": 16,
68 "TAP_API_FLAG_GRO_COALESCE": 32,
69 "TAP_API_FLAG_PACKED": 64,
70 "TAP_API_FLAG_IN_ORDER": 128,
74 func (x TapFlags) String() string {
75 s, ok := TapFlags_name[uint32(x)]
79 str := func(n uint32) string {
80 s, ok := TapFlags_name[uint32(n)]
84 return "TapFlags(" + strconv.Itoa(int(n)) + ")"
86 for i := uint32(0); i <= 32; i++ {
101 // SwInterfaceTapV2Details defines message 'sw_interface_tap_v2_details'.
102 type SwInterfaceTapV2Details struct {
103 SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
104 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
105 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"`
106 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"`
107 HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"`
108 HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"`
109 HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"`
110 HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"`
111 TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"`
112 DevName string `binapi:"string[64],name=dev_name" json:"dev_name,omitempty"`
113 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
114 HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"`
115 HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"`
118 func (m *SwInterfaceTapV2Details) Reset() { *m = SwInterfaceTapV2Details{} }
119 func (*SwInterfaceTapV2Details) GetMessageName() string { return "sw_interface_tap_v2_details" }
120 func (*SwInterfaceTapV2Details) GetCrcString() string { return "1e2b2a47" }
121 func (*SwInterfaceTapV2Details) GetMessageType() api.MessageType {
122 return api.ReplyMessage
125 func (m *SwInterfaceTapV2Details) Size() (size int) {
129 size += 4 // m.SwIfIndex
131 size += 2 // m.TxRingSz
132 size += 2 // m.RxRingSz
133 size += 4 // m.HostMtuSize
134 size += 1 * 6 // m.HostMacAddr
135 size += 1 * 4 // m.HostIP4Prefix.Address
136 size += 1 // m.HostIP4Prefix.Len
137 size += 1 * 16 // m.HostIP6Prefix.Address
138 size += 1 // m.HostIP6Prefix.Len
139 size += 4 // m.TapFlags
140 size += 64 // m.DevName
141 size += 64 // m.HostIfName
142 size += 64 // m.HostNamespace
143 size += 64 // m.HostBridge
146 func (m *SwInterfaceTapV2Details) Marshal(b []byte) ([]byte, error) {
148 b = make([]byte, m.Size())
150 buf := codec.NewBuffer(b)
151 buf.EncodeUint32(m.SwIfIndex)
152 buf.EncodeUint32(m.ID)
153 buf.EncodeUint16(m.TxRingSz)
154 buf.EncodeUint16(m.RxRingSz)
155 buf.EncodeUint32(m.HostMtuSize)
156 buf.EncodeBytes(m.HostMacAddr[:], 6)
157 buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4)
158 buf.EncodeUint8(m.HostIP4Prefix.Len)
159 buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16)
160 buf.EncodeUint8(m.HostIP6Prefix.Len)
161 buf.EncodeUint32(uint32(m.TapFlags))
162 buf.EncodeString(m.DevName, 64)
163 buf.EncodeString(m.HostIfName, 64)
164 buf.EncodeString(m.HostNamespace, 64)
165 buf.EncodeString(m.HostBridge, 64)
166 return buf.Bytes(), nil
168 func (m *SwInterfaceTapV2Details) Unmarshal(b []byte) error {
169 buf := codec.NewBuffer(b)
170 m.SwIfIndex = buf.DecodeUint32()
171 m.ID = buf.DecodeUint32()
172 m.TxRingSz = buf.DecodeUint16()
173 m.RxRingSz = buf.DecodeUint16()
174 m.HostMtuSize = buf.DecodeUint32()
175 copy(m.HostMacAddr[:], buf.DecodeBytes(6))
176 copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4))
177 m.HostIP4Prefix.Len = buf.DecodeUint8()
178 copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16))
179 m.HostIP6Prefix.Len = buf.DecodeUint8()
180 m.TapFlags = TapFlags(buf.DecodeUint32())
181 m.DevName = buf.DecodeString(64)
182 m.HostIfName = buf.DecodeString(64)
183 m.HostNamespace = buf.DecodeString(64)
184 m.HostBridge = buf.DecodeString(64)
188 // SwInterfaceTapV2Dump defines message 'sw_interface_tap_v2_dump'.
189 type SwInterfaceTapV2Dump struct {
190 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
193 func (m *SwInterfaceTapV2Dump) Reset() { *m = SwInterfaceTapV2Dump{} }
194 func (*SwInterfaceTapV2Dump) GetMessageName() string { return "sw_interface_tap_v2_dump" }
195 func (*SwInterfaceTapV2Dump) GetCrcString() string { return "f9e6675e" }
196 func (*SwInterfaceTapV2Dump) GetMessageType() api.MessageType {
197 return api.RequestMessage
200 func (m *SwInterfaceTapV2Dump) Size() (size int) {
204 size += 4 // m.SwIfIndex
207 func (m *SwInterfaceTapV2Dump) Marshal(b []byte) ([]byte, error) {
209 b = make([]byte, m.Size())
211 buf := codec.NewBuffer(b)
212 buf.EncodeUint32(uint32(m.SwIfIndex))
213 return buf.Bytes(), nil
215 func (m *SwInterfaceTapV2Dump) Unmarshal(b []byte) error {
216 buf := codec.NewBuffer(b)
217 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
221 // TapCreateV2 defines message 'tap_create_v2'.
222 type TapCreateV2 struct {
223 ID uint32 `binapi:"u32,name=id,default=4294967295" json:"id,omitempty"`
224 UseRandomMac bool `binapi:"bool,name=use_random_mac,default=true" json:"use_random_mac,omitempty"`
225 MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
226 NumRxQueues uint8 `binapi:"u8,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"`
227 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz,default=256" json:"tx_ring_sz,omitempty"`
228 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz,default=256" json:"rx_ring_sz,omitempty"`
229 HostMtuSet bool `binapi:"bool,name=host_mtu_set" json:"host_mtu_set,omitempty"`
230 HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"`
231 HostMacAddrSet bool `binapi:"bool,name=host_mac_addr_set" json:"host_mac_addr_set,omitempty"`
232 HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"`
233 HostIP4PrefixSet bool `binapi:"bool,name=host_ip4_prefix_set" json:"host_ip4_prefix_set,omitempty"`
234 HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"`
235 HostIP6PrefixSet bool `binapi:"bool,name=host_ip6_prefix_set" json:"host_ip6_prefix_set,omitempty"`
236 HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"`
237 HostIP4GwSet bool `binapi:"bool,name=host_ip4_gw_set" json:"host_ip4_gw_set,omitempty"`
238 HostIP4Gw ip_types.IP4Address `binapi:"ip4_address,name=host_ip4_gw" json:"host_ip4_gw,omitempty"`
239 HostIP6GwSet bool `binapi:"bool,name=host_ip6_gw_set" json:"host_ip6_gw_set,omitempty"`
240 HostIP6Gw ip_types.IP6Address `binapi:"ip6_address,name=host_ip6_gw" json:"host_ip6_gw,omitempty"`
241 TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"`
242 HostNamespaceSet bool `binapi:"bool,name=host_namespace_set" json:"host_namespace_set,omitempty"`
243 HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"`
244 HostIfNameSet bool `binapi:"bool,name=host_if_name_set" json:"host_if_name_set,omitempty"`
245 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
246 HostBridgeSet bool `binapi:"bool,name=host_bridge_set" json:"host_bridge_set,omitempty"`
247 HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"`
248 Tag string `binapi:"string[],name=tag" json:"tag,omitempty"`
251 func (m *TapCreateV2) Reset() { *m = TapCreateV2{} }
252 func (*TapCreateV2) GetMessageName() string { return "tap_create_v2" }
253 func (*TapCreateV2) GetCrcString() string { return "2d0d6570" }
254 func (*TapCreateV2) GetMessageType() api.MessageType {
255 return api.RequestMessage
258 func (m *TapCreateV2) Size() (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) {
294 b = make([]byte, m.Size())
296 buf := codec.NewBuffer(b)
297 buf.EncodeUint32(m.ID)
298 buf.EncodeBool(m.UseRandomMac)
299 buf.EncodeBytes(m.MacAddress[:], 6)
300 buf.EncodeUint8(m.NumRxQueues)
301 buf.EncodeUint16(m.TxRingSz)
302 buf.EncodeUint16(m.RxRingSz)
303 buf.EncodeBool(m.HostMtuSet)
304 buf.EncodeUint32(m.HostMtuSize)
305 buf.EncodeBool(m.HostMacAddrSet)
306 buf.EncodeBytes(m.HostMacAddr[:], 6)
307 buf.EncodeBool(m.HostIP4PrefixSet)
308 buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4)
309 buf.EncodeUint8(m.HostIP4Prefix.Len)
310 buf.EncodeBool(m.HostIP6PrefixSet)
311 buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16)
312 buf.EncodeUint8(m.HostIP6Prefix.Len)
313 buf.EncodeBool(m.HostIP4GwSet)
314 buf.EncodeBytes(m.HostIP4Gw[:], 4)
315 buf.EncodeBool(m.HostIP6GwSet)
316 buf.EncodeBytes(m.HostIP6Gw[:], 16)
317 buf.EncodeUint32(uint32(m.TapFlags))
318 buf.EncodeBool(m.HostNamespaceSet)
319 buf.EncodeString(m.HostNamespace, 64)
320 buf.EncodeBool(m.HostIfNameSet)
321 buf.EncodeString(m.HostIfName, 64)
322 buf.EncodeBool(m.HostBridgeSet)
323 buf.EncodeString(m.HostBridge, 64)
324 buf.EncodeString(m.Tag, 0)
325 return buf.Bytes(), nil
327 func (m *TapCreateV2) Unmarshal(b []byte) error {
328 buf := codec.NewBuffer(b)
329 m.ID = buf.DecodeUint32()
330 m.UseRandomMac = buf.DecodeBool()
331 copy(m.MacAddress[:], buf.DecodeBytes(6))
332 m.NumRxQueues = buf.DecodeUint8()
333 m.TxRingSz = buf.DecodeUint16()
334 m.RxRingSz = buf.DecodeUint16()
335 m.HostMtuSet = buf.DecodeBool()
336 m.HostMtuSize = buf.DecodeUint32()
337 m.HostMacAddrSet = buf.DecodeBool()
338 copy(m.HostMacAddr[:], buf.DecodeBytes(6))
339 m.HostIP4PrefixSet = buf.DecodeBool()
340 copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4))
341 m.HostIP4Prefix.Len = buf.DecodeUint8()
342 m.HostIP6PrefixSet = buf.DecodeBool()
343 copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16))
344 m.HostIP6Prefix.Len = buf.DecodeUint8()
345 m.HostIP4GwSet = buf.DecodeBool()
346 copy(m.HostIP4Gw[:], buf.DecodeBytes(4))
347 m.HostIP6GwSet = buf.DecodeBool()
348 copy(m.HostIP6Gw[:], buf.DecodeBytes(16))
349 m.TapFlags = TapFlags(buf.DecodeUint32())
350 m.HostNamespaceSet = buf.DecodeBool()
351 m.HostNamespace = buf.DecodeString(64)
352 m.HostIfNameSet = buf.DecodeBool()
353 m.HostIfName = buf.DecodeString(64)
354 m.HostBridgeSet = buf.DecodeBool()
355 m.HostBridge = buf.DecodeString(64)
356 m.Tag = buf.DecodeString(0)
360 // TapCreateV2Reply defines message 'tap_create_v2_reply'.
361 type TapCreateV2Reply struct {
362 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
363 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
366 func (m *TapCreateV2Reply) Reset() { *m = TapCreateV2Reply{} }
367 func (*TapCreateV2Reply) GetMessageName() string { return "tap_create_v2_reply" }
368 func (*TapCreateV2Reply) GetCrcString() string { return "5383d31f" }
369 func (*TapCreateV2Reply) GetMessageType() api.MessageType {
370 return api.ReplyMessage
373 func (m *TapCreateV2Reply) Size() (size int) {
377 size += 4 // m.Retval
378 size += 4 // m.SwIfIndex
381 func (m *TapCreateV2Reply) Marshal(b []byte) ([]byte, error) {
383 b = make([]byte, m.Size())
385 buf := codec.NewBuffer(b)
386 buf.EncodeInt32(m.Retval)
387 buf.EncodeUint32(uint32(m.SwIfIndex))
388 return buf.Bytes(), nil
390 func (m *TapCreateV2Reply) Unmarshal(b []byte) error {
391 buf := codec.NewBuffer(b)
392 m.Retval = buf.DecodeInt32()
393 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
397 // TapDeleteV2 defines message 'tap_delete_v2'.
398 type TapDeleteV2 struct {
399 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
402 func (m *TapDeleteV2) Reset() { *m = TapDeleteV2{} }
403 func (*TapDeleteV2) GetMessageName() string { return "tap_delete_v2" }
404 func (*TapDeleteV2) GetCrcString() string { return "f9e6675e" }
405 func (*TapDeleteV2) GetMessageType() api.MessageType {
406 return api.RequestMessage
409 func (m *TapDeleteV2) Size() (size int) {
413 size += 4 // m.SwIfIndex
416 func (m *TapDeleteV2) Marshal(b []byte) ([]byte, error) {
418 b = make([]byte, m.Size())
420 buf := codec.NewBuffer(b)
421 buf.EncodeUint32(uint32(m.SwIfIndex))
422 return buf.Bytes(), nil
424 func (m *TapDeleteV2) Unmarshal(b []byte) error {
425 buf := codec.NewBuffer(b)
426 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
430 // TapDeleteV2Reply defines message 'tap_delete_v2_reply'.
431 type TapDeleteV2Reply struct {
432 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
435 func (m *TapDeleteV2Reply) Reset() { *m = TapDeleteV2Reply{} }
436 func (*TapDeleteV2Reply) GetMessageName() string { return "tap_delete_v2_reply" }
437 func (*TapDeleteV2Reply) GetCrcString() string { return "e8d4e804" }
438 func (*TapDeleteV2Reply) GetMessageType() api.MessageType {
439 return api.ReplyMessage
442 func (m *TapDeleteV2Reply) Size() (size int) {
446 size += 4 // m.Retval
449 func (m *TapDeleteV2Reply) Marshal(b []byte) ([]byte, error) {
451 b = make([]byte, m.Size())
453 buf := codec.NewBuffer(b)
454 buf.EncodeInt32(m.Retval)
455 return buf.Bytes(), nil
457 func (m *TapDeleteV2Reply) Unmarshal(b []byte) error {
458 buf := codec.NewBuffer(b)
459 m.Retval = buf.DecodeInt32()
463 func init() { file_tapv2_binapi_init() }
464 func file_tapv2_binapi_init() {
465 api.RegisterMessage((*SwInterfaceTapV2Details)(nil), "sw_interface_tap_v2_details_1e2b2a47")
466 api.RegisterMessage((*SwInterfaceTapV2Dump)(nil), "sw_interface_tap_v2_dump_f9e6675e")
467 api.RegisterMessage((*TapCreateV2)(nil), "tap_create_v2_2d0d6570")
468 api.RegisterMessage((*TapCreateV2Reply)(nil), "tap_create_v2_reply_5383d31f")
469 api.RegisterMessage((*TapDeleteV2)(nil), "tap_delete_v2_f9e6675e")
470 api.RegisterMessage((*TapDeleteV2Reply)(nil), "tap_delete_v2_reply_e8d4e804")
473 // Messages returns list of all messages in this module.
474 func AllMessages() []api.Message {
475 return []api.Message{
476 (*SwInterfaceTapV2Details)(nil),
477 (*SwInterfaceTapV2Dump)(nil),
479 (*TapCreateV2Reply)(nil),
481 (*TapDeleteV2Reply)(nil),