github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/pg/pg.ba.go (about)

     1  // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
     2  // versions:
     3  //  binapi-generator: v0.10.0-dev
     4  //  VPP:              23.10-rc0~170-g6f1548434
     5  // source: core/pg.api.json
     6  
     7  // Package pg contains generated bindings for API file pg.api.
     8  //
     9  // Contents:
    10  // -  1 enum
    11  // - 10 messages
    12  package pg
    13  
    14  import (
    15  	"strconv"
    16  
    17  	interface_types "github.com/networkservicemesh/govpp/binapi/interface_types"
    18  	api "go.fd.io/govpp/api"
    19  	codec "go.fd.io/govpp/codec"
    20  )
    21  
    22  // This is a compile-time assertion to ensure that this generated file
    23  // is compatible with the GoVPP api package it is being compiled against.
    24  // A compilation error at this line likely means your copy of the
    25  // GoVPP api package needs to be updated.
    26  const _ = api.GoVppAPIPackageIsVersion2
    27  
    28  const (
    29  	APIFile    = "pg"
    30  	APIVersion = "2.0.0"
    31  	VersionCrc = 0x32a1ad3b
    32  )
    33  
    34  // PgInterfaceMode defines enum 'pg_interface_mode'.
    35  type PgInterfaceMode uint8
    36  
    37  const (
    38  	PG_API_MODE_ETHERNET PgInterfaceMode = 0
    39  	PG_API_MODE_IP4      PgInterfaceMode = 1
    40  	PG_API_MODE_IP6      PgInterfaceMode = 2
    41  )
    42  
    43  var (
    44  	PgInterfaceMode_name = map[uint8]string{
    45  		0: "PG_API_MODE_ETHERNET",
    46  		1: "PG_API_MODE_IP4",
    47  		2: "PG_API_MODE_IP6",
    48  	}
    49  	PgInterfaceMode_value = map[string]uint8{
    50  		"PG_API_MODE_ETHERNET": 0,
    51  		"PG_API_MODE_IP4":      1,
    52  		"PG_API_MODE_IP6":      2,
    53  	}
    54  )
    55  
    56  func (x PgInterfaceMode) String() string {
    57  	s, ok := PgInterfaceMode_name[uint8(x)]
    58  	if ok {
    59  		return s
    60  	}
    61  	return "PgInterfaceMode(" + strconv.Itoa(int(x)) + ")"
    62  }
    63  
    64  // PacketGenerator capture packets on given interface request
    65  //   - interface_id - pg interface index
    66  //   - is_enabled - 1 if enabling streams, 0 if disabling
    67  //   - count - number of packets to be captured
    68  //   - pcap_file_name - pacp file name to store captured packets
    69  //
    70  // PgCapture defines message 'pg_capture'.
    71  type PgCapture struct {
    72  	InterfaceID  interface_types.InterfaceIndex `binapi:"interface_index,name=interface_id" json:"interface_id,omitempty"`
    73  	IsEnabled    bool                           `binapi:"bool,name=is_enabled,default=true" json:"is_enabled,omitempty"`
    74  	Count        uint32                         `binapi:"u32,name=count" json:"count,omitempty"`
    75  	PcapFileName string                         `binapi:"string[],name=pcap_file_name" json:"pcap_file_name,omitempty"`
    76  }
    77  
    78  func (m *PgCapture) Reset()               { *m = PgCapture{} }
    79  func (*PgCapture) GetMessageName() string { return "pg_capture" }
    80  func (*PgCapture) GetCrcString() string   { return "3712fb6c" }
    81  func (*PgCapture) GetMessageType() api.MessageType {
    82  	return api.RequestMessage
    83  }
    84  
    85  func (m *PgCapture) Size() (size int) {
    86  	if m == nil {
    87  		return 0
    88  	}
    89  	size += 4                       // m.InterfaceID
    90  	size += 1                       // m.IsEnabled
    91  	size += 4                       // m.Count
    92  	size += 4 + len(m.PcapFileName) // m.PcapFileName
    93  	return size
    94  }
    95  func (m *PgCapture) Marshal(b []byte) ([]byte, error) {
    96  	if b == nil {
    97  		b = make([]byte, m.Size())
    98  	}
    99  	buf := codec.NewBuffer(b)
   100  	buf.EncodeUint32(uint32(m.InterfaceID))
   101  	buf.EncodeBool(m.IsEnabled)
   102  	buf.EncodeUint32(m.Count)
   103  	buf.EncodeString(m.PcapFileName, 0)
   104  	return buf.Bytes(), nil
   105  }
   106  func (m *PgCapture) Unmarshal(b []byte) error {
   107  	buf := codec.NewBuffer(b)
   108  	m.InterfaceID = interface_types.InterfaceIndex(buf.DecodeUint32())
   109  	m.IsEnabled = buf.DecodeBool()
   110  	m.Count = buf.DecodeUint32()
   111  	m.PcapFileName = buf.DecodeString(0)
   112  	return nil
   113  }
   114  
   115  // PgCaptureReply defines message 'pg_capture_reply'.
   116  type PgCaptureReply struct {
   117  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   118  }
   119  
   120  func (m *PgCaptureReply) Reset()               { *m = PgCaptureReply{} }
   121  func (*PgCaptureReply) GetMessageName() string { return "pg_capture_reply" }
   122  func (*PgCaptureReply) GetCrcString() string   { return "e8d4e804" }
   123  func (*PgCaptureReply) GetMessageType() api.MessageType {
   124  	return api.ReplyMessage
   125  }
   126  
   127  func (m *PgCaptureReply) Size() (size int) {
   128  	if m == nil {
   129  		return 0
   130  	}
   131  	size += 4 // m.Retval
   132  	return size
   133  }
   134  func (m *PgCaptureReply) Marshal(b []byte) ([]byte, error) {
   135  	if b == nil {
   136  		b = make([]byte, m.Size())
   137  	}
   138  	buf := codec.NewBuffer(b)
   139  	buf.EncodeInt32(m.Retval)
   140  	return buf.Bytes(), nil
   141  }
   142  func (m *PgCaptureReply) Unmarshal(b []byte) error {
   143  	buf := codec.NewBuffer(b)
   144  	m.Retval = buf.DecodeInt32()
   145  	return nil
   146  }
   147  
   148  // PacketGenerator create interface request
   149  //   - interface_id - interface index
   150  //   - gso_enabled - enable gso on this interface
   151  //   - gso_size - gso size on this interface
   152  //
   153  // PgCreateInterface defines message 'pg_create_interface'.
   154  // Deprecated: the message will be removed in the future versions
   155  type PgCreateInterface struct {
   156  	InterfaceID interface_types.InterfaceIndex `binapi:"interface_index,name=interface_id" json:"interface_id,omitempty"`
   157  	GsoEnabled  bool                           `binapi:"bool,name=gso_enabled" json:"gso_enabled,omitempty"`
   158  	GsoSize     uint32                         `binapi:"u32,name=gso_size" json:"gso_size,omitempty"`
   159  }
   160  
   161  func (m *PgCreateInterface) Reset()               { *m = PgCreateInterface{} }
   162  func (*PgCreateInterface) GetMessageName() string { return "pg_create_interface" }
   163  func (*PgCreateInterface) GetCrcString() string   { return "b7c893d7" }
   164  func (*PgCreateInterface) GetMessageType() api.MessageType {
   165  	return api.RequestMessage
   166  }
   167  
   168  func (m *PgCreateInterface) Size() (size int) {
   169  	if m == nil {
   170  		return 0
   171  	}
   172  	size += 4 // m.InterfaceID
   173  	size += 1 // m.GsoEnabled
   174  	size += 4 // m.GsoSize
   175  	return size
   176  }
   177  func (m *PgCreateInterface) Marshal(b []byte) ([]byte, error) {
   178  	if b == nil {
   179  		b = make([]byte, m.Size())
   180  	}
   181  	buf := codec.NewBuffer(b)
   182  	buf.EncodeUint32(uint32(m.InterfaceID))
   183  	buf.EncodeBool(m.GsoEnabled)
   184  	buf.EncodeUint32(m.GsoSize)
   185  	return buf.Bytes(), nil
   186  }
   187  func (m *PgCreateInterface) Unmarshal(b []byte) error {
   188  	buf := codec.NewBuffer(b)
   189  	m.InterfaceID = interface_types.InterfaceIndex(buf.DecodeUint32())
   190  	m.GsoEnabled = buf.DecodeBool()
   191  	m.GsoSize = buf.DecodeUint32()
   192  	return nil
   193  }
   194  
   195  // PacketGenerator create interface response
   196  //   - retval - return value for request
   197  //
   198  // PgCreateInterfaceReply defines message 'pg_create_interface_reply'.
   199  // Deprecated: the message will be removed in the future versions
   200  type PgCreateInterfaceReply struct {
   201  	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
   202  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   203  }
   204  
   205  func (m *PgCreateInterfaceReply) Reset()               { *m = PgCreateInterfaceReply{} }
   206  func (*PgCreateInterfaceReply) GetMessageName() string { return "pg_create_interface_reply" }
   207  func (*PgCreateInterfaceReply) GetCrcString() string   { return "5383d31f" }
   208  func (*PgCreateInterfaceReply) GetMessageType() api.MessageType {
   209  	return api.ReplyMessage
   210  }
   211  
   212  func (m *PgCreateInterfaceReply) Size() (size int) {
   213  	if m == nil {
   214  		return 0
   215  	}
   216  	size += 4 // m.Retval
   217  	size += 4 // m.SwIfIndex
   218  	return size
   219  }
   220  func (m *PgCreateInterfaceReply) Marshal(b []byte) ([]byte, error) {
   221  	if b == nil {
   222  		b = make([]byte, m.Size())
   223  	}
   224  	buf := codec.NewBuffer(b)
   225  	buf.EncodeInt32(m.Retval)
   226  	buf.EncodeUint32(uint32(m.SwIfIndex))
   227  	return buf.Bytes(), nil
   228  }
   229  func (m *PgCreateInterfaceReply) Unmarshal(b []byte) error {
   230  	buf := codec.NewBuffer(b)
   231  	m.Retval = buf.DecodeInt32()
   232  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   233  	return nil
   234  }
   235  
   236  // PgCreateInterfaceV2 defines message 'pg_create_interface_v2'.
   237  type PgCreateInterfaceV2 struct {
   238  	InterfaceID interface_types.InterfaceIndex `binapi:"interface_index,name=interface_id" json:"interface_id,omitempty"`
   239  	GsoEnabled  bool                           `binapi:"bool,name=gso_enabled" json:"gso_enabled,omitempty"`
   240  	GsoSize     uint32                         `binapi:"u32,name=gso_size" json:"gso_size,omitempty"`
   241  	Mode        PgInterfaceMode                `binapi:"pg_interface_mode,name=mode" json:"mode,omitempty"`
   242  }
   243  
   244  func (m *PgCreateInterfaceV2) Reset()               { *m = PgCreateInterfaceV2{} }
   245  func (*PgCreateInterfaceV2) GetMessageName() string { return "pg_create_interface_v2" }
   246  func (*PgCreateInterfaceV2) GetCrcString() string   { return "8657466a" }
   247  func (*PgCreateInterfaceV2) GetMessageType() api.MessageType {
   248  	return api.RequestMessage
   249  }
   250  
   251  func (m *PgCreateInterfaceV2) Size() (size int) {
   252  	if m == nil {
   253  		return 0
   254  	}
   255  	size += 4 // m.InterfaceID
   256  	size += 1 // m.GsoEnabled
   257  	size += 4 // m.GsoSize
   258  	size += 1 // m.Mode
   259  	return size
   260  }
   261  func (m *PgCreateInterfaceV2) Marshal(b []byte) ([]byte, error) {
   262  	if b == nil {
   263  		b = make([]byte, m.Size())
   264  	}
   265  	buf := codec.NewBuffer(b)
   266  	buf.EncodeUint32(uint32(m.InterfaceID))
   267  	buf.EncodeBool(m.GsoEnabled)
   268  	buf.EncodeUint32(m.GsoSize)
   269  	buf.EncodeUint8(uint8(m.Mode))
   270  	return buf.Bytes(), nil
   271  }
   272  func (m *PgCreateInterfaceV2) Unmarshal(b []byte) error {
   273  	buf := codec.NewBuffer(b)
   274  	m.InterfaceID = interface_types.InterfaceIndex(buf.DecodeUint32())
   275  	m.GsoEnabled = buf.DecodeBool()
   276  	m.GsoSize = buf.DecodeUint32()
   277  	m.Mode = PgInterfaceMode(buf.DecodeUint8())
   278  	return nil
   279  }
   280  
   281  // PgCreateInterfaceV2Reply defines message 'pg_create_interface_v2_reply'.
   282  type PgCreateInterfaceV2Reply struct {
   283  	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
   284  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   285  }
   286  
   287  func (m *PgCreateInterfaceV2Reply) Reset()               { *m = PgCreateInterfaceV2Reply{} }
   288  func (*PgCreateInterfaceV2Reply) GetMessageName() string { return "pg_create_interface_v2_reply" }
   289  func (*PgCreateInterfaceV2Reply) GetCrcString() string   { return "5383d31f" }
   290  func (*PgCreateInterfaceV2Reply) GetMessageType() api.MessageType {
   291  	return api.ReplyMessage
   292  }
   293  
   294  func (m *PgCreateInterfaceV2Reply) Size() (size int) {
   295  	if m == nil {
   296  		return 0
   297  	}
   298  	size += 4 // m.Retval
   299  	size += 4 // m.SwIfIndex
   300  	return size
   301  }
   302  func (m *PgCreateInterfaceV2Reply) Marshal(b []byte) ([]byte, error) {
   303  	if b == nil {
   304  		b = make([]byte, m.Size())
   305  	}
   306  	buf := codec.NewBuffer(b)
   307  	buf.EncodeInt32(m.Retval)
   308  	buf.EncodeUint32(uint32(m.SwIfIndex))
   309  	return buf.Bytes(), nil
   310  }
   311  func (m *PgCreateInterfaceV2Reply) Unmarshal(b []byte) error {
   312  	buf := codec.NewBuffer(b)
   313  	m.Retval = buf.DecodeInt32()
   314  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   315  	return nil
   316  }
   317  
   318  // Enable / disable packet generator request
   319  //   - is_enabled - 1 if enabling streams, 0 if disabling
   320  //   - stream_name - stream name to be enable/disabled, if not specified handle all streams
   321  //
   322  // PgEnableDisable defines message 'pg_enable_disable'.
   323  type PgEnableDisable struct {
   324  	IsEnabled  bool   `binapi:"bool,name=is_enabled,default=true" json:"is_enabled,omitempty"`
   325  	StreamName string `binapi:"string[],name=stream_name" json:"stream_name,omitempty"`
   326  }
   327  
   328  func (m *PgEnableDisable) Reset()               { *m = PgEnableDisable{} }
   329  func (*PgEnableDisable) GetMessageName() string { return "pg_enable_disable" }
   330  func (*PgEnableDisable) GetCrcString() string   { return "01f94f3a" }
   331  func (*PgEnableDisable) GetMessageType() api.MessageType {
   332  	return api.RequestMessage
   333  }
   334  
   335  func (m *PgEnableDisable) Size() (size int) {
   336  	if m == nil {
   337  		return 0
   338  	}
   339  	size += 1                     // m.IsEnabled
   340  	size += 4 + len(m.StreamName) // m.StreamName
   341  	return size
   342  }
   343  func (m *PgEnableDisable) Marshal(b []byte) ([]byte, error) {
   344  	if b == nil {
   345  		b = make([]byte, m.Size())
   346  	}
   347  	buf := codec.NewBuffer(b)
   348  	buf.EncodeBool(m.IsEnabled)
   349  	buf.EncodeString(m.StreamName, 0)
   350  	return buf.Bytes(), nil
   351  }
   352  func (m *PgEnableDisable) Unmarshal(b []byte) error {
   353  	buf := codec.NewBuffer(b)
   354  	m.IsEnabled = buf.DecodeBool()
   355  	m.StreamName = buf.DecodeString(0)
   356  	return nil
   357  }
   358  
   359  // PgEnableDisableReply defines message 'pg_enable_disable_reply'.
   360  type PgEnableDisableReply struct {
   361  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   362  }
   363  
   364  func (m *PgEnableDisableReply) Reset()               { *m = PgEnableDisableReply{} }
   365  func (*PgEnableDisableReply) GetMessageName() string { return "pg_enable_disable_reply" }
   366  func (*PgEnableDisableReply) GetCrcString() string   { return "e8d4e804" }
   367  func (*PgEnableDisableReply) GetMessageType() api.MessageType {
   368  	return api.ReplyMessage
   369  }
   370  
   371  func (m *PgEnableDisableReply) Size() (size int) {
   372  	if m == nil {
   373  		return 0
   374  	}
   375  	size += 4 // m.Retval
   376  	return size
   377  }
   378  func (m *PgEnableDisableReply) Marshal(b []byte) ([]byte, error) {
   379  	if b == nil {
   380  		b = make([]byte, m.Size())
   381  	}
   382  	buf := codec.NewBuffer(b)
   383  	buf.EncodeInt32(m.Retval)
   384  	return buf.Bytes(), nil
   385  }
   386  func (m *PgEnableDisableReply) Unmarshal(b []byte) error {
   387  	buf := codec.NewBuffer(b)
   388  	m.Retval = buf.DecodeInt32()
   389  	return nil
   390  }
   391  
   392  // PacketGenerator interface enable/disable packet coalesce
   393  //   - interface_id - interface index
   394  //   - coalesce_enabled - enable/disable packet coalesce on this interface
   395  //
   396  // PgInterfaceEnableDisableCoalesce defines message 'pg_interface_enable_disable_coalesce'.
   397  // InProgress: the message form may change in the future versions
   398  type PgInterfaceEnableDisableCoalesce struct {
   399  	SwIfIndex       interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   400  	CoalesceEnabled bool                           `binapi:"bool,name=coalesce_enabled" json:"coalesce_enabled,omitempty"`
   401  }
   402  
   403  func (m *PgInterfaceEnableDisableCoalesce) Reset() { *m = PgInterfaceEnableDisableCoalesce{} }
   404  func (*PgInterfaceEnableDisableCoalesce) GetMessageName() string {
   405  	return "pg_interface_enable_disable_coalesce"
   406  }
   407  func (*PgInterfaceEnableDisableCoalesce) GetCrcString() string { return "a2ef99e7" }
   408  func (*PgInterfaceEnableDisableCoalesce) GetMessageType() api.MessageType {
   409  	return api.RequestMessage
   410  }
   411  
   412  func (m *PgInterfaceEnableDisableCoalesce) Size() (size int) {
   413  	if m == nil {
   414  		return 0
   415  	}
   416  	size += 4 // m.SwIfIndex
   417  	size += 1 // m.CoalesceEnabled
   418  	return size
   419  }
   420  func (m *PgInterfaceEnableDisableCoalesce) Marshal(b []byte) ([]byte, error) {
   421  	if b == nil {
   422  		b = make([]byte, m.Size())
   423  	}
   424  	buf := codec.NewBuffer(b)
   425  	buf.EncodeUint32(uint32(m.SwIfIndex))
   426  	buf.EncodeBool(m.CoalesceEnabled)
   427  	return buf.Bytes(), nil
   428  }
   429  func (m *PgInterfaceEnableDisableCoalesce) Unmarshal(b []byte) error {
   430  	buf := codec.NewBuffer(b)
   431  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   432  	m.CoalesceEnabled = buf.DecodeBool()
   433  	return nil
   434  }
   435  
   436  // PgInterfaceEnableDisableCoalesceReply defines message 'pg_interface_enable_disable_coalesce_reply'.
   437  // InProgress: the message form may change in the future versions
   438  type PgInterfaceEnableDisableCoalesceReply struct {
   439  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   440  }
   441  
   442  func (m *PgInterfaceEnableDisableCoalesceReply) Reset() { *m = PgInterfaceEnableDisableCoalesceReply{} }
   443  func (*PgInterfaceEnableDisableCoalesceReply) GetMessageName() string {
   444  	return "pg_interface_enable_disable_coalesce_reply"
   445  }
   446  func (*PgInterfaceEnableDisableCoalesceReply) GetCrcString() string { return "e8d4e804" }
   447  func (*PgInterfaceEnableDisableCoalesceReply) GetMessageType() api.MessageType {
   448  	return api.ReplyMessage
   449  }
   450  
   451  func (m *PgInterfaceEnableDisableCoalesceReply) Size() (size int) {
   452  	if m == nil {
   453  		return 0
   454  	}
   455  	size += 4 // m.Retval
   456  	return size
   457  }
   458  func (m *PgInterfaceEnableDisableCoalesceReply) Marshal(b []byte) ([]byte, error) {
   459  	if b == nil {
   460  		b = make([]byte, m.Size())
   461  	}
   462  	buf := codec.NewBuffer(b)
   463  	buf.EncodeInt32(m.Retval)
   464  	return buf.Bytes(), nil
   465  }
   466  func (m *PgInterfaceEnableDisableCoalesceReply) Unmarshal(b []byte) error {
   467  	buf := codec.NewBuffer(b)
   468  	m.Retval = buf.DecodeInt32()
   469  	return nil
   470  }
   471  
   472  func init() { file_pg_binapi_init() }
   473  func file_pg_binapi_init() {
   474  	api.RegisterMessage((*PgCapture)(nil), "pg_capture_3712fb6c")
   475  	api.RegisterMessage((*PgCaptureReply)(nil), "pg_capture_reply_e8d4e804")
   476  	api.RegisterMessage((*PgCreateInterface)(nil), "pg_create_interface_b7c893d7")
   477  	api.RegisterMessage((*PgCreateInterfaceReply)(nil), "pg_create_interface_reply_5383d31f")
   478  	api.RegisterMessage((*PgCreateInterfaceV2)(nil), "pg_create_interface_v2_8657466a")
   479  	api.RegisterMessage((*PgCreateInterfaceV2Reply)(nil), "pg_create_interface_v2_reply_5383d31f")
   480  	api.RegisterMessage((*PgEnableDisable)(nil), "pg_enable_disable_01f94f3a")
   481  	api.RegisterMessage((*PgEnableDisableReply)(nil), "pg_enable_disable_reply_e8d4e804")
   482  	api.RegisterMessage((*PgInterfaceEnableDisableCoalesce)(nil), "pg_interface_enable_disable_coalesce_a2ef99e7")
   483  	api.RegisterMessage((*PgInterfaceEnableDisableCoalesceReply)(nil), "pg_interface_enable_disable_coalesce_reply_e8d4e804")
   484  }
   485  
   486  // Messages returns list of all messages in this module.
   487  func AllMessages() []api.Message {
   488  	return []api.Message{
   489  		(*PgCapture)(nil),
   490  		(*PgCaptureReply)(nil),
   491  		(*PgCreateInterface)(nil),
   492  		(*PgCreateInterfaceReply)(nil),
   493  		(*PgCreateInterfaceV2)(nil),
   494  		(*PgCreateInterfaceV2Reply)(nil),
   495  		(*PgEnableDisable)(nil),
   496  		(*PgEnableDisableReply)(nil),
   497  		(*PgInterfaceEnableDisableCoalesce)(nil),
   498  		(*PgInterfaceEnableDisableCoalesceReply)(nil),
   499  	}
   500  }