github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/lldp/lldp.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: plugins/lldp.api.json
     6  
     7  // Package lldp contains generated bindings for API file lldp.api.
     8  //
     9  // Contents:
    10  // -  4 messages
    11  package lldp
    12  
    13  import (
    14  	interface_types "github.com/networkservicemesh/govpp/binapi/interface_types"
    15  	ip_types "github.com/networkservicemesh/govpp/binapi/ip_types"
    16  	api "go.fd.io/govpp/api"
    17  	codec "go.fd.io/govpp/codec"
    18  )
    19  
    20  // This is a compile-time assertion to ensure that this generated file
    21  // is compatible with the GoVPP api package it is being compiled against.
    22  // A compilation error at this line likely means your copy of the
    23  // GoVPP api package needs to be updated.
    24  const _ = api.GoVppAPIPackageIsVersion2
    25  
    26  const (
    27  	APIFile    = "lldp"
    28  	APIVersion = "2.0.0"
    29  	VersionCrc = 0x8a7e7049
    30  )
    31  
    32  // configure global parameter for LLDP
    33  //   - system_name - VPP system name
    34  //   - tx_hold - multiplier for tx_interval when setting time-to-live (TTL)
    35  //     value in the LLDP packets
    36  //   - tx_interval - time interval, in seconds, between each LLDP frames
    37  //
    38  // LldpConfig defines message 'lldp_config'.
    39  type LldpConfig struct {
    40  	TxHold     uint32 `binapi:"u32,name=tx_hold" json:"tx_hold,omitempty"`
    41  	TxInterval uint32 `binapi:"u32,name=tx_interval" json:"tx_interval,omitempty"`
    42  	SystemName string `binapi:"string[],name=system_name" json:"system_name,omitempty"`
    43  }
    44  
    45  func (m *LldpConfig) Reset()               { *m = LldpConfig{} }
    46  func (*LldpConfig) GetMessageName() string { return "lldp_config" }
    47  func (*LldpConfig) GetCrcString() string   { return "c14445df" }
    48  func (*LldpConfig) GetMessageType() api.MessageType {
    49  	return api.RequestMessage
    50  }
    51  
    52  func (m *LldpConfig) Size() (size int) {
    53  	if m == nil {
    54  		return 0
    55  	}
    56  	size += 4                     // m.TxHold
    57  	size += 4                     // m.TxInterval
    58  	size += 4 + len(m.SystemName) // m.SystemName
    59  	return size
    60  }
    61  func (m *LldpConfig) Marshal(b []byte) ([]byte, error) {
    62  	if b == nil {
    63  		b = make([]byte, m.Size())
    64  	}
    65  	buf := codec.NewBuffer(b)
    66  	buf.EncodeUint32(m.TxHold)
    67  	buf.EncodeUint32(m.TxInterval)
    68  	buf.EncodeString(m.SystemName, 0)
    69  	return buf.Bytes(), nil
    70  }
    71  func (m *LldpConfig) Unmarshal(b []byte) error {
    72  	buf := codec.NewBuffer(b)
    73  	m.TxHold = buf.DecodeUint32()
    74  	m.TxInterval = buf.DecodeUint32()
    75  	m.SystemName = buf.DecodeString(0)
    76  	return nil
    77  }
    78  
    79  // LldpConfigReply defines message 'lldp_config_reply'.
    80  type LldpConfigReply struct {
    81  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
    82  }
    83  
    84  func (m *LldpConfigReply) Reset()               { *m = LldpConfigReply{} }
    85  func (*LldpConfigReply) GetMessageName() string { return "lldp_config_reply" }
    86  func (*LldpConfigReply) GetCrcString() string   { return "e8d4e804" }
    87  func (*LldpConfigReply) GetMessageType() api.MessageType {
    88  	return api.ReplyMessage
    89  }
    90  
    91  func (m *LldpConfigReply) Size() (size int) {
    92  	if m == nil {
    93  		return 0
    94  	}
    95  	size += 4 // m.Retval
    96  	return size
    97  }
    98  func (m *LldpConfigReply) Marshal(b []byte) ([]byte, error) {
    99  	if b == nil {
   100  		b = make([]byte, m.Size())
   101  	}
   102  	buf := codec.NewBuffer(b)
   103  	buf.EncodeInt32(m.Retval)
   104  	return buf.Bytes(), nil
   105  }
   106  func (m *LldpConfigReply) Unmarshal(b []byte) error {
   107  	buf := codec.NewBuffer(b)
   108  	m.Retval = buf.DecodeInt32()
   109  	return nil
   110  }
   111  
   112  // Interface set LLDP request
   113  //   - sw_if_index - interface for which to enable/disable LLDP
   114  //   - mgmt_ip4_addr - management ip4 address of the interface
   115  //   - mgmt_ip6_addr - management ip6 address of the interface
   116  //   - mgmt_oid - OID(Object Identifier) of the interface
   117  //   - enable - if non-zero enable, else disable
   118  //   - port_desc - local port description
   119  //
   120  // SwInterfaceSetLldp defines message 'sw_interface_set_lldp'.
   121  type SwInterfaceSetLldp struct {
   122  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   123  	MgmtIP4   ip_types.IP4Address            `binapi:"ip4_address,name=mgmt_ip4" json:"mgmt_ip4,omitempty"`
   124  	MgmtIP6   ip_types.IP6Address            `binapi:"ip6_address,name=mgmt_ip6" json:"mgmt_ip6,omitempty"`
   125  	MgmtOid   []byte                         `binapi:"u8[128],name=mgmt_oid" json:"mgmt_oid,omitempty"`
   126  	Enable    bool                           `binapi:"bool,name=enable,default=true" json:"enable,omitempty"`
   127  	PortDesc  string                         `binapi:"string[],name=port_desc" json:"port_desc,omitempty"`
   128  }
   129  
   130  func (m *SwInterfaceSetLldp) Reset()               { *m = SwInterfaceSetLldp{} }
   131  func (*SwInterfaceSetLldp) GetMessageName() string { return "sw_interface_set_lldp" }
   132  func (*SwInterfaceSetLldp) GetCrcString() string   { return "57afbcd4" }
   133  func (*SwInterfaceSetLldp) GetMessageType() api.MessageType {
   134  	return api.RequestMessage
   135  }
   136  
   137  func (m *SwInterfaceSetLldp) Size() (size int) {
   138  	if m == nil {
   139  		return 0
   140  	}
   141  	size += 4                   // m.SwIfIndex
   142  	size += 1 * 4               // m.MgmtIP4
   143  	size += 1 * 16              // m.MgmtIP6
   144  	size += 1 * 128             // m.MgmtOid
   145  	size += 1                   // m.Enable
   146  	size += 4 + len(m.PortDesc) // m.PortDesc
   147  	return size
   148  }
   149  func (m *SwInterfaceSetLldp) Marshal(b []byte) ([]byte, error) {
   150  	if b == nil {
   151  		b = make([]byte, m.Size())
   152  	}
   153  	buf := codec.NewBuffer(b)
   154  	buf.EncodeUint32(uint32(m.SwIfIndex))
   155  	buf.EncodeBytes(m.MgmtIP4[:], 4)
   156  	buf.EncodeBytes(m.MgmtIP6[:], 16)
   157  	buf.EncodeBytes(m.MgmtOid, 128)
   158  	buf.EncodeBool(m.Enable)
   159  	buf.EncodeString(m.PortDesc, 0)
   160  	return buf.Bytes(), nil
   161  }
   162  func (m *SwInterfaceSetLldp) Unmarshal(b []byte) error {
   163  	buf := codec.NewBuffer(b)
   164  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   165  	copy(m.MgmtIP4[:], buf.DecodeBytes(4))
   166  	copy(m.MgmtIP6[:], buf.DecodeBytes(16))
   167  	m.MgmtOid = make([]byte, 128)
   168  	copy(m.MgmtOid, buf.DecodeBytes(len(m.MgmtOid)))
   169  	m.Enable = buf.DecodeBool()
   170  	m.PortDesc = buf.DecodeString(0)
   171  	return nil
   172  }
   173  
   174  // SwInterfaceSetLldpReply defines message 'sw_interface_set_lldp_reply'.
   175  type SwInterfaceSetLldpReply struct {
   176  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   177  }
   178  
   179  func (m *SwInterfaceSetLldpReply) Reset()               { *m = SwInterfaceSetLldpReply{} }
   180  func (*SwInterfaceSetLldpReply) GetMessageName() string { return "sw_interface_set_lldp_reply" }
   181  func (*SwInterfaceSetLldpReply) GetCrcString() string   { return "e8d4e804" }
   182  func (*SwInterfaceSetLldpReply) GetMessageType() api.MessageType {
   183  	return api.ReplyMessage
   184  }
   185  
   186  func (m *SwInterfaceSetLldpReply) Size() (size int) {
   187  	if m == nil {
   188  		return 0
   189  	}
   190  	size += 4 // m.Retval
   191  	return size
   192  }
   193  func (m *SwInterfaceSetLldpReply) Marshal(b []byte) ([]byte, error) {
   194  	if b == nil {
   195  		b = make([]byte, m.Size())
   196  	}
   197  	buf := codec.NewBuffer(b)
   198  	buf.EncodeInt32(m.Retval)
   199  	return buf.Bytes(), nil
   200  }
   201  func (m *SwInterfaceSetLldpReply) Unmarshal(b []byte) error {
   202  	buf := codec.NewBuffer(b)
   203  	m.Retval = buf.DecodeInt32()
   204  	return nil
   205  }
   206  
   207  func init() { file_lldp_binapi_init() }
   208  func file_lldp_binapi_init() {
   209  	api.RegisterMessage((*LldpConfig)(nil), "lldp_config_c14445df")
   210  	api.RegisterMessage((*LldpConfigReply)(nil), "lldp_config_reply_e8d4e804")
   211  	api.RegisterMessage((*SwInterfaceSetLldp)(nil), "sw_interface_set_lldp_57afbcd4")
   212  	api.RegisterMessage((*SwInterfaceSetLldpReply)(nil), "sw_interface_set_lldp_reply_e8d4e804")
   213  }
   214  
   215  // Messages returns list of all messages in this module.
   216  func AllMessages() []api.Message {
   217  	return []api.Message{
   218  		(*LldpConfig)(nil),
   219  		(*LldpConfigReply)(nil),
   220  		(*SwInterfaceSetLldp)(nil),
   221  		(*SwInterfaceSetLldpReply)(nil),
   222  	}
   223  }