github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/capo/capo.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/capo.api.json
     6  
     7  // Package capo contains generated bindings for API file capo.api.
     8  //
     9  // Contents:
    10  // -  4 enums
    11  // -  8 structs
    12  // -  2 unions
    13  // - 24 messages
    14  package capo
    15  
    16  import (
    17  	"strconv"
    18  
    19  	_ "github.com/networkservicemesh/govpp/binapi/fib_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    = "capo"
    33  	APIVersion = "0.1.0"
    34  	VersionCrc = 0x7ed1a7f5
    35  )
    36  
    37  // CapoEntryType defines enum 'capo_entry_type'.
    38  type CapoEntryType uint8
    39  
    40  const (
    41  	CAPO_CIDR        CapoEntryType = 0
    42  	CAPO_PORT_RANGE  CapoEntryType = 1
    43  	CAPO_PORT_IP_SET CapoEntryType = 2
    44  	CAPO_IP_SET      CapoEntryType = 3
    45  )
    46  
    47  var (
    48  	CapoEntryType_name = map[uint8]string{
    49  		0: "CAPO_CIDR",
    50  		1: "CAPO_PORT_RANGE",
    51  		2: "CAPO_PORT_IP_SET",
    52  		3: "CAPO_IP_SET",
    53  	}
    54  	CapoEntryType_value = map[string]uint8{
    55  		"CAPO_CIDR":        0,
    56  		"CAPO_PORT_RANGE":  1,
    57  		"CAPO_PORT_IP_SET": 2,
    58  		"CAPO_IP_SET":      3,
    59  	}
    60  )
    61  
    62  func (x CapoEntryType) String() string {
    63  	s, ok := CapoEntryType_name[uint8(x)]
    64  	if ok {
    65  		return s
    66  	}
    67  	return "CapoEntryType(" + strconv.Itoa(int(x)) + ")"
    68  }
    69  
    70  // CapoIpsetType defines enum 'capo_ipset_type'.
    71  type CapoIpsetType uint8
    72  
    73  const (
    74  	CAPO_IP          CapoIpsetType = 0
    75  	CAPO_IP_AND_PORT CapoIpsetType = 1
    76  	CAPO_NET         CapoIpsetType = 2
    77  )
    78  
    79  var (
    80  	CapoIpsetType_name = map[uint8]string{
    81  		0: "CAPO_IP",
    82  		1: "CAPO_IP_AND_PORT",
    83  		2: "CAPO_NET",
    84  	}
    85  	CapoIpsetType_value = map[string]uint8{
    86  		"CAPO_IP":          0,
    87  		"CAPO_IP_AND_PORT": 1,
    88  		"CAPO_NET":         2,
    89  	}
    90  )
    91  
    92  func (x CapoIpsetType) String() string {
    93  	s, ok := CapoIpsetType_name[uint8(x)]
    94  	if ok {
    95  		return s
    96  	}
    97  	return "CapoIpsetType(" + strconv.Itoa(int(x)) + ")"
    98  }
    99  
   100  // CapoRuleAction defines enum 'capo_rule_action'.
   101  type CapoRuleAction uint8
   102  
   103  const (
   104  	CAPO_ALLOW CapoRuleAction = 0
   105  	CAPO_DENY  CapoRuleAction = 1
   106  	CAPO_LOG   CapoRuleAction = 2
   107  	CAPO_PASS  CapoRuleAction = 3
   108  )
   109  
   110  var (
   111  	CapoRuleAction_name = map[uint8]string{
   112  		0: "CAPO_ALLOW",
   113  		1: "CAPO_DENY",
   114  		2: "CAPO_LOG",
   115  		3: "CAPO_PASS",
   116  	}
   117  	CapoRuleAction_value = map[string]uint8{
   118  		"CAPO_ALLOW": 0,
   119  		"CAPO_DENY":  1,
   120  		"CAPO_LOG":   2,
   121  		"CAPO_PASS":  3,
   122  	}
   123  )
   124  
   125  func (x CapoRuleAction) String() string {
   126  	s, ok := CapoRuleAction_name[uint8(x)]
   127  	if ok {
   128  		return s
   129  	}
   130  	return "CapoRuleAction(" + strconv.Itoa(int(x)) + ")"
   131  }
   132  
   133  // CapoRuleFilterType defines enum 'capo_rule_filter_type'.
   134  type CapoRuleFilterType uint8
   135  
   136  const (
   137  	CAPO_RULE_FILTER_NONE_TYPE CapoRuleFilterType = 0
   138  	CAPO_RULE_FILTER_ICMP_TYPE CapoRuleFilterType = 1
   139  	CAPO_RULE_FILTER_ICMP_CODE CapoRuleFilterType = 2
   140  	CAPO_RULE_FILTER_L4_PROTO  CapoRuleFilterType = 3
   141  )
   142  
   143  var (
   144  	CapoRuleFilterType_name = map[uint8]string{
   145  		0: "CAPO_RULE_FILTER_NONE_TYPE",
   146  		1: "CAPO_RULE_FILTER_ICMP_TYPE",
   147  		2: "CAPO_RULE_FILTER_ICMP_CODE",
   148  		3: "CAPO_RULE_FILTER_L4_PROTO",
   149  	}
   150  	CapoRuleFilterType_value = map[string]uint8{
   151  		"CAPO_RULE_FILTER_NONE_TYPE": 0,
   152  		"CAPO_RULE_FILTER_ICMP_TYPE": 1,
   153  		"CAPO_RULE_FILTER_ICMP_CODE": 2,
   154  		"CAPO_RULE_FILTER_L4_PROTO":  3,
   155  	}
   156  )
   157  
   158  func (x CapoRuleFilterType) String() string {
   159  	s, ok := CapoRuleFilterType_name[uint8(x)]
   160  	if ok {
   161  		return s
   162  	}
   163  	return "CapoRuleFilterType(" + strconv.Itoa(int(x)) + ")"
   164  }
   165  
   166  // CapoEntrySetID defines type 'capo_entry_set_id'.
   167  type CapoEntrySetID struct {
   168  	SetID uint32 `binapi:"u32,name=set_id" json:"set_id,omitempty"`
   169  }
   170  
   171  // CapoIpsetMember defines type 'capo_ipset_member'.
   172  type CapoIpsetMember struct {
   173  	Val CapoIpsetMemberValUnion `binapi:"capo_ipset_member_val,name=val" json:"val,omitempty"`
   174  }
   175  
   176  // CapoPolicyItem defines type 'capo_policy_item'.
   177  type CapoPolicyItem struct {
   178  	IsInbound bool   `binapi:"bool,name=is_inbound" json:"is_inbound,omitempty"`
   179  	RuleID    uint32 `binapi:"u32,name=rule_id" json:"rule_id,omitempty"`
   180  }
   181  
   182  // CapoPortRange defines type 'capo_port_range'.
   183  type CapoPortRange struct {
   184  	Start uint16 `binapi:"u16,name=start" json:"start,omitempty"`
   185  	End   uint16 `binapi:"u16,name=end" json:"end,omitempty"`
   186  }
   187  
   188  // CapoRule defines type 'capo_rule'.
   189  type CapoRule struct {
   190  	Af         ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
   191  	Action     CapoRuleAction         `binapi:"capo_rule_action,name=action" json:"action,omitempty"`
   192  	Filters    [3]CapoRuleFilter      `binapi:"capo_rule_filter[3],name=filters" json:"filters,omitempty"`
   193  	NumEntries uint32                 `binapi:"u32,name=num_entries" json:"-"`
   194  	Matches    []CapoRuleEntry        `binapi:"capo_rule_entry[num_entries],name=matches" json:"matches,omitempty"`
   195  }
   196  
   197  // CapoRuleEntry defines type 'capo_rule_entry'.
   198  type CapoRuleEntry struct {
   199  	IsSrc bool               `binapi:"bool,name=is_src" json:"is_src,omitempty"`
   200  	IsNot bool               `binapi:"bool,name=is_not" json:"is_not,omitempty"`
   201  	Type  CapoEntryType      `binapi:"capo_entry_type,name=type" json:"type,omitempty"`
   202  	Data  CapoEntryDataUnion `binapi:"capo_entry_data,name=data" json:"data,omitempty"`
   203  }
   204  
   205  // CapoRuleFilter defines type 'capo_rule_filter'.
   206  type CapoRuleFilter struct {
   207  	Value       uint32             `binapi:"u32,name=value" json:"value,omitempty"`
   208  	Type        CapoRuleFilterType `binapi:"capo_rule_filter_type,name=type" json:"type,omitempty"`
   209  	ShouldMatch uint8              `binapi:"u8,name=should_match" json:"should_match,omitempty"`
   210  }
   211  
   212  // CapoThreeTuple defines type 'capo_three_tuple'.
   213  type CapoThreeTuple struct {
   214  	Address ip_types.Address `binapi:"address,name=address" json:"address,omitempty"`
   215  	L4Proto uint8            `binapi:"u8,name=l4_proto" json:"l4_proto,omitempty"`
   216  	Port    uint16           `binapi:"u16,name=port" json:"port,omitempty"`
   217  }
   218  
   219  // CapoEntryDataUnion defines union 'capo_entry_data'.
   220  type CapoEntryDataUnion struct {
   221  	// CapoEntryDataUnion can be one of:
   222  	// - Cidr *ip_types.Prefix
   223  	// - PortRange *CapoPortRange
   224  	// - SetID *CapoEntrySetID
   225  	XXX_UnionData [18]byte
   226  }
   227  
   228  func CapoEntryDataUnionCidr(a ip_types.Prefix) (u CapoEntryDataUnion) {
   229  	u.SetCidr(a)
   230  	return
   231  }
   232  func (u *CapoEntryDataUnion) SetCidr(a ip_types.Prefix) {
   233  	buf := codec.NewBuffer(u.XXX_UnionData[:])
   234  	buf.EncodeUint8(uint8(a.Address.Af))
   235  	buf.EncodeBytes(a.Address.Un.XXX_UnionData[:], 16)
   236  	buf.EncodeUint8(a.Len)
   237  }
   238  func (u *CapoEntryDataUnion) GetCidr() (a ip_types.Prefix) {
   239  	buf := codec.NewBuffer(u.XXX_UnionData[:])
   240  	a.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
   241  	copy(a.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   242  	a.Len = buf.DecodeUint8()
   243  	return
   244  }
   245  
   246  func CapoEntryDataUnionPortRange(a CapoPortRange) (u CapoEntryDataUnion) {
   247  	u.SetPortRange(a)
   248  	return
   249  }
   250  func (u *CapoEntryDataUnion) SetPortRange(a CapoPortRange) {
   251  	buf := codec.NewBuffer(u.XXX_UnionData[:])
   252  	buf.EncodeUint16(a.Start)
   253  	buf.EncodeUint16(a.End)
   254  }
   255  func (u *CapoEntryDataUnion) GetPortRange() (a CapoPortRange) {
   256  	buf := codec.NewBuffer(u.XXX_UnionData[:])
   257  	a.Start = buf.DecodeUint16()
   258  	a.End = buf.DecodeUint16()
   259  	return
   260  }
   261  
   262  func CapoEntryDataUnionSetID(a CapoEntrySetID) (u CapoEntryDataUnion) {
   263  	u.SetSetID(a)
   264  	return
   265  }
   266  func (u *CapoEntryDataUnion) SetSetID(a CapoEntrySetID) {
   267  	buf := codec.NewBuffer(u.XXX_UnionData[:])
   268  	buf.EncodeUint32(a.SetID)
   269  }
   270  func (u *CapoEntryDataUnion) GetSetID() (a CapoEntrySetID) {
   271  	buf := codec.NewBuffer(u.XXX_UnionData[:])
   272  	a.SetID = buf.DecodeUint32()
   273  	return
   274  }
   275  
   276  // CapoIpsetMemberValUnion defines union 'capo_ipset_member_val'.
   277  type CapoIpsetMemberValUnion struct {
   278  	// CapoIpsetMemberValUnion can be one of:
   279  	// - Address *ip_types.Address
   280  	// - Prefix *ip_types.Prefix
   281  	// - Tuple *CapoThreeTuple
   282  	XXX_UnionData [20]byte
   283  }
   284  
   285  func CapoIpsetMemberValUnionAddress(a ip_types.Address) (u CapoIpsetMemberValUnion) {
   286  	u.SetAddress(a)
   287  	return
   288  }
   289  func (u *CapoIpsetMemberValUnion) SetAddress(a ip_types.Address) {
   290  	buf := codec.NewBuffer(u.XXX_UnionData[:])
   291  	buf.EncodeUint8(uint8(a.Af))
   292  	buf.EncodeBytes(a.Un.XXX_UnionData[:], 16)
   293  }
   294  func (u *CapoIpsetMemberValUnion) GetAddress() (a ip_types.Address) {
   295  	buf := codec.NewBuffer(u.XXX_UnionData[:])
   296  	a.Af = ip_types.AddressFamily(buf.DecodeUint8())
   297  	copy(a.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   298  	return
   299  }
   300  
   301  func CapoIpsetMemberValUnionPrefix(a ip_types.Prefix) (u CapoIpsetMemberValUnion) {
   302  	u.SetPrefix(a)
   303  	return
   304  }
   305  func (u *CapoIpsetMemberValUnion) SetPrefix(a ip_types.Prefix) {
   306  	buf := codec.NewBuffer(u.XXX_UnionData[:])
   307  	buf.EncodeUint8(uint8(a.Address.Af))
   308  	buf.EncodeBytes(a.Address.Un.XXX_UnionData[:], 16)
   309  	buf.EncodeUint8(a.Len)
   310  }
   311  func (u *CapoIpsetMemberValUnion) GetPrefix() (a ip_types.Prefix) {
   312  	buf := codec.NewBuffer(u.XXX_UnionData[:])
   313  	a.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
   314  	copy(a.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   315  	a.Len = buf.DecodeUint8()
   316  	return
   317  }
   318  
   319  func CapoIpsetMemberValUnionTuple(a CapoThreeTuple) (u CapoIpsetMemberValUnion) {
   320  	u.SetTuple(a)
   321  	return
   322  }
   323  func (u *CapoIpsetMemberValUnion) SetTuple(a CapoThreeTuple) {
   324  	buf := codec.NewBuffer(u.XXX_UnionData[:])
   325  	buf.EncodeUint8(uint8(a.Address.Af))
   326  	buf.EncodeBytes(a.Address.Un.XXX_UnionData[:], 16)
   327  	buf.EncodeUint8(a.L4Proto)
   328  	buf.EncodeUint16(a.Port)
   329  }
   330  func (u *CapoIpsetMemberValUnion) GetTuple() (a CapoThreeTuple) {
   331  	buf := codec.NewBuffer(u.XXX_UnionData[:])
   332  	a.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
   333  	copy(a.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   334  	a.L4Proto = buf.DecodeUint8()
   335  	a.Port = buf.DecodeUint16()
   336  	return
   337  }
   338  
   339  // CapoConfigurePolicies defines message 'capo_configure_policies'.
   340  type CapoConfigurePolicies struct {
   341  	SwIfIndex     uint32   `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
   342  	NumRxPolicies uint32   `binapi:"u32,name=num_rx_policies" json:"num_rx_policies,omitempty"`
   343  	NumTxPolicies uint32   `binapi:"u32,name=num_tx_policies" json:"num_tx_policies,omitempty"`
   344  	TotalIds      uint32   `binapi:"u32,name=total_ids" json:"-"`
   345  	InvertRxTx    uint8    `binapi:"u8,name=invert_rx_tx" json:"invert_rx_tx,omitempty"`
   346  	PolicyIds     []uint32 `binapi:"u32[total_ids],name=policy_ids" json:"policy_ids,omitempty"`
   347  }
   348  
   349  func (m *CapoConfigurePolicies) Reset()               { *m = CapoConfigurePolicies{} }
   350  func (*CapoConfigurePolicies) GetMessageName() string { return "capo_configure_policies" }
   351  func (*CapoConfigurePolicies) GetCrcString() string   { return "743e3c30" }
   352  func (*CapoConfigurePolicies) GetMessageType() api.MessageType {
   353  	return api.RequestMessage
   354  }
   355  
   356  func (m *CapoConfigurePolicies) Size() (size int) {
   357  	if m == nil {
   358  		return 0
   359  	}
   360  	size += 4                    // m.SwIfIndex
   361  	size += 4                    // m.NumRxPolicies
   362  	size += 4                    // m.NumTxPolicies
   363  	size += 4                    // m.TotalIds
   364  	size += 1                    // m.InvertRxTx
   365  	size += 4 * len(m.PolicyIds) // m.PolicyIds
   366  	return size
   367  }
   368  func (m *CapoConfigurePolicies) Marshal(b []byte) ([]byte, error) {
   369  	if b == nil {
   370  		b = make([]byte, m.Size())
   371  	}
   372  	buf := codec.NewBuffer(b)
   373  	buf.EncodeUint32(m.SwIfIndex)
   374  	buf.EncodeUint32(m.NumRxPolicies)
   375  	buf.EncodeUint32(m.NumTxPolicies)
   376  	buf.EncodeUint32(uint32(len(m.PolicyIds)))
   377  	buf.EncodeUint8(m.InvertRxTx)
   378  	for i := 0; i < len(m.PolicyIds); i++ {
   379  		var x uint32
   380  		if i < len(m.PolicyIds) {
   381  			x = uint32(m.PolicyIds[i])
   382  		}
   383  		buf.EncodeUint32(x)
   384  	}
   385  	return buf.Bytes(), nil
   386  }
   387  func (m *CapoConfigurePolicies) Unmarshal(b []byte) error {
   388  	buf := codec.NewBuffer(b)
   389  	m.SwIfIndex = buf.DecodeUint32()
   390  	m.NumRxPolicies = buf.DecodeUint32()
   391  	m.NumTxPolicies = buf.DecodeUint32()
   392  	m.TotalIds = buf.DecodeUint32()
   393  	m.InvertRxTx = buf.DecodeUint8()
   394  	m.PolicyIds = make([]uint32, m.TotalIds)
   395  	for i := 0; i < len(m.PolicyIds); i++ {
   396  		m.PolicyIds[i] = buf.DecodeUint32()
   397  	}
   398  	return nil
   399  }
   400  
   401  // CapoConfigurePoliciesReply defines message 'capo_configure_policies_reply'.
   402  type CapoConfigurePoliciesReply struct {
   403  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   404  }
   405  
   406  func (m *CapoConfigurePoliciesReply) Reset()               { *m = CapoConfigurePoliciesReply{} }
   407  func (*CapoConfigurePoliciesReply) GetMessageName() string { return "capo_configure_policies_reply" }
   408  func (*CapoConfigurePoliciesReply) GetCrcString() string   { return "e8d4e804" }
   409  func (*CapoConfigurePoliciesReply) GetMessageType() api.MessageType {
   410  	return api.ReplyMessage
   411  }
   412  
   413  func (m *CapoConfigurePoliciesReply) Size() (size int) {
   414  	if m == nil {
   415  		return 0
   416  	}
   417  	size += 4 // m.Retval
   418  	return size
   419  }
   420  func (m *CapoConfigurePoliciesReply) Marshal(b []byte) ([]byte, error) {
   421  	if b == nil {
   422  		b = make([]byte, m.Size())
   423  	}
   424  	buf := codec.NewBuffer(b)
   425  	buf.EncodeInt32(m.Retval)
   426  	return buf.Bytes(), nil
   427  }
   428  func (m *CapoConfigurePoliciesReply) Unmarshal(b []byte) error {
   429  	buf := codec.NewBuffer(b)
   430  	m.Retval = buf.DecodeInt32()
   431  	return nil
   432  }
   433  
   434  // Control ping from client to api server request
   435  // CapoControlPing defines message 'capo_control_ping'.
   436  type CapoControlPing struct{}
   437  
   438  func (m *CapoControlPing) Reset()               { *m = CapoControlPing{} }
   439  func (*CapoControlPing) GetMessageName() string { return "capo_control_ping" }
   440  func (*CapoControlPing) GetCrcString() string   { return "51077d14" }
   441  func (*CapoControlPing) GetMessageType() api.MessageType {
   442  	return api.RequestMessage
   443  }
   444  
   445  func (m *CapoControlPing) Size() (size int) {
   446  	if m == nil {
   447  		return 0
   448  	}
   449  	return size
   450  }
   451  func (m *CapoControlPing) Marshal(b []byte) ([]byte, error) {
   452  	if b == nil {
   453  		b = make([]byte, m.Size())
   454  	}
   455  	buf := codec.NewBuffer(b)
   456  	return buf.Bytes(), nil
   457  }
   458  func (m *CapoControlPing) Unmarshal(b []byte) error {
   459  	return nil
   460  }
   461  
   462  // Control ping from the client to the server response
   463  //   - retval - return code for the request
   464  //   - vpe_pid - the pid of the vpe, returned by the server
   465  //
   466  // CapoControlPingReply defines message 'capo_control_ping_reply'.
   467  type CapoControlPingReply struct {
   468  	Retval      int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
   469  	ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"`
   470  	VpePID      uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"`
   471  }
   472  
   473  func (m *CapoControlPingReply) Reset()               { *m = CapoControlPingReply{} }
   474  func (*CapoControlPingReply) GetMessageName() string { return "capo_control_ping_reply" }
   475  func (*CapoControlPingReply) GetCrcString() string   { return "f6b0b8ca" }
   476  func (*CapoControlPingReply) GetMessageType() api.MessageType {
   477  	return api.ReplyMessage
   478  }
   479  
   480  func (m *CapoControlPingReply) Size() (size int) {
   481  	if m == nil {
   482  		return 0
   483  	}
   484  	size += 4 // m.Retval
   485  	size += 4 // m.ClientIndex
   486  	size += 4 // m.VpePID
   487  	return size
   488  }
   489  func (m *CapoControlPingReply) Marshal(b []byte) ([]byte, error) {
   490  	if b == nil {
   491  		b = make([]byte, m.Size())
   492  	}
   493  	buf := codec.NewBuffer(b)
   494  	buf.EncodeInt32(m.Retval)
   495  	buf.EncodeUint32(m.ClientIndex)
   496  	buf.EncodeUint32(m.VpePID)
   497  	return buf.Bytes(), nil
   498  }
   499  func (m *CapoControlPingReply) Unmarshal(b []byte) error {
   500  	buf := codec.NewBuffer(b)
   501  	m.Retval = buf.DecodeInt32()
   502  	m.ClientIndex = buf.DecodeUint32()
   503  	m.VpePID = buf.DecodeUint32()
   504  	return nil
   505  }
   506  
   507  // Get the plugin version
   508  // CapoGetVersion defines message 'capo_get_version'.
   509  type CapoGetVersion struct{}
   510  
   511  func (m *CapoGetVersion) Reset()               { *m = CapoGetVersion{} }
   512  func (*CapoGetVersion) GetMessageName() string { return "capo_get_version" }
   513  func (*CapoGetVersion) GetCrcString() string   { return "51077d14" }
   514  func (*CapoGetVersion) GetMessageType() api.MessageType {
   515  	return api.RequestMessage
   516  }
   517  
   518  func (m *CapoGetVersion) Size() (size int) {
   519  	if m == nil {
   520  		return 0
   521  	}
   522  	return size
   523  }
   524  func (m *CapoGetVersion) Marshal(b []byte) ([]byte, error) {
   525  	if b == nil {
   526  		b = make([]byte, m.Size())
   527  	}
   528  	buf := codec.NewBuffer(b)
   529  	return buf.Bytes(), nil
   530  }
   531  func (m *CapoGetVersion) Unmarshal(b []byte) error {
   532  	return nil
   533  }
   534  
   535  // Reply to get the plugin version
   536  //   - major - Incremented every time a known breaking behavior change is introduced
   537  //   - minor - Incremented with small changes, may be used to avoid buggy versions
   538  //
   539  // CapoGetVersionReply defines message 'capo_get_version_reply'.
   540  type CapoGetVersionReply struct {
   541  	Major uint32 `binapi:"u32,name=major" json:"major,omitempty"`
   542  	Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"`
   543  }
   544  
   545  func (m *CapoGetVersionReply) Reset()               { *m = CapoGetVersionReply{} }
   546  func (*CapoGetVersionReply) GetMessageName() string { return "capo_get_version_reply" }
   547  func (*CapoGetVersionReply) GetCrcString() string   { return "9b32cf86" }
   548  func (*CapoGetVersionReply) GetMessageType() api.MessageType {
   549  	return api.ReplyMessage
   550  }
   551  
   552  func (m *CapoGetVersionReply) Size() (size int) {
   553  	if m == nil {
   554  		return 0
   555  	}
   556  	size += 4 // m.Major
   557  	size += 4 // m.Minor
   558  	return size
   559  }
   560  func (m *CapoGetVersionReply) Marshal(b []byte) ([]byte, error) {
   561  	if b == nil {
   562  		b = make([]byte, m.Size())
   563  	}
   564  	buf := codec.NewBuffer(b)
   565  	buf.EncodeUint32(m.Major)
   566  	buf.EncodeUint32(m.Minor)
   567  	return buf.Bytes(), nil
   568  }
   569  func (m *CapoGetVersionReply) Unmarshal(b []byte) error {
   570  	buf := codec.NewBuffer(b)
   571  	m.Major = buf.DecodeUint32()
   572  	m.Minor = buf.DecodeUint32()
   573  	return nil
   574  }
   575  
   576  // CapoIpsetAddDelMembers defines message 'capo_ipset_add_del_members'.
   577  type CapoIpsetAddDelMembers struct {
   578  	SetID   uint32            `binapi:"u32,name=set_id" json:"set_id,omitempty"`
   579  	IsAdd   bool              `binapi:"bool,name=is_add" json:"is_add,omitempty"`
   580  	Len     uint32            `binapi:"u32,name=len" json:"-"`
   581  	Members []CapoIpsetMember `binapi:"capo_ipset_member[len],name=members" json:"members,omitempty"`
   582  }
   583  
   584  func (m *CapoIpsetAddDelMembers) Reset()               { *m = CapoIpsetAddDelMembers{} }
   585  func (*CapoIpsetAddDelMembers) GetMessageName() string { return "capo_ipset_add_del_members" }
   586  func (*CapoIpsetAddDelMembers) GetCrcString() string   { return "e7056d10" }
   587  func (*CapoIpsetAddDelMembers) GetMessageType() api.MessageType {
   588  	return api.RequestMessage
   589  }
   590  
   591  func (m *CapoIpsetAddDelMembers) Size() (size int) {
   592  	if m == nil {
   593  		return 0
   594  	}
   595  	size += 4 // m.SetID
   596  	size += 1 // m.IsAdd
   597  	size += 4 // m.Len
   598  	for j1 := 0; j1 < len(m.Members); j1++ {
   599  		var s1 CapoIpsetMember
   600  		_ = s1
   601  		if j1 < len(m.Members) {
   602  			s1 = m.Members[j1]
   603  		}
   604  		size += 1 * 20 // s1.Val
   605  	}
   606  	return size
   607  }
   608  func (m *CapoIpsetAddDelMembers) Marshal(b []byte) ([]byte, error) {
   609  	if b == nil {
   610  		b = make([]byte, m.Size())
   611  	}
   612  	buf := codec.NewBuffer(b)
   613  	buf.EncodeUint32(m.SetID)
   614  	buf.EncodeBool(m.IsAdd)
   615  	buf.EncodeUint32(uint32(len(m.Members)))
   616  	for j0 := 0; j0 < len(m.Members); j0++ {
   617  		var v0 CapoIpsetMember // Members
   618  		if j0 < len(m.Members) {
   619  			v0 = m.Members[j0]
   620  		}
   621  		buf.EncodeBytes(v0.Val.XXX_UnionData[:], 20)
   622  	}
   623  	return buf.Bytes(), nil
   624  }
   625  func (m *CapoIpsetAddDelMembers) Unmarshal(b []byte) error {
   626  	buf := codec.NewBuffer(b)
   627  	m.SetID = buf.DecodeUint32()
   628  	m.IsAdd = buf.DecodeBool()
   629  	m.Len = buf.DecodeUint32()
   630  	m.Members = make([]CapoIpsetMember, m.Len)
   631  	for j0 := 0; j0 < len(m.Members); j0++ {
   632  		copy(m.Members[j0].Val.XXX_UnionData[:], buf.DecodeBytes(20))
   633  	}
   634  	return nil
   635  }
   636  
   637  // CapoIpsetAddDelMembersReply defines message 'capo_ipset_add_del_members_reply'.
   638  type CapoIpsetAddDelMembersReply struct {
   639  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   640  }
   641  
   642  func (m *CapoIpsetAddDelMembersReply) Reset() { *m = CapoIpsetAddDelMembersReply{} }
   643  func (*CapoIpsetAddDelMembersReply) GetMessageName() string {
   644  	return "capo_ipset_add_del_members_reply"
   645  }
   646  func (*CapoIpsetAddDelMembersReply) GetCrcString() string { return "e8d4e804" }
   647  func (*CapoIpsetAddDelMembersReply) GetMessageType() api.MessageType {
   648  	return api.ReplyMessage
   649  }
   650  
   651  func (m *CapoIpsetAddDelMembersReply) Size() (size int) {
   652  	if m == nil {
   653  		return 0
   654  	}
   655  	size += 4 // m.Retval
   656  	return size
   657  }
   658  func (m *CapoIpsetAddDelMembersReply) Marshal(b []byte) ([]byte, error) {
   659  	if b == nil {
   660  		b = make([]byte, m.Size())
   661  	}
   662  	buf := codec.NewBuffer(b)
   663  	buf.EncodeInt32(m.Retval)
   664  	return buf.Bytes(), nil
   665  }
   666  func (m *CapoIpsetAddDelMembersReply) Unmarshal(b []byte) error {
   667  	buf := codec.NewBuffer(b)
   668  	m.Retval = buf.DecodeInt32()
   669  	return nil
   670  }
   671  
   672  // CapoIpsetCreate defines message 'capo_ipset_create'.
   673  type CapoIpsetCreate struct {
   674  	Type CapoIpsetType `binapi:"capo_ipset_type,name=type" json:"type,omitempty"`
   675  }
   676  
   677  func (m *CapoIpsetCreate) Reset()               { *m = CapoIpsetCreate{} }
   678  func (*CapoIpsetCreate) GetMessageName() string { return "capo_ipset_create" }
   679  func (*CapoIpsetCreate) GetCrcString() string   { return "69150c8a" }
   680  func (*CapoIpsetCreate) GetMessageType() api.MessageType {
   681  	return api.RequestMessage
   682  }
   683  
   684  func (m *CapoIpsetCreate) Size() (size int) {
   685  	if m == nil {
   686  		return 0
   687  	}
   688  	size += 1 // m.Type
   689  	return size
   690  }
   691  func (m *CapoIpsetCreate) Marshal(b []byte) ([]byte, error) {
   692  	if b == nil {
   693  		b = make([]byte, m.Size())
   694  	}
   695  	buf := codec.NewBuffer(b)
   696  	buf.EncodeUint8(uint8(m.Type))
   697  	return buf.Bytes(), nil
   698  }
   699  func (m *CapoIpsetCreate) Unmarshal(b []byte) error {
   700  	buf := codec.NewBuffer(b)
   701  	m.Type = CapoIpsetType(buf.DecodeUint8())
   702  	return nil
   703  }
   704  
   705  // CapoIpsetCreateReply defines message 'capo_ipset_create_reply'.
   706  type CapoIpsetCreateReply struct {
   707  	Retval int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
   708  	SetID  uint32 `binapi:"u32,name=set_id" json:"set_id,omitempty"`
   709  }
   710  
   711  func (m *CapoIpsetCreateReply) Reset()               { *m = CapoIpsetCreateReply{} }
   712  func (*CapoIpsetCreateReply) GetMessageName() string { return "capo_ipset_create_reply" }
   713  func (*CapoIpsetCreateReply) GetCrcString() string   { return "6a43f193" }
   714  func (*CapoIpsetCreateReply) GetMessageType() api.MessageType {
   715  	return api.ReplyMessage
   716  }
   717  
   718  func (m *CapoIpsetCreateReply) Size() (size int) {
   719  	if m == nil {
   720  		return 0
   721  	}
   722  	size += 4 // m.Retval
   723  	size += 4 // m.SetID
   724  	return size
   725  }
   726  func (m *CapoIpsetCreateReply) Marshal(b []byte) ([]byte, error) {
   727  	if b == nil {
   728  		b = make([]byte, m.Size())
   729  	}
   730  	buf := codec.NewBuffer(b)
   731  	buf.EncodeInt32(m.Retval)
   732  	buf.EncodeUint32(m.SetID)
   733  	return buf.Bytes(), nil
   734  }
   735  func (m *CapoIpsetCreateReply) Unmarshal(b []byte) error {
   736  	buf := codec.NewBuffer(b)
   737  	m.Retval = buf.DecodeInt32()
   738  	m.SetID = buf.DecodeUint32()
   739  	return nil
   740  }
   741  
   742  // CapoIpsetDelete defines message 'capo_ipset_delete'.
   743  type CapoIpsetDelete struct {
   744  	SetID uint32 `binapi:"u32,name=set_id" json:"set_id,omitempty"`
   745  }
   746  
   747  func (m *CapoIpsetDelete) Reset()               { *m = CapoIpsetDelete{} }
   748  func (*CapoIpsetDelete) GetMessageName() string { return "capo_ipset_delete" }
   749  func (*CapoIpsetDelete) GetCrcString() string   { return "ceacdbcb" }
   750  func (*CapoIpsetDelete) GetMessageType() api.MessageType {
   751  	return api.RequestMessage
   752  }
   753  
   754  func (m *CapoIpsetDelete) Size() (size int) {
   755  	if m == nil {
   756  		return 0
   757  	}
   758  	size += 4 // m.SetID
   759  	return size
   760  }
   761  func (m *CapoIpsetDelete) Marshal(b []byte) ([]byte, error) {
   762  	if b == nil {
   763  		b = make([]byte, m.Size())
   764  	}
   765  	buf := codec.NewBuffer(b)
   766  	buf.EncodeUint32(m.SetID)
   767  	return buf.Bytes(), nil
   768  }
   769  func (m *CapoIpsetDelete) Unmarshal(b []byte) error {
   770  	buf := codec.NewBuffer(b)
   771  	m.SetID = buf.DecodeUint32()
   772  	return nil
   773  }
   774  
   775  // CapoIpsetDeleteReply defines message 'capo_ipset_delete_reply'.
   776  type CapoIpsetDeleteReply struct {
   777  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   778  }
   779  
   780  func (m *CapoIpsetDeleteReply) Reset()               { *m = CapoIpsetDeleteReply{} }
   781  func (*CapoIpsetDeleteReply) GetMessageName() string { return "capo_ipset_delete_reply" }
   782  func (*CapoIpsetDeleteReply) GetCrcString() string   { return "e8d4e804" }
   783  func (*CapoIpsetDeleteReply) GetMessageType() api.MessageType {
   784  	return api.ReplyMessage
   785  }
   786  
   787  func (m *CapoIpsetDeleteReply) Size() (size int) {
   788  	if m == nil {
   789  		return 0
   790  	}
   791  	size += 4 // m.Retval
   792  	return size
   793  }
   794  func (m *CapoIpsetDeleteReply) Marshal(b []byte) ([]byte, error) {
   795  	if b == nil {
   796  		b = make([]byte, m.Size())
   797  	}
   798  	buf := codec.NewBuffer(b)
   799  	buf.EncodeInt32(m.Retval)
   800  	return buf.Bytes(), nil
   801  }
   802  func (m *CapoIpsetDeleteReply) Unmarshal(b []byte) error {
   803  	buf := codec.NewBuffer(b)
   804  	m.Retval = buf.DecodeInt32()
   805  	return nil
   806  }
   807  
   808  // CapoPolicyCreate defines message 'capo_policy_create'.
   809  type CapoPolicyCreate struct {
   810  	NumItems uint32           `binapi:"u32,name=num_items" json:"-"`
   811  	Rules    []CapoPolicyItem `binapi:"capo_policy_item[num_items],name=rules" json:"rules,omitempty"`
   812  }
   813  
   814  func (m *CapoPolicyCreate) Reset()               { *m = CapoPolicyCreate{} }
   815  func (*CapoPolicyCreate) GetMessageName() string { return "capo_policy_create" }
   816  func (*CapoPolicyCreate) GetCrcString() string   { return "f7ed31a8" }
   817  func (*CapoPolicyCreate) GetMessageType() api.MessageType {
   818  	return api.RequestMessage
   819  }
   820  
   821  func (m *CapoPolicyCreate) Size() (size int) {
   822  	if m == nil {
   823  		return 0
   824  	}
   825  	size += 4 // m.NumItems
   826  	for j1 := 0; j1 < len(m.Rules); j1++ {
   827  		var s1 CapoPolicyItem
   828  		_ = s1
   829  		if j1 < len(m.Rules) {
   830  			s1 = m.Rules[j1]
   831  		}
   832  		size += 1 // s1.IsInbound
   833  		size += 4 // s1.RuleID
   834  	}
   835  	return size
   836  }
   837  func (m *CapoPolicyCreate) Marshal(b []byte) ([]byte, error) {
   838  	if b == nil {
   839  		b = make([]byte, m.Size())
   840  	}
   841  	buf := codec.NewBuffer(b)
   842  	buf.EncodeUint32(uint32(len(m.Rules)))
   843  	for j0 := 0; j0 < len(m.Rules); j0++ {
   844  		var v0 CapoPolicyItem // Rules
   845  		if j0 < len(m.Rules) {
   846  			v0 = m.Rules[j0]
   847  		}
   848  		buf.EncodeBool(v0.IsInbound)
   849  		buf.EncodeUint32(v0.RuleID)
   850  	}
   851  	return buf.Bytes(), nil
   852  }
   853  func (m *CapoPolicyCreate) Unmarshal(b []byte) error {
   854  	buf := codec.NewBuffer(b)
   855  	m.NumItems = buf.DecodeUint32()
   856  	m.Rules = make([]CapoPolicyItem, m.NumItems)
   857  	for j0 := 0; j0 < len(m.Rules); j0++ {
   858  		m.Rules[j0].IsInbound = buf.DecodeBool()
   859  		m.Rules[j0].RuleID = buf.DecodeUint32()
   860  	}
   861  	return nil
   862  }
   863  
   864  // CapoPolicyCreateReply defines message 'capo_policy_create_reply'.
   865  type CapoPolicyCreateReply struct {
   866  	Retval   int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
   867  	PolicyID uint32 `binapi:"u32,name=policy_id" json:"policy_id,omitempty"`
   868  }
   869  
   870  func (m *CapoPolicyCreateReply) Reset()               { *m = CapoPolicyCreateReply{} }
   871  func (*CapoPolicyCreateReply) GetMessageName() string { return "capo_policy_create_reply" }
   872  func (*CapoPolicyCreateReply) GetCrcString() string   { return "90f27405" }
   873  func (*CapoPolicyCreateReply) GetMessageType() api.MessageType {
   874  	return api.ReplyMessage
   875  }
   876  
   877  func (m *CapoPolicyCreateReply) Size() (size int) {
   878  	if m == nil {
   879  		return 0
   880  	}
   881  	size += 4 // m.Retval
   882  	size += 4 // m.PolicyID
   883  	return size
   884  }
   885  func (m *CapoPolicyCreateReply) Marshal(b []byte) ([]byte, error) {
   886  	if b == nil {
   887  		b = make([]byte, m.Size())
   888  	}
   889  	buf := codec.NewBuffer(b)
   890  	buf.EncodeInt32(m.Retval)
   891  	buf.EncodeUint32(m.PolicyID)
   892  	return buf.Bytes(), nil
   893  }
   894  func (m *CapoPolicyCreateReply) Unmarshal(b []byte) error {
   895  	buf := codec.NewBuffer(b)
   896  	m.Retval = buf.DecodeInt32()
   897  	m.PolicyID = buf.DecodeUint32()
   898  	return nil
   899  }
   900  
   901  // CapoPolicyDelete defines message 'capo_policy_delete'.
   902  type CapoPolicyDelete struct {
   903  	PolicyID uint32 `binapi:"u32,name=policy_id" json:"policy_id,omitempty"`
   904  }
   905  
   906  func (m *CapoPolicyDelete) Reset()               { *m = CapoPolicyDelete{} }
   907  func (*CapoPolicyDelete) GetMessageName() string { return "capo_policy_delete" }
   908  func (*CapoPolicyDelete) GetCrcString() string   { return "ad833868" }
   909  func (*CapoPolicyDelete) GetMessageType() api.MessageType {
   910  	return api.RequestMessage
   911  }
   912  
   913  func (m *CapoPolicyDelete) Size() (size int) {
   914  	if m == nil {
   915  		return 0
   916  	}
   917  	size += 4 // m.PolicyID
   918  	return size
   919  }
   920  func (m *CapoPolicyDelete) Marshal(b []byte) ([]byte, error) {
   921  	if b == nil {
   922  		b = make([]byte, m.Size())
   923  	}
   924  	buf := codec.NewBuffer(b)
   925  	buf.EncodeUint32(m.PolicyID)
   926  	return buf.Bytes(), nil
   927  }
   928  func (m *CapoPolicyDelete) Unmarshal(b []byte) error {
   929  	buf := codec.NewBuffer(b)
   930  	m.PolicyID = buf.DecodeUint32()
   931  	return nil
   932  }
   933  
   934  // CapoPolicyDeleteReply defines message 'capo_policy_delete_reply'.
   935  type CapoPolicyDeleteReply struct {
   936  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   937  }
   938  
   939  func (m *CapoPolicyDeleteReply) Reset()               { *m = CapoPolicyDeleteReply{} }
   940  func (*CapoPolicyDeleteReply) GetMessageName() string { return "capo_policy_delete_reply" }
   941  func (*CapoPolicyDeleteReply) GetCrcString() string   { return "e8d4e804" }
   942  func (*CapoPolicyDeleteReply) GetMessageType() api.MessageType {
   943  	return api.ReplyMessage
   944  }
   945  
   946  func (m *CapoPolicyDeleteReply) Size() (size int) {
   947  	if m == nil {
   948  		return 0
   949  	}
   950  	size += 4 // m.Retval
   951  	return size
   952  }
   953  func (m *CapoPolicyDeleteReply) Marshal(b []byte) ([]byte, error) {
   954  	if b == nil {
   955  		b = make([]byte, m.Size())
   956  	}
   957  	buf := codec.NewBuffer(b)
   958  	buf.EncodeInt32(m.Retval)
   959  	return buf.Bytes(), nil
   960  }
   961  func (m *CapoPolicyDeleteReply) Unmarshal(b []byte) error {
   962  	buf := codec.NewBuffer(b)
   963  	m.Retval = buf.DecodeInt32()
   964  	return nil
   965  }
   966  
   967  // CapoPolicyUpdate defines message 'capo_policy_update'.
   968  type CapoPolicyUpdate struct {
   969  	PolicyID uint32           `binapi:"u32,name=policy_id" json:"policy_id,omitempty"`
   970  	NumItems uint32           `binapi:"u32,name=num_items" json:"-"`
   971  	Rules    []CapoPolicyItem `binapi:"capo_policy_item[num_items],name=rules" json:"rules,omitempty"`
   972  }
   973  
   974  func (m *CapoPolicyUpdate) Reset()               { *m = CapoPolicyUpdate{} }
   975  func (*CapoPolicyUpdate) GetMessageName() string { return "capo_policy_update" }
   976  func (*CapoPolicyUpdate) GetCrcString() string   { return "e2097dd0" }
   977  func (*CapoPolicyUpdate) GetMessageType() api.MessageType {
   978  	return api.RequestMessage
   979  }
   980  
   981  func (m *CapoPolicyUpdate) Size() (size int) {
   982  	if m == nil {
   983  		return 0
   984  	}
   985  	size += 4 // m.PolicyID
   986  	size += 4 // m.NumItems
   987  	for j1 := 0; j1 < len(m.Rules); j1++ {
   988  		var s1 CapoPolicyItem
   989  		_ = s1
   990  		if j1 < len(m.Rules) {
   991  			s1 = m.Rules[j1]
   992  		}
   993  		size += 1 // s1.IsInbound
   994  		size += 4 // s1.RuleID
   995  	}
   996  	return size
   997  }
   998  func (m *CapoPolicyUpdate) Marshal(b []byte) ([]byte, error) {
   999  	if b == nil {
  1000  		b = make([]byte, m.Size())
  1001  	}
  1002  	buf := codec.NewBuffer(b)
  1003  	buf.EncodeUint32(m.PolicyID)
  1004  	buf.EncodeUint32(uint32(len(m.Rules)))
  1005  	for j0 := 0; j0 < len(m.Rules); j0++ {
  1006  		var v0 CapoPolicyItem // Rules
  1007  		if j0 < len(m.Rules) {
  1008  			v0 = m.Rules[j0]
  1009  		}
  1010  		buf.EncodeBool(v0.IsInbound)
  1011  		buf.EncodeUint32(v0.RuleID)
  1012  	}
  1013  	return buf.Bytes(), nil
  1014  }
  1015  func (m *CapoPolicyUpdate) Unmarshal(b []byte) error {
  1016  	buf := codec.NewBuffer(b)
  1017  	m.PolicyID = buf.DecodeUint32()
  1018  	m.NumItems = buf.DecodeUint32()
  1019  	m.Rules = make([]CapoPolicyItem, m.NumItems)
  1020  	for j0 := 0; j0 < len(m.Rules); j0++ {
  1021  		m.Rules[j0].IsInbound = buf.DecodeBool()
  1022  		m.Rules[j0].RuleID = buf.DecodeUint32()
  1023  	}
  1024  	return nil
  1025  }
  1026  
  1027  // CapoPolicyUpdateReply defines message 'capo_policy_update_reply'.
  1028  type CapoPolicyUpdateReply struct {
  1029  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
  1030  }
  1031  
  1032  func (m *CapoPolicyUpdateReply) Reset()               { *m = CapoPolicyUpdateReply{} }
  1033  func (*CapoPolicyUpdateReply) GetMessageName() string { return "capo_policy_update_reply" }
  1034  func (*CapoPolicyUpdateReply) GetCrcString() string   { return "e8d4e804" }
  1035  func (*CapoPolicyUpdateReply) GetMessageType() api.MessageType {
  1036  	return api.ReplyMessage
  1037  }
  1038  
  1039  func (m *CapoPolicyUpdateReply) Size() (size int) {
  1040  	if m == nil {
  1041  		return 0
  1042  	}
  1043  	size += 4 // m.Retval
  1044  	return size
  1045  }
  1046  func (m *CapoPolicyUpdateReply) Marshal(b []byte) ([]byte, error) {
  1047  	if b == nil {
  1048  		b = make([]byte, m.Size())
  1049  	}
  1050  	buf := codec.NewBuffer(b)
  1051  	buf.EncodeInt32(m.Retval)
  1052  	return buf.Bytes(), nil
  1053  }
  1054  func (m *CapoPolicyUpdateReply) Unmarshal(b []byte) error {
  1055  	buf := codec.NewBuffer(b)
  1056  	m.Retval = buf.DecodeInt32()
  1057  	return nil
  1058  }
  1059  
  1060  // // where the packet only needs to match one entry in either category
  1061  // CapoRuleCreate defines message 'capo_rule_create'.
  1062  type CapoRuleCreate struct {
  1063  	Rule CapoRule `binapi:"capo_rule,name=rule" json:"rule,omitempty"`
  1064  }
  1065  
  1066  func (m *CapoRuleCreate) Reset()               { *m = CapoRuleCreate{} }
  1067  func (*CapoRuleCreate) GetMessageName() string { return "capo_rule_create" }
  1068  func (*CapoRuleCreate) GetCrcString() string   { return "0a2d5fd6" }
  1069  func (*CapoRuleCreate) GetMessageType() api.MessageType {
  1070  	return api.RequestMessage
  1071  }
  1072  
  1073  func (m *CapoRuleCreate) Size() (size int) {
  1074  	if m == nil {
  1075  		return 0
  1076  	}
  1077  	size += 1 // m.Rule.Af
  1078  	size += 1 // m.Rule.Action
  1079  	for j2 := 0; j2 < 3; j2++ {
  1080  		size += 4 // m.Rule.Filters[j2].Value
  1081  		size += 1 // m.Rule.Filters[j2].Type
  1082  		size += 1 // m.Rule.Filters[j2].ShouldMatch
  1083  	}
  1084  	size += 4 // m.Rule.NumEntries
  1085  	for j2 := 0; j2 < len(m.Rule.Matches); j2++ {
  1086  		var s2 CapoRuleEntry
  1087  		_ = s2
  1088  		if j2 < len(m.Rule.Matches) {
  1089  			s2 = m.Rule.Matches[j2]
  1090  		}
  1091  		size += 1      // s2.IsSrc
  1092  		size += 1      // s2.IsNot
  1093  		size += 1      // s2.Type
  1094  		size += 1 * 18 // s2.Data
  1095  	}
  1096  	return size
  1097  }
  1098  func (m *CapoRuleCreate) Marshal(b []byte) ([]byte, error) {
  1099  	if b == nil {
  1100  		b = make([]byte, m.Size())
  1101  	}
  1102  	buf := codec.NewBuffer(b)
  1103  	buf.EncodeUint8(uint8(m.Rule.Af))
  1104  	buf.EncodeUint8(uint8(m.Rule.Action))
  1105  	for j1 := 0; j1 < 3; j1++ {
  1106  		buf.EncodeUint32(m.Rule.Filters[j1].Value)
  1107  		buf.EncodeUint8(uint8(m.Rule.Filters[j1].Type))
  1108  		buf.EncodeUint8(m.Rule.Filters[j1].ShouldMatch)
  1109  	}
  1110  	buf.EncodeUint32(uint32(len(m.Rule.Matches)))
  1111  	for j1 := 0; j1 < len(m.Rule.Matches); j1++ {
  1112  		var v1 CapoRuleEntry // Matches
  1113  		if j1 < len(m.Rule.Matches) {
  1114  			v1 = m.Rule.Matches[j1]
  1115  		}
  1116  		buf.EncodeBool(v1.IsSrc)
  1117  		buf.EncodeBool(v1.IsNot)
  1118  		buf.EncodeUint8(uint8(v1.Type))
  1119  		buf.EncodeBytes(v1.Data.XXX_UnionData[:], 18)
  1120  	}
  1121  	return buf.Bytes(), nil
  1122  }
  1123  func (m *CapoRuleCreate) Unmarshal(b []byte) error {
  1124  	buf := codec.NewBuffer(b)
  1125  	m.Rule.Af = ip_types.AddressFamily(buf.DecodeUint8())
  1126  	m.Rule.Action = CapoRuleAction(buf.DecodeUint8())
  1127  	for j1 := 0; j1 < 3; j1++ {
  1128  		m.Rule.Filters[j1].Value = buf.DecodeUint32()
  1129  		m.Rule.Filters[j1].Type = CapoRuleFilterType(buf.DecodeUint8())
  1130  		m.Rule.Filters[j1].ShouldMatch = buf.DecodeUint8()
  1131  	}
  1132  	m.Rule.NumEntries = buf.DecodeUint32()
  1133  	m.Rule.Matches = make([]CapoRuleEntry, m.Rule.NumEntries)
  1134  	for j1 := 0; j1 < len(m.Rule.Matches); j1++ {
  1135  		m.Rule.Matches[j1].IsSrc = buf.DecodeBool()
  1136  		m.Rule.Matches[j1].IsNot = buf.DecodeBool()
  1137  		m.Rule.Matches[j1].Type = CapoEntryType(buf.DecodeUint8())
  1138  		copy(m.Rule.Matches[j1].Data.XXX_UnionData[:], buf.DecodeBytes(18))
  1139  	}
  1140  	return nil
  1141  }
  1142  
  1143  // CapoRuleCreateReply defines message 'capo_rule_create_reply'.
  1144  type CapoRuleCreateReply struct {
  1145  	Retval int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
  1146  	RuleID uint32 `binapi:"u32,name=rule_id" json:"rule_id,omitempty"`
  1147  }
  1148  
  1149  func (m *CapoRuleCreateReply) Reset()               { *m = CapoRuleCreateReply{} }
  1150  func (*CapoRuleCreateReply) GetMessageName() string { return "capo_rule_create_reply" }
  1151  func (*CapoRuleCreateReply) GetCrcString() string   { return "b48f8052" }
  1152  func (*CapoRuleCreateReply) GetMessageType() api.MessageType {
  1153  	return api.ReplyMessage
  1154  }
  1155  
  1156  func (m *CapoRuleCreateReply) Size() (size int) {
  1157  	if m == nil {
  1158  		return 0
  1159  	}
  1160  	size += 4 // m.Retval
  1161  	size += 4 // m.RuleID
  1162  	return size
  1163  }
  1164  func (m *CapoRuleCreateReply) Marshal(b []byte) ([]byte, error) {
  1165  	if b == nil {
  1166  		b = make([]byte, m.Size())
  1167  	}
  1168  	buf := codec.NewBuffer(b)
  1169  	buf.EncodeInt32(m.Retval)
  1170  	buf.EncodeUint32(m.RuleID)
  1171  	return buf.Bytes(), nil
  1172  }
  1173  func (m *CapoRuleCreateReply) Unmarshal(b []byte) error {
  1174  	buf := codec.NewBuffer(b)
  1175  	m.Retval = buf.DecodeInt32()
  1176  	m.RuleID = buf.DecodeUint32()
  1177  	return nil
  1178  }
  1179  
  1180  // CapoRuleDelete defines message 'capo_rule_delete'.
  1181  type CapoRuleDelete struct {
  1182  	RuleID uint32 `binapi:"u32,name=rule_id" json:"rule_id,omitempty"`
  1183  }
  1184  
  1185  func (m *CapoRuleDelete) Reset()               { *m = CapoRuleDelete{} }
  1186  func (*CapoRuleDelete) GetMessageName() string { return "capo_rule_delete" }
  1187  func (*CapoRuleDelete) GetCrcString() string   { return "d19bb6be" }
  1188  func (*CapoRuleDelete) GetMessageType() api.MessageType {
  1189  	return api.RequestMessage
  1190  }
  1191  
  1192  func (m *CapoRuleDelete) Size() (size int) {
  1193  	if m == nil {
  1194  		return 0
  1195  	}
  1196  	size += 4 // m.RuleID
  1197  	return size
  1198  }
  1199  func (m *CapoRuleDelete) Marshal(b []byte) ([]byte, error) {
  1200  	if b == nil {
  1201  		b = make([]byte, m.Size())
  1202  	}
  1203  	buf := codec.NewBuffer(b)
  1204  	buf.EncodeUint32(m.RuleID)
  1205  	return buf.Bytes(), nil
  1206  }
  1207  func (m *CapoRuleDelete) Unmarshal(b []byte) error {
  1208  	buf := codec.NewBuffer(b)
  1209  	m.RuleID = buf.DecodeUint32()
  1210  	return nil
  1211  }
  1212  
  1213  // CapoRuleDeleteReply defines message 'capo_rule_delete_reply'.
  1214  type CapoRuleDeleteReply struct {
  1215  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
  1216  }
  1217  
  1218  func (m *CapoRuleDeleteReply) Reset()               { *m = CapoRuleDeleteReply{} }
  1219  func (*CapoRuleDeleteReply) GetMessageName() string { return "capo_rule_delete_reply" }
  1220  func (*CapoRuleDeleteReply) GetCrcString() string   { return "e8d4e804" }
  1221  func (*CapoRuleDeleteReply) GetMessageType() api.MessageType {
  1222  	return api.ReplyMessage
  1223  }
  1224  
  1225  func (m *CapoRuleDeleteReply) Size() (size int) {
  1226  	if m == nil {
  1227  		return 0
  1228  	}
  1229  	size += 4 // m.Retval
  1230  	return size
  1231  }
  1232  func (m *CapoRuleDeleteReply) Marshal(b []byte) ([]byte, error) {
  1233  	if b == nil {
  1234  		b = make([]byte, m.Size())
  1235  	}
  1236  	buf := codec.NewBuffer(b)
  1237  	buf.EncodeInt32(m.Retval)
  1238  	return buf.Bytes(), nil
  1239  }
  1240  func (m *CapoRuleDeleteReply) Unmarshal(b []byte) error {
  1241  	buf := codec.NewBuffer(b)
  1242  	m.Retval = buf.DecodeInt32()
  1243  	return nil
  1244  }
  1245  
  1246  // CapoRuleUpdate defines message 'capo_rule_update'.
  1247  type CapoRuleUpdate struct {
  1248  	RuleID uint32   `binapi:"u32,name=rule_id" json:"rule_id,omitempty"`
  1249  	Rule   CapoRule `binapi:"capo_rule,name=rule" json:"rule,omitempty"`
  1250  }
  1251  
  1252  func (m *CapoRuleUpdate) Reset()               { *m = CapoRuleUpdate{} }
  1253  func (*CapoRuleUpdate) GetMessageName() string { return "capo_rule_update" }
  1254  func (*CapoRuleUpdate) GetCrcString() string   { return "a0535ee2" }
  1255  func (*CapoRuleUpdate) GetMessageType() api.MessageType {
  1256  	return api.RequestMessage
  1257  }
  1258  
  1259  func (m *CapoRuleUpdate) Size() (size int) {
  1260  	if m == nil {
  1261  		return 0
  1262  	}
  1263  	size += 4 // m.RuleID
  1264  	size += 1 // m.Rule.Af
  1265  	size += 1 // m.Rule.Action
  1266  	for j2 := 0; j2 < 3; j2++ {
  1267  		size += 4 // m.Rule.Filters[j2].Value
  1268  		size += 1 // m.Rule.Filters[j2].Type
  1269  		size += 1 // m.Rule.Filters[j2].ShouldMatch
  1270  	}
  1271  	size += 4 // m.Rule.NumEntries
  1272  	for j2 := 0; j2 < len(m.Rule.Matches); j2++ {
  1273  		var s2 CapoRuleEntry
  1274  		_ = s2
  1275  		if j2 < len(m.Rule.Matches) {
  1276  			s2 = m.Rule.Matches[j2]
  1277  		}
  1278  		size += 1      // s2.IsSrc
  1279  		size += 1      // s2.IsNot
  1280  		size += 1      // s2.Type
  1281  		size += 1 * 18 // s2.Data
  1282  	}
  1283  	return size
  1284  }
  1285  func (m *CapoRuleUpdate) Marshal(b []byte) ([]byte, error) {
  1286  	if b == nil {
  1287  		b = make([]byte, m.Size())
  1288  	}
  1289  	buf := codec.NewBuffer(b)
  1290  	buf.EncodeUint32(m.RuleID)
  1291  	buf.EncodeUint8(uint8(m.Rule.Af))
  1292  	buf.EncodeUint8(uint8(m.Rule.Action))
  1293  	for j1 := 0; j1 < 3; j1++ {
  1294  		buf.EncodeUint32(m.Rule.Filters[j1].Value)
  1295  		buf.EncodeUint8(uint8(m.Rule.Filters[j1].Type))
  1296  		buf.EncodeUint8(m.Rule.Filters[j1].ShouldMatch)
  1297  	}
  1298  	buf.EncodeUint32(uint32(len(m.Rule.Matches)))
  1299  	for j1 := 0; j1 < len(m.Rule.Matches); j1++ {
  1300  		var v1 CapoRuleEntry // Matches
  1301  		if j1 < len(m.Rule.Matches) {
  1302  			v1 = m.Rule.Matches[j1]
  1303  		}
  1304  		buf.EncodeBool(v1.IsSrc)
  1305  		buf.EncodeBool(v1.IsNot)
  1306  		buf.EncodeUint8(uint8(v1.Type))
  1307  		buf.EncodeBytes(v1.Data.XXX_UnionData[:], 18)
  1308  	}
  1309  	return buf.Bytes(), nil
  1310  }
  1311  func (m *CapoRuleUpdate) Unmarshal(b []byte) error {
  1312  	buf := codec.NewBuffer(b)
  1313  	m.RuleID = buf.DecodeUint32()
  1314  	m.Rule.Af = ip_types.AddressFamily(buf.DecodeUint8())
  1315  	m.Rule.Action = CapoRuleAction(buf.DecodeUint8())
  1316  	for j1 := 0; j1 < 3; j1++ {
  1317  		m.Rule.Filters[j1].Value = buf.DecodeUint32()
  1318  		m.Rule.Filters[j1].Type = CapoRuleFilterType(buf.DecodeUint8())
  1319  		m.Rule.Filters[j1].ShouldMatch = buf.DecodeUint8()
  1320  	}
  1321  	m.Rule.NumEntries = buf.DecodeUint32()
  1322  	m.Rule.Matches = make([]CapoRuleEntry, m.Rule.NumEntries)
  1323  	for j1 := 0; j1 < len(m.Rule.Matches); j1++ {
  1324  		m.Rule.Matches[j1].IsSrc = buf.DecodeBool()
  1325  		m.Rule.Matches[j1].IsNot = buf.DecodeBool()
  1326  		m.Rule.Matches[j1].Type = CapoEntryType(buf.DecodeUint8())
  1327  		copy(m.Rule.Matches[j1].Data.XXX_UnionData[:], buf.DecodeBytes(18))
  1328  	}
  1329  	return nil
  1330  }
  1331  
  1332  // CapoRuleUpdateReply defines message 'capo_rule_update_reply'.
  1333  type CapoRuleUpdateReply struct {
  1334  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
  1335  }
  1336  
  1337  func (m *CapoRuleUpdateReply) Reset()               { *m = CapoRuleUpdateReply{} }
  1338  func (*CapoRuleUpdateReply) GetMessageName() string { return "capo_rule_update_reply" }
  1339  func (*CapoRuleUpdateReply) GetCrcString() string   { return "e8d4e804" }
  1340  func (*CapoRuleUpdateReply) GetMessageType() api.MessageType {
  1341  	return api.ReplyMessage
  1342  }
  1343  
  1344  func (m *CapoRuleUpdateReply) Size() (size int) {
  1345  	if m == nil {
  1346  		return 0
  1347  	}
  1348  	size += 4 // m.Retval
  1349  	return size
  1350  }
  1351  func (m *CapoRuleUpdateReply) Marshal(b []byte) ([]byte, error) {
  1352  	if b == nil {
  1353  		b = make([]byte, m.Size())
  1354  	}
  1355  	buf := codec.NewBuffer(b)
  1356  	buf.EncodeInt32(m.Retval)
  1357  	return buf.Bytes(), nil
  1358  }
  1359  func (m *CapoRuleUpdateReply) Unmarshal(b []byte) error {
  1360  	buf := codec.NewBuffer(b)
  1361  	m.Retval = buf.DecodeInt32()
  1362  	return nil
  1363  }
  1364  
  1365  func init() { file_capo_binapi_init() }
  1366  func file_capo_binapi_init() {
  1367  	api.RegisterMessage((*CapoConfigurePolicies)(nil), "capo_configure_policies_743e3c30")
  1368  	api.RegisterMessage((*CapoConfigurePoliciesReply)(nil), "capo_configure_policies_reply_e8d4e804")
  1369  	api.RegisterMessage((*CapoControlPing)(nil), "capo_control_ping_51077d14")
  1370  	api.RegisterMessage((*CapoControlPingReply)(nil), "capo_control_ping_reply_f6b0b8ca")
  1371  	api.RegisterMessage((*CapoGetVersion)(nil), "capo_get_version_51077d14")
  1372  	api.RegisterMessage((*CapoGetVersionReply)(nil), "capo_get_version_reply_9b32cf86")
  1373  	api.RegisterMessage((*CapoIpsetAddDelMembers)(nil), "capo_ipset_add_del_members_e7056d10")
  1374  	api.RegisterMessage((*CapoIpsetAddDelMembersReply)(nil), "capo_ipset_add_del_members_reply_e8d4e804")
  1375  	api.RegisterMessage((*CapoIpsetCreate)(nil), "capo_ipset_create_69150c8a")
  1376  	api.RegisterMessage((*CapoIpsetCreateReply)(nil), "capo_ipset_create_reply_6a43f193")
  1377  	api.RegisterMessage((*CapoIpsetDelete)(nil), "capo_ipset_delete_ceacdbcb")
  1378  	api.RegisterMessage((*CapoIpsetDeleteReply)(nil), "capo_ipset_delete_reply_e8d4e804")
  1379  	api.RegisterMessage((*CapoPolicyCreate)(nil), "capo_policy_create_f7ed31a8")
  1380  	api.RegisterMessage((*CapoPolicyCreateReply)(nil), "capo_policy_create_reply_90f27405")
  1381  	api.RegisterMessage((*CapoPolicyDelete)(nil), "capo_policy_delete_ad833868")
  1382  	api.RegisterMessage((*CapoPolicyDeleteReply)(nil), "capo_policy_delete_reply_e8d4e804")
  1383  	api.RegisterMessage((*CapoPolicyUpdate)(nil), "capo_policy_update_e2097dd0")
  1384  	api.RegisterMessage((*CapoPolicyUpdateReply)(nil), "capo_policy_update_reply_e8d4e804")
  1385  	api.RegisterMessage((*CapoRuleCreate)(nil), "capo_rule_create_0a2d5fd6")
  1386  	api.RegisterMessage((*CapoRuleCreateReply)(nil), "capo_rule_create_reply_b48f8052")
  1387  	api.RegisterMessage((*CapoRuleDelete)(nil), "capo_rule_delete_d19bb6be")
  1388  	api.RegisterMessage((*CapoRuleDeleteReply)(nil), "capo_rule_delete_reply_e8d4e804")
  1389  	api.RegisterMessage((*CapoRuleUpdate)(nil), "capo_rule_update_a0535ee2")
  1390  	api.RegisterMessage((*CapoRuleUpdateReply)(nil), "capo_rule_update_reply_e8d4e804")
  1391  }
  1392  
  1393  // Messages returns list of all messages in this module.
  1394  func AllMessages() []api.Message {
  1395  	return []api.Message{
  1396  		(*CapoConfigurePolicies)(nil),
  1397  		(*CapoConfigurePoliciesReply)(nil),
  1398  		(*CapoControlPing)(nil),
  1399  		(*CapoControlPingReply)(nil),
  1400  		(*CapoGetVersion)(nil),
  1401  		(*CapoGetVersionReply)(nil),
  1402  		(*CapoIpsetAddDelMembers)(nil),
  1403  		(*CapoIpsetAddDelMembersReply)(nil),
  1404  		(*CapoIpsetCreate)(nil),
  1405  		(*CapoIpsetCreateReply)(nil),
  1406  		(*CapoIpsetDelete)(nil),
  1407  		(*CapoIpsetDeleteReply)(nil),
  1408  		(*CapoPolicyCreate)(nil),
  1409  		(*CapoPolicyCreateReply)(nil),
  1410  		(*CapoPolicyDelete)(nil),
  1411  		(*CapoPolicyDeleteReply)(nil),
  1412  		(*CapoPolicyUpdate)(nil),
  1413  		(*CapoPolicyUpdateReply)(nil),
  1414  		(*CapoRuleCreate)(nil),
  1415  		(*CapoRuleCreateReply)(nil),
  1416  		(*CapoRuleDelete)(nil),
  1417  		(*CapoRuleDeleteReply)(nil),
  1418  		(*CapoRuleUpdate)(nil),
  1419  		(*CapoRuleUpdateReply)(nil),
  1420  	}
  1421  }