1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.4.0-dev
5 // source: .vppapi/core/virtio.api.json
7 // Package virtio contains generated bindings for API file virtio.api.
18 api "git.fd.io/govpp.git/api"
19 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 = 0xb64fcf02
36 // IfStatusFlags defines enum 'if_status_flags'.
37 type IfStatusFlags uint32
40 IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
41 IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2
45 IfStatusFlags_name = map[uint32]string{
46 1: "IF_STATUS_API_FLAG_ADMIN_UP",
47 2: "IF_STATUS_API_FLAG_LINK_UP",
49 IfStatusFlags_value = map[string]uint32{
50 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
51 "IF_STATUS_API_FLAG_LINK_UP": 2,
55 func (x IfStatusFlags) String() string {
56 s, ok := IfStatusFlags_name[uint32(x)]
60 str := func(n uint32) string {
61 s, ok := IfStatusFlags_name[uint32(n)]
65 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
67 for i := uint32(0); i <= 32; i++ {
82 // IfType defines enum 'if_type'.
86 IF_API_TYPE_HARDWARE IfType = 1
87 IF_API_TYPE_SUB IfType = 2
88 IF_API_TYPE_P2P IfType = 3
89 IF_API_TYPE_PIPE IfType = 4
93 IfType_name = map[uint32]string{
94 1: "IF_API_TYPE_HARDWARE",
97 4: "IF_API_TYPE_PIPE",
99 IfType_value = map[string]uint32{
100 "IF_API_TYPE_HARDWARE": 1,
101 "IF_API_TYPE_SUB": 2,
102 "IF_API_TYPE_P2P": 3,
103 "IF_API_TYPE_PIPE": 4,
107 func (x IfType) String() string {
108 s, ok := IfType_name[uint32(x)]
112 return "IfType(" + strconv.Itoa(int(x)) + ")"
115 // LinkDuplex defines enum 'link_duplex'.
116 type LinkDuplex uint32
119 LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
120 LINK_DUPLEX_API_HALF LinkDuplex = 1
121 LINK_DUPLEX_API_FULL LinkDuplex = 2
125 LinkDuplex_name = map[uint32]string{
126 0: "LINK_DUPLEX_API_UNKNOWN",
127 1: "LINK_DUPLEX_API_HALF",
128 2: "LINK_DUPLEX_API_FULL",
130 LinkDuplex_value = map[string]uint32{
131 "LINK_DUPLEX_API_UNKNOWN": 0,
132 "LINK_DUPLEX_API_HALF": 1,
133 "LINK_DUPLEX_API_FULL": 2,
137 func (x LinkDuplex) String() string {
138 s, ok := LinkDuplex_name[uint32(x)]
142 return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
145 // MtuProto defines enum 'mtu_proto'.
149 MTU_PROTO_API_L3 MtuProto = 1
150 MTU_PROTO_API_IP4 MtuProto = 2
151 MTU_PROTO_API_IP6 MtuProto = 3
152 MTU_PROTO_API_MPLS MtuProto = 4
153 MTU_PROTO_API_N MtuProto = 5
157 MtuProto_name = map[uint32]string{
158 1: "MTU_PROTO_API_L3",
159 2: "MTU_PROTO_API_IP4",
160 3: "MTU_PROTO_API_IP6",
161 4: "MTU_PROTO_API_MPLS",
162 5: "MTU_PROTO_API_N",
164 MtuProto_value = map[string]uint32{
165 "MTU_PROTO_API_L3": 1,
166 "MTU_PROTO_API_IP4": 2,
167 "MTU_PROTO_API_IP6": 3,
168 "MTU_PROTO_API_MPLS": 4,
169 "MTU_PROTO_API_N": 5,
173 func (x MtuProto) String() string {
174 s, ok := MtuProto_name[uint32(x)]
178 return "MtuProto(" + strconv.Itoa(int(x)) + ")"
181 // RxMode defines enum 'rx_mode'.
185 RX_MODE_API_UNKNOWN RxMode = 0
186 RX_MODE_API_POLLING RxMode = 1
187 RX_MODE_API_INTERRUPT RxMode = 2
188 RX_MODE_API_ADAPTIVE RxMode = 3
189 RX_MODE_API_DEFAULT RxMode = 4
193 RxMode_name = map[uint32]string{
194 0: "RX_MODE_API_UNKNOWN",
195 1: "RX_MODE_API_POLLING",
196 2: "RX_MODE_API_INTERRUPT",
197 3: "RX_MODE_API_ADAPTIVE",
198 4: "RX_MODE_API_DEFAULT",
200 RxMode_value = map[string]uint32{
201 "RX_MODE_API_UNKNOWN": 0,
202 "RX_MODE_API_POLLING": 1,
203 "RX_MODE_API_INTERRUPT": 2,
204 "RX_MODE_API_ADAPTIVE": 3,
205 "RX_MODE_API_DEFAULT": 4,
209 func (x RxMode) String() string {
210 s, ok := RxMode_name[uint32(x)]
214 return "RxMode(" + strconv.Itoa(int(x)) + ")"
217 // SubIfFlags defines enum 'sub_if_flags'.
218 type SubIfFlags uint32
221 SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1
222 SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2
223 SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4
224 SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8
225 SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16
226 SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32
227 SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
228 SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
229 SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254
230 SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256
234 SubIfFlags_name = map[uint32]string{
235 1: "SUB_IF_API_FLAG_NO_TAGS",
236 2: "SUB_IF_API_FLAG_ONE_TAG",
237 4: "SUB_IF_API_FLAG_TWO_TAGS",
238 8: "SUB_IF_API_FLAG_DOT1AD",
239 16: "SUB_IF_API_FLAG_EXACT_MATCH",
240 32: "SUB_IF_API_FLAG_DEFAULT",
241 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
242 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
243 254: "SUB_IF_API_FLAG_MASK_VNET",
244 256: "SUB_IF_API_FLAG_DOT1AH",
246 SubIfFlags_value = map[string]uint32{
247 "SUB_IF_API_FLAG_NO_TAGS": 1,
248 "SUB_IF_API_FLAG_ONE_TAG": 2,
249 "SUB_IF_API_FLAG_TWO_TAGS": 4,
250 "SUB_IF_API_FLAG_DOT1AD": 8,
251 "SUB_IF_API_FLAG_EXACT_MATCH": 16,
252 "SUB_IF_API_FLAG_DEFAULT": 32,
253 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
254 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
255 "SUB_IF_API_FLAG_MASK_VNET": 254,
256 "SUB_IF_API_FLAG_DOT1AH": 256,
260 func (x SubIfFlags) String() string {
261 s, ok := SubIfFlags_name[uint32(x)]
265 str := func(n uint32) string {
266 s, ok := SubIfFlags_name[uint32(n)]
270 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
272 for i := uint32(0); i <= 32; i++ {
282 return str(uint32(x))
287 // InterfaceIndex defines alias 'interface_index'.
288 type InterfaceIndex uint32
290 // MacAddress defines alias 'mac_address'.
291 type MacAddress [6]uint8
293 func ParseMacAddress(s string) (MacAddress, error) {
294 var macaddr MacAddress
295 mac, err := net.ParseMAC(s)
299 copy(macaddr[:], mac[:])
302 func (x MacAddress) ToMAC() net.HardwareAddr {
303 return net.HardwareAddr(x[:])
305 func (x MacAddress) String() string {
306 return x.ToMAC().String()
308 func (x *MacAddress) MarshalText() ([]byte, error) {
309 return []byte(x.String()), nil
311 func (x *MacAddress) UnmarshalText(text []byte) error {
312 mac, err := ParseMacAddress(string(text))
320 // PciAddress defines type 'pci_address'.
321 type PciAddress struct {
322 Domain uint16 `binapi:"u16,name=domain" json:"domain,omitempty"`
323 Bus uint8 `binapi:"u8,name=bus" json:"bus,omitempty"`
324 Slot uint8 `binapi:"u8,name=slot" json:"slot,omitempty"`
325 Function uint8 `binapi:"u8,name=function" json:"function,omitempty"`
328 // SwInterfaceVirtioPciDetails defines message 'sw_interface_virtio_pci_details'.
329 type SwInterfaceVirtioPciDetails struct {
330 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
331 PciAddr PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"`
332 MacAddr MacAddress `binapi:"mac_address,name=mac_addr" json:"mac_addr,omitempty"`
333 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"`
334 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"`
335 Features uint64 `binapi:"u64,name=features" json:"features,omitempty"`
338 func (m *SwInterfaceVirtioPciDetails) Reset() { *m = SwInterfaceVirtioPciDetails{} }
339 func (*SwInterfaceVirtioPciDetails) GetMessageName() string { return "sw_interface_virtio_pci_details" }
340 func (*SwInterfaceVirtioPciDetails) GetCrcString() string { return "16187f3a" }
341 func (*SwInterfaceVirtioPciDetails) GetMessageType() api.MessageType {
342 return api.ReplyMessage
345 func (m *SwInterfaceVirtioPciDetails) Size() (size int) {
349 size += 4 // m.SwIfIndex
350 size += 2 // m.PciAddr.Domain
351 size += 1 // m.PciAddr.Bus
352 size += 1 // m.PciAddr.Slot
353 size += 1 // m.PciAddr.Function
354 size += 1 * 6 // m.MacAddr
355 size += 2 // m.TxRingSz
356 size += 2 // m.RxRingSz
357 size += 8 // m.Features
360 func (m *SwInterfaceVirtioPciDetails) Marshal(b []byte) ([]byte, error) {
362 b = make([]byte, m.Size())
364 buf := codec.NewBuffer(b)
365 buf.EncodeUint32(uint32(m.SwIfIndex))
366 buf.EncodeUint16(m.PciAddr.Domain)
367 buf.EncodeUint8(m.PciAddr.Bus)
368 buf.EncodeUint8(m.PciAddr.Slot)
369 buf.EncodeUint8(m.PciAddr.Function)
370 buf.EncodeBytes(m.MacAddr[:], 6)
371 buf.EncodeUint16(m.TxRingSz)
372 buf.EncodeUint16(m.RxRingSz)
373 buf.EncodeUint64(m.Features)
374 return buf.Bytes(), nil
376 func (m *SwInterfaceVirtioPciDetails) Unmarshal(b []byte) error {
377 buf := codec.NewBuffer(b)
378 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
379 m.PciAddr.Domain = buf.DecodeUint16()
380 m.PciAddr.Bus = buf.DecodeUint8()
381 m.PciAddr.Slot = buf.DecodeUint8()
382 m.PciAddr.Function = buf.DecodeUint8()
383 copy(m.MacAddr[:], buf.DecodeBytes(6))
384 m.TxRingSz = buf.DecodeUint16()
385 m.RxRingSz = buf.DecodeUint16()
386 m.Features = buf.DecodeUint64()
390 // SwInterfaceVirtioPciDump defines message 'sw_interface_virtio_pci_dump'.
391 type SwInterfaceVirtioPciDump struct{}
393 func (m *SwInterfaceVirtioPciDump) Reset() { *m = SwInterfaceVirtioPciDump{} }
394 func (*SwInterfaceVirtioPciDump) GetMessageName() string { return "sw_interface_virtio_pci_dump" }
395 func (*SwInterfaceVirtioPciDump) GetCrcString() string { return "51077d14" }
396 func (*SwInterfaceVirtioPciDump) GetMessageType() api.MessageType {
397 return api.RequestMessage
400 func (m *SwInterfaceVirtioPciDump) Size() (size int) {
406 func (m *SwInterfaceVirtioPciDump) Marshal(b []byte) ([]byte, error) {
408 b = make([]byte, m.Size())
410 buf := codec.NewBuffer(b)
411 return buf.Bytes(), nil
413 func (m *SwInterfaceVirtioPciDump) Unmarshal(b []byte) error {
417 // VirtioPciCreate defines message 'virtio_pci_create'.
418 type VirtioPciCreate struct {
419 PciAddr PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"`
420 UseRandomMac bool `binapi:"bool,name=use_random_mac" json:"use_random_mac,omitempty"`
421 MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
422 GsoEnabled bool `binapi:"bool,name=gso_enabled" json:"gso_enabled,omitempty"`
423 ChecksumOffloadEnabled bool `binapi:"bool,name=checksum_offload_enabled" json:"checksum_offload_enabled,omitempty"`
424 Features uint64 `binapi:"u64,name=features" json:"features,omitempty"`
427 func (m *VirtioPciCreate) Reset() { *m = VirtioPciCreate{} }
428 func (*VirtioPciCreate) GetMessageName() string { return "virtio_pci_create" }
429 func (*VirtioPciCreate) GetCrcString() string { return "a9f1370c" }
430 func (*VirtioPciCreate) GetMessageType() api.MessageType {
431 return api.RequestMessage
434 func (m *VirtioPciCreate) Size() (size int) {
438 size += 2 // m.PciAddr.Domain
439 size += 1 // m.PciAddr.Bus
440 size += 1 // m.PciAddr.Slot
441 size += 1 // m.PciAddr.Function
442 size += 1 // m.UseRandomMac
443 size += 1 * 6 // m.MacAddress
444 size += 1 // m.GsoEnabled
445 size += 1 // m.ChecksumOffloadEnabled
446 size += 8 // m.Features
449 func (m *VirtioPciCreate) Marshal(b []byte) ([]byte, error) {
451 b = make([]byte, m.Size())
453 buf := codec.NewBuffer(b)
454 buf.EncodeUint16(m.PciAddr.Domain)
455 buf.EncodeUint8(m.PciAddr.Bus)
456 buf.EncodeUint8(m.PciAddr.Slot)
457 buf.EncodeUint8(m.PciAddr.Function)
458 buf.EncodeBool(m.UseRandomMac)
459 buf.EncodeBytes(m.MacAddress[:], 6)
460 buf.EncodeBool(m.GsoEnabled)
461 buf.EncodeBool(m.ChecksumOffloadEnabled)
462 buf.EncodeUint64(m.Features)
463 return buf.Bytes(), nil
465 func (m *VirtioPciCreate) Unmarshal(b []byte) error {
466 buf := codec.NewBuffer(b)
467 m.PciAddr.Domain = buf.DecodeUint16()
468 m.PciAddr.Bus = buf.DecodeUint8()
469 m.PciAddr.Slot = buf.DecodeUint8()
470 m.PciAddr.Function = buf.DecodeUint8()
471 m.UseRandomMac = buf.DecodeBool()
472 copy(m.MacAddress[:], buf.DecodeBytes(6))
473 m.GsoEnabled = buf.DecodeBool()
474 m.ChecksumOffloadEnabled = buf.DecodeBool()
475 m.Features = buf.DecodeUint64()
479 // VirtioPciCreateReply defines message 'virtio_pci_create_reply'.
480 type VirtioPciCreateReply struct {
481 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
482 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
485 func (m *VirtioPciCreateReply) Reset() { *m = VirtioPciCreateReply{} }
486 func (*VirtioPciCreateReply) GetMessageName() string { return "virtio_pci_create_reply" }
487 func (*VirtioPciCreateReply) GetCrcString() string { return "5383d31f" }
488 func (*VirtioPciCreateReply) GetMessageType() api.MessageType {
489 return api.ReplyMessage
492 func (m *VirtioPciCreateReply) Size() (size int) {
496 size += 4 // m.Retval
497 size += 4 // m.SwIfIndex
500 func (m *VirtioPciCreateReply) Marshal(b []byte) ([]byte, error) {
502 b = make([]byte, m.Size())
504 buf := codec.NewBuffer(b)
505 buf.EncodeInt32(m.Retval)
506 buf.EncodeUint32(uint32(m.SwIfIndex))
507 return buf.Bytes(), nil
509 func (m *VirtioPciCreateReply) Unmarshal(b []byte) error {
510 buf := codec.NewBuffer(b)
511 m.Retval = buf.DecodeInt32()
512 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
516 // VirtioPciDelete defines message 'virtio_pci_delete'.
517 type VirtioPciDelete struct {
518 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
521 func (m *VirtioPciDelete) Reset() { *m = VirtioPciDelete{} }
522 func (*VirtioPciDelete) GetMessageName() string { return "virtio_pci_delete" }
523 func (*VirtioPciDelete) GetCrcString() string { return "f9e6675e" }
524 func (*VirtioPciDelete) GetMessageType() api.MessageType {
525 return api.RequestMessage
528 func (m *VirtioPciDelete) Size() (size int) {
532 size += 4 // m.SwIfIndex
535 func (m *VirtioPciDelete) Marshal(b []byte) ([]byte, error) {
537 b = make([]byte, m.Size())
539 buf := codec.NewBuffer(b)
540 buf.EncodeUint32(uint32(m.SwIfIndex))
541 return buf.Bytes(), nil
543 func (m *VirtioPciDelete) Unmarshal(b []byte) error {
544 buf := codec.NewBuffer(b)
545 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
549 // VirtioPciDeleteReply defines message 'virtio_pci_delete_reply'.
550 type VirtioPciDeleteReply struct {
551 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
554 func (m *VirtioPciDeleteReply) Reset() { *m = VirtioPciDeleteReply{} }
555 func (*VirtioPciDeleteReply) GetMessageName() string { return "virtio_pci_delete_reply" }
556 func (*VirtioPciDeleteReply) GetCrcString() string { return "e8d4e804" }
557 func (*VirtioPciDeleteReply) GetMessageType() api.MessageType {
558 return api.ReplyMessage
561 func (m *VirtioPciDeleteReply) Size() (size int) {
565 size += 4 // m.Retval
568 func (m *VirtioPciDeleteReply) Marshal(b []byte) ([]byte, error) {
570 b = make([]byte, m.Size())
572 buf := codec.NewBuffer(b)
573 buf.EncodeInt32(m.Retval)
574 return buf.Bytes(), nil
576 func (m *VirtioPciDeleteReply) Unmarshal(b []byte) error {
577 buf := codec.NewBuffer(b)
578 m.Retval = buf.DecodeInt32()
582 func init() { file_virtio_binapi_init() }
583 func file_virtio_binapi_init() {
584 api.RegisterMessage((*SwInterfaceVirtioPciDetails)(nil), "sw_interface_virtio_pci_details_16187f3a")
585 api.RegisterMessage((*SwInterfaceVirtioPciDump)(nil), "sw_interface_virtio_pci_dump_51077d14")
586 api.RegisterMessage((*VirtioPciCreate)(nil), "virtio_pci_create_a9f1370c")
587 api.RegisterMessage((*VirtioPciCreateReply)(nil), "virtio_pci_create_reply_5383d31f")
588 api.RegisterMessage((*VirtioPciDelete)(nil), "virtio_pci_delete_f9e6675e")
589 api.RegisterMessage((*VirtioPciDeleteReply)(nil), "virtio_pci_delete_reply_e8d4e804")
592 // Messages returns list of all messages in this module.
593 func AllMessages() []api.Message {
594 return []api.Message{
595 (*SwInterfaceVirtioPciDetails)(nil),
596 (*SwInterfaceVirtioPciDump)(nil),
597 (*VirtioPciCreate)(nil),
598 (*VirtioPciCreateReply)(nil),
599 (*VirtioPciDelete)(nil),
600 (*VirtioPciDeleteReply)(nil),