github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/binapi/virtio/virtio.ba.go (about)

     1  // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
     2  // versions:
     3  //  binapi-generator: v0.4.0-dev
     4  //  VPP:              23.02-rc0~189-g57127b32a
     5  // source: /usr/share/vpp/api/core/virtio.api.json
     6  
     7  // Package virtio contains generated bindings for API file virtio.api.
     8  //
     9  // Contents:
    10  //   1 enum
    11  //   8 messages
    12  //
    13  package virtio
    14  
    15  import (
    16  	"strconv"
    17  
    18  	api "git.fd.io/govpp.git/api"
    19  	codec "git.fd.io/govpp.git/codec"
    20  	ethernet_types "github.com/edwarnicke/govpp/binapi/ethernet_types"
    21  	interface_types "github.com/edwarnicke/govpp/binapi/interface_types"
    22  	pci_types "github.com/edwarnicke/govpp/binapi/pci_types"
    23  )
    24  
    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
    30  
    31  const (
    32  	APIFile    = "virtio"
    33  	APIVersion = "3.0.0"
    34  	VersionCrc = 0xa507d784
    35  )
    36  
    37  // VirtioFlags defines enum 'virtio_flags'.
    38  type VirtioFlags uint32
    39  
    40  const (
    41  	VIRTIO_API_FLAG_GSO          VirtioFlags = 1
    42  	VIRTIO_API_FLAG_CSUM_OFFLOAD VirtioFlags = 2
    43  	VIRTIO_API_FLAG_GRO_COALESCE VirtioFlags = 4
    44  	VIRTIO_API_FLAG_PACKED       VirtioFlags = 8
    45  	VIRTIO_API_FLAG_IN_ORDER     VirtioFlags = 16
    46  	VIRTIO_API_FLAG_BUFFERING    VirtioFlags = 32
    47  )
    48  
    49  var (
    50  	VirtioFlags_name = map[uint32]string{
    51  		1:  "VIRTIO_API_FLAG_GSO",
    52  		2:  "VIRTIO_API_FLAG_CSUM_OFFLOAD",
    53  		4:  "VIRTIO_API_FLAG_GRO_COALESCE",
    54  		8:  "VIRTIO_API_FLAG_PACKED",
    55  		16: "VIRTIO_API_FLAG_IN_ORDER",
    56  		32: "VIRTIO_API_FLAG_BUFFERING",
    57  	}
    58  	VirtioFlags_value = map[string]uint32{
    59  		"VIRTIO_API_FLAG_GSO":          1,
    60  		"VIRTIO_API_FLAG_CSUM_OFFLOAD": 2,
    61  		"VIRTIO_API_FLAG_GRO_COALESCE": 4,
    62  		"VIRTIO_API_FLAG_PACKED":       8,
    63  		"VIRTIO_API_FLAG_IN_ORDER":     16,
    64  		"VIRTIO_API_FLAG_BUFFERING":    32,
    65  	}
    66  )
    67  
    68  func (x VirtioFlags) String() string {
    69  	s, ok := VirtioFlags_name[uint32(x)]
    70  	if ok {
    71  		return s
    72  	}
    73  	str := func(n uint32) string {
    74  		s, ok := VirtioFlags_name[uint32(n)]
    75  		if ok {
    76  			return s
    77  		}
    78  		return "VirtioFlags(" + strconv.Itoa(int(n)) + ")"
    79  	}
    80  	for i := uint32(0); i <= 32; i++ {
    81  		val := uint32(x)
    82  		if val&(1<<i) != 0 {
    83  			if s != "" {
    84  				s += "|"
    85  			}
    86  			s += str(1 << i)
    87  		}
    88  	}
    89  	if s == "" {
    90  		return str(uint32(x))
    91  	}
    92  	return s
    93  }
    94  
    95  // SwInterfaceVirtioPciDetails defines message 'sw_interface_virtio_pci_details'.
    96  type SwInterfaceVirtioPciDetails struct {
    97  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
    98  	PciAddr   pci_types.PciAddress           `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"`
    99  	MacAddr   ethernet_types.MacAddress      `binapi:"mac_address,name=mac_addr" json:"mac_addr,omitempty"`
   100  	TxRingSz  uint16                         `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"`
   101  	RxRingSz  uint16                         `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"`
   102  	Features  uint64                         `binapi:"u64,name=features" json:"features,omitempty"`
   103  }
   104  
   105  func (m *SwInterfaceVirtioPciDetails) Reset()               { *m = SwInterfaceVirtioPciDetails{} }
   106  func (*SwInterfaceVirtioPciDetails) GetMessageName() string { return "sw_interface_virtio_pci_details" }
   107  func (*SwInterfaceVirtioPciDetails) GetCrcString() string   { return "6ca9c167" }
   108  func (*SwInterfaceVirtioPciDetails) GetMessageType() api.MessageType {
   109  	return api.ReplyMessage
   110  }
   111  
   112  func (m *SwInterfaceVirtioPciDetails) Size() (size int) {
   113  	if m == nil {
   114  		return 0
   115  	}
   116  	size += 4     // m.SwIfIndex
   117  	size += 2     // m.PciAddr.Domain
   118  	size += 1     // m.PciAddr.Bus
   119  	size += 1     // m.PciAddr.Slot
   120  	size += 1     // m.PciAddr.Function
   121  	size += 1 * 6 // m.MacAddr
   122  	size += 2     // m.TxRingSz
   123  	size += 2     // m.RxRingSz
   124  	size += 8     // m.Features
   125  	return size
   126  }
   127  func (m *SwInterfaceVirtioPciDetails) Marshal(b []byte) ([]byte, error) {
   128  	if b == nil {
   129  		b = make([]byte, m.Size())
   130  	}
   131  	buf := codec.NewBuffer(b)
   132  	buf.EncodeUint32(uint32(m.SwIfIndex))
   133  	buf.EncodeUint16(m.PciAddr.Domain)
   134  	buf.EncodeUint8(m.PciAddr.Bus)
   135  	buf.EncodeUint8(m.PciAddr.Slot)
   136  	buf.EncodeUint8(m.PciAddr.Function)
   137  	buf.EncodeBytes(m.MacAddr[:], 6)
   138  	buf.EncodeUint16(m.TxRingSz)
   139  	buf.EncodeUint16(m.RxRingSz)
   140  	buf.EncodeUint64(m.Features)
   141  	return buf.Bytes(), nil
   142  }
   143  func (m *SwInterfaceVirtioPciDetails) Unmarshal(b []byte) error {
   144  	buf := codec.NewBuffer(b)
   145  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   146  	m.PciAddr.Domain = buf.DecodeUint16()
   147  	m.PciAddr.Bus = buf.DecodeUint8()
   148  	m.PciAddr.Slot = buf.DecodeUint8()
   149  	m.PciAddr.Function = buf.DecodeUint8()
   150  	copy(m.MacAddr[:], buf.DecodeBytes(6))
   151  	m.TxRingSz = buf.DecodeUint16()
   152  	m.RxRingSz = buf.DecodeUint16()
   153  	m.Features = buf.DecodeUint64()
   154  	return nil
   155  }
   156  
   157  // SwInterfaceVirtioPciDump defines message 'sw_interface_virtio_pci_dump'.
   158  type SwInterfaceVirtioPciDump struct{}
   159  
   160  func (m *SwInterfaceVirtioPciDump) Reset()               { *m = SwInterfaceVirtioPciDump{} }
   161  func (*SwInterfaceVirtioPciDump) GetMessageName() string { return "sw_interface_virtio_pci_dump" }
   162  func (*SwInterfaceVirtioPciDump) GetCrcString() string   { return "51077d14" }
   163  func (*SwInterfaceVirtioPciDump) GetMessageType() api.MessageType {
   164  	return api.RequestMessage
   165  }
   166  
   167  func (m *SwInterfaceVirtioPciDump) Size() (size int) {
   168  	if m == nil {
   169  		return 0
   170  	}
   171  	return size
   172  }
   173  func (m *SwInterfaceVirtioPciDump) Marshal(b []byte) ([]byte, error) {
   174  	if b == nil {
   175  		b = make([]byte, m.Size())
   176  	}
   177  	buf := codec.NewBuffer(b)
   178  	return buf.Bytes(), nil
   179  }
   180  func (m *SwInterfaceVirtioPciDump) Unmarshal(b []byte) error {
   181  	return nil
   182  }
   183  
   184  // VirtioPciCreate defines message 'virtio_pci_create'.
   185  // Deprecated: the message will be removed in the future versions
   186  type VirtioPciCreate struct {
   187  	PciAddr                pci_types.PciAddress      `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"`
   188  	UseRandomMac           bool                      `binapi:"bool,name=use_random_mac" json:"use_random_mac,omitempty"`
   189  	MacAddress             ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
   190  	GsoEnabled             bool                      `binapi:"bool,name=gso_enabled" json:"gso_enabled,omitempty"`
   191  	ChecksumOffloadEnabled bool                      `binapi:"bool,name=checksum_offload_enabled" json:"checksum_offload_enabled,omitempty"`
   192  	Features               uint64                    `binapi:"u64,name=features" json:"features,omitempty"`
   193  }
   194  
   195  func (m *VirtioPciCreate) Reset()               { *m = VirtioPciCreate{} }
   196  func (*VirtioPciCreate) GetMessageName() string { return "virtio_pci_create" }
   197  func (*VirtioPciCreate) GetCrcString() string   { return "1944f8db" }
   198  func (*VirtioPciCreate) GetMessageType() api.MessageType {
   199  	return api.RequestMessage
   200  }
   201  
   202  func (m *VirtioPciCreate) Size() (size int) {
   203  	if m == nil {
   204  		return 0
   205  	}
   206  	size += 2     // m.PciAddr.Domain
   207  	size += 1     // m.PciAddr.Bus
   208  	size += 1     // m.PciAddr.Slot
   209  	size += 1     // m.PciAddr.Function
   210  	size += 1     // m.UseRandomMac
   211  	size += 1 * 6 // m.MacAddress
   212  	size += 1     // m.GsoEnabled
   213  	size += 1     // m.ChecksumOffloadEnabled
   214  	size += 8     // m.Features
   215  	return size
   216  }
   217  func (m *VirtioPciCreate) Marshal(b []byte) ([]byte, error) {
   218  	if b == nil {
   219  		b = make([]byte, m.Size())
   220  	}
   221  	buf := codec.NewBuffer(b)
   222  	buf.EncodeUint16(m.PciAddr.Domain)
   223  	buf.EncodeUint8(m.PciAddr.Bus)
   224  	buf.EncodeUint8(m.PciAddr.Slot)
   225  	buf.EncodeUint8(m.PciAddr.Function)
   226  	buf.EncodeBool(m.UseRandomMac)
   227  	buf.EncodeBytes(m.MacAddress[:], 6)
   228  	buf.EncodeBool(m.GsoEnabled)
   229  	buf.EncodeBool(m.ChecksumOffloadEnabled)
   230  	buf.EncodeUint64(m.Features)
   231  	return buf.Bytes(), nil
   232  }
   233  func (m *VirtioPciCreate) Unmarshal(b []byte) error {
   234  	buf := codec.NewBuffer(b)
   235  	m.PciAddr.Domain = buf.DecodeUint16()
   236  	m.PciAddr.Bus = buf.DecodeUint8()
   237  	m.PciAddr.Slot = buf.DecodeUint8()
   238  	m.PciAddr.Function = buf.DecodeUint8()
   239  	m.UseRandomMac = buf.DecodeBool()
   240  	copy(m.MacAddress[:], buf.DecodeBytes(6))
   241  	m.GsoEnabled = buf.DecodeBool()
   242  	m.ChecksumOffloadEnabled = buf.DecodeBool()
   243  	m.Features = buf.DecodeUint64()
   244  	return nil
   245  }
   246  
   247  // VirtioPciCreateReply defines message 'virtio_pci_create_reply'.
   248  // Deprecated: the message will be removed in the future versions
   249  type VirtioPciCreateReply struct {
   250  	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
   251  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   252  }
   253  
   254  func (m *VirtioPciCreateReply) Reset()               { *m = VirtioPciCreateReply{} }
   255  func (*VirtioPciCreateReply) GetMessageName() string { return "virtio_pci_create_reply" }
   256  func (*VirtioPciCreateReply) GetCrcString() string   { return "5383d31f" }
   257  func (*VirtioPciCreateReply) GetMessageType() api.MessageType {
   258  	return api.ReplyMessage
   259  }
   260  
   261  func (m *VirtioPciCreateReply) Size() (size int) {
   262  	if m == nil {
   263  		return 0
   264  	}
   265  	size += 4 // m.Retval
   266  	size += 4 // m.SwIfIndex
   267  	return size
   268  }
   269  func (m *VirtioPciCreateReply) Marshal(b []byte) ([]byte, error) {
   270  	if b == nil {
   271  		b = make([]byte, m.Size())
   272  	}
   273  	buf := codec.NewBuffer(b)
   274  	buf.EncodeInt32(m.Retval)
   275  	buf.EncodeUint32(uint32(m.SwIfIndex))
   276  	return buf.Bytes(), nil
   277  }
   278  func (m *VirtioPciCreateReply) Unmarshal(b []byte) error {
   279  	buf := codec.NewBuffer(b)
   280  	m.Retval = buf.DecodeInt32()
   281  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   282  	return nil
   283  }
   284  
   285  // VirtioPciCreateV2 defines message 'virtio_pci_create_v2'.
   286  type VirtioPciCreateV2 struct {
   287  	PciAddr      pci_types.PciAddress      `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"`
   288  	UseRandomMac bool                      `binapi:"bool,name=use_random_mac" json:"use_random_mac,omitempty"`
   289  	MacAddress   ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
   290  	VirtioFlags  VirtioFlags               `binapi:"virtio_flags,name=virtio_flags" json:"virtio_flags,omitempty"`
   291  	Features     uint64                    `binapi:"u64,name=features" json:"features,omitempty"`
   292  }
   293  
   294  func (m *VirtioPciCreateV2) Reset()               { *m = VirtioPciCreateV2{} }
   295  func (*VirtioPciCreateV2) GetMessageName() string { return "virtio_pci_create_v2" }
   296  func (*VirtioPciCreateV2) GetCrcString() string   { return "5d096e1a" }
   297  func (*VirtioPciCreateV2) GetMessageType() api.MessageType {
   298  	return api.RequestMessage
   299  }
   300  
   301  func (m *VirtioPciCreateV2) Size() (size int) {
   302  	if m == nil {
   303  		return 0
   304  	}
   305  	size += 2     // m.PciAddr.Domain
   306  	size += 1     // m.PciAddr.Bus
   307  	size += 1     // m.PciAddr.Slot
   308  	size += 1     // m.PciAddr.Function
   309  	size += 1     // m.UseRandomMac
   310  	size += 1 * 6 // m.MacAddress
   311  	size += 4     // m.VirtioFlags
   312  	size += 8     // m.Features
   313  	return size
   314  }
   315  func (m *VirtioPciCreateV2) Marshal(b []byte) ([]byte, error) {
   316  	if b == nil {
   317  		b = make([]byte, m.Size())
   318  	}
   319  	buf := codec.NewBuffer(b)
   320  	buf.EncodeUint16(m.PciAddr.Domain)
   321  	buf.EncodeUint8(m.PciAddr.Bus)
   322  	buf.EncodeUint8(m.PciAddr.Slot)
   323  	buf.EncodeUint8(m.PciAddr.Function)
   324  	buf.EncodeBool(m.UseRandomMac)
   325  	buf.EncodeBytes(m.MacAddress[:], 6)
   326  	buf.EncodeUint32(uint32(m.VirtioFlags))
   327  	buf.EncodeUint64(m.Features)
   328  	return buf.Bytes(), nil
   329  }
   330  func (m *VirtioPciCreateV2) Unmarshal(b []byte) error {
   331  	buf := codec.NewBuffer(b)
   332  	m.PciAddr.Domain = buf.DecodeUint16()
   333  	m.PciAddr.Bus = buf.DecodeUint8()
   334  	m.PciAddr.Slot = buf.DecodeUint8()
   335  	m.PciAddr.Function = buf.DecodeUint8()
   336  	m.UseRandomMac = buf.DecodeBool()
   337  	copy(m.MacAddress[:], buf.DecodeBytes(6))
   338  	m.VirtioFlags = VirtioFlags(buf.DecodeUint32())
   339  	m.Features = buf.DecodeUint64()
   340  	return nil
   341  }
   342  
   343  // VirtioPciCreateV2Reply defines message 'virtio_pci_create_v2_reply'.
   344  type VirtioPciCreateV2Reply struct {
   345  	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
   346  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   347  }
   348  
   349  func (m *VirtioPciCreateV2Reply) Reset()               { *m = VirtioPciCreateV2Reply{} }
   350  func (*VirtioPciCreateV2Reply) GetMessageName() string { return "virtio_pci_create_v2_reply" }
   351  func (*VirtioPciCreateV2Reply) GetCrcString() string   { return "5383d31f" }
   352  func (*VirtioPciCreateV2Reply) GetMessageType() api.MessageType {
   353  	return api.ReplyMessage
   354  }
   355  
   356  func (m *VirtioPciCreateV2Reply) Size() (size int) {
   357  	if m == nil {
   358  		return 0
   359  	}
   360  	size += 4 // m.Retval
   361  	size += 4 // m.SwIfIndex
   362  	return size
   363  }
   364  func (m *VirtioPciCreateV2Reply) Marshal(b []byte) ([]byte, error) {
   365  	if b == nil {
   366  		b = make([]byte, m.Size())
   367  	}
   368  	buf := codec.NewBuffer(b)
   369  	buf.EncodeInt32(m.Retval)
   370  	buf.EncodeUint32(uint32(m.SwIfIndex))
   371  	return buf.Bytes(), nil
   372  }
   373  func (m *VirtioPciCreateV2Reply) Unmarshal(b []byte) error {
   374  	buf := codec.NewBuffer(b)
   375  	m.Retval = buf.DecodeInt32()
   376  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   377  	return nil
   378  }
   379  
   380  // VirtioPciDelete defines message 'virtio_pci_delete'.
   381  type VirtioPciDelete struct {
   382  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   383  }
   384  
   385  func (m *VirtioPciDelete) Reset()               { *m = VirtioPciDelete{} }
   386  func (*VirtioPciDelete) GetMessageName() string { return "virtio_pci_delete" }
   387  func (*VirtioPciDelete) GetCrcString() string   { return "f9e6675e" }
   388  func (*VirtioPciDelete) GetMessageType() api.MessageType {
   389  	return api.RequestMessage
   390  }
   391  
   392  func (m *VirtioPciDelete) Size() (size int) {
   393  	if m == nil {
   394  		return 0
   395  	}
   396  	size += 4 // m.SwIfIndex
   397  	return size
   398  }
   399  func (m *VirtioPciDelete) Marshal(b []byte) ([]byte, error) {
   400  	if b == nil {
   401  		b = make([]byte, m.Size())
   402  	}
   403  	buf := codec.NewBuffer(b)
   404  	buf.EncodeUint32(uint32(m.SwIfIndex))
   405  	return buf.Bytes(), nil
   406  }
   407  func (m *VirtioPciDelete) Unmarshal(b []byte) error {
   408  	buf := codec.NewBuffer(b)
   409  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   410  	return nil
   411  }
   412  
   413  // VirtioPciDeleteReply defines message 'virtio_pci_delete_reply'.
   414  type VirtioPciDeleteReply struct {
   415  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   416  }
   417  
   418  func (m *VirtioPciDeleteReply) Reset()               { *m = VirtioPciDeleteReply{} }
   419  func (*VirtioPciDeleteReply) GetMessageName() string { return "virtio_pci_delete_reply" }
   420  func (*VirtioPciDeleteReply) GetCrcString() string   { return "e8d4e804" }
   421  func (*VirtioPciDeleteReply) GetMessageType() api.MessageType {
   422  	return api.ReplyMessage
   423  }
   424  
   425  func (m *VirtioPciDeleteReply) Size() (size int) {
   426  	if m == nil {
   427  		return 0
   428  	}
   429  	size += 4 // m.Retval
   430  	return size
   431  }
   432  func (m *VirtioPciDeleteReply) Marshal(b []byte) ([]byte, error) {
   433  	if b == nil {
   434  		b = make([]byte, m.Size())
   435  	}
   436  	buf := codec.NewBuffer(b)
   437  	buf.EncodeInt32(m.Retval)
   438  	return buf.Bytes(), nil
   439  }
   440  func (m *VirtioPciDeleteReply) Unmarshal(b []byte) error {
   441  	buf := codec.NewBuffer(b)
   442  	m.Retval = buf.DecodeInt32()
   443  	return nil
   444  }
   445  
   446  func init() { file_virtio_binapi_init() }
   447  func file_virtio_binapi_init() {
   448  	api.RegisterMessage((*SwInterfaceVirtioPciDetails)(nil), "sw_interface_virtio_pci_details_6ca9c167")
   449  	api.RegisterMessage((*SwInterfaceVirtioPciDump)(nil), "sw_interface_virtio_pci_dump_51077d14")
   450  	api.RegisterMessage((*VirtioPciCreate)(nil), "virtio_pci_create_1944f8db")
   451  	api.RegisterMessage((*VirtioPciCreateReply)(nil), "virtio_pci_create_reply_5383d31f")
   452  	api.RegisterMessage((*VirtioPciCreateV2)(nil), "virtio_pci_create_v2_5d096e1a")
   453  	api.RegisterMessage((*VirtioPciCreateV2Reply)(nil), "virtio_pci_create_v2_reply_5383d31f")
   454  	api.RegisterMessage((*VirtioPciDelete)(nil), "virtio_pci_delete_f9e6675e")
   455  	api.RegisterMessage((*VirtioPciDeleteReply)(nil), "virtio_pci_delete_reply_e8d4e804")
   456  }
   457  
   458  // Messages returns list of all messages in this module.
   459  func AllMessages() []api.Message {
   460  	return []api.Message{
   461  		(*SwInterfaceVirtioPciDetails)(nil),
   462  		(*SwInterfaceVirtioPciDump)(nil),
   463  		(*VirtioPciCreate)(nil),
   464  		(*VirtioPciCreateReply)(nil),
   465  		(*VirtioPciCreateV2)(nil),
   466  		(*VirtioPciCreateV2Reply)(nil),
   467  		(*VirtioPciDelete)(nil),
   468  		(*VirtioPciDeleteReply)(nil),
   469  	}
   470  }