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