github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/mss_clamp/mss_clamp.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/mss_clamp.api.json
     6  
     7  // Package mss_clamp contains generated bindings for API file mss_clamp.api.
     8  //
     9  // Contents:
    10  // -  1 enum
    11  // -  5 messages
    12  package mss_clamp
    13  
    14  import (
    15  	"strconv"
    16  
    17  	interface_types "github.com/networkservicemesh/govpp/binapi/interface_types"
    18  	api "go.fd.io/govpp/api"
    19  	codec "go.fd.io/govpp/codec"
    20  )
    21  
    22  // This is a compile-time assertion to ensure that this generated file
    23  // is compatible with the GoVPP api package it is being compiled against.
    24  // A compilation error at this line likely means your copy of the
    25  // GoVPP api package needs to be updated.
    26  const _ = api.GoVppAPIPackageIsVersion2
    27  
    28  const (
    29  	APIFile    = "mss_clamp"
    30  	APIVersion = "1.0.0"
    31  	VersionCrc = 0xea8186c0
    32  )
    33  
    34  // MssClampDir defines enum 'mss_clamp_dir'.
    35  type MssClampDir uint8
    36  
    37  const (
    38  	MSS_CLAMP_DIR_NONE MssClampDir = 0
    39  	MSS_CLAMP_DIR_RX   MssClampDir = 1
    40  	MSS_CLAMP_DIR_TX   MssClampDir = 2
    41  )
    42  
    43  var (
    44  	MssClampDir_name = map[uint8]string{
    45  		0: "MSS_CLAMP_DIR_NONE",
    46  		1: "MSS_CLAMP_DIR_RX",
    47  		2: "MSS_CLAMP_DIR_TX",
    48  	}
    49  	MssClampDir_value = map[string]uint8{
    50  		"MSS_CLAMP_DIR_NONE": 0,
    51  		"MSS_CLAMP_DIR_RX":   1,
    52  		"MSS_CLAMP_DIR_TX":   2,
    53  	}
    54  )
    55  
    56  func (x MssClampDir) String() string {
    57  	s, ok := MssClampDir_name[uint8(x)]
    58  	if ok {
    59  		return s
    60  	}
    61  	str := func(n uint8) string {
    62  		s, ok := MssClampDir_name[uint8(n)]
    63  		if ok {
    64  			return s
    65  		}
    66  		return "MssClampDir(" + strconv.Itoa(int(n)) + ")"
    67  	}
    68  	for i := uint8(0); i <= 8; i++ {
    69  		val := uint8(x)
    70  		if val&(1<<i) != 0 {
    71  			if s != "" {
    72  				s += "|"
    73  			}
    74  			s += str(1 << i)
    75  		}
    76  	}
    77  	if s == "" {
    78  		return str(uint8(x))
    79  	}
    80  	return s
    81  }
    82  
    83  // Configured MSS values on an interface
    84  //   - sw_if_index - interface index on which clamping is applied
    85  //   - ipv4_mss - Maximum Segment Size for IPv4/TCP
    86  //   - ipv6_mss - Maximum Segment Size for IPv6/TCP
    87  //   - ipv4_direction - Direction clamping is enabled on (IPv4/TCP)
    88  //   - ipv6_direction - Direction clamping is enabled on (IPv6/TCP)
    89  //
    90  // MssClampDetails defines message 'mss_clamp_details'.
    91  type MssClampDetails struct {
    92  	SwIfIndex     interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
    93  	IPv4Mss       uint16                         `binapi:"u16,name=ipv4_mss" json:"ipv4_mss,omitempty"`
    94  	IPv6Mss       uint16                         `binapi:"u16,name=ipv6_mss" json:"ipv6_mss,omitempty"`
    95  	IPv4Direction MssClampDir                    `binapi:"mss_clamp_dir,name=ipv4_direction" json:"ipv4_direction,omitempty"`
    96  	IPv6Direction MssClampDir                    `binapi:"mss_clamp_dir,name=ipv6_direction" json:"ipv6_direction,omitempty"`
    97  }
    98  
    99  func (m *MssClampDetails) Reset()               { *m = MssClampDetails{} }
   100  func (*MssClampDetails) GetMessageName() string { return "mss_clamp_details" }
   101  func (*MssClampDetails) GetCrcString() string   { return "d3a4de61" }
   102  func (*MssClampDetails) GetMessageType() api.MessageType {
   103  	return api.ReplyMessage
   104  }
   105  
   106  func (m *MssClampDetails) Size() (size int) {
   107  	if m == nil {
   108  		return 0
   109  	}
   110  	size += 4 // m.SwIfIndex
   111  	size += 2 // m.IPv4Mss
   112  	size += 2 // m.IPv6Mss
   113  	size += 1 // m.IPv4Direction
   114  	size += 1 // m.IPv6Direction
   115  	return size
   116  }
   117  func (m *MssClampDetails) Marshal(b []byte) ([]byte, error) {
   118  	if b == nil {
   119  		b = make([]byte, m.Size())
   120  	}
   121  	buf := codec.NewBuffer(b)
   122  	buf.EncodeUint32(uint32(m.SwIfIndex))
   123  	buf.EncodeUint16(m.IPv4Mss)
   124  	buf.EncodeUint16(m.IPv6Mss)
   125  	buf.EncodeUint8(uint8(m.IPv4Direction))
   126  	buf.EncodeUint8(uint8(m.IPv6Direction))
   127  	return buf.Bytes(), nil
   128  }
   129  func (m *MssClampDetails) Unmarshal(b []byte) error {
   130  	buf := codec.NewBuffer(b)
   131  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   132  	m.IPv4Mss = buf.DecodeUint16()
   133  	m.IPv6Mss = buf.DecodeUint16()
   134  	m.IPv4Direction = MssClampDir(buf.DecodeUint8())
   135  	m.IPv6Direction = MssClampDir(buf.DecodeUint8())
   136  	return nil
   137  }
   138  
   139  // Enable/Disable TCP MSS Clamping feature on an interface
   140  //   - sw_if_index - interface index on which clamping will be applied
   141  //   - ipv4_mss - Maximum Segment Size for IPv4/TCP
   142  //   - ipv6_mss - Maximum Segment Size for IPv6/TCP
   143  //   - ipv4_direction - Direction clamping is enabled on (IPv4/TCP)
   144  //   - ipv6_direction - Direction clamping is enabled on (IPv6/TCP)
   145  //
   146  // MssClampEnableDisable defines message 'mss_clamp_enable_disable'.
   147  type MssClampEnableDisable struct {
   148  	SwIfIndex     interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   149  	IPv4Mss       uint16                         `binapi:"u16,name=ipv4_mss" json:"ipv4_mss,omitempty"`
   150  	IPv6Mss       uint16                         `binapi:"u16,name=ipv6_mss" json:"ipv6_mss,omitempty"`
   151  	IPv4Direction MssClampDir                    `binapi:"mss_clamp_dir,name=ipv4_direction" json:"ipv4_direction,omitempty"`
   152  	IPv6Direction MssClampDir                    `binapi:"mss_clamp_dir,name=ipv6_direction" json:"ipv6_direction,omitempty"`
   153  }
   154  
   155  func (m *MssClampEnableDisable) Reset()               { *m = MssClampEnableDisable{} }
   156  func (*MssClampEnableDisable) GetMessageName() string { return "mss_clamp_enable_disable" }
   157  func (*MssClampEnableDisable) GetCrcString() string   { return "d31b44e3" }
   158  func (*MssClampEnableDisable) GetMessageType() api.MessageType {
   159  	return api.RequestMessage
   160  }
   161  
   162  func (m *MssClampEnableDisable) Size() (size int) {
   163  	if m == nil {
   164  		return 0
   165  	}
   166  	size += 4 // m.SwIfIndex
   167  	size += 2 // m.IPv4Mss
   168  	size += 2 // m.IPv6Mss
   169  	size += 1 // m.IPv4Direction
   170  	size += 1 // m.IPv6Direction
   171  	return size
   172  }
   173  func (m *MssClampEnableDisable) Marshal(b []byte) ([]byte, error) {
   174  	if b == nil {
   175  		b = make([]byte, m.Size())
   176  	}
   177  	buf := codec.NewBuffer(b)
   178  	buf.EncodeUint32(uint32(m.SwIfIndex))
   179  	buf.EncodeUint16(m.IPv4Mss)
   180  	buf.EncodeUint16(m.IPv6Mss)
   181  	buf.EncodeUint8(uint8(m.IPv4Direction))
   182  	buf.EncodeUint8(uint8(m.IPv6Direction))
   183  	return buf.Bytes(), nil
   184  }
   185  func (m *MssClampEnableDisable) Unmarshal(b []byte) error {
   186  	buf := codec.NewBuffer(b)
   187  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   188  	m.IPv4Mss = buf.DecodeUint16()
   189  	m.IPv6Mss = buf.DecodeUint16()
   190  	m.IPv4Direction = MssClampDir(buf.DecodeUint8())
   191  	m.IPv6Direction = MssClampDir(buf.DecodeUint8())
   192  	return nil
   193  }
   194  
   195  // MssClampEnableDisableReply defines message 'mss_clamp_enable_disable_reply'.
   196  type MssClampEnableDisableReply struct {
   197  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   198  }
   199  
   200  func (m *MssClampEnableDisableReply) Reset()               { *m = MssClampEnableDisableReply{} }
   201  func (*MssClampEnableDisableReply) GetMessageName() string { return "mss_clamp_enable_disable_reply" }
   202  func (*MssClampEnableDisableReply) GetCrcString() string   { return "e8d4e804" }
   203  func (*MssClampEnableDisableReply) GetMessageType() api.MessageType {
   204  	return api.ReplyMessage
   205  }
   206  
   207  func (m *MssClampEnableDisableReply) Size() (size int) {
   208  	if m == nil {
   209  		return 0
   210  	}
   211  	size += 4 // m.Retval
   212  	return size
   213  }
   214  func (m *MssClampEnableDisableReply) Marshal(b []byte) ([]byte, error) {
   215  	if b == nil {
   216  		b = make([]byte, m.Size())
   217  	}
   218  	buf := codec.NewBuffer(b)
   219  	buf.EncodeInt32(m.Retval)
   220  	return buf.Bytes(), nil
   221  }
   222  func (m *MssClampEnableDisableReply) Unmarshal(b []byte) error {
   223  	buf := codec.NewBuffer(b)
   224  	m.Retval = buf.DecodeInt32()
   225  	return nil
   226  }
   227  
   228  // Get the TCP MSS Clamping feature settings
   229  //   - cursor - cursor to continue when there is more to read
   230  //   - sw_if_index - interface index to filter the result,
   231  //     ~0 means no filter
   232  //
   233  // MssClampGet defines message 'mss_clamp_get'.
   234  type MssClampGet struct {
   235  	Cursor    uint32                         `binapi:"u32,name=cursor" json:"cursor,omitempty"`
   236  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   237  }
   238  
   239  func (m *MssClampGet) Reset()               { *m = MssClampGet{} }
   240  func (*MssClampGet) GetMessageName() string { return "mss_clamp_get" }
   241  func (*MssClampGet) GetCrcString() string   { return "47250981" }
   242  func (*MssClampGet) GetMessageType() api.MessageType {
   243  	return api.RequestMessage
   244  }
   245  
   246  func (m *MssClampGet) Size() (size int) {
   247  	if m == nil {
   248  		return 0
   249  	}
   250  	size += 4 // m.Cursor
   251  	size += 4 // m.SwIfIndex
   252  	return size
   253  }
   254  func (m *MssClampGet) Marshal(b []byte) ([]byte, error) {
   255  	if b == nil {
   256  		b = make([]byte, m.Size())
   257  	}
   258  	buf := codec.NewBuffer(b)
   259  	buf.EncodeUint32(m.Cursor)
   260  	buf.EncodeUint32(uint32(m.SwIfIndex))
   261  	return buf.Bytes(), nil
   262  }
   263  func (m *MssClampGet) Unmarshal(b []byte) error {
   264  	buf := codec.NewBuffer(b)
   265  	m.Cursor = buf.DecodeUint32()
   266  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   267  	return nil
   268  }
   269  
   270  // Reply for get TCP MSS Clamping feature settings request
   271  //   - retval - return code
   272  //   - cursor - cursor to continue when there is more to read
   273  //
   274  // MssClampGetReply defines message 'mss_clamp_get_reply'.
   275  type MssClampGetReply struct {
   276  	Retval int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
   277  	Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"`
   278  }
   279  
   280  func (m *MssClampGetReply) Reset()               { *m = MssClampGetReply{} }
   281  func (*MssClampGetReply) GetMessageName() string { return "mss_clamp_get_reply" }
   282  func (*MssClampGetReply) GetCrcString() string   { return "53b48f5d" }
   283  func (*MssClampGetReply) GetMessageType() api.MessageType {
   284  	return api.ReplyMessage
   285  }
   286  
   287  func (m *MssClampGetReply) Size() (size int) {
   288  	if m == nil {
   289  		return 0
   290  	}
   291  	size += 4 // m.Retval
   292  	size += 4 // m.Cursor
   293  	return size
   294  }
   295  func (m *MssClampGetReply) Marshal(b []byte) ([]byte, error) {
   296  	if b == nil {
   297  		b = make([]byte, m.Size())
   298  	}
   299  	buf := codec.NewBuffer(b)
   300  	buf.EncodeInt32(m.Retval)
   301  	buf.EncodeUint32(m.Cursor)
   302  	return buf.Bytes(), nil
   303  }
   304  func (m *MssClampGetReply) Unmarshal(b []byte) error {
   305  	buf := codec.NewBuffer(b)
   306  	m.Retval = buf.DecodeInt32()
   307  	m.Cursor = buf.DecodeUint32()
   308  	return nil
   309  }
   310  
   311  func init() { file_mss_clamp_binapi_init() }
   312  func file_mss_clamp_binapi_init() {
   313  	api.RegisterMessage((*MssClampDetails)(nil), "mss_clamp_details_d3a4de61")
   314  	api.RegisterMessage((*MssClampEnableDisable)(nil), "mss_clamp_enable_disable_d31b44e3")
   315  	api.RegisterMessage((*MssClampEnableDisableReply)(nil), "mss_clamp_enable_disable_reply_e8d4e804")
   316  	api.RegisterMessage((*MssClampGet)(nil), "mss_clamp_get_47250981")
   317  	api.RegisterMessage((*MssClampGetReply)(nil), "mss_clamp_get_reply_53b48f5d")
   318  }
   319  
   320  // Messages returns list of all messages in this module.
   321  func AllMessages() []api.Message {
   322  	return []api.Message{
   323  		(*MssClampDetails)(nil),
   324  		(*MssClampEnableDisable)(nil),
   325  		(*MssClampEnableDisableReply)(nil),
   326  		(*MssClampGet)(nil),
   327  		(*MssClampGetReply)(nil),
   328  	}
   329  }