go.ligato.io/vpp-agent/v3@v3.5.0/plugins/vpp/binapi/vpp2106/span/span.ba.go (about)

     1  // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
     2  
     3  // Package span contains generated bindings for API file span.api.
     4  //
     5  // Contents:
     6  // -  1 enum
     7  // -  4 messages
     8  package span
     9  
    10  import (
    11  	"strconv"
    12  
    13  	api "go.fd.io/govpp/api"
    14  	codec "go.fd.io/govpp/codec"
    15  	interface_types "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2106/interface_types"
    16  )
    17  
    18  // This is a compile-time assertion to ensure that this generated file
    19  // is compatible with the GoVPP api package it is being compiled against.
    20  // A compilation error at this line likely means your copy of the
    21  // GoVPP api package needs to be updated.
    22  const _ = api.GoVppAPIPackageIsVersion2
    23  
    24  const (
    25  	APIFile    = "span"
    26  	APIVersion = "2.0.0"
    27  	VersionCrc = 0x34ee02b
    28  )
    29  
    30  // SpanState defines enum 'span_state'.
    31  type SpanState uint32
    32  
    33  const (
    34  	SPAN_STATE_API_DISABLED SpanState = 0
    35  	SPAN_STATE_API_RX       SpanState = 1
    36  	SPAN_STATE_API_TX       SpanState = 2
    37  	SPAN_STATE_API_RX_TX    SpanState = 3
    38  )
    39  
    40  var (
    41  	SpanState_name = map[uint32]string{
    42  		0: "SPAN_STATE_API_DISABLED",
    43  		1: "SPAN_STATE_API_RX",
    44  		2: "SPAN_STATE_API_TX",
    45  		3: "SPAN_STATE_API_RX_TX",
    46  	}
    47  	SpanState_value = map[string]uint32{
    48  		"SPAN_STATE_API_DISABLED": 0,
    49  		"SPAN_STATE_API_RX":       1,
    50  		"SPAN_STATE_API_TX":       2,
    51  		"SPAN_STATE_API_RX_TX":    3,
    52  	}
    53  )
    54  
    55  func (x SpanState) String() string {
    56  	s, ok := SpanState_name[uint32(x)]
    57  	if ok {
    58  		return s
    59  	}
    60  	return "SpanState(" + strconv.Itoa(int(x)) + ")"
    61  }
    62  
    63  // SwInterfaceSpanDetails defines message 'sw_interface_span_details'.
    64  type SwInterfaceSpanDetails struct {
    65  	SwIfIndexFrom interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_from" json:"sw_if_index_from,omitempty"`
    66  	SwIfIndexTo   interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_to" json:"sw_if_index_to,omitempty"`
    67  	State         SpanState                      `binapi:"span_state,name=state" json:"state,omitempty"`
    68  	IsL2          bool                           `binapi:"bool,name=is_l2" json:"is_l2,omitempty"`
    69  }
    70  
    71  func (m *SwInterfaceSpanDetails) Reset()               { *m = SwInterfaceSpanDetails{} }
    72  func (*SwInterfaceSpanDetails) GetMessageName() string { return "sw_interface_span_details" }
    73  func (*SwInterfaceSpanDetails) GetCrcString() string   { return "8a20e79f" }
    74  func (*SwInterfaceSpanDetails) GetMessageType() api.MessageType {
    75  	return api.ReplyMessage
    76  }
    77  
    78  func (m *SwInterfaceSpanDetails) Size() (size int) {
    79  	if m == nil {
    80  		return 0
    81  	}
    82  	size += 4 // m.SwIfIndexFrom
    83  	size += 4 // m.SwIfIndexTo
    84  	size += 4 // m.State
    85  	size += 1 // m.IsL2
    86  	return size
    87  }
    88  func (m *SwInterfaceSpanDetails) Marshal(b []byte) ([]byte, error) {
    89  	if b == nil {
    90  		b = make([]byte, m.Size())
    91  	}
    92  	buf := codec.NewBuffer(b)
    93  	buf.EncodeUint32(uint32(m.SwIfIndexFrom))
    94  	buf.EncodeUint32(uint32(m.SwIfIndexTo))
    95  	buf.EncodeUint32(uint32(m.State))
    96  	buf.EncodeBool(m.IsL2)
    97  	return buf.Bytes(), nil
    98  }
    99  func (m *SwInterfaceSpanDetails) Unmarshal(b []byte) error {
   100  	buf := codec.NewBuffer(b)
   101  	m.SwIfIndexFrom = interface_types.InterfaceIndex(buf.DecodeUint32())
   102  	m.SwIfIndexTo = interface_types.InterfaceIndex(buf.DecodeUint32())
   103  	m.State = SpanState(buf.DecodeUint32())
   104  	m.IsL2 = buf.DecodeBool()
   105  	return nil
   106  }
   107  
   108  // SwInterfaceSpanDump defines message 'sw_interface_span_dump'.
   109  type SwInterfaceSpanDump struct {
   110  	IsL2 bool `binapi:"bool,name=is_l2" json:"is_l2,omitempty"`
   111  }
   112  
   113  func (m *SwInterfaceSpanDump) Reset()               { *m = SwInterfaceSpanDump{} }
   114  func (*SwInterfaceSpanDump) GetMessageName() string { return "sw_interface_span_dump" }
   115  func (*SwInterfaceSpanDump) GetCrcString() string   { return "d6cf0c3d" }
   116  func (*SwInterfaceSpanDump) GetMessageType() api.MessageType {
   117  	return api.RequestMessage
   118  }
   119  
   120  func (m *SwInterfaceSpanDump) Size() (size int) {
   121  	if m == nil {
   122  		return 0
   123  	}
   124  	size += 1 // m.IsL2
   125  	return size
   126  }
   127  func (m *SwInterfaceSpanDump) Marshal(b []byte) ([]byte, error) {
   128  	if b == nil {
   129  		b = make([]byte, m.Size())
   130  	}
   131  	buf := codec.NewBuffer(b)
   132  	buf.EncodeBool(m.IsL2)
   133  	return buf.Bytes(), nil
   134  }
   135  func (m *SwInterfaceSpanDump) Unmarshal(b []byte) error {
   136  	buf := codec.NewBuffer(b)
   137  	m.IsL2 = buf.DecodeBool()
   138  	return nil
   139  }
   140  
   141  // SwInterfaceSpanEnableDisable defines message 'sw_interface_span_enable_disable'.
   142  type SwInterfaceSpanEnableDisable struct {
   143  	SwIfIndexFrom interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_from" json:"sw_if_index_from,omitempty"`
   144  	SwIfIndexTo   interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_to" json:"sw_if_index_to,omitempty"`
   145  	State         SpanState                      `binapi:"span_state,name=state" json:"state,omitempty"`
   146  	IsL2          bool                           `binapi:"bool,name=is_l2" json:"is_l2,omitempty"`
   147  }
   148  
   149  func (m *SwInterfaceSpanEnableDisable) Reset() { *m = SwInterfaceSpanEnableDisable{} }
   150  func (*SwInterfaceSpanEnableDisable) GetMessageName() string {
   151  	return "sw_interface_span_enable_disable"
   152  }
   153  func (*SwInterfaceSpanEnableDisable) GetCrcString() string { return "23ddd96b" }
   154  func (*SwInterfaceSpanEnableDisable) GetMessageType() api.MessageType {
   155  	return api.RequestMessage
   156  }
   157  
   158  func (m *SwInterfaceSpanEnableDisable) Size() (size int) {
   159  	if m == nil {
   160  		return 0
   161  	}
   162  	size += 4 // m.SwIfIndexFrom
   163  	size += 4 // m.SwIfIndexTo
   164  	size += 4 // m.State
   165  	size += 1 // m.IsL2
   166  	return size
   167  }
   168  func (m *SwInterfaceSpanEnableDisable) Marshal(b []byte) ([]byte, error) {
   169  	if b == nil {
   170  		b = make([]byte, m.Size())
   171  	}
   172  	buf := codec.NewBuffer(b)
   173  	buf.EncodeUint32(uint32(m.SwIfIndexFrom))
   174  	buf.EncodeUint32(uint32(m.SwIfIndexTo))
   175  	buf.EncodeUint32(uint32(m.State))
   176  	buf.EncodeBool(m.IsL2)
   177  	return buf.Bytes(), nil
   178  }
   179  func (m *SwInterfaceSpanEnableDisable) Unmarshal(b []byte) error {
   180  	buf := codec.NewBuffer(b)
   181  	m.SwIfIndexFrom = interface_types.InterfaceIndex(buf.DecodeUint32())
   182  	m.SwIfIndexTo = interface_types.InterfaceIndex(buf.DecodeUint32())
   183  	m.State = SpanState(buf.DecodeUint32())
   184  	m.IsL2 = buf.DecodeBool()
   185  	return nil
   186  }
   187  
   188  // SwInterfaceSpanEnableDisableReply defines message 'sw_interface_span_enable_disable_reply'.
   189  type SwInterfaceSpanEnableDisableReply struct {
   190  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   191  }
   192  
   193  func (m *SwInterfaceSpanEnableDisableReply) Reset() { *m = SwInterfaceSpanEnableDisableReply{} }
   194  func (*SwInterfaceSpanEnableDisableReply) GetMessageName() string {
   195  	return "sw_interface_span_enable_disable_reply"
   196  }
   197  func (*SwInterfaceSpanEnableDisableReply) GetCrcString() string { return "e8d4e804" }
   198  func (*SwInterfaceSpanEnableDisableReply) GetMessageType() api.MessageType {
   199  	return api.ReplyMessage
   200  }
   201  
   202  func (m *SwInterfaceSpanEnableDisableReply) Size() (size int) {
   203  	if m == nil {
   204  		return 0
   205  	}
   206  	size += 4 // m.Retval
   207  	return size
   208  }
   209  func (m *SwInterfaceSpanEnableDisableReply) Marshal(b []byte) ([]byte, error) {
   210  	if b == nil {
   211  		b = make([]byte, m.Size())
   212  	}
   213  	buf := codec.NewBuffer(b)
   214  	buf.EncodeInt32(m.Retval)
   215  	return buf.Bytes(), nil
   216  }
   217  func (m *SwInterfaceSpanEnableDisableReply) Unmarshal(b []byte) error {
   218  	buf := codec.NewBuffer(b)
   219  	m.Retval = buf.DecodeInt32()
   220  	return nil
   221  }
   222  
   223  func init() { file_span_binapi_init() }
   224  func file_span_binapi_init() {
   225  	api.RegisterMessage((*SwInterfaceSpanDetails)(nil), "sw_interface_span_details_8a20e79f")
   226  	api.RegisterMessage((*SwInterfaceSpanDump)(nil), "sw_interface_span_dump_d6cf0c3d")
   227  	api.RegisterMessage((*SwInterfaceSpanEnableDisable)(nil), "sw_interface_span_enable_disable_23ddd96b")
   228  	api.RegisterMessage((*SwInterfaceSpanEnableDisableReply)(nil), "sw_interface_span_enable_disable_reply_e8d4e804")
   229  }
   230  
   231  // Messages returns list of all messages in this module.
   232  func AllMessages() []api.Message {
   233  	return []api.Message{
   234  		(*SwInterfaceSpanDetails)(nil),
   235  		(*SwInterfaceSpanDump)(nil),
   236  		(*SwInterfaceSpanEnableDisable)(nil),
   237  		(*SwInterfaceSpanEnableDisableReply)(nil),
   238  	}
   239  }