github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/binapi/pnat/pnat.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/pnat.api.json
     6  
     7  // Package pnat contains generated bindings for API file pnat.api.
     8  //
     9  // Contents:
    10  //   2 enums
    11  //   2 structs
    12  //  16 messages
    13  //
    14  package pnat
    15  
    16  import (
    17  	"strconv"
    18  
    19  	api "git.fd.io/govpp.git/api"
    20  	codec "git.fd.io/govpp.git/codec"
    21  	interface_types "github.com/edwarnicke/govpp/binapi/interface_types"
    22  	ip_types "github.com/edwarnicke/govpp/binapi/ip_types"
    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    = "pnat"
    33  	APIVersion = "0.1.1"
    34  	VersionCrc = 0x7296c7ab
    35  )
    36  
    37  // PnatAttachmentPoint defines enum 'pnat_attachment_point'.
    38  type PnatAttachmentPoint uint32
    39  
    40  const (
    41  	PNAT_IP4_INPUT            PnatAttachmentPoint = 0
    42  	PNAT_IP4_OUTPUT           PnatAttachmentPoint = 1
    43  	PNAT_ATTACHMENT_POINT_MAX PnatAttachmentPoint = 2
    44  )
    45  
    46  var (
    47  	PnatAttachmentPoint_name = map[uint32]string{
    48  		0: "PNAT_IP4_INPUT",
    49  		1: "PNAT_IP4_OUTPUT",
    50  		2: "PNAT_ATTACHMENT_POINT_MAX",
    51  	}
    52  	PnatAttachmentPoint_value = map[string]uint32{
    53  		"PNAT_IP4_INPUT":            0,
    54  		"PNAT_IP4_OUTPUT":           1,
    55  		"PNAT_ATTACHMENT_POINT_MAX": 2,
    56  	}
    57  )
    58  
    59  func (x PnatAttachmentPoint) String() string {
    60  	s, ok := PnatAttachmentPoint_name[uint32(x)]
    61  	if ok {
    62  		return s
    63  	}
    64  	return "PnatAttachmentPoint(" + strconv.Itoa(int(x)) + ")"
    65  }
    66  
    67  // PnatMask defines enum 'pnat_mask'.
    68  type PnatMask uint32
    69  
    70  const (
    71  	PNAT_SA         PnatMask = 1
    72  	PNAT_DA         PnatMask = 2
    73  	PNAT_SPORT      PnatMask = 4
    74  	PNAT_DPORT      PnatMask = 8
    75  	PNAT_COPY_BYTE  PnatMask = 16
    76  	PNAT_CLEAR_BYTE PnatMask = 32
    77  	PNAT_PROTO      PnatMask = 64
    78  )
    79  
    80  var (
    81  	PnatMask_name = map[uint32]string{
    82  		1:  "PNAT_SA",
    83  		2:  "PNAT_DA",
    84  		4:  "PNAT_SPORT",
    85  		8:  "PNAT_DPORT",
    86  		16: "PNAT_COPY_BYTE",
    87  		32: "PNAT_CLEAR_BYTE",
    88  		64: "PNAT_PROTO",
    89  	}
    90  	PnatMask_value = map[string]uint32{
    91  		"PNAT_SA":         1,
    92  		"PNAT_DA":         2,
    93  		"PNAT_SPORT":      4,
    94  		"PNAT_DPORT":      8,
    95  		"PNAT_COPY_BYTE":  16,
    96  		"PNAT_CLEAR_BYTE": 32,
    97  		"PNAT_PROTO":      64,
    98  	}
    99  )
   100  
   101  func (x PnatMask) String() string {
   102  	s, ok := PnatMask_name[uint32(x)]
   103  	if ok {
   104  		return s
   105  	}
   106  	return "PnatMask(" + strconv.Itoa(int(x)) + ")"
   107  }
   108  
   109  // PnatMatchTuple defines type 'pnat_match_tuple'.
   110  type PnatMatchTuple struct {
   111  	Src   ip_types.IP4Address `binapi:"ip4_address,name=src" json:"src,omitempty"`
   112  	Dst   ip_types.IP4Address `binapi:"ip4_address,name=dst" json:"dst,omitempty"`
   113  	Proto ip_types.IPProto    `binapi:"ip_proto,name=proto" json:"proto,omitempty"`
   114  	Sport uint16              `binapi:"u16,name=sport" json:"sport,omitempty"`
   115  	Dport uint16              `binapi:"u16,name=dport" json:"dport,omitempty"`
   116  	Mask  PnatMask            `binapi:"pnat_mask,name=mask" json:"mask,omitempty"`
   117  }
   118  
   119  // PnatRewriteTuple defines type 'pnat_rewrite_tuple'.
   120  type PnatRewriteTuple struct {
   121  	Src         ip_types.IP4Address `binapi:"ip4_address,name=src" json:"src,omitempty"`
   122  	Dst         ip_types.IP4Address `binapi:"ip4_address,name=dst" json:"dst,omitempty"`
   123  	Sport       uint16              `binapi:"u16,name=sport" json:"sport,omitempty"`
   124  	Dport       uint16              `binapi:"u16,name=dport" json:"dport,omitempty"`
   125  	Mask        PnatMask            `binapi:"pnat_mask,name=mask" json:"mask,omitempty"`
   126  	FromOffset  uint8               `binapi:"u8,name=from_offset" json:"from_offset,omitempty"`
   127  	ToOffset    uint8               `binapi:"u8,name=to_offset" json:"to_offset,omitempty"`
   128  	ClearOffset uint8               `binapi:"u8,name=clear_offset" json:"clear_offset,omitempty"`
   129  }
   130  
   131  // PnatBindingAdd defines message 'pnat_binding_add'.
   132  // InProgress: the message form may change in the future versions
   133  type PnatBindingAdd struct {
   134  	Match   PnatMatchTuple   `binapi:"pnat_match_tuple,name=match" json:"match,omitempty"`
   135  	Rewrite PnatRewriteTuple `binapi:"pnat_rewrite_tuple,name=rewrite" json:"rewrite,omitempty"`
   136  }
   137  
   138  func (m *PnatBindingAdd) Reset()               { *m = PnatBindingAdd{} }
   139  func (*PnatBindingAdd) GetMessageName() string { return "pnat_binding_add" }
   140  func (*PnatBindingAdd) GetCrcString() string   { return "946ee0b7" }
   141  func (*PnatBindingAdd) GetMessageType() api.MessageType {
   142  	return api.RequestMessage
   143  }
   144  
   145  func (m *PnatBindingAdd) Size() (size int) {
   146  	if m == nil {
   147  		return 0
   148  	}
   149  	size += 1 * 4 // m.Match.Src
   150  	size += 1 * 4 // m.Match.Dst
   151  	size += 1     // m.Match.Proto
   152  	size += 2     // m.Match.Sport
   153  	size += 2     // m.Match.Dport
   154  	size += 4     // m.Match.Mask
   155  	size += 1 * 4 // m.Rewrite.Src
   156  	size += 1 * 4 // m.Rewrite.Dst
   157  	size += 2     // m.Rewrite.Sport
   158  	size += 2     // m.Rewrite.Dport
   159  	size += 4     // m.Rewrite.Mask
   160  	size += 1     // m.Rewrite.FromOffset
   161  	size += 1     // m.Rewrite.ToOffset
   162  	size += 1     // m.Rewrite.ClearOffset
   163  	return size
   164  }
   165  func (m *PnatBindingAdd) Marshal(b []byte) ([]byte, error) {
   166  	if b == nil {
   167  		b = make([]byte, m.Size())
   168  	}
   169  	buf := codec.NewBuffer(b)
   170  	buf.EncodeBytes(m.Match.Src[:], 4)
   171  	buf.EncodeBytes(m.Match.Dst[:], 4)
   172  	buf.EncodeUint8(uint8(m.Match.Proto))
   173  	buf.EncodeUint16(m.Match.Sport)
   174  	buf.EncodeUint16(m.Match.Dport)
   175  	buf.EncodeUint32(uint32(m.Match.Mask))
   176  	buf.EncodeBytes(m.Rewrite.Src[:], 4)
   177  	buf.EncodeBytes(m.Rewrite.Dst[:], 4)
   178  	buf.EncodeUint16(m.Rewrite.Sport)
   179  	buf.EncodeUint16(m.Rewrite.Dport)
   180  	buf.EncodeUint32(uint32(m.Rewrite.Mask))
   181  	buf.EncodeUint8(m.Rewrite.FromOffset)
   182  	buf.EncodeUint8(m.Rewrite.ToOffset)
   183  	buf.EncodeUint8(m.Rewrite.ClearOffset)
   184  	return buf.Bytes(), nil
   185  }
   186  func (m *PnatBindingAdd) Unmarshal(b []byte) error {
   187  	buf := codec.NewBuffer(b)
   188  	copy(m.Match.Src[:], buf.DecodeBytes(4))
   189  	copy(m.Match.Dst[:], buf.DecodeBytes(4))
   190  	m.Match.Proto = ip_types.IPProto(buf.DecodeUint8())
   191  	m.Match.Sport = buf.DecodeUint16()
   192  	m.Match.Dport = buf.DecodeUint16()
   193  	m.Match.Mask = PnatMask(buf.DecodeUint32())
   194  	copy(m.Rewrite.Src[:], buf.DecodeBytes(4))
   195  	copy(m.Rewrite.Dst[:], buf.DecodeBytes(4))
   196  	m.Rewrite.Sport = buf.DecodeUint16()
   197  	m.Rewrite.Dport = buf.DecodeUint16()
   198  	m.Rewrite.Mask = PnatMask(buf.DecodeUint32())
   199  	m.Rewrite.FromOffset = buf.DecodeUint8()
   200  	m.Rewrite.ToOffset = buf.DecodeUint8()
   201  	m.Rewrite.ClearOffset = buf.DecodeUint8()
   202  	return nil
   203  }
   204  
   205  // PnatBindingAddReply defines message 'pnat_binding_add_reply'.
   206  // InProgress: the message form may change in the future versions
   207  type PnatBindingAddReply struct {
   208  	Retval       int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
   209  	BindingIndex uint32 `binapi:"u32,name=binding_index" json:"binding_index,omitempty"`
   210  }
   211  
   212  func (m *PnatBindingAddReply) Reset()               { *m = PnatBindingAddReply{} }
   213  func (*PnatBindingAddReply) GetMessageName() string { return "pnat_binding_add_reply" }
   214  func (*PnatBindingAddReply) GetCrcString() string   { return "4cd980a7" }
   215  func (*PnatBindingAddReply) GetMessageType() api.MessageType {
   216  	return api.ReplyMessage
   217  }
   218  
   219  func (m *PnatBindingAddReply) Size() (size int) {
   220  	if m == nil {
   221  		return 0
   222  	}
   223  	size += 4 // m.Retval
   224  	size += 4 // m.BindingIndex
   225  	return size
   226  }
   227  func (m *PnatBindingAddReply) Marshal(b []byte) ([]byte, error) {
   228  	if b == nil {
   229  		b = make([]byte, m.Size())
   230  	}
   231  	buf := codec.NewBuffer(b)
   232  	buf.EncodeInt32(m.Retval)
   233  	buf.EncodeUint32(m.BindingIndex)
   234  	return buf.Bytes(), nil
   235  }
   236  func (m *PnatBindingAddReply) Unmarshal(b []byte) error {
   237  	buf := codec.NewBuffer(b)
   238  	m.Retval = buf.DecodeInt32()
   239  	m.BindingIndex = buf.DecodeUint32()
   240  	return nil
   241  }
   242  
   243  // PnatBindingAddV2 defines message 'pnat_binding_add_v2'.
   244  // InProgress: the message form may change in the future versions
   245  type PnatBindingAddV2 struct {
   246  	Match   PnatMatchTuple   `binapi:"pnat_match_tuple,name=match" json:"match,omitempty"`
   247  	Rewrite PnatRewriteTuple `binapi:"pnat_rewrite_tuple,name=rewrite" json:"rewrite,omitempty"`
   248  }
   249  
   250  func (m *PnatBindingAddV2) Reset()               { *m = PnatBindingAddV2{} }
   251  func (*PnatBindingAddV2) GetMessageName() string { return "pnat_binding_add_v2" }
   252  func (*PnatBindingAddV2) GetCrcString() string   { return "946ee0b7" }
   253  func (*PnatBindingAddV2) GetMessageType() api.MessageType {
   254  	return api.RequestMessage
   255  }
   256  
   257  func (m *PnatBindingAddV2) Size() (size int) {
   258  	if m == nil {
   259  		return 0
   260  	}
   261  	size += 1 * 4 // m.Match.Src
   262  	size += 1 * 4 // m.Match.Dst
   263  	size += 1     // m.Match.Proto
   264  	size += 2     // m.Match.Sport
   265  	size += 2     // m.Match.Dport
   266  	size += 4     // m.Match.Mask
   267  	size += 1 * 4 // m.Rewrite.Src
   268  	size += 1 * 4 // m.Rewrite.Dst
   269  	size += 2     // m.Rewrite.Sport
   270  	size += 2     // m.Rewrite.Dport
   271  	size += 4     // m.Rewrite.Mask
   272  	size += 1     // m.Rewrite.FromOffset
   273  	size += 1     // m.Rewrite.ToOffset
   274  	size += 1     // m.Rewrite.ClearOffset
   275  	return size
   276  }
   277  func (m *PnatBindingAddV2) Marshal(b []byte) ([]byte, error) {
   278  	if b == nil {
   279  		b = make([]byte, m.Size())
   280  	}
   281  	buf := codec.NewBuffer(b)
   282  	buf.EncodeBytes(m.Match.Src[:], 4)
   283  	buf.EncodeBytes(m.Match.Dst[:], 4)
   284  	buf.EncodeUint8(uint8(m.Match.Proto))
   285  	buf.EncodeUint16(m.Match.Sport)
   286  	buf.EncodeUint16(m.Match.Dport)
   287  	buf.EncodeUint32(uint32(m.Match.Mask))
   288  	buf.EncodeBytes(m.Rewrite.Src[:], 4)
   289  	buf.EncodeBytes(m.Rewrite.Dst[:], 4)
   290  	buf.EncodeUint16(m.Rewrite.Sport)
   291  	buf.EncodeUint16(m.Rewrite.Dport)
   292  	buf.EncodeUint32(uint32(m.Rewrite.Mask))
   293  	buf.EncodeUint8(m.Rewrite.FromOffset)
   294  	buf.EncodeUint8(m.Rewrite.ToOffset)
   295  	buf.EncodeUint8(m.Rewrite.ClearOffset)
   296  	return buf.Bytes(), nil
   297  }
   298  func (m *PnatBindingAddV2) Unmarshal(b []byte) error {
   299  	buf := codec.NewBuffer(b)
   300  	copy(m.Match.Src[:], buf.DecodeBytes(4))
   301  	copy(m.Match.Dst[:], buf.DecodeBytes(4))
   302  	m.Match.Proto = ip_types.IPProto(buf.DecodeUint8())
   303  	m.Match.Sport = buf.DecodeUint16()
   304  	m.Match.Dport = buf.DecodeUint16()
   305  	m.Match.Mask = PnatMask(buf.DecodeUint32())
   306  	copy(m.Rewrite.Src[:], buf.DecodeBytes(4))
   307  	copy(m.Rewrite.Dst[:], buf.DecodeBytes(4))
   308  	m.Rewrite.Sport = buf.DecodeUint16()
   309  	m.Rewrite.Dport = buf.DecodeUint16()
   310  	m.Rewrite.Mask = PnatMask(buf.DecodeUint32())
   311  	m.Rewrite.FromOffset = buf.DecodeUint8()
   312  	m.Rewrite.ToOffset = buf.DecodeUint8()
   313  	m.Rewrite.ClearOffset = buf.DecodeUint8()
   314  	return nil
   315  }
   316  
   317  // PnatBindingAddV2Reply defines message 'pnat_binding_add_v2_reply'.
   318  // InProgress: the message form may change in the future versions
   319  type PnatBindingAddV2Reply struct {
   320  	Retval       int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
   321  	BindingIndex uint32 `binapi:"u32,name=binding_index" json:"binding_index,omitempty"`
   322  }
   323  
   324  func (m *PnatBindingAddV2Reply) Reset()               { *m = PnatBindingAddV2Reply{} }
   325  func (*PnatBindingAddV2Reply) GetMessageName() string { return "pnat_binding_add_v2_reply" }
   326  func (*PnatBindingAddV2Reply) GetCrcString() string   { return "4cd980a7" }
   327  func (*PnatBindingAddV2Reply) GetMessageType() api.MessageType {
   328  	return api.ReplyMessage
   329  }
   330  
   331  func (m *PnatBindingAddV2Reply) Size() (size int) {
   332  	if m == nil {
   333  		return 0
   334  	}
   335  	size += 4 // m.Retval
   336  	size += 4 // m.BindingIndex
   337  	return size
   338  }
   339  func (m *PnatBindingAddV2Reply) Marshal(b []byte) ([]byte, error) {
   340  	if b == nil {
   341  		b = make([]byte, m.Size())
   342  	}
   343  	buf := codec.NewBuffer(b)
   344  	buf.EncodeInt32(m.Retval)
   345  	buf.EncodeUint32(m.BindingIndex)
   346  	return buf.Bytes(), nil
   347  }
   348  func (m *PnatBindingAddV2Reply) Unmarshal(b []byte) error {
   349  	buf := codec.NewBuffer(b)
   350  	m.Retval = buf.DecodeInt32()
   351  	m.BindingIndex = buf.DecodeUint32()
   352  	return nil
   353  }
   354  
   355  // PnatBindingAttach defines message 'pnat_binding_attach'.
   356  // InProgress: the message form may change in the future versions
   357  type PnatBindingAttach struct {
   358  	SwIfIndex    interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   359  	Attachment   PnatAttachmentPoint            `binapi:"pnat_attachment_point,name=attachment" json:"attachment,omitempty"`
   360  	BindingIndex uint32                         `binapi:"u32,name=binding_index" json:"binding_index,omitempty"`
   361  }
   362  
   363  func (m *PnatBindingAttach) Reset()               { *m = PnatBindingAttach{} }
   364  func (*PnatBindingAttach) GetMessageName() string { return "pnat_binding_attach" }
   365  func (*PnatBindingAttach) GetCrcString() string   { return "6e074232" }
   366  func (*PnatBindingAttach) GetMessageType() api.MessageType {
   367  	return api.RequestMessage
   368  }
   369  
   370  func (m *PnatBindingAttach) Size() (size int) {
   371  	if m == nil {
   372  		return 0
   373  	}
   374  	size += 4 // m.SwIfIndex
   375  	size += 4 // m.Attachment
   376  	size += 4 // m.BindingIndex
   377  	return size
   378  }
   379  func (m *PnatBindingAttach) Marshal(b []byte) ([]byte, error) {
   380  	if b == nil {
   381  		b = make([]byte, m.Size())
   382  	}
   383  	buf := codec.NewBuffer(b)
   384  	buf.EncodeUint32(uint32(m.SwIfIndex))
   385  	buf.EncodeUint32(uint32(m.Attachment))
   386  	buf.EncodeUint32(m.BindingIndex)
   387  	return buf.Bytes(), nil
   388  }
   389  func (m *PnatBindingAttach) Unmarshal(b []byte) error {
   390  	buf := codec.NewBuffer(b)
   391  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   392  	m.Attachment = PnatAttachmentPoint(buf.DecodeUint32())
   393  	m.BindingIndex = buf.DecodeUint32()
   394  	return nil
   395  }
   396  
   397  // PnatBindingAttachReply defines message 'pnat_binding_attach_reply'.
   398  // InProgress: the message form may change in the future versions
   399  type PnatBindingAttachReply struct {
   400  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   401  }
   402  
   403  func (m *PnatBindingAttachReply) Reset()               { *m = PnatBindingAttachReply{} }
   404  func (*PnatBindingAttachReply) GetMessageName() string { return "pnat_binding_attach_reply" }
   405  func (*PnatBindingAttachReply) GetCrcString() string   { return "e8d4e804" }
   406  func (*PnatBindingAttachReply) GetMessageType() api.MessageType {
   407  	return api.ReplyMessage
   408  }
   409  
   410  func (m *PnatBindingAttachReply) Size() (size int) {
   411  	if m == nil {
   412  		return 0
   413  	}
   414  	size += 4 // m.Retval
   415  	return size
   416  }
   417  func (m *PnatBindingAttachReply) Marshal(b []byte) ([]byte, error) {
   418  	if b == nil {
   419  		b = make([]byte, m.Size())
   420  	}
   421  	buf := codec.NewBuffer(b)
   422  	buf.EncodeInt32(m.Retval)
   423  	return buf.Bytes(), nil
   424  }
   425  func (m *PnatBindingAttachReply) Unmarshal(b []byte) error {
   426  	buf := codec.NewBuffer(b)
   427  	m.Retval = buf.DecodeInt32()
   428  	return nil
   429  }
   430  
   431  // PnatBindingDel defines message 'pnat_binding_del'.
   432  // InProgress: the message form may change in the future versions
   433  type PnatBindingDel struct {
   434  	BindingIndex uint32 `binapi:"u32,name=binding_index" json:"binding_index,omitempty"`
   435  }
   436  
   437  func (m *PnatBindingDel) Reset()               { *m = PnatBindingDel{} }
   438  func (*PnatBindingDel) GetMessageName() string { return "pnat_binding_del" }
   439  func (*PnatBindingDel) GetCrcString() string   { return "9259df7b" }
   440  func (*PnatBindingDel) GetMessageType() api.MessageType {
   441  	return api.RequestMessage
   442  }
   443  
   444  func (m *PnatBindingDel) Size() (size int) {
   445  	if m == nil {
   446  		return 0
   447  	}
   448  	size += 4 // m.BindingIndex
   449  	return size
   450  }
   451  func (m *PnatBindingDel) Marshal(b []byte) ([]byte, error) {
   452  	if b == nil {
   453  		b = make([]byte, m.Size())
   454  	}
   455  	buf := codec.NewBuffer(b)
   456  	buf.EncodeUint32(m.BindingIndex)
   457  	return buf.Bytes(), nil
   458  }
   459  func (m *PnatBindingDel) Unmarshal(b []byte) error {
   460  	buf := codec.NewBuffer(b)
   461  	m.BindingIndex = buf.DecodeUint32()
   462  	return nil
   463  }
   464  
   465  // PnatBindingDelReply defines message 'pnat_binding_del_reply'.
   466  // InProgress: the message form may change in the future versions
   467  type PnatBindingDelReply struct {
   468  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   469  }
   470  
   471  func (m *PnatBindingDelReply) Reset()               { *m = PnatBindingDelReply{} }
   472  func (*PnatBindingDelReply) GetMessageName() string { return "pnat_binding_del_reply" }
   473  func (*PnatBindingDelReply) GetCrcString() string   { return "e8d4e804" }
   474  func (*PnatBindingDelReply) GetMessageType() api.MessageType {
   475  	return api.ReplyMessage
   476  }
   477  
   478  func (m *PnatBindingDelReply) Size() (size int) {
   479  	if m == nil {
   480  		return 0
   481  	}
   482  	size += 4 // m.Retval
   483  	return size
   484  }
   485  func (m *PnatBindingDelReply) Marshal(b []byte) ([]byte, error) {
   486  	if b == nil {
   487  		b = make([]byte, m.Size())
   488  	}
   489  	buf := codec.NewBuffer(b)
   490  	buf.EncodeInt32(m.Retval)
   491  	return buf.Bytes(), nil
   492  }
   493  func (m *PnatBindingDelReply) Unmarshal(b []byte) error {
   494  	buf := codec.NewBuffer(b)
   495  	m.Retval = buf.DecodeInt32()
   496  	return nil
   497  }
   498  
   499  // PnatBindingDetach defines message 'pnat_binding_detach'.
   500  // InProgress: the message form may change in the future versions
   501  type PnatBindingDetach struct {
   502  	SwIfIndex    interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   503  	Attachment   PnatAttachmentPoint            `binapi:"pnat_attachment_point,name=attachment" json:"attachment,omitempty"`
   504  	BindingIndex uint32                         `binapi:"u32,name=binding_index" json:"binding_index,omitempty"`
   505  }
   506  
   507  func (m *PnatBindingDetach) Reset()               { *m = PnatBindingDetach{} }
   508  func (*PnatBindingDetach) GetMessageName() string { return "pnat_binding_detach" }
   509  func (*PnatBindingDetach) GetCrcString() string   { return "6e074232" }
   510  func (*PnatBindingDetach) GetMessageType() api.MessageType {
   511  	return api.RequestMessage
   512  }
   513  
   514  func (m *PnatBindingDetach) Size() (size int) {
   515  	if m == nil {
   516  		return 0
   517  	}
   518  	size += 4 // m.SwIfIndex
   519  	size += 4 // m.Attachment
   520  	size += 4 // m.BindingIndex
   521  	return size
   522  }
   523  func (m *PnatBindingDetach) Marshal(b []byte) ([]byte, error) {
   524  	if b == nil {
   525  		b = make([]byte, m.Size())
   526  	}
   527  	buf := codec.NewBuffer(b)
   528  	buf.EncodeUint32(uint32(m.SwIfIndex))
   529  	buf.EncodeUint32(uint32(m.Attachment))
   530  	buf.EncodeUint32(m.BindingIndex)
   531  	return buf.Bytes(), nil
   532  }
   533  func (m *PnatBindingDetach) Unmarshal(b []byte) error {
   534  	buf := codec.NewBuffer(b)
   535  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   536  	m.Attachment = PnatAttachmentPoint(buf.DecodeUint32())
   537  	m.BindingIndex = buf.DecodeUint32()
   538  	return nil
   539  }
   540  
   541  // PnatBindingDetachReply defines message 'pnat_binding_detach_reply'.
   542  // InProgress: the message form may change in the future versions
   543  type PnatBindingDetachReply struct {
   544  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   545  }
   546  
   547  func (m *PnatBindingDetachReply) Reset()               { *m = PnatBindingDetachReply{} }
   548  func (*PnatBindingDetachReply) GetMessageName() string { return "pnat_binding_detach_reply" }
   549  func (*PnatBindingDetachReply) GetCrcString() string   { return "e8d4e804" }
   550  func (*PnatBindingDetachReply) GetMessageType() api.MessageType {
   551  	return api.ReplyMessage
   552  }
   553  
   554  func (m *PnatBindingDetachReply) Size() (size int) {
   555  	if m == nil {
   556  		return 0
   557  	}
   558  	size += 4 // m.Retval
   559  	return size
   560  }
   561  func (m *PnatBindingDetachReply) Marshal(b []byte) ([]byte, error) {
   562  	if b == nil {
   563  		b = make([]byte, m.Size())
   564  	}
   565  	buf := codec.NewBuffer(b)
   566  	buf.EncodeInt32(m.Retval)
   567  	return buf.Bytes(), nil
   568  }
   569  func (m *PnatBindingDetachReply) Unmarshal(b []byte) error {
   570  	buf := codec.NewBuffer(b)
   571  	m.Retval = buf.DecodeInt32()
   572  	return nil
   573  }
   574  
   575  // PnatBindingsDetails defines message 'pnat_bindings_details'.
   576  // InProgress: the message form may change in the future versions
   577  type PnatBindingsDetails struct {
   578  	Match   PnatMatchTuple   `binapi:"pnat_match_tuple,name=match" json:"match,omitempty"`
   579  	Rewrite PnatRewriteTuple `binapi:"pnat_rewrite_tuple,name=rewrite" json:"rewrite,omitempty"`
   580  }
   581  
   582  func (m *PnatBindingsDetails) Reset()               { *m = PnatBindingsDetails{} }
   583  func (*PnatBindingsDetails) GetMessageName() string { return "pnat_bindings_details" }
   584  func (*PnatBindingsDetails) GetCrcString() string   { return "08fb2815" }
   585  func (*PnatBindingsDetails) GetMessageType() api.MessageType {
   586  	return api.ReplyMessage
   587  }
   588  
   589  func (m *PnatBindingsDetails) Size() (size int) {
   590  	if m == nil {
   591  		return 0
   592  	}
   593  	size += 1 * 4 // m.Match.Src
   594  	size += 1 * 4 // m.Match.Dst
   595  	size += 1     // m.Match.Proto
   596  	size += 2     // m.Match.Sport
   597  	size += 2     // m.Match.Dport
   598  	size += 4     // m.Match.Mask
   599  	size += 1 * 4 // m.Rewrite.Src
   600  	size += 1 * 4 // m.Rewrite.Dst
   601  	size += 2     // m.Rewrite.Sport
   602  	size += 2     // m.Rewrite.Dport
   603  	size += 4     // m.Rewrite.Mask
   604  	size += 1     // m.Rewrite.FromOffset
   605  	size += 1     // m.Rewrite.ToOffset
   606  	size += 1     // m.Rewrite.ClearOffset
   607  	return size
   608  }
   609  func (m *PnatBindingsDetails) Marshal(b []byte) ([]byte, error) {
   610  	if b == nil {
   611  		b = make([]byte, m.Size())
   612  	}
   613  	buf := codec.NewBuffer(b)
   614  	buf.EncodeBytes(m.Match.Src[:], 4)
   615  	buf.EncodeBytes(m.Match.Dst[:], 4)
   616  	buf.EncodeUint8(uint8(m.Match.Proto))
   617  	buf.EncodeUint16(m.Match.Sport)
   618  	buf.EncodeUint16(m.Match.Dport)
   619  	buf.EncodeUint32(uint32(m.Match.Mask))
   620  	buf.EncodeBytes(m.Rewrite.Src[:], 4)
   621  	buf.EncodeBytes(m.Rewrite.Dst[:], 4)
   622  	buf.EncodeUint16(m.Rewrite.Sport)
   623  	buf.EncodeUint16(m.Rewrite.Dport)
   624  	buf.EncodeUint32(uint32(m.Rewrite.Mask))
   625  	buf.EncodeUint8(m.Rewrite.FromOffset)
   626  	buf.EncodeUint8(m.Rewrite.ToOffset)
   627  	buf.EncodeUint8(m.Rewrite.ClearOffset)
   628  	return buf.Bytes(), nil
   629  }
   630  func (m *PnatBindingsDetails) Unmarshal(b []byte) error {
   631  	buf := codec.NewBuffer(b)
   632  	copy(m.Match.Src[:], buf.DecodeBytes(4))
   633  	copy(m.Match.Dst[:], buf.DecodeBytes(4))
   634  	m.Match.Proto = ip_types.IPProto(buf.DecodeUint8())
   635  	m.Match.Sport = buf.DecodeUint16()
   636  	m.Match.Dport = buf.DecodeUint16()
   637  	m.Match.Mask = PnatMask(buf.DecodeUint32())
   638  	copy(m.Rewrite.Src[:], buf.DecodeBytes(4))
   639  	copy(m.Rewrite.Dst[:], buf.DecodeBytes(4))
   640  	m.Rewrite.Sport = buf.DecodeUint16()
   641  	m.Rewrite.Dport = buf.DecodeUint16()
   642  	m.Rewrite.Mask = PnatMask(buf.DecodeUint32())
   643  	m.Rewrite.FromOffset = buf.DecodeUint8()
   644  	m.Rewrite.ToOffset = buf.DecodeUint8()
   645  	m.Rewrite.ClearOffset = buf.DecodeUint8()
   646  	return nil
   647  }
   648  
   649  // PnatBindingsGet defines message 'pnat_bindings_get'.
   650  // InProgress: the message form may change in the future versions
   651  type PnatBindingsGet struct {
   652  	Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"`
   653  }
   654  
   655  func (m *PnatBindingsGet) Reset()               { *m = PnatBindingsGet{} }
   656  func (*PnatBindingsGet) GetMessageName() string { return "pnat_bindings_get" }
   657  func (*PnatBindingsGet) GetCrcString() string   { return "f75ba505" }
   658  func (*PnatBindingsGet) GetMessageType() api.MessageType {
   659  	return api.RequestMessage
   660  }
   661  
   662  func (m *PnatBindingsGet) Size() (size int) {
   663  	if m == nil {
   664  		return 0
   665  	}
   666  	size += 4 // m.Cursor
   667  	return size
   668  }
   669  func (m *PnatBindingsGet) Marshal(b []byte) ([]byte, error) {
   670  	if b == nil {
   671  		b = make([]byte, m.Size())
   672  	}
   673  	buf := codec.NewBuffer(b)
   674  	buf.EncodeUint32(m.Cursor)
   675  	return buf.Bytes(), nil
   676  }
   677  func (m *PnatBindingsGet) Unmarshal(b []byte) error {
   678  	buf := codec.NewBuffer(b)
   679  	m.Cursor = buf.DecodeUint32()
   680  	return nil
   681  }
   682  
   683  // PnatBindingsGetReply defines message 'pnat_bindings_get_reply'.
   684  // InProgress: the message form may change in the future versions
   685  type PnatBindingsGetReply struct {
   686  	Retval int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
   687  	Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"`
   688  }
   689  
   690  func (m *PnatBindingsGetReply) Reset()               { *m = PnatBindingsGetReply{} }
   691  func (*PnatBindingsGetReply) GetMessageName() string { return "pnat_bindings_get_reply" }
   692  func (*PnatBindingsGetReply) GetCrcString() string   { return "53b48f5d" }
   693  func (*PnatBindingsGetReply) GetMessageType() api.MessageType {
   694  	return api.ReplyMessage
   695  }
   696  
   697  func (m *PnatBindingsGetReply) Size() (size int) {
   698  	if m == nil {
   699  		return 0
   700  	}
   701  	size += 4 // m.Retval
   702  	size += 4 // m.Cursor
   703  	return size
   704  }
   705  func (m *PnatBindingsGetReply) Marshal(b []byte) ([]byte, error) {
   706  	if b == nil {
   707  		b = make([]byte, m.Size())
   708  	}
   709  	buf := codec.NewBuffer(b)
   710  	buf.EncodeInt32(m.Retval)
   711  	buf.EncodeUint32(m.Cursor)
   712  	return buf.Bytes(), nil
   713  }
   714  func (m *PnatBindingsGetReply) Unmarshal(b []byte) error {
   715  	buf := codec.NewBuffer(b)
   716  	m.Retval = buf.DecodeInt32()
   717  	m.Cursor = buf.DecodeUint32()
   718  	return nil
   719  }
   720  
   721  // PnatInterfacesDetails defines message 'pnat_interfaces_details'.
   722  // InProgress: the message form may change in the future versions
   723  type PnatInterfacesDetails struct {
   724  	SwIfIndex  interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   725  	Enabled    []bool                         `binapi:"bool[2],name=enabled" json:"enabled,omitempty"`
   726  	LookupMask [2]PnatMask                    `binapi:"pnat_mask[2],name=lookup_mask" json:"lookup_mask,omitempty"`
   727  }
   728  
   729  func (m *PnatInterfacesDetails) Reset()               { *m = PnatInterfacesDetails{} }
   730  func (*PnatInterfacesDetails) GetMessageName() string { return "pnat_interfaces_details" }
   731  func (*PnatInterfacesDetails) GetCrcString() string   { return "4cb09493" }
   732  func (*PnatInterfacesDetails) GetMessageType() api.MessageType {
   733  	return api.ReplyMessage
   734  }
   735  
   736  func (m *PnatInterfacesDetails) Size() (size int) {
   737  	if m == nil {
   738  		return 0
   739  	}
   740  	size += 4     // m.SwIfIndex
   741  	size += 1 * 2 // m.Enabled
   742  	for j1 := 0; j1 < 2; j1++ {
   743  		size += 4 // m.LookupMask[j1]
   744  	}
   745  	return size
   746  }
   747  func (m *PnatInterfacesDetails) Marshal(b []byte) ([]byte, error) {
   748  	if b == nil {
   749  		b = make([]byte, m.Size())
   750  	}
   751  	buf := codec.NewBuffer(b)
   752  	buf.EncodeUint32(uint32(m.SwIfIndex))
   753  	for i := 0; i < 2; i++ {
   754  		var x bool
   755  		if i < len(m.Enabled) {
   756  			x = bool(m.Enabled[i])
   757  		}
   758  		buf.EncodeBool(x)
   759  	}
   760  	for j0 := 0; j0 < 2; j0++ {
   761  		buf.EncodeUint32(uint32(m.LookupMask[j0]))
   762  	}
   763  	return buf.Bytes(), nil
   764  }
   765  func (m *PnatInterfacesDetails) Unmarshal(b []byte) error {
   766  	buf := codec.NewBuffer(b)
   767  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   768  	m.Enabled = make([]bool, 2)
   769  	for i := 0; i < len(m.Enabled); i++ {
   770  		m.Enabled[i] = buf.DecodeBool()
   771  	}
   772  	for j0 := 0; j0 < 2; j0++ {
   773  		m.LookupMask[j0] = PnatMask(buf.DecodeUint32())
   774  	}
   775  	return nil
   776  }
   777  
   778  // PnatInterfacesGet defines message 'pnat_interfaces_get'.
   779  // InProgress: the message form may change in the future versions
   780  type PnatInterfacesGet struct {
   781  	Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"`
   782  }
   783  
   784  func (m *PnatInterfacesGet) Reset()               { *m = PnatInterfacesGet{} }
   785  func (*PnatInterfacesGet) GetMessageName() string { return "pnat_interfaces_get" }
   786  func (*PnatInterfacesGet) GetCrcString() string   { return "f75ba505" }
   787  func (*PnatInterfacesGet) GetMessageType() api.MessageType {
   788  	return api.RequestMessage
   789  }
   790  
   791  func (m *PnatInterfacesGet) Size() (size int) {
   792  	if m == nil {
   793  		return 0
   794  	}
   795  	size += 4 // m.Cursor
   796  	return size
   797  }
   798  func (m *PnatInterfacesGet) Marshal(b []byte) ([]byte, error) {
   799  	if b == nil {
   800  		b = make([]byte, m.Size())
   801  	}
   802  	buf := codec.NewBuffer(b)
   803  	buf.EncodeUint32(m.Cursor)
   804  	return buf.Bytes(), nil
   805  }
   806  func (m *PnatInterfacesGet) Unmarshal(b []byte) error {
   807  	buf := codec.NewBuffer(b)
   808  	m.Cursor = buf.DecodeUint32()
   809  	return nil
   810  }
   811  
   812  // PnatInterfacesGetReply defines message 'pnat_interfaces_get_reply'.
   813  // InProgress: the message form may change in the future versions
   814  type PnatInterfacesGetReply struct {
   815  	Retval int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
   816  	Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"`
   817  }
   818  
   819  func (m *PnatInterfacesGetReply) Reset()               { *m = PnatInterfacesGetReply{} }
   820  func (*PnatInterfacesGetReply) GetMessageName() string { return "pnat_interfaces_get_reply" }
   821  func (*PnatInterfacesGetReply) GetCrcString() string   { return "53b48f5d" }
   822  func (*PnatInterfacesGetReply) GetMessageType() api.MessageType {
   823  	return api.ReplyMessage
   824  }
   825  
   826  func (m *PnatInterfacesGetReply) Size() (size int) {
   827  	if m == nil {
   828  		return 0
   829  	}
   830  	size += 4 // m.Retval
   831  	size += 4 // m.Cursor
   832  	return size
   833  }
   834  func (m *PnatInterfacesGetReply) Marshal(b []byte) ([]byte, error) {
   835  	if b == nil {
   836  		b = make([]byte, m.Size())
   837  	}
   838  	buf := codec.NewBuffer(b)
   839  	buf.EncodeInt32(m.Retval)
   840  	buf.EncodeUint32(m.Cursor)
   841  	return buf.Bytes(), nil
   842  }
   843  func (m *PnatInterfacesGetReply) Unmarshal(b []byte) error {
   844  	buf := codec.NewBuffer(b)
   845  	m.Retval = buf.DecodeInt32()
   846  	m.Cursor = buf.DecodeUint32()
   847  	return nil
   848  }
   849  
   850  func init() { file_pnat_binapi_init() }
   851  func file_pnat_binapi_init() {
   852  	api.RegisterMessage((*PnatBindingAdd)(nil), "pnat_binding_add_946ee0b7")
   853  	api.RegisterMessage((*PnatBindingAddReply)(nil), "pnat_binding_add_reply_4cd980a7")
   854  	api.RegisterMessage((*PnatBindingAddV2)(nil), "pnat_binding_add_v2_946ee0b7")
   855  	api.RegisterMessage((*PnatBindingAddV2Reply)(nil), "pnat_binding_add_v2_reply_4cd980a7")
   856  	api.RegisterMessage((*PnatBindingAttach)(nil), "pnat_binding_attach_6e074232")
   857  	api.RegisterMessage((*PnatBindingAttachReply)(nil), "pnat_binding_attach_reply_e8d4e804")
   858  	api.RegisterMessage((*PnatBindingDel)(nil), "pnat_binding_del_9259df7b")
   859  	api.RegisterMessage((*PnatBindingDelReply)(nil), "pnat_binding_del_reply_e8d4e804")
   860  	api.RegisterMessage((*PnatBindingDetach)(nil), "pnat_binding_detach_6e074232")
   861  	api.RegisterMessage((*PnatBindingDetachReply)(nil), "pnat_binding_detach_reply_e8d4e804")
   862  	api.RegisterMessage((*PnatBindingsDetails)(nil), "pnat_bindings_details_08fb2815")
   863  	api.RegisterMessage((*PnatBindingsGet)(nil), "pnat_bindings_get_f75ba505")
   864  	api.RegisterMessage((*PnatBindingsGetReply)(nil), "pnat_bindings_get_reply_53b48f5d")
   865  	api.RegisterMessage((*PnatInterfacesDetails)(nil), "pnat_interfaces_details_4cb09493")
   866  	api.RegisterMessage((*PnatInterfacesGet)(nil), "pnat_interfaces_get_f75ba505")
   867  	api.RegisterMessage((*PnatInterfacesGetReply)(nil), "pnat_interfaces_get_reply_53b48f5d")
   868  }
   869  
   870  // Messages returns list of all messages in this module.
   871  func AllMessages() []api.Message {
   872  	return []api.Message{
   873  		(*PnatBindingAdd)(nil),
   874  		(*PnatBindingAddReply)(nil),
   875  		(*PnatBindingAddV2)(nil),
   876  		(*PnatBindingAddV2Reply)(nil),
   877  		(*PnatBindingAttach)(nil),
   878  		(*PnatBindingAttachReply)(nil),
   879  		(*PnatBindingDel)(nil),
   880  		(*PnatBindingDelReply)(nil),
   881  		(*PnatBindingDetach)(nil),
   882  		(*PnatBindingDetachReply)(nil),
   883  		(*PnatBindingsDetails)(nil),
   884  		(*PnatBindingsGet)(nil),
   885  		(*PnatBindingsGetReply)(nil),
   886  		(*PnatInterfacesDetails)(nil),
   887  		(*PnatInterfacesGet)(nil),
   888  		(*PnatInterfacesGetReply)(nil),
   889  	}
   890  }