github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/binapi/cnat/cnat.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/cnat.api.json
     6  
     7  // Package cnat contains generated bindings for API file cnat.api.
     8  //
     9  // Contents:
    10  //   5 enums
    11  //   4 structs
    12  //  20 messages
    13  //
    14  package cnat
    15  
    16  import (
    17  	"strconv"
    18  
    19  	api "git.fd.io/govpp.git/api"
    20  	codec "git.fd.io/govpp.git/codec"
    21  	_ "github.com/edwarnicke/govpp/binapi/fib_types"
    22  	interface_types "github.com/edwarnicke/govpp/binapi/interface_types"
    23  	ip_types "github.com/edwarnicke/govpp/binapi/ip_types"
    24  )
    25  
    26  // This is a compile-time assertion to ensure that this generated file
    27  // is compatible with the GoVPP api package it is being compiled against.
    28  // A compilation error at this line likely means your copy of the
    29  // GoVPP api package needs to be updated.
    30  const _ = api.GoVppAPIPackageIsVersion2
    31  
    32  const (
    33  	APIFile    = "cnat"
    34  	APIVersion = "0.2.0"
    35  	VersionCrc = 0xfd05573b
    36  )
    37  
    38  // CnatEndpointTupleFlags defines enum 'cnat_endpoint_tuple_flags'.
    39  type CnatEndpointTupleFlags uint8
    40  
    41  const (
    42  	CNAT_EPT_NO_NAT CnatEndpointTupleFlags = 1
    43  )
    44  
    45  var (
    46  	CnatEndpointTupleFlags_name = map[uint8]string{
    47  		1: "CNAT_EPT_NO_NAT",
    48  	}
    49  	CnatEndpointTupleFlags_value = map[string]uint8{
    50  		"CNAT_EPT_NO_NAT": 1,
    51  	}
    52  )
    53  
    54  func (x CnatEndpointTupleFlags) String() string {
    55  	s, ok := CnatEndpointTupleFlags_name[uint8(x)]
    56  	if ok {
    57  		return s
    58  	}
    59  	str := func(n uint8) string {
    60  		s, ok := CnatEndpointTupleFlags_name[uint8(n)]
    61  		if ok {
    62  			return s
    63  		}
    64  		return "CnatEndpointTupleFlags(" + strconv.Itoa(int(n)) + ")"
    65  	}
    66  	for i := uint8(0); i <= 8; i++ {
    67  		val := uint8(x)
    68  		if val&(1<<i) != 0 {
    69  			if s != "" {
    70  				s += "|"
    71  			}
    72  			s += str(1 << i)
    73  		}
    74  	}
    75  	if s == "" {
    76  		return str(uint8(x))
    77  	}
    78  	return s
    79  }
    80  
    81  // CnatLbType defines enum 'cnat_lb_type'.
    82  type CnatLbType uint8
    83  
    84  const (
    85  	CNAT_LB_TYPE_DEFAULT CnatLbType = 0
    86  	CNAT_LB_TYPE_MAGLEV  CnatLbType = 1
    87  )
    88  
    89  var (
    90  	CnatLbType_name = map[uint8]string{
    91  		0: "CNAT_LB_TYPE_DEFAULT",
    92  		1: "CNAT_LB_TYPE_MAGLEV",
    93  	}
    94  	CnatLbType_value = map[string]uint8{
    95  		"CNAT_LB_TYPE_DEFAULT": 0,
    96  		"CNAT_LB_TYPE_MAGLEV":  1,
    97  	}
    98  )
    99  
   100  func (x CnatLbType) String() string {
   101  	s, ok := CnatLbType_name[uint8(x)]
   102  	if ok {
   103  		return s
   104  	}
   105  	return "CnatLbType(" + strconv.Itoa(int(x)) + ")"
   106  }
   107  
   108  // CnatSnatPolicies defines enum 'cnat_snat_policies'.
   109  type CnatSnatPolicies uint8
   110  
   111  const (
   112  	CNAT_POLICY_NONE   CnatSnatPolicies = 0
   113  	CNAT_POLICY_IF_PFX CnatSnatPolicies = 1
   114  	CNAT_POLICY_K8S    CnatSnatPolicies = 2
   115  )
   116  
   117  var (
   118  	CnatSnatPolicies_name = map[uint8]string{
   119  		0: "CNAT_POLICY_NONE",
   120  		1: "CNAT_POLICY_IF_PFX",
   121  		2: "CNAT_POLICY_K8S",
   122  	}
   123  	CnatSnatPolicies_value = map[string]uint8{
   124  		"CNAT_POLICY_NONE":   0,
   125  		"CNAT_POLICY_IF_PFX": 1,
   126  		"CNAT_POLICY_K8S":    2,
   127  	}
   128  )
   129  
   130  func (x CnatSnatPolicies) String() string {
   131  	s, ok := CnatSnatPolicies_name[uint8(x)]
   132  	if ok {
   133  		return s
   134  	}
   135  	return "CnatSnatPolicies(" + strconv.Itoa(int(x)) + ")"
   136  }
   137  
   138  // CnatSnatPolicyTable defines enum 'cnat_snat_policy_table'.
   139  type CnatSnatPolicyTable uint8
   140  
   141  const (
   142  	CNAT_POLICY_INCLUDE_V4 CnatSnatPolicyTable = 0
   143  	CNAT_POLICY_INCLUDE_V6 CnatSnatPolicyTable = 1
   144  	CNAT_POLICY_POD        CnatSnatPolicyTable = 2
   145  )
   146  
   147  var (
   148  	CnatSnatPolicyTable_name = map[uint8]string{
   149  		0: "CNAT_POLICY_INCLUDE_V4",
   150  		1: "CNAT_POLICY_INCLUDE_V6",
   151  		2: "CNAT_POLICY_POD",
   152  	}
   153  	CnatSnatPolicyTable_value = map[string]uint8{
   154  		"CNAT_POLICY_INCLUDE_V4": 0,
   155  		"CNAT_POLICY_INCLUDE_V6": 1,
   156  		"CNAT_POLICY_POD":        2,
   157  	}
   158  )
   159  
   160  func (x CnatSnatPolicyTable) String() string {
   161  	s, ok := CnatSnatPolicyTable_name[uint8(x)]
   162  	if ok {
   163  		return s
   164  	}
   165  	return "CnatSnatPolicyTable(" + strconv.Itoa(int(x)) + ")"
   166  }
   167  
   168  // CnatTranslationFlags defines enum 'cnat_translation_flags'.
   169  type CnatTranslationFlags uint8
   170  
   171  const (
   172  	CNAT_TRANSLATION_ALLOC_PORT CnatTranslationFlags = 1
   173  )
   174  
   175  var (
   176  	CnatTranslationFlags_name = map[uint8]string{
   177  		1: "CNAT_TRANSLATION_ALLOC_PORT",
   178  	}
   179  	CnatTranslationFlags_value = map[string]uint8{
   180  		"CNAT_TRANSLATION_ALLOC_PORT": 1,
   181  	}
   182  )
   183  
   184  func (x CnatTranslationFlags) String() string {
   185  	s, ok := CnatTranslationFlags_name[uint8(x)]
   186  	if ok {
   187  		return s
   188  	}
   189  	str := func(n uint8) string {
   190  		s, ok := CnatTranslationFlags_name[uint8(n)]
   191  		if ok {
   192  			return s
   193  		}
   194  		return "CnatTranslationFlags(" + strconv.Itoa(int(n)) + ")"
   195  	}
   196  	for i := uint8(0); i <= 8; i++ {
   197  		val := uint8(x)
   198  		if val&(1<<i) != 0 {
   199  			if s != "" {
   200  				s += "|"
   201  			}
   202  			s += str(1 << i)
   203  		}
   204  	}
   205  	if s == "" {
   206  		return str(uint8(x))
   207  	}
   208  	return s
   209  }
   210  
   211  // CnatEndpoint defines type 'cnat_endpoint'.
   212  type CnatEndpoint struct {
   213  	Addr      ip_types.Address               `binapi:"address,name=addr" json:"addr,omitempty"`
   214  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   215  	IfAf      ip_types.AddressFamily         `binapi:"address_family,name=if_af" json:"if_af,omitempty"`
   216  	Port      uint16                         `binapi:"u16,name=port" json:"port,omitempty"`
   217  }
   218  
   219  // CnatEndpointTuple defines type 'cnat_endpoint_tuple'.
   220  type CnatEndpointTuple struct {
   221  	DstEp CnatEndpoint `binapi:"cnat_endpoint,name=dst_ep" json:"dst_ep,omitempty"`
   222  	SrcEp CnatEndpoint `binapi:"cnat_endpoint,name=src_ep" json:"src_ep,omitempty"`
   223  	Flags uint8        `binapi:"u8,name=flags" json:"flags,omitempty"`
   224  }
   225  
   226  // CnatSession defines type 'cnat_session'.
   227  type CnatSession struct {
   228  	Src       CnatEndpoint     `binapi:"cnat_endpoint,name=src" json:"src,omitempty"`
   229  	Dst       CnatEndpoint     `binapi:"cnat_endpoint,name=dst" json:"dst,omitempty"`
   230  	New       CnatEndpoint     `binapi:"cnat_endpoint,name=new" json:"new,omitempty"`
   231  	IPProto   ip_types.IPProto `binapi:"ip_proto,name=ip_proto" json:"ip_proto,omitempty"`
   232  	Location  uint8            `binapi:"u8,name=location" json:"location,omitempty"`
   233  	Timestamp float64          `binapi:"f64,name=timestamp" json:"timestamp,omitempty"`
   234  }
   235  
   236  // CnatTranslation defines type 'cnat_translation'.
   237  type CnatTranslation struct {
   238  	Vip      CnatEndpoint        `binapi:"cnat_endpoint,name=vip" json:"vip,omitempty"`
   239  	ID       uint32              `binapi:"u32,name=id" json:"id,omitempty"`
   240  	IPProto  ip_types.IPProto    `binapi:"ip_proto,name=ip_proto" json:"ip_proto,omitempty"`
   241  	IsRealIP uint8               `binapi:"u8,name=is_real_ip" json:"is_real_ip,omitempty"`
   242  	Flags    uint8               `binapi:"u8,name=flags" json:"flags,omitempty"`
   243  	LbType   CnatLbType          `binapi:"cnat_lb_type,name=lb_type" json:"lb_type,omitempty"`
   244  	NPaths   uint32              `binapi:"u32,name=n_paths" json:"-"`
   245  	Paths    []CnatEndpointTuple `binapi:"cnat_endpoint_tuple[n_paths],name=paths" json:"paths,omitempty"`
   246  }
   247  
   248  // CnatGetSnatAddresses defines message 'cnat_get_snat_addresses'.
   249  // InProgress: the message form may change in the future versions
   250  type CnatGetSnatAddresses struct{}
   251  
   252  func (m *CnatGetSnatAddresses) Reset()               { *m = CnatGetSnatAddresses{} }
   253  func (*CnatGetSnatAddresses) GetMessageName() string { return "cnat_get_snat_addresses" }
   254  func (*CnatGetSnatAddresses) GetCrcString() string   { return "51077d14" }
   255  func (*CnatGetSnatAddresses) GetMessageType() api.MessageType {
   256  	return api.RequestMessage
   257  }
   258  
   259  func (m *CnatGetSnatAddresses) Size() (size int) {
   260  	if m == nil {
   261  		return 0
   262  	}
   263  	return size
   264  }
   265  func (m *CnatGetSnatAddresses) Marshal(b []byte) ([]byte, error) {
   266  	if b == nil {
   267  		b = make([]byte, m.Size())
   268  	}
   269  	buf := codec.NewBuffer(b)
   270  	return buf.Bytes(), nil
   271  }
   272  func (m *CnatGetSnatAddresses) Unmarshal(b []byte) error {
   273  	return nil
   274  }
   275  
   276  // CnatGetSnatAddressesReply defines message 'cnat_get_snat_addresses_reply'.
   277  // InProgress: the message form may change in the future versions
   278  type CnatGetSnatAddressesReply struct {
   279  	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
   280  	ID        uint32                         `binapi:"u32,name=id" json:"id,omitempty"`
   281  	SnatIP4   ip_types.IP4Address            `binapi:"ip4_address,name=snat_ip4" json:"snat_ip4,omitempty"`
   282  	SnatIP6   ip_types.IP6Address            `binapi:"ip6_address,name=snat_ip6" json:"snat_ip6,omitempty"`
   283  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   284  }
   285  
   286  func (m *CnatGetSnatAddressesReply) Reset()               { *m = CnatGetSnatAddressesReply{} }
   287  func (*CnatGetSnatAddressesReply) GetMessageName() string { return "cnat_get_snat_addresses_reply" }
   288  func (*CnatGetSnatAddressesReply) GetCrcString() string   { return "879513c1" }
   289  func (*CnatGetSnatAddressesReply) GetMessageType() api.MessageType {
   290  	return api.ReplyMessage
   291  }
   292  
   293  func (m *CnatGetSnatAddressesReply) Size() (size int) {
   294  	if m == nil {
   295  		return 0
   296  	}
   297  	size += 4      // m.Retval
   298  	size += 4      // m.ID
   299  	size += 1 * 4  // m.SnatIP4
   300  	size += 1 * 16 // m.SnatIP6
   301  	size += 4      // m.SwIfIndex
   302  	return size
   303  }
   304  func (m *CnatGetSnatAddressesReply) Marshal(b []byte) ([]byte, error) {
   305  	if b == nil {
   306  		b = make([]byte, m.Size())
   307  	}
   308  	buf := codec.NewBuffer(b)
   309  	buf.EncodeInt32(m.Retval)
   310  	buf.EncodeUint32(m.ID)
   311  	buf.EncodeBytes(m.SnatIP4[:], 4)
   312  	buf.EncodeBytes(m.SnatIP6[:], 16)
   313  	buf.EncodeUint32(uint32(m.SwIfIndex))
   314  	return buf.Bytes(), nil
   315  }
   316  func (m *CnatGetSnatAddressesReply) Unmarshal(b []byte) error {
   317  	buf := codec.NewBuffer(b)
   318  	m.Retval = buf.DecodeInt32()
   319  	m.ID = buf.DecodeUint32()
   320  	copy(m.SnatIP4[:], buf.DecodeBytes(4))
   321  	copy(m.SnatIP6[:], buf.DecodeBytes(16))
   322  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   323  	return nil
   324  }
   325  
   326  // CnatSessionDetails defines message 'cnat_session_details'.
   327  // InProgress: the message form may change in the future versions
   328  type CnatSessionDetails struct {
   329  	Session CnatSession `binapi:"cnat_session,name=session" json:"session,omitempty"`
   330  }
   331  
   332  func (m *CnatSessionDetails) Reset()               { *m = CnatSessionDetails{} }
   333  func (*CnatSessionDetails) GetMessageName() string { return "cnat_session_details" }
   334  func (*CnatSessionDetails) GetCrcString() string   { return "7e5017c7" }
   335  func (*CnatSessionDetails) GetMessageType() api.MessageType {
   336  	return api.ReplyMessage
   337  }
   338  
   339  func (m *CnatSessionDetails) Size() (size int) {
   340  	if m == nil {
   341  		return 0
   342  	}
   343  	size += 1      // m.Session.Src.Addr.Af
   344  	size += 1 * 16 // m.Session.Src.Addr.Un
   345  	size += 4      // m.Session.Src.SwIfIndex
   346  	size += 1      // m.Session.Src.IfAf
   347  	size += 2      // m.Session.Src.Port
   348  	size += 1      // m.Session.Dst.Addr.Af
   349  	size += 1 * 16 // m.Session.Dst.Addr.Un
   350  	size += 4      // m.Session.Dst.SwIfIndex
   351  	size += 1      // m.Session.Dst.IfAf
   352  	size += 2      // m.Session.Dst.Port
   353  	size += 1      // m.Session.New.Addr.Af
   354  	size += 1 * 16 // m.Session.New.Addr.Un
   355  	size += 4      // m.Session.New.SwIfIndex
   356  	size += 1      // m.Session.New.IfAf
   357  	size += 2      // m.Session.New.Port
   358  	size += 1      // m.Session.IPProto
   359  	size += 1      // m.Session.Location
   360  	size += 8      // m.Session.Timestamp
   361  	return size
   362  }
   363  func (m *CnatSessionDetails) Marshal(b []byte) ([]byte, error) {
   364  	if b == nil {
   365  		b = make([]byte, m.Size())
   366  	}
   367  	buf := codec.NewBuffer(b)
   368  	buf.EncodeUint8(uint8(m.Session.Src.Addr.Af))
   369  	buf.EncodeBytes(m.Session.Src.Addr.Un.XXX_UnionData[:], 16)
   370  	buf.EncodeUint32(uint32(m.Session.Src.SwIfIndex))
   371  	buf.EncodeUint8(uint8(m.Session.Src.IfAf))
   372  	buf.EncodeUint16(m.Session.Src.Port)
   373  	buf.EncodeUint8(uint8(m.Session.Dst.Addr.Af))
   374  	buf.EncodeBytes(m.Session.Dst.Addr.Un.XXX_UnionData[:], 16)
   375  	buf.EncodeUint32(uint32(m.Session.Dst.SwIfIndex))
   376  	buf.EncodeUint8(uint8(m.Session.Dst.IfAf))
   377  	buf.EncodeUint16(m.Session.Dst.Port)
   378  	buf.EncodeUint8(uint8(m.Session.New.Addr.Af))
   379  	buf.EncodeBytes(m.Session.New.Addr.Un.XXX_UnionData[:], 16)
   380  	buf.EncodeUint32(uint32(m.Session.New.SwIfIndex))
   381  	buf.EncodeUint8(uint8(m.Session.New.IfAf))
   382  	buf.EncodeUint16(m.Session.New.Port)
   383  	buf.EncodeUint8(uint8(m.Session.IPProto))
   384  	buf.EncodeUint8(m.Session.Location)
   385  	buf.EncodeFloat64(m.Session.Timestamp)
   386  	return buf.Bytes(), nil
   387  }
   388  func (m *CnatSessionDetails) Unmarshal(b []byte) error {
   389  	buf := codec.NewBuffer(b)
   390  	m.Session.Src.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8())
   391  	copy(m.Session.Src.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   392  	m.Session.Src.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   393  	m.Session.Src.IfAf = ip_types.AddressFamily(buf.DecodeUint8())
   394  	m.Session.Src.Port = buf.DecodeUint16()
   395  	m.Session.Dst.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8())
   396  	copy(m.Session.Dst.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   397  	m.Session.Dst.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   398  	m.Session.Dst.IfAf = ip_types.AddressFamily(buf.DecodeUint8())
   399  	m.Session.Dst.Port = buf.DecodeUint16()
   400  	m.Session.New.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8())
   401  	copy(m.Session.New.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   402  	m.Session.New.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   403  	m.Session.New.IfAf = ip_types.AddressFamily(buf.DecodeUint8())
   404  	m.Session.New.Port = buf.DecodeUint16()
   405  	m.Session.IPProto = ip_types.IPProto(buf.DecodeUint8())
   406  	m.Session.Location = buf.DecodeUint8()
   407  	m.Session.Timestamp = buf.DecodeFloat64()
   408  	return nil
   409  }
   410  
   411  // CnatSessionDump defines message 'cnat_session_dump'.
   412  // InProgress: the message form may change in the future versions
   413  type CnatSessionDump struct{}
   414  
   415  func (m *CnatSessionDump) Reset()               { *m = CnatSessionDump{} }
   416  func (*CnatSessionDump) GetMessageName() string { return "cnat_session_dump" }
   417  func (*CnatSessionDump) GetCrcString() string   { return "51077d14" }
   418  func (*CnatSessionDump) GetMessageType() api.MessageType {
   419  	return api.RequestMessage
   420  }
   421  
   422  func (m *CnatSessionDump) Size() (size int) {
   423  	if m == nil {
   424  		return 0
   425  	}
   426  	return size
   427  }
   428  func (m *CnatSessionDump) Marshal(b []byte) ([]byte, error) {
   429  	if b == nil {
   430  		b = make([]byte, m.Size())
   431  	}
   432  	buf := codec.NewBuffer(b)
   433  	return buf.Bytes(), nil
   434  }
   435  func (m *CnatSessionDump) Unmarshal(b []byte) error {
   436  	return nil
   437  }
   438  
   439  // CnatSessionPurge defines message 'cnat_session_purge'.
   440  // InProgress: the message form may change in the future versions
   441  type CnatSessionPurge struct{}
   442  
   443  func (m *CnatSessionPurge) Reset()               { *m = CnatSessionPurge{} }
   444  func (*CnatSessionPurge) GetMessageName() string { return "cnat_session_purge" }
   445  func (*CnatSessionPurge) GetCrcString() string   { return "51077d14" }
   446  func (*CnatSessionPurge) GetMessageType() api.MessageType {
   447  	return api.RequestMessage
   448  }
   449  
   450  func (m *CnatSessionPurge) Size() (size int) {
   451  	if m == nil {
   452  		return 0
   453  	}
   454  	return size
   455  }
   456  func (m *CnatSessionPurge) Marshal(b []byte) ([]byte, error) {
   457  	if b == nil {
   458  		b = make([]byte, m.Size())
   459  	}
   460  	buf := codec.NewBuffer(b)
   461  	return buf.Bytes(), nil
   462  }
   463  func (m *CnatSessionPurge) Unmarshal(b []byte) error {
   464  	return nil
   465  }
   466  
   467  // CnatSessionPurgeReply defines message 'cnat_session_purge_reply'.
   468  // InProgress: the message form may change in the future versions
   469  type CnatSessionPurgeReply struct {
   470  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   471  }
   472  
   473  func (m *CnatSessionPurgeReply) Reset()               { *m = CnatSessionPurgeReply{} }
   474  func (*CnatSessionPurgeReply) GetMessageName() string { return "cnat_session_purge_reply" }
   475  func (*CnatSessionPurgeReply) GetCrcString() string   { return "e8d4e804" }
   476  func (*CnatSessionPurgeReply) GetMessageType() api.MessageType {
   477  	return api.ReplyMessage
   478  }
   479  
   480  func (m *CnatSessionPurgeReply) Size() (size int) {
   481  	if m == nil {
   482  		return 0
   483  	}
   484  	size += 4 // m.Retval
   485  	return size
   486  }
   487  func (m *CnatSessionPurgeReply) Marshal(b []byte) ([]byte, error) {
   488  	if b == nil {
   489  		b = make([]byte, m.Size())
   490  	}
   491  	buf := codec.NewBuffer(b)
   492  	buf.EncodeInt32(m.Retval)
   493  	return buf.Bytes(), nil
   494  }
   495  func (m *CnatSessionPurgeReply) Unmarshal(b []byte) error {
   496  	buf := codec.NewBuffer(b)
   497  	m.Retval = buf.DecodeInt32()
   498  	return nil
   499  }
   500  
   501  // CnatSetSnatAddresses defines message 'cnat_set_snat_addresses'.
   502  // InProgress: the message form may change in the future versions
   503  type CnatSetSnatAddresses struct {
   504  	SnatIP4   ip_types.IP4Address            `binapi:"ip4_address,name=snat_ip4" json:"snat_ip4,omitempty"`
   505  	SnatIP6   ip_types.IP6Address            `binapi:"ip6_address,name=snat_ip6" json:"snat_ip6,omitempty"`
   506  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   507  }
   508  
   509  func (m *CnatSetSnatAddresses) Reset()               { *m = CnatSetSnatAddresses{} }
   510  func (*CnatSetSnatAddresses) GetMessageName() string { return "cnat_set_snat_addresses" }
   511  func (*CnatSetSnatAddresses) GetCrcString() string   { return "d997e96c" }
   512  func (*CnatSetSnatAddresses) GetMessageType() api.MessageType {
   513  	return api.RequestMessage
   514  }
   515  
   516  func (m *CnatSetSnatAddresses) Size() (size int) {
   517  	if m == nil {
   518  		return 0
   519  	}
   520  	size += 1 * 4  // m.SnatIP4
   521  	size += 1 * 16 // m.SnatIP6
   522  	size += 4      // m.SwIfIndex
   523  	return size
   524  }
   525  func (m *CnatSetSnatAddresses) Marshal(b []byte) ([]byte, error) {
   526  	if b == nil {
   527  		b = make([]byte, m.Size())
   528  	}
   529  	buf := codec.NewBuffer(b)
   530  	buf.EncodeBytes(m.SnatIP4[:], 4)
   531  	buf.EncodeBytes(m.SnatIP6[:], 16)
   532  	buf.EncodeUint32(uint32(m.SwIfIndex))
   533  	return buf.Bytes(), nil
   534  }
   535  func (m *CnatSetSnatAddresses) Unmarshal(b []byte) error {
   536  	buf := codec.NewBuffer(b)
   537  	copy(m.SnatIP4[:], buf.DecodeBytes(4))
   538  	copy(m.SnatIP6[:], buf.DecodeBytes(16))
   539  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   540  	return nil
   541  }
   542  
   543  // CnatSetSnatAddressesReply defines message 'cnat_set_snat_addresses_reply'.
   544  // InProgress: the message form may change in the future versions
   545  type CnatSetSnatAddressesReply struct {
   546  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   547  }
   548  
   549  func (m *CnatSetSnatAddressesReply) Reset()               { *m = CnatSetSnatAddressesReply{} }
   550  func (*CnatSetSnatAddressesReply) GetMessageName() string { return "cnat_set_snat_addresses_reply" }
   551  func (*CnatSetSnatAddressesReply) GetCrcString() string   { return "e8d4e804" }
   552  func (*CnatSetSnatAddressesReply) GetMessageType() api.MessageType {
   553  	return api.ReplyMessage
   554  }
   555  
   556  func (m *CnatSetSnatAddressesReply) Size() (size int) {
   557  	if m == nil {
   558  		return 0
   559  	}
   560  	size += 4 // m.Retval
   561  	return size
   562  }
   563  func (m *CnatSetSnatAddressesReply) Marshal(b []byte) ([]byte, error) {
   564  	if b == nil {
   565  		b = make([]byte, m.Size())
   566  	}
   567  	buf := codec.NewBuffer(b)
   568  	buf.EncodeInt32(m.Retval)
   569  	return buf.Bytes(), nil
   570  }
   571  func (m *CnatSetSnatAddressesReply) Unmarshal(b []byte) error {
   572  	buf := codec.NewBuffer(b)
   573  	m.Retval = buf.DecodeInt32()
   574  	return nil
   575  }
   576  
   577  // CnatSetSnatPolicy defines message 'cnat_set_snat_policy'.
   578  // InProgress: the message form may change in the future versions
   579  type CnatSetSnatPolicy struct {
   580  	Policy CnatSnatPolicies `binapi:"cnat_snat_policies,name=policy" json:"policy,omitempty"`
   581  }
   582  
   583  func (m *CnatSetSnatPolicy) Reset()               { *m = CnatSetSnatPolicy{} }
   584  func (*CnatSetSnatPolicy) GetMessageName() string { return "cnat_set_snat_policy" }
   585  func (*CnatSetSnatPolicy) GetCrcString() string   { return "d3e6eaf4" }
   586  func (*CnatSetSnatPolicy) GetMessageType() api.MessageType {
   587  	return api.RequestMessage
   588  }
   589  
   590  func (m *CnatSetSnatPolicy) Size() (size int) {
   591  	if m == nil {
   592  		return 0
   593  	}
   594  	size += 1 // m.Policy
   595  	return size
   596  }
   597  func (m *CnatSetSnatPolicy) Marshal(b []byte) ([]byte, error) {
   598  	if b == nil {
   599  		b = make([]byte, m.Size())
   600  	}
   601  	buf := codec.NewBuffer(b)
   602  	buf.EncodeUint8(uint8(m.Policy))
   603  	return buf.Bytes(), nil
   604  }
   605  func (m *CnatSetSnatPolicy) Unmarshal(b []byte) error {
   606  	buf := codec.NewBuffer(b)
   607  	m.Policy = CnatSnatPolicies(buf.DecodeUint8())
   608  	return nil
   609  }
   610  
   611  // CnatSetSnatPolicyReply defines message 'cnat_set_snat_policy_reply'.
   612  // InProgress: the message form may change in the future versions
   613  type CnatSetSnatPolicyReply struct {
   614  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   615  }
   616  
   617  func (m *CnatSetSnatPolicyReply) Reset()               { *m = CnatSetSnatPolicyReply{} }
   618  func (*CnatSetSnatPolicyReply) GetMessageName() string { return "cnat_set_snat_policy_reply" }
   619  func (*CnatSetSnatPolicyReply) GetCrcString() string   { return "e8d4e804" }
   620  func (*CnatSetSnatPolicyReply) GetMessageType() api.MessageType {
   621  	return api.ReplyMessage
   622  }
   623  
   624  func (m *CnatSetSnatPolicyReply) Size() (size int) {
   625  	if m == nil {
   626  		return 0
   627  	}
   628  	size += 4 // m.Retval
   629  	return size
   630  }
   631  func (m *CnatSetSnatPolicyReply) Marshal(b []byte) ([]byte, error) {
   632  	if b == nil {
   633  		b = make([]byte, m.Size())
   634  	}
   635  	buf := codec.NewBuffer(b)
   636  	buf.EncodeInt32(m.Retval)
   637  	return buf.Bytes(), nil
   638  }
   639  func (m *CnatSetSnatPolicyReply) Unmarshal(b []byte) error {
   640  	buf := codec.NewBuffer(b)
   641  	m.Retval = buf.DecodeInt32()
   642  	return nil
   643  }
   644  
   645  // CnatSnatPolicyAddDelExcludePfx defines message 'cnat_snat_policy_add_del_exclude_pfx'.
   646  // InProgress: the message form may change in the future versions
   647  type CnatSnatPolicyAddDelExcludePfx struct {
   648  	IsAdd  uint8           `binapi:"u8,name=is_add" json:"is_add,omitempty"`
   649  	Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"`
   650  }
   651  
   652  func (m *CnatSnatPolicyAddDelExcludePfx) Reset() { *m = CnatSnatPolicyAddDelExcludePfx{} }
   653  func (*CnatSnatPolicyAddDelExcludePfx) GetMessageName() string {
   654  	return "cnat_snat_policy_add_del_exclude_pfx"
   655  }
   656  func (*CnatSnatPolicyAddDelExcludePfx) GetCrcString() string { return "e26dd79a" }
   657  func (*CnatSnatPolicyAddDelExcludePfx) GetMessageType() api.MessageType {
   658  	return api.RequestMessage
   659  }
   660  
   661  func (m *CnatSnatPolicyAddDelExcludePfx) Size() (size int) {
   662  	if m == nil {
   663  		return 0
   664  	}
   665  	size += 1      // m.IsAdd
   666  	size += 1      // m.Prefix.Address.Af
   667  	size += 1 * 16 // m.Prefix.Address.Un
   668  	size += 1      // m.Prefix.Len
   669  	return size
   670  }
   671  func (m *CnatSnatPolicyAddDelExcludePfx) Marshal(b []byte) ([]byte, error) {
   672  	if b == nil {
   673  		b = make([]byte, m.Size())
   674  	}
   675  	buf := codec.NewBuffer(b)
   676  	buf.EncodeUint8(m.IsAdd)
   677  	buf.EncodeUint8(uint8(m.Prefix.Address.Af))
   678  	buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
   679  	buf.EncodeUint8(m.Prefix.Len)
   680  	return buf.Bytes(), nil
   681  }
   682  func (m *CnatSnatPolicyAddDelExcludePfx) Unmarshal(b []byte) error {
   683  	buf := codec.NewBuffer(b)
   684  	m.IsAdd = buf.DecodeUint8()
   685  	m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
   686  	copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   687  	m.Prefix.Len = buf.DecodeUint8()
   688  	return nil
   689  }
   690  
   691  // CnatSnatPolicyAddDelExcludePfxReply defines message 'cnat_snat_policy_add_del_exclude_pfx_reply'.
   692  // InProgress: the message form may change in the future versions
   693  type CnatSnatPolicyAddDelExcludePfxReply struct {
   694  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   695  }
   696  
   697  func (m *CnatSnatPolicyAddDelExcludePfxReply) Reset() { *m = CnatSnatPolicyAddDelExcludePfxReply{} }
   698  func (*CnatSnatPolicyAddDelExcludePfxReply) GetMessageName() string {
   699  	return "cnat_snat_policy_add_del_exclude_pfx_reply"
   700  }
   701  func (*CnatSnatPolicyAddDelExcludePfxReply) GetCrcString() string { return "e8d4e804" }
   702  func (*CnatSnatPolicyAddDelExcludePfxReply) GetMessageType() api.MessageType {
   703  	return api.ReplyMessage
   704  }
   705  
   706  func (m *CnatSnatPolicyAddDelExcludePfxReply) Size() (size int) {
   707  	if m == nil {
   708  		return 0
   709  	}
   710  	size += 4 // m.Retval
   711  	return size
   712  }
   713  func (m *CnatSnatPolicyAddDelExcludePfxReply) Marshal(b []byte) ([]byte, error) {
   714  	if b == nil {
   715  		b = make([]byte, m.Size())
   716  	}
   717  	buf := codec.NewBuffer(b)
   718  	buf.EncodeInt32(m.Retval)
   719  	return buf.Bytes(), nil
   720  }
   721  func (m *CnatSnatPolicyAddDelExcludePfxReply) Unmarshal(b []byte) error {
   722  	buf := codec.NewBuffer(b)
   723  	m.Retval = buf.DecodeInt32()
   724  	return nil
   725  }
   726  
   727  // CnatSnatPolicyAddDelIf defines message 'cnat_snat_policy_add_del_if'.
   728  // InProgress: the message form may change in the future versions
   729  type CnatSnatPolicyAddDelIf struct {
   730  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   731  	IsAdd     uint8                          `binapi:"u8,name=is_add" json:"is_add,omitempty"`
   732  	Table     CnatSnatPolicyTable            `binapi:"cnat_snat_policy_table,name=table" json:"table,omitempty"`
   733  }
   734  
   735  func (m *CnatSnatPolicyAddDelIf) Reset()               { *m = CnatSnatPolicyAddDelIf{} }
   736  func (*CnatSnatPolicyAddDelIf) GetMessageName() string { return "cnat_snat_policy_add_del_if" }
   737  func (*CnatSnatPolicyAddDelIf) GetCrcString() string   { return "6828deca" }
   738  func (*CnatSnatPolicyAddDelIf) GetMessageType() api.MessageType {
   739  	return api.RequestMessage
   740  }
   741  
   742  func (m *CnatSnatPolicyAddDelIf) Size() (size int) {
   743  	if m == nil {
   744  		return 0
   745  	}
   746  	size += 4 // m.SwIfIndex
   747  	size += 1 // m.IsAdd
   748  	size += 1 // m.Table
   749  	return size
   750  }
   751  func (m *CnatSnatPolicyAddDelIf) Marshal(b []byte) ([]byte, error) {
   752  	if b == nil {
   753  		b = make([]byte, m.Size())
   754  	}
   755  	buf := codec.NewBuffer(b)
   756  	buf.EncodeUint32(uint32(m.SwIfIndex))
   757  	buf.EncodeUint8(m.IsAdd)
   758  	buf.EncodeUint8(uint8(m.Table))
   759  	return buf.Bytes(), nil
   760  }
   761  func (m *CnatSnatPolicyAddDelIf) Unmarshal(b []byte) error {
   762  	buf := codec.NewBuffer(b)
   763  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   764  	m.IsAdd = buf.DecodeUint8()
   765  	m.Table = CnatSnatPolicyTable(buf.DecodeUint8())
   766  	return nil
   767  }
   768  
   769  // CnatSnatPolicyAddDelIfReply defines message 'cnat_snat_policy_add_del_if_reply'.
   770  // InProgress: the message form may change in the future versions
   771  type CnatSnatPolicyAddDelIfReply struct {
   772  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   773  }
   774  
   775  func (m *CnatSnatPolicyAddDelIfReply) Reset() { *m = CnatSnatPolicyAddDelIfReply{} }
   776  func (*CnatSnatPolicyAddDelIfReply) GetMessageName() string {
   777  	return "cnat_snat_policy_add_del_if_reply"
   778  }
   779  func (*CnatSnatPolicyAddDelIfReply) GetCrcString() string { return "e8d4e804" }
   780  func (*CnatSnatPolicyAddDelIfReply) GetMessageType() api.MessageType {
   781  	return api.ReplyMessage
   782  }
   783  
   784  func (m *CnatSnatPolicyAddDelIfReply) Size() (size int) {
   785  	if m == nil {
   786  		return 0
   787  	}
   788  	size += 4 // m.Retval
   789  	return size
   790  }
   791  func (m *CnatSnatPolicyAddDelIfReply) Marshal(b []byte) ([]byte, error) {
   792  	if b == nil {
   793  		b = make([]byte, m.Size())
   794  	}
   795  	buf := codec.NewBuffer(b)
   796  	buf.EncodeInt32(m.Retval)
   797  	return buf.Bytes(), nil
   798  }
   799  func (m *CnatSnatPolicyAddDelIfReply) Unmarshal(b []byte) error {
   800  	buf := codec.NewBuffer(b)
   801  	m.Retval = buf.DecodeInt32()
   802  	return nil
   803  }
   804  
   805  // CnatTranslationDel defines message 'cnat_translation_del'.
   806  // InProgress: the message form may change in the future versions
   807  type CnatTranslationDel struct {
   808  	ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
   809  }
   810  
   811  func (m *CnatTranslationDel) Reset()               { *m = CnatTranslationDel{} }
   812  func (*CnatTranslationDel) GetMessageName() string { return "cnat_translation_del" }
   813  func (*CnatTranslationDel) GetCrcString() string   { return "3a91bde5" }
   814  func (*CnatTranslationDel) GetMessageType() api.MessageType {
   815  	return api.RequestMessage
   816  }
   817  
   818  func (m *CnatTranslationDel) Size() (size int) {
   819  	if m == nil {
   820  		return 0
   821  	}
   822  	size += 4 // m.ID
   823  	return size
   824  }
   825  func (m *CnatTranslationDel) Marshal(b []byte) ([]byte, error) {
   826  	if b == nil {
   827  		b = make([]byte, m.Size())
   828  	}
   829  	buf := codec.NewBuffer(b)
   830  	buf.EncodeUint32(m.ID)
   831  	return buf.Bytes(), nil
   832  }
   833  func (m *CnatTranslationDel) Unmarshal(b []byte) error {
   834  	buf := codec.NewBuffer(b)
   835  	m.ID = buf.DecodeUint32()
   836  	return nil
   837  }
   838  
   839  // CnatTranslationDelReply defines message 'cnat_translation_del_reply'.
   840  // InProgress: the message form may change in the future versions
   841  type CnatTranslationDelReply struct {
   842  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   843  }
   844  
   845  func (m *CnatTranslationDelReply) Reset()               { *m = CnatTranslationDelReply{} }
   846  func (*CnatTranslationDelReply) GetMessageName() string { return "cnat_translation_del_reply" }
   847  func (*CnatTranslationDelReply) GetCrcString() string   { return "e8d4e804" }
   848  func (*CnatTranslationDelReply) GetMessageType() api.MessageType {
   849  	return api.ReplyMessage
   850  }
   851  
   852  func (m *CnatTranslationDelReply) Size() (size int) {
   853  	if m == nil {
   854  		return 0
   855  	}
   856  	size += 4 // m.Retval
   857  	return size
   858  }
   859  func (m *CnatTranslationDelReply) Marshal(b []byte) ([]byte, error) {
   860  	if b == nil {
   861  		b = make([]byte, m.Size())
   862  	}
   863  	buf := codec.NewBuffer(b)
   864  	buf.EncodeInt32(m.Retval)
   865  	return buf.Bytes(), nil
   866  }
   867  func (m *CnatTranslationDelReply) Unmarshal(b []byte) error {
   868  	buf := codec.NewBuffer(b)
   869  	m.Retval = buf.DecodeInt32()
   870  	return nil
   871  }
   872  
   873  // CnatTranslationDetails defines message 'cnat_translation_details'.
   874  // InProgress: the message form may change in the future versions
   875  type CnatTranslationDetails struct {
   876  	Translation CnatTranslation `binapi:"cnat_translation,name=translation" json:"translation,omitempty"`
   877  }
   878  
   879  func (m *CnatTranslationDetails) Reset()               { *m = CnatTranslationDetails{} }
   880  func (*CnatTranslationDetails) GetMessageName() string { return "cnat_translation_details" }
   881  func (*CnatTranslationDetails) GetCrcString() string   { return "347e1f16" }
   882  func (*CnatTranslationDetails) GetMessageType() api.MessageType {
   883  	return api.ReplyMessage
   884  }
   885  
   886  func (m *CnatTranslationDetails) Size() (size int) {
   887  	if m == nil {
   888  		return 0
   889  	}
   890  	size += 1      // m.Translation.Vip.Addr.Af
   891  	size += 1 * 16 // m.Translation.Vip.Addr.Un
   892  	size += 4      // m.Translation.Vip.SwIfIndex
   893  	size += 1      // m.Translation.Vip.IfAf
   894  	size += 2      // m.Translation.Vip.Port
   895  	size += 4      // m.Translation.ID
   896  	size += 1      // m.Translation.IPProto
   897  	size += 1      // m.Translation.IsRealIP
   898  	size += 1      // m.Translation.Flags
   899  	size += 1      // m.Translation.LbType
   900  	size += 4      // m.Translation.NPaths
   901  	for j2 := 0; j2 < len(m.Translation.Paths); j2++ {
   902  		var s2 CnatEndpointTuple
   903  		_ = s2
   904  		if j2 < len(m.Translation.Paths) {
   905  			s2 = m.Translation.Paths[j2]
   906  		}
   907  		size += 1      // s2.DstEp.Addr.Af
   908  		size += 1 * 16 // s2.DstEp.Addr.Un
   909  		size += 4      // s2.DstEp.SwIfIndex
   910  		size += 1      // s2.DstEp.IfAf
   911  		size += 2      // s2.DstEp.Port
   912  		size += 1      // s2.SrcEp.Addr.Af
   913  		size += 1 * 16 // s2.SrcEp.Addr.Un
   914  		size += 4      // s2.SrcEp.SwIfIndex
   915  		size += 1      // s2.SrcEp.IfAf
   916  		size += 2      // s2.SrcEp.Port
   917  		size += 1      // s2.Flags
   918  	}
   919  	return size
   920  }
   921  func (m *CnatTranslationDetails) Marshal(b []byte) ([]byte, error) {
   922  	if b == nil {
   923  		b = make([]byte, m.Size())
   924  	}
   925  	buf := codec.NewBuffer(b)
   926  	buf.EncodeUint8(uint8(m.Translation.Vip.Addr.Af))
   927  	buf.EncodeBytes(m.Translation.Vip.Addr.Un.XXX_UnionData[:], 16)
   928  	buf.EncodeUint32(uint32(m.Translation.Vip.SwIfIndex))
   929  	buf.EncodeUint8(uint8(m.Translation.Vip.IfAf))
   930  	buf.EncodeUint16(m.Translation.Vip.Port)
   931  	buf.EncodeUint32(m.Translation.ID)
   932  	buf.EncodeUint8(uint8(m.Translation.IPProto))
   933  	buf.EncodeUint8(m.Translation.IsRealIP)
   934  	buf.EncodeUint8(m.Translation.Flags)
   935  	buf.EncodeUint8(uint8(m.Translation.LbType))
   936  	buf.EncodeUint32(uint32(len(m.Translation.Paths)))
   937  	for j1 := 0; j1 < len(m.Translation.Paths); j1++ {
   938  		var v1 CnatEndpointTuple // Paths
   939  		if j1 < len(m.Translation.Paths) {
   940  			v1 = m.Translation.Paths[j1]
   941  		}
   942  		buf.EncodeUint8(uint8(v1.DstEp.Addr.Af))
   943  		buf.EncodeBytes(v1.DstEp.Addr.Un.XXX_UnionData[:], 16)
   944  		buf.EncodeUint32(uint32(v1.DstEp.SwIfIndex))
   945  		buf.EncodeUint8(uint8(v1.DstEp.IfAf))
   946  		buf.EncodeUint16(v1.DstEp.Port)
   947  		buf.EncodeUint8(uint8(v1.SrcEp.Addr.Af))
   948  		buf.EncodeBytes(v1.SrcEp.Addr.Un.XXX_UnionData[:], 16)
   949  		buf.EncodeUint32(uint32(v1.SrcEp.SwIfIndex))
   950  		buf.EncodeUint8(uint8(v1.SrcEp.IfAf))
   951  		buf.EncodeUint16(v1.SrcEp.Port)
   952  		buf.EncodeUint8(v1.Flags)
   953  	}
   954  	return buf.Bytes(), nil
   955  }
   956  func (m *CnatTranslationDetails) Unmarshal(b []byte) error {
   957  	buf := codec.NewBuffer(b)
   958  	m.Translation.Vip.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8())
   959  	copy(m.Translation.Vip.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   960  	m.Translation.Vip.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   961  	m.Translation.Vip.IfAf = ip_types.AddressFamily(buf.DecodeUint8())
   962  	m.Translation.Vip.Port = buf.DecodeUint16()
   963  	m.Translation.ID = buf.DecodeUint32()
   964  	m.Translation.IPProto = ip_types.IPProto(buf.DecodeUint8())
   965  	m.Translation.IsRealIP = buf.DecodeUint8()
   966  	m.Translation.Flags = buf.DecodeUint8()
   967  	m.Translation.LbType = CnatLbType(buf.DecodeUint8())
   968  	m.Translation.NPaths = buf.DecodeUint32()
   969  	m.Translation.Paths = make([]CnatEndpointTuple, m.Translation.NPaths)
   970  	for j1 := 0; j1 < len(m.Translation.Paths); j1++ {
   971  		m.Translation.Paths[j1].DstEp.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8())
   972  		copy(m.Translation.Paths[j1].DstEp.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   973  		m.Translation.Paths[j1].DstEp.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   974  		m.Translation.Paths[j1].DstEp.IfAf = ip_types.AddressFamily(buf.DecodeUint8())
   975  		m.Translation.Paths[j1].DstEp.Port = buf.DecodeUint16()
   976  		m.Translation.Paths[j1].SrcEp.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8())
   977  		copy(m.Translation.Paths[j1].SrcEp.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   978  		m.Translation.Paths[j1].SrcEp.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   979  		m.Translation.Paths[j1].SrcEp.IfAf = ip_types.AddressFamily(buf.DecodeUint8())
   980  		m.Translation.Paths[j1].SrcEp.Port = buf.DecodeUint16()
   981  		m.Translation.Paths[j1].Flags = buf.DecodeUint8()
   982  	}
   983  	return nil
   984  }
   985  
   986  // CnatTranslationDump defines message 'cnat_translation_dump'.
   987  // InProgress: the message form may change in the future versions
   988  type CnatTranslationDump struct{}
   989  
   990  func (m *CnatTranslationDump) Reset()               { *m = CnatTranslationDump{} }
   991  func (*CnatTranslationDump) GetMessageName() string { return "cnat_translation_dump" }
   992  func (*CnatTranslationDump) GetCrcString() string   { return "51077d14" }
   993  func (*CnatTranslationDump) GetMessageType() api.MessageType {
   994  	return api.RequestMessage
   995  }
   996  
   997  func (m *CnatTranslationDump) Size() (size int) {
   998  	if m == nil {
   999  		return 0
  1000  	}
  1001  	return size
  1002  }
  1003  func (m *CnatTranslationDump) Marshal(b []byte) ([]byte, error) {
  1004  	if b == nil {
  1005  		b = make([]byte, m.Size())
  1006  	}
  1007  	buf := codec.NewBuffer(b)
  1008  	return buf.Bytes(), nil
  1009  }
  1010  func (m *CnatTranslationDump) Unmarshal(b []byte) error {
  1011  	return nil
  1012  }
  1013  
  1014  // CnatTranslationUpdate defines message 'cnat_translation_update'.
  1015  // InProgress: the message form may change in the future versions
  1016  type CnatTranslationUpdate struct {
  1017  	Translation CnatTranslation `binapi:"cnat_translation,name=translation" json:"translation,omitempty"`
  1018  }
  1019  
  1020  func (m *CnatTranslationUpdate) Reset()               { *m = CnatTranslationUpdate{} }
  1021  func (*CnatTranslationUpdate) GetMessageName() string { return "cnat_translation_update" }
  1022  func (*CnatTranslationUpdate) GetCrcString() string   { return "cd5aedf5" }
  1023  func (*CnatTranslationUpdate) GetMessageType() api.MessageType {
  1024  	return api.RequestMessage
  1025  }
  1026  
  1027  func (m *CnatTranslationUpdate) Size() (size int) {
  1028  	if m == nil {
  1029  		return 0
  1030  	}
  1031  	size += 1      // m.Translation.Vip.Addr.Af
  1032  	size += 1 * 16 // m.Translation.Vip.Addr.Un
  1033  	size += 4      // m.Translation.Vip.SwIfIndex
  1034  	size += 1      // m.Translation.Vip.IfAf
  1035  	size += 2      // m.Translation.Vip.Port
  1036  	size += 4      // m.Translation.ID
  1037  	size += 1      // m.Translation.IPProto
  1038  	size += 1      // m.Translation.IsRealIP
  1039  	size += 1      // m.Translation.Flags
  1040  	size += 1      // m.Translation.LbType
  1041  	size += 4      // m.Translation.NPaths
  1042  	for j2 := 0; j2 < len(m.Translation.Paths); j2++ {
  1043  		var s2 CnatEndpointTuple
  1044  		_ = s2
  1045  		if j2 < len(m.Translation.Paths) {
  1046  			s2 = m.Translation.Paths[j2]
  1047  		}
  1048  		size += 1      // s2.DstEp.Addr.Af
  1049  		size += 1 * 16 // s2.DstEp.Addr.Un
  1050  		size += 4      // s2.DstEp.SwIfIndex
  1051  		size += 1      // s2.DstEp.IfAf
  1052  		size += 2      // s2.DstEp.Port
  1053  		size += 1      // s2.SrcEp.Addr.Af
  1054  		size += 1 * 16 // s2.SrcEp.Addr.Un
  1055  		size += 4      // s2.SrcEp.SwIfIndex
  1056  		size += 1      // s2.SrcEp.IfAf
  1057  		size += 2      // s2.SrcEp.Port
  1058  		size += 1      // s2.Flags
  1059  	}
  1060  	return size
  1061  }
  1062  func (m *CnatTranslationUpdate) Marshal(b []byte) ([]byte, error) {
  1063  	if b == nil {
  1064  		b = make([]byte, m.Size())
  1065  	}
  1066  	buf := codec.NewBuffer(b)
  1067  	buf.EncodeUint8(uint8(m.Translation.Vip.Addr.Af))
  1068  	buf.EncodeBytes(m.Translation.Vip.Addr.Un.XXX_UnionData[:], 16)
  1069  	buf.EncodeUint32(uint32(m.Translation.Vip.SwIfIndex))
  1070  	buf.EncodeUint8(uint8(m.Translation.Vip.IfAf))
  1071  	buf.EncodeUint16(m.Translation.Vip.Port)
  1072  	buf.EncodeUint32(m.Translation.ID)
  1073  	buf.EncodeUint8(uint8(m.Translation.IPProto))
  1074  	buf.EncodeUint8(m.Translation.IsRealIP)
  1075  	buf.EncodeUint8(m.Translation.Flags)
  1076  	buf.EncodeUint8(uint8(m.Translation.LbType))
  1077  	buf.EncodeUint32(uint32(len(m.Translation.Paths)))
  1078  	for j1 := 0; j1 < len(m.Translation.Paths); j1++ {
  1079  		var v1 CnatEndpointTuple // Paths
  1080  		if j1 < len(m.Translation.Paths) {
  1081  			v1 = m.Translation.Paths[j1]
  1082  		}
  1083  		buf.EncodeUint8(uint8(v1.DstEp.Addr.Af))
  1084  		buf.EncodeBytes(v1.DstEp.Addr.Un.XXX_UnionData[:], 16)
  1085  		buf.EncodeUint32(uint32(v1.DstEp.SwIfIndex))
  1086  		buf.EncodeUint8(uint8(v1.DstEp.IfAf))
  1087  		buf.EncodeUint16(v1.DstEp.Port)
  1088  		buf.EncodeUint8(uint8(v1.SrcEp.Addr.Af))
  1089  		buf.EncodeBytes(v1.SrcEp.Addr.Un.XXX_UnionData[:], 16)
  1090  		buf.EncodeUint32(uint32(v1.SrcEp.SwIfIndex))
  1091  		buf.EncodeUint8(uint8(v1.SrcEp.IfAf))
  1092  		buf.EncodeUint16(v1.SrcEp.Port)
  1093  		buf.EncodeUint8(v1.Flags)
  1094  	}
  1095  	return buf.Bytes(), nil
  1096  }
  1097  func (m *CnatTranslationUpdate) Unmarshal(b []byte) error {
  1098  	buf := codec.NewBuffer(b)
  1099  	m.Translation.Vip.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8())
  1100  	copy(m.Translation.Vip.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16))
  1101  	m.Translation.Vip.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
  1102  	m.Translation.Vip.IfAf = ip_types.AddressFamily(buf.DecodeUint8())
  1103  	m.Translation.Vip.Port = buf.DecodeUint16()
  1104  	m.Translation.ID = buf.DecodeUint32()
  1105  	m.Translation.IPProto = ip_types.IPProto(buf.DecodeUint8())
  1106  	m.Translation.IsRealIP = buf.DecodeUint8()
  1107  	m.Translation.Flags = buf.DecodeUint8()
  1108  	m.Translation.LbType = CnatLbType(buf.DecodeUint8())
  1109  	m.Translation.NPaths = buf.DecodeUint32()
  1110  	m.Translation.Paths = make([]CnatEndpointTuple, m.Translation.NPaths)
  1111  	for j1 := 0; j1 < len(m.Translation.Paths); j1++ {
  1112  		m.Translation.Paths[j1].DstEp.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8())
  1113  		copy(m.Translation.Paths[j1].DstEp.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16))
  1114  		m.Translation.Paths[j1].DstEp.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
  1115  		m.Translation.Paths[j1].DstEp.IfAf = ip_types.AddressFamily(buf.DecodeUint8())
  1116  		m.Translation.Paths[j1].DstEp.Port = buf.DecodeUint16()
  1117  		m.Translation.Paths[j1].SrcEp.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8())
  1118  		copy(m.Translation.Paths[j1].SrcEp.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16))
  1119  		m.Translation.Paths[j1].SrcEp.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
  1120  		m.Translation.Paths[j1].SrcEp.IfAf = ip_types.AddressFamily(buf.DecodeUint8())
  1121  		m.Translation.Paths[j1].SrcEp.Port = buf.DecodeUint16()
  1122  		m.Translation.Paths[j1].Flags = buf.DecodeUint8()
  1123  	}
  1124  	return nil
  1125  }
  1126  
  1127  // CnatTranslationUpdateReply defines message 'cnat_translation_update_reply'.
  1128  // InProgress: the message form may change in the future versions
  1129  type CnatTranslationUpdateReply struct {
  1130  	Retval int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
  1131  	ID     uint32 `binapi:"u32,name=id" json:"id,omitempty"`
  1132  }
  1133  
  1134  func (m *CnatTranslationUpdateReply) Reset()               { *m = CnatTranslationUpdateReply{} }
  1135  func (*CnatTranslationUpdateReply) GetMessageName() string { return "cnat_translation_update_reply" }
  1136  func (*CnatTranslationUpdateReply) GetCrcString() string   { return "e2fc8294" }
  1137  func (*CnatTranslationUpdateReply) GetMessageType() api.MessageType {
  1138  	return api.ReplyMessage
  1139  }
  1140  
  1141  func (m *CnatTranslationUpdateReply) Size() (size int) {
  1142  	if m == nil {
  1143  		return 0
  1144  	}
  1145  	size += 4 // m.Retval
  1146  	size += 4 // m.ID
  1147  	return size
  1148  }
  1149  func (m *CnatTranslationUpdateReply) Marshal(b []byte) ([]byte, error) {
  1150  	if b == nil {
  1151  		b = make([]byte, m.Size())
  1152  	}
  1153  	buf := codec.NewBuffer(b)
  1154  	buf.EncodeInt32(m.Retval)
  1155  	buf.EncodeUint32(m.ID)
  1156  	return buf.Bytes(), nil
  1157  }
  1158  func (m *CnatTranslationUpdateReply) Unmarshal(b []byte) error {
  1159  	buf := codec.NewBuffer(b)
  1160  	m.Retval = buf.DecodeInt32()
  1161  	m.ID = buf.DecodeUint32()
  1162  	return nil
  1163  }
  1164  
  1165  func init() { file_cnat_binapi_init() }
  1166  func file_cnat_binapi_init() {
  1167  	api.RegisterMessage((*CnatGetSnatAddresses)(nil), "cnat_get_snat_addresses_51077d14")
  1168  	api.RegisterMessage((*CnatGetSnatAddressesReply)(nil), "cnat_get_snat_addresses_reply_879513c1")
  1169  	api.RegisterMessage((*CnatSessionDetails)(nil), "cnat_session_details_7e5017c7")
  1170  	api.RegisterMessage((*CnatSessionDump)(nil), "cnat_session_dump_51077d14")
  1171  	api.RegisterMessage((*CnatSessionPurge)(nil), "cnat_session_purge_51077d14")
  1172  	api.RegisterMessage((*CnatSessionPurgeReply)(nil), "cnat_session_purge_reply_e8d4e804")
  1173  	api.RegisterMessage((*CnatSetSnatAddresses)(nil), "cnat_set_snat_addresses_d997e96c")
  1174  	api.RegisterMessage((*CnatSetSnatAddressesReply)(nil), "cnat_set_snat_addresses_reply_e8d4e804")
  1175  	api.RegisterMessage((*CnatSetSnatPolicy)(nil), "cnat_set_snat_policy_d3e6eaf4")
  1176  	api.RegisterMessage((*CnatSetSnatPolicyReply)(nil), "cnat_set_snat_policy_reply_e8d4e804")
  1177  	api.RegisterMessage((*CnatSnatPolicyAddDelExcludePfx)(nil), "cnat_snat_policy_add_del_exclude_pfx_e26dd79a")
  1178  	api.RegisterMessage((*CnatSnatPolicyAddDelExcludePfxReply)(nil), "cnat_snat_policy_add_del_exclude_pfx_reply_e8d4e804")
  1179  	api.RegisterMessage((*CnatSnatPolicyAddDelIf)(nil), "cnat_snat_policy_add_del_if_6828deca")
  1180  	api.RegisterMessage((*CnatSnatPolicyAddDelIfReply)(nil), "cnat_snat_policy_add_del_if_reply_e8d4e804")
  1181  	api.RegisterMessage((*CnatTranslationDel)(nil), "cnat_translation_del_3a91bde5")
  1182  	api.RegisterMessage((*CnatTranslationDelReply)(nil), "cnat_translation_del_reply_e8d4e804")
  1183  	api.RegisterMessage((*CnatTranslationDetails)(nil), "cnat_translation_details_347e1f16")
  1184  	api.RegisterMessage((*CnatTranslationDump)(nil), "cnat_translation_dump_51077d14")
  1185  	api.RegisterMessage((*CnatTranslationUpdate)(nil), "cnat_translation_update_cd5aedf5")
  1186  	api.RegisterMessage((*CnatTranslationUpdateReply)(nil), "cnat_translation_update_reply_e2fc8294")
  1187  }
  1188  
  1189  // Messages returns list of all messages in this module.
  1190  func AllMessages() []api.Message {
  1191  	return []api.Message{
  1192  		(*CnatGetSnatAddresses)(nil),
  1193  		(*CnatGetSnatAddressesReply)(nil),
  1194  		(*CnatSessionDetails)(nil),
  1195  		(*CnatSessionDump)(nil),
  1196  		(*CnatSessionPurge)(nil),
  1197  		(*CnatSessionPurgeReply)(nil),
  1198  		(*CnatSetSnatAddresses)(nil),
  1199  		(*CnatSetSnatAddressesReply)(nil),
  1200  		(*CnatSetSnatPolicy)(nil),
  1201  		(*CnatSetSnatPolicyReply)(nil),
  1202  		(*CnatSnatPolicyAddDelExcludePfx)(nil),
  1203  		(*CnatSnatPolicyAddDelExcludePfxReply)(nil),
  1204  		(*CnatSnatPolicyAddDelIf)(nil),
  1205  		(*CnatSnatPolicyAddDelIfReply)(nil),
  1206  		(*CnatTranslationDel)(nil),
  1207  		(*CnatTranslationDelReply)(nil),
  1208  		(*CnatTranslationDetails)(nil),
  1209  		(*CnatTranslationDump)(nil),
  1210  		(*CnatTranslationUpdate)(nil),
  1211  		(*CnatTranslationUpdateReply)(nil),
  1212  	}
  1213  }