github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/binapi/stn/stn.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/stn.api.json
     6  
     7  // Package stn contains generated bindings for API file stn.api.
     8  //
     9  // Contents:
    10  //   4 messages
    11  //
    12  package stn
    13  
    14  import (
    15  	api "git.fd.io/govpp.git/api"
    16  	codec "git.fd.io/govpp.git/codec"
    17  	interface_types "github.com/edwarnicke/govpp/binapi/interface_types"
    18  	ip_types "github.com/edwarnicke/govpp/binapi/ip_types"
    19  )
    20  
    21  // This is a compile-time assertion to ensure that this generated file
    22  // is compatible with the GoVPP api package it is being compiled against.
    23  // A compilation error at this line likely means your copy of the
    24  // GoVPP api package needs to be updated.
    25  const _ = api.GoVppAPIPackageIsVersion2
    26  
    27  const (
    28  	APIFile    = "stn"
    29  	APIVersion = "2.0.0"
    30  	VersionCrc = 0x9cfaef64
    31  )
    32  
    33  // StnAddDelRule defines message 'stn_add_del_rule'.
    34  type StnAddDelRule struct {
    35  	IPAddress ip_types.Address               `binapi:"address,name=ip_address" json:"ip_address,omitempty"`
    36  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
    37  	IsAdd     bool                           `binapi:"bool,name=is_add" json:"is_add,omitempty"`
    38  }
    39  
    40  func (m *StnAddDelRule) Reset()               { *m = StnAddDelRule{} }
    41  func (*StnAddDelRule) GetMessageName() string { return "stn_add_del_rule" }
    42  func (*StnAddDelRule) GetCrcString() string   { return "224c6edd" }
    43  func (*StnAddDelRule) GetMessageType() api.MessageType {
    44  	return api.RequestMessage
    45  }
    46  
    47  func (m *StnAddDelRule) Size() (size int) {
    48  	if m == nil {
    49  		return 0
    50  	}
    51  	size += 1      // m.IPAddress.Af
    52  	size += 1 * 16 // m.IPAddress.Un
    53  	size += 4      // m.SwIfIndex
    54  	size += 1      // m.IsAdd
    55  	return size
    56  }
    57  func (m *StnAddDelRule) Marshal(b []byte) ([]byte, error) {
    58  	if b == nil {
    59  		b = make([]byte, m.Size())
    60  	}
    61  	buf := codec.NewBuffer(b)
    62  	buf.EncodeUint8(uint8(m.IPAddress.Af))
    63  	buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
    64  	buf.EncodeUint32(uint32(m.SwIfIndex))
    65  	buf.EncodeBool(m.IsAdd)
    66  	return buf.Bytes(), nil
    67  }
    68  func (m *StnAddDelRule) Unmarshal(b []byte) error {
    69  	buf := codec.NewBuffer(b)
    70  	m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
    71  	copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
    72  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
    73  	m.IsAdd = buf.DecodeBool()
    74  	return nil
    75  }
    76  
    77  // StnAddDelRuleReply defines message 'stn_add_del_rule_reply'.
    78  type StnAddDelRuleReply struct {
    79  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
    80  }
    81  
    82  func (m *StnAddDelRuleReply) Reset()               { *m = StnAddDelRuleReply{} }
    83  func (*StnAddDelRuleReply) GetMessageName() string { return "stn_add_del_rule_reply" }
    84  func (*StnAddDelRuleReply) GetCrcString() string   { return "e8d4e804" }
    85  func (*StnAddDelRuleReply) GetMessageType() api.MessageType {
    86  	return api.ReplyMessage
    87  }
    88  
    89  func (m *StnAddDelRuleReply) Size() (size int) {
    90  	if m == nil {
    91  		return 0
    92  	}
    93  	size += 4 // m.Retval
    94  	return size
    95  }
    96  func (m *StnAddDelRuleReply) Marshal(b []byte) ([]byte, error) {
    97  	if b == nil {
    98  		b = make([]byte, m.Size())
    99  	}
   100  	buf := codec.NewBuffer(b)
   101  	buf.EncodeInt32(m.Retval)
   102  	return buf.Bytes(), nil
   103  }
   104  func (m *StnAddDelRuleReply) Unmarshal(b []byte) error {
   105  	buf := codec.NewBuffer(b)
   106  	m.Retval = buf.DecodeInt32()
   107  	return nil
   108  }
   109  
   110  // StnRulesDetails defines message 'stn_rules_details'.
   111  type StnRulesDetails struct {
   112  	IPAddress ip_types.Address               `binapi:"address,name=ip_address" json:"ip_address,omitempty"`
   113  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   114  }
   115  
   116  func (m *StnRulesDetails) Reset()               { *m = StnRulesDetails{} }
   117  func (*StnRulesDetails) GetMessageName() string { return "stn_rules_details" }
   118  func (*StnRulesDetails) GetCrcString() string   { return "a51935a6" }
   119  func (*StnRulesDetails) GetMessageType() api.MessageType {
   120  	return api.ReplyMessage
   121  }
   122  
   123  func (m *StnRulesDetails) Size() (size int) {
   124  	if m == nil {
   125  		return 0
   126  	}
   127  	size += 1      // m.IPAddress.Af
   128  	size += 1 * 16 // m.IPAddress.Un
   129  	size += 4      // m.SwIfIndex
   130  	return size
   131  }
   132  func (m *StnRulesDetails) Marshal(b []byte) ([]byte, error) {
   133  	if b == nil {
   134  		b = make([]byte, m.Size())
   135  	}
   136  	buf := codec.NewBuffer(b)
   137  	buf.EncodeUint8(uint8(m.IPAddress.Af))
   138  	buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
   139  	buf.EncodeUint32(uint32(m.SwIfIndex))
   140  	return buf.Bytes(), nil
   141  }
   142  func (m *StnRulesDetails) Unmarshal(b []byte) error {
   143  	buf := codec.NewBuffer(b)
   144  	m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
   145  	copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   146  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   147  	return nil
   148  }
   149  
   150  // StnRulesDump defines message 'stn_rules_dump'.
   151  type StnRulesDump struct{}
   152  
   153  func (m *StnRulesDump) Reset()               { *m = StnRulesDump{} }
   154  func (*StnRulesDump) GetMessageName() string { return "stn_rules_dump" }
   155  func (*StnRulesDump) GetCrcString() string   { return "51077d14" }
   156  func (*StnRulesDump) GetMessageType() api.MessageType {
   157  	return api.RequestMessage
   158  }
   159  
   160  func (m *StnRulesDump) Size() (size int) {
   161  	if m == nil {
   162  		return 0
   163  	}
   164  	return size
   165  }
   166  func (m *StnRulesDump) Marshal(b []byte) ([]byte, error) {
   167  	if b == nil {
   168  		b = make([]byte, m.Size())
   169  	}
   170  	buf := codec.NewBuffer(b)
   171  	return buf.Bytes(), nil
   172  }
   173  func (m *StnRulesDump) Unmarshal(b []byte) error {
   174  	return nil
   175  }
   176  
   177  func init() { file_stn_binapi_init() }
   178  func file_stn_binapi_init() {
   179  	api.RegisterMessage((*StnAddDelRule)(nil), "stn_add_del_rule_224c6edd")
   180  	api.RegisterMessage((*StnAddDelRuleReply)(nil), "stn_add_del_rule_reply_e8d4e804")
   181  	api.RegisterMessage((*StnRulesDetails)(nil), "stn_rules_details_a51935a6")
   182  	api.RegisterMessage((*StnRulesDump)(nil), "stn_rules_dump_51077d14")
   183  }
   184  
   185  // Messages returns list of all messages in this module.
   186  func AllMessages() []api.Message {
   187  	return []api.Message{
   188  		(*StnAddDelRule)(nil),
   189  		(*StnAddDelRuleReply)(nil),
   190  		(*StnRulesDetails)(nil),
   191  		(*StnRulesDump)(nil),
   192  	}
   193  }