github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/nat66/nat66.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/nat66.api.json
     6  
     7  // Package nat66 contains generated bindings for API file nat66.api.
     8  //
     9  // Contents:
    10  // - 10 messages
    11  package nat66
    12  
    13  import (
    14  	interface_types "github.com/networkservicemesh/govpp/binapi/interface_types"
    15  	ip_types "github.com/networkservicemesh/govpp/binapi/ip_types"
    16  	nat_types "github.com/networkservicemesh/govpp/binapi/nat_types"
    17  	api "go.fd.io/govpp/api"
    18  	codec "go.fd.io/govpp/codec"
    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    = "nat66"
    29  	APIVersion = "1.0.0"
    30  	VersionCrc = 0xa6343f71
    31  )
    32  
    33  // Enable/disable NAT66 feature on the interface
    34  //   - is_add - true if add, false if delete
    35  //   - flags - flag NAT_IS_INSIDE if interface is inside or
    36  //     interface is outside,
    37  //   - sw_if_index - software index of the interface
    38  //
    39  // Nat66AddDelInterface defines message 'nat66_add_del_interface'.
    40  type Nat66AddDelInterface struct {
    41  	IsAdd     bool                           `binapi:"bool,name=is_add" json:"is_add,omitempty"`
    42  	Flags     nat_types.NatConfigFlags       `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"`
    43  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
    44  }
    45  
    46  func (m *Nat66AddDelInterface) Reset()               { *m = Nat66AddDelInterface{} }
    47  func (*Nat66AddDelInterface) GetMessageName() string { return "nat66_add_del_interface" }
    48  func (*Nat66AddDelInterface) GetCrcString() string   { return "f3699b83" }
    49  func (*Nat66AddDelInterface) GetMessageType() api.MessageType {
    50  	return api.RequestMessage
    51  }
    52  
    53  func (m *Nat66AddDelInterface) Size() (size int) {
    54  	if m == nil {
    55  		return 0
    56  	}
    57  	size += 1 // m.IsAdd
    58  	size += 1 // m.Flags
    59  	size += 4 // m.SwIfIndex
    60  	return size
    61  }
    62  func (m *Nat66AddDelInterface) Marshal(b []byte) ([]byte, error) {
    63  	if b == nil {
    64  		b = make([]byte, m.Size())
    65  	}
    66  	buf := codec.NewBuffer(b)
    67  	buf.EncodeBool(m.IsAdd)
    68  	buf.EncodeUint8(uint8(m.Flags))
    69  	buf.EncodeUint32(uint32(m.SwIfIndex))
    70  	return buf.Bytes(), nil
    71  }
    72  func (m *Nat66AddDelInterface) Unmarshal(b []byte) error {
    73  	buf := codec.NewBuffer(b)
    74  	m.IsAdd = buf.DecodeBool()
    75  	m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8())
    76  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
    77  	return nil
    78  }
    79  
    80  // Nat66AddDelInterfaceReply defines message 'nat66_add_del_interface_reply'.
    81  type Nat66AddDelInterfaceReply struct {
    82  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
    83  }
    84  
    85  func (m *Nat66AddDelInterfaceReply) Reset()               { *m = Nat66AddDelInterfaceReply{} }
    86  func (*Nat66AddDelInterfaceReply) GetMessageName() string { return "nat66_add_del_interface_reply" }
    87  func (*Nat66AddDelInterfaceReply) GetCrcString() string   { return "e8d4e804" }
    88  func (*Nat66AddDelInterfaceReply) GetMessageType() api.MessageType {
    89  	return api.ReplyMessage
    90  }
    91  
    92  func (m *Nat66AddDelInterfaceReply) Size() (size int) {
    93  	if m == nil {
    94  		return 0
    95  	}
    96  	size += 4 // m.Retval
    97  	return size
    98  }
    99  func (m *Nat66AddDelInterfaceReply) Marshal(b []byte) ([]byte, error) {
   100  	if b == nil {
   101  		b = make([]byte, m.Size())
   102  	}
   103  	buf := codec.NewBuffer(b)
   104  	buf.EncodeInt32(m.Retval)
   105  	return buf.Bytes(), nil
   106  }
   107  func (m *Nat66AddDelInterfaceReply) Unmarshal(b []byte) error {
   108  	buf := codec.NewBuffer(b)
   109  	m.Retval = buf.DecodeInt32()
   110  	return nil
   111  }
   112  
   113  // Add/delete 1:1 NAT66
   114  //   - is_add - true if add, false if delete
   115  //   - local_ip_address - local IPv6 address
   116  //   - external_ip_address - external IPv6 address
   117  //   - vrf_id - VRF id of tenant
   118  //
   119  // Nat66AddDelStaticMapping defines message 'nat66_add_del_static_mapping'.
   120  type Nat66AddDelStaticMapping struct {
   121  	IsAdd             bool                `binapi:"bool,name=is_add" json:"is_add,omitempty"`
   122  	LocalIPAddress    ip_types.IP6Address `binapi:"ip6_address,name=local_ip_address" json:"local_ip_address,omitempty"`
   123  	ExternalIPAddress ip_types.IP6Address `binapi:"ip6_address,name=external_ip_address" json:"external_ip_address,omitempty"`
   124  	VrfID             uint32              `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"`
   125  }
   126  
   127  func (m *Nat66AddDelStaticMapping) Reset()               { *m = Nat66AddDelStaticMapping{} }
   128  func (*Nat66AddDelStaticMapping) GetMessageName() string { return "nat66_add_del_static_mapping" }
   129  func (*Nat66AddDelStaticMapping) GetCrcString() string   { return "3ed88f71" }
   130  func (*Nat66AddDelStaticMapping) GetMessageType() api.MessageType {
   131  	return api.RequestMessage
   132  }
   133  
   134  func (m *Nat66AddDelStaticMapping) Size() (size int) {
   135  	if m == nil {
   136  		return 0
   137  	}
   138  	size += 1      // m.IsAdd
   139  	size += 1 * 16 // m.LocalIPAddress
   140  	size += 1 * 16 // m.ExternalIPAddress
   141  	size += 4      // m.VrfID
   142  	return size
   143  }
   144  func (m *Nat66AddDelStaticMapping) Marshal(b []byte) ([]byte, error) {
   145  	if b == nil {
   146  		b = make([]byte, m.Size())
   147  	}
   148  	buf := codec.NewBuffer(b)
   149  	buf.EncodeBool(m.IsAdd)
   150  	buf.EncodeBytes(m.LocalIPAddress[:], 16)
   151  	buf.EncodeBytes(m.ExternalIPAddress[:], 16)
   152  	buf.EncodeUint32(m.VrfID)
   153  	return buf.Bytes(), nil
   154  }
   155  func (m *Nat66AddDelStaticMapping) Unmarshal(b []byte) error {
   156  	buf := codec.NewBuffer(b)
   157  	m.IsAdd = buf.DecodeBool()
   158  	copy(m.LocalIPAddress[:], buf.DecodeBytes(16))
   159  	copy(m.ExternalIPAddress[:], buf.DecodeBytes(16))
   160  	m.VrfID = buf.DecodeUint32()
   161  	return nil
   162  }
   163  
   164  // Nat66AddDelStaticMappingReply defines message 'nat66_add_del_static_mapping_reply'.
   165  type Nat66AddDelStaticMappingReply struct {
   166  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   167  }
   168  
   169  func (m *Nat66AddDelStaticMappingReply) Reset() { *m = Nat66AddDelStaticMappingReply{} }
   170  func (*Nat66AddDelStaticMappingReply) GetMessageName() string {
   171  	return "nat66_add_del_static_mapping_reply"
   172  }
   173  func (*Nat66AddDelStaticMappingReply) GetCrcString() string { return "e8d4e804" }
   174  func (*Nat66AddDelStaticMappingReply) GetMessageType() api.MessageType {
   175  	return api.ReplyMessage
   176  }
   177  
   178  func (m *Nat66AddDelStaticMappingReply) Size() (size int) {
   179  	if m == nil {
   180  		return 0
   181  	}
   182  	size += 4 // m.Retval
   183  	return size
   184  }
   185  func (m *Nat66AddDelStaticMappingReply) Marshal(b []byte) ([]byte, error) {
   186  	if b == nil {
   187  		b = make([]byte, m.Size())
   188  	}
   189  	buf := codec.NewBuffer(b)
   190  	buf.EncodeInt32(m.Retval)
   191  	return buf.Bytes(), nil
   192  }
   193  func (m *Nat66AddDelStaticMappingReply) Unmarshal(b []byte) error {
   194  	buf := codec.NewBuffer(b)
   195  	m.Retval = buf.DecodeInt32()
   196  	return nil
   197  }
   198  
   199  // NAT66 interface details response
   200  //   - flags - flag NAT_IS_INSIDE if interface is inside or
   201  //     interface is outside,
   202  //   - sw_if_index - software index of the interface
   203  //
   204  // Nat66InterfaceDetails defines message 'nat66_interface_details'.
   205  type Nat66InterfaceDetails struct {
   206  	Flags     nat_types.NatConfigFlags       `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"`
   207  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   208  }
   209  
   210  func (m *Nat66InterfaceDetails) Reset()               { *m = Nat66InterfaceDetails{} }
   211  func (*Nat66InterfaceDetails) GetMessageName() string { return "nat66_interface_details" }
   212  func (*Nat66InterfaceDetails) GetCrcString() string   { return "5d286289" }
   213  func (*Nat66InterfaceDetails) GetMessageType() api.MessageType {
   214  	return api.ReplyMessage
   215  }
   216  
   217  func (m *Nat66InterfaceDetails) Size() (size int) {
   218  	if m == nil {
   219  		return 0
   220  	}
   221  	size += 1 // m.Flags
   222  	size += 4 // m.SwIfIndex
   223  	return size
   224  }
   225  func (m *Nat66InterfaceDetails) Marshal(b []byte) ([]byte, error) {
   226  	if b == nil {
   227  		b = make([]byte, m.Size())
   228  	}
   229  	buf := codec.NewBuffer(b)
   230  	buf.EncodeUint8(uint8(m.Flags))
   231  	buf.EncodeUint32(uint32(m.SwIfIndex))
   232  	return buf.Bytes(), nil
   233  }
   234  func (m *Nat66InterfaceDetails) Unmarshal(b []byte) error {
   235  	buf := codec.NewBuffer(b)
   236  	m.Flags = nat_types.NatConfigFlags(buf.DecodeUint8())
   237  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   238  	return nil
   239  }
   240  
   241  // Dump interfaces with NAT66 feature
   242  // Nat66InterfaceDump defines message 'nat66_interface_dump'.
   243  type Nat66InterfaceDump struct{}
   244  
   245  func (m *Nat66InterfaceDump) Reset()               { *m = Nat66InterfaceDump{} }
   246  func (*Nat66InterfaceDump) GetMessageName() string { return "nat66_interface_dump" }
   247  func (*Nat66InterfaceDump) GetCrcString() string   { return "51077d14" }
   248  func (*Nat66InterfaceDump) GetMessageType() api.MessageType {
   249  	return api.RequestMessage
   250  }
   251  
   252  func (m *Nat66InterfaceDump) Size() (size int) {
   253  	if m == nil {
   254  		return 0
   255  	}
   256  	return size
   257  }
   258  func (m *Nat66InterfaceDump) Marshal(b []byte) ([]byte, error) {
   259  	if b == nil {
   260  		b = make([]byte, m.Size())
   261  	}
   262  	buf := codec.NewBuffer(b)
   263  	return buf.Bytes(), nil
   264  }
   265  func (m *Nat66InterfaceDump) Unmarshal(b []byte) error {
   266  	return nil
   267  }
   268  
   269  // Enable/disable NAT66 plugin
   270  //   - outside_vrf - outside vrf id
   271  //   - enable - true if enable, false if disable
   272  //
   273  // Nat66PluginEnableDisable defines message 'nat66_plugin_enable_disable'.
   274  type Nat66PluginEnableDisable struct {
   275  	OutsideVrf uint32 `binapi:"u32,name=outside_vrf" json:"outside_vrf,omitempty"`
   276  	Enable     bool   `binapi:"bool,name=enable" json:"enable,omitempty"`
   277  }
   278  
   279  func (m *Nat66PluginEnableDisable) Reset()               { *m = Nat66PluginEnableDisable{} }
   280  func (*Nat66PluginEnableDisable) GetMessageName() string { return "nat66_plugin_enable_disable" }
   281  func (*Nat66PluginEnableDisable) GetCrcString() string   { return "56f2f83b" }
   282  func (*Nat66PluginEnableDisable) GetMessageType() api.MessageType {
   283  	return api.RequestMessage
   284  }
   285  
   286  func (m *Nat66PluginEnableDisable) Size() (size int) {
   287  	if m == nil {
   288  		return 0
   289  	}
   290  	size += 4 // m.OutsideVrf
   291  	size += 1 // m.Enable
   292  	return size
   293  }
   294  func (m *Nat66PluginEnableDisable) Marshal(b []byte) ([]byte, error) {
   295  	if b == nil {
   296  		b = make([]byte, m.Size())
   297  	}
   298  	buf := codec.NewBuffer(b)
   299  	buf.EncodeUint32(m.OutsideVrf)
   300  	buf.EncodeBool(m.Enable)
   301  	return buf.Bytes(), nil
   302  }
   303  func (m *Nat66PluginEnableDisable) Unmarshal(b []byte) error {
   304  	buf := codec.NewBuffer(b)
   305  	m.OutsideVrf = buf.DecodeUint32()
   306  	m.Enable = buf.DecodeBool()
   307  	return nil
   308  }
   309  
   310  // Nat66PluginEnableDisableReply defines message 'nat66_plugin_enable_disable_reply'.
   311  type Nat66PluginEnableDisableReply struct {
   312  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   313  }
   314  
   315  func (m *Nat66PluginEnableDisableReply) Reset() { *m = Nat66PluginEnableDisableReply{} }
   316  func (*Nat66PluginEnableDisableReply) GetMessageName() string {
   317  	return "nat66_plugin_enable_disable_reply"
   318  }
   319  func (*Nat66PluginEnableDisableReply) GetCrcString() string { return "e8d4e804" }
   320  func (*Nat66PluginEnableDisableReply) GetMessageType() api.MessageType {
   321  	return api.ReplyMessage
   322  }
   323  
   324  func (m *Nat66PluginEnableDisableReply) Size() (size int) {
   325  	if m == nil {
   326  		return 0
   327  	}
   328  	size += 4 // m.Retval
   329  	return size
   330  }
   331  func (m *Nat66PluginEnableDisableReply) Marshal(b []byte) ([]byte, error) {
   332  	if b == nil {
   333  		b = make([]byte, m.Size())
   334  	}
   335  	buf := codec.NewBuffer(b)
   336  	buf.EncodeInt32(m.Retval)
   337  	return buf.Bytes(), nil
   338  }
   339  func (m *Nat66PluginEnableDisableReply) Unmarshal(b []byte) error {
   340  	buf := codec.NewBuffer(b)
   341  	m.Retval = buf.DecodeInt32()
   342  	return nil
   343  }
   344  
   345  // NAT66 static mapping details response
   346  //   - local_ip_address - local IPv6 address
   347  //   - external_ip_address - external IPv6 address
   348  //   - vrf_id - VRF id of tenant
   349  //   - total_bytes - count of bytes sent through static mapping
   350  //   - total_pkts - count of pakets sent through static mapping
   351  //
   352  // Nat66StaticMappingDetails defines message 'nat66_static_mapping_details'.
   353  type Nat66StaticMappingDetails struct {
   354  	LocalIPAddress    ip_types.IP6Address `binapi:"ip6_address,name=local_ip_address" json:"local_ip_address,omitempty"`
   355  	ExternalIPAddress ip_types.IP6Address `binapi:"ip6_address,name=external_ip_address" json:"external_ip_address,omitempty"`
   356  	VrfID             uint32              `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"`
   357  	TotalBytes        uint64              `binapi:"u64,name=total_bytes" json:"total_bytes,omitempty"`
   358  	TotalPkts         uint64              `binapi:"u64,name=total_pkts" json:"total_pkts,omitempty"`
   359  }
   360  
   361  func (m *Nat66StaticMappingDetails) Reset()               { *m = Nat66StaticMappingDetails{} }
   362  func (*Nat66StaticMappingDetails) GetMessageName() string { return "nat66_static_mapping_details" }
   363  func (*Nat66StaticMappingDetails) GetCrcString() string   { return "df39654b" }
   364  func (*Nat66StaticMappingDetails) GetMessageType() api.MessageType {
   365  	return api.ReplyMessage
   366  }
   367  
   368  func (m *Nat66StaticMappingDetails) Size() (size int) {
   369  	if m == nil {
   370  		return 0
   371  	}
   372  	size += 1 * 16 // m.LocalIPAddress
   373  	size += 1 * 16 // m.ExternalIPAddress
   374  	size += 4      // m.VrfID
   375  	size += 8      // m.TotalBytes
   376  	size += 8      // m.TotalPkts
   377  	return size
   378  }
   379  func (m *Nat66StaticMappingDetails) Marshal(b []byte) ([]byte, error) {
   380  	if b == nil {
   381  		b = make([]byte, m.Size())
   382  	}
   383  	buf := codec.NewBuffer(b)
   384  	buf.EncodeBytes(m.LocalIPAddress[:], 16)
   385  	buf.EncodeBytes(m.ExternalIPAddress[:], 16)
   386  	buf.EncodeUint32(m.VrfID)
   387  	buf.EncodeUint64(m.TotalBytes)
   388  	buf.EncodeUint64(m.TotalPkts)
   389  	return buf.Bytes(), nil
   390  }
   391  func (m *Nat66StaticMappingDetails) Unmarshal(b []byte) error {
   392  	buf := codec.NewBuffer(b)
   393  	copy(m.LocalIPAddress[:], buf.DecodeBytes(16))
   394  	copy(m.ExternalIPAddress[:], buf.DecodeBytes(16))
   395  	m.VrfID = buf.DecodeUint32()
   396  	m.TotalBytes = buf.DecodeUint64()
   397  	m.TotalPkts = buf.DecodeUint64()
   398  	return nil
   399  }
   400  
   401  // Dump NAT66 static mappings
   402  // Nat66StaticMappingDump defines message 'nat66_static_mapping_dump'.
   403  type Nat66StaticMappingDump struct{}
   404  
   405  func (m *Nat66StaticMappingDump) Reset()               { *m = Nat66StaticMappingDump{} }
   406  func (*Nat66StaticMappingDump) GetMessageName() string { return "nat66_static_mapping_dump" }
   407  func (*Nat66StaticMappingDump) GetCrcString() string   { return "51077d14" }
   408  func (*Nat66StaticMappingDump) GetMessageType() api.MessageType {
   409  	return api.RequestMessage
   410  }
   411  
   412  func (m *Nat66StaticMappingDump) Size() (size int) {
   413  	if m == nil {
   414  		return 0
   415  	}
   416  	return size
   417  }
   418  func (m *Nat66StaticMappingDump) Marshal(b []byte) ([]byte, error) {
   419  	if b == nil {
   420  		b = make([]byte, m.Size())
   421  	}
   422  	buf := codec.NewBuffer(b)
   423  	return buf.Bytes(), nil
   424  }
   425  func (m *Nat66StaticMappingDump) Unmarshal(b []byte) error {
   426  	return nil
   427  }
   428  
   429  func init() { file_nat66_binapi_init() }
   430  func file_nat66_binapi_init() {
   431  	api.RegisterMessage((*Nat66AddDelInterface)(nil), "nat66_add_del_interface_f3699b83")
   432  	api.RegisterMessage((*Nat66AddDelInterfaceReply)(nil), "nat66_add_del_interface_reply_e8d4e804")
   433  	api.RegisterMessage((*Nat66AddDelStaticMapping)(nil), "nat66_add_del_static_mapping_3ed88f71")
   434  	api.RegisterMessage((*Nat66AddDelStaticMappingReply)(nil), "nat66_add_del_static_mapping_reply_e8d4e804")
   435  	api.RegisterMessage((*Nat66InterfaceDetails)(nil), "nat66_interface_details_5d286289")
   436  	api.RegisterMessage((*Nat66InterfaceDump)(nil), "nat66_interface_dump_51077d14")
   437  	api.RegisterMessage((*Nat66PluginEnableDisable)(nil), "nat66_plugin_enable_disable_56f2f83b")
   438  	api.RegisterMessage((*Nat66PluginEnableDisableReply)(nil), "nat66_plugin_enable_disable_reply_e8d4e804")
   439  	api.RegisterMessage((*Nat66StaticMappingDetails)(nil), "nat66_static_mapping_details_df39654b")
   440  	api.RegisterMessage((*Nat66StaticMappingDump)(nil), "nat66_static_mapping_dump_51077d14")
   441  }
   442  
   443  // Messages returns list of all messages in this module.
   444  func AllMessages() []api.Message {
   445  	return []api.Message{
   446  		(*Nat66AddDelInterface)(nil),
   447  		(*Nat66AddDelInterfaceReply)(nil),
   448  		(*Nat66AddDelStaticMapping)(nil),
   449  		(*Nat66AddDelStaticMappingReply)(nil),
   450  		(*Nat66InterfaceDetails)(nil),
   451  		(*Nat66InterfaceDump)(nil),
   452  		(*Nat66PluginEnableDisable)(nil),
   453  		(*Nat66PluginEnableDisableReply)(nil),
   454  		(*Nat66StaticMappingDetails)(nil),
   455  		(*Nat66StaticMappingDump)(nil),
   456  	}
   457  }