Jonathan Hart | 44bdbfc | 2020-04-14 17:45:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 3 | * Copyright (c) 2011, 2012 Open Networking Foundation |
| 4 | * Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler. |
| 5 | * Copyright 2018, Red Hat, Inc. |
| 6 | */ |
| 7 | // Automatically generated by LOXI from template module.go |
| 8 | // Do not modify |
| 9 | |
| 10 | package of15 |
| 11 | |
| 12 | import ( |
| 13 | "bytes" |
| 14 | "encoding/binary" |
| 15 | "fmt" |
| 16 | "net" |
| 17 | |
| 18 | "github.com/opencord/goloxi" |
| 19 | ) |
| 20 | |
| 21 | type Header struct { |
| 22 | Version uint8 |
| 23 | Type uint8 |
| 24 | Length uint16 |
| 25 | Xid uint32 |
| 26 | } |
| 27 | |
| 28 | type IHeader interface { |
| 29 | goloxi.Serializable |
| 30 | GetVersion() uint8 |
| 31 | GetType() uint8 |
| 32 | GetLength() uint16 |
| 33 | GetXid() uint32 |
| 34 | } |
| 35 | |
| 36 | func (self *Header) GetVersion() uint8 { |
| 37 | return self.Version |
| 38 | } |
| 39 | |
| 40 | func (self *Header) SetVersion(v uint8) { |
| 41 | self.Version = v |
| 42 | } |
| 43 | |
| 44 | func (self *Header) GetType() uint8 { |
| 45 | return self.Type |
| 46 | } |
| 47 | |
| 48 | func (self *Header) SetType(v uint8) { |
| 49 | self.Type = v |
| 50 | } |
| 51 | |
| 52 | func (self *Header) GetLength() uint16 { |
| 53 | return self.Length |
| 54 | } |
| 55 | |
| 56 | func (self *Header) SetLength(v uint16) { |
| 57 | self.Length = v |
| 58 | } |
| 59 | |
| 60 | func (self *Header) GetXid() uint32 { |
| 61 | return self.Xid |
| 62 | } |
| 63 | |
| 64 | func (self *Header) SetXid(v uint32) { |
| 65 | self.Xid = v |
| 66 | } |
| 67 | |
| 68 | func (self *Header) Serialize(encoder *goloxi.Encoder) error { |
| 69 | |
| 70 | encoder.PutUint8(uint8(6)) |
| 71 | encoder.PutUint8(uint8(self.Type)) |
| 72 | encoder.PutUint16(uint16(self.Length)) |
| 73 | encoder.PutUint32(uint32(self.Xid)) |
| 74 | |
| 75 | return nil |
| 76 | } |
| 77 | func (self *Header) Decode(decoder *goloxi.Decoder) error { |
| 78 | if decoder.Length() < 8 { |
| 79 | return fmt.Errorf("Header packet too short: %d < 8", decoder.Length()) |
| 80 | } |
| 81 | |
| 82 | self.Version = uint8(decoder.ReadByte()) |
| 83 | self.Type = uint8(decoder.ReadByte()) |
| 84 | self.Length = uint16(decoder.ReadUint16()) |
| 85 | oldDecoder := decoder |
| 86 | defer func() { decoder = oldDecoder }() |
| 87 | decoder = decoder.SliceDecoder(int(self.Length), 2+2) |
| 88 | self.Xid = uint32(decoder.ReadUint32()) |
| 89 | |
| 90 | return nil |
| 91 | } |
| 92 | func DecodeHeader(decoder *goloxi.Decoder) (IHeader, error) { |
| 93 | _header := &Header{} |
| 94 | if decoder.Length() < 8 { |
| 95 | return nil, fmt.Errorf("Header packet too short: %d < 8", decoder.Length()) |
| 96 | } |
| 97 | _header.Version = uint8(decoder.ReadByte()) |
| 98 | _header.Type = uint8(decoder.ReadByte()) |
| 99 | _header.Length = uint16(decoder.ReadUint16()) |
| 100 | oldDecoder := decoder |
| 101 | defer func() { decoder = oldDecoder }() |
| 102 | decoder = decoder.SliceDecoder(int(_header.Length), 2+2) |
| 103 | _header.Xid = uint32(decoder.ReadUint32()) |
| 104 | |
| 105 | switch _header.Type { |
| 106 | case 0: |
| 107 | return DecodeHello(_header, decoder) |
| 108 | case 1: |
| 109 | return DecodeErrorMsg(_header, decoder) |
| 110 | case 2: |
| 111 | return DecodeEchoRequest(_header, decoder) |
| 112 | case 3: |
| 113 | return DecodeEchoReply(_header, decoder) |
| 114 | case 4: |
| 115 | return DecodeExperimenter(_header, decoder) |
| 116 | case 5: |
| 117 | return DecodeFeaturesRequest(_header, decoder) |
| 118 | case 6: |
| 119 | return DecodeFeaturesReply(_header, decoder) |
| 120 | case 7: |
| 121 | return DecodeGetConfigRequest(_header, decoder) |
| 122 | case 8: |
| 123 | return DecodeGetConfigReply(_header, decoder) |
| 124 | case 9: |
| 125 | return DecodeSetConfig(_header, decoder) |
| 126 | case 10: |
| 127 | return DecodePacketIn(_header, decoder) |
| 128 | case 11: |
| 129 | return DecodeFlowRemoved(_header, decoder) |
| 130 | case 12: |
| 131 | return DecodePortStatus(_header, decoder) |
| 132 | case 13: |
| 133 | return DecodePacketOut(_header, decoder) |
| 134 | case 14: |
| 135 | return DecodeFlowMod(_header, decoder) |
| 136 | case 15: |
| 137 | return DecodeGroupMod(_header, decoder) |
| 138 | case 16: |
| 139 | return DecodePortMod(_header, decoder) |
| 140 | case 17: |
| 141 | return DecodeTableMod(_header, decoder) |
| 142 | case 18: |
| 143 | return DecodeStatsRequest(_header, decoder) |
| 144 | case 19: |
| 145 | return DecodeStatsReply(_header, decoder) |
| 146 | case 20: |
| 147 | return DecodeBarrierRequest(_header, decoder) |
| 148 | case 21: |
| 149 | return DecodeBarrierReply(_header, decoder) |
| 150 | case 24: |
| 151 | return DecodeRoleRequest(_header, decoder) |
| 152 | case 25: |
| 153 | return DecodeRoleReply(_header, decoder) |
| 154 | case 26: |
| 155 | return DecodeAsyncGetRequest(_header, decoder) |
| 156 | case 27: |
| 157 | return DecodeAsyncGetReply(_header, decoder) |
| 158 | case 28: |
| 159 | return DecodeAsyncSet(_header, decoder) |
| 160 | case 29: |
| 161 | return DecodeMeterMod(_header, decoder) |
| 162 | case 30: |
| 163 | return DecodeRoleStatus(_header, decoder) |
| 164 | case 31: |
| 165 | return DecodeTableStatus(_header, decoder) |
| 166 | case 32: |
| 167 | return DecodeRequestforward(_header, decoder) |
| 168 | case 33: |
| 169 | return DecodeBundleCtrlMsg(_header, decoder) |
| 170 | case 34: |
| 171 | return DecodeBundleAddMsg(_header, decoder) |
| 172 | case 35: |
| 173 | return DecodeControllerStatus(_header, decoder) |
| 174 | default: |
| 175 | return nil, fmt.Errorf("Invalid type '%d' for 'Header'", _header.Type) |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | func NewHeader(_type uint8) *Header { |
| 180 | obj := &Header{} |
| 181 | obj.Type = _type |
| 182 | return obj |
| 183 | } |
| 184 | |
| 185 | type StatsReply struct { |
| 186 | *Header |
| 187 | StatsType uint16 |
| 188 | Flags StatsReplyFlags |
| 189 | } |
| 190 | |
| 191 | type IStatsReply interface { |
| 192 | IHeader |
| 193 | GetStatsType() uint16 |
| 194 | GetFlags() StatsReplyFlags |
| 195 | } |
| 196 | |
| 197 | func (self *StatsReply) GetStatsType() uint16 { |
| 198 | return self.StatsType |
| 199 | } |
| 200 | |
| 201 | func (self *StatsReply) SetStatsType(v uint16) { |
| 202 | self.StatsType = v |
| 203 | } |
| 204 | |
| 205 | func (self *StatsReply) GetFlags() StatsReplyFlags { |
| 206 | return self.Flags |
| 207 | } |
| 208 | |
| 209 | func (self *StatsReply) SetFlags(v StatsReplyFlags) { |
| 210 | self.Flags = v |
| 211 | } |
| 212 | |
| 213 | func (self *StatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 214 | if err := self.Header.Serialize(encoder); err != nil { |
| 215 | return err |
| 216 | } |
| 217 | |
| 218 | encoder.PutUint16(uint16(self.StatsType)) |
| 219 | encoder.PutUint16(uint16(self.Flags)) |
| 220 | |
| 221 | return nil |
| 222 | } |
| 223 | |
| 224 | func DecodeStatsReply(parent *Header, decoder *goloxi.Decoder) (IStatsReply, error) { |
| 225 | _statsreply := &StatsReply{Header: parent} |
| 226 | if decoder.Length() < 4 { |
| 227 | return nil, fmt.Errorf("StatsReply packet too short: %d < 4", decoder.Length()) |
| 228 | } |
| 229 | _statsreply.StatsType = uint16(decoder.ReadUint16()) |
| 230 | _statsreply.Flags = StatsReplyFlags(decoder.ReadUint16()) |
| 231 | |
| 232 | switch _statsreply.StatsType { |
| 233 | case 0: |
| 234 | return DecodeDescStatsReply(_statsreply, decoder) |
| 235 | case 1: |
| 236 | return DecodeFlowStatsReply(_statsreply, decoder) |
| 237 | case 2: |
| 238 | return DecodeAggregateStatsReply(_statsreply, decoder) |
| 239 | case 3: |
| 240 | return DecodeTableStatsReply(_statsreply, decoder) |
| 241 | case 4: |
| 242 | return DecodePortStatsReply(_statsreply, decoder) |
| 243 | case 5: |
| 244 | return DecodeQueueStatsReply(_statsreply, decoder) |
| 245 | case 6: |
| 246 | return DecodeGroupStatsReply(_statsreply, decoder) |
| 247 | case 7: |
| 248 | return DecodeGroupDescStatsReply(_statsreply, decoder) |
| 249 | case 8: |
| 250 | return DecodeGroupFeaturesStatsReply(_statsreply, decoder) |
| 251 | case 9: |
| 252 | return DecodeMeterStatsReply(_statsreply, decoder) |
| 253 | case 10: |
| 254 | return DecodeMeterConfigStatsReply(_statsreply, decoder) |
| 255 | case 11: |
| 256 | return DecodeMeterFeaturesStatsReply(_statsreply, decoder) |
| 257 | case 12: |
| 258 | return DecodeTableFeaturesStatsReply(_statsreply, decoder) |
| 259 | case 13: |
| 260 | return DecodePortDescStatsReply(_statsreply, decoder) |
| 261 | case 14: |
| 262 | return DecodeTableDescStatsReply(_statsreply, decoder) |
| 263 | case 15: |
| 264 | return DecodeQueueDescStatsReply(_statsreply, decoder) |
| 265 | case 16: |
| 266 | return DecodeFlowMonitorReply(_statsreply, decoder) |
| 267 | case 17: |
| 268 | return DecodeFlowLightweightStatsReply(_statsreply, decoder) |
| 269 | case 18: |
| 270 | return DecodeControllerStatusStatsReply(_statsreply, decoder) |
| 271 | case 19: |
| 272 | return DecodeBundleFeaturesStatsReply(_statsreply, decoder) |
| 273 | case 65535: |
| 274 | return DecodeExperimenterStatsReply(_statsreply, decoder) |
| 275 | default: |
| 276 | return nil, fmt.Errorf("Invalid type '%d' for 'StatsReply'", _statsreply.StatsType) |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | func NewStatsReply(_stats_type uint16) *StatsReply { |
| 281 | obj := &StatsReply{ |
| 282 | Header: NewHeader(19), |
| 283 | } |
| 284 | obj.StatsType = _stats_type |
| 285 | return obj |
| 286 | } |
| 287 | |
| 288 | type AggregateStatsReply struct { |
| 289 | *StatsReply |
| 290 | Stats Stat |
| 291 | } |
| 292 | |
| 293 | type IAggregateStatsReply interface { |
| 294 | IStatsReply |
| 295 | GetStats() Stat |
| 296 | } |
| 297 | |
| 298 | func (self *AggregateStatsReply) GetStats() Stat { |
| 299 | return self.Stats |
| 300 | } |
| 301 | |
| 302 | func (self *AggregateStatsReply) SetStats(v Stat) { |
| 303 | self.Stats = v |
| 304 | } |
| 305 | |
| 306 | func (self *AggregateStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 307 | startIndex := len(encoder.Bytes()) |
| 308 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 309 | return err |
| 310 | } |
| 311 | |
| 312 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 313 | if err := self.Stats.Serialize(encoder); err != nil { |
| 314 | return err |
| 315 | } |
| 316 | |
| 317 | length := len(encoder.Bytes()) - startIndex |
| 318 | |
| 319 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 320 | |
| 321 | return nil |
| 322 | } |
| 323 | |
| 324 | func DecodeAggregateStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*AggregateStatsReply, error) { |
| 325 | _aggregatestatsreply := &AggregateStatsReply{StatsReply: parent} |
| 326 | if decoder.Length() < 12 { |
| 327 | return nil, fmt.Errorf("AggregateStatsReply packet too short: %d < 12", decoder.Length()) |
| 328 | } |
| 329 | decoder.Skip(4) |
| 330 | if err := _aggregatestatsreply.Stats.Decode(decoder); err != nil { |
| 331 | return nil, err |
| 332 | } |
| 333 | |
| 334 | decoder.SkipAlign() |
| 335 | return _aggregatestatsreply, nil |
| 336 | } |
| 337 | |
| 338 | func NewAggregateStatsReply() *AggregateStatsReply { |
| 339 | obj := &AggregateStatsReply{ |
| 340 | StatsReply: NewStatsReply(2), |
| 341 | } |
| 342 | return obj |
| 343 | } |
| 344 | |
| 345 | type StatsRequest struct { |
| 346 | *Header |
| 347 | StatsType uint16 |
| 348 | Flags StatsRequestFlags |
| 349 | } |
| 350 | |
| 351 | type IStatsRequest interface { |
| 352 | IHeader |
| 353 | GetStatsType() uint16 |
| 354 | GetFlags() StatsRequestFlags |
| 355 | } |
| 356 | |
| 357 | func (self *StatsRequest) GetStatsType() uint16 { |
| 358 | return self.StatsType |
| 359 | } |
| 360 | |
| 361 | func (self *StatsRequest) SetStatsType(v uint16) { |
| 362 | self.StatsType = v |
| 363 | } |
| 364 | |
| 365 | func (self *StatsRequest) GetFlags() StatsRequestFlags { |
| 366 | return self.Flags |
| 367 | } |
| 368 | |
| 369 | func (self *StatsRequest) SetFlags(v StatsRequestFlags) { |
| 370 | self.Flags = v |
| 371 | } |
| 372 | |
| 373 | func (self *StatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 374 | if err := self.Header.Serialize(encoder); err != nil { |
| 375 | return err |
| 376 | } |
| 377 | |
| 378 | encoder.PutUint16(uint16(self.StatsType)) |
| 379 | encoder.PutUint16(uint16(self.Flags)) |
| 380 | |
| 381 | return nil |
| 382 | } |
| 383 | |
| 384 | func DecodeStatsRequest(parent *Header, decoder *goloxi.Decoder) (IStatsRequest, error) { |
| 385 | _statsrequest := &StatsRequest{Header: parent} |
| 386 | if decoder.Length() < 4 { |
| 387 | return nil, fmt.Errorf("StatsRequest packet too short: %d < 4", decoder.Length()) |
| 388 | } |
| 389 | _statsrequest.StatsType = uint16(decoder.ReadUint16()) |
| 390 | _statsrequest.Flags = StatsRequestFlags(decoder.ReadUint16()) |
| 391 | |
| 392 | switch _statsrequest.StatsType { |
| 393 | case 0: |
| 394 | return DecodeDescStatsRequest(_statsrequest, decoder) |
| 395 | case 1: |
| 396 | return DecodeFlowStatsRequest(_statsrequest, decoder) |
| 397 | case 2: |
| 398 | return DecodeAggregateStatsRequest(_statsrequest, decoder) |
| 399 | case 3: |
| 400 | return DecodeTableStatsRequest(_statsrequest, decoder) |
| 401 | case 4: |
| 402 | return DecodePortStatsRequest(_statsrequest, decoder) |
| 403 | case 5: |
| 404 | return DecodeQueueStatsRequest(_statsrequest, decoder) |
| 405 | case 6: |
| 406 | return DecodeGroupStatsRequest(_statsrequest, decoder) |
| 407 | case 7: |
| 408 | return DecodeGroupDescStatsRequest(_statsrequest, decoder) |
| 409 | case 8: |
| 410 | return DecodeGroupFeaturesStatsRequest(_statsrequest, decoder) |
| 411 | case 9: |
| 412 | return DecodeMeterStatsRequest(_statsrequest, decoder) |
| 413 | case 10: |
| 414 | return DecodeMeterConfigStatsRequest(_statsrequest, decoder) |
| 415 | case 11: |
| 416 | return DecodeMeterFeaturesStatsRequest(_statsrequest, decoder) |
| 417 | case 12: |
| 418 | return DecodeTableFeaturesStatsRequest(_statsrequest, decoder) |
| 419 | case 13: |
| 420 | return DecodePortDescStatsRequest(_statsrequest, decoder) |
| 421 | case 14: |
| 422 | return DecodeTableDescStatsRequest(_statsrequest, decoder) |
| 423 | case 15: |
| 424 | return DecodeQueueDescStatsRequest(_statsrequest, decoder) |
| 425 | case 16: |
| 426 | return DecodeFlowMonitorRequest(_statsrequest, decoder) |
| 427 | case 17: |
| 428 | return DecodeFlowLightweightStatsRequest(_statsrequest, decoder) |
| 429 | case 18: |
| 430 | return DecodeControllerStatusStatsRequest(_statsrequest, decoder) |
| 431 | case 19: |
| 432 | return DecodeBundleFeaturesStatsRequest(_statsrequest, decoder) |
| 433 | case 65535: |
| 434 | return DecodeExperimenterStatsRequest(_statsrequest, decoder) |
| 435 | default: |
| 436 | return nil, fmt.Errorf("Invalid type '%d' for 'StatsRequest'", _statsrequest.StatsType) |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | func NewStatsRequest(_stats_type uint16) *StatsRequest { |
| 441 | obj := &StatsRequest{ |
| 442 | Header: NewHeader(18), |
| 443 | } |
| 444 | obj.StatsType = _stats_type |
| 445 | return obj |
| 446 | } |
| 447 | |
| 448 | type AggregateStatsRequest struct { |
| 449 | *StatsRequest |
| 450 | TableId uint8 |
| 451 | OutPort Port |
| 452 | OutGroup uint32 |
| 453 | Cookie uint64 |
| 454 | CookieMask uint64 |
| 455 | Match Match |
| 456 | } |
| 457 | |
| 458 | type IAggregateStatsRequest interface { |
| 459 | IStatsRequest |
| 460 | GetTableId() uint8 |
| 461 | GetOutPort() Port |
| 462 | GetOutGroup() uint32 |
| 463 | GetCookie() uint64 |
| 464 | GetCookieMask() uint64 |
| 465 | GetMatch() Match |
| 466 | } |
| 467 | |
| 468 | func (self *AggregateStatsRequest) GetTableId() uint8 { |
| 469 | return self.TableId |
| 470 | } |
| 471 | |
| 472 | func (self *AggregateStatsRequest) SetTableId(v uint8) { |
| 473 | self.TableId = v |
| 474 | } |
| 475 | |
| 476 | func (self *AggregateStatsRequest) GetOutPort() Port { |
| 477 | return self.OutPort |
| 478 | } |
| 479 | |
| 480 | func (self *AggregateStatsRequest) SetOutPort(v Port) { |
| 481 | self.OutPort = v |
| 482 | } |
| 483 | |
| 484 | func (self *AggregateStatsRequest) GetOutGroup() uint32 { |
| 485 | return self.OutGroup |
| 486 | } |
| 487 | |
| 488 | func (self *AggregateStatsRequest) SetOutGroup(v uint32) { |
| 489 | self.OutGroup = v |
| 490 | } |
| 491 | |
| 492 | func (self *AggregateStatsRequest) GetCookie() uint64 { |
| 493 | return self.Cookie |
| 494 | } |
| 495 | |
| 496 | func (self *AggregateStatsRequest) SetCookie(v uint64) { |
| 497 | self.Cookie = v |
| 498 | } |
| 499 | |
| 500 | func (self *AggregateStatsRequest) GetCookieMask() uint64 { |
| 501 | return self.CookieMask |
| 502 | } |
| 503 | |
| 504 | func (self *AggregateStatsRequest) SetCookieMask(v uint64) { |
| 505 | self.CookieMask = v |
| 506 | } |
| 507 | |
| 508 | func (self *AggregateStatsRequest) GetMatch() Match { |
| 509 | return self.Match |
| 510 | } |
| 511 | |
| 512 | func (self *AggregateStatsRequest) SetMatch(v Match) { |
| 513 | self.Match = v |
| 514 | } |
| 515 | |
| 516 | func (self *AggregateStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 517 | startIndex := len(encoder.Bytes()) |
| 518 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 519 | return err |
| 520 | } |
| 521 | |
| 522 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 523 | encoder.PutUint8(uint8(self.TableId)) |
| 524 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 525 | self.OutPort.Serialize(encoder) |
| 526 | encoder.PutUint32(uint32(self.OutGroup)) |
| 527 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 528 | encoder.PutUint64(uint64(self.Cookie)) |
| 529 | encoder.PutUint64(uint64(self.CookieMask)) |
| 530 | if err := self.Match.Serialize(encoder); err != nil { |
| 531 | return err |
| 532 | } |
| 533 | |
| 534 | length := len(encoder.Bytes()) - startIndex |
| 535 | |
| 536 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 537 | |
| 538 | return nil |
| 539 | } |
| 540 | |
| 541 | func DecodeAggregateStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*AggregateStatsRequest, error) { |
| 542 | _aggregatestatsrequest := &AggregateStatsRequest{StatsRequest: parent} |
| 543 | if decoder.Length() < 28 { |
| 544 | return nil, fmt.Errorf("AggregateStatsRequest packet too short: %d < 28", decoder.Length()) |
| 545 | } |
| 546 | decoder.Skip(4) |
| 547 | _aggregatestatsrequest.TableId = uint8(decoder.ReadByte()) |
| 548 | decoder.Skip(3) |
| 549 | _aggregatestatsrequest.OutPort.Decode(decoder) |
| 550 | _aggregatestatsrequest.OutGroup = uint32(decoder.ReadUint32()) |
| 551 | decoder.Skip(4) |
| 552 | _aggregatestatsrequest.Cookie = uint64(decoder.ReadUint64()) |
| 553 | _aggregatestatsrequest.CookieMask = uint64(decoder.ReadUint64()) |
| 554 | if err := _aggregatestatsrequest.Match.Decode(decoder); err != nil { |
| 555 | return nil, err |
| 556 | } |
| 557 | |
| 558 | decoder.SkipAlign() |
| 559 | return _aggregatestatsrequest, nil |
| 560 | } |
| 561 | |
| 562 | func NewAggregateStatsRequest() *AggregateStatsRequest { |
| 563 | obj := &AggregateStatsRequest{ |
| 564 | StatsRequest: NewStatsRequest(2), |
| 565 | } |
| 566 | return obj |
| 567 | } |
| 568 | |
| 569 | type ErrorMsg struct { |
| 570 | *Header |
| 571 | ErrType uint16 |
| 572 | } |
| 573 | |
| 574 | type IErrorMsg interface { |
| 575 | IHeader |
| 576 | GetErrType() uint16 |
| 577 | } |
| 578 | |
| 579 | func (self *ErrorMsg) GetErrType() uint16 { |
| 580 | return self.ErrType |
| 581 | } |
| 582 | |
| 583 | func (self *ErrorMsg) SetErrType(v uint16) { |
| 584 | self.ErrType = v |
| 585 | } |
| 586 | |
| 587 | func (self *ErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 588 | if err := self.Header.Serialize(encoder); err != nil { |
| 589 | return err |
| 590 | } |
| 591 | |
| 592 | encoder.PutUint16(uint16(self.ErrType)) |
| 593 | |
| 594 | return nil |
| 595 | } |
| 596 | |
| 597 | func DecodeErrorMsg(parent *Header, decoder *goloxi.Decoder) (IErrorMsg, error) { |
| 598 | _errormsg := &ErrorMsg{Header: parent} |
| 599 | if decoder.Length() < 2 { |
| 600 | return nil, fmt.Errorf("ErrorMsg packet too short: %d < 2", decoder.Length()) |
| 601 | } |
| 602 | _errormsg.ErrType = uint16(decoder.ReadUint16()) |
| 603 | |
| 604 | switch _errormsg.ErrType { |
| 605 | case 0: |
| 606 | return DecodeHelloFailedErrorMsg(_errormsg, decoder) |
| 607 | case 1: |
| 608 | return DecodeBadRequestErrorMsg(_errormsg, decoder) |
| 609 | case 2: |
| 610 | return DecodeBadActionErrorMsg(_errormsg, decoder) |
| 611 | case 3: |
| 612 | return DecodeBadInstructionErrorMsg(_errormsg, decoder) |
| 613 | case 4: |
| 614 | return DecodeBadMatchErrorMsg(_errormsg, decoder) |
| 615 | case 5: |
| 616 | return DecodeFlowModFailedErrorMsg(_errormsg, decoder) |
| 617 | case 6: |
| 618 | return DecodeGroupModFailedErrorMsg(_errormsg, decoder) |
| 619 | case 7: |
| 620 | return DecodePortModFailedErrorMsg(_errormsg, decoder) |
| 621 | case 8: |
| 622 | return DecodeTableModFailedErrorMsg(_errormsg, decoder) |
| 623 | case 9: |
| 624 | return DecodeQueueOpFailedErrorMsg(_errormsg, decoder) |
| 625 | case 10: |
| 626 | return DecodeSwitchConfigFailedErrorMsg(_errormsg, decoder) |
| 627 | case 11: |
| 628 | return DecodeRoleRequestFailedErrorMsg(_errormsg, decoder) |
| 629 | case 12: |
| 630 | return DecodeMeterModFailedErrorMsg(_errormsg, decoder) |
| 631 | case 13: |
| 632 | return DecodeTableFeaturesFailedErrorMsg(_errormsg, decoder) |
| 633 | case 14: |
| 634 | return DecodeBadPropertyErrorMsg(_errormsg, decoder) |
| 635 | case 15: |
| 636 | return DecodeAsyncConfigFailedErrorMsg(_errormsg, decoder) |
| 637 | case 16: |
| 638 | return DecodeFlowMonitorFailedErrorMsg(_errormsg, decoder) |
| 639 | case 17: |
| 640 | return DecodeBundleFailedErrorMsg(_errormsg, decoder) |
| 641 | case 65535: |
| 642 | return DecodeExperimenterErrorMsg(_errormsg, decoder) |
| 643 | default: |
| 644 | return nil, fmt.Errorf("Invalid type '%d' for 'ErrorMsg'", _errormsg.ErrType) |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | func NewErrorMsg(_err_type uint16) *ErrorMsg { |
| 649 | obj := &ErrorMsg{ |
| 650 | Header: NewHeader(1), |
| 651 | } |
| 652 | obj.ErrType = _err_type |
| 653 | return obj |
| 654 | } |
| 655 | |
| 656 | type AsyncConfigFailedErrorMsg struct { |
| 657 | *ErrorMsg |
| 658 | Code AsyncConfigFailedCode |
| 659 | Data []byte |
| 660 | } |
| 661 | |
| 662 | type IAsyncConfigFailedErrorMsg interface { |
| 663 | IErrorMsg |
| 664 | GetCode() AsyncConfigFailedCode |
| 665 | GetData() []byte |
| 666 | } |
| 667 | |
| 668 | func (self *AsyncConfigFailedErrorMsg) GetCode() AsyncConfigFailedCode { |
| 669 | return self.Code |
| 670 | } |
| 671 | |
| 672 | func (self *AsyncConfigFailedErrorMsg) SetCode(v AsyncConfigFailedCode) { |
| 673 | self.Code = v |
| 674 | } |
| 675 | |
| 676 | func (self *AsyncConfigFailedErrorMsg) GetData() []byte { |
| 677 | return self.Data |
| 678 | } |
| 679 | |
| 680 | func (self *AsyncConfigFailedErrorMsg) SetData(v []byte) { |
| 681 | self.Data = v |
| 682 | } |
| 683 | |
| 684 | func (self *AsyncConfigFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 685 | startIndex := len(encoder.Bytes()) |
| 686 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 687 | return err |
| 688 | } |
| 689 | |
| 690 | encoder.PutUint16(uint16(self.Code)) |
| 691 | encoder.Write(self.Data) |
| 692 | length := len(encoder.Bytes()) - startIndex |
| 693 | |
| 694 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 695 | |
| 696 | return nil |
| 697 | } |
| 698 | |
| 699 | func DecodeAsyncConfigFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*AsyncConfigFailedErrorMsg, error) { |
| 700 | _asyncconfigfailederrormsg := &AsyncConfigFailedErrorMsg{ErrorMsg: parent} |
| 701 | if decoder.Length() < 2 { |
| 702 | return nil, fmt.Errorf("AsyncConfigFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 703 | } |
| 704 | _asyncconfigfailederrormsg.Code = AsyncConfigFailedCode(decoder.ReadUint16()) |
| 705 | _asyncconfigfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 706 | return _asyncconfigfailederrormsg, nil |
| 707 | } |
| 708 | |
| 709 | func NewAsyncConfigFailedErrorMsg() *AsyncConfigFailedErrorMsg { |
| 710 | obj := &AsyncConfigFailedErrorMsg{ |
| 711 | ErrorMsg: NewErrorMsg(15), |
| 712 | } |
| 713 | return obj |
| 714 | } |
| 715 | |
| 716 | type AsyncGetReply struct { |
| 717 | *Header |
| 718 | Properties []IAsyncConfigProp |
| 719 | } |
| 720 | |
| 721 | type IAsyncGetReply interface { |
| 722 | IHeader |
| 723 | GetProperties() []IAsyncConfigProp |
| 724 | } |
| 725 | |
| 726 | func (self *AsyncGetReply) GetProperties() []IAsyncConfigProp { |
| 727 | return self.Properties |
| 728 | } |
| 729 | |
| 730 | func (self *AsyncGetReply) SetProperties(v []IAsyncConfigProp) { |
| 731 | self.Properties = v |
| 732 | } |
| 733 | |
| 734 | func (self *AsyncGetReply) Serialize(encoder *goloxi.Encoder) error { |
| 735 | startIndex := len(encoder.Bytes()) |
| 736 | if err := self.Header.Serialize(encoder); err != nil { |
| 737 | return err |
| 738 | } |
| 739 | |
| 740 | for _, obj := range self.Properties { |
| 741 | if err := obj.Serialize(encoder); err != nil { |
| 742 | return err |
| 743 | } |
| 744 | } |
| 745 | length := len(encoder.Bytes()) - startIndex |
| 746 | |
| 747 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 748 | |
| 749 | return nil |
| 750 | } |
| 751 | |
| 752 | func DecodeAsyncGetReply(parent *Header, decoder *goloxi.Decoder) (*AsyncGetReply, error) { |
| 753 | _asyncgetreply := &AsyncGetReply{Header: parent} |
| 754 | |
| 755 | for decoder.Length() >= 4 { |
| 756 | item, err := DecodeAsyncConfigProp(decoder) |
| 757 | if err != nil { |
| 758 | return nil, err |
| 759 | } |
| 760 | if item != nil { |
| 761 | _asyncgetreply.Properties = append(_asyncgetreply.Properties, item) |
| 762 | } |
| 763 | } |
| 764 | return _asyncgetreply, nil |
| 765 | } |
| 766 | |
| 767 | func NewAsyncGetReply() *AsyncGetReply { |
| 768 | obj := &AsyncGetReply{ |
| 769 | Header: NewHeader(27), |
| 770 | } |
| 771 | return obj |
| 772 | } |
| 773 | |
| 774 | type AsyncGetRequest struct { |
| 775 | *Header |
| 776 | Properties []IAsyncConfigProp |
| 777 | } |
| 778 | |
| 779 | type IAsyncGetRequest interface { |
| 780 | IHeader |
| 781 | GetProperties() []IAsyncConfigProp |
| 782 | } |
| 783 | |
| 784 | func (self *AsyncGetRequest) GetProperties() []IAsyncConfigProp { |
| 785 | return self.Properties |
| 786 | } |
| 787 | |
| 788 | func (self *AsyncGetRequest) SetProperties(v []IAsyncConfigProp) { |
| 789 | self.Properties = v |
| 790 | } |
| 791 | |
| 792 | func (self *AsyncGetRequest) Serialize(encoder *goloxi.Encoder) error { |
| 793 | startIndex := len(encoder.Bytes()) |
| 794 | if err := self.Header.Serialize(encoder); err != nil { |
| 795 | return err |
| 796 | } |
| 797 | |
| 798 | for _, obj := range self.Properties { |
| 799 | if err := obj.Serialize(encoder); err != nil { |
| 800 | return err |
| 801 | } |
| 802 | } |
| 803 | length := len(encoder.Bytes()) - startIndex |
| 804 | |
| 805 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 806 | |
| 807 | return nil |
| 808 | } |
| 809 | |
| 810 | func DecodeAsyncGetRequest(parent *Header, decoder *goloxi.Decoder) (*AsyncGetRequest, error) { |
| 811 | _asyncgetrequest := &AsyncGetRequest{Header: parent} |
| 812 | |
| 813 | for decoder.Length() >= 4 { |
| 814 | item, err := DecodeAsyncConfigProp(decoder) |
| 815 | if err != nil { |
| 816 | return nil, err |
| 817 | } |
| 818 | if item != nil { |
| 819 | _asyncgetrequest.Properties = append(_asyncgetrequest.Properties, item) |
| 820 | } |
| 821 | } |
| 822 | return _asyncgetrequest, nil |
| 823 | } |
| 824 | |
| 825 | func NewAsyncGetRequest() *AsyncGetRequest { |
| 826 | obj := &AsyncGetRequest{ |
| 827 | Header: NewHeader(26), |
| 828 | } |
| 829 | return obj |
| 830 | } |
| 831 | |
| 832 | type AsyncSet struct { |
| 833 | *Header |
| 834 | Properties []IAsyncConfigProp |
| 835 | } |
| 836 | |
| 837 | type IAsyncSet interface { |
| 838 | IHeader |
| 839 | GetProperties() []IAsyncConfigProp |
| 840 | } |
| 841 | |
| 842 | func (self *AsyncSet) GetProperties() []IAsyncConfigProp { |
| 843 | return self.Properties |
| 844 | } |
| 845 | |
| 846 | func (self *AsyncSet) SetProperties(v []IAsyncConfigProp) { |
| 847 | self.Properties = v |
| 848 | } |
| 849 | |
| 850 | func (self *AsyncSet) Serialize(encoder *goloxi.Encoder) error { |
| 851 | startIndex := len(encoder.Bytes()) |
| 852 | if err := self.Header.Serialize(encoder); err != nil { |
| 853 | return err |
| 854 | } |
| 855 | |
| 856 | for _, obj := range self.Properties { |
| 857 | if err := obj.Serialize(encoder); err != nil { |
| 858 | return err |
| 859 | } |
| 860 | } |
| 861 | length := len(encoder.Bytes()) - startIndex |
| 862 | |
| 863 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 864 | |
| 865 | return nil |
| 866 | } |
| 867 | |
| 868 | func DecodeAsyncSet(parent *Header, decoder *goloxi.Decoder) (*AsyncSet, error) { |
| 869 | _asyncset := &AsyncSet{Header: parent} |
| 870 | |
| 871 | for decoder.Length() >= 4 { |
| 872 | item, err := DecodeAsyncConfigProp(decoder) |
| 873 | if err != nil { |
| 874 | return nil, err |
| 875 | } |
| 876 | if item != nil { |
| 877 | _asyncset.Properties = append(_asyncset.Properties, item) |
| 878 | } |
| 879 | } |
| 880 | return _asyncset, nil |
| 881 | } |
| 882 | |
| 883 | func NewAsyncSet() *AsyncSet { |
| 884 | obj := &AsyncSet{ |
| 885 | Header: NewHeader(28), |
| 886 | } |
| 887 | return obj |
| 888 | } |
| 889 | |
| 890 | type BadActionErrorMsg struct { |
| 891 | *ErrorMsg |
| 892 | Code BadActionCode |
| 893 | Data []byte |
| 894 | } |
| 895 | |
| 896 | type IBadActionErrorMsg interface { |
| 897 | IErrorMsg |
| 898 | GetCode() BadActionCode |
| 899 | GetData() []byte |
| 900 | } |
| 901 | |
| 902 | func (self *BadActionErrorMsg) GetCode() BadActionCode { |
| 903 | return self.Code |
| 904 | } |
| 905 | |
| 906 | func (self *BadActionErrorMsg) SetCode(v BadActionCode) { |
| 907 | self.Code = v |
| 908 | } |
| 909 | |
| 910 | func (self *BadActionErrorMsg) GetData() []byte { |
| 911 | return self.Data |
| 912 | } |
| 913 | |
| 914 | func (self *BadActionErrorMsg) SetData(v []byte) { |
| 915 | self.Data = v |
| 916 | } |
| 917 | |
| 918 | func (self *BadActionErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 919 | startIndex := len(encoder.Bytes()) |
| 920 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 921 | return err |
| 922 | } |
| 923 | |
| 924 | encoder.PutUint16(uint16(self.Code)) |
| 925 | encoder.Write(self.Data) |
| 926 | length := len(encoder.Bytes()) - startIndex |
| 927 | |
| 928 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 929 | |
| 930 | return nil |
| 931 | } |
| 932 | |
| 933 | func DecodeBadActionErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*BadActionErrorMsg, error) { |
| 934 | _badactionerrormsg := &BadActionErrorMsg{ErrorMsg: parent} |
| 935 | if decoder.Length() < 2 { |
| 936 | return nil, fmt.Errorf("BadActionErrorMsg packet too short: %d < 2", decoder.Length()) |
| 937 | } |
| 938 | _badactionerrormsg.Code = BadActionCode(decoder.ReadUint16()) |
| 939 | _badactionerrormsg.Data = decoder.Read(int(decoder.Length())) |
| 940 | return _badactionerrormsg, nil |
| 941 | } |
| 942 | |
| 943 | func NewBadActionErrorMsg() *BadActionErrorMsg { |
| 944 | obj := &BadActionErrorMsg{ |
| 945 | ErrorMsg: NewErrorMsg(2), |
| 946 | } |
| 947 | return obj |
| 948 | } |
| 949 | |
| 950 | type BadInstructionErrorMsg struct { |
| 951 | *ErrorMsg |
| 952 | Code BadInstructionCode |
| 953 | Data []byte |
| 954 | } |
| 955 | |
| 956 | type IBadInstructionErrorMsg interface { |
| 957 | IErrorMsg |
| 958 | GetCode() BadInstructionCode |
| 959 | GetData() []byte |
| 960 | } |
| 961 | |
| 962 | func (self *BadInstructionErrorMsg) GetCode() BadInstructionCode { |
| 963 | return self.Code |
| 964 | } |
| 965 | |
| 966 | func (self *BadInstructionErrorMsg) SetCode(v BadInstructionCode) { |
| 967 | self.Code = v |
| 968 | } |
| 969 | |
| 970 | func (self *BadInstructionErrorMsg) GetData() []byte { |
| 971 | return self.Data |
| 972 | } |
| 973 | |
| 974 | func (self *BadInstructionErrorMsg) SetData(v []byte) { |
| 975 | self.Data = v |
| 976 | } |
| 977 | |
| 978 | func (self *BadInstructionErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 979 | startIndex := len(encoder.Bytes()) |
| 980 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 981 | return err |
| 982 | } |
| 983 | |
| 984 | encoder.PutUint16(uint16(self.Code)) |
| 985 | encoder.Write(self.Data) |
| 986 | length := len(encoder.Bytes()) - startIndex |
| 987 | |
| 988 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 989 | |
| 990 | return nil |
| 991 | } |
| 992 | |
| 993 | func DecodeBadInstructionErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*BadInstructionErrorMsg, error) { |
| 994 | _badinstructionerrormsg := &BadInstructionErrorMsg{ErrorMsg: parent} |
| 995 | if decoder.Length() < 2 { |
| 996 | return nil, fmt.Errorf("BadInstructionErrorMsg packet too short: %d < 2", decoder.Length()) |
| 997 | } |
| 998 | _badinstructionerrormsg.Code = BadInstructionCode(decoder.ReadUint16()) |
| 999 | _badinstructionerrormsg.Data = decoder.Read(int(decoder.Length())) |
| 1000 | return _badinstructionerrormsg, nil |
| 1001 | } |
| 1002 | |
| 1003 | func NewBadInstructionErrorMsg() *BadInstructionErrorMsg { |
| 1004 | obj := &BadInstructionErrorMsg{ |
| 1005 | ErrorMsg: NewErrorMsg(3), |
| 1006 | } |
| 1007 | return obj |
| 1008 | } |
| 1009 | |
| 1010 | type BadMatchErrorMsg struct { |
| 1011 | *ErrorMsg |
| 1012 | Code BadMatchCode |
| 1013 | Data []byte |
| 1014 | } |
| 1015 | |
| 1016 | type IBadMatchErrorMsg interface { |
| 1017 | IErrorMsg |
| 1018 | GetCode() BadMatchCode |
| 1019 | GetData() []byte |
| 1020 | } |
| 1021 | |
| 1022 | func (self *BadMatchErrorMsg) GetCode() BadMatchCode { |
| 1023 | return self.Code |
| 1024 | } |
| 1025 | |
| 1026 | func (self *BadMatchErrorMsg) SetCode(v BadMatchCode) { |
| 1027 | self.Code = v |
| 1028 | } |
| 1029 | |
| 1030 | func (self *BadMatchErrorMsg) GetData() []byte { |
| 1031 | return self.Data |
| 1032 | } |
| 1033 | |
| 1034 | func (self *BadMatchErrorMsg) SetData(v []byte) { |
| 1035 | self.Data = v |
| 1036 | } |
| 1037 | |
| 1038 | func (self *BadMatchErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 1039 | startIndex := len(encoder.Bytes()) |
| 1040 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 1041 | return err |
| 1042 | } |
| 1043 | |
| 1044 | encoder.PutUint16(uint16(self.Code)) |
| 1045 | encoder.Write(self.Data) |
| 1046 | length := len(encoder.Bytes()) - startIndex |
| 1047 | |
| 1048 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1049 | |
| 1050 | return nil |
| 1051 | } |
| 1052 | |
| 1053 | func DecodeBadMatchErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*BadMatchErrorMsg, error) { |
| 1054 | _badmatcherrormsg := &BadMatchErrorMsg{ErrorMsg: parent} |
| 1055 | if decoder.Length() < 2 { |
| 1056 | return nil, fmt.Errorf("BadMatchErrorMsg packet too short: %d < 2", decoder.Length()) |
| 1057 | } |
| 1058 | _badmatcherrormsg.Code = BadMatchCode(decoder.ReadUint16()) |
| 1059 | _badmatcherrormsg.Data = decoder.Read(int(decoder.Length())) |
| 1060 | return _badmatcherrormsg, nil |
| 1061 | } |
| 1062 | |
| 1063 | func NewBadMatchErrorMsg() *BadMatchErrorMsg { |
| 1064 | obj := &BadMatchErrorMsg{ |
| 1065 | ErrorMsg: NewErrorMsg(4), |
| 1066 | } |
| 1067 | return obj |
| 1068 | } |
| 1069 | |
| 1070 | type BadPropertyErrorMsg struct { |
| 1071 | *ErrorMsg |
| 1072 | Code BadPropertyCode |
| 1073 | Data []byte |
| 1074 | } |
| 1075 | |
| 1076 | type IBadPropertyErrorMsg interface { |
| 1077 | IErrorMsg |
| 1078 | GetCode() BadPropertyCode |
| 1079 | GetData() []byte |
| 1080 | } |
| 1081 | |
| 1082 | func (self *BadPropertyErrorMsg) GetCode() BadPropertyCode { |
| 1083 | return self.Code |
| 1084 | } |
| 1085 | |
| 1086 | func (self *BadPropertyErrorMsg) SetCode(v BadPropertyCode) { |
| 1087 | self.Code = v |
| 1088 | } |
| 1089 | |
| 1090 | func (self *BadPropertyErrorMsg) GetData() []byte { |
| 1091 | return self.Data |
| 1092 | } |
| 1093 | |
| 1094 | func (self *BadPropertyErrorMsg) SetData(v []byte) { |
| 1095 | self.Data = v |
| 1096 | } |
| 1097 | |
| 1098 | func (self *BadPropertyErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 1099 | startIndex := len(encoder.Bytes()) |
| 1100 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 1101 | return err |
| 1102 | } |
| 1103 | |
| 1104 | encoder.PutUint16(uint16(self.Code)) |
| 1105 | encoder.Write(self.Data) |
| 1106 | length := len(encoder.Bytes()) - startIndex |
| 1107 | |
| 1108 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1109 | |
| 1110 | return nil |
| 1111 | } |
| 1112 | |
| 1113 | func DecodeBadPropertyErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*BadPropertyErrorMsg, error) { |
| 1114 | _badpropertyerrormsg := &BadPropertyErrorMsg{ErrorMsg: parent} |
| 1115 | if decoder.Length() < 2 { |
| 1116 | return nil, fmt.Errorf("BadPropertyErrorMsg packet too short: %d < 2", decoder.Length()) |
| 1117 | } |
| 1118 | _badpropertyerrormsg.Code = BadPropertyCode(decoder.ReadUint16()) |
| 1119 | _badpropertyerrormsg.Data = decoder.Read(int(decoder.Length())) |
| 1120 | return _badpropertyerrormsg, nil |
| 1121 | } |
| 1122 | |
| 1123 | func NewBadPropertyErrorMsg() *BadPropertyErrorMsg { |
| 1124 | obj := &BadPropertyErrorMsg{ |
| 1125 | ErrorMsg: NewErrorMsg(14), |
| 1126 | } |
| 1127 | return obj |
| 1128 | } |
| 1129 | |
| 1130 | type BadRequestErrorMsg struct { |
| 1131 | *ErrorMsg |
| 1132 | Code BadRequestCode |
| 1133 | Data []byte |
| 1134 | } |
| 1135 | |
| 1136 | type IBadRequestErrorMsg interface { |
| 1137 | IErrorMsg |
| 1138 | GetCode() BadRequestCode |
| 1139 | GetData() []byte |
| 1140 | } |
| 1141 | |
| 1142 | func (self *BadRequestErrorMsg) GetCode() BadRequestCode { |
| 1143 | return self.Code |
| 1144 | } |
| 1145 | |
| 1146 | func (self *BadRequestErrorMsg) SetCode(v BadRequestCode) { |
| 1147 | self.Code = v |
| 1148 | } |
| 1149 | |
| 1150 | func (self *BadRequestErrorMsg) GetData() []byte { |
| 1151 | return self.Data |
| 1152 | } |
| 1153 | |
| 1154 | func (self *BadRequestErrorMsg) SetData(v []byte) { |
| 1155 | self.Data = v |
| 1156 | } |
| 1157 | |
| 1158 | func (self *BadRequestErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 1159 | startIndex := len(encoder.Bytes()) |
| 1160 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 1161 | return err |
| 1162 | } |
| 1163 | |
| 1164 | encoder.PutUint16(uint16(self.Code)) |
| 1165 | encoder.Write(self.Data) |
| 1166 | length := len(encoder.Bytes()) - startIndex |
| 1167 | |
| 1168 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1169 | |
| 1170 | return nil |
| 1171 | } |
| 1172 | |
| 1173 | func DecodeBadRequestErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*BadRequestErrorMsg, error) { |
| 1174 | _badrequesterrormsg := &BadRequestErrorMsg{ErrorMsg: parent} |
| 1175 | if decoder.Length() < 2 { |
| 1176 | return nil, fmt.Errorf("BadRequestErrorMsg packet too short: %d < 2", decoder.Length()) |
| 1177 | } |
| 1178 | _badrequesterrormsg.Code = BadRequestCode(decoder.ReadUint16()) |
| 1179 | _badrequesterrormsg.Data = decoder.Read(int(decoder.Length())) |
| 1180 | return _badrequesterrormsg, nil |
| 1181 | } |
| 1182 | |
| 1183 | func NewBadRequestErrorMsg() *BadRequestErrorMsg { |
| 1184 | obj := &BadRequestErrorMsg{ |
| 1185 | ErrorMsg: NewErrorMsg(1), |
| 1186 | } |
| 1187 | return obj |
| 1188 | } |
| 1189 | |
| 1190 | type BarrierReply struct { |
| 1191 | *Header |
| 1192 | } |
| 1193 | |
| 1194 | type IBarrierReply interface { |
| 1195 | IHeader |
| 1196 | } |
| 1197 | |
| 1198 | func (self *BarrierReply) Serialize(encoder *goloxi.Encoder) error { |
| 1199 | startIndex := len(encoder.Bytes()) |
| 1200 | if err := self.Header.Serialize(encoder); err != nil { |
| 1201 | return err |
| 1202 | } |
| 1203 | length := len(encoder.Bytes()) - startIndex |
| 1204 | |
| 1205 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1206 | |
| 1207 | return nil |
| 1208 | } |
| 1209 | |
| 1210 | func DecodeBarrierReply(parent *Header, decoder *goloxi.Decoder) (*BarrierReply, error) { |
| 1211 | _barrierreply := &BarrierReply{Header: parent} |
| 1212 | return _barrierreply, nil |
| 1213 | } |
| 1214 | |
| 1215 | func NewBarrierReply() *BarrierReply { |
| 1216 | obj := &BarrierReply{ |
| 1217 | Header: NewHeader(21), |
| 1218 | } |
| 1219 | return obj |
| 1220 | } |
| 1221 | |
| 1222 | type BarrierRequest struct { |
| 1223 | *Header |
| 1224 | } |
| 1225 | |
| 1226 | type IBarrierRequest interface { |
| 1227 | IHeader |
| 1228 | } |
| 1229 | |
| 1230 | func (self *BarrierRequest) Serialize(encoder *goloxi.Encoder) error { |
| 1231 | startIndex := len(encoder.Bytes()) |
| 1232 | if err := self.Header.Serialize(encoder); err != nil { |
| 1233 | return err |
| 1234 | } |
| 1235 | length := len(encoder.Bytes()) - startIndex |
| 1236 | |
| 1237 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1238 | |
| 1239 | return nil |
| 1240 | } |
| 1241 | |
| 1242 | func DecodeBarrierRequest(parent *Header, decoder *goloxi.Decoder) (*BarrierRequest, error) { |
| 1243 | _barrierrequest := &BarrierRequest{Header: parent} |
| 1244 | return _barrierrequest, nil |
| 1245 | } |
| 1246 | |
| 1247 | func NewBarrierRequest() *BarrierRequest { |
| 1248 | obj := &BarrierRequest{ |
| 1249 | Header: NewHeader(20), |
| 1250 | } |
| 1251 | return obj |
| 1252 | } |
| 1253 | |
| 1254 | type Experimenter struct { |
| 1255 | *Header |
| 1256 | Experimenter uint32 |
| 1257 | Subtype uint32 |
| 1258 | } |
| 1259 | |
| 1260 | type IExperimenter interface { |
| 1261 | IHeader |
| 1262 | GetExperimenter() uint32 |
| 1263 | GetSubtype() uint32 |
| 1264 | } |
| 1265 | |
| 1266 | func (self *Experimenter) GetExperimenter() uint32 { |
| 1267 | return self.Experimenter |
| 1268 | } |
| 1269 | |
| 1270 | func (self *Experimenter) SetExperimenter(v uint32) { |
| 1271 | self.Experimenter = v |
| 1272 | } |
| 1273 | |
| 1274 | func (self *Experimenter) GetSubtype() uint32 { |
| 1275 | return self.Subtype |
| 1276 | } |
| 1277 | |
| 1278 | func (self *Experimenter) SetSubtype(v uint32) { |
| 1279 | self.Subtype = v |
| 1280 | } |
| 1281 | |
| 1282 | func (self *Experimenter) Serialize(encoder *goloxi.Encoder) error { |
| 1283 | if err := self.Header.Serialize(encoder); err != nil { |
| 1284 | return err |
| 1285 | } |
| 1286 | |
| 1287 | encoder.PutUint32(uint32(self.Experimenter)) |
| 1288 | encoder.PutUint32(uint32(self.Subtype)) |
| 1289 | |
| 1290 | return nil |
| 1291 | } |
| 1292 | |
| 1293 | func DecodeExperimenter(parent *Header, decoder *goloxi.Decoder) (IExperimenter, error) { |
| 1294 | _experimenter := &Experimenter{Header: parent} |
| 1295 | if decoder.Length() < 8 { |
| 1296 | return nil, fmt.Errorf("Experimenter packet too short: %d < 8", decoder.Length()) |
| 1297 | } |
| 1298 | _experimenter.Experimenter = uint32(decoder.ReadUint32()) |
| 1299 | _experimenter.Subtype = uint32(decoder.ReadUint32()) |
| 1300 | |
| 1301 | switch _experimenter.Experimenter { |
| 1302 | case 8992: |
| 1303 | return DecodeNiciraHeader(_experimenter, decoder) |
| 1304 | case 6035143: |
| 1305 | return DecodeBsnHeader(_experimenter, decoder) |
| 1306 | default: |
| 1307 | return nil, fmt.Errorf("Invalid type '%d' for 'Experimenter'", _experimenter.Experimenter) |
| 1308 | } |
| 1309 | } |
| 1310 | |
| 1311 | func NewExperimenter(_experimenter uint32) *Experimenter { |
| 1312 | obj := &Experimenter{ |
| 1313 | Header: NewHeader(4), |
| 1314 | } |
| 1315 | obj.Experimenter = _experimenter |
| 1316 | return obj |
| 1317 | } |
| 1318 | |
| 1319 | type BsnHeader struct { |
| 1320 | *Experimenter |
| 1321 | } |
| 1322 | |
| 1323 | type IBsnHeader interface { |
| 1324 | IExperimenter |
| 1325 | } |
| 1326 | |
| 1327 | func (self *BsnHeader) Serialize(encoder *goloxi.Encoder) error { |
| 1328 | if err := self.Experimenter.Serialize(encoder); err != nil { |
| 1329 | return err |
| 1330 | } |
| 1331 | |
| 1332 | return nil |
| 1333 | } |
| 1334 | |
| 1335 | func DecodeBsnHeader(parent *Experimenter, decoder *goloxi.Decoder) (IBsnHeader, error) { |
| 1336 | _bsnheader := &BsnHeader{Experimenter: parent} |
| 1337 | |
| 1338 | switch _bsnheader.Subtype { |
| 1339 | case 3: |
| 1340 | return DecodeBsnSetMirroring(_bsnheader, decoder) |
| 1341 | case 4: |
| 1342 | return DecodeBsnGetMirroringRequest(_bsnheader, decoder) |
| 1343 | case 5: |
| 1344 | return DecodeBsnGetMirroringReply(_bsnheader, decoder) |
| 1345 | case 9: |
| 1346 | return DecodeBsnGetInterfacesRequest(_bsnheader, decoder) |
| 1347 | case 10: |
| 1348 | return DecodeBsnGetInterfacesReply(_bsnheader, decoder) |
| 1349 | case 11: |
| 1350 | return DecodeBsnSetPktinSuppressionRequest(_bsnheader, decoder) |
| 1351 | case 15: |
| 1352 | return DecodeBsnVirtualPortCreateRequest(_bsnheader, decoder) |
| 1353 | case 16: |
| 1354 | return DecodeBsnVirtualPortCreateReply(_bsnheader, decoder) |
| 1355 | case 17: |
| 1356 | return DecodeBsnVirtualPortRemoveRequest(_bsnheader, decoder) |
| 1357 | case 18: |
| 1358 | return DecodeBsnBwEnableSetRequest(_bsnheader, decoder) |
| 1359 | case 19: |
| 1360 | return DecodeBsnBwEnableGetRequest(_bsnheader, decoder) |
| 1361 | case 20: |
| 1362 | return DecodeBsnBwEnableGetReply(_bsnheader, decoder) |
| 1363 | case 21: |
| 1364 | return DecodeBsnBwClearDataRequest(_bsnheader, decoder) |
| 1365 | case 22: |
| 1366 | return DecodeBsnBwClearDataReply(_bsnheader, decoder) |
| 1367 | case 23: |
| 1368 | return DecodeBsnBwEnableSetReply(_bsnheader, decoder) |
| 1369 | case 25: |
| 1370 | return DecodeBsnSetPktinSuppressionReply(_bsnheader, decoder) |
| 1371 | case 26: |
| 1372 | return DecodeBsnVirtualPortRemoveReply(_bsnheader, decoder) |
| 1373 | case 31: |
| 1374 | return DecodeBsnPduTxRequest(_bsnheader, decoder) |
| 1375 | case 32: |
| 1376 | return DecodeBsnPduTxReply(_bsnheader, decoder) |
| 1377 | case 33: |
| 1378 | return DecodeBsnPduRxRequest(_bsnheader, decoder) |
| 1379 | case 34: |
| 1380 | return DecodeBsnPduRxReply(_bsnheader, decoder) |
| 1381 | case 35: |
| 1382 | return DecodeBsnPduRxTimeout(_bsnheader, decoder) |
| 1383 | case 36: |
| 1384 | return DecodeBsnFlowIdleEnableSetRequest(_bsnheader, decoder) |
| 1385 | case 37: |
| 1386 | return DecodeBsnFlowIdleEnableSetReply(_bsnheader, decoder) |
| 1387 | case 38: |
| 1388 | return DecodeBsnFlowIdleEnableGetRequest(_bsnheader, decoder) |
| 1389 | case 39: |
| 1390 | return DecodeBsnFlowIdleEnableGetReply(_bsnheader, decoder) |
| 1391 | case 40: |
| 1392 | return DecodeBsnFlowIdle(_bsnheader, decoder) |
| 1393 | case 41: |
| 1394 | return DecodeBsnSetLacpRequest(_bsnheader, decoder) |
| 1395 | case 42: |
| 1396 | return DecodeBsnSetLacpReply(_bsnheader, decoder) |
| 1397 | case 43: |
| 1398 | return DecodeBsnLacpConvergenceNotif(_bsnheader, decoder) |
| 1399 | case 44: |
| 1400 | return DecodeBsnTimeRequest(_bsnheader, decoder) |
| 1401 | case 45: |
| 1402 | return DecodeBsnTimeReply(_bsnheader, decoder) |
| 1403 | case 46: |
| 1404 | return DecodeBsnGentableEntryAdd(_bsnheader, decoder) |
| 1405 | case 47: |
| 1406 | return DecodeBsnGentableEntryDelete(_bsnheader, decoder) |
| 1407 | case 48: |
| 1408 | return DecodeBsnGentableClearRequest(_bsnheader, decoder) |
| 1409 | case 49: |
| 1410 | return DecodeBsnGentableClearReply(_bsnheader, decoder) |
| 1411 | case 50: |
| 1412 | return DecodeBsnGentableSetBucketsSize(_bsnheader, decoder) |
| 1413 | case 51: |
| 1414 | return DecodeBsnGetSwitchPipelineRequest(_bsnheader, decoder) |
| 1415 | case 52: |
| 1416 | return DecodeBsnGetSwitchPipelineReply(_bsnheader, decoder) |
| 1417 | case 53: |
| 1418 | return DecodeBsnSetSwitchPipelineRequest(_bsnheader, decoder) |
| 1419 | case 54: |
| 1420 | return DecodeBsnSetSwitchPipelineReply(_bsnheader, decoder) |
| 1421 | case 56: |
| 1422 | return DecodeBsnControllerConnectionsRequest(_bsnheader, decoder) |
| 1423 | case 57: |
| 1424 | return DecodeBsnControllerConnectionsReply(_bsnheader, decoder) |
| 1425 | case 58: |
| 1426 | return DecodeBsnSetAuxCxnsRequest(_bsnheader, decoder) |
| 1427 | case 59: |
| 1428 | return DecodeBsnSetAuxCxnsReply(_bsnheader, decoder) |
| 1429 | case 60: |
| 1430 | return DecodeBsnArpIdle(_bsnheader, decoder) |
| 1431 | case 61: |
| 1432 | return DecodeBsnTableSetBucketsSize(_bsnheader, decoder) |
| 1433 | case 63: |
| 1434 | return DecodeBsnLog(_bsnheader, decoder) |
| 1435 | case 64: |
| 1436 | return DecodeBsnLuaUpload(_bsnheader, decoder) |
| 1437 | case 65: |
| 1438 | return DecodeBsnLuaCommandRequest(_bsnheader, decoder) |
| 1439 | case 66: |
| 1440 | return DecodeBsnLuaCommandReply(_bsnheader, decoder) |
| 1441 | case 67: |
| 1442 | return DecodeBsnLuaNotification(_bsnheader, decoder) |
| 1443 | case 68: |
| 1444 | return DecodeBsnGenericAsync(_bsnheader, decoder) |
| 1445 | case 69: |
| 1446 | return DecodeBsnTakeover(_bsnheader, decoder) |
| 1447 | case 70: |
| 1448 | return DecodeBsnVlanCounterClear(_bsnheader, decoder) |
| 1449 | case 71: |
| 1450 | return DecodeBsnGenericCommand(_bsnheader, decoder) |
| 1451 | default: |
| 1452 | return nil, fmt.Errorf("Invalid type '%d' for 'BsnHeader'", _bsnheader.Subtype) |
| 1453 | } |
| 1454 | } |
| 1455 | |
| 1456 | func NewBsnHeader(_subtype uint32) *BsnHeader { |
| 1457 | obj := &BsnHeader{ |
| 1458 | Experimenter: NewExperimenter(6035143), |
| 1459 | } |
| 1460 | obj.Subtype = _subtype |
| 1461 | return obj |
| 1462 | } |
| 1463 | |
| 1464 | type BsnArpIdle struct { |
| 1465 | *BsnHeader |
| 1466 | VlanVid uint16 |
| 1467 | Ipv4Addr net.IP |
| 1468 | } |
| 1469 | |
| 1470 | type IBsnArpIdle interface { |
| 1471 | IBsnHeader |
| 1472 | GetVlanVid() uint16 |
| 1473 | GetIpv4Addr() net.IP |
| 1474 | } |
| 1475 | |
| 1476 | func (self *BsnArpIdle) GetVlanVid() uint16 { |
| 1477 | return self.VlanVid |
| 1478 | } |
| 1479 | |
| 1480 | func (self *BsnArpIdle) SetVlanVid(v uint16) { |
| 1481 | self.VlanVid = v |
| 1482 | } |
| 1483 | |
| 1484 | func (self *BsnArpIdle) GetIpv4Addr() net.IP { |
| 1485 | return self.Ipv4Addr |
| 1486 | } |
| 1487 | |
| 1488 | func (self *BsnArpIdle) SetIpv4Addr(v net.IP) { |
| 1489 | self.Ipv4Addr = v |
| 1490 | } |
| 1491 | |
| 1492 | func (self *BsnArpIdle) Serialize(encoder *goloxi.Encoder) error { |
| 1493 | startIndex := len(encoder.Bytes()) |
| 1494 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1495 | return err |
| 1496 | } |
| 1497 | |
| 1498 | encoder.PutUint16(uint16(self.VlanVid)) |
| 1499 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 1500 | encoder.Write(self.Ipv4Addr.To4()) |
| 1501 | length := len(encoder.Bytes()) - startIndex |
| 1502 | |
| 1503 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1504 | |
| 1505 | return nil |
| 1506 | } |
| 1507 | |
| 1508 | func DecodeBsnArpIdle(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnArpIdle, error) { |
| 1509 | _bsnarpidle := &BsnArpIdle{BsnHeader: parent} |
| 1510 | if decoder.Length() < 8 { |
| 1511 | return nil, fmt.Errorf("BsnArpIdle packet too short: %d < 8", decoder.Length()) |
| 1512 | } |
| 1513 | _bsnarpidle.VlanVid = uint16(decoder.ReadUint16()) |
| 1514 | decoder.Skip(2) |
| 1515 | _bsnarpidle.Ipv4Addr = net.IP(decoder.Read(4)) |
| 1516 | return _bsnarpidle, nil |
| 1517 | } |
| 1518 | |
| 1519 | func NewBsnArpIdle() *BsnArpIdle { |
| 1520 | obj := &BsnArpIdle{ |
| 1521 | BsnHeader: NewBsnHeader(60), |
| 1522 | } |
| 1523 | return obj |
| 1524 | } |
| 1525 | |
| 1526 | type ExperimenterErrorMsg struct { |
| 1527 | *ErrorMsg |
| 1528 | Subtype uint16 |
| 1529 | Experimenter uint32 |
| 1530 | } |
| 1531 | |
| 1532 | type IExperimenterErrorMsg interface { |
| 1533 | IErrorMsg |
| 1534 | GetSubtype() uint16 |
| 1535 | GetExperimenter() uint32 |
| 1536 | } |
| 1537 | |
| 1538 | func (self *ExperimenterErrorMsg) GetSubtype() uint16 { |
| 1539 | return self.Subtype |
| 1540 | } |
| 1541 | |
| 1542 | func (self *ExperimenterErrorMsg) SetSubtype(v uint16) { |
| 1543 | self.Subtype = v |
| 1544 | } |
| 1545 | |
| 1546 | func (self *ExperimenterErrorMsg) GetExperimenter() uint32 { |
| 1547 | return self.Experimenter |
| 1548 | } |
| 1549 | |
| 1550 | func (self *ExperimenterErrorMsg) SetExperimenter(v uint32) { |
| 1551 | self.Experimenter = v |
| 1552 | } |
| 1553 | |
| 1554 | func (self *ExperimenterErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 1555 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 1556 | return err |
| 1557 | } |
| 1558 | |
| 1559 | encoder.PutUint16(uint16(self.Subtype)) |
| 1560 | encoder.PutUint32(uint32(self.Experimenter)) |
| 1561 | |
| 1562 | return nil |
| 1563 | } |
| 1564 | |
| 1565 | func DecodeExperimenterErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (IExperimenterErrorMsg, error) { |
| 1566 | _experimentererrormsg := &ExperimenterErrorMsg{ErrorMsg: parent} |
| 1567 | if decoder.Length() < 6 { |
| 1568 | return nil, fmt.Errorf("ExperimenterErrorMsg packet too short: %d < 6", decoder.Length()) |
| 1569 | } |
| 1570 | _experimentererrormsg.Subtype = uint16(decoder.ReadUint16()) |
| 1571 | _experimentererrormsg.Experimenter = uint32(decoder.ReadUint32()) |
| 1572 | |
| 1573 | switch _experimentererrormsg.Experimenter { |
| 1574 | case 6035143: |
| 1575 | return DecodeBsnBaseError(_experimentererrormsg, decoder) |
| 1576 | default: |
| 1577 | return nil, fmt.Errorf("Invalid type '%d' for 'ExperimenterErrorMsg'", _experimentererrormsg.Experimenter) |
| 1578 | } |
| 1579 | } |
| 1580 | |
| 1581 | func NewExperimenterErrorMsg(_experimenter uint32) *ExperimenterErrorMsg { |
| 1582 | obj := &ExperimenterErrorMsg{ |
| 1583 | ErrorMsg: NewErrorMsg(65535), |
| 1584 | } |
| 1585 | obj.Experimenter = _experimenter |
| 1586 | return obj |
| 1587 | } |
| 1588 | |
| 1589 | type BsnBaseError struct { |
| 1590 | *ExperimenterErrorMsg |
| 1591 | ErrMsg string |
| 1592 | } |
| 1593 | |
| 1594 | type IBsnBaseError interface { |
| 1595 | IExperimenterErrorMsg |
| 1596 | GetErrMsg() string |
| 1597 | } |
| 1598 | |
| 1599 | func (self *BsnBaseError) GetErrMsg() string { |
| 1600 | return self.ErrMsg |
| 1601 | } |
| 1602 | |
| 1603 | func (self *BsnBaseError) SetErrMsg(v string) { |
| 1604 | self.ErrMsg = v |
| 1605 | } |
| 1606 | |
| 1607 | func (self *BsnBaseError) Serialize(encoder *goloxi.Encoder) error { |
| 1608 | if err := self.ExperimenterErrorMsg.Serialize(encoder); err != nil { |
| 1609 | return err |
| 1610 | } |
| 1611 | |
| 1612 | encoder.Write([]byte(self.ErrMsg)) |
| 1613 | |
| 1614 | return nil |
| 1615 | } |
| 1616 | |
| 1617 | func DecodeBsnBaseError(parent *ExperimenterErrorMsg, decoder *goloxi.Decoder) (IBsnBaseError, error) { |
| 1618 | _bsnbaseerror := &BsnBaseError{ExperimenterErrorMsg: parent} |
| 1619 | if decoder.Length() < 256 { |
| 1620 | return nil, fmt.Errorf("BsnBaseError packet too short: %d < 256", decoder.Length()) |
| 1621 | } |
| 1622 | _bsnbaseerror.ErrMsg = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 1623 | |
| 1624 | switch _bsnbaseerror.Subtype { |
| 1625 | case 1: |
| 1626 | return DecodeBsnError(_bsnbaseerror, decoder) |
| 1627 | case 2: |
| 1628 | return DecodeBsnGentableError(_bsnbaseerror, decoder) |
| 1629 | default: |
| 1630 | return nil, fmt.Errorf("Invalid type '%d' for 'BsnBaseError'", _bsnbaseerror.Subtype) |
| 1631 | } |
| 1632 | } |
| 1633 | |
| 1634 | func NewBsnBaseError(_subtype uint16) *BsnBaseError { |
| 1635 | obj := &BsnBaseError{ |
| 1636 | ExperimenterErrorMsg: NewExperimenterErrorMsg(6035143), |
| 1637 | } |
| 1638 | obj.Subtype = _subtype |
| 1639 | return obj |
| 1640 | } |
| 1641 | |
| 1642 | type BsnBwClearDataReply struct { |
| 1643 | *BsnHeader |
| 1644 | Status uint32 |
| 1645 | } |
| 1646 | |
| 1647 | type IBsnBwClearDataReply interface { |
| 1648 | IBsnHeader |
| 1649 | GetStatus() uint32 |
| 1650 | } |
| 1651 | |
| 1652 | func (self *BsnBwClearDataReply) GetStatus() uint32 { |
| 1653 | return self.Status |
| 1654 | } |
| 1655 | |
| 1656 | func (self *BsnBwClearDataReply) SetStatus(v uint32) { |
| 1657 | self.Status = v |
| 1658 | } |
| 1659 | |
| 1660 | func (self *BsnBwClearDataReply) Serialize(encoder *goloxi.Encoder) error { |
| 1661 | startIndex := len(encoder.Bytes()) |
| 1662 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1663 | return err |
| 1664 | } |
| 1665 | |
| 1666 | encoder.PutUint32(uint32(self.Status)) |
| 1667 | length := len(encoder.Bytes()) - startIndex |
| 1668 | |
| 1669 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1670 | |
| 1671 | return nil |
| 1672 | } |
| 1673 | |
| 1674 | func DecodeBsnBwClearDataReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwClearDataReply, error) { |
| 1675 | _bsnbwcleardatareply := &BsnBwClearDataReply{BsnHeader: parent} |
| 1676 | if decoder.Length() < 4 { |
| 1677 | return nil, fmt.Errorf("BsnBwClearDataReply packet too short: %d < 4", decoder.Length()) |
| 1678 | } |
| 1679 | _bsnbwcleardatareply.Status = uint32(decoder.ReadUint32()) |
| 1680 | return _bsnbwcleardatareply, nil |
| 1681 | } |
| 1682 | |
| 1683 | func NewBsnBwClearDataReply() *BsnBwClearDataReply { |
| 1684 | obj := &BsnBwClearDataReply{ |
| 1685 | BsnHeader: NewBsnHeader(22), |
| 1686 | } |
| 1687 | return obj |
| 1688 | } |
| 1689 | |
| 1690 | type BsnBwClearDataRequest struct { |
| 1691 | *BsnHeader |
| 1692 | } |
| 1693 | |
| 1694 | type IBsnBwClearDataRequest interface { |
| 1695 | IBsnHeader |
| 1696 | } |
| 1697 | |
| 1698 | func (self *BsnBwClearDataRequest) Serialize(encoder *goloxi.Encoder) error { |
| 1699 | startIndex := len(encoder.Bytes()) |
| 1700 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1701 | return err |
| 1702 | } |
| 1703 | length := len(encoder.Bytes()) - startIndex |
| 1704 | |
| 1705 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1706 | |
| 1707 | return nil |
| 1708 | } |
| 1709 | |
| 1710 | func DecodeBsnBwClearDataRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwClearDataRequest, error) { |
| 1711 | _bsnbwcleardatarequest := &BsnBwClearDataRequest{BsnHeader: parent} |
| 1712 | return _bsnbwcleardatarequest, nil |
| 1713 | } |
| 1714 | |
| 1715 | func NewBsnBwClearDataRequest() *BsnBwClearDataRequest { |
| 1716 | obj := &BsnBwClearDataRequest{ |
| 1717 | BsnHeader: NewBsnHeader(21), |
| 1718 | } |
| 1719 | return obj |
| 1720 | } |
| 1721 | |
| 1722 | type BsnBwEnableGetReply struct { |
| 1723 | *BsnHeader |
| 1724 | Enabled uint32 |
| 1725 | } |
| 1726 | |
| 1727 | type IBsnBwEnableGetReply interface { |
| 1728 | IBsnHeader |
| 1729 | GetEnabled() uint32 |
| 1730 | } |
| 1731 | |
| 1732 | func (self *BsnBwEnableGetReply) GetEnabled() uint32 { |
| 1733 | return self.Enabled |
| 1734 | } |
| 1735 | |
| 1736 | func (self *BsnBwEnableGetReply) SetEnabled(v uint32) { |
| 1737 | self.Enabled = v |
| 1738 | } |
| 1739 | |
| 1740 | func (self *BsnBwEnableGetReply) Serialize(encoder *goloxi.Encoder) error { |
| 1741 | startIndex := len(encoder.Bytes()) |
| 1742 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1743 | return err |
| 1744 | } |
| 1745 | |
| 1746 | encoder.PutUint32(uint32(self.Enabled)) |
| 1747 | length := len(encoder.Bytes()) - startIndex |
| 1748 | |
| 1749 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1750 | |
| 1751 | return nil |
| 1752 | } |
| 1753 | |
| 1754 | func DecodeBsnBwEnableGetReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwEnableGetReply, error) { |
| 1755 | _bsnbwenablegetreply := &BsnBwEnableGetReply{BsnHeader: parent} |
| 1756 | if decoder.Length() < 4 { |
| 1757 | return nil, fmt.Errorf("BsnBwEnableGetReply packet too short: %d < 4", decoder.Length()) |
| 1758 | } |
| 1759 | _bsnbwenablegetreply.Enabled = uint32(decoder.ReadUint32()) |
| 1760 | return _bsnbwenablegetreply, nil |
| 1761 | } |
| 1762 | |
| 1763 | func NewBsnBwEnableGetReply() *BsnBwEnableGetReply { |
| 1764 | obj := &BsnBwEnableGetReply{ |
| 1765 | BsnHeader: NewBsnHeader(20), |
| 1766 | } |
| 1767 | return obj |
| 1768 | } |
| 1769 | |
| 1770 | type BsnBwEnableGetRequest struct { |
| 1771 | *BsnHeader |
| 1772 | } |
| 1773 | |
| 1774 | type IBsnBwEnableGetRequest interface { |
| 1775 | IBsnHeader |
| 1776 | } |
| 1777 | |
| 1778 | func (self *BsnBwEnableGetRequest) Serialize(encoder *goloxi.Encoder) error { |
| 1779 | startIndex := len(encoder.Bytes()) |
| 1780 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1781 | return err |
| 1782 | } |
| 1783 | length := len(encoder.Bytes()) - startIndex |
| 1784 | |
| 1785 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1786 | |
| 1787 | return nil |
| 1788 | } |
| 1789 | |
| 1790 | func DecodeBsnBwEnableGetRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwEnableGetRequest, error) { |
| 1791 | _bsnbwenablegetrequest := &BsnBwEnableGetRequest{BsnHeader: parent} |
| 1792 | return _bsnbwenablegetrequest, nil |
| 1793 | } |
| 1794 | |
| 1795 | func NewBsnBwEnableGetRequest() *BsnBwEnableGetRequest { |
| 1796 | obj := &BsnBwEnableGetRequest{ |
| 1797 | BsnHeader: NewBsnHeader(19), |
| 1798 | } |
| 1799 | return obj |
| 1800 | } |
| 1801 | |
| 1802 | type BsnBwEnableSetReply struct { |
| 1803 | *BsnHeader |
| 1804 | Enable uint32 |
| 1805 | Status uint32 |
| 1806 | } |
| 1807 | |
| 1808 | type IBsnBwEnableSetReply interface { |
| 1809 | IBsnHeader |
| 1810 | GetEnable() uint32 |
| 1811 | GetStatus() uint32 |
| 1812 | } |
| 1813 | |
| 1814 | func (self *BsnBwEnableSetReply) GetEnable() uint32 { |
| 1815 | return self.Enable |
| 1816 | } |
| 1817 | |
| 1818 | func (self *BsnBwEnableSetReply) SetEnable(v uint32) { |
| 1819 | self.Enable = v |
| 1820 | } |
| 1821 | |
| 1822 | func (self *BsnBwEnableSetReply) GetStatus() uint32 { |
| 1823 | return self.Status |
| 1824 | } |
| 1825 | |
| 1826 | func (self *BsnBwEnableSetReply) SetStatus(v uint32) { |
| 1827 | self.Status = v |
| 1828 | } |
| 1829 | |
| 1830 | func (self *BsnBwEnableSetReply) Serialize(encoder *goloxi.Encoder) error { |
| 1831 | startIndex := len(encoder.Bytes()) |
| 1832 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1833 | return err |
| 1834 | } |
| 1835 | |
| 1836 | encoder.PutUint32(uint32(self.Enable)) |
| 1837 | encoder.PutUint32(uint32(self.Status)) |
| 1838 | length := len(encoder.Bytes()) - startIndex |
| 1839 | |
| 1840 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1841 | |
| 1842 | return nil |
| 1843 | } |
| 1844 | |
| 1845 | func DecodeBsnBwEnableSetReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwEnableSetReply, error) { |
| 1846 | _bsnbwenablesetreply := &BsnBwEnableSetReply{BsnHeader: parent} |
| 1847 | if decoder.Length() < 8 { |
| 1848 | return nil, fmt.Errorf("BsnBwEnableSetReply packet too short: %d < 8", decoder.Length()) |
| 1849 | } |
| 1850 | _bsnbwenablesetreply.Enable = uint32(decoder.ReadUint32()) |
| 1851 | _bsnbwenablesetreply.Status = uint32(decoder.ReadUint32()) |
| 1852 | return _bsnbwenablesetreply, nil |
| 1853 | } |
| 1854 | |
| 1855 | func NewBsnBwEnableSetReply() *BsnBwEnableSetReply { |
| 1856 | obj := &BsnBwEnableSetReply{ |
| 1857 | BsnHeader: NewBsnHeader(23), |
| 1858 | } |
| 1859 | return obj |
| 1860 | } |
| 1861 | |
| 1862 | type BsnBwEnableSetRequest struct { |
| 1863 | *BsnHeader |
| 1864 | Enable uint32 |
| 1865 | } |
| 1866 | |
| 1867 | type IBsnBwEnableSetRequest interface { |
| 1868 | IBsnHeader |
| 1869 | GetEnable() uint32 |
| 1870 | } |
| 1871 | |
| 1872 | func (self *BsnBwEnableSetRequest) GetEnable() uint32 { |
| 1873 | return self.Enable |
| 1874 | } |
| 1875 | |
| 1876 | func (self *BsnBwEnableSetRequest) SetEnable(v uint32) { |
| 1877 | self.Enable = v |
| 1878 | } |
| 1879 | |
| 1880 | func (self *BsnBwEnableSetRequest) Serialize(encoder *goloxi.Encoder) error { |
| 1881 | startIndex := len(encoder.Bytes()) |
| 1882 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1883 | return err |
| 1884 | } |
| 1885 | |
| 1886 | encoder.PutUint32(uint32(self.Enable)) |
| 1887 | length := len(encoder.Bytes()) - startIndex |
| 1888 | |
| 1889 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1890 | |
| 1891 | return nil |
| 1892 | } |
| 1893 | |
| 1894 | func DecodeBsnBwEnableSetRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwEnableSetRequest, error) { |
| 1895 | _bsnbwenablesetrequest := &BsnBwEnableSetRequest{BsnHeader: parent} |
| 1896 | if decoder.Length() < 4 { |
| 1897 | return nil, fmt.Errorf("BsnBwEnableSetRequest packet too short: %d < 4", decoder.Length()) |
| 1898 | } |
| 1899 | _bsnbwenablesetrequest.Enable = uint32(decoder.ReadUint32()) |
| 1900 | return _bsnbwenablesetrequest, nil |
| 1901 | } |
| 1902 | |
| 1903 | func NewBsnBwEnableSetRequest() *BsnBwEnableSetRequest { |
| 1904 | obj := &BsnBwEnableSetRequest{ |
| 1905 | BsnHeader: NewBsnHeader(18), |
| 1906 | } |
| 1907 | return obj |
| 1908 | } |
| 1909 | |
| 1910 | type BsnControllerConnectionsReply struct { |
| 1911 | *BsnHeader |
| 1912 | Connections []*BsnControllerConnection |
| 1913 | } |
| 1914 | |
| 1915 | type IBsnControllerConnectionsReply interface { |
| 1916 | IBsnHeader |
| 1917 | GetConnections() []*BsnControllerConnection |
| 1918 | } |
| 1919 | |
| 1920 | func (self *BsnControllerConnectionsReply) GetConnections() []*BsnControllerConnection { |
| 1921 | return self.Connections |
| 1922 | } |
| 1923 | |
| 1924 | func (self *BsnControllerConnectionsReply) SetConnections(v []*BsnControllerConnection) { |
| 1925 | self.Connections = v |
| 1926 | } |
| 1927 | |
| 1928 | func (self *BsnControllerConnectionsReply) Serialize(encoder *goloxi.Encoder) error { |
| 1929 | startIndex := len(encoder.Bytes()) |
| 1930 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1931 | return err |
| 1932 | } |
| 1933 | |
| 1934 | for _, obj := range self.Connections { |
| 1935 | if err := obj.Serialize(encoder); err != nil { |
| 1936 | return err |
| 1937 | } |
| 1938 | } |
| 1939 | length := len(encoder.Bytes()) - startIndex |
| 1940 | |
| 1941 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1942 | |
| 1943 | return nil |
| 1944 | } |
| 1945 | |
| 1946 | func DecodeBsnControllerConnectionsReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnControllerConnectionsReply, error) { |
| 1947 | _bsncontrollerconnectionsreply := &BsnControllerConnectionsReply{BsnHeader: parent} |
| 1948 | |
| 1949 | for decoder.Length() >= 264 { |
| 1950 | item, err := DecodeBsnControllerConnection(decoder) |
| 1951 | if err != nil { |
| 1952 | return nil, err |
| 1953 | } |
| 1954 | if item != nil { |
| 1955 | _bsncontrollerconnectionsreply.Connections = append(_bsncontrollerconnectionsreply.Connections, item) |
| 1956 | } |
| 1957 | } |
| 1958 | return _bsncontrollerconnectionsreply, nil |
| 1959 | } |
| 1960 | |
| 1961 | func NewBsnControllerConnectionsReply() *BsnControllerConnectionsReply { |
| 1962 | obj := &BsnControllerConnectionsReply{ |
| 1963 | BsnHeader: NewBsnHeader(57), |
| 1964 | } |
| 1965 | return obj |
| 1966 | } |
| 1967 | |
| 1968 | type BsnControllerConnectionsRequest struct { |
| 1969 | *BsnHeader |
| 1970 | } |
| 1971 | |
| 1972 | type IBsnControllerConnectionsRequest interface { |
| 1973 | IBsnHeader |
| 1974 | } |
| 1975 | |
| 1976 | func (self *BsnControllerConnectionsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 1977 | startIndex := len(encoder.Bytes()) |
| 1978 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1979 | return err |
| 1980 | } |
| 1981 | length := len(encoder.Bytes()) - startIndex |
| 1982 | |
| 1983 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1984 | |
| 1985 | return nil |
| 1986 | } |
| 1987 | |
| 1988 | func DecodeBsnControllerConnectionsRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnControllerConnectionsRequest, error) { |
| 1989 | _bsncontrollerconnectionsrequest := &BsnControllerConnectionsRequest{BsnHeader: parent} |
| 1990 | return _bsncontrollerconnectionsrequest, nil |
| 1991 | } |
| 1992 | |
| 1993 | func NewBsnControllerConnectionsRequest() *BsnControllerConnectionsRequest { |
| 1994 | obj := &BsnControllerConnectionsRequest{ |
| 1995 | BsnHeader: NewBsnHeader(56), |
| 1996 | } |
| 1997 | return obj |
| 1998 | } |
| 1999 | |
| 2000 | type ExperimenterStatsReply struct { |
| 2001 | *StatsReply |
| 2002 | Experimenter uint32 |
| 2003 | Subtype uint32 |
| 2004 | } |
| 2005 | |
| 2006 | type IExperimenterStatsReply interface { |
| 2007 | IStatsReply |
| 2008 | GetExperimenter() uint32 |
| 2009 | GetSubtype() uint32 |
| 2010 | } |
| 2011 | |
| 2012 | func (self *ExperimenterStatsReply) GetExperimenter() uint32 { |
| 2013 | return self.Experimenter |
| 2014 | } |
| 2015 | |
| 2016 | func (self *ExperimenterStatsReply) SetExperimenter(v uint32) { |
| 2017 | self.Experimenter = v |
| 2018 | } |
| 2019 | |
| 2020 | func (self *ExperimenterStatsReply) GetSubtype() uint32 { |
| 2021 | return self.Subtype |
| 2022 | } |
| 2023 | |
| 2024 | func (self *ExperimenterStatsReply) SetSubtype(v uint32) { |
| 2025 | self.Subtype = v |
| 2026 | } |
| 2027 | |
| 2028 | func (self *ExperimenterStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 2029 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 2030 | return err |
| 2031 | } |
| 2032 | |
| 2033 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 2034 | encoder.PutUint32(uint32(self.Experimenter)) |
| 2035 | encoder.PutUint32(uint32(self.Subtype)) |
| 2036 | |
| 2037 | return nil |
| 2038 | } |
| 2039 | |
| 2040 | func DecodeExperimenterStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (IExperimenterStatsReply, error) { |
| 2041 | _experimenterstatsreply := &ExperimenterStatsReply{StatsReply: parent} |
| 2042 | if decoder.Length() < 12 { |
| 2043 | return nil, fmt.Errorf("ExperimenterStatsReply packet too short: %d < 12", decoder.Length()) |
| 2044 | } |
| 2045 | decoder.Skip(4) |
| 2046 | _experimenterstatsreply.Experimenter = uint32(decoder.ReadUint32()) |
| 2047 | _experimenterstatsreply.Subtype = uint32(decoder.ReadUint32()) |
| 2048 | |
| 2049 | switch _experimenterstatsreply.Experimenter { |
| 2050 | case 8992: |
| 2051 | return DecodeNiciraStatsReply(_experimenterstatsreply, decoder) |
| 2052 | case 6035143: |
| 2053 | return DecodeBsnStatsReply(_experimenterstatsreply, decoder) |
| 2054 | default: |
| 2055 | return nil, fmt.Errorf("Invalid type '%d' for 'ExperimenterStatsReply'", _experimenterstatsreply.Experimenter) |
| 2056 | } |
| 2057 | } |
| 2058 | |
| 2059 | func NewExperimenterStatsReply(_experimenter uint32) *ExperimenterStatsReply { |
| 2060 | obj := &ExperimenterStatsReply{ |
| 2061 | StatsReply: NewStatsReply(65535), |
| 2062 | } |
| 2063 | obj.Experimenter = _experimenter |
| 2064 | return obj |
| 2065 | } |
| 2066 | |
| 2067 | type BsnStatsReply struct { |
| 2068 | *ExperimenterStatsReply |
| 2069 | } |
| 2070 | |
| 2071 | type IBsnStatsReply interface { |
| 2072 | IExperimenterStatsReply |
| 2073 | } |
| 2074 | |
| 2075 | func (self *BsnStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 2076 | if err := self.ExperimenterStatsReply.Serialize(encoder); err != nil { |
| 2077 | return err |
| 2078 | } |
| 2079 | |
| 2080 | return nil |
| 2081 | } |
| 2082 | |
| 2083 | func DecodeBsnStatsReply(parent *ExperimenterStatsReply, decoder *goloxi.Decoder) (IBsnStatsReply, error) { |
| 2084 | _bsnstatsreply := &BsnStatsReply{ExperimenterStatsReply: parent} |
| 2085 | |
| 2086 | switch _bsnstatsreply.Subtype { |
| 2087 | case 1: |
| 2088 | return DecodeBsnLacpStatsReply(_bsnstatsreply, decoder) |
| 2089 | case 2: |
| 2090 | return DecodeBsnGentableEntryDescStatsReply(_bsnstatsreply, decoder) |
| 2091 | case 3: |
| 2092 | return DecodeBsnGentableEntryStatsReply(_bsnstatsreply, decoder) |
| 2093 | case 4: |
| 2094 | return DecodeBsnGentableDescStatsReply(_bsnstatsreply, decoder) |
| 2095 | case 5: |
| 2096 | return DecodeBsnGentableBucketStatsReply(_bsnstatsreply, decoder) |
| 2097 | case 6: |
| 2098 | return DecodeBsnSwitchPipelineStatsReply(_bsnstatsreply, decoder) |
| 2099 | case 7: |
| 2100 | return DecodeBsnGentableStatsReply(_bsnstatsreply, decoder) |
| 2101 | case 8: |
| 2102 | return DecodeBsnPortCounterStatsReply(_bsnstatsreply, decoder) |
| 2103 | case 9: |
| 2104 | return DecodeBsnVlanCounterStatsReply(_bsnstatsreply, decoder) |
| 2105 | case 10: |
| 2106 | return DecodeBsnFlowChecksumBucketStatsReply(_bsnstatsreply, decoder) |
| 2107 | case 11: |
| 2108 | return DecodeBsnTableChecksumStatsReply(_bsnstatsreply, decoder) |
| 2109 | case 12: |
| 2110 | return DecodeBsnDebugCounterStatsReply(_bsnstatsreply, decoder) |
| 2111 | case 13: |
| 2112 | return DecodeBsnDebugCounterDescStatsReply(_bsnstatsreply, decoder) |
| 2113 | case 14: |
| 2114 | return DecodeBsnImageDescStatsReply(_bsnstatsreply, decoder) |
| 2115 | case 15: |
| 2116 | return DecodeBsnVrfCounterStatsReply(_bsnstatsreply, decoder) |
| 2117 | case 16: |
| 2118 | return DecodeBsnGenericStatsReply(_bsnstatsreply, decoder) |
| 2119 | default: |
| 2120 | return nil, fmt.Errorf("Invalid type '%d' for 'BsnStatsReply'", _bsnstatsreply.Subtype) |
| 2121 | } |
| 2122 | } |
| 2123 | |
| 2124 | func NewBsnStatsReply(_subtype uint32) *BsnStatsReply { |
| 2125 | obj := &BsnStatsReply{ |
| 2126 | ExperimenterStatsReply: NewExperimenterStatsReply(6035143), |
| 2127 | } |
| 2128 | obj.Subtype = _subtype |
| 2129 | return obj |
| 2130 | } |
| 2131 | |
| 2132 | type BsnDebugCounterDescStatsReply struct { |
| 2133 | *BsnStatsReply |
| 2134 | Entries []*BsnDebugCounterDescStatsEntry |
| 2135 | } |
| 2136 | |
| 2137 | type IBsnDebugCounterDescStatsReply interface { |
| 2138 | IBsnStatsReply |
| 2139 | GetEntries() []*BsnDebugCounterDescStatsEntry |
| 2140 | } |
| 2141 | |
| 2142 | func (self *BsnDebugCounterDescStatsReply) GetEntries() []*BsnDebugCounterDescStatsEntry { |
| 2143 | return self.Entries |
| 2144 | } |
| 2145 | |
| 2146 | func (self *BsnDebugCounterDescStatsReply) SetEntries(v []*BsnDebugCounterDescStatsEntry) { |
| 2147 | self.Entries = v |
| 2148 | } |
| 2149 | |
| 2150 | func (self *BsnDebugCounterDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 2151 | startIndex := len(encoder.Bytes()) |
| 2152 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 2153 | return err |
| 2154 | } |
| 2155 | |
| 2156 | for _, obj := range self.Entries { |
| 2157 | if err := obj.Serialize(encoder); err != nil { |
| 2158 | return err |
| 2159 | } |
| 2160 | } |
| 2161 | length := len(encoder.Bytes()) - startIndex |
| 2162 | |
| 2163 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2164 | |
| 2165 | return nil |
| 2166 | } |
| 2167 | |
| 2168 | func DecodeBsnDebugCounterDescStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnDebugCounterDescStatsReply, error) { |
| 2169 | _bsndebugcounterdescstatsreply := &BsnDebugCounterDescStatsReply{BsnStatsReply: parent} |
| 2170 | |
| 2171 | for decoder.Length() >= 328 { |
| 2172 | item, err := DecodeBsnDebugCounterDescStatsEntry(decoder) |
| 2173 | if err != nil { |
| 2174 | return nil, err |
| 2175 | } |
| 2176 | if item != nil { |
| 2177 | _bsndebugcounterdescstatsreply.Entries = append(_bsndebugcounterdescstatsreply.Entries, item) |
| 2178 | } |
| 2179 | } |
| 2180 | return _bsndebugcounterdescstatsreply, nil |
| 2181 | } |
| 2182 | |
| 2183 | func NewBsnDebugCounterDescStatsReply() *BsnDebugCounterDescStatsReply { |
| 2184 | obj := &BsnDebugCounterDescStatsReply{ |
| 2185 | BsnStatsReply: NewBsnStatsReply(13), |
| 2186 | } |
| 2187 | return obj |
| 2188 | } |
| 2189 | |
| 2190 | type ExperimenterStatsRequest struct { |
| 2191 | *StatsRequest |
| 2192 | Experimenter uint32 |
| 2193 | Subtype uint32 |
| 2194 | } |
| 2195 | |
| 2196 | type IExperimenterStatsRequest interface { |
| 2197 | IStatsRequest |
| 2198 | GetExperimenter() uint32 |
| 2199 | GetSubtype() uint32 |
| 2200 | } |
| 2201 | |
| 2202 | func (self *ExperimenterStatsRequest) GetExperimenter() uint32 { |
| 2203 | return self.Experimenter |
| 2204 | } |
| 2205 | |
| 2206 | func (self *ExperimenterStatsRequest) SetExperimenter(v uint32) { |
| 2207 | self.Experimenter = v |
| 2208 | } |
| 2209 | |
| 2210 | func (self *ExperimenterStatsRequest) GetSubtype() uint32 { |
| 2211 | return self.Subtype |
| 2212 | } |
| 2213 | |
| 2214 | func (self *ExperimenterStatsRequest) SetSubtype(v uint32) { |
| 2215 | self.Subtype = v |
| 2216 | } |
| 2217 | |
| 2218 | func (self *ExperimenterStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2219 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 2220 | return err |
| 2221 | } |
| 2222 | |
| 2223 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 2224 | encoder.PutUint32(uint32(self.Experimenter)) |
| 2225 | encoder.PutUint32(uint32(self.Subtype)) |
| 2226 | |
| 2227 | return nil |
| 2228 | } |
| 2229 | |
| 2230 | func DecodeExperimenterStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (IExperimenterStatsRequest, error) { |
| 2231 | _experimenterstatsrequest := &ExperimenterStatsRequest{StatsRequest: parent} |
| 2232 | if decoder.Length() < 12 { |
| 2233 | return nil, fmt.Errorf("ExperimenterStatsRequest packet too short: %d < 12", decoder.Length()) |
| 2234 | } |
| 2235 | decoder.Skip(4) |
| 2236 | _experimenterstatsrequest.Experimenter = uint32(decoder.ReadUint32()) |
| 2237 | _experimenterstatsrequest.Subtype = uint32(decoder.ReadUint32()) |
| 2238 | |
| 2239 | switch _experimenterstatsrequest.Experimenter { |
| 2240 | case 8992: |
| 2241 | return DecodeNiciraFlowStatsRequest(_experimenterstatsrequest, decoder) |
| 2242 | case 6035143: |
| 2243 | return DecodeBsnStatsRequest(_experimenterstatsrequest, decoder) |
| 2244 | default: |
| 2245 | return nil, fmt.Errorf("Invalid type '%d' for 'ExperimenterStatsRequest'", _experimenterstatsrequest.Experimenter) |
| 2246 | } |
| 2247 | } |
| 2248 | |
| 2249 | func NewExperimenterStatsRequest(_experimenter uint32) *ExperimenterStatsRequest { |
| 2250 | obj := &ExperimenterStatsRequest{ |
| 2251 | StatsRequest: NewStatsRequest(65535), |
| 2252 | } |
| 2253 | obj.Experimenter = _experimenter |
| 2254 | return obj |
| 2255 | } |
| 2256 | |
| 2257 | type BsnStatsRequest struct { |
| 2258 | *ExperimenterStatsRequest |
| 2259 | } |
| 2260 | |
| 2261 | type IBsnStatsRequest interface { |
| 2262 | IExperimenterStatsRequest |
| 2263 | } |
| 2264 | |
| 2265 | func (self *BsnStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2266 | if err := self.ExperimenterStatsRequest.Serialize(encoder); err != nil { |
| 2267 | return err |
| 2268 | } |
| 2269 | |
| 2270 | return nil |
| 2271 | } |
| 2272 | |
| 2273 | func DecodeBsnStatsRequest(parent *ExperimenterStatsRequest, decoder *goloxi.Decoder) (IBsnStatsRequest, error) { |
| 2274 | _bsnstatsrequest := &BsnStatsRequest{ExperimenterStatsRequest: parent} |
| 2275 | |
| 2276 | switch _bsnstatsrequest.Subtype { |
| 2277 | case 1: |
| 2278 | return DecodeBsnLacpStatsRequest(_bsnstatsrequest, decoder) |
| 2279 | case 2: |
| 2280 | return DecodeBsnGentableEntryDescStatsRequest(_bsnstatsrequest, decoder) |
| 2281 | case 3: |
| 2282 | return DecodeBsnGentableEntryStatsRequest(_bsnstatsrequest, decoder) |
| 2283 | case 4: |
| 2284 | return DecodeBsnGentableDescStatsRequest(_bsnstatsrequest, decoder) |
| 2285 | case 5: |
| 2286 | return DecodeBsnGentableBucketStatsRequest(_bsnstatsrequest, decoder) |
| 2287 | case 6: |
| 2288 | return DecodeBsnSwitchPipelineStatsRequest(_bsnstatsrequest, decoder) |
| 2289 | case 7: |
| 2290 | return DecodeBsnGentableStatsRequest(_bsnstatsrequest, decoder) |
| 2291 | case 8: |
| 2292 | return DecodeBsnPortCounterStatsRequest(_bsnstatsrequest, decoder) |
| 2293 | case 9: |
| 2294 | return DecodeBsnVlanCounterStatsRequest(_bsnstatsrequest, decoder) |
| 2295 | case 10: |
| 2296 | return DecodeBsnFlowChecksumBucketStatsRequest(_bsnstatsrequest, decoder) |
| 2297 | case 11: |
| 2298 | return DecodeBsnTableChecksumStatsRequest(_bsnstatsrequest, decoder) |
| 2299 | case 12: |
| 2300 | return DecodeBsnDebugCounterStatsRequest(_bsnstatsrequest, decoder) |
| 2301 | case 13: |
| 2302 | return DecodeBsnDebugCounterDescStatsRequest(_bsnstatsrequest, decoder) |
| 2303 | case 14: |
| 2304 | return DecodeBsnImageDescStatsRequest(_bsnstatsrequest, decoder) |
| 2305 | case 15: |
| 2306 | return DecodeBsnVrfCounterStatsRequest(_bsnstatsrequest, decoder) |
| 2307 | case 16: |
| 2308 | return DecodeBsnGenericStatsRequest(_bsnstatsrequest, decoder) |
| 2309 | default: |
| 2310 | return nil, fmt.Errorf("Invalid type '%d' for 'BsnStatsRequest'", _bsnstatsrequest.Subtype) |
| 2311 | } |
| 2312 | } |
| 2313 | |
| 2314 | func NewBsnStatsRequest(_subtype uint32) *BsnStatsRequest { |
| 2315 | obj := &BsnStatsRequest{ |
| 2316 | ExperimenterStatsRequest: NewExperimenterStatsRequest(6035143), |
| 2317 | } |
| 2318 | obj.Subtype = _subtype |
| 2319 | return obj |
| 2320 | } |
| 2321 | |
| 2322 | type BsnDebugCounterDescStatsRequest struct { |
| 2323 | *BsnStatsRequest |
| 2324 | } |
| 2325 | |
| 2326 | type IBsnDebugCounterDescStatsRequest interface { |
| 2327 | IBsnStatsRequest |
| 2328 | } |
| 2329 | |
| 2330 | func (self *BsnDebugCounterDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2331 | startIndex := len(encoder.Bytes()) |
| 2332 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 2333 | return err |
| 2334 | } |
| 2335 | length := len(encoder.Bytes()) - startIndex |
| 2336 | |
| 2337 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2338 | |
| 2339 | return nil |
| 2340 | } |
| 2341 | |
| 2342 | func DecodeBsnDebugCounterDescStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnDebugCounterDescStatsRequest, error) { |
| 2343 | _bsndebugcounterdescstatsrequest := &BsnDebugCounterDescStatsRequest{BsnStatsRequest: parent} |
| 2344 | return _bsndebugcounterdescstatsrequest, nil |
| 2345 | } |
| 2346 | |
| 2347 | func NewBsnDebugCounterDescStatsRequest() *BsnDebugCounterDescStatsRequest { |
| 2348 | obj := &BsnDebugCounterDescStatsRequest{ |
| 2349 | BsnStatsRequest: NewBsnStatsRequest(13), |
| 2350 | } |
| 2351 | return obj |
| 2352 | } |
| 2353 | |
| 2354 | type BsnDebugCounterStatsReply struct { |
| 2355 | *BsnStatsReply |
| 2356 | Entries []*BsnDebugCounterStatsEntry |
| 2357 | } |
| 2358 | |
| 2359 | type IBsnDebugCounterStatsReply interface { |
| 2360 | IBsnStatsReply |
| 2361 | GetEntries() []*BsnDebugCounterStatsEntry |
| 2362 | } |
| 2363 | |
| 2364 | func (self *BsnDebugCounterStatsReply) GetEntries() []*BsnDebugCounterStatsEntry { |
| 2365 | return self.Entries |
| 2366 | } |
| 2367 | |
| 2368 | func (self *BsnDebugCounterStatsReply) SetEntries(v []*BsnDebugCounterStatsEntry) { |
| 2369 | self.Entries = v |
| 2370 | } |
| 2371 | |
| 2372 | func (self *BsnDebugCounterStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 2373 | startIndex := len(encoder.Bytes()) |
| 2374 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 2375 | return err |
| 2376 | } |
| 2377 | |
| 2378 | for _, obj := range self.Entries { |
| 2379 | if err := obj.Serialize(encoder); err != nil { |
| 2380 | return err |
| 2381 | } |
| 2382 | } |
| 2383 | length := len(encoder.Bytes()) - startIndex |
| 2384 | |
| 2385 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2386 | |
| 2387 | return nil |
| 2388 | } |
| 2389 | |
| 2390 | func DecodeBsnDebugCounterStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnDebugCounterStatsReply, error) { |
| 2391 | _bsndebugcounterstatsreply := &BsnDebugCounterStatsReply{BsnStatsReply: parent} |
| 2392 | |
| 2393 | for decoder.Length() >= 16 { |
| 2394 | item, err := DecodeBsnDebugCounterStatsEntry(decoder) |
| 2395 | if err != nil { |
| 2396 | return nil, err |
| 2397 | } |
| 2398 | if item != nil { |
| 2399 | _bsndebugcounterstatsreply.Entries = append(_bsndebugcounterstatsreply.Entries, item) |
| 2400 | } |
| 2401 | } |
| 2402 | return _bsndebugcounterstatsreply, nil |
| 2403 | } |
| 2404 | |
| 2405 | func NewBsnDebugCounterStatsReply() *BsnDebugCounterStatsReply { |
| 2406 | obj := &BsnDebugCounterStatsReply{ |
| 2407 | BsnStatsReply: NewBsnStatsReply(12), |
| 2408 | } |
| 2409 | return obj |
| 2410 | } |
| 2411 | |
| 2412 | type BsnDebugCounterStatsRequest struct { |
| 2413 | *BsnStatsRequest |
| 2414 | } |
| 2415 | |
| 2416 | type IBsnDebugCounterStatsRequest interface { |
| 2417 | IBsnStatsRequest |
| 2418 | } |
| 2419 | |
| 2420 | func (self *BsnDebugCounterStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2421 | startIndex := len(encoder.Bytes()) |
| 2422 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 2423 | return err |
| 2424 | } |
| 2425 | length := len(encoder.Bytes()) - startIndex |
| 2426 | |
| 2427 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2428 | |
| 2429 | return nil |
| 2430 | } |
| 2431 | |
| 2432 | func DecodeBsnDebugCounterStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnDebugCounterStatsRequest, error) { |
| 2433 | _bsndebugcounterstatsrequest := &BsnDebugCounterStatsRequest{BsnStatsRequest: parent} |
| 2434 | return _bsndebugcounterstatsrequest, nil |
| 2435 | } |
| 2436 | |
| 2437 | func NewBsnDebugCounterStatsRequest() *BsnDebugCounterStatsRequest { |
| 2438 | obj := &BsnDebugCounterStatsRequest{ |
| 2439 | BsnStatsRequest: NewBsnStatsRequest(12), |
| 2440 | } |
| 2441 | return obj |
| 2442 | } |
| 2443 | |
| 2444 | type BsnError struct { |
| 2445 | *BsnBaseError |
| 2446 | } |
| 2447 | |
| 2448 | type IBsnError interface { |
| 2449 | IBsnBaseError |
| 2450 | } |
| 2451 | |
| 2452 | func (self *BsnError) Serialize(encoder *goloxi.Encoder) error { |
| 2453 | startIndex := len(encoder.Bytes()) |
| 2454 | if err := self.BsnBaseError.Serialize(encoder); err != nil { |
| 2455 | return err |
| 2456 | } |
| 2457 | length := len(encoder.Bytes()) - startIndex |
| 2458 | |
| 2459 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2460 | |
| 2461 | return nil |
| 2462 | } |
| 2463 | |
| 2464 | func DecodeBsnError(parent *BsnBaseError, decoder *goloxi.Decoder) (*BsnError, error) { |
| 2465 | _bsnerror := &BsnError{BsnBaseError: parent} |
| 2466 | return _bsnerror, nil |
| 2467 | } |
| 2468 | |
| 2469 | func NewBsnError() *BsnError { |
| 2470 | obj := &BsnError{ |
| 2471 | BsnBaseError: NewBsnBaseError(1), |
| 2472 | } |
| 2473 | return obj |
| 2474 | } |
| 2475 | |
| 2476 | type BsnFlowChecksumBucketStatsReply struct { |
| 2477 | *BsnStatsReply |
| 2478 | Entries []*BsnFlowChecksumBucketStatsEntry |
| 2479 | } |
| 2480 | |
| 2481 | type IBsnFlowChecksumBucketStatsReply interface { |
| 2482 | IBsnStatsReply |
| 2483 | GetEntries() []*BsnFlowChecksumBucketStatsEntry |
| 2484 | } |
| 2485 | |
| 2486 | func (self *BsnFlowChecksumBucketStatsReply) GetEntries() []*BsnFlowChecksumBucketStatsEntry { |
| 2487 | return self.Entries |
| 2488 | } |
| 2489 | |
| 2490 | func (self *BsnFlowChecksumBucketStatsReply) SetEntries(v []*BsnFlowChecksumBucketStatsEntry) { |
| 2491 | self.Entries = v |
| 2492 | } |
| 2493 | |
| 2494 | func (self *BsnFlowChecksumBucketStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 2495 | startIndex := len(encoder.Bytes()) |
| 2496 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 2497 | return err |
| 2498 | } |
| 2499 | |
| 2500 | for _, obj := range self.Entries { |
| 2501 | if err := obj.Serialize(encoder); err != nil { |
| 2502 | return err |
| 2503 | } |
| 2504 | } |
| 2505 | length := len(encoder.Bytes()) - startIndex |
| 2506 | |
| 2507 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2508 | |
| 2509 | return nil |
| 2510 | } |
| 2511 | |
| 2512 | func DecodeBsnFlowChecksumBucketStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnFlowChecksumBucketStatsReply, error) { |
| 2513 | _bsnflowchecksumbucketstatsreply := &BsnFlowChecksumBucketStatsReply{BsnStatsReply: parent} |
| 2514 | |
| 2515 | for decoder.Length() >= 8 { |
| 2516 | item, err := DecodeBsnFlowChecksumBucketStatsEntry(decoder) |
| 2517 | if err != nil { |
| 2518 | return nil, err |
| 2519 | } |
| 2520 | if item != nil { |
| 2521 | _bsnflowchecksumbucketstatsreply.Entries = append(_bsnflowchecksumbucketstatsreply.Entries, item) |
| 2522 | } |
| 2523 | } |
| 2524 | return _bsnflowchecksumbucketstatsreply, nil |
| 2525 | } |
| 2526 | |
| 2527 | func NewBsnFlowChecksumBucketStatsReply() *BsnFlowChecksumBucketStatsReply { |
| 2528 | obj := &BsnFlowChecksumBucketStatsReply{ |
| 2529 | BsnStatsReply: NewBsnStatsReply(10), |
| 2530 | } |
| 2531 | return obj |
| 2532 | } |
| 2533 | |
| 2534 | type BsnFlowChecksumBucketStatsRequest struct { |
| 2535 | *BsnStatsRequest |
| 2536 | TableId uint8 |
| 2537 | } |
| 2538 | |
| 2539 | type IBsnFlowChecksumBucketStatsRequest interface { |
| 2540 | IBsnStatsRequest |
| 2541 | GetTableId() uint8 |
| 2542 | } |
| 2543 | |
| 2544 | func (self *BsnFlowChecksumBucketStatsRequest) GetTableId() uint8 { |
| 2545 | return self.TableId |
| 2546 | } |
| 2547 | |
| 2548 | func (self *BsnFlowChecksumBucketStatsRequest) SetTableId(v uint8) { |
| 2549 | self.TableId = v |
| 2550 | } |
| 2551 | |
| 2552 | func (self *BsnFlowChecksumBucketStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2553 | startIndex := len(encoder.Bytes()) |
| 2554 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 2555 | return err |
| 2556 | } |
| 2557 | |
| 2558 | encoder.PutUint8(uint8(self.TableId)) |
| 2559 | length := len(encoder.Bytes()) - startIndex |
| 2560 | |
| 2561 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2562 | |
| 2563 | return nil |
| 2564 | } |
| 2565 | |
| 2566 | func DecodeBsnFlowChecksumBucketStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnFlowChecksumBucketStatsRequest, error) { |
| 2567 | _bsnflowchecksumbucketstatsrequest := &BsnFlowChecksumBucketStatsRequest{BsnStatsRequest: parent} |
| 2568 | if decoder.Length() < 1 { |
| 2569 | return nil, fmt.Errorf("BsnFlowChecksumBucketStatsRequest packet too short: %d < 1", decoder.Length()) |
| 2570 | } |
| 2571 | _bsnflowchecksumbucketstatsrequest.TableId = uint8(decoder.ReadByte()) |
| 2572 | return _bsnflowchecksumbucketstatsrequest, nil |
| 2573 | } |
| 2574 | |
| 2575 | func NewBsnFlowChecksumBucketStatsRequest() *BsnFlowChecksumBucketStatsRequest { |
| 2576 | obj := &BsnFlowChecksumBucketStatsRequest{ |
| 2577 | BsnStatsRequest: NewBsnStatsRequest(10), |
| 2578 | } |
| 2579 | return obj |
| 2580 | } |
| 2581 | |
| 2582 | type BsnFlowIdle struct { |
| 2583 | *BsnHeader |
| 2584 | Cookie uint64 |
| 2585 | Priority uint16 |
| 2586 | TableId uint8 |
| 2587 | Match Match |
| 2588 | } |
| 2589 | |
| 2590 | type IBsnFlowIdle interface { |
| 2591 | IBsnHeader |
| 2592 | GetCookie() uint64 |
| 2593 | GetPriority() uint16 |
| 2594 | GetTableId() uint8 |
| 2595 | GetMatch() Match |
| 2596 | } |
| 2597 | |
| 2598 | func (self *BsnFlowIdle) GetCookie() uint64 { |
| 2599 | return self.Cookie |
| 2600 | } |
| 2601 | |
| 2602 | func (self *BsnFlowIdle) SetCookie(v uint64) { |
| 2603 | self.Cookie = v |
| 2604 | } |
| 2605 | |
| 2606 | func (self *BsnFlowIdle) GetPriority() uint16 { |
| 2607 | return self.Priority |
| 2608 | } |
| 2609 | |
| 2610 | func (self *BsnFlowIdle) SetPriority(v uint16) { |
| 2611 | self.Priority = v |
| 2612 | } |
| 2613 | |
| 2614 | func (self *BsnFlowIdle) GetTableId() uint8 { |
| 2615 | return self.TableId |
| 2616 | } |
| 2617 | |
| 2618 | func (self *BsnFlowIdle) SetTableId(v uint8) { |
| 2619 | self.TableId = v |
| 2620 | } |
| 2621 | |
| 2622 | func (self *BsnFlowIdle) GetMatch() Match { |
| 2623 | return self.Match |
| 2624 | } |
| 2625 | |
| 2626 | func (self *BsnFlowIdle) SetMatch(v Match) { |
| 2627 | self.Match = v |
| 2628 | } |
| 2629 | |
| 2630 | func (self *BsnFlowIdle) Serialize(encoder *goloxi.Encoder) error { |
| 2631 | startIndex := len(encoder.Bytes()) |
| 2632 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2633 | return err |
| 2634 | } |
| 2635 | |
| 2636 | encoder.PutUint64(uint64(self.Cookie)) |
| 2637 | encoder.PutUint16(uint16(self.Priority)) |
| 2638 | encoder.PutUint8(uint8(self.TableId)) |
| 2639 | encoder.Write(bytes.Repeat([]byte{0}, 5)) |
| 2640 | if err := self.Match.Serialize(encoder); err != nil { |
| 2641 | return err |
| 2642 | } |
| 2643 | |
| 2644 | length := len(encoder.Bytes()) - startIndex |
| 2645 | |
| 2646 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2647 | |
| 2648 | return nil |
| 2649 | } |
| 2650 | |
| 2651 | func DecodeBsnFlowIdle(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnFlowIdle, error) { |
| 2652 | _bsnflowidle := &BsnFlowIdle{BsnHeader: parent} |
| 2653 | if decoder.Length() < 24 { |
| 2654 | return nil, fmt.Errorf("BsnFlowIdle packet too short: %d < 24", decoder.Length()) |
| 2655 | } |
| 2656 | _bsnflowidle.Cookie = uint64(decoder.ReadUint64()) |
| 2657 | _bsnflowidle.Priority = uint16(decoder.ReadUint16()) |
| 2658 | _bsnflowidle.TableId = uint8(decoder.ReadByte()) |
| 2659 | decoder.Skip(5) |
| 2660 | if err := _bsnflowidle.Match.Decode(decoder); err != nil { |
| 2661 | return nil, err |
| 2662 | } |
| 2663 | |
| 2664 | decoder.SkipAlign() |
| 2665 | return _bsnflowidle, nil |
| 2666 | } |
| 2667 | |
| 2668 | func NewBsnFlowIdle() *BsnFlowIdle { |
| 2669 | obj := &BsnFlowIdle{ |
| 2670 | BsnHeader: NewBsnHeader(40), |
| 2671 | } |
| 2672 | return obj |
| 2673 | } |
| 2674 | |
| 2675 | type BsnFlowIdleEnableGetReply struct { |
| 2676 | *BsnHeader |
| 2677 | Enabled uint32 |
| 2678 | } |
| 2679 | |
| 2680 | type IBsnFlowIdleEnableGetReply interface { |
| 2681 | IBsnHeader |
| 2682 | GetEnabled() uint32 |
| 2683 | } |
| 2684 | |
| 2685 | func (self *BsnFlowIdleEnableGetReply) GetEnabled() uint32 { |
| 2686 | return self.Enabled |
| 2687 | } |
| 2688 | |
| 2689 | func (self *BsnFlowIdleEnableGetReply) SetEnabled(v uint32) { |
| 2690 | self.Enabled = v |
| 2691 | } |
| 2692 | |
| 2693 | func (self *BsnFlowIdleEnableGetReply) Serialize(encoder *goloxi.Encoder) error { |
| 2694 | startIndex := len(encoder.Bytes()) |
| 2695 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2696 | return err |
| 2697 | } |
| 2698 | |
| 2699 | encoder.PutUint32(uint32(self.Enabled)) |
| 2700 | length := len(encoder.Bytes()) - startIndex |
| 2701 | |
| 2702 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2703 | |
| 2704 | return nil |
| 2705 | } |
| 2706 | |
| 2707 | func DecodeBsnFlowIdleEnableGetReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnFlowIdleEnableGetReply, error) { |
| 2708 | _bsnflowidleenablegetreply := &BsnFlowIdleEnableGetReply{BsnHeader: parent} |
| 2709 | if decoder.Length() < 4 { |
| 2710 | return nil, fmt.Errorf("BsnFlowIdleEnableGetReply packet too short: %d < 4", decoder.Length()) |
| 2711 | } |
| 2712 | _bsnflowidleenablegetreply.Enabled = uint32(decoder.ReadUint32()) |
| 2713 | return _bsnflowidleenablegetreply, nil |
| 2714 | } |
| 2715 | |
| 2716 | func NewBsnFlowIdleEnableGetReply() *BsnFlowIdleEnableGetReply { |
| 2717 | obj := &BsnFlowIdleEnableGetReply{ |
| 2718 | BsnHeader: NewBsnHeader(39), |
| 2719 | } |
| 2720 | return obj |
| 2721 | } |
| 2722 | |
| 2723 | type BsnFlowIdleEnableGetRequest struct { |
| 2724 | *BsnHeader |
| 2725 | } |
| 2726 | |
| 2727 | type IBsnFlowIdleEnableGetRequest interface { |
| 2728 | IBsnHeader |
| 2729 | } |
| 2730 | |
| 2731 | func (self *BsnFlowIdleEnableGetRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2732 | startIndex := len(encoder.Bytes()) |
| 2733 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2734 | return err |
| 2735 | } |
| 2736 | length := len(encoder.Bytes()) - startIndex |
| 2737 | |
| 2738 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2739 | |
| 2740 | return nil |
| 2741 | } |
| 2742 | |
| 2743 | func DecodeBsnFlowIdleEnableGetRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnFlowIdleEnableGetRequest, error) { |
| 2744 | _bsnflowidleenablegetrequest := &BsnFlowIdleEnableGetRequest{BsnHeader: parent} |
| 2745 | return _bsnflowidleenablegetrequest, nil |
| 2746 | } |
| 2747 | |
| 2748 | func NewBsnFlowIdleEnableGetRequest() *BsnFlowIdleEnableGetRequest { |
| 2749 | obj := &BsnFlowIdleEnableGetRequest{ |
| 2750 | BsnHeader: NewBsnHeader(38), |
| 2751 | } |
| 2752 | return obj |
| 2753 | } |
| 2754 | |
| 2755 | type BsnFlowIdleEnableSetReply struct { |
| 2756 | *BsnHeader |
| 2757 | Enable uint32 |
| 2758 | Status uint32 |
| 2759 | } |
| 2760 | |
| 2761 | type IBsnFlowIdleEnableSetReply interface { |
| 2762 | IBsnHeader |
| 2763 | GetEnable() uint32 |
| 2764 | GetStatus() uint32 |
| 2765 | } |
| 2766 | |
| 2767 | func (self *BsnFlowIdleEnableSetReply) GetEnable() uint32 { |
| 2768 | return self.Enable |
| 2769 | } |
| 2770 | |
| 2771 | func (self *BsnFlowIdleEnableSetReply) SetEnable(v uint32) { |
| 2772 | self.Enable = v |
| 2773 | } |
| 2774 | |
| 2775 | func (self *BsnFlowIdleEnableSetReply) GetStatus() uint32 { |
| 2776 | return self.Status |
| 2777 | } |
| 2778 | |
| 2779 | func (self *BsnFlowIdleEnableSetReply) SetStatus(v uint32) { |
| 2780 | self.Status = v |
| 2781 | } |
| 2782 | |
| 2783 | func (self *BsnFlowIdleEnableSetReply) Serialize(encoder *goloxi.Encoder) error { |
| 2784 | startIndex := len(encoder.Bytes()) |
| 2785 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2786 | return err |
| 2787 | } |
| 2788 | |
| 2789 | encoder.PutUint32(uint32(self.Enable)) |
| 2790 | encoder.PutUint32(uint32(self.Status)) |
| 2791 | length := len(encoder.Bytes()) - startIndex |
| 2792 | |
| 2793 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2794 | |
| 2795 | return nil |
| 2796 | } |
| 2797 | |
| 2798 | func DecodeBsnFlowIdleEnableSetReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnFlowIdleEnableSetReply, error) { |
| 2799 | _bsnflowidleenablesetreply := &BsnFlowIdleEnableSetReply{BsnHeader: parent} |
| 2800 | if decoder.Length() < 8 { |
| 2801 | return nil, fmt.Errorf("BsnFlowIdleEnableSetReply packet too short: %d < 8", decoder.Length()) |
| 2802 | } |
| 2803 | _bsnflowidleenablesetreply.Enable = uint32(decoder.ReadUint32()) |
| 2804 | _bsnflowidleenablesetreply.Status = uint32(decoder.ReadUint32()) |
| 2805 | return _bsnflowidleenablesetreply, nil |
| 2806 | } |
| 2807 | |
| 2808 | func NewBsnFlowIdleEnableSetReply() *BsnFlowIdleEnableSetReply { |
| 2809 | obj := &BsnFlowIdleEnableSetReply{ |
| 2810 | BsnHeader: NewBsnHeader(37), |
| 2811 | } |
| 2812 | return obj |
| 2813 | } |
| 2814 | |
| 2815 | type BsnFlowIdleEnableSetRequest struct { |
| 2816 | *BsnHeader |
| 2817 | Enable uint32 |
| 2818 | } |
| 2819 | |
| 2820 | type IBsnFlowIdleEnableSetRequest interface { |
| 2821 | IBsnHeader |
| 2822 | GetEnable() uint32 |
| 2823 | } |
| 2824 | |
| 2825 | func (self *BsnFlowIdleEnableSetRequest) GetEnable() uint32 { |
| 2826 | return self.Enable |
| 2827 | } |
| 2828 | |
| 2829 | func (self *BsnFlowIdleEnableSetRequest) SetEnable(v uint32) { |
| 2830 | self.Enable = v |
| 2831 | } |
| 2832 | |
| 2833 | func (self *BsnFlowIdleEnableSetRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2834 | startIndex := len(encoder.Bytes()) |
| 2835 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2836 | return err |
| 2837 | } |
| 2838 | |
| 2839 | encoder.PutUint32(uint32(self.Enable)) |
| 2840 | length := len(encoder.Bytes()) - startIndex |
| 2841 | |
| 2842 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2843 | |
| 2844 | return nil |
| 2845 | } |
| 2846 | |
| 2847 | func DecodeBsnFlowIdleEnableSetRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnFlowIdleEnableSetRequest, error) { |
| 2848 | _bsnflowidleenablesetrequest := &BsnFlowIdleEnableSetRequest{BsnHeader: parent} |
| 2849 | if decoder.Length() < 4 { |
| 2850 | return nil, fmt.Errorf("BsnFlowIdleEnableSetRequest packet too short: %d < 4", decoder.Length()) |
| 2851 | } |
| 2852 | _bsnflowidleenablesetrequest.Enable = uint32(decoder.ReadUint32()) |
| 2853 | return _bsnflowidleenablesetrequest, nil |
| 2854 | } |
| 2855 | |
| 2856 | func NewBsnFlowIdleEnableSetRequest() *BsnFlowIdleEnableSetRequest { |
| 2857 | obj := &BsnFlowIdleEnableSetRequest{ |
| 2858 | BsnHeader: NewBsnHeader(36), |
| 2859 | } |
| 2860 | return obj |
| 2861 | } |
| 2862 | |
| 2863 | type BsnGenericAsync struct { |
| 2864 | *BsnHeader |
| 2865 | Name string |
| 2866 | Tlvs []IBsnTlv |
| 2867 | } |
| 2868 | |
| 2869 | type IBsnGenericAsync interface { |
| 2870 | IBsnHeader |
| 2871 | GetName() string |
| 2872 | GetTlvs() []IBsnTlv |
| 2873 | } |
| 2874 | |
| 2875 | func (self *BsnGenericAsync) GetName() string { |
| 2876 | return self.Name |
| 2877 | } |
| 2878 | |
| 2879 | func (self *BsnGenericAsync) SetName(v string) { |
| 2880 | self.Name = v |
| 2881 | } |
| 2882 | |
| 2883 | func (self *BsnGenericAsync) GetTlvs() []IBsnTlv { |
| 2884 | return self.Tlvs |
| 2885 | } |
| 2886 | |
| 2887 | func (self *BsnGenericAsync) SetTlvs(v []IBsnTlv) { |
| 2888 | self.Tlvs = v |
| 2889 | } |
| 2890 | |
| 2891 | func (self *BsnGenericAsync) Serialize(encoder *goloxi.Encoder) error { |
| 2892 | startIndex := len(encoder.Bytes()) |
| 2893 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2894 | return err |
| 2895 | } |
| 2896 | |
| 2897 | encoder.Write([]byte(self.Name)) |
| 2898 | for _, obj := range self.Tlvs { |
| 2899 | if err := obj.Serialize(encoder); err != nil { |
| 2900 | return err |
| 2901 | } |
| 2902 | } |
| 2903 | length := len(encoder.Bytes()) - startIndex |
| 2904 | |
| 2905 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2906 | |
| 2907 | return nil |
| 2908 | } |
| 2909 | |
| 2910 | func DecodeBsnGenericAsync(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGenericAsync, error) { |
| 2911 | _bsngenericasync := &BsnGenericAsync{BsnHeader: parent} |
| 2912 | if decoder.Length() < 64 { |
| 2913 | return nil, fmt.Errorf("BsnGenericAsync packet too short: %d < 64", decoder.Length()) |
| 2914 | } |
| 2915 | _bsngenericasync.Name = string(bytes.Trim(decoder.Read(64), "\x00")) |
| 2916 | |
| 2917 | for decoder.Length() >= 4 { |
| 2918 | item, err := DecodeBsnTlv(decoder) |
| 2919 | if err != nil { |
| 2920 | return nil, err |
| 2921 | } |
| 2922 | if item != nil { |
| 2923 | _bsngenericasync.Tlvs = append(_bsngenericasync.Tlvs, item) |
| 2924 | } |
| 2925 | } |
| 2926 | return _bsngenericasync, nil |
| 2927 | } |
| 2928 | |
| 2929 | func NewBsnGenericAsync() *BsnGenericAsync { |
| 2930 | obj := &BsnGenericAsync{ |
| 2931 | BsnHeader: NewBsnHeader(68), |
| 2932 | } |
| 2933 | return obj |
| 2934 | } |
| 2935 | |
| 2936 | type BsnGenericCommand struct { |
| 2937 | *BsnHeader |
| 2938 | Name string |
| 2939 | Tlvs []IBsnTlv |
| 2940 | } |
| 2941 | |
| 2942 | type IBsnGenericCommand interface { |
| 2943 | IBsnHeader |
| 2944 | GetName() string |
| 2945 | GetTlvs() []IBsnTlv |
| 2946 | } |
| 2947 | |
| 2948 | func (self *BsnGenericCommand) GetName() string { |
| 2949 | return self.Name |
| 2950 | } |
| 2951 | |
| 2952 | func (self *BsnGenericCommand) SetName(v string) { |
| 2953 | self.Name = v |
| 2954 | } |
| 2955 | |
| 2956 | func (self *BsnGenericCommand) GetTlvs() []IBsnTlv { |
| 2957 | return self.Tlvs |
| 2958 | } |
| 2959 | |
| 2960 | func (self *BsnGenericCommand) SetTlvs(v []IBsnTlv) { |
| 2961 | self.Tlvs = v |
| 2962 | } |
| 2963 | |
| 2964 | func (self *BsnGenericCommand) Serialize(encoder *goloxi.Encoder) error { |
| 2965 | startIndex := len(encoder.Bytes()) |
| 2966 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2967 | return err |
| 2968 | } |
| 2969 | |
| 2970 | encoder.Write([]byte(self.Name)) |
| 2971 | for _, obj := range self.Tlvs { |
| 2972 | if err := obj.Serialize(encoder); err != nil { |
| 2973 | return err |
| 2974 | } |
| 2975 | } |
| 2976 | length := len(encoder.Bytes()) - startIndex |
| 2977 | |
| 2978 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2979 | |
| 2980 | return nil |
| 2981 | } |
| 2982 | |
| 2983 | func DecodeBsnGenericCommand(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGenericCommand, error) { |
| 2984 | _bsngenericcommand := &BsnGenericCommand{BsnHeader: parent} |
| 2985 | if decoder.Length() < 64 { |
| 2986 | return nil, fmt.Errorf("BsnGenericCommand packet too short: %d < 64", decoder.Length()) |
| 2987 | } |
| 2988 | _bsngenericcommand.Name = string(bytes.Trim(decoder.Read(64), "\x00")) |
| 2989 | |
| 2990 | for decoder.Length() >= 4 { |
| 2991 | item, err := DecodeBsnTlv(decoder) |
| 2992 | if err != nil { |
| 2993 | return nil, err |
| 2994 | } |
| 2995 | if item != nil { |
| 2996 | _bsngenericcommand.Tlvs = append(_bsngenericcommand.Tlvs, item) |
| 2997 | } |
| 2998 | } |
| 2999 | return _bsngenericcommand, nil |
| 3000 | } |
| 3001 | |
| 3002 | func NewBsnGenericCommand() *BsnGenericCommand { |
| 3003 | obj := &BsnGenericCommand{ |
| 3004 | BsnHeader: NewBsnHeader(71), |
| 3005 | } |
| 3006 | return obj |
| 3007 | } |
| 3008 | |
| 3009 | type BsnGenericStatsReply struct { |
| 3010 | *BsnStatsReply |
| 3011 | Entries []*BsnGenericStatsEntry |
| 3012 | } |
| 3013 | |
| 3014 | type IBsnGenericStatsReply interface { |
| 3015 | IBsnStatsReply |
| 3016 | GetEntries() []*BsnGenericStatsEntry |
| 3017 | } |
| 3018 | |
| 3019 | func (self *BsnGenericStatsReply) GetEntries() []*BsnGenericStatsEntry { |
| 3020 | return self.Entries |
| 3021 | } |
| 3022 | |
| 3023 | func (self *BsnGenericStatsReply) SetEntries(v []*BsnGenericStatsEntry) { |
| 3024 | self.Entries = v |
| 3025 | } |
| 3026 | |
| 3027 | func (self *BsnGenericStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 3028 | startIndex := len(encoder.Bytes()) |
| 3029 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 3030 | return err |
| 3031 | } |
| 3032 | |
| 3033 | for _, obj := range self.Entries { |
| 3034 | if err := obj.Serialize(encoder); err != nil { |
| 3035 | return err |
| 3036 | } |
| 3037 | } |
| 3038 | length := len(encoder.Bytes()) - startIndex |
| 3039 | |
| 3040 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3041 | |
| 3042 | return nil |
| 3043 | } |
| 3044 | |
| 3045 | func DecodeBsnGenericStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnGenericStatsReply, error) { |
| 3046 | _bsngenericstatsreply := &BsnGenericStatsReply{BsnStatsReply: parent} |
| 3047 | |
| 3048 | for decoder.Length() >= 2 { |
| 3049 | item, err := DecodeBsnGenericStatsEntry(decoder) |
| 3050 | if err != nil { |
| 3051 | return nil, err |
| 3052 | } |
| 3053 | if item != nil { |
| 3054 | _bsngenericstatsreply.Entries = append(_bsngenericstatsreply.Entries, item) |
| 3055 | } |
| 3056 | } |
| 3057 | return _bsngenericstatsreply, nil |
| 3058 | } |
| 3059 | |
| 3060 | func NewBsnGenericStatsReply() *BsnGenericStatsReply { |
| 3061 | obj := &BsnGenericStatsReply{ |
| 3062 | BsnStatsReply: NewBsnStatsReply(16), |
| 3063 | } |
| 3064 | return obj |
| 3065 | } |
| 3066 | |
| 3067 | type BsnGenericStatsRequest struct { |
| 3068 | *BsnStatsRequest |
| 3069 | Name string |
| 3070 | Tlvs []IBsnTlv |
| 3071 | } |
| 3072 | |
| 3073 | type IBsnGenericStatsRequest interface { |
| 3074 | IBsnStatsRequest |
| 3075 | GetName() string |
| 3076 | GetTlvs() []IBsnTlv |
| 3077 | } |
| 3078 | |
| 3079 | func (self *BsnGenericStatsRequest) GetName() string { |
| 3080 | return self.Name |
| 3081 | } |
| 3082 | |
| 3083 | func (self *BsnGenericStatsRequest) SetName(v string) { |
| 3084 | self.Name = v |
| 3085 | } |
| 3086 | |
| 3087 | func (self *BsnGenericStatsRequest) GetTlvs() []IBsnTlv { |
| 3088 | return self.Tlvs |
| 3089 | } |
| 3090 | |
| 3091 | func (self *BsnGenericStatsRequest) SetTlvs(v []IBsnTlv) { |
| 3092 | self.Tlvs = v |
| 3093 | } |
| 3094 | |
| 3095 | func (self *BsnGenericStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 3096 | startIndex := len(encoder.Bytes()) |
| 3097 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 3098 | return err |
| 3099 | } |
| 3100 | |
| 3101 | encoder.Write([]byte(self.Name)) |
| 3102 | for _, obj := range self.Tlvs { |
| 3103 | if err := obj.Serialize(encoder); err != nil { |
| 3104 | return err |
| 3105 | } |
| 3106 | } |
| 3107 | length := len(encoder.Bytes()) - startIndex |
| 3108 | |
| 3109 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3110 | |
| 3111 | return nil |
| 3112 | } |
| 3113 | |
| 3114 | func DecodeBsnGenericStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnGenericStatsRequest, error) { |
| 3115 | _bsngenericstatsrequest := &BsnGenericStatsRequest{BsnStatsRequest: parent} |
| 3116 | if decoder.Length() < 64 { |
| 3117 | return nil, fmt.Errorf("BsnGenericStatsRequest packet too short: %d < 64", decoder.Length()) |
| 3118 | } |
| 3119 | _bsngenericstatsrequest.Name = string(bytes.Trim(decoder.Read(64), "\x00")) |
| 3120 | |
| 3121 | for decoder.Length() >= 4 { |
| 3122 | item, err := DecodeBsnTlv(decoder) |
| 3123 | if err != nil { |
| 3124 | return nil, err |
| 3125 | } |
| 3126 | if item != nil { |
| 3127 | _bsngenericstatsrequest.Tlvs = append(_bsngenericstatsrequest.Tlvs, item) |
| 3128 | } |
| 3129 | } |
| 3130 | return _bsngenericstatsrequest, nil |
| 3131 | } |
| 3132 | |
| 3133 | func NewBsnGenericStatsRequest() *BsnGenericStatsRequest { |
| 3134 | obj := &BsnGenericStatsRequest{ |
| 3135 | BsnStatsRequest: NewBsnStatsRequest(16), |
| 3136 | } |
| 3137 | return obj |
| 3138 | } |
| 3139 | |
| 3140 | type BsnGentableBucketStatsReply struct { |
| 3141 | *BsnStatsReply |
| 3142 | Entries []*BsnGentableBucketStatsEntry |
| 3143 | } |
| 3144 | |
| 3145 | type IBsnGentableBucketStatsReply interface { |
| 3146 | IBsnStatsReply |
| 3147 | GetEntries() []*BsnGentableBucketStatsEntry |
| 3148 | } |
| 3149 | |
| 3150 | func (self *BsnGentableBucketStatsReply) GetEntries() []*BsnGentableBucketStatsEntry { |
| 3151 | return self.Entries |
| 3152 | } |
| 3153 | |
| 3154 | func (self *BsnGentableBucketStatsReply) SetEntries(v []*BsnGentableBucketStatsEntry) { |
| 3155 | self.Entries = v |
| 3156 | } |
| 3157 | |
| 3158 | func (self *BsnGentableBucketStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 3159 | startIndex := len(encoder.Bytes()) |
| 3160 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 3161 | return err |
| 3162 | } |
| 3163 | |
| 3164 | for _, obj := range self.Entries { |
| 3165 | if err := obj.Serialize(encoder); err != nil { |
| 3166 | return err |
| 3167 | } |
| 3168 | } |
| 3169 | length := len(encoder.Bytes()) - startIndex |
| 3170 | |
| 3171 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3172 | |
| 3173 | return nil |
| 3174 | } |
| 3175 | |
| 3176 | func DecodeBsnGentableBucketStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnGentableBucketStatsReply, error) { |
| 3177 | _bsngentablebucketstatsreply := &BsnGentableBucketStatsReply{BsnStatsReply: parent} |
| 3178 | |
| 3179 | for decoder.Length() >= 16 { |
| 3180 | item, err := DecodeBsnGentableBucketStatsEntry(decoder) |
| 3181 | if err != nil { |
| 3182 | return nil, err |
| 3183 | } |
| 3184 | if item != nil { |
| 3185 | _bsngentablebucketstatsreply.Entries = append(_bsngentablebucketstatsreply.Entries, item) |
| 3186 | } |
| 3187 | } |
| 3188 | return _bsngentablebucketstatsreply, nil |
| 3189 | } |
| 3190 | |
| 3191 | func NewBsnGentableBucketStatsReply() *BsnGentableBucketStatsReply { |
| 3192 | obj := &BsnGentableBucketStatsReply{ |
| 3193 | BsnStatsReply: NewBsnStatsReply(5), |
| 3194 | } |
| 3195 | return obj |
| 3196 | } |
| 3197 | |
| 3198 | type BsnGentableBucketStatsRequest struct { |
| 3199 | *BsnStatsRequest |
| 3200 | TableId uint16 |
| 3201 | } |
| 3202 | |
| 3203 | type IBsnGentableBucketStatsRequest interface { |
| 3204 | IBsnStatsRequest |
| 3205 | GetTableId() uint16 |
| 3206 | } |
| 3207 | |
| 3208 | func (self *BsnGentableBucketStatsRequest) GetTableId() uint16 { |
| 3209 | return self.TableId |
| 3210 | } |
| 3211 | |
| 3212 | func (self *BsnGentableBucketStatsRequest) SetTableId(v uint16) { |
| 3213 | self.TableId = v |
| 3214 | } |
| 3215 | |
| 3216 | func (self *BsnGentableBucketStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 3217 | startIndex := len(encoder.Bytes()) |
| 3218 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 3219 | return err |
| 3220 | } |
| 3221 | |
| 3222 | encoder.PutUint16(uint16(self.TableId)) |
| 3223 | length := len(encoder.Bytes()) - startIndex |
| 3224 | |
| 3225 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3226 | |
| 3227 | return nil |
| 3228 | } |
| 3229 | |
| 3230 | func DecodeBsnGentableBucketStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnGentableBucketStatsRequest, error) { |
| 3231 | _bsngentablebucketstatsrequest := &BsnGentableBucketStatsRequest{BsnStatsRequest: parent} |
| 3232 | if decoder.Length() < 2 { |
| 3233 | return nil, fmt.Errorf("BsnGentableBucketStatsRequest packet too short: %d < 2", decoder.Length()) |
| 3234 | } |
| 3235 | _bsngentablebucketstatsrequest.TableId = uint16(decoder.ReadUint16()) |
| 3236 | return _bsngentablebucketstatsrequest, nil |
| 3237 | } |
| 3238 | |
| 3239 | func NewBsnGentableBucketStatsRequest() *BsnGentableBucketStatsRequest { |
| 3240 | obj := &BsnGentableBucketStatsRequest{ |
| 3241 | BsnStatsRequest: NewBsnStatsRequest(5), |
| 3242 | } |
| 3243 | return obj |
| 3244 | } |
| 3245 | |
| 3246 | type BsnGentableClearReply struct { |
| 3247 | *BsnHeader |
| 3248 | TableId uint16 |
| 3249 | DeletedCount uint32 |
| 3250 | ErrorCount uint32 |
| 3251 | } |
| 3252 | |
| 3253 | type IBsnGentableClearReply interface { |
| 3254 | IBsnHeader |
| 3255 | GetTableId() uint16 |
| 3256 | GetDeletedCount() uint32 |
| 3257 | GetErrorCount() uint32 |
| 3258 | } |
| 3259 | |
| 3260 | func (self *BsnGentableClearReply) GetTableId() uint16 { |
| 3261 | return self.TableId |
| 3262 | } |
| 3263 | |
| 3264 | func (self *BsnGentableClearReply) SetTableId(v uint16) { |
| 3265 | self.TableId = v |
| 3266 | } |
| 3267 | |
| 3268 | func (self *BsnGentableClearReply) GetDeletedCount() uint32 { |
| 3269 | return self.DeletedCount |
| 3270 | } |
| 3271 | |
| 3272 | func (self *BsnGentableClearReply) SetDeletedCount(v uint32) { |
| 3273 | self.DeletedCount = v |
| 3274 | } |
| 3275 | |
| 3276 | func (self *BsnGentableClearReply) GetErrorCount() uint32 { |
| 3277 | return self.ErrorCount |
| 3278 | } |
| 3279 | |
| 3280 | func (self *BsnGentableClearReply) SetErrorCount(v uint32) { |
| 3281 | self.ErrorCount = v |
| 3282 | } |
| 3283 | |
| 3284 | func (self *BsnGentableClearReply) Serialize(encoder *goloxi.Encoder) error { |
| 3285 | startIndex := len(encoder.Bytes()) |
| 3286 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 3287 | return err |
| 3288 | } |
| 3289 | |
| 3290 | encoder.PutUint16(uint16(self.TableId)) |
| 3291 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 3292 | encoder.PutUint32(uint32(self.DeletedCount)) |
| 3293 | encoder.PutUint32(uint32(self.ErrorCount)) |
| 3294 | length := len(encoder.Bytes()) - startIndex |
| 3295 | |
| 3296 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3297 | |
| 3298 | return nil |
| 3299 | } |
| 3300 | |
| 3301 | func DecodeBsnGentableClearReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGentableClearReply, error) { |
| 3302 | _bsngentableclearreply := &BsnGentableClearReply{BsnHeader: parent} |
| 3303 | if decoder.Length() < 12 { |
| 3304 | return nil, fmt.Errorf("BsnGentableClearReply packet too short: %d < 12", decoder.Length()) |
| 3305 | } |
| 3306 | _bsngentableclearreply.TableId = uint16(decoder.ReadUint16()) |
| 3307 | decoder.Skip(2) |
| 3308 | _bsngentableclearreply.DeletedCount = uint32(decoder.ReadUint32()) |
| 3309 | _bsngentableclearreply.ErrorCount = uint32(decoder.ReadUint32()) |
| 3310 | return _bsngentableclearreply, nil |
| 3311 | } |
| 3312 | |
| 3313 | func NewBsnGentableClearReply() *BsnGentableClearReply { |
| 3314 | obj := &BsnGentableClearReply{ |
| 3315 | BsnHeader: NewBsnHeader(49), |
| 3316 | } |
| 3317 | return obj |
| 3318 | } |
| 3319 | |
| 3320 | type BsnGentableClearRequest struct { |
| 3321 | *BsnHeader |
| 3322 | TableId uint16 |
| 3323 | Checksum Checksum128 |
| 3324 | ChecksumMask Checksum128 |
| 3325 | } |
| 3326 | |
| 3327 | type IBsnGentableClearRequest interface { |
| 3328 | IBsnHeader |
| 3329 | GetTableId() uint16 |
| 3330 | GetChecksum() Checksum128 |
| 3331 | GetChecksumMask() Checksum128 |
| 3332 | } |
| 3333 | |
| 3334 | func (self *BsnGentableClearRequest) GetTableId() uint16 { |
| 3335 | return self.TableId |
| 3336 | } |
| 3337 | |
| 3338 | func (self *BsnGentableClearRequest) SetTableId(v uint16) { |
| 3339 | self.TableId = v |
| 3340 | } |
| 3341 | |
| 3342 | func (self *BsnGentableClearRequest) GetChecksum() Checksum128 { |
| 3343 | return self.Checksum |
| 3344 | } |
| 3345 | |
| 3346 | func (self *BsnGentableClearRequest) SetChecksum(v Checksum128) { |
| 3347 | self.Checksum = v |
| 3348 | } |
| 3349 | |
| 3350 | func (self *BsnGentableClearRequest) GetChecksumMask() Checksum128 { |
| 3351 | return self.ChecksumMask |
| 3352 | } |
| 3353 | |
| 3354 | func (self *BsnGentableClearRequest) SetChecksumMask(v Checksum128) { |
| 3355 | self.ChecksumMask = v |
| 3356 | } |
| 3357 | |
| 3358 | func (self *BsnGentableClearRequest) Serialize(encoder *goloxi.Encoder) error { |
| 3359 | startIndex := len(encoder.Bytes()) |
| 3360 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 3361 | return err |
| 3362 | } |
| 3363 | |
| 3364 | encoder.PutUint16(uint16(self.TableId)) |
| 3365 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 3366 | self.Checksum.Serialize(encoder) |
| 3367 | self.ChecksumMask.Serialize(encoder) |
| 3368 | length := len(encoder.Bytes()) - startIndex |
| 3369 | |
| 3370 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3371 | |
| 3372 | return nil |
| 3373 | } |
| 3374 | |
| 3375 | func DecodeBsnGentableClearRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGentableClearRequest, error) { |
| 3376 | _bsngentableclearrequest := &BsnGentableClearRequest{BsnHeader: parent} |
| 3377 | if decoder.Length() < 36 { |
| 3378 | return nil, fmt.Errorf("BsnGentableClearRequest packet too short: %d < 36", decoder.Length()) |
| 3379 | } |
| 3380 | _bsngentableclearrequest.TableId = uint16(decoder.ReadUint16()) |
| 3381 | decoder.Skip(2) |
| 3382 | _bsngentableclearrequest.Checksum.Decode(decoder) |
| 3383 | _bsngentableclearrequest.ChecksumMask.Decode(decoder) |
| 3384 | return _bsngentableclearrequest, nil |
| 3385 | } |
| 3386 | |
| 3387 | func NewBsnGentableClearRequest() *BsnGentableClearRequest { |
| 3388 | obj := &BsnGentableClearRequest{ |
| 3389 | BsnHeader: NewBsnHeader(48), |
| 3390 | } |
| 3391 | return obj |
| 3392 | } |
| 3393 | |
| 3394 | type BsnGentableDescStatsReply struct { |
| 3395 | *BsnStatsReply |
| 3396 | Entries []*BsnGentableDescStatsEntry |
| 3397 | } |
| 3398 | |
| 3399 | type IBsnGentableDescStatsReply interface { |
| 3400 | IBsnStatsReply |
| 3401 | GetEntries() []*BsnGentableDescStatsEntry |
| 3402 | } |
| 3403 | |
| 3404 | func (self *BsnGentableDescStatsReply) GetEntries() []*BsnGentableDescStatsEntry { |
| 3405 | return self.Entries |
| 3406 | } |
| 3407 | |
| 3408 | func (self *BsnGentableDescStatsReply) SetEntries(v []*BsnGentableDescStatsEntry) { |
| 3409 | self.Entries = v |
| 3410 | } |
| 3411 | |
| 3412 | func (self *BsnGentableDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 3413 | startIndex := len(encoder.Bytes()) |
| 3414 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 3415 | return err |
| 3416 | } |
| 3417 | |
| 3418 | for _, obj := range self.Entries { |
| 3419 | if err := obj.Serialize(encoder); err != nil { |
| 3420 | return err |
| 3421 | } |
| 3422 | } |
| 3423 | length := len(encoder.Bytes()) - startIndex |
| 3424 | |
| 3425 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3426 | |
| 3427 | return nil |
| 3428 | } |
| 3429 | |
| 3430 | func DecodeBsnGentableDescStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnGentableDescStatsReply, error) { |
| 3431 | _bsngentabledescstatsreply := &BsnGentableDescStatsReply{BsnStatsReply: parent} |
| 3432 | |
| 3433 | for decoder.Length() >= 48 { |
| 3434 | item, err := DecodeBsnGentableDescStatsEntry(decoder) |
| 3435 | if err != nil { |
| 3436 | return nil, err |
| 3437 | } |
| 3438 | if item != nil { |
| 3439 | _bsngentabledescstatsreply.Entries = append(_bsngentabledescstatsreply.Entries, item) |
| 3440 | } |
| 3441 | } |
| 3442 | return _bsngentabledescstatsreply, nil |
| 3443 | } |
| 3444 | |
| 3445 | func NewBsnGentableDescStatsReply() *BsnGentableDescStatsReply { |
| 3446 | obj := &BsnGentableDescStatsReply{ |
| 3447 | BsnStatsReply: NewBsnStatsReply(4), |
| 3448 | } |
| 3449 | return obj |
| 3450 | } |
| 3451 | |
| 3452 | type BsnGentableDescStatsRequest struct { |
| 3453 | *BsnStatsRequest |
| 3454 | } |
| 3455 | |
| 3456 | type IBsnGentableDescStatsRequest interface { |
| 3457 | IBsnStatsRequest |
| 3458 | } |
| 3459 | |
| 3460 | func (self *BsnGentableDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 3461 | startIndex := len(encoder.Bytes()) |
| 3462 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 3463 | return err |
| 3464 | } |
| 3465 | length := len(encoder.Bytes()) - startIndex |
| 3466 | |
| 3467 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3468 | |
| 3469 | return nil |
| 3470 | } |
| 3471 | |
| 3472 | func DecodeBsnGentableDescStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnGentableDescStatsRequest, error) { |
| 3473 | _bsngentabledescstatsrequest := &BsnGentableDescStatsRequest{BsnStatsRequest: parent} |
| 3474 | return _bsngentabledescstatsrequest, nil |
| 3475 | } |
| 3476 | |
| 3477 | func NewBsnGentableDescStatsRequest() *BsnGentableDescStatsRequest { |
| 3478 | obj := &BsnGentableDescStatsRequest{ |
| 3479 | BsnStatsRequest: NewBsnStatsRequest(4), |
| 3480 | } |
| 3481 | return obj |
| 3482 | } |
| 3483 | |
| 3484 | type BsnGentableEntryAdd struct { |
| 3485 | *BsnHeader |
| 3486 | TableId uint16 |
| 3487 | KeyLength uint16 |
| 3488 | Checksum Checksum128 |
| 3489 | Key []IBsnTlv |
| 3490 | Value []IBsnTlv |
| 3491 | } |
| 3492 | |
| 3493 | type IBsnGentableEntryAdd interface { |
| 3494 | IBsnHeader |
| 3495 | GetTableId() uint16 |
| 3496 | GetKeyLength() uint16 |
| 3497 | GetChecksum() Checksum128 |
| 3498 | GetKey() []IBsnTlv |
| 3499 | GetValue() []IBsnTlv |
| 3500 | } |
| 3501 | |
| 3502 | func (self *BsnGentableEntryAdd) GetTableId() uint16 { |
| 3503 | return self.TableId |
| 3504 | } |
| 3505 | |
| 3506 | func (self *BsnGentableEntryAdd) SetTableId(v uint16) { |
| 3507 | self.TableId = v |
| 3508 | } |
| 3509 | |
| 3510 | func (self *BsnGentableEntryAdd) GetKeyLength() uint16 { |
| 3511 | return self.KeyLength |
| 3512 | } |
| 3513 | |
| 3514 | func (self *BsnGentableEntryAdd) SetKeyLength(v uint16) { |
| 3515 | self.KeyLength = v |
| 3516 | } |
| 3517 | |
| 3518 | func (self *BsnGentableEntryAdd) GetChecksum() Checksum128 { |
| 3519 | return self.Checksum |
| 3520 | } |
| 3521 | |
| 3522 | func (self *BsnGentableEntryAdd) SetChecksum(v Checksum128) { |
| 3523 | self.Checksum = v |
| 3524 | } |
| 3525 | |
| 3526 | func (self *BsnGentableEntryAdd) GetKey() []IBsnTlv { |
| 3527 | return self.Key |
| 3528 | } |
| 3529 | |
| 3530 | func (self *BsnGentableEntryAdd) SetKey(v []IBsnTlv) { |
| 3531 | self.Key = v |
| 3532 | } |
| 3533 | |
| 3534 | func (self *BsnGentableEntryAdd) GetValue() []IBsnTlv { |
| 3535 | return self.Value |
| 3536 | } |
| 3537 | |
| 3538 | func (self *BsnGentableEntryAdd) SetValue(v []IBsnTlv) { |
| 3539 | self.Value = v |
| 3540 | } |
| 3541 | |
| 3542 | func (self *BsnGentableEntryAdd) Serialize(encoder *goloxi.Encoder) error { |
| 3543 | startIndex := len(encoder.Bytes()) |
| 3544 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 3545 | return err |
| 3546 | } |
| 3547 | |
| 3548 | encoder.PutUint16(uint16(self.TableId)) |
| 3549 | encoder.PutUint16(uint16(self.KeyLength)) |
| 3550 | self.Checksum.Serialize(encoder) |
| 3551 | for _, obj := range self.Key { |
| 3552 | if err := obj.Serialize(encoder); err != nil { |
| 3553 | return err |
| 3554 | } |
| 3555 | } |
| 3556 | for _, obj := range self.Value { |
| 3557 | if err := obj.Serialize(encoder); err != nil { |
| 3558 | return err |
| 3559 | } |
| 3560 | } |
| 3561 | length := len(encoder.Bytes()) - startIndex |
| 3562 | |
| 3563 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3564 | |
| 3565 | return nil |
| 3566 | } |
| 3567 | |
| 3568 | func DecodeBsnGentableEntryAdd(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGentableEntryAdd, error) { |
| 3569 | _bsngentableentryadd := &BsnGentableEntryAdd{BsnHeader: parent} |
| 3570 | if decoder.Length() < 20 { |
| 3571 | return nil, fmt.Errorf("BsnGentableEntryAdd packet too short: %d < 20", decoder.Length()) |
| 3572 | } |
| 3573 | _bsngentableentryadd.TableId = uint16(decoder.ReadUint16()) |
| 3574 | _bsngentableentryadd.KeyLength = uint16(decoder.ReadUint16()) |
| 3575 | _bsngentableentryadd.Checksum.Decode(decoder) |
| 3576 | |
| 3577 | end := decoder.Offset() + int(_bsngentableentryadd.KeyLength) |
| 3578 | for decoder.Offset() < end { |
| 3579 | item, err := DecodeBsnTlv(decoder) |
| 3580 | if err != nil { |
| 3581 | return nil, err |
| 3582 | } |
| 3583 | if item != nil { |
| 3584 | _bsngentableentryadd.Key = append(_bsngentableentryadd.Key, item) |
| 3585 | } |
| 3586 | } |
| 3587 | |
| 3588 | for decoder.Length() >= 4 { |
| 3589 | item, err := DecodeBsnTlv(decoder) |
| 3590 | if err != nil { |
| 3591 | return nil, err |
| 3592 | } |
| 3593 | if item != nil { |
| 3594 | _bsngentableentryadd.Value = append(_bsngentableentryadd.Value, item) |
| 3595 | } |
| 3596 | } |
| 3597 | return _bsngentableentryadd, nil |
| 3598 | } |
| 3599 | |
| 3600 | func NewBsnGentableEntryAdd() *BsnGentableEntryAdd { |
| 3601 | obj := &BsnGentableEntryAdd{ |
| 3602 | BsnHeader: NewBsnHeader(46), |
| 3603 | } |
| 3604 | return obj |
| 3605 | } |
| 3606 | |
| 3607 | type BsnGentableEntryDelete struct { |
| 3608 | *BsnHeader |
| 3609 | TableId uint16 |
| 3610 | Key []IBsnTlv |
| 3611 | } |
| 3612 | |
| 3613 | type IBsnGentableEntryDelete interface { |
| 3614 | IBsnHeader |
| 3615 | GetTableId() uint16 |
| 3616 | GetKey() []IBsnTlv |
| 3617 | } |
| 3618 | |
| 3619 | func (self *BsnGentableEntryDelete) GetTableId() uint16 { |
| 3620 | return self.TableId |
| 3621 | } |
| 3622 | |
| 3623 | func (self *BsnGentableEntryDelete) SetTableId(v uint16) { |
| 3624 | self.TableId = v |
| 3625 | } |
| 3626 | |
| 3627 | func (self *BsnGentableEntryDelete) GetKey() []IBsnTlv { |
| 3628 | return self.Key |
| 3629 | } |
| 3630 | |
| 3631 | func (self *BsnGentableEntryDelete) SetKey(v []IBsnTlv) { |
| 3632 | self.Key = v |
| 3633 | } |
| 3634 | |
| 3635 | func (self *BsnGentableEntryDelete) Serialize(encoder *goloxi.Encoder) error { |
| 3636 | startIndex := len(encoder.Bytes()) |
| 3637 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 3638 | return err |
| 3639 | } |
| 3640 | |
| 3641 | encoder.PutUint16(uint16(self.TableId)) |
| 3642 | for _, obj := range self.Key { |
| 3643 | if err := obj.Serialize(encoder); err != nil { |
| 3644 | return err |
| 3645 | } |
| 3646 | } |
| 3647 | length := len(encoder.Bytes()) - startIndex |
| 3648 | |
| 3649 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3650 | |
| 3651 | return nil |
| 3652 | } |
| 3653 | |
| 3654 | func DecodeBsnGentableEntryDelete(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGentableEntryDelete, error) { |
| 3655 | _bsngentableentrydelete := &BsnGentableEntryDelete{BsnHeader: parent} |
| 3656 | if decoder.Length() < 2 { |
| 3657 | return nil, fmt.Errorf("BsnGentableEntryDelete packet too short: %d < 2", decoder.Length()) |
| 3658 | } |
| 3659 | _bsngentableentrydelete.TableId = uint16(decoder.ReadUint16()) |
| 3660 | |
| 3661 | for decoder.Length() >= 4 { |
| 3662 | item, err := DecodeBsnTlv(decoder) |
| 3663 | if err != nil { |
| 3664 | return nil, err |
| 3665 | } |
| 3666 | if item != nil { |
| 3667 | _bsngentableentrydelete.Key = append(_bsngentableentrydelete.Key, item) |
| 3668 | } |
| 3669 | } |
| 3670 | return _bsngentableentrydelete, nil |
| 3671 | } |
| 3672 | |
| 3673 | func NewBsnGentableEntryDelete() *BsnGentableEntryDelete { |
| 3674 | obj := &BsnGentableEntryDelete{ |
| 3675 | BsnHeader: NewBsnHeader(47), |
| 3676 | } |
| 3677 | return obj |
| 3678 | } |
| 3679 | |
| 3680 | type BsnGentableEntryDescStatsReply struct { |
| 3681 | *BsnStatsReply |
| 3682 | Entries []*BsnGentableEntryDescStatsEntry |
| 3683 | } |
| 3684 | |
| 3685 | type IBsnGentableEntryDescStatsReply interface { |
| 3686 | IBsnStatsReply |
| 3687 | GetEntries() []*BsnGentableEntryDescStatsEntry |
| 3688 | } |
| 3689 | |
| 3690 | func (self *BsnGentableEntryDescStatsReply) GetEntries() []*BsnGentableEntryDescStatsEntry { |
| 3691 | return self.Entries |
| 3692 | } |
| 3693 | |
| 3694 | func (self *BsnGentableEntryDescStatsReply) SetEntries(v []*BsnGentableEntryDescStatsEntry) { |
| 3695 | self.Entries = v |
| 3696 | } |
| 3697 | |
| 3698 | func (self *BsnGentableEntryDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 3699 | startIndex := len(encoder.Bytes()) |
| 3700 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 3701 | return err |
| 3702 | } |
| 3703 | |
| 3704 | for _, obj := range self.Entries { |
| 3705 | if err := obj.Serialize(encoder); err != nil { |
| 3706 | return err |
| 3707 | } |
| 3708 | } |
| 3709 | length := len(encoder.Bytes()) - startIndex |
| 3710 | |
| 3711 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3712 | |
| 3713 | return nil |
| 3714 | } |
| 3715 | |
| 3716 | func DecodeBsnGentableEntryDescStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnGentableEntryDescStatsReply, error) { |
| 3717 | _bsngentableentrydescstatsreply := &BsnGentableEntryDescStatsReply{BsnStatsReply: parent} |
| 3718 | |
| 3719 | for decoder.Length() >= 20 { |
| 3720 | item, err := DecodeBsnGentableEntryDescStatsEntry(decoder) |
| 3721 | if err != nil { |
| 3722 | return nil, err |
| 3723 | } |
| 3724 | if item != nil { |
| 3725 | _bsngentableentrydescstatsreply.Entries = append(_bsngentableentrydescstatsreply.Entries, item) |
| 3726 | } |
| 3727 | } |
| 3728 | return _bsngentableentrydescstatsreply, nil |
| 3729 | } |
| 3730 | |
| 3731 | func NewBsnGentableEntryDescStatsReply() *BsnGentableEntryDescStatsReply { |
| 3732 | obj := &BsnGentableEntryDescStatsReply{ |
| 3733 | BsnStatsReply: NewBsnStatsReply(2), |
| 3734 | } |
| 3735 | return obj |
| 3736 | } |
| 3737 | |
| 3738 | type BsnGentableEntryDescStatsRequest struct { |
| 3739 | *BsnStatsRequest |
| 3740 | TableId uint16 |
| 3741 | Checksum Checksum128 |
| 3742 | ChecksumMask Checksum128 |
| 3743 | } |
| 3744 | |
| 3745 | type IBsnGentableEntryDescStatsRequest interface { |
| 3746 | IBsnStatsRequest |
| 3747 | GetTableId() uint16 |
| 3748 | GetChecksum() Checksum128 |
| 3749 | GetChecksumMask() Checksum128 |
| 3750 | } |
| 3751 | |
| 3752 | func (self *BsnGentableEntryDescStatsRequest) GetTableId() uint16 { |
| 3753 | return self.TableId |
| 3754 | } |
| 3755 | |
| 3756 | func (self *BsnGentableEntryDescStatsRequest) SetTableId(v uint16) { |
| 3757 | self.TableId = v |
| 3758 | } |
| 3759 | |
| 3760 | func (self *BsnGentableEntryDescStatsRequest) GetChecksum() Checksum128 { |
| 3761 | return self.Checksum |
| 3762 | } |
| 3763 | |
| 3764 | func (self *BsnGentableEntryDescStatsRequest) SetChecksum(v Checksum128) { |
| 3765 | self.Checksum = v |
| 3766 | } |
| 3767 | |
| 3768 | func (self *BsnGentableEntryDescStatsRequest) GetChecksumMask() Checksum128 { |
| 3769 | return self.ChecksumMask |
| 3770 | } |
| 3771 | |
| 3772 | func (self *BsnGentableEntryDescStatsRequest) SetChecksumMask(v Checksum128) { |
| 3773 | self.ChecksumMask = v |
| 3774 | } |
| 3775 | |
| 3776 | func (self *BsnGentableEntryDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 3777 | startIndex := len(encoder.Bytes()) |
| 3778 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 3779 | return err |
| 3780 | } |
| 3781 | |
| 3782 | encoder.PutUint16(uint16(self.TableId)) |
| 3783 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 3784 | self.Checksum.Serialize(encoder) |
| 3785 | self.ChecksumMask.Serialize(encoder) |
| 3786 | length := len(encoder.Bytes()) - startIndex |
| 3787 | |
| 3788 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3789 | |
| 3790 | return nil |
| 3791 | } |
| 3792 | |
| 3793 | func DecodeBsnGentableEntryDescStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnGentableEntryDescStatsRequest, error) { |
| 3794 | _bsngentableentrydescstatsrequest := &BsnGentableEntryDescStatsRequest{BsnStatsRequest: parent} |
| 3795 | if decoder.Length() < 36 { |
| 3796 | return nil, fmt.Errorf("BsnGentableEntryDescStatsRequest packet too short: %d < 36", decoder.Length()) |
| 3797 | } |
| 3798 | _bsngentableentrydescstatsrequest.TableId = uint16(decoder.ReadUint16()) |
| 3799 | decoder.Skip(2) |
| 3800 | _bsngentableentrydescstatsrequest.Checksum.Decode(decoder) |
| 3801 | _bsngentableentrydescstatsrequest.ChecksumMask.Decode(decoder) |
| 3802 | return _bsngentableentrydescstatsrequest, nil |
| 3803 | } |
| 3804 | |
| 3805 | func NewBsnGentableEntryDescStatsRequest() *BsnGentableEntryDescStatsRequest { |
| 3806 | obj := &BsnGentableEntryDescStatsRequest{ |
| 3807 | BsnStatsRequest: NewBsnStatsRequest(2), |
| 3808 | } |
| 3809 | return obj |
| 3810 | } |
| 3811 | |
| 3812 | type BsnGentableEntryStatsReply struct { |
| 3813 | *BsnStatsReply |
| 3814 | Entries []*BsnGentableEntryStatsEntry |
| 3815 | } |
| 3816 | |
| 3817 | type IBsnGentableEntryStatsReply interface { |
| 3818 | IBsnStatsReply |
| 3819 | GetEntries() []*BsnGentableEntryStatsEntry |
| 3820 | } |
| 3821 | |
| 3822 | func (self *BsnGentableEntryStatsReply) GetEntries() []*BsnGentableEntryStatsEntry { |
| 3823 | return self.Entries |
| 3824 | } |
| 3825 | |
| 3826 | func (self *BsnGentableEntryStatsReply) SetEntries(v []*BsnGentableEntryStatsEntry) { |
| 3827 | self.Entries = v |
| 3828 | } |
| 3829 | |
| 3830 | func (self *BsnGentableEntryStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 3831 | startIndex := len(encoder.Bytes()) |
| 3832 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 3833 | return err |
| 3834 | } |
| 3835 | |
| 3836 | for _, obj := range self.Entries { |
| 3837 | if err := obj.Serialize(encoder); err != nil { |
| 3838 | return err |
| 3839 | } |
| 3840 | } |
| 3841 | length := len(encoder.Bytes()) - startIndex |
| 3842 | |
| 3843 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3844 | |
| 3845 | return nil |
| 3846 | } |
| 3847 | |
| 3848 | func DecodeBsnGentableEntryStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnGentableEntryStatsReply, error) { |
| 3849 | _bsngentableentrystatsreply := &BsnGentableEntryStatsReply{BsnStatsReply: parent} |
| 3850 | |
| 3851 | for decoder.Length() >= 4 { |
| 3852 | item, err := DecodeBsnGentableEntryStatsEntry(decoder) |
| 3853 | if err != nil { |
| 3854 | return nil, err |
| 3855 | } |
| 3856 | if item != nil { |
| 3857 | _bsngentableentrystatsreply.Entries = append(_bsngentableentrystatsreply.Entries, item) |
| 3858 | } |
| 3859 | } |
| 3860 | return _bsngentableentrystatsreply, nil |
| 3861 | } |
| 3862 | |
| 3863 | func NewBsnGentableEntryStatsReply() *BsnGentableEntryStatsReply { |
| 3864 | obj := &BsnGentableEntryStatsReply{ |
| 3865 | BsnStatsReply: NewBsnStatsReply(3), |
| 3866 | } |
| 3867 | return obj |
| 3868 | } |
| 3869 | |
| 3870 | type BsnGentableEntryStatsRequest struct { |
| 3871 | *BsnStatsRequest |
| 3872 | TableId uint16 |
| 3873 | Checksum Checksum128 |
| 3874 | ChecksumMask Checksum128 |
| 3875 | } |
| 3876 | |
| 3877 | type IBsnGentableEntryStatsRequest interface { |
| 3878 | IBsnStatsRequest |
| 3879 | GetTableId() uint16 |
| 3880 | GetChecksum() Checksum128 |
| 3881 | GetChecksumMask() Checksum128 |
| 3882 | } |
| 3883 | |
| 3884 | func (self *BsnGentableEntryStatsRequest) GetTableId() uint16 { |
| 3885 | return self.TableId |
| 3886 | } |
| 3887 | |
| 3888 | func (self *BsnGentableEntryStatsRequest) SetTableId(v uint16) { |
| 3889 | self.TableId = v |
| 3890 | } |
| 3891 | |
| 3892 | func (self *BsnGentableEntryStatsRequest) GetChecksum() Checksum128 { |
| 3893 | return self.Checksum |
| 3894 | } |
| 3895 | |
| 3896 | func (self *BsnGentableEntryStatsRequest) SetChecksum(v Checksum128) { |
| 3897 | self.Checksum = v |
| 3898 | } |
| 3899 | |
| 3900 | func (self *BsnGentableEntryStatsRequest) GetChecksumMask() Checksum128 { |
| 3901 | return self.ChecksumMask |
| 3902 | } |
| 3903 | |
| 3904 | func (self *BsnGentableEntryStatsRequest) SetChecksumMask(v Checksum128) { |
| 3905 | self.ChecksumMask = v |
| 3906 | } |
| 3907 | |
| 3908 | func (self *BsnGentableEntryStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 3909 | startIndex := len(encoder.Bytes()) |
| 3910 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 3911 | return err |
| 3912 | } |
| 3913 | |
| 3914 | encoder.PutUint16(uint16(self.TableId)) |
| 3915 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 3916 | self.Checksum.Serialize(encoder) |
| 3917 | self.ChecksumMask.Serialize(encoder) |
| 3918 | length := len(encoder.Bytes()) - startIndex |
| 3919 | |
| 3920 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3921 | |
| 3922 | return nil |
| 3923 | } |
| 3924 | |
| 3925 | func DecodeBsnGentableEntryStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnGentableEntryStatsRequest, error) { |
| 3926 | _bsngentableentrystatsrequest := &BsnGentableEntryStatsRequest{BsnStatsRequest: parent} |
| 3927 | if decoder.Length() < 36 { |
| 3928 | return nil, fmt.Errorf("BsnGentableEntryStatsRequest packet too short: %d < 36", decoder.Length()) |
| 3929 | } |
| 3930 | _bsngentableentrystatsrequest.TableId = uint16(decoder.ReadUint16()) |
| 3931 | decoder.Skip(2) |
| 3932 | _bsngentableentrystatsrequest.Checksum.Decode(decoder) |
| 3933 | _bsngentableentrystatsrequest.ChecksumMask.Decode(decoder) |
| 3934 | return _bsngentableentrystatsrequest, nil |
| 3935 | } |
| 3936 | |
| 3937 | func NewBsnGentableEntryStatsRequest() *BsnGentableEntryStatsRequest { |
| 3938 | obj := &BsnGentableEntryStatsRequest{ |
| 3939 | BsnStatsRequest: NewBsnStatsRequest(3), |
| 3940 | } |
| 3941 | return obj |
| 3942 | } |
| 3943 | |
| 3944 | type BsnGentableError struct { |
| 3945 | *BsnBaseError |
| 3946 | ErrorCode BsnGentableErrorCode |
| 3947 | TableId uint16 |
| 3948 | } |
| 3949 | |
| 3950 | type IBsnGentableError interface { |
| 3951 | IBsnBaseError |
| 3952 | GetErrorCode() BsnGentableErrorCode |
| 3953 | GetTableId() uint16 |
| 3954 | } |
| 3955 | |
| 3956 | func (self *BsnGentableError) GetErrorCode() BsnGentableErrorCode { |
| 3957 | return self.ErrorCode |
| 3958 | } |
| 3959 | |
| 3960 | func (self *BsnGentableError) SetErrorCode(v BsnGentableErrorCode) { |
| 3961 | self.ErrorCode = v |
| 3962 | } |
| 3963 | |
| 3964 | func (self *BsnGentableError) GetTableId() uint16 { |
| 3965 | return self.TableId |
| 3966 | } |
| 3967 | |
| 3968 | func (self *BsnGentableError) SetTableId(v uint16) { |
| 3969 | self.TableId = v |
| 3970 | } |
| 3971 | |
| 3972 | func (self *BsnGentableError) Serialize(encoder *goloxi.Encoder) error { |
| 3973 | startIndex := len(encoder.Bytes()) |
| 3974 | if err := self.BsnBaseError.Serialize(encoder); err != nil { |
| 3975 | return err |
| 3976 | } |
| 3977 | |
| 3978 | encoder.PutUint16(uint16(self.ErrorCode)) |
| 3979 | encoder.PutUint16(uint16(self.TableId)) |
| 3980 | length := len(encoder.Bytes()) - startIndex |
| 3981 | |
| 3982 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3983 | |
| 3984 | return nil |
| 3985 | } |
| 3986 | |
| 3987 | func DecodeBsnGentableError(parent *BsnBaseError, decoder *goloxi.Decoder) (*BsnGentableError, error) { |
| 3988 | _bsngentableerror := &BsnGentableError{BsnBaseError: parent} |
| 3989 | if decoder.Length() < 260 { |
| 3990 | return nil, fmt.Errorf("BsnGentableError packet too short: %d < 260", decoder.Length()) |
| 3991 | } |
| 3992 | _bsngentableerror.ErrorCode = BsnGentableErrorCode(decoder.ReadUint16()) |
| 3993 | _bsngentableerror.TableId = uint16(decoder.ReadUint16()) |
| 3994 | return _bsngentableerror, nil |
| 3995 | } |
| 3996 | |
| 3997 | func NewBsnGentableError() *BsnGentableError { |
| 3998 | obj := &BsnGentableError{ |
| 3999 | BsnBaseError: NewBsnBaseError(2), |
| 4000 | } |
| 4001 | return obj |
| 4002 | } |
| 4003 | |
| 4004 | type BsnGentableSetBucketsSize struct { |
| 4005 | *BsnHeader |
| 4006 | TableId uint16 |
| 4007 | BucketsSize uint32 |
| 4008 | } |
| 4009 | |
| 4010 | type IBsnGentableSetBucketsSize interface { |
| 4011 | IBsnHeader |
| 4012 | GetTableId() uint16 |
| 4013 | GetBucketsSize() uint32 |
| 4014 | } |
| 4015 | |
| 4016 | func (self *BsnGentableSetBucketsSize) GetTableId() uint16 { |
| 4017 | return self.TableId |
| 4018 | } |
| 4019 | |
| 4020 | func (self *BsnGentableSetBucketsSize) SetTableId(v uint16) { |
| 4021 | self.TableId = v |
| 4022 | } |
| 4023 | |
| 4024 | func (self *BsnGentableSetBucketsSize) GetBucketsSize() uint32 { |
| 4025 | return self.BucketsSize |
| 4026 | } |
| 4027 | |
| 4028 | func (self *BsnGentableSetBucketsSize) SetBucketsSize(v uint32) { |
| 4029 | self.BucketsSize = v |
| 4030 | } |
| 4031 | |
| 4032 | func (self *BsnGentableSetBucketsSize) Serialize(encoder *goloxi.Encoder) error { |
| 4033 | startIndex := len(encoder.Bytes()) |
| 4034 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4035 | return err |
| 4036 | } |
| 4037 | |
| 4038 | encoder.PutUint16(uint16(self.TableId)) |
| 4039 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 4040 | encoder.PutUint32(uint32(self.BucketsSize)) |
| 4041 | length := len(encoder.Bytes()) - startIndex |
| 4042 | |
| 4043 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4044 | |
| 4045 | return nil |
| 4046 | } |
| 4047 | |
| 4048 | func DecodeBsnGentableSetBucketsSize(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGentableSetBucketsSize, error) { |
| 4049 | _bsngentablesetbucketssize := &BsnGentableSetBucketsSize{BsnHeader: parent} |
| 4050 | if decoder.Length() < 8 { |
| 4051 | return nil, fmt.Errorf("BsnGentableSetBucketsSize packet too short: %d < 8", decoder.Length()) |
| 4052 | } |
| 4053 | _bsngentablesetbucketssize.TableId = uint16(decoder.ReadUint16()) |
| 4054 | decoder.Skip(2) |
| 4055 | _bsngentablesetbucketssize.BucketsSize = uint32(decoder.ReadUint32()) |
| 4056 | return _bsngentablesetbucketssize, nil |
| 4057 | } |
| 4058 | |
| 4059 | func NewBsnGentableSetBucketsSize() *BsnGentableSetBucketsSize { |
| 4060 | obj := &BsnGentableSetBucketsSize{ |
| 4061 | BsnHeader: NewBsnHeader(50), |
| 4062 | } |
| 4063 | return obj |
| 4064 | } |
| 4065 | |
| 4066 | type BsnGentableStatsReply struct { |
| 4067 | *BsnStatsReply |
| 4068 | Entries []*BsnGentableStatsEntry |
| 4069 | } |
| 4070 | |
| 4071 | type IBsnGentableStatsReply interface { |
| 4072 | IBsnStatsReply |
| 4073 | GetEntries() []*BsnGentableStatsEntry |
| 4074 | } |
| 4075 | |
| 4076 | func (self *BsnGentableStatsReply) GetEntries() []*BsnGentableStatsEntry { |
| 4077 | return self.Entries |
| 4078 | } |
| 4079 | |
| 4080 | func (self *BsnGentableStatsReply) SetEntries(v []*BsnGentableStatsEntry) { |
| 4081 | self.Entries = v |
| 4082 | } |
| 4083 | |
| 4084 | func (self *BsnGentableStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 4085 | startIndex := len(encoder.Bytes()) |
| 4086 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 4087 | return err |
| 4088 | } |
| 4089 | |
| 4090 | for _, obj := range self.Entries { |
| 4091 | if err := obj.Serialize(encoder); err != nil { |
| 4092 | return err |
| 4093 | } |
| 4094 | } |
| 4095 | length := len(encoder.Bytes()) - startIndex |
| 4096 | |
| 4097 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4098 | |
| 4099 | return nil |
| 4100 | } |
| 4101 | |
| 4102 | func DecodeBsnGentableStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnGentableStatsReply, error) { |
| 4103 | _bsngentablestatsreply := &BsnGentableStatsReply{BsnStatsReply: parent} |
| 4104 | |
| 4105 | for decoder.Length() >= 24 { |
| 4106 | item, err := DecodeBsnGentableStatsEntry(decoder) |
| 4107 | if err != nil { |
| 4108 | return nil, err |
| 4109 | } |
| 4110 | if item != nil { |
| 4111 | _bsngentablestatsreply.Entries = append(_bsngentablestatsreply.Entries, item) |
| 4112 | } |
| 4113 | } |
| 4114 | return _bsngentablestatsreply, nil |
| 4115 | } |
| 4116 | |
| 4117 | func NewBsnGentableStatsReply() *BsnGentableStatsReply { |
| 4118 | obj := &BsnGentableStatsReply{ |
| 4119 | BsnStatsReply: NewBsnStatsReply(7), |
| 4120 | } |
| 4121 | return obj |
| 4122 | } |
| 4123 | |
| 4124 | type BsnGentableStatsRequest struct { |
| 4125 | *BsnStatsRequest |
| 4126 | } |
| 4127 | |
| 4128 | type IBsnGentableStatsRequest interface { |
| 4129 | IBsnStatsRequest |
| 4130 | } |
| 4131 | |
| 4132 | func (self *BsnGentableStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 4133 | startIndex := len(encoder.Bytes()) |
| 4134 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 4135 | return err |
| 4136 | } |
| 4137 | length := len(encoder.Bytes()) - startIndex |
| 4138 | |
| 4139 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4140 | |
| 4141 | return nil |
| 4142 | } |
| 4143 | |
| 4144 | func DecodeBsnGentableStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnGentableStatsRequest, error) { |
| 4145 | _bsngentablestatsrequest := &BsnGentableStatsRequest{BsnStatsRequest: parent} |
| 4146 | return _bsngentablestatsrequest, nil |
| 4147 | } |
| 4148 | |
| 4149 | func NewBsnGentableStatsRequest() *BsnGentableStatsRequest { |
| 4150 | obj := &BsnGentableStatsRequest{ |
| 4151 | BsnStatsRequest: NewBsnStatsRequest(7), |
| 4152 | } |
| 4153 | return obj |
| 4154 | } |
| 4155 | |
| 4156 | type BsnGetInterfacesReply struct { |
| 4157 | *BsnHeader |
| 4158 | Interfaces []*BsnInterface |
| 4159 | } |
| 4160 | |
| 4161 | type IBsnGetInterfacesReply interface { |
| 4162 | IBsnHeader |
| 4163 | GetInterfaces() []*BsnInterface |
| 4164 | } |
| 4165 | |
| 4166 | func (self *BsnGetInterfacesReply) GetInterfaces() []*BsnInterface { |
| 4167 | return self.Interfaces |
| 4168 | } |
| 4169 | |
| 4170 | func (self *BsnGetInterfacesReply) SetInterfaces(v []*BsnInterface) { |
| 4171 | self.Interfaces = v |
| 4172 | } |
| 4173 | |
| 4174 | func (self *BsnGetInterfacesReply) Serialize(encoder *goloxi.Encoder) error { |
| 4175 | startIndex := len(encoder.Bytes()) |
| 4176 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4177 | return err |
| 4178 | } |
| 4179 | |
| 4180 | for _, obj := range self.Interfaces { |
| 4181 | if err := obj.Serialize(encoder); err != nil { |
| 4182 | return err |
| 4183 | } |
| 4184 | } |
| 4185 | length := len(encoder.Bytes()) - startIndex |
| 4186 | |
| 4187 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4188 | |
| 4189 | return nil |
| 4190 | } |
| 4191 | |
| 4192 | func DecodeBsnGetInterfacesReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetInterfacesReply, error) { |
| 4193 | _bsngetinterfacesreply := &BsnGetInterfacesReply{BsnHeader: parent} |
| 4194 | |
| 4195 | for decoder.Length() >= 32 { |
| 4196 | item, err := DecodeBsnInterface(decoder) |
| 4197 | if err != nil { |
| 4198 | return nil, err |
| 4199 | } |
| 4200 | if item != nil { |
| 4201 | _bsngetinterfacesreply.Interfaces = append(_bsngetinterfacesreply.Interfaces, item) |
| 4202 | } |
| 4203 | } |
| 4204 | return _bsngetinterfacesreply, nil |
| 4205 | } |
| 4206 | |
| 4207 | func NewBsnGetInterfacesReply() *BsnGetInterfacesReply { |
| 4208 | obj := &BsnGetInterfacesReply{ |
| 4209 | BsnHeader: NewBsnHeader(10), |
| 4210 | } |
| 4211 | return obj |
| 4212 | } |
| 4213 | |
| 4214 | type BsnGetInterfacesRequest struct { |
| 4215 | *BsnHeader |
| 4216 | } |
| 4217 | |
| 4218 | type IBsnGetInterfacesRequest interface { |
| 4219 | IBsnHeader |
| 4220 | } |
| 4221 | |
| 4222 | func (self *BsnGetInterfacesRequest) Serialize(encoder *goloxi.Encoder) error { |
| 4223 | startIndex := len(encoder.Bytes()) |
| 4224 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4225 | return err |
| 4226 | } |
| 4227 | length := len(encoder.Bytes()) - startIndex |
| 4228 | |
| 4229 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4230 | |
| 4231 | return nil |
| 4232 | } |
| 4233 | |
| 4234 | func DecodeBsnGetInterfacesRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetInterfacesRequest, error) { |
| 4235 | _bsngetinterfacesrequest := &BsnGetInterfacesRequest{BsnHeader: parent} |
| 4236 | return _bsngetinterfacesrequest, nil |
| 4237 | } |
| 4238 | |
| 4239 | func NewBsnGetInterfacesRequest() *BsnGetInterfacesRequest { |
| 4240 | obj := &BsnGetInterfacesRequest{ |
| 4241 | BsnHeader: NewBsnHeader(9), |
| 4242 | } |
| 4243 | return obj |
| 4244 | } |
| 4245 | |
| 4246 | type BsnGetMirroringReply struct { |
| 4247 | *BsnHeader |
| 4248 | ReportMirrorPorts uint8 |
| 4249 | } |
| 4250 | |
| 4251 | type IBsnGetMirroringReply interface { |
| 4252 | IBsnHeader |
| 4253 | GetReportMirrorPorts() uint8 |
| 4254 | } |
| 4255 | |
| 4256 | func (self *BsnGetMirroringReply) GetReportMirrorPorts() uint8 { |
| 4257 | return self.ReportMirrorPorts |
| 4258 | } |
| 4259 | |
| 4260 | func (self *BsnGetMirroringReply) SetReportMirrorPorts(v uint8) { |
| 4261 | self.ReportMirrorPorts = v |
| 4262 | } |
| 4263 | |
| 4264 | func (self *BsnGetMirroringReply) Serialize(encoder *goloxi.Encoder) error { |
| 4265 | startIndex := len(encoder.Bytes()) |
| 4266 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4267 | return err |
| 4268 | } |
| 4269 | |
| 4270 | encoder.PutUint8(uint8(self.ReportMirrorPorts)) |
| 4271 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 4272 | length := len(encoder.Bytes()) - startIndex |
| 4273 | |
| 4274 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4275 | |
| 4276 | return nil |
| 4277 | } |
| 4278 | |
| 4279 | func DecodeBsnGetMirroringReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetMirroringReply, error) { |
| 4280 | _bsngetmirroringreply := &BsnGetMirroringReply{BsnHeader: parent} |
| 4281 | if decoder.Length() < 4 { |
| 4282 | return nil, fmt.Errorf("BsnGetMirroringReply packet too short: %d < 4", decoder.Length()) |
| 4283 | } |
| 4284 | _bsngetmirroringreply.ReportMirrorPorts = uint8(decoder.ReadByte()) |
| 4285 | decoder.Skip(3) |
| 4286 | return _bsngetmirroringreply, nil |
| 4287 | } |
| 4288 | |
| 4289 | func NewBsnGetMirroringReply() *BsnGetMirroringReply { |
| 4290 | obj := &BsnGetMirroringReply{ |
| 4291 | BsnHeader: NewBsnHeader(5), |
| 4292 | } |
| 4293 | return obj |
| 4294 | } |
| 4295 | |
| 4296 | type BsnGetMirroringRequest struct { |
| 4297 | *BsnHeader |
| 4298 | ReportMirrorPorts uint8 |
| 4299 | } |
| 4300 | |
| 4301 | type IBsnGetMirroringRequest interface { |
| 4302 | IBsnHeader |
| 4303 | GetReportMirrorPorts() uint8 |
| 4304 | } |
| 4305 | |
| 4306 | func (self *BsnGetMirroringRequest) GetReportMirrorPorts() uint8 { |
| 4307 | return self.ReportMirrorPorts |
| 4308 | } |
| 4309 | |
| 4310 | func (self *BsnGetMirroringRequest) SetReportMirrorPorts(v uint8) { |
| 4311 | self.ReportMirrorPorts = v |
| 4312 | } |
| 4313 | |
| 4314 | func (self *BsnGetMirroringRequest) Serialize(encoder *goloxi.Encoder) error { |
| 4315 | startIndex := len(encoder.Bytes()) |
| 4316 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4317 | return err |
| 4318 | } |
| 4319 | |
| 4320 | encoder.PutUint8(uint8(self.ReportMirrorPorts)) |
| 4321 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 4322 | length := len(encoder.Bytes()) - startIndex |
| 4323 | |
| 4324 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4325 | |
| 4326 | return nil |
| 4327 | } |
| 4328 | |
| 4329 | func DecodeBsnGetMirroringRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetMirroringRequest, error) { |
| 4330 | _bsngetmirroringrequest := &BsnGetMirroringRequest{BsnHeader: parent} |
| 4331 | if decoder.Length() < 4 { |
| 4332 | return nil, fmt.Errorf("BsnGetMirroringRequest packet too short: %d < 4", decoder.Length()) |
| 4333 | } |
| 4334 | _bsngetmirroringrequest.ReportMirrorPorts = uint8(decoder.ReadByte()) |
| 4335 | decoder.Skip(3) |
| 4336 | return _bsngetmirroringrequest, nil |
| 4337 | } |
| 4338 | |
| 4339 | func NewBsnGetMirroringRequest() *BsnGetMirroringRequest { |
| 4340 | obj := &BsnGetMirroringRequest{ |
| 4341 | BsnHeader: NewBsnHeader(4), |
| 4342 | } |
| 4343 | return obj |
| 4344 | } |
| 4345 | |
| 4346 | type BsnGetSwitchPipelineReply struct { |
| 4347 | *BsnHeader |
| 4348 | Pipeline string |
| 4349 | } |
| 4350 | |
| 4351 | type IBsnGetSwitchPipelineReply interface { |
| 4352 | IBsnHeader |
| 4353 | GetPipeline() string |
| 4354 | } |
| 4355 | |
| 4356 | func (self *BsnGetSwitchPipelineReply) GetPipeline() string { |
| 4357 | return self.Pipeline |
| 4358 | } |
| 4359 | |
| 4360 | func (self *BsnGetSwitchPipelineReply) SetPipeline(v string) { |
| 4361 | self.Pipeline = v |
| 4362 | } |
| 4363 | |
| 4364 | func (self *BsnGetSwitchPipelineReply) Serialize(encoder *goloxi.Encoder) error { |
| 4365 | startIndex := len(encoder.Bytes()) |
| 4366 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4367 | return err |
| 4368 | } |
| 4369 | |
| 4370 | encoder.Write([]byte(self.Pipeline)) |
| 4371 | length := len(encoder.Bytes()) - startIndex |
| 4372 | |
| 4373 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4374 | |
| 4375 | return nil |
| 4376 | } |
| 4377 | |
| 4378 | func DecodeBsnGetSwitchPipelineReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetSwitchPipelineReply, error) { |
| 4379 | _bsngetswitchpipelinereply := &BsnGetSwitchPipelineReply{BsnHeader: parent} |
| 4380 | if decoder.Length() < 256 { |
| 4381 | return nil, fmt.Errorf("BsnGetSwitchPipelineReply packet too short: %d < 256", decoder.Length()) |
| 4382 | } |
| 4383 | _bsngetswitchpipelinereply.Pipeline = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 4384 | return _bsngetswitchpipelinereply, nil |
| 4385 | } |
| 4386 | |
| 4387 | func NewBsnGetSwitchPipelineReply() *BsnGetSwitchPipelineReply { |
| 4388 | obj := &BsnGetSwitchPipelineReply{ |
| 4389 | BsnHeader: NewBsnHeader(52), |
| 4390 | } |
| 4391 | return obj |
| 4392 | } |
| 4393 | |
| 4394 | type BsnGetSwitchPipelineRequest struct { |
| 4395 | *BsnHeader |
| 4396 | } |
| 4397 | |
| 4398 | type IBsnGetSwitchPipelineRequest interface { |
| 4399 | IBsnHeader |
| 4400 | } |
| 4401 | |
| 4402 | func (self *BsnGetSwitchPipelineRequest) Serialize(encoder *goloxi.Encoder) error { |
| 4403 | startIndex := len(encoder.Bytes()) |
| 4404 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4405 | return err |
| 4406 | } |
| 4407 | length := len(encoder.Bytes()) - startIndex |
| 4408 | |
| 4409 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4410 | |
| 4411 | return nil |
| 4412 | } |
| 4413 | |
| 4414 | func DecodeBsnGetSwitchPipelineRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetSwitchPipelineRequest, error) { |
| 4415 | _bsngetswitchpipelinerequest := &BsnGetSwitchPipelineRequest{BsnHeader: parent} |
| 4416 | return _bsngetswitchpipelinerequest, nil |
| 4417 | } |
| 4418 | |
| 4419 | func NewBsnGetSwitchPipelineRequest() *BsnGetSwitchPipelineRequest { |
| 4420 | obj := &BsnGetSwitchPipelineRequest{ |
| 4421 | BsnHeader: NewBsnHeader(51), |
| 4422 | } |
| 4423 | return obj |
| 4424 | } |
| 4425 | |
| 4426 | type BsnImageDescStatsReply struct { |
| 4427 | *BsnStatsReply |
| 4428 | ImageChecksum string |
| 4429 | StartupConfigChecksum string |
| 4430 | } |
| 4431 | |
| 4432 | type IBsnImageDescStatsReply interface { |
| 4433 | IBsnStatsReply |
| 4434 | GetImageChecksum() string |
| 4435 | GetStartupConfigChecksum() string |
| 4436 | } |
| 4437 | |
| 4438 | func (self *BsnImageDescStatsReply) GetImageChecksum() string { |
| 4439 | return self.ImageChecksum |
| 4440 | } |
| 4441 | |
| 4442 | func (self *BsnImageDescStatsReply) SetImageChecksum(v string) { |
| 4443 | self.ImageChecksum = v |
| 4444 | } |
| 4445 | |
| 4446 | func (self *BsnImageDescStatsReply) GetStartupConfigChecksum() string { |
| 4447 | return self.StartupConfigChecksum |
| 4448 | } |
| 4449 | |
| 4450 | func (self *BsnImageDescStatsReply) SetStartupConfigChecksum(v string) { |
| 4451 | self.StartupConfigChecksum = v |
| 4452 | } |
| 4453 | |
| 4454 | func (self *BsnImageDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 4455 | startIndex := len(encoder.Bytes()) |
| 4456 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 4457 | return err |
| 4458 | } |
| 4459 | |
| 4460 | encoder.Write([]byte(self.ImageChecksum)) |
| 4461 | encoder.Write([]byte(self.StartupConfigChecksum)) |
| 4462 | length := len(encoder.Bytes()) - startIndex |
| 4463 | |
| 4464 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4465 | |
| 4466 | return nil |
| 4467 | } |
| 4468 | |
| 4469 | func DecodeBsnImageDescStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnImageDescStatsReply, error) { |
| 4470 | _bsnimagedescstatsreply := &BsnImageDescStatsReply{BsnStatsReply: parent} |
| 4471 | if decoder.Length() < 512 { |
| 4472 | return nil, fmt.Errorf("BsnImageDescStatsReply packet too short: %d < 512", decoder.Length()) |
| 4473 | } |
| 4474 | _bsnimagedescstatsreply.ImageChecksum = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 4475 | _bsnimagedescstatsreply.StartupConfigChecksum = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 4476 | return _bsnimagedescstatsreply, nil |
| 4477 | } |
| 4478 | |
| 4479 | func NewBsnImageDescStatsReply() *BsnImageDescStatsReply { |
| 4480 | obj := &BsnImageDescStatsReply{ |
| 4481 | BsnStatsReply: NewBsnStatsReply(14), |
| 4482 | } |
| 4483 | return obj |
| 4484 | } |
| 4485 | |
| 4486 | type BsnImageDescStatsRequest struct { |
| 4487 | *BsnStatsRequest |
| 4488 | } |
| 4489 | |
| 4490 | type IBsnImageDescStatsRequest interface { |
| 4491 | IBsnStatsRequest |
| 4492 | } |
| 4493 | |
| 4494 | func (self *BsnImageDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 4495 | startIndex := len(encoder.Bytes()) |
| 4496 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 4497 | return err |
| 4498 | } |
| 4499 | length := len(encoder.Bytes()) - startIndex |
| 4500 | |
| 4501 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4502 | |
| 4503 | return nil |
| 4504 | } |
| 4505 | |
| 4506 | func DecodeBsnImageDescStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnImageDescStatsRequest, error) { |
| 4507 | _bsnimagedescstatsrequest := &BsnImageDescStatsRequest{BsnStatsRequest: parent} |
| 4508 | return _bsnimagedescstatsrequest, nil |
| 4509 | } |
| 4510 | |
| 4511 | func NewBsnImageDescStatsRequest() *BsnImageDescStatsRequest { |
| 4512 | obj := &BsnImageDescStatsRequest{ |
| 4513 | BsnStatsRequest: NewBsnStatsRequest(14), |
| 4514 | } |
| 4515 | return obj |
| 4516 | } |
| 4517 | |
| 4518 | type BsnLacpConvergenceNotif struct { |
| 4519 | *BsnHeader |
| 4520 | ConvergenceStatus uint8 |
| 4521 | PortNo Port |
| 4522 | ActorSysPriority uint16 |
| 4523 | ActorSysMac net.HardwareAddr |
| 4524 | ActorPortPriority uint16 |
| 4525 | ActorPortNum uint16 |
| 4526 | ActorKey uint16 |
| 4527 | PartnerSysPriority uint16 |
| 4528 | PartnerSysMac net.HardwareAddr |
| 4529 | PartnerPortPriority uint16 |
| 4530 | PartnerPortNum uint16 |
| 4531 | PartnerKey uint16 |
| 4532 | } |
| 4533 | |
| 4534 | type IBsnLacpConvergenceNotif interface { |
| 4535 | IBsnHeader |
| 4536 | GetConvergenceStatus() uint8 |
| 4537 | GetPortNo() Port |
| 4538 | GetActorSysPriority() uint16 |
| 4539 | GetActorSysMac() net.HardwareAddr |
| 4540 | GetActorPortPriority() uint16 |
| 4541 | GetActorPortNum() uint16 |
| 4542 | GetActorKey() uint16 |
| 4543 | GetPartnerSysPriority() uint16 |
| 4544 | GetPartnerSysMac() net.HardwareAddr |
| 4545 | GetPartnerPortPriority() uint16 |
| 4546 | GetPartnerPortNum() uint16 |
| 4547 | GetPartnerKey() uint16 |
| 4548 | } |
| 4549 | |
| 4550 | func (self *BsnLacpConvergenceNotif) GetConvergenceStatus() uint8 { |
| 4551 | return self.ConvergenceStatus |
| 4552 | } |
| 4553 | |
| 4554 | func (self *BsnLacpConvergenceNotif) SetConvergenceStatus(v uint8) { |
| 4555 | self.ConvergenceStatus = v |
| 4556 | } |
| 4557 | |
| 4558 | func (self *BsnLacpConvergenceNotif) GetPortNo() Port { |
| 4559 | return self.PortNo |
| 4560 | } |
| 4561 | |
| 4562 | func (self *BsnLacpConvergenceNotif) SetPortNo(v Port) { |
| 4563 | self.PortNo = v |
| 4564 | } |
| 4565 | |
| 4566 | func (self *BsnLacpConvergenceNotif) GetActorSysPriority() uint16 { |
| 4567 | return self.ActorSysPriority |
| 4568 | } |
| 4569 | |
| 4570 | func (self *BsnLacpConvergenceNotif) SetActorSysPriority(v uint16) { |
| 4571 | self.ActorSysPriority = v |
| 4572 | } |
| 4573 | |
| 4574 | func (self *BsnLacpConvergenceNotif) GetActorSysMac() net.HardwareAddr { |
| 4575 | return self.ActorSysMac |
| 4576 | } |
| 4577 | |
| 4578 | func (self *BsnLacpConvergenceNotif) SetActorSysMac(v net.HardwareAddr) { |
| 4579 | self.ActorSysMac = v |
| 4580 | } |
| 4581 | |
| 4582 | func (self *BsnLacpConvergenceNotif) GetActorPortPriority() uint16 { |
| 4583 | return self.ActorPortPriority |
| 4584 | } |
| 4585 | |
| 4586 | func (self *BsnLacpConvergenceNotif) SetActorPortPriority(v uint16) { |
| 4587 | self.ActorPortPriority = v |
| 4588 | } |
| 4589 | |
| 4590 | func (self *BsnLacpConvergenceNotif) GetActorPortNum() uint16 { |
| 4591 | return self.ActorPortNum |
| 4592 | } |
| 4593 | |
| 4594 | func (self *BsnLacpConvergenceNotif) SetActorPortNum(v uint16) { |
| 4595 | self.ActorPortNum = v |
| 4596 | } |
| 4597 | |
| 4598 | func (self *BsnLacpConvergenceNotif) GetActorKey() uint16 { |
| 4599 | return self.ActorKey |
| 4600 | } |
| 4601 | |
| 4602 | func (self *BsnLacpConvergenceNotif) SetActorKey(v uint16) { |
| 4603 | self.ActorKey = v |
| 4604 | } |
| 4605 | |
| 4606 | func (self *BsnLacpConvergenceNotif) GetPartnerSysPriority() uint16 { |
| 4607 | return self.PartnerSysPriority |
| 4608 | } |
| 4609 | |
| 4610 | func (self *BsnLacpConvergenceNotif) SetPartnerSysPriority(v uint16) { |
| 4611 | self.PartnerSysPriority = v |
| 4612 | } |
| 4613 | |
| 4614 | func (self *BsnLacpConvergenceNotif) GetPartnerSysMac() net.HardwareAddr { |
| 4615 | return self.PartnerSysMac |
| 4616 | } |
| 4617 | |
| 4618 | func (self *BsnLacpConvergenceNotif) SetPartnerSysMac(v net.HardwareAddr) { |
| 4619 | self.PartnerSysMac = v |
| 4620 | } |
| 4621 | |
| 4622 | func (self *BsnLacpConvergenceNotif) GetPartnerPortPriority() uint16 { |
| 4623 | return self.PartnerPortPriority |
| 4624 | } |
| 4625 | |
| 4626 | func (self *BsnLacpConvergenceNotif) SetPartnerPortPriority(v uint16) { |
| 4627 | self.PartnerPortPriority = v |
| 4628 | } |
| 4629 | |
| 4630 | func (self *BsnLacpConvergenceNotif) GetPartnerPortNum() uint16 { |
| 4631 | return self.PartnerPortNum |
| 4632 | } |
| 4633 | |
| 4634 | func (self *BsnLacpConvergenceNotif) SetPartnerPortNum(v uint16) { |
| 4635 | self.PartnerPortNum = v |
| 4636 | } |
| 4637 | |
| 4638 | func (self *BsnLacpConvergenceNotif) GetPartnerKey() uint16 { |
| 4639 | return self.PartnerKey |
| 4640 | } |
| 4641 | |
| 4642 | func (self *BsnLacpConvergenceNotif) SetPartnerKey(v uint16) { |
| 4643 | self.PartnerKey = v |
| 4644 | } |
| 4645 | |
| 4646 | func (self *BsnLacpConvergenceNotif) Serialize(encoder *goloxi.Encoder) error { |
| 4647 | startIndex := len(encoder.Bytes()) |
| 4648 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4649 | return err |
| 4650 | } |
| 4651 | |
| 4652 | encoder.PutUint8(uint8(self.ConvergenceStatus)) |
| 4653 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 4654 | self.PortNo.Serialize(encoder) |
| 4655 | encoder.PutUint16(uint16(self.ActorSysPriority)) |
| 4656 | encoder.Write(self.ActorSysMac) |
| 4657 | encoder.PutUint16(uint16(self.ActorPortPriority)) |
| 4658 | encoder.PutUint16(uint16(self.ActorPortNum)) |
| 4659 | encoder.PutUint16(uint16(self.ActorKey)) |
| 4660 | encoder.PutUint16(uint16(self.PartnerSysPriority)) |
| 4661 | encoder.Write(self.PartnerSysMac) |
| 4662 | encoder.PutUint16(uint16(self.PartnerPortPriority)) |
| 4663 | encoder.PutUint16(uint16(self.PartnerPortNum)) |
| 4664 | encoder.PutUint16(uint16(self.PartnerKey)) |
| 4665 | length := len(encoder.Bytes()) - startIndex |
| 4666 | |
| 4667 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4668 | |
| 4669 | return nil |
| 4670 | } |
| 4671 | |
| 4672 | func DecodeBsnLacpConvergenceNotif(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnLacpConvergenceNotif, error) { |
| 4673 | _bsnlacpconvergencenotif := &BsnLacpConvergenceNotif{BsnHeader: parent} |
| 4674 | if decoder.Length() < 36 { |
| 4675 | return nil, fmt.Errorf("BsnLacpConvergenceNotif packet too short: %d < 36", decoder.Length()) |
| 4676 | } |
| 4677 | _bsnlacpconvergencenotif.ConvergenceStatus = uint8(decoder.ReadByte()) |
| 4678 | decoder.Skip(3) |
| 4679 | _bsnlacpconvergencenotif.PortNo.Decode(decoder) |
| 4680 | _bsnlacpconvergencenotif.ActorSysPriority = uint16(decoder.ReadUint16()) |
| 4681 | _bsnlacpconvergencenotif.ActorSysMac = net.HardwareAddr(decoder.Read(6)) |
| 4682 | _bsnlacpconvergencenotif.ActorPortPriority = uint16(decoder.ReadUint16()) |
| 4683 | _bsnlacpconvergencenotif.ActorPortNum = uint16(decoder.ReadUint16()) |
| 4684 | _bsnlacpconvergencenotif.ActorKey = uint16(decoder.ReadUint16()) |
| 4685 | _bsnlacpconvergencenotif.PartnerSysPriority = uint16(decoder.ReadUint16()) |
| 4686 | _bsnlacpconvergencenotif.PartnerSysMac = net.HardwareAddr(decoder.Read(6)) |
| 4687 | _bsnlacpconvergencenotif.PartnerPortPriority = uint16(decoder.ReadUint16()) |
| 4688 | _bsnlacpconvergencenotif.PartnerPortNum = uint16(decoder.ReadUint16()) |
| 4689 | _bsnlacpconvergencenotif.PartnerKey = uint16(decoder.ReadUint16()) |
| 4690 | return _bsnlacpconvergencenotif, nil |
| 4691 | } |
| 4692 | |
| 4693 | func NewBsnLacpConvergenceNotif() *BsnLacpConvergenceNotif { |
| 4694 | obj := &BsnLacpConvergenceNotif{ |
| 4695 | BsnHeader: NewBsnHeader(43), |
| 4696 | } |
| 4697 | return obj |
| 4698 | } |
| 4699 | |
| 4700 | type BsnLacpStatsReply struct { |
| 4701 | *BsnStatsReply |
| 4702 | Entries []*BsnLacpStatsEntry |
| 4703 | } |
| 4704 | |
| 4705 | type IBsnLacpStatsReply interface { |
| 4706 | IBsnStatsReply |
| 4707 | GetEntries() []*BsnLacpStatsEntry |
| 4708 | } |
| 4709 | |
| 4710 | func (self *BsnLacpStatsReply) GetEntries() []*BsnLacpStatsEntry { |
| 4711 | return self.Entries |
| 4712 | } |
| 4713 | |
| 4714 | func (self *BsnLacpStatsReply) SetEntries(v []*BsnLacpStatsEntry) { |
| 4715 | self.Entries = v |
| 4716 | } |
| 4717 | |
| 4718 | func (self *BsnLacpStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 4719 | startIndex := len(encoder.Bytes()) |
| 4720 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 4721 | return err |
| 4722 | } |
| 4723 | |
| 4724 | for _, obj := range self.Entries { |
| 4725 | if err := obj.Serialize(encoder); err != nil { |
| 4726 | return err |
| 4727 | } |
| 4728 | } |
| 4729 | length := len(encoder.Bytes()) - startIndex |
| 4730 | |
| 4731 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4732 | |
| 4733 | return nil |
| 4734 | } |
| 4735 | |
| 4736 | func DecodeBsnLacpStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnLacpStatsReply, error) { |
| 4737 | _bsnlacpstatsreply := &BsnLacpStatsReply{BsnStatsReply: parent} |
| 4738 | |
| 4739 | for decoder.Length() >= 36 { |
| 4740 | item, err := DecodeBsnLacpStatsEntry(decoder) |
| 4741 | if err != nil { |
| 4742 | return nil, err |
| 4743 | } |
| 4744 | if item != nil { |
| 4745 | _bsnlacpstatsreply.Entries = append(_bsnlacpstatsreply.Entries, item) |
| 4746 | } |
| 4747 | } |
| 4748 | return _bsnlacpstatsreply, nil |
| 4749 | } |
| 4750 | |
| 4751 | func NewBsnLacpStatsReply() *BsnLacpStatsReply { |
| 4752 | obj := &BsnLacpStatsReply{ |
| 4753 | BsnStatsReply: NewBsnStatsReply(1), |
| 4754 | } |
| 4755 | return obj |
| 4756 | } |
| 4757 | |
| 4758 | type BsnLacpStatsRequest struct { |
| 4759 | *BsnStatsRequest |
| 4760 | } |
| 4761 | |
| 4762 | type IBsnLacpStatsRequest interface { |
| 4763 | IBsnStatsRequest |
| 4764 | } |
| 4765 | |
| 4766 | func (self *BsnLacpStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 4767 | startIndex := len(encoder.Bytes()) |
| 4768 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 4769 | return err |
| 4770 | } |
| 4771 | length := len(encoder.Bytes()) - startIndex |
| 4772 | |
| 4773 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4774 | |
| 4775 | return nil |
| 4776 | } |
| 4777 | |
| 4778 | func DecodeBsnLacpStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnLacpStatsRequest, error) { |
| 4779 | _bsnlacpstatsrequest := &BsnLacpStatsRequest{BsnStatsRequest: parent} |
| 4780 | return _bsnlacpstatsrequest, nil |
| 4781 | } |
| 4782 | |
| 4783 | func NewBsnLacpStatsRequest() *BsnLacpStatsRequest { |
| 4784 | obj := &BsnLacpStatsRequest{ |
| 4785 | BsnStatsRequest: NewBsnStatsRequest(1), |
| 4786 | } |
| 4787 | return obj |
| 4788 | } |
| 4789 | |
| 4790 | type BsnLog struct { |
| 4791 | *BsnHeader |
| 4792 | Loglevel BsnLoglevel |
| 4793 | Data []byte |
| 4794 | } |
| 4795 | |
| 4796 | type IBsnLog interface { |
| 4797 | IBsnHeader |
| 4798 | GetLoglevel() BsnLoglevel |
| 4799 | GetData() []byte |
| 4800 | } |
| 4801 | |
| 4802 | func (self *BsnLog) GetLoglevel() BsnLoglevel { |
| 4803 | return self.Loglevel |
| 4804 | } |
| 4805 | |
| 4806 | func (self *BsnLog) SetLoglevel(v BsnLoglevel) { |
| 4807 | self.Loglevel = v |
| 4808 | } |
| 4809 | |
| 4810 | func (self *BsnLog) GetData() []byte { |
| 4811 | return self.Data |
| 4812 | } |
| 4813 | |
| 4814 | func (self *BsnLog) SetData(v []byte) { |
| 4815 | self.Data = v |
| 4816 | } |
| 4817 | |
| 4818 | func (self *BsnLog) Serialize(encoder *goloxi.Encoder) error { |
| 4819 | startIndex := len(encoder.Bytes()) |
| 4820 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4821 | return err |
| 4822 | } |
| 4823 | |
| 4824 | encoder.PutUint8(uint8(self.Loglevel)) |
| 4825 | encoder.Write(self.Data) |
| 4826 | length := len(encoder.Bytes()) - startIndex |
| 4827 | |
| 4828 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4829 | |
| 4830 | return nil |
| 4831 | } |
| 4832 | |
| 4833 | func DecodeBsnLog(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnLog, error) { |
| 4834 | _bsnlog := &BsnLog{BsnHeader: parent} |
| 4835 | if decoder.Length() < 1 { |
| 4836 | return nil, fmt.Errorf("BsnLog packet too short: %d < 1", decoder.Length()) |
| 4837 | } |
| 4838 | _bsnlog.Loglevel = BsnLoglevel(decoder.ReadByte()) |
| 4839 | _bsnlog.Data = decoder.Read(int(decoder.Length())) |
| 4840 | return _bsnlog, nil |
| 4841 | } |
| 4842 | |
| 4843 | func NewBsnLog() *BsnLog { |
| 4844 | obj := &BsnLog{ |
| 4845 | BsnHeader: NewBsnHeader(63), |
| 4846 | } |
| 4847 | return obj |
| 4848 | } |
| 4849 | |
| 4850 | type BsnLuaCommandReply struct { |
| 4851 | *BsnHeader |
| 4852 | Data []byte |
| 4853 | } |
| 4854 | |
| 4855 | type IBsnLuaCommandReply interface { |
| 4856 | IBsnHeader |
| 4857 | GetData() []byte |
| 4858 | } |
| 4859 | |
| 4860 | func (self *BsnLuaCommandReply) GetData() []byte { |
| 4861 | return self.Data |
| 4862 | } |
| 4863 | |
| 4864 | func (self *BsnLuaCommandReply) SetData(v []byte) { |
| 4865 | self.Data = v |
| 4866 | } |
| 4867 | |
| 4868 | func (self *BsnLuaCommandReply) Serialize(encoder *goloxi.Encoder) error { |
| 4869 | startIndex := len(encoder.Bytes()) |
| 4870 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4871 | return err |
| 4872 | } |
| 4873 | |
| 4874 | encoder.Write(self.Data) |
| 4875 | length := len(encoder.Bytes()) - startIndex |
| 4876 | |
| 4877 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4878 | |
| 4879 | return nil |
| 4880 | } |
| 4881 | |
| 4882 | func DecodeBsnLuaCommandReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnLuaCommandReply, error) { |
| 4883 | _bsnluacommandreply := &BsnLuaCommandReply{BsnHeader: parent} |
| 4884 | _bsnluacommandreply.Data = decoder.Read(int(decoder.Length())) |
| 4885 | return _bsnluacommandreply, nil |
| 4886 | } |
| 4887 | |
| 4888 | func NewBsnLuaCommandReply() *BsnLuaCommandReply { |
| 4889 | obj := &BsnLuaCommandReply{ |
| 4890 | BsnHeader: NewBsnHeader(66), |
| 4891 | } |
| 4892 | return obj |
| 4893 | } |
| 4894 | |
| 4895 | type BsnLuaCommandRequest struct { |
| 4896 | *BsnHeader |
| 4897 | Data []byte |
| 4898 | } |
| 4899 | |
| 4900 | type IBsnLuaCommandRequest interface { |
| 4901 | IBsnHeader |
| 4902 | GetData() []byte |
| 4903 | } |
| 4904 | |
| 4905 | func (self *BsnLuaCommandRequest) GetData() []byte { |
| 4906 | return self.Data |
| 4907 | } |
| 4908 | |
| 4909 | func (self *BsnLuaCommandRequest) SetData(v []byte) { |
| 4910 | self.Data = v |
| 4911 | } |
| 4912 | |
| 4913 | func (self *BsnLuaCommandRequest) Serialize(encoder *goloxi.Encoder) error { |
| 4914 | startIndex := len(encoder.Bytes()) |
| 4915 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4916 | return err |
| 4917 | } |
| 4918 | |
| 4919 | encoder.Write(self.Data) |
| 4920 | length := len(encoder.Bytes()) - startIndex |
| 4921 | |
| 4922 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4923 | |
| 4924 | return nil |
| 4925 | } |
| 4926 | |
| 4927 | func DecodeBsnLuaCommandRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnLuaCommandRequest, error) { |
| 4928 | _bsnluacommandrequest := &BsnLuaCommandRequest{BsnHeader: parent} |
| 4929 | _bsnluacommandrequest.Data = decoder.Read(int(decoder.Length())) |
| 4930 | return _bsnluacommandrequest, nil |
| 4931 | } |
| 4932 | |
| 4933 | func NewBsnLuaCommandRequest() *BsnLuaCommandRequest { |
| 4934 | obj := &BsnLuaCommandRequest{ |
| 4935 | BsnHeader: NewBsnHeader(65), |
| 4936 | } |
| 4937 | return obj |
| 4938 | } |
| 4939 | |
| 4940 | type BsnLuaNotification struct { |
| 4941 | *BsnHeader |
| 4942 | Data []byte |
| 4943 | } |
| 4944 | |
| 4945 | type IBsnLuaNotification interface { |
| 4946 | IBsnHeader |
| 4947 | GetData() []byte |
| 4948 | } |
| 4949 | |
| 4950 | func (self *BsnLuaNotification) GetData() []byte { |
| 4951 | return self.Data |
| 4952 | } |
| 4953 | |
| 4954 | func (self *BsnLuaNotification) SetData(v []byte) { |
| 4955 | self.Data = v |
| 4956 | } |
| 4957 | |
| 4958 | func (self *BsnLuaNotification) Serialize(encoder *goloxi.Encoder) error { |
| 4959 | startIndex := len(encoder.Bytes()) |
| 4960 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4961 | return err |
| 4962 | } |
| 4963 | |
| 4964 | encoder.Write(self.Data) |
| 4965 | length := len(encoder.Bytes()) - startIndex |
| 4966 | |
| 4967 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4968 | |
| 4969 | return nil |
| 4970 | } |
| 4971 | |
| 4972 | func DecodeBsnLuaNotification(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnLuaNotification, error) { |
| 4973 | _bsnluanotification := &BsnLuaNotification{BsnHeader: parent} |
| 4974 | _bsnluanotification.Data = decoder.Read(int(decoder.Length())) |
| 4975 | return _bsnluanotification, nil |
| 4976 | } |
| 4977 | |
| 4978 | func NewBsnLuaNotification() *BsnLuaNotification { |
| 4979 | obj := &BsnLuaNotification{ |
| 4980 | BsnHeader: NewBsnHeader(67), |
| 4981 | } |
| 4982 | return obj |
| 4983 | } |
| 4984 | |
| 4985 | type BsnLuaUpload struct { |
| 4986 | *BsnHeader |
| 4987 | Flags BsnLuaUploadFlags |
| 4988 | Filename string |
| 4989 | Data []byte |
| 4990 | } |
| 4991 | |
| 4992 | type IBsnLuaUpload interface { |
| 4993 | IBsnHeader |
| 4994 | GetFlags() BsnLuaUploadFlags |
| 4995 | GetFilename() string |
| 4996 | GetData() []byte |
| 4997 | } |
| 4998 | |
| 4999 | func (self *BsnLuaUpload) GetFlags() BsnLuaUploadFlags { |
| 5000 | return self.Flags |
| 5001 | } |
| 5002 | |
| 5003 | func (self *BsnLuaUpload) SetFlags(v BsnLuaUploadFlags) { |
| 5004 | self.Flags = v |
| 5005 | } |
| 5006 | |
| 5007 | func (self *BsnLuaUpload) GetFilename() string { |
| 5008 | return self.Filename |
| 5009 | } |
| 5010 | |
| 5011 | func (self *BsnLuaUpload) SetFilename(v string) { |
| 5012 | self.Filename = v |
| 5013 | } |
| 5014 | |
| 5015 | func (self *BsnLuaUpload) GetData() []byte { |
| 5016 | return self.Data |
| 5017 | } |
| 5018 | |
| 5019 | func (self *BsnLuaUpload) SetData(v []byte) { |
| 5020 | self.Data = v |
| 5021 | } |
| 5022 | |
| 5023 | func (self *BsnLuaUpload) Serialize(encoder *goloxi.Encoder) error { |
| 5024 | startIndex := len(encoder.Bytes()) |
| 5025 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5026 | return err |
| 5027 | } |
| 5028 | |
| 5029 | encoder.PutUint16(uint16(self.Flags)) |
| 5030 | encoder.Write([]byte(self.Filename)) |
| 5031 | encoder.Write(self.Data) |
| 5032 | length := len(encoder.Bytes()) - startIndex |
| 5033 | |
| 5034 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5035 | |
| 5036 | return nil |
| 5037 | } |
| 5038 | |
| 5039 | func DecodeBsnLuaUpload(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnLuaUpload, error) { |
| 5040 | _bsnluaupload := &BsnLuaUpload{BsnHeader: parent} |
| 5041 | if decoder.Length() < 66 { |
| 5042 | return nil, fmt.Errorf("BsnLuaUpload packet too short: %d < 66", decoder.Length()) |
| 5043 | } |
| 5044 | _bsnluaupload.Flags = BsnLuaUploadFlags(decoder.ReadUint16()) |
| 5045 | _bsnluaupload.Filename = string(bytes.Trim(decoder.Read(64), "\x00")) |
| 5046 | _bsnluaupload.Data = decoder.Read(int(decoder.Length())) |
| 5047 | return _bsnluaupload, nil |
| 5048 | } |
| 5049 | |
| 5050 | func NewBsnLuaUpload() *BsnLuaUpload { |
| 5051 | obj := &BsnLuaUpload{ |
| 5052 | BsnHeader: NewBsnHeader(64), |
| 5053 | } |
| 5054 | return obj |
| 5055 | } |
| 5056 | |
| 5057 | type BsnPduRxReply struct { |
| 5058 | *BsnHeader |
| 5059 | Status uint32 |
| 5060 | PortNo Port |
| 5061 | SlotNum uint8 |
| 5062 | } |
| 5063 | |
| 5064 | type IBsnPduRxReply interface { |
| 5065 | IBsnHeader |
| 5066 | GetStatus() uint32 |
| 5067 | GetPortNo() Port |
| 5068 | GetSlotNum() uint8 |
| 5069 | } |
| 5070 | |
| 5071 | func (self *BsnPduRxReply) GetStatus() uint32 { |
| 5072 | return self.Status |
| 5073 | } |
| 5074 | |
| 5075 | func (self *BsnPduRxReply) SetStatus(v uint32) { |
| 5076 | self.Status = v |
| 5077 | } |
| 5078 | |
| 5079 | func (self *BsnPduRxReply) GetPortNo() Port { |
| 5080 | return self.PortNo |
| 5081 | } |
| 5082 | |
| 5083 | func (self *BsnPduRxReply) SetPortNo(v Port) { |
| 5084 | self.PortNo = v |
| 5085 | } |
| 5086 | |
| 5087 | func (self *BsnPduRxReply) GetSlotNum() uint8 { |
| 5088 | return self.SlotNum |
| 5089 | } |
| 5090 | |
| 5091 | func (self *BsnPduRxReply) SetSlotNum(v uint8) { |
| 5092 | self.SlotNum = v |
| 5093 | } |
| 5094 | |
| 5095 | func (self *BsnPduRxReply) Serialize(encoder *goloxi.Encoder) error { |
| 5096 | startIndex := len(encoder.Bytes()) |
| 5097 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5098 | return err |
| 5099 | } |
| 5100 | |
| 5101 | encoder.PutUint32(uint32(self.Status)) |
| 5102 | self.PortNo.Serialize(encoder) |
| 5103 | encoder.PutUint8(uint8(self.SlotNum)) |
| 5104 | length := len(encoder.Bytes()) - startIndex |
| 5105 | |
| 5106 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5107 | |
| 5108 | return nil |
| 5109 | } |
| 5110 | |
| 5111 | func DecodeBsnPduRxReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduRxReply, error) { |
| 5112 | _bsnpdurxreply := &BsnPduRxReply{BsnHeader: parent} |
| 5113 | if decoder.Length() < 9 { |
| 5114 | return nil, fmt.Errorf("BsnPduRxReply packet too short: %d < 9", decoder.Length()) |
| 5115 | } |
| 5116 | _bsnpdurxreply.Status = uint32(decoder.ReadUint32()) |
| 5117 | _bsnpdurxreply.PortNo.Decode(decoder) |
| 5118 | _bsnpdurxreply.SlotNum = uint8(decoder.ReadByte()) |
| 5119 | return _bsnpdurxreply, nil |
| 5120 | } |
| 5121 | |
| 5122 | func NewBsnPduRxReply() *BsnPduRxReply { |
| 5123 | obj := &BsnPduRxReply{ |
| 5124 | BsnHeader: NewBsnHeader(34), |
| 5125 | } |
| 5126 | return obj |
| 5127 | } |
| 5128 | |
| 5129 | type BsnPduRxRequest struct { |
| 5130 | *BsnHeader |
| 5131 | TimeoutMs uint32 |
| 5132 | PortNo Port |
| 5133 | SlotNum uint8 |
| 5134 | Data []byte |
| 5135 | } |
| 5136 | |
| 5137 | type IBsnPduRxRequest interface { |
| 5138 | IBsnHeader |
| 5139 | GetTimeoutMs() uint32 |
| 5140 | GetPortNo() Port |
| 5141 | GetSlotNum() uint8 |
| 5142 | GetData() []byte |
| 5143 | } |
| 5144 | |
| 5145 | func (self *BsnPduRxRequest) GetTimeoutMs() uint32 { |
| 5146 | return self.TimeoutMs |
| 5147 | } |
| 5148 | |
| 5149 | func (self *BsnPduRxRequest) SetTimeoutMs(v uint32) { |
| 5150 | self.TimeoutMs = v |
| 5151 | } |
| 5152 | |
| 5153 | func (self *BsnPduRxRequest) GetPortNo() Port { |
| 5154 | return self.PortNo |
| 5155 | } |
| 5156 | |
| 5157 | func (self *BsnPduRxRequest) SetPortNo(v Port) { |
| 5158 | self.PortNo = v |
| 5159 | } |
| 5160 | |
| 5161 | func (self *BsnPduRxRequest) GetSlotNum() uint8 { |
| 5162 | return self.SlotNum |
| 5163 | } |
| 5164 | |
| 5165 | func (self *BsnPduRxRequest) SetSlotNum(v uint8) { |
| 5166 | self.SlotNum = v |
| 5167 | } |
| 5168 | |
| 5169 | func (self *BsnPduRxRequest) GetData() []byte { |
| 5170 | return self.Data |
| 5171 | } |
| 5172 | |
| 5173 | func (self *BsnPduRxRequest) SetData(v []byte) { |
| 5174 | self.Data = v |
| 5175 | } |
| 5176 | |
| 5177 | func (self *BsnPduRxRequest) Serialize(encoder *goloxi.Encoder) error { |
| 5178 | startIndex := len(encoder.Bytes()) |
| 5179 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5180 | return err |
| 5181 | } |
| 5182 | |
| 5183 | encoder.PutUint32(uint32(self.TimeoutMs)) |
| 5184 | self.PortNo.Serialize(encoder) |
| 5185 | encoder.PutUint8(uint8(self.SlotNum)) |
| 5186 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 5187 | encoder.Write(self.Data) |
| 5188 | length := len(encoder.Bytes()) - startIndex |
| 5189 | |
| 5190 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5191 | |
| 5192 | return nil |
| 5193 | } |
| 5194 | |
| 5195 | func DecodeBsnPduRxRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduRxRequest, error) { |
| 5196 | _bsnpdurxrequest := &BsnPduRxRequest{BsnHeader: parent} |
| 5197 | if decoder.Length() < 12 { |
| 5198 | return nil, fmt.Errorf("BsnPduRxRequest packet too short: %d < 12", decoder.Length()) |
| 5199 | } |
| 5200 | _bsnpdurxrequest.TimeoutMs = uint32(decoder.ReadUint32()) |
| 5201 | _bsnpdurxrequest.PortNo.Decode(decoder) |
| 5202 | _bsnpdurxrequest.SlotNum = uint8(decoder.ReadByte()) |
| 5203 | decoder.Skip(3) |
| 5204 | _bsnpdurxrequest.Data = decoder.Read(int(decoder.Length())) |
| 5205 | return _bsnpdurxrequest, nil |
| 5206 | } |
| 5207 | |
| 5208 | func NewBsnPduRxRequest() *BsnPduRxRequest { |
| 5209 | obj := &BsnPduRxRequest{ |
| 5210 | BsnHeader: NewBsnHeader(33), |
| 5211 | } |
| 5212 | return obj |
| 5213 | } |
| 5214 | |
| 5215 | type BsnPduRxTimeout struct { |
| 5216 | *BsnHeader |
| 5217 | PortNo Port |
| 5218 | SlotNum uint8 |
| 5219 | } |
| 5220 | |
| 5221 | type IBsnPduRxTimeout interface { |
| 5222 | IBsnHeader |
| 5223 | GetPortNo() Port |
| 5224 | GetSlotNum() uint8 |
| 5225 | } |
| 5226 | |
| 5227 | func (self *BsnPduRxTimeout) GetPortNo() Port { |
| 5228 | return self.PortNo |
| 5229 | } |
| 5230 | |
| 5231 | func (self *BsnPduRxTimeout) SetPortNo(v Port) { |
| 5232 | self.PortNo = v |
| 5233 | } |
| 5234 | |
| 5235 | func (self *BsnPduRxTimeout) GetSlotNum() uint8 { |
| 5236 | return self.SlotNum |
| 5237 | } |
| 5238 | |
| 5239 | func (self *BsnPduRxTimeout) SetSlotNum(v uint8) { |
| 5240 | self.SlotNum = v |
| 5241 | } |
| 5242 | |
| 5243 | func (self *BsnPduRxTimeout) Serialize(encoder *goloxi.Encoder) error { |
| 5244 | startIndex := len(encoder.Bytes()) |
| 5245 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5246 | return err |
| 5247 | } |
| 5248 | |
| 5249 | self.PortNo.Serialize(encoder) |
| 5250 | encoder.PutUint8(uint8(self.SlotNum)) |
| 5251 | length := len(encoder.Bytes()) - startIndex |
| 5252 | |
| 5253 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5254 | |
| 5255 | return nil |
| 5256 | } |
| 5257 | |
| 5258 | func DecodeBsnPduRxTimeout(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduRxTimeout, error) { |
| 5259 | _bsnpdurxtimeout := &BsnPduRxTimeout{BsnHeader: parent} |
| 5260 | if decoder.Length() < 5 { |
| 5261 | return nil, fmt.Errorf("BsnPduRxTimeout packet too short: %d < 5", decoder.Length()) |
| 5262 | } |
| 5263 | _bsnpdurxtimeout.PortNo.Decode(decoder) |
| 5264 | _bsnpdurxtimeout.SlotNum = uint8(decoder.ReadByte()) |
| 5265 | return _bsnpdurxtimeout, nil |
| 5266 | } |
| 5267 | |
| 5268 | func NewBsnPduRxTimeout() *BsnPduRxTimeout { |
| 5269 | obj := &BsnPduRxTimeout{ |
| 5270 | BsnHeader: NewBsnHeader(35), |
| 5271 | } |
| 5272 | return obj |
| 5273 | } |
| 5274 | |
| 5275 | type BsnPduTxReply struct { |
| 5276 | *BsnHeader |
| 5277 | Status uint32 |
| 5278 | PortNo Port |
| 5279 | SlotNum uint8 |
| 5280 | } |
| 5281 | |
| 5282 | type IBsnPduTxReply interface { |
| 5283 | IBsnHeader |
| 5284 | GetStatus() uint32 |
| 5285 | GetPortNo() Port |
| 5286 | GetSlotNum() uint8 |
| 5287 | } |
| 5288 | |
| 5289 | func (self *BsnPduTxReply) GetStatus() uint32 { |
| 5290 | return self.Status |
| 5291 | } |
| 5292 | |
| 5293 | func (self *BsnPduTxReply) SetStatus(v uint32) { |
| 5294 | self.Status = v |
| 5295 | } |
| 5296 | |
| 5297 | func (self *BsnPduTxReply) GetPortNo() Port { |
| 5298 | return self.PortNo |
| 5299 | } |
| 5300 | |
| 5301 | func (self *BsnPduTxReply) SetPortNo(v Port) { |
| 5302 | self.PortNo = v |
| 5303 | } |
| 5304 | |
| 5305 | func (self *BsnPduTxReply) GetSlotNum() uint8 { |
| 5306 | return self.SlotNum |
| 5307 | } |
| 5308 | |
| 5309 | func (self *BsnPduTxReply) SetSlotNum(v uint8) { |
| 5310 | self.SlotNum = v |
| 5311 | } |
| 5312 | |
| 5313 | func (self *BsnPduTxReply) Serialize(encoder *goloxi.Encoder) error { |
| 5314 | startIndex := len(encoder.Bytes()) |
| 5315 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5316 | return err |
| 5317 | } |
| 5318 | |
| 5319 | encoder.PutUint32(uint32(self.Status)) |
| 5320 | self.PortNo.Serialize(encoder) |
| 5321 | encoder.PutUint8(uint8(self.SlotNum)) |
| 5322 | length := len(encoder.Bytes()) - startIndex |
| 5323 | |
| 5324 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5325 | |
| 5326 | return nil |
| 5327 | } |
| 5328 | |
| 5329 | func DecodeBsnPduTxReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduTxReply, error) { |
| 5330 | _bsnpdutxreply := &BsnPduTxReply{BsnHeader: parent} |
| 5331 | if decoder.Length() < 9 { |
| 5332 | return nil, fmt.Errorf("BsnPduTxReply packet too short: %d < 9", decoder.Length()) |
| 5333 | } |
| 5334 | _bsnpdutxreply.Status = uint32(decoder.ReadUint32()) |
| 5335 | _bsnpdutxreply.PortNo.Decode(decoder) |
| 5336 | _bsnpdutxreply.SlotNum = uint8(decoder.ReadByte()) |
| 5337 | return _bsnpdutxreply, nil |
| 5338 | } |
| 5339 | |
| 5340 | func NewBsnPduTxReply() *BsnPduTxReply { |
| 5341 | obj := &BsnPduTxReply{ |
| 5342 | BsnHeader: NewBsnHeader(32), |
| 5343 | } |
| 5344 | return obj |
| 5345 | } |
| 5346 | |
| 5347 | type BsnPduTxRequest struct { |
| 5348 | *BsnHeader |
| 5349 | TxIntervalMs uint32 |
| 5350 | PortNo Port |
| 5351 | SlotNum uint8 |
| 5352 | Data []byte |
| 5353 | } |
| 5354 | |
| 5355 | type IBsnPduTxRequest interface { |
| 5356 | IBsnHeader |
| 5357 | GetTxIntervalMs() uint32 |
| 5358 | GetPortNo() Port |
| 5359 | GetSlotNum() uint8 |
| 5360 | GetData() []byte |
| 5361 | } |
| 5362 | |
| 5363 | func (self *BsnPduTxRequest) GetTxIntervalMs() uint32 { |
| 5364 | return self.TxIntervalMs |
| 5365 | } |
| 5366 | |
| 5367 | func (self *BsnPduTxRequest) SetTxIntervalMs(v uint32) { |
| 5368 | self.TxIntervalMs = v |
| 5369 | } |
| 5370 | |
| 5371 | func (self *BsnPduTxRequest) GetPortNo() Port { |
| 5372 | return self.PortNo |
| 5373 | } |
| 5374 | |
| 5375 | func (self *BsnPduTxRequest) SetPortNo(v Port) { |
| 5376 | self.PortNo = v |
| 5377 | } |
| 5378 | |
| 5379 | func (self *BsnPduTxRequest) GetSlotNum() uint8 { |
| 5380 | return self.SlotNum |
| 5381 | } |
| 5382 | |
| 5383 | func (self *BsnPduTxRequest) SetSlotNum(v uint8) { |
| 5384 | self.SlotNum = v |
| 5385 | } |
| 5386 | |
| 5387 | func (self *BsnPduTxRequest) GetData() []byte { |
| 5388 | return self.Data |
| 5389 | } |
| 5390 | |
| 5391 | func (self *BsnPduTxRequest) SetData(v []byte) { |
| 5392 | self.Data = v |
| 5393 | } |
| 5394 | |
| 5395 | func (self *BsnPduTxRequest) Serialize(encoder *goloxi.Encoder) error { |
| 5396 | startIndex := len(encoder.Bytes()) |
| 5397 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5398 | return err |
| 5399 | } |
| 5400 | |
| 5401 | encoder.PutUint32(uint32(self.TxIntervalMs)) |
| 5402 | self.PortNo.Serialize(encoder) |
| 5403 | encoder.PutUint8(uint8(self.SlotNum)) |
| 5404 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 5405 | encoder.Write(self.Data) |
| 5406 | length := len(encoder.Bytes()) - startIndex |
| 5407 | |
| 5408 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5409 | |
| 5410 | return nil |
| 5411 | } |
| 5412 | |
| 5413 | func DecodeBsnPduTxRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduTxRequest, error) { |
| 5414 | _bsnpdutxrequest := &BsnPduTxRequest{BsnHeader: parent} |
| 5415 | if decoder.Length() < 12 { |
| 5416 | return nil, fmt.Errorf("BsnPduTxRequest packet too short: %d < 12", decoder.Length()) |
| 5417 | } |
| 5418 | _bsnpdutxrequest.TxIntervalMs = uint32(decoder.ReadUint32()) |
| 5419 | _bsnpdutxrequest.PortNo.Decode(decoder) |
| 5420 | _bsnpdutxrequest.SlotNum = uint8(decoder.ReadByte()) |
| 5421 | decoder.Skip(3) |
| 5422 | _bsnpdutxrequest.Data = decoder.Read(int(decoder.Length())) |
| 5423 | return _bsnpdutxrequest, nil |
| 5424 | } |
| 5425 | |
| 5426 | func NewBsnPduTxRequest() *BsnPduTxRequest { |
| 5427 | obj := &BsnPduTxRequest{ |
| 5428 | BsnHeader: NewBsnHeader(31), |
| 5429 | } |
| 5430 | return obj |
| 5431 | } |
| 5432 | |
| 5433 | type BsnPortCounterStatsReply struct { |
| 5434 | *BsnStatsReply |
| 5435 | Entries []*BsnPortCounterStatsEntry |
| 5436 | } |
| 5437 | |
| 5438 | type IBsnPortCounterStatsReply interface { |
| 5439 | IBsnStatsReply |
| 5440 | GetEntries() []*BsnPortCounterStatsEntry |
| 5441 | } |
| 5442 | |
| 5443 | func (self *BsnPortCounterStatsReply) GetEntries() []*BsnPortCounterStatsEntry { |
| 5444 | return self.Entries |
| 5445 | } |
| 5446 | |
| 5447 | func (self *BsnPortCounterStatsReply) SetEntries(v []*BsnPortCounterStatsEntry) { |
| 5448 | self.Entries = v |
| 5449 | } |
| 5450 | |
| 5451 | func (self *BsnPortCounterStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 5452 | startIndex := len(encoder.Bytes()) |
| 5453 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 5454 | return err |
| 5455 | } |
| 5456 | |
| 5457 | for _, obj := range self.Entries { |
| 5458 | if err := obj.Serialize(encoder); err != nil { |
| 5459 | return err |
| 5460 | } |
| 5461 | } |
| 5462 | length := len(encoder.Bytes()) - startIndex |
| 5463 | |
| 5464 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5465 | |
| 5466 | return nil |
| 5467 | } |
| 5468 | |
| 5469 | func DecodeBsnPortCounterStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnPortCounterStatsReply, error) { |
| 5470 | _bsnportcounterstatsreply := &BsnPortCounterStatsReply{BsnStatsReply: parent} |
| 5471 | |
| 5472 | for decoder.Length() >= 8 { |
| 5473 | item, err := DecodeBsnPortCounterStatsEntry(decoder) |
| 5474 | if err != nil { |
| 5475 | return nil, err |
| 5476 | } |
| 5477 | if item != nil { |
| 5478 | _bsnportcounterstatsreply.Entries = append(_bsnportcounterstatsreply.Entries, item) |
| 5479 | } |
| 5480 | } |
| 5481 | return _bsnportcounterstatsreply, nil |
| 5482 | } |
| 5483 | |
| 5484 | func NewBsnPortCounterStatsReply() *BsnPortCounterStatsReply { |
| 5485 | obj := &BsnPortCounterStatsReply{ |
| 5486 | BsnStatsReply: NewBsnStatsReply(8), |
| 5487 | } |
| 5488 | return obj |
| 5489 | } |
| 5490 | |
| 5491 | type BsnPortCounterStatsRequest struct { |
| 5492 | *BsnStatsRequest |
| 5493 | PortNo Port |
| 5494 | } |
| 5495 | |
| 5496 | type IBsnPortCounterStatsRequest interface { |
| 5497 | IBsnStatsRequest |
| 5498 | GetPortNo() Port |
| 5499 | } |
| 5500 | |
| 5501 | func (self *BsnPortCounterStatsRequest) GetPortNo() Port { |
| 5502 | return self.PortNo |
| 5503 | } |
| 5504 | |
| 5505 | func (self *BsnPortCounterStatsRequest) SetPortNo(v Port) { |
| 5506 | self.PortNo = v |
| 5507 | } |
| 5508 | |
| 5509 | func (self *BsnPortCounterStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 5510 | startIndex := len(encoder.Bytes()) |
| 5511 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 5512 | return err |
| 5513 | } |
| 5514 | |
| 5515 | self.PortNo.Serialize(encoder) |
| 5516 | length := len(encoder.Bytes()) - startIndex |
| 5517 | |
| 5518 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5519 | |
| 5520 | return nil |
| 5521 | } |
| 5522 | |
| 5523 | func DecodeBsnPortCounterStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnPortCounterStatsRequest, error) { |
| 5524 | _bsnportcounterstatsrequest := &BsnPortCounterStatsRequest{BsnStatsRequest: parent} |
| 5525 | if decoder.Length() < 4 { |
| 5526 | return nil, fmt.Errorf("BsnPortCounterStatsRequest packet too short: %d < 4", decoder.Length()) |
| 5527 | } |
| 5528 | _bsnportcounterstatsrequest.PortNo.Decode(decoder) |
| 5529 | return _bsnportcounterstatsrequest, nil |
| 5530 | } |
| 5531 | |
| 5532 | func NewBsnPortCounterStatsRequest() *BsnPortCounterStatsRequest { |
| 5533 | obj := &BsnPortCounterStatsRequest{ |
| 5534 | BsnStatsRequest: NewBsnStatsRequest(8), |
| 5535 | } |
| 5536 | return obj |
| 5537 | } |
| 5538 | |
| 5539 | type BsnSetAuxCxnsReply struct { |
| 5540 | *BsnHeader |
| 5541 | NumAux uint32 |
| 5542 | Status uint32 |
| 5543 | } |
| 5544 | |
| 5545 | type IBsnSetAuxCxnsReply interface { |
| 5546 | IBsnHeader |
| 5547 | GetNumAux() uint32 |
| 5548 | GetStatus() uint32 |
| 5549 | } |
| 5550 | |
| 5551 | func (self *BsnSetAuxCxnsReply) GetNumAux() uint32 { |
| 5552 | return self.NumAux |
| 5553 | } |
| 5554 | |
| 5555 | func (self *BsnSetAuxCxnsReply) SetNumAux(v uint32) { |
| 5556 | self.NumAux = v |
| 5557 | } |
| 5558 | |
| 5559 | func (self *BsnSetAuxCxnsReply) GetStatus() uint32 { |
| 5560 | return self.Status |
| 5561 | } |
| 5562 | |
| 5563 | func (self *BsnSetAuxCxnsReply) SetStatus(v uint32) { |
| 5564 | self.Status = v |
| 5565 | } |
| 5566 | |
| 5567 | func (self *BsnSetAuxCxnsReply) Serialize(encoder *goloxi.Encoder) error { |
| 5568 | startIndex := len(encoder.Bytes()) |
| 5569 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5570 | return err |
| 5571 | } |
| 5572 | |
| 5573 | encoder.PutUint32(uint32(self.NumAux)) |
| 5574 | encoder.PutUint32(uint32(self.Status)) |
| 5575 | length := len(encoder.Bytes()) - startIndex |
| 5576 | |
| 5577 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5578 | |
| 5579 | return nil |
| 5580 | } |
| 5581 | |
| 5582 | func DecodeBsnSetAuxCxnsReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetAuxCxnsReply, error) { |
| 5583 | _bsnsetauxcxnsreply := &BsnSetAuxCxnsReply{BsnHeader: parent} |
| 5584 | if decoder.Length() < 8 { |
| 5585 | return nil, fmt.Errorf("BsnSetAuxCxnsReply packet too short: %d < 8", decoder.Length()) |
| 5586 | } |
| 5587 | _bsnsetauxcxnsreply.NumAux = uint32(decoder.ReadUint32()) |
| 5588 | _bsnsetauxcxnsreply.Status = uint32(decoder.ReadUint32()) |
| 5589 | return _bsnsetauxcxnsreply, nil |
| 5590 | } |
| 5591 | |
| 5592 | func NewBsnSetAuxCxnsReply() *BsnSetAuxCxnsReply { |
| 5593 | obj := &BsnSetAuxCxnsReply{ |
| 5594 | BsnHeader: NewBsnHeader(59), |
| 5595 | } |
| 5596 | return obj |
| 5597 | } |
| 5598 | |
| 5599 | type BsnSetAuxCxnsRequest struct { |
| 5600 | *BsnHeader |
| 5601 | NumAux uint32 |
| 5602 | } |
| 5603 | |
| 5604 | type IBsnSetAuxCxnsRequest interface { |
| 5605 | IBsnHeader |
| 5606 | GetNumAux() uint32 |
| 5607 | } |
| 5608 | |
| 5609 | func (self *BsnSetAuxCxnsRequest) GetNumAux() uint32 { |
| 5610 | return self.NumAux |
| 5611 | } |
| 5612 | |
| 5613 | func (self *BsnSetAuxCxnsRequest) SetNumAux(v uint32) { |
| 5614 | self.NumAux = v |
| 5615 | } |
| 5616 | |
| 5617 | func (self *BsnSetAuxCxnsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 5618 | startIndex := len(encoder.Bytes()) |
| 5619 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5620 | return err |
| 5621 | } |
| 5622 | |
| 5623 | encoder.PutUint32(uint32(self.NumAux)) |
| 5624 | length := len(encoder.Bytes()) - startIndex |
| 5625 | |
| 5626 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5627 | |
| 5628 | return nil |
| 5629 | } |
| 5630 | |
| 5631 | func DecodeBsnSetAuxCxnsRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetAuxCxnsRequest, error) { |
| 5632 | _bsnsetauxcxnsrequest := &BsnSetAuxCxnsRequest{BsnHeader: parent} |
| 5633 | if decoder.Length() < 4 { |
| 5634 | return nil, fmt.Errorf("BsnSetAuxCxnsRequest packet too short: %d < 4", decoder.Length()) |
| 5635 | } |
| 5636 | _bsnsetauxcxnsrequest.NumAux = uint32(decoder.ReadUint32()) |
| 5637 | return _bsnsetauxcxnsrequest, nil |
| 5638 | } |
| 5639 | |
| 5640 | func NewBsnSetAuxCxnsRequest() *BsnSetAuxCxnsRequest { |
| 5641 | obj := &BsnSetAuxCxnsRequest{ |
| 5642 | BsnHeader: NewBsnHeader(58), |
| 5643 | } |
| 5644 | return obj |
| 5645 | } |
| 5646 | |
| 5647 | type BsnSetLacpReply struct { |
| 5648 | *BsnHeader |
| 5649 | Status uint32 |
| 5650 | PortNo Port |
| 5651 | } |
| 5652 | |
| 5653 | type IBsnSetLacpReply interface { |
| 5654 | IBsnHeader |
| 5655 | GetStatus() uint32 |
| 5656 | GetPortNo() Port |
| 5657 | } |
| 5658 | |
| 5659 | func (self *BsnSetLacpReply) GetStatus() uint32 { |
| 5660 | return self.Status |
| 5661 | } |
| 5662 | |
| 5663 | func (self *BsnSetLacpReply) SetStatus(v uint32) { |
| 5664 | self.Status = v |
| 5665 | } |
| 5666 | |
| 5667 | func (self *BsnSetLacpReply) GetPortNo() Port { |
| 5668 | return self.PortNo |
| 5669 | } |
| 5670 | |
| 5671 | func (self *BsnSetLacpReply) SetPortNo(v Port) { |
| 5672 | self.PortNo = v |
| 5673 | } |
| 5674 | |
| 5675 | func (self *BsnSetLacpReply) Serialize(encoder *goloxi.Encoder) error { |
| 5676 | startIndex := len(encoder.Bytes()) |
| 5677 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5678 | return err |
| 5679 | } |
| 5680 | |
| 5681 | encoder.PutUint32(uint32(self.Status)) |
| 5682 | self.PortNo.Serialize(encoder) |
| 5683 | length := len(encoder.Bytes()) - startIndex |
| 5684 | |
| 5685 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5686 | |
| 5687 | return nil |
| 5688 | } |
| 5689 | |
| 5690 | func DecodeBsnSetLacpReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetLacpReply, error) { |
| 5691 | _bsnsetlacpreply := &BsnSetLacpReply{BsnHeader: parent} |
| 5692 | if decoder.Length() < 8 { |
| 5693 | return nil, fmt.Errorf("BsnSetLacpReply packet too short: %d < 8", decoder.Length()) |
| 5694 | } |
| 5695 | _bsnsetlacpreply.Status = uint32(decoder.ReadUint32()) |
| 5696 | _bsnsetlacpreply.PortNo.Decode(decoder) |
| 5697 | return _bsnsetlacpreply, nil |
| 5698 | } |
| 5699 | |
| 5700 | func NewBsnSetLacpReply() *BsnSetLacpReply { |
| 5701 | obj := &BsnSetLacpReply{ |
| 5702 | BsnHeader: NewBsnHeader(42), |
| 5703 | } |
| 5704 | return obj |
| 5705 | } |
| 5706 | |
| 5707 | type BsnSetLacpRequest struct { |
| 5708 | *BsnHeader |
| 5709 | Enabled uint8 |
| 5710 | PortNo Port |
| 5711 | ActorSysPriority uint16 |
| 5712 | ActorSysMac net.HardwareAddr |
| 5713 | ActorPortPriority uint16 |
| 5714 | ActorPortNum uint16 |
| 5715 | ActorKey uint16 |
| 5716 | } |
| 5717 | |
| 5718 | type IBsnSetLacpRequest interface { |
| 5719 | IBsnHeader |
| 5720 | GetEnabled() uint8 |
| 5721 | GetPortNo() Port |
| 5722 | GetActorSysPriority() uint16 |
| 5723 | GetActorSysMac() net.HardwareAddr |
| 5724 | GetActorPortPriority() uint16 |
| 5725 | GetActorPortNum() uint16 |
| 5726 | GetActorKey() uint16 |
| 5727 | } |
| 5728 | |
| 5729 | func (self *BsnSetLacpRequest) GetEnabled() uint8 { |
| 5730 | return self.Enabled |
| 5731 | } |
| 5732 | |
| 5733 | func (self *BsnSetLacpRequest) SetEnabled(v uint8) { |
| 5734 | self.Enabled = v |
| 5735 | } |
| 5736 | |
| 5737 | func (self *BsnSetLacpRequest) GetPortNo() Port { |
| 5738 | return self.PortNo |
| 5739 | } |
| 5740 | |
| 5741 | func (self *BsnSetLacpRequest) SetPortNo(v Port) { |
| 5742 | self.PortNo = v |
| 5743 | } |
| 5744 | |
| 5745 | func (self *BsnSetLacpRequest) GetActorSysPriority() uint16 { |
| 5746 | return self.ActorSysPriority |
| 5747 | } |
| 5748 | |
| 5749 | func (self *BsnSetLacpRequest) SetActorSysPriority(v uint16) { |
| 5750 | self.ActorSysPriority = v |
| 5751 | } |
| 5752 | |
| 5753 | func (self *BsnSetLacpRequest) GetActorSysMac() net.HardwareAddr { |
| 5754 | return self.ActorSysMac |
| 5755 | } |
| 5756 | |
| 5757 | func (self *BsnSetLacpRequest) SetActorSysMac(v net.HardwareAddr) { |
| 5758 | self.ActorSysMac = v |
| 5759 | } |
| 5760 | |
| 5761 | func (self *BsnSetLacpRequest) GetActorPortPriority() uint16 { |
| 5762 | return self.ActorPortPriority |
| 5763 | } |
| 5764 | |
| 5765 | func (self *BsnSetLacpRequest) SetActorPortPriority(v uint16) { |
| 5766 | self.ActorPortPriority = v |
| 5767 | } |
| 5768 | |
| 5769 | func (self *BsnSetLacpRequest) GetActorPortNum() uint16 { |
| 5770 | return self.ActorPortNum |
| 5771 | } |
| 5772 | |
| 5773 | func (self *BsnSetLacpRequest) SetActorPortNum(v uint16) { |
| 5774 | self.ActorPortNum = v |
| 5775 | } |
| 5776 | |
| 5777 | func (self *BsnSetLacpRequest) GetActorKey() uint16 { |
| 5778 | return self.ActorKey |
| 5779 | } |
| 5780 | |
| 5781 | func (self *BsnSetLacpRequest) SetActorKey(v uint16) { |
| 5782 | self.ActorKey = v |
| 5783 | } |
| 5784 | |
| 5785 | func (self *BsnSetLacpRequest) Serialize(encoder *goloxi.Encoder) error { |
| 5786 | startIndex := len(encoder.Bytes()) |
| 5787 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5788 | return err |
| 5789 | } |
| 5790 | |
| 5791 | encoder.PutUint8(uint8(self.Enabled)) |
| 5792 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 5793 | self.PortNo.Serialize(encoder) |
| 5794 | encoder.PutUint16(uint16(self.ActorSysPriority)) |
| 5795 | encoder.Write(self.ActorSysMac) |
| 5796 | encoder.PutUint16(uint16(self.ActorPortPriority)) |
| 5797 | encoder.PutUint16(uint16(self.ActorPortNum)) |
| 5798 | encoder.PutUint16(uint16(self.ActorKey)) |
| 5799 | length := len(encoder.Bytes()) - startIndex |
| 5800 | |
| 5801 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5802 | |
| 5803 | return nil |
| 5804 | } |
| 5805 | |
| 5806 | func DecodeBsnSetLacpRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetLacpRequest, error) { |
| 5807 | _bsnsetlacprequest := &BsnSetLacpRequest{BsnHeader: parent} |
| 5808 | if decoder.Length() < 22 { |
| 5809 | return nil, fmt.Errorf("BsnSetLacpRequest packet too short: %d < 22", decoder.Length()) |
| 5810 | } |
| 5811 | _bsnsetlacprequest.Enabled = uint8(decoder.ReadByte()) |
| 5812 | decoder.Skip(3) |
| 5813 | _bsnsetlacprequest.PortNo.Decode(decoder) |
| 5814 | _bsnsetlacprequest.ActorSysPriority = uint16(decoder.ReadUint16()) |
| 5815 | _bsnsetlacprequest.ActorSysMac = net.HardwareAddr(decoder.Read(6)) |
| 5816 | _bsnsetlacprequest.ActorPortPriority = uint16(decoder.ReadUint16()) |
| 5817 | _bsnsetlacprequest.ActorPortNum = uint16(decoder.ReadUint16()) |
| 5818 | _bsnsetlacprequest.ActorKey = uint16(decoder.ReadUint16()) |
| 5819 | return _bsnsetlacprequest, nil |
| 5820 | } |
| 5821 | |
| 5822 | func NewBsnSetLacpRequest() *BsnSetLacpRequest { |
| 5823 | obj := &BsnSetLacpRequest{ |
| 5824 | BsnHeader: NewBsnHeader(41), |
| 5825 | } |
| 5826 | return obj |
| 5827 | } |
| 5828 | |
| 5829 | type BsnSetMirroring struct { |
| 5830 | *BsnHeader |
| 5831 | ReportMirrorPorts uint8 |
| 5832 | } |
| 5833 | |
| 5834 | type IBsnSetMirroring interface { |
| 5835 | IBsnHeader |
| 5836 | GetReportMirrorPorts() uint8 |
| 5837 | } |
| 5838 | |
| 5839 | func (self *BsnSetMirroring) GetReportMirrorPorts() uint8 { |
| 5840 | return self.ReportMirrorPorts |
| 5841 | } |
| 5842 | |
| 5843 | func (self *BsnSetMirroring) SetReportMirrorPorts(v uint8) { |
| 5844 | self.ReportMirrorPorts = v |
| 5845 | } |
| 5846 | |
| 5847 | func (self *BsnSetMirroring) Serialize(encoder *goloxi.Encoder) error { |
| 5848 | startIndex := len(encoder.Bytes()) |
| 5849 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5850 | return err |
| 5851 | } |
| 5852 | |
| 5853 | encoder.PutUint8(uint8(self.ReportMirrorPorts)) |
| 5854 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 5855 | length := len(encoder.Bytes()) - startIndex |
| 5856 | |
| 5857 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5858 | |
| 5859 | return nil |
| 5860 | } |
| 5861 | |
| 5862 | func DecodeBsnSetMirroring(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetMirroring, error) { |
| 5863 | _bsnsetmirroring := &BsnSetMirroring{BsnHeader: parent} |
| 5864 | if decoder.Length() < 4 { |
| 5865 | return nil, fmt.Errorf("BsnSetMirroring packet too short: %d < 4", decoder.Length()) |
| 5866 | } |
| 5867 | _bsnsetmirroring.ReportMirrorPorts = uint8(decoder.ReadByte()) |
| 5868 | decoder.Skip(3) |
| 5869 | return _bsnsetmirroring, nil |
| 5870 | } |
| 5871 | |
| 5872 | func NewBsnSetMirroring() *BsnSetMirroring { |
| 5873 | obj := &BsnSetMirroring{ |
| 5874 | BsnHeader: NewBsnHeader(3), |
| 5875 | } |
| 5876 | return obj |
| 5877 | } |
| 5878 | |
| 5879 | type BsnSetPktinSuppressionReply struct { |
| 5880 | *BsnHeader |
| 5881 | Status uint32 |
| 5882 | } |
| 5883 | |
| 5884 | type IBsnSetPktinSuppressionReply interface { |
| 5885 | IBsnHeader |
| 5886 | GetStatus() uint32 |
| 5887 | } |
| 5888 | |
| 5889 | func (self *BsnSetPktinSuppressionReply) GetStatus() uint32 { |
| 5890 | return self.Status |
| 5891 | } |
| 5892 | |
| 5893 | func (self *BsnSetPktinSuppressionReply) SetStatus(v uint32) { |
| 5894 | self.Status = v |
| 5895 | } |
| 5896 | |
| 5897 | func (self *BsnSetPktinSuppressionReply) Serialize(encoder *goloxi.Encoder) error { |
| 5898 | startIndex := len(encoder.Bytes()) |
| 5899 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5900 | return err |
| 5901 | } |
| 5902 | |
| 5903 | encoder.PutUint32(uint32(self.Status)) |
| 5904 | length := len(encoder.Bytes()) - startIndex |
| 5905 | |
| 5906 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5907 | |
| 5908 | return nil |
| 5909 | } |
| 5910 | |
| 5911 | func DecodeBsnSetPktinSuppressionReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetPktinSuppressionReply, error) { |
| 5912 | _bsnsetpktinsuppressionreply := &BsnSetPktinSuppressionReply{BsnHeader: parent} |
| 5913 | if decoder.Length() < 4 { |
| 5914 | return nil, fmt.Errorf("BsnSetPktinSuppressionReply packet too short: %d < 4", decoder.Length()) |
| 5915 | } |
| 5916 | _bsnsetpktinsuppressionreply.Status = uint32(decoder.ReadUint32()) |
| 5917 | return _bsnsetpktinsuppressionreply, nil |
| 5918 | } |
| 5919 | |
| 5920 | func NewBsnSetPktinSuppressionReply() *BsnSetPktinSuppressionReply { |
| 5921 | obj := &BsnSetPktinSuppressionReply{ |
| 5922 | BsnHeader: NewBsnHeader(25), |
| 5923 | } |
| 5924 | return obj |
| 5925 | } |
| 5926 | |
| 5927 | type BsnSetPktinSuppressionRequest struct { |
| 5928 | *BsnHeader |
| 5929 | Enabled uint8 |
| 5930 | IdleTimeout uint16 |
| 5931 | HardTimeout uint16 |
| 5932 | Priority uint16 |
| 5933 | Cookie uint64 |
| 5934 | } |
| 5935 | |
| 5936 | type IBsnSetPktinSuppressionRequest interface { |
| 5937 | IBsnHeader |
| 5938 | GetEnabled() uint8 |
| 5939 | GetIdleTimeout() uint16 |
| 5940 | GetHardTimeout() uint16 |
| 5941 | GetPriority() uint16 |
| 5942 | GetCookie() uint64 |
| 5943 | } |
| 5944 | |
| 5945 | func (self *BsnSetPktinSuppressionRequest) GetEnabled() uint8 { |
| 5946 | return self.Enabled |
| 5947 | } |
| 5948 | |
| 5949 | func (self *BsnSetPktinSuppressionRequest) SetEnabled(v uint8) { |
| 5950 | self.Enabled = v |
| 5951 | } |
| 5952 | |
| 5953 | func (self *BsnSetPktinSuppressionRequest) GetIdleTimeout() uint16 { |
| 5954 | return self.IdleTimeout |
| 5955 | } |
| 5956 | |
| 5957 | func (self *BsnSetPktinSuppressionRequest) SetIdleTimeout(v uint16) { |
| 5958 | self.IdleTimeout = v |
| 5959 | } |
| 5960 | |
| 5961 | func (self *BsnSetPktinSuppressionRequest) GetHardTimeout() uint16 { |
| 5962 | return self.HardTimeout |
| 5963 | } |
| 5964 | |
| 5965 | func (self *BsnSetPktinSuppressionRequest) SetHardTimeout(v uint16) { |
| 5966 | self.HardTimeout = v |
| 5967 | } |
| 5968 | |
| 5969 | func (self *BsnSetPktinSuppressionRequest) GetPriority() uint16 { |
| 5970 | return self.Priority |
| 5971 | } |
| 5972 | |
| 5973 | func (self *BsnSetPktinSuppressionRequest) SetPriority(v uint16) { |
| 5974 | self.Priority = v |
| 5975 | } |
| 5976 | |
| 5977 | func (self *BsnSetPktinSuppressionRequest) GetCookie() uint64 { |
| 5978 | return self.Cookie |
| 5979 | } |
| 5980 | |
| 5981 | func (self *BsnSetPktinSuppressionRequest) SetCookie(v uint64) { |
| 5982 | self.Cookie = v |
| 5983 | } |
| 5984 | |
| 5985 | func (self *BsnSetPktinSuppressionRequest) Serialize(encoder *goloxi.Encoder) error { |
| 5986 | startIndex := len(encoder.Bytes()) |
| 5987 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5988 | return err |
| 5989 | } |
| 5990 | |
| 5991 | encoder.PutUint8(uint8(self.Enabled)) |
| 5992 | encoder.Write(bytes.Repeat([]byte{0}, 1)) |
| 5993 | encoder.PutUint16(uint16(self.IdleTimeout)) |
| 5994 | encoder.PutUint16(uint16(self.HardTimeout)) |
| 5995 | encoder.PutUint16(uint16(self.Priority)) |
| 5996 | encoder.PutUint64(uint64(self.Cookie)) |
| 5997 | length := len(encoder.Bytes()) - startIndex |
| 5998 | |
| 5999 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6000 | |
| 6001 | return nil |
| 6002 | } |
| 6003 | |
| 6004 | func DecodeBsnSetPktinSuppressionRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetPktinSuppressionRequest, error) { |
| 6005 | _bsnsetpktinsuppressionrequest := &BsnSetPktinSuppressionRequest{BsnHeader: parent} |
| 6006 | if decoder.Length() < 16 { |
| 6007 | return nil, fmt.Errorf("BsnSetPktinSuppressionRequest packet too short: %d < 16", decoder.Length()) |
| 6008 | } |
| 6009 | _bsnsetpktinsuppressionrequest.Enabled = uint8(decoder.ReadByte()) |
| 6010 | decoder.Skip(1) |
| 6011 | _bsnsetpktinsuppressionrequest.IdleTimeout = uint16(decoder.ReadUint16()) |
| 6012 | _bsnsetpktinsuppressionrequest.HardTimeout = uint16(decoder.ReadUint16()) |
| 6013 | _bsnsetpktinsuppressionrequest.Priority = uint16(decoder.ReadUint16()) |
| 6014 | _bsnsetpktinsuppressionrequest.Cookie = uint64(decoder.ReadUint64()) |
| 6015 | return _bsnsetpktinsuppressionrequest, nil |
| 6016 | } |
| 6017 | |
| 6018 | func NewBsnSetPktinSuppressionRequest() *BsnSetPktinSuppressionRequest { |
| 6019 | obj := &BsnSetPktinSuppressionRequest{ |
| 6020 | BsnHeader: NewBsnHeader(11), |
| 6021 | } |
| 6022 | return obj |
| 6023 | } |
| 6024 | |
| 6025 | type BsnSetSwitchPipelineReply struct { |
| 6026 | *BsnHeader |
| 6027 | Status uint32 |
| 6028 | } |
| 6029 | |
| 6030 | type IBsnSetSwitchPipelineReply interface { |
| 6031 | IBsnHeader |
| 6032 | GetStatus() uint32 |
| 6033 | } |
| 6034 | |
| 6035 | func (self *BsnSetSwitchPipelineReply) GetStatus() uint32 { |
| 6036 | return self.Status |
| 6037 | } |
| 6038 | |
| 6039 | func (self *BsnSetSwitchPipelineReply) SetStatus(v uint32) { |
| 6040 | self.Status = v |
| 6041 | } |
| 6042 | |
| 6043 | func (self *BsnSetSwitchPipelineReply) Serialize(encoder *goloxi.Encoder) error { |
| 6044 | startIndex := len(encoder.Bytes()) |
| 6045 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6046 | return err |
| 6047 | } |
| 6048 | |
| 6049 | encoder.PutUint32(uint32(self.Status)) |
| 6050 | length := len(encoder.Bytes()) - startIndex |
| 6051 | |
| 6052 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6053 | |
| 6054 | return nil |
| 6055 | } |
| 6056 | |
| 6057 | func DecodeBsnSetSwitchPipelineReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetSwitchPipelineReply, error) { |
| 6058 | _bsnsetswitchpipelinereply := &BsnSetSwitchPipelineReply{BsnHeader: parent} |
| 6059 | if decoder.Length() < 4 { |
| 6060 | return nil, fmt.Errorf("BsnSetSwitchPipelineReply packet too short: %d < 4", decoder.Length()) |
| 6061 | } |
| 6062 | _bsnsetswitchpipelinereply.Status = uint32(decoder.ReadUint32()) |
| 6063 | return _bsnsetswitchpipelinereply, nil |
| 6064 | } |
| 6065 | |
| 6066 | func NewBsnSetSwitchPipelineReply() *BsnSetSwitchPipelineReply { |
| 6067 | obj := &BsnSetSwitchPipelineReply{ |
| 6068 | BsnHeader: NewBsnHeader(54), |
| 6069 | } |
| 6070 | return obj |
| 6071 | } |
| 6072 | |
| 6073 | type BsnSetSwitchPipelineRequest struct { |
| 6074 | *BsnHeader |
| 6075 | Pipeline string |
| 6076 | } |
| 6077 | |
| 6078 | type IBsnSetSwitchPipelineRequest interface { |
| 6079 | IBsnHeader |
| 6080 | GetPipeline() string |
| 6081 | } |
| 6082 | |
| 6083 | func (self *BsnSetSwitchPipelineRequest) GetPipeline() string { |
| 6084 | return self.Pipeline |
| 6085 | } |
| 6086 | |
| 6087 | func (self *BsnSetSwitchPipelineRequest) SetPipeline(v string) { |
| 6088 | self.Pipeline = v |
| 6089 | } |
| 6090 | |
| 6091 | func (self *BsnSetSwitchPipelineRequest) Serialize(encoder *goloxi.Encoder) error { |
| 6092 | startIndex := len(encoder.Bytes()) |
| 6093 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6094 | return err |
| 6095 | } |
| 6096 | |
| 6097 | encoder.Write([]byte(self.Pipeline)) |
| 6098 | length := len(encoder.Bytes()) - startIndex |
| 6099 | |
| 6100 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6101 | |
| 6102 | return nil |
| 6103 | } |
| 6104 | |
| 6105 | func DecodeBsnSetSwitchPipelineRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetSwitchPipelineRequest, error) { |
| 6106 | _bsnsetswitchpipelinerequest := &BsnSetSwitchPipelineRequest{BsnHeader: parent} |
| 6107 | if decoder.Length() < 256 { |
| 6108 | return nil, fmt.Errorf("BsnSetSwitchPipelineRequest packet too short: %d < 256", decoder.Length()) |
| 6109 | } |
| 6110 | _bsnsetswitchpipelinerequest.Pipeline = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 6111 | return _bsnsetswitchpipelinerequest, nil |
| 6112 | } |
| 6113 | |
| 6114 | func NewBsnSetSwitchPipelineRequest() *BsnSetSwitchPipelineRequest { |
| 6115 | obj := &BsnSetSwitchPipelineRequest{ |
| 6116 | BsnHeader: NewBsnHeader(53), |
| 6117 | } |
| 6118 | return obj |
| 6119 | } |
| 6120 | |
| 6121 | type BsnSwitchPipelineStatsReply struct { |
| 6122 | *BsnStatsReply |
| 6123 | Entries []*BsnSwitchPipelineStatsEntry |
| 6124 | } |
| 6125 | |
| 6126 | type IBsnSwitchPipelineStatsReply interface { |
| 6127 | IBsnStatsReply |
| 6128 | GetEntries() []*BsnSwitchPipelineStatsEntry |
| 6129 | } |
| 6130 | |
| 6131 | func (self *BsnSwitchPipelineStatsReply) GetEntries() []*BsnSwitchPipelineStatsEntry { |
| 6132 | return self.Entries |
| 6133 | } |
| 6134 | |
| 6135 | func (self *BsnSwitchPipelineStatsReply) SetEntries(v []*BsnSwitchPipelineStatsEntry) { |
| 6136 | self.Entries = v |
| 6137 | } |
| 6138 | |
| 6139 | func (self *BsnSwitchPipelineStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 6140 | startIndex := len(encoder.Bytes()) |
| 6141 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 6142 | return err |
| 6143 | } |
| 6144 | |
| 6145 | for _, obj := range self.Entries { |
| 6146 | if err := obj.Serialize(encoder); err != nil { |
| 6147 | return err |
| 6148 | } |
| 6149 | } |
| 6150 | length := len(encoder.Bytes()) - startIndex |
| 6151 | |
| 6152 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6153 | |
| 6154 | return nil |
| 6155 | } |
| 6156 | |
| 6157 | func DecodeBsnSwitchPipelineStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnSwitchPipelineStatsReply, error) { |
| 6158 | _bsnswitchpipelinestatsreply := &BsnSwitchPipelineStatsReply{BsnStatsReply: parent} |
| 6159 | |
| 6160 | for decoder.Length() >= 256 { |
| 6161 | item, err := DecodeBsnSwitchPipelineStatsEntry(decoder) |
| 6162 | if err != nil { |
| 6163 | return nil, err |
| 6164 | } |
| 6165 | if item != nil { |
| 6166 | _bsnswitchpipelinestatsreply.Entries = append(_bsnswitchpipelinestatsreply.Entries, item) |
| 6167 | } |
| 6168 | } |
| 6169 | return _bsnswitchpipelinestatsreply, nil |
| 6170 | } |
| 6171 | |
| 6172 | func NewBsnSwitchPipelineStatsReply() *BsnSwitchPipelineStatsReply { |
| 6173 | obj := &BsnSwitchPipelineStatsReply{ |
| 6174 | BsnStatsReply: NewBsnStatsReply(6), |
| 6175 | } |
| 6176 | return obj |
| 6177 | } |
| 6178 | |
| 6179 | type BsnSwitchPipelineStatsRequest struct { |
| 6180 | *BsnStatsRequest |
| 6181 | } |
| 6182 | |
| 6183 | type IBsnSwitchPipelineStatsRequest interface { |
| 6184 | IBsnStatsRequest |
| 6185 | } |
| 6186 | |
| 6187 | func (self *BsnSwitchPipelineStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 6188 | startIndex := len(encoder.Bytes()) |
| 6189 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 6190 | return err |
| 6191 | } |
| 6192 | length := len(encoder.Bytes()) - startIndex |
| 6193 | |
| 6194 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6195 | |
| 6196 | return nil |
| 6197 | } |
| 6198 | |
| 6199 | func DecodeBsnSwitchPipelineStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnSwitchPipelineStatsRequest, error) { |
| 6200 | _bsnswitchpipelinestatsrequest := &BsnSwitchPipelineStatsRequest{BsnStatsRequest: parent} |
| 6201 | return _bsnswitchpipelinestatsrequest, nil |
| 6202 | } |
| 6203 | |
| 6204 | func NewBsnSwitchPipelineStatsRequest() *BsnSwitchPipelineStatsRequest { |
| 6205 | obj := &BsnSwitchPipelineStatsRequest{ |
| 6206 | BsnStatsRequest: NewBsnStatsRequest(6), |
| 6207 | } |
| 6208 | return obj |
| 6209 | } |
| 6210 | |
| 6211 | type BsnTableChecksumStatsReply struct { |
| 6212 | *BsnStatsReply |
| 6213 | Entries []*BsnTableChecksumStatsEntry |
| 6214 | } |
| 6215 | |
| 6216 | type IBsnTableChecksumStatsReply interface { |
| 6217 | IBsnStatsReply |
| 6218 | GetEntries() []*BsnTableChecksumStatsEntry |
| 6219 | } |
| 6220 | |
| 6221 | func (self *BsnTableChecksumStatsReply) GetEntries() []*BsnTableChecksumStatsEntry { |
| 6222 | return self.Entries |
| 6223 | } |
| 6224 | |
| 6225 | func (self *BsnTableChecksumStatsReply) SetEntries(v []*BsnTableChecksumStatsEntry) { |
| 6226 | self.Entries = v |
| 6227 | } |
| 6228 | |
| 6229 | func (self *BsnTableChecksumStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 6230 | startIndex := len(encoder.Bytes()) |
| 6231 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 6232 | return err |
| 6233 | } |
| 6234 | |
| 6235 | for _, obj := range self.Entries { |
| 6236 | if err := obj.Serialize(encoder); err != nil { |
| 6237 | return err |
| 6238 | } |
| 6239 | } |
| 6240 | length := len(encoder.Bytes()) - startIndex |
| 6241 | |
| 6242 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6243 | |
| 6244 | return nil |
| 6245 | } |
| 6246 | |
| 6247 | func DecodeBsnTableChecksumStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnTableChecksumStatsReply, error) { |
| 6248 | _bsntablechecksumstatsreply := &BsnTableChecksumStatsReply{BsnStatsReply: parent} |
| 6249 | |
| 6250 | for decoder.Length() >= 9 { |
| 6251 | item, err := DecodeBsnTableChecksumStatsEntry(decoder) |
| 6252 | if err != nil { |
| 6253 | return nil, err |
| 6254 | } |
| 6255 | if item != nil { |
| 6256 | _bsntablechecksumstatsreply.Entries = append(_bsntablechecksumstatsreply.Entries, item) |
| 6257 | } |
| 6258 | } |
| 6259 | return _bsntablechecksumstatsreply, nil |
| 6260 | } |
| 6261 | |
| 6262 | func NewBsnTableChecksumStatsReply() *BsnTableChecksumStatsReply { |
| 6263 | obj := &BsnTableChecksumStatsReply{ |
| 6264 | BsnStatsReply: NewBsnStatsReply(11), |
| 6265 | } |
| 6266 | return obj |
| 6267 | } |
| 6268 | |
| 6269 | type BsnTableChecksumStatsRequest struct { |
| 6270 | *BsnStatsRequest |
| 6271 | } |
| 6272 | |
| 6273 | type IBsnTableChecksumStatsRequest interface { |
| 6274 | IBsnStatsRequest |
| 6275 | } |
| 6276 | |
| 6277 | func (self *BsnTableChecksumStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 6278 | startIndex := len(encoder.Bytes()) |
| 6279 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 6280 | return err |
| 6281 | } |
| 6282 | length := len(encoder.Bytes()) - startIndex |
| 6283 | |
| 6284 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6285 | |
| 6286 | return nil |
| 6287 | } |
| 6288 | |
| 6289 | func DecodeBsnTableChecksumStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnTableChecksumStatsRequest, error) { |
| 6290 | _bsntablechecksumstatsrequest := &BsnTableChecksumStatsRequest{BsnStatsRequest: parent} |
| 6291 | return _bsntablechecksumstatsrequest, nil |
| 6292 | } |
| 6293 | |
| 6294 | func NewBsnTableChecksumStatsRequest() *BsnTableChecksumStatsRequest { |
| 6295 | obj := &BsnTableChecksumStatsRequest{ |
| 6296 | BsnStatsRequest: NewBsnStatsRequest(11), |
| 6297 | } |
| 6298 | return obj |
| 6299 | } |
| 6300 | |
| 6301 | type BsnTableSetBucketsSize struct { |
| 6302 | *BsnHeader |
| 6303 | TableId uint8 |
| 6304 | BucketsSize uint32 |
| 6305 | } |
| 6306 | |
| 6307 | type IBsnTableSetBucketsSize interface { |
| 6308 | IBsnHeader |
| 6309 | GetTableId() uint8 |
| 6310 | GetBucketsSize() uint32 |
| 6311 | } |
| 6312 | |
| 6313 | func (self *BsnTableSetBucketsSize) GetTableId() uint8 { |
| 6314 | return self.TableId |
| 6315 | } |
| 6316 | |
| 6317 | func (self *BsnTableSetBucketsSize) SetTableId(v uint8) { |
| 6318 | self.TableId = v |
| 6319 | } |
| 6320 | |
| 6321 | func (self *BsnTableSetBucketsSize) GetBucketsSize() uint32 { |
| 6322 | return self.BucketsSize |
| 6323 | } |
| 6324 | |
| 6325 | func (self *BsnTableSetBucketsSize) SetBucketsSize(v uint32) { |
| 6326 | self.BucketsSize = v |
| 6327 | } |
| 6328 | |
| 6329 | func (self *BsnTableSetBucketsSize) Serialize(encoder *goloxi.Encoder) error { |
| 6330 | startIndex := len(encoder.Bytes()) |
| 6331 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6332 | return err |
| 6333 | } |
| 6334 | |
| 6335 | encoder.Write(bytes.Repeat([]byte{0}, 1)) |
| 6336 | encoder.PutUint8(uint8(self.TableId)) |
| 6337 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 6338 | encoder.PutUint32(uint32(self.BucketsSize)) |
| 6339 | length := len(encoder.Bytes()) - startIndex |
| 6340 | |
| 6341 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6342 | |
| 6343 | return nil |
| 6344 | } |
| 6345 | |
| 6346 | func DecodeBsnTableSetBucketsSize(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnTableSetBucketsSize, error) { |
| 6347 | _bsntablesetbucketssize := &BsnTableSetBucketsSize{BsnHeader: parent} |
| 6348 | if decoder.Length() < 8 { |
| 6349 | return nil, fmt.Errorf("BsnTableSetBucketsSize packet too short: %d < 8", decoder.Length()) |
| 6350 | } |
| 6351 | decoder.Skip(1) |
| 6352 | _bsntablesetbucketssize.TableId = uint8(decoder.ReadByte()) |
| 6353 | decoder.Skip(2) |
| 6354 | _bsntablesetbucketssize.BucketsSize = uint32(decoder.ReadUint32()) |
| 6355 | return _bsntablesetbucketssize, nil |
| 6356 | } |
| 6357 | |
| 6358 | func NewBsnTableSetBucketsSize() *BsnTableSetBucketsSize { |
| 6359 | obj := &BsnTableSetBucketsSize{ |
| 6360 | BsnHeader: NewBsnHeader(61), |
| 6361 | } |
| 6362 | return obj |
| 6363 | } |
| 6364 | |
| 6365 | type BsnTakeover struct { |
| 6366 | *BsnHeader |
| 6367 | } |
| 6368 | |
| 6369 | type IBsnTakeover interface { |
| 6370 | IBsnHeader |
| 6371 | } |
| 6372 | |
| 6373 | func (self *BsnTakeover) Serialize(encoder *goloxi.Encoder) error { |
| 6374 | startIndex := len(encoder.Bytes()) |
| 6375 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6376 | return err |
| 6377 | } |
| 6378 | length := len(encoder.Bytes()) - startIndex |
| 6379 | |
| 6380 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6381 | |
| 6382 | return nil |
| 6383 | } |
| 6384 | |
| 6385 | func DecodeBsnTakeover(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnTakeover, error) { |
| 6386 | _bsntakeover := &BsnTakeover{BsnHeader: parent} |
| 6387 | return _bsntakeover, nil |
| 6388 | } |
| 6389 | |
| 6390 | func NewBsnTakeover() *BsnTakeover { |
| 6391 | obj := &BsnTakeover{ |
| 6392 | BsnHeader: NewBsnHeader(69), |
| 6393 | } |
| 6394 | return obj |
| 6395 | } |
| 6396 | |
| 6397 | type BsnTimeReply struct { |
| 6398 | *BsnHeader |
| 6399 | TimeMs uint64 |
| 6400 | } |
| 6401 | |
| 6402 | type IBsnTimeReply interface { |
| 6403 | IBsnHeader |
| 6404 | GetTimeMs() uint64 |
| 6405 | } |
| 6406 | |
| 6407 | func (self *BsnTimeReply) GetTimeMs() uint64 { |
| 6408 | return self.TimeMs |
| 6409 | } |
| 6410 | |
| 6411 | func (self *BsnTimeReply) SetTimeMs(v uint64) { |
| 6412 | self.TimeMs = v |
| 6413 | } |
| 6414 | |
| 6415 | func (self *BsnTimeReply) Serialize(encoder *goloxi.Encoder) error { |
| 6416 | startIndex := len(encoder.Bytes()) |
| 6417 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6418 | return err |
| 6419 | } |
| 6420 | |
| 6421 | encoder.PutUint64(uint64(self.TimeMs)) |
| 6422 | length := len(encoder.Bytes()) - startIndex |
| 6423 | |
| 6424 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6425 | |
| 6426 | return nil |
| 6427 | } |
| 6428 | |
| 6429 | func DecodeBsnTimeReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnTimeReply, error) { |
| 6430 | _bsntimereply := &BsnTimeReply{BsnHeader: parent} |
| 6431 | if decoder.Length() < 8 { |
| 6432 | return nil, fmt.Errorf("BsnTimeReply packet too short: %d < 8", decoder.Length()) |
| 6433 | } |
| 6434 | _bsntimereply.TimeMs = uint64(decoder.ReadUint64()) |
| 6435 | return _bsntimereply, nil |
| 6436 | } |
| 6437 | |
| 6438 | func NewBsnTimeReply() *BsnTimeReply { |
| 6439 | obj := &BsnTimeReply{ |
| 6440 | BsnHeader: NewBsnHeader(45), |
| 6441 | } |
| 6442 | return obj |
| 6443 | } |
| 6444 | |
| 6445 | type BsnTimeRequest struct { |
| 6446 | *BsnHeader |
| 6447 | } |
| 6448 | |
| 6449 | type IBsnTimeRequest interface { |
| 6450 | IBsnHeader |
| 6451 | } |
| 6452 | |
| 6453 | func (self *BsnTimeRequest) Serialize(encoder *goloxi.Encoder) error { |
| 6454 | startIndex := len(encoder.Bytes()) |
| 6455 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6456 | return err |
| 6457 | } |
| 6458 | length := len(encoder.Bytes()) - startIndex |
| 6459 | |
| 6460 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6461 | |
| 6462 | return nil |
| 6463 | } |
| 6464 | |
| 6465 | func DecodeBsnTimeRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnTimeRequest, error) { |
| 6466 | _bsntimerequest := &BsnTimeRequest{BsnHeader: parent} |
| 6467 | return _bsntimerequest, nil |
| 6468 | } |
| 6469 | |
| 6470 | func NewBsnTimeRequest() *BsnTimeRequest { |
| 6471 | obj := &BsnTimeRequest{ |
| 6472 | BsnHeader: NewBsnHeader(44), |
| 6473 | } |
| 6474 | return obj |
| 6475 | } |
| 6476 | |
| 6477 | type BsnVirtualPortCreateReply struct { |
| 6478 | *BsnHeader |
| 6479 | Status uint32 |
| 6480 | VportNo uint32 |
| 6481 | } |
| 6482 | |
| 6483 | type IBsnVirtualPortCreateReply interface { |
| 6484 | IBsnHeader |
| 6485 | GetStatus() uint32 |
| 6486 | GetVportNo() uint32 |
| 6487 | } |
| 6488 | |
| 6489 | func (self *BsnVirtualPortCreateReply) GetStatus() uint32 { |
| 6490 | return self.Status |
| 6491 | } |
| 6492 | |
| 6493 | func (self *BsnVirtualPortCreateReply) SetStatus(v uint32) { |
| 6494 | self.Status = v |
| 6495 | } |
| 6496 | |
| 6497 | func (self *BsnVirtualPortCreateReply) GetVportNo() uint32 { |
| 6498 | return self.VportNo |
| 6499 | } |
| 6500 | |
| 6501 | func (self *BsnVirtualPortCreateReply) SetVportNo(v uint32) { |
| 6502 | self.VportNo = v |
| 6503 | } |
| 6504 | |
| 6505 | func (self *BsnVirtualPortCreateReply) Serialize(encoder *goloxi.Encoder) error { |
| 6506 | startIndex := len(encoder.Bytes()) |
| 6507 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6508 | return err |
| 6509 | } |
| 6510 | |
| 6511 | encoder.PutUint32(uint32(self.Status)) |
| 6512 | encoder.PutUint32(uint32(self.VportNo)) |
| 6513 | length := len(encoder.Bytes()) - startIndex |
| 6514 | |
| 6515 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6516 | |
| 6517 | return nil |
| 6518 | } |
| 6519 | |
| 6520 | func DecodeBsnVirtualPortCreateReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnVirtualPortCreateReply, error) { |
| 6521 | _bsnvirtualportcreatereply := &BsnVirtualPortCreateReply{BsnHeader: parent} |
| 6522 | if decoder.Length() < 8 { |
| 6523 | return nil, fmt.Errorf("BsnVirtualPortCreateReply packet too short: %d < 8", decoder.Length()) |
| 6524 | } |
| 6525 | _bsnvirtualportcreatereply.Status = uint32(decoder.ReadUint32()) |
| 6526 | _bsnvirtualportcreatereply.VportNo = uint32(decoder.ReadUint32()) |
| 6527 | return _bsnvirtualportcreatereply, nil |
| 6528 | } |
| 6529 | |
| 6530 | func NewBsnVirtualPortCreateReply() *BsnVirtualPortCreateReply { |
| 6531 | obj := &BsnVirtualPortCreateReply{ |
| 6532 | BsnHeader: NewBsnHeader(16), |
| 6533 | } |
| 6534 | return obj |
| 6535 | } |
| 6536 | |
| 6537 | type BsnVirtualPortCreateRequest struct { |
| 6538 | *BsnHeader |
| 6539 | Vport BSNVport |
| 6540 | } |
| 6541 | |
| 6542 | type IBsnVirtualPortCreateRequest interface { |
| 6543 | IBsnHeader |
| 6544 | GetVport() BSNVport |
| 6545 | } |
| 6546 | |
| 6547 | func (self *BsnVirtualPortCreateRequest) GetVport() BSNVport { |
| 6548 | return self.Vport |
| 6549 | } |
| 6550 | |
| 6551 | func (self *BsnVirtualPortCreateRequest) SetVport(v BSNVport) { |
| 6552 | self.Vport = v |
| 6553 | } |
| 6554 | |
| 6555 | func (self *BsnVirtualPortCreateRequest) Serialize(encoder *goloxi.Encoder) error { |
| 6556 | startIndex := len(encoder.Bytes()) |
| 6557 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6558 | return err |
| 6559 | } |
| 6560 | |
| 6561 | if err := self.Vport.Serialize(encoder); err != nil { |
| 6562 | return err |
| 6563 | } |
| 6564 | |
| 6565 | length := len(encoder.Bytes()) - startIndex |
| 6566 | |
| 6567 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6568 | |
| 6569 | return nil |
| 6570 | } |
| 6571 | |
| 6572 | func DecodeBsnVirtualPortCreateRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnVirtualPortCreateRequest, error) { |
| 6573 | _bsnvirtualportcreaterequest := &BsnVirtualPortCreateRequest{BsnHeader: parent} |
| 6574 | if decoder.Length() < 4 { |
| 6575 | return nil, fmt.Errorf("BsnVirtualPortCreateRequest packet too short: %d < 4", decoder.Length()) |
| 6576 | } |
| 6577 | if err := _bsnvirtualportcreaterequest.Vport.Decode(decoder); err != nil { |
| 6578 | return nil, err |
| 6579 | } |
| 6580 | |
| 6581 | return _bsnvirtualportcreaterequest, nil |
| 6582 | } |
| 6583 | |
| 6584 | func NewBsnVirtualPortCreateRequest() *BsnVirtualPortCreateRequest { |
| 6585 | obj := &BsnVirtualPortCreateRequest{ |
| 6586 | BsnHeader: NewBsnHeader(15), |
| 6587 | } |
| 6588 | return obj |
| 6589 | } |
| 6590 | |
| 6591 | type BsnVirtualPortRemoveReply struct { |
| 6592 | *BsnHeader |
| 6593 | Status uint32 |
| 6594 | } |
| 6595 | |
| 6596 | type IBsnVirtualPortRemoveReply interface { |
| 6597 | IBsnHeader |
| 6598 | GetStatus() uint32 |
| 6599 | } |
| 6600 | |
| 6601 | func (self *BsnVirtualPortRemoveReply) GetStatus() uint32 { |
| 6602 | return self.Status |
| 6603 | } |
| 6604 | |
| 6605 | func (self *BsnVirtualPortRemoveReply) SetStatus(v uint32) { |
| 6606 | self.Status = v |
| 6607 | } |
| 6608 | |
| 6609 | func (self *BsnVirtualPortRemoveReply) Serialize(encoder *goloxi.Encoder) error { |
| 6610 | startIndex := len(encoder.Bytes()) |
| 6611 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6612 | return err |
| 6613 | } |
| 6614 | |
| 6615 | encoder.PutUint32(uint32(self.Status)) |
| 6616 | length := len(encoder.Bytes()) - startIndex |
| 6617 | |
| 6618 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6619 | |
| 6620 | return nil |
| 6621 | } |
| 6622 | |
| 6623 | func DecodeBsnVirtualPortRemoveReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnVirtualPortRemoveReply, error) { |
| 6624 | _bsnvirtualportremovereply := &BsnVirtualPortRemoveReply{BsnHeader: parent} |
| 6625 | if decoder.Length() < 4 { |
| 6626 | return nil, fmt.Errorf("BsnVirtualPortRemoveReply packet too short: %d < 4", decoder.Length()) |
| 6627 | } |
| 6628 | _bsnvirtualportremovereply.Status = uint32(decoder.ReadUint32()) |
| 6629 | return _bsnvirtualportremovereply, nil |
| 6630 | } |
| 6631 | |
| 6632 | func NewBsnVirtualPortRemoveReply() *BsnVirtualPortRemoveReply { |
| 6633 | obj := &BsnVirtualPortRemoveReply{ |
| 6634 | BsnHeader: NewBsnHeader(26), |
| 6635 | } |
| 6636 | return obj |
| 6637 | } |
| 6638 | |
| 6639 | type BsnVirtualPortRemoveRequest struct { |
| 6640 | *BsnHeader |
| 6641 | VportNo uint32 |
| 6642 | } |
| 6643 | |
| 6644 | type IBsnVirtualPortRemoveRequest interface { |
| 6645 | IBsnHeader |
| 6646 | GetVportNo() uint32 |
| 6647 | } |
| 6648 | |
| 6649 | func (self *BsnVirtualPortRemoveRequest) GetVportNo() uint32 { |
| 6650 | return self.VportNo |
| 6651 | } |
| 6652 | |
| 6653 | func (self *BsnVirtualPortRemoveRequest) SetVportNo(v uint32) { |
| 6654 | self.VportNo = v |
| 6655 | } |
| 6656 | |
| 6657 | func (self *BsnVirtualPortRemoveRequest) Serialize(encoder *goloxi.Encoder) error { |
| 6658 | startIndex := len(encoder.Bytes()) |
| 6659 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6660 | return err |
| 6661 | } |
| 6662 | |
| 6663 | encoder.PutUint32(uint32(self.VportNo)) |
| 6664 | length := len(encoder.Bytes()) - startIndex |
| 6665 | |
| 6666 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6667 | |
| 6668 | return nil |
| 6669 | } |
| 6670 | |
| 6671 | func DecodeBsnVirtualPortRemoveRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnVirtualPortRemoveRequest, error) { |
| 6672 | _bsnvirtualportremoverequest := &BsnVirtualPortRemoveRequest{BsnHeader: parent} |
| 6673 | if decoder.Length() < 4 { |
| 6674 | return nil, fmt.Errorf("BsnVirtualPortRemoveRequest packet too short: %d < 4", decoder.Length()) |
| 6675 | } |
| 6676 | _bsnvirtualportremoverequest.VportNo = uint32(decoder.ReadUint32()) |
| 6677 | return _bsnvirtualportremoverequest, nil |
| 6678 | } |
| 6679 | |
| 6680 | func NewBsnVirtualPortRemoveRequest() *BsnVirtualPortRemoveRequest { |
| 6681 | obj := &BsnVirtualPortRemoveRequest{ |
| 6682 | BsnHeader: NewBsnHeader(17), |
| 6683 | } |
| 6684 | return obj |
| 6685 | } |
| 6686 | |
| 6687 | type BsnVlanCounterClear struct { |
| 6688 | *BsnHeader |
| 6689 | VlanVid uint16 |
| 6690 | } |
| 6691 | |
| 6692 | type IBsnVlanCounterClear interface { |
| 6693 | IBsnHeader |
| 6694 | GetVlanVid() uint16 |
| 6695 | } |
| 6696 | |
| 6697 | func (self *BsnVlanCounterClear) GetVlanVid() uint16 { |
| 6698 | return self.VlanVid |
| 6699 | } |
| 6700 | |
| 6701 | func (self *BsnVlanCounterClear) SetVlanVid(v uint16) { |
| 6702 | self.VlanVid = v |
| 6703 | } |
| 6704 | |
| 6705 | func (self *BsnVlanCounterClear) Serialize(encoder *goloxi.Encoder) error { |
| 6706 | startIndex := len(encoder.Bytes()) |
| 6707 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6708 | return err |
| 6709 | } |
| 6710 | |
| 6711 | encoder.PutUint16(uint16(self.VlanVid)) |
| 6712 | length := len(encoder.Bytes()) - startIndex |
| 6713 | |
| 6714 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6715 | |
| 6716 | return nil |
| 6717 | } |
| 6718 | |
| 6719 | func DecodeBsnVlanCounterClear(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnVlanCounterClear, error) { |
| 6720 | _bsnvlancounterclear := &BsnVlanCounterClear{BsnHeader: parent} |
| 6721 | if decoder.Length() < 2 { |
| 6722 | return nil, fmt.Errorf("BsnVlanCounterClear packet too short: %d < 2", decoder.Length()) |
| 6723 | } |
| 6724 | _bsnvlancounterclear.VlanVid = uint16(decoder.ReadUint16()) |
| 6725 | return _bsnvlancounterclear, nil |
| 6726 | } |
| 6727 | |
| 6728 | func NewBsnVlanCounterClear() *BsnVlanCounterClear { |
| 6729 | obj := &BsnVlanCounterClear{ |
| 6730 | BsnHeader: NewBsnHeader(70), |
| 6731 | } |
| 6732 | return obj |
| 6733 | } |
| 6734 | |
| 6735 | type BsnVlanCounterStatsReply struct { |
| 6736 | *BsnStatsReply |
| 6737 | Entries []*BsnVlanCounterStatsEntry |
| 6738 | } |
| 6739 | |
| 6740 | type IBsnVlanCounterStatsReply interface { |
| 6741 | IBsnStatsReply |
| 6742 | GetEntries() []*BsnVlanCounterStatsEntry |
| 6743 | } |
| 6744 | |
| 6745 | func (self *BsnVlanCounterStatsReply) GetEntries() []*BsnVlanCounterStatsEntry { |
| 6746 | return self.Entries |
| 6747 | } |
| 6748 | |
| 6749 | func (self *BsnVlanCounterStatsReply) SetEntries(v []*BsnVlanCounterStatsEntry) { |
| 6750 | self.Entries = v |
| 6751 | } |
| 6752 | |
| 6753 | func (self *BsnVlanCounterStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 6754 | startIndex := len(encoder.Bytes()) |
| 6755 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 6756 | return err |
| 6757 | } |
| 6758 | |
| 6759 | for _, obj := range self.Entries { |
| 6760 | if err := obj.Serialize(encoder); err != nil { |
| 6761 | return err |
| 6762 | } |
| 6763 | } |
| 6764 | length := len(encoder.Bytes()) - startIndex |
| 6765 | |
| 6766 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6767 | |
| 6768 | return nil |
| 6769 | } |
| 6770 | |
| 6771 | func DecodeBsnVlanCounterStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnVlanCounterStatsReply, error) { |
| 6772 | _bsnvlancounterstatsreply := &BsnVlanCounterStatsReply{BsnStatsReply: parent} |
| 6773 | |
| 6774 | for decoder.Length() >= 8 { |
| 6775 | item, err := DecodeBsnVlanCounterStatsEntry(decoder) |
| 6776 | if err != nil { |
| 6777 | return nil, err |
| 6778 | } |
| 6779 | if item != nil { |
| 6780 | _bsnvlancounterstatsreply.Entries = append(_bsnvlancounterstatsreply.Entries, item) |
| 6781 | } |
| 6782 | } |
| 6783 | return _bsnvlancounterstatsreply, nil |
| 6784 | } |
| 6785 | |
| 6786 | func NewBsnVlanCounterStatsReply() *BsnVlanCounterStatsReply { |
| 6787 | obj := &BsnVlanCounterStatsReply{ |
| 6788 | BsnStatsReply: NewBsnStatsReply(9), |
| 6789 | } |
| 6790 | return obj |
| 6791 | } |
| 6792 | |
| 6793 | type BsnVlanCounterStatsRequest struct { |
| 6794 | *BsnStatsRequest |
| 6795 | VlanVid uint16 |
| 6796 | } |
| 6797 | |
| 6798 | type IBsnVlanCounterStatsRequest interface { |
| 6799 | IBsnStatsRequest |
| 6800 | GetVlanVid() uint16 |
| 6801 | } |
| 6802 | |
| 6803 | func (self *BsnVlanCounterStatsRequest) GetVlanVid() uint16 { |
| 6804 | return self.VlanVid |
| 6805 | } |
| 6806 | |
| 6807 | func (self *BsnVlanCounterStatsRequest) SetVlanVid(v uint16) { |
| 6808 | self.VlanVid = v |
| 6809 | } |
| 6810 | |
| 6811 | func (self *BsnVlanCounterStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 6812 | startIndex := len(encoder.Bytes()) |
| 6813 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 6814 | return err |
| 6815 | } |
| 6816 | |
| 6817 | encoder.PutUint16(uint16(self.VlanVid)) |
| 6818 | length := len(encoder.Bytes()) - startIndex |
| 6819 | |
| 6820 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6821 | |
| 6822 | return nil |
| 6823 | } |
| 6824 | |
| 6825 | func DecodeBsnVlanCounterStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnVlanCounterStatsRequest, error) { |
| 6826 | _bsnvlancounterstatsrequest := &BsnVlanCounterStatsRequest{BsnStatsRequest: parent} |
| 6827 | if decoder.Length() < 2 { |
| 6828 | return nil, fmt.Errorf("BsnVlanCounterStatsRequest packet too short: %d < 2", decoder.Length()) |
| 6829 | } |
| 6830 | _bsnvlancounterstatsrequest.VlanVid = uint16(decoder.ReadUint16()) |
| 6831 | return _bsnvlancounterstatsrequest, nil |
| 6832 | } |
| 6833 | |
| 6834 | func NewBsnVlanCounterStatsRequest() *BsnVlanCounterStatsRequest { |
| 6835 | obj := &BsnVlanCounterStatsRequest{ |
| 6836 | BsnStatsRequest: NewBsnStatsRequest(9), |
| 6837 | } |
| 6838 | return obj |
| 6839 | } |
| 6840 | |
| 6841 | type BsnVrfCounterStatsReply struct { |
| 6842 | *BsnStatsReply |
| 6843 | Entries []*BsnVrfCounterStatsEntry |
| 6844 | } |
| 6845 | |
| 6846 | type IBsnVrfCounterStatsReply interface { |
| 6847 | IBsnStatsReply |
| 6848 | GetEntries() []*BsnVrfCounterStatsEntry |
| 6849 | } |
| 6850 | |
| 6851 | func (self *BsnVrfCounterStatsReply) GetEntries() []*BsnVrfCounterStatsEntry { |
| 6852 | return self.Entries |
| 6853 | } |
| 6854 | |
| 6855 | func (self *BsnVrfCounterStatsReply) SetEntries(v []*BsnVrfCounterStatsEntry) { |
| 6856 | self.Entries = v |
| 6857 | } |
| 6858 | |
| 6859 | func (self *BsnVrfCounterStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 6860 | startIndex := len(encoder.Bytes()) |
| 6861 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 6862 | return err |
| 6863 | } |
| 6864 | |
| 6865 | for _, obj := range self.Entries { |
| 6866 | if err := obj.Serialize(encoder); err != nil { |
| 6867 | return err |
| 6868 | } |
| 6869 | } |
| 6870 | length := len(encoder.Bytes()) - startIndex |
| 6871 | |
| 6872 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6873 | |
| 6874 | return nil |
| 6875 | } |
| 6876 | |
| 6877 | func DecodeBsnVrfCounterStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnVrfCounterStatsReply, error) { |
| 6878 | _bsnvrfcounterstatsreply := &BsnVrfCounterStatsReply{BsnStatsReply: parent} |
| 6879 | |
| 6880 | for decoder.Length() >= 8 { |
| 6881 | item, err := DecodeBsnVrfCounterStatsEntry(decoder) |
| 6882 | if err != nil { |
| 6883 | return nil, err |
| 6884 | } |
| 6885 | if item != nil { |
| 6886 | _bsnvrfcounterstatsreply.Entries = append(_bsnvrfcounterstatsreply.Entries, item) |
| 6887 | } |
| 6888 | } |
| 6889 | return _bsnvrfcounterstatsreply, nil |
| 6890 | } |
| 6891 | |
| 6892 | func NewBsnVrfCounterStatsReply() *BsnVrfCounterStatsReply { |
| 6893 | obj := &BsnVrfCounterStatsReply{ |
| 6894 | BsnStatsReply: NewBsnStatsReply(15), |
| 6895 | } |
| 6896 | return obj |
| 6897 | } |
| 6898 | |
| 6899 | type BsnVrfCounterStatsRequest struct { |
| 6900 | *BsnStatsRequest |
| 6901 | Vrf uint32 |
| 6902 | } |
| 6903 | |
| 6904 | type IBsnVrfCounterStatsRequest interface { |
| 6905 | IBsnStatsRequest |
| 6906 | GetVrf() uint32 |
| 6907 | } |
| 6908 | |
| 6909 | func (self *BsnVrfCounterStatsRequest) GetVrf() uint32 { |
| 6910 | return self.Vrf |
| 6911 | } |
| 6912 | |
| 6913 | func (self *BsnVrfCounterStatsRequest) SetVrf(v uint32) { |
| 6914 | self.Vrf = v |
| 6915 | } |
| 6916 | |
| 6917 | func (self *BsnVrfCounterStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 6918 | startIndex := len(encoder.Bytes()) |
| 6919 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 6920 | return err |
| 6921 | } |
| 6922 | |
| 6923 | encoder.PutUint32(uint32(self.Vrf)) |
| 6924 | length := len(encoder.Bytes()) - startIndex |
| 6925 | |
| 6926 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 6927 | |
| 6928 | return nil |
| 6929 | } |
| 6930 | |
| 6931 | func DecodeBsnVrfCounterStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnVrfCounterStatsRequest, error) { |
| 6932 | _bsnvrfcounterstatsrequest := &BsnVrfCounterStatsRequest{BsnStatsRequest: parent} |
| 6933 | if decoder.Length() < 4 { |
| 6934 | return nil, fmt.Errorf("BsnVrfCounterStatsRequest packet too short: %d < 4", decoder.Length()) |
| 6935 | } |
| 6936 | _bsnvrfcounterstatsrequest.Vrf = uint32(decoder.ReadUint32()) |
| 6937 | return _bsnvrfcounterstatsrequest, nil |
| 6938 | } |
| 6939 | |
| 6940 | func NewBsnVrfCounterStatsRequest() *BsnVrfCounterStatsRequest { |
| 6941 | obj := &BsnVrfCounterStatsRequest{ |
| 6942 | BsnStatsRequest: NewBsnStatsRequest(15), |
| 6943 | } |
| 6944 | return obj |
| 6945 | } |
| 6946 | |
| 6947 | type BundleAddMsg struct { |
| 6948 | *Header |
| 6949 | BundleId uint32 |
| 6950 | Flags BundleFlags |
| 6951 | Message IHeader |
| 6952 | Properties []IBundleProp |
| 6953 | } |
| 6954 | |
| 6955 | type IBundleAddMsg interface { |
| 6956 | IHeader |
| 6957 | GetBundleId() uint32 |
| 6958 | GetFlags() BundleFlags |
| 6959 | GetMessage() IHeader |
| 6960 | GetProperties() []IBundleProp |
| 6961 | } |
| 6962 | |
| 6963 | func (self *BundleAddMsg) GetBundleId() uint32 { |
| 6964 | return self.BundleId |
| 6965 | } |
| 6966 | |
| 6967 | func (self *BundleAddMsg) SetBundleId(v uint32) { |
| 6968 | self.BundleId = v |
| 6969 | } |
| 6970 | |
| 6971 | func (self *BundleAddMsg) GetFlags() BundleFlags { |
| 6972 | return self.Flags |
| 6973 | } |
| 6974 | |
| 6975 | func (self *BundleAddMsg) SetFlags(v BundleFlags) { |
| 6976 | self.Flags = v |
| 6977 | } |
| 6978 | |
| 6979 | func (self *BundleAddMsg) GetMessage() IHeader { |
| 6980 | return self.Message |
| 6981 | } |
| 6982 | |
| 6983 | func (self *BundleAddMsg) SetMessage(v IHeader) { |
| 6984 | self.Message = v |
| 6985 | } |
| 6986 | |
| 6987 | func (self *BundleAddMsg) GetProperties() []IBundleProp { |
| 6988 | return self.Properties |
| 6989 | } |
| 6990 | |
| 6991 | func (self *BundleAddMsg) SetProperties(v []IBundleProp) { |
| 6992 | self.Properties = v |
| 6993 | } |
| 6994 | |
| 6995 | func (self *BundleAddMsg) Serialize(encoder *goloxi.Encoder) error { |
| 6996 | startIndex := len(encoder.Bytes()) |
| 6997 | if err := self.Header.Serialize(encoder); err != nil { |
| 6998 | return err |
| 6999 | } |
| 7000 | |
| 7001 | encoder.PutUint32(uint32(self.BundleId)) |
| 7002 | encoder.Write(bytes.Repeat([]byte{0}, 1)) |
| 7003 | encoder.PutUint16(uint16(self.Flags)) |
| 7004 | self.Message.Serialize(encoder) |
| 7005 | for _, obj := range self.Properties { |
| 7006 | if err := obj.Serialize(encoder); err != nil { |
| 7007 | return err |
| 7008 | } |
| 7009 | } |
| 7010 | length := len(encoder.Bytes()) - startIndex |
| 7011 | |
| 7012 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 7013 | |
| 7014 | return nil |
| 7015 | } |
| 7016 | |
| 7017 | func DecodeBundleAddMsg(parent *Header, decoder *goloxi.Decoder) (*BundleAddMsg, error) { |
| 7018 | _bundleaddmsg := &BundleAddMsg{Header: parent} |
| 7019 | if decoder.Length() < 15 { |
| 7020 | return nil, fmt.Errorf("BundleAddMsg packet too short: %d < 15", decoder.Length()) |
| 7021 | } |
| 7022 | _bundleaddmsg.BundleId = uint32(decoder.ReadUint32()) |
| 7023 | decoder.Skip(1) |
| 7024 | _bundleaddmsg.Flags = BundleFlags(decoder.ReadUint16()) |
| 7025 | if obj, err := DecodeHeader(decoder); err != nil { |
| 7026 | return nil, err |
| 7027 | } else { |
| 7028 | _bundleaddmsg.Message = obj |
| 7029 | } |
| 7030 | |
| 7031 | for decoder.Length() >= 4 { |
| 7032 | item, err := DecodeBundleProp(decoder) |
| 7033 | if err != nil { |
| 7034 | return nil, err |
| 7035 | } |
| 7036 | if item != nil { |
| 7037 | _bundleaddmsg.Properties = append(_bundleaddmsg.Properties, item) |
| 7038 | } |
| 7039 | } |
| 7040 | return _bundleaddmsg, nil |
| 7041 | } |
| 7042 | |
| 7043 | func NewBundleAddMsg() *BundleAddMsg { |
| 7044 | obj := &BundleAddMsg{ |
| 7045 | Header: NewHeader(34), |
| 7046 | } |
| 7047 | return obj |
| 7048 | } |
| 7049 | |
| 7050 | type BundleCtrlMsg struct { |
| 7051 | *Header |
| 7052 | BundleId uint32 |
| 7053 | BundleCtrlType BundleCtrlType |
| 7054 | Flags BundleFlags |
| 7055 | Properties []IBundleProp |
| 7056 | } |
| 7057 | |
| 7058 | type IBundleCtrlMsg interface { |
| 7059 | IHeader |
| 7060 | GetBundleId() uint32 |
| 7061 | GetBundleCtrlType() BundleCtrlType |
| 7062 | GetFlags() BundleFlags |
| 7063 | GetProperties() []IBundleProp |
| 7064 | } |
| 7065 | |
| 7066 | func (self *BundleCtrlMsg) GetBundleId() uint32 { |
| 7067 | return self.BundleId |
| 7068 | } |
| 7069 | |
| 7070 | func (self *BundleCtrlMsg) SetBundleId(v uint32) { |
| 7071 | self.BundleId = v |
| 7072 | } |
| 7073 | |
| 7074 | func (self *BundleCtrlMsg) GetBundleCtrlType() BundleCtrlType { |
| 7075 | return self.BundleCtrlType |
| 7076 | } |
| 7077 | |
| 7078 | func (self *BundleCtrlMsg) SetBundleCtrlType(v BundleCtrlType) { |
| 7079 | self.BundleCtrlType = v |
| 7080 | } |
| 7081 | |
| 7082 | func (self *BundleCtrlMsg) GetFlags() BundleFlags { |
| 7083 | return self.Flags |
| 7084 | } |
| 7085 | |
| 7086 | func (self *BundleCtrlMsg) SetFlags(v BundleFlags) { |
| 7087 | self.Flags = v |
| 7088 | } |
| 7089 | |
| 7090 | func (self *BundleCtrlMsg) GetProperties() []IBundleProp { |
| 7091 | return self.Properties |
| 7092 | } |
| 7093 | |
| 7094 | func (self *BundleCtrlMsg) SetProperties(v []IBundleProp) { |
| 7095 | self.Properties = v |
| 7096 | } |
| 7097 | |
| 7098 | func (self *BundleCtrlMsg) Serialize(encoder *goloxi.Encoder) error { |
| 7099 | startIndex := len(encoder.Bytes()) |
| 7100 | if err := self.Header.Serialize(encoder); err != nil { |
| 7101 | return err |
| 7102 | } |
| 7103 | |
| 7104 | encoder.PutUint32(uint32(self.BundleId)) |
| 7105 | encoder.PutUint16(uint16(self.BundleCtrlType)) |
| 7106 | encoder.PutUint16(uint16(self.Flags)) |
| 7107 | for _, obj := range self.Properties { |
| 7108 | if err := obj.Serialize(encoder); err != nil { |
| 7109 | return err |
| 7110 | } |
| 7111 | } |
| 7112 | length := len(encoder.Bytes()) - startIndex |
| 7113 | |
| 7114 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 7115 | |
| 7116 | return nil |
| 7117 | } |
| 7118 | |
| 7119 | func DecodeBundleCtrlMsg(parent *Header, decoder *goloxi.Decoder) (*BundleCtrlMsg, error) { |
| 7120 | _bundlectrlmsg := &BundleCtrlMsg{Header: parent} |
| 7121 | if decoder.Length() < 8 { |
| 7122 | return nil, fmt.Errorf("BundleCtrlMsg packet too short: %d < 8", decoder.Length()) |
| 7123 | } |
| 7124 | _bundlectrlmsg.BundleId = uint32(decoder.ReadUint32()) |
| 7125 | _bundlectrlmsg.BundleCtrlType = BundleCtrlType(decoder.ReadUint16()) |
| 7126 | _bundlectrlmsg.Flags = BundleFlags(decoder.ReadUint16()) |
| 7127 | |
| 7128 | for decoder.Length() >= 4 { |
| 7129 | item, err := DecodeBundleProp(decoder) |
| 7130 | if err != nil { |
| 7131 | return nil, err |
| 7132 | } |
| 7133 | if item != nil { |
| 7134 | _bundlectrlmsg.Properties = append(_bundlectrlmsg.Properties, item) |
| 7135 | } |
| 7136 | } |
| 7137 | return _bundlectrlmsg, nil |
| 7138 | } |
| 7139 | |
| 7140 | func NewBundleCtrlMsg() *BundleCtrlMsg { |
| 7141 | obj := &BundleCtrlMsg{ |
| 7142 | Header: NewHeader(33), |
| 7143 | } |
| 7144 | return obj |
| 7145 | } |
| 7146 | |
| 7147 | type BundleFailedErrorMsg struct { |
| 7148 | *ErrorMsg |
| 7149 | Code BundleFailedCode |
| 7150 | Data []byte |
| 7151 | } |
| 7152 | |
| 7153 | type IBundleFailedErrorMsg interface { |
| 7154 | IErrorMsg |
| 7155 | GetCode() BundleFailedCode |
| 7156 | GetData() []byte |
| 7157 | } |
| 7158 | |
| 7159 | func (self *BundleFailedErrorMsg) GetCode() BundleFailedCode { |
| 7160 | return self.Code |
| 7161 | } |
| 7162 | |
| 7163 | func (self *BundleFailedErrorMsg) SetCode(v BundleFailedCode) { |
| 7164 | self.Code = v |
| 7165 | } |
| 7166 | |
| 7167 | func (self *BundleFailedErrorMsg) GetData() []byte { |
| 7168 | return self.Data |
| 7169 | } |
| 7170 | |
| 7171 | func (self *BundleFailedErrorMsg) SetData(v []byte) { |
| 7172 | self.Data = v |
| 7173 | } |
| 7174 | |
| 7175 | func (self *BundleFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 7176 | startIndex := len(encoder.Bytes()) |
| 7177 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 7178 | return err |
| 7179 | } |
| 7180 | |
| 7181 | encoder.PutUint16(uint16(self.Code)) |
| 7182 | encoder.Write(self.Data) |
| 7183 | length := len(encoder.Bytes()) - startIndex |
| 7184 | |
| 7185 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 7186 | |
| 7187 | return nil |
| 7188 | } |
| 7189 | |
| 7190 | func DecodeBundleFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*BundleFailedErrorMsg, error) { |
| 7191 | _bundlefailederrormsg := &BundleFailedErrorMsg{ErrorMsg: parent} |
| 7192 | if decoder.Length() < 2 { |
| 7193 | return nil, fmt.Errorf("BundleFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 7194 | } |
| 7195 | _bundlefailederrormsg.Code = BundleFailedCode(decoder.ReadUint16()) |
| 7196 | _bundlefailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 7197 | return _bundlefailederrormsg, nil |
| 7198 | } |
| 7199 | |
| 7200 | func NewBundleFailedErrorMsg() *BundleFailedErrorMsg { |
| 7201 | obj := &BundleFailedErrorMsg{ |
| 7202 | ErrorMsg: NewErrorMsg(17), |
| 7203 | } |
| 7204 | return obj |
| 7205 | } |
| 7206 | |
| 7207 | type BundleFeaturesStatsReply struct { |
| 7208 | *StatsReply |
| 7209 | Capabilities BundleFeatureFlags |
| 7210 | Properties []IBundleFeaturesProp |
| 7211 | } |
| 7212 | |
| 7213 | type IBundleFeaturesStatsReply interface { |
| 7214 | IStatsReply |
| 7215 | GetCapabilities() BundleFeatureFlags |
| 7216 | GetProperties() []IBundleFeaturesProp |
| 7217 | } |
| 7218 | |
| 7219 | func (self *BundleFeaturesStatsReply) GetCapabilities() BundleFeatureFlags { |
| 7220 | return self.Capabilities |
| 7221 | } |
| 7222 | |
| 7223 | func (self *BundleFeaturesStatsReply) SetCapabilities(v BundleFeatureFlags) { |
| 7224 | self.Capabilities = v |
| 7225 | } |
| 7226 | |
| 7227 | func (self *BundleFeaturesStatsReply) GetProperties() []IBundleFeaturesProp { |
| 7228 | return self.Properties |
| 7229 | } |
| 7230 | |
| 7231 | func (self *BundleFeaturesStatsReply) SetProperties(v []IBundleFeaturesProp) { |
| 7232 | self.Properties = v |
| 7233 | } |
| 7234 | |
| 7235 | func (self *BundleFeaturesStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 7236 | startIndex := len(encoder.Bytes()) |
| 7237 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 7238 | return err |
| 7239 | } |
| 7240 | |
| 7241 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 7242 | encoder.PutUint32(uint32(self.Capabilities)) |
| 7243 | encoder.Write(bytes.Repeat([]byte{0}, 6)) |
| 7244 | for _, obj := range self.Properties { |
| 7245 | if err := obj.Serialize(encoder); err != nil { |
| 7246 | return err |
| 7247 | } |
| 7248 | } |
| 7249 | length := len(encoder.Bytes()) - startIndex |
| 7250 | |
| 7251 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 7252 | |
| 7253 | return nil |
| 7254 | } |
| 7255 | |
| 7256 | func DecodeBundleFeaturesStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*BundleFeaturesStatsReply, error) { |
| 7257 | _bundlefeaturesstatsreply := &BundleFeaturesStatsReply{StatsReply: parent} |
| 7258 | if decoder.Length() < 14 { |
| 7259 | return nil, fmt.Errorf("BundleFeaturesStatsReply packet too short: %d < 14", decoder.Length()) |
| 7260 | } |
| 7261 | decoder.Skip(4) |
| 7262 | _bundlefeaturesstatsreply.Capabilities = BundleFeatureFlags(decoder.ReadUint32()) |
| 7263 | decoder.Skip(6) |
| 7264 | |
| 7265 | for decoder.Length() >= 4 { |
| 7266 | item, err := DecodeBundleFeaturesProp(decoder) |
| 7267 | if err != nil { |
| 7268 | return nil, err |
| 7269 | } |
| 7270 | if item != nil { |
| 7271 | _bundlefeaturesstatsreply.Properties = append(_bundlefeaturesstatsreply.Properties, item) |
| 7272 | } |
| 7273 | } |
| 7274 | return _bundlefeaturesstatsreply, nil |
| 7275 | } |
| 7276 | |
| 7277 | func NewBundleFeaturesStatsReply() *BundleFeaturesStatsReply { |
| 7278 | obj := &BundleFeaturesStatsReply{ |
| 7279 | StatsReply: NewStatsReply(19), |
| 7280 | } |
| 7281 | return obj |
| 7282 | } |
| 7283 | |
| 7284 | type BundleFeaturesStatsRequest struct { |
| 7285 | *StatsRequest |
| 7286 | FeatureRequestFlags BundleFeatureFlags |
| 7287 | Properties []IBundleFeaturesProp |
| 7288 | } |
| 7289 | |
| 7290 | type IBundleFeaturesStatsRequest interface { |
| 7291 | IStatsRequest |
| 7292 | GetFeatureRequestFlags() BundleFeatureFlags |
| 7293 | GetProperties() []IBundleFeaturesProp |
| 7294 | } |
| 7295 | |
| 7296 | func (self *BundleFeaturesStatsRequest) GetFeatureRequestFlags() BundleFeatureFlags { |
| 7297 | return self.FeatureRequestFlags |
| 7298 | } |
| 7299 | |
| 7300 | func (self *BundleFeaturesStatsRequest) SetFeatureRequestFlags(v BundleFeatureFlags) { |
| 7301 | self.FeatureRequestFlags = v |
| 7302 | } |
| 7303 | |
| 7304 | func (self *BundleFeaturesStatsRequest) GetProperties() []IBundleFeaturesProp { |
| 7305 | return self.Properties |
| 7306 | } |
| 7307 | |
| 7308 | func (self *BundleFeaturesStatsRequest) SetProperties(v []IBundleFeaturesProp) { |
| 7309 | self.Properties = v |
| 7310 | } |
| 7311 | |
| 7312 | func (self *BundleFeaturesStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 7313 | startIndex := len(encoder.Bytes()) |
| 7314 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 7315 | return err |
| 7316 | } |
| 7317 | |
| 7318 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 7319 | encoder.PutUint32(uint32(self.FeatureRequestFlags)) |
| 7320 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 7321 | for _, obj := range self.Properties { |
| 7322 | if err := obj.Serialize(encoder); err != nil { |
| 7323 | return err |
| 7324 | } |
| 7325 | } |
| 7326 | length := len(encoder.Bytes()) - startIndex |
| 7327 | |
| 7328 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 7329 | |
| 7330 | return nil |
| 7331 | } |
| 7332 | |
| 7333 | func DecodeBundleFeaturesStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*BundleFeaturesStatsRequest, error) { |
| 7334 | _bundlefeaturesstatsrequest := &BundleFeaturesStatsRequest{StatsRequest: parent} |
| 7335 | if decoder.Length() < 4 { |
| 7336 | return nil, fmt.Errorf("BundleFeaturesStatsRequest packet too short: %d < 4", decoder.Length()) |
| 7337 | } |
| 7338 | decoder.Skip(4) |
| 7339 | _bundlefeaturesstatsrequest.FeatureRequestFlags = BundleFeatureFlags(decoder.ReadUint32()) |
| 7340 | decoder.Skip(4) |
| 7341 | |
| 7342 | for decoder.Length() >= 4 { |
| 7343 | item, err := DecodeBundleFeaturesProp(decoder) |
| 7344 | if err != nil { |
| 7345 | return nil, err |
| 7346 | } |
| 7347 | if item != nil { |
| 7348 | _bundlefeaturesstatsrequest.Properties = append(_bundlefeaturesstatsrequest.Properties, item) |
| 7349 | } |
| 7350 | } |
| 7351 | return _bundlefeaturesstatsrequest, nil |
| 7352 | } |
| 7353 | |
| 7354 | func NewBundleFeaturesStatsRequest() *BundleFeaturesStatsRequest { |
| 7355 | obj := &BundleFeaturesStatsRequest{ |
| 7356 | StatsRequest: NewStatsRequest(19), |
| 7357 | } |
| 7358 | return obj |
| 7359 | } |
| 7360 | |
| 7361 | type ControllerStatus struct { |
| 7362 | *Header |
| 7363 | Entry *ControllerStatusEntry |
| 7364 | } |
| 7365 | |
| 7366 | type IControllerStatus interface { |
| 7367 | IHeader |
| 7368 | GetEntry() *ControllerStatusEntry |
| 7369 | } |
| 7370 | |
| 7371 | func (self *ControllerStatus) GetEntry() *ControllerStatusEntry { |
| 7372 | return self.Entry |
| 7373 | } |
| 7374 | |
| 7375 | func (self *ControllerStatus) SetEntry(v *ControllerStatusEntry) { |
| 7376 | self.Entry = v |
| 7377 | } |
| 7378 | |
| 7379 | func (self *ControllerStatus) Serialize(encoder *goloxi.Encoder) error { |
| 7380 | startIndex := len(encoder.Bytes()) |
| 7381 | if err := self.Header.Serialize(encoder); err != nil { |
| 7382 | return err |
| 7383 | } |
| 7384 | |
| 7385 | self.Entry.Serialize(encoder) |
| 7386 | length := len(encoder.Bytes()) - startIndex |
| 7387 | |
| 7388 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 7389 | |
| 7390 | return nil |
| 7391 | } |
| 7392 | |
| 7393 | func DecodeControllerStatus(parent *Header, decoder *goloxi.Decoder) (*ControllerStatus, error) { |
| 7394 | _controllerstatus := &ControllerStatus{Header: parent} |
| 7395 | if decoder.Length() < 16 { |
| 7396 | return nil, fmt.Errorf("ControllerStatus packet too short: %d < 16", decoder.Length()) |
| 7397 | } |
| 7398 | if obj, err := DecodeControllerStatusEntry(decoder); err != nil { |
| 7399 | return nil, err |
| 7400 | } else { |
| 7401 | _controllerstatus.Entry = obj |
| 7402 | } |
| 7403 | |
| 7404 | return _controllerstatus, nil |
| 7405 | } |
| 7406 | |
| 7407 | func NewControllerStatus() *ControllerStatus { |
| 7408 | obj := &ControllerStatus{ |
| 7409 | Header: NewHeader(35), |
| 7410 | } |
| 7411 | return obj |
| 7412 | } |
| 7413 | |
| 7414 | type ControllerStatusStatsReply struct { |
| 7415 | *StatsReply |
| 7416 | ControllerStatus []*ControllerStatusEntry |
| 7417 | } |
| 7418 | |
| 7419 | type IControllerStatusStatsReply interface { |
| 7420 | IStatsReply |
| 7421 | GetControllerStatus() []*ControllerStatusEntry |
| 7422 | } |
| 7423 | |
| 7424 | func (self *ControllerStatusStatsReply) GetControllerStatus() []*ControllerStatusEntry { |
| 7425 | return self.ControllerStatus |
| 7426 | } |
| 7427 | |
| 7428 | func (self *ControllerStatusStatsReply) SetControllerStatus(v []*ControllerStatusEntry) { |
| 7429 | self.ControllerStatus = v |
| 7430 | } |
| 7431 | |
| 7432 | func (self *ControllerStatusStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 7433 | startIndex := len(encoder.Bytes()) |
| 7434 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 7435 | return err |
| 7436 | } |
| 7437 | |
| 7438 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 7439 | for _, obj := range self.ControllerStatus { |
| 7440 | if err := obj.Serialize(encoder); err != nil { |
| 7441 | return err |
| 7442 | } |
| 7443 | } |
| 7444 | length := len(encoder.Bytes()) - startIndex |
| 7445 | |
| 7446 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 7447 | |
| 7448 | return nil |
| 7449 | } |
| 7450 | |
| 7451 | func DecodeControllerStatusStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*ControllerStatusStatsReply, error) { |
| 7452 | _controllerstatusstatsreply := &ControllerStatusStatsReply{StatsReply: parent} |
| 7453 | if decoder.Length() < 4 { |
| 7454 | return nil, fmt.Errorf("ControllerStatusStatsReply packet too short: %d < 4", decoder.Length()) |
| 7455 | } |
| 7456 | decoder.Skip(4) |
| 7457 | |
| 7458 | for decoder.Length() >= 16 { |
| 7459 | item, err := DecodeControllerStatusEntry(decoder) |
| 7460 | if err != nil { |
| 7461 | return nil, err |
| 7462 | } |
| 7463 | if item != nil { |
| 7464 | _controllerstatusstatsreply.ControllerStatus = append(_controllerstatusstatsreply.ControllerStatus, item) |
| 7465 | } |
| 7466 | } |
| 7467 | return _controllerstatusstatsreply, nil |
| 7468 | } |
| 7469 | |
| 7470 | func NewControllerStatusStatsReply() *ControllerStatusStatsReply { |
| 7471 | obj := &ControllerStatusStatsReply{ |
| 7472 | StatsReply: NewStatsReply(18), |
| 7473 | } |
| 7474 | return obj |
| 7475 | } |
| 7476 | |
| 7477 | type ControllerStatusStatsRequest struct { |
| 7478 | *StatsRequest |
| 7479 | } |
| 7480 | |
| 7481 | type IControllerStatusStatsRequest interface { |
| 7482 | IStatsRequest |
| 7483 | } |
| 7484 | |
| 7485 | func (self *ControllerStatusStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 7486 | startIndex := len(encoder.Bytes()) |
| 7487 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 7488 | return err |
| 7489 | } |
| 7490 | |
| 7491 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 7492 | length := len(encoder.Bytes()) - startIndex |
| 7493 | |
| 7494 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 7495 | |
| 7496 | return nil |
| 7497 | } |
| 7498 | |
| 7499 | func DecodeControllerStatusStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*ControllerStatusStatsRequest, error) { |
| 7500 | _controllerstatusstatsrequest := &ControllerStatusStatsRequest{StatsRequest: parent} |
| 7501 | if decoder.Length() < 4 { |
| 7502 | return nil, fmt.Errorf("ControllerStatusStatsRequest packet too short: %d < 4", decoder.Length()) |
| 7503 | } |
| 7504 | decoder.Skip(4) |
| 7505 | return _controllerstatusstatsrequest, nil |
| 7506 | } |
| 7507 | |
| 7508 | func NewControllerStatusStatsRequest() *ControllerStatusStatsRequest { |
| 7509 | obj := &ControllerStatusStatsRequest{ |
| 7510 | StatsRequest: NewStatsRequest(18), |
| 7511 | } |
| 7512 | return obj |
| 7513 | } |
| 7514 | |
| 7515 | type DescStatsReply struct { |
| 7516 | *StatsReply |
| 7517 | MfrDesc string |
| 7518 | HwDesc string |
| 7519 | SwDesc string |
| 7520 | SerialNum string |
| 7521 | DpDesc string |
| 7522 | } |
| 7523 | |
| 7524 | type IDescStatsReply interface { |
| 7525 | IStatsReply |
| 7526 | GetMfrDesc() string |
| 7527 | GetHwDesc() string |
| 7528 | GetSwDesc() string |
| 7529 | GetSerialNum() string |
| 7530 | GetDpDesc() string |
| 7531 | } |
| 7532 | |
| 7533 | func (self *DescStatsReply) GetMfrDesc() string { |
| 7534 | return self.MfrDesc |
| 7535 | } |
| 7536 | |
| 7537 | func (self *DescStatsReply) SetMfrDesc(v string) { |
| 7538 | self.MfrDesc = v |
| 7539 | } |
| 7540 | |
| 7541 | func (self *DescStatsReply) GetHwDesc() string { |
| 7542 | return self.HwDesc |
| 7543 | } |
| 7544 | |
| 7545 | func (self *DescStatsReply) SetHwDesc(v string) { |
| 7546 | self.HwDesc = v |
| 7547 | } |
| 7548 | |
| 7549 | func (self *DescStatsReply) GetSwDesc() string { |
| 7550 | return self.SwDesc |
| 7551 | } |
| 7552 | |
| 7553 | func (self *DescStatsReply) SetSwDesc(v string) { |
| 7554 | self.SwDesc = v |
| 7555 | } |
| 7556 | |
| 7557 | func (self *DescStatsReply) GetSerialNum() string { |
| 7558 | return self.SerialNum |
| 7559 | } |
| 7560 | |
| 7561 | func (self *DescStatsReply) SetSerialNum(v string) { |
| 7562 | self.SerialNum = v |
| 7563 | } |
| 7564 | |
| 7565 | func (self *DescStatsReply) GetDpDesc() string { |
| 7566 | return self.DpDesc |
| 7567 | } |
| 7568 | |
| 7569 | func (self *DescStatsReply) SetDpDesc(v string) { |
| 7570 | self.DpDesc = v |
| 7571 | } |
| 7572 | |
| 7573 | func (self *DescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 7574 | startIndex := len(encoder.Bytes()) |
| 7575 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 7576 | return err |
| 7577 | } |
| 7578 | |
| 7579 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 7580 | encoder.Write([]byte(self.MfrDesc)) |
| 7581 | encoder.Write([]byte(self.HwDesc)) |
| 7582 | encoder.Write([]byte(self.SwDesc)) |
| 7583 | encoder.Write([]byte(self.SerialNum)) |
| 7584 | encoder.Write([]byte(self.DpDesc)) |
| 7585 | length := len(encoder.Bytes()) - startIndex |
| 7586 | |
| 7587 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 7588 | |
| 7589 | return nil |
| 7590 | } |
| 7591 | |
| 7592 | func DecodeDescStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*DescStatsReply, error) { |
| 7593 | _descstatsreply := &DescStatsReply{StatsReply: parent} |
| 7594 | if decoder.Length() < 1060 { |
| 7595 | return nil, fmt.Errorf("DescStatsReply packet too short: %d < 1060", decoder.Length()) |
| 7596 | } |
| 7597 | decoder.Skip(4) |
| 7598 | _descstatsreply.MfrDesc = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 7599 | _descstatsreply.HwDesc = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 7600 | _descstatsreply.SwDesc = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 7601 | _descstatsreply.SerialNum = string(bytes.Trim(decoder.Read(32), "\x00")) |
| 7602 | _descstatsreply.DpDesc = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 7603 | return _descstatsreply, nil |
| 7604 | } |
| 7605 | |
| 7606 | func NewDescStatsReply() *DescStatsReply { |
| 7607 | obj := &DescStatsReply{ |
| 7608 | StatsReply: NewStatsReply(0), |
| 7609 | } |
| 7610 | return obj |
| 7611 | } |
| 7612 | |
| 7613 | type DescStatsRequest struct { |
| 7614 | *StatsRequest |
| 7615 | } |
| 7616 | |
| 7617 | type IDescStatsRequest interface { |
| 7618 | IStatsRequest |
| 7619 | } |
| 7620 | |
| 7621 | func (self *DescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 7622 | startIndex := len(encoder.Bytes()) |
| 7623 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 7624 | return err |
| 7625 | } |
| 7626 | |
| 7627 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 7628 | length := len(encoder.Bytes()) - startIndex |
| 7629 | |
| 7630 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 7631 | |
| 7632 | return nil |
| 7633 | } |
| 7634 | |
| 7635 | func DecodeDescStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*DescStatsRequest, error) { |
| 7636 | _descstatsrequest := &DescStatsRequest{StatsRequest: parent} |
| 7637 | if decoder.Length() < 4 { |
| 7638 | return nil, fmt.Errorf("DescStatsRequest packet too short: %d < 4", decoder.Length()) |
| 7639 | } |
| 7640 | decoder.Skip(4) |
| 7641 | return _descstatsrequest, nil |
| 7642 | } |
| 7643 | |
| 7644 | func NewDescStatsRequest() *DescStatsRequest { |
| 7645 | obj := &DescStatsRequest{ |
| 7646 | StatsRequest: NewStatsRequest(0), |
| 7647 | } |
| 7648 | return obj |
| 7649 | } |
| 7650 | |
| 7651 | type EchoReply struct { |
| 7652 | *Header |
| 7653 | Data []byte |
| 7654 | } |
| 7655 | |
| 7656 | type IEchoReply interface { |
| 7657 | IHeader |
| 7658 | GetData() []byte |
| 7659 | } |
| 7660 | |
| 7661 | func (self *EchoReply) GetData() []byte { |
| 7662 | return self.Data |
| 7663 | } |
| 7664 | |
| 7665 | func (self *EchoReply) SetData(v []byte) { |
| 7666 | self.Data = v |
| 7667 | } |
| 7668 | |
| 7669 | func (self *EchoReply) Serialize(encoder *goloxi.Encoder) error { |
| 7670 | startIndex := len(encoder.Bytes()) |
| 7671 | if err := self.Header.Serialize(encoder); err != nil { |
| 7672 | return err |
| 7673 | } |
| 7674 | |
| 7675 | encoder.Write(self.Data) |
| 7676 | length := len(encoder.Bytes()) - startIndex |
| 7677 | |
| 7678 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 7679 | |
| 7680 | return nil |
| 7681 | } |
| 7682 | |
| 7683 | func DecodeEchoReply(parent *Header, decoder *goloxi.Decoder) (*EchoReply, error) { |
| 7684 | _echoreply := &EchoReply{Header: parent} |
| 7685 | _echoreply.Data = decoder.Read(int(decoder.Length())) |
| 7686 | return _echoreply, nil |
| 7687 | } |
| 7688 | |
| 7689 | func NewEchoReply() *EchoReply { |
| 7690 | obj := &EchoReply{ |
| 7691 | Header: NewHeader(3), |
| 7692 | } |
| 7693 | return obj |
| 7694 | } |
| 7695 | |
| 7696 | type EchoRequest struct { |
| 7697 | *Header |
| 7698 | Data []byte |
| 7699 | } |
| 7700 | |
| 7701 | type IEchoRequest interface { |
| 7702 | IHeader |
| 7703 | GetData() []byte |
| 7704 | } |
| 7705 | |
| 7706 | func (self *EchoRequest) GetData() []byte { |
| 7707 | return self.Data |
| 7708 | } |
| 7709 | |
| 7710 | func (self *EchoRequest) SetData(v []byte) { |
| 7711 | self.Data = v |
| 7712 | } |
| 7713 | |
| 7714 | func (self *EchoRequest) Serialize(encoder *goloxi.Encoder) error { |
| 7715 | startIndex := len(encoder.Bytes()) |
| 7716 | if err := self.Header.Serialize(encoder); err != nil { |
| 7717 | return err |
| 7718 | } |
| 7719 | |
| 7720 | encoder.Write(self.Data) |
| 7721 | length := len(encoder.Bytes()) - startIndex |
| 7722 | |
| 7723 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 7724 | |
| 7725 | return nil |
| 7726 | } |
| 7727 | |
| 7728 | func DecodeEchoRequest(parent *Header, decoder *goloxi.Decoder) (*EchoRequest, error) { |
| 7729 | _echorequest := &EchoRequest{Header: parent} |
| 7730 | _echorequest.Data = decoder.Read(int(decoder.Length())) |
| 7731 | return _echorequest, nil |
| 7732 | } |
| 7733 | |
| 7734 | func NewEchoRequest() *EchoRequest { |
| 7735 | obj := &EchoRequest{ |
| 7736 | Header: NewHeader(2), |
| 7737 | } |
| 7738 | return obj |
| 7739 | } |
| 7740 | |
| 7741 | type FeaturesReply struct { |
| 7742 | *Header |
| 7743 | DatapathId uint64 |
| 7744 | NBuffers uint32 |
| 7745 | NTables uint8 |
| 7746 | AuxiliaryId uint8 |
| 7747 | Capabilities Capabilities |
| 7748 | Reserved uint32 |
| 7749 | } |
| 7750 | |
| 7751 | type IFeaturesReply interface { |
| 7752 | IHeader |
| 7753 | GetDatapathId() uint64 |
| 7754 | GetNBuffers() uint32 |
| 7755 | GetNTables() uint8 |
| 7756 | GetAuxiliaryId() uint8 |
| 7757 | GetCapabilities() Capabilities |
| 7758 | GetReserved() uint32 |
| 7759 | } |
| 7760 | |
| 7761 | func (self *FeaturesReply) GetDatapathId() uint64 { |
| 7762 | return self.DatapathId |
| 7763 | } |
| 7764 | |
| 7765 | func (self *FeaturesReply) SetDatapathId(v uint64) { |
| 7766 | self.DatapathId = v |
| 7767 | } |
| 7768 | |
| 7769 | func (self *FeaturesReply) GetNBuffers() uint32 { |
| 7770 | return self.NBuffers |
| 7771 | } |
| 7772 | |
| 7773 | func (self *FeaturesReply) SetNBuffers(v uint32) { |
| 7774 | self.NBuffers = v |
| 7775 | } |
| 7776 | |
| 7777 | func (self *FeaturesReply) GetNTables() uint8 { |
| 7778 | return self.NTables |
| 7779 | } |
| 7780 | |
| 7781 | func (self *FeaturesReply) SetNTables(v uint8) { |
| 7782 | self.NTables = v |
| 7783 | } |
| 7784 | |
| 7785 | func (self *FeaturesReply) GetAuxiliaryId() uint8 { |
| 7786 | return self.AuxiliaryId |
| 7787 | } |
| 7788 | |
| 7789 | func (self *FeaturesReply) SetAuxiliaryId(v uint8) { |
| 7790 | self.AuxiliaryId = v |
| 7791 | } |
| 7792 | |
| 7793 | func (self *FeaturesReply) GetCapabilities() Capabilities { |
| 7794 | return self.Capabilities |
| 7795 | } |
| 7796 | |
| 7797 | func (self *FeaturesReply) SetCapabilities(v Capabilities) { |
| 7798 | self.Capabilities = v |
| 7799 | } |
| 7800 | |
| 7801 | func (self *FeaturesReply) GetReserved() uint32 { |
| 7802 | return self.Reserved |
| 7803 | } |
| 7804 | |
| 7805 | func (self *FeaturesReply) SetReserved(v uint32) { |
| 7806 | self.Reserved = v |
| 7807 | } |
| 7808 | |
| 7809 | func (self *FeaturesReply) Serialize(encoder *goloxi.Encoder) error { |
| 7810 | startIndex := len(encoder.Bytes()) |
| 7811 | if err := self.Header.Serialize(encoder); err != nil { |
| 7812 | return err |
| 7813 | } |
| 7814 | |
| 7815 | encoder.PutUint64(uint64(self.DatapathId)) |
| 7816 | encoder.PutUint32(uint32(self.NBuffers)) |
| 7817 | encoder.PutUint8(uint8(self.NTables)) |
| 7818 | encoder.PutUint8(uint8(self.AuxiliaryId)) |
| 7819 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 7820 | encoder.PutUint32(uint32(self.Capabilities)) |
| 7821 | encoder.PutUint32(uint32(self.Reserved)) |
| 7822 | length := len(encoder.Bytes()) - startIndex |
| 7823 | |
| 7824 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 7825 | |
| 7826 | return nil |
| 7827 | } |
| 7828 | |
| 7829 | func DecodeFeaturesReply(parent *Header, decoder *goloxi.Decoder) (*FeaturesReply, error) { |
| 7830 | _featuresreply := &FeaturesReply{Header: parent} |
| 7831 | if decoder.Length() < 24 { |
| 7832 | return nil, fmt.Errorf("FeaturesReply packet too short: %d < 24", decoder.Length()) |
| 7833 | } |
| 7834 | _featuresreply.DatapathId = uint64(decoder.ReadUint64()) |
| 7835 | _featuresreply.NBuffers = uint32(decoder.ReadUint32()) |
| 7836 | _featuresreply.NTables = uint8(decoder.ReadByte()) |
| 7837 | _featuresreply.AuxiliaryId = uint8(decoder.ReadByte()) |
| 7838 | decoder.Skip(2) |
| 7839 | _featuresreply.Capabilities = Capabilities(decoder.ReadUint32()) |
| 7840 | _featuresreply.Reserved = uint32(decoder.ReadUint32()) |
| 7841 | return _featuresreply, nil |
| 7842 | } |
| 7843 | |
| 7844 | func NewFeaturesReply() *FeaturesReply { |
| 7845 | obj := &FeaturesReply{ |
| 7846 | Header: NewHeader(6), |
| 7847 | } |
| 7848 | return obj |
| 7849 | } |
| 7850 | |
| 7851 | type FeaturesRequest struct { |
| 7852 | *Header |
| 7853 | } |
| 7854 | |
| 7855 | type IFeaturesRequest interface { |
| 7856 | IHeader |
| 7857 | } |
| 7858 | |
| 7859 | func (self *FeaturesRequest) Serialize(encoder *goloxi.Encoder) error { |
| 7860 | startIndex := len(encoder.Bytes()) |
| 7861 | if err := self.Header.Serialize(encoder); err != nil { |
| 7862 | return err |
| 7863 | } |
| 7864 | length := len(encoder.Bytes()) - startIndex |
| 7865 | |
| 7866 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 7867 | |
| 7868 | return nil |
| 7869 | } |
| 7870 | |
| 7871 | func DecodeFeaturesRequest(parent *Header, decoder *goloxi.Decoder) (*FeaturesRequest, error) { |
| 7872 | _featuresrequest := &FeaturesRequest{Header: parent} |
| 7873 | return _featuresrequest, nil |
| 7874 | } |
| 7875 | |
| 7876 | func NewFeaturesRequest() *FeaturesRequest { |
| 7877 | obj := &FeaturesRequest{ |
| 7878 | Header: NewHeader(5), |
| 7879 | } |
| 7880 | return obj |
| 7881 | } |
| 7882 | |
| 7883 | type FlowMod struct { |
| 7884 | *Header |
| 7885 | Cookie uint64 |
| 7886 | CookieMask uint64 |
| 7887 | TableId uint8 |
| 7888 | Command FmCmd |
| 7889 | IdleTimeout uint16 |
| 7890 | HardTimeout uint16 |
| 7891 | Priority uint16 |
| 7892 | BufferId uint32 |
| 7893 | OutPort Port |
| 7894 | OutGroup uint32 |
| 7895 | Flags FlowModFlags |
| 7896 | Importance uint16 |
| 7897 | Match Match |
| 7898 | Instructions []IInstruction |
| 7899 | } |
| 7900 | |
| 7901 | type IFlowMod interface { |
| 7902 | IHeader |
| 7903 | GetCookie() uint64 |
| 7904 | GetCookieMask() uint64 |
| 7905 | GetTableId() uint8 |
| 7906 | GetCommand() FmCmd |
| 7907 | GetIdleTimeout() uint16 |
| 7908 | GetHardTimeout() uint16 |
| 7909 | GetPriority() uint16 |
| 7910 | GetBufferId() uint32 |
| 7911 | GetOutPort() Port |
| 7912 | GetOutGroup() uint32 |
| 7913 | GetFlags() FlowModFlags |
| 7914 | GetImportance() uint16 |
| 7915 | GetMatch() Match |
| 7916 | GetInstructions() []IInstruction |
| 7917 | } |
| 7918 | |
| 7919 | func (self *FlowMod) GetCookie() uint64 { |
| 7920 | return self.Cookie |
| 7921 | } |
| 7922 | |
| 7923 | func (self *FlowMod) SetCookie(v uint64) { |
| 7924 | self.Cookie = v |
| 7925 | } |
| 7926 | |
| 7927 | func (self *FlowMod) GetCookieMask() uint64 { |
| 7928 | return self.CookieMask |
| 7929 | } |
| 7930 | |
| 7931 | func (self *FlowMod) SetCookieMask(v uint64) { |
| 7932 | self.CookieMask = v |
| 7933 | } |
| 7934 | |
| 7935 | func (self *FlowMod) GetTableId() uint8 { |
| 7936 | return self.TableId |
| 7937 | } |
| 7938 | |
| 7939 | func (self *FlowMod) SetTableId(v uint8) { |
| 7940 | self.TableId = v |
| 7941 | } |
| 7942 | |
| 7943 | func (self *FlowMod) GetCommand() FmCmd { |
| 7944 | return self.Command |
| 7945 | } |
| 7946 | |
| 7947 | func (self *FlowMod) SetCommand(v FmCmd) { |
| 7948 | self.Command = v |
| 7949 | } |
| 7950 | |
| 7951 | func (self *FlowMod) GetIdleTimeout() uint16 { |
| 7952 | return self.IdleTimeout |
| 7953 | } |
| 7954 | |
| 7955 | func (self *FlowMod) SetIdleTimeout(v uint16) { |
| 7956 | self.IdleTimeout = v |
| 7957 | } |
| 7958 | |
| 7959 | func (self *FlowMod) GetHardTimeout() uint16 { |
| 7960 | return self.HardTimeout |
| 7961 | } |
| 7962 | |
| 7963 | func (self *FlowMod) SetHardTimeout(v uint16) { |
| 7964 | self.HardTimeout = v |
| 7965 | } |
| 7966 | |
| 7967 | func (self *FlowMod) GetPriority() uint16 { |
| 7968 | return self.Priority |
| 7969 | } |
| 7970 | |
| 7971 | func (self *FlowMod) SetPriority(v uint16) { |
| 7972 | self.Priority = v |
| 7973 | } |
| 7974 | |
| 7975 | func (self *FlowMod) GetBufferId() uint32 { |
| 7976 | return self.BufferId |
| 7977 | } |
| 7978 | |
| 7979 | func (self *FlowMod) SetBufferId(v uint32) { |
| 7980 | self.BufferId = v |
| 7981 | } |
| 7982 | |
| 7983 | func (self *FlowMod) GetOutPort() Port { |
| 7984 | return self.OutPort |
| 7985 | } |
| 7986 | |
| 7987 | func (self *FlowMod) SetOutPort(v Port) { |
| 7988 | self.OutPort = v |
| 7989 | } |
| 7990 | |
| 7991 | func (self *FlowMod) GetOutGroup() uint32 { |
| 7992 | return self.OutGroup |
| 7993 | } |
| 7994 | |
| 7995 | func (self *FlowMod) SetOutGroup(v uint32) { |
| 7996 | self.OutGroup = v |
| 7997 | } |
| 7998 | |
| 7999 | func (self *FlowMod) GetFlags() FlowModFlags { |
| 8000 | return self.Flags |
| 8001 | } |
| 8002 | |
| 8003 | func (self *FlowMod) SetFlags(v FlowModFlags) { |
| 8004 | self.Flags = v |
| 8005 | } |
| 8006 | |
| 8007 | func (self *FlowMod) GetImportance() uint16 { |
| 8008 | return self.Importance |
| 8009 | } |
| 8010 | |
| 8011 | func (self *FlowMod) SetImportance(v uint16) { |
| 8012 | self.Importance = v |
| 8013 | } |
| 8014 | |
| 8015 | func (self *FlowMod) GetMatch() Match { |
| 8016 | return self.Match |
| 8017 | } |
| 8018 | |
| 8019 | func (self *FlowMod) SetMatch(v Match) { |
| 8020 | self.Match = v |
| 8021 | } |
| 8022 | |
| 8023 | func (self *FlowMod) GetInstructions() []IInstruction { |
| 8024 | return self.Instructions |
| 8025 | } |
| 8026 | |
| 8027 | func (self *FlowMod) SetInstructions(v []IInstruction) { |
| 8028 | self.Instructions = v |
| 8029 | } |
| 8030 | |
| 8031 | func (self *FlowMod) Serialize(encoder *goloxi.Encoder) error { |
| 8032 | if err := self.Header.Serialize(encoder); err != nil { |
| 8033 | return err |
| 8034 | } |
| 8035 | |
| 8036 | encoder.PutUint64(uint64(self.Cookie)) |
| 8037 | encoder.PutUint64(uint64(self.CookieMask)) |
| 8038 | encoder.PutUint8(uint8(self.TableId)) |
| 8039 | self.Command.Serialize(encoder) |
| 8040 | encoder.PutUint16(uint16(self.IdleTimeout)) |
| 8041 | encoder.PutUint16(uint16(self.HardTimeout)) |
| 8042 | encoder.PutUint16(uint16(self.Priority)) |
| 8043 | encoder.PutUint32(uint32(self.BufferId)) |
| 8044 | self.OutPort.Serialize(encoder) |
| 8045 | encoder.PutUint32(uint32(self.OutGroup)) |
| 8046 | encoder.PutUint16(uint16(self.Flags)) |
| 8047 | encoder.PutUint16(uint16(self.Importance)) |
| 8048 | if err := self.Match.Serialize(encoder); err != nil { |
| 8049 | return err |
| 8050 | } |
| 8051 | |
| 8052 | for _, obj := range self.Instructions { |
| 8053 | if err := obj.Serialize(encoder); err != nil { |
| 8054 | return err |
| 8055 | } |
| 8056 | } |
| 8057 | |
| 8058 | return nil |
| 8059 | } |
| 8060 | |
| 8061 | func DecodeFlowMod(parent *Header, decoder *goloxi.Decoder) (IFlowMod, error) { |
| 8062 | _flowmod := &FlowMod{Header: parent} |
| 8063 | if decoder.Length() < 48 { |
| 8064 | return nil, fmt.Errorf("FlowMod packet too short: %d < 48", decoder.Length()) |
| 8065 | } |
| 8066 | _flowmod.Cookie = uint64(decoder.ReadUint64()) |
| 8067 | _flowmod.CookieMask = uint64(decoder.ReadUint64()) |
| 8068 | _flowmod.TableId = uint8(decoder.ReadByte()) |
| 8069 | _flowmod.Command.Decode(decoder) |
| 8070 | _flowmod.IdleTimeout = uint16(decoder.ReadUint16()) |
| 8071 | _flowmod.HardTimeout = uint16(decoder.ReadUint16()) |
| 8072 | _flowmod.Priority = uint16(decoder.ReadUint16()) |
| 8073 | _flowmod.BufferId = uint32(decoder.ReadUint32()) |
| 8074 | _flowmod.OutPort.Decode(decoder) |
| 8075 | _flowmod.OutGroup = uint32(decoder.ReadUint32()) |
| 8076 | _flowmod.Flags = FlowModFlags(decoder.ReadUint16()) |
| 8077 | _flowmod.Importance = uint16(decoder.ReadUint16()) |
| 8078 | if err := _flowmod.Match.Decode(decoder); err != nil { |
| 8079 | return nil, err |
| 8080 | } |
| 8081 | |
| 8082 | decoder.SkipAlign() |
| 8083 | |
| 8084 | for decoder.Length() >= 4 { |
| 8085 | item, err := DecodeInstruction(decoder) |
| 8086 | if err != nil { |
| 8087 | return nil, err |
| 8088 | } |
| 8089 | if item != nil { |
| 8090 | _flowmod.Instructions = append(_flowmod.Instructions, item) |
| 8091 | } |
| 8092 | } |
| 8093 | |
| 8094 | switch _flowmod.Command { |
| 8095 | case 0: |
| 8096 | return DecodeFlowAdd(_flowmod, decoder) |
| 8097 | case 1: |
| 8098 | return DecodeFlowModify(_flowmod, decoder) |
| 8099 | case 2: |
| 8100 | return DecodeFlowModifyStrict(_flowmod, decoder) |
| 8101 | case 3: |
| 8102 | return DecodeFlowDelete(_flowmod, decoder) |
| 8103 | case 4: |
| 8104 | return DecodeFlowDeleteStrict(_flowmod, decoder) |
| 8105 | default: |
| 8106 | return nil, fmt.Errorf("Invalid type '%d' for 'FlowMod'", _flowmod.Command) |
| 8107 | } |
| 8108 | } |
| 8109 | |
| 8110 | func NewFlowMod(__command FmCmd) *FlowMod { |
| 8111 | obj := &FlowMod{ |
| 8112 | Header: NewHeader(14), |
| 8113 | } |
| 8114 | obj.Command = __command |
| 8115 | return obj |
| 8116 | } |
| 8117 | |
| 8118 | type FlowAdd struct { |
| 8119 | *FlowMod |
| 8120 | } |
| 8121 | |
| 8122 | type IFlowAdd interface { |
| 8123 | IFlowMod |
| 8124 | } |
| 8125 | |
| 8126 | func (self *FlowAdd) Serialize(encoder *goloxi.Encoder) error { |
| 8127 | startIndex := len(encoder.Bytes()) |
| 8128 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 8129 | return err |
| 8130 | } |
| 8131 | length := len(encoder.Bytes()) - startIndex |
| 8132 | |
| 8133 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 8134 | |
| 8135 | return nil |
| 8136 | } |
| 8137 | |
| 8138 | func DecodeFlowAdd(parent *FlowMod, decoder *goloxi.Decoder) (*FlowAdd, error) { |
| 8139 | _flowadd := &FlowAdd{FlowMod: parent} |
| 8140 | return _flowadd, nil |
| 8141 | } |
| 8142 | |
| 8143 | func NewFlowAdd() *FlowAdd { |
| 8144 | obj := &FlowAdd{ |
| 8145 | FlowMod: NewFlowMod(0), |
| 8146 | } |
| 8147 | return obj |
| 8148 | } |
| 8149 | |
| 8150 | type FlowDelete struct { |
| 8151 | *FlowMod |
| 8152 | } |
| 8153 | |
| 8154 | type IFlowDelete interface { |
| 8155 | IFlowMod |
| 8156 | } |
| 8157 | |
| 8158 | func (self *FlowDelete) Serialize(encoder *goloxi.Encoder) error { |
| 8159 | startIndex := len(encoder.Bytes()) |
| 8160 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 8161 | return err |
| 8162 | } |
| 8163 | length := len(encoder.Bytes()) - startIndex |
| 8164 | |
| 8165 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 8166 | |
| 8167 | return nil |
| 8168 | } |
| 8169 | |
| 8170 | func DecodeFlowDelete(parent *FlowMod, decoder *goloxi.Decoder) (*FlowDelete, error) { |
| 8171 | _flowdelete := &FlowDelete{FlowMod: parent} |
| 8172 | return _flowdelete, nil |
| 8173 | } |
| 8174 | |
| 8175 | func NewFlowDelete() *FlowDelete { |
| 8176 | obj := &FlowDelete{ |
| 8177 | FlowMod: NewFlowMod(3), |
| 8178 | } |
| 8179 | return obj |
| 8180 | } |
| 8181 | |
| 8182 | type FlowDeleteStrict struct { |
| 8183 | *FlowMod |
| 8184 | } |
| 8185 | |
| 8186 | type IFlowDeleteStrict interface { |
| 8187 | IFlowMod |
| 8188 | } |
| 8189 | |
| 8190 | func (self *FlowDeleteStrict) Serialize(encoder *goloxi.Encoder) error { |
| 8191 | startIndex := len(encoder.Bytes()) |
| 8192 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 8193 | return err |
| 8194 | } |
| 8195 | length := len(encoder.Bytes()) - startIndex |
| 8196 | |
| 8197 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 8198 | |
| 8199 | return nil |
| 8200 | } |
| 8201 | |
| 8202 | func DecodeFlowDeleteStrict(parent *FlowMod, decoder *goloxi.Decoder) (*FlowDeleteStrict, error) { |
| 8203 | _flowdeletestrict := &FlowDeleteStrict{FlowMod: parent} |
| 8204 | return _flowdeletestrict, nil |
| 8205 | } |
| 8206 | |
| 8207 | func NewFlowDeleteStrict() *FlowDeleteStrict { |
| 8208 | obj := &FlowDeleteStrict{ |
| 8209 | FlowMod: NewFlowMod(4), |
| 8210 | } |
| 8211 | return obj |
| 8212 | } |
| 8213 | |
| 8214 | type FlowLightweightStatsReply struct { |
| 8215 | *StatsReply |
| 8216 | Entries []*FlowLightweightStatsEntry |
| 8217 | } |
| 8218 | |
| 8219 | type IFlowLightweightStatsReply interface { |
| 8220 | IStatsReply |
| 8221 | GetEntries() []*FlowLightweightStatsEntry |
| 8222 | } |
| 8223 | |
| 8224 | func (self *FlowLightweightStatsReply) GetEntries() []*FlowLightweightStatsEntry { |
| 8225 | return self.Entries |
| 8226 | } |
| 8227 | |
| 8228 | func (self *FlowLightweightStatsReply) SetEntries(v []*FlowLightweightStatsEntry) { |
| 8229 | self.Entries = v |
| 8230 | } |
| 8231 | |
| 8232 | func (self *FlowLightweightStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 8233 | startIndex := len(encoder.Bytes()) |
| 8234 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 8235 | return err |
| 8236 | } |
| 8237 | |
| 8238 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8239 | for _, obj := range self.Entries { |
| 8240 | if err := obj.Serialize(encoder); err != nil { |
| 8241 | return err |
| 8242 | } |
| 8243 | } |
| 8244 | length := len(encoder.Bytes()) - startIndex |
| 8245 | |
| 8246 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 8247 | |
| 8248 | return nil |
| 8249 | } |
| 8250 | |
| 8251 | func DecodeFlowLightweightStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*FlowLightweightStatsReply, error) { |
| 8252 | _flowlightweightstatsreply := &FlowLightweightStatsReply{StatsReply: parent} |
| 8253 | if decoder.Length() < 4 { |
| 8254 | return nil, fmt.Errorf("FlowLightweightStatsReply packet too short: %d < 4", decoder.Length()) |
| 8255 | } |
| 8256 | decoder.Skip(4) |
| 8257 | |
| 8258 | for decoder.Length() >= 24 { |
| 8259 | item, err := DecodeFlowLightweightStatsEntry(decoder) |
| 8260 | if err != nil { |
| 8261 | return nil, err |
| 8262 | } |
| 8263 | if item != nil { |
| 8264 | _flowlightweightstatsreply.Entries = append(_flowlightweightstatsreply.Entries, item) |
| 8265 | } |
| 8266 | } |
| 8267 | return _flowlightweightstatsreply, nil |
| 8268 | } |
| 8269 | |
| 8270 | func NewFlowLightweightStatsReply() *FlowLightweightStatsReply { |
| 8271 | obj := &FlowLightweightStatsReply{ |
| 8272 | StatsReply: NewStatsReply(17), |
| 8273 | } |
| 8274 | return obj |
| 8275 | } |
| 8276 | |
| 8277 | type FlowLightweightStatsRequest struct { |
| 8278 | *StatsRequest |
| 8279 | TableId uint8 |
| 8280 | OutPort Port |
| 8281 | OutGroup uint32 |
| 8282 | Cookie uint64 |
| 8283 | CookieMask uint64 |
| 8284 | Match Match |
| 8285 | } |
| 8286 | |
| 8287 | type IFlowLightweightStatsRequest interface { |
| 8288 | IStatsRequest |
| 8289 | GetTableId() uint8 |
| 8290 | GetOutPort() Port |
| 8291 | GetOutGroup() uint32 |
| 8292 | GetCookie() uint64 |
| 8293 | GetCookieMask() uint64 |
| 8294 | GetMatch() Match |
| 8295 | } |
| 8296 | |
| 8297 | func (self *FlowLightweightStatsRequest) GetTableId() uint8 { |
| 8298 | return self.TableId |
| 8299 | } |
| 8300 | |
| 8301 | func (self *FlowLightweightStatsRequest) SetTableId(v uint8) { |
| 8302 | self.TableId = v |
| 8303 | } |
| 8304 | |
| 8305 | func (self *FlowLightweightStatsRequest) GetOutPort() Port { |
| 8306 | return self.OutPort |
| 8307 | } |
| 8308 | |
| 8309 | func (self *FlowLightweightStatsRequest) SetOutPort(v Port) { |
| 8310 | self.OutPort = v |
| 8311 | } |
| 8312 | |
| 8313 | func (self *FlowLightweightStatsRequest) GetOutGroup() uint32 { |
| 8314 | return self.OutGroup |
| 8315 | } |
| 8316 | |
| 8317 | func (self *FlowLightweightStatsRequest) SetOutGroup(v uint32) { |
| 8318 | self.OutGroup = v |
| 8319 | } |
| 8320 | |
| 8321 | func (self *FlowLightweightStatsRequest) GetCookie() uint64 { |
| 8322 | return self.Cookie |
| 8323 | } |
| 8324 | |
| 8325 | func (self *FlowLightweightStatsRequest) SetCookie(v uint64) { |
| 8326 | self.Cookie = v |
| 8327 | } |
| 8328 | |
| 8329 | func (self *FlowLightweightStatsRequest) GetCookieMask() uint64 { |
| 8330 | return self.CookieMask |
| 8331 | } |
| 8332 | |
| 8333 | func (self *FlowLightweightStatsRequest) SetCookieMask(v uint64) { |
| 8334 | self.CookieMask = v |
| 8335 | } |
| 8336 | |
| 8337 | func (self *FlowLightweightStatsRequest) GetMatch() Match { |
| 8338 | return self.Match |
| 8339 | } |
| 8340 | |
| 8341 | func (self *FlowLightweightStatsRequest) SetMatch(v Match) { |
| 8342 | self.Match = v |
| 8343 | } |
| 8344 | |
| 8345 | func (self *FlowLightweightStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 8346 | startIndex := len(encoder.Bytes()) |
| 8347 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 8348 | return err |
| 8349 | } |
| 8350 | |
| 8351 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8352 | encoder.PutUint8(uint8(self.TableId)) |
| 8353 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 8354 | self.OutPort.Serialize(encoder) |
| 8355 | encoder.PutUint32(uint32(self.OutGroup)) |
| 8356 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8357 | encoder.PutUint64(uint64(self.Cookie)) |
| 8358 | encoder.PutUint64(uint64(self.CookieMask)) |
| 8359 | if err := self.Match.Serialize(encoder); err != nil { |
| 8360 | return err |
| 8361 | } |
| 8362 | |
| 8363 | length := len(encoder.Bytes()) - startIndex |
| 8364 | |
| 8365 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 8366 | |
| 8367 | return nil |
| 8368 | } |
| 8369 | |
| 8370 | func DecodeFlowLightweightStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*FlowLightweightStatsRequest, error) { |
| 8371 | _flowlightweightstatsrequest := &FlowLightweightStatsRequest{StatsRequest: parent} |
| 8372 | if decoder.Length() < 28 { |
| 8373 | return nil, fmt.Errorf("FlowLightweightStatsRequest packet too short: %d < 28", decoder.Length()) |
| 8374 | } |
| 8375 | decoder.Skip(4) |
| 8376 | _flowlightweightstatsrequest.TableId = uint8(decoder.ReadByte()) |
| 8377 | decoder.Skip(3) |
| 8378 | _flowlightweightstatsrequest.OutPort.Decode(decoder) |
| 8379 | _flowlightweightstatsrequest.OutGroup = uint32(decoder.ReadUint32()) |
| 8380 | decoder.Skip(4) |
| 8381 | _flowlightweightstatsrequest.Cookie = uint64(decoder.ReadUint64()) |
| 8382 | _flowlightweightstatsrequest.CookieMask = uint64(decoder.ReadUint64()) |
| 8383 | if err := _flowlightweightstatsrequest.Match.Decode(decoder); err != nil { |
| 8384 | return nil, err |
| 8385 | } |
| 8386 | |
| 8387 | decoder.SkipAlign() |
| 8388 | return _flowlightweightstatsrequest, nil |
| 8389 | } |
| 8390 | |
| 8391 | func NewFlowLightweightStatsRequest() *FlowLightweightStatsRequest { |
| 8392 | obj := &FlowLightweightStatsRequest{ |
| 8393 | StatsRequest: NewStatsRequest(17), |
| 8394 | } |
| 8395 | return obj |
| 8396 | } |
| 8397 | |
| 8398 | type FlowModFailedErrorMsg struct { |
| 8399 | *ErrorMsg |
| 8400 | Code FlowModFailedCode |
| 8401 | Data []byte |
| 8402 | } |
| 8403 | |
| 8404 | type IFlowModFailedErrorMsg interface { |
| 8405 | IErrorMsg |
| 8406 | GetCode() FlowModFailedCode |
| 8407 | GetData() []byte |
| 8408 | } |
| 8409 | |
| 8410 | func (self *FlowModFailedErrorMsg) GetCode() FlowModFailedCode { |
| 8411 | return self.Code |
| 8412 | } |
| 8413 | |
| 8414 | func (self *FlowModFailedErrorMsg) SetCode(v FlowModFailedCode) { |
| 8415 | self.Code = v |
| 8416 | } |
| 8417 | |
| 8418 | func (self *FlowModFailedErrorMsg) GetData() []byte { |
| 8419 | return self.Data |
| 8420 | } |
| 8421 | |
| 8422 | func (self *FlowModFailedErrorMsg) SetData(v []byte) { |
| 8423 | self.Data = v |
| 8424 | } |
| 8425 | |
| 8426 | func (self *FlowModFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 8427 | startIndex := len(encoder.Bytes()) |
| 8428 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 8429 | return err |
| 8430 | } |
| 8431 | |
| 8432 | encoder.PutUint16(uint16(self.Code)) |
| 8433 | encoder.Write(self.Data) |
| 8434 | length := len(encoder.Bytes()) - startIndex |
| 8435 | |
| 8436 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 8437 | |
| 8438 | return nil |
| 8439 | } |
| 8440 | |
| 8441 | func DecodeFlowModFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*FlowModFailedErrorMsg, error) { |
| 8442 | _flowmodfailederrormsg := &FlowModFailedErrorMsg{ErrorMsg: parent} |
| 8443 | if decoder.Length() < 2 { |
| 8444 | return nil, fmt.Errorf("FlowModFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 8445 | } |
| 8446 | _flowmodfailederrormsg.Code = FlowModFailedCode(decoder.ReadUint16()) |
| 8447 | _flowmodfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 8448 | return _flowmodfailederrormsg, nil |
| 8449 | } |
| 8450 | |
| 8451 | func NewFlowModFailedErrorMsg() *FlowModFailedErrorMsg { |
| 8452 | obj := &FlowModFailedErrorMsg{ |
| 8453 | ErrorMsg: NewErrorMsg(5), |
| 8454 | } |
| 8455 | return obj |
| 8456 | } |
| 8457 | |
| 8458 | type FlowModify struct { |
| 8459 | *FlowMod |
| 8460 | } |
| 8461 | |
| 8462 | type IFlowModify interface { |
| 8463 | IFlowMod |
| 8464 | } |
| 8465 | |
| 8466 | func (self *FlowModify) Serialize(encoder *goloxi.Encoder) error { |
| 8467 | startIndex := len(encoder.Bytes()) |
| 8468 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 8469 | return err |
| 8470 | } |
| 8471 | length := len(encoder.Bytes()) - startIndex |
| 8472 | |
| 8473 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 8474 | |
| 8475 | return nil |
| 8476 | } |
| 8477 | |
| 8478 | func DecodeFlowModify(parent *FlowMod, decoder *goloxi.Decoder) (*FlowModify, error) { |
| 8479 | _flowmodify := &FlowModify{FlowMod: parent} |
| 8480 | return _flowmodify, nil |
| 8481 | } |
| 8482 | |
| 8483 | func NewFlowModify() *FlowModify { |
| 8484 | obj := &FlowModify{ |
| 8485 | FlowMod: NewFlowMod(1), |
| 8486 | } |
| 8487 | return obj |
| 8488 | } |
| 8489 | |
| 8490 | type FlowModifyStrict struct { |
| 8491 | *FlowMod |
| 8492 | } |
| 8493 | |
| 8494 | type IFlowModifyStrict interface { |
| 8495 | IFlowMod |
| 8496 | } |
| 8497 | |
| 8498 | func (self *FlowModifyStrict) Serialize(encoder *goloxi.Encoder) error { |
| 8499 | startIndex := len(encoder.Bytes()) |
| 8500 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 8501 | return err |
| 8502 | } |
| 8503 | length := len(encoder.Bytes()) - startIndex |
| 8504 | |
| 8505 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 8506 | |
| 8507 | return nil |
| 8508 | } |
| 8509 | |
| 8510 | func DecodeFlowModifyStrict(parent *FlowMod, decoder *goloxi.Decoder) (*FlowModifyStrict, error) { |
| 8511 | _flowmodifystrict := &FlowModifyStrict{FlowMod: parent} |
| 8512 | return _flowmodifystrict, nil |
| 8513 | } |
| 8514 | |
| 8515 | func NewFlowModifyStrict() *FlowModifyStrict { |
| 8516 | obj := &FlowModifyStrict{ |
| 8517 | FlowMod: NewFlowMod(2), |
| 8518 | } |
| 8519 | return obj |
| 8520 | } |
| 8521 | |
| 8522 | type FlowMonitorFailedErrorMsg struct { |
| 8523 | *ErrorMsg |
| 8524 | Code FlowMonitorFailedCode |
| 8525 | Data []byte |
| 8526 | } |
| 8527 | |
| 8528 | type IFlowMonitorFailedErrorMsg interface { |
| 8529 | IErrorMsg |
| 8530 | GetCode() FlowMonitorFailedCode |
| 8531 | GetData() []byte |
| 8532 | } |
| 8533 | |
| 8534 | func (self *FlowMonitorFailedErrorMsg) GetCode() FlowMonitorFailedCode { |
| 8535 | return self.Code |
| 8536 | } |
| 8537 | |
| 8538 | func (self *FlowMonitorFailedErrorMsg) SetCode(v FlowMonitorFailedCode) { |
| 8539 | self.Code = v |
| 8540 | } |
| 8541 | |
| 8542 | func (self *FlowMonitorFailedErrorMsg) GetData() []byte { |
| 8543 | return self.Data |
| 8544 | } |
| 8545 | |
| 8546 | func (self *FlowMonitorFailedErrorMsg) SetData(v []byte) { |
| 8547 | self.Data = v |
| 8548 | } |
| 8549 | |
| 8550 | func (self *FlowMonitorFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 8551 | startIndex := len(encoder.Bytes()) |
| 8552 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 8553 | return err |
| 8554 | } |
| 8555 | |
| 8556 | encoder.PutUint16(uint16(self.Code)) |
| 8557 | encoder.Write(self.Data) |
| 8558 | length := len(encoder.Bytes()) - startIndex |
| 8559 | |
| 8560 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 8561 | |
| 8562 | return nil |
| 8563 | } |
| 8564 | |
| 8565 | func DecodeFlowMonitorFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*FlowMonitorFailedErrorMsg, error) { |
| 8566 | _flowmonitorfailederrormsg := &FlowMonitorFailedErrorMsg{ErrorMsg: parent} |
| 8567 | if decoder.Length() < 2 { |
| 8568 | return nil, fmt.Errorf("FlowMonitorFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 8569 | } |
| 8570 | _flowmonitorfailederrormsg.Code = FlowMonitorFailedCode(decoder.ReadUint16()) |
| 8571 | _flowmonitorfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 8572 | return _flowmonitorfailederrormsg, nil |
| 8573 | } |
| 8574 | |
| 8575 | func NewFlowMonitorFailedErrorMsg() *FlowMonitorFailedErrorMsg { |
| 8576 | obj := &FlowMonitorFailedErrorMsg{ |
| 8577 | ErrorMsg: NewErrorMsg(16), |
| 8578 | } |
| 8579 | return obj |
| 8580 | } |
| 8581 | |
| 8582 | type FlowMonitorReply struct { |
| 8583 | *StatsReply |
| 8584 | Entries []IFlowMonitorReplyEntry |
| 8585 | } |
| 8586 | |
| 8587 | type IFlowMonitorReply interface { |
| 8588 | IStatsReply |
| 8589 | GetEntries() []IFlowMonitorReplyEntry |
| 8590 | } |
| 8591 | |
| 8592 | func (self *FlowMonitorReply) GetEntries() []IFlowMonitorReplyEntry { |
| 8593 | return self.Entries |
| 8594 | } |
| 8595 | |
| 8596 | func (self *FlowMonitorReply) SetEntries(v []IFlowMonitorReplyEntry) { |
| 8597 | self.Entries = v |
| 8598 | } |
| 8599 | |
| 8600 | func (self *FlowMonitorReply) Serialize(encoder *goloxi.Encoder) error { |
| 8601 | startIndex := len(encoder.Bytes()) |
| 8602 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 8603 | return err |
| 8604 | } |
| 8605 | |
| 8606 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8607 | for _, obj := range self.Entries { |
| 8608 | if err := obj.Serialize(encoder); err != nil { |
| 8609 | return err |
| 8610 | } |
| 8611 | } |
| 8612 | length := len(encoder.Bytes()) - startIndex |
| 8613 | |
| 8614 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 8615 | |
| 8616 | return nil |
| 8617 | } |
| 8618 | |
| 8619 | func DecodeFlowMonitorReply(parent *StatsReply, decoder *goloxi.Decoder) (*FlowMonitorReply, error) { |
| 8620 | _flowmonitorreply := &FlowMonitorReply{StatsReply: parent} |
| 8621 | if decoder.Length() < 4 { |
| 8622 | return nil, fmt.Errorf("FlowMonitorReply packet too short: %d < 4", decoder.Length()) |
| 8623 | } |
| 8624 | decoder.Skip(4) |
| 8625 | |
| 8626 | for decoder.Length() >= 4 { |
| 8627 | item, err := DecodeFlowMonitorReplyEntry(decoder) |
| 8628 | if err != nil { |
| 8629 | return nil, err |
| 8630 | } |
| 8631 | if item != nil { |
| 8632 | _flowmonitorreply.Entries = append(_flowmonitorreply.Entries, item) |
| 8633 | } |
| 8634 | } |
| 8635 | return _flowmonitorreply, nil |
| 8636 | } |
| 8637 | |
| 8638 | func NewFlowMonitorReply() *FlowMonitorReply { |
| 8639 | obj := &FlowMonitorReply{ |
| 8640 | StatsReply: NewStatsReply(16), |
| 8641 | } |
| 8642 | return obj |
| 8643 | } |
| 8644 | |
| 8645 | type FlowMonitorRequest struct { |
| 8646 | *StatsRequest |
| 8647 | Entries []*FlowMonitorEntry |
| 8648 | } |
| 8649 | |
| 8650 | type IFlowMonitorRequest interface { |
| 8651 | IStatsRequest |
| 8652 | GetEntries() []*FlowMonitorEntry |
| 8653 | } |
| 8654 | |
| 8655 | func (self *FlowMonitorRequest) GetEntries() []*FlowMonitorEntry { |
| 8656 | return self.Entries |
| 8657 | } |
| 8658 | |
| 8659 | func (self *FlowMonitorRequest) SetEntries(v []*FlowMonitorEntry) { |
| 8660 | self.Entries = v |
| 8661 | } |
| 8662 | |
| 8663 | func (self *FlowMonitorRequest) Serialize(encoder *goloxi.Encoder) error { |
| 8664 | startIndex := len(encoder.Bytes()) |
| 8665 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 8666 | return err |
| 8667 | } |
| 8668 | |
| 8669 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8670 | for _, obj := range self.Entries { |
| 8671 | if err := obj.Serialize(encoder); err != nil { |
| 8672 | return err |
| 8673 | } |
| 8674 | } |
| 8675 | length := len(encoder.Bytes()) - startIndex |
| 8676 | |
| 8677 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 8678 | |
| 8679 | return nil |
| 8680 | } |
| 8681 | |
| 8682 | func DecodeFlowMonitorRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*FlowMonitorRequest, error) { |
| 8683 | _flowmonitorrequest := &FlowMonitorRequest{StatsRequest: parent} |
| 8684 | if decoder.Length() < 4 { |
| 8685 | return nil, fmt.Errorf("FlowMonitorRequest packet too short: %d < 4", decoder.Length()) |
| 8686 | } |
| 8687 | decoder.Skip(4) |
| 8688 | |
| 8689 | for decoder.Length() >= 24 { |
| 8690 | item, err := DecodeFlowMonitorEntry(decoder) |
| 8691 | if err != nil { |
| 8692 | return nil, err |
| 8693 | } |
| 8694 | if item != nil { |
| 8695 | _flowmonitorrequest.Entries = append(_flowmonitorrequest.Entries, item) |
| 8696 | } |
| 8697 | } |
| 8698 | return _flowmonitorrequest, nil |
| 8699 | } |
| 8700 | |
| 8701 | func NewFlowMonitorRequest() *FlowMonitorRequest { |
| 8702 | obj := &FlowMonitorRequest{ |
| 8703 | StatsRequest: NewStatsRequest(16), |
| 8704 | } |
| 8705 | return obj |
| 8706 | } |
| 8707 | |
| 8708 | type FlowRemoved struct { |
| 8709 | *Header |
| 8710 | TableId uint8 |
| 8711 | Reason FlowRemovedReason |
| 8712 | Priority uint16 |
| 8713 | IdleTimeout uint16 |
| 8714 | HardTimeout uint16 |
| 8715 | Cookie uint64 |
| 8716 | Match Match |
| 8717 | Stats Stat |
| 8718 | } |
| 8719 | |
| 8720 | type IFlowRemoved interface { |
| 8721 | IHeader |
| 8722 | GetTableId() uint8 |
| 8723 | GetReason() FlowRemovedReason |
| 8724 | GetPriority() uint16 |
| 8725 | GetIdleTimeout() uint16 |
| 8726 | GetHardTimeout() uint16 |
| 8727 | GetCookie() uint64 |
| 8728 | GetMatch() Match |
| 8729 | GetStats() Stat |
| 8730 | } |
| 8731 | |
| 8732 | func (self *FlowRemoved) GetTableId() uint8 { |
| 8733 | return self.TableId |
| 8734 | } |
| 8735 | |
| 8736 | func (self *FlowRemoved) SetTableId(v uint8) { |
| 8737 | self.TableId = v |
| 8738 | } |
| 8739 | |
| 8740 | func (self *FlowRemoved) GetReason() FlowRemovedReason { |
| 8741 | return self.Reason |
| 8742 | } |
| 8743 | |
| 8744 | func (self *FlowRemoved) SetReason(v FlowRemovedReason) { |
| 8745 | self.Reason = v |
| 8746 | } |
| 8747 | |
| 8748 | func (self *FlowRemoved) GetPriority() uint16 { |
| 8749 | return self.Priority |
| 8750 | } |
| 8751 | |
| 8752 | func (self *FlowRemoved) SetPriority(v uint16) { |
| 8753 | self.Priority = v |
| 8754 | } |
| 8755 | |
| 8756 | func (self *FlowRemoved) GetIdleTimeout() uint16 { |
| 8757 | return self.IdleTimeout |
| 8758 | } |
| 8759 | |
| 8760 | func (self *FlowRemoved) SetIdleTimeout(v uint16) { |
| 8761 | self.IdleTimeout = v |
| 8762 | } |
| 8763 | |
| 8764 | func (self *FlowRemoved) GetHardTimeout() uint16 { |
| 8765 | return self.HardTimeout |
| 8766 | } |
| 8767 | |
| 8768 | func (self *FlowRemoved) SetHardTimeout(v uint16) { |
| 8769 | self.HardTimeout = v |
| 8770 | } |
| 8771 | |
| 8772 | func (self *FlowRemoved) GetCookie() uint64 { |
| 8773 | return self.Cookie |
| 8774 | } |
| 8775 | |
| 8776 | func (self *FlowRemoved) SetCookie(v uint64) { |
| 8777 | self.Cookie = v |
| 8778 | } |
| 8779 | |
| 8780 | func (self *FlowRemoved) GetMatch() Match { |
| 8781 | return self.Match |
| 8782 | } |
| 8783 | |
| 8784 | func (self *FlowRemoved) SetMatch(v Match) { |
| 8785 | self.Match = v |
| 8786 | } |
| 8787 | |
| 8788 | func (self *FlowRemoved) GetStats() Stat { |
| 8789 | return self.Stats |
| 8790 | } |
| 8791 | |
| 8792 | func (self *FlowRemoved) SetStats(v Stat) { |
| 8793 | self.Stats = v |
| 8794 | } |
| 8795 | |
| 8796 | func (self *FlowRemoved) Serialize(encoder *goloxi.Encoder) error { |
| 8797 | startIndex := len(encoder.Bytes()) |
| 8798 | if err := self.Header.Serialize(encoder); err != nil { |
| 8799 | return err |
| 8800 | } |
| 8801 | |
| 8802 | encoder.PutUint8(uint8(self.TableId)) |
| 8803 | encoder.PutUint8(uint8(self.Reason)) |
| 8804 | encoder.PutUint16(uint16(self.Priority)) |
| 8805 | encoder.PutUint16(uint16(self.IdleTimeout)) |
| 8806 | encoder.PutUint16(uint16(self.HardTimeout)) |
| 8807 | encoder.PutUint64(uint64(self.Cookie)) |
| 8808 | if err := self.Match.Serialize(encoder); err != nil { |
| 8809 | return err |
| 8810 | } |
| 8811 | |
| 8812 | if err := self.Stats.Serialize(encoder); err != nil { |
| 8813 | return err |
| 8814 | } |
| 8815 | |
| 8816 | length := len(encoder.Bytes()) - startIndex |
| 8817 | |
| 8818 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 8819 | |
| 8820 | return nil |
| 8821 | } |
| 8822 | |
| 8823 | func DecodeFlowRemoved(parent *Header, decoder *goloxi.Decoder) (*FlowRemoved, error) { |
| 8824 | _flowremoved := &FlowRemoved{Header: parent} |
| 8825 | if decoder.Length() < 32 { |
| 8826 | return nil, fmt.Errorf("FlowRemoved packet too short: %d < 32", decoder.Length()) |
| 8827 | } |
| 8828 | _flowremoved.TableId = uint8(decoder.ReadByte()) |
| 8829 | _flowremoved.Reason = FlowRemovedReason(decoder.ReadByte()) |
| 8830 | _flowremoved.Priority = uint16(decoder.ReadUint16()) |
| 8831 | _flowremoved.IdleTimeout = uint16(decoder.ReadUint16()) |
| 8832 | _flowremoved.HardTimeout = uint16(decoder.ReadUint16()) |
| 8833 | _flowremoved.Cookie = uint64(decoder.ReadUint64()) |
| 8834 | if err := _flowremoved.Match.Decode(decoder); err != nil { |
| 8835 | return nil, err |
| 8836 | } |
| 8837 | |
| 8838 | decoder.SkipAlign() |
| 8839 | if err := _flowremoved.Stats.Decode(decoder); err != nil { |
| 8840 | return nil, err |
| 8841 | } |
| 8842 | |
| 8843 | decoder.SkipAlign() |
| 8844 | return _flowremoved, nil |
| 8845 | } |
| 8846 | |
| 8847 | func NewFlowRemoved() *FlowRemoved { |
| 8848 | obj := &FlowRemoved{ |
| 8849 | Header: NewHeader(11), |
| 8850 | } |
| 8851 | return obj |
| 8852 | } |
| 8853 | |
| 8854 | type FlowStatsReply struct { |
| 8855 | *StatsReply |
| 8856 | Entries []*FlowStatsEntry |
| 8857 | } |
| 8858 | |
| 8859 | type IFlowStatsReply interface { |
| 8860 | IStatsReply |
| 8861 | GetEntries() []*FlowStatsEntry |
| 8862 | } |
| 8863 | |
| 8864 | func (self *FlowStatsReply) GetEntries() []*FlowStatsEntry { |
| 8865 | return self.Entries |
| 8866 | } |
| 8867 | |
| 8868 | func (self *FlowStatsReply) SetEntries(v []*FlowStatsEntry) { |
| 8869 | self.Entries = v |
| 8870 | } |
| 8871 | |
| 8872 | func (self *FlowStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 8873 | startIndex := len(encoder.Bytes()) |
| 8874 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 8875 | return err |
| 8876 | } |
| 8877 | |
| 8878 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8879 | for _, obj := range self.Entries { |
| 8880 | if err := obj.Serialize(encoder); err != nil { |
| 8881 | return err |
| 8882 | } |
| 8883 | } |
| 8884 | length := len(encoder.Bytes()) - startIndex |
| 8885 | |
| 8886 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 8887 | |
| 8888 | return nil |
| 8889 | } |
| 8890 | |
| 8891 | func DecodeFlowStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*FlowStatsReply, error) { |
| 8892 | _flowstatsreply := &FlowStatsReply{StatsReply: parent} |
| 8893 | if decoder.Length() < 4 { |
| 8894 | return nil, fmt.Errorf("FlowStatsReply packet too short: %d < 4", decoder.Length()) |
| 8895 | } |
| 8896 | decoder.Skip(4) |
| 8897 | |
| 8898 | for decoder.Length() >= 40 { |
| 8899 | item, err := DecodeFlowStatsEntry(decoder) |
| 8900 | if err != nil { |
| 8901 | return nil, err |
| 8902 | } |
| 8903 | if item != nil { |
| 8904 | _flowstatsreply.Entries = append(_flowstatsreply.Entries, item) |
| 8905 | } |
| 8906 | } |
| 8907 | return _flowstatsreply, nil |
| 8908 | } |
| 8909 | |
| 8910 | func NewFlowStatsReply() *FlowStatsReply { |
| 8911 | obj := &FlowStatsReply{ |
| 8912 | StatsReply: NewStatsReply(1), |
| 8913 | } |
| 8914 | return obj |
| 8915 | } |
| 8916 | |
| 8917 | type FlowStatsRequest struct { |
| 8918 | *StatsRequest |
| 8919 | TableId uint8 |
| 8920 | OutPort Port |
| 8921 | OutGroup uint32 |
| 8922 | Cookie uint64 |
| 8923 | CookieMask uint64 |
| 8924 | Match Match |
| 8925 | } |
| 8926 | |
| 8927 | type IFlowStatsRequest interface { |
| 8928 | IStatsRequest |
| 8929 | GetTableId() uint8 |
| 8930 | GetOutPort() Port |
| 8931 | GetOutGroup() uint32 |
| 8932 | GetCookie() uint64 |
| 8933 | GetCookieMask() uint64 |
| 8934 | GetMatch() Match |
| 8935 | } |
| 8936 | |
| 8937 | func (self *FlowStatsRequest) GetTableId() uint8 { |
| 8938 | return self.TableId |
| 8939 | } |
| 8940 | |
| 8941 | func (self *FlowStatsRequest) SetTableId(v uint8) { |
| 8942 | self.TableId = v |
| 8943 | } |
| 8944 | |
| 8945 | func (self *FlowStatsRequest) GetOutPort() Port { |
| 8946 | return self.OutPort |
| 8947 | } |
| 8948 | |
| 8949 | func (self *FlowStatsRequest) SetOutPort(v Port) { |
| 8950 | self.OutPort = v |
| 8951 | } |
| 8952 | |
| 8953 | func (self *FlowStatsRequest) GetOutGroup() uint32 { |
| 8954 | return self.OutGroup |
| 8955 | } |
| 8956 | |
| 8957 | func (self *FlowStatsRequest) SetOutGroup(v uint32) { |
| 8958 | self.OutGroup = v |
| 8959 | } |
| 8960 | |
| 8961 | func (self *FlowStatsRequest) GetCookie() uint64 { |
| 8962 | return self.Cookie |
| 8963 | } |
| 8964 | |
| 8965 | func (self *FlowStatsRequest) SetCookie(v uint64) { |
| 8966 | self.Cookie = v |
| 8967 | } |
| 8968 | |
| 8969 | func (self *FlowStatsRequest) GetCookieMask() uint64 { |
| 8970 | return self.CookieMask |
| 8971 | } |
| 8972 | |
| 8973 | func (self *FlowStatsRequest) SetCookieMask(v uint64) { |
| 8974 | self.CookieMask = v |
| 8975 | } |
| 8976 | |
| 8977 | func (self *FlowStatsRequest) GetMatch() Match { |
| 8978 | return self.Match |
| 8979 | } |
| 8980 | |
| 8981 | func (self *FlowStatsRequest) SetMatch(v Match) { |
| 8982 | self.Match = v |
| 8983 | } |
| 8984 | |
| 8985 | func (self *FlowStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 8986 | startIndex := len(encoder.Bytes()) |
| 8987 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 8988 | return err |
| 8989 | } |
| 8990 | |
| 8991 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8992 | encoder.PutUint8(uint8(self.TableId)) |
| 8993 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 8994 | self.OutPort.Serialize(encoder) |
| 8995 | encoder.PutUint32(uint32(self.OutGroup)) |
| 8996 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8997 | encoder.PutUint64(uint64(self.Cookie)) |
| 8998 | encoder.PutUint64(uint64(self.CookieMask)) |
| 8999 | if err := self.Match.Serialize(encoder); err != nil { |
| 9000 | return err |
| 9001 | } |
| 9002 | |
| 9003 | length := len(encoder.Bytes()) - startIndex |
| 9004 | |
| 9005 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9006 | |
| 9007 | return nil |
| 9008 | } |
| 9009 | |
| 9010 | func DecodeFlowStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*FlowStatsRequest, error) { |
| 9011 | _flowstatsrequest := &FlowStatsRequest{StatsRequest: parent} |
| 9012 | if decoder.Length() < 28 { |
| 9013 | return nil, fmt.Errorf("FlowStatsRequest packet too short: %d < 28", decoder.Length()) |
| 9014 | } |
| 9015 | decoder.Skip(4) |
| 9016 | _flowstatsrequest.TableId = uint8(decoder.ReadByte()) |
| 9017 | decoder.Skip(3) |
| 9018 | _flowstatsrequest.OutPort.Decode(decoder) |
| 9019 | _flowstatsrequest.OutGroup = uint32(decoder.ReadUint32()) |
| 9020 | decoder.Skip(4) |
| 9021 | _flowstatsrequest.Cookie = uint64(decoder.ReadUint64()) |
| 9022 | _flowstatsrequest.CookieMask = uint64(decoder.ReadUint64()) |
| 9023 | if err := _flowstatsrequest.Match.Decode(decoder); err != nil { |
| 9024 | return nil, err |
| 9025 | } |
| 9026 | |
| 9027 | decoder.SkipAlign() |
| 9028 | return _flowstatsrequest, nil |
| 9029 | } |
| 9030 | |
| 9031 | func NewFlowStatsRequest() *FlowStatsRequest { |
| 9032 | obj := &FlowStatsRequest{ |
| 9033 | StatsRequest: NewStatsRequest(1), |
| 9034 | } |
| 9035 | return obj |
| 9036 | } |
| 9037 | |
| 9038 | type GetConfigReply struct { |
| 9039 | *Header |
| 9040 | Flags ConfigFlags |
| 9041 | MissSendLen uint16 |
| 9042 | } |
| 9043 | |
| 9044 | type IGetConfigReply interface { |
| 9045 | IHeader |
| 9046 | GetFlags() ConfigFlags |
| 9047 | GetMissSendLen() uint16 |
| 9048 | } |
| 9049 | |
| 9050 | func (self *GetConfigReply) GetFlags() ConfigFlags { |
| 9051 | return self.Flags |
| 9052 | } |
| 9053 | |
| 9054 | func (self *GetConfigReply) SetFlags(v ConfigFlags) { |
| 9055 | self.Flags = v |
| 9056 | } |
| 9057 | |
| 9058 | func (self *GetConfigReply) GetMissSendLen() uint16 { |
| 9059 | return self.MissSendLen |
| 9060 | } |
| 9061 | |
| 9062 | func (self *GetConfigReply) SetMissSendLen(v uint16) { |
| 9063 | self.MissSendLen = v |
| 9064 | } |
| 9065 | |
| 9066 | func (self *GetConfigReply) Serialize(encoder *goloxi.Encoder) error { |
| 9067 | startIndex := len(encoder.Bytes()) |
| 9068 | if err := self.Header.Serialize(encoder); err != nil { |
| 9069 | return err |
| 9070 | } |
| 9071 | |
| 9072 | encoder.PutUint16(uint16(self.Flags)) |
| 9073 | encoder.PutUint16(uint16(self.MissSendLen)) |
| 9074 | length := len(encoder.Bytes()) - startIndex |
| 9075 | |
| 9076 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9077 | |
| 9078 | return nil |
| 9079 | } |
| 9080 | |
| 9081 | func DecodeGetConfigReply(parent *Header, decoder *goloxi.Decoder) (*GetConfigReply, error) { |
| 9082 | _getconfigreply := &GetConfigReply{Header: parent} |
| 9083 | if decoder.Length() < 4 { |
| 9084 | return nil, fmt.Errorf("GetConfigReply packet too short: %d < 4", decoder.Length()) |
| 9085 | } |
| 9086 | _getconfigreply.Flags = ConfigFlags(decoder.ReadUint16()) |
| 9087 | _getconfigreply.MissSendLen = uint16(decoder.ReadUint16()) |
| 9088 | return _getconfigreply, nil |
| 9089 | } |
| 9090 | |
| 9091 | func NewGetConfigReply() *GetConfigReply { |
| 9092 | obj := &GetConfigReply{ |
| 9093 | Header: NewHeader(8), |
| 9094 | } |
| 9095 | return obj |
| 9096 | } |
| 9097 | |
| 9098 | type GetConfigRequest struct { |
| 9099 | *Header |
| 9100 | } |
| 9101 | |
| 9102 | type IGetConfigRequest interface { |
| 9103 | IHeader |
| 9104 | } |
| 9105 | |
| 9106 | func (self *GetConfigRequest) Serialize(encoder *goloxi.Encoder) error { |
| 9107 | startIndex := len(encoder.Bytes()) |
| 9108 | if err := self.Header.Serialize(encoder); err != nil { |
| 9109 | return err |
| 9110 | } |
| 9111 | length := len(encoder.Bytes()) - startIndex |
| 9112 | |
| 9113 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9114 | |
| 9115 | return nil |
| 9116 | } |
| 9117 | |
| 9118 | func DecodeGetConfigRequest(parent *Header, decoder *goloxi.Decoder) (*GetConfigRequest, error) { |
| 9119 | _getconfigrequest := &GetConfigRequest{Header: parent} |
| 9120 | return _getconfigrequest, nil |
| 9121 | } |
| 9122 | |
| 9123 | func NewGetConfigRequest() *GetConfigRequest { |
| 9124 | obj := &GetConfigRequest{ |
| 9125 | Header: NewHeader(7), |
| 9126 | } |
| 9127 | return obj |
| 9128 | } |
| 9129 | |
| 9130 | type GroupMod struct { |
| 9131 | *Header |
| 9132 | Command GroupModCommand |
| 9133 | GroupType GroupType |
| 9134 | GroupId uint32 |
| 9135 | BucketArrayLen uint16 |
| 9136 | CommandBucketId GroupBucket |
| 9137 | Buckets []*Bucket |
| 9138 | Properties []IGroupProp |
| 9139 | } |
| 9140 | |
| 9141 | type IGroupMod interface { |
| 9142 | IHeader |
| 9143 | GetCommand() GroupModCommand |
| 9144 | GetGroupType() GroupType |
| 9145 | GetGroupId() uint32 |
| 9146 | GetBucketArrayLen() uint16 |
| 9147 | GetCommandBucketId() GroupBucket |
| 9148 | GetBuckets() []*Bucket |
| 9149 | GetProperties() []IGroupProp |
| 9150 | } |
| 9151 | |
| 9152 | func (self *GroupMod) GetCommand() GroupModCommand { |
| 9153 | return self.Command |
| 9154 | } |
| 9155 | |
| 9156 | func (self *GroupMod) SetCommand(v GroupModCommand) { |
| 9157 | self.Command = v |
| 9158 | } |
| 9159 | |
| 9160 | func (self *GroupMod) GetGroupType() GroupType { |
| 9161 | return self.GroupType |
| 9162 | } |
| 9163 | |
| 9164 | func (self *GroupMod) SetGroupType(v GroupType) { |
| 9165 | self.GroupType = v |
| 9166 | } |
| 9167 | |
| 9168 | func (self *GroupMod) GetGroupId() uint32 { |
| 9169 | return self.GroupId |
| 9170 | } |
| 9171 | |
| 9172 | func (self *GroupMod) SetGroupId(v uint32) { |
| 9173 | self.GroupId = v |
| 9174 | } |
| 9175 | |
| 9176 | func (self *GroupMod) GetBucketArrayLen() uint16 { |
| 9177 | return self.BucketArrayLen |
| 9178 | } |
| 9179 | |
| 9180 | func (self *GroupMod) SetBucketArrayLen(v uint16) { |
| 9181 | self.BucketArrayLen = v |
| 9182 | } |
| 9183 | |
| 9184 | func (self *GroupMod) GetCommandBucketId() GroupBucket { |
| 9185 | return self.CommandBucketId |
| 9186 | } |
| 9187 | |
| 9188 | func (self *GroupMod) SetCommandBucketId(v GroupBucket) { |
| 9189 | self.CommandBucketId = v |
| 9190 | } |
| 9191 | |
| 9192 | func (self *GroupMod) GetBuckets() []*Bucket { |
| 9193 | return self.Buckets |
| 9194 | } |
| 9195 | |
| 9196 | func (self *GroupMod) SetBuckets(v []*Bucket) { |
| 9197 | self.Buckets = v |
| 9198 | } |
| 9199 | |
| 9200 | func (self *GroupMod) GetProperties() []IGroupProp { |
| 9201 | return self.Properties |
| 9202 | } |
| 9203 | |
| 9204 | func (self *GroupMod) SetProperties(v []IGroupProp) { |
| 9205 | self.Properties = v |
| 9206 | } |
| 9207 | |
| 9208 | func (self *GroupMod) Serialize(encoder *goloxi.Encoder) error { |
| 9209 | if err := self.Header.Serialize(encoder); err != nil { |
| 9210 | return err |
| 9211 | } |
| 9212 | |
| 9213 | encoder.PutUint16(uint16(self.Command)) |
| 9214 | encoder.PutUint8(uint8(self.GroupType)) |
| 9215 | encoder.Write(bytes.Repeat([]byte{0}, 1)) |
| 9216 | encoder.PutUint32(uint32(self.GroupId)) |
| 9217 | encoder.PutUint16(uint16(self.BucketArrayLen)) |
| 9218 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 9219 | encoder.PutUint32(uint32(self.CommandBucketId)) |
| 9220 | for _, obj := range self.Buckets { |
| 9221 | if err := obj.Serialize(encoder); err != nil { |
| 9222 | return err |
| 9223 | } |
| 9224 | } |
| 9225 | for _, obj := range self.Properties { |
| 9226 | if err := obj.Serialize(encoder); err != nil { |
| 9227 | return err |
| 9228 | } |
| 9229 | } |
| 9230 | |
| 9231 | return nil |
| 9232 | } |
| 9233 | |
| 9234 | func DecodeGroupMod(parent *Header, decoder *goloxi.Decoder) (IGroupMod, error) { |
| 9235 | _groupmod := &GroupMod{Header: parent} |
| 9236 | if decoder.Length() < 16 { |
| 9237 | return nil, fmt.Errorf("GroupMod packet too short: %d < 16", decoder.Length()) |
| 9238 | } |
| 9239 | _groupmod.Command = GroupModCommand(decoder.ReadUint16()) |
| 9240 | _groupmod.GroupType = GroupType(decoder.ReadByte()) |
| 9241 | decoder.Skip(1) |
| 9242 | _groupmod.GroupId = uint32(decoder.ReadUint32()) |
| 9243 | _groupmod.BucketArrayLen = uint16(decoder.ReadUint16()) |
| 9244 | decoder.Skip(2) |
| 9245 | _groupmod.CommandBucketId = GroupBucket(decoder.ReadUint32()) |
| 9246 | |
| 9247 | end := decoder.Offset() + int(_groupmod.BucketArrayLen) |
| 9248 | for decoder.Offset() < end { |
| 9249 | item, err := DecodeBucket(decoder) |
| 9250 | if err != nil { |
| 9251 | return nil, err |
| 9252 | } |
| 9253 | if item != nil { |
| 9254 | _groupmod.Buckets = append(_groupmod.Buckets, item) |
| 9255 | } |
| 9256 | } |
| 9257 | |
| 9258 | for decoder.Length() >= 4 { |
| 9259 | item, err := DecodeGroupProp(decoder) |
| 9260 | if err != nil { |
| 9261 | return nil, err |
| 9262 | } |
| 9263 | if item != nil { |
| 9264 | _groupmod.Properties = append(_groupmod.Properties, item) |
| 9265 | } |
| 9266 | } |
| 9267 | |
| 9268 | switch _groupmod.Command { |
| 9269 | case 0: |
| 9270 | return DecodeGroupAdd(_groupmod, decoder) |
| 9271 | case 1: |
| 9272 | return DecodeGroupModify(_groupmod, decoder) |
| 9273 | case 2: |
| 9274 | return DecodeGroupDelete(_groupmod, decoder) |
| 9275 | case 3: |
| 9276 | return DecodeGroupInsertBucket(_groupmod, decoder) |
| 9277 | case 5: |
| 9278 | return DecodeGroupRemoveBucket(_groupmod, decoder) |
| 9279 | default: |
| 9280 | return nil, fmt.Errorf("Invalid type '%d' for 'GroupMod'", _groupmod.Command) |
| 9281 | } |
| 9282 | } |
| 9283 | |
| 9284 | func NewGroupMod(_command GroupModCommand) *GroupMod { |
| 9285 | obj := &GroupMod{ |
| 9286 | Header: NewHeader(15), |
| 9287 | } |
| 9288 | obj.Command = _command |
| 9289 | return obj |
| 9290 | } |
| 9291 | |
| 9292 | type GroupAdd struct { |
| 9293 | *GroupMod |
| 9294 | } |
| 9295 | |
| 9296 | type IGroupAdd interface { |
| 9297 | IGroupMod |
| 9298 | } |
| 9299 | |
| 9300 | func (self *GroupAdd) Serialize(encoder *goloxi.Encoder) error { |
| 9301 | startIndex := len(encoder.Bytes()) |
| 9302 | if err := self.GroupMod.Serialize(encoder); err != nil { |
| 9303 | return err |
| 9304 | } |
| 9305 | length := len(encoder.Bytes()) - startIndex |
| 9306 | |
| 9307 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9308 | |
| 9309 | return nil |
| 9310 | } |
| 9311 | |
| 9312 | func DecodeGroupAdd(parent *GroupMod, decoder *goloxi.Decoder) (*GroupAdd, error) { |
| 9313 | _groupadd := &GroupAdd{GroupMod: parent} |
| 9314 | return _groupadd, nil |
| 9315 | } |
| 9316 | |
| 9317 | func NewGroupAdd() *GroupAdd { |
| 9318 | obj := &GroupAdd{ |
| 9319 | GroupMod: NewGroupMod(0), |
| 9320 | } |
| 9321 | return obj |
| 9322 | } |
| 9323 | |
| 9324 | type GroupDelete struct { |
| 9325 | *GroupMod |
| 9326 | } |
| 9327 | |
| 9328 | type IGroupDelete interface { |
| 9329 | IGroupMod |
| 9330 | } |
| 9331 | |
| 9332 | func (self *GroupDelete) Serialize(encoder *goloxi.Encoder) error { |
| 9333 | startIndex := len(encoder.Bytes()) |
| 9334 | if err := self.GroupMod.Serialize(encoder); err != nil { |
| 9335 | return err |
| 9336 | } |
| 9337 | length := len(encoder.Bytes()) - startIndex |
| 9338 | |
| 9339 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9340 | |
| 9341 | return nil |
| 9342 | } |
| 9343 | |
| 9344 | func DecodeGroupDelete(parent *GroupMod, decoder *goloxi.Decoder) (*GroupDelete, error) { |
| 9345 | _groupdelete := &GroupDelete{GroupMod: parent} |
| 9346 | return _groupdelete, nil |
| 9347 | } |
| 9348 | |
| 9349 | func NewGroupDelete() *GroupDelete { |
| 9350 | obj := &GroupDelete{ |
| 9351 | GroupMod: NewGroupMod(2), |
| 9352 | } |
| 9353 | return obj |
| 9354 | } |
| 9355 | |
| 9356 | type GroupDescStatsReply struct { |
| 9357 | *StatsReply |
| 9358 | Entries []*GroupDescStatsEntry |
| 9359 | } |
| 9360 | |
| 9361 | type IGroupDescStatsReply interface { |
| 9362 | IStatsReply |
| 9363 | GetEntries() []*GroupDescStatsEntry |
| 9364 | } |
| 9365 | |
| 9366 | func (self *GroupDescStatsReply) GetEntries() []*GroupDescStatsEntry { |
| 9367 | return self.Entries |
| 9368 | } |
| 9369 | |
| 9370 | func (self *GroupDescStatsReply) SetEntries(v []*GroupDescStatsEntry) { |
| 9371 | self.Entries = v |
| 9372 | } |
| 9373 | |
| 9374 | func (self *GroupDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 9375 | startIndex := len(encoder.Bytes()) |
| 9376 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 9377 | return err |
| 9378 | } |
| 9379 | |
| 9380 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9381 | for _, obj := range self.Entries { |
| 9382 | if err := obj.Serialize(encoder); err != nil { |
| 9383 | return err |
| 9384 | } |
| 9385 | } |
| 9386 | length := len(encoder.Bytes()) - startIndex |
| 9387 | |
| 9388 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9389 | |
| 9390 | return nil |
| 9391 | } |
| 9392 | |
| 9393 | func DecodeGroupDescStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*GroupDescStatsReply, error) { |
| 9394 | _groupdescstatsreply := &GroupDescStatsReply{StatsReply: parent} |
| 9395 | if decoder.Length() < 4 { |
| 9396 | return nil, fmt.Errorf("GroupDescStatsReply packet too short: %d < 4", decoder.Length()) |
| 9397 | } |
| 9398 | decoder.Skip(4) |
| 9399 | |
| 9400 | for decoder.Length() >= 16 { |
| 9401 | item, err := DecodeGroupDescStatsEntry(decoder) |
| 9402 | if err != nil { |
| 9403 | return nil, err |
| 9404 | } |
| 9405 | if item != nil { |
| 9406 | _groupdescstatsreply.Entries = append(_groupdescstatsreply.Entries, item) |
| 9407 | } |
| 9408 | } |
| 9409 | return _groupdescstatsreply, nil |
| 9410 | } |
| 9411 | |
| 9412 | func NewGroupDescStatsReply() *GroupDescStatsReply { |
| 9413 | obj := &GroupDescStatsReply{ |
| 9414 | StatsReply: NewStatsReply(7), |
| 9415 | } |
| 9416 | return obj |
| 9417 | } |
| 9418 | |
| 9419 | type GroupDescStatsRequest struct { |
| 9420 | *StatsRequest |
| 9421 | GroupId uint32 |
| 9422 | } |
| 9423 | |
| 9424 | type IGroupDescStatsRequest interface { |
| 9425 | IStatsRequest |
| 9426 | GetGroupId() uint32 |
| 9427 | } |
| 9428 | |
| 9429 | func (self *GroupDescStatsRequest) GetGroupId() uint32 { |
| 9430 | return self.GroupId |
| 9431 | } |
| 9432 | |
| 9433 | func (self *GroupDescStatsRequest) SetGroupId(v uint32) { |
| 9434 | self.GroupId = v |
| 9435 | } |
| 9436 | |
| 9437 | func (self *GroupDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 9438 | startIndex := len(encoder.Bytes()) |
| 9439 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 9440 | return err |
| 9441 | } |
| 9442 | |
| 9443 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9444 | encoder.PutUint32(uint32(self.GroupId)) |
| 9445 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9446 | length := len(encoder.Bytes()) - startIndex |
| 9447 | |
| 9448 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9449 | |
| 9450 | return nil |
| 9451 | } |
| 9452 | |
| 9453 | func DecodeGroupDescStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*GroupDescStatsRequest, error) { |
| 9454 | _groupdescstatsrequest := &GroupDescStatsRequest{StatsRequest: parent} |
| 9455 | if decoder.Length() < 4 { |
| 9456 | return nil, fmt.Errorf("GroupDescStatsRequest packet too short: %d < 4", decoder.Length()) |
| 9457 | } |
| 9458 | decoder.Skip(4) |
| 9459 | _groupdescstatsrequest.GroupId = uint32(decoder.ReadUint32()) |
| 9460 | decoder.Skip(4) |
| 9461 | return _groupdescstatsrequest, nil |
| 9462 | } |
| 9463 | |
| 9464 | func NewGroupDescStatsRequest() *GroupDescStatsRequest { |
| 9465 | obj := &GroupDescStatsRequest{ |
| 9466 | StatsRequest: NewStatsRequest(7), |
| 9467 | } |
| 9468 | return obj |
| 9469 | } |
| 9470 | |
| 9471 | type GroupFeaturesStatsReply struct { |
| 9472 | *StatsReply |
| 9473 | Types uint32 |
| 9474 | Capabilities GroupCapabilities |
| 9475 | MaxGroupsAll uint32 |
| 9476 | MaxGroupsSelect uint32 |
| 9477 | MaxGroupsIndirect uint32 |
| 9478 | MaxGroupsFf uint32 |
| 9479 | ActionsAll uint32 |
| 9480 | ActionsSelect uint32 |
| 9481 | ActionsIndirect uint32 |
| 9482 | ActionsFf uint32 |
| 9483 | } |
| 9484 | |
| 9485 | type IGroupFeaturesStatsReply interface { |
| 9486 | IStatsReply |
| 9487 | GetTypes() uint32 |
| 9488 | GetCapabilities() GroupCapabilities |
| 9489 | GetMaxGroupsAll() uint32 |
| 9490 | GetMaxGroupsSelect() uint32 |
| 9491 | GetMaxGroupsIndirect() uint32 |
| 9492 | GetMaxGroupsFf() uint32 |
| 9493 | GetActionsAll() uint32 |
| 9494 | GetActionsSelect() uint32 |
| 9495 | GetActionsIndirect() uint32 |
| 9496 | GetActionsFf() uint32 |
| 9497 | } |
| 9498 | |
| 9499 | func (self *GroupFeaturesStatsReply) GetTypes() uint32 { |
| 9500 | return self.Types |
| 9501 | } |
| 9502 | |
| 9503 | func (self *GroupFeaturesStatsReply) SetTypes(v uint32) { |
| 9504 | self.Types = v |
| 9505 | } |
| 9506 | |
| 9507 | func (self *GroupFeaturesStatsReply) GetCapabilities() GroupCapabilities { |
| 9508 | return self.Capabilities |
| 9509 | } |
| 9510 | |
| 9511 | func (self *GroupFeaturesStatsReply) SetCapabilities(v GroupCapabilities) { |
| 9512 | self.Capabilities = v |
| 9513 | } |
| 9514 | |
| 9515 | func (self *GroupFeaturesStatsReply) GetMaxGroupsAll() uint32 { |
| 9516 | return self.MaxGroupsAll |
| 9517 | } |
| 9518 | |
| 9519 | func (self *GroupFeaturesStatsReply) SetMaxGroupsAll(v uint32) { |
| 9520 | self.MaxGroupsAll = v |
| 9521 | } |
| 9522 | |
| 9523 | func (self *GroupFeaturesStatsReply) GetMaxGroupsSelect() uint32 { |
| 9524 | return self.MaxGroupsSelect |
| 9525 | } |
| 9526 | |
| 9527 | func (self *GroupFeaturesStatsReply) SetMaxGroupsSelect(v uint32) { |
| 9528 | self.MaxGroupsSelect = v |
| 9529 | } |
| 9530 | |
| 9531 | func (self *GroupFeaturesStatsReply) GetMaxGroupsIndirect() uint32 { |
| 9532 | return self.MaxGroupsIndirect |
| 9533 | } |
| 9534 | |
| 9535 | func (self *GroupFeaturesStatsReply) SetMaxGroupsIndirect(v uint32) { |
| 9536 | self.MaxGroupsIndirect = v |
| 9537 | } |
| 9538 | |
| 9539 | func (self *GroupFeaturesStatsReply) GetMaxGroupsFf() uint32 { |
| 9540 | return self.MaxGroupsFf |
| 9541 | } |
| 9542 | |
| 9543 | func (self *GroupFeaturesStatsReply) SetMaxGroupsFf(v uint32) { |
| 9544 | self.MaxGroupsFf = v |
| 9545 | } |
| 9546 | |
| 9547 | func (self *GroupFeaturesStatsReply) GetActionsAll() uint32 { |
| 9548 | return self.ActionsAll |
| 9549 | } |
| 9550 | |
| 9551 | func (self *GroupFeaturesStatsReply) SetActionsAll(v uint32) { |
| 9552 | self.ActionsAll = v |
| 9553 | } |
| 9554 | |
| 9555 | func (self *GroupFeaturesStatsReply) GetActionsSelect() uint32 { |
| 9556 | return self.ActionsSelect |
| 9557 | } |
| 9558 | |
| 9559 | func (self *GroupFeaturesStatsReply) SetActionsSelect(v uint32) { |
| 9560 | self.ActionsSelect = v |
| 9561 | } |
| 9562 | |
| 9563 | func (self *GroupFeaturesStatsReply) GetActionsIndirect() uint32 { |
| 9564 | return self.ActionsIndirect |
| 9565 | } |
| 9566 | |
| 9567 | func (self *GroupFeaturesStatsReply) SetActionsIndirect(v uint32) { |
| 9568 | self.ActionsIndirect = v |
| 9569 | } |
| 9570 | |
| 9571 | func (self *GroupFeaturesStatsReply) GetActionsFf() uint32 { |
| 9572 | return self.ActionsFf |
| 9573 | } |
| 9574 | |
| 9575 | func (self *GroupFeaturesStatsReply) SetActionsFf(v uint32) { |
| 9576 | self.ActionsFf = v |
| 9577 | } |
| 9578 | |
| 9579 | func (self *GroupFeaturesStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 9580 | startIndex := len(encoder.Bytes()) |
| 9581 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 9582 | return err |
| 9583 | } |
| 9584 | |
| 9585 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9586 | encoder.PutUint32(uint32(self.Types)) |
| 9587 | encoder.PutUint32(uint32(self.Capabilities)) |
| 9588 | encoder.PutUint32(uint32(self.MaxGroupsAll)) |
| 9589 | encoder.PutUint32(uint32(self.MaxGroupsSelect)) |
| 9590 | encoder.PutUint32(uint32(self.MaxGroupsIndirect)) |
| 9591 | encoder.PutUint32(uint32(self.MaxGroupsFf)) |
| 9592 | encoder.PutUint32(uint32(self.ActionsAll)) |
| 9593 | encoder.PutUint32(uint32(self.ActionsSelect)) |
| 9594 | encoder.PutUint32(uint32(self.ActionsIndirect)) |
| 9595 | encoder.PutUint32(uint32(self.ActionsFf)) |
| 9596 | length := len(encoder.Bytes()) - startIndex |
| 9597 | |
| 9598 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9599 | |
| 9600 | return nil |
| 9601 | } |
| 9602 | |
| 9603 | func DecodeGroupFeaturesStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*GroupFeaturesStatsReply, error) { |
| 9604 | _groupfeaturesstatsreply := &GroupFeaturesStatsReply{StatsReply: parent} |
| 9605 | if decoder.Length() < 44 { |
| 9606 | return nil, fmt.Errorf("GroupFeaturesStatsReply packet too short: %d < 44", decoder.Length()) |
| 9607 | } |
| 9608 | decoder.Skip(4) |
| 9609 | _groupfeaturesstatsreply.Types = uint32(decoder.ReadUint32()) |
| 9610 | _groupfeaturesstatsreply.Capabilities = GroupCapabilities(decoder.ReadUint32()) |
| 9611 | _groupfeaturesstatsreply.MaxGroupsAll = uint32(decoder.ReadUint32()) |
| 9612 | _groupfeaturesstatsreply.MaxGroupsSelect = uint32(decoder.ReadUint32()) |
| 9613 | _groupfeaturesstatsreply.MaxGroupsIndirect = uint32(decoder.ReadUint32()) |
| 9614 | _groupfeaturesstatsreply.MaxGroupsFf = uint32(decoder.ReadUint32()) |
| 9615 | _groupfeaturesstatsreply.ActionsAll = uint32(decoder.ReadUint32()) |
| 9616 | _groupfeaturesstatsreply.ActionsSelect = uint32(decoder.ReadUint32()) |
| 9617 | _groupfeaturesstatsreply.ActionsIndirect = uint32(decoder.ReadUint32()) |
| 9618 | _groupfeaturesstatsreply.ActionsFf = uint32(decoder.ReadUint32()) |
| 9619 | return _groupfeaturesstatsreply, nil |
| 9620 | } |
| 9621 | |
| 9622 | func NewGroupFeaturesStatsReply() *GroupFeaturesStatsReply { |
| 9623 | obj := &GroupFeaturesStatsReply{ |
| 9624 | StatsReply: NewStatsReply(8), |
| 9625 | } |
| 9626 | return obj |
| 9627 | } |
| 9628 | |
| 9629 | type GroupFeaturesStatsRequest struct { |
| 9630 | *StatsRequest |
| 9631 | } |
| 9632 | |
| 9633 | type IGroupFeaturesStatsRequest interface { |
| 9634 | IStatsRequest |
| 9635 | } |
| 9636 | |
| 9637 | func (self *GroupFeaturesStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 9638 | startIndex := len(encoder.Bytes()) |
| 9639 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 9640 | return err |
| 9641 | } |
| 9642 | |
| 9643 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9644 | length := len(encoder.Bytes()) - startIndex |
| 9645 | |
| 9646 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9647 | |
| 9648 | return nil |
| 9649 | } |
| 9650 | |
| 9651 | func DecodeGroupFeaturesStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*GroupFeaturesStatsRequest, error) { |
| 9652 | _groupfeaturesstatsrequest := &GroupFeaturesStatsRequest{StatsRequest: parent} |
| 9653 | if decoder.Length() < 4 { |
| 9654 | return nil, fmt.Errorf("GroupFeaturesStatsRequest packet too short: %d < 4", decoder.Length()) |
| 9655 | } |
| 9656 | decoder.Skip(4) |
| 9657 | return _groupfeaturesstatsrequest, nil |
| 9658 | } |
| 9659 | |
| 9660 | func NewGroupFeaturesStatsRequest() *GroupFeaturesStatsRequest { |
| 9661 | obj := &GroupFeaturesStatsRequest{ |
| 9662 | StatsRequest: NewStatsRequest(8), |
| 9663 | } |
| 9664 | return obj |
| 9665 | } |
| 9666 | |
| 9667 | type GroupInsertBucket struct { |
| 9668 | *GroupMod |
| 9669 | } |
| 9670 | |
| 9671 | type IGroupInsertBucket interface { |
| 9672 | IGroupMod |
| 9673 | } |
| 9674 | |
| 9675 | func (self *GroupInsertBucket) Serialize(encoder *goloxi.Encoder) error { |
| 9676 | startIndex := len(encoder.Bytes()) |
| 9677 | if err := self.GroupMod.Serialize(encoder); err != nil { |
| 9678 | return err |
| 9679 | } |
| 9680 | length := len(encoder.Bytes()) - startIndex |
| 9681 | |
| 9682 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9683 | |
| 9684 | return nil |
| 9685 | } |
| 9686 | |
| 9687 | func DecodeGroupInsertBucket(parent *GroupMod, decoder *goloxi.Decoder) (*GroupInsertBucket, error) { |
| 9688 | _groupinsertbucket := &GroupInsertBucket{GroupMod: parent} |
| 9689 | return _groupinsertbucket, nil |
| 9690 | } |
| 9691 | |
| 9692 | func NewGroupInsertBucket() *GroupInsertBucket { |
| 9693 | obj := &GroupInsertBucket{ |
| 9694 | GroupMod: NewGroupMod(3), |
| 9695 | } |
| 9696 | return obj |
| 9697 | } |
| 9698 | |
| 9699 | type GroupModFailedErrorMsg struct { |
| 9700 | *ErrorMsg |
| 9701 | Code GroupModFailedCode |
| 9702 | Data []byte |
| 9703 | } |
| 9704 | |
| 9705 | type IGroupModFailedErrorMsg interface { |
| 9706 | IErrorMsg |
| 9707 | GetCode() GroupModFailedCode |
| 9708 | GetData() []byte |
| 9709 | } |
| 9710 | |
| 9711 | func (self *GroupModFailedErrorMsg) GetCode() GroupModFailedCode { |
| 9712 | return self.Code |
| 9713 | } |
| 9714 | |
| 9715 | func (self *GroupModFailedErrorMsg) SetCode(v GroupModFailedCode) { |
| 9716 | self.Code = v |
| 9717 | } |
| 9718 | |
| 9719 | func (self *GroupModFailedErrorMsg) GetData() []byte { |
| 9720 | return self.Data |
| 9721 | } |
| 9722 | |
| 9723 | func (self *GroupModFailedErrorMsg) SetData(v []byte) { |
| 9724 | self.Data = v |
| 9725 | } |
| 9726 | |
| 9727 | func (self *GroupModFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 9728 | startIndex := len(encoder.Bytes()) |
| 9729 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 9730 | return err |
| 9731 | } |
| 9732 | |
| 9733 | encoder.PutUint16(uint16(self.Code)) |
| 9734 | encoder.Write(self.Data) |
| 9735 | length := len(encoder.Bytes()) - startIndex |
| 9736 | |
| 9737 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9738 | |
| 9739 | return nil |
| 9740 | } |
| 9741 | |
| 9742 | func DecodeGroupModFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*GroupModFailedErrorMsg, error) { |
| 9743 | _groupmodfailederrormsg := &GroupModFailedErrorMsg{ErrorMsg: parent} |
| 9744 | if decoder.Length() < 2 { |
| 9745 | return nil, fmt.Errorf("GroupModFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 9746 | } |
| 9747 | _groupmodfailederrormsg.Code = GroupModFailedCode(decoder.ReadUint16()) |
| 9748 | _groupmodfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 9749 | return _groupmodfailederrormsg, nil |
| 9750 | } |
| 9751 | |
| 9752 | func NewGroupModFailedErrorMsg() *GroupModFailedErrorMsg { |
| 9753 | obj := &GroupModFailedErrorMsg{ |
| 9754 | ErrorMsg: NewErrorMsg(6), |
| 9755 | } |
| 9756 | return obj |
| 9757 | } |
| 9758 | |
| 9759 | type GroupModify struct { |
| 9760 | *GroupMod |
| 9761 | } |
| 9762 | |
| 9763 | type IGroupModify interface { |
| 9764 | IGroupMod |
| 9765 | } |
| 9766 | |
| 9767 | func (self *GroupModify) Serialize(encoder *goloxi.Encoder) error { |
| 9768 | startIndex := len(encoder.Bytes()) |
| 9769 | if err := self.GroupMod.Serialize(encoder); err != nil { |
| 9770 | return err |
| 9771 | } |
| 9772 | length := len(encoder.Bytes()) - startIndex |
| 9773 | |
| 9774 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9775 | |
| 9776 | return nil |
| 9777 | } |
| 9778 | |
| 9779 | func DecodeGroupModify(parent *GroupMod, decoder *goloxi.Decoder) (*GroupModify, error) { |
| 9780 | _groupmodify := &GroupModify{GroupMod: parent} |
| 9781 | return _groupmodify, nil |
| 9782 | } |
| 9783 | |
| 9784 | func NewGroupModify() *GroupModify { |
| 9785 | obj := &GroupModify{ |
| 9786 | GroupMod: NewGroupMod(1), |
| 9787 | } |
| 9788 | return obj |
| 9789 | } |
| 9790 | |
| 9791 | type GroupRemoveBucket struct { |
| 9792 | *GroupMod |
| 9793 | } |
| 9794 | |
| 9795 | type IGroupRemoveBucket interface { |
| 9796 | IGroupMod |
| 9797 | } |
| 9798 | |
| 9799 | func (self *GroupRemoveBucket) Serialize(encoder *goloxi.Encoder) error { |
| 9800 | startIndex := len(encoder.Bytes()) |
| 9801 | if err := self.GroupMod.Serialize(encoder); err != nil { |
| 9802 | return err |
| 9803 | } |
| 9804 | length := len(encoder.Bytes()) - startIndex |
| 9805 | |
| 9806 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9807 | |
| 9808 | return nil |
| 9809 | } |
| 9810 | |
| 9811 | func DecodeGroupRemoveBucket(parent *GroupMod, decoder *goloxi.Decoder) (*GroupRemoveBucket, error) { |
| 9812 | _groupremovebucket := &GroupRemoveBucket{GroupMod: parent} |
| 9813 | return _groupremovebucket, nil |
| 9814 | } |
| 9815 | |
| 9816 | func NewGroupRemoveBucket() *GroupRemoveBucket { |
| 9817 | obj := &GroupRemoveBucket{ |
| 9818 | GroupMod: NewGroupMod(5), |
| 9819 | } |
| 9820 | return obj |
| 9821 | } |
| 9822 | |
| 9823 | type GroupStatsReply struct { |
| 9824 | *StatsReply |
| 9825 | Entries []*GroupStatsEntry |
| 9826 | } |
| 9827 | |
| 9828 | type IGroupStatsReply interface { |
| 9829 | IStatsReply |
| 9830 | GetEntries() []*GroupStatsEntry |
| 9831 | } |
| 9832 | |
| 9833 | func (self *GroupStatsReply) GetEntries() []*GroupStatsEntry { |
| 9834 | return self.Entries |
| 9835 | } |
| 9836 | |
| 9837 | func (self *GroupStatsReply) SetEntries(v []*GroupStatsEntry) { |
| 9838 | self.Entries = v |
| 9839 | } |
| 9840 | |
| 9841 | func (self *GroupStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 9842 | startIndex := len(encoder.Bytes()) |
| 9843 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 9844 | return err |
| 9845 | } |
| 9846 | |
| 9847 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9848 | for _, obj := range self.Entries { |
| 9849 | if err := obj.Serialize(encoder); err != nil { |
| 9850 | return err |
| 9851 | } |
| 9852 | } |
| 9853 | length := len(encoder.Bytes()) - startIndex |
| 9854 | |
| 9855 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9856 | |
| 9857 | return nil |
| 9858 | } |
| 9859 | |
| 9860 | func DecodeGroupStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*GroupStatsReply, error) { |
| 9861 | _groupstatsreply := &GroupStatsReply{StatsReply: parent} |
| 9862 | if decoder.Length() < 4 { |
| 9863 | return nil, fmt.Errorf("GroupStatsReply packet too short: %d < 4", decoder.Length()) |
| 9864 | } |
| 9865 | decoder.Skip(4) |
| 9866 | |
| 9867 | for decoder.Length() >= 40 { |
| 9868 | item, err := DecodeGroupStatsEntry(decoder) |
| 9869 | if err != nil { |
| 9870 | return nil, err |
| 9871 | } |
| 9872 | if item != nil { |
| 9873 | _groupstatsreply.Entries = append(_groupstatsreply.Entries, item) |
| 9874 | } |
| 9875 | } |
| 9876 | return _groupstatsreply, nil |
| 9877 | } |
| 9878 | |
| 9879 | func NewGroupStatsReply() *GroupStatsReply { |
| 9880 | obj := &GroupStatsReply{ |
| 9881 | StatsReply: NewStatsReply(6), |
| 9882 | } |
| 9883 | return obj |
| 9884 | } |
| 9885 | |
| 9886 | type GroupStatsRequest struct { |
| 9887 | *StatsRequest |
| 9888 | GroupId uint32 |
| 9889 | } |
| 9890 | |
| 9891 | type IGroupStatsRequest interface { |
| 9892 | IStatsRequest |
| 9893 | GetGroupId() uint32 |
| 9894 | } |
| 9895 | |
| 9896 | func (self *GroupStatsRequest) GetGroupId() uint32 { |
| 9897 | return self.GroupId |
| 9898 | } |
| 9899 | |
| 9900 | func (self *GroupStatsRequest) SetGroupId(v uint32) { |
| 9901 | self.GroupId = v |
| 9902 | } |
| 9903 | |
| 9904 | func (self *GroupStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 9905 | startIndex := len(encoder.Bytes()) |
| 9906 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 9907 | return err |
| 9908 | } |
| 9909 | |
| 9910 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9911 | encoder.PutUint32(uint32(self.GroupId)) |
| 9912 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9913 | length := len(encoder.Bytes()) - startIndex |
| 9914 | |
| 9915 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9916 | |
| 9917 | return nil |
| 9918 | } |
| 9919 | |
| 9920 | func DecodeGroupStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*GroupStatsRequest, error) { |
| 9921 | _groupstatsrequest := &GroupStatsRequest{StatsRequest: parent} |
| 9922 | if decoder.Length() < 4 { |
| 9923 | return nil, fmt.Errorf("GroupStatsRequest packet too short: %d < 4", decoder.Length()) |
| 9924 | } |
| 9925 | decoder.Skip(4) |
| 9926 | _groupstatsrequest.GroupId = uint32(decoder.ReadUint32()) |
| 9927 | decoder.Skip(4) |
| 9928 | return _groupstatsrequest, nil |
| 9929 | } |
| 9930 | |
| 9931 | func NewGroupStatsRequest() *GroupStatsRequest { |
| 9932 | obj := &GroupStatsRequest{ |
| 9933 | StatsRequest: NewStatsRequest(6), |
| 9934 | } |
| 9935 | return obj |
| 9936 | } |
| 9937 | |
| 9938 | type Hello struct { |
| 9939 | *Header |
| 9940 | Elements []IHelloElem |
| 9941 | } |
| 9942 | |
| 9943 | type IHello interface { |
| 9944 | IHeader |
| 9945 | GetElements() []IHelloElem |
| 9946 | } |
| 9947 | |
| 9948 | func (self *Hello) GetElements() []IHelloElem { |
| 9949 | return self.Elements |
| 9950 | } |
| 9951 | |
| 9952 | func (self *Hello) SetElements(v []IHelloElem) { |
| 9953 | self.Elements = v |
| 9954 | } |
| 9955 | |
| 9956 | func (self *Hello) Serialize(encoder *goloxi.Encoder) error { |
| 9957 | startIndex := len(encoder.Bytes()) |
| 9958 | if err := self.Header.Serialize(encoder); err != nil { |
| 9959 | return err |
| 9960 | } |
| 9961 | |
| 9962 | for _, obj := range self.Elements { |
| 9963 | if err := obj.Serialize(encoder); err != nil { |
| 9964 | return err |
| 9965 | } |
| 9966 | } |
| 9967 | length := len(encoder.Bytes()) - startIndex |
| 9968 | |
| 9969 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 9970 | |
| 9971 | return nil |
| 9972 | } |
| 9973 | |
| 9974 | func DecodeHello(parent *Header, decoder *goloxi.Decoder) (*Hello, error) { |
| 9975 | _hello := &Hello{Header: parent} |
| 9976 | |
| 9977 | for decoder.Length() >= 4 { |
| 9978 | item, err := DecodeHelloElem(decoder) |
| 9979 | if err != nil { |
| 9980 | return nil, err |
| 9981 | } |
| 9982 | if item != nil { |
| 9983 | _hello.Elements = append(_hello.Elements, item) |
| 9984 | } |
| 9985 | } |
| 9986 | return _hello, nil |
| 9987 | } |
| 9988 | |
| 9989 | func NewHello() *Hello { |
| 9990 | obj := &Hello{ |
| 9991 | Header: NewHeader(0), |
| 9992 | } |
| 9993 | return obj |
| 9994 | } |
| 9995 | |
| 9996 | type HelloFailedErrorMsg struct { |
| 9997 | *ErrorMsg |
| 9998 | Code HelloFailedCode |
| 9999 | Data []byte |
| 10000 | } |
| 10001 | |
| 10002 | type IHelloFailedErrorMsg interface { |
| 10003 | IErrorMsg |
| 10004 | GetCode() HelloFailedCode |
| 10005 | GetData() []byte |
| 10006 | } |
| 10007 | |
| 10008 | func (self *HelloFailedErrorMsg) GetCode() HelloFailedCode { |
| 10009 | return self.Code |
| 10010 | } |
| 10011 | |
| 10012 | func (self *HelloFailedErrorMsg) SetCode(v HelloFailedCode) { |
| 10013 | self.Code = v |
| 10014 | } |
| 10015 | |
| 10016 | func (self *HelloFailedErrorMsg) GetData() []byte { |
| 10017 | return self.Data |
| 10018 | } |
| 10019 | |
| 10020 | func (self *HelloFailedErrorMsg) SetData(v []byte) { |
| 10021 | self.Data = v |
| 10022 | } |
| 10023 | |
| 10024 | func (self *HelloFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 10025 | startIndex := len(encoder.Bytes()) |
| 10026 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 10027 | return err |
| 10028 | } |
| 10029 | |
| 10030 | encoder.PutUint16(uint16(self.Code)) |
| 10031 | encoder.Write(self.Data) |
| 10032 | length := len(encoder.Bytes()) - startIndex |
| 10033 | |
| 10034 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 10035 | |
| 10036 | return nil |
| 10037 | } |
| 10038 | |
| 10039 | func DecodeHelloFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*HelloFailedErrorMsg, error) { |
| 10040 | _hellofailederrormsg := &HelloFailedErrorMsg{ErrorMsg: parent} |
| 10041 | if decoder.Length() < 2 { |
| 10042 | return nil, fmt.Errorf("HelloFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 10043 | } |
| 10044 | _hellofailederrormsg.Code = HelloFailedCode(decoder.ReadUint16()) |
| 10045 | _hellofailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 10046 | return _hellofailederrormsg, nil |
| 10047 | } |
| 10048 | |
| 10049 | func NewHelloFailedErrorMsg() *HelloFailedErrorMsg { |
| 10050 | obj := &HelloFailedErrorMsg{ |
| 10051 | ErrorMsg: NewErrorMsg(0), |
| 10052 | } |
| 10053 | return obj |
| 10054 | } |
| 10055 | |
| 10056 | type MeterConfigStatsReply struct { |
| 10057 | *StatsReply |
| 10058 | Entries []*MeterConfig |
| 10059 | } |
| 10060 | |
| 10061 | type IMeterConfigStatsReply interface { |
| 10062 | IStatsReply |
| 10063 | GetEntries() []*MeterConfig |
| 10064 | } |
| 10065 | |
| 10066 | func (self *MeterConfigStatsReply) GetEntries() []*MeterConfig { |
| 10067 | return self.Entries |
| 10068 | } |
| 10069 | |
| 10070 | func (self *MeterConfigStatsReply) SetEntries(v []*MeterConfig) { |
| 10071 | self.Entries = v |
| 10072 | } |
| 10073 | |
| 10074 | func (self *MeterConfigStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 10075 | startIndex := len(encoder.Bytes()) |
| 10076 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 10077 | return err |
| 10078 | } |
| 10079 | |
| 10080 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10081 | for _, obj := range self.Entries { |
| 10082 | if err := obj.Serialize(encoder); err != nil { |
| 10083 | return err |
| 10084 | } |
| 10085 | } |
| 10086 | length := len(encoder.Bytes()) - startIndex |
| 10087 | |
| 10088 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 10089 | |
| 10090 | return nil |
| 10091 | } |
| 10092 | |
| 10093 | func DecodeMeterConfigStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*MeterConfigStatsReply, error) { |
| 10094 | _meterconfigstatsreply := &MeterConfigStatsReply{StatsReply: parent} |
| 10095 | if decoder.Length() < 4 { |
| 10096 | return nil, fmt.Errorf("MeterConfigStatsReply packet too short: %d < 4", decoder.Length()) |
| 10097 | } |
| 10098 | decoder.Skip(4) |
| 10099 | |
| 10100 | for decoder.Length() >= 8 { |
| 10101 | item, err := DecodeMeterConfig(decoder) |
| 10102 | if err != nil { |
| 10103 | return nil, err |
| 10104 | } |
| 10105 | if item != nil { |
| 10106 | _meterconfigstatsreply.Entries = append(_meterconfigstatsreply.Entries, item) |
| 10107 | } |
| 10108 | } |
| 10109 | return _meterconfigstatsreply, nil |
| 10110 | } |
| 10111 | |
| 10112 | func NewMeterConfigStatsReply() *MeterConfigStatsReply { |
| 10113 | obj := &MeterConfigStatsReply{ |
| 10114 | StatsReply: NewStatsReply(10), |
| 10115 | } |
| 10116 | return obj |
| 10117 | } |
| 10118 | |
| 10119 | type MeterConfigStatsRequest struct { |
| 10120 | *StatsRequest |
| 10121 | MeterId uint32 |
| 10122 | } |
| 10123 | |
| 10124 | type IMeterConfigStatsRequest interface { |
| 10125 | IStatsRequest |
| 10126 | GetMeterId() uint32 |
| 10127 | } |
| 10128 | |
| 10129 | func (self *MeterConfigStatsRequest) GetMeterId() uint32 { |
| 10130 | return self.MeterId |
| 10131 | } |
| 10132 | |
| 10133 | func (self *MeterConfigStatsRequest) SetMeterId(v uint32) { |
| 10134 | self.MeterId = v |
| 10135 | } |
| 10136 | |
| 10137 | func (self *MeterConfigStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 10138 | startIndex := len(encoder.Bytes()) |
| 10139 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 10140 | return err |
| 10141 | } |
| 10142 | |
| 10143 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10144 | encoder.PutUint32(uint32(self.MeterId)) |
| 10145 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10146 | length := len(encoder.Bytes()) - startIndex |
| 10147 | |
| 10148 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 10149 | |
| 10150 | return nil |
| 10151 | } |
| 10152 | |
| 10153 | func DecodeMeterConfigStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*MeterConfigStatsRequest, error) { |
| 10154 | _meterconfigstatsrequest := &MeterConfigStatsRequest{StatsRequest: parent} |
| 10155 | if decoder.Length() < 4 { |
| 10156 | return nil, fmt.Errorf("MeterConfigStatsRequest packet too short: %d < 4", decoder.Length()) |
| 10157 | } |
| 10158 | decoder.Skip(4) |
| 10159 | _meterconfigstatsrequest.MeterId = uint32(decoder.ReadUint32()) |
| 10160 | decoder.Skip(4) |
| 10161 | return _meterconfigstatsrequest, nil |
| 10162 | } |
| 10163 | |
| 10164 | func NewMeterConfigStatsRequest() *MeterConfigStatsRequest { |
| 10165 | obj := &MeterConfigStatsRequest{ |
| 10166 | StatsRequest: NewStatsRequest(10), |
| 10167 | } |
| 10168 | return obj |
| 10169 | } |
| 10170 | |
| 10171 | type MeterFeaturesStatsReply struct { |
| 10172 | *StatsReply |
| 10173 | Features MeterFeatures |
| 10174 | } |
| 10175 | |
| 10176 | type IMeterFeaturesStatsReply interface { |
| 10177 | IStatsReply |
| 10178 | GetFeatures() MeterFeatures |
| 10179 | } |
| 10180 | |
| 10181 | func (self *MeterFeaturesStatsReply) GetFeatures() MeterFeatures { |
| 10182 | return self.Features |
| 10183 | } |
| 10184 | |
| 10185 | func (self *MeterFeaturesStatsReply) SetFeatures(v MeterFeatures) { |
| 10186 | self.Features = v |
| 10187 | } |
| 10188 | |
| 10189 | func (self *MeterFeaturesStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 10190 | startIndex := len(encoder.Bytes()) |
| 10191 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 10192 | return err |
| 10193 | } |
| 10194 | |
| 10195 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10196 | if err := self.Features.Serialize(encoder); err != nil { |
| 10197 | return err |
| 10198 | } |
| 10199 | |
| 10200 | length := len(encoder.Bytes()) - startIndex |
| 10201 | |
| 10202 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 10203 | |
| 10204 | return nil |
| 10205 | } |
| 10206 | |
| 10207 | func DecodeMeterFeaturesStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*MeterFeaturesStatsReply, error) { |
| 10208 | _meterfeaturesstatsreply := &MeterFeaturesStatsReply{StatsReply: parent} |
| 10209 | if decoder.Length() < 28 { |
| 10210 | return nil, fmt.Errorf("MeterFeaturesStatsReply packet too short: %d < 28", decoder.Length()) |
| 10211 | } |
| 10212 | decoder.Skip(4) |
| 10213 | if err := _meterfeaturesstatsreply.Features.Decode(decoder); err != nil { |
| 10214 | return nil, err |
| 10215 | } |
| 10216 | |
| 10217 | return _meterfeaturesstatsreply, nil |
| 10218 | } |
| 10219 | |
| 10220 | func NewMeterFeaturesStatsReply() *MeterFeaturesStatsReply { |
| 10221 | obj := &MeterFeaturesStatsReply{ |
| 10222 | StatsReply: NewStatsReply(11), |
| 10223 | } |
| 10224 | return obj |
| 10225 | } |
| 10226 | |
| 10227 | type MeterFeaturesStatsRequest struct { |
| 10228 | *StatsRequest |
| 10229 | } |
| 10230 | |
| 10231 | type IMeterFeaturesStatsRequest interface { |
| 10232 | IStatsRequest |
| 10233 | } |
| 10234 | |
| 10235 | func (self *MeterFeaturesStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 10236 | startIndex := len(encoder.Bytes()) |
| 10237 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 10238 | return err |
| 10239 | } |
| 10240 | |
| 10241 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10242 | length := len(encoder.Bytes()) - startIndex |
| 10243 | |
| 10244 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 10245 | |
| 10246 | return nil |
| 10247 | } |
| 10248 | |
| 10249 | func DecodeMeterFeaturesStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*MeterFeaturesStatsRequest, error) { |
| 10250 | _meterfeaturesstatsrequest := &MeterFeaturesStatsRequest{StatsRequest: parent} |
| 10251 | if decoder.Length() < 4 { |
| 10252 | return nil, fmt.Errorf("MeterFeaturesStatsRequest packet too short: %d < 4", decoder.Length()) |
| 10253 | } |
| 10254 | decoder.Skip(4) |
| 10255 | return _meterfeaturesstatsrequest, nil |
| 10256 | } |
| 10257 | |
| 10258 | func NewMeterFeaturesStatsRequest() *MeterFeaturesStatsRequest { |
| 10259 | obj := &MeterFeaturesStatsRequest{ |
| 10260 | StatsRequest: NewStatsRequest(11), |
| 10261 | } |
| 10262 | return obj |
| 10263 | } |
| 10264 | |
| 10265 | type MeterMod struct { |
| 10266 | *Header |
| 10267 | Command MeterModCommand |
| 10268 | Flags MeterFlags |
| 10269 | MeterId uint32 |
| 10270 | Bands []IMeterBand |
| 10271 | } |
| 10272 | |
| 10273 | type IMeterMod interface { |
| 10274 | IHeader |
| 10275 | GetCommand() MeterModCommand |
| 10276 | GetFlags() MeterFlags |
| 10277 | GetMeterId() uint32 |
| 10278 | GetBands() []IMeterBand |
| 10279 | } |
| 10280 | |
| 10281 | func (self *MeterMod) GetCommand() MeterModCommand { |
| 10282 | return self.Command |
| 10283 | } |
| 10284 | |
| 10285 | func (self *MeterMod) SetCommand(v MeterModCommand) { |
| 10286 | self.Command = v |
| 10287 | } |
| 10288 | |
| 10289 | func (self *MeterMod) GetFlags() MeterFlags { |
| 10290 | return self.Flags |
| 10291 | } |
| 10292 | |
| 10293 | func (self *MeterMod) SetFlags(v MeterFlags) { |
| 10294 | self.Flags = v |
| 10295 | } |
| 10296 | |
| 10297 | func (self *MeterMod) GetMeterId() uint32 { |
| 10298 | return self.MeterId |
| 10299 | } |
| 10300 | |
| 10301 | func (self *MeterMod) SetMeterId(v uint32) { |
| 10302 | self.MeterId = v |
| 10303 | } |
| 10304 | |
| 10305 | func (self *MeterMod) GetBands() []IMeterBand { |
| 10306 | return self.Bands |
| 10307 | } |
| 10308 | |
| 10309 | func (self *MeterMod) SetBands(v []IMeterBand) { |
| 10310 | self.Bands = v |
| 10311 | } |
| 10312 | |
| 10313 | func (self *MeterMod) Serialize(encoder *goloxi.Encoder) error { |
| 10314 | startIndex := len(encoder.Bytes()) |
| 10315 | if err := self.Header.Serialize(encoder); err != nil { |
| 10316 | return err |
| 10317 | } |
| 10318 | |
| 10319 | encoder.PutUint16(uint16(self.Command)) |
| 10320 | encoder.PutUint16(uint16(self.Flags)) |
| 10321 | encoder.PutUint32(uint32(self.MeterId)) |
| 10322 | for _, obj := range self.Bands { |
| 10323 | if err := obj.Serialize(encoder); err != nil { |
| 10324 | return err |
| 10325 | } |
| 10326 | } |
| 10327 | length := len(encoder.Bytes()) - startIndex |
| 10328 | |
| 10329 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 10330 | |
| 10331 | return nil |
| 10332 | } |
| 10333 | |
| 10334 | func DecodeMeterMod(parent *Header, decoder *goloxi.Decoder) (*MeterMod, error) { |
| 10335 | _metermod := &MeterMod{Header: parent} |
| 10336 | if decoder.Length() < 8 { |
| 10337 | return nil, fmt.Errorf("MeterMod packet too short: %d < 8", decoder.Length()) |
| 10338 | } |
| 10339 | _metermod.Command = MeterModCommand(decoder.ReadUint16()) |
| 10340 | _metermod.Flags = MeterFlags(decoder.ReadUint16()) |
| 10341 | _metermod.MeterId = uint32(decoder.ReadUint32()) |
| 10342 | |
| 10343 | for decoder.Length() >= 4 { |
| 10344 | item, err := DecodeMeterBand(decoder) |
| 10345 | if err != nil { |
| 10346 | return nil, err |
| 10347 | } |
| 10348 | if item != nil { |
| 10349 | _metermod.Bands = append(_metermod.Bands, item) |
| 10350 | } |
| 10351 | } |
| 10352 | return _metermod, nil |
| 10353 | } |
| 10354 | |
| 10355 | func NewMeterMod() *MeterMod { |
| 10356 | obj := &MeterMod{ |
| 10357 | Header: NewHeader(29), |
| 10358 | } |
| 10359 | return obj |
| 10360 | } |
| 10361 | |
| 10362 | type MeterModFailedErrorMsg struct { |
| 10363 | *ErrorMsg |
| 10364 | Code MeterModFailedCode |
| 10365 | Data []byte |
| 10366 | } |
| 10367 | |
| 10368 | type IMeterModFailedErrorMsg interface { |
| 10369 | IErrorMsg |
| 10370 | GetCode() MeterModFailedCode |
| 10371 | GetData() []byte |
| 10372 | } |
| 10373 | |
| 10374 | func (self *MeterModFailedErrorMsg) GetCode() MeterModFailedCode { |
| 10375 | return self.Code |
| 10376 | } |
| 10377 | |
| 10378 | func (self *MeterModFailedErrorMsg) SetCode(v MeterModFailedCode) { |
| 10379 | self.Code = v |
| 10380 | } |
| 10381 | |
| 10382 | func (self *MeterModFailedErrorMsg) GetData() []byte { |
| 10383 | return self.Data |
| 10384 | } |
| 10385 | |
| 10386 | func (self *MeterModFailedErrorMsg) SetData(v []byte) { |
| 10387 | self.Data = v |
| 10388 | } |
| 10389 | |
| 10390 | func (self *MeterModFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 10391 | startIndex := len(encoder.Bytes()) |
| 10392 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 10393 | return err |
| 10394 | } |
| 10395 | |
| 10396 | encoder.PutUint16(uint16(self.Code)) |
| 10397 | encoder.Write(self.Data) |
| 10398 | length := len(encoder.Bytes()) - startIndex |
| 10399 | |
| 10400 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 10401 | |
| 10402 | return nil |
| 10403 | } |
| 10404 | |
| 10405 | func DecodeMeterModFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*MeterModFailedErrorMsg, error) { |
| 10406 | _metermodfailederrormsg := &MeterModFailedErrorMsg{ErrorMsg: parent} |
| 10407 | if decoder.Length() < 2 { |
| 10408 | return nil, fmt.Errorf("MeterModFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 10409 | } |
| 10410 | _metermodfailederrormsg.Code = MeterModFailedCode(decoder.ReadUint16()) |
| 10411 | _metermodfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 10412 | return _metermodfailederrormsg, nil |
| 10413 | } |
| 10414 | |
| 10415 | func NewMeterModFailedErrorMsg() *MeterModFailedErrorMsg { |
| 10416 | obj := &MeterModFailedErrorMsg{ |
| 10417 | ErrorMsg: NewErrorMsg(12), |
| 10418 | } |
| 10419 | return obj |
| 10420 | } |
| 10421 | |
| 10422 | type MeterStatsReply struct { |
| 10423 | *StatsReply |
| 10424 | Entries []*MeterStats |
| 10425 | } |
| 10426 | |
| 10427 | type IMeterStatsReply interface { |
| 10428 | IStatsReply |
| 10429 | GetEntries() []*MeterStats |
| 10430 | } |
| 10431 | |
| 10432 | func (self *MeterStatsReply) GetEntries() []*MeterStats { |
| 10433 | return self.Entries |
| 10434 | } |
| 10435 | |
| 10436 | func (self *MeterStatsReply) SetEntries(v []*MeterStats) { |
| 10437 | self.Entries = v |
| 10438 | } |
| 10439 | |
| 10440 | func (self *MeterStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 10441 | startIndex := len(encoder.Bytes()) |
| 10442 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 10443 | return err |
| 10444 | } |
| 10445 | |
| 10446 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10447 | for _, obj := range self.Entries { |
| 10448 | if err := obj.Serialize(encoder); err != nil { |
| 10449 | return err |
| 10450 | } |
| 10451 | } |
| 10452 | length := len(encoder.Bytes()) - startIndex |
| 10453 | |
| 10454 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 10455 | |
| 10456 | return nil |
| 10457 | } |
| 10458 | |
| 10459 | func DecodeMeterStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*MeterStatsReply, error) { |
| 10460 | _meterstatsreply := &MeterStatsReply{StatsReply: parent} |
| 10461 | if decoder.Length() < 4 { |
| 10462 | return nil, fmt.Errorf("MeterStatsReply packet too short: %d < 4", decoder.Length()) |
| 10463 | } |
| 10464 | decoder.Skip(4) |
| 10465 | |
| 10466 | for decoder.Length() >= 40 { |
| 10467 | item, err := DecodeMeterStats(decoder) |
| 10468 | if err != nil { |
| 10469 | return nil, err |
| 10470 | } |
| 10471 | if item != nil { |
| 10472 | _meterstatsreply.Entries = append(_meterstatsreply.Entries, item) |
| 10473 | } |
| 10474 | } |
| 10475 | return _meterstatsreply, nil |
| 10476 | } |
| 10477 | |
| 10478 | func NewMeterStatsReply() *MeterStatsReply { |
| 10479 | obj := &MeterStatsReply{ |
| 10480 | StatsReply: NewStatsReply(9), |
| 10481 | } |
| 10482 | return obj |
| 10483 | } |
| 10484 | |
| 10485 | type MeterStatsRequest struct { |
| 10486 | *StatsRequest |
| 10487 | MeterId uint32 |
| 10488 | } |
| 10489 | |
| 10490 | type IMeterStatsRequest interface { |
| 10491 | IStatsRequest |
| 10492 | GetMeterId() uint32 |
| 10493 | } |
| 10494 | |
| 10495 | func (self *MeterStatsRequest) GetMeterId() uint32 { |
| 10496 | return self.MeterId |
| 10497 | } |
| 10498 | |
| 10499 | func (self *MeterStatsRequest) SetMeterId(v uint32) { |
| 10500 | self.MeterId = v |
| 10501 | } |
| 10502 | |
| 10503 | func (self *MeterStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 10504 | startIndex := len(encoder.Bytes()) |
| 10505 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 10506 | return err |
| 10507 | } |
| 10508 | |
| 10509 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10510 | encoder.PutUint32(uint32(self.MeterId)) |
| 10511 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10512 | length := len(encoder.Bytes()) - startIndex |
| 10513 | |
| 10514 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 10515 | |
| 10516 | return nil |
| 10517 | } |
| 10518 | |
| 10519 | func DecodeMeterStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*MeterStatsRequest, error) { |
| 10520 | _meterstatsrequest := &MeterStatsRequest{StatsRequest: parent} |
| 10521 | if decoder.Length() < 4 { |
| 10522 | return nil, fmt.Errorf("MeterStatsRequest packet too short: %d < 4", decoder.Length()) |
| 10523 | } |
| 10524 | decoder.Skip(4) |
| 10525 | _meterstatsrequest.MeterId = uint32(decoder.ReadUint32()) |
| 10526 | decoder.Skip(4) |
| 10527 | return _meterstatsrequest, nil |
| 10528 | } |
| 10529 | |
| 10530 | func NewMeterStatsRequest() *MeterStatsRequest { |
| 10531 | obj := &MeterStatsRequest{ |
| 10532 | StatsRequest: NewStatsRequest(9), |
| 10533 | } |
| 10534 | return obj |
| 10535 | } |
| 10536 | |
| 10537 | type NiciraStatsReply struct { |
| 10538 | *ExperimenterStatsReply |
| 10539 | } |
| 10540 | |
| 10541 | type INiciraStatsReply interface { |
| 10542 | IExperimenterStatsReply |
| 10543 | } |
| 10544 | |
| 10545 | func (self *NiciraStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 10546 | if err := self.ExperimenterStatsReply.Serialize(encoder); err != nil { |
| 10547 | return err |
| 10548 | } |
| 10549 | |
| 10550 | return nil |
| 10551 | } |
| 10552 | |
| 10553 | func DecodeNiciraStatsReply(parent *ExperimenterStatsReply, decoder *goloxi.Decoder) (INiciraStatsReply, error) { |
| 10554 | _nicirastatsreply := &NiciraStatsReply{ExperimenterStatsReply: parent} |
| 10555 | if decoder.Length() < -4 { |
| 10556 | return nil, fmt.Errorf("NiciraStatsReply packet too short: %d < -4", decoder.Length()) |
| 10557 | } |
| 10558 | |
| 10559 | switch _nicirastatsreply.Subtype { |
| 10560 | case 0: |
| 10561 | return DecodeNiciraFlowStatsReply(_nicirastatsreply, decoder) |
| 10562 | case 2: |
| 10563 | return DecodeNiciraFlowMonitorReply(_nicirastatsreply, decoder) |
| 10564 | default: |
| 10565 | return nil, fmt.Errorf("Invalid type '%d' for 'NiciraStatsReply'", _nicirastatsreply.Subtype) |
| 10566 | } |
| 10567 | } |
| 10568 | |
| 10569 | func NewNiciraStatsReply(_subtype uint32) *NiciraStatsReply { |
| 10570 | obj := &NiciraStatsReply{ |
| 10571 | ExperimenterStatsReply: NewExperimenterStatsReply(8992), |
| 10572 | } |
| 10573 | obj.Subtype = _subtype |
| 10574 | return obj |
| 10575 | } |
| 10576 | |
| 10577 | type NiciraFlowMonitorReply struct { |
| 10578 | *NiciraStatsReply |
| 10579 | Updates []INiciraFlowUpdateEvent |
| 10580 | } |
| 10581 | |
| 10582 | type INiciraFlowMonitorReply interface { |
| 10583 | INiciraStatsReply |
| 10584 | GetUpdates() []INiciraFlowUpdateEvent |
| 10585 | } |
| 10586 | |
| 10587 | func (self *NiciraFlowMonitorReply) GetUpdates() []INiciraFlowUpdateEvent { |
| 10588 | return self.Updates |
| 10589 | } |
| 10590 | |
| 10591 | func (self *NiciraFlowMonitorReply) SetUpdates(v []INiciraFlowUpdateEvent) { |
| 10592 | self.Updates = v |
| 10593 | } |
| 10594 | |
| 10595 | func (self *NiciraFlowMonitorReply) Serialize(encoder *goloxi.Encoder) error { |
| 10596 | startIndex := len(encoder.Bytes()) |
| 10597 | if err := self.NiciraStatsReply.Serialize(encoder); err != nil { |
| 10598 | return err |
| 10599 | } |
| 10600 | |
| 10601 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10602 | for _, obj := range self.Updates { |
| 10603 | if err := obj.Serialize(encoder); err != nil { |
| 10604 | return err |
| 10605 | } |
| 10606 | } |
| 10607 | length := len(encoder.Bytes()) - startIndex |
| 10608 | |
| 10609 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 10610 | |
| 10611 | return nil |
| 10612 | } |
| 10613 | |
| 10614 | func DecodeNiciraFlowMonitorReply(parent *NiciraStatsReply, decoder *goloxi.Decoder) (*NiciraFlowMonitorReply, error) { |
| 10615 | _niciraflowmonitorreply := &NiciraFlowMonitorReply{NiciraStatsReply: parent} |
| 10616 | if decoder.Length() < 4 { |
| 10617 | return nil, fmt.Errorf("NiciraFlowMonitorReply packet too short: %d < 4", decoder.Length()) |
| 10618 | } |
| 10619 | decoder.Skip(4) |
| 10620 | |
| 10621 | for decoder.Length() >= 4 { |
| 10622 | item, err := DecodeNiciraFlowUpdateEvent(decoder) |
| 10623 | if err != nil { |
| 10624 | return nil, err |
| 10625 | } |
| 10626 | if item != nil { |
| 10627 | _niciraflowmonitorreply.Updates = append(_niciraflowmonitorreply.Updates, item) |
| 10628 | } |
| 10629 | } |
| 10630 | return _niciraflowmonitorreply, nil |
| 10631 | } |
| 10632 | |
| 10633 | func NewNiciraFlowMonitorReply() *NiciraFlowMonitorReply { |
| 10634 | obj := &NiciraFlowMonitorReply{ |
| 10635 | NiciraStatsReply: NewNiciraStatsReply(2), |
| 10636 | } |
| 10637 | return obj |
| 10638 | } |
| 10639 | |
| 10640 | type NiciraFlowMonitorRequest struct { |
| 10641 | *ExperimenterStatsRequest |
| 10642 | MonitorId uint32 |
| 10643 | MonitorFlags NxFlowMonitorFlags |
| 10644 | OutPort Port |
| 10645 | MatchLen uint16 |
| 10646 | TableId uint8 |
| 10647 | Match NiciraMatch |
| 10648 | } |
| 10649 | |
| 10650 | type INiciraFlowMonitorRequest interface { |
| 10651 | IExperimenterStatsRequest |
| 10652 | GetMonitorId() uint32 |
| 10653 | GetMonitorFlags() NxFlowMonitorFlags |
| 10654 | GetOutPort() Port |
| 10655 | GetMatchLen() uint16 |
| 10656 | GetTableId() uint8 |
| 10657 | GetMatch() NiciraMatch |
| 10658 | } |
| 10659 | |
| 10660 | func (self *NiciraFlowMonitorRequest) GetMonitorId() uint32 { |
| 10661 | return self.MonitorId |
| 10662 | } |
| 10663 | |
| 10664 | func (self *NiciraFlowMonitorRequest) SetMonitorId(v uint32) { |
| 10665 | self.MonitorId = v |
| 10666 | } |
| 10667 | |
| 10668 | func (self *NiciraFlowMonitorRequest) GetMonitorFlags() NxFlowMonitorFlags { |
| 10669 | return self.MonitorFlags |
| 10670 | } |
| 10671 | |
| 10672 | func (self *NiciraFlowMonitorRequest) SetMonitorFlags(v NxFlowMonitorFlags) { |
| 10673 | self.MonitorFlags = v |
| 10674 | } |
| 10675 | |
| 10676 | func (self *NiciraFlowMonitorRequest) GetOutPort() Port { |
| 10677 | return self.OutPort |
| 10678 | } |
| 10679 | |
| 10680 | func (self *NiciraFlowMonitorRequest) SetOutPort(v Port) { |
| 10681 | self.OutPort = v |
| 10682 | } |
| 10683 | |
| 10684 | func (self *NiciraFlowMonitorRequest) GetMatchLen() uint16 { |
| 10685 | return self.MatchLen |
| 10686 | } |
| 10687 | |
| 10688 | func (self *NiciraFlowMonitorRequest) SetMatchLen(v uint16) { |
| 10689 | self.MatchLen = v |
| 10690 | } |
| 10691 | |
| 10692 | func (self *NiciraFlowMonitorRequest) GetTableId() uint8 { |
| 10693 | return self.TableId |
| 10694 | } |
| 10695 | |
| 10696 | func (self *NiciraFlowMonitorRequest) SetTableId(v uint8) { |
| 10697 | self.TableId = v |
| 10698 | } |
| 10699 | |
| 10700 | func (self *NiciraFlowMonitorRequest) GetMatch() NiciraMatch { |
| 10701 | return self.Match |
| 10702 | } |
| 10703 | |
| 10704 | func (self *NiciraFlowMonitorRequest) SetMatch(v NiciraMatch) { |
| 10705 | self.Match = v |
| 10706 | } |
| 10707 | |
| 10708 | func (self *NiciraFlowMonitorRequest) Serialize(encoder *goloxi.Encoder) error { |
| 10709 | startIndex := len(encoder.Bytes()) |
| 10710 | if err := self.ExperimenterStatsRequest.Serialize(encoder); err != nil { |
| 10711 | return err |
| 10712 | } |
| 10713 | |
| 10714 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10715 | encoder.PutUint32(uint32(self.MonitorId)) |
| 10716 | encoder.PutUint16(uint16(self.MonitorFlags)) |
| 10717 | self.OutPort.Serialize(encoder) |
| 10718 | encoder.PutUint16(uint16(self.MatchLen)) |
| 10719 | encoder.PutUint8(uint8(self.TableId)) |
| 10720 | encoder.Write(bytes.Repeat([]byte{0}, 5)) |
| 10721 | if err := self.Match.Serialize(encoder); err != nil { |
| 10722 | return err |
| 10723 | } |
| 10724 | |
| 10725 | length := len(encoder.Bytes()) - startIndex |
| 10726 | |
| 10727 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 10728 | |
| 10729 | return nil |
| 10730 | } |
| 10731 | |
| 10732 | func DecodeNiciraFlowMonitorRequest(parent *ExperimenterStatsRequest, decoder *goloxi.Decoder) (*NiciraFlowMonitorRequest, error) { |
| 10733 | _niciraflowmonitorrequest := &NiciraFlowMonitorRequest{ExperimenterStatsRequest: parent} |
| 10734 | if decoder.Length() < 22 { |
| 10735 | return nil, fmt.Errorf("NiciraFlowMonitorRequest packet too short: %d < 22", decoder.Length()) |
| 10736 | } |
| 10737 | decoder.Skip(4) |
| 10738 | _niciraflowmonitorrequest.MonitorId = uint32(decoder.ReadUint32()) |
| 10739 | _niciraflowmonitorrequest.MonitorFlags = NxFlowMonitorFlags(decoder.ReadUint16()) |
| 10740 | _niciraflowmonitorrequest.OutPort.Decode(decoder) |
| 10741 | _niciraflowmonitorrequest.MatchLen = uint16(decoder.ReadUint16()) |
| 10742 | _niciraflowmonitorrequest.TableId = uint8(decoder.ReadByte()) |
| 10743 | decoder.Skip(5) |
| 10744 | if err := _niciraflowmonitorrequest.Match.Decode(decoder); err != nil { |
| 10745 | return nil, err |
| 10746 | } |
| 10747 | |
| 10748 | decoder.SkipAlign() |
| 10749 | return _niciraflowmonitorrequest, nil |
| 10750 | } |
| 10751 | |
| 10752 | func NewNiciraFlowMonitorRequest() *NiciraFlowMonitorRequest { |
| 10753 | obj := &NiciraFlowMonitorRequest{ |
| 10754 | ExperimenterStatsRequest: NewExperimenterStatsRequest(8992), |
| 10755 | } |
| 10756 | return obj |
| 10757 | } |
| 10758 | |
| 10759 | type NiciraFlowStatsReply struct { |
| 10760 | *NiciraStatsReply |
| 10761 | Stats []*NiciraFlowStats |
| 10762 | } |
| 10763 | |
| 10764 | type INiciraFlowStatsReply interface { |
| 10765 | INiciraStatsReply |
| 10766 | GetStats() []*NiciraFlowStats |
| 10767 | } |
| 10768 | |
| 10769 | func (self *NiciraFlowStatsReply) GetStats() []*NiciraFlowStats { |
| 10770 | return self.Stats |
| 10771 | } |
| 10772 | |
| 10773 | func (self *NiciraFlowStatsReply) SetStats(v []*NiciraFlowStats) { |
| 10774 | self.Stats = v |
| 10775 | } |
| 10776 | |
| 10777 | func (self *NiciraFlowStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 10778 | startIndex := len(encoder.Bytes()) |
| 10779 | if err := self.NiciraStatsReply.Serialize(encoder); err != nil { |
| 10780 | return err |
| 10781 | } |
| 10782 | |
| 10783 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10784 | for _, obj := range self.Stats { |
| 10785 | if err := obj.Serialize(encoder); err != nil { |
| 10786 | return err |
| 10787 | } |
| 10788 | } |
| 10789 | length := len(encoder.Bytes()) - startIndex |
| 10790 | |
| 10791 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 10792 | |
| 10793 | return nil |
| 10794 | } |
| 10795 | |
| 10796 | func DecodeNiciraFlowStatsReply(parent *NiciraStatsReply, decoder *goloxi.Decoder) (*NiciraFlowStatsReply, error) { |
| 10797 | _niciraflowstatsreply := &NiciraFlowStatsReply{NiciraStatsReply: parent} |
| 10798 | if decoder.Length() < 4 { |
| 10799 | return nil, fmt.Errorf("NiciraFlowStatsReply packet too short: %d < 4", decoder.Length()) |
| 10800 | } |
| 10801 | decoder.Skip(4) |
| 10802 | |
| 10803 | for decoder.Length() >= 48 { |
| 10804 | item, err := DecodeNiciraFlowStats(decoder) |
| 10805 | if err != nil { |
| 10806 | return nil, err |
| 10807 | } |
| 10808 | if item != nil { |
| 10809 | _niciraflowstatsreply.Stats = append(_niciraflowstatsreply.Stats, item) |
| 10810 | } |
| 10811 | } |
| 10812 | return _niciraflowstatsreply, nil |
| 10813 | } |
| 10814 | |
| 10815 | func NewNiciraFlowStatsReply() *NiciraFlowStatsReply { |
| 10816 | obj := &NiciraFlowStatsReply{ |
| 10817 | NiciraStatsReply: NewNiciraStatsReply(0), |
| 10818 | } |
| 10819 | return obj |
| 10820 | } |
| 10821 | |
| 10822 | type NiciraFlowStatsRequest struct { |
| 10823 | *ExperimenterStatsRequest |
| 10824 | OutPort Port |
| 10825 | MatchLen uint16 |
| 10826 | TableId uint8 |
| 10827 | } |
| 10828 | |
| 10829 | type INiciraFlowStatsRequest interface { |
| 10830 | IExperimenterStatsRequest |
| 10831 | GetOutPort() Port |
| 10832 | GetMatchLen() uint16 |
| 10833 | GetTableId() uint8 |
| 10834 | } |
| 10835 | |
| 10836 | func (self *NiciraFlowStatsRequest) GetOutPort() Port { |
| 10837 | return self.OutPort |
| 10838 | } |
| 10839 | |
| 10840 | func (self *NiciraFlowStatsRequest) SetOutPort(v Port) { |
| 10841 | self.OutPort = v |
| 10842 | } |
| 10843 | |
| 10844 | func (self *NiciraFlowStatsRequest) GetMatchLen() uint16 { |
| 10845 | return self.MatchLen |
| 10846 | } |
| 10847 | |
| 10848 | func (self *NiciraFlowStatsRequest) SetMatchLen(v uint16) { |
| 10849 | self.MatchLen = v |
| 10850 | } |
| 10851 | |
| 10852 | func (self *NiciraFlowStatsRequest) GetTableId() uint8 { |
| 10853 | return self.TableId |
| 10854 | } |
| 10855 | |
| 10856 | func (self *NiciraFlowStatsRequest) SetTableId(v uint8) { |
| 10857 | self.TableId = v |
| 10858 | } |
| 10859 | |
| 10860 | func (self *NiciraFlowStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 10861 | startIndex := len(encoder.Bytes()) |
| 10862 | if err := self.ExperimenterStatsRequest.Serialize(encoder); err != nil { |
| 10863 | return err |
| 10864 | } |
| 10865 | |
| 10866 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10867 | self.OutPort.Serialize(encoder) |
| 10868 | encoder.PutUint16(uint16(self.MatchLen)) |
| 10869 | encoder.PutUint8(uint8(self.TableId)) |
| 10870 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 10871 | length := len(encoder.Bytes()) - startIndex |
| 10872 | |
| 10873 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 10874 | |
| 10875 | return nil |
| 10876 | } |
| 10877 | |
| 10878 | func DecodeNiciraFlowStatsRequest(parent *ExperimenterStatsRequest, decoder *goloxi.Decoder) (*NiciraFlowStatsRequest, error) { |
| 10879 | _niciraflowstatsrequest := &NiciraFlowStatsRequest{ExperimenterStatsRequest: parent} |
| 10880 | if decoder.Length() < 14 { |
| 10881 | return nil, fmt.Errorf("NiciraFlowStatsRequest packet too short: %d < 14", decoder.Length()) |
| 10882 | } |
| 10883 | decoder.Skip(4) |
| 10884 | _niciraflowstatsrequest.OutPort.Decode(decoder) |
| 10885 | _niciraflowstatsrequest.MatchLen = uint16(decoder.ReadUint16()) |
| 10886 | _niciraflowstatsrequest.TableId = uint8(decoder.ReadByte()) |
| 10887 | decoder.Skip(3) |
| 10888 | return _niciraflowstatsrequest, nil |
| 10889 | } |
| 10890 | |
| 10891 | func NewNiciraFlowStatsRequest() *NiciraFlowStatsRequest { |
| 10892 | obj := &NiciraFlowStatsRequest{ |
| 10893 | ExperimenterStatsRequest: NewExperimenterStatsRequest(8992), |
| 10894 | } |
| 10895 | return obj |
| 10896 | } |
| 10897 | |
| 10898 | type NiciraHeader struct { |
| 10899 | *Experimenter |
| 10900 | } |
| 10901 | |
| 10902 | type INiciraHeader interface { |
| 10903 | IExperimenter |
| 10904 | } |
| 10905 | |
| 10906 | func (self *NiciraHeader) Serialize(encoder *goloxi.Encoder) error { |
| 10907 | if err := self.Experimenter.Serialize(encoder); err != nil { |
| 10908 | return err |
| 10909 | } |
| 10910 | |
| 10911 | return nil |
| 10912 | } |
| 10913 | |
| 10914 | func DecodeNiciraHeader(parent *Experimenter, decoder *goloxi.Decoder) (INiciraHeader, error) { |
| 10915 | _niciraheader := &NiciraHeader{Experimenter: parent} |
| 10916 | return _niciraheader, nil |
| 10917 | } |
| 10918 | |
| 10919 | func NewNiciraHeader(_subtype uint32) *NiciraHeader { |
| 10920 | obj := &NiciraHeader{ |
| 10921 | Experimenter: NewExperimenter(8992), |
| 10922 | } |
| 10923 | obj.Subtype = _subtype |
| 10924 | return obj |
| 10925 | } |
| 10926 | |
| 10927 | type PacketIn struct { |
| 10928 | *Header |
| 10929 | BufferId uint32 |
| 10930 | TotalLen uint16 |
| 10931 | Reason uint8 |
| 10932 | TableId uint8 |
| 10933 | Cookie uint64 |
| 10934 | Match Match |
| 10935 | Data []byte |
| 10936 | } |
| 10937 | |
| 10938 | type IPacketIn interface { |
| 10939 | IHeader |
| 10940 | GetBufferId() uint32 |
| 10941 | GetTotalLen() uint16 |
| 10942 | GetReason() uint8 |
| 10943 | GetTableId() uint8 |
| 10944 | GetCookie() uint64 |
| 10945 | GetMatch() Match |
| 10946 | GetData() []byte |
| 10947 | } |
| 10948 | |
| 10949 | func (self *PacketIn) GetBufferId() uint32 { |
| 10950 | return self.BufferId |
| 10951 | } |
| 10952 | |
| 10953 | func (self *PacketIn) SetBufferId(v uint32) { |
| 10954 | self.BufferId = v |
| 10955 | } |
| 10956 | |
| 10957 | func (self *PacketIn) GetTotalLen() uint16 { |
| 10958 | return self.TotalLen |
| 10959 | } |
| 10960 | |
| 10961 | func (self *PacketIn) SetTotalLen(v uint16) { |
| 10962 | self.TotalLen = v |
| 10963 | } |
| 10964 | |
| 10965 | func (self *PacketIn) GetReason() uint8 { |
| 10966 | return self.Reason |
| 10967 | } |
| 10968 | |
| 10969 | func (self *PacketIn) SetReason(v uint8) { |
| 10970 | self.Reason = v |
| 10971 | } |
| 10972 | |
| 10973 | func (self *PacketIn) GetTableId() uint8 { |
| 10974 | return self.TableId |
| 10975 | } |
| 10976 | |
| 10977 | func (self *PacketIn) SetTableId(v uint8) { |
| 10978 | self.TableId = v |
| 10979 | } |
| 10980 | |
| 10981 | func (self *PacketIn) GetCookie() uint64 { |
| 10982 | return self.Cookie |
| 10983 | } |
| 10984 | |
| 10985 | func (self *PacketIn) SetCookie(v uint64) { |
| 10986 | self.Cookie = v |
| 10987 | } |
| 10988 | |
| 10989 | func (self *PacketIn) GetMatch() Match { |
| 10990 | return self.Match |
| 10991 | } |
| 10992 | |
| 10993 | func (self *PacketIn) SetMatch(v Match) { |
| 10994 | self.Match = v |
| 10995 | } |
| 10996 | |
| 10997 | func (self *PacketIn) GetData() []byte { |
| 10998 | return self.Data |
| 10999 | } |
| 11000 | |
| 11001 | func (self *PacketIn) SetData(v []byte) { |
| 11002 | self.Data = v |
| 11003 | } |
| 11004 | |
| 11005 | func (self *PacketIn) Serialize(encoder *goloxi.Encoder) error { |
| 11006 | startIndex := len(encoder.Bytes()) |
| 11007 | if err := self.Header.Serialize(encoder); err != nil { |
| 11008 | return err |
| 11009 | } |
| 11010 | |
| 11011 | encoder.PutUint32(uint32(self.BufferId)) |
| 11012 | encoder.PutUint16(uint16(self.TotalLen)) |
| 11013 | encoder.PutUint8(uint8(self.Reason)) |
| 11014 | encoder.PutUint8(uint8(self.TableId)) |
| 11015 | encoder.PutUint64(uint64(self.Cookie)) |
| 11016 | if err := self.Match.Serialize(encoder); err != nil { |
| 11017 | return err |
| 11018 | } |
| 11019 | |
| 11020 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 11021 | encoder.Write(self.Data) |
| 11022 | length := len(encoder.Bytes()) - startIndex |
| 11023 | |
| 11024 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11025 | |
| 11026 | return nil |
| 11027 | } |
| 11028 | |
| 11029 | func DecodePacketIn(parent *Header, decoder *goloxi.Decoder) (*PacketIn, error) { |
| 11030 | _packetin := &PacketIn{Header: parent} |
| 11031 | if decoder.Length() < 26 { |
| 11032 | return nil, fmt.Errorf("PacketIn packet too short: %d < 26", decoder.Length()) |
| 11033 | } |
| 11034 | _packetin.BufferId = uint32(decoder.ReadUint32()) |
| 11035 | _packetin.TotalLen = uint16(decoder.ReadUint16()) |
| 11036 | _packetin.Reason = uint8(decoder.ReadByte()) |
| 11037 | _packetin.TableId = uint8(decoder.ReadByte()) |
| 11038 | _packetin.Cookie = uint64(decoder.ReadUint64()) |
| 11039 | if err := _packetin.Match.Decode(decoder); err != nil { |
| 11040 | return nil, err |
| 11041 | } |
| 11042 | |
| 11043 | decoder.SkipAlign() |
| 11044 | decoder.Skip(2) |
| 11045 | _packetin.Data = decoder.Read(int(decoder.Length())) |
| 11046 | return _packetin, nil |
| 11047 | } |
| 11048 | |
| 11049 | func NewPacketIn() *PacketIn { |
| 11050 | obj := &PacketIn{ |
| 11051 | Header: NewHeader(10), |
| 11052 | } |
| 11053 | return obj |
| 11054 | } |
| 11055 | |
| 11056 | type PacketOut struct { |
| 11057 | *Header |
| 11058 | BufferId uint32 |
| 11059 | ActionsLen uint16 |
| 11060 | Match Match |
| 11061 | Actions []goloxi.IAction |
| 11062 | Data []byte |
| 11063 | } |
| 11064 | |
| 11065 | type IPacketOut interface { |
| 11066 | IHeader |
| 11067 | GetBufferId() uint32 |
| 11068 | GetActionsLen() uint16 |
| 11069 | GetMatch() Match |
| 11070 | GetActions() []goloxi.IAction |
| 11071 | GetData() []byte |
| 11072 | } |
| 11073 | |
| 11074 | func (self *PacketOut) GetBufferId() uint32 { |
| 11075 | return self.BufferId |
| 11076 | } |
| 11077 | |
| 11078 | func (self *PacketOut) SetBufferId(v uint32) { |
| 11079 | self.BufferId = v |
| 11080 | } |
| 11081 | |
| 11082 | func (self *PacketOut) GetActionsLen() uint16 { |
| 11083 | return self.ActionsLen |
| 11084 | } |
| 11085 | |
| 11086 | func (self *PacketOut) SetActionsLen(v uint16) { |
| 11087 | self.ActionsLen = v |
| 11088 | } |
| 11089 | |
| 11090 | func (self *PacketOut) GetMatch() Match { |
| 11091 | return self.Match |
| 11092 | } |
| 11093 | |
| 11094 | func (self *PacketOut) SetMatch(v Match) { |
| 11095 | self.Match = v |
| 11096 | } |
| 11097 | |
| 11098 | func (self *PacketOut) GetActions() []goloxi.IAction { |
| 11099 | return self.Actions |
| 11100 | } |
| 11101 | |
| 11102 | func (self *PacketOut) SetActions(v []goloxi.IAction) { |
| 11103 | self.Actions = v |
| 11104 | } |
| 11105 | |
| 11106 | func (self *PacketOut) GetData() []byte { |
| 11107 | return self.Data |
| 11108 | } |
| 11109 | |
| 11110 | func (self *PacketOut) SetData(v []byte) { |
| 11111 | self.Data = v |
| 11112 | } |
| 11113 | |
| 11114 | func (self *PacketOut) Serialize(encoder *goloxi.Encoder) error { |
| 11115 | startIndex := len(encoder.Bytes()) |
| 11116 | if err := self.Header.Serialize(encoder); err != nil { |
| 11117 | return err |
| 11118 | } |
| 11119 | |
| 11120 | encoder.PutUint32(uint32(self.BufferId)) |
| 11121 | encoder.PutUint16(uint16(self.ActionsLen)) |
| 11122 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 11123 | if err := self.Match.Serialize(encoder); err != nil { |
| 11124 | return err |
| 11125 | } |
| 11126 | |
| 11127 | for _, obj := range self.Actions { |
| 11128 | if err := obj.Serialize(encoder); err != nil { |
| 11129 | return err |
| 11130 | } |
| 11131 | } |
| 11132 | encoder.Write(self.Data) |
| 11133 | length := len(encoder.Bytes()) - startIndex |
| 11134 | |
| 11135 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11136 | |
| 11137 | return nil |
| 11138 | } |
| 11139 | |
| 11140 | func DecodePacketOut(parent *Header, decoder *goloxi.Decoder) (*PacketOut, error) { |
| 11141 | _packetout := &PacketOut{Header: parent} |
| 11142 | if decoder.Length() < 16 { |
| 11143 | return nil, fmt.Errorf("PacketOut packet too short: %d < 16", decoder.Length()) |
| 11144 | } |
| 11145 | _packetout.BufferId = uint32(decoder.ReadUint32()) |
| 11146 | _packetout.ActionsLen = uint16(decoder.ReadUint16()) |
| 11147 | decoder.Skip(2) |
| 11148 | if err := _packetout.Match.Decode(decoder); err != nil { |
| 11149 | return nil, err |
| 11150 | } |
| 11151 | |
| 11152 | decoder.SkipAlign() |
| 11153 | |
| 11154 | end := decoder.Offset() + int(_packetout.ActionsLen) |
| 11155 | for decoder.Offset() < end { |
| 11156 | item, err := DecodeAction(decoder) |
| 11157 | if err != nil { |
| 11158 | return nil, err |
| 11159 | } |
| 11160 | if item != nil { |
| 11161 | _packetout.Actions = append(_packetout.Actions, item) |
| 11162 | } |
| 11163 | } |
| 11164 | _packetout.Data = decoder.Read(int(decoder.Length())) |
| 11165 | return _packetout, nil |
| 11166 | } |
| 11167 | |
| 11168 | func NewPacketOut() *PacketOut { |
| 11169 | obj := &PacketOut{ |
| 11170 | Header: NewHeader(13), |
| 11171 | } |
| 11172 | return obj |
| 11173 | } |
| 11174 | |
| 11175 | type PortDescStatsReply struct { |
| 11176 | *StatsReply |
| 11177 | Entries []*PortDesc |
| 11178 | } |
| 11179 | |
| 11180 | type IPortDescStatsReply interface { |
| 11181 | IStatsReply |
| 11182 | GetEntries() []*PortDesc |
| 11183 | } |
| 11184 | |
| 11185 | func (self *PortDescStatsReply) GetEntries() []*PortDesc { |
| 11186 | return self.Entries |
| 11187 | } |
| 11188 | |
| 11189 | func (self *PortDescStatsReply) SetEntries(v []*PortDesc) { |
| 11190 | self.Entries = v |
| 11191 | } |
| 11192 | |
| 11193 | func (self *PortDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 11194 | startIndex := len(encoder.Bytes()) |
| 11195 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 11196 | return err |
| 11197 | } |
| 11198 | |
| 11199 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 11200 | for _, obj := range self.Entries { |
| 11201 | if err := obj.Serialize(encoder); err != nil { |
| 11202 | return err |
| 11203 | } |
| 11204 | } |
| 11205 | length := len(encoder.Bytes()) - startIndex |
| 11206 | |
| 11207 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11208 | |
| 11209 | return nil |
| 11210 | } |
| 11211 | |
| 11212 | func DecodePortDescStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*PortDescStatsReply, error) { |
| 11213 | _portdescstatsreply := &PortDescStatsReply{StatsReply: parent} |
| 11214 | if decoder.Length() < 4 { |
| 11215 | return nil, fmt.Errorf("PortDescStatsReply packet too short: %d < 4", decoder.Length()) |
| 11216 | } |
| 11217 | decoder.Skip(4) |
| 11218 | |
| 11219 | for decoder.Length() >= 40 { |
| 11220 | item := &PortDesc{} |
| 11221 | if err := item.Decode(decoder); err != nil { |
| 11222 | return nil, err |
| 11223 | } |
| 11224 | if item != nil { |
| 11225 | _portdescstatsreply.Entries = append(_portdescstatsreply.Entries, item) |
| 11226 | } |
| 11227 | } |
| 11228 | return _portdescstatsreply, nil |
| 11229 | } |
| 11230 | |
| 11231 | func NewPortDescStatsReply() *PortDescStatsReply { |
| 11232 | obj := &PortDescStatsReply{ |
| 11233 | StatsReply: NewStatsReply(13), |
| 11234 | } |
| 11235 | return obj |
| 11236 | } |
| 11237 | |
| 11238 | type PortDescStatsRequest struct { |
| 11239 | *StatsRequest |
| 11240 | PortNo Port |
| 11241 | } |
| 11242 | |
| 11243 | type IPortDescStatsRequest interface { |
| 11244 | IStatsRequest |
| 11245 | GetPortNo() Port |
| 11246 | } |
| 11247 | |
| 11248 | func (self *PortDescStatsRequest) GetPortNo() Port { |
| 11249 | return self.PortNo |
| 11250 | } |
| 11251 | |
| 11252 | func (self *PortDescStatsRequest) SetPortNo(v Port) { |
| 11253 | self.PortNo = v |
| 11254 | } |
| 11255 | |
| 11256 | func (self *PortDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 11257 | startIndex := len(encoder.Bytes()) |
| 11258 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 11259 | return err |
| 11260 | } |
| 11261 | |
| 11262 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 11263 | self.PortNo.Serialize(encoder) |
| 11264 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 11265 | length := len(encoder.Bytes()) - startIndex |
| 11266 | |
| 11267 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11268 | |
| 11269 | return nil |
| 11270 | } |
| 11271 | |
| 11272 | func DecodePortDescStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*PortDescStatsRequest, error) { |
| 11273 | _portdescstatsrequest := &PortDescStatsRequest{StatsRequest: parent} |
| 11274 | if decoder.Length() < 4 { |
| 11275 | return nil, fmt.Errorf("PortDescStatsRequest packet too short: %d < 4", decoder.Length()) |
| 11276 | } |
| 11277 | decoder.Skip(4) |
| 11278 | _portdescstatsrequest.PortNo.Decode(decoder) |
| 11279 | decoder.Skip(4) |
| 11280 | return _portdescstatsrequest, nil |
| 11281 | } |
| 11282 | |
| 11283 | func NewPortDescStatsRequest() *PortDescStatsRequest { |
| 11284 | obj := &PortDescStatsRequest{ |
| 11285 | StatsRequest: NewStatsRequest(13), |
| 11286 | } |
| 11287 | return obj |
| 11288 | } |
| 11289 | |
| 11290 | type PortMod struct { |
| 11291 | *Header |
| 11292 | PortNo Port |
| 11293 | HwAddr net.HardwareAddr |
| 11294 | Config PortConfig |
| 11295 | Mask PortConfig |
| 11296 | Properties []IPortModProp |
| 11297 | } |
| 11298 | |
| 11299 | type IPortMod interface { |
| 11300 | IHeader |
| 11301 | GetPortNo() Port |
| 11302 | GetHwAddr() net.HardwareAddr |
| 11303 | GetConfig() PortConfig |
| 11304 | GetMask() PortConfig |
| 11305 | GetProperties() []IPortModProp |
| 11306 | } |
| 11307 | |
| 11308 | func (self *PortMod) GetPortNo() Port { |
| 11309 | return self.PortNo |
| 11310 | } |
| 11311 | |
| 11312 | func (self *PortMod) SetPortNo(v Port) { |
| 11313 | self.PortNo = v |
| 11314 | } |
| 11315 | |
| 11316 | func (self *PortMod) GetHwAddr() net.HardwareAddr { |
| 11317 | return self.HwAddr |
| 11318 | } |
| 11319 | |
| 11320 | func (self *PortMod) SetHwAddr(v net.HardwareAddr) { |
| 11321 | self.HwAddr = v |
| 11322 | } |
| 11323 | |
| 11324 | func (self *PortMod) GetConfig() PortConfig { |
| 11325 | return self.Config |
| 11326 | } |
| 11327 | |
| 11328 | func (self *PortMod) SetConfig(v PortConfig) { |
| 11329 | self.Config = v |
| 11330 | } |
| 11331 | |
| 11332 | func (self *PortMod) GetMask() PortConfig { |
| 11333 | return self.Mask |
| 11334 | } |
| 11335 | |
| 11336 | func (self *PortMod) SetMask(v PortConfig) { |
| 11337 | self.Mask = v |
| 11338 | } |
| 11339 | |
| 11340 | func (self *PortMod) GetProperties() []IPortModProp { |
| 11341 | return self.Properties |
| 11342 | } |
| 11343 | |
| 11344 | func (self *PortMod) SetProperties(v []IPortModProp) { |
| 11345 | self.Properties = v |
| 11346 | } |
| 11347 | |
| 11348 | func (self *PortMod) Serialize(encoder *goloxi.Encoder) error { |
| 11349 | startIndex := len(encoder.Bytes()) |
| 11350 | if err := self.Header.Serialize(encoder); err != nil { |
| 11351 | return err |
| 11352 | } |
| 11353 | |
| 11354 | self.PortNo.Serialize(encoder) |
| 11355 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 11356 | encoder.Write(self.HwAddr) |
| 11357 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 11358 | encoder.PutUint32(uint32(self.Config)) |
| 11359 | encoder.PutUint32(uint32(self.Mask)) |
| 11360 | for _, obj := range self.Properties { |
| 11361 | if err := obj.Serialize(encoder); err != nil { |
| 11362 | return err |
| 11363 | } |
| 11364 | } |
| 11365 | length := len(encoder.Bytes()) - startIndex |
| 11366 | |
| 11367 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11368 | |
| 11369 | return nil |
| 11370 | } |
| 11371 | |
| 11372 | func DecodePortMod(parent *Header, decoder *goloxi.Decoder) (*PortMod, error) { |
| 11373 | _portmod := &PortMod{Header: parent} |
| 11374 | if decoder.Length() < 24 { |
| 11375 | return nil, fmt.Errorf("PortMod packet too short: %d < 24", decoder.Length()) |
| 11376 | } |
| 11377 | _portmod.PortNo.Decode(decoder) |
| 11378 | decoder.Skip(4) |
| 11379 | _portmod.HwAddr = net.HardwareAddr(decoder.Read(6)) |
| 11380 | decoder.Skip(2) |
| 11381 | _portmod.Config = PortConfig(decoder.ReadUint32()) |
| 11382 | _portmod.Mask = PortConfig(decoder.ReadUint32()) |
| 11383 | |
| 11384 | for decoder.Length() >= 4 { |
| 11385 | item, err := DecodePortModProp(decoder) |
| 11386 | if err != nil { |
| 11387 | return nil, err |
| 11388 | } |
| 11389 | if item != nil { |
| 11390 | _portmod.Properties = append(_portmod.Properties, item) |
| 11391 | } |
| 11392 | } |
| 11393 | return _portmod, nil |
| 11394 | } |
| 11395 | |
| 11396 | func NewPortMod() *PortMod { |
| 11397 | obj := &PortMod{ |
| 11398 | Header: NewHeader(16), |
| 11399 | } |
| 11400 | return obj |
| 11401 | } |
| 11402 | |
| 11403 | type PortModFailedErrorMsg struct { |
| 11404 | *ErrorMsg |
| 11405 | Code PortModFailedCode |
| 11406 | Data []byte |
| 11407 | } |
| 11408 | |
| 11409 | type IPortModFailedErrorMsg interface { |
| 11410 | IErrorMsg |
| 11411 | GetCode() PortModFailedCode |
| 11412 | GetData() []byte |
| 11413 | } |
| 11414 | |
| 11415 | func (self *PortModFailedErrorMsg) GetCode() PortModFailedCode { |
| 11416 | return self.Code |
| 11417 | } |
| 11418 | |
| 11419 | func (self *PortModFailedErrorMsg) SetCode(v PortModFailedCode) { |
| 11420 | self.Code = v |
| 11421 | } |
| 11422 | |
| 11423 | func (self *PortModFailedErrorMsg) GetData() []byte { |
| 11424 | return self.Data |
| 11425 | } |
| 11426 | |
| 11427 | func (self *PortModFailedErrorMsg) SetData(v []byte) { |
| 11428 | self.Data = v |
| 11429 | } |
| 11430 | |
| 11431 | func (self *PortModFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 11432 | startIndex := len(encoder.Bytes()) |
| 11433 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 11434 | return err |
| 11435 | } |
| 11436 | |
| 11437 | encoder.PutUint16(uint16(self.Code)) |
| 11438 | encoder.Write(self.Data) |
| 11439 | length := len(encoder.Bytes()) - startIndex |
| 11440 | |
| 11441 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11442 | |
| 11443 | return nil |
| 11444 | } |
| 11445 | |
| 11446 | func DecodePortModFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*PortModFailedErrorMsg, error) { |
| 11447 | _portmodfailederrormsg := &PortModFailedErrorMsg{ErrorMsg: parent} |
| 11448 | if decoder.Length() < 2 { |
| 11449 | return nil, fmt.Errorf("PortModFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 11450 | } |
| 11451 | _portmodfailederrormsg.Code = PortModFailedCode(decoder.ReadUint16()) |
| 11452 | _portmodfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 11453 | return _portmodfailederrormsg, nil |
| 11454 | } |
| 11455 | |
| 11456 | func NewPortModFailedErrorMsg() *PortModFailedErrorMsg { |
| 11457 | obj := &PortModFailedErrorMsg{ |
| 11458 | ErrorMsg: NewErrorMsg(7), |
| 11459 | } |
| 11460 | return obj |
| 11461 | } |
| 11462 | |
| 11463 | type PortStatsReply struct { |
| 11464 | *StatsReply |
| 11465 | Entries []*PortStatsEntry |
| 11466 | } |
| 11467 | |
| 11468 | type IPortStatsReply interface { |
| 11469 | IStatsReply |
| 11470 | GetEntries() []*PortStatsEntry |
| 11471 | } |
| 11472 | |
| 11473 | func (self *PortStatsReply) GetEntries() []*PortStatsEntry { |
| 11474 | return self.Entries |
| 11475 | } |
| 11476 | |
| 11477 | func (self *PortStatsReply) SetEntries(v []*PortStatsEntry) { |
| 11478 | self.Entries = v |
| 11479 | } |
| 11480 | |
| 11481 | func (self *PortStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 11482 | startIndex := len(encoder.Bytes()) |
| 11483 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 11484 | return err |
| 11485 | } |
| 11486 | |
| 11487 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 11488 | for _, obj := range self.Entries { |
| 11489 | if err := obj.Serialize(encoder); err != nil { |
| 11490 | return err |
| 11491 | } |
| 11492 | } |
| 11493 | length := len(encoder.Bytes()) - startIndex |
| 11494 | |
| 11495 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11496 | |
| 11497 | return nil |
| 11498 | } |
| 11499 | |
| 11500 | func DecodePortStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*PortStatsReply, error) { |
| 11501 | _portstatsreply := &PortStatsReply{StatsReply: parent} |
| 11502 | if decoder.Length() < 4 { |
| 11503 | return nil, fmt.Errorf("PortStatsReply packet too short: %d < 4", decoder.Length()) |
| 11504 | } |
| 11505 | decoder.Skip(4) |
| 11506 | |
| 11507 | for decoder.Length() >= 80 { |
| 11508 | item, err := DecodePortStatsEntry(decoder) |
| 11509 | if err != nil { |
| 11510 | return nil, err |
| 11511 | } |
| 11512 | if item != nil { |
| 11513 | _portstatsreply.Entries = append(_portstatsreply.Entries, item) |
| 11514 | } |
| 11515 | } |
| 11516 | return _portstatsreply, nil |
| 11517 | } |
| 11518 | |
| 11519 | func NewPortStatsReply() *PortStatsReply { |
| 11520 | obj := &PortStatsReply{ |
| 11521 | StatsReply: NewStatsReply(4), |
| 11522 | } |
| 11523 | return obj |
| 11524 | } |
| 11525 | |
| 11526 | type PortStatsRequest struct { |
| 11527 | *StatsRequest |
| 11528 | PortNo Port |
| 11529 | } |
| 11530 | |
| 11531 | type IPortStatsRequest interface { |
| 11532 | IStatsRequest |
| 11533 | GetPortNo() Port |
| 11534 | } |
| 11535 | |
| 11536 | func (self *PortStatsRequest) GetPortNo() Port { |
| 11537 | return self.PortNo |
| 11538 | } |
| 11539 | |
| 11540 | func (self *PortStatsRequest) SetPortNo(v Port) { |
| 11541 | self.PortNo = v |
| 11542 | } |
| 11543 | |
| 11544 | func (self *PortStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 11545 | startIndex := len(encoder.Bytes()) |
| 11546 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 11547 | return err |
| 11548 | } |
| 11549 | |
| 11550 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 11551 | self.PortNo.Serialize(encoder) |
| 11552 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 11553 | length := len(encoder.Bytes()) - startIndex |
| 11554 | |
| 11555 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11556 | |
| 11557 | return nil |
| 11558 | } |
| 11559 | |
| 11560 | func DecodePortStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*PortStatsRequest, error) { |
| 11561 | _portstatsrequest := &PortStatsRequest{StatsRequest: parent} |
| 11562 | if decoder.Length() < 4 { |
| 11563 | return nil, fmt.Errorf("PortStatsRequest packet too short: %d < 4", decoder.Length()) |
| 11564 | } |
| 11565 | decoder.Skip(4) |
| 11566 | _portstatsrequest.PortNo.Decode(decoder) |
| 11567 | decoder.Skip(4) |
| 11568 | return _portstatsrequest, nil |
| 11569 | } |
| 11570 | |
| 11571 | func NewPortStatsRequest() *PortStatsRequest { |
| 11572 | obj := &PortStatsRequest{ |
| 11573 | StatsRequest: NewStatsRequest(4), |
| 11574 | } |
| 11575 | return obj |
| 11576 | } |
| 11577 | |
| 11578 | type PortStatus struct { |
| 11579 | *Header |
| 11580 | Reason PortReason |
| 11581 | Desc PortDesc |
| 11582 | } |
| 11583 | |
| 11584 | type IPortStatus interface { |
| 11585 | IHeader |
| 11586 | GetReason() PortReason |
| 11587 | GetDesc() PortDesc |
| 11588 | } |
| 11589 | |
| 11590 | func (self *PortStatus) GetReason() PortReason { |
| 11591 | return self.Reason |
| 11592 | } |
| 11593 | |
| 11594 | func (self *PortStatus) SetReason(v PortReason) { |
| 11595 | self.Reason = v |
| 11596 | } |
| 11597 | |
| 11598 | func (self *PortStatus) GetDesc() PortDesc { |
| 11599 | return self.Desc |
| 11600 | } |
| 11601 | |
| 11602 | func (self *PortStatus) SetDesc(v PortDesc) { |
| 11603 | self.Desc = v |
| 11604 | } |
| 11605 | |
| 11606 | func (self *PortStatus) Serialize(encoder *goloxi.Encoder) error { |
| 11607 | startIndex := len(encoder.Bytes()) |
| 11608 | if err := self.Header.Serialize(encoder); err != nil { |
| 11609 | return err |
| 11610 | } |
| 11611 | |
| 11612 | encoder.PutUint8(uint8(self.Reason)) |
| 11613 | encoder.Write(bytes.Repeat([]byte{0}, 7)) |
| 11614 | if err := self.Desc.Serialize(encoder); err != nil { |
| 11615 | return err |
| 11616 | } |
| 11617 | |
| 11618 | length := len(encoder.Bytes()) - startIndex |
| 11619 | |
| 11620 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11621 | |
| 11622 | return nil |
| 11623 | } |
| 11624 | |
| 11625 | func DecodePortStatus(parent *Header, decoder *goloxi.Decoder) (*PortStatus, error) { |
| 11626 | _portstatus := &PortStatus{Header: parent} |
| 11627 | if decoder.Length() < 48 { |
| 11628 | return nil, fmt.Errorf("PortStatus packet too short: %d < 48", decoder.Length()) |
| 11629 | } |
| 11630 | _portstatus.Reason = PortReason(decoder.ReadByte()) |
| 11631 | decoder.Skip(7) |
| 11632 | if err := _portstatus.Desc.Decode(decoder); err != nil { |
| 11633 | return nil, err |
| 11634 | } |
| 11635 | |
| 11636 | return _portstatus, nil |
| 11637 | } |
| 11638 | |
| 11639 | func NewPortStatus() *PortStatus { |
| 11640 | obj := &PortStatus{ |
| 11641 | Header: NewHeader(12), |
| 11642 | } |
| 11643 | return obj |
| 11644 | } |
| 11645 | |
| 11646 | type QueueDescStatsReply struct { |
| 11647 | *StatsReply |
| 11648 | Entries []*QueueDesc |
| 11649 | } |
| 11650 | |
| 11651 | type IQueueDescStatsReply interface { |
| 11652 | IStatsReply |
| 11653 | GetEntries() []*QueueDesc |
| 11654 | } |
| 11655 | |
| 11656 | func (self *QueueDescStatsReply) GetEntries() []*QueueDesc { |
| 11657 | return self.Entries |
| 11658 | } |
| 11659 | |
| 11660 | func (self *QueueDescStatsReply) SetEntries(v []*QueueDesc) { |
| 11661 | self.Entries = v |
| 11662 | } |
| 11663 | |
| 11664 | func (self *QueueDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 11665 | startIndex := len(encoder.Bytes()) |
| 11666 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 11667 | return err |
| 11668 | } |
| 11669 | |
| 11670 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 11671 | for _, obj := range self.Entries { |
| 11672 | if err := obj.Serialize(encoder); err != nil { |
| 11673 | return err |
| 11674 | } |
| 11675 | } |
| 11676 | length := len(encoder.Bytes()) - startIndex |
| 11677 | |
| 11678 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11679 | |
| 11680 | return nil |
| 11681 | } |
| 11682 | |
| 11683 | func DecodeQueueDescStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*QueueDescStatsReply, error) { |
| 11684 | _queuedescstatsreply := &QueueDescStatsReply{StatsReply: parent} |
| 11685 | if decoder.Length() < 4 { |
| 11686 | return nil, fmt.Errorf("QueueDescStatsReply packet too short: %d < 4", decoder.Length()) |
| 11687 | } |
| 11688 | decoder.Skip(4) |
| 11689 | |
| 11690 | for decoder.Length() >= 16 { |
| 11691 | item, err := DecodeQueueDesc(decoder) |
| 11692 | if err != nil { |
| 11693 | return nil, err |
| 11694 | } |
| 11695 | if item != nil { |
| 11696 | _queuedescstatsreply.Entries = append(_queuedescstatsreply.Entries, item) |
| 11697 | } |
| 11698 | } |
| 11699 | return _queuedescstatsreply, nil |
| 11700 | } |
| 11701 | |
| 11702 | func NewQueueDescStatsReply() *QueueDescStatsReply { |
| 11703 | obj := &QueueDescStatsReply{ |
| 11704 | StatsReply: NewStatsReply(15), |
| 11705 | } |
| 11706 | return obj |
| 11707 | } |
| 11708 | |
| 11709 | type QueueDescStatsRequest struct { |
| 11710 | *StatsRequest |
| 11711 | PortNo Port |
| 11712 | QueueId uint32 |
| 11713 | } |
| 11714 | |
| 11715 | type IQueueDescStatsRequest interface { |
| 11716 | IStatsRequest |
| 11717 | GetPortNo() Port |
| 11718 | GetQueueId() uint32 |
| 11719 | } |
| 11720 | |
| 11721 | func (self *QueueDescStatsRequest) GetPortNo() Port { |
| 11722 | return self.PortNo |
| 11723 | } |
| 11724 | |
| 11725 | func (self *QueueDescStatsRequest) SetPortNo(v Port) { |
| 11726 | self.PortNo = v |
| 11727 | } |
| 11728 | |
| 11729 | func (self *QueueDescStatsRequest) GetQueueId() uint32 { |
| 11730 | return self.QueueId |
| 11731 | } |
| 11732 | |
| 11733 | func (self *QueueDescStatsRequest) SetQueueId(v uint32) { |
| 11734 | self.QueueId = v |
| 11735 | } |
| 11736 | |
| 11737 | func (self *QueueDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 11738 | startIndex := len(encoder.Bytes()) |
| 11739 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 11740 | return err |
| 11741 | } |
| 11742 | |
| 11743 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 11744 | self.PortNo.Serialize(encoder) |
| 11745 | encoder.PutUint32(uint32(self.QueueId)) |
| 11746 | length := len(encoder.Bytes()) - startIndex |
| 11747 | |
| 11748 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11749 | |
| 11750 | return nil |
| 11751 | } |
| 11752 | |
| 11753 | func DecodeQueueDescStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*QueueDescStatsRequest, error) { |
| 11754 | _queuedescstatsrequest := &QueueDescStatsRequest{StatsRequest: parent} |
| 11755 | if decoder.Length() < 12 { |
| 11756 | return nil, fmt.Errorf("QueueDescStatsRequest packet too short: %d < 12", decoder.Length()) |
| 11757 | } |
| 11758 | decoder.Skip(4) |
| 11759 | _queuedescstatsrequest.PortNo.Decode(decoder) |
| 11760 | _queuedescstatsrequest.QueueId = uint32(decoder.ReadUint32()) |
| 11761 | return _queuedescstatsrequest, nil |
| 11762 | } |
| 11763 | |
| 11764 | func NewQueueDescStatsRequest() *QueueDescStatsRequest { |
| 11765 | obj := &QueueDescStatsRequest{ |
| 11766 | StatsRequest: NewStatsRequest(15), |
| 11767 | } |
| 11768 | return obj |
| 11769 | } |
| 11770 | |
| 11771 | type QueueOpFailedErrorMsg struct { |
| 11772 | *ErrorMsg |
| 11773 | Code QueueOpFailedCode |
| 11774 | Data []byte |
| 11775 | } |
| 11776 | |
| 11777 | type IQueueOpFailedErrorMsg interface { |
| 11778 | IErrorMsg |
| 11779 | GetCode() QueueOpFailedCode |
| 11780 | GetData() []byte |
| 11781 | } |
| 11782 | |
| 11783 | func (self *QueueOpFailedErrorMsg) GetCode() QueueOpFailedCode { |
| 11784 | return self.Code |
| 11785 | } |
| 11786 | |
| 11787 | func (self *QueueOpFailedErrorMsg) SetCode(v QueueOpFailedCode) { |
| 11788 | self.Code = v |
| 11789 | } |
| 11790 | |
| 11791 | func (self *QueueOpFailedErrorMsg) GetData() []byte { |
| 11792 | return self.Data |
| 11793 | } |
| 11794 | |
| 11795 | func (self *QueueOpFailedErrorMsg) SetData(v []byte) { |
| 11796 | self.Data = v |
| 11797 | } |
| 11798 | |
| 11799 | func (self *QueueOpFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 11800 | startIndex := len(encoder.Bytes()) |
| 11801 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 11802 | return err |
| 11803 | } |
| 11804 | |
| 11805 | encoder.PutUint16(uint16(self.Code)) |
| 11806 | encoder.Write(self.Data) |
| 11807 | length := len(encoder.Bytes()) - startIndex |
| 11808 | |
| 11809 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11810 | |
| 11811 | return nil |
| 11812 | } |
| 11813 | |
| 11814 | func DecodeQueueOpFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*QueueOpFailedErrorMsg, error) { |
| 11815 | _queueopfailederrormsg := &QueueOpFailedErrorMsg{ErrorMsg: parent} |
| 11816 | if decoder.Length() < 2 { |
| 11817 | return nil, fmt.Errorf("QueueOpFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 11818 | } |
| 11819 | _queueopfailederrormsg.Code = QueueOpFailedCode(decoder.ReadUint16()) |
| 11820 | _queueopfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 11821 | return _queueopfailederrormsg, nil |
| 11822 | } |
| 11823 | |
| 11824 | func NewQueueOpFailedErrorMsg() *QueueOpFailedErrorMsg { |
| 11825 | obj := &QueueOpFailedErrorMsg{ |
| 11826 | ErrorMsg: NewErrorMsg(9), |
| 11827 | } |
| 11828 | return obj |
| 11829 | } |
| 11830 | |
| 11831 | type QueueStatsReply struct { |
| 11832 | *StatsReply |
| 11833 | Entries []*QueueStatsEntry |
| 11834 | } |
| 11835 | |
| 11836 | type IQueueStatsReply interface { |
| 11837 | IStatsReply |
| 11838 | GetEntries() []*QueueStatsEntry |
| 11839 | } |
| 11840 | |
| 11841 | func (self *QueueStatsReply) GetEntries() []*QueueStatsEntry { |
| 11842 | return self.Entries |
| 11843 | } |
| 11844 | |
| 11845 | func (self *QueueStatsReply) SetEntries(v []*QueueStatsEntry) { |
| 11846 | self.Entries = v |
| 11847 | } |
| 11848 | |
| 11849 | func (self *QueueStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 11850 | startIndex := len(encoder.Bytes()) |
| 11851 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 11852 | return err |
| 11853 | } |
| 11854 | |
| 11855 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 11856 | for _, obj := range self.Entries { |
| 11857 | if err := obj.Serialize(encoder); err != nil { |
| 11858 | return err |
| 11859 | } |
| 11860 | } |
| 11861 | length := len(encoder.Bytes()) - startIndex |
| 11862 | |
| 11863 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11864 | |
| 11865 | return nil |
| 11866 | } |
| 11867 | |
| 11868 | func DecodeQueueStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*QueueStatsReply, error) { |
| 11869 | _queuestatsreply := &QueueStatsReply{StatsReply: parent} |
| 11870 | if decoder.Length() < 4 { |
| 11871 | return nil, fmt.Errorf("QueueStatsReply packet too short: %d < 4", decoder.Length()) |
| 11872 | } |
| 11873 | decoder.Skip(4) |
| 11874 | |
| 11875 | for decoder.Length() >= 48 { |
| 11876 | item, err := DecodeQueueStatsEntry(decoder) |
| 11877 | if err != nil { |
| 11878 | return nil, err |
| 11879 | } |
| 11880 | if item != nil { |
| 11881 | _queuestatsreply.Entries = append(_queuestatsreply.Entries, item) |
| 11882 | } |
| 11883 | } |
| 11884 | return _queuestatsreply, nil |
| 11885 | } |
| 11886 | |
| 11887 | func NewQueueStatsReply() *QueueStatsReply { |
| 11888 | obj := &QueueStatsReply{ |
| 11889 | StatsReply: NewStatsReply(5), |
| 11890 | } |
| 11891 | return obj |
| 11892 | } |
| 11893 | |
| 11894 | type QueueStatsRequest struct { |
| 11895 | *StatsRequest |
| 11896 | PortNo Port |
| 11897 | QueueId uint32 |
| 11898 | } |
| 11899 | |
| 11900 | type IQueueStatsRequest interface { |
| 11901 | IStatsRequest |
| 11902 | GetPortNo() Port |
| 11903 | GetQueueId() uint32 |
| 11904 | } |
| 11905 | |
| 11906 | func (self *QueueStatsRequest) GetPortNo() Port { |
| 11907 | return self.PortNo |
| 11908 | } |
| 11909 | |
| 11910 | func (self *QueueStatsRequest) SetPortNo(v Port) { |
| 11911 | self.PortNo = v |
| 11912 | } |
| 11913 | |
| 11914 | func (self *QueueStatsRequest) GetQueueId() uint32 { |
| 11915 | return self.QueueId |
| 11916 | } |
| 11917 | |
| 11918 | func (self *QueueStatsRequest) SetQueueId(v uint32) { |
| 11919 | self.QueueId = v |
| 11920 | } |
| 11921 | |
| 11922 | func (self *QueueStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 11923 | startIndex := len(encoder.Bytes()) |
| 11924 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 11925 | return err |
| 11926 | } |
| 11927 | |
| 11928 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 11929 | self.PortNo.Serialize(encoder) |
| 11930 | encoder.PutUint32(uint32(self.QueueId)) |
| 11931 | length := len(encoder.Bytes()) - startIndex |
| 11932 | |
| 11933 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11934 | |
| 11935 | return nil |
| 11936 | } |
| 11937 | |
| 11938 | func DecodeQueueStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*QueueStatsRequest, error) { |
| 11939 | _queuestatsrequest := &QueueStatsRequest{StatsRequest: parent} |
| 11940 | if decoder.Length() < 12 { |
| 11941 | return nil, fmt.Errorf("QueueStatsRequest packet too short: %d < 12", decoder.Length()) |
| 11942 | } |
| 11943 | decoder.Skip(4) |
| 11944 | _queuestatsrequest.PortNo.Decode(decoder) |
| 11945 | _queuestatsrequest.QueueId = uint32(decoder.ReadUint32()) |
| 11946 | return _queuestatsrequest, nil |
| 11947 | } |
| 11948 | |
| 11949 | func NewQueueStatsRequest() *QueueStatsRequest { |
| 11950 | obj := &QueueStatsRequest{ |
| 11951 | StatsRequest: NewStatsRequest(5), |
| 11952 | } |
| 11953 | return obj |
| 11954 | } |
| 11955 | |
| 11956 | type Requestforward struct { |
| 11957 | *Header |
| 11958 | Request IHeader |
| 11959 | } |
| 11960 | |
| 11961 | type IRequestforward interface { |
| 11962 | IHeader |
| 11963 | GetRequest() IHeader |
| 11964 | } |
| 11965 | |
| 11966 | func (self *Requestforward) GetRequest() IHeader { |
| 11967 | return self.Request |
| 11968 | } |
| 11969 | |
| 11970 | func (self *Requestforward) SetRequest(v IHeader) { |
| 11971 | self.Request = v |
| 11972 | } |
| 11973 | |
| 11974 | func (self *Requestforward) Serialize(encoder *goloxi.Encoder) error { |
| 11975 | startIndex := len(encoder.Bytes()) |
| 11976 | if err := self.Header.Serialize(encoder); err != nil { |
| 11977 | return err |
| 11978 | } |
| 11979 | |
| 11980 | self.Request.Serialize(encoder) |
| 11981 | length := len(encoder.Bytes()) - startIndex |
| 11982 | |
| 11983 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 11984 | |
| 11985 | return nil |
| 11986 | } |
| 11987 | |
| 11988 | func DecodeRequestforward(parent *Header, decoder *goloxi.Decoder) (*Requestforward, error) { |
| 11989 | _requestforward := &Requestforward{Header: parent} |
| 11990 | if decoder.Length() < 8 { |
| 11991 | return nil, fmt.Errorf("Requestforward packet too short: %d < 8", decoder.Length()) |
| 11992 | } |
| 11993 | if obj, err := DecodeHeader(decoder); err != nil { |
| 11994 | return nil, err |
| 11995 | } else { |
| 11996 | _requestforward.Request = obj |
| 11997 | } |
| 11998 | |
| 11999 | return _requestforward, nil |
| 12000 | } |
| 12001 | |
| 12002 | func NewRequestforward() *Requestforward { |
| 12003 | obj := &Requestforward{ |
| 12004 | Header: NewHeader(32), |
| 12005 | } |
| 12006 | return obj |
| 12007 | } |
| 12008 | |
| 12009 | type RoleReply struct { |
| 12010 | *Header |
| 12011 | Role ControllerRole |
| 12012 | ShortId uint16 |
| 12013 | GenerationId uint64 |
| 12014 | } |
| 12015 | |
| 12016 | type IRoleReply interface { |
| 12017 | IHeader |
| 12018 | GetRole() ControllerRole |
| 12019 | GetShortId() uint16 |
| 12020 | GetGenerationId() uint64 |
| 12021 | } |
| 12022 | |
| 12023 | func (self *RoleReply) GetRole() ControllerRole { |
| 12024 | return self.Role |
| 12025 | } |
| 12026 | |
| 12027 | func (self *RoleReply) SetRole(v ControllerRole) { |
| 12028 | self.Role = v |
| 12029 | } |
| 12030 | |
| 12031 | func (self *RoleReply) GetShortId() uint16 { |
| 12032 | return self.ShortId |
| 12033 | } |
| 12034 | |
| 12035 | func (self *RoleReply) SetShortId(v uint16) { |
| 12036 | self.ShortId = v |
| 12037 | } |
| 12038 | |
| 12039 | func (self *RoleReply) GetGenerationId() uint64 { |
| 12040 | return self.GenerationId |
| 12041 | } |
| 12042 | |
| 12043 | func (self *RoleReply) SetGenerationId(v uint64) { |
| 12044 | self.GenerationId = v |
| 12045 | } |
| 12046 | |
| 12047 | func (self *RoleReply) Serialize(encoder *goloxi.Encoder) error { |
| 12048 | startIndex := len(encoder.Bytes()) |
| 12049 | if err := self.Header.Serialize(encoder); err != nil { |
| 12050 | return err |
| 12051 | } |
| 12052 | |
| 12053 | encoder.PutUint32(uint32(self.Role)) |
| 12054 | encoder.PutUint16(uint16(self.ShortId)) |
| 12055 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 12056 | encoder.PutUint64(uint64(self.GenerationId)) |
| 12057 | length := len(encoder.Bytes()) - startIndex |
| 12058 | |
| 12059 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12060 | |
| 12061 | return nil |
| 12062 | } |
| 12063 | |
| 12064 | func DecodeRoleReply(parent *Header, decoder *goloxi.Decoder) (*RoleReply, error) { |
| 12065 | _rolereply := &RoleReply{Header: parent} |
| 12066 | if decoder.Length() < 16 { |
| 12067 | return nil, fmt.Errorf("RoleReply packet too short: %d < 16", decoder.Length()) |
| 12068 | } |
| 12069 | _rolereply.Role = ControllerRole(decoder.ReadUint32()) |
| 12070 | _rolereply.ShortId = uint16(decoder.ReadUint16()) |
| 12071 | decoder.Skip(2) |
| 12072 | _rolereply.GenerationId = uint64(decoder.ReadUint64()) |
| 12073 | return _rolereply, nil |
| 12074 | } |
| 12075 | |
| 12076 | func NewRoleReply() *RoleReply { |
| 12077 | obj := &RoleReply{ |
| 12078 | Header: NewHeader(25), |
| 12079 | } |
| 12080 | return obj |
| 12081 | } |
| 12082 | |
| 12083 | type RoleRequest struct { |
| 12084 | *Header |
| 12085 | Role ControllerRole |
| 12086 | ShortId uint16 |
| 12087 | GenerationId uint64 |
| 12088 | } |
| 12089 | |
| 12090 | type IRoleRequest interface { |
| 12091 | IHeader |
| 12092 | GetRole() ControllerRole |
| 12093 | GetShortId() uint16 |
| 12094 | GetGenerationId() uint64 |
| 12095 | } |
| 12096 | |
| 12097 | func (self *RoleRequest) GetRole() ControllerRole { |
| 12098 | return self.Role |
| 12099 | } |
| 12100 | |
| 12101 | func (self *RoleRequest) SetRole(v ControllerRole) { |
| 12102 | self.Role = v |
| 12103 | } |
| 12104 | |
| 12105 | func (self *RoleRequest) GetShortId() uint16 { |
| 12106 | return self.ShortId |
| 12107 | } |
| 12108 | |
| 12109 | func (self *RoleRequest) SetShortId(v uint16) { |
| 12110 | self.ShortId = v |
| 12111 | } |
| 12112 | |
| 12113 | func (self *RoleRequest) GetGenerationId() uint64 { |
| 12114 | return self.GenerationId |
| 12115 | } |
| 12116 | |
| 12117 | func (self *RoleRequest) SetGenerationId(v uint64) { |
| 12118 | self.GenerationId = v |
| 12119 | } |
| 12120 | |
| 12121 | func (self *RoleRequest) Serialize(encoder *goloxi.Encoder) error { |
| 12122 | startIndex := len(encoder.Bytes()) |
| 12123 | if err := self.Header.Serialize(encoder); err != nil { |
| 12124 | return err |
| 12125 | } |
| 12126 | |
| 12127 | encoder.PutUint32(uint32(self.Role)) |
| 12128 | encoder.PutUint16(uint16(self.ShortId)) |
| 12129 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 12130 | encoder.PutUint64(uint64(self.GenerationId)) |
| 12131 | length := len(encoder.Bytes()) - startIndex |
| 12132 | |
| 12133 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12134 | |
| 12135 | return nil |
| 12136 | } |
| 12137 | |
| 12138 | func DecodeRoleRequest(parent *Header, decoder *goloxi.Decoder) (*RoleRequest, error) { |
| 12139 | _rolerequest := &RoleRequest{Header: parent} |
| 12140 | if decoder.Length() < 16 { |
| 12141 | return nil, fmt.Errorf("RoleRequest packet too short: %d < 16", decoder.Length()) |
| 12142 | } |
| 12143 | _rolerequest.Role = ControllerRole(decoder.ReadUint32()) |
| 12144 | _rolerequest.ShortId = uint16(decoder.ReadUint16()) |
| 12145 | decoder.Skip(2) |
| 12146 | _rolerequest.GenerationId = uint64(decoder.ReadUint64()) |
| 12147 | return _rolerequest, nil |
| 12148 | } |
| 12149 | |
| 12150 | func NewRoleRequest() *RoleRequest { |
| 12151 | obj := &RoleRequest{ |
| 12152 | Header: NewHeader(24), |
| 12153 | } |
| 12154 | return obj |
| 12155 | } |
| 12156 | |
| 12157 | type RoleRequestFailedErrorMsg struct { |
| 12158 | *ErrorMsg |
| 12159 | Code RoleRequestFailedCode |
| 12160 | Data []byte |
| 12161 | } |
| 12162 | |
| 12163 | type IRoleRequestFailedErrorMsg interface { |
| 12164 | IErrorMsg |
| 12165 | GetCode() RoleRequestFailedCode |
| 12166 | GetData() []byte |
| 12167 | } |
| 12168 | |
| 12169 | func (self *RoleRequestFailedErrorMsg) GetCode() RoleRequestFailedCode { |
| 12170 | return self.Code |
| 12171 | } |
| 12172 | |
| 12173 | func (self *RoleRequestFailedErrorMsg) SetCode(v RoleRequestFailedCode) { |
| 12174 | self.Code = v |
| 12175 | } |
| 12176 | |
| 12177 | func (self *RoleRequestFailedErrorMsg) GetData() []byte { |
| 12178 | return self.Data |
| 12179 | } |
| 12180 | |
| 12181 | func (self *RoleRequestFailedErrorMsg) SetData(v []byte) { |
| 12182 | self.Data = v |
| 12183 | } |
| 12184 | |
| 12185 | func (self *RoleRequestFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 12186 | startIndex := len(encoder.Bytes()) |
| 12187 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 12188 | return err |
| 12189 | } |
| 12190 | |
| 12191 | encoder.PutUint16(uint16(self.Code)) |
| 12192 | encoder.Write(self.Data) |
| 12193 | length := len(encoder.Bytes()) - startIndex |
| 12194 | |
| 12195 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12196 | |
| 12197 | return nil |
| 12198 | } |
| 12199 | |
| 12200 | func DecodeRoleRequestFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*RoleRequestFailedErrorMsg, error) { |
| 12201 | _rolerequestfailederrormsg := &RoleRequestFailedErrorMsg{ErrorMsg: parent} |
| 12202 | if decoder.Length() < 2 { |
| 12203 | return nil, fmt.Errorf("RoleRequestFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 12204 | } |
| 12205 | _rolerequestfailederrormsg.Code = RoleRequestFailedCode(decoder.ReadUint16()) |
| 12206 | _rolerequestfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 12207 | return _rolerequestfailederrormsg, nil |
| 12208 | } |
| 12209 | |
| 12210 | func NewRoleRequestFailedErrorMsg() *RoleRequestFailedErrorMsg { |
| 12211 | obj := &RoleRequestFailedErrorMsg{ |
| 12212 | ErrorMsg: NewErrorMsg(11), |
| 12213 | } |
| 12214 | return obj |
| 12215 | } |
| 12216 | |
| 12217 | type RoleStatus struct { |
| 12218 | *Header |
| 12219 | Role ControllerRole |
| 12220 | Reason ControllerRoleReason |
| 12221 | GenerationId uint64 |
| 12222 | Properties []IRoleProp |
| 12223 | } |
| 12224 | |
| 12225 | type IRoleStatus interface { |
| 12226 | IHeader |
| 12227 | GetRole() ControllerRole |
| 12228 | GetReason() ControllerRoleReason |
| 12229 | GetGenerationId() uint64 |
| 12230 | GetProperties() []IRoleProp |
| 12231 | } |
| 12232 | |
| 12233 | func (self *RoleStatus) GetRole() ControllerRole { |
| 12234 | return self.Role |
| 12235 | } |
| 12236 | |
| 12237 | func (self *RoleStatus) SetRole(v ControllerRole) { |
| 12238 | self.Role = v |
| 12239 | } |
| 12240 | |
| 12241 | func (self *RoleStatus) GetReason() ControllerRoleReason { |
| 12242 | return self.Reason |
| 12243 | } |
| 12244 | |
| 12245 | func (self *RoleStatus) SetReason(v ControllerRoleReason) { |
| 12246 | self.Reason = v |
| 12247 | } |
| 12248 | |
| 12249 | func (self *RoleStatus) GetGenerationId() uint64 { |
| 12250 | return self.GenerationId |
| 12251 | } |
| 12252 | |
| 12253 | func (self *RoleStatus) SetGenerationId(v uint64) { |
| 12254 | self.GenerationId = v |
| 12255 | } |
| 12256 | |
| 12257 | func (self *RoleStatus) GetProperties() []IRoleProp { |
| 12258 | return self.Properties |
| 12259 | } |
| 12260 | |
| 12261 | func (self *RoleStatus) SetProperties(v []IRoleProp) { |
| 12262 | self.Properties = v |
| 12263 | } |
| 12264 | |
| 12265 | func (self *RoleStatus) Serialize(encoder *goloxi.Encoder) error { |
| 12266 | startIndex := len(encoder.Bytes()) |
| 12267 | if err := self.Header.Serialize(encoder); err != nil { |
| 12268 | return err |
| 12269 | } |
| 12270 | |
| 12271 | encoder.PutUint32(uint32(self.Role)) |
| 12272 | encoder.PutUint8(uint8(self.Reason)) |
| 12273 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 12274 | encoder.PutUint64(uint64(self.GenerationId)) |
| 12275 | for _, obj := range self.Properties { |
| 12276 | if err := obj.Serialize(encoder); err != nil { |
| 12277 | return err |
| 12278 | } |
| 12279 | } |
| 12280 | length := len(encoder.Bytes()) - startIndex |
| 12281 | |
| 12282 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12283 | |
| 12284 | return nil |
| 12285 | } |
| 12286 | |
| 12287 | func DecodeRoleStatus(parent *Header, decoder *goloxi.Decoder) (*RoleStatus, error) { |
| 12288 | _rolestatus := &RoleStatus{Header: parent} |
| 12289 | if decoder.Length() < 16 { |
| 12290 | return nil, fmt.Errorf("RoleStatus packet too short: %d < 16", decoder.Length()) |
| 12291 | } |
| 12292 | _rolestatus.Role = ControllerRole(decoder.ReadUint32()) |
| 12293 | _rolestatus.Reason = ControllerRoleReason(decoder.ReadByte()) |
| 12294 | decoder.Skip(3) |
| 12295 | _rolestatus.GenerationId = uint64(decoder.ReadUint64()) |
| 12296 | |
| 12297 | for decoder.Length() >= 4 { |
| 12298 | item, err := DecodeRoleProp(decoder) |
| 12299 | if err != nil { |
| 12300 | return nil, err |
| 12301 | } |
| 12302 | if item != nil { |
| 12303 | _rolestatus.Properties = append(_rolestatus.Properties, item) |
| 12304 | } |
| 12305 | } |
| 12306 | return _rolestatus, nil |
| 12307 | } |
| 12308 | |
| 12309 | func NewRoleStatus() *RoleStatus { |
| 12310 | obj := &RoleStatus{ |
| 12311 | Header: NewHeader(30), |
| 12312 | } |
| 12313 | return obj |
| 12314 | } |
| 12315 | |
| 12316 | type SetConfig struct { |
| 12317 | *Header |
| 12318 | Flags ConfigFlags |
| 12319 | MissSendLen uint16 |
| 12320 | } |
| 12321 | |
| 12322 | type ISetConfig interface { |
| 12323 | IHeader |
| 12324 | GetFlags() ConfigFlags |
| 12325 | GetMissSendLen() uint16 |
| 12326 | } |
| 12327 | |
| 12328 | func (self *SetConfig) GetFlags() ConfigFlags { |
| 12329 | return self.Flags |
| 12330 | } |
| 12331 | |
| 12332 | func (self *SetConfig) SetFlags(v ConfigFlags) { |
| 12333 | self.Flags = v |
| 12334 | } |
| 12335 | |
| 12336 | func (self *SetConfig) GetMissSendLen() uint16 { |
| 12337 | return self.MissSendLen |
| 12338 | } |
| 12339 | |
| 12340 | func (self *SetConfig) SetMissSendLen(v uint16) { |
| 12341 | self.MissSendLen = v |
| 12342 | } |
| 12343 | |
| 12344 | func (self *SetConfig) Serialize(encoder *goloxi.Encoder) error { |
| 12345 | startIndex := len(encoder.Bytes()) |
| 12346 | if err := self.Header.Serialize(encoder); err != nil { |
| 12347 | return err |
| 12348 | } |
| 12349 | |
| 12350 | encoder.PutUint16(uint16(self.Flags)) |
| 12351 | encoder.PutUint16(uint16(self.MissSendLen)) |
| 12352 | length := len(encoder.Bytes()) - startIndex |
| 12353 | |
| 12354 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12355 | |
| 12356 | return nil |
| 12357 | } |
| 12358 | |
| 12359 | func DecodeSetConfig(parent *Header, decoder *goloxi.Decoder) (*SetConfig, error) { |
| 12360 | _setconfig := &SetConfig{Header: parent} |
| 12361 | if decoder.Length() < 4 { |
| 12362 | return nil, fmt.Errorf("SetConfig packet too short: %d < 4", decoder.Length()) |
| 12363 | } |
| 12364 | _setconfig.Flags = ConfigFlags(decoder.ReadUint16()) |
| 12365 | _setconfig.MissSendLen = uint16(decoder.ReadUint16()) |
| 12366 | return _setconfig, nil |
| 12367 | } |
| 12368 | |
| 12369 | func NewSetConfig() *SetConfig { |
| 12370 | obj := &SetConfig{ |
| 12371 | Header: NewHeader(9), |
| 12372 | } |
| 12373 | return obj |
| 12374 | } |
| 12375 | |
| 12376 | type SwitchConfigFailedErrorMsg struct { |
| 12377 | *ErrorMsg |
| 12378 | Code SwitchConfigFailedCode |
| 12379 | Data []byte |
| 12380 | } |
| 12381 | |
| 12382 | type ISwitchConfigFailedErrorMsg interface { |
| 12383 | IErrorMsg |
| 12384 | GetCode() SwitchConfigFailedCode |
| 12385 | GetData() []byte |
| 12386 | } |
| 12387 | |
| 12388 | func (self *SwitchConfigFailedErrorMsg) GetCode() SwitchConfigFailedCode { |
| 12389 | return self.Code |
| 12390 | } |
| 12391 | |
| 12392 | func (self *SwitchConfigFailedErrorMsg) SetCode(v SwitchConfigFailedCode) { |
| 12393 | self.Code = v |
| 12394 | } |
| 12395 | |
| 12396 | func (self *SwitchConfigFailedErrorMsg) GetData() []byte { |
| 12397 | return self.Data |
| 12398 | } |
| 12399 | |
| 12400 | func (self *SwitchConfigFailedErrorMsg) SetData(v []byte) { |
| 12401 | self.Data = v |
| 12402 | } |
| 12403 | |
| 12404 | func (self *SwitchConfigFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 12405 | startIndex := len(encoder.Bytes()) |
| 12406 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 12407 | return err |
| 12408 | } |
| 12409 | |
| 12410 | encoder.PutUint16(uint16(self.Code)) |
| 12411 | encoder.Write(self.Data) |
| 12412 | length := len(encoder.Bytes()) - startIndex |
| 12413 | |
| 12414 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12415 | |
| 12416 | return nil |
| 12417 | } |
| 12418 | |
| 12419 | func DecodeSwitchConfigFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*SwitchConfigFailedErrorMsg, error) { |
| 12420 | _switchconfigfailederrormsg := &SwitchConfigFailedErrorMsg{ErrorMsg: parent} |
| 12421 | if decoder.Length() < 2 { |
| 12422 | return nil, fmt.Errorf("SwitchConfigFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 12423 | } |
| 12424 | _switchconfigfailederrormsg.Code = SwitchConfigFailedCode(decoder.ReadUint16()) |
| 12425 | _switchconfigfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 12426 | return _switchconfigfailederrormsg, nil |
| 12427 | } |
| 12428 | |
| 12429 | func NewSwitchConfigFailedErrorMsg() *SwitchConfigFailedErrorMsg { |
| 12430 | obj := &SwitchConfigFailedErrorMsg{ |
| 12431 | ErrorMsg: NewErrorMsg(10), |
| 12432 | } |
| 12433 | return obj |
| 12434 | } |
| 12435 | |
| 12436 | type TableDescStatsReply struct { |
| 12437 | *StatsReply |
| 12438 | Entries []*TableDesc |
| 12439 | } |
| 12440 | |
| 12441 | type ITableDescStatsReply interface { |
| 12442 | IStatsReply |
| 12443 | GetEntries() []*TableDesc |
| 12444 | } |
| 12445 | |
| 12446 | func (self *TableDescStatsReply) GetEntries() []*TableDesc { |
| 12447 | return self.Entries |
| 12448 | } |
| 12449 | |
| 12450 | func (self *TableDescStatsReply) SetEntries(v []*TableDesc) { |
| 12451 | self.Entries = v |
| 12452 | } |
| 12453 | |
| 12454 | func (self *TableDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 12455 | startIndex := len(encoder.Bytes()) |
| 12456 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 12457 | return err |
| 12458 | } |
| 12459 | |
| 12460 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 12461 | for _, obj := range self.Entries { |
| 12462 | if err := obj.Serialize(encoder); err != nil { |
| 12463 | return err |
| 12464 | } |
| 12465 | } |
| 12466 | length := len(encoder.Bytes()) - startIndex |
| 12467 | |
| 12468 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12469 | |
| 12470 | return nil |
| 12471 | } |
| 12472 | |
| 12473 | func DecodeTableDescStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*TableDescStatsReply, error) { |
| 12474 | _tabledescstatsreply := &TableDescStatsReply{StatsReply: parent} |
| 12475 | if decoder.Length() < 4 { |
| 12476 | return nil, fmt.Errorf("TableDescStatsReply packet too short: %d < 4", decoder.Length()) |
| 12477 | } |
| 12478 | decoder.Skip(4) |
| 12479 | |
| 12480 | for decoder.Length() >= 8 { |
| 12481 | item := &TableDesc{} |
| 12482 | if err := item.Decode(decoder); err != nil { |
| 12483 | return nil, err |
| 12484 | } |
| 12485 | if item != nil { |
| 12486 | _tabledescstatsreply.Entries = append(_tabledescstatsreply.Entries, item) |
| 12487 | } |
| 12488 | } |
| 12489 | return _tabledescstatsreply, nil |
| 12490 | } |
| 12491 | |
| 12492 | func NewTableDescStatsReply() *TableDescStatsReply { |
| 12493 | obj := &TableDescStatsReply{ |
| 12494 | StatsReply: NewStatsReply(14), |
| 12495 | } |
| 12496 | return obj |
| 12497 | } |
| 12498 | |
| 12499 | type TableDescStatsRequest struct { |
| 12500 | *StatsRequest |
| 12501 | } |
| 12502 | |
| 12503 | type ITableDescStatsRequest interface { |
| 12504 | IStatsRequest |
| 12505 | } |
| 12506 | |
| 12507 | func (self *TableDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 12508 | startIndex := len(encoder.Bytes()) |
| 12509 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 12510 | return err |
| 12511 | } |
| 12512 | |
| 12513 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 12514 | length := len(encoder.Bytes()) - startIndex |
| 12515 | |
| 12516 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12517 | |
| 12518 | return nil |
| 12519 | } |
| 12520 | |
| 12521 | func DecodeTableDescStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*TableDescStatsRequest, error) { |
| 12522 | _tabledescstatsrequest := &TableDescStatsRequest{StatsRequest: parent} |
| 12523 | if decoder.Length() < 4 { |
| 12524 | return nil, fmt.Errorf("TableDescStatsRequest packet too short: %d < 4", decoder.Length()) |
| 12525 | } |
| 12526 | decoder.Skip(4) |
| 12527 | return _tabledescstatsrequest, nil |
| 12528 | } |
| 12529 | |
| 12530 | func NewTableDescStatsRequest() *TableDescStatsRequest { |
| 12531 | obj := &TableDescStatsRequest{ |
| 12532 | StatsRequest: NewStatsRequest(14), |
| 12533 | } |
| 12534 | return obj |
| 12535 | } |
| 12536 | |
| 12537 | type TableFeaturesFailedErrorMsg struct { |
| 12538 | *ErrorMsg |
| 12539 | Code TableFeaturesFailedCode |
| 12540 | Data []byte |
| 12541 | } |
| 12542 | |
| 12543 | type ITableFeaturesFailedErrorMsg interface { |
| 12544 | IErrorMsg |
| 12545 | GetCode() TableFeaturesFailedCode |
| 12546 | GetData() []byte |
| 12547 | } |
| 12548 | |
| 12549 | func (self *TableFeaturesFailedErrorMsg) GetCode() TableFeaturesFailedCode { |
| 12550 | return self.Code |
| 12551 | } |
| 12552 | |
| 12553 | func (self *TableFeaturesFailedErrorMsg) SetCode(v TableFeaturesFailedCode) { |
| 12554 | self.Code = v |
| 12555 | } |
| 12556 | |
| 12557 | func (self *TableFeaturesFailedErrorMsg) GetData() []byte { |
| 12558 | return self.Data |
| 12559 | } |
| 12560 | |
| 12561 | func (self *TableFeaturesFailedErrorMsg) SetData(v []byte) { |
| 12562 | self.Data = v |
| 12563 | } |
| 12564 | |
| 12565 | func (self *TableFeaturesFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 12566 | startIndex := len(encoder.Bytes()) |
| 12567 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 12568 | return err |
| 12569 | } |
| 12570 | |
| 12571 | encoder.PutUint16(uint16(self.Code)) |
| 12572 | encoder.Write(self.Data) |
| 12573 | length := len(encoder.Bytes()) - startIndex |
| 12574 | |
| 12575 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12576 | |
| 12577 | return nil |
| 12578 | } |
| 12579 | |
| 12580 | func DecodeTableFeaturesFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*TableFeaturesFailedErrorMsg, error) { |
| 12581 | _tablefeaturesfailederrormsg := &TableFeaturesFailedErrorMsg{ErrorMsg: parent} |
| 12582 | if decoder.Length() < 2 { |
| 12583 | return nil, fmt.Errorf("TableFeaturesFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 12584 | } |
| 12585 | _tablefeaturesfailederrormsg.Code = TableFeaturesFailedCode(decoder.ReadUint16()) |
| 12586 | _tablefeaturesfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 12587 | return _tablefeaturesfailederrormsg, nil |
| 12588 | } |
| 12589 | |
| 12590 | func NewTableFeaturesFailedErrorMsg() *TableFeaturesFailedErrorMsg { |
| 12591 | obj := &TableFeaturesFailedErrorMsg{ |
| 12592 | ErrorMsg: NewErrorMsg(13), |
| 12593 | } |
| 12594 | return obj |
| 12595 | } |
| 12596 | |
| 12597 | type TableFeaturesStatsReply struct { |
| 12598 | *StatsReply |
| 12599 | Entries []*TableFeatures |
| 12600 | } |
| 12601 | |
| 12602 | type ITableFeaturesStatsReply interface { |
| 12603 | IStatsReply |
| 12604 | GetEntries() []*TableFeatures |
| 12605 | } |
| 12606 | |
| 12607 | func (self *TableFeaturesStatsReply) GetEntries() []*TableFeatures { |
| 12608 | return self.Entries |
| 12609 | } |
| 12610 | |
| 12611 | func (self *TableFeaturesStatsReply) SetEntries(v []*TableFeatures) { |
| 12612 | self.Entries = v |
| 12613 | } |
| 12614 | |
| 12615 | func (self *TableFeaturesStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 12616 | startIndex := len(encoder.Bytes()) |
| 12617 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 12618 | return err |
| 12619 | } |
| 12620 | |
| 12621 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 12622 | for _, obj := range self.Entries { |
| 12623 | if err := obj.Serialize(encoder); err != nil { |
| 12624 | return err |
| 12625 | } |
| 12626 | } |
| 12627 | length := len(encoder.Bytes()) - startIndex |
| 12628 | |
| 12629 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12630 | |
| 12631 | return nil |
| 12632 | } |
| 12633 | |
| 12634 | func DecodeTableFeaturesStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*TableFeaturesStatsReply, error) { |
| 12635 | _tablefeaturesstatsreply := &TableFeaturesStatsReply{StatsReply: parent} |
| 12636 | if decoder.Length() < 4 { |
| 12637 | return nil, fmt.Errorf("TableFeaturesStatsReply packet too short: %d < 4", decoder.Length()) |
| 12638 | } |
| 12639 | decoder.Skip(4) |
| 12640 | |
| 12641 | for decoder.Length() >= 64 { |
| 12642 | item, err := DecodeTableFeatures(decoder) |
| 12643 | if err != nil { |
| 12644 | return nil, err |
| 12645 | } |
| 12646 | if item != nil { |
| 12647 | _tablefeaturesstatsreply.Entries = append(_tablefeaturesstatsreply.Entries, item) |
| 12648 | } |
| 12649 | } |
| 12650 | return _tablefeaturesstatsreply, nil |
| 12651 | } |
| 12652 | |
| 12653 | func NewTableFeaturesStatsReply() *TableFeaturesStatsReply { |
| 12654 | obj := &TableFeaturesStatsReply{ |
| 12655 | StatsReply: NewStatsReply(12), |
| 12656 | } |
| 12657 | return obj |
| 12658 | } |
| 12659 | |
| 12660 | type TableFeaturesStatsRequest struct { |
| 12661 | *StatsRequest |
| 12662 | Entries []*TableFeatures |
| 12663 | } |
| 12664 | |
| 12665 | type ITableFeaturesStatsRequest interface { |
| 12666 | IStatsRequest |
| 12667 | GetEntries() []*TableFeatures |
| 12668 | } |
| 12669 | |
| 12670 | func (self *TableFeaturesStatsRequest) GetEntries() []*TableFeatures { |
| 12671 | return self.Entries |
| 12672 | } |
| 12673 | |
| 12674 | func (self *TableFeaturesStatsRequest) SetEntries(v []*TableFeatures) { |
| 12675 | self.Entries = v |
| 12676 | } |
| 12677 | |
| 12678 | func (self *TableFeaturesStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 12679 | startIndex := len(encoder.Bytes()) |
| 12680 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 12681 | return err |
| 12682 | } |
| 12683 | |
| 12684 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 12685 | for _, obj := range self.Entries { |
| 12686 | if err := obj.Serialize(encoder); err != nil { |
| 12687 | return err |
| 12688 | } |
| 12689 | } |
| 12690 | length := len(encoder.Bytes()) - startIndex |
| 12691 | |
| 12692 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12693 | |
| 12694 | return nil |
| 12695 | } |
| 12696 | |
| 12697 | func DecodeTableFeaturesStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*TableFeaturesStatsRequest, error) { |
| 12698 | _tablefeaturesstatsrequest := &TableFeaturesStatsRequest{StatsRequest: parent} |
| 12699 | if decoder.Length() < 4 { |
| 12700 | return nil, fmt.Errorf("TableFeaturesStatsRequest packet too short: %d < 4", decoder.Length()) |
| 12701 | } |
| 12702 | decoder.Skip(4) |
| 12703 | |
| 12704 | for decoder.Length() >= 64 { |
| 12705 | item, err := DecodeTableFeatures(decoder) |
| 12706 | if err != nil { |
| 12707 | return nil, err |
| 12708 | } |
| 12709 | if item != nil { |
| 12710 | _tablefeaturesstatsrequest.Entries = append(_tablefeaturesstatsrequest.Entries, item) |
| 12711 | } |
| 12712 | } |
| 12713 | return _tablefeaturesstatsrequest, nil |
| 12714 | } |
| 12715 | |
| 12716 | func NewTableFeaturesStatsRequest() *TableFeaturesStatsRequest { |
| 12717 | obj := &TableFeaturesStatsRequest{ |
| 12718 | StatsRequest: NewStatsRequest(12), |
| 12719 | } |
| 12720 | return obj |
| 12721 | } |
| 12722 | |
| 12723 | type TableMod struct { |
| 12724 | *Header |
| 12725 | TableId uint8 |
| 12726 | Config uint32 |
| 12727 | Properties []ITableModProp |
| 12728 | } |
| 12729 | |
| 12730 | type ITableMod interface { |
| 12731 | IHeader |
| 12732 | GetTableId() uint8 |
| 12733 | GetConfig() uint32 |
| 12734 | GetProperties() []ITableModProp |
| 12735 | } |
| 12736 | |
| 12737 | func (self *TableMod) GetTableId() uint8 { |
| 12738 | return self.TableId |
| 12739 | } |
| 12740 | |
| 12741 | func (self *TableMod) SetTableId(v uint8) { |
| 12742 | self.TableId = v |
| 12743 | } |
| 12744 | |
| 12745 | func (self *TableMod) GetConfig() uint32 { |
| 12746 | return self.Config |
| 12747 | } |
| 12748 | |
| 12749 | func (self *TableMod) SetConfig(v uint32) { |
| 12750 | self.Config = v |
| 12751 | } |
| 12752 | |
| 12753 | func (self *TableMod) GetProperties() []ITableModProp { |
| 12754 | return self.Properties |
| 12755 | } |
| 12756 | |
| 12757 | func (self *TableMod) SetProperties(v []ITableModProp) { |
| 12758 | self.Properties = v |
| 12759 | } |
| 12760 | |
| 12761 | func (self *TableMod) Serialize(encoder *goloxi.Encoder) error { |
| 12762 | startIndex := len(encoder.Bytes()) |
| 12763 | if err := self.Header.Serialize(encoder); err != nil { |
| 12764 | return err |
| 12765 | } |
| 12766 | |
| 12767 | encoder.PutUint8(uint8(self.TableId)) |
| 12768 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 12769 | encoder.PutUint32(uint32(self.Config)) |
| 12770 | for _, obj := range self.Properties { |
| 12771 | if err := obj.Serialize(encoder); err != nil { |
| 12772 | return err |
| 12773 | } |
| 12774 | } |
| 12775 | length := len(encoder.Bytes()) - startIndex |
| 12776 | |
| 12777 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12778 | |
| 12779 | return nil |
| 12780 | } |
| 12781 | |
| 12782 | func DecodeTableMod(parent *Header, decoder *goloxi.Decoder) (*TableMod, error) { |
| 12783 | _tablemod := &TableMod{Header: parent} |
| 12784 | if decoder.Length() < 8 { |
| 12785 | return nil, fmt.Errorf("TableMod packet too short: %d < 8", decoder.Length()) |
| 12786 | } |
| 12787 | _tablemod.TableId = uint8(decoder.ReadByte()) |
| 12788 | decoder.Skip(3) |
| 12789 | _tablemod.Config = uint32(decoder.ReadUint32()) |
| 12790 | |
| 12791 | for decoder.Length() >= 4 { |
| 12792 | item, err := DecodeTableModProp(decoder) |
| 12793 | if err != nil { |
| 12794 | return nil, err |
| 12795 | } |
| 12796 | if item != nil { |
| 12797 | _tablemod.Properties = append(_tablemod.Properties, item) |
| 12798 | } |
| 12799 | } |
| 12800 | return _tablemod, nil |
| 12801 | } |
| 12802 | |
| 12803 | func NewTableMod() *TableMod { |
| 12804 | obj := &TableMod{ |
| 12805 | Header: NewHeader(17), |
| 12806 | } |
| 12807 | return obj |
| 12808 | } |
| 12809 | |
| 12810 | type TableModFailedErrorMsg struct { |
| 12811 | *ErrorMsg |
| 12812 | Code TableModFailedCode |
| 12813 | Data []byte |
| 12814 | } |
| 12815 | |
| 12816 | type ITableModFailedErrorMsg interface { |
| 12817 | IErrorMsg |
| 12818 | GetCode() TableModFailedCode |
| 12819 | GetData() []byte |
| 12820 | } |
| 12821 | |
| 12822 | func (self *TableModFailedErrorMsg) GetCode() TableModFailedCode { |
| 12823 | return self.Code |
| 12824 | } |
| 12825 | |
| 12826 | func (self *TableModFailedErrorMsg) SetCode(v TableModFailedCode) { |
| 12827 | self.Code = v |
| 12828 | } |
| 12829 | |
| 12830 | func (self *TableModFailedErrorMsg) GetData() []byte { |
| 12831 | return self.Data |
| 12832 | } |
| 12833 | |
| 12834 | func (self *TableModFailedErrorMsg) SetData(v []byte) { |
| 12835 | self.Data = v |
| 12836 | } |
| 12837 | |
| 12838 | func (self *TableModFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 12839 | startIndex := len(encoder.Bytes()) |
| 12840 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 12841 | return err |
| 12842 | } |
| 12843 | |
| 12844 | encoder.PutUint16(uint16(self.Code)) |
| 12845 | encoder.Write(self.Data) |
| 12846 | length := len(encoder.Bytes()) - startIndex |
| 12847 | |
| 12848 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12849 | |
| 12850 | return nil |
| 12851 | } |
| 12852 | |
| 12853 | func DecodeTableModFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*TableModFailedErrorMsg, error) { |
| 12854 | _tablemodfailederrormsg := &TableModFailedErrorMsg{ErrorMsg: parent} |
| 12855 | if decoder.Length() < 2 { |
| 12856 | return nil, fmt.Errorf("TableModFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 12857 | } |
| 12858 | _tablemodfailederrormsg.Code = TableModFailedCode(decoder.ReadUint16()) |
| 12859 | _tablemodfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 12860 | return _tablemodfailederrormsg, nil |
| 12861 | } |
| 12862 | |
| 12863 | func NewTableModFailedErrorMsg() *TableModFailedErrorMsg { |
| 12864 | obj := &TableModFailedErrorMsg{ |
| 12865 | ErrorMsg: NewErrorMsg(8), |
| 12866 | } |
| 12867 | return obj |
| 12868 | } |
| 12869 | |
| 12870 | type TableStatsReply struct { |
| 12871 | *StatsReply |
| 12872 | Entries []*TableStatsEntry |
| 12873 | } |
| 12874 | |
| 12875 | type ITableStatsReply interface { |
| 12876 | IStatsReply |
| 12877 | GetEntries() []*TableStatsEntry |
| 12878 | } |
| 12879 | |
| 12880 | func (self *TableStatsReply) GetEntries() []*TableStatsEntry { |
| 12881 | return self.Entries |
| 12882 | } |
| 12883 | |
| 12884 | func (self *TableStatsReply) SetEntries(v []*TableStatsEntry) { |
| 12885 | self.Entries = v |
| 12886 | } |
| 12887 | |
| 12888 | func (self *TableStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 12889 | startIndex := len(encoder.Bytes()) |
| 12890 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 12891 | return err |
| 12892 | } |
| 12893 | |
| 12894 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 12895 | for _, obj := range self.Entries { |
| 12896 | if err := obj.Serialize(encoder); err != nil { |
| 12897 | return err |
| 12898 | } |
| 12899 | } |
| 12900 | length := len(encoder.Bytes()) - startIndex |
| 12901 | |
| 12902 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12903 | |
| 12904 | return nil |
| 12905 | } |
| 12906 | |
| 12907 | func DecodeTableStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*TableStatsReply, error) { |
| 12908 | _tablestatsreply := &TableStatsReply{StatsReply: parent} |
| 12909 | if decoder.Length() < 4 { |
| 12910 | return nil, fmt.Errorf("TableStatsReply packet too short: %d < 4", decoder.Length()) |
| 12911 | } |
| 12912 | decoder.Skip(4) |
| 12913 | |
| 12914 | for decoder.Length() >= 24 { |
| 12915 | item, err := DecodeTableStatsEntry(decoder) |
| 12916 | if err != nil { |
| 12917 | return nil, err |
| 12918 | } |
| 12919 | if item != nil { |
| 12920 | _tablestatsreply.Entries = append(_tablestatsreply.Entries, item) |
| 12921 | } |
| 12922 | } |
| 12923 | return _tablestatsreply, nil |
| 12924 | } |
| 12925 | |
| 12926 | func NewTableStatsReply() *TableStatsReply { |
| 12927 | obj := &TableStatsReply{ |
| 12928 | StatsReply: NewStatsReply(3), |
| 12929 | } |
| 12930 | return obj |
| 12931 | } |
| 12932 | |
| 12933 | type TableStatsRequest struct { |
| 12934 | *StatsRequest |
| 12935 | } |
| 12936 | |
| 12937 | type ITableStatsRequest interface { |
| 12938 | IStatsRequest |
| 12939 | } |
| 12940 | |
| 12941 | func (self *TableStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 12942 | startIndex := len(encoder.Bytes()) |
| 12943 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 12944 | return err |
| 12945 | } |
| 12946 | |
| 12947 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 12948 | length := len(encoder.Bytes()) - startIndex |
| 12949 | |
| 12950 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 12951 | |
| 12952 | return nil |
| 12953 | } |
| 12954 | |
| 12955 | func DecodeTableStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*TableStatsRequest, error) { |
| 12956 | _tablestatsrequest := &TableStatsRequest{StatsRequest: parent} |
| 12957 | if decoder.Length() < 4 { |
| 12958 | return nil, fmt.Errorf("TableStatsRequest packet too short: %d < 4", decoder.Length()) |
| 12959 | } |
| 12960 | decoder.Skip(4) |
| 12961 | return _tablestatsrequest, nil |
| 12962 | } |
| 12963 | |
| 12964 | func NewTableStatsRequest() *TableStatsRequest { |
| 12965 | obj := &TableStatsRequest{ |
| 12966 | StatsRequest: NewStatsRequest(3), |
| 12967 | } |
| 12968 | return obj |
| 12969 | } |
| 12970 | |
| 12971 | type TableStatus struct { |
| 12972 | *Header |
| 12973 | Reason TableReason |
| 12974 | Table TableDesc |
| 12975 | } |
| 12976 | |
| 12977 | type ITableStatus interface { |
| 12978 | IHeader |
| 12979 | GetReason() TableReason |
| 12980 | GetTable() TableDesc |
| 12981 | } |
| 12982 | |
| 12983 | func (self *TableStatus) GetReason() TableReason { |
| 12984 | return self.Reason |
| 12985 | } |
| 12986 | |
| 12987 | func (self *TableStatus) SetReason(v TableReason) { |
| 12988 | self.Reason = v |
| 12989 | } |
| 12990 | |
| 12991 | func (self *TableStatus) GetTable() TableDesc { |
| 12992 | return self.Table |
| 12993 | } |
| 12994 | |
| 12995 | func (self *TableStatus) SetTable(v TableDesc) { |
| 12996 | self.Table = v |
| 12997 | } |
| 12998 | |
| 12999 | func (self *TableStatus) Serialize(encoder *goloxi.Encoder) error { |
| 13000 | startIndex := len(encoder.Bytes()) |
| 13001 | if err := self.Header.Serialize(encoder); err != nil { |
| 13002 | return err |
| 13003 | } |
| 13004 | |
| 13005 | encoder.PutUint8(uint8(self.Reason)) |
| 13006 | encoder.Write(bytes.Repeat([]byte{0}, 7)) |
| 13007 | if err := self.Table.Serialize(encoder); err != nil { |
| 13008 | return err |
| 13009 | } |
| 13010 | |
| 13011 | length := len(encoder.Bytes()) - startIndex |
| 13012 | |
| 13013 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 13014 | |
| 13015 | return nil |
| 13016 | } |
| 13017 | |
| 13018 | func DecodeTableStatus(parent *Header, decoder *goloxi.Decoder) (*TableStatus, error) { |
| 13019 | _tablestatus := &TableStatus{Header: parent} |
| 13020 | if decoder.Length() < 16 { |
| 13021 | return nil, fmt.Errorf("TableStatus packet too short: %d < 16", decoder.Length()) |
| 13022 | } |
| 13023 | _tablestatus.Reason = TableReason(decoder.ReadByte()) |
| 13024 | decoder.Skip(7) |
| 13025 | if err := _tablestatus.Table.Decode(decoder); err != nil { |
| 13026 | return nil, err |
| 13027 | } |
| 13028 | |
| 13029 | return _tablestatus, nil |
| 13030 | } |
| 13031 | |
| 13032 | func NewTableStatus() *TableStatus { |
| 13033 | obj := &TableStatus{ |
| 13034 | Header: NewHeader(31), |
| 13035 | } |
| 13036 | return obj |
| 13037 | } |