github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/lb/lb.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/lb.api.json 6 7 // Package lb contains generated bindings for API file lb.api. 8 // 9 // Contents: 10 // - 18 messages 11 package lb 12 13 import ( 14 interface_types "github.com/networkservicemesh/govpp/binapi/interface_types" 15 ip_types "github.com/networkservicemesh/govpp/binapi/ip_types" 16 lb_types "github.com/networkservicemesh/govpp/binapi/lb_types" 17 api "go.fd.io/govpp/api" 18 codec "go.fd.io/govpp/codec" 19 ) 20 21 // This is a compile-time assertion to ensure that this generated file 22 // is compatible with the GoVPP api package it is being compiled against. 23 // A compilation error at this line likely means your copy of the 24 // GoVPP api package needs to be updated. 25 const _ = api.GoVppAPIPackageIsVersion2 26 27 const ( 28 APIFile = "lb" 29 APIVersion = "1.1.0" 30 VersionCrc = 0x49e3c1c1 31 ) 32 33 // Add an application server for a given VIP 34 // - pfx - ip prefix and length 35 // - protocol - tcp or udp. 36 // - port - destination port. 37 // - as_address - The application server address (IPv4 in lower order 32 bits). 38 // - is_del - The AS should be removed. 39 // - is_flush - The sessions related to this AS should be flushed. 40 // 41 // LbAddDelAs defines message 'lb_add_del_as'. 42 type LbAddDelAs struct { 43 Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"` 44 Protocol uint8 `binapi:"u8,name=protocol,default=255" json:"protocol,omitempty"` 45 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` 46 AsAddress ip_types.Address `binapi:"address,name=as_address" json:"as_address,omitempty"` 47 IsDel bool `binapi:"bool,name=is_del" json:"is_del,omitempty"` 48 IsFlush bool `binapi:"bool,name=is_flush" json:"is_flush,omitempty"` 49 } 50 51 func (m *LbAddDelAs) Reset() { *m = LbAddDelAs{} } 52 func (*LbAddDelAs) GetMessageName() string { return "lb_add_del_as" } 53 func (*LbAddDelAs) GetCrcString() string { return "35d72500" } 54 func (*LbAddDelAs) GetMessageType() api.MessageType { 55 return api.RequestMessage 56 } 57 58 func (m *LbAddDelAs) Size() (size int) { 59 if m == nil { 60 return 0 61 } 62 size += 1 // m.Pfx.Address.Af 63 size += 1 * 16 // m.Pfx.Address.Un 64 size += 1 // m.Pfx.Len 65 size += 1 // m.Protocol 66 size += 2 // m.Port 67 size += 1 // m.AsAddress.Af 68 size += 1 * 16 // m.AsAddress.Un 69 size += 1 // m.IsDel 70 size += 1 // m.IsFlush 71 return size 72 } 73 func (m *LbAddDelAs) Marshal(b []byte) ([]byte, error) { 74 if b == nil { 75 b = make([]byte, m.Size()) 76 } 77 buf := codec.NewBuffer(b) 78 buf.EncodeUint8(uint8(m.Pfx.Address.Af)) 79 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16) 80 buf.EncodeUint8(m.Pfx.Len) 81 buf.EncodeUint8(m.Protocol) 82 buf.EncodeUint16(m.Port) 83 buf.EncodeUint8(uint8(m.AsAddress.Af)) 84 buf.EncodeBytes(m.AsAddress.Un.XXX_UnionData[:], 16) 85 buf.EncodeBool(m.IsDel) 86 buf.EncodeBool(m.IsFlush) 87 return buf.Bytes(), nil 88 } 89 func (m *LbAddDelAs) Unmarshal(b []byte) error { 90 buf := codec.NewBuffer(b) 91 m.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) 92 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 93 m.Pfx.Len = buf.DecodeUint8() 94 m.Protocol = buf.DecodeUint8() 95 m.Port = buf.DecodeUint16() 96 m.AsAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) 97 copy(m.AsAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 98 m.IsDel = buf.DecodeBool() 99 m.IsFlush = buf.DecodeBool() 100 return nil 101 } 102 103 // LbAddDelAsReply defines message 'lb_add_del_as_reply'. 104 type LbAddDelAsReply struct { 105 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 106 } 107 108 func (m *LbAddDelAsReply) Reset() { *m = LbAddDelAsReply{} } 109 func (*LbAddDelAsReply) GetMessageName() string { return "lb_add_del_as_reply" } 110 func (*LbAddDelAsReply) GetCrcString() string { return "e8d4e804" } 111 func (*LbAddDelAsReply) GetMessageType() api.MessageType { 112 return api.ReplyMessage 113 } 114 115 func (m *LbAddDelAsReply) Size() (size int) { 116 if m == nil { 117 return 0 118 } 119 size += 4 // m.Retval 120 return size 121 } 122 func (m *LbAddDelAsReply) Marshal(b []byte) ([]byte, error) { 123 if b == nil { 124 b = make([]byte, m.Size()) 125 } 126 buf := codec.NewBuffer(b) 127 buf.EncodeInt32(m.Retval) 128 return buf.Bytes(), nil 129 } 130 func (m *LbAddDelAsReply) Unmarshal(b []byte) error { 131 buf := codec.NewBuffer(b) 132 m.Retval = buf.DecodeInt32() 133 return nil 134 } 135 136 // Enable/disable NAT4 feature on the interface 137 // - is_add - true if add, false if delete 138 // - sw_if_index - software index of the interface 139 // 140 // LbAddDelIntfNat4 defines message 'lb_add_del_intf_nat4'. 141 type LbAddDelIntfNat4 struct { 142 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` 143 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 144 } 145 146 func (m *LbAddDelIntfNat4) Reset() { *m = LbAddDelIntfNat4{} } 147 func (*LbAddDelIntfNat4) GetMessageName() string { return "lb_add_del_intf_nat4" } 148 func (*LbAddDelIntfNat4) GetCrcString() string { return "47d6e753" } 149 func (*LbAddDelIntfNat4) GetMessageType() api.MessageType { 150 return api.RequestMessage 151 } 152 153 func (m *LbAddDelIntfNat4) Size() (size int) { 154 if m == nil { 155 return 0 156 } 157 size += 1 // m.IsAdd 158 size += 4 // m.SwIfIndex 159 return size 160 } 161 func (m *LbAddDelIntfNat4) Marshal(b []byte) ([]byte, error) { 162 if b == nil { 163 b = make([]byte, m.Size()) 164 } 165 buf := codec.NewBuffer(b) 166 buf.EncodeBool(m.IsAdd) 167 buf.EncodeUint32(uint32(m.SwIfIndex)) 168 return buf.Bytes(), nil 169 } 170 func (m *LbAddDelIntfNat4) Unmarshal(b []byte) error { 171 buf := codec.NewBuffer(b) 172 m.IsAdd = buf.DecodeBool() 173 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 174 return nil 175 } 176 177 // LbAddDelIntfNat4Reply defines message 'lb_add_del_intf_nat4_reply'. 178 type LbAddDelIntfNat4Reply struct { 179 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 180 } 181 182 func (m *LbAddDelIntfNat4Reply) Reset() { *m = LbAddDelIntfNat4Reply{} } 183 func (*LbAddDelIntfNat4Reply) GetMessageName() string { return "lb_add_del_intf_nat4_reply" } 184 func (*LbAddDelIntfNat4Reply) GetCrcString() string { return "e8d4e804" } 185 func (*LbAddDelIntfNat4Reply) GetMessageType() api.MessageType { 186 return api.ReplyMessage 187 } 188 189 func (m *LbAddDelIntfNat4Reply) Size() (size int) { 190 if m == nil { 191 return 0 192 } 193 size += 4 // m.Retval 194 return size 195 } 196 func (m *LbAddDelIntfNat4Reply) Marshal(b []byte) ([]byte, error) { 197 if b == nil { 198 b = make([]byte, m.Size()) 199 } 200 buf := codec.NewBuffer(b) 201 buf.EncodeInt32(m.Retval) 202 return buf.Bytes(), nil 203 } 204 func (m *LbAddDelIntfNat4Reply) Unmarshal(b []byte) error { 205 buf := codec.NewBuffer(b) 206 m.Retval = buf.DecodeInt32() 207 return nil 208 } 209 210 // Enable/disable NAT6 feature on the interface 211 // - is_add - true if add, false if delete 212 // - sw_if_index - software index of the interface 213 // 214 // LbAddDelIntfNat6 defines message 'lb_add_del_intf_nat6'. 215 type LbAddDelIntfNat6 struct { 216 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` 217 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 218 } 219 220 func (m *LbAddDelIntfNat6) Reset() { *m = LbAddDelIntfNat6{} } 221 func (*LbAddDelIntfNat6) GetMessageName() string { return "lb_add_del_intf_nat6" } 222 func (*LbAddDelIntfNat6) GetCrcString() string { return "47d6e753" } 223 func (*LbAddDelIntfNat6) GetMessageType() api.MessageType { 224 return api.RequestMessage 225 } 226 227 func (m *LbAddDelIntfNat6) Size() (size int) { 228 if m == nil { 229 return 0 230 } 231 size += 1 // m.IsAdd 232 size += 4 // m.SwIfIndex 233 return size 234 } 235 func (m *LbAddDelIntfNat6) Marshal(b []byte) ([]byte, error) { 236 if b == nil { 237 b = make([]byte, m.Size()) 238 } 239 buf := codec.NewBuffer(b) 240 buf.EncodeBool(m.IsAdd) 241 buf.EncodeUint32(uint32(m.SwIfIndex)) 242 return buf.Bytes(), nil 243 } 244 func (m *LbAddDelIntfNat6) Unmarshal(b []byte) error { 245 buf := codec.NewBuffer(b) 246 m.IsAdd = buf.DecodeBool() 247 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 248 return nil 249 } 250 251 // LbAddDelIntfNat6Reply defines message 'lb_add_del_intf_nat6_reply'. 252 type LbAddDelIntfNat6Reply struct { 253 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 254 } 255 256 func (m *LbAddDelIntfNat6Reply) Reset() { *m = LbAddDelIntfNat6Reply{} } 257 func (*LbAddDelIntfNat6Reply) GetMessageName() string { return "lb_add_del_intf_nat6_reply" } 258 func (*LbAddDelIntfNat6Reply) GetCrcString() string { return "e8d4e804" } 259 func (*LbAddDelIntfNat6Reply) GetMessageType() api.MessageType { 260 return api.ReplyMessage 261 } 262 263 func (m *LbAddDelIntfNat6Reply) Size() (size int) { 264 if m == nil { 265 return 0 266 } 267 size += 4 // m.Retval 268 return size 269 } 270 func (m *LbAddDelIntfNat6Reply) Marshal(b []byte) ([]byte, error) { 271 if b == nil { 272 b = make([]byte, m.Size()) 273 } 274 buf := codec.NewBuffer(b) 275 buf.EncodeInt32(m.Retval) 276 return buf.Bytes(), nil 277 } 278 func (m *LbAddDelIntfNat6Reply) Unmarshal(b []byte) error { 279 buf := codec.NewBuffer(b) 280 m.Retval = buf.DecodeInt32() 281 return nil 282 } 283 284 // Add a virtual address (or prefix) 285 // - pfx - ip prefix and length 286 // - protocol - tcp or udp. 287 // - port - destination port. (0) means 'all-port VIP' 288 // - encap - Encap is ip4 GRE(0) or ip6 GRE(1) or L3DSR(2) or NAT4(3) or NAT6(4). 289 // - dscp - DSCP bit corresponding to VIP(applicable in L3DSR mode only). 290 // - type - service type(applicable in NAT4/NAT6 mode only). 291 // - target_port - Pod's port corresponding to specific service(applicable in NAT4/NAT6 mode only). 292 // - node_port - Node's port(applicable in NAT4/NAT6 mode only). 293 // - new_flows_table_length - Size of the new connections flow table used 294 // for this VIP (must be power of 2). 295 // - is_del - The VIP should be removed. 296 // 297 // LbAddDelVip defines message 'lb_add_del_vip'. 298 type LbAddDelVip struct { 299 Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"` 300 Protocol uint8 `binapi:"u8,name=protocol,default=255" json:"protocol,omitempty"` 301 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` 302 Encap lb_types.LbEncapType `binapi:"lb_encap_type,name=encap" json:"encap,omitempty"` 303 Dscp uint8 `binapi:"u8,name=dscp" json:"dscp,omitempty"` 304 Type lb_types.LbSrvType `binapi:"lb_srv_type,name=type" json:"type,omitempty"` 305 TargetPort uint16 `binapi:"u16,name=target_port" json:"target_port,omitempty"` 306 NodePort uint16 `binapi:"u16,name=node_port" json:"node_port,omitempty"` 307 NewFlowsTableLength uint32 `binapi:"u32,name=new_flows_table_length,default=1024" json:"new_flows_table_length,omitempty"` 308 IsDel bool `binapi:"bool,name=is_del" json:"is_del,omitempty"` 309 } 310 311 func (m *LbAddDelVip) Reset() { *m = LbAddDelVip{} } 312 func (*LbAddDelVip) GetMessageName() string { return "lb_add_del_vip" } 313 func (*LbAddDelVip) GetCrcString() string { return "6fa569c7" } 314 func (*LbAddDelVip) GetMessageType() api.MessageType { 315 return api.RequestMessage 316 } 317 318 func (m *LbAddDelVip) Size() (size int) { 319 if m == nil { 320 return 0 321 } 322 size += 1 // m.Pfx.Address.Af 323 size += 1 * 16 // m.Pfx.Address.Un 324 size += 1 // m.Pfx.Len 325 size += 1 // m.Protocol 326 size += 2 // m.Port 327 size += 4 // m.Encap 328 size += 1 // m.Dscp 329 size += 4 // m.Type 330 size += 2 // m.TargetPort 331 size += 2 // m.NodePort 332 size += 4 // m.NewFlowsTableLength 333 size += 1 // m.IsDel 334 return size 335 } 336 func (m *LbAddDelVip) Marshal(b []byte) ([]byte, error) { 337 if b == nil { 338 b = make([]byte, m.Size()) 339 } 340 buf := codec.NewBuffer(b) 341 buf.EncodeUint8(uint8(m.Pfx.Address.Af)) 342 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16) 343 buf.EncodeUint8(m.Pfx.Len) 344 buf.EncodeUint8(m.Protocol) 345 buf.EncodeUint16(m.Port) 346 buf.EncodeUint32(uint32(m.Encap)) 347 buf.EncodeUint8(m.Dscp) 348 buf.EncodeUint32(uint32(m.Type)) 349 buf.EncodeUint16(m.TargetPort) 350 buf.EncodeUint16(m.NodePort) 351 buf.EncodeUint32(m.NewFlowsTableLength) 352 buf.EncodeBool(m.IsDel) 353 return buf.Bytes(), nil 354 } 355 func (m *LbAddDelVip) Unmarshal(b []byte) error { 356 buf := codec.NewBuffer(b) 357 m.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) 358 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 359 m.Pfx.Len = buf.DecodeUint8() 360 m.Protocol = buf.DecodeUint8() 361 m.Port = buf.DecodeUint16() 362 m.Encap = lb_types.LbEncapType(buf.DecodeUint32()) 363 m.Dscp = buf.DecodeUint8() 364 m.Type = lb_types.LbSrvType(buf.DecodeUint32()) 365 m.TargetPort = buf.DecodeUint16() 366 m.NodePort = buf.DecodeUint16() 367 m.NewFlowsTableLength = buf.DecodeUint32() 368 m.IsDel = buf.DecodeBool() 369 return nil 370 } 371 372 // LbAddDelVipReply defines message 'lb_add_del_vip_reply'. 373 type LbAddDelVipReply struct { 374 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 375 } 376 377 func (m *LbAddDelVipReply) Reset() { *m = LbAddDelVipReply{} } 378 func (*LbAddDelVipReply) GetMessageName() string { return "lb_add_del_vip_reply" } 379 func (*LbAddDelVipReply) GetCrcString() string { return "e8d4e804" } 380 func (*LbAddDelVipReply) GetMessageType() api.MessageType { 381 return api.ReplyMessage 382 } 383 384 func (m *LbAddDelVipReply) Size() (size int) { 385 if m == nil { 386 return 0 387 } 388 size += 4 // m.Retval 389 return size 390 } 391 func (m *LbAddDelVipReply) Marshal(b []byte) ([]byte, error) { 392 if b == nil { 393 b = make([]byte, m.Size()) 394 } 395 buf := codec.NewBuffer(b) 396 buf.EncodeInt32(m.Retval) 397 return buf.Bytes(), nil 398 } 399 func (m *LbAddDelVipReply) Unmarshal(b []byte) error { 400 buf := codec.NewBuffer(b) 401 m.Retval = buf.DecodeInt32() 402 return nil 403 } 404 405 // Add a virtual address (or prefix) 406 // - pfx - ip prefix and length 407 // - protocol - tcp or udp. 408 // - port - destination port. (0) means 'all-port VIP' 409 // - encap - Encap is ip4 GRE(0) or ip6 GRE(1) or L3DSR(2) or NAT4(3) or NAT6(4). 410 // - dscp - DSCP bit corresponding to VIP(applicable in L3DSR mode only). 411 // - type - service type(applicable in NAT4/NAT6 mode only). 412 // - target_port - Pod's port corresponding to specific service(applicable in NAT4/NAT6 mode only). 413 // - node_port - Node's port(applicable in NAT4/NAT6 mode only). 414 // - new_flows_table_length - Size of the new connections flow table used 415 // for this VIP (must be power of 2). 416 // - src_ip_sticky - source ip based sticky session. 417 // - is_del - The VIP should be removed. 418 // 419 // LbAddDelVipV2 defines message 'lb_add_del_vip_v2'. 420 type LbAddDelVipV2 struct { 421 Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"` 422 Protocol uint8 `binapi:"u8,name=protocol,default=255" json:"protocol,omitempty"` 423 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` 424 Encap lb_types.LbEncapType `binapi:"lb_encap_type,name=encap" json:"encap,omitempty"` 425 Dscp uint8 `binapi:"u8,name=dscp" json:"dscp,omitempty"` 426 Type lb_types.LbSrvType `binapi:"lb_srv_type,name=type" json:"type,omitempty"` 427 TargetPort uint16 `binapi:"u16,name=target_port" json:"target_port,omitempty"` 428 NodePort uint16 `binapi:"u16,name=node_port" json:"node_port,omitempty"` 429 NewFlowsTableLength uint32 `binapi:"u32,name=new_flows_table_length,default=1024" json:"new_flows_table_length,omitempty"` 430 SrcIPSticky bool `binapi:"bool,name=src_ip_sticky" json:"src_ip_sticky,omitempty"` 431 IsDel bool `binapi:"bool,name=is_del" json:"is_del,omitempty"` 432 } 433 434 func (m *LbAddDelVipV2) Reset() { *m = LbAddDelVipV2{} } 435 func (*LbAddDelVipV2) GetMessageName() string { return "lb_add_del_vip_v2" } 436 func (*LbAddDelVipV2) GetCrcString() string { return "7c520e0f" } 437 func (*LbAddDelVipV2) GetMessageType() api.MessageType { 438 return api.RequestMessage 439 } 440 441 func (m *LbAddDelVipV2) Size() (size int) { 442 if m == nil { 443 return 0 444 } 445 size += 1 // m.Pfx.Address.Af 446 size += 1 * 16 // m.Pfx.Address.Un 447 size += 1 // m.Pfx.Len 448 size += 1 // m.Protocol 449 size += 2 // m.Port 450 size += 4 // m.Encap 451 size += 1 // m.Dscp 452 size += 4 // m.Type 453 size += 2 // m.TargetPort 454 size += 2 // m.NodePort 455 size += 4 // m.NewFlowsTableLength 456 size += 1 // m.SrcIPSticky 457 size += 1 // m.IsDel 458 return size 459 } 460 func (m *LbAddDelVipV2) Marshal(b []byte) ([]byte, error) { 461 if b == nil { 462 b = make([]byte, m.Size()) 463 } 464 buf := codec.NewBuffer(b) 465 buf.EncodeUint8(uint8(m.Pfx.Address.Af)) 466 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16) 467 buf.EncodeUint8(m.Pfx.Len) 468 buf.EncodeUint8(m.Protocol) 469 buf.EncodeUint16(m.Port) 470 buf.EncodeUint32(uint32(m.Encap)) 471 buf.EncodeUint8(m.Dscp) 472 buf.EncodeUint32(uint32(m.Type)) 473 buf.EncodeUint16(m.TargetPort) 474 buf.EncodeUint16(m.NodePort) 475 buf.EncodeUint32(m.NewFlowsTableLength) 476 buf.EncodeBool(m.SrcIPSticky) 477 buf.EncodeBool(m.IsDel) 478 return buf.Bytes(), nil 479 } 480 func (m *LbAddDelVipV2) Unmarshal(b []byte) error { 481 buf := codec.NewBuffer(b) 482 m.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) 483 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 484 m.Pfx.Len = buf.DecodeUint8() 485 m.Protocol = buf.DecodeUint8() 486 m.Port = buf.DecodeUint16() 487 m.Encap = lb_types.LbEncapType(buf.DecodeUint32()) 488 m.Dscp = buf.DecodeUint8() 489 m.Type = lb_types.LbSrvType(buf.DecodeUint32()) 490 m.TargetPort = buf.DecodeUint16() 491 m.NodePort = buf.DecodeUint16() 492 m.NewFlowsTableLength = buf.DecodeUint32() 493 m.SrcIPSticky = buf.DecodeBool() 494 m.IsDel = buf.DecodeBool() 495 return nil 496 } 497 498 // LbAddDelVipV2Reply defines message 'lb_add_del_vip_v2_reply'. 499 type LbAddDelVipV2Reply struct { 500 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 501 } 502 503 func (m *LbAddDelVipV2Reply) Reset() { *m = LbAddDelVipV2Reply{} } 504 func (*LbAddDelVipV2Reply) GetMessageName() string { return "lb_add_del_vip_v2_reply" } 505 func (*LbAddDelVipV2Reply) GetCrcString() string { return "e8d4e804" } 506 func (*LbAddDelVipV2Reply) GetMessageType() api.MessageType { 507 return api.ReplyMessage 508 } 509 510 func (m *LbAddDelVipV2Reply) Size() (size int) { 511 if m == nil { 512 return 0 513 } 514 size += 4 // m.Retval 515 return size 516 } 517 func (m *LbAddDelVipV2Reply) Marshal(b []byte) ([]byte, error) { 518 if b == nil { 519 b = make([]byte, m.Size()) 520 } 521 buf := codec.NewBuffer(b) 522 buf.EncodeInt32(m.Retval) 523 return buf.Bytes(), nil 524 } 525 func (m *LbAddDelVipV2Reply) Unmarshal(b []byte) error { 526 buf := codec.NewBuffer(b) 527 m.Retval = buf.DecodeInt32() 528 return nil 529 } 530 531 // lb_as_details 532 // - as - AS detail record 533 // 534 // LbAsDetails defines message 'lb_as_details'. 535 type LbAsDetails struct { 536 Vip lb_types.LbVip `binapi:"lb_vip,name=vip" json:"vip,omitempty"` 537 AppSrv ip_types.Address `binapi:"address,name=app_srv" json:"app_srv,omitempty"` 538 Flags uint8 `binapi:"u8,name=flags" json:"flags,omitempty"` 539 InUseSince uint32 `binapi:"u32,name=in_use_since" json:"in_use_since,omitempty"` 540 } 541 542 func (m *LbAsDetails) Reset() { *m = LbAsDetails{} } 543 func (*LbAsDetails) GetMessageName() string { return "lb_as_details" } 544 func (*LbAsDetails) GetCrcString() string { return "8d24c29e" } 545 func (*LbAsDetails) GetMessageType() api.MessageType { 546 return api.ReplyMessage 547 } 548 549 func (m *LbAsDetails) Size() (size int) { 550 if m == nil { 551 return 0 552 } 553 size += 1 // m.Vip.Pfx.Address.Af 554 size += 1 * 16 // m.Vip.Pfx.Address.Un 555 size += 1 // m.Vip.Pfx.Len 556 size += 1 // m.Vip.Protocol 557 size += 2 // m.Vip.Port 558 size += 1 // m.AppSrv.Af 559 size += 1 * 16 // m.AppSrv.Un 560 size += 1 // m.Flags 561 size += 4 // m.InUseSince 562 return size 563 } 564 func (m *LbAsDetails) Marshal(b []byte) ([]byte, error) { 565 if b == nil { 566 b = make([]byte, m.Size()) 567 } 568 buf := codec.NewBuffer(b) 569 buf.EncodeUint8(uint8(m.Vip.Pfx.Address.Af)) 570 buf.EncodeBytes(m.Vip.Pfx.Address.Un.XXX_UnionData[:], 16) 571 buf.EncodeUint8(m.Vip.Pfx.Len) 572 buf.EncodeUint8(uint8(m.Vip.Protocol)) 573 buf.EncodeUint16(m.Vip.Port) 574 buf.EncodeUint8(uint8(m.AppSrv.Af)) 575 buf.EncodeBytes(m.AppSrv.Un.XXX_UnionData[:], 16) 576 buf.EncodeUint8(m.Flags) 577 buf.EncodeUint32(m.InUseSince) 578 return buf.Bytes(), nil 579 } 580 func (m *LbAsDetails) Unmarshal(b []byte) error { 581 buf := codec.NewBuffer(b) 582 m.Vip.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) 583 copy(m.Vip.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 584 m.Vip.Pfx.Len = buf.DecodeUint8() 585 m.Vip.Protocol = ip_types.IPProto(buf.DecodeUint8()) 586 m.Vip.Port = buf.DecodeUint16() 587 m.AppSrv.Af = ip_types.AddressFamily(buf.DecodeUint8()) 588 copy(m.AppSrv.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 589 m.Flags = buf.DecodeUint8() 590 m.InUseSince = buf.DecodeUint32() 591 return nil 592 } 593 594 // dump AS list per VIP or all ASs for all VIPs 595 // - pfx - ip prefix and length. 596 // - protocol - tcp or udp. 597 // - port - destination port. 598 // 599 // LbAsDump defines message 'lb_as_dump'. 600 type LbAsDump struct { 601 Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"` 602 Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` 603 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` 604 } 605 606 func (m *LbAsDump) Reset() { *m = LbAsDump{} } 607 func (*LbAsDump) GetMessageName() string { return "lb_as_dump" } 608 func (*LbAsDump) GetCrcString() string { return "1063f819" } 609 func (*LbAsDump) GetMessageType() api.MessageType { 610 return api.RequestMessage 611 } 612 613 func (m *LbAsDump) Size() (size int) { 614 if m == nil { 615 return 0 616 } 617 size += 1 // m.Pfx.Address.Af 618 size += 1 * 16 // m.Pfx.Address.Un 619 size += 1 // m.Pfx.Len 620 size += 1 // m.Protocol 621 size += 2 // m.Port 622 return size 623 } 624 func (m *LbAsDump) Marshal(b []byte) ([]byte, error) { 625 if b == nil { 626 b = make([]byte, m.Size()) 627 } 628 buf := codec.NewBuffer(b) 629 buf.EncodeUint8(uint8(m.Pfx.Address.Af)) 630 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16) 631 buf.EncodeUint8(m.Pfx.Len) 632 buf.EncodeUint8(m.Protocol) 633 buf.EncodeUint16(m.Port) 634 return buf.Bytes(), nil 635 } 636 func (m *LbAsDump) Unmarshal(b []byte) error { 637 buf := codec.NewBuffer(b) 638 m.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) 639 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 640 m.Pfx.Len = buf.DecodeUint8() 641 m.Protocol = buf.DecodeUint8() 642 m.Port = buf.DecodeUint16() 643 return nil 644 } 645 646 // Configure Load-Balancer global parameters (unlike the CLI, both ip4_src_address and ip6_src_address need to be specified. 647 // - ip4_src_address - IPv4 address to be used as source for IPv4 traffic(applicable in GRE4/GRE6/NAT4/NAT6 mode only). 648 // - ip6_src_address - IPv6 address to be used as source for IPv6 traffic(applicable in GRE4/GRE6/NAT4/NAT6 mode only). 649 // - sticky_buckets_per_core - Number of buckets *per worker thread* in the 650 // established flow table (must be power of 2). 651 // - flow_timeout - Time in seconds after which, if no packet is received 652 // for a given flow, the flow is removed from the established flow table. 653 // 654 // LbConf defines message 'lb_conf'. 655 type LbConf struct { 656 IP4SrcAddress ip_types.IP4Address `binapi:"ip4_address,name=ip4_src_address" json:"ip4_src_address,omitempty"` 657 IP6SrcAddress ip_types.IP6Address `binapi:"ip6_address,name=ip6_src_address" json:"ip6_src_address,omitempty"` 658 StickyBucketsPerCore uint32 `binapi:"u32,name=sticky_buckets_per_core,default=4294967295" json:"sticky_buckets_per_core,omitempty"` 659 FlowTimeout uint32 `binapi:"u32,name=flow_timeout,default=4294967295" json:"flow_timeout,omitempty"` 660 } 661 662 func (m *LbConf) Reset() { *m = LbConf{} } 663 func (*LbConf) GetMessageName() string { return "lb_conf" } 664 func (*LbConf) GetCrcString() string { return "56cd3261" } 665 func (*LbConf) GetMessageType() api.MessageType { 666 return api.RequestMessage 667 } 668 669 func (m *LbConf) Size() (size int) { 670 if m == nil { 671 return 0 672 } 673 size += 1 * 4 // m.IP4SrcAddress 674 size += 1 * 16 // m.IP6SrcAddress 675 size += 4 // m.StickyBucketsPerCore 676 size += 4 // m.FlowTimeout 677 return size 678 } 679 func (m *LbConf) Marshal(b []byte) ([]byte, error) { 680 if b == nil { 681 b = make([]byte, m.Size()) 682 } 683 buf := codec.NewBuffer(b) 684 buf.EncodeBytes(m.IP4SrcAddress[:], 4) 685 buf.EncodeBytes(m.IP6SrcAddress[:], 16) 686 buf.EncodeUint32(m.StickyBucketsPerCore) 687 buf.EncodeUint32(m.FlowTimeout) 688 return buf.Bytes(), nil 689 } 690 func (m *LbConf) Unmarshal(b []byte) error { 691 buf := codec.NewBuffer(b) 692 copy(m.IP4SrcAddress[:], buf.DecodeBytes(4)) 693 copy(m.IP6SrcAddress[:], buf.DecodeBytes(16)) 694 m.StickyBucketsPerCore = buf.DecodeUint32() 695 m.FlowTimeout = buf.DecodeUint32() 696 return nil 697 } 698 699 // LbConfReply defines message 'lb_conf_reply'. 700 type LbConfReply struct { 701 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 702 } 703 704 func (m *LbConfReply) Reset() { *m = LbConfReply{} } 705 func (*LbConfReply) GetMessageName() string { return "lb_conf_reply" } 706 func (*LbConfReply) GetCrcString() string { return "e8d4e804" } 707 func (*LbConfReply) GetMessageType() api.MessageType { 708 return api.ReplyMessage 709 } 710 711 func (m *LbConfReply) Size() (size int) { 712 if m == nil { 713 return 0 714 } 715 size += 4 // m.Retval 716 return size 717 } 718 func (m *LbConfReply) Marshal(b []byte) ([]byte, error) { 719 if b == nil { 720 b = make([]byte, m.Size()) 721 } 722 buf := codec.NewBuffer(b) 723 buf.EncodeInt32(m.Retval) 724 return buf.Bytes(), nil 725 } 726 func (m *LbConfReply) Unmarshal(b []byte) error { 727 buf := codec.NewBuffer(b) 728 m.Retval = buf.DecodeInt32() 729 return nil 730 } 731 732 // Flush a given vip 733 // - pfx - ip prefix and length 734 // - protocol - tcp or udp. 735 // - port - destination port. 736 // 737 // LbFlushVip defines message 'lb_flush_vip'. 738 type LbFlushVip struct { 739 Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"` 740 Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` 741 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` 742 } 743 744 func (m *LbFlushVip) Reset() { *m = LbFlushVip{} } 745 func (*LbFlushVip) GetMessageName() string { return "lb_flush_vip" } 746 func (*LbFlushVip) GetCrcString() string { return "1063f819" } 747 func (*LbFlushVip) GetMessageType() api.MessageType { 748 return api.RequestMessage 749 } 750 751 func (m *LbFlushVip) Size() (size int) { 752 if m == nil { 753 return 0 754 } 755 size += 1 // m.Pfx.Address.Af 756 size += 1 * 16 // m.Pfx.Address.Un 757 size += 1 // m.Pfx.Len 758 size += 1 // m.Protocol 759 size += 2 // m.Port 760 return size 761 } 762 func (m *LbFlushVip) Marshal(b []byte) ([]byte, error) { 763 if b == nil { 764 b = make([]byte, m.Size()) 765 } 766 buf := codec.NewBuffer(b) 767 buf.EncodeUint8(uint8(m.Pfx.Address.Af)) 768 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16) 769 buf.EncodeUint8(m.Pfx.Len) 770 buf.EncodeUint8(m.Protocol) 771 buf.EncodeUint16(m.Port) 772 return buf.Bytes(), nil 773 } 774 func (m *LbFlushVip) Unmarshal(b []byte) error { 775 buf := codec.NewBuffer(b) 776 m.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) 777 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 778 m.Pfx.Len = buf.DecodeUint8() 779 m.Protocol = buf.DecodeUint8() 780 m.Port = buf.DecodeUint16() 781 return nil 782 } 783 784 // LbFlushVipReply defines message 'lb_flush_vip_reply'. 785 type LbFlushVipReply struct { 786 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 787 } 788 789 func (m *LbFlushVipReply) Reset() { *m = LbFlushVipReply{} } 790 func (*LbFlushVipReply) GetMessageName() string { return "lb_flush_vip_reply" } 791 func (*LbFlushVipReply) GetCrcString() string { return "e8d4e804" } 792 func (*LbFlushVipReply) GetMessageType() api.MessageType { 793 return api.ReplyMessage 794 } 795 796 func (m *LbFlushVipReply) Size() (size int) { 797 if m == nil { 798 return 0 799 } 800 size += 4 // m.Retval 801 return size 802 } 803 func (m *LbFlushVipReply) Marshal(b []byte) ([]byte, error) { 804 if b == nil { 805 b = make([]byte, m.Size()) 806 } 807 buf := codec.NewBuffer(b) 808 buf.EncodeInt32(m.Retval) 809 return buf.Bytes(), nil 810 } 811 func (m *LbFlushVipReply) Unmarshal(b []byte) error { 812 buf := codec.NewBuffer(b) 813 m.Retval = buf.DecodeInt32() 814 return nil 815 } 816 817 // Reply all configured vip 818 // - vip - all vip addrs. 819 // 820 // LbVipDetails defines message 'lb_vip_details'. 821 type LbVipDetails struct { 822 Vip lb_types.LbVip `binapi:"lb_vip,name=vip" json:"vip,omitempty"` 823 Encap lb_types.LbEncapType `binapi:"lb_encap_type,name=encap" json:"encap,omitempty"` 824 Dscp ip_types.IPDscp `binapi:"ip_dscp,name=dscp" json:"dscp,omitempty"` 825 SrvType lb_types.LbSrvType `binapi:"lb_srv_type,name=srv_type" json:"srv_type,omitempty"` 826 TargetPort uint16 `binapi:"u16,name=target_port" json:"target_port,omitempty"` 827 FlowTableLength uint16 `binapi:"u16,name=flow_table_length" json:"flow_table_length,omitempty"` 828 } 829 830 func (m *LbVipDetails) Reset() { *m = LbVipDetails{} } 831 func (*LbVipDetails) GetMessageName() string { return "lb_vip_details" } 832 func (*LbVipDetails) GetCrcString() string { return "1329ec9b" } 833 func (*LbVipDetails) GetMessageType() api.MessageType { 834 return api.ReplyMessage 835 } 836 837 func (m *LbVipDetails) Size() (size int) { 838 if m == nil { 839 return 0 840 } 841 size += 1 // m.Vip.Pfx.Address.Af 842 size += 1 * 16 // m.Vip.Pfx.Address.Un 843 size += 1 // m.Vip.Pfx.Len 844 size += 1 // m.Vip.Protocol 845 size += 2 // m.Vip.Port 846 size += 4 // m.Encap 847 size += 1 // m.Dscp 848 size += 4 // m.SrvType 849 size += 2 // m.TargetPort 850 size += 2 // m.FlowTableLength 851 return size 852 } 853 func (m *LbVipDetails) Marshal(b []byte) ([]byte, error) { 854 if b == nil { 855 b = make([]byte, m.Size()) 856 } 857 buf := codec.NewBuffer(b) 858 buf.EncodeUint8(uint8(m.Vip.Pfx.Address.Af)) 859 buf.EncodeBytes(m.Vip.Pfx.Address.Un.XXX_UnionData[:], 16) 860 buf.EncodeUint8(m.Vip.Pfx.Len) 861 buf.EncodeUint8(uint8(m.Vip.Protocol)) 862 buf.EncodeUint16(m.Vip.Port) 863 buf.EncodeUint32(uint32(m.Encap)) 864 buf.EncodeUint8(uint8(m.Dscp)) 865 buf.EncodeUint32(uint32(m.SrvType)) 866 buf.EncodeUint16(m.TargetPort) 867 buf.EncodeUint16(m.FlowTableLength) 868 return buf.Bytes(), nil 869 } 870 func (m *LbVipDetails) Unmarshal(b []byte) error { 871 buf := codec.NewBuffer(b) 872 m.Vip.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) 873 copy(m.Vip.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 874 m.Vip.Pfx.Len = buf.DecodeUint8() 875 m.Vip.Protocol = ip_types.IPProto(buf.DecodeUint8()) 876 m.Vip.Port = buf.DecodeUint16() 877 m.Encap = lb_types.LbEncapType(buf.DecodeUint32()) 878 m.Dscp = ip_types.IPDscp(buf.DecodeUint8()) 879 m.SrvType = lb_types.LbSrvType(buf.DecodeUint32()) 880 m.TargetPort = buf.DecodeUint16() 881 m.FlowTableLength = buf.DecodeUint16() 882 return nil 883 } 884 885 // Dump all vips 886 // LbVipDump defines message 'lb_vip_dump'. 887 type LbVipDump struct { 888 Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"` 889 PfxMatcher ip_types.PrefixMatcher `binapi:"prefix_matcher,name=pfx_matcher" json:"pfx_matcher,omitempty"` 890 Protocol uint8 `binapi:"u8,name=protocol,default=255" json:"protocol,omitempty"` 891 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` 892 } 893 894 func (m *LbVipDump) Reset() { *m = LbVipDump{} } 895 func (*LbVipDump) GetMessageName() string { return "lb_vip_dump" } 896 func (*LbVipDump) GetCrcString() string { return "56110cb7" } 897 func (*LbVipDump) GetMessageType() api.MessageType { 898 return api.RequestMessage 899 } 900 901 func (m *LbVipDump) Size() (size int) { 902 if m == nil { 903 return 0 904 } 905 size += 1 // m.Pfx.Address.Af 906 size += 1 * 16 // m.Pfx.Address.Un 907 size += 1 // m.Pfx.Len 908 size += 1 // m.PfxMatcher.Le 909 size += 1 // m.PfxMatcher.Ge 910 size += 1 // m.Protocol 911 size += 2 // m.Port 912 return size 913 } 914 func (m *LbVipDump) Marshal(b []byte) ([]byte, error) { 915 if b == nil { 916 b = make([]byte, m.Size()) 917 } 918 buf := codec.NewBuffer(b) 919 buf.EncodeUint8(uint8(m.Pfx.Address.Af)) 920 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16) 921 buf.EncodeUint8(m.Pfx.Len) 922 buf.EncodeUint8(m.PfxMatcher.Le) 923 buf.EncodeUint8(m.PfxMatcher.Ge) 924 buf.EncodeUint8(m.Protocol) 925 buf.EncodeUint16(m.Port) 926 return buf.Bytes(), nil 927 } 928 func (m *LbVipDump) Unmarshal(b []byte) error { 929 buf := codec.NewBuffer(b) 930 m.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) 931 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 932 m.Pfx.Len = buf.DecodeUint8() 933 m.PfxMatcher.Le = buf.DecodeUint8() 934 m.PfxMatcher.Ge = buf.DecodeUint8() 935 m.Protocol = buf.DecodeUint8() 936 m.Port = buf.DecodeUint16() 937 return nil 938 } 939 940 func init() { file_lb_binapi_init() } 941 func file_lb_binapi_init() { 942 api.RegisterMessage((*LbAddDelAs)(nil), "lb_add_del_as_35d72500") 943 api.RegisterMessage((*LbAddDelAsReply)(nil), "lb_add_del_as_reply_e8d4e804") 944 api.RegisterMessage((*LbAddDelIntfNat4)(nil), "lb_add_del_intf_nat4_47d6e753") 945 api.RegisterMessage((*LbAddDelIntfNat4Reply)(nil), "lb_add_del_intf_nat4_reply_e8d4e804") 946 api.RegisterMessage((*LbAddDelIntfNat6)(nil), "lb_add_del_intf_nat6_47d6e753") 947 api.RegisterMessage((*LbAddDelIntfNat6Reply)(nil), "lb_add_del_intf_nat6_reply_e8d4e804") 948 api.RegisterMessage((*LbAddDelVip)(nil), "lb_add_del_vip_6fa569c7") 949 api.RegisterMessage((*LbAddDelVipReply)(nil), "lb_add_del_vip_reply_e8d4e804") 950 api.RegisterMessage((*LbAddDelVipV2)(nil), "lb_add_del_vip_v2_7c520e0f") 951 api.RegisterMessage((*LbAddDelVipV2Reply)(nil), "lb_add_del_vip_v2_reply_e8d4e804") 952 api.RegisterMessage((*LbAsDetails)(nil), "lb_as_details_8d24c29e") 953 api.RegisterMessage((*LbAsDump)(nil), "lb_as_dump_1063f819") 954 api.RegisterMessage((*LbConf)(nil), "lb_conf_56cd3261") 955 api.RegisterMessage((*LbConfReply)(nil), "lb_conf_reply_e8d4e804") 956 api.RegisterMessage((*LbFlushVip)(nil), "lb_flush_vip_1063f819") 957 api.RegisterMessage((*LbFlushVipReply)(nil), "lb_flush_vip_reply_e8d4e804") 958 api.RegisterMessage((*LbVipDetails)(nil), "lb_vip_details_1329ec9b") 959 api.RegisterMessage((*LbVipDump)(nil), "lb_vip_dump_56110cb7") 960 } 961 962 // Messages returns list of all messages in this module. 963 func AllMessages() []api.Message { 964 return []api.Message{ 965 (*LbAddDelAs)(nil), 966 (*LbAddDelAsReply)(nil), 967 (*LbAddDelIntfNat4)(nil), 968 (*LbAddDelIntfNat4Reply)(nil), 969 (*LbAddDelIntfNat6)(nil), 970 (*LbAddDelIntfNat6Reply)(nil), 971 (*LbAddDelVip)(nil), 972 (*LbAddDelVipReply)(nil), 973 (*LbAddDelVipV2)(nil), 974 (*LbAddDelVipV2Reply)(nil), 975 (*LbAsDetails)(nil), 976 (*LbAsDump)(nil), 977 (*LbConf)(nil), 978 (*LbConfReply)(nil), 979 (*LbFlushVip)(nil), 980 (*LbFlushVipReply)(nil), 981 (*LbVipDetails)(nil), 982 (*LbVipDump)(nil), 983 } 984 }