1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.5.0-dev
5 // source: .vppapi/core/virtio.api.json
7 // Package virtio contains generated bindings for API file virtio.api.
21 api "git.fd.io/govpp.git/api"
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 = 0xb64fcf02
37 // IfStatusFlags defines enum 'if_status_flags'.
38 type IfStatusFlags uint32
41 IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
42 IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2
46 IfStatusFlags_name = map[uint32]string{
47 1: "IF_STATUS_API_FLAG_ADMIN_UP",
48 2: "IF_STATUS_API_FLAG_LINK_UP",
50 IfStatusFlags_value = map[string]uint32{
51 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
52 "IF_STATUS_API_FLAG_LINK_UP": 2,
56 func (x IfStatusFlags) String() string {
57 s, ok := IfStatusFlags_name[uint32(x)]
61 str := func(n uint32) string {
62 s, ok := IfStatusFlags_name[uint32(n)]
66 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
68 for i := uint32(0); i <= 32; i++ {
83 // IfType defines enum 'if_type'.
87 IF_API_TYPE_HARDWARE IfType = 1
88 IF_API_TYPE_SUB IfType = 2
89 IF_API_TYPE_P2P IfType = 3
90 IF_API_TYPE_PIPE IfType = 4
94 IfType_name = map[uint32]string{
95 1: "IF_API_TYPE_HARDWARE",
98 4: "IF_API_TYPE_PIPE",
100 IfType_value = map[string]uint32{
101 "IF_API_TYPE_HARDWARE": 1,
102 "IF_API_TYPE_SUB": 2,
103 "IF_API_TYPE_P2P": 3,
104 "IF_API_TYPE_PIPE": 4,
108 func (x IfType) String() string {
109 s, ok := IfType_name[uint32(x)]
113 return "IfType(" + strconv.Itoa(int(x)) + ")"
116 // LinkDuplex defines enum 'link_duplex'.
117 type LinkDuplex uint32
120 LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
121 LINK_DUPLEX_API_HALF LinkDuplex = 1
122 LINK_DUPLEX_API_FULL LinkDuplex = 2
126 LinkDuplex_name = map[uint32]string{
127 0: "LINK_DUPLEX_API_UNKNOWN",
128 1: "LINK_DUPLEX_API_HALF",
129 2: "LINK_DUPLEX_API_FULL",
131 LinkDuplex_value = map[string]uint32{
132 "LINK_DUPLEX_API_UNKNOWN": 0,
133 "LINK_DUPLEX_API_HALF": 1,
134 "LINK_DUPLEX_API_FULL": 2,
138 func (x LinkDuplex) String() string {
139 s, ok := LinkDuplex_name[uint32(x)]
143 return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
146 // MtuProto defines enum 'mtu_proto'.
150 MTU_PROTO_API_L3 MtuProto = 1
151 MTU_PROTO_API_IP4 MtuProto = 2
152 MTU_PROTO_API_IP6 MtuProto = 3
153 MTU_PROTO_API_MPLS MtuProto = 4
154 MTU_PROTO_API_N MtuProto = 5
158 MtuProto_name = map[uint32]string{
159 1: "MTU_PROTO_API_L3",
160 2: "MTU_PROTO_API_IP4",
161 3: "MTU_PROTO_API_IP6",
162 4: "MTU_PROTO_API_MPLS",
163 5: "MTU_PROTO_API_N",
165 MtuProto_value = map[string]uint32{
166 "MTU_PROTO_API_L3": 1,
167 "MTU_PROTO_API_IP4": 2,
168 "MTU_PROTO_API_IP6": 3,
169 "MTU_PROTO_API_MPLS": 4,
170 "MTU_PROTO_API_N": 5,
174 func (x MtuProto) String() string {
175 s, ok := MtuProto_name[uint32(x)]
179 return "MtuProto(" + strconv.Itoa(int(x)) + ")"
182 // RxMode defines enum 'rx_mode'.
186 RX_MODE_API_UNKNOWN RxMode = 0
187 RX_MODE_API_POLLING RxMode = 1
188 RX_MODE_API_INTERRUPT RxMode = 2
189 RX_MODE_API_ADAPTIVE RxMode = 3
190 RX_MODE_API_DEFAULT RxMode = 4
194 RxMode_name = map[uint32]string{
195 0: "RX_MODE_API_UNKNOWN",
196 1: "RX_MODE_API_POLLING",
197 2: "RX_MODE_API_INTERRUPT",
198 3: "RX_MODE_API_ADAPTIVE",
199 4: "RX_MODE_API_DEFAULT",
201 RxMode_value = map[string]uint32{
202 "RX_MODE_API_UNKNOWN": 0,
203 "RX_MODE_API_POLLING": 1,
204 "RX_MODE_API_INTERRUPT": 2,
205 "RX_MODE_API_ADAPTIVE": 3,
206 "RX_MODE_API_DEFAULT": 4,
210 func (x RxMode) String() string {
211 s, ok := RxMode_name[uint32(x)]
215 return "RxMode(" + strconv.Itoa(int(x)) + ")"
218 // SubIfFlags defines enum 'sub_if_flags'.
219 type SubIfFlags uint32
222 SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1
223 SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2
224 SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4
225 SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8
226 SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16
227 SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32
228 SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
229 SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
230 SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254
231 SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256
235 SubIfFlags_name = map[uint32]string{
236 1: "SUB_IF_API_FLAG_NO_TAGS",
237 2: "SUB_IF_API_FLAG_ONE_TAG",
238 4: "SUB_IF_API_FLAG_TWO_TAGS",
239 8: "SUB_IF_API_FLAG_DOT1AD",
240 16: "SUB_IF_API_FLAG_EXACT_MATCH",
241 32: "SUB_IF_API_FLAG_DEFAULT",
242 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
243 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
244 254: "SUB_IF_API_FLAG_MASK_VNET",
245 256: "SUB_IF_API_FLAG_DOT1AH",
247 SubIfFlags_value = map[string]uint32{
248 "SUB_IF_API_FLAG_NO_TAGS": 1,
249 "SUB_IF_API_FLAG_ONE_TAG": 2,
250 "SUB_IF_API_FLAG_TWO_TAGS": 4,
251 "SUB_IF_API_FLAG_DOT1AD": 8,
252 "SUB_IF_API_FLAG_EXACT_MATCH": 16,
253 "SUB_IF_API_FLAG_DEFAULT": 32,
254 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
255 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
256 "SUB_IF_API_FLAG_MASK_VNET": 254,
257 "SUB_IF_API_FLAG_DOT1AH": 256,
261 func (x SubIfFlags) String() string {
262 s, ok := SubIfFlags_name[uint32(x)]
266 str := func(n uint32) string {
267 s, ok := SubIfFlags_name[uint32(n)]
271 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
273 for i := uint32(0); i <= 32; i++ {
283 return str(uint32(x))
288 // InterfaceIndex defines alias 'interface_index'.
289 type InterfaceIndex uint32
291 // MacAddress defines alias 'mac_address'.
292 type MacAddress [6]uint8
294 func ParseMacAddress(s string) (MacAddress, error) {
295 var macaddr MacAddress
296 mac, err := net.ParseMAC(s)
300 copy(macaddr[:], mac[:])
304 func (x MacAddress) ToMAC() net.HardwareAddr {
305 return net.HardwareAddr(x[:])
308 func (x MacAddress) String() string {
309 return x.ToMAC().String()
312 func (x *MacAddress) MarshalText() ([]byte, error) {
313 return []byte(x.String()), nil
316 func (x *MacAddress) UnmarshalText(text []byte) error {
317 mac, err := ParseMacAddress(string(text))
325 // PciAddress defines type 'pci_address'.
326 type PciAddress struct {
327 Domain uint16 `binapi:"u16,name=domain" json:"domain,omitempty"`
328 Bus uint8 `binapi:"u8,name=bus" json:"bus,omitempty"`
329 Slot uint8 `binapi:"u8,name=slot" json:"slot,omitempty"`
330 Function uint8 `binapi:"u8,name=function" json:"function,omitempty"`
333 // SwInterfaceVirtioPciDetails defines message 'sw_interface_virtio_pci_details'.
334 type SwInterfaceVirtioPciDetails struct {
335 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
336 PciAddr PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"`
337 MacAddr MacAddress `binapi:"mac_address,name=mac_addr" json:"mac_addr,omitempty"`
338 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"`
339 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"`
340 Features uint64 `binapi:"u64,name=features" json:"features,omitempty"`
343 func (m *SwInterfaceVirtioPciDetails) Reset() { *m = SwInterfaceVirtioPciDetails{} }
344 func (*SwInterfaceVirtioPciDetails) GetMessageName() string { return "sw_interface_virtio_pci_details" }
345 func (*SwInterfaceVirtioPciDetails) GetCrcString() string { return "16187f3a" }
346 func (*SwInterfaceVirtioPciDetails) GetMessageType() api.MessageType {
347 return api.ReplyMessage
350 func (m *SwInterfaceVirtioPciDetails) Size() (size int) {
354 size += 4 // m.SwIfIndex
355 size += 2 // m.PciAddr.Domain
356 size += 1 // m.PciAddr.Bus
357 size += 1 // m.PciAddr.Slot
358 size += 1 // m.PciAddr.Function
359 size += 1 * 6 // m.MacAddr
360 size += 2 // m.TxRingSz
361 size += 2 // m.RxRingSz
362 size += 8 // m.Features
365 func (m *SwInterfaceVirtioPciDetails) Marshal(b []byte) ([]byte, error) {
367 b = make([]byte, m.Size())
369 buf := codec.NewBuffer(b)
370 buf.EncodeUint32(uint32(m.SwIfIndex))
371 buf.EncodeUint16(m.PciAddr.Domain)
372 buf.EncodeUint8(m.PciAddr.Bus)
373 buf.EncodeUint8(m.PciAddr.Slot)
374 buf.EncodeUint8(m.PciAddr.Function)
375 buf.EncodeBytes(m.MacAddr[:], 6)
376 buf.EncodeUint16(m.TxRingSz)
377 buf.EncodeUint16(m.RxRingSz)
378 buf.EncodeUint64(m.Features)
379 return buf.Bytes(), nil
381 func (m *SwInterfaceVirtioPciDetails) Unmarshal(b []byte) error {
382 buf := codec.NewBuffer(b)
383 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
384 m.PciAddr.Domain = buf.DecodeUint16()
385 m.PciAddr.Bus = buf.DecodeUint8()
386 m.PciAddr.Slot = buf.DecodeUint8()
387 m.PciAddr.Function = buf.DecodeUint8()
388 copy(m.MacAddr[:], buf.DecodeBytes(6))
389 m.TxRingSz = buf.DecodeUint16()
390 m.RxRingSz = buf.DecodeUint16()
391 m.Features = buf.DecodeUint64()
395 // SwInterfaceVirtioPciDump defines message 'sw_interface_virtio_pci_dump'.
396 type SwInterfaceVirtioPciDump struct{}
398 func (m *SwInterfaceVirtioPciDump) Reset() { *m = SwInterfaceVirtioPciDump{} }
399 func (*SwInterfaceVirtioPciDump) GetMessageName() string { return "sw_interface_virtio_pci_dump" }
400 func (*SwInterfaceVirtioPciDump) GetCrcString() string { return "51077d14" }
401 func (*SwInterfaceVirtioPciDump) GetMessageType() api.MessageType {
402 return api.RequestMessage
405 func (m *SwInterfaceVirtioPciDump) Size() (size int) {
411 func (m *SwInterfaceVirtioPciDump) Marshal(b []byte) ([]byte, error) {
413 b = make([]byte, m.Size())
415 buf := codec.NewBuffer(b)
416 return buf.Bytes(), nil
418 func (m *SwInterfaceVirtioPciDump) Unmarshal(b []byte) error {
422 // VirtioPciCreate defines message 'virtio_pci_create'.
423 type VirtioPciCreate struct {
424 PciAddr PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"`
425 UseRandomMac bool `binapi:"bool,name=use_random_mac" json:"use_random_mac,omitempty"`
426 MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
427 GsoEnabled bool `binapi:"bool,name=gso_enabled" json:"gso_enabled,omitempty"`
428 ChecksumOffloadEnabled bool `binapi:"bool,name=checksum_offload_enabled" json:"checksum_offload_enabled,omitempty"`
429 Features uint64 `binapi:"u64,name=features" json:"features,omitempty"`
432 func (m *VirtioPciCreate) Reset() { *m = VirtioPciCreate{} }
433 func (*VirtioPciCreate) GetMessageName() string { return "virtio_pci_create" }
434 func (*VirtioPciCreate) GetCrcString() string { return "a9f1370c" }
435 func (*VirtioPciCreate) GetMessageType() api.MessageType {
436 return api.RequestMessage
439 func (m *VirtioPciCreate) Size() (size int) {
443 size += 2 // m.PciAddr.Domain
444 size += 1 // m.PciAddr.Bus
445 size += 1 // m.PciAddr.Slot
446 size += 1 // m.PciAddr.Function
447 size += 1 // m.UseRandomMac
448 size += 1 * 6 // m.MacAddress
449 size += 1 // m.GsoEnabled
450 size += 1 // m.ChecksumOffloadEnabled
451 size += 8 // m.Features
454 func (m *VirtioPciCreate) Marshal(b []byte) ([]byte, error) {
456 b = make([]byte, m.Size())
458 buf := codec.NewBuffer(b)
459 buf.EncodeUint16(m.PciAddr.Domain)
460 buf.EncodeUint8(m.PciAddr.Bus)
461 buf.EncodeUint8(m.PciAddr.Slot)
462 buf.EncodeUint8(m.PciAddr.Function)
463 buf.EncodeBool(m.UseRandomMac)
464 buf.EncodeBytes(m.MacAddress[:], 6)
465 buf.EncodeBool(m.GsoEnabled)
466 buf.EncodeBool(m.ChecksumOffloadEnabled)
467 buf.EncodeUint64(m.Features)
468 return buf.Bytes(), nil
470 func (m *VirtioPciCreate) Unmarshal(b []byte) error {
471 buf := codec.NewBuffer(b)
472 m.PciAddr.Domain = buf.DecodeUint16()
473 m.PciAddr.Bus = buf.DecodeUint8()
474 m.PciAddr.Slot = buf.DecodeUint8()
475 m.PciAddr.Function = buf.DecodeUint8()
476 m.UseRandomMac = buf.DecodeBool()
477 copy(m.MacAddress[:], buf.DecodeBytes(6))
478 m.GsoEnabled = buf.DecodeBool()
479 m.ChecksumOffloadEnabled = buf.DecodeBool()
480 m.Features = buf.DecodeUint64()
484 // VirtioPciCreateReply defines message 'virtio_pci_create_reply'.
485 type VirtioPciCreateReply struct {
486 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
487 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
490 func (m *VirtioPciCreateReply) Reset() { *m = VirtioPciCreateReply{} }
491 func (*VirtioPciCreateReply) GetMessageName() string { return "virtio_pci_create_reply" }
492 func (*VirtioPciCreateReply) GetCrcString() string { return "5383d31f" }
493 func (*VirtioPciCreateReply) GetMessageType() api.MessageType {
494 return api.ReplyMessage
497 func (m *VirtioPciCreateReply) Size() (size int) {
501 size += 4 // m.Retval
502 size += 4 // m.SwIfIndex
505 func (m *VirtioPciCreateReply) Marshal(b []byte) ([]byte, error) {
507 b = make([]byte, m.Size())
509 buf := codec.NewBuffer(b)
510 buf.EncodeInt32(m.Retval)
511 buf.EncodeUint32(uint32(m.SwIfIndex))
512 return buf.Bytes(), nil
514 func (m *VirtioPciCreateReply) Unmarshal(b []byte) error {
515 buf := codec.NewBuffer(b)
516 m.Retval = buf.DecodeInt32()
517 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
521 // VirtioPciDelete defines message 'virtio_pci_delete'.
522 type VirtioPciDelete struct {
523 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
526 func (m *VirtioPciDelete) Reset() { *m = VirtioPciDelete{} }
527 func (*VirtioPciDelete) GetMessageName() string { return "virtio_pci_delete" }
528 func (*VirtioPciDelete) GetCrcString() string { return "f9e6675e" }
529 func (*VirtioPciDelete) GetMessageType() api.MessageType {
530 return api.RequestMessage
533 func (m *VirtioPciDelete) Size() (size int) {
537 size += 4 // m.SwIfIndex
540 func (m *VirtioPciDelete) Marshal(b []byte) ([]byte, error) {
542 b = make([]byte, m.Size())
544 buf := codec.NewBuffer(b)
545 buf.EncodeUint32(uint32(m.SwIfIndex))
546 return buf.Bytes(), nil
548 func (m *VirtioPciDelete) Unmarshal(b []byte) error {
549 buf := codec.NewBuffer(b)
550 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
554 // VirtioPciDeleteReply defines message 'virtio_pci_delete_reply'.
555 type VirtioPciDeleteReply struct {
556 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
559 func (m *VirtioPciDeleteReply) Reset() { *m = VirtioPciDeleteReply{} }
560 func (*VirtioPciDeleteReply) GetMessageName() string { return "virtio_pci_delete_reply" }
561 func (*VirtioPciDeleteReply) GetCrcString() string { return "e8d4e804" }
562 func (*VirtioPciDeleteReply) GetMessageType() api.MessageType {
563 return api.ReplyMessage
566 func (m *VirtioPciDeleteReply) Size() (size int) {
570 size += 4 // m.Retval
573 func (m *VirtioPciDeleteReply) Marshal(b []byte) ([]byte, error) {
575 b = make([]byte, m.Size())
577 buf := codec.NewBuffer(b)
578 buf.EncodeInt32(m.Retval)
579 return buf.Bytes(), nil
581 func (m *VirtioPciDeleteReply) Unmarshal(b []byte) error {
582 buf := codec.NewBuffer(b)
583 m.Retval = buf.DecodeInt32()
587 func init() { file_virtio_binapi_init() }
588 func file_virtio_binapi_init() {
589 api.RegisterMessage((*SwInterfaceVirtioPciDetails)(nil), "sw_interface_virtio_pci_details_16187f3a")
590 api.RegisterMessage((*SwInterfaceVirtioPciDump)(nil), "sw_interface_virtio_pci_dump_51077d14")
591 api.RegisterMessage((*VirtioPciCreate)(nil), "virtio_pci_create_a9f1370c")
592 api.RegisterMessage((*VirtioPciCreateReply)(nil), "virtio_pci_create_reply_5383d31f")
593 api.RegisterMessage((*VirtioPciDelete)(nil), "virtio_pci_delete_f9e6675e")
594 api.RegisterMessage((*VirtioPciDeleteReply)(nil), "virtio_pci_delete_reply_e8d4e804")
597 // Messages returns list of all messages in this module.
598 func AllMessages() []api.Message {
599 return []api.Message{
600 (*SwInterfaceVirtioPciDetails)(nil),
601 (*SwInterfaceVirtioPciDump)(nil),
602 (*VirtioPciCreate)(nil),
603 (*VirtioPciCreateReply)(nil),
604 (*VirtioPciDelete)(nil),
605 (*VirtioPciDeleteReply)(nil),