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

     1  // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
     2  
     3  // Package af_packet contains generated bindings for API file af_packet.api.
     4  //
     5  // Contents:
     6  // -  8 messages
     7  package af_packet
     8  
     9  import (
    10  	api "go.fd.io/govpp/api"
    11  	codec "go.fd.io/govpp/codec"
    12  	ethernet_types "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2106/ethernet_types"
    13  	interface_types "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2106/interface_types"
    14  )
    15  
    16  // This is a compile-time assertion to ensure that this generated file
    17  // is compatible with the GoVPP api package it is being compiled against.
    18  // A compilation error at this line likely means your copy of the
    19  // GoVPP api package needs to be updated.
    20  const _ = api.GoVppAPIPackageIsVersion2
    21  
    22  const (
    23  	APIFile    = "af_packet"
    24  	APIVersion = "2.0.0"
    25  	VersionCrc = 0x4191e8ae
    26  )
    27  
    28  // AfPacketCreate defines message 'af_packet_create'.
    29  type AfPacketCreate struct {
    30  	HwAddr          ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
    31  	UseRandomHwAddr bool                      `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"`
    32  	HostIfName      string                    `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
    33  }
    34  
    35  func (m *AfPacketCreate) Reset()               { *m = AfPacketCreate{} }
    36  func (*AfPacketCreate) GetMessageName() string { return "af_packet_create" }
    37  func (*AfPacketCreate) GetCrcString() string   { return "a190415f" }
    38  func (*AfPacketCreate) GetMessageType() api.MessageType {
    39  	return api.RequestMessage
    40  }
    41  
    42  func (m *AfPacketCreate) Size() (size int) {
    43  	if m == nil {
    44  		return 0
    45  	}
    46  	size += 1 * 6 // m.HwAddr
    47  	size += 1     // m.UseRandomHwAddr
    48  	size += 64    // m.HostIfName
    49  	return size
    50  }
    51  func (m *AfPacketCreate) Marshal(b []byte) ([]byte, error) {
    52  	if b == nil {
    53  		b = make([]byte, m.Size())
    54  	}
    55  	buf := codec.NewBuffer(b)
    56  	buf.EncodeBytes(m.HwAddr[:], 6)
    57  	buf.EncodeBool(m.UseRandomHwAddr)
    58  	buf.EncodeString(m.HostIfName, 64)
    59  	return buf.Bytes(), nil
    60  }
    61  func (m *AfPacketCreate) Unmarshal(b []byte) error {
    62  	buf := codec.NewBuffer(b)
    63  	copy(m.HwAddr[:], buf.DecodeBytes(6))
    64  	m.UseRandomHwAddr = buf.DecodeBool()
    65  	m.HostIfName = buf.DecodeString(64)
    66  	return nil
    67  }
    68  
    69  // AfPacketCreateReply defines message 'af_packet_create_reply'.
    70  type AfPacketCreateReply struct {
    71  	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
    72  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
    73  }
    74  
    75  func (m *AfPacketCreateReply) Reset()               { *m = AfPacketCreateReply{} }
    76  func (*AfPacketCreateReply) GetMessageName() string { return "af_packet_create_reply" }
    77  func (*AfPacketCreateReply) GetCrcString() string   { return "5383d31f" }
    78  func (*AfPacketCreateReply) GetMessageType() api.MessageType {
    79  	return api.ReplyMessage
    80  }
    81  
    82  func (m *AfPacketCreateReply) Size() (size int) {
    83  	if m == nil {
    84  		return 0
    85  	}
    86  	size += 4 // m.Retval
    87  	size += 4 // m.SwIfIndex
    88  	return size
    89  }
    90  func (m *AfPacketCreateReply) Marshal(b []byte) ([]byte, error) {
    91  	if b == nil {
    92  		b = make([]byte, m.Size())
    93  	}
    94  	buf := codec.NewBuffer(b)
    95  	buf.EncodeInt32(m.Retval)
    96  	buf.EncodeUint32(uint32(m.SwIfIndex))
    97  	return buf.Bytes(), nil
    98  }
    99  func (m *AfPacketCreateReply) Unmarshal(b []byte) error {
   100  	buf := codec.NewBuffer(b)
   101  	m.Retval = buf.DecodeInt32()
   102  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   103  	return nil
   104  }
   105  
   106  // AfPacketDelete defines message 'af_packet_delete'.
   107  type AfPacketDelete struct {
   108  	HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
   109  }
   110  
   111  func (m *AfPacketDelete) Reset()               { *m = AfPacketDelete{} }
   112  func (*AfPacketDelete) GetMessageName() string { return "af_packet_delete" }
   113  func (*AfPacketDelete) GetCrcString() string   { return "863fa648" }
   114  func (*AfPacketDelete) GetMessageType() api.MessageType {
   115  	return api.RequestMessage
   116  }
   117  
   118  func (m *AfPacketDelete) Size() (size int) {
   119  	if m == nil {
   120  		return 0
   121  	}
   122  	size += 64 // m.HostIfName
   123  	return size
   124  }
   125  func (m *AfPacketDelete) Marshal(b []byte) ([]byte, error) {
   126  	if b == nil {
   127  		b = make([]byte, m.Size())
   128  	}
   129  	buf := codec.NewBuffer(b)
   130  	buf.EncodeString(m.HostIfName, 64)
   131  	return buf.Bytes(), nil
   132  }
   133  func (m *AfPacketDelete) Unmarshal(b []byte) error {
   134  	buf := codec.NewBuffer(b)
   135  	m.HostIfName = buf.DecodeString(64)
   136  	return nil
   137  }
   138  
   139  // AfPacketDeleteReply defines message 'af_packet_delete_reply'.
   140  type AfPacketDeleteReply struct {
   141  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   142  }
   143  
   144  func (m *AfPacketDeleteReply) Reset()               { *m = AfPacketDeleteReply{} }
   145  func (*AfPacketDeleteReply) GetMessageName() string { return "af_packet_delete_reply" }
   146  func (*AfPacketDeleteReply) GetCrcString() string   { return "e8d4e804" }
   147  func (*AfPacketDeleteReply) GetMessageType() api.MessageType {
   148  	return api.ReplyMessage
   149  }
   150  
   151  func (m *AfPacketDeleteReply) Size() (size int) {
   152  	if m == nil {
   153  		return 0
   154  	}
   155  	size += 4 // m.Retval
   156  	return size
   157  }
   158  func (m *AfPacketDeleteReply) Marshal(b []byte) ([]byte, error) {
   159  	if b == nil {
   160  		b = make([]byte, m.Size())
   161  	}
   162  	buf := codec.NewBuffer(b)
   163  	buf.EncodeInt32(m.Retval)
   164  	return buf.Bytes(), nil
   165  }
   166  func (m *AfPacketDeleteReply) Unmarshal(b []byte) error {
   167  	buf := codec.NewBuffer(b)
   168  	m.Retval = buf.DecodeInt32()
   169  	return nil
   170  }
   171  
   172  // AfPacketDetails defines message 'af_packet_details'.
   173  type AfPacketDetails struct {
   174  	SwIfIndex  interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   175  	HostIfName string                         `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
   176  }
   177  
   178  func (m *AfPacketDetails) Reset()               { *m = AfPacketDetails{} }
   179  func (*AfPacketDetails) GetMessageName() string { return "af_packet_details" }
   180  func (*AfPacketDetails) GetCrcString() string   { return "58c7c042" }
   181  func (*AfPacketDetails) GetMessageType() api.MessageType {
   182  	return api.ReplyMessage
   183  }
   184  
   185  func (m *AfPacketDetails) Size() (size int) {
   186  	if m == nil {
   187  		return 0
   188  	}
   189  	size += 4  // m.SwIfIndex
   190  	size += 64 // m.HostIfName
   191  	return size
   192  }
   193  func (m *AfPacketDetails) Marshal(b []byte) ([]byte, error) {
   194  	if b == nil {
   195  		b = make([]byte, m.Size())
   196  	}
   197  	buf := codec.NewBuffer(b)
   198  	buf.EncodeUint32(uint32(m.SwIfIndex))
   199  	buf.EncodeString(m.HostIfName, 64)
   200  	return buf.Bytes(), nil
   201  }
   202  func (m *AfPacketDetails) Unmarshal(b []byte) error {
   203  	buf := codec.NewBuffer(b)
   204  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   205  	m.HostIfName = buf.DecodeString(64)
   206  	return nil
   207  }
   208  
   209  // AfPacketDump defines message 'af_packet_dump'.
   210  type AfPacketDump struct{}
   211  
   212  func (m *AfPacketDump) Reset()               { *m = AfPacketDump{} }
   213  func (*AfPacketDump) GetMessageName() string { return "af_packet_dump" }
   214  func (*AfPacketDump) GetCrcString() string   { return "51077d14" }
   215  func (*AfPacketDump) GetMessageType() api.MessageType {
   216  	return api.RequestMessage
   217  }
   218  
   219  func (m *AfPacketDump) Size() (size int) {
   220  	if m == nil {
   221  		return 0
   222  	}
   223  	return size
   224  }
   225  func (m *AfPacketDump) Marshal(b []byte) ([]byte, error) {
   226  	if b == nil {
   227  		b = make([]byte, m.Size())
   228  	}
   229  	buf := codec.NewBuffer(b)
   230  	return buf.Bytes(), nil
   231  }
   232  func (m *AfPacketDump) Unmarshal(b []byte) error {
   233  	return nil
   234  }
   235  
   236  // AfPacketSetL4CksumOffload defines message 'af_packet_set_l4_cksum_offload'.
   237  type AfPacketSetL4CksumOffload struct {
   238  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   239  	Set       bool                           `binapi:"bool,name=set" json:"set,omitempty"`
   240  }
   241  
   242  func (m *AfPacketSetL4CksumOffload) Reset()               { *m = AfPacketSetL4CksumOffload{} }
   243  func (*AfPacketSetL4CksumOffload) GetMessageName() string { return "af_packet_set_l4_cksum_offload" }
   244  func (*AfPacketSetL4CksumOffload) GetCrcString() string   { return "319cd5c8" }
   245  func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType {
   246  	return api.RequestMessage
   247  }
   248  
   249  func (m *AfPacketSetL4CksumOffload) Size() (size int) {
   250  	if m == nil {
   251  		return 0
   252  	}
   253  	size += 4 // m.SwIfIndex
   254  	size += 1 // m.Set
   255  	return size
   256  }
   257  func (m *AfPacketSetL4CksumOffload) Marshal(b []byte) ([]byte, error) {
   258  	if b == nil {
   259  		b = make([]byte, m.Size())
   260  	}
   261  	buf := codec.NewBuffer(b)
   262  	buf.EncodeUint32(uint32(m.SwIfIndex))
   263  	buf.EncodeBool(m.Set)
   264  	return buf.Bytes(), nil
   265  }
   266  func (m *AfPacketSetL4CksumOffload) Unmarshal(b []byte) error {
   267  	buf := codec.NewBuffer(b)
   268  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   269  	m.Set = buf.DecodeBool()
   270  	return nil
   271  }
   272  
   273  // AfPacketSetL4CksumOffloadReply defines message 'af_packet_set_l4_cksum_offload_reply'.
   274  type AfPacketSetL4CksumOffloadReply struct {
   275  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   276  }
   277  
   278  func (m *AfPacketSetL4CksumOffloadReply) Reset() { *m = AfPacketSetL4CksumOffloadReply{} }
   279  func (*AfPacketSetL4CksumOffloadReply) GetMessageName() string {
   280  	return "af_packet_set_l4_cksum_offload_reply"
   281  }
   282  func (*AfPacketSetL4CksumOffloadReply) GetCrcString() string { return "e8d4e804" }
   283  func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType {
   284  	return api.ReplyMessage
   285  }
   286  
   287  func (m *AfPacketSetL4CksumOffloadReply) Size() (size int) {
   288  	if m == nil {
   289  		return 0
   290  	}
   291  	size += 4 // m.Retval
   292  	return size
   293  }
   294  func (m *AfPacketSetL4CksumOffloadReply) Marshal(b []byte) ([]byte, error) {
   295  	if b == nil {
   296  		b = make([]byte, m.Size())
   297  	}
   298  	buf := codec.NewBuffer(b)
   299  	buf.EncodeInt32(m.Retval)
   300  	return buf.Bytes(), nil
   301  }
   302  func (m *AfPacketSetL4CksumOffloadReply) Unmarshal(b []byte) error {
   303  	buf := codec.NewBuffer(b)
   304  	m.Retval = buf.DecodeInt32()
   305  	return nil
   306  }
   307  
   308  func init() { file_af_packet_binapi_init() }
   309  func file_af_packet_binapi_init() {
   310  	api.RegisterMessage((*AfPacketCreate)(nil), "af_packet_create_a190415f")
   311  	api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet_create_reply_5383d31f")
   312  	api.RegisterMessage((*AfPacketDelete)(nil), "af_packet_delete_863fa648")
   313  	api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet_delete_reply_e8d4e804")
   314  	api.RegisterMessage((*AfPacketDetails)(nil), "af_packet_details_58c7c042")
   315  	api.RegisterMessage((*AfPacketDump)(nil), "af_packet_dump_51077d14")
   316  	api.RegisterMessage((*AfPacketSetL4CksumOffload)(nil), "af_packet_set_l4_cksum_offload_319cd5c8")
   317  	api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet_set_l4_cksum_offload_reply_e8d4e804")
   318  }
   319  
   320  // Messages returns list of all messages in this module.
   321  func AllMessages() []api.Message {
   322  	return []api.Message{
   323  		(*AfPacketCreate)(nil),
   324  		(*AfPacketCreateReply)(nil),
   325  		(*AfPacketDelete)(nil),
   326  		(*AfPacketDeleteReply)(nil),
   327  		(*AfPacketDetails)(nil),
   328  		(*AfPacketDump)(nil),
   329  		(*AfPacketSetL4CksumOffload)(nil),
   330  		(*AfPacketSetL4CksumOffloadReply)(nil),
   331  	}
   332  }