1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.4.0-dev
6 // Package tapv2 contains generated bindings for API file tapv2.api.
17 api "git.fd.io/govpp.git/api"
18 ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types"
19 interface_types "git.fd.io/govpp.git/binapi/interface_types"
20 ip_types "git.fd.io/govpp.git/binapi/ip_types"
21 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() (size int) {
122 size += 4 // m.SwIfIndex
124 size += 2 // m.TxRingSz
125 size += 2 // m.RxRingSz
126 size += 4 // m.HostMtuSize
127 size += 1 * 6 // m.HostMacAddr
128 size += 1 * 4 // m.HostIP4Prefix.Address
129 size += 1 // m.HostIP4Prefix.Len
130 size += 1 * 16 // m.HostIP6Prefix.Address
131 size += 1 // m.HostIP6Prefix.Len
132 size += 4 // m.TapFlags
133 size += 64 // m.DevName
134 size += 64 // m.HostIfName
135 size += 64 // m.HostNamespace
136 size += 64 // m.HostBridge
139 func (m *SwInterfaceTapV2Details) Marshal(b []byte) ([]byte, error) {
141 b = make([]byte, m.Size())
143 buf := codec.NewBuffer(b)
144 buf.EncodeUint32(m.SwIfIndex)
145 buf.EncodeUint32(m.ID)
146 buf.EncodeUint16(m.TxRingSz)
147 buf.EncodeUint16(m.RxRingSz)
148 buf.EncodeUint32(m.HostMtuSize)
149 buf.EncodeBytes(m.HostMacAddr[:], 6)
150 buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4)
151 buf.EncodeUint8(m.HostIP4Prefix.Len)
152 buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16)
153 buf.EncodeUint8(m.HostIP6Prefix.Len)
154 buf.EncodeUint32(uint32(m.TapFlags))
155 buf.EncodeString(m.DevName, 64)
156 buf.EncodeString(m.HostIfName, 64)
157 buf.EncodeString(m.HostNamespace, 64)
158 buf.EncodeString(m.HostBridge, 64)
159 return buf.Bytes(), nil
161 func (m *SwInterfaceTapV2Details) Unmarshal(b []byte) error {
162 buf := codec.NewBuffer(b)
163 m.SwIfIndex = buf.DecodeUint32()
164 m.ID = buf.DecodeUint32()
165 m.TxRingSz = buf.DecodeUint16()
166 m.RxRingSz = buf.DecodeUint16()
167 m.HostMtuSize = buf.DecodeUint32()
168 copy(m.HostMacAddr[:], buf.DecodeBytes(6))
169 copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4))
170 m.HostIP4Prefix.Len = buf.DecodeUint8()
171 copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16))
172 m.HostIP6Prefix.Len = buf.DecodeUint8()
173 m.TapFlags = TapFlags(buf.DecodeUint32())
174 m.DevName = buf.DecodeString(64)
175 m.HostIfName = buf.DecodeString(64)
176 m.HostNamespace = buf.DecodeString(64)
177 m.HostBridge = buf.DecodeString(64)
181 // SwInterfaceTapV2Dump defines message 'sw_interface_tap_v2_dump'.
182 type SwInterfaceTapV2Dump struct {
183 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
186 func (m *SwInterfaceTapV2Dump) Reset() { *m = SwInterfaceTapV2Dump{} }
187 func (*SwInterfaceTapV2Dump) GetMessageName() string { return "sw_interface_tap_v2_dump" }
188 func (*SwInterfaceTapV2Dump) GetCrcString() string { return "f9e6675e" }
189 func (*SwInterfaceTapV2Dump) GetMessageType() api.MessageType {
190 return api.RequestMessage
193 func (m *SwInterfaceTapV2Dump) Size() (size int) {
197 size += 4 // m.SwIfIndex
200 func (m *SwInterfaceTapV2Dump) Marshal(b []byte) ([]byte, error) {
202 b = make([]byte, m.Size())
204 buf := codec.NewBuffer(b)
205 buf.EncodeUint32(uint32(m.SwIfIndex))
206 return buf.Bytes(), nil
208 func (m *SwInterfaceTapV2Dump) Unmarshal(b []byte) error {
209 buf := codec.NewBuffer(b)
210 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
214 // TapCreateV2 defines message 'tap_create_v2'.
215 type TapCreateV2 struct {
216 ID uint32 `binapi:"u32,name=id,default=4294967295" json:"id,omitempty"`
217 UseRandomMac bool `binapi:"bool,name=use_random_mac,default=true" json:"use_random_mac,omitempty"`
218 MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
219 NumRxQueues uint8 `binapi:"u8,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"`
220 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz,default=256" json:"tx_ring_sz,omitempty"`
221 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz,default=256" json:"rx_ring_sz,omitempty"`
222 HostMtuSet bool `binapi:"bool,name=host_mtu_set" json:"host_mtu_set,omitempty"`
223 HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"`
224 HostMacAddrSet bool `binapi:"bool,name=host_mac_addr_set" json:"host_mac_addr_set,omitempty"`
225 HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"`
226 HostIP4PrefixSet bool `binapi:"bool,name=host_ip4_prefix_set" json:"host_ip4_prefix_set,omitempty"`
227 HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"`
228 HostIP6PrefixSet bool `binapi:"bool,name=host_ip6_prefix_set" json:"host_ip6_prefix_set,omitempty"`
229 HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"`
230 HostIP4GwSet bool `binapi:"bool,name=host_ip4_gw_set" json:"host_ip4_gw_set,omitempty"`
231 HostIP4Gw ip_types.IP4Address `binapi:"ip4_address,name=host_ip4_gw" json:"host_ip4_gw,omitempty"`
232 HostIP6GwSet bool `binapi:"bool,name=host_ip6_gw_set" json:"host_ip6_gw_set,omitempty"`
233 HostIP6Gw ip_types.IP6Address `binapi:"ip6_address,name=host_ip6_gw" json:"host_ip6_gw,omitempty"`
234 TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"`
235 HostNamespaceSet bool `binapi:"bool,name=host_namespace_set" json:"host_namespace_set,omitempty"`
236 HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"`
237 HostIfNameSet bool `binapi:"bool,name=host_if_name_set" json:"host_if_name_set,omitempty"`
238 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
239 HostBridgeSet bool `binapi:"bool,name=host_bridge_set" json:"host_bridge_set,omitempty"`
240 HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"`
241 Tag string `binapi:"string[],name=tag" json:"tag,omitempty"`
244 func (m *TapCreateV2) Reset() { *m = TapCreateV2{} }
245 func (*TapCreateV2) GetMessageName() string { return "tap_create_v2" }
246 func (*TapCreateV2) GetCrcString() string { return "445835fd" }
247 func (*TapCreateV2) GetMessageType() api.MessageType {
248 return api.RequestMessage
251 func (m *TapCreateV2) Size() (size int) {
256 size += 1 // m.UseRandomMac
257 size += 1 * 6 // m.MacAddress
258 size += 1 // m.NumRxQueues
259 size += 2 // m.TxRingSz
260 size += 2 // m.RxRingSz
261 size += 1 // m.HostMtuSet
262 size += 4 // m.HostMtuSize
263 size += 1 // m.HostMacAddrSet
264 size += 1 * 6 // m.HostMacAddr
265 size += 1 // m.HostIP4PrefixSet
266 size += 1 * 4 // m.HostIP4Prefix.Address
267 size += 1 // m.HostIP4Prefix.Len
268 size += 1 // m.HostIP6PrefixSet
269 size += 1 * 16 // m.HostIP6Prefix.Address
270 size += 1 // m.HostIP6Prefix.Len
271 size += 1 // m.HostIP4GwSet
272 size += 1 * 4 // m.HostIP4Gw
273 size += 1 // m.HostIP6GwSet
274 size += 1 * 16 // m.HostIP6Gw
275 size += 4 // m.TapFlags
276 size += 1 // m.HostNamespaceSet
277 size += 64 // m.HostNamespace
278 size += 1 // m.HostIfNameSet
279 size += 64 // m.HostIfName
280 size += 1 // m.HostBridgeSet
281 size += 64 // m.HostBridge
282 size += 4 + len(m.Tag) // m.Tag
285 func (m *TapCreateV2) Marshal(b []byte) ([]byte, error) {
287 b = make([]byte, m.Size())
289 buf := codec.NewBuffer(b)
290 buf.EncodeUint32(m.ID)
291 buf.EncodeBool(m.UseRandomMac)
292 buf.EncodeBytes(m.MacAddress[:], 6)
293 buf.EncodeUint8(m.NumRxQueues)
294 buf.EncodeUint16(m.TxRingSz)
295 buf.EncodeUint16(m.RxRingSz)
296 buf.EncodeBool(m.HostMtuSet)
297 buf.EncodeUint32(m.HostMtuSize)
298 buf.EncodeBool(m.HostMacAddrSet)
299 buf.EncodeBytes(m.HostMacAddr[:], 6)
300 buf.EncodeBool(m.HostIP4PrefixSet)
301 buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4)
302 buf.EncodeUint8(m.HostIP4Prefix.Len)
303 buf.EncodeBool(m.HostIP6PrefixSet)
304 buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16)
305 buf.EncodeUint8(m.HostIP6Prefix.Len)
306 buf.EncodeBool(m.HostIP4GwSet)
307 buf.EncodeBytes(m.HostIP4Gw[:], 4)
308 buf.EncodeBool(m.HostIP6GwSet)
309 buf.EncodeBytes(m.HostIP6Gw[:], 16)
310 buf.EncodeUint32(uint32(m.TapFlags))
311 buf.EncodeBool(m.HostNamespaceSet)
312 buf.EncodeString(m.HostNamespace, 64)
313 buf.EncodeBool(m.HostIfNameSet)
314 buf.EncodeString(m.HostIfName, 64)
315 buf.EncodeBool(m.HostBridgeSet)
316 buf.EncodeString(m.HostBridge, 64)
317 buf.EncodeString(m.Tag, 0)
318 return buf.Bytes(), nil
320 func (m *TapCreateV2) Unmarshal(b []byte) error {
321 buf := codec.NewBuffer(b)
322 m.ID = buf.DecodeUint32()
323 m.UseRandomMac = buf.DecodeBool()
324 copy(m.MacAddress[:], buf.DecodeBytes(6))
325 m.NumRxQueues = buf.DecodeUint8()
326 m.TxRingSz = buf.DecodeUint16()
327 m.RxRingSz = buf.DecodeUint16()
328 m.HostMtuSet = buf.DecodeBool()
329 m.HostMtuSize = buf.DecodeUint32()
330 m.HostMacAddrSet = buf.DecodeBool()
331 copy(m.HostMacAddr[:], buf.DecodeBytes(6))
332 m.HostIP4PrefixSet = buf.DecodeBool()
333 copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4))
334 m.HostIP4Prefix.Len = buf.DecodeUint8()
335 m.HostIP6PrefixSet = buf.DecodeBool()
336 copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16))
337 m.HostIP6Prefix.Len = buf.DecodeUint8()
338 m.HostIP4GwSet = buf.DecodeBool()
339 copy(m.HostIP4Gw[:], buf.DecodeBytes(4))
340 m.HostIP6GwSet = buf.DecodeBool()
341 copy(m.HostIP6Gw[:], buf.DecodeBytes(16))
342 m.TapFlags = TapFlags(buf.DecodeUint32())
343 m.HostNamespaceSet = buf.DecodeBool()
344 m.HostNamespace = buf.DecodeString(64)
345 m.HostIfNameSet = buf.DecodeBool()
346 m.HostIfName = buf.DecodeString(64)
347 m.HostBridgeSet = buf.DecodeBool()
348 m.HostBridge = buf.DecodeString(64)
349 m.Tag = buf.DecodeString(0)
353 // TapCreateV2Reply defines message 'tap_create_v2_reply'.
354 type TapCreateV2Reply struct {
355 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
356 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
359 func (m *TapCreateV2Reply) Reset() { *m = TapCreateV2Reply{} }
360 func (*TapCreateV2Reply) GetMessageName() string { return "tap_create_v2_reply" }
361 func (*TapCreateV2Reply) GetCrcString() string { return "5383d31f" }
362 func (*TapCreateV2Reply) GetMessageType() api.MessageType {
363 return api.ReplyMessage
366 func (m *TapCreateV2Reply) Size() (size int) {
370 size += 4 // m.Retval
371 size += 4 // m.SwIfIndex
374 func (m *TapCreateV2Reply) Marshal(b []byte) ([]byte, error) {
376 b = make([]byte, m.Size())
378 buf := codec.NewBuffer(b)
379 buf.EncodeInt32(m.Retval)
380 buf.EncodeUint32(uint32(m.SwIfIndex))
381 return buf.Bytes(), nil
383 func (m *TapCreateV2Reply) Unmarshal(b []byte) error {
384 buf := codec.NewBuffer(b)
385 m.Retval = buf.DecodeInt32()
386 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
390 // TapDeleteV2 defines message 'tap_delete_v2'.
391 type TapDeleteV2 struct {
392 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
395 func (m *TapDeleteV2) Reset() { *m = TapDeleteV2{} }
396 func (*TapDeleteV2) GetMessageName() string { return "tap_delete_v2" }
397 func (*TapDeleteV2) GetCrcString() string { return "f9e6675e" }
398 func (*TapDeleteV2) GetMessageType() api.MessageType {
399 return api.RequestMessage
402 func (m *TapDeleteV2) Size() (size int) {
406 size += 4 // m.SwIfIndex
409 func (m *TapDeleteV2) Marshal(b []byte) ([]byte, error) {
411 b = make([]byte, m.Size())
413 buf := codec.NewBuffer(b)
414 buf.EncodeUint32(uint32(m.SwIfIndex))
415 return buf.Bytes(), nil
417 func (m *TapDeleteV2) Unmarshal(b []byte) error {
418 buf := codec.NewBuffer(b)
419 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
423 // TapDeleteV2Reply defines message 'tap_delete_v2_reply'.
424 type TapDeleteV2Reply struct {
425 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
428 func (m *TapDeleteV2Reply) Reset() { *m = TapDeleteV2Reply{} }
429 func (*TapDeleteV2Reply) GetMessageName() string { return "tap_delete_v2_reply" }
430 func (*TapDeleteV2Reply) GetCrcString() string { return "e8d4e804" }
431 func (*TapDeleteV2Reply) GetMessageType() api.MessageType {
432 return api.ReplyMessage
435 func (m *TapDeleteV2Reply) Size() (size int) {
439 size += 4 // m.Retval
442 func (m *TapDeleteV2Reply) Marshal(b []byte) ([]byte, error) {
444 b = make([]byte, m.Size())
446 buf := codec.NewBuffer(b)
447 buf.EncodeInt32(m.Retval)
448 return buf.Bytes(), nil
450 func (m *TapDeleteV2Reply) Unmarshal(b []byte) error {
451 buf := codec.NewBuffer(b)
452 m.Retval = buf.DecodeInt32()
456 func init() { file_tapv2_binapi_init() }
457 func file_tapv2_binapi_init() {
458 api.RegisterMessage((*SwInterfaceTapV2Details)(nil), "sw_interface_tap_v2_details_e53c16de")
459 api.RegisterMessage((*SwInterfaceTapV2Dump)(nil), "sw_interface_tap_v2_dump_f9e6675e")
460 api.RegisterMessage((*TapCreateV2)(nil), "tap_create_v2_445835fd")
461 api.RegisterMessage((*TapCreateV2Reply)(nil), "tap_create_v2_reply_5383d31f")
462 api.RegisterMessage((*TapDeleteV2)(nil), "tap_delete_v2_f9e6675e")
463 api.RegisterMessage((*TapDeleteV2Reply)(nil), "tap_delete_v2_reply_e8d4e804")
466 // Messages returns list of all messages in this module.
467 func AllMessages() []api.Message {
468 return []api.Message{
469 (*SwInterfaceTapV2Details)(nil),
470 (*SwInterfaceTapV2Dump)(nil),
472 (*TapCreateV2Reply)(nil),
474 (*TapDeleteV2Reply)(nil),