github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/binapi/af_xdp/af_xdp.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/plugins/af_xdp.api.json
     6  
     7  // Package af_xdp contains generated bindings for API file af_xdp.api.
     8  //
     9  // Contents:
    10  //   2 enums
    11  //   6 messages
    12  //
    13  package af_xdp
    14  
    15  import (
    16  	"strconv"
    17  
    18  	api "git.fd.io/govpp.git/api"
    19  	codec "git.fd.io/govpp.git/codec"
    20  	interface_types "github.com/edwarnicke/govpp/binapi/interface_types"
    21  )
    22  
    23  // This is a compile-time assertion to ensure that this generated file
    24  // is compatible with the GoVPP api package it is being compiled against.
    25  // A compilation error at this line likely means your copy of the
    26  // GoVPP api package needs to be updated.
    27  const _ = api.GoVppAPIPackageIsVersion2
    28  
    29  const (
    30  	APIFile    = "af_xdp"
    31  	APIVersion = "1.0.0"
    32  	VersionCrc = 0x346626ce
    33  )
    34  
    35  // AfXdpMode defines enum 'af_xdp_mode'.
    36  type AfXdpMode uint32
    37  
    38  const (
    39  	AF_XDP_API_MODE_AUTO      AfXdpMode = 0
    40  	AF_XDP_API_MODE_COPY      AfXdpMode = 1
    41  	AF_XDP_API_MODE_ZERO_COPY AfXdpMode = 2
    42  )
    43  
    44  var (
    45  	AfXdpMode_name = map[uint32]string{
    46  		0: "AF_XDP_API_MODE_AUTO",
    47  		1: "AF_XDP_API_MODE_COPY",
    48  		2: "AF_XDP_API_MODE_ZERO_COPY",
    49  	}
    50  	AfXdpMode_value = map[string]uint32{
    51  		"AF_XDP_API_MODE_AUTO":      0,
    52  		"AF_XDP_API_MODE_COPY":      1,
    53  		"AF_XDP_API_MODE_ZERO_COPY": 2,
    54  	}
    55  )
    56  
    57  func (x AfXdpMode) String() string {
    58  	s, ok := AfXdpMode_name[uint32(x)]
    59  	if ok {
    60  		return s
    61  	}
    62  	return "AfXdpMode(" + strconv.Itoa(int(x)) + ")"
    63  }
    64  
    65  // AfXdpFlag defines enum 'af_xdp_flag'.
    66  type AfXdpFlag uint8
    67  
    68  const (
    69  	AF_XDP_API_FLAGS_NO_SYSCALL_LOCK AfXdpFlag = 1
    70  )
    71  
    72  var (
    73  	AfXdpFlag_name = map[uint8]string{
    74  		1: "AF_XDP_API_FLAGS_NO_SYSCALL_LOCK",
    75  	}
    76  	AfXdpFlag_value = map[string]uint8{
    77  		"AF_XDP_API_FLAGS_NO_SYSCALL_LOCK": 1,
    78  	}
    79  )
    80  
    81  func (x AfXdpFlag) String() string {
    82  	s, ok := AfXdpFlag_name[uint8(x)]
    83  	if ok {
    84  		return s
    85  	}
    86  	str := func(n uint8) string {
    87  		s, ok := AfXdpFlag_name[uint8(n)]
    88  		if ok {
    89  			return s
    90  		}
    91  		return "AfXdpFlag(" + strconv.Itoa(int(n)) + ")"
    92  	}
    93  	for i := uint8(0); i <= 8; i++ {
    94  		val := uint8(x)
    95  		if val&(1<<i) != 0 {
    96  			if s != "" {
    97  				s += "|"
    98  			}
    99  			s += str(1 << i)
   100  		}
   101  	}
   102  	if s == "" {
   103  		return str(uint8(x))
   104  	}
   105  	return s
   106  }
   107  
   108  // AfXdpCreate defines message 'af_xdp_create'.
   109  type AfXdpCreate struct {
   110  	HostIf  string    `binapi:"string[64],name=host_if" json:"host_if,omitempty"`
   111  	Name    string    `binapi:"string[64],name=name" json:"name,omitempty"`
   112  	RxqNum  uint16    `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"`
   113  	RxqSize uint16    `binapi:"u16,name=rxq_size,default=0" json:"rxq_size,omitempty"`
   114  	TxqSize uint16    `binapi:"u16,name=txq_size,default=0" json:"txq_size,omitempty"`
   115  	Mode    AfXdpMode `binapi:"af_xdp_mode,name=mode,default=0" json:"mode,omitempty"`
   116  	Flags   AfXdpFlag `binapi:"af_xdp_flag,name=flags,default=0" json:"flags,omitempty"`
   117  	Prog    string    `binapi:"string[256],name=prog" json:"prog,omitempty"`
   118  }
   119  
   120  func (m *AfXdpCreate) Reset()               { *m = AfXdpCreate{} }
   121  func (*AfXdpCreate) GetMessageName() string { return "af_xdp_create" }
   122  func (*AfXdpCreate) GetCrcString() string   { return "21226c99" }
   123  func (*AfXdpCreate) GetMessageType() api.MessageType {
   124  	return api.RequestMessage
   125  }
   126  
   127  func (m *AfXdpCreate) Size() (size int) {
   128  	if m == nil {
   129  		return 0
   130  	}
   131  	size += 64  // m.HostIf
   132  	size += 64  // m.Name
   133  	size += 2   // m.RxqNum
   134  	size += 2   // m.RxqSize
   135  	size += 2   // m.TxqSize
   136  	size += 4   // m.Mode
   137  	size += 1   // m.Flags
   138  	size += 256 // m.Prog
   139  	return size
   140  }
   141  func (m *AfXdpCreate) Marshal(b []byte) ([]byte, error) {
   142  	if b == nil {
   143  		b = make([]byte, m.Size())
   144  	}
   145  	buf := codec.NewBuffer(b)
   146  	buf.EncodeString(m.HostIf, 64)
   147  	buf.EncodeString(m.Name, 64)
   148  	buf.EncodeUint16(m.RxqNum)
   149  	buf.EncodeUint16(m.RxqSize)
   150  	buf.EncodeUint16(m.TxqSize)
   151  	buf.EncodeUint32(uint32(m.Mode))
   152  	buf.EncodeUint8(uint8(m.Flags))
   153  	buf.EncodeString(m.Prog, 256)
   154  	return buf.Bytes(), nil
   155  }
   156  func (m *AfXdpCreate) Unmarshal(b []byte) error {
   157  	buf := codec.NewBuffer(b)
   158  	m.HostIf = buf.DecodeString(64)
   159  	m.Name = buf.DecodeString(64)
   160  	m.RxqNum = buf.DecodeUint16()
   161  	m.RxqSize = buf.DecodeUint16()
   162  	m.TxqSize = buf.DecodeUint16()
   163  	m.Mode = AfXdpMode(buf.DecodeUint32())
   164  	m.Flags = AfXdpFlag(buf.DecodeUint8())
   165  	m.Prog = buf.DecodeString(256)
   166  	return nil
   167  }
   168  
   169  // AfXdpCreateReply defines message 'af_xdp_create_reply'.
   170  type AfXdpCreateReply struct {
   171  	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
   172  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   173  }
   174  
   175  func (m *AfXdpCreateReply) Reset()               { *m = AfXdpCreateReply{} }
   176  func (*AfXdpCreateReply) GetMessageName() string { return "af_xdp_create_reply" }
   177  func (*AfXdpCreateReply) GetCrcString() string   { return "5383d31f" }
   178  func (*AfXdpCreateReply) GetMessageType() api.MessageType {
   179  	return api.ReplyMessage
   180  }
   181  
   182  func (m *AfXdpCreateReply) Size() (size int) {
   183  	if m == nil {
   184  		return 0
   185  	}
   186  	size += 4 // m.Retval
   187  	size += 4 // m.SwIfIndex
   188  	return size
   189  }
   190  func (m *AfXdpCreateReply) Marshal(b []byte) ([]byte, error) {
   191  	if b == nil {
   192  		b = make([]byte, m.Size())
   193  	}
   194  	buf := codec.NewBuffer(b)
   195  	buf.EncodeInt32(m.Retval)
   196  	buf.EncodeUint32(uint32(m.SwIfIndex))
   197  	return buf.Bytes(), nil
   198  }
   199  func (m *AfXdpCreateReply) Unmarshal(b []byte) error {
   200  	buf := codec.NewBuffer(b)
   201  	m.Retval = buf.DecodeInt32()
   202  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   203  	return nil
   204  }
   205  
   206  // AfXdpCreateV2 defines message 'af_xdp_create_v2'.
   207  type AfXdpCreateV2 struct {
   208  	HostIf    string    `binapi:"string[64],name=host_if" json:"host_if,omitempty"`
   209  	Name      string    `binapi:"string[64],name=name" json:"name,omitempty"`
   210  	RxqNum    uint16    `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"`
   211  	RxqSize   uint16    `binapi:"u16,name=rxq_size,default=0" json:"rxq_size,omitempty"`
   212  	TxqSize   uint16    `binapi:"u16,name=txq_size,default=0" json:"txq_size,omitempty"`
   213  	Mode      AfXdpMode `binapi:"af_xdp_mode,name=mode,default=0" json:"mode,omitempty"`
   214  	Flags     AfXdpFlag `binapi:"af_xdp_flag,name=flags,default=0" json:"flags,omitempty"`
   215  	Prog      string    `binapi:"string[256],name=prog" json:"prog,omitempty"`
   216  	Namespace string    `binapi:"string[64],name=namespace" json:"namespace,omitempty"`
   217  }
   218  
   219  func (m *AfXdpCreateV2) Reset()               { *m = AfXdpCreateV2{} }
   220  func (*AfXdpCreateV2) GetMessageName() string { return "af_xdp_create_v2" }
   221  func (*AfXdpCreateV2) GetCrcString() string   { return "e17ec2eb" }
   222  func (*AfXdpCreateV2) GetMessageType() api.MessageType {
   223  	return api.RequestMessage
   224  }
   225  
   226  func (m *AfXdpCreateV2) Size() (size int) {
   227  	if m == nil {
   228  		return 0
   229  	}
   230  	size += 64  // m.HostIf
   231  	size += 64  // m.Name
   232  	size += 2   // m.RxqNum
   233  	size += 2   // m.RxqSize
   234  	size += 2   // m.TxqSize
   235  	size += 4   // m.Mode
   236  	size += 1   // m.Flags
   237  	size += 256 // m.Prog
   238  	size += 64  // m.Namespace
   239  	return size
   240  }
   241  func (m *AfXdpCreateV2) Marshal(b []byte) ([]byte, error) {
   242  	if b == nil {
   243  		b = make([]byte, m.Size())
   244  	}
   245  	buf := codec.NewBuffer(b)
   246  	buf.EncodeString(m.HostIf, 64)
   247  	buf.EncodeString(m.Name, 64)
   248  	buf.EncodeUint16(m.RxqNum)
   249  	buf.EncodeUint16(m.RxqSize)
   250  	buf.EncodeUint16(m.TxqSize)
   251  	buf.EncodeUint32(uint32(m.Mode))
   252  	buf.EncodeUint8(uint8(m.Flags))
   253  	buf.EncodeString(m.Prog, 256)
   254  	buf.EncodeString(m.Namespace, 64)
   255  	return buf.Bytes(), nil
   256  }
   257  func (m *AfXdpCreateV2) Unmarshal(b []byte) error {
   258  	buf := codec.NewBuffer(b)
   259  	m.HostIf = buf.DecodeString(64)
   260  	m.Name = buf.DecodeString(64)
   261  	m.RxqNum = buf.DecodeUint16()
   262  	m.RxqSize = buf.DecodeUint16()
   263  	m.TxqSize = buf.DecodeUint16()
   264  	m.Mode = AfXdpMode(buf.DecodeUint32())
   265  	m.Flags = AfXdpFlag(buf.DecodeUint8())
   266  	m.Prog = buf.DecodeString(256)
   267  	m.Namespace = buf.DecodeString(64)
   268  	return nil
   269  }
   270  
   271  // AfXdpCreateV2Reply defines message 'af_xdp_create_v2_reply'.
   272  type AfXdpCreateV2Reply struct {
   273  	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
   274  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   275  }
   276  
   277  func (m *AfXdpCreateV2Reply) Reset()               { *m = AfXdpCreateV2Reply{} }
   278  func (*AfXdpCreateV2Reply) GetMessageName() string { return "af_xdp_create_v2_reply" }
   279  func (*AfXdpCreateV2Reply) GetCrcString() string   { return "5383d31f" }
   280  func (*AfXdpCreateV2Reply) GetMessageType() api.MessageType {
   281  	return api.ReplyMessage
   282  }
   283  
   284  func (m *AfXdpCreateV2Reply) Size() (size int) {
   285  	if m == nil {
   286  		return 0
   287  	}
   288  	size += 4 // m.Retval
   289  	size += 4 // m.SwIfIndex
   290  	return size
   291  }
   292  func (m *AfXdpCreateV2Reply) Marshal(b []byte) ([]byte, error) {
   293  	if b == nil {
   294  		b = make([]byte, m.Size())
   295  	}
   296  	buf := codec.NewBuffer(b)
   297  	buf.EncodeInt32(m.Retval)
   298  	buf.EncodeUint32(uint32(m.SwIfIndex))
   299  	return buf.Bytes(), nil
   300  }
   301  func (m *AfXdpCreateV2Reply) Unmarshal(b []byte) error {
   302  	buf := codec.NewBuffer(b)
   303  	m.Retval = buf.DecodeInt32()
   304  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   305  	return nil
   306  }
   307  
   308  // AfXdpDelete defines message 'af_xdp_delete'.
   309  type AfXdpDelete struct {
   310  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   311  }
   312  
   313  func (m *AfXdpDelete) Reset()               { *m = AfXdpDelete{} }
   314  func (*AfXdpDelete) GetMessageName() string { return "af_xdp_delete" }
   315  func (*AfXdpDelete) GetCrcString() string   { return "f9e6675e" }
   316  func (*AfXdpDelete) GetMessageType() api.MessageType {
   317  	return api.RequestMessage
   318  }
   319  
   320  func (m *AfXdpDelete) Size() (size int) {
   321  	if m == nil {
   322  		return 0
   323  	}
   324  	size += 4 // m.SwIfIndex
   325  	return size
   326  }
   327  func (m *AfXdpDelete) Marshal(b []byte) ([]byte, error) {
   328  	if b == nil {
   329  		b = make([]byte, m.Size())
   330  	}
   331  	buf := codec.NewBuffer(b)
   332  	buf.EncodeUint32(uint32(m.SwIfIndex))
   333  	return buf.Bytes(), nil
   334  }
   335  func (m *AfXdpDelete) Unmarshal(b []byte) error {
   336  	buf := codec.NewBuffer(b)
   337  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   338  	return nil
   339  }
   340  
   341  // AfXdpDeleteReply defines message 'af_xdp_delete_reply'.
   342  type AfXdpDeleteReply struct {
   343  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   344  }
   345  
   346  func (m *AfXdpDeleteReply) Reset()               { *m = AfXdpDeleteReply{} }
   347  func (*AfXdpDeleteReply) GetMessageName() string { return "af_xdp_delete_reply" }
   348  func (*AfXdpDeleteReply) GetCrcString() string   { return "e8d4e804" }
   349  func (*AfXdpDeleteReply) GetMessageType() api.MessageType {
   350  	return api.ReplyMessage
   351  }
   352  
   353  func (m *AfXdpDeleteReply) Size() (size int) {
   354  	if m == nil {
   355  		return 0
   356  	}
   357  	size += 4 // m.Retval
   358  	return size
   359  }
   360  func (m *AfXdpDeleteReply) Marshal(b []byte) ([]byte, error) {
   361  	if b == nil {
   362  		b = make([]byte, m.Size())
   363  	}
   364  	buf := codec.NewBuffer(b)
   365  	buf.EncodeInt32(m.Retval)
   366  	return buf.Bytes(), nil
   367  }
   368  func (m *AfXdpDeleteReply) Unmarshal(b []byte) error {
   369  	buf := codec.NewBuffer(b)
   370  	m.Retval = buf.DecodeInt32()
   371  	return nil
   372  }
   373  
   374  func init() { file_af_xdp_binapi_init() }
   375  func file_af_xdp_binapi_init() {
   376  	api.RegisterMessage((*AfXdpCreate)(nil), "af_xdp_create_21226c99")
   377  	api.RegisterMessage((*AfXdpCreateReply)(nil), "af_xdp_create_reply_5383d31f")
   378  	api.RegisterMessage((*AfXdpCreateV2)(nil), "af_xdp_create_v2_e17ec2eb")
   379  	api.RegisterMessage((*AfXdpCreateV2Reply)(nil), "af_xdp_create_v2_reply_5383d31f")
   380  	api.RegisterMessage((*AfXdpDelete)(nil), "af_xdp_delete_f9e6675e")
   381  	api.RegisterMessage((*AfXdpDeleteReply)(nil), "af_xdp_delete_reply_e8d4e804")
   382  }
   383  
   384  // Messages returns list of all messages in this module.
   385  func AllMessages() []api.Message {
   386  	return []api.Message{
   387  		(*AfXdpCreate)(nil),
   388  		(*AfXdpCreateReply)(nil),
   389  		(*AfXdpCreateV2)(nil),
   390  		(*AfXdpCreateV2Reply)(nil),
   391  		(*AfXdpDelete)(nil),
   392  		(*AfXdpDeleteReply)(nil),
   393  	}
   394  }