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