github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/af_packet/af_packet.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/af_packet.api.json
     6  
     7  // Package af_packet contains generated bindings for API file af_packet.api.
     8  //
     9  // Contents:
    10  // -  2 enums
    11  // - 12 messages
    12  package af_packet
    13  
    14  import (
    15  	"strconv"
    16  
    17  	ethernet_types "github.com/networkservicemesh/govpp/binapi/ethernet_types"
    18  	interface_types "github.com/networkservicemesh/govpp/binapi/interface_types"
    19  	api "go.fd.io/govpp/api"
    20  	codec "go.fd.io/govpp/codec"
    21  )
    22  
    23  // This is a compile-time assertion to ensure that this generated file
    24  // is compatible with the GoVPP api package it is being compiled against.
    25  // A compilation error at this line likely means your copy of the
    26  // GoVPP api package needs to be updated.
    27  const _ = api.GoVppAPIPackageIsVersion2
    28  
    29  const (
    30  	APIFile    = "af_packet"
    31  	APIVersion = "2.0.0"
    32  	VersionCrc = 0x5b12de21
    33  )
    34  
    35  // AfPacketFlags defines enum 'af_packet_flags'.
    36  type AfPacketFlags uint32
    37  
    38  const (
    39  	AF_PACKET_API_FLAG_QDISC_BYPASS AfPacketFlags = 1
    40  	AF_PACKET_API_FLAG_CKSUM_GSO    AfPacketFlags = 2
    41  	AF_PACKET_API_FLAG_VERSION_2    AfPacketFlags = 8
    42  )
    43  
    44  var (
    45  	AfPacketFlags_name = map[uint32]string{
    46  		1: "AF_PACKET_API_FLAG_QDISC_BYPASS",
    47  		2: "AF_PACKET_API_FLAG_CKSUM_GSO",
    48  		8: "AF_PACKET_API_FLAG_VERSION_2",
    49  	}
    50  	AfPacketFlags_value = map[string]uint32{
    51  		"AF_PACKET_API_FLAG_QDISC_BYPASS": 1,
    52  		"AF_PACKET_API_FLAG_CKSUM_GSO":    2,
    53  		"AF_PACKET_API_FLAG_VERSION_2":    8,
    54  	}
    55  )
    56  
    57  func (x AfPacketFlags) String() string {
    58  	s, ok := AfPacketFlags_name[uint32(x)]
    59  	if ok {
    60  		return s
    61  	}
    62  	str := func(n uint32) string {
    63  		s, ok := AfPacketFlags_name[uint32(n)]
    64  		if ok {
    65  			return s
    66  		}
    67  		return "AfPacketFlags(" + strconv.Itoa(int(n)) + ")"
    68  	}
    69  	for i := uint32(0); i <= 32; i++ {
    70  		val := uint32(x)
    71  		if val&(1<<i) != 0 {
    72  			if s != "" {
    73  				s += "|"
    74  			}
    75  			s += str(1 << i)
    76  		}
    77  	}
    78  	if s == "" {
    79  		return str(uint32(x))
    80  	}
    81  	return s
    82  }
    83  
    84  // AfPacketMode defines enum 'af_packet_mode'.
    85  type AfPacketMode uint32
    86  
    87  const (
    88  	AF_PACKET_API_MODE_ETHERNET AfPacketMode = 1
    89  	AF_PACKET_API_MODE_IP       AfPacketMode = 2
    90  )
    91  
    92  var (
    93  	AfPacketMode_name = map[uint32]string{
    94  		1: "AF_PACKET_API_MODE_ETHERNET",
    95  		2: "AF_PACKET_API_MODE_IP",
    96  	}
    97  	AfPacketMode_value = map[string]uint32{
    98  		"AF_PACKET_API_MODE_ETHERNET": 1,
    99  		"AF_PACKET_API_MODE_IP":       2,
   100  	}
   101  )
   102  
   103  func (x AfPacketMode) String() string {
   104  	s, ok := AfPacketMode_name[uint32(x)]
   105  	if ok {
   106  		return s
   107  	}
   108  	return "AfPacketMode(" + strconv.Itoa(int(x)) + ")"
   109  }
   110  
   111  // Create host-interface
   112  //   - hw_addr - interface MAC
   113  //   - use_random_hw_addr - use random generated MAC
   114  //   - host_if_name - interface name
   115  //
   116  // AfPacketCreate defines message 'af_packet_create'.
   117  // Deprecated: the message will be removed in the future versions
   118  type AfPacketCreate struct {
   119  	HwAddr          ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
   120  	UseRandomHwAddr bool                      `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"`
   121  	HostIfName      string                    `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
   122  }
   123  
   124  func (m *AfPacketCreate) Reset()               { *m = AfPacketCreate{} }
   125  func (*AfPacketCreate) GetMessageName() string { return "af_packet_create" }
   126  func (*AfPacketCreate) GetCrcString() string   { return "a190415f" }
   127  func (*AfPacketCreate) GetMessageType() api.MessageType {
   128  	return api.RequestMessage
   129  }
   130  
   131  func (m *AfPacketCreate) Size() (size int) {
   132  	if m == nil {
   133  		return 0
   134  	}
   135  	size += 1 * 6 // m.HwAddr
   136  	size += 1     // m.UseRandomHwAddr
   137  	size += 64    // m.HostIfName
   138  	return size
   139  }
   140  func (m *AfPacketCreate) Marshal(b []byte) ([]byte, error) {
   141  	if b == nil {
   142  		b = make([]byte, m.Size())
   143  	}
   144  	buf := codec.NewBuffer(b)
   145  	buf.EncodeBytes(m.HwAddr[:], 6)
   146  	buf.EncodeBool(m.UseRandomHwAddr)
   147  	buf.EncodeString(m.HostIfName, 64)
   148  	return buf.Bytes(), nil
   149  }
   150  func (m *AfPacketCreate) Unmarshal(b []byte) error {
   151  	buf := codec.NewBuffer(b)
   152  	copy(m.HwAddr[:], buf.DecodeBytes(6))
   153  	m.UseRandomHwAddr = buf.DecodeBool()
   154  	m.HostIfName = buf.DecodeString(64)
   155  	return nil
   156  }
   157  
   158  // Create host-interface response
   159  //   - retval - return value for request
   160  //
   161  // AfPacketCreateReply defines message 'af_packet_create_reply'.
   162  // Deprecated: the message will be removed in the future versions
   163  type AfPacketCreateReply struct {
   164  	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
   165  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   166  }
   167  
   168  func (m *AfPacketCreateReply) Reset()               { *m = AfPacketCreateReply{} }
   169  func (*AfPacketCreateReply) GetMessageName() string { return "af_packet_create_reply" }
   170  func (*AfPacketCreateReply) GetCrcString() string   { return "5383d31f" }
   171  func (*AfPacketCreateReply) GetMessageType() api.MessageType {
   172  	return api.ReplyMessage
   173  }
   174  
   175  func (m *AfPacketCreateReply) Size() (size int) {
   176  	if m == nil {
   177  		return 0
   178  	}
   179  	size += 4 // m.Retval
   180  	size += 4 // m.SwIfIndex
   181  	return size
   182  }
   183  func (m *AfPacketCreateReply) Marshal(b []byte) ([]byte, error) {
   184  	if b == nil {
   185  		b = make([]byte, m.Size())
   186  	}
   187  	buf := codec.NewBuffer(b)
   188  	buf.EncodeInt32(m.Retval)
   189  	buf.EncodeUint32(uint32(m.SwIfIndex))
   190  	return buf.Bytes(), nil
   191  }
   192  func (m *AfPacketCreateReply) Unmarshal(b []byte) error {
   193  	buf := codec.NewBuffer(b)
   194  	m.Retval = buf.DecodeInt32()
   195  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   196  	return nil
   197  }
   198  
   199  // Create host-interface
   200  //   - hw_addr - interface MAC
   201  //   - use_random_hw_addr - use random generated MAC
   202  //   - host_if_name - interface name
   203  //   - rx_frame_size - frame size for RX
   204  //   - tx_frame_size - frame size for TX
   205  //   - rx_frames_per_block - frames per block for RX
   206  //   - tx_frames_per_block - frames per block for TX
   207  //   - flags - flags for the af_packet interface creation
   208  //   - num_rx_queues - number of rx queues
   209  //
   210  // AfPacketCreateV2 defines message 'af_packet_create_v2'.
   211  // Deprecated: the message will be removed in the future versions
   212  type AfPacketCreateV2 struct {
   213  	HwAddr           ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
   214  	UseRandomHwAddr  bool                      `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"`
   215  	HostIfName       string                    `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
   216  	RxFrameSize      uint32                    `binapi:"u32,name=rx_frame_size" json:"rx_frame_size,omitempty"`
   217  	TxFrameSize      uint32                    `binapi:"u32,name=tx_frame_size" json:"tx_frame_size,omitempty"`
   218  	RxFramesPerBlock uint32                    `binapi:"u32,name=rx_frames_per_block" json:"rx_frames_per_block,omitempty"`
   219  	TxFramesPerBlock uint32                    `binapi:"u32,name=tx_frames_per_block" json:"tx_frames_per_block,omitempty"`
   220  	Flags            uint32                    `binapi:"u32,name=flags" json:"flags,omitempty"`
   221  	NumRxQueues      uint16                    `binapi:"u16,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"`
   222  }
   223  
   224  func (m *AfPacketCreateV2) Reset()               { *m = AfPacketCreateV2{} }
   225  func (*AfPacketCreateV2) GetMessageName() string { return "af_packet_create_v2" }
   226  func (*AfPacketCreateV2) GetCrcString() string   { return "4aff0436" }
   227  func (*AfPacketCreateV2) GetMessageType() api.MessageType {
   228  	return api.RequestMessage
   229  }
   230  
   231  func (m *AfPacketCreateV2) Size() (size int) {
   232  	if m == nil {
   233  		return 0
   234  	}
   235  	size += 1 * 6 // m.HwAddr
   236  	size += 1     // m.UseRandomHwAddr
   237  	size += 64    // m.HostIfName
   238  	size += 4     // m.RxFrameSize
   239  	size += 4     // m.TxFrameSize
   240  	size += 4     // m.RxFramesPerBlock
   241  	size += 4     // m.TxFramesPerBlock
   242  	size += 4     // m.Flags
   243  	size += 2     // m.NumRxQueues
   244  	return size
   245  }
   246  func (m *AfPacketCreateV2) Marshal(b []byte) ([]byte, error) {
   247  	if b == nil {
   248  		b = make([]byte, m.Size())
   249  	}
   250  	buf := codec.NewBuffer(b)
   251  	buf.EncodeBytes(m.HwAddr[:], 6)
   252  	buf.EncodeBool(m.UseRandomHwAddr)
   253  	buf.EncodeString(m.HostIfName, 64)
   254  	buf.EncodeUint32(m.RxFrameSize)
   255  	buf.EncodeUint32(m.TxFrameSize)
   256  	buf.EncodeUint32(m.RxFramesPerBlock)
   257  	buf.EncodeUint32(m.TxFramesPerBlock)
   258  	buf.EncodeUint32(m.Flags)
   259  	buf.EncodeUint16(m.NumRxQueues)
   260  	return buf.Bytes(), nil
   261  }
   262  func (m *AfPacketCreateV2) Unmarshal(b []byte) error {
   263  	buf := codec.NewBuffer(b)
   264  	copy(m.HwAddr[:], buf.DecodeBytes(6))
   265  	m.UseRandomHwAddr = buf.DecodeBool()
   266  	m.HostIfName = buf.DecodeString(64)
   267  	m.RxFrameSize = buf.DecodeUint32()
   268  	m.TxFrameSize = buf.DecodeUint32()
   269  	m.RxFramesPerBlock = buf.DecodeUint32()
   270  	m.TxFramesPerBlock = buf.DecodeUint32()
   271  	m.Flags = buf.DecodeUint32()
   272  	m.NumRxQueues = buf.DecodeUint16()
   273  	return nil
   274  }
   275  
   276  // Create host-interface response
   277  //   - retval - return value for request
   278  //
   279  // AfPacketCreateV2Reply defines message 'af_packet_create_v2_reply'.
   280  // Deprecated: the message will be removed in the future versions
   281  type AfPacketCreateV2Reply struct {
   282  	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
   283  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   284  }
   285  
   286  func (m *AfPacketCreateV2Reply) Reset()               { *m = AfPacketCreateV2Reply{} }
   287  func (*AfPacketCreateV2Reply) GetMessageName() string { return "af_packet_create_v2_reply" }
   288  func (*AfPacketCreateV2Reply) GetCrcString() string   { return "5383d31f" }
   289  func (*AfPacketCreateV2Reply) GetMessageType() api.MessageType {
   290  	return api.ReplyMessage
   291  }
   292  
   293  func (m *AfPacketCreateV2Reply) Size() (size int) {
   294  	if m == nil {
   295  		return 0
   296  	}
   297  	size += 4 // m.Retval
   298  	size += 4 // m.SwIfIndex
   299  	return size
   300  }
   301  func (m *AfPacketCreateV2Reply) 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(uint32(m.SwIfIndex))
   308  	return buf.Bytes(), nil
   309  }
   310  func (m *AfPacketCreateV2Reply) Unmarshal(b []byte) error {
   311  	buf := codec.NewBuffer(b)
   312  	m.Retval = buf.DecodeInt32()
   313  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   314  	return nil
   315  }
   316  
   317  // Create host-interface
   318  //   - mode - 1 - Ethernet, 2 - IP
   319  //   - hw_addr - interface MAC
   320  //   - use_random_hw_addr - use random generated MAC
   321  //   - host_if_name - interface name
   322  //   - rx_frame_size - frame size for RX
   323  //   - tx_frame_size - frame size for TX
   324  //   - rx_frames_per_block - frames per block for RX
   325  //   - tx_frames_per_block - frames per block for TX
   326  //   - flags - flags for the af_packet interface creation
   327  //   - num_rx_queues - number of rx queues
   328  //   - num_tx_queues - number of tx queues
   329  //
   330  // AfPacketCreateV3 defines message 'af_packet_create_v3'.
   331  type AfPacketCreateV3 struct {
   332  	Mode             AfPacketMode              `binapi:"af_packet_mode,name=mode" json:"mode,omitempty"`
   333  	HwAddr           ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
   334  	UseRandomHwAddr  bool                      `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"`
   335  	HostIfName       string                    `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
   336  	RxFrameSize      uint32                    `binapi:"u32,name=rx_frame_size" json:"rx_frame_size,omitempty"`
   337  	TxFrameSize      uint32                    `binapi:"u32,name=tx_frame_size" json:"tx_frame_size,omitempty"`
   338  	RxFramesPerBlock uint32                    `binapi:"u32,name=rx_frames_per_block" json:"rx_frames_per_block,omitempty"`
   339  	TxFramesPerBlock uint32                    `binapi:"u32,name=tx_frames_per_block" json:"tx_frames_per_block,omitempty"`
   340  	Flags            AfPacketFlags             `binapi:"af_packet_flags,name=flags" json:"flags,omitempty"`
   341  	NumRxQueues      uint16                    `binapi:"u16,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"`
   342  	NumTxQueues      uint16                    `binapi:"u16,name=num_tx_queues,default=1" json:"num_tx_queues,omitempty"`
   343  }
   344  
   345  func (m *AfPacketCreateV3) Reset()               { *m = AfPacketCreateV3{} }
   346  func (*AfPacketCreateV3) GetMessageName() string { return "af_packet_create_v3" }
   347  func (*AfPacketCreateV3) GetCrcString() string   { return "b3a809d4" }
   348  func (*AfPacketCreateV3) GetMessageType() api.MessageType {
   349  	return api.RequestMessage
   350  }
   351  
   352  func (m *AfPacketCreateV3) Size() (size int) {
   353  	if m == nil {
   354  		return 0
   355  	}
   356  	size += 4     // m.Mode
   357  	size += 1 * 6 // m.HwAddr
   358  	size += 1     // m.UseRandomHwAddr
   359  	size += 64    // m.HostIfName
   360  	size += 4     // m.RxFrameSize
   361  	size += 4     // m.TxFrameSize
   362  	size += 4     // m.RxFramesPerBlock
   363  	size += 4     // m.TxFramesPerBlock
   364  	size += 4     // m.Flags
   365  	size += 2     // m.NumRxQueues
   366  	size += 2     // m.NumTxQueues
   367  	return size
   368  }
   369  func (m *AfPacketCreateV3) Marshal(b []byte) ([]byte, error) {
   370  	if b == nil {
   371  		b = make([]byte, m.Size())
   372  	}
   373  	buf := codec.NewBuffer(b)
   374  	buf.EncodeUint32(uint32(m.Mode))
   375  	buf.EncodeBytes(m.HwAddr[:], 6)
   376  	buf.EncodeBool(m.UseRandomHwAddr)
   377  	buf.EncodeString(m.HostIfName, 64)
   378  	buf.EncodeUint32(m.RxFrameSize)
   379  	buf.EncodeUint32(m.TxFrameSize)
   380  	buf.EncodeUint32(m.RxFramesPerBlock)
   381  	buf.EncodeUint32(m.TxFramesPerBlock)
   382  	buf.EncodeUint32(uint32(m.Flags))
   383  	buf.EncodeUint16(m.NumRxQueues)
   384  	buf.EncodeUint16(m.NumTxQueues)
   385  	return buf.Bytes(), nil
   386  }
   387  func (m *AfPacketCreateV3) Unmarshal(b []byte) error {
   388  	buf := codec.NewBuffer(b)
   389  	m.Mode = AfPacketMode(buf.DecodeUint32())
   390  	copy(m.HwAddr[:], buf.DecodeBytes(6))
   391  	m.UseRandomHwAddr = buf.DecodeBool()
   392  	m.HostIfName = buf.DecodeString(64)
   393  	m.RxFrameSize = buf.DecodeUint32()
   394  	m.TxFrameSize = buf.DecodeUint32()
   395  	m.RxFramesPerBlock = buf.DecodeUint32()
   396  	m.TxFramesPerBlock = buf.DecodeUint32()
   397  	m.Flags = AfPacketFlags(buf.DecodeUint32())
   398  	m.NumRxQueues = buf.DecodeUint16()
   399  	m.NumTxQueues = buf.DecodeUint16()
   400  	return nil
   401  }
   402  
   403  // Create host-interface response
   404  //   - retval - return value for request
   405  //
   406  // AfPacketCreateV3Reply defines message 'af_packet_create_v3_reply'.
   407  type AfPacketCreateV3Reply struct {
   408  	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
   409  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   410  }
   411  
   412  func (m *AfPacketCreateV3Reply) Reset()               { *m = AfPacketCreateV3Reply{} }
   413  func (*AfPacketCreateV3Reply) GetMessageName() string { return "af_packet_create_v3_reply" }
   414  func (*AfPacketCreateV3Reply) GetCrcString() string   { return "5383d31f" }
   415  func (*AfPacketCreateV3Reply) GetMessageType() api.MessageType {
   416  	return api.ReplyMessage
   417  }
   418  
   419  func (m *AfPacketCreateV3Reply) Size() (size int) {
   420  	if m == nil {
   421  		return 0
   422  	}
   423  	size += 4 // m.Retval
   424  	size += 4 // m.SwIfIndex
   425  	return size
   426  }
   427  func (m *AfPacketCreateV3Reply) Marshal(b []byte) ([]byte, error) {
   428  	if b == nil {
   429  		b = make([]byte, m.Size())
   430  	}
   431  	buf := codec.NewBuffer(b)
   432  	buf.EncodeInt32(m.Retval)
   433  	buf.EncodeUint32(uint32(m.SwIfIndex))
   434  	return buf.Bytes(), nil
   435  }
   436  func (m *AfPacketCreateV3Reply) Unmarshal(b []byte) error {
   437  	buf := codec.NewBuffer(b)
   438  	m.Retval = buf.DecodeInt32()
   439  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   440  	return nil
   441  }
   442  
   443  // Delete host-interface
   444  //   - host_if_name - interface name
   445  //
   446  // AfPacketDelete defines message 'af_packet_delete'.
   447  type AfPacketDelete struct {
   448  	HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
   449  }
   450  
   451  func (m *AfPacketDelete) Reset()               { *m = AfPacketDelete{} }
   452  func (*AfPacketDelete) GetMessageName() string { return "af_packet_delete" }
   453  func (*AfPacketDelete) GetCrcString() string   { return "863fa648" }
   454  func (*AfPacketDelete) GetMessageType() api.MessageType {
   455  	return api.RequestMessage
   456  }
   457  
   458  func (m *AfPacketDelete) Size() (size int) {
   459  	if m == nil {
   460  		return 0
   461  	}
   462  	size += 64 // m.HostIfName
   463  	return size
   464  }
   465  func (m *AfPacketDelete) Marshal(b []byte) ([]byte, error) {
   466  	if b == nil {
   467  		b = make([]byte, m.Size())
   468  	}
   469  	buf := codec.NewBuffer(b)
   470  	buf.EncodeString(m.HostIfName, 64)
   471  	return buf.Bytes(), nil
   472  }
   473  func (m *AfPacketDelete) Unmarshal(b []byte) error {
   474  	buf := codec.NewBuffer(b)
   475  	m.HostIfName = buf.DecodeString(64)
   476  	return nil
   477  }
   478  
   479  // AfPacketDeleteReply defines message 'af_packet_delete_reply'.
   480  type AfPacketDeleteReply struct {
   481  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   482  }
   483  
   484  func (m *AfPacketDeleteReply) Reset()               { *m = AfPacketDeleteReply{} }
   485  func (*AfPacketDeleteReply) GetMessageName() string { return "af_packet_delete_reply" }
   486  func (*AfPacketDeleteReply) GetCrcString() string   { return "e8d4e804" }
   487  func (*AfPacketDeleteReply) GetMessageType() api.MessageType {
   488  	return api.ReplyMessage
   489  }
   490  
   491  func (m *AfPacketDeleteReply) Size() (size int) {
   492  	if m == nil {
   493  		return 0
   494  	}
   495  	size += 4 // m.Retval
   496  	return size
   497  }
   498  func (m *AfPacketDeleteReply) Marshal(b []byte) ([]byte, error) {
   499  	if b == nil {
   500  		b = make([]byte, m.Size())
   501  	}
   502  	buf := codec.NewBuffer(b)
   503  	buf.EncodeInt32(m.Retval)
   504  	return buf.Bytes(), nil
   505  }
   506  func (m *AfPacketDeleteReply) Unmarshal(b []byte) error {
   507  	buf := codec.NewBuffer(b)
   508  	m.Retval = buf.DecodeInt32()
   509  	return nil
   510  }
   511  
   512  // Reply for af_packet dump request
   513  //   - sw_if_index - software index of af_packet interface
   514  //   - host_if_name - interface name
   515  //
   516  // AfPacketDetails defines message 'af_packet_details'.
   517  type AfPacketDetails struct {
   518  	SwIfIndex  interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   519  	HostIfName string                         `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
   520  }
   521  
   522  func (m *AfPacketDetails) Reset()               { *m = AfPacketDetails{} }
   523  func (*AfPacketDetails) GetMessageName() string { return "af_packet_details" }
   524  func (*AfPacketDetails) GetCrcString() string   { return "58c7c042" }
   525  func (*AfPacketDetails) GetMessageType() api.MessageType {
   526  	return api.ReplyMessage
   527  }
   528  
   529  func (m *AfPacketDetails) Size() (size int) {
   530  	if m == nil {
   531  		return 0
   532  	}
   533  	size += 4  // m.SwIfIndex
   534  	size += 64 // m.HostIfName
   535  	return size
   536  }
   537  func (m *AfPacketDetails) Marshal(b []byte) ([]byte, error) {
   538  	if b == nil {
   539  		b = make([]byte, m.Size())
   540  	}
   541  	buf := codec.NewBuffer(b)
   542  	buf.EncodeUint32(uint32(m.SwIfIndex))
   543  	buf.EncodeString(m.HostIfName, 64)
   544  	return buf.Bytes(), nil
   545  }
   546  func (m *AfPacketDetails) Unmarshal(b []byte) error {
   547  	buf := codec.NewBuffer(b)
   548  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   549  	m.HostIfName = buf.DecodeString(64)
   550  	return nil
   551  }
   552  
   553  // Dump af_packet interfaces request
   554  // AfPacketDump defines message 'af_packet_dump'.
   555  type AfPacketDump struct{}
   556  
   557  func (m *AfPacketDump) Reset()               { *m = AfPacketDump{} }
   558  func (*AfPacketDump) GetMessageName() string { return "af_packet_dump" }
   559  func (*AfPacketDump) GetCrcString() string   { return "51077d14" }
   560  func (*AfPacketDump) GetMessageType() api.MessageType {
   561  	return api.RequestMessage
   562  }
   563  
   564  func (m *AfPacketDump) Size() (size int) {
   565  	if m == nil {
   566  		return 0
   567  	}
   568  	return size
   569  }
   570  func (m *AfPacketDump) Marshal(b []byte) ([]byte, error) {
   571  	if b == nil {
   572  		b = make([]byte, m.Size())
   573  	}
   574  	buf := codec.NewBuffer(b)
   575  	return buf.Bytes(), nil
   576  }
   577  func (m *AfPacketDump) Unmarshal(b []byte) error {
   578  	return nil
   579  }
   580  
   581  // Set l4 offload checksum calculation
   582  // AfPacketSetL4CksumOffload defines message 'af_packet_set_l4_cksum_offload'.
   583  type AfPacketSetL4CksumOffload struct {
   584  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   585  	Set       bool                           `binapi:"bool,name=set" json:"set,omitempty"`
   586  }
   587  
   588  func (m *AfPacketSetL4CksumOffload) Reset()               { *m = AfPacketSetL4CksumOffload{} }
   589  func (*AfPacketSetL4CksumOffload) GetMessageName() string { return "af_packet_set_l4_cksum_offload" }
   590  func (*AfPacketSetL4CksumOffload) GetCrcString() string   { return "319cd5c8" }
   591  func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType {
   592  	return api.RequestMessage
   593  }
   594  
   595  func (m *AfPacketSetL4CksumOffload) Size() (size int) {
   596  	if m == nil {
   597  		return 0
   598  	}
   599  	size += 4 // m.SwIfIndex
   600  	size += 1 // m.Set
   601  	return size
   602  }
   603  func (m *AfPacketSetL4CksumOffload) Marshal(b []byte) ([]byte, error) {
   604  	if b == nil {
   605  		b = make([]byte, m.Size())
   606  	}
   607  	buf := codec.NewBuffer(b)
   608  	buf.EncodeUint32(uint32(m.SwIfIndex))
   609  	buf.EncodeBool(m.Set)
   610  	return buf.Bytes(), nil
   611  }
   612  func (m *AfPacketSetL4CksumOffload) Unmarshal(b []byte) error {
   613  	buf := codec.NewBuffer(b)
   614  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   615  	m.Set = buf.DecodeBool()
   616  	return nil
   617  }
   618  
   619  // AfPacketSetL4CksumOffloadReply defines message 'af_packet_set_l4_cksum_offload_reply'.
   620  type AfPacketSetL4CksumOffloadReply struct {
   621  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   622  }
   623  
   624  func (m *AfPacketSetL4CksumOffloadReply) Reset() { *m = AfPacketSetL4CksumOffloadReply{} }
   625  func (*AfPacketSetL4CksumOffloadReply) GetMessageName() string {
   626  	return "af_packet_set_l4_cksum_offload_reply"
   627  }
   628  func (*AfPacketSetL4CksumOffloadReply) GetCrcString() string { return "e8d4e804" }
   629  func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType {
   630  	return api.ReplyMessage
   631  }
   632  
   633  func (m *AfPacketSetL4CksumOffloadReply) Size() (size int) {
   634  	if m == nil {
   635  		return 0
   636  	}
   637  	size += 4 // m.Retval
   638  	return size
   639  }
   640  func (m *AfPacketSetL4CksumOffloadReply) Marshal(b []byte) ([]byte, error) {
   641  	if b == nil {
   642  		b = make([]byte, m.Size())
   643  	}
   644  	buf := codec.NewBuffer(b)
   645  	buf.EncodeInt32(m.Retval)
   646  	return buf.Bytes(), nil
   647  }
   648  func (m *AfPacketSetL4CksumOffloadReply) Unmarshal(b []byte) error {
   649  	buf := codec.NewBuffer(b)
   650  	m.Retval = buf.DecodeInt32()
   651  	return nil
   652  }
   653  
   654  func init() { file_af_packet_binapi_init() }
   655  func file_af_packet_binapi_init() {
   656  	api.RegisterMessage((*AfPacketCreate)(nil), "af_packet_create_a190415f")
   657  	api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet_create_reply_5383d31f")
   658  	api.RegisterMessage((*AfPacketCreateV2)(nil), "af_packet_create_v2_4aff0436")
   659  	api.RegisterMessage((*AfPacketCreateV2Reply)(nil), "af_packet_create_v2_reply_5383d31f")
   660  	api.RegisterMessage((*AfPacketCreateV3)(nil), "af_packet_create_v3_b3a809d4")
   661  	api.RegisterMessage((*AfPacketCreateV3Reply)(nil), "af_packet_create_v3_reply_5383d31f")
   662  	api.RegisterMessage((*AfPacketDelete)(nil), "af_packet_delete_863fa648")
   663  	api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet_delete_reply_e8d4e804")
   664  	api.RegisterMessage((*AfPacketDetails)(nil), "af_packet_details_58c7c042")
   665  	api.RegisterMessage((*AfPacketDump)(nil), "af_packet_dump_51077d14")
   666  	api.RegisterMessage((*AfPacketSetL4CksumOffload)(nil), "af_packet_set_l4_cksum_offload_319cd5c8")
   667  	api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet_set_l4_cksum_offload_reply_e8d4e804")
   668  }
   669  
   670  // Messages returns list of all messages in this module.
   671  func AllMessages() []api.Message {
   672  	return []api.Message{
   673  		(*AfPacketCreate)(nil),
   674  		(*AfPacketCreateReply)(nil),
   675  		(*AfPacketCreateV2)(nil),
   676  		(*AfPacketCreateV2Reply)(nil),
   677  		(*AfPacketCreateV3)(nil),
   678  		(*AfPacketCreateV3Reply)(nil),
   679  		(*AfPacketDelete)(nil),
   680  		(*AfPacketDeleteReply)(nil),
   681  		(*AfPacketDetails)(nil),
   682  		(*AfPacketDump)(nil),
   683  		(*AfPacketSetL4CksumOffload)(nil),
   684  		(*AfPacketSetL4CksumOffloadReply)(nil),
   685  	}
   686  }