github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/binapi/mactime/mactime.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/mactime.api.json
     6  
     7  // Package mactime contains generated bindings for API file mactime.api.
     8  //
     9  // Contents:
    10  //   2 structs
    11  //   7 messages
    12  //
    13  package mactime
    14  
    15  import (
    16  	api "git.fd.io/govpp.git/api"
    17  	codec "git.fd.io/govpp.git/codec"
    18  	ethernet_types "github.com/edwarnicke/govpp/binapi/ethernet_types"
    19  	interface_types "github.com/edwarnicke/govpp/binapi/interface_types"
    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    = "mactime"
    30  	APIVersion = "2.0.0"
    31  	VersionCrc = 0xc72e296e
    32  )
    33  
    34  // MactimeTimeRange defines type 'mactime_time_range'.
    35  type MactimeTimeRange struct {
    36  	Start float64 `binapi:"f64,name=start" json:"start,omitempty"`
    37  	End   float64 `binapi:"f64,name=end" json:"end,omitempty"`
    38  }
    39  
    40  // TimeRange defines type 'time_range'.
    41  type TimeRange struct {
    42  	Start float64 `binapi:"f64,name=start" json:"start,omitempty"`
    43  	End   float64 `binapi:"f64,name=end" json:"end,omitempty"`
    44  }
    45  
    46  // MactimeAddDelRange defines message 'mactime_add_del_range'.
    47  type MactimeAddDelRange struct {
    48  	IsAdd      bool                      `binapi:"bool,name=is_add" json:"is_add,omitempty"`
    49  	Drop       bool                      `binapi:"bool,name=drop" json:"drop,omitempty"`
    50  	Allow      bool                      `binapi:"bool,name=allow" json:"allow,omitempty"`
    51  	AllowQuota uint8                     `binapi:"u8,name=allow_quota" json:"allow_quota,omitempty"`
    52  	NoUDP10001 bool                      `binapi:"bool,name=no_udp_10001" json:"no_udp_10001,omitempty"`
    53  	DataQuota  uint64                    `binapi:"u64,name=data_quota" json:"data_quota,omitempty"`
    54  	MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
    55  	DeviceName string                    `binapi:"string[64],name=device_name" json:"device_name,omitempty"`
    56  	Count      uint32                    `binapi:"u32,name=count" json:"-"`
    57  	Ranges     []TimeRange               `binapi:"time_range[count],name=ranges" json:"ranges,omitempty"`
    58  }
    59  
    60  func (m *MactimeAddDelRange) Reset()               { *m = MactimeAddDelRange{} }
    61  func (*MactimeAddDelRange) GetMessageName() string { return "mactime_add_del_range" }
    62  func (*MactimeAddDelRange) GetCrcString() string   { return "cb56e877" }
    63  func (*MactimeAddDelRange) GetMessageType() api.MessageType {
    64  	return api.RequestMessage
    65  }
    66  
    67  func (m *MactimeAddDelRange) Size() (size int) {
    68  	if m == nil {
    69  		return 0
    70  	}
    71  	size += 1     // m.IsAdd
    72  	size += 1     // m.Drop
    73  	size += 1     // m.Allow
    74  	size += 1     // m.AllowQuota
    75  	size += 1     // m.NoUDP10001
    76  	size += 8     // m.DataQuota
    77  	size += 1 * 6 // m.MacAddress
    78  	size += 64    // m.DeviceName
    79  	size += 4     // m.Count
    80  	for j1 := 0; j1 < len(m.Ranges); j1++ {
    81  		var s1 TimeRange
    82  		_ = s1
    83  		if j1 < len(m.Ranges) {
    84  			s1 = m.Ranges[j1]
    85  		}
    86  		size += 8 // s1.Start
    87  		size += 8 // s1.End
    88  	}
    89  	return size
    90  }
    91  func (m *MactimeAddDelRange) Marshal(b []byte) ([]byte, error) {
    92  	if b == nil {
    93  		b = make([]byte, m.Size())
    94  	}
    95  	buf := codec.NewBuffer(b)
    96  	buf.EncodeBool(m.IsAdd)
    97  	buf.EncodeBool(m.Drop)
    98  	buf.EncodeBool(m.Allow)
    99  	buf.EncodeUint8(m.AllowQuota)
   100  	buf.EncodeBool(m.NoUDP10001)
   101  	buf.EncodeUint64(m.DataQuota)
   102  	buf.EncodeBytes(m.MacAddress[:], 6)
   103  	buf.EncodeString(m.DeviceName, 64)
   104  	buf.EncodeUint32(uint32(len(m.Ranges)))
   105  	for j0 := 0; j0 < len(m.Ranges); j0++ {
   106  		var v0 TimeRange // Ranges
   107  		if j0 < len(m.Ranges) {
   108  			v0 = m.Ranges[j0]
   109  		}
   110  		buf.EncodeFloat64(v0.Start)
   111  		buf.EncodeFloat64(v0.End)
   112  	}
   113  	return buf.Bytes(), nil
   114  }
   115  func (m *MactimeAddDelRange) Unmarshal(b []byte) error {
   116  	buf := codec.NewBuffer(b)
   117  	m.IsAdd = buf.DecodeBool()
   118  	m.Drop = buf.DecodeBool()
   119  	m.Allow = buf.DecodeBool()
   120  	m.AllowQuota = buf.DecodeUint8()
   121  	m.NoUDP10001 = buf.DecodeBool()
   122  	m.DataQuota = buf.DecodeUint64()
   123  	copy(m.MacAddress[:], buf.DecodeBytes(6))
   124  	m.DeviceName = buf.DecodeString(64)
   125  	m.Count = buf.DecodeUint32()
   126  	m.Ranges = make([]TimeRange, m.Count)
   127  	for j0 := 0; j0 < len(m.Ranges); j0++ {
   128  		m.Ranges[j0].Start = buf.DecodeFloat64()
   129  		m.Ranges[j0].End = buf.DecodeFloat64()
   130  	}
   131  	return nil
   132  }
   133  
   134  // MactimeAddDelRangeReply defines message 'mactime_add_del_range_reply'.
   135  type MactimeAddDelRangeReply struct {
   136  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   137  }
   138  
   139  func (m *MactimeAddDelRangeReply) Reset()               { *m = MactimeAddDelRangeReply{} }
   140  func (*MactimeAddDelRangeReply) GetMessageName() string { return "mactime_add_del_range_reply" }
   141  func (*MactimeAddDelRangeReply) GetCrcString() string   { return "e8d4e804" }
   142  func (*MactimeAddDelRangeReply) GetMessageType() api.MessageType {
   143  	return api.ReplyMessage
   144  }
   145  
   146  func (m *MactimeAddDelRangeReply) Size() (size int) {
   147  	if m == nil {
   148  		return 0
   149  	}
   150  	size += 4 // m.Retval
   151  	return size
   152  }
   153  func (m *MactimeAddDelRangeReply) Marshal(b []byte) ([]byte, error) {
   154  	if b == nil {
   155  		b = make([]byte, m.Size())
   156  	}
   157  	buf := codec.NewBuffer(b)
   158  	buf.EncodeInt32(m.Retval)
   159  	return buf.Bytes(), nil
   160  }
   161  func (m *MactimeAddDelRangeReply) Unmarshal(b []byte) error {
   162  	buf := codec.NewBuffer(b)
   163  	m.Retval = buf.DecodeInt32()
   164  	return nil
   165  }
   166  
   167  // MactimeDetails defines message 'mactime_details'.
   168  type MactimeDetails struct {
   169  	PoolIndex       uint32                    `binapi:"u32,name=pool_index" json:"pool_index,omitempty"`
   170  	MacAddress      ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
   171  	DataQuota       uint64                    `binapi:"u64,name=data_quota" json:"data_quota,omitempty"`
   172  	DataUsedInRange uint64                    `binapi:"u64,name=data_used_in_range" json:"data_used_in_range,omitempty"`
   173  	Flags           uint32                    `binapi:"u32,name=flags" json:"flags,omitempty"`
   174  	DeviceName      string                    `binapi:"string[64],name=device_name" json:"device_name,omitempty"`
   175  	Nranges         uint32                    `binapi:"u32,name=nranges" json:"-"`
   176  	Ranges          []MactimeTimeRange        `binapi:"mactime_time_range[nranges],name=ranges" json:"ranges,omitempty"`
   177  }
   178  
   179  func (m *MactimeDetails) Reset()               { *m = MactimeDetails{} }
   180  func (*MactimeDetails) GetMessageName() string { return "mactime_details" }
   181  func (*MactimeDetails) GetCrcString() string   { return "da25b13a" }
   182  func (*MactimeDetails) GetMessageType() api.MessageType {
   183  	return api.ReplyMessage
   184  }
   185  
   186  func (m *MactimeDetails) Size() (size int) {
   187  	if m == nil {
   188  		return 0
   189  	}
   190  	size += 4     // m.PoolIndex
   191  	size += 1 * 6 // m.MacAddress
   192  	size += 8     // m.DataQuota
   193  	size += 8     // m.DataUsedInRange
   194  	size += 4     // m.Flags
   195  	size += 64    // m.DeviceName
   196  	size += 4     // m.Nranges
   197  	for j1 := 0; j1 < len(m.Ranges); j1++ {
   198  		var s1 MactimeTimeRange
   199  		_ = s1
   200  		if j1 < len(m.Ranges) {
   201  			s1 = m.Ranges[j1]
   202  		}
   203  		size += 8 // s1.Start
   204  		size += 8 // s1.End
   205  	}
   206  	return size
   207  }
   208  func (m *MactimeDetails) Marshal(b []byte) ([]byte, error) {
   209  	if b == nil {
   210  		b = make([]byte, m.Size())
   211  	}
   212  	buf := codec.NewBuffer(b)
   213  	buf.EncodeUint32(m.PoolIndex)
   214  	buf.EncodeBytes(m.MacAddress[:], 6)
   215  	buf.EncodeUint64(m.DataQuota)
   216  	buf.EncodeUint64(m.DataUsedInRange)
   217  	buf.EncodeUint32(m.Flags)
   218  	buf.EncodeString(m.DeviceName, 64)
   219  	buf.EncodeUint32(uint32(len(m.Ranges)))
   220  	for j0 := 0; j0 < len(m.Ranges); j0++ {
   221  		var v0 MactimeTimeRange // Ranges
   222  		if j0 < len(m.Ranges) {
   223  			v0 = m.Ranges[j0]
   224  		}
   225  		buf.EncodeFloat64(v0.Start)
   226  		buf.EncodeFloat64(v0.End)
   227  	}
   228  	return buf.Bytes(), nil
   229  }
   230  func (m *MactimeDetails) Unmarshal(b []byte) error {
   231  	buf := codec.NewBuffer(b)
   232  	m.PoolIndex = buf.DecodeUint32()
   233  	copy(m.MacAddress[:], buf.DecodeBytes(6))
   234  	m.DataQuota = buf.DecodeUint64()
   235  	m.DataUsedInRange = buf.DecodeUint64()
   236  	m.Flags = buf.DecodeUint32()
   237  	m.DeviceName = buf.DecodeString(64)
   238  	m.Nranges = buf.DecodeUint32()
   239  	m.Ranges = make([]MactimeTimeRange, m.Nranges)
   240  	for j0 := 0; j0 < len(m.Ranges); j0++ {
   241  		m.Ranges[j0].Start = buf.DecodeFloat64()
   242  		m.Ranges[j0].End = buf.DecodeFloat64()
   243  	}
   244  	return nil
   245  }
   246  
   247  // MactimeDump defines message 'mactime_dump'.
   248  type MactimeDump struct {
   249  	MyTableEpoch uint32 `binapi:"u32,name=my_table_epoch" json:"my_table_epoch,omitempty"`
   250  }
   251  
   252  func (m *MactimeDump) Reset()               { *m = MactimeDump{} }
   253  func (*MactimeDump) GetMessageName() string { return "mactime_dump" }
   254  func (*MactimeDump) GetCrcString() string   { return "8f454e23" }
   255  func (*MactimeDump) GetMessageType() api.MessageType {
   256  	return api.RequestMessage
   257  }
   258  
   259  func (m *MactimeDump) Size() (size int) {
   260  	if m == nil {
   261  		return 0
   262  	}
   263  	size += 4 // m.MyTableEpoch
   264  	return size
   265  }
   266  func (m *MactimeDump) Marshal(b []byte) ([]byte, error) {
   267  	if b == nil {
   268  		b = make([]byte, m.Size())
   269  	}
   270  	buf := codec.NewBuffer(b)
   271  	buf.EncodeUint32(m.MyTableEpoch)
   272  	return buf.Bytes(), nil
   273  }
   274  func (m *MactimeDump) Unmarshal(b []byte) error {
   275  	buf := codec.NewBuffer(b)
   276  	m.MyTableEpoch = buf.DecodeUint32()
   277  	return nil
   278  }
   279  
   280  // MactimeDumpReply defines message 'mactime_dump_reply'.
   281  type MactimeDumpReply struct {
   282  	Retval     int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
   283  	TableEpoch uint32 `binapi:"u32,name=table_epoch" json:"table_epoch,omitempty"`
   284  }
   285  
   286  func (m *MactimeDumpReply) Reset()               { *m = MactimeDumpReply{} }
   287  func (*MactimeDumpReply) GetMessageName() string { return "mactime_dump_reply" }
   288  func (*MactimeDumpReply) GetCrcString() string   { return "49bcc753" }
   289  func (*MactimeDumpReply) GetMessageType() api.MessageType {
   290  	return api.ReplyMessage
   291  }
   292  
   293  func (m *MactimeDumpReply) Size() (size int) {
   294  	if m == nil {
   295  		return 0
   296  	}
   297  	size += 4 // m.Retval
   298  	size += 4 // m.TableEpoch
   299  	return size
   300  }
   301  func (m *MactimeDumpReply) Marshal(b []byte) ([]byte, error) {
   302  	if b == nil {
   303  		b = make([]byte, m.Size())
   304  	}
   305  	buf := codec.NewBuffer(b)
   306  	buf.EncodeInt32(m.Retval)
   307  	buf.EncodeUint32(m.TableEpoch)
   308  	return buf.Bytes(), nil
   309  }
   310  func (m *MactimeDumpReply) Unmarshal(b []byte) error {
   311  	buf := codec.NewBuffer(b)
   312  	m.Retval = buf.DecodeInt32()
   313  	m.TableEpoch = buf.DecodeUint32()
   314  	return nil
   315  }
   316  
   317  // MactimeEnableDisable defines message 'mactime_enable_disable'.
   318  type MactimeEnableDisable struct {
   319  	EnableDisable bool                           `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"`
   320  	SwIfIndex     interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   321  }
   322  
   323  func (m *MactimeEnableDisable) Reset()               { *m = MactimeEnableDisable{} }
   324  func (*MactimeEnableDisable) GetMessageName() string { return "mactime_enable_disable" }
   325  func (*MactimeEnableDisable) GetCrcString() string   { return "3865946c" }
   326  func (*MactimeEnableDisable) GetMessageType() api.MessageType {
   327  	return api.RequestMessage
   328  }
   329  
   330  func (m *MactimeEnableDisable) Size() (size int) {
   331  	if m == nil {
   332  		return 0
   333  	}
   334  	size += 1 // m.EnableDisable
   335  	size += 4 // m.SwIfIndex
   336  	return size
   337  }
   338  func (m *MactimeEnableDisable) Marshal(b []byte) ([]byte, error) {
   339  	if b == nil {
   340  		b = make([]byte, m.Size())
   341  	}
   342  	buf := codec.NewBuffer(b)
   343  	buf.EncodeBool(m.EnableDisable)
   344  	buf.EncodeUint32(uint32(m.SwIfIndex))
   345  	return buf.Bytes(), nil
   346  }
   347  func (m *MactimeEnableDisable) Unmarshal(b []byte) error {
   348  	buf := codec.NewBuffer(b)
   349  	m.EnableDisable = buf.DecodeBool()
   350  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   351  	return nil
   352  }
   353  
   354  // MactimeEnableDisableReply defines message 'mactime_enable_disable_reply'.
   355  type MactimeEnableDisableReply struct {
   356  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   357  }
   358  
   359  func (m *MactimeEnableDisableReply) Reset()               { *m = MactimeEnableDisableReply{} }
   360  func (*MactimeEnableDisableReply) GetMessageName() string { return "mactime_enable_disable_reply" }
   361  func (*MactimeEnableDisableReply) GetCrcString() string   { return "e8d4e804" }
   362  func (*MactimeEnableDisableReply) GetMessageType() api.MessageType {
   363  	return api.ReplyMessage
   364  }
   365  
   366  func (m *MactimeEnableDisableReply) Size() (size int) {
   367  	if m == nil {
   368  		return 0
   369  	}
   370  	size += 4 // m.Retval
   371  	return size
   372  }
   373  func (m *MactimeEnableDisableReply) Marshal(b []byte) ([]byte, error) {
   374  	if b == nil {
   375  		b = make([]byte, m.Size())
   376  	}
   377  	buf := codec.NewBuffer(b)
   378  	buf.EncodeInt32(m.Retval)
   379  	return buf.Bytes(), nil
   380  }
   381  func (m *MactimeEnableDisableReply) Unmarshal(b []byte) error {
   382  	buf := codec.NewBuffer(b)
   383  	m.Retval = buf.DecodeInt32()
   384  	return nil
   385  }
   386  
   387  func init() { file_mactime_binapi_init() }
   388  func file_mactime_binapi_init() {
   389  	api.RegisterMessage((*MactimeAddDelRange)(nil), "mactime_add_del_range_cb56e877")
   390  	api.RegisterMessage((*MactimeAddDelRangeReply)(nil), "mactime_add_del_range_reply_e8d4e804")
   391  	api.RegisterMessage((*MactimeDetails)(nil), "mactime_details_da25b13a")
   392  	api.RegisterMessage((*MactimeDump)(nil), "mactime_dump_8f454e23")
   393  	api.RegisterMessage((*MactimeDumpReply)(nil), "mactime_dump_reply_49bcc753")
   394  	api.RegisterMessage((*MactimeEnableDisable)(nil), "mactime_enable_disable_3865946c")
   395  	api.RegisterMessage((*MactimeEnableDisableReply)(nil), "mactime_enable_disable_reply_e8d4e804")
   396  }
   397  
   398  // Messages returns list of all messages in this module.
   399  func AllMessages() []api.Message {
   400  	return []api.Message{
   401  		(*MactimeAddDelRange)(nil),
   402  		(*MactimeAddDelRangeReply)(nil),
   403  		(*MactimeDetails)(nil),
   404  		(*MactimeDump)(nil),
   405  		(*MactimeDumpReply)(nil),
   406  		(*MactimeEnableDisable)(nil),
   407  		(*MactimeEnableDisableReply)(nil),
   408  	}
   409  }