Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [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 of13 |
| 11 | |
| 12 | import ( |
| 13 | "bytes" |
| 14 | "encoding/binary" |
| 15 | "fmt" |
| 16 | "net" |
| 17 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 18 | "github.com/opencord/goloxi" |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 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(4)) |
| 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 22: |
| 151 | return DecodeQueueGetConfigRequest(_header, decoder) |
| 152 | case 23: |
| 153 | return DecodeQueueGetConfigReply(_header, decoder) |
| 154 | case 24: |
| 155 | return DecodeRoleRequest(_header, decoder) |
| 156 | case 25: |
| 157 | return DecodeRoleReply(_header, decoder) |
| 158 | case 26: |
| 159 | return DecodeAsyncGetRequest(_header, decoder) |
| 160 | case 27: |
| 161 | return DecodeAsyncGetReply(_header, decoder) |
| 162 | case 28: |
| 163 | return DecodeAsyncSet(_header, decoder) |
| 164 | case 29: |
| 165 | return DecodeMeterMod(_header, decoder) |
| 166 | default: |
| 167 | return nil, fmt.Errorf("Invalid type '%d' for 'Header'", _header.Type) |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | func NewHeader(_type uint8) *Header { |
| 172 | obj := &Header{} |
| 173 | obj.Type = _type |
| 174 | return obj |
| 175 | } |
| 176 | |
| 177 | type StatsReply struct { |
| 178 | *Header |
| 179 | StatsType uint16 |
| 180 | Flags StatsReplyFlags |
| 181 | } |
| 182 | |
| 183 | type IStatsReply interface { |
| 184 | IHeader |
| 185 | GetStatsType() uint16 |
| 186 | GetFlags() StatsReplyFlags |
| 187 | } |
| 188 | |
| 189 | func (self *StatsReply) GetStatsType() uint16 { |
| 190 | return self.StatsType |
| 191 | } |
| 192 | |
| 193 | func (self *StatsReply) SetStatsType(v uint16) { |
| 194 | self.StatsType = v |
| 195 | } |
| 196 | |
| 197 | func (self *StatsReply) GetFlags() StatsReplyFlags { |
| 198 | return self.Flags |
| 199 | } |
| 200 | |
| 201 | func (self *StatsReply) SetFlags(v StatsReplyFlags) { |
| 202 | self.Flags = v |
| 203 | } |
| 204 | |
| 205 | func (self *StatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 206 | if err := self.Header.Serialize(encoder); err != nil { |
| 207 | return err |
| 208 | } |
| 209 | |
| 210 | encoder.PutUint16(uint16(self.StatsType)) |
| 211 | encoder.PutUint16(uint16(self.Flags)) |
| 212 | |
| 213 | return nil |
| 214 | } |
| 215 | |
| 216 | func DecodeStatsReply(parent *Header, decoder *goloxi.Decoder) (IStatsReply, error) { |
| 217 | _statsreply := &StatsReply{Header: parent} |
| 218 | if decoder.Length() < 4 { |
| 219 | return nil, fmt.Errorf("StatsReply packet too short: %d < 4", decoder.Length()) |
| 220 | } |
| 221 | _statsreply.StatsType = uint16(decoder.ReadUint16()) |
| 222 | _statsreply.Flags = StatsReplyFlags(decoder.ReadUint16()) |
| 223 | |
| 224 | switch _statsreply.StatsType { |
| 225 | case 0: |
| 226 | return DecodeDescStatsReply(_statsreply, decoder) |
| 227 | case 1: |
| 228 | return DecodeFlowStatsReply(_statsreply, decoder) |
| 229 | case 2: |
| 230 | return DecodeAggregateStatsReply(_statsreply, decoder) |
| 231 | case 3: |
| 232 | return DecodeTableStatsReply(_statsreply, decoder) |
| 233 | case 4: |
| 234 | return DecodePortStatsReply(_statsreply, decoder) |
| 235 | case 5: |
| 236 | return DecodeQueueStatsReply(_statsreply, decoder) |
| 237 | case 6: |
| 238 | return DecodeGroupStatsReply(_statsreply, decoder) |
| 239 | case 7: |
| 240 | return DecodeGroupDescStatsReply(_statsreply, decoder) |
| 241 | case 8: |
| 242 | return DecodeGroupFeaturesStatsReply(_statsreply, decoder) |
| 243 | case 9: |
| 244 | return DecodeMeterStatsReply(_statsreply, decoder) |
| 245 | case 10: |
| 246 | return DecodeMeterConfigStatsReply(_statsreply, decoder) |
| 247 | case 11: |
| 248 | return DecodeMeterFeaturesStatsReply(_statsreply, decoder) |
| 249 | case 12: |
| 250 | return DecodeTableFeaturesStatsReply(_statsreply, decoder) |
| 251 | case 13: |
| 252 | return DecodePortDescStatsReply(_statsreply, decoder) |
| 253 | case 65535: |
| 254 | return DecodeExperimenterStatsReply(_statsreply, decoder) |
| 255 | default: |
| 256 | return nil, fmt.Errorf("Invalid type '%d' for 'StatsReply'", _statsreply.StatsType) |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | func NewStatsReply(_stats_type uint16) *StatsReply { |
| 261 | obj := &StatsReply{ |
| 262 | Header: NewHeader(19), |
| 263 | } |
| 264 | obj.StatsType = _stats_type |
| 265 | return obj |
| 266 | } |
| 267 | |
| 268 | type AggregateStatsReply struct { |
| 269 | *StatsReply |
| 270 | PacketCount uint64 |
| 271 | ByteCount uint64 |
| 272 | FlowCount uint32 |
| 273 | } |
| 274 | |
| 275 | type IAggregateStatsReply interface { |
| 276 | IStatsReply |
| 277 | GetPacketCount() uint64 |
| 278 | GetByteCount() uint64 |
| 279 | GetFlowCount() uint32 |
| 280 | } |
| 281 | |
| 282 | func (self *AggregateStatsReply) GetPacketCount() uint64 { |
| 283 | return self.PacketCount |
| 284 | } |
| 285 | |
| 286 | func (self *AggregateStatsReply) SetPacketCount(v uint64) { |
| 287 | self.PacketCount = v |
| 288 | } |
| 289 | |
| 290 | func (self *AggregateStatsReply) GetByteCount() uint64 { |
| 291 | return self.ByteCount |
| 292 | } |
| 293 | |
| 294 | func (self *AggregateStatsReply) SetByteCount(v uint64) { |
| 295 | self.ByteCount = v |
| 296 | } |
| 297 | |
| 298 | func (self *AggregateStatsReply) GetFlowCount() uint32 { |
| 299 | return self.FlowCount |
| 300 | } |
| 301 | |
| 302 | func (self *AggregateStatsReply) SetFlowCount(v uint32) { |
| 303 | self.FlowCount = v |
| 304 | } |
| 305 | |
| 306 | func (self *AggregateStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 307 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 308 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 309 | return err |
| 310 | } |
| 311 | |
| 312 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 313 | encoder.PutUint64(uint64(self.PacketCount)) |
| 314 | encoder.PutUint64(uint64(self.ByteCount)) |
| 315 | encoder.PutUint32(uint32(self.FlowCount)) |
| 316 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 317 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 318 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 319 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 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() < 4 { |
| 327 | return nil, fmt.Errorf("AggregateStatsReply packet too short: %d < 4", decoder.Length()) |
| 328 | } |
| 329 | decoder.Skip(4) |
| 330 | _aggregatestatsreply.PacketCount = uint64(decoder.ReadUint64()) |
| 331 | _aggregatestatsreply.ByteCount = uint64(decoder.ReadUint64()) |
| 332 | _aggregatestatsreply.FlowCount = uint32(decoder.ReadUint32()) |
| 333 | decoder.Skip(4) |
| 334 | return _aggregatestatsreply, nil |
| 335 | } |
| 336 | |
| 337 | func NewAggregateStatsReply() *AggregateStatsReply { |
| 338 | obj := &AggregateStatsReply{ |
| 339 | StatsReply: NewStatsReply(2), |
| 340 | } |
| 341 | return obj |
| 342 | } |
| 343 | |
| 344 | type StatsRequest struct { |
| 345 | *Header |
| 346 | StatsType uint16 |
| 347 | Flags StatsRequestFlags |
| 348 | } |
| 349 | |
| 350 | type IStatsRequest interface { |
| 351 | IHeader |
| 352 | GetStatsType() uint16 |
| 353 | GetFlags() StatsRequestFlags |
| 354 | } |
| 355 | |
| 356 | func (self *StatsRequest) GetStatsType() uint16 { |
| 357 | return self.StatsType |
| 358 | } |
| 359 | |
| 360 | func (self *StatsRequest) SetStatsType(v uint16) { |
| 361 | self.StatsType = v |
| 362 | } |
| 363 | |
| 364 | func (self *StatsRequest) GetFlags() StatsRequestFlags { |
| 365 | return self.Flags |
| 366 | } |
| 367 | |
| 368 | func (self *StatsRequest) SetFlags(v StatsRequestFlags) { |
| 369 | self.Flags = v |
| 370 | } |
| 371 | |
| 372 | func (self *StatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 373 | if err := self.Header.Serialize(encoder); err != nil { |
| 374 | return err |
| 375 | } |
| 376 | |
| 377 | encoder.PutUint16(uint16(self.StatsType)) |
| 378 | encoder.PutUint16(uint16(self.Flags)) |
| 379 | |
| 380 | return nil |
| 381 | } |
| 382 | |
| 383 | func DecodeStatsRequest(parent *Header, decoder *goloxi.Decoder) (IStatsRequest, error) { |
| 384 | _statsrequest := &StatsRequest{Header: parent} |
| 385 | if decoder.Length() < 4 { |
| 386 | return nil, fmt.Errorf("StatsRequest packet too short: %d < 4", decoder.Length()) |
| 387 | } |
| 388 | _statsrequest.StatsType = uint16(decoder.ReadUint16()) |
| 389 | _statsrequest.Flags = StatsRequestFlags(decoder.ReadUint16()) |
| 390 | |
| 391 | switch _statsrequest.StatsType { |
| 392 | case 0: |
| 393 | return DecodeDescStatsRequest(_statsrequest, decoder) |
| 394 | case 1: |
| 395 | return DecodeFlowStatsRequest(_statsrequest, decoder) |
| 396 | case 2: |
| 397 | return DecodeAggregateStatsRequest(_statsrequest, decoder) |
| 398 | case 3: |
| 399 | return DecodeTableStatsRequest(_statsrequest, decoder) |
| 400 | case 4: |
| 401 | return DecodePortStatsRequest(_statsrequest, decoder) |
| 402 | case 5: |
| 403 | return DecodeQueueStatsRequest(_statsrequest, decoder) |
| 404 | case 6: |
| 405 | return DecodeGroupStatsRequest(_statsrequest, decoder) |
| 406 | case 7: |
| 407 | return DecodeGroupDescStatsRequest(_statsrequest, decoder) |
| 408 | case 8: |
| 409 | return DecodeGroupFeaturesStatsRequest(_statsrequest, decoder) |
| 410 | case 9: |
| 411 | return DecodeMeterStatsRequest(_statsrequest, decoder) |
| 412 | case 10: |
| 413 | return DecodeMeterConfigStatsRequest(_statsrequest, decoder) |
| 414 | case 11: |
| 415 | return DecodeMeterFeaturesStatsRequest(_statsrequest, decoder) |
| 416 | case 12: |
| 417 | return DecodeTableFeaturesStatsRequest(_statsrequest, decoder) |
| 418 | case 13: |
| 419 | return DecodePortDescStatsRequest(_statsrequest, decoder) |
| 420 | case 65535: |
| 421 | return DecodeExperimenterStatsRequest(_statsrequest, decoder) |
| 422 | default: |
| 423 | return nil, fmt.Errorf("Invalid type '%d' for 'StatsRequest'", _statsrequest.StatsType) |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | func NewStatsRequest(_stats_type uint16) *StatsRequest { |
| 428 | obj := &StatsRequest{ |
| 429 | Header: NewHeader(18), |
| 430 | } |
| 431 | obj.StatsType = _stats_type |
| 432 | return obj |
| 433 | } |
| 434 | |
| 435 | type AggregateStatsRequest struct { |
| 436 | *StatsRequest |
| 437 | TableId uint8 |
| 438 | OutPort Port |
| 439 | OutGroup uint32 |
| 440 | Cookie uint64 |
| 441 | CookieMask uint64 |
| 442 | Match Match |
| 443 | } |
| 444 | |
| 445 | type IAggregateStatsRequest interface { |
| 446 | IStatsRequest |
| 447 | GetTableId() uint8 |
| 448 | GetOutPort() Port |
| 449 | GetOutGroup() uint32 |
| 450 | GetCookie() uint64 |
| 451 | GetCookieMask() uint64 |
| 452 | GetMatch() Match |
| 453 | } |
| 454 | |
| 455 | func (self *AggregateStatsRequest) GetTableId() uint8 { |
| 456 | return self.TableId |
| 457 | } |
| 458 | |
| 459 | func (self *AggregateStatsRequest) SetTableId(v uint8) { |
| 460 | self.TableId = v |
| 461 | } |
| 462 | |
| 463 | func (self *AggregateStatsRequest) GetOutPort() Port { |
| 464 | return self.OutPort |
| 465 | } |
| 466 | |
| 467 | func (self *AggregateStatsRequest) SetOutPort(v Port) { |
| 468 | self.OutPort = v |
| 469 | } |
| 470 | |
| 471 | func (self *AggregateStatsRequest) GetOutGroup() uint32 { |
| 472 | return self.OutGroup |
| 473 | } |
| 474 | |
| 475 | func (self *AggregateStatsRequest) SetOutGroup(v uint32) { |
| 476 | self.OutGroup = v |
| 477 | } |
| 478 | |
| 479 | func (self *AggregateStatsRequest) GetCookie() uint64 { |
| 480 | return self.Cookie |
| 481 | } |
| 482 | |
| 483 | func (self *AggregateStatsRequest) SetCookie(v uint64) { |
| 484 | self.Cookie = v |
| 485 | } |
| 486 | |
| 487 | func (self *AggregateStatsRequest) GetCookieMask() uint64 { |
| 488 | return self.CookieMask |
| 489 | } |
| 490 | |
| 491 | func (self *AggregateStatsRequest) SetCookieMask(v uint64) { |
| 492 | self.CookieMask = v |
| 493 | } |
| 494 | |
| 495 | func (self *AggregateStatsRequest) GetMatch() Match { |
| 496 | return self.Match |
| 497 | } |
| 498 | |
| 499 | func (self *AggregateStatsRequest) SetMatch(v Match) { |
| 500 | self.Match = v |
| 501 | } |
| 502 | |
| 503 | func (self *AggregateStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 504 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 505 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 506 | return err |
| 507 | } |
| 508 | |
| 509 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 510 | encoder.PutUint8(uint8(self.TableId)) |
| 511 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 512 | self.OutPort.Serialize(encoder) |
| 513 | encoder.PutUint32(uint32(self.OutGroup)) |
| 514 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 515 | encoder.PutUint64(uint64(self.Cookie)) |
| 516 | encoder.PutUint64(uint64(self.CookieMask)) |
| 517 | if err := self.Match.Serialize(encoder); err != nil { |
| 518 | return err |
| 519 | } |
| 520 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 521 | length := len(encoder.Bytes()) - startIndex |
| 522 | |
| 523 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 524 | |
| 525 | return nil |
| 526 | } |
| 527 | |
| 528 | func DecodeAggregateStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*AggregateStatsRequest, error) { |
| 529 | _aggregatestatsrequest := &AggregateStatsRequest{StatsRequest: parent} |
| 530 | if decoder.Length() < 28 { |
| 531 | return nil, fmt.Errorf("AggregateStatsRequest packet too short: %d < 28", decoder.Length()) |
| 532 | } |
| 533 | decoder.Skip(4) |
| 534 | _aggregatestatsrequest.TableId = uint8(decoder.ReadByte()) |
| 535 | decoder.Skip(3) |
| 536 | _aggregatestatsrequest.OutPort.Decode(decoder) |
| 537 | _aggregatestatsrequest.OutGroup = uint32(decoder.ReadUint32()) |
| 538 | decoder.Skip(4) |
| 539 | _aggregatestatsrequest.Cookie = uint64(decoder.ReadUint64()) |
| 540 | _aggregatestatsrequest.CookieMask = uint64(decoder.ReadUint64()) |
| 541 | if err := _aggregatestatsrequest.Match.Decode(decoder); err != nil { |
| 542 | return nil, err |
| 543 | } |
| 544 | |
| 545 | decoder.SkipAlign() |
| 546 | return _aggregatestatsrequest, nil |
| 547 | } |
| 548 | |
| 549 | func NewAggregateStatsRequest() *AggregateStatsRequest { |
| 550 | obj := &AggregateStatsRequest{ |
| 551 | StatsRequest: NewStatsRequest(2), |
| 552 | } |
| 553 | return obj |
| 554 | } |
| 555 | |
| 556 | type AsyncGetReply struct { |
| 557 | *Header |
| 558 | PacketInMaskEqualMaster uint32 |
| 559 | PacketInMaskSlave uint32 |
| 560 | PortStatusMaskEqualMaster uint32 |
| 561 | PortStatusMaskSlave uint32 |
| 562 | FlowRemovedMaskEqualMaster uint32 |
| 563 | FlowRemovedMaskSlave uint32 |
| 564 | } |
| 565 | |
| 566 | type IAsyncGetReply interface { |
| 567 | IHeader |
| 568 | GetPacketInMaskEqualMaster() uint32 |
| 569 | GetPacketInMaskSlave() uint32 |
| 570 | GetPortStatusMaskEqualMaster() uint32 |
| 571 | GetPortStatusMaskSlave() uint32 |
| 572 | GetFlowRemovedMaskEqualMaster() uint32 |
| 573 | GetFlowRemovedMaskSlave() uint32 |
| 574 | } |
| 575 | |
| 576 | func (self *AsyncGetReply) GetPacketInMaskEqualMaster() uint32 { |
| 577 | return self.PacketInMaskEqualMaster |
| 578 | } |
| 579 | |
| 580 | func (self *AsyncGetReply) SetPacketInMaskEqualMaster(v uint32) { |
| 581 | self.PacketInMaskEqualMaster = v |
| 582 | } |
| 583 | |
| 584 | func (self *AsyncGetReply) GetPacketInMaskSlave() uint32 { |
| 585 | return self.PacketInMaskSlave |
| 586 | } |
| 587 | |
| 588 | func (self *AsyncGetReply) SetPacketInMaskSlave(v uint32) { |
| 589 | self.PacketInMaskSlave = v |
| 590 | } |
| 591 | |
| 592 | func (self *AsyncGetReply) GetPortStatusMaskEqualMaster() uint32 { |
| 593 | return self.PortStatusMaskEqualMaster |
| 594 | } |
| 595 | |
| 596 | func (self *AsyncGetReply) SetPortStatusMaskEqualMaster(v uint32) { |
| 597 | self.PortStatusMaskEqualMaster = v |
| 598 | } |
| 599 | |
| 600 | func (self *AsyncGetReply) GetPortStatusMaskSlave() uint32 { |
| 601 | return self.PortStatusMaskSlave |
| 602 | } |
| 603 | |
| 604 | func (self *AsyncGetReply) SetPortStatusMaskSlave(v uint32) { |
| 605 | self.PortStatusMaskSlave = v |
| 606 | } |
| 607 | |
| 608 | func (self *AsyncGetReply) GetFlowRemovedMaskEqualMaster() uint32 { |
| 609 | return self.FlowRemovedMaskEqualMaster |
| 610 | } |
| 611 | |
| 612 | func (self *AsyncGetReply) SetFlowRemovedMaskEqualMaster(v uint32) { |
| 613 | self.FlowRemovedMaskEqualMaster = v |
| 614 | } |
| 615 | |
| 616 | func (self *AsyncGetReply) GetFlowRemovedMaskSlave() uint32 { |
| 617 | return self.FlowRemovedMaskSlave |
| 618 | } |
| 619 | |
| 620 | func (self *AsyncGetReply) SetFlowRemovedMaskSlave(v uint32) { |
| 621 | self.FlowRemovedMaskSlave = v |
| 622 | } |
| 623 | |
| 624 | func (self *AsyncGetReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 625 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 626 | if err := self.Header.Serialize(encoder); err != nil { |
| 627 | return err |
| 628 | } |
| 629 | |
| 630 | encoder.PutUint32(uint32(self.PacketInMaskEqualMaster)) |
| 631 | encoder.PutUint32(uint32(self.PacketInMaskSlave)) |
| 632 | encoder.PutUint32(uint32(self.PortStatusMaskEqualMaster)) |
| 633 | encoder.PutUint32(uint32(self.PortStatusMaskSlave)) |
| 634 | encoder.PutUint32(uint32(self.FlowRemovedMaskEqualMaster)) |
| 635 | encoder.PutUint32(uint32(self.FlowRemovedMaskSlave)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 636 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 637 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 638 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 639 | |
| 640 | return nil |
| 641 | } |
| 642 | |
| 643 | func DecodeAsyncGetReply(parent *Header, decoder *goloxi.Decoder) (*AsyncGetReply, error) { |
| 644 | _asyncgetreply := &AsyncGetReply{Header: parent} |
| 645 | if decoder.Length() < 24 { |
| 646 | return nil, fmt.Errorf("AsyncGetReply packet too short: %d < 24", decoder.Length()) |
| 647 | } |
| 648 | _asyncgetreply.PacketInMaskEqualMaster = uint32(decoder.ReadUint32()) |
| 649 | _asyncgetreply.PacketInMaskSlave = uint32(decoder.ReadUint32()) |
| 650 | _asyncgetreply.PortStatusMaskEqualMaster = uint32(decoder.ReadUint32()) |
| 651 | _asyncgetreply.PortStatusMaskSlave = uint32(decoder.ReadUint32()) |
| 652 | _asyncgetreply.FlowRemovedMaskEqualMaster = uint32(decoder.ReadUint32()) |
| 653 | _asyncgetreply.FlowRemovedMaskSlave = uint32(decoder.ReadUint32()) |
| 654 | return _asyncgetreply, nil |
| 655 | } |
| 656 | |
| 657 | func NewAsyncGetReply() *AsyncGetReply { |
| 658 | obj := &AsyncGetReply{ |
| 659 | Header: NewHeader(27), |
| 660 | } |
| 661 | return obj |
| 662 | } |
| 663 | |
| 664 | type AsyncGetRequest struct { |
| 665 | *Header |
| 666 | } |
| 667 | |
| 668 | type IAsyncGetRequest interface { |
| 669 | IHeader |
| 670 | } |
| 671 | |
| 672 | func (self *AsyncGetRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 673 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 674 | if err := self.Header.Serialize(encoder); err != nil { |
| 675 | return err |
| 676 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 677 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 678 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 679 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 680 | |
| 681 | return nil |
| 682 | } |
| 683 | |
| 684 | func DecodeAsyncGetRequest(parent *Header, decoder *goloxi.Decoder) (*AsyncGetRequest, error) { |
| 685 | _asyncgetrequest := &AsyncGetRequest{Header: parent} |
| 686 | return _asyncgetrequest, nil |
| 687 | } |
| 688 | |
| 689 | func NewAsyncGetRequest() *AsyncGetRequest { |
| 690 | obj := &AsyncGetRequest{ |
| 691 | Header: NewHeader(26), |
| 692 | } |
| 693 | return obj |
| 694 | } |
| 695 | |
| 696 | type AsyncSet struct { |
| 697 | *Header |
| 698 | PacketInMaskEqualMaster uint32 |
| 699 | PacketInMaskSlave uint32 |
| 700 | PortStatusMaskEqualMaster uint32 |
| 701 | PortStatusMaskSlave uint32 |
| 702 | FlowRemovedMaskEqualMaster uint32 |
| 703 | FlowRemovedMaskSlave uint32 |
| 704 | } |
| 705 | |
| 706 | type IAsyncSet interface { |
| 707 | IHeader |
| 708 | GetPacketInMaskEqualMaster() uint32 |
| 709 | GetPacketInMaskSlave() uint32 |
| 710 | GetPortStatusMaskEqualMaster() uint32 |
| 711 | GetPortStatusMaskSlave() uint32 |
| 712 | GetFlowRemovedMaskEqualMaster() uint32 |
| 713 | GetFlowRemovedMaskSlave() uint32 |
| 714 | } |
| 715 | |
| 716 | func (self *AsyncSet) GetPacketInMaskEqualMaster() uint32 { |
| 717 | return self.PacketInMaskEqualMaster |
| 718 | } |
| 719 | |
| 720 | func (self *AsyncSet) SetPacketInMaskEqualMaster(v uint32) { |
| 721 | self.PacketInMaskEqualMaster = v |
| 722 | } |
| 723 | |
| 724 | func (self *AsyncSet) GetPacketInMaskSlave() uint32 { |
| 725 | return self.PacketInMaskSlave |
| 726 | } |
| 727 | |
| 728 | func (self *AsyncSet) SetPacketInMaskSlave(v uint32) { |
| 729 | self.PacketInMaskSlave = v |
| 730 | } |
| 731 | |
| 732 | func (self *AsyncSet) GetPortStatusMaskEqualMaster() uint32 { |
| 733 | return self.PortStatusMaskEqualMaster |
| 734 | } |
| 735 | |
| 736 | func (self *AsyncSet) SetPortStatusMaskEqualMaster(v uint32) { |
| 737 | self.PortStatusMaskEqualMaster = v |
| 738 | } |
| 739 | |
| 740 | func (self *AsyncSet) GetPortStatusMaskSlave() uint32 { |
| 741 | return self.PortStatusMaskSlave |
| 742 | } |
| 743 | |
| 744 | func (self *AsyncSet) SetPortStatusMaskSlave(v uint32) { |
| 745 | self.PortStatusMaskSlave = v |
| 746 | } |
| 747 | |
| 748 | func (self *AsyncSet) GetFlowRemovedMaskEqualMaster() uint32 { |
| 749 | return self.FlowRemovedMaskEqualMaster |
| 750 | } |
| 751 | |
| 752 | func (self *AsyncSet) SetFlowRemovedMaskEqualMaster(v uint32) { |
| 753 | self.FlowRemovedMaskEqualMaster = v |
| 754 | } |
| 755 | |
| 756 | func (self *AsyncSet) GetFlowRemovedMaskSlave() uint32 { |
| 757 | return self.FlowRemovedMaskSlave |
| 758 | } |
| 759 | |
| 760 | func (self *AsyncSet) SetFlowRemovedMaskSlave(v uint32) { |
| 761 | self.FlowRemovedMaskSlave = v |
| 762 | } |
| 763 | |
| 764 | func (self *AsyncSet) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 765 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 766 | if err := self.Header.Serialize(encoder); err != nil { |
| 767 | return err |
| 768 | } |
| 769 | |
| 770 | encoder.PutUint32(uint32(self.PacketInMaskEqualMaster)) |
| 771 | encoder.PutUint32(uint32(self.PacketInMaskSlave)) |
| 772 | encoder.PutUint32(uint32(self.PortStatusMaskEqualMaster)) |
| 773 | encoder.PutUint32(uint32(self.PortStatusMaskSlave)) |
| 774 | encoder.PutUint32(uint32(self.FlowRemovedMaskEqualMaster)) |
| 775 | encoder.PutUint32(uint32(self.FlowRemovedMaskSlave)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 776 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 777 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 778 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 779 | |
| 780 | return nil |
| 781 | } |
| 782 | |
| 783 | func DecodeAsyncSet(parent *Header, decoder *goloxi.Decoder) (*AsyncSet, error) { |
| 784 | _asyncset := &AsyncSet{Header: parent} |
| 785 | if decoder.Length() < 24 { |
| 786 | return nil, fmt.Errorf("AsyncSet packet too short: %d < 24", decoder.Length()) |
| 787 | } |
| 788 | _asyncset.PacketInMaskEqualMaster = uint32(decoder.ReadUint32()) |
| 789 | _asyncset.PacketInMaskSlave = uint32(decoder.ReadUint32()) |
| 790 | _asyncset.PortStatusMaskEqualMaster = uint32(decoder.ReadUint32()) |
| 791 | _asyncset.PortStatusMaskSlave = uint32(decoder.ReadUint32()) |
| 792 | _asyncset.FlowRemovedMaskEqualMaster = uint32(decoder.ReadUint32()) |
| 793 | _asyncset.FlowRemovedMaskSlave = uint32(decoder.ReadUint32()) |
| 794 | return _asyncset, nil |
| 795 | } |
| 796 | |
| 797 | func NewAsyncSet() *AsyncSet { |
| 798 | obj := &AsyncSet{ |
| 799 | Header: NewHeader(28), |
| 800 | } |
| 801 | return obj |
| 802 | } |
| 803 | |
| 804 | type ErrorMsg struct { |
| 805 | *Header |
| 806 | ErrType uint16 |
| 807 | } |
| 808 | |
| 809 | type IErrorMsg interface { |
| 810 | IHeader |
| 811 | GetErrType() uint16 |
| 812 | } |
| 813 | |
| 814 | func (self *ErrorMsg) GetErrType() uint16 { |
| 815 | return self.ErrType |
| 816 | } |
| 817 | |
| 818 | func (self *ErrorMsg) SetErrType(v uint16) { |
| 819 | self.ErrType = v |
| 820 | } |
| 821 | |
| 822 | func (self *ErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 823 | if err := self.Header.Serialize(encoder); err != nil { |
| 824 | return err |
| 825 | } |
| 826 | |
| 827 | encoder.PutUint16(uint16(self.ErrType)) |
| 828 | |
| 829 | return nil |
| 830 | } |
| 831 | |
| 832 | func DecodeErrorMsg(parent *Header, decoder *goloxi.Decoder) (IErrorMsg, error) { |
| 833 | _errormsg := &ErrorMsg{Header: parent} |
| 834 | if decoder.Length() < 2 { |
| 835 | return nil, fmt.Errorf("ErrorMsg packet too short: %d < 2", decoder.Length()) |
| 836 | } |
| 837 | _errormsg.ErrType = uint16(decoder.ReadUint16()) |
| 838 | |
| 839 | switch _errormsg.ErrType { |
| 840 | case 0: |
| 841 | return DecodeHelloFailedErrorMsg(_errormsg, decoder) |
| 842 | case 1: |
| 843 | return DecodeBadRequestErrorMsg(_errormsg, decoder) |
| 844 | case 2: |
| 845 | return DecodeBadActionErrorMsg(_errormsg, decoder) |
| 846 | case 3: |
| 847 | return DecodeBadInstructionErrorMsg(_errormsg, decoder) |
| 848 | case 4: |
| 849 | return DecodeBadMatchErrorMsg(_errormsg, decoder) |
| 850 | case 5: |
| 851 | return DecodeFlowModFailedErrorMsg(_errormsg, decoder) |
| 852 | case 6: |
| 853 | return DecodeGroupModFailedErrorMsg(_errormsg, decoder) |
| 854 | case 7: |
| 855 | return DecodePortModFailedErrorMsg(_errormsg, decoder) |
| 856 | case 8: |
| 857 | return DecodeTableModFailedErrorMsg(_errormsg, decoder) |
| 858 | case 9: |
| 859 | return DecodeQueueOpFailedErrorMsg(_errormsg, decoder) |
| 860 | case 10: |
| 861 | return DecodeSwitchConfigFailedErrorMsg(_errormsg, decoder) |
| 862 | case 11: |
| 863 | return DecodeRoleRequestFailedErrorMsg(_errormsg, decoder) |
| 864 | case 12: |
| 865 | return DecodeMeterModFailedErrorMsg(_errormsg, decoder) |
| 866 | case 13: |
| 867 | return DecodeTableFeaturesFailedErrorMsg(_errormsg, decoder) |
| 868 | case 65535: |
| 869 | return DecodeExperimenterErrorMsg(_errormsg, decoder) |
| 870 | default: |
| 871 | return nil, fmt.Errorf("Invalid type '%d' for 'ErrorMsg'", _errormsg.ErrType) |
| 872 | } |
| 873 | } |
| 874 | |
| 875 | func NewErrorMsg(_err_type uint16) *ErrorMsg { |
| 876 | obj := &ErrorMsg{ |
| 877 | Header: NewHeader(1), |
| 878 | } |
| 879 | obj.ErrType = _err_type |
| 880 | return obj |
| 881 | } |
| 882 | |
| 883 | type BadActionErrorMsg struct { |
| 884 | *ErrorMsg |
| 885 | Code BadActionCode |
| 886 | Data []byte |
| 887 | } |
| 888 | |
| 889 | type IBadActionErrorMsg interface { |
| 890 | IErrorMsg |
| 891 | GetCode() BadActionCode |
| 892 | GetData() []byte |
| 893 | } |
| 894 | |
| 895 | func (self *BadActionErrorMsg) GetCode() BadActionCode { |
| 896 | return self.Code |
| 897 | } |
| 898 | |
| 899 | func (self *BadActionErrorMsg) SetCode(v BadActionCode) { |
| 900 | self.Code = v |
| 901 | } |
| 902 | |
| 903 | func (self *BadActionErrorMsg) GetData() []byte { |
| 904 | return self.Data |
| 905 | } |
| 906 | |
| 907 | func (self *BadActionErrorMsg) SetData(v []byte) { |
| 908 | self.Data = v |
| 909 | } |
| 910 | |
| 911 | func (self *BadActionErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 912 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 913 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 914 | return err |
| 915 | } |
| 916 | |
| 917 | encoder.PutUint16(uint16(self.Code)) |
| 918 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 919 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 920 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 921 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 922 | |
| 923 | return nil |
| 924 | } |
| 925 | |
| 926 | func DecodeBadActionErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*BadActionErrorMsg, error) { |
| 927 | _badactionerrormsg := &BadActionErrorMsg{ErrorMsg: parent} |
| 928 | if decoder.Length() < 2 { |
| 929 | return nil, fmt.Errorf("BadActionErrorMsg packet too short: %d < 2", decoder.Length()) |
| 930 | } |
| 931 | _badactionerrormsg.Code = BadActionCode(decoder.ReadUint16()) |
| 932 | _badactionerrormsg.Data = decoder.Read(int(decoder.Length())) |
| 933 | return _badactionerrormsg, nil |
| 934 | } |
| 935 | |
| 936 | func NewBadActionErrorMsg() *BadActionErrorMsg { |
| 937 | obj := &BadActionErrorMsg{ |
| 938 | ErrorMsg: NewErrorMsg(2), |
| 939 | } |
| 940 | return obj |
| 941 | } |
| 942 | |
| 943 | type BadInstructionErrorMsg struct { |
| 944 | *ErrorMsg |
| 945 | Code BadInstructionCode |
| 946 | Data []byte |
| 947 | } |
| 948 | |
| 949 | type IBadInstructionErrorMsg interface { |
| 950 | IErrorMsg |
| 951 | GetCode() BadInstructionCode |
| 952 | GetData() []byte |
| 953 | } |
| 954 | |
| 955 | func (self *BadInstructionErrorMsg) GetCode() BadInstructionCode { |
| 956 | return self.Code |
| 957 | } |
| 958 | |
| 959 | func (self *BadInstructionErrorMsg) SetCode(v BadInstructionCode) { |
| 960 | self.Code = v |
| 961 | } |
| 962 | |
| 963 | func (self *BadInstructionErrorMsg) GetData() []byte { |
| 964 | return self.Data |
| 965 | } |
| 966 | |
| 967 | func (self *BadInstructionErrorMsg) SetData(v []byte) { |
| 968 | self.Data = v |
| 969 | } |
| 970 | |
| 971 | func (self *BadInstructionErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 972 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 973 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 974 | return err |
| 975 | } |
| 976 | |
| 977 | encoder.PutUint16(uint16(self.Code)) |
| 978 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 979 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 980 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 981 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 982 | |
| 983 | return nil |
| 984 | } |
| 985 | |
| 986 | func DecodeBadInstructionErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*BadInstructionErrorMsg, error) { |
| 987 | _badinstructionerrormsg := &BadInstructionErrorMsg{ErrorMsg: parent} |
| 988 | if decoder.Length() < 2 { |
| 989 | return nil, fmt.Errorf("BadInstructionErrorMsg packet too short: %d < 2", decoder.Length()) |
| 990 | } |
| 991 | _badinstructionerrormsg.Code = BadInstructionCode(decoder.ReadUint16()) |
| 992 | _badinstructionerrormsg.Data = decoder.Read(int(decoder.Length())) |
| 993 | return _badinstructionerrormsg, nil |
| 994 | } |
| 995 | |
| 996 | func NewBadInstructionErrorMsg() *BadInstructionErrorMsg { |
| 997 | obj := &BadInstructionErrorMsg{ |
| 998 | ErrorMsg: NewErrorMsg(3), |
| 999 | } |
| 1000 | return obj |
| 1001 | } |
| 1002 | |
| 1003 | type BadMatchErrorMsg struct { |
| 1004 | *ErrorMsg |
| 1005 | Code BadMatchCode |
| 1006 | Data []byte |
| 1007 | } |
| 1008 | |
| 1009 | type IBadMatchErrorMsg interface { |
| 1010 | IErrorMsg |
| 1011 | GetCode() BadMatchCode |
| 1012 | GetData() []byte |
| 1013 | } |
| 1014 | |
| 1015 | func (self *BadMatchErrorMsg) GetCode() BadMatchCode { |
| 1016 | return self.Code |
| 1017 | } |
| 1018 | |
| 1019 | func (self *BadMatchErrorMsg) SetCode(v BadMatchCode) { |
| 1020 | self.Code = v |
| 1021 | } |
| 1022 | |
| 1023 | func (self *BadMatchErrorMsg) GetData() []byte { |
| 1024 | return self.Data |
| 1025 | } |
| 1026 | |
| 1027 | func (self *BadMatchErrorMsg) SetData(v []byte) { |
| 1028 | self.Data = v |
| 1029 | } |
| 1030 | |
| 1031 | func (self *BadMatchErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1032 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1033 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 1034 | return err |
| 1035 | } |
| 1036 | |
| 1037 | encoder.PutUint16(uint16(self.Code)) |
| 1038 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1039 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1040 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1041 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1042 | |
| 1043 | return nil |
| 1044 | } |
| 1045 | |
| 1046 | func DecodeBadMatchErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*BadMatchErrorMsg, error) { |
| 1047 | _badmatcherrormsg := &BadMatchErrorMsg{ErrorMsg: parent} |
| 1048 | if decoder.Length() < 2 { |
| 1049 | return nil, fmt.Errorf("BadMatchErrorMsg packet too short: %d < 2", decoder.Length()) |
| 1050 | } |
| 1051 | _badmatcherrormsg.Code = BadMatchCode(decoder.ReadUint16()) |
| 1052 | _badmatcherrormsg.Data = decoder.Read(int(decoder.Length())) |
| 1053 | return _badmatcherrormsg, nil |
| 1054 | } |
| 1055 | |
| 1056 | func NewBadMatchErrorMsg() *BadMatchErrorMsg { |
| 1057 | obj := &BadMatchErrorMsg{ |
| 1058 | ErrorMsg: NewErrorMsg(4), |
| 1059 | } |
| 1060 | return obj |
| 1061 | } |
| 1062 | |
| 1063 | type BadRequestErrorMsg struct { |
| 1064 | *ErrorMsg |
| 1065 | Code BadRequestCode |
| 1066 | Data []byte |
| 1067 | } |
| 1068 | |
| 1069 | type IBadRequestErrorMsg interface { |
| 1070 | IErrorMsg |
| 1071 | GetCode() BadRequestCode |
| 1072 | GetData() []byte |
| 1073 | } |
| 1074 | |
| 1075 | func (self *BadRequestErrorMsg) GetCode() BadRequestCode { |
| 1076 | return self.Code |
| 1077 | } |
| 1078 | |
| 1079 | func (self *BadRequestErrorMsg) SetCode(v BadRequestCode) { |
| 1080 | self.Code = v |
| 1081 | } |
| 1082 | |
| 1083 | func (self *BadRequestErrorMsg) GetData() []byte { |
| 1084 | return self.Data |
| 1085 | } |
| 1086 | |
| 1087 | func (self *BadRequestErrorMsg) SetData(v []byte) { |
| 1088 | self.Data = v |
| 1089 | } |
| 1090 | |
| 1091 | func (self *BadRequestErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1092 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1093 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 1094 | return err |
| 1095 | } |
| 1096 | |
| 1097 | encoder.PutUint16(uint16(self.Code)) |
| 1098 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1099 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1100 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1101 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1102 | |
| 1103 | return nil |
| 1104 | } |
| 1105 | |
| 1106 | func DecodeBadRequestErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*BadRequestErrorMsg, error) { |
| 1107 | _badrequesterrormsg := &BadRequestErrorMsg{ErrorMsg: parent} |
| 1108 | if decoder.Length() < 2 { |
| 1109 | return nil, fmt.Errorf("BadRequestErrorMsg packet too short: %d < 2", decoder.Length()) |
| 1110 | } |
| 1111 | _badrequesterrormsg.Code = BadRequestCode(decoder.ReadUint16()) |
| 1112 | _badrequesterrormsg.Data = decoder.Read(int(decoder.Length())) |
| 1113 | return _badrequesterrormsg, nil |
| 1114 | } |
| 1115 | |
| 1116 | func NewBadRequestErrorMsg() *BadRequestErrorMsg { |
| 1117 | obj := &BadRequestErrorMsg{ |
| 1118 | ErrorMsg: NewErrorMsg(1), |
| 1119 | } |
| 1120 | return obj |
| 1121 | } |
| 1122 | |
| 1123 | type BarrierReply struct { |
| 1124 | *Header |
| 1125 | } |
| 1126 | |
| 1127 | type IBarrierReply interface { |
| 1128 | IHeader |
| 1129 | } |
| 1130 | |
| 1131 | func (self *BarrierReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1132 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1133 | if err := self.Header.Serialize(encoder); err != nil { |
| 1134 | return err |
| 1135 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1136 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1137 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1138 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1139 | |
| 1140 | return nil |
| 1141 | } |
| 1142 | |
| 1143 | func DecodeBarrierReply(parent *Header, decoder *goloxi.Decoder) (*BarrierReply, error) { |
| 1144 | _barrierreply := &BarrierReply{Header: parent} |
| 1145 | return _barrierreply, nil |
| 1146 | } |
| 1147 | |
| 1148 | func NewBarrierReply() *BarrierReply { |
| 1149 | obj := &BarrierReply{ |
| 1150 | Header: NewHeader(21), |
| 1151 | } |
| 1152 | return obj |
| 1153 | } |
| 1154 | |
| 1155 | type BarrierRequest struct { |
| 1156 | *Header |
| 1157 | } |
| 1158 | |
| 1159 | type IBarrierRequest interface { |
| 1160 | IHeader |
| 1161 | } |
| 1162 | |
| 1163 | func (self *BarrierRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1164 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1165 | if err := self.Header.Serialize(encoder); err != nil { |
| 1166 | return err |
| 1167 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1168 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1169 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1170 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1171 | |
| 1172 | return nil |
| 1173 | } |
| 1174 | |
| 1175 | func DecodeBarrierRequest(parent *Header, decoder *goloxi.Decoder) (*BarrierRequest, error) { |
| 1176 | _barrierrequest := &BarrierRequest{Header: parent} |
| 1177 | return _barrierrequest, nil |
| 1178 | } |
| 1179 | |
| 1180 | func NewBarrierRequest() *BarrierRequest { |
| 1181 | obj := &BarrierRequest{ |
| 1182 | Header: NewHeader(20), |
| 1183 | } |
| 1184 | return obj |
| 1185 | } |
| 1186 | |
| 1187 | type Experimenter struct { |
| 1188 | *Header |
| 1189 | Experimenter uint32 |
| 1190 | Subtype uint32 |
| 1191 | } |
| 1192 | |
| 1193 | type IExperimenter interface { |
| 1194 | IHeader |
| 1195 | GetExperimenter() uint32 |
| 1196 | GetSubtype() uint32 |
| 1197 | } |
| 1198 | |
| 1199 | func (self *Experimenter) GetExperimenter() uint32 { |
| 1200 | return self.Experimenter |
| 1201 | } |
| 1202 | |
| 1203 | func (self *Experimenter) SetExperimenter(v uint32) { |
| 1204 | self.Experimenter = v |
| 1205 | } |
| 1206 | |
| 1207 | func (self *Experimenter) GetSubtype() uint32 { |
| 1208 | return self.Subtype |
| 1209 | } |
| 1210 | |
| 1211 | func (self *Experimenter) SetSubtype(v uint32) { |
| 1212 | self.Subtype = v |
| 1213 | } |
| 1214 | |
| 1215 | func (self *Experimenter) Serialize(encoder *goloxi.Encoder) error { |
| 1216 | if err := self.Header.Serialize(encoder); err != nil { |
| 1217 | return err |
| 1218 | } |
| 1219 | |
| 1220 | encoder.PutUint32(uint32(self.Experimenter)) |
| 1221 | encoder.PutUint32(uint32(self.Subtype)) |
| 1222 | |
| 1223 | return nil |
| 1224 | } |
| 1225 | |
| 1226 | func DecodeExperimenter(parent *Header, decoder *goloxi.Decoder) (IExperimenter, error) { |
| 1227 | _experimenter := &Experimenter{Header: parent} |
| 1228 | if decoder.Length() < 8 { |
| 1229 | return nil, fmt.Errorf("Experimenter packet too short: %d < 8", decoder.Length()) |
| 1230 | } |
| 1231 | _experimenter.Experimenter = uint32(decoder.ReadUint32()) |
| 1232 | _experimenter.Subtype = uint32(decoder.ReadUint32()) |
| 1233 | |
| 1234 | switch _experimenter.Experimenter { |
| 1235 | case 8992: |
| 1236 | return DecodeNiciraHeader(_experimenter, decoder) |
| 1237 | case 6035143: |
| 1238 | return DecodeBsnHeader(_experimenter, decoder) |
| 1239 | default: |
| 1240 | return nil, fmt.Errorf("Invalid type '%d' for 'Experimenter'", _experimenter.Experimenter) |
| 1241 | } |
| 1242 | } |
| 1243 | |
| 1244 | func NewExperimenter(_experimenter uint32) *Experimenter { |
| 1245 | obj := &Experimenter{ |
| 1246 | Header: NewHeader(4), |
| 1247 | } |
| 1248 | obj.Experimenter = _experimenter |
| 1249 | return obj |
| 1250 | } |
| 1251 | |
| 1252 | type BsnHeader struct { |
| 1253 | *Experimenter |
| 1254 | } |
| 1255 | |
| 1256 | type IBsnHeader interface { |
| 1257 | IExperimenter |
| 1258 | } |
| 1259 | |
| 1260 | func (self *BsnHeader) Serialize(encoder *goloxi.Encoder) error { |
| 1261 | if err := self.Experimenter.Serialize(encoder); err != nil { |
| 1262 | return err |
| 1263 | } |
| 1264 | |
| 1265 | return nil |
| 1266 | } |
| 1267 | |
| 1268 | func DecodeBsnHeader(parent *Experimenter, decoder *goloxi.Decoder) (IBsnHeader, error) { |
| 1269 | _bsnheader := &BsnHeader{Experimenter: parent} |
| 1270 | |
| 1271 | switch _bsnheader.Subtype { |
| 1272 | case 3: |
| 1273 | return DecodeBsnSetMirroring(_bsnheader, decoder) |
| 1274 | case 4: |
| 1275 | return DecodeBsnGetMirroringRequest(_bsnheader, decoder) |
| 1276 | case 5: |
| 1277 | return DecodeBsnGetMirroringReply(_bsnheader, decoder) |
| 1278 | case 9: |
| 1279 | return DecodeBsnGetInterfacesRequest(_bsnheader, decoder) |
| 1280 | case 10: |
| 1281 | return DecodeBsnGetInterfacesReply(_bsnheader, decoder) |
| 1282 | case 11: |
| 1283 | return DecodeBsnSetPktinSuppressionRequest(_bsnheader, decoder) |
| 1284 | case 15: |
| 1285 | return DecodeBsnVirtualPortCreateRequest(_bsnheader, decoder) |
| 1286 | case 16: |
| 1287 | return DecodeBsnVirtualPortCreateReply(_bsnheader, decoder) |
| 1288 | case 17: |
| 1289 | return DecodeBsnVirtualPortRemoveRequest(_bsnheader, decoder) |
| 1290 | case 18: |
| 1291 | return DecodeBsnBwEnableSetRequest(_bsnheader, decoder) |
| 1292 | case 19: |
| 1293 | return DecodeBsnBwEnableGetRequest(_bsnheader, decoder) |
| 1294 | case 20: |
| 1295 | return DecodeBsnBwEnableGetReply(_bsnheader, decoder) |
| 1296 | case 21: |
| 1297 | return DecodeBsnBwClearDataRequest(_bsnheader, decoder) |
| 1298 | case 22: |
| 1299 | return DecodeBsnBwClearDataReply(_bsnheader, decoder) |
| 1300 | case 23: |
| 1301 | return DecodeBsnBwEnableSetReply(_bsnheader, decoder) |
| 1302 | case 25: |
| 1303 | return DecodeBsnSetPktinSuppressionReply(_bsnheader, decoder) |
| 1304 | case 26: |
| 1305 | return DecodeBsnVirtualPortRemoveReply(_bsnheader, decoder) |
| 1306 | case 31: |
| 1307 | return DecodeBsnPduTxRequest(_bsnheader, decoder) |
| 1308 | case 32: |
| 1309 | return DecodeBsnPduTxReply(_bsnheader, decoder) |
| 1310 | case 33: |
| 1311 | return DecodeBsnPduRxRequest(_bsnheader, decoder) |
| 1312 | case 34: |
| 1313 | return DecodeBsnPduRxReply(_bsnheader, decoder) |
| 1314 | case 35: |
| 1315 | return DecodeBsnPduRxTimeout(_bsnheader, decoder) |
| 1316 | case 36: |
| 1317 | return DecodeBsnFlowIdleEnableSetRequest(_bsnheader, decoder) |
| 1318 | case 37: |
| 1319 | return DecodeBsnFlowIdleEnableSetReply(_bsnheader, decoder) |
| 1320 | case 38: |
| 1321 | return DecodeBsnFlowIdleEnableGetRequest(_bsnheader, decoder) |
| 1322 | case 39: |
| 1323 | return DecodeBsnFlowIdleEnableGetReply(_bsnheader, decoder) |
| 1324 | case 40: |
| 1325 | return DecodeBsnFlowIdle(_bsnheader, decoder) |
| 1326 | case 41: |
| 1327 | return DecodeBsnSetLacpRequest(_bsnheader, decoder) |
| 1328 | case 42: |
| 1329 | return DecodeBsnSetLacpReply(_bsnheader, decoder) |
| 1330 | case 43: |
| 1331 | return DecodeBsnLacpConvergenceNotif(_bsnheader, decoder) |
| 1332 | case 44: |
| 1333 | return DecodeBsnTimeRequest(_bsnheader, decoder) |
| 1334 | case 45: |
| 1335 | return DecodeBsnTimeReply(_bsnheader, decoder) |
| 1336 | case 46: |
| 1337 | return DecodeBsnGentableEntryAdd(_bsnheader, decoder) |
| 1338 | case 47: |
| 1339 | return DecodeBsnGentableEntryDelete(_bsnheader, decoder) |
| 1340 | case 48: |
| 1341 | return DecodeBsnGentableClearRequest(_bsnheader, decoder) |
| 1342 | case 49: |
| 1343 | return DecodeBsnGentableClearReply(_bsnheader, decoder) |
| 1344 | case 50: |
| 1345 | return DecodeBsnGentableSetBucketsSize(_bsnheader, decoder) |
| 1346 | case 51: |
| 1347 | return DecodeBsnGetSwitchPipelineRequest(_bsnheader, decoder) |
| 1348 | case 52: |
| 1349 | return DecodeBsnGetSwitchPipelineReply(_bsnheader, decoder) |
| 1350 | case 53: |
| 1351 | return DecodeBsnSetSwitchPipelineRequest(_bsnheader, decoder) |
| 1352 | case 54: |
| 1353 | return DecodeBsnSetSwitchPipelineReply(_bsnheader, decoder) |
| 1354 | case 55: |
| 1355 | return DecodeBsnRoleStatus(_bsnheader, decoder) |
| 1356 | case 56: |
| 1357 | return DecodeBsnControllerConnectionsRequest(_bsnheader, decoder) |
| 1358 | case 57: |
| 1359 | return DecodeBsnControllerConnectionsReply(_bsnheader, decoder) |
| 1360 | case 58: |
| 1361 | return DecodeBsnSetAuxCxnsRequest(_bsnheader, decoder) |
| 1362 | case 59: |
| 1363 | return DecodeBsnSetAuxCxnsReply(_bsnheader, decoder) |
| 1364 | case 60: |
| 1365 | return DecodeBsnArpIdle(_bsnheader, decoder) |
| 1366 | case 61: |
| 1367 | return DecodeBsnTableSetBucketsSize(_bsnheader, decoder) |
| 1368 | case 63: |
| 1369 | return DecodeBsnLog(_bsnheader, decoder) |
| 1370 | case 64: |
| 1371 | return DecodeBsnLuaUpload(_bsnheader, decoder) |
| 1372 | case 65: |
| 1373 | return DecodeBsnLuaCommandRequest(_bsnheader, decoder) |
| 1374 | case 66: |
| 1375 | return DecodeBsnLuaCommandReply(_bsnheader, decoder) |
| 1376 | case 67: |
| 1377 | return DecodeBsnLuaNotification(_bsnheader, decoder) |
| 1378 | case 70: |
| 1379 | return DecodeBsnVlanCounterClear(_bsnheader, decoder) |
| 1380 | default: |
| 1381 | return nil, fmt.Errorf("Invalid type '%d' for 'BsnHeader'", _bsnheader.Subtype) |
| 1382 | } |
| 1383 | } |
| 1384 | |
| 1385 | func NewBsnHeader(_subtype uint32) *BsnHeader { |
| 1386 | obj := &BsnHeader{ |
| 1387 | Experimenter: NewExperimenter(6035143), |
| 1388 | } |
| 1389 | obj.Subtype = _subtype |
| 1390 | return obj |
| 1391 | } |
| 1392 | |
| 1393 | type BsnArpIdle struct { |
| 1394 | *BsnHeader |
| 1395 | VlanVid uint16 |
| 1396 | Ipv4Addr net.IP |
| 1397 | } |
| 1398 | |
| 1399 | type IBsnArpIdle interface { |
| 1400 | IBsnHeader |
| 1401 | GetVlanVid() uint16 |
| 1402 | GetIpv4Addr() net.IP |
| 1403 | } |
| 1404 | |
| 1405 | func (self *BsnArpIdle) GetVlanVid() uint16 { |
| 1406 | return self.VlanVid |
| 1407 | } |
| 1408 | |
| 1409 | func (self *BsnArpIdle) SetVlanVid(v uint16) { |
| 1410 | self.VlanVid = v |
| 1411 | } |
| 1412 | |
| 1413 | func (self *BsnArpIdle) GetIpv4Addr() net.IP { |
| 1414 | return self.Ipv4Addr |
| 1415 | } |
| 1416 | |
| 1417 | func (self *BsnArpIdle) SetIpv4Addr(v net.IP) { |
| 1418 | self.Ipv4Addr = v |
| 1419 | } |
| 1420 | |
| 1421 | func (self *BsnArpIdle) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1422 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1423 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1424 | return err |
| 1425 | } |
| 1426 | |
| 1427 | encoder.PutUint16(uint16(self.VlanVid)) |
| 1428 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 1429 | encoder.Write(self.Ipv4Addr.To4()) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1430 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1431 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1432 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1433 | |
| 1434 | return nil |
| 1435 | } |
| 1436 | |
| 1437 | func DecodeBsnArpIdle(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnArpIdle, error) { |
| 1438 | _bsnarpidle := &BsnArpIdle{BsnHeader: parent} |
| 1439 | if decoder.Length() < 8 { |
| 1440 | return nil, fmt.Errorf("BsnArpIdle packet too short: %d < 8", decoder.Length()) |
| 1441 | } |
| 1442 | _bsnarpidle.VlanVid = uint16(decoder.ReadUint16()) |
| 1443 | decoder.Skip(2) |
| 1444 | _bsnarpidle.Ipv4Addr = net.IP(decoder.Read(4)) |
| 1445 | return _bsnarpidle, nil |
| 1446 | } |
| 1447 | |
| 1448 | func NewBsnArpIdle() *BsnArpIdle { |
| 1449 | obj := &BsnArpIdle{ |
| 1450 | BsnHeader: NewBsnHeader(60), |
| 1451 | } |
| 1452 | return obj |
| 1453 | } |
| 1454 | |
| 1455 | type ExperimenterErrorMsg struct { |
| 1456 | *ErrorMsg |
| 1457 | Subtype uint16 |
| 1458 | Experimenter uint32 |
| 1459 | } |
| 1460 | |
| 1461 | type IExperimenterErrorMsg interface { |
| 1462 | IErrorMsg |
| 1463 | GetSubtype() uint16 |
| 1464 | GetExperimenter() uint32 |
| 1465 | } |
| 1466 | |
| 1467 | func (self *ExperimenterErrorMsg) GetSubtype() uint16 { |
| 1468 | return self.Subtype |
| 1469 | } |
| 1470 | |
| 1471 | func (self *ExperimenterErrorMsg) SetSubtype(v uint16) { |
| 1472 | self.Subtype = v |
| 1473 | } |
| 1474 | |
| 1475 | func (self *ExperimenterErrorMsg) GetExperimenter() uint32 { |
| 1476 | return self.Experimenter |
| 1477 | } |
| 1478 | |
| 1479 | func (self *ExperimenterErrorMsg) SetExperimenter(v uint32) { |
| 1480 | self.Experimenter = v |
| 1481 | } |
| 1482 | |
| 1483 | func (self *ExperimenterErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 1484 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 1485 | return err |
| 1486 | } |
| 1487 | |
| 1488 | encoder.PutUint16(uint16(self.Subtype)) |
| 1489 | encoder.PutUint32(uint32(self.Experimenter)) |
| 1490 | |
| 1491 | return nil |
| 1492 | } |
| 1493 | |
| 1494 | func DecodeExperimenterErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (IExperimenterErrorMsg, error) { |
| 1495 | _experimentererrormsg := &ExperimenterErrorMsg{ErrorMsg: parent} |
| 1496 | if decoder.Length() < 6 { |
| 1497 | return nil, fmt.Errorf("ExperimenterErrorMsg packet too short: %d < 6", decoder.Length()) |
| 1498 | } |
| 1499 | _experimentererrormsg.Subtype = uint16(decoder.ReadUint16()) |
| 1500 | _experimentererrormsg.Experimenter = uint32(decoder.ReadUint32()) |
| 1501 | |
| 1502 | switch _experimentererrormsg.Experimenter { |
| 1503 | case 6035143: |
| 1504 | return DecodeBsnBaseError(_experimentererrormsg, decoder) |
| 1505 | default: |
| 1506 | return nil, fmt.Errorf("Invalid type '%d' for 'ExperimenterErrorMsg'", _experimentererrormsg.Experimenter) |
| 1507 | } |
| 1508 | } |
| 1509 | |
| 1510 | func NewExperimenterErrorMsg(_experimenter uint32) *ExperimenterErrorMsg { |
| 1511 | obj := &ExperimenterErrorMsg{ |
| 1512 | ErrorMsg: NewErrorMsg(65535), |
| 1513 | } |
| 1514 | obj.Experimenter = _experimenter |
| 1515 | return obj |
| 1516 | } |
| 1517 | |
| 1518 | type BsnBaseError struct { |
| 1519 | *ExperimenterErrorMsg |
| 1520 | ErrMsg string |
| 1521 | } |
| 1522 | |
| 1523 | type IBsnBaseError interface { |
| 1524 | IExperimenterErrorMsg |
| 1525 | GetErrMsg() string |
| 1526 | } |
| 1527 | |
| 1528 | func (self *BsnBaseError) GetErrMsg() string { |
| 1529 | return self.ErrMsg |
| 1530 | } |
| 1531 | |
| 1532 | func (self *BsnBaseError) SetErrMsg(v string) { |
| 1533 | self.ErrMsg = v |
| 1534 | } |
| 1535 | |
| 1536 | func (self *BsnBaseError) Serialize(encoder *goloxi.Encoder) error { |
| 1537 | if err := self.ExperimenterErrorMsg.Serialize(encoder); err != nil { |
| 1538 | return err |
| 1539 | } |
| 1540 | |
| 1541 | encoder.Write([]byte(self.ErrMsg)) |
| 1542 | |
| 1543 | return nil |
| 1544 | } |
| 1545 | |
| 1546 | func DecodeBsnBaseError(parent *ExperimenterErrorMsg, decoder *goloxi.Decoder) (IBsnBaseError, error) { |
| 1547 | _bsnbaseerror := &BsnBaseError{ExperimenterErrorMsg: parent} |
| 1548 | if decoder.Length() < 256 { |
| 1549 | return nil, fmt.Errorf("BsnBaseError packet too short: %d < 256", decoder.Length()) |
| 1550 | } |
| 1551 | _bsnbaseerror.ErrMsg = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 1552 | |
| 1553 | switch _bsnbaseerror.Subtype { |
| 1554 | case 1: |
| 1555 | return DecodeBsnError(_bsnbaseerror, decoder) |
| 1556 | case 2: |
| 1557 | return DecodeBsnGentableError(_bsnbaseerror, decoder) |
| 1558 | default: |
| 1559 | return nil, fmt.Errorf("Invalid type '%d' for 'BsnBaseError'", _bsnbaseerror.Subtype) |
| 1560 | } |
| 1561 | } |
| 1562 | |
| 1563 | func NewBsnBaseError(_subtype uint16) *BsnBaseError { |
| 1564 | obj := &BsnBaseError{ |
| 1565 | ExperimenterErrorMsg: NewExperimenterErrorMsg(6035143), |
| 1566 | } |
| 1567 | obj.Subtype = _subtype |
| 1568 | return obj |
| 1569 | } |
| 1570 | |
| 1571 | type BsnBwClearDataReply struct { |
| 1572 | *BsnHeader |
| 1573 | Status uint32 |
| 1574 | } |
| 1575 | |
| 1576 | type IBsnBwClearDataReply interface { |
| 1577 | IBsnHeader |
| 1578 | GetStatus() uint32 |
| 1579 | } |
| 1580 | |
| 1581 | func (self *BsnBwClearDataReply) GetStatus() uint32 { |
| 1582 | return self.Status |
| 1583 | } |
| 1584 | |
| 1585 | func (self *BsnBwClearDataReply) SetStatus(v uint32) { |
| 1586 | self.Status = v |
| 1587 | } |
| 1588 | |
| 1589 | func (self *BsnBwClearDataReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1590 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1591 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1592 | return err |
| 1593 | } |
| 1594 | |
| 1595 | encoder.PutUint32(uint32(self.Status)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1596 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1597 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1598 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1599 | |
| 1600 | return nil |
| 1601 | } |
| 1602 | |
| 1603 | func DecodeBsnBwClearDataReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwClearDataReply, error) { |
| 1604 | _bsnbwcleardatareply := &BsnBwClearDataReply{BsnHeader: parent} |
| 1605 | if decoder.Length() < 4 { |
| 1606 | return nil, fmt.Errorf("BsnBwClearDataReply packet too short: %d < 4", decoder.Length()) |
| 1607 | } |
| 1608 | _bsnbwcleardatareply.Status = uint32(decoder.ReadUint32()) |
| 1609 | return _bsnbwcleardatareply, nil |
| 1610 | } |
| 1611 | |
| 1612 | func NewBsnBwClearDataReply() *BsnBwClearDataReply { |
| 1613 | obj := &BsnBwClearDataReply{ |
| 1614 | BsnHeader: NewBsnHeader(22), |
| 1615 | } |
| 1616 | return obj |
| 1617 | } |
| 1618 | |
| 1619 | type BsnBwClearDataRequest struct { |
| 1620 | *BsnHeader |
| 1621 | } |
| 1622 | |
| 1623 | type IBsnBwClearDataRequest interface { |
| 1624 | IBsnHeader |
| 1625 | } |
| 1626 | |
| 1627 | func (self *BsnBwClearDataRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1628 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1629 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1630 | return err |
| 1631 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1632 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1633 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1634 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1635 | |
| 1636 | return nil |
| 1637 | } |
| 1638 | |
| 1639 | func DecodeBsnBwClearDataRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwClearDataRequest, error) { |
| 1640 | _bsnbwcleardatarequest := &BsnBwClearDataRequest{BsnHeader: parent} |
| 1641 | return _bsnbwcleardatarequest, nil |
| 1642 | } |
| 1643 | |
| 1644 | func NewBsnBwClearDataRequest() *BsnBwClearDataRequest { |
| 1645 | obj := &BsnBwClearDataRequest{ |
| 1646 | BsnHeader: NewBsnHeader(21), |
| 1647 | } |
| 1648 | return obj |
| 1649 | } |
| 1650 | |
| 1651 | type BsnBwEnableGetReply struct { |
| 1652 | *BsnHeader |
| 1653 | Enabled uint32 |
| 1654 | } |
| 1655 | |
| 1656 | type IBsnBwEnableGetReply interface { |
| 1657 | IBsnHeader |
| 1658 | GetEnabled() uint32 |
| 1659 | } |
| 1660 | |
| 1661 | func (self *BsnBwEnableGetReply) GetEnabled() uint32 { |
| 1662 | return self.Enabled |
| 1663 | } |
| 1664 | |
| 1665 | func (self *BsnBwEnableGetReply) SetEnabled(v uint32) { |
| 1666 | self.Enabled = v |
| 1667 | } |
| 1668 | |
| 1669 | func (self *BsnBwEnableGetReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1670 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1671 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1672 | return err |
| 1673 | } |
| 1674 | |
| 1675 | encoder.PutUint32(uint32(self.Enabled)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1676 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1677 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1678 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1679 | |
| 1680 | return nil |
| 1681 | } |
| 1682 | |
| 1683 | func DecodeBsnBwEnableGetReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwEnableGetReply, error) { |
| 1684 | _bsnbwenablegetreply := &BsnBwEnableGetReply{BsnHeader: parent} |
| 1685 | if decoder.Length() < 4 { |
| 1686 | return nil, fmt.Errorf("BsnBwEnableGetReply packet too short: %d < 4", decoder.Length()) |
| 1687 | } |
| 1688 | _bsnbwenablegetreply.Enabled = uint32(decoder.ReadUint32()) |
| 1689 | return _bsnbwenablegetreply, nil |
| 1690 | } |
| 1691 | |
| 1692 | func NewBsnBwEnableGetReply() *BsnBwEnableGetReply { |
| 1693 | obj := &BsnBwEnableGetReply{ |
| 1694 | BsnHeader: NewBsnHeader(20), |
| 1695 | } |
| 1696 | return obj |
| 1697 | } |
| 1698 | |
| 1699 | type BsnBwEnableGetRequest struct { |
| 1700 | *BsnHeader |
| 1701 | } |
| 1702 | |
| 1703 | type IBsnBwEnableGetRequest interface { |
| 1704 | IBsnHeader |
| 1705 | } |
| 1706 | |
| 1707 | func (self *BsnBwEnableGetRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1708 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1709 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1710 | return err |
| 1711 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1712 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1713 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1714 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1715 | |
| 1716 | return nil |
| 1717 | } |
| 1718 | |
| 1719 | func DecodeBsnBwEnableGetRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwEnableGetRequest, error) { |
| 1720 | _bsnbwenablegetrequest := &BsnBwEnableGetRequest{BsnHeader: parent} |
| 1721 | return _bsnbwenablegetrequest, nil |
| 1722 | } |
| 1723 | |
| 1724 | func NewBsnBwEnableGetRequest() *BsnBwEnableGetRequest { |
| 1725 | obj := &BsnBwEnableGetRequest{ |
| 1726 | BsnHeader: NewBsnHeader(19), |
| 1727 | } |
| 1728 | return obj |
| 1729 | } |
| 1730 | |
| 1731 | type BsnBwEnableSetReply struct { |
| 1732 | *BsnHeader |
| 1733 | Enable uint32 |
| 1734 | Status uint32 |
| 1735 | } |
| 1736 | |
| 1737 | type IBsnBwEnableSetReply interface { |
| 1738 | IBsnHeader |
| 1739 | GetEnable() uint32 |
| 1740 | GetStatus() uint32 |
| 1741 | } |
| 1742 | |
| 1743 | func (self *BsnBwEnableSetReply) GetEnable() uint32 { |
| 1744 | return self.Enable |
| 1745 | } |
| 1746 | |
| 1747 | func (self *BsnBwEnableSetReply) SetEnable(v uint32) { |
| 1748 | self.Enable = v |
| 1749 | } |
| 1750 | |
| 1751 | func (self *BsnBwEnableSetReply) GetStatus() uint32 { |
| 1752 | return self.Status |
| 1753 | } |
| 1754 | |
| 1755 | func (self *BsnBwEnableSetReply) SetStatus(v uint32) { |
| 1756 | self.Status = v |
| 1757 | } |
| 1758 | |
| 1759 | func (self *BsnBwEnableSetReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1760 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1761 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1762 | return err |
| 1763 | } |
| 1764 | |
| 1765 | encoder.PutUint32(uint32(self.Enable)) |
| 1766 | encoder.PutUint32(uint32(self.Status)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1767 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1768 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1769 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1770 | |
| 1771 | return nil |
| 1772 | } |
| 1773 | |
| 1774 | func DecodeBsnBwEnableSetReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwEnableSetReply, error) { |
| 1775 | _bsnbwenablesetreply := &BsnBwEnableSetReply{BsnHeader: parent} |
| 1776 | if decoder.Length() < 8 { |
| 1777 | return nil, fmt.Errorf("BsnBwEnableSetReply packet too short: %d < 8", decoder.Length()) |
| 1778 | } |
| 1779 | _bsnbwenablesetreply.Enable = uint32(decoder.ReadUint32()) |
| 1780 | _bsnbwenablesetreply.Status = uint32(decoder.ReadUint32()) |
| 1781 | return _bsnbwenablesetreply, nil |
| 1782 | } |
| 1783 | |
| 1784 | func NewBsnBwEnableSetReply() *BsnBwEnableSetReply { |
| 1785 | obj := &BsnBwEnableSetReply{ |
| 1786 | BsnHeader: NewBsnHeader(23), |
| 1787 | } |
| 1788 | return obj |
| 1789 | } |
| 1790 | |
| 1791 | type BsnBwEnableSetRequest struct { |
| 1792 | *BsnHeader |
| 1793 | Enable uint32 |
| 1794 | } |
| 1795 | |
| 1796 | type IBsnBwEnableSetRequest interface { |
| 1797 | IBsnHeader |
| 1798 | GetEnable() uint32 |
| 1799 | } |
| 1800 | |
| 1801 | func (self *BsnBwEnableSetRequest) GetEnable() uint32 { |
| 1802 | return self.Enable |
| 1803 | } |
| 1804 | |
| 1805 | func (self *BsnBwEnableSetRequest) SetEnable(v uint32) { |
| 1806 | self.Enable = v |
| 1807 | } |
| 1808 | |
| 1809 | func (self *BsnBwEnableSetRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1810 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1811 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1812 | return err |
| 1813 | } |
| 1814 | |
| 1815 | encoder.PutUint32(uint32(self.Enable)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1816 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1817 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1818 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1819 | |
| 1820 | return nil |
| 1821 | } |
| 1822 | |
| 1823 | func DecodeBsnBwEnableSetRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwEnableSetRequest, error) { |
| 1824 | _bsnbwenablesetrequest := &BsnBwEnableSetRequest{BsnHeader: parent} |
| 1825 | if decoder.Length() < 4 { |
| 1826 | return nil, fmt.Errorf("BsnBwEnableSetRequest packet too short: %d < 4", decoder.Length()) |
| 1827 | } |
| 1828 | _bsnbwenablesetrequest.Enable = uint32(decoder.ReadUint32()) |
| 1829 | return _bsnbwenablesetrequest, nil |
| 1830 | } |
| 1831 | |
| 1832 | func NewBsnBwEnableSetRequest() *BsnBwEnableSetRequest { |
| 1833 | obj := &BsnBwEnableSetRequest{ |
| 1834 | BsnHeader: NewBsnHeader(18), |
| 1835 | } |
| 1836 | return obj |
| 1837 | } |
| 1838 | |
| 1839 | type BsnControllerConnectionsReply struct { |
| 1840 | *BsnHeader |
| 1841 | Connections []*BsnControllerConnection |
| 1842 | } |
| 1843 | |
| 1844 | type IBsnControllerConnectionsReply interface { |
| 1845 | IBsnHeader |
| 1846 | GetConnections() []*BsnControllerConnection |
| 1847 | } |
| 1848 | |
| 1849 | func (self *BsnControllerConnectionsReply) GetConnections() []*BsnControllerConnection { |
| 1850 | return self.Connections |
| 1851 | } |
| 1852 | |
| 1853 | func (self *BsnControllerConnectionsReply) SetConnections(v []*BsnControllerConnection) { |
| 1854 | self.Connections = v |
| 1855 | } |
| 1856 | |
| 1857 | func (self *BsnControllerConnectionsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1858 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1859 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1860 | return err |
| 1861 | } |
| 1862 | |
| 1863 | for _, obj := range self.Connections { |
| 1864 | if err := obj.Serialize(encoder); err != nil { |
| 1865 | return err |
| 1866 | } |
| 1867 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1868 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1869 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1870 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1871 | |
| 1872 | return nil |
| 1873 | } |
| 1874 | |
| 1875 | func DecodeBsnControllerConnectionsReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnControllerConnectionsReply, error) { |
| 1876 | _bsncontrollerconnectionsreply := &BsnControllerConnectionsReply{BsnHeader: parent} |
| 1877 | |
| 1878 | for decoder.Length() >= 264 { |
| 1879 | item, err := DecodeBsnControllerConnection(decoder) |
| 1880 | if err != nil { |
| 1881 | return nil, err |
| 1882 | } |
| 1883 | if item != nil { |
| 1884 | _bsncontrollerconnectionsreply.Connections = append(_bsncontrollerconnectionsreply.Connections, item) |
| 1885 | } |
| 1886 | } |
| 1887 | return _bsncontrollerconnectionsreply, nil |
| 1888 | } |
| 1889 | |
| 1890 | func NewBsnControllerConnectionsReply() *BsnControllerConnectionsReply { |
| 1891 | obj := &BsnControllerConnectionsReply{ |
| 1892 | BsnHeader: NewBsnHeader(57), |
| 1893 | } |
| 1894 | return obj |
| 1895 | } |
| 1896 | |
| 1897 | type BsnControllerConnectionsRequest struct { |
| 1898 | *BsnHeader |
| 1899 | } |
| 1900 | |
| 1901 | type IBsnControllerConnectionsRequest interface { |
| 1902 | IBsnHeader |
| 1903 | } |
| 1904 | |
| 1905 | func (self *BsnControllerConnectionsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1906 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1907 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1908 | return err |
| 1909 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1910 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1911 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 1912 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 1913 | |
| 1914 | return nil |
| 1915 | } |
| 1916 | |
| 1917 | func DecodeBsnControllerConnectionsRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnControllerConnectionsRequest, error) { |
| 1918 | _bsncontrollerconnectionsrequest := &BsnControllerConnectionsRequest{BsnHeader: parent} |
| 1919 | return _bsncontrollerconnectionsrequest, nil |
| 1920 | } |
| 1921 | |
| 1922 | func NewBsnControllerConnectionsRequest() *BsnControllerConnectionsRequest { |
| 1923 | obj := &BsnControllerConnectionsRequest{ |
| 1924 | BsnHeader: NewBsnHeader(56), |
| 1925 | } |
| 1926 | return obj |
| 1927 | } |
| 1928 | |
| 1929 | type ExperimenterStatsReply struct { |
| 1930 | *StatsReply |
| 1931 | Experimenter uint32 |
| 1932 | Subtype uint32 |
| 1933 | } |
| 1934 | |
| 1935 | type IExperimenterStatsReply interface { |
| 1936 | IStatsReply |
| 1937 | GetExperimenter() uint32 |
| 1938 | GetSubtype() uint32 |
| 1939 | } |
| 1940 | |
| 1941 | func (self *ExperimenterStatsReply) GetExperimenter() uint32 { |
| 1942 | return self.Experimenter |
| 1943 | } |
| 1944 | |
| 1945 | func (self *ExperimenterStatsReply) SetExperimenter(v uint32) { |
| 1946 | self.Experimenter = v |
| 1947 | } |
| 1948 | |
| 1949 | func (self *ExperimenterStatsReply) GetSubtype() uint32 { |
| 1950 | return self.Subtype |
| 1951 | } |
| 1952 | |
| 1953 | func (self *ExperimenterStatsReply) SetSubtype(v uint32) { |
| 1954 | self.Subtype = v |
| 1955 | } |
| 1956 | |
| 1957 | func (self *ExperimenterStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 1958 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 1959 | return err |
| 1960 | } |
| 1961 | |
| 1962 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 1963 | encoder.PutUint32(uint32(self.Experimenter)) |
| 1964 | encoder.PutUint32(uint32(self.Subtype)) |
| 1965 | |
| 1966 | return nil |
| 1967 | } |
| 1968 | |
| 1969 | func DecodeExperimenterStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (IExperimenterStatsReply, error) { |
| 1970 | _experimenterstatsreply := &ExperimenterStatsReply{StatsReply: parent} |
| 1971 | if decoder.Length() < 12 { |
| 1972 | return nil, fmt.Errorf("ExperimenterStatsReply packet too short: %d < 12", decoder.Length()) |
| 1973 | } |
| 1974 | decoder.Skip(4) |
| 1975 | _experimenterstatsreply.Experimenter = uint32(decoder.ReadUint32()) |
| 1976 | _experimenterstatsreply.Subtype = uint32(decoder.ReadUint32()) |
| 1977 | |
| 1978 | switch _experimenterstatsreply.Experimenter { |
| 1979 | case 8992: |
| 1980 | return DecodeNiciraStatsReply(_experimenterstatsreply, decoder) |
| 1981 | case 6035143: |
| 1982 | return DecodeBsnStatsReply(_experimenterstatsreply, decoder) |
| 1983 | default: |
| 1984 | return nil, fmt.Errorf("Invalid type '%d' for 'ExperimenterStatsReply'", _experimenterstatsreply.Experimenter) |
| 1985 | } |
| 1986 | } |
| 1987 | |
| 1988 | func NewExperimenterStatsReply(_experimenter uint32) *ExperimenterStatsReply { |
| 1989 | obj := &ExperimenterStatsReply{ |
| 1990 | StatsReply: NewStatsReply(65535), |
| 1991 | } |
| 1992 | obj.Experimenter = _experimenter |
| 1993 | return obj |
| 1994 | } |
| 1995 | |
| 1996 | type BsnStatsReply struct { |
| 1997 | *ExperimenterStatsReply |
| 1998 | } |
| 1999 | |
| 2000 | type IBsnStatsReply interface { |
| 2001 | IExperimenterStatsReply |
| 2002 | } |
| 2003 | |
| 2004 | func (self *BsnStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 2005 | if err := self.ExperimenterStatsReply.Serialize(encoder); err != nil { |
| 2006 | return err |
| 2007 | } |
| 2008 | |
| 2009 | return nil |
| 2010 | } |
| 2011 | |
| 2012 | func DecodeBsnStatsReply(parent *ExperimenterStatsReply, decoder *goloxi.Decoder) (IBsnStatsReply, error) { |
| 2013 | _bsnstatsreply := &BsnStatsReply{ExperimenterStatsReply: parent} |
| 2014 | |
| 2015 | switch _bsnstatsreply.Subtype { |
| 2016 | case 1: |
| 2017 | return DecodeBsnLacpStatsReply(_bsnstatsreply, decoder) |
| 2018 | case 2: |
| 2019 | return DecodeBsnGentableEntryDescStatsReply(_bsnstatsreply, decoder) |
| 2020 | case 3: |
| 2021 | return DecodeBsnGentableEntryStatsReply(_bsnstatsreply, decoder) |
| 2022 | case 4: |
| 2023 | return DecodeBsnGentableDescStatsReply(_bsnstatsreply, decoder) |
| 2024 | case 5: |
| 2025 | return DecodeBsnGentableBucketStatsReply(_bsnstatsreply, decoder) |
| 2026 | case 6: |
| 2027 | return DecodeBsnSwitchPipelineStatsReply(_bsnstatsreply, decoder) |
| 2028 | case 7: |
| 2029 | return DecodeBsnGentableStatsReply(_bsnstatsreply, decoder) |
| 2030 | case 8: |
| 2031 | return DecodeBsnPortCounterStatsReply(_bsnstatsreply, decoder) |
| 2032 | case 9: |
| 2033 | return DecodeBsnVlanCounterStatsReply(_bsnstatsreply, decoder) |
| 2034 | case 10: |
| 2035 | return DecodeBsnFlowChecksumBucketStatsReply(_bsnstatsreply, decoder) |
| 2036 | case 11: |
| 2037 | return DecodeBsnTableChecksumStatsReply(_bsnstatsreply, decoder) |
| 2038 | case 12: |
| 2039 | return DecodeBsnDebugCounterStatsReply(_bsnstatsreply, decoder) |
| 2040 | case 13: |
| 2041 | return DecodeBsnDebugCounterDescStatsReply(_bsnstatsreply, decoder) |
| 2042 | case 14: |
| 2043 | return DecodeBsnImageDescStatsReply(_bsnstatsreply, decoder) |
| 2044 | case 15: |
| 2045 | return DecodeBsnVrfCounterStatsReply(_bsnstatsreply, decoder) |
| 2046 | case 16: |
| 2047 | return DecodeBsnGenericStatsReply(_bsnstatsreply, decoder) |
| 2048 | default: |
| 2049 | return nil, fmt.Errorf("Invalid type '%d' for 'BsnStatsReply'", _bsnstatsreply.Subtype) |
| 2050 | } |
| 2051 | } |
| 2052 | |
| 2053 | func NewBsnStatsReply(_subtype uint32) *BsnStatsReply { |
| 2054 | obj := &BsnStatsReply{ |
| 2055 | ExperimenterStatsReply: NewExperimenterStatsReply(6035143), |
| 2056 | } |
| 2057 | obj.Subtype = _subtype |
| 2058 | return obj |
| 2059 | } |
| 2060 | |
| 2061 | type BsnDebugCounterDescStatsReply struct { |
| 2062 | *BsnStatsReply |
| 2063 | Entries []*BsnDebugCounterDescStatsEntry |
| 2064 | } |
| 2065 | |
| 2066 | type IBsnDebugCounterDescStatsReply interface { |
| 2067 | IBsnStatsReply |
| 2068 | GetEntries() []*BsnDebugCounterDescStatsEntry |
| 2069 | } |
| 2070 | |
| 2071 | func (self *BsnDebugCounterDescStatsReply) GetEntries() []*BsnDebugCounterDescStatsEntry { |
| 2072 | return self.Entries |
| 2073 | } |
| 2074 | |
| 2075 | func (self *BsnDebugCounterDescStatsReply) SetEntries(v []*BsnDebugCounterDescStatsEntry) { |
| 2076 | self.Entries = v |
| 2077 | } |
| 2078 | |
| 2079 | func (self *BsnDebugCounterDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2080 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2081 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 2082 | return err |
| 2083 | } |
| 2084 | |
| 2085 | for _, obj := range self.Entries { |
| 2086 | if err := obj.Serialize(encoder); err != nil { |
| 2087 | return err |
| 2088 | } |
| 2089 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2090 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2091 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2092 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2093 | |
| 2094 | return nil |
| 2095 | } |
| 2096 | |
| 2097 | func DecodeBsnDebugCounterDescStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnDebugCounterDescStatsReply, error) { |
| 2098 | _bsndebugcounterdescstatsreply := &BsnDebugCounterDescStatsReply{BsnStatsReply: parent} |
| 2099 | |
| 2100 | for decoder.Length() >= 328 { |
| 2101 | item, err := DecodeBsnDebugCounterDescStatsEntry(decoder) |
| 2102 | if err != nil { |
| 2103 | return nil, err |
| 2104 | } |
| 2105 | if item != nil { |
| 2106 | _bsndebugcounterdescstatsreply.Entries = append(_bsndebugcounterdescstatsreply.Entries, item) |
| 2107 | } |
| 2108 | } |
| 2109 | return _bsndebugcounterdescstatsreply, nil |
| 2110 | } |
| 2111 | |
| 2112 | func NewBsnDebugCounterDescStatsReply() *BsnDebugCounterDescStatsReply { |
| 2113 | obj := &BsnDebugCounterDescStatsReply{ |
| 2114 | BsnStatsReply: NewBsnStatsReply(13), |
| 2115 | } |
| 2116 | return obj |
| 2117 | } |
| 2118 | |
| 2119 | type ExperimenterStatsRequest struct { |
| 2120 | *StatsRequest |
| 2121 | Experimenter uint32 |
| 2122 | Subtype uint32 |
| 2123 | } |
| 2124 | |
| 2125 | type IExperimenterStatsRequest interface { |
| 2126 | IStatsRequest |
| 2127 | GetExperimenter() uint32 |
| 2128 | GetSubtype() uint32 |
| 2129 | } |
| 2130 | |
| 2131 | func (self *ExperimenterStatsRequest) GetExperimenter() uint32 { |
| 2132 | return self.Experimenter |
| 2133 | } |
| 2134 | |
| 2135 | func (self *ExperimenterStatsRequest) SetExperimenter(v uint32) { |
| 2136 | self.Experimenter = v |
| 2137 | } |
| 2138 | |
| 2139 | func (self *ExperimenterStatsRequest) GetSubtype() uint32 { |
| 2140 | return self.Subtype |
| 2141 | } |
| 2142 | |
| 2143 | func (self *ExperimenterStatsRequest) SetSubtype(v uint32) { |
| 2144 | self.Subtype = v |
| 2145 | } |
| 2146 | |
| 2147 | func (self *ExperimenterStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2148 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 2149 | return err |
| 2150 | } |
| 2151 | |
| 2152 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 2153 | encoder.PutUint32(uint32(self.Experimenter)) |
| 2154 | encoder.PutUint32(uint32(self.Subtype)) |
| 2155 | |
| 2156 | return nil |
| 2157 | } |
| 2158 | |
| 2159 | func DecodeExperimenterStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (IExperimenterStatsRequest, error) { |
| 2160 | _experimenterstatsrequest := &ExperimenterStatsRequest{StatsRequest: parent} |
| 2161 | if decoder.Length() < 12 { |
| 2162 | return nil, fmt.Errorf("ExperimenterStatsRequest packet too short: %d < 12", decoder.Length()) |
| 2163 | } |
| 2164 | decoder.Skip(4) |
| 2165 | _experimenterstatsrequest.Experimenter = uint32(decoder.ReadUint32()) |
| 2166 | _experimenterstatsrequest.Subtype = uint32(decoder.ReadUint32()) |
| 2167 | |
| 2168 | switch _experimenterstatsrequest.Experimenter { |
| 2169 | case 8992: |
| 2170 | return DecodeNiciraFlowStatsRequest(_experimenterstatsrequest, decoder) |
| 2171 | case 6035143: |
| 2172 | return DecodeBsnStatsRequest(_experimenterstatsrequest, decoder) |
| 2173 | default: |
| 2174 | return nil, fmt.Errorf("Invalid type '%d' for 'ExperimenterStatsRequest'", _experimenterstatsrequest.Experimenter) |
| 2175 | } |
| 2176 | } |
| 2177 | |
| 2178 | func NewExperimenterStatsRequest(_experimenter uint32) *ExperimenterStatsRequest { |
| 2179 | obj := &ExperimenterStatsRequest{ |
| 2180 | StatsRequest: NewStatsRequest(65535), |
| 2181 | } |
| 2182 | obj.Experimenter = _experimenter |
| 2183 | return obj |
| 2184 | } |
| 2185 | |
| 2186 | type BsnStatsRequest struct { |
| 2187 | *ExperimenterStatsRequest |
| 2188 | } |
| 2189 | |
| 2190 | type IBsnStatsRequest interface { |
| 2191 | IExperimenterStatsRequest |
| 2192 | } |
| 2193 | |
| 2194 | func (self *BsnStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2195 | if err := self.ExperimenterStatsRequest.Serialize(encoder); err != nil { |
| 2196 | return err |
| 2197 | } |
| 2198 | |
| 2199 | return nil |
| 2200 | } |
| 2201 | |
| 2202 | func DecodeBsnStatsRequest(parent *ExperimenterStatsRequest, decoder *goloxi.Decoder) (IBsnStatsRequest, error) { |
| 2203 | _bsnstatsrequest := &BsnStatsRequest{ExperimenterStatsRequest: parent} |
| 2204 | |
| 2205 | switch _bsnstatsrequest.Subtype { |
| 2206 | case 1: |
| 2207 | return DecodeBsnLacpStatsRequest(_bsnstatsrequest, decoder) |
| 2208 | case 2: |
| 2209 | return DecodeBsnGentableEntryDescStatsRequest(_bsnstatsrequest, decoder) |
| 2210 | case 3: |
| 2211 | return DecodeBsnGentableEntryStatsRequest(_bsnstatsrequest, decoder) |
| 2212 | case 4: |
| 2213 | return DecodeBsnGentableDescStatsRequest(_bsnstatsrequest, decoder) |
| 2214 | case 5: |
| 2215 | return DecodeBsnGentableBucketStatsRequest(_bsnstatsrequest, decoder) |
| 2216 | case 6: |
| 2217 | return DecodeBsnSwitchPipelineStatsRequest(_bsnstatsrequest, decoder) |
| 2218 | case 7: |
| 2219 | return DecodeBsnGentableStatsRequest(_bsnstatsrequest, decoder) |
| 2220 | case 8: |
| 2221 | return DecodeBsnPortCounterStatsRequest(_bsnstatsrequest, decoder) |
| 2222 | case 9: |
| 2223 | return DecodeBsnVlanCounterStatsRequest(_bsnstatsrequest, decoder) |
| 2224 | case 10: |
| 2225 | return DecodeBsnFlowChecksumBucketStatsRequest(_bsnstatsrequest, decoder) |
| 2226 | case 11: |
| 2227 | return DecodeBsnTableChecksumStatsRequest(_bsnstatsrequest, decoder) |
| 2228 | case 12: |
| 2229 | return DecodeBsnDebugCounterStatsRequest(_bsnstatsrequest, decoder) |
| 2230 | case 13: |
| 2231 | return DecodeBsnDebugCounterDescStatsRequest(_bsnstatsrequest, decoder) |
| 2232 | case 14: |
| 2233 | return DecodeBsnImageDescStatsRequest(_bsnstatsrequest, decoder) |
| 2234 | case 15: |
| 2235 | return DecodeBsnVrfCounterStatsRequest(_bsnstatsrequest, decoder) |
| 2236 | case 16: |
| 2237 | return DecodeBsnGenericStatsRequest(_bsnstatsrequest, decoder) |
| 2238 | default: |
| 2239 | return nil, fmt.Errorf("Invalid type '%d' for 'BsnStatsRequest'", _bsnstatsrequest.Subtype) |
| 2240 | } |
| 2241 | } |
| 2242 | |
| 2243 | func NewBsnStatsRequest(_subtype uint32) *BsnStatsRequest { |
| 2244 | obj := &BsnStatsRequest{ |
| 2245 | ExperimenterStatsRequest: NewExperimenterStatsRequest(6035143), |
| 2246 | } |
| 2247 | obj.Subtype = _subtype |
| 2248 | return obj |
| 2249 | } |
| 2250 | |
| 2251 | type BsnDebugCounterDescStatsRequest struct { |
| 2252 | *BsnStatsRequest |
| 2253 | } |
| 2254 | |
| 2255 | type IBsnDebugCounterDescStatsRequest interface { |
| 2256 | IBsnStatsRequest |
| 2257 | } |
| 2258 | |
| 2259 | func (self *BsnDebugCounterDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2260 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2261 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 2262 | return err |
| 2263 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2264 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2265 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2266 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2267 | |
| 2268 | return nil |
| 2269 | } |
| 2270 | |
| 2271 | func DecodeBsnDebugCounterDescStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnDebugCounterDescStatsRequest, error) { |
| 2272 | _bsndebugcounterdescstatsrequest := &BsnDebugCounterDescStatsRequest{BsnStatsRequest: parent} |
| 2273 | return _bsndebugcounterdescstatsrequest, nil |
| 2274 | } |
| 2275 | |
| 2276 | func NewBsnDebugCounterDescStatsRequest() *BsnDebugCounterDescStatsRequest { |
| 2277 | obj := &BsnDebugCounterDescStatsRequest{ |
| 2278 | BsnStatsRequest: NewBsnStatsRequest(13), |
| 2279 | } |
| 2280 | return obj |
| 2281 | } |
| 2282 | |
| 2283 | type BsnDebugCounterStatsReply struct { |
| 2284 | *BsnStatsReply |
| 2285 | Entries []*BsnDebugCounterStatsEntry |
| 2286 | } |
| 2287 | |
| 2288 | type IBsnDebugCounterStatsReply interface { |
| 2289 | IBsnStatsReply |
| 2290 | GetEntries() []*BsnDebugCounterStatsEntry |
| 2291 | } |
| 2292 | |
| 2293 | func (self *BsnDebugCounterStatsReply) GetEntries() []*BsnDebugCounterStatsEntry { |
| 2294 | return self.Entries |
| 2295 | } |
| 2296 | |
| 2297 | func (self *BsnDebugCounterStatsReply) SetEntries(v []*BsnDebugCounterStatsEntry) { |
| 2298 | self.Entries = v |
| 2299 | } |
| 2300 | |
| 2301 | func (self *BsnDebugCounterStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2302 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2303 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 2304 | return err |
| 2305 | } |
| 2306 | |
| 2307 | for _, obj := range self.Entries { |
| 2308 | if err := obj.Serialize(encoder); err != nil { |
| 2309 | return err |
| 2310 | } |
| 2311 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2312 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2313 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2314 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2315 | |
| 2316 | return nil |
| 2317 | } |
| 2318 | |
| 2319 | func DecodeBsnDebugCounterStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnDebugCounterStatsReply, error) { |
| 2320 | _bsndebugcounterstatsreply := &BsnDebugCounterStatsReply{BsnStatsReply: parent} |
| 2321 | |
| 2322 | for decoder.Length() >= 16 { |
| 2323 | item, err := DecodeBsnDebugCounterStatsEntry(decoder) |
| 2324 | if err != nil { |
| 2325 | return nil, err |
| 2326 | } |
| 2327 | if item != nil { |
| 2328 | _bsndebugcounterstatsreply.Entries = append(_bsndebugcounterstatsreply.Entries, item) |
| 2329 | } |
| 2330 | } |
| 2331 | return _bsndebugcounterstatsreply, nil |
| 2332 | } |
| 2333 | |
| 2334 | func NewBsnDebugCounterStatsReply() *BsnDebugCounterStatsReply { |
| 2335 | obj := &BsnDebugCounterStatsReply{ |
| 2336 | BsnStatsReply: NewBsnStatsReply(12), |
| 2337 | } |
| 2338 | return obj |
| 2339 | } |
| 2340 | |
| 2341 | type BsnDebugCounterStatsRequest struct { |
| 2342 | *BsnStatsRequest |
| 2343 | } |
| 2344 | |
| 2345 | type IBsnDebugCounterStatsRequest interface { |
| 2346 | IBsnStatsRequest |
| 2347 | } |
| 2348 | |
| 2349 | func (self *BsnDebugCounterStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2350 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2351 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 2352 | return err |
| 2353 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2354 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2355 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2356 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2357 | |
| 2358 | return nil |
| 2359 | } |
| 2360 | |
| 2361 | func DecodeBsnDebugCounterStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnDebugCounterStatsRequest, error) { |
| 2362 | _bsndebugcounterstatsrequest := &BsnDebugCounterStatsRequest{BsnStatsRequest: parent} |
| 2363 | return _bsndebugcounterstatsrequest, nil |
| 2364 | } |
| 2365 | |
| 2366 | func NewBsnDebugCounterStatsRequest() *BsnDebugCounterStatsRequest { |
| 2367 | obj := &BsnDebugCounterStatsRequest{ |
| 2368 | BsnStatsRequest: NewBsnStatsRequest(12), |
| 2369 | } |
| 2370 | return obj |
| 2371 | } |
| 2372 | |
| 2373 | type BsnError struct { |
| 2374 | *BsnBaseError |
| 2375 | } |
| 2376 | |
| 2377 | type IBsnError interface { |
| 2378 | IBsnBaseError |
| 2379 | } |
| 2380 | |
| 2381 | func (self *BsnError) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2382 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2383 | if err := self.BsnBaseError.Serialize(encoder); err != nil { |
| 2384 | return err |
| 2385 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2386 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2387 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2388 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2389 | |
| 2390 | return nil |
| 2391 | } |
| 2392 | |
| 2393 | func DecodeBsnError(parent *BsnBaseError, decoder *goloxi.Decoder) (*BsnError, error) { |
| 2394 | _bsnerror := &BsnError{BsnBaseError: parent} |
| 2395 | return _bsnerror, nil |
| 2396 | } |
| 2397 | |
| 2398 | func NewBsnError() *BsnError { |
| 2399 | obj := &BsnError{ |
| 2400 | BsnBaseError: NewBsnBaseError(1), |
| 2401 | } |
| 2402 | return obj |
| 2403 | } |
| 2404 | |
| 2405 | type BsnFlowChecksumBucketStatsReply struct { |
| 2406 | *BsnStatsReply |
| 2407 | Entries []*BsnFlowChecksumBucketStatsEntry |
| 2408 | } |
| 2409 | |
| 2410 | type IBsnFlowChecksumBucketStatsReply interface { |
| 2411 | IBsnStatsReply |
| 2412 | GetEntries() []*BsnFlowChecksumBucketStatsEntry |
| 2413 | } |
| 2414 | |
| 2415 | func (self *BsnFlowChecksumBucketStatsReply) GetEntries() []*BsnFlowChecksumBucketStatsEntry { |
| 2416 | return self.Entries |
| 2417 | } |
| 2418 | |
| 2419 | func (self *BsnFlowChecksumBucketStatsReply) SetEntries(v []*BsnFlowChecksumBucketStatsEntry) { |
| 2420 | self.Entries = v |
| 2421 | } |
| 2422 | |
| 2423 | func (self *BsnFlowChecksumBucketStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2424 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2425 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 2426 | return err |
| 2427 | } |
| 2428 | |
| 2429 | for _, obj := range self.Entries { |
| 2430 | if err := obj.Serialize(encoder); err != nil { |
| 2431 | return err |
| 2432 | } |
| 2433 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2434 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2435 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2436 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2437 | |
| 2438 | return nil |
| 2439 | } |
| 2440 | |
| 2441 | func DecodeBsnFlowChecksumBucketStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnFlowChecksumBucketStatsReply, error) { |
| 2442 | _bsnflowchecksumbucketstatsreply := &BsnFlowChecksumBucketStatsReply{BsnStatsReply: parent} |
| 2443 | |
| 2444 | for decoder.Length() >= 8 { |
| 2445 | item, err := DecodeBsnFlowChecksumBucketStatsEntry(decoder) |
| 2446 | if err != nil { |
| 2447 | return nil, err |
| 2448 | } |
| 2449 | if item != nil { |
| 2450 | _bsnflowchecksumbucketstatsreply.Entries = append(_bsnflowchecksumbucketstatsreply.Entries, item) |
| 2451 | } |
| 2452 | } |
| 2453 | return _bsnflowchecksumbucketstatsreply, nil |
| 2454 | } |
| 2455 | |
| 2456 | func NewBsnFlowChecksumBucketStatsReply() *BsnFlowChecksumBucketStatsReply { |
| 2457 | obj := &BsnFlowChecksumBucketStatsReply{ |
| 2458 | BsnStatsReply: NewBsnStatsReply(10), |
| 2459 | } |
| 2460 | return obj |
| 2461 | } |
| 2462 | |
| 2463 | type BsnFlowChecksumBucketStatsRequest struct { |
| 2464 | *BsnStatsRequest |
| 2465 | TableId uint8 |
| 2466 | } |
| 2467 | |
| 2468 | type IBsnFlowChecksumBucketStatsRequest interface { |
| 2469 | IBsnStatsRequest |
| 2470 | GetTableId() uint8 |
| 2471 | } |
| 2472 | |
| 2473 | func (self *BsnFlowChecksumBucketStatsRequest) GetTableId() uint8 { |
| 2474 | return self.TableId |
| 2475 | } |
| 2476 | |
| 2477 | func (self *BsnFlowChecksumBucketStatsRequest) SetTableId(v uint8) { |
| 2478 | self.TableId = v |
| 2479 | } |
| 2480 | |
| 2481 | func (self *BsnFlowChecksumBucketStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2482 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2483 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 2484 | return err |
| 2485 | } |
| 2486 | |
| 2487 | encoder.PutUint8(uint8(self.TableId)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2488 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2489 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2490 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2491 | |
| 2492 | return nil |
| 2493 | } |
| 2494 | |
| 2495 | func DecodeBsnFlowChecksumBucketStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnFlowChecksumBucketStatsRequest, error) { |
| 2496 | _bsnflowchecksumbucketstatsrequest := &BsnFlowChecksumBucketStatsRequest{BsnStatsRequest: parent} |
| 2497 | if decoder.Length() < 1 { |
| 2498 | return nil, fmt.Errorf("BsnFlowChecksumBucketStatsRequest packet too short: %d < 1", decoder.Length()) |
| 2499 | } |
| 2500 | _bsnflowchecksumbucketstatsrequest.TableId = uint8(decoder.ReadByte()) |
| 2501 | return _bsnflowchecksumbucketstatsrequest, nil |
| 2502 | } |
| 2503 | |
| 2504 | func NewBsnFlowChecksumBucketStatsRequest() *BsnFlowChecksumBucketStatsRequest { |
| 2505 | obj := &BsnFlowChecksumBucketStatsRequest{ |
| 2506 | BsnStatsRequest: NewBsnStatsRequest(10), |
| 2507 | } |
| 2508 | return obj |
| 2509 | } |
| 2510 | |
| 2511 | type BsnFlowIdle struct { |
| 2512 | *BsnHeader |
| 2513 | Cookie uint64 |
| 2514 | Priority uint16 |
| 2515 | TableId uint8 |
| 2516 | Match Match |
| 2517 | } |
| 2518 | |
| 2519 | type IBsnFlowIdle interface { |
| 2520 | IBsnHeader |
| 2521 | GetCookie() uint64 |
| 2522 | GetPriority() uint16 |
| 2523 | GetTableId() uint8 |
| 2524 | GetMatch() Match |
| 2525 | } |
| 2526 | |
| 2527 | func (self *BsnFlowIdle) GetCookie() uint64 { |
| 2528 | return self.Cookie |
| 2529 | } |
| 2530 | |
| 2531 | func (self *BsnFlowIdle) SetCookie(v uint64) { |
| 2532 | self.Cookie = v |
| 2533 | } |
| 2534 | |
| 2535 | func (self *BsnFlowIdle) GetPriority() uint16 { |
| 2536 | return self.Priority |
| 2537 | } |
| 2538 | |
| 2539 | func (self *BsnFlowIdle) SetPriority(v uint16) { |
| 2540 | self.Priority = v |
| 2541 | } |
| 2542 | |
| 2543 | func (self *BsnFlowIdle) GetTableId() uint8 { |
| 2544 | return self.TableId |
| 2545 | } |
| 2546 | |
| 2547 | func (self *BsnFlowIdle) SetTableId(v uint8) { |
| 2548 | self.TableId = v |
| 2549 | } |
| 2550 | |
| 2551 | func (self *BsnFlowIdle) GetMatch() Match { |
| 2552 | return self.Match |
| 2553 | } |
| 2554 | |
| 2555 | func (self *BsnFlowIdle) SetMatch(v Match) { |
| 2556 | self.Match = v |
| 2557 | } |
| 2558 | |
| 2559 | func (self *BsnFlowIdle) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2560 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2561 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2562 | return err |
| 2563 | } |
| 2564 | |
| 2565 | encoder.PutUint64(uint64(self.Cookie)) |
| 2566 | encoder.PutUint16(uint16(self.Priority)) |
| 2567 | encoder.PutUint8(uint8(self.TableId)) |
| 2568 | encoder.Write(bytes.Repeat([]byte{0}, 5)) |
| 2569 | if err := self.Match.Serialize(encoder); err != nil { |
| 2570 | return err |
| 2571 | } |
| 2572 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2573 | length := len(encoder.Bytes()) - startIndex |
| 2574 | |
| 2575 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2576 | |
| 2577 | return nil |
| 2578 | } |
| 2579 | |
| 2580 | func DecodeBsnFlowIdle(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnFlowIdle, error) { |
| 2581 | _bsnflowidle := &BsnFlowIdle{BsnHeader: parent} |
| 2582 | if decoder.Length() < 24 { |
| 2583 | return nil, fmt.Errorf("BsnFlowIdle packet too short: %d < 24", decoder.Length()) |
| 2584 | } |
| 2585 | _bsnflowidle.Cookie = uint64(decoder.ReadUint64()) |
| 2586 | _bsnflowidle.Priority = uint16(decoder.ReadUint16()) |
| 2587 | _bsnflowidle.TableId = uint8(decoder.ReadByte()) |
| 2588 | decoder.Skip(5) |
| 2589 | if err := _bsnflowidle.Match.Decode(decoder); err != nil { |
| 2590 | return nil, err |
| 2591 | } |
| 2592 | |
| 2593 | decoder.SkipAlign() |
| 2594 | return _bsnflowidle, nil |
| 2595 | } |
| 2596 | |
| 2597 | func NewBsnFlowIdle() *BsnFlowIdle { |
| 2598 | obj := &BsnFlowIdle{ |
| 2599 | BsnHeader: NewBsnHeader(40), |
| 2600 | } |
| 2601 | return obj |
| 2602 | } |
| 2603 | |
| 2604 | type BsnFlowIdleEnableGetReply struct { |
| 2605 | *BsnHeader |
| 2606 | Enabled uint32 |
| 2607 | } |
| 2608 | |
| 2609 | type IBsnFlowIdleEnableGetReply interface { |
| 2610 | IBsnHeader |
| 2611 | GetEnabled() uint32 |
| 2612 | } |
| 2613 | |
| 2614 | func (self *BsnFlowIdleEnableGetReply) GetEnabled() uint32 { |
| 2615 | return self.Enabled |
| 2616 | } |
| 2617 | |
| 2618 | func (self *BsnFlowIdleEnableGetReply) SetEnabled(v uint32) { |
| 2619 | self.Enabled = v |
| 2620 | } |
| 2621 | |
| 2622 | func (self *BsnFlowIdleEnableGetReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2623 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2624 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2625 | return err |
| 2626 | } |
| 2627 | |
| 2628 | encoder.PutUint32(uint32(self.Enabled)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2629 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2630 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2631 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2632 | |
| 2633 | return nil |
| 2634 | } |
| 2635 | |
| 2636 | func DecodeBsnFlowIdleEnableGetReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnFlowIdleEnableGetReply, error) { |
| 2637 | _bsnflowidleenablegetreply := &BsnFlowIdleEnableGetReply{BsnHeader: parent} |
| 2638 | if decoder.Length() < 4 { |
| 2639 | return nil, fmt.Errorf("BsnFlowIdleEnableGetReply packet too short: %d < 4", decoder.Length()) |
| 2640 | } |
| 2641 | _bsnflowidleenablegetreply.Enabled = uint32(decoder.ReadUint32()) |
| 2642 | return _bsnflowidleenablegetreply, nil |
| 2643 | } |
| 2644 | |
| 2645 | func NewBsnFlowIdleEnableGetReply() *BsnFlowIdleEnableGetReply { |
| 2646 | obj := &BsnFlowIdleEnableGetReply{ |
| 2647 | BsnHeader: NewBsnHeader(39), |
| 2648 | } |
| 2649 | return obj |
| 2650 | } |
| 2651 | |
| 2652 | type BsnFlowIdleEnableGetRequest struct { |
| 2653 | *BsnHeader |
| 2654 | } |
| 2655 | |
| 2656 | type IBsnFlowIdleEnableGetRequest interface { |
| 2657 | IBsnHeader |
| 2658 | } |
| 2659 | |
| 2660 | func (self *BsnFlowIdleEnableGetRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2661 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2662 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2663 | return err |
| 2664 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2665 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2666 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2667 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2668 | |
| 2669 | return nil |
| 2670 | } |
| 2671 | |
| 2672 | func DecodeBsnFlowIdleEnableGetRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnFlowIdleEnableGetRequest, error) { |
| 2673 | _bsnflowidleenablegetrequest := &BsnFlowIdleEnableGetRequest{BsnHeader: parent} |
| 2674 | return _bsnflowidleenablegetrequest, nil |
| 2675 | } |
| 2676 | |
| 2677 | func NewBsnFlowIdleEnableGetRequest() *BsnFlowIdleEnableGetRequest { |
| 2678 | obj := &BsnFlowIdleEnableGetRequest{ |
| 2679 | BsnHeader: NewBsnHeader(38), |
| 2680 | } |
| 2681 | return obj |
| 2682 | } |
| 2683 | |
| 2684 | type BsnFlowIdleEnableSetReply struct { |
| 2685 | *BsnHeader |
| 2686 | Enable uint32 |
| 2687 | Status uint32 |
| 2688 | } |
| 2689 | |
| 2690 | type IBsnFlowIdleEnableSetReply interface { |
| 2691 | IBsnHeader |
| 2692 | GetEnable() uint32 |
| 2693 | GetStatus() uint32 |
| 2694 | } |
| 2695 | |
| 2696 | func (self *BsnFlowIdleEnableSetReply) GetEnable() uint32 { |
| 2697 | return self.Enable |
| 2698 | } |
| 2699 | |
| 2700 | func (self *BsnFlowIdleEnableSetReply) SetEnable(v uint32) { |
| 2701 | self.Enable = v |
| 2702 | } |
| 2703 | |
| 2704 | func (self *BsnFlowIdleEnableSetReply) GetStatus() uint32 { |
| 2705 | return self.Status |
| 2706 | } |
| 2707 | |
| 2708 | func (self *BsnFlowIdleEnableSetReply) SetStatus(v uint32) { |
| 2709 | self.Status = v |
| 2710 | } |
| 2711 | |
| 2712 | func (self *BsnFlowIdleEnableSetReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2713 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2714 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2715 | return err |
| 2716 | } |
| 2717 | |
| 2718 | encoder.PutUint32(uint32(self.Enable)) |
| 2719 | encoder.PutUint32(uint32(self.Status)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2720 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2721 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2722 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2723 | |
| 2724 | return nil |
| 2725 | } |
| 2726 | |
| 2727 | func DecodeBsnFlowIdleEnableSetReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnFlowIdleEnableSetReply, error) { |
| 2728 | _bsnflowidleenablesetreply := &BsnFlowIdleEnableSetReply{BsnHeader: parent} |
| 2729 | if decoder.Length() < 8 { |
| 2730 | return nil, fmt.Errorf("BsnFlowIdleEnableSetReply packet too short: %d < 8", decoder.Length()) |
| 2731 | } |
| 2732 | _bsnflowidleenablesetreply.Enable = uint32(decoder.ReadUint32()) |
| 2733 | _bsnflowidleenablesetreply.Status = uint32(decoder.ReadUint32()) |
| 2734 | return _bsnflowidleenablesetreply, nil |
| 2735 | } |
| 2736 | |
| 2737 | func NewBsnFlowIdleEnableSetReply() *BsnFlowIdleEnableSetReply { |
| 2738 | obj := &BsnFlowIdleEnableSetReply{ |
| 2739 | BsnHeader: NewBsnHeader(37), |
| 2740 | } |
| 2741 | return obj |
| 2742 | } |
| 2743 | |
| 2744 | type BsnFlowIdleEnableSetRequest struct { |
| 2745 | *BsnHeader |
| 2746 | Enable uint32 |
| 2747 | } |
| 2748 | |
| 2749 | type IBsnFlowIdleEnableSetRequest interface { |
| 2750 | IBsnHeader |
| 2751 | GetEnable() uint32 |
| 2752 | } |
| 2753 | |
| 2754 | func (self *BsnFlowIdleEnableSetRequest) GetEnable() uint32 { |
| 2755 | return self.Enable |
| 2756 | } |
| 2757 | |
| 2758 | func (self *BsnFlowIdleEnableSetRequest) SetEnable(v uint32) { |
| 2759 | self.Enable = v |
| 2760 | } |
| 2761 | |
| 2762 | func (self *BsnFlowIdleEnableSetRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2763 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2764 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2765 | return err |
| 2766 | } |
| 2767 | |
| 2768 | encoder.PutUint32(uint32(self.Enable)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2769 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2770 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2771 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2772 | |
| 2773 | return nil |
| 2774 | } |
| 2775 | |
| 2776 | func DecodeBsnFlowIdleEnableSetRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnFlowIdleEnableSetRequest, error) { |
| 2777 | _bsnflowidleenablesetrequest := &BsnFlowIdleEnableSetRequest{BsnHeader: parent} |
| 2778 | if decoder.Length() < 4 { |
| 2779 | return nil, fmt.Errorf("BsnFlowIdleEnableSetRequest packet too short: %d < 4", decoder.Length()) |
| 2780 | } |
| 2781 | _bsnflowidleenablesetrequest.Enable = uint32(decoder.ReadUint32()) |
| 2782 | return _bsnflowidleenablesetrequest, nil |
| 2783 | } |
| 2784 | |
| 2785 | func NewBsnFlowIdleEnableSetRequest() *BsnFlowIdleEnableSetRequest { |
| 2786 | obj := &BsnFlowIdleEnableSetRequest{ |
| 2787 | BsnHeader: NewBsnHeader(36), |
| 2788 | } |
| 2789 | return obj |
| 2790 | } |
| 2791 | |
| 2792 | type BsnGenericStatsReply struct { |
| 2793 | *BsnStatsReply |
| 2794 | Entries []*BsnGenericStatsEntry |
| 2795 | } |
| 2796 | |
| 2797 | type IBsnGenericStatsReply interface { |
| 2798 | IBsnStatsReply |
| 2799 | GetEntries() []*BsnGenericStatsEntry |
| 2800 | } |
| 2801 | |
| 2802 | func (self *BsnGenericStatsReply) GetEntries() []*BsnGenericStatsEntry { |
| 2803 | return self.Entries |
| 2804 | } |
| 2805 | |
| 2806 | func (self *BsnGenericStatsReply) SetEntries(v []*BsnGenericStatsEntry) { |
| 2807 | self.Entries = v |
| 2808 | } |
| 2809 | |
| 2810 | func (self *BsnGenericStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2811 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2812 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 2813 | return err |
| 2814 | } |
| 2815 | |
| 2816 | for _, obj := range self.Entries { |
| 2817 | if err := obj.Serialize(encoder); err != nil { |
| 2818 | return err |
| 2819 | } |
| 2820 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2821 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2822 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2823 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2824 | |
| 2825 | return nil |
| 2826 | } |
| 2827 | |
| 2828 | func DecodeBsnGenericStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnGenericStatsReply, error) { |
| 2829 | _bsngenericstatsreply := &BsnGenericStatsReply{BsnStatsReply: parent} |
| 2830 | |
| 2831 | for decoder.Length() >= 2 { |
| 2832 | item, err := DecodeBsnGenericStatsEntry(decoder) |
| 2833 | if err != nil { |
| 2834 | return nil, err |
| 2835 | } |
| 2836 | if item != nil { |
| 2837 | _bsngenericstatsreply.Entries = append(_bsngenericstatsreply.Entries, item) |
| 2838 | } |
| 2839 | } |
| 2840 | return _bsngenericstatsreply, nil |
| 2841 | } |
| 2842 | |
| 2843 | func NewBsnGenericStatsReply() *BsnGenericStatsReply { |
| 2844 | obj := &BsnGenericStatsReply{ |
| 2845 | BsnStatsReply: NewBsnStatsReply(16), |
| 2846 | } |
| 2847 | return obj |
| 2848 | } |
| 2849 | |
| 2850 | type BsnGenericStatsRequest struct { |
| 2851 | *BsnStatsRequest |
| 2852 | Name string |
| 2853 | Tlvs []IBsnTlv |
| 2854 | } |
| 2855 | |
| 2856 | type IBsnGenericStatsRequest interface { |
| 2857 | IBsnStatsRequest |
| 2858 | GetName() string |
| 2859 | GetTlvs() []IBsnTlv |
| 2860 | } |
| 2861 | |
| 2862 | func (self *BsnGenericStatsRequest) GetName() string { |
| 2863 | return self.Name |
| 2864 | } |
| 2865 | |
| 2866 | func (self *BsnGenericStatsRequest) SetName(v string) { |
| 2867 | self.Name = v |
| 2868 | } |
| 2869 | |
| 2870 | func (self *BsnGenericStatsRequest) GetTlvs() []IBsnTlv { |
| 2871 | return self.Tlvs |
| 2872 | } |
| 2873 | |
| 2874 | func (self *BsnGenericStatsRequest) SetTlvs(v []IBsnTlv) { |
| 2875 | self.Tlvs = v |
| 2876 | } |
| 2877 | |
| 2878 | func (self *BsnGenericStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2879 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2880 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 2881 | return err |
| 2882 | } |
| 2883 | |
| 2884 | encoder.Write([]byte(self.Name)) |
| 2885 | for _, obj := range self.Tlvs { |
| 2886 | if err := obj.Serialize(encoder); err != nil { |
| 2887 | return err |
| 2888 | } |
| 2889 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2890 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2891 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2892 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2893 | |
| 2894 | return nil |
| 2895 | } |
| 2896 | |
| 2897 | func DecodeBsnGenericStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnGenericStatsRequest, error) { |
| 2898 | _bsngenericstatsrequest := &BsnGenericStatsRequest{BsnStatsRequest: parent} |
| 2899 | if decoder.Length() < 64 { |
| 2900 | return nil, fmt.Errorf("BsnGenericStatsRequest packet too short: %d < 64", decoder.Length()) |
| 2901 | } |
| 2902 | _bsngenericstatsrequest.Name = string(bytes.Trim(decoder.Read(64), "\x00")) |
| 2903 | |
| 2904 | for decoder.Length() >= 4 { |
| 2905 | item, err := DecodeBsnTlv(decoder) |
| 2906 | if err != nil { |
| 2907 | return nil, err |
| 2908 | } |
| 2909 | if item != nil { |
| 2910 | _bsngenericstatsrequest.Tlvs = append(_bsngenericstatsrequest.Tlvs, item) |
| 2911 | } |
| 2912 | } |
| 2913 | return _bsngenericstatsrequest, nil |
| 2914 | } |
| 2915 | |
| 2916 | func NewBsnGenericStatsRequest() *BsnGenericStatsRequest { |
| 2917 | obj := &BsnGenericStatsRequest{ |
| 2918 | BsnStatsRequest: NewBsnStatsRequest(16), |
| 2919 | } |
| 2920 | return obj |
| 2921 | } |
| 2922 | |
| 2923 | type BsnGentableBucketStatsReply struct { |
| 2924 | *BsnStatsReply |
| 2925 | Entries []*BsnGentableBucketStatsEntry |
| 2926 | } |
| 2927 | |
| 2928 | type IBsnGentableBucketStatsReply interface { |
| 2929 | IBsnStatsReply |
| 2930 | GetEntries() []*BsnGentableBucketStatsEntry |
| 2931 | } |
| 2932 | |
| 2933 | func (self *BsnGentableBucketStatsReply) GetEntries() []*BsnGentableBucketStatsEntry { |
| 2934 | return self.Entries |
| 2935 | } |
| 2936 | |
| 2937 | func (self *BsnGentableBucketStatsReply) SetEntries(v []*BsnGentableBucketStatsEntry) { |
| 2938 | self.Entries = v |
| 2939 | } |
| 2940 | |
| 2941 | func (self *BsnGentableBucketStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2942 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2943 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 2944 | return err |
| 2945 | } |
| 2946 | |
| 2947 | for _, obj := range self.Entries { |
| 2948 | if err := obj.Serialize(encoder); err != nil { |
| 2949 | return err |
| 2950 | } |
| 2951 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2952 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2953 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 2954 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 2955 | |
| 2956 | return nil |
| 2957 | } |
| 2958 | |
| 2959 | func DecodeBsnGentableBucketStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnGentableBucketStatsReply, error) { |
| 2960 | _bsngentablebucketstatsreply := &BsnGentableBucketStatsReply{BsnStatsReply: parent} |
| 2961 | |
| 2962 | for decoder.Length() >= 16 { |
| 2963 | item, err := DecodeBsnGentableBucketStatsEntry(decoder) |
| 2964 | if err != nil { |
| 2965 | return nil, err |
| 2966 | } |
| 2967 | if item != nil { |
| 2968 | _bsngentablebucketstatsreply.Entries = append(_bsngentablebucketstatsreply.Entries, item) |
| 2969 | } |
| 2970 | } |
| 2971 | return _bsngentablebucketstatsreply, nil |
| 2972 | } |
| 2973 | |
| 2974 | func NewBsnGentableBucketStatsReply() *BsnGentableBucketStatsReply { |
| 2975 | obj := &BsnGentableBucketStatsReply{ |
| 2976 | BsnStatsReply: NewBsnStatsReply(5), |
| 2977 | } |
| 2978 | return obj |
| 2979 | } |
| 2980 | |
| 2981 | type BsnGentableBucketStatsRequest struct { |
| 2982 | *BsnStatsRequest |
| 2983 | TableId uint16 |
| 2984 | } |
| 2985 | |
| 2986 | type IBsnGentableBucketStatsRequest interface { |
| 2987 | IBsnStatsRequest |
| 2988 | GetTableId() uint16 |
| 2989 | } |
| 2990 | |
| 2991 | func (self *BsnGentableBucketStatsRequest) GetTableId() uint16 { |
| 2992 | return self.TableId |
| 2993 | } |
| 2994 | |
| 2995 | func (self *BsnGentableBucketStatsRequest) SetTableId(v uint16) { |
| 2996 | self.TableId = v |
| 2997 | } |
| 2998 | |
| 2999 | func (self *BsnGentableBucketStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3000 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3001 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 3002 | return err |
| 3003 | } |
| 3004 | |
| 3005 | encoder.PutUint16(uint16(self.TableId)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3006 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3007 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3008 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3009 | |
| 3010 | return nil |
| 3011 | } |
| 3012 | |
| 3013 | func DecodeBsnGentableBucketStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnGentableBucketStatsRequest, error) { |
| 3014 | _bsngentablebucketstatsrequest := &BsnGentableBucketStatsRequest{BsnStatsRequest: parent} |
| 3015 | if decoder.Length() < 2 { |
| 3016 | return nil, fmt.Errorf("BsnGentableBucketStatsRequest packet too short: %d < 2", decoder.Length()) |
| 3017 | } |
| 3018 | _bsngentablebucketstatsrequest.TableId = uint16(decoder.ReadUint16()) |
| 3019 | return _bsngentablebucketstatsrequest, nil |
| 3020 | } |
| 3021 | |
| 3022 | func NewBsnGentableBucketStatsRequest() *BsnGentableBucketStatsRequest { |
| 3023 | obj := &BsnGentableBucketStatsRequest{ |
| 3024 | BsnStatsRequest: NewBsnStatsRequest(5), |
| 3025 | } |
| 3026 | return obj |
| 3027 | } |
| 3028 | |
| 3029 | type BsnGentableClearReply struct { |
| 3030 | *BsnHeader |
| 3031 | TableId uint16 |
| 3032 | DeletedCount uint32 |
| 3033 | ErrorCount uint32 |
| 3034 | } |
| 3035 | |
| 3036 | type IBsnGentableClearReply interface { |
| 3037 | IBsnHeader |
| 3038 | GetTableId() uint16 |
| 3039 | GetDeletedCount() uint32 |
| 3040 | GetErrorCount() uint32 |
| 3041 | } |
| 3042 | |
| 3043 | func (self *BsnGentableClearReply) GetTableId() uint16 { |
| 3044 | return self.TableId |
| 3045 | } |
| 3046 | |
| 3047 | func (self *BsnGentableClearReply) SetTableId(v uint16) { |
| 3048 | self.TableId = v |
| 3049 | } |
| 3050 | |
| 3051 | func (self *BsnGentableClearReply) GetDeletedCount() uint32 { |
| 3052 | return self.DeletedCount |
| 3053 | } |
| 3054 | |
| 3055 | func (self *BsnGentableClearReply) SetDeletedCount(v uint32) { |
| 3056 | self.DeletedCount = v |
| 3057 | } |
| 3058 | |
| 3059 | func (self *BsnGentableClearReply) GetErrorCount() uint32 { |
| 3060 | return self.ErrorCount |
| 3061 | } |
| 3062 | |
| 3063 | func (self *BsnGentableClearReply) SetErrorCount(v uint32) { |
| 3064 | self.ErrorCount = v |
| 3065 | } |
| 3066 | |
| 3067 | func (self *BsnGentableClearReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3068 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3069 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 3070 | return err |
| 3071 | } |
| 3072 | |
| 3073 | encoder.PutUint16(uint16(self.TableId)) |
| 3074 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 3075 | encoder.PutUint32(uint32(self.DeletedCount)) |
| 3076 | encoder.PutUint32(uint32(self.ErrorCount)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3077 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3078 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3079 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3080 | |
| 3081 | return nil |
| 3082 | } |
| 3083 | |
| 3084 | func DecodeBsnGentableClearReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGentableClearReply, error) { |
| 3085 | _bsngentableclearreply := &BsnGentableClearReply{BsnHeader: parent} |
| 3086 | if decoder.Length() < 12 { |
| 3087 | return nil, fmt.Errorf("BsnGentableClearReply packet too short: %d < 12", decoder.Length()) |
| 3088 | } |
| 3089 | _bsngentableclearreply.TableId = uint16(decoder.ReadUint16()) |
| 3090 | decoder.Skip(2) |
| 3091 | _bsngentableclearreply.DeletedCount = uint32(decoder.ReadUint32()) |
| 3092 | _bsngentableclearreply.ErrorCount = uint32(decoder.ReadUint32()) |
| 3093 | return _bsngentableclearreply, nil |
| 3094 | } |
| 3095 | |
| 3096 | func NewBsnGentableClearReply() *BsnGentableClearReply { |
| 3097 | obj := &BsnGentableClearReply{ |
| 3098 | BsnHeader: NewBsnHeader(49), |
| 3099 | } |
| 3100 | return obj |
| 3101 | } |
| 3102 | |
| 3103 | type BsnGentableClearRequest struct { |
| 3104 | *BsnHeader |
| 3105 | TableId uint16 |
| 3106 | Checksum Checksum128 |
| 3107 | ChecksumMask Checksum128 |
| 3108 | } |
| 3109 | |
| 3110 | type IBsnGentableClearRequest interface { |
| 3111 | IBsnHeader |
| 3112 | GetTableId() uint16 |
| 3113 | GetChecksum() Checksum128 |
| 3114 | GetChecksumMask() Checksum128 |
| 3115 | } |
| 3116 | |
| 3117 | func (self *BsnGentableClearRequest) GetTableId() uint16 { |
| 3118 | return self.TableId |
| 3119 | } |
| 3120 | |
| 3121 | func (self *BsnGentableClearRequest) SetTableId(v uint16) { |
| 3122 | self.TableId = v |
| 3123 | } |
| 3124 | |
| 3125 | func (self *BsnGentableClearRequest) GetChecksum() Checksum128 { |
| 3126 | return self.Checksum |
| 3127 | } |
| 3128 | |
| 3129 | func (self *BsnGentableClearRequest) SetChecksum(v Checksum128) { |
| 3130 | self.Checksum = v |
| 3131 | } |
| 3132 | |
| 3133 | func (self *BsnGentableClearRequest) GetChecksumMask() Checksum128 { |
| 3134 | return self.ChecksumMask |
| 3135 | } |
| 3136 | |
| 3137 | func (self *BsnGentableClearRequest) SetChecksumMask(v Checksum128) { |
| 3138 | self.ChecksumMask = v |
| 3139 | } |
| 3140 | |
| 3141 | func (self *BsnGentableClearRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3142 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3143 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 3144 | return err |
| 3145 | } |
| 3146 | |
| 3147 | encoder.PutUint16(uint16(self.TableId)) |
| 3148 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 3149 | self.Checksum.Serialize(encoder) |
| 3150 | self.ChecksumMask.Serialize(encoder) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3151 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3152 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3153 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3154 | |
| 3155 | return nil |
| 3156 | } |
| 3157 | |
| 3158 | func DecodeBsnGentableClearRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGentableClearRequest, error) { |
| 3159 | _bsngentableclearrequest := &BsnGentableClearRequest{BsnHeader: parent} |
| 3160 | if decoder.Length() < 36 { |
| 3161 | return nil, fmt.Errorf("BsnGentableClearRequest packet too short: %d < 36", decoder.Length()) |
| 3162 | } |
| 3163 | _bsngentableclearrequest.TableId = uint16(decoder.ReadUint16()) |
| 3164 | decoder.Skip(2) |
| 3165 | _bsngentableclearrequest.Checksum.Decode(decoder) |
| 3166 | _bsngentableclearrequest.ChecksumMask.Decode(decoder) |
| 3167 | return _bsngentableclearrequest, nil |
| 3168 | } |
| 3169 | |
| 3170 | func NewBsnGentableClearRequest() *BsnGentableClearRequest { |
| 3171 | obj := &BsnGentableClearRequest{ |
| 3172 | BsnHeader: NewBsnHeader(48), |
| 3173 | } |
| 3174 | return obj |
| 3175 | } |
| 3176 | |
| 3177 | type BsnGentableDescStatsReply struct { |
| 3178 | *BsnStatsReply |
| 3179 | Entries []*BsnGentableDescStatsEntry |
| 3180 | } |
| 3181 | |
| 3182 | type IBsnGentableDescStatsReply interface { |
| 3183 | IBsnStatsReply |
| 3184 | GetEntries() []*BsnGentableDescStatsEntry |
| 3185 | } |
| 3186 | |
| 3187 | func (self *BsnGentableDescStatsReply) GetEntries() []*BsnGentableDescStatsEntry { |
| 3188 | return self.Entries |
| 3189 | } |
| 3190 | |
| 3191 | func (self *BsnGentableDescStatsReply) SetEntries(v []*BsnGentableDescStatsEntry) { |
| 3192 | self.Entries = v |
| 3193 | } |
| 3194 | |
| 3195 | func (self *BsnGentableDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3196 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3197 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 3198 | return err |
| 3199 | } |
| 3200 | |
| 3201 | for _, obj := range self.Entries { |
| 3202 | if err := obj.Serialize(encoder); err != nil { |
| 3203 | return err |
| 3204 | } |
| 3205 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3206 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3207 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3208 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3209 | |
| 3210 | return nil |
| 3211 | } |
| 3212 | |
| 3213 | func DecodeBsnGentableDescStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnGentableDescStatsReply, error) { |
| 3214 | _bsngentabledescstatsreply := &BsnGentableDescStatsReply{BsnStatsReply: parent} |
| 3215 | |
| 3216 | for decoder.Length() >= 48 { |
| 3217 | item, err := DecodeBsnGentableDescStatsEntry(decoder) |
| 3218 | if err != nil { |
| 3219 | return nil, err |
| 3220 | } |
| 3221 | if item != nil { |
| 3222 | _bsngentabledescstatsreply.Entries = append(_bsngentabledescstatsreply.Entries, item) |
| 3223 | } |
| 3224 | } |
| 3225 | return _bsngentabledescstatsreply, nil |
| 3226 | } |
| 3227 | |
| 3228 | func NewBsnGentableDescStatsReply() *BsnGentableDescStatsReply { |
| 3229 | obj := &BsnGentableDescStatsReply{ |
| 3230 | BsnStatsReply: NewBsnStatsReply(4), |
| 3231 | } |
| 3232 | return obj |
| 3233 | } |
| 3234 | |
| 3235 | type BsnGentableDescStatsRequest struct { |
| 3236 | *BsnStatsRequest |
| 3237 | } |
| 3238 | |
| 3239 | type IBsnGentableDescStatsRequest interface { |
| 3240 | IBsnStatsRequest |
| 3241 | } |
| 3242 | |
| 3243 | func (self *BsnGentableDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3244 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3245 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 3246 | return err |
| 3247 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3248 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3249 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3250 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3251 | |
| 3252 | return nil |
| 3253 | } |
| 3254 | |
| 3255 | func DecodeBsnGentableDescStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnGentableDescStatsRequest, error) { |
| 3256 | _bsngentabledescstatsrequest := &BsnGentableDescStatsRequest{BsnStatsRequest: parent} |
| 3257 | return _bsngentabledescstatsrequest, nil |
| 3258 | } |
| 3259 | |
| 3260 | func NewBsnGentableDescStatsRequest() *BsnGentableDescStatsRequest { |
| 3261 | obj := &BsnGentableDescStatsRequest{ |
| 3262 | BsnStatsRequest: NewBsnStatsRequest(4), |
| 3263 | } |
| 3264 | return obj |
| 3265 | } |
| 3266 | |
| 3267 | type BsnGentableEntryAdd struct { |
| 3268 | *BsnHeader |
| 3269 | TableId uint16 |
| 3270 | KeyLength uint16 |
| 3271 | Checksum Checksum128 |
| 3272 | Key []IBsnTlv |
| 3273 | Value []IBsnTlv |
| 3274 | } |
| 3275 | |
| 3276 | type IBsnGentableEntryAdd interface { |
| 3277 | IBsnHeader |
| 3278 | GetTableId() uint16 |
| 3279 | GetKeyLength() uint16 |
| 3280 | GetChecksum() Checksum128 |
| 3281 | GetKey() []IBsnTlv |
| 3282 | GetValue() []IBsnTlv |
| 3283 | } |
| 3284 | |
| 3285 | func (self *BsnGentableEntryAdd) GetTableId() uint16 { |
| 3286 | return self.TableId |
| 3287 | } |
| 3288 | |
| 3289 | func (self *BsnGentableEntryAdd) SetTableId(v uint16) { |
| 3290 | self.TableId = v |
| 3291 | } |
| 3292 | |
| 3293 | func (self *BsnGentableEntryAdd) GetKeyLength() uint16 { |
| 3294 | return self.KeyLength |
| 3295 | } |
| 3296 | |
| 3297 | func (self *BsnGentableEntryAdd) SetKeyLength(v uint16) { |
| 3298 | self.KeyLength = v |
| 3299 | } |
| 3300 | |
| 3301 | func (self *BsnGentableEntryAdd) GetChecksum() Checksum128 { |
| 3302 | return self.Checksum |
| 3303 | } |
| 3304 | |
| 3305 | func (self *BsnGentableEntryAdd) SetChecksum(v Checksum128) { |
| 3306 | self.Checksum = v |
| 3307 | } |
| 3308 | |
| 3309 | func (self *BsnGentableEntryAdd) GetKey() []IBsnTlv { |
| 3310 | return self.Key |
| 3311 | } |
| 3312 | |
| 3313 | func (self *BsnGentableEntryAdd) SetKey(v []IBsnTlv) { |
| 3314 | self.Key = v |
| 3315 | } |
| 3316 | |
| 3317 | func (self *BsnGentableEntryAdd) GetValue() []IBsnTlv { |
| 3318 | return self.Value |
| 3319 | } |
| 3320 | |
| 3321 | func (self *BsnGentableEntryAdd) SetValue(v []IBsnTlv) { |
| 3322 | self.Value = v |
| 3323 | } |
| 3324 | |
| 3325 | func (self *BsnGentableEntryAdd) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3326 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3327 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 3328 | return err |
| 3329 | } |
| 3330 | |
| 3331 | encoder.PutUint16(uint16(self.TableId)) |
| 3332 | encoder.PutUint16(uint16(self.KeyLength)) |
| 3333 | self.Checksum.Serialize(encoder) |
| 3334 | for _, obj := range self.Key { |
| 3335 | if err := obj.Serialize(encoder); err != nil { |
| 3336 | return err |
| 3337 | } |
| 3338 | } |
| 3339 | for _, obj := range self.Value { |
| 3340 | if err := obj.Serialize(encoder); err != nil { |
| 3341 | return err |
| 3342 | } |
| 3343 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3344 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3345 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3346 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3347 | |
| 3348 | return nil |
| 3349 | } |
| 3350 | |
| 3351 | func DecodeBsnGentableEntryAdd(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGentableEntryAdd, error) { |
| 3352 | _bsngentableentryadd := &BsnGentableEntryAdd{BsnHeader: parent} |
| 3353 | if decoder.Length() < 20 { |
| 3354 | return nil, fmt.Errorf("BsnGentableEntryAdd packet too short: %d < 20", decoder.Length()) |
| 3355 | } |
| 3356 | _bsngentableentryadd.TableId = uint16(decoder.ReadUint16()) |
| 3357 | _bsngentableentryadd.KeyLength = uint16(decoder.ReadUint16()) |
| 3358 | _bsngentableentryadd.Checksum.Decode(decoder) |
| 3359 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3360 | end := decoder.Offset() + int(_bsngentableentryadd.KeyLength) |
| 3361 | for decoder.Offset() < end { |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3362 | item, err := DecodeBsnTlv(decoder) |
| 3363 | if err != nil { |
| 3364 | return nil, err |
| 3365 | } |
| 3366 | if item != nil { |
| 3367 | _bsngentableentryadd.Key = append(_bsngentableentryadd.Key, item) |
| 3368 | } |
| 3369 | } |
| 3370 | |
| 3371 | for decoder.Length() >= 4 { |
| 3372 | item, err := DecodeBsnTlv(decoder) |
| 3373 | if err != nil { |
| 3374 | return nil, err |
| 3375 | } |
| 3376 | if item != nil { |
| 3377 | _bsngentableentryadd.Value = append(_bsngentableentryadd.Value, item) |
| 3378 | } |
| 3379 | } |
| 3380 | return _bsngentableentryadd, nil |
| 3381 | } |
| 3382 | |
| 3383 | func NewBsnGentableEntryAdd() *BsnGentableEntryAdd { |
| 3384 | obj := &BsnGentableEntryAdd{ |
| 3385 | BsnHeader: NewBsnHeader(46), |
| 3386 | } |
| 3387 | return obj |
| 3388 | } |
| 3389 | |
| 3390 | type BsnGentableEntryDelete struct { |
| 3391 | *BsnHeader |
| 3392 | TableId uint16 |
| 3393 | Key []IBsnTlv |
| 3394 | } |
| 3395 | |
| 3396 | type IBsnGentableEntryDelete interface { |
| 3397 | IBsnHeader |
| 3398 | GetTableId() uint16 |
| 3399 | GetKey() []IBsnTlv |
| 3400 | } |
| 3401 | |
| 3402 | func (self *BsnGentableEntryDelete) GetTableId() uint16 { |
| 3403 | return self.TableId |
| 3404 | } |
| 3405 | |
| 3406 | func (self *BsnGentableEntryDelete) SetTableId(v uint16) { |
| 3407 | self.TableId = v |
| 3408 | } |
| 3409 | |
| 3410 | func (self *BsnGentableEntryDelete) GetKey() []IBsnTlv { |
| 3411 | return self.Key |
| 3412 | } |
| 3413 | |
| 3414 | func (self *BsnGentableEntryDelete) SetKey(v []IBsnTlv) { |
| 3415 | self.Key = v |
| 3416 | } |
| 3417 | |
| 3418 | func (self *BsnGentableEntryDelete) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3419 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3420 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 3421 | return err |
| 3422 | } |
| 3423 | |
| 3424 | encoder.PutUint16(uint16(self.TableId)) |
| 3425 | for _, obj := range self.Key { |
| 3426 | if err := obj.Serialize(encoder); err != nil { |
| 3427 | return err |
| 3428 | } |
| 3429 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3430 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3431 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3432 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3433 | |
| 3434 | return nil |
| 3435 | } |
| 3436 | |
| 3437 | func DecodeBsnGentableEntryDelete(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGentableEntryDelete, error) { |
| 3438 | _bsngentableentrydelete := &BsnGentableEntryDelete{BsnHeader: parent} |
| 3439 | if decoder.Length() < 2 { |
| 3440 | return nil, fmt.Errorf("BsnGentableEntryDelete packet too short: %d < 2", decoder.Length()) |
| 3441 | } |
| 3442 | _bsngentableentrydelete.TableId = uint16(decoder.ReadUint16()) |
| 3443 | |
| 3444 | for decoder.Length() >= 4 { |
| 3445 | item, err := DecodeBsnTlv(decoder) |
| 3446 | if err != nil { |
| 3447 | return nil, err |
| 3448 | } |
| 3449 | if item != nil { |
| 3450 | _bsngentableentrydelete.Key = append(_bsngentableentrydelete.Key, item) |
| 3451 | } |
| 3452 | } |
| 3453 | return _bsngentableentrydelete, nil |
| 3454 | } |
| 3455 | |
| 3456 | func NewBsnGentableEntryDelete() *BsnGentableEntryDelete { |
| 3457 | obj := &BsnGentableEntryDelete{ |
| 3458 | BsnHeader: NewBsnHeader(47), |
| 3459 | } |
| 3460 | return obj |
| 3461 | } |
| 3462 | |
| 3463 | type BsnGentableEntryDescStatsReply struct { |
| 3464 | *BsnStatsReply |
| 3465 | Entries []*BsnGentableEntryDescStatsEntry |
| 3466 | } |
| 3467 | |
| 3468 | type IBsnGentableEntryDescStatsReply interface { |
| 3469 | IBsnStatsReply |
| 3470 | GetEntries() []*BsnGentableEntryDescStatsEntry |
| 3471 | } |
| 3472 | |
| 3473 | func (self *BsnGentableEntryDescStatsReply) GetEntries() []*BsnGentableEntryDescStatsEntry { |
| 3474 | return self.Entries |
| 3475 | } |
| 3476 | |
| 3477 | func (self *BsnGentableEntryDescStatsReply) SetEntries(v []*BsnGentableEntryDescStatsEntry) { |
| 3478 | self.Entries = v |
| 3479 | } |
| 3480 | |
| 3481 | func (self *BsnGentableEntryDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3482 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3483 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 3484 | return err |
| 3485 | } |
| 3486 | |
| 3487 | for _, obj := range self.Entries { |
| 3488 | if err := obj.Serialize(encoder); err != nil { |
| 3489 | return err |
| 3490 | } |
| 3491 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3492 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3493 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3494 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3495 | |
| 3496 | return nil |
| 3497 | } |
| 3498 | |
| 3499 | func DecodeBsnGentableEntryDescStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnGentableEntryDescStatsReply, error) { |
| 3500 | _bsngentableentrydescstatsreply := &BsnGentableEntryDescStatsReply{BsnStatsReply: parent} |
| 3501 | |
| 3502 | for decoder.Length() >= 20 { |
| 3503 | item, err := DecodeBsnGentableEntryDescStatsEntry(decoder) |
| 3504 | if err != nil { |
| 3505 | return nil, err |
| 3506 | } |
| 3507 | if item != nil { |
| 3508 | _bsngentableentrydescstatsreply.Entries = append(_bsngentableentrydescstatsreply.Entries, item) |
| 3509 | } |
| 3510 | } |
| 3511 | return _bsngentableentrydescstatsreply, nil |
| 3512 | } |
| 3513 | |
| 3514 | func NewBsnGentableEntryDescStatsReply() *BsnGentableEntryDescStatsReply { |
| 3515 | obj := &BsnGentableEntryDescStatsReply{ |
| 3516 | BsnStatsReply: NewBsnStatsReply(2), |
| 3517 | } |
| 3518 | return obj |
| 3519 | } |
| 3520 | |
| 3521 | type BsnGentableEntryDescStatsRequest struct { |
| 3522 | *BsnStatsRequest |
| 3523 | TableId uint16 |
| 3524 | Checksum Checksum128 |
| 3525 | ChecksumMask Checksum128 |
| 3526 | } |
| 3527 | |
| 3528 | type IBsnGentableEntryDescStatsRequest interface { |
| 3529 | IBsnStatsRequest |
| 3530 | GetTableId() uint16 |
| 3531 | GetChecksum() Checksum128 |
| 3532 | GetChecksumMask() Checksum128 |
| 3533 | } |
| 3534 | |
| 3535 | func (self *BsnGentableEntryDescStatsRequest) GetTableId() uint16 { |
| 3536 | return self.TableId |
| 3537 | } |
| 3538 | |
| 3539 | func (self *BsnGentableEntryDescStatsRequest) SetTableId(v uint16) { |
| 3540 | self.TableId = v |
| 3541 | } |
| 3542 | |
| 3543 | func (self *BsnGentableEntryDescStatsRequest) GetChecksum() Checksum128 { |
| 3544 | return self.Checksum |
| 3545 | } |
| 3546 | |
| 3547 | func (self *BsnGentableEntryDescStatsRequest) SetChecksum(v Checksum128) { |
| 3548 | self.Checksum = v |
| 3549 | } |
| 3550 | |
| 3551 | func (self *BsnGentableEntryDescStatsRequest) GetChecksumMask() Checksum128 { |
| 3552 | return self.ChecksumMask |
| 3553 | } |
| 3554 | |
| 3555 | func (self *BsnGentableEntryDescStatsRequest) SetChecksumMask(v Checksum128) { |
| 3556 | self.ChecksumMask = v |
| 3557 | } |
| 3558 | |
| 3559 | func (self *BsnGentableEntryDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3560 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3561 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 3562 | return err |
| 3563 | } |
| 3564 | |
| 3565 | encoder.PutUint16(uint16(self.TableId)) |
| 3566 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 3567 | self.Checksum.Serialize(encoder) |
| 3568 | self.ChecksumMask.Serialize(encoder) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3569 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3570 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3571 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3572 | |
| 3573 | return nil |
| 3574 | } |
| 3575 | |
| 3576 | func DecodeBsnGentableEntryDescStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnGentableEntryDescStatsRequest, error) { |
| 3577 | _bsngentableentrydescstatsrequest := &BsnGentableEntryDescStatsRequest{BsnStatsRequest: parent} |
| 3578 | if decoder.Length() < 36 { |
| 3579 | return nil, fmt.Errorf("BsnGentableEntryDescStatsRequest packet too short: %d < 36", decoder.Length()) |
| 3580 | } |
| 3581 | _bsngentableentrydescstatsrequest.TableId = uint16(decoder.ReadUint16()) |
| 3582 | decoder.Skip(2) |
| 3583 | _bsngentableentrydescstatsrequest.Checksum.Decode(decoder) |
| 3584 | _bsngentableentrydescstatsrequest.ChecksumMask.Decode(decoder) |
| 3585 | return _bsngentableentrydescstatsrequest, nil |
| 3586 | } |
| 3587 | |
| 3588 | func NewBsnGentableEntryDescStatsRequest() *BsnGentableEntryDescStatsRequest { |
| 3589 | obj := &BsnGentableEntryDescStatsRequest{ |
| 3590 | BsnStatsRequest: NewBsnStatsRequest(2), |
| 3591 | } |
| 3592 | return obj |
| 3593 | } |
| 3594 | |
| 3595 | type BsnGentableEntryStatsReply struct { |
| 3596 | *BsnStatsReply |
| 3597 | Entries []*BsnGentableEntryStatsEntry |
| 3598 | } |
| 3599 | |
| 3600 | type IBsnGentableEntryStatsReply interface { |
| 3601 | IBsnStatsReply |
| 3602 | GetEntries() []*BsnGentableEntryStatsEntry |
| 3603 | } |
| 3604 | |
| 3605 | func (self *BsnGentableEntryStatsReply) GetEntries() []*BsnGentableEntryStatsEntry { |
| 3606 | return self.Entries |
| 3607 | } |
| 3608 | |
| 3609 | func (self *BsnGentableEntryStatsReply) SetEntries(v []*BsnGentableEntryStatsEntry) { |
| 3610 | self.Entries = v |
| 3611 | } |
| 3612 | |
| 3613 | func (self *BsnGentableEntryStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3614 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3615 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 3616 | return err |
| 3617 | } |
| 3618 | |
| 3619 | for _, obj := range self.Entries { |
| 3620 | if err := obj.Serialize(encoder); err != nil { |
| 3621 | return err |
| 3622 | } |
| 3623 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3624 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3625 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3626 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3627 | |
| 3628 | return nil |
| 3629 | } |
| 3630 | |
| 3631 | func DecodeBsnGentableEntryStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnGentableEntryStatsReply, error) { |
| 3632 | _bsngentableentrystatsreply := &BsnGentableEntryStatsReply{BsnStatsReply: parent} |
| 3633 | |
| 3634 | for decoder.Length() >= 4 { |
| 3635 | item, err := DecodeBsnGentableEntryStatsEntry(decoder) |
| 3636 | if err != nil { |
| 3637 | return nil, err |
| 3638 | } |
| 3639 | if item != nil { |
| 3640 | _bsngentableentrystatsreply.Entries = append(_bsngentableentrystatsreply.Entries, item) |
| 3641 | } |
| 3642 | } |
| 3643 | return _bsngentableentrystatsreply, nil |
| 3644 | } |
| 3645 | |
| 3646 | func NewBsnGentableEntryStatsReply() *BsnGentableEntryStatsReply { |
| 3647 | obj := &BsnGentableEntryStatsReply{ |
| 3648 | BsnStatsReply: NewBsnStatsReply(3), |
| 3649 | } |
| 3650 | return obj |
| 3651 | } |
| 3652 | |
| 3653 | type BsnGentableEntryStatsRequest struct { |
| 3654 | *BsnStatsRequest |
| 3655 | TableId uint16 |
| 3656 | Checksum Checksum128 |
| 3657 | ChecksumMask Checksum128 |
| 3658 | } |
| 3659 | |
| 3660 | type IBsnGentableEntryStatsRequest interface { |
| 3661 | IBsnStatsRequest |
| 3662 | GetTableId() uint16 |
| 3663 | GetChecksum() Checksum128 |
| 3664 | GetChecksumMask() Checksum128 |
| 3665 | } |
| 3666 | |
| 3667 | func (self *BsnGentableEntryStatsRequest) GetTableId() uint16 { |
| 3668 | return self.TableId |
| 3669 | } |
| 3670 | |
| 3671 | func (self *BsnGentableEntryStatsRequest) SetTableId(v uint16) { |
| 3672 | self.TableId = v |
| 3673 | } |
| 3674 | |
| 3675 | func (self *BsnGentableEntryStatsRequest) GetChecksum() Checksum128 { |
| 3676 | return self.Checksum |
| 3677 | } |
| 3678 | |
| 3679 | func (self *BsnGentableEntryStatsRequest) SetChecksum(v Checksum128) { |
| 3680 | self.Checksum = v |
| 3681 | } |
| 3682 | |
| 3683 | func (self *BsnGentableEntryStatsRequest) GetChecksumMask() Checksum128 { |
| 3684 | return self.ChecksumMask |
| 3685 | } |
| 3686 | |
| 3687 | func (self *BsnGentableEntryStatsRequest) SetChecksumMask(v Checksum128) { |
| 3688 | self.ChecksumMask = v |
| 3689 | } |
| 3690 | |
| 3691 | func (self *BsnGentableEntryStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3692 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3693 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 3694 | return err |
| 3695 | } |
| 3696 | |
| 3697 | encoder.PutUint16(uint16(self.TableId)) |
| 3698 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 3699 | self.Checksum.Serialize(encoder) |
| 3700 | self.ChecksumMask.Serialize(encoder) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3701 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3702 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3703 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3704 | |
| 3705 | return nil |
| 3706 | } |
| 3707 | |
| 3708 | func DecodeBsnGentableEntryStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnGentableEntryStatsRequest, error) { |
| 3709 | _bsngentableentrystatsrequest := &BsnGentableEntryStatsRequest{BsnStatsRequest: parent} |
| 3710 | if decoder.Length() < 36 { |
| 3711 | return nil, fmt.Errorf("BsnGentableEntryStatsRequest packet too short: %d < 36", decoder.Length()) |
| 3712 | } |
| 3713 | _bsngentableentrystatsrequest.TableId = uint16(decoder.ReadUint16()) |
| 3714 | decoder.Skip(2) |
| 3715 | _bsngentableentrystatsrequest.Checksum.Decode(decoder) |
| 3716 | _bsngentableentrystatsrequest.ChecksumMask.Decode(decoder) |
| 3717 | return _bsngentableentrystatsrequest, nil |
| 3718 | } |
| 3719 | |
| 3720 | func NewBsnGentableEntryStatsRequest() *BsnGentableEntryStatsRequest { |
| 3721 | obj := &BsnGentableEntryStatsRequest{ |
| 3722 | BsnStatsRequest: NewBsnStatsRequest(3), |
| 3723 | } |
| 3724 | return obj |
| 3725 | } |
| 3726 | |
| 3727 | type BsnGentableError struct { |
| 3728 | *BsnBaseError |
| 3729 | ErrorCode BsnGentableErrorCode |
| 3730 | TableId uint16 |
| 3731 | } |
| 3732 | |
| 3733 | type IBsnGentableError interface { |
| 3734 | IBsnBaseError |
| 3735 | GetErrorCode() BsnGentableErrorCode |
| 3736 | GetTableId() uint16 |
| 3737 | } |
| 3738 | |
| 3739 | func (self *BsnGentableError) GetErrorCode() BsnGentableErrorCode { |
| 3740 | return self.ErrorCode |
| 3741 | } |
| 3742 | |
| 3743 | func (self *BsnGentableError) SetErrorCode(v BsnGentableErrorCode) { |
| 3744 | self.ErrorCode = v |
| 3745 | } |
| 3746 | |
| 3747 | func (self *BsnGentableError) GetTableId() uint16 { |
| 3748 | return self.TableId |
| 3749 | } |
| 3750 | |
| 3751 | func (self *BsnGentableError) SetTableId(v uint16) { |
| 3752 | self.TableId = v |
| 3753 | } |
| 3754 | |
| 3755 | func (self *BsnGentableError) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3756 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3757 | if err := self.BsnBaseError.Serialize(encoder); err != nil { |
| 3758 | return err |
| 3759 | } |
| 3760 | |
| 3761 | encoder.PutUint16(uint16(self.ErrorCode)) |
| 3762 | encoder.PutUint16(uint16(self.TableId)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3763 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3764 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3765 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3766 | |
| 3767 | return nil |
| 3768 | } |
| 3769 | |
| 3770 | func DecodeBsnGentableError(parent *BsnBaseError, decoder *goloxi.Decoder) (*BsnGentableError, error) { |
| 3771 | _bsngentableerror := &BsnGentableError{BsnBaseError: parent} |
| 3772 | if decoder.Length() < 260 { |
| 3773 | return nil, fmt.Errorf("BsnGentableError packet too short: %d < 260", decoder.Length()) |
| 3774 | } |
| 3775 | _bsngentableerror.ErrorCode = BsnGentableErrorCode(decoder.ReadUint16()) |
| 3776 | _bsngentableerror.TableId = uint16(decoder.ReadUint16()) |
| 3777 | return _bsngentableerror, nil |
| 3778 | } |
| 3779 | |
| 3780 | func NewBsnGentableError() *BsnGentableError { |
| 3781 | obj := &BsnGentableError{ |
| 3782 | BsnBaseError: NewBsnBaseError(2), |
| 3783 | } |
| 3784 | return obj |
| 3785 | } |
| 3786 | |
| 3787 | type BsnGentableSetBucketsSize struct { |
| 3788 | *BsnHeader |
| 3789 | TableId uint16 |
| 3790 | BucketsSize uint32 |
| 3791 | } |
| 3792 | |
| 3793 | type IBsnGentableSetBucketsSize interface { |
| 3794 | IBsnHeader |
| 3795 | GetTableId() uint16 |
| 3796 | GetBucketsSize() uint32 |
| 3797 | } |
| 3798 | |
| 3799 | func (self *BsnGentableSetBucketsSize) GetTableId() uint16 { |
| 3800 | return self.TableId |
| 3801 | } |
| 3802 | |
| 3803 | func (self *BsnGentableSetBucketsSize) SetTableId(v uint16) { |
| 3804 | self.TableId = v |
| 3805 | } |
| 3806 | |
| 3807 | func (self *BsnGentableSetBucketsSize) GetBucketsSize() uint32 { |
| 3808 | return self.BucketsSize |
| 3809 | } |
| 3810 | |
| 3811 | func (self *BsnGentableSetBucketsSize) SetBucketsSize(v uint32) { |
| 3812 | self.BucketsSize = v |
| 3813 | } |
| 3814 | |
| 3815 | func (self *BsnGentableSetBucketsSize) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3816 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3817 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 3818 | return err |
| 3819 | } |
| 3820 | |
| 3821 | encoder.PutUint16(uint16(self.TableId)) |
| 3822 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 3823 | encoder.PutUint32(uint32(self.BucketsSize)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3824 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3825 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3826 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3827 | |
| 3828 | return nil |
| 3829 | } |
| 3830 | |
| 3831 | func DecodeBsnGentableSetBucketsSize(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGentableSetBucketsSize, error) { |
| 3832 | _bsngentablesetbucketssize := &BsnGentableSetBucketsSize{BsnHeader: parent} |
| 3833 | if decoder.Length() < 8 { |
| 3834 | return nil, fmt.Errorf("BsnGentableSetBucketsSize packet too short: %d < 8", decoder.Length()) |
| 3835 | } |
| 3836 | _bsngentablesetbucketssize.TableId = uint16(decoder.ReadUint16()) |
| 3837 | decoder.Skip(2) |
| 3838 | _bsngentablesetbucketssize.BucketsSize = uint32(decoder.ReadUint32()) |
| 3839 | return _bsngentablesetbucketssize, nil |
| 3840 | } |
| 3841 | |
| 3842 | func NewBsnGentableSetBucketsSize() *BsnGentableSetBucketsSize { |
| 3843 | obj := &BsnGentableSetBucketsSize{ |
| 3844 | BsnHeader: NewBsnHeader(50), |
| 3845 | } |
| 3846 | return obj |
| 3847 | } |
| 3848 | |
| 3849 | type BsnGentableStatsReply struct { |
| 3850 | *BsnStatsReply |
| 3851 | Entries []*BsnGentableStatsEntry |
| 3852 | } |
| 3853 | |
| 3854 | type IBsnGentableStatsReply interface { |
| 3855 | IBsnStatsReply |
| 3856 | GetEntries() []*BsnGentableStatsEntry |
| 3857 | } |
| 3858 | |
| 3859 | func (self *BsnGentableStatsReply) GetEntries() []*BsnGentableStatsEntry { |
| 3860 | return self.Entries |
| 3861 | } |
| 3862 | |
| 3863 | func (self *BsnGentableStatsReply) SetEntries(v []*BsnGentableStatsEntry) { |
| 3864 | self.Entries = v |
| 3865 | } |
| 3866 | |
| 3867 | func (self *BsnGentableStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3868 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3869 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 3870 | return err |
| 3871 | } |
| 3872 | |
| 3873 | for _, obj := range self.Entries { |
| 3874 | if err := obj.Serialize(encoder); err != nil { |
| 3875 | return err |
| 3876 | } |
| 3877 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3878 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3879 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3880 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3881 | |
| 3882 | return nil |
| 3883 | } |
| 3884 | |
| 3885 | func DecodeBsnGentableStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnGentableStatsReply, error) { |
| 3886 | _bsngentablestatsreply := &BsnGentableStatsReply{BsnStatsReply: parent} |
| 3887 | |
| 3888 | for decoder.Length() >= 24 { |
| 3889 | item, err := DecodeBsnGentableStatsEntry(decoder) |
| 3890 | if err != nil { |
| 3891 | return nil, err |
| 3892 | } |
| 3893 | if item != nil { |
| 3894 | _bsngentablestatsreply.Entries = append(_bsngentablestatsreply.Entries, item) |
| 3895 | } |
| 3896 | } |
| 3897 | return _bsngentablestatsreply, nil |
| 3898 | } |
| 3899 | |
| 3900 | func NewBsnGentableStatsReply() *BsnGentableStatsReply { |
| 3901 | obj := &BsnGentableStatsReply{ |
| 3902 | BsnStatsReply: NewBsnStatsReply(7), |
| 3903 | } |
| 3904 | return obj |
| 3905 | } |
| 3906 | |
| 3907 | type BsnGentableStatsRequest struct { |
| 3908 | *BsnStatsRequest |
| 3909 | } |
| 3910 | |
| 3911 | type IBsnGentableStatsRequest interface { |
| 3912 | IBsnStatsRequest |
| 3913 | } |
| 3914 | |
| 3915 | func (self *BsnGentableStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3916 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3917 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 3918 | return err |
| 3919 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3920 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3921 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3922 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3923 | |
| 3924 | return nil |
| 3925 | } |
| 3926 | |
| 3927 | func DecodeBsnGentableStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnGentableStatsRequest, error) { |
| 3928 | _bsngentablestatsrequest := &BsnGentableStatsRequest{BsnStatsRequest: parent} |
| 3929 | return _bsngentablestatsrequest, nil |
| 3930 | } |
| 3931 | |
| 3932 | func NewBsnGentableStatsRequest() *BsnGentableStatsRequest { |
| 3933 | obj := &BsnGentableStatsRequest{ |
| 3934 | BsnStatsRequest: NewBsnStatsRequest(7), |
| 3935 | } |
| 3936 | return obj |
| 3937 | } |
| 3938 | |
| 3939 | type BsnGetInterfacesReply struct { |
| 3940 | *BsnHeader |
| 3941 | Interfaces []*BsnInterface |
| 3942 | } |
| 3943 | |
| 3944 | type IBsnGetInterfacesReply interface { |
| 3945 | IBsnHeader |
| 3946 | GetInterfaces() []*BsnInterface |
| 3947 | } |
| 3948 | |
| 3949 | func (self *BsnGetInterfacesReply) GetInterfaces() []*BsnInterface { |
| 3950 | return self.Interfaces |
| 3951 | } |
| 3952 | |
| 3953 | func (self *BsnGetInterfacesReply) SetInterfaces(v []*BsnInterface) { |
| 3954 | self.Interfaces = v |
| 3955 | } |
| 3956 | |
| 3957 | func (self *BsnGetInterfacesReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3958 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3959 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 3960 | return err |
| 3961 | } |
| 3962 | |
| 3963 | for _, obj := range self.Interfaces { |
| 3964 | if err := obj.Serialize(encoder); err != nil { |
| 3965 | return err |
| 3966 | } |
| 3967 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3968 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3969 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 3970 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 3971 | |
| 3972 | return nil |
| 3973 | } |
| 3974 | |
| 3975 | func DecodeBsnGetInterfacesReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetInterfacesReply, error) { |
| 3976 | _bsngetinterfacesreply := &BsnGetInterfacesReply{BsnHeader: parent} |
| 3977 | |
| 3978 | for decoder.Length() >= 32 { |
| 3979 | item, err := DecodeBsnInterface(decoder) |
| 3980 | if err != nil { |
| 3981 | return nil, err |
| 3982 | } |
| 3983 | if item != nil { |
| 3984 | _bsngetinterfacesreply.Interfaces = append(_bsngetinterfacesreply.Interfaces, item) |
| 3985 | } |
| 3986 | } |
| 3987 | return _bsngetinterfacesreply, nil |
| 3988 | } |
| 3989 | |
| 3990 | func NewBsnGetInterfacesReply() *BsnGetInterfacesReply { |
| 3991 | obj := &BsnGetInterfacesReply{ |
| 3992 | BsnHeader: NewBsnHeader(10), |
| 3993 | } |
| 3994 | return obj |
| 3995 | } |
| 3996 | |
| 3997 | type BsnGetInterfacesRequest struct { |
| 3998 | *BsnHeader |
| 3999 | } |
| 4000 | |
| 4001 | type IBsnGetInterfacesRequest interface { |
| 4002 | IBsnHeader |
| 4003 | } |
| 4004 | |
| 4005 | func (self *BsnGetInterfacesRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4006 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4007 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4008 | return err |
| 4009 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4010 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4011 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4012 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4013 | |
| 4014 | return nil |
| 4015 | } |
| 4016 | |
| 4017 | func DecodeBsnGetInterfacesRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetInterfacesRequest, error) { |
| 4018 | _bsngetinterfacesrequest := &BsnGetInterfacesRequest{BsnHeader: parent} |
| 4019 | return _bsngetinterfacesrequest, nil |
| 4020 | } |
| 4021 | |
| 4022 | func NewBsnGetInterfacesRequest() *BsnGetInterfacesRequest { |
| 4023 | obj := &BsnGetInterfacesRequest{ |
| 4024 | BsnHeader: NewBsnHeader(9), |
| 4025 | } |
| 4026 | return obj |
| 4027 | } |
| 4028 | |
| 4029 | type BsnGetMirroringReply struct { |
| 4030 | *BsnHeader |
| 4031 | ReportMirrorPorts uint8 |
| 4032 | } |
| 4033 | |
| 4034 | type IBsnGetMirroringReply interface { |
| 4035 | IBsnHeader |
| 4036 | GetReportMirrorPorts() uint8 |
| 4037 | } |
| 4038 | |
| 4039 | func (self *BsnGetMirroringReply) GetReportMirrorPorts() uint8 { |
| 4040 | return self.ReportMirrorPorts |
| 4041 | } |
| 4042 | |
| 4043 | func (self *BsnGetMirroringReply) SetReportMirrorPorts(v uint8) { |
| 4044 | self.ReportMirrorPorts = v |
| 4045 | } |
| 4046 | |
| 4047 | func (self *BsnGetMirroringReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4048 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4049 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4050 | return err |
| 4051 | } |
| 4052 | |
| 4053 | encoder.PutUint8(uint8(self.ReportMirrorPorts)) |
| 4054 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4055 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4056 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4057 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4058 | |
| 4059 | return nil |
| 4060 | } |
| 4061 | |
| 4062 | func DecodeBsnGetMirroringReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetMirroringReply, error) { |
| 4063 | _bsngetmirroringreply := &BsnGetMirroringReply{BsnHeader: parent} |
| 4064 | if decoder.Length() < 4 { |
| 4065 | return nil, fmt.Errorf("BsnGetMirroringReply packet too short: %d < 4", decoder.Length()) |
| 4066 | } |
| 4067 | _bsngetmirroringreply.ReportMirrorPorts = uint8(decoder.ReadByte()) |
| 4068 | decoder.Skip(3) |
| 4069 | return _bsngetmirroringreply, nil |
| 4070 | } |
| 4071 | |
| 4072 | func NewBsnGetMirroringReply() *BsnGetMirroringReply { |
| 4073 | obj := &BsnGetMirroringReply{ |
| 4074 | BsnHeader: NewBsnHeader(5), |
| 4075 | } |
| 4076 | return obj |
| 4077 | } |
| 4078 | |
| 4079 | type BsnGetMirroringRequest struct { |
| 4080 | *BsnHeader |
| 4081 | ReportMirrorPorts uint8 |
| 4082 | } |
| 4083 | |
| 4084 | type IBsnGetMirroringRequest interface { |
| 4085 | IBsnHeader |
| 4086 | GetReportMirrorPorts() uint8 |
| 4087 | } |
| 4088 | |
| 4089 | func (self *BsnGetMirroringRequest) GetReportMirrorPorts() uint8 { |
| 4090 | return self.ReportMirrorPorts |
| 4091 | } |
| 4092 | |
| 4093 | func (self *BsnGetMirroringRequest) SetReportMirrorPorts(v uint8) { |
| 4094 | self.ReportMirrorPorts = v |
| 4095 | } |
| 4096 | |
| 4097 | func (self *BsnGetMirroringRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4098 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4099 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4100 | return err |
| 4101 | } |
| 4102 | |
| 4103 | encoder.PutUint8(uint8(self.ReportMirrorPorts)) |
| 4104 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4105 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4106 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4107 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4108 | |
| 4109 | return nil |
| 4110 | } |
| 4111 | |
| 4112 | func DecodeBsnGetMirroringRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetMirroringRequest, error) { |
| 4113 | _bsngetmirroringrequest := &BsnGetMirroringRequest{BsnHeader: parent} |
| 4114 | if decoder.Length() < 4 { |
| 4115 | return nil, fmt.Errorf("BsnGetMirroringRequest packet too short: %d < 4", decoder.Length()) |
| 4116 | } |
| 4117 | _bsngetmirroringrequest.ReportMirrorPorts = uint8(decoder.ReadByte()) |
| 4118 | decoder.Skip(3) |
| 4119 | return _bsngetmirroringrequest, nil |
| 4120 | } |
| 4121 | |
| 4122 | func NewBsnGetMirroringRequest() *BsnGetMirroringRequest { |
| 4123 | obj := &BsnGetMirroringRequest{ |
| 4124 | BsnHeader: NewBsnHeader(4), |
| 4125 | } |
| 4126 | return obj |
| 4127 | } |
| 4128 | |
| 4129 | type BsnGetSwitchPipelineReply struct { |
| 4130 | *BsnHeader |
| 4131 | Pipeline string |
| 4132 | } |
| 4133 | |
| 4134 | type IBsnGetSwitchPipelineReply interface { |
| 4135 | IBsnHeader |
| 4136 | GetPipeline() string |
| 4137 | } |
| 4138 | |
| 4139 | func (self *BsnGetSwitchPipelineReply) GetPipeline() string { |
| 4140 | return self.Pipeline |
| 4141 | } |
| 4142 | |
| 4143 | func (self *BsnGetSwitchPipelineReply) SetPipeline(v string) { |
| 4144 | self.Pipeline = v |
| 4145 | } |
| 4146 | |
| 4147 | func (self *BsnGetSwitchPipelineReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4148 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4149 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4150 | return err |
| 4151 | } |
| 4152 | |
| 4153 | encoder.Write([]byte(self.Pipeline)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4154 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4155 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4156 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4157 | |
| 4158 | return nil |
| 4159 | } |
| 4160 | |
| 4161 | func DecodeBsnGetSwitchPipelineReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetSwitchPipelineReply, error) { |
| 4162 | _bsngetswitchpipelinereply := &BsnGetSwitchPipelineReply{BsnHeader: parent} |
| 4163 | if decoder.Length() < 256 { |
| 4164 | return nil, fmt.Errorf("BsnGetSwitchPipelineReply packet too short: %d < 256", decoder.Length()) |
| 4165 | } |
| 4166 | _bsngetswitchpipelinereply.Pipeline = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 4167 | return _bsngetswitchpipelinereply, nil |
| 4168 | } |
| 4169 | |
| 4170 | func NewBsnGetSwitchPipelineReply() *BsnGetSwitchPipelineReply { |
| 4171 | obj := &BsnGetSwitchPipelineReply{ |
| 4172 | BsnHeader: NewBsnHeader(52), |
| 4173 | } |
| 4174 | return obj |
| 4175 | } |
| 4176 | |
| 4177 | type BsnGetSwitchPipelineRequest struct { |
| 4178 | *BsnHeader |
| 4179 | } |
| 4180 | |
| 4181 | type IBsnGetSwitchPipelineRequest interface { |
| 4182 | IBsnHeader |
| 4183 | } |
| 4184 | |
| 4185 | func (self *BsnGetSwitchPipelineRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4186 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4187 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4188 | return err |
| 4189 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4190 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4191 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4192 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4193 | |
| 4194 | return nil |
| 4195 | } |
| 4196 | |
| 4197 | func DecodeBsnGetSwitchPipelineRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetSwitchPipelineRequest, error) { |
| 4198 | _bsngetswitchpipelinerequest := &BsnGetSwitchPipelineRequest{BsnHeader: parent} |
| 4199 | return _bsngetswitchpipelinerequest, nil |
| 4200 | } |
| 4201 | |
| 4202 | func NewBsnGetSwitchPipelineRequest() *BsnGetSwitchPipelineRequest { |
| 4203 | obj := &BsnGetSwitchPipelineRequest{ |
| 4204 | BsnHeader: NewBsnHeader(51), |
| 4205 | } |
| 4206 | return obj |
| 4207 | } |
| 4208 | |
| 4209 | type BsnImageDescStatsReply struct { |
| 4210 | *BsnStatsReply |
| 4211 | ImageChecksum string |
| 4212 | StartupConfigChecksum string |
| 4213 | } |
| 4214 | |
| 4215 | type IBsnImageDescStatsReply interface { |
| 4216 | IBsnStatsReply |
| 4217 | GetImageChecksum() string |
| 4218 | GetStartupConfigChecksum() string |
| 4219 | } |
| 4220 | |
| 4221 | func (self *BsnImageDescStatsReply) GetImageChecksum() string { |
| 4222 | return self.ImageChecksum |
| 4223 | } |
| 4224 | |
| 4225 | func (self *BsnImageDescStatsReply) SetImageChecksum(v string) { |
| 4226 | self.ImageChecksum = v |
| 4227 | } |
| 4228 | |
| 4229 | func (self *BsnImageDescStatsReply) GetStartupConfigChecksum() string { |
| 4230 | return self.StartupConfigChecksum |
| 4231 | } |
| 4232 | |
| 4233 | func (self *BsnImageDescStatsReply) SetStartupConfigChecksum(v string) { |
| 4234 | self.StartupConfigChecksum = v |
| 4235 | } |
| 4236 | |
| 4237 | func (self *BsnImageDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4238 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4239 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 4240 | return err |
| 4241 | } |
| 4242 | |
| 4243 | encoder.Write([]byte(self.ImageChecksum)) |
| 4244 | encoder.Write([]byte(self.StartupConfigChecksum)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4245 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4246 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4247 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4248 | |
| 4249 | return nil |
| 4250 | } |
| 4251 | |
| 4252 | func DecodeBsnImageDescStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnImageDescStatsReply, error) { |
| 4253 | _bsnimagedescstatsreply := &BsnImageDescStatsReply{BsnStatsReply: parent} |
| 4254 | if decoder.Length() < 512 { |
| 4255 | return nil, fmt.Errorf("BsnImageDescStatsReply packet too short: %d < 512", decoder.Length()) |
| 4256 | } |
| 4257 | _bsnimagedescstatsreply.ImageChecksum = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 4258 | _bsnimagedescstatsreply.StartupConfigChecksum = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 4259 | return _bsnimagedescstatsreply, nil |
| 4260 | } |
| 4261 | |
| 4262 | func NewBsnImageDescStatsReply() *BsnImageDescStatsReply { |
| 4263 | obj := &BsnImageDescStatsReply{ |
| 4264 | BsnStatsReply: NewBsnStatsReply(14), |
| 4265 | } |
| 4266 | return obj |
| 4267 | } |
| 4268 | |
| 4269 | type BsnImageDescStatsRequest struct { |
| 4270 | *BsnStatsRequest |
| 4271 | } |
| 4272 | |
| 4273 | type IBsnImageDescStatsRequest interface { |
| 4274 | IBsnStatsRequest |
| 4275 | } |
| 4276 | |
| 4277 | func (self *BsnImageDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4278 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4279 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 4280 | return err |
| 4281 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4282 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4283 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4284 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4285 | |
| 4286 | return nil |
| 4287 | } |
| 4288 | |
| 4289 | func DecodeBsnImageDescStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnImageDescStatsRequest, error) { |
| 4290 | _bsnimagedescstatsrequest := &BsnImageDescStatsRequest{BsnStatsRequest: parent} |
| 4291 | return _bsnimagedescstatsrequest, nil |
| 4292 | } |
| 4293 | |
| 4294 | func NewBsnImageDescStatsRequest() *BsnImageDescStatsRequest { |
| 4295 | obj := &BsnImageDescStatsRequest{ |
| 4296 | BsnStatsRequest: NewBsnStatsRequest(14), |
| 4297 | } |
| 4298 | return obj |
| 4299 | } |
| 4300 | |
| 4301 | type BsnLacpConvergenceNotif struct { |
| 4302 | *BsnHeader |
| 4303 | ConvergenceStatus uint8 |
| 4304 | PortNo Port |
| 4305 | ActorSysPriority uint16 |
| 4306 | ActorSysMac net.HardwareAddr |
| 4307 | ActorPortPriority uint16 |
| 4308 | ActorPortNum uint16 |
| 4309 | ActorKey uint16 |
| 4310 | PartnerSysPriority uint16 |
| 4311 | PartnerSysMac net.HardwareAddr |
| 4312 | PartnerPortPriority uint16 |
| 4313 | PartnerPortNum uint16 |
| 4314 | PartnerKey uint16 |
| 4315 | } |
| 4316 | |
| 4317 | type IBsnLacpConvergenceNotif interface { |
| 4318 | IBsnHeader |
| 4319 | GetConvergenceStatus() uint8 |
| 4320 | GetPortNo() Port |
| 4321 | GetActorSysPriority() uint16 |
| 4322 | GetActorSysMac() net.HardwareAddr |
| 4323 | GetActorPortPriority() uint16 |
| 4324 | GetActorPortNum() uint16 |
| 4325 | GetActorKey() uint16 |
| 4326 | GetPartnerSysPriority() uint16 |
| 4327 | GetPartnerSysMac() net.HardwareAddr |
| 4328 | GetPartnerPortPriority() uint16 |
| 4329 | GetPartnerPortNum() uint16 |
| 4330 | GetPartnerKey() uint16 |
| 4331 | } |
| 4332 | |
| 4333 | func (self *BsnLacpConvergenceNotif) GetConvergenceStatus() uint8 { |
| 4334 | return self.ConvergenceStatus |
| 4335 | } |
| 4336 | |
| 4337 | func (self *BsnLacpConvergenceNotif) SetConvergenceStatus(v uint8) { |
| 4338 | self.ConvergenceStatus = v |
| 4339 | } |
| 4340 | |
| 4341 | func (self *BsnLacpConvergenceNotif) GetPortNo() Port { |
| 4342 | return self.PortNo |
| 4343 | } |
| 4344 | |
| 4345 | func (self *BsnLacpConvergenceNotif) SetPortNo(v Port) { |
| 4346 | self.PortNo = v |
| 4347 | } |
| 4348 | |
| 4349 | func (self *BsnLacpConvergenceNotif) GetActorSysPriority() uint16 { |
| 4350 | return self.ActorSysPriority |
| 4351 | } |
| 4352 | |
| 4353 | func (self *BsnLacpConvergenceNotif) SetActorSysPriority(v uint16) { |
| 4354 | self.ActorSysPriority = v |
| 4355 | } |
| 4356 | |
| 4357 | func (self *BsnLacpConvergenceNotif) GetActorSysMac() net.HardwareAddr { |
| 4358 | return self.ActorSysMac |
| 4359 | } |
| 4360 | |
| 4361 | func (self *BsnLacpConvergenceNotif) SetActorSysMac(v net.HardwareAddr) { |
| 4362 | self.ActorSysMac = v |
| 4363 | } |
| 4364 | |
| 4365 | func (self *BsnLacpConvergenceNotif) GetActorPortPriority() uint16 { |
| 4366 | return self.ActorPortPriority |
| 4367 | } |
| 4368 | |
| 4369 | func (self *BsnLacpConvergenceNotif) SetActorPortPriority(v uint16) { |
| 4370 | self.ActorPortPriority = v |
| 4371 | } |
| 4372 | |
| 4373 | func (self *BsnLacpConvergenceNotif) GetActorPortNum() uint16 { |
| 4374 | return self.ActorPortNum |
| 4375 | } |
| 4376 | |
| 4377 | func (self *BsnLacpConvergenceNotif) SetActorPortNum(v uint16) { |
| 4378 | self.ActorPortNum = v |
| 4379 | } |
| 4380 | |
| 4381 | func (self *BsnLacpConvergenceNotif) GetActorKey() uint16 { |
| 4382 | return self.ActorKey |
| 4383 | } |
| 4384 | |
| 4385 | func (self *BsnLacpConvergenceNotif) SetActorKey(v uint16) { |
| 4386 | self.ActorKey = v |
| 4387 | } |
| 4388 | |
| 4389 | func (self *BsnLacpConvergenceNotif) GetPartnerSysPriority() uint16 { |
| 4390 | return self.PartnerSysPriority |
| 4391 | } |
| 4392 | |
| 4393 | func (self *BsnLacpConvergenceNotif) SetPartnerSysPriority(v uint16) { |
| 4394 | self.PartnerSysPriority = v |
| 4395 | } |
| 4396 | |
| 4397 | func (self *BsnLacpConvergenceNotif) GetPartnerSysMac() net.HardwareAddr { |
| 4398 | return self.PartnerSysMac |
| 4399 | } |
| 4400 | |
| 4401 | func (self *BsnLacpConvergenceNotif) SetPartnerSysMac(v net.HardwareAddr) { |
| 4402 | self.PartnerSysMac = v |
| 4403 | } |
| 4404 | |
| 4405 | func (self *BsnLacpConvergenceNotif) GetPartnerPortPriority() uint16 { |
| 4406 | return self.PartnerPortPriority |
| 4407 | } |
| 4408 | |
| 4409 | func (self *BsnLacpConvergenceNotif) SetPartnerPortPriority(v uint16) { |
| 4410 | self.PartnerPortPriority = v |
| 4411 | } |
| 4412 | |
| 4413 | func (self *BsnLacpConvergenceNotif) GetPartnerPortNum() uint16 { |
| 4414 | return self.PartnerPortNum |
| 4415 | } |
| 4416 | |
| 4417 | func (self *BsnLacpConvergenceNotif) SetPartnerPortNum(v uint16) { |
| 4418 | self.PartnerPortNum = v |
| 4419 | } |
| 4420 | |
| 4421 | func (self *BsnLacpConvergenceNotif) GetPartnerKey() uint16 { |
| 4422 | return self.PartnerKey |
| 4423 | } |
| 4424 | |
| 4425 | func (self *BsnLacpConvergenceNotif) SetPartnerKey(v uint16) { |
| 4426 | self.PartnerKey = v |
| 4427 | } |
| 4428 | |
| 4429 | func (self *BsnLacpConvergenceNotif) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4430 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4431 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4432 | return err |
| 4433 | } |
| 4434 | |
| 4435 | encoder.PutUint8(uint8(self.ConvergenceStatus)) |
| 4436 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 4437 | self.PortNo.Serialize(encoder) |
| 4438 | encoder.PutUint16(uint16(self.ActorSysPriority)) |
| 4439 | encoder.Write(self.ActorSysMac) |
| 4440 | encoder.PutUint16(uint16(self.ActorPortPriority)) |
| 4441 | encoder.PutUint16(uint16(self.ActorPortNum)) |
| 4442 | encoder.PutUint16(uint16(self.ActorKey)) |
| 4443 | encoder.PutUint16(uint16(self.PartnerSysPriority)) |
| 4444 | encoder.Write(self.PartnerSysMac) |
| 4445 | encoder.PutUint16(uint16(self.PartnerPortPriority)) |
| 4446 | encoder.PutUint16(uint16(self.PartnerPortNum)) |
| 4447 | encoder.PutUint16(uint16(self.PartnerKey)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4448 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4449 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4450 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4451 | |
| 4452 | return nil |
| 4453 | } |
| 4454 | |
| 4455 | func DecodeBsnLacpConvergenceNotif(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnLacpConvergenceNotif, error) { |
| 4456 | _bsnlacpconvergencenotif := &BsnLacpConvergenceNotif{BsnHeader: parent} |
| 4457 | if decoder.Length() < 36 { |
| 4458 | return nil, fmt.Errorf("BsnLacpConvergenceNotif packet too short: %d < 36", decoder.Length()) |
| 4459 | } |
| 4460 | _bsnlacpconvergencenotif.ConvergenceStatus = uint8(decoder.ReadByte()) |
| 4461 | decoder.Skip(3) |
| 4462 | _bsnlacpconvergencenotif.PortNo.Decode(decoder) |
| 4463 | _bsnlacpconvergencenotif.ActorSysPriority = uint16(decoder.ReadUint16()) |
| 4464 | _bsnlacpconvergencenotif.ActorSysMac = net.HardwareAddr(decoder.Read(6)) |
| 4465 | _bsnlacpconvergencenotif.ActorPortPriority = uint16(decoder.ReadUint16()) |
| 4466 | _bsnlacpconvergencenotif.ActorPortNum = uint16(decoder.ReadUint16()) |
| 4467 | _bsnlacpconvergencenotif.ActorKey = uint16(decoder.ReadUint16()) |
| 4468 | _bsnlacpconvergencenotif.PartnerSysPriority = uint16(decoder.ReadUint16()) |
| 4469 | _bsnlacpconvergencenotif.PartnerSysMac = net.HardwareAddr(decoder.Read(6)) |
| 4470 | _bsnlacpconvergencenotif.PartnerPortPriority = uint16(decoder.ReadUint16()) |
| 4471 | _bsnlacpconvergencenotif.PartnerPortNum = uint16(decoder.ReadUint16()) |
| 4472 | _bsnlacpconvergencenotif.PartnerKey = uint16(decoder.ReadUint16()) |
| 4473 | return _bsnlacpconvergencenotif, nil |
| 4474 | } |
| 4475 | |
| 4476 | func NewBsnLacpConvergenceNotif() *BsnLacpConvergenceNotif { |
| 4477 | obj := &BsnLacpConvergenceNotif{ |
| 4478 | BsnHeader: NewBsnHeader(43), |
| 4479 | } |
| 4480 | return obj |
| 4481 | } |
| 4482 | |
| 4483 | type BsnLacpStatsReply struct { |
| 4484 | *BsnStatsReply |
| 4485 | Entries []*BsnLacpStatsEntry |
| 4486 | } |
| 4487 | |
| 4488 | type IBsnLacpStatsReply interface { |
| 4489 | IBsnStatsReply |
| 4490 | GetEntries() []*BsnLacpStatsEntry |
| 4491 | } |
| 4492 | |
| 4493 | func (self *BsnLacpStatsReply) GetEntries() []*BsnLacpStatsEntry { |
| 4494 | return self.Entries |
| 4495 | } |
| 4496 | |
| 4497 | func (self *BsnLacpStatsReply) SetEntries(v []*BsnLacpStatsEntry) { |
| 4498 | self.Entries = v |
| 4499 | } |
| 4500 | |
| 4501 | func (self *BsnLacpStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4502 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4503 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 4504 | return err |
| 4505 | } |
| 4506 | |
| 4507 | for _, obj := range self.Entries { |
| 4508 | if err := obj.Serialize(encoder); err != nil { |
| 4509 | return err |
| 4510 | } |
| 4511 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4512 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4513 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4514 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4515 | |
| 4516 | return nil |
| 4517 | } |
| 4518 | |
| 4519 | func DecodeBsnLacpStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnLacpStatsReply, error) { |
| 4520 | _bsnlacpstatsreply := &BsnLacpStatsReply{BsnStatsReply: parent} |
| 4521 | |
| 4522 | for decoder.Length() >= 36 { |
| 4523 | item, err := DecodeBsnLacpStatsEntry(decoder) |
| 4524 | if err != nil { |
| 4525 | return nil, err |
| 4526 | } |
| 4527 | if item != nil { |
| 4528 | _bsnlacpstatsreply.Entries = append(_bsnlacpstatsreply.Entries, item) |
| 4529 | } |
| 4530 | } |
| 4531 | return _bsnlacpstatsreply, nil |
| 4532 | } |
| 4533 | |
| 4534 | func NewBsnLacpStatsReply() *BsnLacpStatsReply { |
| 4535 | obj := &BsnLacpStatsReply{ |
| 4536 | BsnStatsReply: NewBsnStatsReply(1), |
| 4537 | } |
| 4538 | return obj |
| 4539 | } |
| 4540 | |
| 4541 | type BsnLacpStatsRequest struct { |
| 4542 | *BsnStatsRequest |
| 4543 | } |
| 4544 | |
| 4545 | type IBsnLacpStatsRequest interface { |
| 4546 | IBsnStatsRequest |
| 4547 | } |
| 4548 | |
| 4549 | func (self *BsnLacpStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4550 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4551 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 4552 | return err |
| 4553 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4554 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4555 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4556 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4557 | |
| 4558 | return nil |
| 4559 | } |
| 4560 | |
| 4561 | func DecodeBsnLacpStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnLacpStatsRequest, error) { |
| 4562 | _bsnlacpstatsrequest := &BsnLacpStatsRequest{BsnStatsRequest: parent} |
| 4563 | return _bsnlacpstatsrequest, nil |
| 4564 | } |
| 4565 | |
| 4566 | func NewBsnLacpStatsRequest() *BsnLacpStatsRequest { |
| 4567 | obj := &BsnLacpStatsRequest{ |
| 4568 | BsnStatsRequest: NewBsnStatsRequest(1), |
| 4569 | } |
| 4570 | return obj |
| 4571 | } |
| 4572 | |
| 4573 | type BsnLog struct { |
| 4574 | *BsnHeader |
| 4575 | Loglevel BsnLoglevel |
| 4576 | Data []byte |
| 4577 | } |
| 4578 | |
| 4579 | type IBsnLog interface { |
| 4580 | IBsnHeader |
| 4581 | GetLoglevel() BsnLoglevel |
| 4582 | GetData() []byte |
| 4583 | } |
| 4584 | |
| 4585 | func (self *BsnLog) GetLoglevel() BsnLoglevel { |
| 4586 | return self.Loglevel |
| 4587 | } |
| 4588 | |
| 4589 | func (self *BsnLog) SetLoglevel(v BsnLoglevel) { |
| 4590 | self.Loglevel = v |
| 4591 | } |
| 4592 | |
| 4593 | func (self *BsnLog) GetData() []byte { |
| 4594 | return self.Data |
| 4595 | } |
| 4596 | |
| 4597 | func (self *BsnLog) SetData(v []byte) { |
| 4598 | self.Data = v |
| 4599 | } |
| 4600 | |
| 4601 | func (self *BsnLog) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4602 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4603 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4604 | return err |
| 4605 | } |
| 4606 | |
| 4607 | encoder.PutUint8(uint8(self.Loglevel)) |
| 4608 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4609 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4610 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4611 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4612 | |
| 4613 | return nil |
| 4614 | } |
| 4615 | |
| 4616 | func DecodeBsnLog(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnLog, error) { |
| 4617 | _bsnlog := &BsnLog{BsnHeader: parent} |
| 4618 | if decoder.Length() < 1 { |
| 4619 | return nil, fmt.Errorf("BsnLog packet too short: %d < 1", decoder.Length()) |
| 4620 | } |
| 4621 | _bsnlog.Loglevel = BsnLoglevel(decoder.ReadByte()) |
| 4622 | _bsnlog.Data = decoder.Read(int(decoder.Length())) |
| 4623 | return _bsnlog, nil |
| 4624 | } |
| 4625 | |
| 4626 | func NewBsnLog() *BsnLog { |
| 4627 | obj := &BsnLog{ |
| 4628 | BsnHeader: NewBsnHeader(63), |
| 4629 | } |
| 4630 | return obj |
| 4631 | } |
| 4632 | |
| 4633 | type BsnLuaCommandReply struct { |
| 4634 | *BsnHeader |
| 4635 | Data []byte |
| 4636 | } |
| 4637 | |
| 4638 | type IBsnLuaCommandReply interface { |
| 4639 | IBsnHeader |
| 4640 | GetData() []byte |
| 4641 | } |
| 4642 | |
| 4643 | func (self *BsnLuaCommandReply) GetData() []byte { |
| 4644 | return self.Data |
| 4645 | } |
| 4646 | |
| 4647 | func (self *BsnLuaCommandReply) SetData(v []byte) { |
| 4648 | self.Data = v |
| 4649 | } |
| 4650 | |
| 4651 | func (self *BsnLuaCommandReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4652 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4653 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4654 | return err |
| 4655 | } |
| 4656 | |
| 4657 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4658 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4659 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4660 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4661 | |
| 4662 | return nil |
| 4663 | } |
| 4664 | |
| 4665 | func DecodeBsnLuaCommandReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnLuaCommandReply, error) { |
| 4666 | _bsnluacommandreply := &BsnLuaCommandReply{BsnHeader: parent} |
| 4667 | _bsnluacommandreply.Data = decoder.Read(int(decoder.Length())) |
| 4668 | return _bsnluacommandreply, nil |
| 4669 | } |
| 4670 | |
| 4671 | func NewBsnLuaCommandReply() *BsnLuaCommandReply { |
| 4672 | obj := &BsnLuaCommandReply{ |
| 4673 | BsnHeader: NewBsnHeader(66), |
| 4674 | } |
| 4675 | return obj |
| 4676 | } |
| 4677 | |
| 4678 | type BsnLuaCommandRequest struct { |
| 4679 | *BsnHeader |
| 4680 | Data []byte |
| 4681 | } |
| 4682 | |
| 4683 | type IBsnLuaCommandRequest interface { |
| 4684 | IBsnHeader |
| 4685 | GetData() []byte |
| 4686 | } |
| 4687 | |
| 4688 | func (self *BsnLuaCommandRequest) GetData() []byte { |
| 4689 | return self.Data |
| 4690 | } |
| 4691 | |
| 4692 | func (self *BsnLuaCommandRequest) SetData(v []byte) { |
| 4693 | self.Data = v |
| 4694 | } |
| 4695 | |
| 4696 | func (self *BsnLuaCommandRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4697 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4698 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4699 | return err |
| 4700 | } |
| 4701 | |
| 4702 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4703 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4704 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4705 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4706 | |
| 4707 | return nil |
| 4708 | } |
| 4709 | |
| 4710 | func DecodeBsnLuaCommandRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnLuaCommandRequest, error) { |
| 4711 | _bsnluacommandrequest := &BsnLuaCommandRequest{BsnHeader: parent} |
| 4712 | _bsnluacommandrequest.Data = decoder.Read(int(decoder.Length())) |
| 4713 | return _bsnluacommandrequest, nil |
| 4714 | } |
| 4715 | |
| 4716 | func NewBsnLuaCommandRequest() *BsnLuaCommandRequest { |
| 4717 | obj := &BsnLuaCommandRequest{ |
| 4718 | BsnHeader: NewBsnHeader(65), |
| 4719 | } |
| 4720 | return obj |
| 4721 | } |
| 4722 | |
| 4723 | type BsnLuaNotification struct { |
| 4724 | *BsnHeader |
| 4725 | Data []byte |
| 4726 | } |
| 4727 | |
| 4728 | type IBsnLuaNotification interface { |
| 4729 | IBsnHeader |
| 4730 | GetData() []byte |
| 4731 | } |
| 4732 | |
| 4733 | func (self *BsnLuaNotification) GetData() []byte { |
| 4734 | return self.Data |
| 4735 | } |
| 4736 | |
| 4737 | func (self *BsnLuaNotification) SetData(v []byte) { |
| 4738 | self.Data = v |
| 4739 | } |
| 4740 | |
| 4741 | func (self *BsnLuaNotification) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4742 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4743 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4744 | return err |
| 4745 | } |
| 4746 | |
| 4747 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4748 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4749 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4750 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4751 | |
| 4752 | return nil |
| 4753 | } |
| 4754 | |
| 4755 | func DecodeBsnLuaNotification(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnLuaNotification, error) { |
| 4756 | _bsnluanotification := &BsnLuaNotification{BsnHeader: parent} |
| 4757 | _bsnluanotification.Data = decoder.Read(int(decoder.Length())) |
| 4758 | return _bsnluanotification, nil |
| 4759 | } |
| 4760 | |
| 4761 | func NewBsnLuaNotification() *BsnLuaNotification { |
| 4762 | obj := &BsnLuaNotification{ |
| 4763 | BsnHeader: NewBsnHeader(67), |
| 4764 | } |
| 4765 | return obj |
| 4766 | } |
| 4767 | |
| 4768 | type BsnLuaUpload struct { |
| 4769 | *BsnHeader |
| 4770 | Flags BsnLuaUploadFlags |
| 4771 | Filename string |
| 4772 | Data []byte |
| 4773 | } |
| 4774 | |
| 4775 | type IBsnLuaUpload interface { |
| 4776 | IBsnHeader |
| 4777 | GetFlags() BsnLuaUploadFlags |
| 4778 | GetFilename() string |
| 4779 | GetData() []byte |
| 4780 | } |
| 4781 | |
| 4782 | func (self *BsnLuaUpload) GetFlags() BsnLuaUploadFlags { |
| 4783 | return self.Flags |
| 4784 | } |
| 4785 | |
| 4786 | func (self *BsnLuaUpload) SetFlags(v BsnLuaUploadFlags) { |
| 4787 | self.Flags = v |
| 4788 | } |
| 4789 | |
| 4790 | func (self *BsnLuaUpload) GetFilename() string { |
| 4791 | return self.Filename |
| 4792 | } |
| 4793 | |
| 4794 | func (self *BsnLuaUpload) SetFilename(v string) { |
| 4795 | self.Filename = v |
| 4796 | } |
| 4797 | |
| 4798 | func (self *BsnLuaUpload) GetData() []byte { |
| 4799 | return self.Data |
| 4800 | } |
| 4801 | |
| 4802 | func (self *BsnLuaUpload) SetData(v []byte) { |
| 4803 | self.Data = v |
| 4804 | } |
| 4805 | |
| 4806 | func (self *BsnLuaUpload) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4807 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4808 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4809 | return err |
| 4810 | } |
| 4811 | |
| 4812 | encoder.PutUint16(uint16(self.Flags)) |
| 4813 | encoder.Write([]byte(self.Filename)) |
| 4814 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4815 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4816 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4817 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4818 | |
| 4819 | return nil |
| 4820 | } |
| 4821 | |
| 4822 | func DecodeBsnLuaUpload(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnLuaUpload, error) { |
| 4823 | _bsnluaupload := &BsnLuaUpload{BsnHeader: parent} |
| 4824 | if decoder.Length() < 66 { |
| 4825 | return nil, fmt.Errorf("BsnLuaUpload packet too short: %d < 66", decoder.Length()) |
| 4826 | } |
| 4827 | _bsnluaupload.Flags = BsnLuaUploadFlags(decoder.ReadUint16()) |
| 4828 | _bsnluaupload.Filename = string(bytes.Trim(decoder.Read(64), "\x00")) |
| 4829 | _bsnluaupload.Data = decoder.Read(int(decoder.Length())) |
| 4830 | return _bsnluaupload, nil |
| 4831 | } |
| 4832 | |
| 4833 | func NewBsnLuaUpload() *BsnLuaUpload { |
| 4834 | obj := &BsnLuaUpload{ |
| 4835 | BsnHeader: NewBsnHeader(64), |
| 4836 | } |
| 4837 | return obj |
| 4838 | } |
| 4839 | |
| 4840 | type BsnPduRxReply struct { |
| 4841 | *BsnHeader |
| 4842 | Status uint32 |
| 4843 | PortNo Port |
| 4844 | SlotNum uint8 |
| 4845 | } |
| 4846 | |
| 4847 | type IBsnPduRxReply interface { |
| 4848 | IBsnHeader |
| 4849 | GetStatus() uint32 |
| 4850 | GetPortNo() Port |
| 4851 | GetSlotNum() uint8 |
| 4852 | } |
| 4853 | |
| 4854 | func (self *BsnPduRxReply) GetStatus() uint32 { |
| 4855 | return self.Status |
| 4856 | } |
| 4857 | |
| 4858 | func (self *BsnPduRxReply) SetStatus(v uint32) { |
| 4859 | self.Status = v |
| 4860 | } |
| 4861 | |
| 4862 | func (self *BsnPduRxReply) GetPortNo() Port { |
| 4863 | return self.PortNo |
| 4864 | } |
| 4865 | |
| 4866 | func (self *BsnPduRxReply) SetPortNo(v Port) { |
| 4867 | self.PortNo = v |
| 4868 | } |
| 4869 | |
| 4870 | func (self *BsnPduRxReply) GetSlotNum() uint8 { |
| 4871 | return self.SlotNum |
| 4872 | } |
| 4873 | |
| 4874 | func (self *BsnPduRxReply) SetSlotNum(v uint8) { |
| 4875 | self.SlotNum = v |
| 4876 | } |
| 4877 | |
| 4878 | func (self *BsnPduRxReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4879 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4880 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4881 | return err |
| 4882 | } |
| 4883 | |
| 4884 | encoder.PutUint32(uint32(self.Status)) |
| 4885 | self.PortNo.Serialize(encoder) |
| 4886 | encoder.PutUint8(uint8(self.SlotNum)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4887 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4888 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4889 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4890 | |
| 4891 | return nil |
| 4892 | } |
| 4893 | |
| 4894 | func DecodeBsnPduRxReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduRxReply, error) { |
| 4895 | _bsnpdurxreply := &BsnPduRxReply{BsnHeader: parent} |
| 4896 | if decoder.Length() < 9 { |
| 4897 | return nil, fmt.Errorf("BsnPduRxReply packet too short: %d < 9", decoder.Length()) |
| 4898 | } |
| 4899 | _bsnpdurxreply.Status = uint32(decoder.ReadUint32()) |
| 4900 | _bsnpdurxreply.PortNo.Decode(decoder) |
| 4901 | _bsnpdurxreply.SlotNum = uint8(decoder.ReadByte()) |
| 4902 | return _bsnpdurxreply, nil |
| 4903 | } |
| 4904 | |
| 4905 | func NewBsnPduRxReply() *BsnPduRxReply { |
| 4906 | obj := &BsnPduRxReply{ |
| 4907 | BsnHeader: NewBsnHeader(34), |
| 4908 | } |
| 4909 | return obj |
| 4910 | } |
| 4911 | |
| 4912 | type BsnPduRxRequest struct { |
| 4913 | *BsnHeader |
| 4914 | TimeoutMs uint32 |
| 4915 | PortNo Port |
| 4916 | SlotNum uint8 |
| 4917 | Data []byte |
| 4918 | } |
| 4919 | |
| 4920 | type IBsnPduRxRequest interface { |
| 4921 | IBsnHeader |
| 4922 | GetTimeoutMs() uint32 |
| 4923 | GetPortNo() Port |
| 4924 | GetSlotNum() uint8 |
| 4925 | GetData() []byte |
| 4926 | } |
| 4927 | |
| 4928 | func (self *BsnPduRxRequest) GetTimeoutMs() uint32 { |
| 4929 | return self.TimeoutMs |
| 4930 | } |
| 4931 | |
| 4932 | func (self *BsnPduRxRequest) SetTimeoutMs(v uint32) { |
| 4933 | self.TimeoutMs = v |
| 4934 | } |
| 4935 | |
| 4936 | func (self *BsnPduRxRequest) GetPortNo() Port { |
| 4937 | return self.PortNo |
| 4938 | } |
| 4939 | |
| 4940 | func (self *BsnPduRxRequest) SetPortNo(v Port) { |
| 4941 | self.PortNo = v |
| 4942 | } |
| 4943 | |
| 4944 | func (self *BsnPduRxRequest) GetSlotNum() uint8 { |
| 4945 | return self.SlotNum |
| 4946 | } |
| 4947 | |
| 4948 | func (self *BsnPduRxRequest) SetSlotNum(v uint8) { |
| 4949 | self.SlotNum = v |
| 4950 | } |
| 4951 | |
| 4952 | func (self *BsnPduRxRequest) GetData() []byte { |
| 4953 | return self.Data |
| 4954 | } |
| 4955 | |
| 4956 | func (self *BsnPduRxRequest) SetData(v []byte) { |
| 4957 | self.Data = v |
| 4958 | } |
| 4959 | |
| 4960 | func (self *BsnPduRxRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4961 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4962 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 4963 | return err |
| 4964 | } |
| 4965 | |
| 4966 | encoder.PutUint32(uint32(self.TimeoutMs)) |
| 4967 | self.PortNo.Serialize(encoder) |
| 4968 | encoder.PutUint8(uint8(self.SlotNum)) |
| 4969 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 4970 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4971 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4972 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 4973 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 4974 | |
| 4975 | return nil |
| 4976 | } |
| 4977 | |
| 4978 | func DecodeBsnPduRxRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduRxRequest, error) { |
| 4979 | _bsnpdurxrequest := &BsnPduRxRequest{BsnHeader: parent} |
| 4980 | if decoder.Length() < 12 { |
| 4981 | return nil, fmt.Errorf("BsnPduRxRequest packet too short: %d < 12", decoder.Length()) |
| 4982 | } |
| 4983 | _bsnpdurxrequest.TimeoutMs = uint32(decoder.ReadUint32()) |
| 4984 | _bsnpdurxrequest.PortNo.Decode(decoder) |
| 4985 | _bsnpdurxrequest.SlotNum = uint8(decoder.ReadByte()) |
| 4986 | decoder.Skip(3) |
| 4987 | _bsnpdurxrequest.Data = decoder.Read(int(decoder.Length())) |
| 4988 | return _bsnpdurxrequest, nil |
| 4989 | } |
| 4990 | |
| 4991 | func NewBsnPduRxRequest() *BsnPduRxRequest { |
| 4992 | obj := &BsnPduRxRequest{ |
| 4993 | BsnHeader: NewBsnHeader(33), |
| 4994 | } |
| 4995 | return obj |
| 4996 | } |
| 4997 | |
| 4998 | type BsnPduRxTimeout struct { |
| 4999 | *BsnHeader |
| 5000 | PortNo Port |
| 5001 | SlotNum uint8 |
| 5002 | } |
| 5003 | |
| 5004 | type IBsnPduRxTimeout interface { |
| 5005 | IBsnHeader |
| 5006 | GetPortNo() Port |
| 5007 | GetSlotNum() uint8 |
| 5008 | } |
| 5009 | |
| 5010 | func (self *BsnPduRxTimeout) GetPortNo() Port { |
| 5011 | return self.PortNo |
| 5012 | } |
| 5013 | |
| 5014 | func (self *BsnPduRxTimeout) SetPortNo(v Port) { |
| 5015 | self.PortNo = v |
| 5016 | } |
| 5017 | |
| 5018 | func (self *BsnPduRxTimeout) GetSlotNum() uint8 { |
| 5019 | return self.SlotNum |
| 5020 | } |
| 5021 | |
| 5022 | func (self *BsnPduRxTimeout) SetSlotNum(v uint8) { |
| 5023 | self.SlotNum = v |
| 5024 | } |
| 5025 | |
| 5026 | func (self *BsnPduRxTimeout) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5027 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5028 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5029 | return err |
| 5030 | } |
| 5031 | |
| 5032 | self.PortNo.Serialize(encoder) |
| 5033 | encoder.PutUint8(uint8(self.SlotNum)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5034 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5035 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5036 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5037 | |
| 5038 | return nil |
| 5039 | } |
| 5040 | |
| 5041 | func DecodeBsnPduRxTimeout(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduRxTimeout, error) { |
| 5042 | _bsnpdurxtimeout := &BsnPduRxTimeout{BsnHeader: parent} |
| 5043 | if decoder.Length() < 5 { |
| 5044 | return nil, fmt.Errorf("BsnPduRxTimeout packet too short: %d < 5", decoder.Length()) |
| 5045 | } |
| 5046 | _bsnpdurxtimeout.PortNo.Decode(decoder) |
| 5047 | _bsnpdurxtimeout.SlotNum = uint8(decoder.ReadByte()) |
| 5048 | return _bsnpdurxtimeout, nil |
| 5049 | } |
| 5050 | |
| 5051 | func NewBsnPduRxTimeout() *BsnPduRxTimeout { |
| 5052 | obj := &BsnPduRxTimeout{ |
| 5053 | BsnHeader: NewBsnHeader(35), |
| 5054 | } |
| 5055 | return obj |
| 5056 | } |
| 5057 | |
| 5058 | type BsnPduTxReply struct { |
| 5059 | *BsnHeader |
| 5060 | Status uint32 |
| 5061 | PortNo Port |
| 5062 | SlotNum uint8 |
| 5063 | } |
| 5064 | |
| 5065 | type IBsnPduTxReply interface { |
| 5066 | IBsnHeader |
| 5067 | GetStatus() uint32 |
| 5068 | GetPortNo() Port |
| 5069 | GetSlotNum() uint8 |
| 5070 | } |
| 5071 | |
| 5072 | func (self *BsnPduTxReply) GetStatus() uint32 { |
| 5073 | return self.Status |
| 5074 | } |
| 5075 | |
| 5076 | func (self *BsnPduTxReply) SetStatus(v uint32) { |
| 5077 | self.Status = v |
| 5078 | } |
| 5079 | |
| 5080 | func (self *BsnPduTxReply) GetPortNo() Port { |
| 5081 | return self.PortNo |
| 5082 | } |
| 5083 | |
| 5084 | func (self *BsnPduTxReply) SetPortNo(v Port) { |
| 5085 | self.PortNo = v |
| 5086 | } |
| 5087 | |
| 5088 | func (self *BsnPduTxReply) GetSlotNum() uint8 { |
| 5089 | return self.SlotNum |
| 5090 | } |
| 5091 | |
| 5092 | func (self *BsnPduTxReply) SetSlotNum(v uint8) { |
| 5093 | self.SlotNum = v |
| 5094 | } |
| 5095 | |
| 5096 | func (self *BsnPduTxReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5097 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5098 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5099 | return err |
| 5100 | } |
| 5101 | |
| 5102 | encoder.PutUint32(uint32(self.Status)) |
| 5103 | self.PortNo.Serialize(encoder) |
| 5104 | encoder.PutUint8(uint8(self.SlotNum)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5105 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5106 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5107 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5108 | |
| 5109 | return nil |
| 5110 | } |
| 5111 | |
| 5112 | func DecodeBsnPduTxReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduTxReply, error) { |
| 5113 | _bsnpdutxreply := &BsnPduTxReply{BsnHeader: parent} |
| 5114 | if decoder.Length() < 9 { |
| 5115 | return nil, fmt.Errorf("BsnPduTxReply packet too short: %d < 9", decoder.Length()) |
| 5116 | } |
| 5117 | _bsnpdutxreply.Status = uint32(decoder.ReadUint32()) |
| 5118 | _bsnpdutxreply.PortNo.Decode(decoder) |
| 5119 | _bsnpdutxreply.SlotNum = uint8(decoder.ReadByte()) |
| 5120 | return _bsnpdutxreply, nil |
| 5121 | } |
| 5122 | |
| 5123 | func NewBsnPduTxReply() *BsnPduTxReply { |
| 5124 | obj := &BsnPduTxReply{ |
| 5125 | BsnHeader: NewBsnHeader(32), |
| 5126 | } |
| 5127 | return obj |
| 5128 | } |
| 5129 | |
| 5130 | type BsnPduTxRequest struct { |
| 5131 | *BsnHeader |
| 5132 | TxIntervalMs uint32 |
| 5133 | PortNo Port |
| 5134 | SlotNum uint8 |
| 5135 | Data []byte |
| 5136 | } |
| 5137 | |
| 5138 | type IBsnPduTxRequest interface { |
| 5139 | IBsnHeader |
| 5140 | GetTxIntervalMs() uint32 |
| 5141 | GetPortNo() Port |
| 5142 | GetSlotNum() uint8 |
| 5143 | GetData() []byte |
| 5144 | } |
| 5145 | |
| 5146 | func (self *BsnPduTxRequest) GetTxIntervalMs() uint32 { |
| 5147 | return self.TxIntervalMs |
| 5148 | } |
| 5149 | |
| 5150 | func (self *BsnPduTxRequest) SetTxIntervalMs(v uint32) { |
| 5151 | self.TxIntervalMs = v |
| 5152 | } |
| 5153 | |
| 5154 | func (self *BsnPduTxRequest) GetPortNo() Port { |
| 5155 | return self.PortNo |
| 5156 | } |
| 5157 | |
| 5158 | func (self *BsnPduTxRequest) SetPortNo(v Port) { |
| 5159 | self.PortNo = v |
| 5160 | } |
| 5161 | |
| 5162 | func (self *BsnPduTxRequest) GetSlotNum() uint8 { |
| 5163 | return self.SlotNum |
| 5164 | } |
| 5165 | |
| 5166 | func (self *BsnPduTxRequest) SetSlotNum(v uint8) { |
| 5167 | self.SlotNum = v |
| 5168 | } |
| 5169 | |
| 5170 | func (self *BsnPduTxRequest) GetData() []byte { |
| 5171 | return self.Data |
| 5172 | } |
| 5173 | |
| 5174 | func (self *BsnPduTxRequest) SetData(v []byte) { |
| 5175 | self.Data = v |
| 5176 | } |
| 5177 | |
| 5178 | func (self *BsnPduTxRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5179 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5180 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5181 | return err |
| 5182 | } |
| 5183 | |
| 5184 | encoder.PutUint32(uint32(self.TxIntervalMs)) |
| 5185 | self.PortNo.Serialize(encoder) |
| 5186 | encoder.PutUint8(uint8(self.SlotNum)) |
| 5187 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 5188 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5189 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5190 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5191 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5192 | |
| 5193 | return nil |
| 5194 | } |
| 5195 | |
| 5196 | func DecodeBsnPduTxRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduTxRequest, error) { |
| 5197 | _bsnpdutxrequest := &BsnPduTxRequest{BsnHeader: parent} |
| 5198 | if decoder.Length() < 12 { |
| 5199 | return nil, fmt.Errorf("BsnPduTxRequest packet too short: %d < 12", decoder.Length()) |
| 5200 | } |
| 5201 | _bsnpdutxrequest.TxIntervalMs = uint32(decoder.ReadUint32()) |
| 5202 | _bsnpdutxrequest.PortNo.Decode(decoder) |
| 5203 | _bsnpdutxrequest.SlotNum = uint8(decoder.ReadByte()) |
| 5204 | decoder.Skip(3) |
| 5205 | _bsnpdutxrequest.Data = decoder.Read(int(decoder.Length())) |
| 5206 | return _bsnpdutxrequest, nil |
| 5207 | } |
| 5208 | |
| 5209 | func NewBsnPduTxRequest() *BsnPduTxRequest { |
| 5210 | obj := &BsnPduTxRequest{ |
| 5211 | BsnHeader: NewBsnHeader(31), |
| 5212 | } |
| 5213 | return obj |
| 5214 | } |
| 5215 | |
| 5216 | type BsnPortCounterStatsReply struct { |
| 5217 | *BsnStatsReply |
| 5218 | Entries []*BsnPortCounterStatsEntry |
| 5219 | } |
| 5220 | |
| 5221 | type IBsnPortCounterStatsReply interface { |
| 5222 | IBsnStatsReply |
| 5223 | GetEntries() []*BsnPortCounterStatsEntry |
| 5224 | } |
| 5225 | |
| 5226 | func (self *BsnPortCounterStatsReply) GetEntries() []*BsnPortCounterStatsEntry { |
| 5227 | return self.Entries |
| 5228 | } |
| 5229 | |
| 5230 | func (self *BsnPortCounterStatsReply) SetEntries(v []*BsnPortCounterStatsEntry) { |
| 5231 | self.Entries = v |
| 5232 | } |
| 5233 | |
| 5234 | func (self *BsnPortCounterStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5235 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5236 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 5237 | return err |
| 5238 | } |
| 5239 | |
| 5240 | for _, obj := range self.Entries { |
| 5241 | if err := obj.Serialize(encoder); err != nil { |
| 5242 | return err |
| 5243 | } |
| 5244 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5245 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5246 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5247 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5248 | |
| 5249 | return nil |
| 5250 | } |
| 5251 | |
| 5252 | func DecodeBsnPortCounterStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnPortCounterStatsReply, error) { |
| 5253 | _bsnportcounterstatsreply := &BsnPortCounterStatsReply{BsnStatsReply: parent} |
| 5254 | |
| 5255 | for decoder.Length() >= 8 { |
| 5256 | item, err := DecodeBsnPortCounterStatsEntry(decoder) |
| 5257 | if err != nil { |
| 5258 | return nil, err |
| 5259 | } |
| 5260 | if item != nil { |
| 5261 | _bsnportcounterstatsreply.Entries = append(_bsnportcounterstatsreply.Entries, item) |
| 5262 | } |
| 5263 | } |
| 5264 | return _bsnportcounterstatsreply, nil |
| 5265 | } |
| 5266 | |
| 5267 | func NewBsnPortCounterStatsReply() *BsnPortCounterStatsReply { |
| 5268 | obj := &BsnPortCounterStatsReply{ |
| 5269 | BsnStatsReply: NewBsnStatsReply(8), |
| 5270 | } |
| 5271 | return obj |
| 5272 | } |
| 5273 | |
| 5274 | type BsnPortCounterStatsRequest struct { |
| 5275 | *BsnStatsRequest |
| 5276 | PortNo Port |
| 5277 | } |
| 5278 | |
| 5279 | type IBsnPortCounterStatsRequest interface { |
| 5280 | IBsnStatsRequest |
| 5281 | GetPortNo() Port |
| 5282 | } |
| 5283 | |
| 5284 | func (self *BsnPortCounterStatsRequest) GetPortNo() Port { |
| 5285 | return self.PortNo |
| 5286 | } |
| 5287 | |
| 5288 | func (self *BsnPortCounterStatsRequest) SetPortNo(v Port) { |
| 5289 | self.PortNo = v |
| 5290 | } |
| 5291 | |
| 5292 | func (self *BsnPortCounterStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5293 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5294 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 5295 | return err |
| 5296 | } |
| 5297 | |
| 5298 | self.PortNo.Serialize(encoder) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5299 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5300 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5301 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5302 | |
| 5303 | return nil |
| 5304 | } |
| 5305 | |
| 5306 | func DecodeBsnPortCounterStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnPortCounterStatsRequest, error) { |
| 5307 | _bsnportcounterstatsrequest := &BsnPortCounterStatsRequest{BsnStatsRequest: parent} |
| 5308 | if decoder.Length() < 4 { |
| 5309 | return nil, fmt.Errorf("BsnPortCounterStatsRequest packet too short: %d < 4", decoder.Length()) |
| 5310 | } |
| 5311 | _bsnportcounterstatsrequest.PortNo.Decode(decoder) |
| 5312 | return _bsnportcounterstatsrequest, nil |
| 5313 | } |
| 5314 | |
| 5315 | func NewBsnPortCounterStatsRequest() *BsnPortCounterStatsRequest { |
| 5316 | obj := &BsnPortCounterStatsRequest{ |
| 5317 | BsnStatsRequest: NewBsnStatsRequest(8), |
| 5318 | } |
| 5319 | return obj |
| 5320 | } |
| 5321 | |
| 5322 | type BsnRoleStatus struct { |
| 5323 | *BsnHeader |
| 5324 | Role ControllerRole |
| 5325 | Reason BsnControllerRoleReason |
| 5326 | GenerationId uint64 |
| 5327 | } |
| 5328 | |
| 5329 | type IBsnRoleStatus interface { |
| 5330 | IBsnHeader |
| 5331 | GetRole() ControllerRole |
| 5332 | GetReason() BsnControllerRoleReason |
| 5333 | GetGenerationId() uint64 |
| 5334 | } |
| 5335 | |
| 5336 | func (self *BsnRoleStatus) GetRole() ControllerRole { |
| 5337 | return self.Role |
| 5338 | } |
| 5339 | |
| 5340 | func (self *BsnRoleStatus) SetRole(v ControllerRole) { |
| 5341 | self.Role = v |
| 5342 | } |
| 5343 | |
| 5344 | func (self *BsnRoleStatus) GetReason() BsnControllerRoleReason { |
| 5345 | return self.Reason |
| 5346 | } |
| 5347 | |
| 5348 | func (self *BsnRoleStatus) SetReason(v BsnControllerRoleReason) { |
| 5349 | self.Reason = v |
| 5350 | } |
| 5351 | |
| 5352 | func (self *BsnRoleStatus) GetGenerationId() uint64 { |
| 5353 | return self.GenerationId |
| 5354 | } |
| 5355 | |
| 5356 | func (self *BsnRoleStatus) SetGenerationId(v uint64) { |
| 5357 | self.GenerationId = v |
| 5358 | } |
| 5359 | |
| 5360 | func (self *BsnRoleStatus) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5361 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5362 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5363 | return err |
| 5364 | } |
| 5365 | |
| 5366 | encoder.PutUint32(uint32(self.Role)) |
| 5367 | encoder.PutUint8(uint8(self.Reason)) |
| 5368 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 5369 | encoder.PutUint64(uint64(self.GenerationId)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5370 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5371 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5372 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5373 | |
| 5374 | return nil |
| 5375 | } |
| 5376 | |
| 5377 | func DecodeBsnRoleStatus(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnRoleStatus, error) { |
| 5378 | _bsnrolestatus := &BsnRoleStatus{BsnHeader: parent} |
| 5379 | if decoder.Length() < 16 { |
| 5380 | return nil, fmt.Errorf("BsnRoleStatus packet too short: %d < 16", decoder.Length()) |
| 5381 | } |
| 5382 | _bsnrolestatus.Role = ControllerRole(decoder.ReadUint32()) |
| 5383 | _bsnrolestatus.Reason = BsnControllerRoleReason(decoder.ReadByte()) |
| 5384 | decoder.Skip(3) |
| 5385 | _bsnrolestatus.GenerationId = uint64(decoder.ReadUint64()) |
| 5386 | return _bsnrolestatus, nil |
| 5387 | } |
| 5388 | |
| 5389 | func NewBsnRoleStatus() *BsnRoleStatus { |
| 5390 | obj := &BsnRoleStatus{ |
| 5391 | BsnHeader: NewBsnHeader(55), |
| 5392 | } |
| 5393 | return obj |
| 5394 | } |
| 5395 | |
| 5396 | type BsnSetAuxCxnsReply struct { |
| 5397 | *BsnHeader |
| 5398 | NumAux uint32 |
| 5399 | Status uint32 |
| 5400 | } |
| 5401 | |
| 5402 | type IBsnSetAuxCxnsReply interface { |
| 5403 | IBsnHeader |
| 5404 | GetNumAux() uint32 |
| 5405 | GetStatus() uint32 |
| 5406 | } |
| 5407 | |
| 5408 | func (self *BsnSetAuxCxnsReply) GetNumAux() uint32 { |
| 5409 | return self.NumAux |
| 5410 | } |
| 5411 | |
| 5412 | func (self *BsnSetAuxCxnsReply) SetNumAux(v uint32) { |
| 5413 | self.NumAux = v |
| 5414 | } |
| 5415 | |
| 5416 | func (self *BsnSetAuxCxnsReply) GetStatus() uint32 { |
| 5417 | return self.Status |
| 5418 | } |
| 5419 | |
| 5420 | func (self *BsnSetAuxCxnsReply) SetStatus(v uint32) { |
| 5421 | self.Status = v |
| 5422 | } |
| 5423 | |
| 5424 | func (self *BsnSetAuxCxnsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5425 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5426 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5427 | return err |
| 5428 | } |
| 5429 | |
| 5430 | encoder.PutUint32(uint32(self.NumAux)) |
| 5431 | encoder.PutUint32(uint32(self.Status)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5432 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5433 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5434 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5435 | |
| 5436 | return nil |
| 5437 | } |
| 5438 | |
| 5439 | func DecodeBsnSetAuxCxnsReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetAuxCxnsReply, error) { |
| 5440 | _bsnsetauxcxnsreply := &BsnSetAuxCxnsReply{BsnHeader: parent} |
| 5441 | if decoder.Length() < 8 { |
| 5442 | return nil, fmt.Errorf("BsnSetAuxCxnsReply packet too short: %d < 8", decoder.Length()) |
| 5443 | } |
| 5444 | _bsnsetauxcxnsreply.NumAux = uint32(decoder.ReadUint32()) |
| 5445 | _bsnsetauxcxnsreply.Status = uint32(decoder.ReadUint32()) |
| 5446 | return _bsnsetauxcxnsreply, nil |
| 5447 | } |
| 5448 | |
| 5449 | func NewBsnSetAuxCxnsReply() *BsnSetAuxCxnsReply { |
| 5450 | obj := &BsnSetAuxCxnsReply{ |
| 5451 | BsnHeader: NewBsnHeader(59), |
| 5452 | } |
| 5453 | return obj |
| 5454 | } |
| 5455 | |
| 5456 | type BsnSetAuxCxnsRequest struct { |
| 5457 | *BsnHeader |
| 5458 | NumAux uint32 |
| 5459 | } |
| 5460 | |
| 5461 | type IBsnSetAuxCxnsRequest interface { |
| 5462 | IBsnHeader |
| 5463 | GetNumAux() uint32 |
| 5464 | } |
| 5465 | |
| 5466 | func (self *BsnSetAuxCxnsRequest) GetNumAux() uint32 { |
| 5467 | return self.NumAux |
| 5468 | } |
| 5469 | |
| 5470 | func (self *BsnSetAuxCxnsRequest) SetNumAux(v uint32) { |
| 5471 | self.NumAux = v |
| 5472 | } |
| 5473 | |
| 5474 | func (self *BsnSetAuxCxnsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5475 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5476 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5477 | return err |
| 5478 | } |
| 5479 | |
| 5480 | encoder.PutUint32(uint32(self.NumAux)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5481 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5482 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5483 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5484 | |
| 5485 | return nil |
| 5486 | } |
| 5487 | |
| 5488 | func DecodeBsnSetAuxCxnsRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetAuxCxnsRequest, error) { |
| 5489 | _bsnsetauxcxnsrequest := &BsnSetAuxCxnsRequest{BsnHeader: parent} |
| 5490 | if decoder.Length() < 4 { |
| 5491 | return nil, fmt.Errorf("BsnSetAuxCxnsRequest packet too short: %d < 4", decoder.Length()) |
| 5492 | } |
| 5493 | _bsnsetauxcxnsrequest.NumAux = uint32(decoder.ReadUint32()) |
| 5494 | return _bsnsetauxcxnsrequest, nil |
| 5495 | } |
| 5496 | |
| 5497 | func NewBsnSetAuxCxnsRequest() *BsnSetAuxCxnsRequest { |
| 5498 | obj := &BsnSetAuxCxnsRequest{ |
| 5499 | BsnHeader: NewBsnHeader(58), |
| 5500 | } |
| 5501 | return obj |
| 5502 | } |
| 5503 | |
| 5504 | type BsnSetLacpReply struct { |
| 5505 | *BsnHeader |
| 5506 | Status uint32 |
| 5507 | PortNo Port |
| 5508 | } |
| 5509 | |
| 5510 | type IBsnSetLacpReply interface { |
| 5511 | IBsnHeader |
| 5512 | GetStatus() uint32 |
| 5513 | GetPortNo() Port |
| 5514 | } |
| 5515 | |
| 5516 | func (self *BsnSetLacpReply) GetStatus() uint32 { |
| 5517 | return self.Status |
| 5518 | } |
| 5519 | |
| 5520 | func (self *BsnSetLacpReply) SetStatus(v uint32) { |
| 5521 | self.Status = v |
| 5522 | } |
| 5523 | |
| 5524 | func (self *BsnSetLacpReply) GetPortNo() Port { |
| 5525 | return self.PortNo |
| 5526 | } |
| 5527 | |
| 5528 | func (self *BsnSetLacpReply) SetPortNo(v Port) { |
| 5529 | self.PortNo = v |
| 5530 | } |
| 5531 | |
| 5532 | func (self *BsnSetLacpReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5533 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5534 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5535 | return err |
| 5536 | } |
| 5537 | |
| 5538 | encoder.PutUint32(uint32(self.Status)) |
| 5539 | self.PortNo.Serialize(encoder) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5540 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5541 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5542 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5543 | |
| 5544 | return nil |
| 5545 | } |
| 5546 | |
| 5547 | func DecodeBsnSetLacpReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetLacpReply, error) { |
| 5548 | _bsnsetlacpreply := &BsnSetLacpReply{BsnHeader: parent} |
| 5549 | if decoder.Length() < 8 { |
| 5550 | return nil, fmt.Errorf("BsnSetLacpReply packet too short: %d < 8", decoder.Length()) |
| 5551 | } |
| 5552 | _bsnsetlacpreply.Status = uint32(decoder.ReadUint32()) |
| 5553 | _bsnsetlacpreply.PortNo.Decode(decoder) |
| 5554 | return _bsnsetlacpreply, nil |
| 5555 | } |
| 5556 | |
| 5557 | func NewBsnSetLacpReply() *BsnSetLacpReply { |
| 5558 | obj := &BsnSetLacpReply{ |
| 5559 | BsnHeader: NewBsnHeader(42), |
| 5560 | } |
| 5561 | return obj |
| 5562 | } |
| 5563 | |
| 5564 | type BsnSetLacpRequest struct { |
| 5565 | *BsnHeader |
| 5566 | Enabled uint8 |
| 5567 | PortNo Port |
| 5568 | ActorSysPriority uint16 |
| 5569 | ActorSysMac net.HardwareAddr |
| 5570 | ActorPortPriority uint16 |
| 5571 | ActorPortNum uint16 |
| 5572 | ActorKey uint16 |
| 5573 | } |
| 5574 | |
| 5575 | type IBsnSetLacpRequest interface { |
| 5576 | IBsnHeader |
| 5577 | GetEnabled() uint8 |
| 5578 | GetPortNo() Port |
| 5579 | GetActorSysPriority() uint16 |
| 5580 | GetActorSysMac() net.HardwareAddr |
| 5581 | GetActorPortPriority() uint16 |
| 5582 | GetActorPortNum() uint16 |
| 5583 | GetActorKey() uint16 |
| 5584 | } |
| 5585 | |
| 5586 | func (self *BsnSetLacpRequest) GetEnabled() uint8 { |
| 5587 | return self.Enabled |
| 5588 | } |
| 5589 | |
| 5590 | func (self *BsnSetLacpRequest) SetEnabled(v uint8) { |
| 5591 | self.Enabled = v |
| 5592 | } |
| 5593 | |
| 5594 | func (self *BsnSetLacpRequest) GetPortNo() Port { |
| 5595 | return self.PortNo |
| 5596 | } |
| 5597 | |
| 5598 | func (self *BsnSetLacpRequest) SetPortNo(v Port) { |
| 5599 | self.PortNo = v |
| 5600 | } |
| 5601 | |
| 5602 | func (self *BsnSetLacpRequest) GetActorSysPriority() uint16 { |
| 5603 | return self.ActorSysPriority |
| 5604 | } |
| 5605 | |
| 5606 | func (self *BsnSetLacpRequest) SetActorSysPriority(v uint16) { |
| 5607 | self.ActorSysPriority = v |
| 5608 | } |
| 5609 | |
| 5610 | func (self *BsnSetLacpRequest) GetActorSysMac() net.HardwareAddr { |
| 5611 | return self.ActorSysMac |
| 5612 | } |
| 5613 | |
| 5614 | func (self *BsnSetLacpRequest) SetActorSysMac(v net.HardwareAddr) { |
| 5615 | self.ActorSysMac = v |
| 5616 | } |
| 5617 | |
| 5618 | func (self *BsnSetLacpRequest) GetActorPortPriority() uint16 { |
| 5619 | return self.ActorPortPriority |
| 5620 | } |
| 5621 | |
| 5622 | func (self *BsnSetLacpRequest) SetActorPortPriority(v uint16) { |
| 5623 | self.ActorPortPriority = v |
| 5624 | } |
| 5625 | |
| 5626 | func (self *BsnSetLacpRequest) GetActorPortNum() uint16 { |
| 5627 | return self.ActorPortNum |
| 5628 | } |
| 5629 | |
| 5630 | func (self *BsnSetLacpRequest) SetActorPortNum(v uint16) { |
| 5631 | self.ActorPortNum = v |
| 5632 | } |
| 5633 | |
| 5634 | func (self *BsnSetLacpRequest) GetActorKey() uint16 { |
| 5635 | return self.ActorKey |
| 5636 | } |
| 5637 | |
| 5638 | func (self *BsnSetLacpRequest) SetActorKey(v uint16) { |
| 5639 | self.ActorKey = v |
| 5640 | } |
| 5641 | |
| 5642 | func (self *BsnSetLacpRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5643 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5644 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5645 | return err |
| 5646 | } |
| 5647 | |
| 5648 | encoder.PutUint8(uint8(self.Enabled)) |
| 5649 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 5650 | self.PortNo.Serialize(encoder) |
| 5651 | encoder.PutUint16(uint16(self.ActorSysPriority)) |
| 5652 | encoder.Write(self.ActorSysMac) |
| 5653 | encoder.PutUint16(uint16(self.ActorPortPriority)) |
| 5654 | encoder.PutUint16(uint16(self.ActorPortNum)) |
| 5655 | encoder.PutUint16(uint16(self.ActorKey)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5656 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5657 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5658 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5659 | |
| 5660 | return nil |
| 5661 | } |
| 5662 | |
| 5663 | func DecodeBsnSetLacpRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetLacpRequest, error) { |
| 5664 | _bsnsetlacprequest := &BsnSetLacpRequest{BsnHeader: parent} |
| 5665 | if decoder.Length() < 22 { |
| 5666 | return nil, fmt.Errorf("BsnSetLacpRequest packet too short: %d < 22", decoder.Length()) |
| 5667 | } |
| 5668 | _bsnsetlacprequest.Enabled = uint8(decoder.ReadByte()) |
| 5669 | decoder.Skip(3) |
| 5670 | _bsnsetlacprequest.PortNo.Decode(decoder) |
| 5671 | _bsnsetlacprequest.ActorSysPriority = uint16(decoder.ReadUint16()) |
| 5672 | _bsnsetlacprequest.ActorSysMac = net.HardwareAddr(decoder.Read(6)) |
| 5673 | _bsnsetlacprequest.ActorPortPriority = uint16(decoder.ReadUint16()) |
| 5674 | _bsnsetlacprequest.ActorPortNum = uint16(decoder.ReadUint16()) |
| 5675 | _bsnsetlacprequest.ActorKey = uint16(decoder.ReadUint16()) |
| 5676 | return _bsnsetlacprequest, nil |
| 5677 | } |
| 5678 | |
| 5679 | func NewBsnSetLacpRequest() *BsnSetLacpRequest { |
| 5680 | obj := &BsnSetLacpRequest{ |
| 5681 | BsnHeader: NewBsnHeader(41), |
| 5682 | } |
| 5683 | return obj |
| 5684 | } |
| 5685 | |
| 5686 | type BsnSetMirroring struct { |
| 5687 | *BsnHeader |
| 5688 | ReportMirrorPorts uint8 |
| 5689 | } |
| 5690 | |
| 5691 | type IBsnSetMirroring interface { |
| 5692 | IBsnHeader |
| 5693 | GetReportMirrorPorts() uint8 |
| 5694 | } |
| 5695 | |
| 5696 | func (self *BsnSetMirroring) GetReportMirrorPorts() uint8 { |
| 5697 | return self.ReportMirrorPorts |
| 5698 | } |
| 5699 | |
| 5700 | func (self *BsnSetMirroring) SetReportMirrorPorts(v uint8) { |
| 5701 | self.ReportMirrorPorts = v |
| 5702 | } |
| 5703 | |
| 5704 | func (self *BsnSetMirroring) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5705 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5706 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5707 | return err |
| 5708 | } |
| 5709 | |
| 5710 | encoder.PutUint8(uint8(self.ReportMirrorPorts)) |
| 5711 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5712 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5713 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5714 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5715 | |
| 5716 | return nil |
| 5717 | } |
| 5718 | |
| 5719 | func DecodeBsnSetMirroring(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetMirroring, error) { |
| 5720 | _bsnsetmirroring := &BsnSetMirroring{BsnHeader: parent} |
| 5721 | if decoder.Length() < 4 { |
| 5722 | return nil, fmt.Errorf("BsnSetMirroring packet too short: %d < 4", decoder.Length()) |
| 5723 | } |
| 5724 | _bsnsetmirroring.ReportMirrorPorts = uint8(decoder.ReadByte()) |
| 5725 | decoder.Skip(3) |
| 5726 | return _bsnsetmirroring, nil |
| 5727 | } |
| 5728 | |
| 5729 | func NewBsnSetMirroring() *BsnSetMirroring { |
| 5730 | obj := &BsnSetMirroring{ |
| 5731 | BsnHeader: NewBsnHeader(3), |
| 5732 | } |
| 5733 | return obj |
| 5734 | } |
| 5735 | |
| 5736 | type BsnSetPktinSuppressionReply struct { |
| 5737 | *BsnHeader |
| 5738 | Status uint32 |
| 5739 | } |
| 5740 | |
| 5741 | type IBsnSetPktinSuppressionReply interface { |
| 5742 | IBsnHeader |
| 5743 | GetStatus() uint32 |
| 5744 | } |
| 5745 | |
| 5746 | func (self *BsnSetPktinSuppressionReply) GetStatus() uint32 { |
| 5747 | return self.Status |
| 5748 | } |
| 5749 | |
| 5750 | func (self *BsnSetPktinSuppressionReply) SetStatus(v uint32) { |
| 5751 | self.Status = v |
| 5752 | } |
| 5753 | |
| 5754 | func (self *BsnSetPktinSuppressionReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5755 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5756 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5757 | return err |
| 5758 | } |
| 5759 | |
| 5760 | encoder.PutUint32(uint32(self.Status)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5761 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5762 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5763 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5764 | |
| 5765 | return nil |
| 5766 | } |
| 5767 | |
| 5768 | func DecodeBsnSetPktinSuppressionReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetPktinSuppressionReply, error) { |
| 5769 | _bsnsetpktinsuppressionreply := &BsnSetPktinSuppressionReply{BsnHeader: parent} |
| 5770 | if decoder.Length() < 4 { |
| 5771 | return nil, fmt.Errorf("BsnSetPktinSuppressionReply packet too short: %d < 4", decoder.Length()) |
| 5772 | } |
| 5773 | _bsnsetpktinsuppressionreply.Status = uint32(decoder.ReadUint32()) |
| 5774 | return _bsnsetpktinsuppressionreply, nil |
| 5775 | } |
| 5776 | |
| 5777 | func NewBsnSetPktinSuppressionReply() *BsnSetPktinSuppressionReply { |
| 5778 | obj := &BsnSetPktinSuppressionReply{ |
| 5779 | BsnHeader: NewBsnHeader(25), |
| 5780 | } |
| 5781 | return obj |
| 5782 | } |
| 5783 | |
| 5784 | type BsnSetPktinSuppressionRequest struct { |
| 5785 | *BsnHeader |
| 5786 | Enabled uint8 |
| 5787 | IdleTimeout uint16 |
| 5788 | HardTimeout uint16 |
| 5789 | Priority uint16 |
| 5790 | Cookie uint64 |
| 5791 | } |
| 5792 | |
| 5793 | type IBsnSetPktinSuppressionRequest interface { |
| 5794 | IBsnHeader |
| 5795 | GetEnabled() uint8 |
| 5796 | GetIdleTimeout() uint16 |
| 5797 | GetHardTimeout() uint16 |
| 5798 | GetPriority() uint16 |
| 5799 | GetCookie() uint64 |
| 5800 | } |
| 5801 | |
| 5802 | func (self *BsnSetPktinSuppressionRequest) GetEnabled() uint8 { |
| 5803 | return self.Enabled |
| 5804 | } |
| 5805 | |
| 5806 | func (self *BsnSetPktinSuppressionRequest) SetEnabled(v uint8) { |
| 5807 | self.Enabled = v |
| 5808 | } |
| 5809 | |
| 5810 | func (self *BsnSetPktinSuppressionRequest) GetIdleTimeout() uint16 { |
| 5811 | return self.IdleTimeout |
| 5812 | } |
| 5813 | |
| 5814 | func (self *BsnSetPktinSuppressionRequest) SetIdleTimeout(v uint16) { |
| 5815 | self.IdleTimeout = v |
| 5816 | } |
| 5817 | |
| 5818 | func (self *BsnSetPktinSuppressionRequest) GetHardTimeout() uint16 { |
| 5819 | return self.HardTimeout |
| 5820 | } |
| 5821 | |
| 5822 | func (self *BsnSetPktinSuppressionRequest) SetHardTimeout(v uint16) { |
| 5823 | self.HardTimeout = v |
| 5824 | } |
| 5825 | |
| 5826 | func (self *BsnSetPktinSuppressionRequest) GetPriority() uint16 { |
| 5827 | return self.Priority |
| 5828 | } |
| 5829 | |
| 5830 | func (self *BsnSetPktinSuppressionRequest) SetPriority(v uint16) { |
| 5831 | self.Priority = v |
| 5832 | } |
| 5833 | |
| 5834 | func (self *BsnSetPktinSuppressionRequest) GetCookie() uint64 { |
| 5835 | return self.Cookie |
| 5836 | } |
| 5837 | |
| 5838 | func (self *BsnSetPktinSuppressionRequest) SetCookie(v uint64) { |
| 5839 | self.Cookie = v |
| 5840 | } |
| 5841 | |
| 5842 | func (self *BsnSetPktinSuppressionRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5843 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5844 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5845 | return err |
| 5846 | } |
| 5847 | |
| 5848 | encoder.PutUint8(uint8(self.Enabled)) |
| 5849 | encoder.Write(bytes.Repeat([]byte{0}, 1)) |
| 5850 | encoder.PutUint16(uint16(self.IdleTimeout)) |
| 5851 | encoder.PutUint16(uint16(self.HardTimeout)) |
| 5852 | encoder.PutUint16(uint16(self.Priority)) |
| 5853 | encoder.PutUint64(uint64(self.Cookie)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5854 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5855 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5856 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5857 | |
| 5858 | return nil |
| 5859 | } |
| 5860 | |
| 5861 | func DecodeBsnSetPktinSuppressionRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetPktinSuppressionRequest, error) { |
| 5862 | _bsnsetpktinsuppressionrequest := &BsnSetPktinSuppressionRequest{BsnHeader: parent} |
| 5863 | if decoder.Length() < 16 { |
| 5864 | return nil, fmt.Errorf("BsnSetPktinSuppressionRequest packet too short: %d < 16", decoder.Length()) |
| 5865 | } |
| 5866 | _bsnsetpktinsuppressionrequest.Enabled = uint8(decoder.ReadByte()) |
| 5867 | decoder.Skip(1) |
| 5868 | _bsnsetpktinsuppressionrequest.IdleTimeout = uint16(decoder.ReadUint16()) |
| 5869 | _bsnsetpktinsuppressionrequest.HardTimeout = uint16(decoder.ReadUint16()) |
| 5870 | _bsnsetpktinsuppressionrequest.Priority = uint16(decoder.ReadUint16()) |
| 5871 | _bsnsetpktinsuppressionrequest.Cookie = uint64(decoder.ReadUint64()) |
| 5872 | return _bsnsetpktinsuppressionrequest, nil |
| 5873 | } |
| 5874 | |
| 5875 | func NewBsnSetPktinSuppressionRequest() *BsnSetPktinSuppressionRequest { |
| 5876 | obj := &BsnSetPktinSuppressionRequest{ |
| 5877 | BsnHeader: NewBsnHeader(11), |
| 5878 | } |
| 5879 | return obj |
| 5880 | } |
| 5881 | |
| 5882 | type BsnSetSwitchPipelineReply struct { |
| 5883 | *BsnHeader |
| 5884 | Status uint32 |
| 5885 | } |
| 5886 | |
| 5887 | type IBsnSetSwitchPipelineReply interface { |
| 5888 | IBsnHeader |
| 5889 | GetStatus() uint32 |
| 5890 | } |
| 5891 | |
| 5892 | func (self *BsnSetSwitchPipelineReply) GetStatus() uint32 { |
| 5893 | return self.Status |
| 5894 | } |
| 5895 | |
| 5896 | func (self *BsnSetSwitchPipelineReply) SetStatus(v uint32) { |
| 5897 | self.Status = v |
| 5898 | } |
| 5899 | |
| 5900 | func (self *BsnSetSwitchPipelineReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5901 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5902 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5903 | return err |
| 5904 | } |
| 5905 | |
| 5906 | encoder.PutUint32(uint32(self.Status)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5907 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5908 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5909 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5910 | |
| 5911 | return nil |
| 5912 | } |
| 5913 | |
| 5914 | func DecodeBsnSetSwitchPipelineReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetSwitchPipelineReply, error) { |
| 5915 | _bsnsetswitchpipelinereply := &BsnSetSwitchPipelineReply{BsnHeader: parent} |
| 5916 | if decoder.Length() < 4 { |
| 5917 | return nil, fmt.Errorf("BsnSetSwitchPipelineReply packet too short: %d < 4", decoder.Length()) |
| 5918 | } |
| 5919 | _bsnsetswitchpipelinereply.Status = uint32(decoder.ReadUint32()) |
| 5920 | return _bsnsetswitchpipelinereply, nil |
| 5921 | } |
| 5922 | |
| 5923 | func NewBsnSetSwitchPipelineReply() *BsnSetSwitchPipelineReply { |
| 5924 | obj := &BsnSetSwitchPipelineReply{ |
| 5925 | BsnHeader: NewBsnHeader(54), |
| 5926 | } |
| 5927 | return obj |
| 5928 | } |
| 5929 | |
| 5930 | type BsnSetSwitchPipelineRequest struct { |
| 5931 | *BsnHeader |
| 5932 | Pipeline string |
| 5933 | } |
| 5934 | |
| 5935 | type IBsnSetSwitchPipelineRequest interface { |
| 5936 | IBsnHeader |
| 5937 | GetPipeline() string |
| 5938 | } |
| 5939 | |
| 5940 | func (self *BsnSetSwitchPipelineRequest) GetPipeline() string { |
| 5941 | return self.Pipeline |
| 5942 | } |
| 5943 | |
| 5944 | func (self *BsnSetSwitchPipelineRequest) SetPipeline(v string) { |
| 5945 | self.Pipeline = v |
| 5946 | } |
| 5947 | |
| 5948 | func (self *BsnSetSwitchPipelineRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5949 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5950 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 5951 | return err |
| 5952 | } |
| 5953 | |
| 5954 | encoder.Write([]byte(self.Pipeline)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5955 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5956 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5957 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5958 | |
| 5959 | return nil |
| 5960 | } |
| 5961 | |
| 5962 | func DecodeBsnSetSwitchPipelineRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetSwitchPipelineRequest, error) { |
| 5963 | _bsnsetswitchpipelinerequest := &BsnSetSwitchPipelineRequest{BsnHeader: parent} |
| 5964 | if decoder.Length() < 256 { |
| 5965 | return nil, fmt.Errorf("BsnSetSwitchPipelineRequest packet too short: %d < 256", decoder.Length()) |
| 5966 | } |
| 5967 | _bsnsetswitchpipelinerequest.Pipeline = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 5968 | return _bsnsetswitchpipelinerequest, nil |
| 5969 | } |
| 5970 | |
| 5971 | func NewBsnSetSwitchPipelineRequest() *BsnSetSwitchPipelineRequest { |
| 5972 | obj := &BsnSetSwitchPipelineRequest{ |
| 5973 | BsnHeader: NewBsnHeader(53), |
| 5974 | } |
| 5975 | return obj |
| 5976 | } |
| 5977 | |
| 5978 | type BsnSwitchPipelineStatsReply struct { |
| 5979 | *BsnStatsReply |
| 5980 | Entries []*BsnSwitchPipelineStatsEntry |
| 5981 | } |
| 5982 | |
| 5983 | type IBsnSwitchPipelineStatsReply interface { |
| 5984 | IBsnStatsReply |
| 5985 | GetEntries() []*BsnSwitchPipelineStatsEntry |
| 5986 | } |
| 5987 | |
| 5988 | func (self *BsnSwitchPipelineStatsReply) GetEntries() []*BsnSwitchPipelineStatsEntry { |
| 5989 | return self.Entries |
| 5990 | } |
| 5991 | |
| 5992 | func (self *BsnSwitchPipelineStatsReply) SetEntries(v []*BsnSwitchPipelineStatsEntry) { |
| 5993 | self.Entries = v |
| 5994 | } |
| 5995 | |
| 5996 | func (self *BsnSwitchPipelineStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 5997 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 5998 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 5999 | return err |
| 6000 | } |
| 6001 | |
| 6002 | for _, obj := range self.Entries { |
| 6003 | if err := obj.Serialize(encoder); err != nil { |
| 6004 | return err |
| 6005 | } |
| 6006 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6007 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6008 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6009 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6010 | |
| 6011 | return nil |
| 6012 | } |
| 6013 | |
| 6014 | func DecodeBsnSwitchPipelineStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnSwitchPipelineStatsReply, error) { |
| 6015 | _bsnswitchpipelinestatsreply := &BsnSwitchPipelineStatsReply{BsnStatsReply: parent} |
| 6016 | |
| 6017 | for decoder.Length() >= 256 { |
| 6018 | item, err := DecodeBsnSwitchPipelineStatsEntry(decoder) |
| 6019 | if err != nil { |
| 6020 | return nil, err |
| 6021 | } |
| 6022 | if item != nil { |
| 6023 | _bsnswitchpipelinestatsreply.Entries = append(_bsnswitchpipelinestatsreply.Entries, item) |
| 6024 | } |
| 6025 | } |
| 6026 | return _bsnswitchpipelinestatsreply, nil |
| 6027 | } |
| 6028 | |
| 6029 | func NewBsnSwitchPipelineStatsReply() *BsnSwitchPipelineStatsReply { |
| 6030 | obj := &BsnSwitchPipelineStatsReply{ |
| 6031 | BsnStatsReply: NewBsnStatsReply(6), |
| 6032 | } |
| 6033 | return obj |
| 6034 | } |
| 6035 | |
| 6036 | type BsnSwitchPipelineStatsRequest struct { |
| 6037 | *BsnStatsRequest |
| 6038 | } |
| 6039 | |
| 6040 | type IBsnSwitchPipelineStatsRequest interface { |
| 6041 | IBsnStatsRequest |
| 6042 | } |
| 6043 | |
| 6044 | func (self *BsnSwitchPipelineStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6045 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6046 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 6047 | return err |
| 6048 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6049 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6050 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6051 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6052 | |
| 6053 | return nil |
| 6054 | } |
| 6055 | |
| 6056 | func DecodeBsnSwitchPipelineStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnSwitchPipelineStatsRequest, error) { |
| 6057 | _bsnswitchpipelinestatsrequest := &BsnSwitchPipelineStatsRequest{BsnStatsRequest: parent} |
| 6058 | return _bsnswitchpipelinestatsrequest, nil |
| 6059 | } |
| 6060 | |
| 6061 | func NewBsnSwitchPipelineStatsRequest() *BsnSwitchPipelineStatsRequest { |
| 6062 | obj := &BsnSwitchPipelineStatsRequest{ |
| 6063 | BsnStatsRequest: NewBsnStatsRequest(6), |
| 6064 | } |
| 6065 | return obj |
| 6066 | } |
| 6067 | |
| 6068 | type BsnTableChecksumStatsReply struct { |
| 6069 | *BsnStatsReply |
| 6070 | Entries []*BsnTableChecksumStatsEntry |
| 6071 | } |
| 6072 | |
| 6073 | type IBsnTableChecksumStatsReply interface { |
| 6074 | IBsnStatsReply |
| 6075 | GetEntries() []*BsnTableChecksumStatsEntry |
| 6076 | } |
| 6077 | |
| 6078 | func (self *BsnTableChecksumStatsReply) GetEntries() []*BsnTableChecksumStatsEntry { |
| 6079 | return self.Entries |
| 6080 | } |
| 6081 | |
| 6082 | func (self *BsnTableChecksumStatsReply) SetEntries(v []*BsnTableChecksumStatsEntry) { |
| 6083 | self.Entries = v |
| 6084 | } |
| 6085 | |
| 6086 | func (self *BsnTableChecksumStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6087 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6088 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 6089 | return err |
| 6090 | } |
| 6091 | |
| 6092 | for _, obj := range self.Entries { |
| 6093 | if err := obj.Serialize(encoder); err != nil { |
| 6094 | return err |
| 6095 | } |
| 6096 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6097 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6098 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6099 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6100 | |
| 6101 | return nil |
| 6102 | } |
| 6103 | |
| 6104 | func DecodeBsnTableChecksumStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnTableChecksumStatsReply, error) { |
| 6105 | _bsntablechecksumstatsreply := &BsnTableChecksumStatsReply{BsnStatsReply: parent} |
| 6106 | |
| 6107 | for decoder.Length() >= 9 { |
| 6108 | item, err := DecodeBsnTableChecksumStatsEntry(decoder) |
| 6109 | if err != nil { |
| 6110 | return nil, err |
| 6111 | } |
| 6112 | if item != nil { |
| 6113 | _bsntablechecksumstatsreply.Entries = append(_bsntablechecksumstatsreply.Entries, item) |
| 6114 | } |
| 6115 | } |
| 6116 | return _bsntablechecksumstatsreply, nil |
| 6117 | } |
| 6118 | |
| 6119 | func NewBsnTableChecksumStatsReply() *BsnTableChecksumStatsReply { |
| 6120 | obj := &BsnTableChecksumStatsReply{ |
| 6121 | BsnStatsReply: NewBsnStatsReply(11), |
| 6122 | } |
| 6123 | return obj |
| 6124 | } |
| 6125 | |
| 6126 | type BsnTableChecksumStatsRequest struct { |
| 6127 | *BsnStatsRequest |
| 6128 | } |
| 6129 | |
| 6130 | type IBsnTableChecksumStatsRequest interface { |
| 6131 | IBsnStatsRequest |
| 6132 | } |
| 6133 | |
| 6134 | func (self *BsnTableChecksumStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6135 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6136 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 6137 | return err |
| 6138 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6139 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6140 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6141 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6142 | |
| 6143 | return nil |
| 6144 | } |
| 6145 | |
| 6146 | func DecodeBsnTableChecksumStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnTableChecksumStatsRequest, error) { |
| 6147 | _bsntablechecksumstatsrequest := &BsnTableChecksumStatsRequest{BsnStatsRequest: parent} |
| 6148 | return _bsntablechecksumstatsrequest, nil |
| 6149 | } |
| 6150 | |
| 6151 | func NewBsnTableChecksumStatsRequest() *BsnTableChecksumStatsRequest { |
| 6152 | obj := &BsnTableChecksumStatsRequest{ |
| 6153 | BsnStatsRequest: NewBsnStatsRequest(11), |
| 6154 | } |
| 6155 | return obj |
| 6156 | } |
| 6157 | |
| 6158 | type BsnTableSetBucketsSize struct { |
| 6159 | *BsnHeader |
| 6160 | TableId uint8 |
| 6161 | BucketsSize uint32 |
| 6162 | } |
| 6163 | |
| 6164 | type IBsnTableSetBucketsSize interface { |
| 6165 | IBsnHeader |
| 6166 | GetTableId() uint8 |
| 6167 | GetBucketsSize() uint32 |
| 6168 | } |
| 6169 | |
| 6170 | func (self *BsnTableSetBucketsSize) GetTableId() uint8 { |
| 6171 | return self.TableId |
| 6172 | } |
| 6173 | |
| 6174 | func (self *BsnTableSetBucketsSize) SetTableId(v uint8) { |
| 6175 | self.TableId = v |
| 6176 | } |
| 6177 | |
| 6178 | func (self *BsnTableSetBucketsSize) GetBucketsSize() uint32 { |
| 6179 | return self.BucketsSize |
| 6180 | } |
| 6181 | |
| 6182 | func (self *BsnTableSetBucketsSize) SetBucketsSize(v uint32) { |
| 6183 | self.BucketsSize = v |
| 6184 | } |
| 6185 | |
| 6186 | func (self *BsnTableSetBucketsSize) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6187 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6188 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6189 | return err |
| 6190 | } |
| 6191 | |
| 6192 | encoder.Write(bytes.Repeat([]byte{0}, 1)) |
| 6193 | encoder.PutUint8(uint8(self.TableId)) |
| 6194 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 6195 | encoder.PutUint32(uint32(self.BucketsSize)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6196 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6197 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6198 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6199 | |
| 6200 | return nil |
| 6201 | } |
| 6202 | |
| 6203 | func DecodeBsnTableSetBucketsSize(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnTableSetBucketsSize, error) { |
| 6204 | _bsntablesetbucketssize := &BsnTableSetBucketsSize{BsnHeader: parent} |
| 6205 | if decoder.Length() < 8 { |
| 6206 | return nil, fmt.Errorf("BsnTableSetBucketsSize packet too short: %d < 8", decoder.Length()) |
| 6207 | } |
| 6208 | decoder.Skip(1) |
| 6209 | _bsntablesetbucketssize.TableId = uint8(decoder.ReadByte()) |
| 6210 | decoder.Skip(2) |
| 6211 | _bsntablesetbucketssize.BucketsSize = uint32(decoder.ReadUint32()) |
| 6212 | return _bsntablesetbucketssize, nil |
| 6213 | } |
| 6214 | |
| 6215 | func NewBsnTableSetBucketsSize() *BsnTableSetBucketsSize { |
| 6216 | obj := &BsnTableSetBucketsSize{ |
| 6217 | BsnHeader: NewBsnHeader(61), |
| 6218 | } |
| 6219 | return obj |
| 6220 | } |
| 6221 | |
| 6222 | type BsnTimeReply struct { |
| 6223 | *BsnHeader |
| 6224 | TimeMs uint64 |
| 6225 | } |
| 6226 | |
| 6227 | type IBsnTimeReply interface { |
| 6228 | IBsnHeader |
| 6229 | GetTimeMs() uint64 |
| 6230 | } |
| 6231 | |
| 6232 | func (self *BsnTimeReply) GetTimeMs() uint64 { |
| 6233 | return self.TimeMs |
| 6234 | } |
| 6235 | |
| 6236 | func (self *BsnTimeReply) SetTimeMs(v uint64) { |
| 6237 | self.TimeMs = v |
| 6238 | } |
| 6239 | |
| 6240 | func (self *BsnTimeReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6241 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6242 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6243 | return err |
| 6244 | } |
| 6245 | |
| 6246 | encoder.PutUint64(uint64(self.TimeMs)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6247 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6248 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6249 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6250 | |
| 6251 | return nil |
| 6252 | } |
| 6253 | |
| 6254 | func DecodeBsnTimeReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnTimeReply, error) { |
| 6255 | _bsntimereply := &BsnTimeReply{BsnHeader: parent} |
| 6256 | if decoder.Length() < 8 { |
| 6257 | return nil, fmt.Errorf("BsnTimeReply packet too short: %d < 8", decoder.Length()) |
| 6258 | } |
| 6259 | _bsntimereply.TimeMs = uint64(decoder.ReadUint64()) |
| 6260 | return _bsntimereply, nil |
| 6261 | } |
| 6262 | |
| 6263 | func NewBsnTimeReply() *BsnTimeReply { |
| 6264 | obj := &BsnTimeReply{ |
| 6265 | BsnHeader: NewBsnHeader(45), |
| 6266 | } |
| 6267 | return obj |
| 6268 | } |
| 6269 | |
| 6270 | type BsnTimeRequest struct { |
| 6271 | *BsnHeader |
| 6272 | } |
| 6273 | |
| 6274 | type IBsnTimeRequest interface { |
| 6275 | IBsnHeader |
| 6276 | } |
| 6277 | |
| 6278 | func (self *BsnTimeRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6279 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6280 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6281 | return err |
| 6282 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6283 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6284 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6285 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6286 | |
| 6287 | return nil |
| 6288 | } |
| 6289 | |
| 6290 | func DecodeBsnTimeRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnTimeRequest, error) { |
| 6291 | _bsntimerequest := &BsnTimeRequest{BsnHeader: parent} |
| 6292 | return _bsntimerequest, nil |
| 6293 | } |
| 6294 | |
| 6295 | func NewBsnTimeRequest() *BsnTimeRequest { |
| 6296 | obj := &BsnTimeRequest{ |
| 6297 | BsnHeader: NewBsnHeader(44), |
| 6298 | } |
| 6299 | return obj |
| 6300 | } |
| 6301 | |
| 6302 | type BsnVirtualPortCreateReply struct { |
| 6303 | *BsnHeader |
| 6304 | Status uint32 |
| 6305 | VportNo uint32 |
| 6306 | } |
| 6307 | |
| 6308 | type IBsnVirtualPortCreateReply interface { |
| 6309 | IBsnHeader |
| 6310 | GetStatus() uint32 |
| 6311 | GetVportNo() uint32 |
| 6312 | } |
| 6313 | |
| 6314 | func (self *BsnVirtualPortCreateReply) GetStatus() uint32 { |
| 6315 | return self.Status |
| 6316 | } |
| 6317 | |
| 6318 | func (self *BsnVirtualPortCreateReply) SetStatus(v uint32) { |
| 6319 | self.Status = v |
| 6320 | } |
| 6321 | |
| 6322 | func (self *BsnVirtualPortCreateReply) GetVportNo() uint32 { |
| 6323 | return self.VportNo |
| 6324 | } |
| 6325 | |
| 6326 | func (self *BsnVirtualPortCreateReply) SetVportNo(v uint32) { |
| 6327 | self.VportNo = v |
| 6328 | } |
| 6329 | |
| 6330 | func (self *BsnVirtualPortCreateReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6331 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6332 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6333 | return err |
| 6334 | } |
| 6335 | |
| 6336 | encoder.PutUint32(uint32(self.Status)) |
| 6337 | encoder.PutUint32(uint32(self.VportNo)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6338 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6339 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6340 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6341 | |
| 6342 | return nil |
| 6343 | } |
| 6344 | |
| 6345 | func DecodeBsnVirtualPortCreateReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnVirtualPortCreateReply, error) { |
| 6346 | _bsnvirtualportcreatereply := &BsnVirtualPortCreateReply{BsnHeader: parent} |
| 6347 | if decoder.Length() < 8 { |
| 6348 | return nil, fmt.Errorf("BsnVirtualPortCreateReply packet too short: %d < 8", decoder.Length()) |
| 6349 | } |
| 6350 | _bsnvirtualportcreatereply.Status = uint32(decoder.ReadUint32()) |
| 6351 | _bsnvirtualportcreatereply.VportNo = uint32(decoder.ReadUint32()) |
| 6352 | return _bsnvirtualportcreatereply, nil |
| 6353 | } |
| 6354 | |
| 6355 | func NewBsnVirtualPortCreateReply() *BsnVirtualPortCreateReply { |
| 6356 | obj := &BsnVirtualPortCreateReply{ |
| 6357 | BsnHeader: NewBsnHeader(16), |
| 6358 | } |
| 6359 | return obj |
| 6360 | } |
| 6361 | |
| 6362 | type BsnVirtualPortCreateRequest struct { |
| 6363 | *BsnHeader |
| 6364 | Vport BSNVport |
| 6365 | } |
| 6366 | |
| 6367 | type IBsnVirtualPortCreateRequest interface { |
| 6368 | IBsnHeader |
| 6369 | GetVport() BSNVport |
| 6370 | } |
| 6371 | |
| 6372 | func (self *BsnVirtualPortCreateRequest) GetVport() BSNVport { |
| 6373 | return self.Vport |
| 6374 | } |
| 6375 | |
| 6376 | func (self *BsnVirtualPortCreateRequest) SetVport(v BSNVport) { |
| 6377 | self.Vport = v |
| 6378 | } |
| 6379 | |
| 6380 | func (self *BsnVirtualPortCreateRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6381 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6382 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6383 | return err |
| 6384 | } |
| 6385 | |
| 6386 | if err := self.Vport.Serialize(encoder); err != nil { |
| 6387 | return err |
| 6388 | } |
| 6389 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6390 | length := len(encoder.Bytes()) - startIndex |
| 6391 | |
| 6392 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6393 | |
| 6394 | return nil |
| 6395 | } |
| 6396 | |
| 6397 | func DecodeBsnVirtualPortCreateRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnVirtualPortCreateRequest, error) { |
| 6398 | _bsnvirtualportcreaterequest := &BsnVirtualPortCreateRequest{BsnHeader: parent} |
| 6399 | if decoder.Length() < 4 { |
| 6400 | return nil, fmt.Errorf("BsnVirtualPortCreateRequest packet too short: %d < 4", decoder.Length()) |
| 6401 | } |
| 6402 | if err := _bsnvirtualportcreaterequest.Vport.Decode(decoder); err != nil { |
| 6403 | return nil, err |
| 6404 | } |
| 6405 | |
| 6406 | return _bsnvirtualportcreaterequest, nil |
| 6407 | } |
| 6408 | |
| 6409 | func NewBsnVirtualPortCreateRequest() *BsnVirtualPortCreateRequest { |
| 6410 | obj := &BsnVirtualPortCreateRequest{ |
| 6411 | BsnHeader: NewBsnHeader(15), |
| 6412 | } |
| 6413 | return obj |
| 6414 | } |
| 6415 | |
| 6416 | type BsnVirtualPortRemoveReply struct { |
| 6417 | *BsnHeader |
| 6418 | Status uint32 |
| 6419 | } |
| 6420 | |
| 6421 | type IBsnVirtualPortRemoveReply interface { |
| 6422 | IBsnHeader |
| 6423 | GetStatus() uint32 |
| 6424 | } |
| 6425 | |
| 6426 | func (self *BsnVirtualPortRemoveReply) GetStatus() uint32 { |
| 6427 | return self.Status |
| 6428 | } |
| 6429 | |
| 6430 | func (self *BsnVirtualPortRemoveReply) SetStatus(v uint32) { |
| 6431 | self.Status = v |
| 6432 | } |
| 6433 | |
| 6434 | func (self *BsnVirtualPortRemoveReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6435 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6436 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6437 | return err |
| 6438 | } |
| 6439 | |
| 6440 | encoder.PutUint32(uint32(self.Status)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6441 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6442 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6443 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6444 | |
| 6445 | return nil |
| 6446 | } |
| 6447 | |
| 6448 | func DecodeBsnVirtualPortRemoveReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnVirtualPortRemoveReply, error) { |
| 6449 | _bsnvirtualportremovereply := &BsnVirtualPortRemoveReply{BsnHeader: parent} |
| 6450 | if decoder.Length() < 4 { |
| 6451 | return nil, fmt.Errorf("BsnVirtualPortRemoveReply packet too short: %d < 4", decoder.Length()) |
| 6452 | } |
| 6453 | _bsnvirtualportremovereply.Status = uint32(decoder.ReadUint32()) |
| 6454 | return _bsnvirtualportremovereply, nil |
| 6455 | } |
| 6456 | |
| 6457 | func NewBsnVirtualPortRemoveReply() *BsnVirtualPortRemoveReply { |
| 6458 | obj := &BsnVirtualPortRemoveReply{ |
| 6459 | BsnHeader: NewBsnHeader(26), |
| 6460 | } |
| 6461 | return obj |
| 6462 | } |
| 6463 | |
| 6464 | type BsnVirtualPortRemoveRequest struct { |
| 6465 | *BsnHeader |
| 6466 | VportNo uint32 |
| 6467 | } |
| 6468 | |
| 6469 | type IBsnVirtualPortRemoveRequest interface { |
| 6470 | IBsnHeader |
| 6471 | GetVportNo() uint32 |
| 6472 | } |
| 6473 | |
| 6474 | func (self *BsnVirtualPortRemoveRequest) GetVportNo() uint32 { |
| 6475 | return self.VportNo |
| 6476 | } |
| 6477 | |
| 6478 | func (self *BsnVirtualPortRemoveRequest) SetVportNo(v uint32) { |
| 6479 | self.VportNo = v |
| 6480 | } |
| 6481 | |
| 6482 | func (self *BsnVirtualPortRemoveRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6483 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6484 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6485 | return err |
| 6486 | } |
| 6487 | |
| 6488 | encoder.PutUint32(uint32(self.VportNo)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6489 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6490 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6491 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6492 | |
| 6493 | return nil |
| 6494 | } |
| 6495 | |
| 6496 | func DecodeBsnVirtualPortRemoveRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnVirtualPortRemoveRequest, error) { |
| 6497 | _bsnvirtualportremoverequest := &BsnVirtualPortRemoveRequest{BsnHeader: parent} |
| 6498 | if decoder.Length() < 4 { |
| 6499 | return nil, fmt.Errorf("BsnVirtualPortRemoveRequest packet too short: %d < 4", decoder.Length()) |
| 6500 | } |
| 6501 | _bsnvirtualportremoverequest.VportNo = uint32(decoder.ReadUint32()) |
| 6502 | return _bsnvirtualportremoverequest, nil |
| 6503 | } |
| 6504 | |
| 6505 | func NewBsnVirtualPortRemoveRequest() *BsnVirtualPortRemoveRequest { |
| 6506 | obj := &BsnVirtualPortRemoveRequest{ |
| 6507 | BsnHeader: NewBsnHeader(17), |
| 6508 | } |
| 6509 | return obj |
| 6510 | } |
| 6511 | |
| 6512 | type BsnVlanCounterClear struct { |
| 6513 | *BsnHeader |
| 6514 | VlanVid uint16 |
| 6515 | } |
| 6516 | |
| 6517 | type IBsnVlanCounterClear interface { |
| 6518 | IBsnHeader |
| 6519 | GetVlanVid() uint16 |
| 6520 | } |
| 6521 | |
| 6522 | func (self *BsnVlanCounterClear) GetVlanVid() uint16 { |
| 6523 | return self.VlanVid |
| 6524 | } |
| 6525 | |
| 6526 | func (self *BsnVlanCounterClear) SetVlanVid(v uint16) { |
| 6527 | self.VlanVid = v |
| 6528 | } |
| 6529 | |
| 6530 | func (self *BsnVlanCounterClear) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6531 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6532 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 6533 | return err |
| 6534 | } |
| 6535 | |
| 6536 | encoder.PutUint16(uint16(self.VlanVid)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6537 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6538 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6539 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6540 | |
| 6541 | return nil |
| 6542 | } |
| 6543 | |
| 6544 | func DecodeBsnVlanCounterClear(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnVlanCounterClear, error) { |
| 6545 | _bsnvlancounterclear := &BsnVlanCounterClear{BsnHeader: parent} |
| 6546 | if decoder.Length() < 2 { |
| 6547 | return nil, fmt.Errorf("BsnVlanCounterClear packet too short: %d < 2", decoder.Length()) |
| 6548 | } |
| 6549 | _bsnvlancounterclear.VlanVid = uint16(decoder.ReadUint16()) |
| 6550 | return _bsnvlancounterclear, nil |
| 6551 | } |
| 6552 | |
| 6553 | func NewBsnVlanCounterClear() *BsnVlanCounterClear { |
| 6554 | obj := &BsnVlanCounterClear{ |
| 6555 | BsnHeader: NewBsnHeader(70), |
| 6556 | } |
| 6557 | return obj |
| 6558 | } |
| 6559 | |
| 6560 | type BsnVlanCounterStatsReply struct { |
| 6561 | *BsnStatsReply |
| 6562 | Entries []*BsnVlanCounterStatsEntry |
| 6563 | } |
| 6564 | |
| 6565 | type IBsnVlanCounterStatsReply interface { |
| 6566 | IBsnStatsReply |
| 6567 | GetEntries() []*BsnVlanCounterStatsEntry |
| 6568 | } |
| 6569 | |
| 6570 | func (self *BsnVlanCounterStatsReply) GetEntries() []*BsnVlanCounterStatsEntry { |
| 6571 | return self.Entries |
| 6572 | } |
| 6573 | |
| 6574 | func (self *BsnVlanCounterStatsReply) SetEntries(v []*BsnVlanCounterStatsEntry) { |
| 6575 | self.Entries = v |
| 6576 | } |
| 6577 | |
| 6578 | func (self *BsnVlanCounterStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6579 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6580 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 6581 | return err |
| 6582 | } |
| 6583 | |
| 6584 | for _, obj := range self.Entries { |
| 6585 | if err := obj.Serialize(encoder); err != nil { |
| 6586 | return err |
| 6587 | } |
| 6588 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6589 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6590 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6591 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6592 | |
| 6593 | return nil |
| 6594 | } |
| 6595 | |
| 6596 | func DecodeBsnVlanCounterStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnVlanCounterStatsReply, error) { |
| 6597 | _bsnvlancounterstatsreply := &BsnVlanCounterStatsReply{BsnStatsReply: parent} |
| 6598 | |
| 6599 | for decoder.Length() >= 8 { |
| 6600 | item, err := DecodeBsnVlanCounterStatsEntry(decoder) |
| 6601 | if err != nil { |
| 6602 | return nil, err |
| 6603 | } |
| 6604 | if item != nil { |
| 6605 | _bsnvlancounterstatsreply.Entries = append(_bsnvlancounterstatsreply.Entries, item) |
| 6606 | } |
| 6607 | } |
| 6608 | return _bsnvlancounterstatsreply, nil |
| 6609 | } |
| 6610 | |
| 6611 | func NewBsnVlanCounterStatsReply() *BsnVlanCounterStatsReply { |
| 6612 | obj := &BsnVlanCounterStatsReply{ |
| 6613 | BsnStatsReply: NewBsnStatsReply(9), |
| 6614 | } |
| 6615 | return obj |
| 6616 | } |
| 6617 | |
| 6618 | type BsnVlanCounterStatsRequest struct { |
| 6619 | *BsnStatsRequest |
| 6620 | VlanVid uint16 |
| 6621 | } |
| 6622 | |
| 6623 | type IBsnVlanCounterStatsRequest interface { |
| 6624 | IBsnStatsRequest |
| 6625 | GetVlanVid() uint16 |
| 6626 | } |
| 6627 | |
| 6628 | func (self *BsnVlanCounterStatsRequest) GetVlanVid() uint16 { |
| 6629 | return self.VlanVid |
| 6630 | } |
| 6631 | |
| 6632 | func (self *BsnVlanCounterStatsRequest) SetVlanVid(v uint16) { |
| 6633 | self.VlanVid = v |
| 6634 | } |
| 6635 | |
| 6636 | func (self *BsnVlanCounterStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6637 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6638 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 6639 | return err |
| 6640 | } |
| 6641 | |
| 6642 | encoder.PutUint16(uint16(self.VlanVid)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6643 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6644 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6645 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6646 | |
| 6647 | return nil |
| 6648 | } |
| 6649 | |
| 6650 | func DecodeBsnVlanCounterStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnVlanCounterStatsRequest, error) { |
| 6651 | _bsnvlancounterstatsrequest := &BsnVlanCounterStatsRequest{BsnStatsRequest: parent} |
| 6652 | if decoder.Length() < 2 { |
| 6653 | return nil, fmt.Errorf("BsnVlanCounterStatsRequest packet too short: %d < 2", decoder.Length()) |
| 6654 | } |
| 6655 | _bsnvlancounterstatsrequest.VlanVid = uint16(decoder.ReadUint16()) |
| 6656 | return _bsnvlancounterstatsrequest, nil |
| 6657 | } |
| 6658 | |
| 6659 | func NewBsnVlanCounterStatsRequest() *BsnVlanCounterStatsRequest { |
| 6660 | obj := &BsnVlanCounterStatsRequest{ |
| 6661 | BsnStatsRequest: NewBsnStatsRequest(9), |
| 6662 | } |
| 6663 | return obj |
| 6664 | } |
| 6665 | |
| 6666 | type BsnVrfCounterStatsReply struct { |
| 6667 | *BsnStatsReply |
| 6668 | Entries []*BsnVrfCounterStatsEntry |
| 6669 | } |
| 6670 | |
| 6671 | type IBsnVrfCounterStatsReply interface { |
| 6672 | IBsnStatsReply |
| 6673 | GetEntries() []*BsnVrfCounterStatsEntry |
| 6674 | } |
| 6675 | |
| 6676 | func (self *BsnVrfCounterStatsReply) GetEntries() []*BsnVrfCounterStatsEntry { |
| 6677 | return self.Entries |
| 6678 | } |
| 6679 | |
| 6680 | func (self *BsnVrfCounterStatsReply) SetEntries(v []*BsnVrfCounterStatsEntry) { |
| 6681 | self.Entries = v |
| 6682 | } |
| 6683 | |
| 6684 | func (self *BsnVrfCounterStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6685 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6686 | if err := self.BsnStatsReply.Serialize(encoder); err != nil { |
| 6687 | return err |
| 6688 | } |
| 6689 | |
| 6690 | for _, obj := range self.Entries { |
| 6691 | if err := obj.Serialize(encoder); err != nil { |
| 6692 | return err |
| 6693 | } |
| 6694 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6695 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6696 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6697 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6698 | |
| 6699 | return nil |
| 6700 | } |
| 6701 | |
| 6702 | func DecodeBsnVrfCounterStatsReply(parent *BsnStatsReply, decoder *goloxi.Decoder) (*BsnVrfCounterStatsReply, error) { |
| 6703 | _bsnvrfcounterstatsreply := &BsnVrfCounterStatsReply{BsnStatsReply: parent} |
| 6704 | |
| 6705 | for decoder.Length() >= 8 { |
| 6706 | item, err := DecodeBsnVrfCounterStatsEntry(decoder) |
| 6707 | if err != nil { |
| 6708 | return nil, err |
| 6709 | } |
| 6710 | if item != nil { |
| 6711 | _bsnvrfcounterstatsreply.Entries = append(_bsnvrfcounterstatsreply.Entries, item) |
| 6712 | } |
| 6713 | } |
| 6714 | return _bsnvrfcounterstatsreply, nil |
| 6715 | } |
| 6716 | |
| 6717 | func NewBsnVrfCounterStatsReply() *BsnVrfCounterStatsReply { |
| 6718 | obj := &BsnVrfCounterStatsReply{ |
| 6719 | BsnStatsReply: NewBsnStatsReply(15), |
| 6720 | } |
| 6721 | return obj |
| 6722 | } |
| 6723 | |
| 6724 | type BsnVrfCounterStatsRequest struct { |
| 6725 | *BsnStatsRequest |
| 6726 | Vrf uint32 |
| 6727 | } |
| 6728 | |
| 6729 | type IBsnVrfCounterStatsRequest interface { |
| 6730 | IBsnStatsRequest |
| 6731 | GetVrf() uint32 |
| 6732 | } |
| 6733 | |
| 6734 | func (self *BsnVrfCounterStatsRequest) GetVrf() uint32 { |
| 6735 | return self.Vrf |
| 6736 | } |
| 6737 | |
| 6738 | func (self *BsnVrfCounterStatsRequest) SetVrf(v uint32) { |
| 6739 | self.Vrf = v |
| 6740 | } |
| 6741 | |
| 6742 | func (self *BsnVrfCounterStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6743 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6744 | if err := self.BsnStatsRequest.Serialize(encoder); err != nil { |
| 6745 | return err |
| 6746 | } |
| 6747 | |
| 6748 | encoder.PutUint32(uint32(self.Vrf)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6749 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6750 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6751 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6752 | |
| 6753 | return nil |
| 6754 | } |
| 6755 | |
| 6756 | func DecodeBsnVrfCounterStatsRequest(parent *BsnStatsRequest, decoder *goloxi.Decoder) (*BsnVrfCounterStatsRequest, error) { |
| 6757 | _bsnvrfcounterstatsrequest := &BsnVrfCounterStatsRequest{BsnStatsRequest: parent} |
| 6758 | if decoder.Length() < 4 { |
| 6759 | return nil, fmt.Errorf("BsnVrfCounterStatsRequest packet too short: %d < 4", decoder.Length()) |
| 6760 | } |
| 6761 | _bsnvrfcounterstatsrequest.Vrf = uint32(decoder.ReadUint32()) |
| 6762 | return _bsnvrfcounterstatsrequest, nil |
| 6763 | } |
| 6764 | |
| 6765 | func NewBsnVrfCounterStatsRequest() *BsnVrfCounterStatsRequest { |
| 6766 | obj := &BsnVrfCounterStatsRequest{ |
| 6767 | BsnStatsRequest: NewBsnStatsRequest(15), |
| 6768 | } |
| 6769 | return obj |
| 6770 | } |
| 6771 | |
| 6772 | type DescStatsReply struct { |
| 6773 | *StatsReply |
| 6774 | MfrDesc string |
| 6775 | HwDesc string |
| 6776 | SwDesc string |
| 6777 | SerialNum string |
| 6778 | DpDesc string |
| 6779 | } |
| 6780 | |
| 6781 | type IDescStatsReply interface { |
| 6782 | IStatsReply |
| 6783 | GetMfrDesc() string |
| 6784 | GetHwDesc() string |
| 6785 | GetSwDesc() string |
| 6786 | GetSerialNum() string |
| 6787 | GetDpDesc() string |
| 6788 | } |
| 6789 | |
| 6790 | func (self *DescStatsReply) GetMfrDesc() string { |
| 6791 | return self.MfrDesc |
| 6792 | } |
| 6793 | |
| 6794 | func (self *DescStatsReply) SetMfrDesc(v string) { |
| 6795 | self.MfrDesc = v |
| 6796 | } |
| 6797 | |
| 6798 | func (self *DescStatsReply) GetHwDesc() string { |
| 6799 | return self.HwDesc |
| 6800 | } |
| 6801 | |
| 6802 | func (self *DescStatsReply) SetHwDesc(v string) { |
| 6803 | self.HwDesc = v |
| 6804 | } |
| 6805 | |
| 6806 | func (self *DescStatsReply) GetSwDesc() string { |
| 6807 | return self.SwDesc |
| 6808 | } |
| 6809 | |
| 6810 | func (self *DescStatsReply) SetSwDesc(v string) { |
| 6811 | self.SwDesc = v |
| 6812 | } |
| 6813 | |
| 6814 | func (self *DescStatsReply) GetSerialNum() string { |
| 6815 | return self.SerialNum |
| 6816 | } |
| 6817 | |
| 6818 | func (self *DescStatsReply) SetSerialNum(v string) { |
| 6819 | self.SerialNum = v |
| 6820 | } |
| 6821 | |
| 6822 | func (self *DescStatsReply) GetDpDesc() string { |
| 6823 | return self.DpDesc |
| 6824 | } |
| 6825 | |
| 6826 | func (self *DescStatsReply) SetDpDesc(v string) { |
| 6827 | self.DpDesc = v |
| 6828 | } |
| 6829 | |
| 6830 | func (self *DescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6831 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6832 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 6833 | return err |
| 6834 | } |
| 6835 | |
| 6836 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 6837 | encoder.Write([]byte(self.MfrDesc)) |
| 6838 | encoder.Write([]byte(self.HwDesc)) |
| 6839 | encoder.Write([]byte(self.SwDesc)) |
| 6840 | encoder.Write([]byte(self.SerialNum)) |
| 6841 | encoder.Write([]byte(self.DpDesc)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6842 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6843 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6844 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6845 | |
| 6846 | return nil |
| 6847 | } |
| 6848 | |
| 6849 | func DecodeDescStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*DescStatsReply, error) { |
| 6850 | _descstatsreply := &DescStatsReply{StatsReply: parent} |
| 6851 | if decoder.Length() < 1060 { |
| 6852 | return nil, fmt.Errorf("DescStatsReply packet too short: %d < 1060", decoder.Length()) |
| 6853 | } |
| 6854 | decoder.Skip(4) |
| 6855 | _descstatsreply.MfrDesc = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 6856 | _descstatsreply.HwDesc = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 6857 | _descstatsreply.SwDesc = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 6858 | _descstatsreply.SerialNum = string(bytes.Trim(decoder.Read(32), "\x00")) |
| 6859 | _descstatsreply.DpDesc = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 6860 | return _descstatsreply, nil |
| 6861 | } |
| 6862 | |
| 6863 | func NewDescStatsReply() *DescStatsReply { |
| 6864 | obj := &DescStatsReply{ |
| 6865 | StatsReply: NewStatsReply(0), |
| 6866 | } |
| 6867 | return obj |
| 6868 | } |
| 6869 | |
| 6870 | type DescStatsRequest struct { |
| 6871 | *StatsRequest |
| 6872 | } |
| 6873 | |
| 6874 | type IDescStatsRequest interface { |
| 6875 | IStatsRequest |
| 6876 | } |
| 6877 | |
| 6878 | func (self *DescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6879 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6880 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 6881 | return err |
| 6882 | } |
| 6883 | |
| 6884 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6885 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6886 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6887 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6888 | |
| 6889 | return nil |
| 6890 | } |
| 6891 | |
| 6892 | func DecodeDescStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*DescStatsRequest, error) { |
| 6893 | _descstatsrequest := &DescStatsRequest{StatsRequest: parent} |
| 6894 | if decoder.Length() < 4 { |
| 6895 | return nil, fmt.Errorf("DescStatsRequest packet too short: %d < 4", decoder.Length()) |
| 6896 | } |
| 6897 | decoder.Skip(4) |
| 6898 | return _descstatsrequest, nil |
| 6899 | } |
| 6900 | |
| 6901 | func NewDescStatsRequest() *DescStatsRequest { |
| 6902 | obj := &DescStatsRequest{ |
| 6903 | StatsRequest: NewStatsRequest(0), |
| 6904 | } |
| 6905 | return obj |
| 6906 | } |
| 6907 | |
| 6908 | type EchoReply struct { |
| 6909 | *Header |
| 6910 | Data []byte |
| 6911 | } |
| 6912 | |
| 6913 | type IEchoReply interface { |
| 6914 | IHeader |
| 6915 | GetData() []byte |
| 6916 | } |
| 6917 | |
| 6918 | func (self *EchoReply) GetData() []byte { |
| 6919 | return self.Data |
| 6920 | } |
| 6921 | |
| 6922 | func (self *EchoReply) SetData(v []byte) { |
| 6923 | self.Data = v |
| 6924 | } |
| 6925 | |
| 6926 | func (self *EchoReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6927 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6928 | if err := self.Header.Serialize(encoder); err != nil { |
| 6929 | return err |
| 6930 | } |
| 6931 | |
| 6932 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6933 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6934 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6935 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6936 | |
| 6937 | return nil |
| 6938 | } |
| 6939 | |
| 6940 | func DecodeEchoReply(parent *Header, decoder *goloxi.Decoder) (*EchoReply, error) { |
| 6941 | _echoreply := &EchoReply{Header: parent} |
| 6942 | _echoreply.Data = decoder.Read(int(decoder.Length())) |
| 6943 | return _echoreply, nil |
| 6944 | } |
| 6945 | |
| 6946 | func NewEchoReply() *EchoReply { |
| 6947 | obj := &EchoReply{ |
| 6948 | Header: NewHeader(3), |
| 6949 | } |
| 6950 | return obj |
| 6951 | } |
| 6952 | |
| 6953 | type EchoRequest struct { |
| 6954 | *Header |
| 6955 | Data []byte |
| 6956 | } |
| 6957 | |
| 6958 | type IEchoRequest interface { |
| 6959 | IHeader |
| 6960 | GetData() []byte |
| 6961 | } |
| 6962 | |
| 6963 | func (self *EchoRequest) GetData() []byte { |
| 6964 | return self.Data |
| 6965 | } |
| 6966 | |
| 6967 | func (self *EchoRequest) SetData(v []byte) { |
| 6968 | self.Data = v |
| 6969 | } |
| 6970 | |
| 6971 | func (self *EchoRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6972 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6973 | if err := self.Header.Serialize(encoder); err != nil { |
| 6974 | return err |
| 6975 | } |
| 6976 | |
| 6977 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6978 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6979 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 6980 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 6981 | |
| 6982 | return nil |
| 6983 | } |
| 6984 | |
| 6985 | func DecodeEchoRequest(parent *Header, decoder *goloxi.Decoder) (*EchoRequest, error) { |
| 6986 | _echorequest := &EchoRequest{Header: parent} |
| 6987 | _echorequest.Data = decoder.Read(int(decoder.Length())) |
| 6988 | return _echorequest, nil |
| 6989 | } |
| 6990 | |
| 6991 | func NewEchoRequest() *EchoRequest { |
| 6992 | obj := &EchoRequest{ |
| 6993 | Header: NewHeader(2), |
| 6994 | } |
| 6995 | return obj |
| 6996 | } |
| 6997 | |
| 6998 | type FeaturesReply struct { |
| 6999 | *Header |
| 7000 | DatapathId uint64 |
| 7001 | NBuffers uint32 |
| 7002 | NTables uint8 |
| 7003 | AuxiliaryId uint8 |
| 7004 | Capabilities Capabilities |
| 7005 | Reserved uint32 |
| 7006 | } |
| 7007 | |
| 7008 | type IFeaturesReply interface { |
| 7009 | IHeader |
| 7010 | GetDatapathId() uint64 |
| 7011 | GetNBuffers() uint32 |
| 7012 | GetNTables() uint8 |
| 7013 | GetAuxiliaryId() uint8 |
| 7014 | GetCapabilities() Capabilities |
| 7015 | GetReserved() uint32 |
| 7016 | } |
| 7017 | |
| 7018 | func (self *FeaturesReply) GetDatapathId() uint64 { |
| 7019 | return self.DatapathId |
| 7020 | } |
| 7021 | |
| 7022 | func (self *FeaturesReply) SetDatapathId(v uint64) { |
| 7023 | self.DatapathId = v |
| 7024 | } |
| 7025 | |
| 7026 | func (self *FeaturesReply) GetNBuffers() uint32 { |
| 7027 | return self.NBuffers |
| 7028 | } |
| 7029 | |
| 7030 | func (self *FeaturesReply) SetNBuffers(v uint32) { |
| 7031 | self.NBuffers = v |
| 7032 | } |
| 7033 | |
| 7034 | func (self *FeaturesReply) GetNTables() uint8 { |
| 7035 | return self.NTables |
| 7036 | } |
| 7037 | |
| 7038 | func (self *FeaturesReply) SetNTables(v uint8) { |
| 7039 | self.NTables = v |
| 7040 | } |
| 7041 | |
| 7042 | func (self *FeaturesReply) GetAuxiliaryId() uint8 { |
| 7043 | return self.AuxiliaryId |
| 7044 | } |
| 7045 | |
| 7046 | func (self *FeaturesReply) SetAuxiliaryId(v uint8) { |
| 7047 | self.AuxiliaryId = v |
| 7048 | } |
| 7049 | |
| 7050 | func (self *FeaturesReply) GetCapabilities() Capabilities { |
| 7051 | return self.Capabilities |
| 7052 | } |
| 7053 | |
| 7054 | func (self *FeaturesReply) SetCapabilities(v Capabilities) { |
| 7055 | self.Capabilities = v |
| 7056 | } |
| 7057 | |
| 7058 | func (self *FeaturesReply) GetReserved() uint32 { |
| 7059 | return self.Reserved |
| 7060 | } |
| 7061 | |
| 7062 | func (self *FeaturesReply) SetReserved(v uint32) { |
| 7063 | self.Reserved = v |
| 7064 | } |
| 7065 | |
| 7066 | func (self *FeaturesReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7067 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7068 | if err := self.Header.Serialize(encoder); err != nil { |
| 7069 | return err |
| 7070 | } |
| 7071 | |
| 7072 | encoder.PutUint64(uint64(self.DatapathId)) |
| 7073 | encoder.PutUint32(uint32(self.NBuffers)) |
| 7074 | encoder.PutUint8(uint8(self.NTables)) |
| 7075 | encoder.PutUint8(uint8(self.AuxiliaryId)) |
| 7076 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 7077 | encoder.PutUint32(uint32(self.Capabilities)) |
| 7078 | encoder.PutUint32(uint32(self.Reserved)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7079 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7080 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7081 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7082 | |
| 7083 | return nil |
| 7084 | } |
| 7085 | |
| 7086 | func DecodeFeaturesReply(parent *Header, decoder *goloxi.Decoder) (*FeaturesReply, error) { |
| 7087 | _featuresreply := &FeaturesReply{Header: parent} |
| 7088 | if decoder.Length() < 24 { |
| 7089 | return nil, fmt.Errorf("FeaturesReply packet too short: %d < 24", decoder.Length()) |
| 7090 | } |
| 7091 | _featuresreply.DatapathId = uint64(decoder.ReadUint64()) |
| 7092 | _featuresreply.NBuffers = uint32(decoder.ReadUint32()) |
| 7093 | _featuresreply.NTables = uint8(decoder.ReadByte()) |
| 7094 | _featuresreply.AuxiliaryId = uint8(decoder.ReadByte()) |
| 7095 | decoder.Skip(2) |
| 7096 | _featuresreply.Capabilities = Capabilities(decoder.ReadUint32()) |
| 7097 | _featuresreply.Reserved = uint32(decoder.ReadUint32()) |
| 7098 | return _featuresreply, nil |
| 7099 | } |
| 7100 | |
| 7101 | func NewFeaturesReply() *FeaturesReply { |
| 7102 | obj := &FeaturesReply{ |
| 7103 | Header: NewHeader(6), |
| 7104 | } |
| 7105 | return obj |
| 7106 | } |
| 7107 | |
| 7108 | type FeaturesRequest struct { |
| 7109 | *Header |
| 7110 | } |
| 7111 | |
| 7112 | type IFeaturesRequest interface { |
| 7113 | IHeader |
| 7114 | } |
| 7115 | |
| 7116 | func (self *FeaturesRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7117 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7118 | if err := self.Header.Serialize(encoder); err != nil { |
| 7119 | return err |
| 7120 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7121 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7122 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7123 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7124 | |
| 7125 | return nil |
| 7126 | } |
| 7127 | |
| 7128 | func DecodeFeaturesRequest(parent *Header, decoder *goloxi.Decoder) (*FeaturesRequest, error) { |
| 7129 | _featuresrequest := &FeaturesRequest{Header: parent} |
| 7130 | return _featuresrequest, nil |
| 7131 | } |
| 7132 | |
| 7133 | func NewFeaturesRequest() *FeaturesRequest { |
| 7134 | obj := &FeaturesRequest{ |
| 7135 | Header: NewHeader(5), |
| 7136 | } |
| 7137 | return obj |
| 7138 | } |
| 7139 | |
| 7140 | type FlowMod struct { |
| 7141 | *Header |
| 7142 | Cookie uint64 |
| 7143 | CookieMask uint64 |
| 7144 | TableId uint8 |
| 7145 | Command FmCmd |
| 7146 | IdleTimeout uint16 |
| 7147 | HardTimeout uint16 |
| 7148 | Priority uint16 |
| 7149 | BufferId uint32 |
| 7150 | OutPort Port |
| 7151 | OutGroup uint32 |
| 7152 | Flags FlowModFlags |
| 7153 | Match Match |
| 7154 | Instructions []IInstruction |
| 7155 | } |
| 7156 | |
| 7157 | type IFlowMod interface { |
| 7158 | IHeader |
| 7159 | GetCookie() uint64 |
| 7160 | GetCookieMask() uint64 |
| 7161 | GetTableId() uint8 |
| 7162 | GetCommand() FmCmd |
| 7163 | GetIdleTimeout() uint16 |
| 7164 | GetHardTimeout() uint16 |
| 7165 | GetPriority() uint16 |
| 7166 | GetBufferId() uint32 |
| 7167 | GetOutPort() Port |
| 7168 | GetOutGroup() uint32 |
| 7169 | GetFlags() FlowModFlags |
| 7170 | GetMatch() Match |
| 7171 | GetInstructions() []IInstruction |
| 7172 | } |
| 7173 | |
| 7174 | func (self *FlowMod) GetCookie() uint64 { |
| 7175 | return self.Cookie |
| 7176 | } |
| 7177 | |
| 7178 | func (self *FlowMod) SetCookie(v uint64) { |
| 7179 | self.Cookie = v |
| 7180 | } |
| 7181 | |
| 7182 | func (self *FlowMod) GetCookieMask() uint64 { |
| 7183 | return self.CookieMask |
| 7184 | } |
| 7185 | |
| 7186 | func (self *FlowMod) SetCookieMask(v uint64) { |
| 7187 | self.CookieMask = v |
| 7188 | } |
| 7189 | |
| 7190 | func (self *FlowMod) GetTableId() uint8 { |
| 7191 | return self.TableId |
| 7192 | } |
| 7193 | |
| 7194 | func (self *FlowMod) SetTableId(v uint8) { |
| 7195 | self.TableId = v |
| 7196 | } |
| 7197 | |
| 7198 | func (self *FlowMod) GetCommand() FmCmd { |
| 7199 | return self.Command |
| 7200 | } |
| 7201 | |
| 7202 | func (self *FlowMod) SetCommand(v FmCmd) { |
| 7203 | self.Command = v |
| 7204 | } |
| 7205 | |
| 7206 | func (self *FlowMod) GetIdleTimeout() uint16 { |
| 7207 | return self.IdleTimeout |
| 7208 | } |
| 7209 | |
| 7210 | func (self *FlowMod) SetIdleTimeout(v uint16) { |
| 7211 | self.IdleTimeout = v |
| 7212 | } |
| 7213 | |
| 7214 | func (self *FlowMod) GetHardTimeout() uint16 { |
| 7215 | return self.HardTimeout |
| 7216 | } |
| 7217 | |
| 7218 | func (self *FlowMod) SetHardTimeout(v uint16) { |
| 7219 | self.HardTimeout = v |
| 7220 | } |
| 7221 | |
| 7222 | func (self *FlowMod) GetPriority() uint16 { |
| 7223 | return self.Priority |
| 7224 | } |
| 7225 | |
| 7226 | func (self *FlowMod) SetPriority(v uint16) { |
| 7227 | self.Priority = v |
| 7228 | } |
| 7229 | |
| 7230 | func (self *FlowMod) GetBufferId() uint32 { |
| 7231 | return self.BufferId |
| 7232 | } |
| 7233 | |
| 7234 | func (self *FlowMod) SetBufferId(v uint32) { |
| 7235 | self.BufferId = v |
| 7236 | } |
| 7237 | |
| 7238 | func (self *FlowMod) GetOutPort() Port { |
| 7239 | return self.OutPort |
| 7240 | } |
| 7241 | |
| 7242 | func (self *FlowMod) SetOutPort(v Port) { |
| 7243 | self.OutPort = v |
| 7244 | } |
| 7245 | |
| 7246 | func (self *FlowMod) GetOutGroup() uint32 { |
| 7247 | return self.OutGroup |
| 7248 | } |
| 7249 | |
| 7250 | func (self *FlowMod) SetOutGroup(v uint32) { |
| 7251 | self.OutGroup = v |
| 7252 | } |
| 7253 | |
| 7254 | func (self *FlowMod) GetFlags() FlowModFlags { |
| 7255 | return self.Flags |
| 7256 | } |
| 7257 | |
| 7258 | func (self *FlowMod) SetFlags(v FlowModFlags) { |
| 7259 | self.Flags = v |
| 7260 | } |
| 7261 | |
| 7262 | func (self *FlowMod) GetMatch() Match { |
| 7263 | return self.Match |
| 7264 | } |
| 7265 | |
| 7266 | func (self *FlowMod) SetMatch(v Match) { |
| 7267 | self.Match = v |
| 7268 | } |
| 7269 | |
| 7270 | func (self *FlowMod) GetInstructions() []IInstruction { |
| 7271 | return self.Instructions |
| 7272 | } |
| 7273 | |
| 7274 | func (self *FlowMod) SetInstructions(v []IInstruction) { |
| 7275 | self.Instructions = v |
| 7276 | } |
| 7277 | |
| 7278 | func (self *FlowMod) Serialize(encoder *goloxi.Encoder) error { |
| 7279 | if err := self.Header.Serialize(encoder); err != nil { |
| 7280 | return err |
| 7281 | } |
| 7282 | |
| 7283 | encoder.PutUint64(uint64(self.Cookie)) |
| 7284 | encoder.PutUint64(uint64(self.CookieMask)) |
| 7285 | encoder.PutUint8(uint8(self.TableId)) |
| 7286 | self.Command.Serialize(encoder) |
| 7287 | encoder.PutUint16(uint16(self.IdleTimeout)) |
| 7288 | encoder.PutUint16(uint16(self.HardTimeout)) |
| 7289 | encoder.PutUint16(uint16(self.Priority)) |
| 7290 | encoder.PutUint32(uint32(self.BufferId)) |
| 7291 | self.OutPort.Serialize(encoder) |
| 7292 | encoder.PutUint32(uint32(self.OutGroup)) |
| 7293 | encoder.PutUint16(uint16(self.Flags)) |
| 7294 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 7295 | if err := self.Match.Serialize(encoder); err != nil { |
| 7296 | return err |
| 7297 | } |
| 7298 | |
| 7299 | for _, obj := range self.Instructions { |
| 7300 | if err := obj.Serialize(encoder); err != nil { |
| 7301 | return err |
| 7302 | } |
| 7303 | } |
| 7304 | |
| 7305 | return nil |
| 7306 | } |
| 7307 | |
| 7308 | func DecodeFlowMod(parent *Header, decoder *goloxi.Decoder) (IFlowMod, error) { |
| 7309 | _flowmod := &FlowMod{Header: parent} |
| 7310 | if decoder.Length() < 48 { |
| 7311 | return nil, fmt.Errorf("FlowMod packet too short: %d < 48", decoder.Length()) |
| 7312 | } |
| 7313 | _flowmod.Cookie = uint64(decoder.ReadUint64()) |
| 7314 | _flowmod.CookieMask = uint64(decoder.ReadUint64()) |
| 7315 | _flowmod.TableId = uint8(decoder.ReadByte()) |
| 7316 | _flowmod.Command.Decode(decoder) |
| 7317 | _flowmod.IdleTimeout = uint16(decoder.ReadUint16()) |
| 7318 | _flowmod.HardTimeout = uint16(decoder.ReadUint16()) |
| 7319 | _flowmod.Priority = uint16(decoder.ReadUint16()) |
| 7320 | _flowmod.BufferId = uint32(decoder.ReadUint32()) |
| 7321 | _flowmod.OutPort.Decode(decoder) |
| 7322 | _flowmod.OutGroup = uint32(decoder.ReadUint32()) |
| 7323 | _flowmod.Flags = FlowModFlags(decoder.ReadUint16()) |
| 7324 | decoder.Skip(2) |
| 7325 | if err := _flowmod.Match.Decode(decoder); err != nil { |
| 7326 | return nil, err |
| 7327 | } |
| 7328 | |
| 7329 | decoder.SkipAlign() |
| 7330 | |
| 7331 | for decoder.Length() >= 4 { |
| 7332 | item, err := DecodeInstruction(decoder) |
| 7333 | if err != nil { |
| 7334 | return nil, err |
| 7335 | } |
| 7336 | if item != nil { |
| 7337 | _flowmod.Instructions = append(_flowmod.Instructions, item) |
| 7338 | } |
| 7339 | } |
| 7340 | |
| 7341 | switch _flowmod.Command { |
| 7342 | case 0: |
| 7343 | return DecodeFlowAdd(_flowmod, decoder) |
| 7344 | case 1: |
| 7345 | return DecodeFlowModify(_flowmod, decoder) |
| 7346 | case 2: |
| 7347 | return DecodeFlowModifyStrict(_flowmod, decoder) |
| 7348 | case 3: |
| 7349 | return DecodeFlowDelete(_flowmod, decoder) |
| 7350 | case 4: |
| 7351 | return DecodeFlowDeleteStrict(_flowmod, decoder) |
| 7352 | default: |
| 7353 | return nil, fmt.Errorf("Invalid type '%d' for 'FlowMod'", _flowmod.Command) |
| 7354 | } |
| 7355 | } |
| 7356 | |
| 7357 | func NewFlowMod(__command FmCmd) *FlowMod { |
| 7358 | obj := &FlowMod{ |
| 7359 | Header: NewHeader(14), |
| 7360 | } |
| 7361 | obj.Command = __command |
| 7362 | return obj |
| 7363 | } |
| 7364 | |
| 7365 | type FlowAdd struct { |
| 7366 | *FlowMod |
| 7367 | } |
| 7368 | |
| 7369 | type IFlowAdd interface { |
| 7370 | IFlowMod |
| 7371 | } |
| 7372 | |
| 7373 | func (self *FlowAdd) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7374 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7375 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 7376 | return err |
| 7377 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7378 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7379 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7380 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7381 | |
| 7382 | return nil |
| 7383 | } |
| 7384 | |
| 7385 | func DecodeFlowAdd(parent *FlowMod, decoder *goloxi.Decoder) (*FlowAdd, error) { |
| 7386 | _flowadd := &FlowAdd{FlowMod: parent} |
| 7387 | return _flowadd, nil |
| 7388 | } |
| 7389 | |
| 7390 | func NewFlowAdd() *FlowAdd { |
| 7391 | obj := &FlowAdd{ |
| 7392 | FlowMod: NewFlowMod(0), |
| 7393 | } |
| 7394 | return obj |
| 7395 | } |
| 7396 | |
| 7397 | type FlowDelete struct { |
| 7398 | *FlowMod |
| 7399 | } |
| 7400 | |
| 7401 | type IFlowDelete interface { |
| 7402 | IFlowMod |
| 7403 | } |
| 7404 | |
| 7405 | func (self *FlowDelete) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7406 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7407 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 7408 | return err |
| 7409 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7410 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7411 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7412 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7413 | |
| 7414 | return nil |
| 7415 | } |
| 7416 | |
| 7417 | func DecodeFlowDelete(parent *FlowMod, decoder *goloxi.Decoder) (*FlowDelete, error) { |
| 7418 | _flowdelete := &FlowDelete{FlowMod: parent} |
| 7419 | return _flowdelete, nil |
| 7420 | } |
| 7421 | |
| 7422 | func NewFlowDelete() *FlowDelete { |
| 7423 | obj := &FlowDelete{ |
| 7424 | FlowMod: NewFlowMod(3), |
| 7425 | } |
| 7426 | return obj |
| 7427 | } |
| 7428 | |
| 7429 | type FlowDeleteStrict struct { |
| 7430 | *FlowMod |
| 7431 | } |
| 7432 | |
| 7433 | type IFlowDeleteStrict interface { |
| 7434 | IFlowMod |
| 7435 | } |
| 7436 | |
| 7437 | func (self *FlowDeleteStrict) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7438 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7439 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 7440 | return err |
| 7441 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7442 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7443 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7444 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7445 | |
| 7446 | return nil |
| 7447 | } |
| 7448 | |
| 7449 | func DecodeFlowDeleteStrict(parent *FlowMod, decoder *goloxi.Decoder) (*FlowDeleteStrict, error) { |
| 7450 | _flowdeletestrict := &FlowDeleteStrict{FlowMod: parent} |
| 7451 | return _flowdeletestrict, nil |
| 7452 | } |
| 7453 | |
| 7454 | func NewFlowDeleteStrict() *FlowDeleteStrict { |
| 7455 | obj := &FlowDeleteStrict{ |
| 7456 | FlowMod: NewFlowMod(4), |
| 7457 | } |
| 7458 | return obj |
| 7459 | } |
| 7460 | |
| 7461 | type FlowModFailedErrorMsg struct { |
| 7462 | *ErrorMsg |
| 7463 | Code FlowModFailedCode |
| 7464 | Data []byte |
| 7465 | } |
| 7466 | |
| 7467 | type IFlowModFailedErrorMsg interface { |
| 7468 | IErrorMsg |
| 7469 | GetCode() FlowModFailedCode |
| 7470 | GetData() []byte |
| 7471 | } |
| 7472 | |
| 7473 | func (self *FlowModFailedErrorMsg) GetCode() FlowModFailedCode { |
| 7474 | return self.Code |
| 7475 | } |
| 7476 | |
| 7477 | func (self *FlowModFailedErrorMsg) SetCode(v FlowModFailedCode) { |
| 7478 | self.Code = v |
| 7479 | } |
| 7480 | |
| 7481 | func (self *FlowModFailedErrorMsg) GetData() []byte { |
| 7482 | return self.Data |
| 7483 | } |
| 7484 | |
| 7485 | func (self *FlowModFailedErrorMsg) SetData(v []byte) { |
| 7486 | self.Data = v |
| 7487 | } |
| 7488 | |
| 7489 | func (self *FlowModFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7490 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7491 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 7492 | return err |
| 7493 | } |
| 7494 | |
| 7495 | encoder.PutUint16(uint16(self.Code)) |
| 7496 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7497 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7498 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7499 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7500 | |
| 7501 | return nil |
| 7502 | } |
| 7503 | |
| 7504 | func DecodeFlowModFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*FlowModFailedErrorMsg, error) { |
| 7505 | _flowmodfailederrormsg := &FlowModFailedErrorMsg{ErrorMsg: parent} |
| 7506 | if decoder.Length() < 2 { |
| 7507 | return nil, fmt.Errorf("FlowModFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 7508 | } |
| 7509 | _flowmodfailederrormsg.Code = FlowModFailedCode(decoder.ReadUint16()) |
| 7510 | _flowmodfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 7511 | return _flowmodfailederrormsg, nil |
| 7512 | } |
| 7513 | |
| 7514 | func NewFlowModFailedErrorMsg() *FlowModFailedErrorMsg { |
| 7515 | obj := &FlowModFailedErrorMsg{ |
| 7516 | ErrorMsg: NewErrorMsg(5), |
| 7517 | } |
| 7518 | return obj |
| 7519 | } |
| 7520 | |
| 7521 | type FlowModify struct { |
| 7522 | *FlowMod |
| 7523 | } |
| 7524 | |
| 7525 | type IFlowModify interface { |
| 7526 | IFlowMod |
| 7527 | } |
| 7528 | |
| 7529 | func (self *FlowModify) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7530 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7531 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 7532 | return err |
| 7533 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7534 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7535 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7536 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7537 | |
| 7538 | return nil |
| 7539 | } |
| 7540 | |
| 7541 | func DecodeFlowModify(parent *FlowMod, decoder *goloxi.Decoder) (*FlowModify, error) { |
| 7542 | _flowmodify := &FlowModify{FlowMod: parent} |
| 7543 | return _flowmodify, nil |
| 7544 | } |
| 7545 | |
| 7546 | func NewFlowModify() *FlowModify { |
| 7547 | obj := &FlowModify{ |
| 7548 | FlowMod: NewFlowMod(1), |
| 7549 | } |
| 7550 | return obj |
| 7551 | } |
| 7552 | |
| 7553 | type FlowModifyStrict struct { |
| 7554 | *FlowMod |
| 7555 | } |
| 7556 | |
| 7557 | type IFlowModifyStrict interface { |
| 7558 | IFlowMod |
| 7559 | } |
| 7560 | |
| 7561 | func (self *FlowModifyStrict) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7562 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7563 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 7564 | return err |
| 7565 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7566 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7567 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7568 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7569 | |
| 7570 | return nil |
| 7571 | } |
| 7572 | |
| 7573 | func DecodeFlowModifyStrict(parent *FlowMod, decoder *goloxi.Decoder) (*FlowModifyStrict, error) { |
| 7574 | _flowmodifystrict := &FlowModifyStrict{FlowMod: parent} |
| 7575 | return _flowmodifystrict, nil |
| 7576 | } |
| 7577 | |
| 7578 | func NewFlowModifyStrict() *FlowModifyStrict { |
| 7579 | obj := &FlowModifyStrict{ |
| 7580 | FlowMod: NewFlowMod(2), |
| 7581 | } |
| 7582 | return obj |
| 7583 | } |
| 7584 | |
| 7585 | type FlowRemoved struct { |
| 7586 | *Header |
| 7587 | Cookie uint64 |
| 7588 | Priority uint16 |
| 7589 | Reason FlowRemovedReason |
| 7590 | TableId uint8 |
| 7591 | DurationSec uint32 |
| 7592 | DurationNsec uint32 |
| 7593 | IdleTimeout uint16 |
| 7594 | HardTimeout uint16 |
| 7595 | PacketCount uint64 |
| 7596 | ByteCount uint64 |
| 7597 | Match Match |
| 7598 | } |
| 7599 | |
| 7600 | type IFlowRemoved interface { |
| 7601 | IHeader |
| 7602 | GetCookie() uint64 |
| 7603 | GetPriority() uint16 |
| 7604 | GetReason() FlowRemovedReason |
| 7605 | GetTableId() uint8 |
| 7606 | GetDurationSec() uint32 |
| 7607 | GetDurationNsec() uint32 |
| 7608 | GetIdleTimeout() uint16 |
| 7609 | GetHardTimeout() uint16 |
| 7610 | GetPacketCount() uint64 |
| 7611 | GetByteCount() uint64 |
| 7612 | GetMatch() Match |
| 7613 | } |
| 7614 | |
| 7615 | func (self *FlowRemoved) GetCookie() uint64 { |
| 7616 | return self.Cookie |
| 7617 | } |
| 7618 | |
| 7619 | func (self *FlowRemoved) SetCookie(v uint64) { |
| 7620 | self.Cookie = v |
| 7621 | } |
| 7622 | |
| 7623 | func (self *FlowRemoved) GetPriority() uint16 { |
| 7624 | return self.Priority |
| 7625 | } |
| 7626 | |
| 7627 | func (self *FlowRemoved) SetPriority(v uint16) { |
| 7628 | self.Priority = v |
| 7629 | } |
| 7630 | |
| 7631 | func (self *FlowRemoved) GetReason() FlowRemovedReason { |
| 7632 | return self.Reason |
| 7633 | } |
| 7634 | |
| 7635 | func (self *FlowRemoved) SetReason(v FlowRemovedReason) { |
| 7636 | self.Reason = v |
| 7637 | } |
| 7638 | |
| 7639 | func (self *FlowRemoved) GetTableId() uint8 { |
| 7640 | return self.TableId |
| 7641 | } |
| 7642 | |
| 7643 | func (self *FlowRemoved) SetTableId(v uint8) { |
| 7644 | self.TableId = v |
| 7645 | } |
| 7646 | |
| 7647 | func (self *FlowRemoved) GetDurationSec() uint32 { |
| 7648 | return self.DurationSec |
| 7649 | } |
| 7650 | |
| 7651 | func (self *FlowRemoved) SetDurationSec(v uint32) { |
| 7652 | self.DurationSec = v |
| 7653 | } |
| 7654 | |
| 7655 | func (self *FlowRemoved) GetDurationNsec() uint32 { |
| 7656 | return self.DurationNsec |
| 7657 | } |
| 7658 | |
| 7659 | func (self *FlowRemoved) SetDurationNsec(v uint32) { |
| 7660 | self.DurationNsec = v |
| 7661 | } |
| 7662 | |
| 7663 | func (self *FlowRemoved) GetIdleTimeout() uint16 { |
| 7664 | return self.IdleTimeout |
| 7665 | } |
| 7666 | |
| 7667 | func (self *FlowRemoved) SetIdleTimeout(v uint16) { |
| 7668 | self.IdleTimeout = v |
| 7669 | } |
| 7670 | |
| 7671 | func (self *FlowRemoved) GetHardTimeout() uint16 { |
| 7672 | return self.HardTimeout |
| 7673 | } |
| 7674 | |
| 7675 | func (self *FlowRemoved) SetHardTimeout(v uint16) { |
| 7676 | self.HardTimeout = v |
| 7677 | } |
| 7678 | |
| 7679 | func (self *FlowRemoved) GetPacketCount() uint64 { |
| 7680 | return self.PacketCount |
| 7681 | } |
| 7682 | |
| 7683 | func (self *FlowRemoved) SetPacketCount(v uint64) { |
| 7684 | self.PacketCount = v |
| 7685 | } |
| 7686 | |
| 7687 | func (self *FlowRemoved) GetByteCount() uint64 { |
| 7688 | return self.ByteCount |
| 7689 | } |
| 7690 | |
| 7691 | func (self *FlowRemoved) SetByteCount(v uint64) { |
| 7692 | self.ByteCount = v |
| 7693 | } |
| 7694 | |
| 7695 | func (self *FlowRemoved) GetMatch() Match { |
| 7696 | return self.Match |
| 7697 | } |
| 7698 | |
| 7699 | func (self *FlowRemoved) SetMatch(v Match) { |
| 7700 | self.Match = v |
| 7701 | } |
| 7702 | |
| 7703 | func (self *FlowRemoved) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7704 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7705 | if err := self.Header.Serialize(encoder); err != nil { |
| 7706 | return err |
| 7707 | } |
| 7708 | |
| 7709 | encoder.PutUint64(uint64(self.Cookie)) |
| 7710 | encoder.PutUint16(uint16(self.Priority)) |
| 7711 | encoder.PutUint8(uint8(self.Reason)) |
| 7712 | encoder.PutUint8(uint8(self.TableId)) |
| 7713 | encoder.PutUint32(uint32(self.DurationSec)) |
| 7714 | encoder.PutUint32(uint32(self.DurationNsec)) |
| 7715 | encoder.PutUint16(uint16(self.IdleTimeout)) |
| 7716 | encoder.PutUint16(uint16(self.HardTimeout)) |
| 7717 | encoder.PutUint64(uint64(self.PacketCount)) |
| 7718 | encoder.PutUint64(uint64(self.ByteCount)) |
| 7719 | if err := self.Match.Serialize(encoder); err != nil { |
| 7720 | return err |
| 7721 | } |
| 7722 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7723 | length := len(encoder.Bytes()) - startIndex |
| 7724 | |
| 7725 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7726 | |
| 7727 | return nil |
| 7728 | } |
| 7729 | |
| 7730 | func DecodeFlowRemoved(parent *Header, decoder *goloxi.Decoder) (*FlowRemoved, error) { |
| 7731 | _flowremoved := &FlowRemoved{Header: parent} |
| 7732 | if decoder.Length() < 48 { |
| 7733 | return nil, fmt.Errorf("FlowRemoved packet too short: %d < 48", decoder.Length()) |
| 7734 | } |
| 7735 | _flowremoved.Cookie = uint64(decoder.ReadUint64()) |
| 7736 | _flowremoved.Priority = uint16(decoder.ReadUint16()) |
| 7737 | _flowremoved.Reason = FlowRemovedReason(decoder.ReadByte()) |
| 7738 | _flowremoved.TableId = uint8(decoder.ReadByte()) |
| 7739 | _flowremoved.DurationSec = uint32(decoder.ReadUint32()) |
| 7740 | _flowremoved.DurationNsec = uint32(decoder.ReadUint32()) |
| 7741 | _flowremoved.IdleTimeout = uint16(decoder.ReadUint16()) |
| 7742 | _flowremoved.HardTimeout = uint16(decoder.ReadUint16()) |
| 7743 | _flowremoved.PacketCount = uint64(decoder.ReadUint64()) |
| 7744 | _flowremoved.ByteCount = uint64(decoder.ReadUint64()) |
| 7745 | if err := _flowremoved.Match.Decode(decoder); err != nil { |
| 7746 | return nil, err |
| 7747 | } |
| 7748 | |
| 7749 | decoder.SkipAlign() |
| 7750 | return _flowremoved, nil |
| 7751 | } |
| 7752 | |
| 7753 | func NewFlowRemoved() *FlowRemoved { |
| 7754 | obj := &FlowRemoved{ |
| 7755 | Header: NewHeader(11), |
| 7756 | } |
| 7757 | return obj |
| 7758 | } |
| 7759 | |
| 7760 | type FlowStatsReply struct { |
| 7761 | *StatsReply |
| 7762 | Entries []*FlowStatsEntry |
| 7763 | } |
| 7764 | |
| 7765 | type IFlowStatsReply interface { |
| 7766 | IStatsReply |
| 7767 | GetEntries() []*FlowStatsEntry |
| 7768 | } |
| 7769 | |
| 7770 | func (self *FlowStatsReply) GetEntries() []*FlowStatsEntry { |
| 7771 | return self.Entries |
| 7772 | } |
| 7773 | |
| 7774 | func (self *FlowStatsReply) SetEntries(v []*FlowStatsEntry) { |
| 7775 | self.Entries = v |
| 7776 | } |
| 7777 | |
| 7778 | func (self *FlowStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7779 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7780 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 7781 | return err |
| 7782 | } |
| 7783 | |
| 7784 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 7785 | for _, obj := range self.Entries { |
| 7786 | if err := obj.Serialize(encoder); err != nil { |
| 7787 | return err |
| 7788 | } |
| 7789 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7790 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7791 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7792 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7793 | |
| 7794 | return nil |
| 7795 | } |
| 7796 | |
| 7797 | func DecodeFlowStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*FlowStatsReply, error) { |
| 7798 | _flowstatsreply := &FlowStatsReply{StatsReply: parent} |
| 7799 | if decoder.Length() < 4 { |
| 7800 | return nil, fmt.Errorf("FlowStatsReply packet too short: %d < 4", decoder.Length()) |
| 7801 | } |
| 7802 | decoder.Skip(4) |
| 7803 | |
| 7804 | for decoder.Length() >= 56 { |
| 7805 | item, err := DecodeFlowStatsEntry(decoder) |
| 7806 | if err != nil { |
| 7807 | return nil, err |
| 7808 | } |
| 7809 | if item != nil { |
| 7810 | _flowstatsreply.Entries = append(_flowstatsreply.Entries, item) |
| 7811 | } |
| 7812 | } |
| 7813 | return _flowstatsreply, nil |
| 7814 | } |
| 7815 | |
| 7816 | func NewFlowStatsReply() *FlowStatsReply { |
| 7817 | obj := &FlowStatsReply{ |
| 7818 | StatsReply: NewStatsReply(1), |
| 7819 | } |
| 7820 | return obj |
| 7821 | } |
| 7822 | |
| 7823 | type FlowStatsRequest struct { |
| 7824 | *StatsRequest |
| 7825 | TableId uint8 |
| 7826 | OutPort Port |
| 7827 | OutGroup uint32 |
| 7828 | Cookie uint64 |
| 7829 | CookieMask uint64 |
| 7830 | Match Match |
| 7831 | } |
| 7832 | |
| 7833 | type IFlowStatsRequest interface { |
| 7834 | IStatsRequest |
| 7835 | GetTableId() uint8 |
| 7836 | GetOutPort() Port |
| 7837 | GetOutGroup() uint32 |
| 7838 | GetCookie() uint64 |
| 7839 | GetCookieMask() uint64 |
| 7840 | GetMatch() Match |
| 7841 | } |
| 7842 | |
| 7843 | func (self *FlowStatsRequest) GetTableId() uint8 { |
| 7844 | return self.TableId |
| 7845 | } |
| 7846 | |
| 7847 | func (self *FlowStatsRequest) SetTableId(v uint8) { |
| 7848 | self.TableId = v |
| 7849 | } |
| 7850 | |
| 7851 | func (self *FlowStatsRequest) GetOutPort() Port { |
| 7852 | return self.OutPort |
| 7853 | } |
| 7854 | |
| 7855 | func (self *FlowStatsRequest) SetOutPort(v Port) { |
| 7856 | self.OutPort = v |
| 7857 | } |
| 7858 | |
| 7859 | func (self *FlowStatsRequest) GetOutGroup() uint32 { |
| 7860 | return self.OutGroup |
| 7861 | } |
| 7862 | |
| 7863 | func (self *FlowStatsRequest) SetOutGroup(v uint32) { |
| 7864 | self.OutGroup = v |
| 7865 | } |
| 7866 | |
| 7867 | func (self *FlowStatsRequest) GetCookie() uint64 { |
| 7868 | return self.Cookie |
| 7869 | } |
| 7870 | |
| 7871 | func (self *FlowStatsRequest) SetCookie(v uint64) { |
| 7872 | self.Cookie = v |
| 7873 | } |
| 7874 | |
| 7875 | func (self *FlowStatsRequest) GetCookieMask() uint64 { |
| 7876 | return self.CookieMask |
| 7877 | } |
| 7878 | |
| 7879 | func (self *FlowStatsRequest) SetCookieMask(v uint64) { |
| 7880 | self.CookieMask = v |
| 7881 | } |
| 7882 | |
| 7883 | func (self *FlowStatsRequest) GetMatch() Match { |
| 7884 | return self.Match |
| 7885 | } |
| 7886 | |
| 7887 | func (self *FlowStatsRequest) SetMatch(v Match) { |
| 7888 | self.Match = v |
| 7889 | } |
| 7890 | |
| 7891 | func (self *FlowStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7892 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7893 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 7894 | return err |
| 7895 | } |
| 7896 | |
| 7897 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 7898 | encoder.PutUint8(uint8(self.TableId)) |
| 7899 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 7900 | self.OutPort.Serialize(encoder) |
| 7901 | encoder.PutUint32(uint32(self.OutGroup)) |
| 7902 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 7903 | encoder.PutUint64(uint64(self.Cookie)) |
| 7904 | encoder.PutUint64(uint64(self.CookieMask)) |
| 7905 | if err := self.Match.Serialize(encoder); err != nil { |
| 7906 | return err |
| 7907 | } |
| 7908 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7909 | length := len(encoder.Bytes()) - startIndex |
| 7910 | |
| 7911 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7912 | |
| 7913 | return nil |
| 7914 | } |
| 7915 | |
| 7916 | func DecodeFlowStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*FlowStatsRequest, error) { |
| 7917 | _flowstatsrequest := &FlowStatsRequest{StatsRequest: parent} |
| 7918 | if decoder.Length() < 28 { |
| 7919 | return nil, fmt.Errorf("FlowStatsRequest packet too short: %d < 28", decoder.Length()) |
| 7920 | } |
| 7921 | decoder.Skip(4) |
| 7922 | _flowstatsrequest.TableId = uint8(decoder.ReadByte()) |
| 7923 | decoder.Skip(3) |
| 7924 | _flowstatsrequest.OutPort.Decode(decoder) |
| 7925 | _flowstatsrequest.OutGroup = uint32(decoder.ReadUint32()) |
| 7926 | decoder.Skip(4) |
| 7927 | _flowstatsrequest.Cookie = uint64(decoder.ReadUint64()) |
| 7928 | _flowstatsrequest.CookieMask = uint64(decoder.ReadUint64()) |
| 7929 | if err := _flowstatsrequest.Match.Decode(decoder); err != nil { |
| 7930 | return nil, err |
| 7931 | } |
| 7932 | |
| 7933 | decoder.SkipAlign() |
| 7934 | return _flowstatsrequest, nil |
| 7935 | } |
| 7936 | |
| 7937 | func NewFlowStatsRequest() *FlowStatsRequest { |
| 7938 | obj := &FlowStatsRequest{ |
| 7939 | StatsRequest: NewStatsRequest(1), |
| 7940 | } |
| 7941 | return obj |
| 7942 | } |
| 7943 | |
| 7944 | type GetConfigReply struct { |
| 7945 | *Header |
| 7946 | Flags ConfigFlags |
| 7947 | MissSendLen uint16 |
| 7948 | } |
| 7949 | |
| 7950 | type IGetConfigReply interface { |
| 7951 | IHeader |
| 7952 | GetFlags() ConfigFlags |
| 7953 | GetMissSendLen() uint16 |
| 7954 | } |
| 7955 | |
| 7956 | func (self *GetConfigReply) GetFlags() ConfigFlags { |
| 7957 | return self.Flags |
| 7958 | } |
| 7959 | |
| 7960 | func (self *GetConfigReply) SetFlags(v ConfigFlags) { |
| 7961 | self.Flags = v |
| 7962 | } |
| 7963 | |
| 7964 | func (self *GetConfigReply) GetMissSendLen() uint16 { |
| 7965 | return self.MissSendLen |
| 7966 | } |
| 7967 | |
| 7968 | func (self *GetConfigReply) SetMissSendLen(v uint16) { |
| 7969 | self.MissSendLen = v |
| 7970 | } |
| 7971 | |
| 7972 | func (self *GetConfigReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7973 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7974 | if err := self.Header.Serialize(encoder); err != nil { |
| 7975 | return err |
| 7976 | } |
| 7977 | |
| 7978 | encoder.PutUint16(uint16(self.Flags)) |
| 7979 | encoder.PutUint16(uint16(self.MissSendLen)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7980 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7981 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 7982 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 7983 | |
| 7984 | return nil |
| 7985 | } |
| 7986 | |
| 7987 | func DecodeGetConfigReply(parent *Header, decoder *goloxi.Decoder) (*GetConfigReply, error) { |
| 7988 | _getconfigreply := &GetConfigReply{Header: parent} |
| 7989 | if decoder.Length() < 4 { |
| 7990 | return nil, fmt.Errorf("GetConfigReply packet too short: %d < 4", decoder.Length()) |
| 7991 | } |
| 7992 | _getconfigreply.Flags = ConfigFlags(decoder.ReadUint16()) |
| 7993 | _getconfigreply.MissSendLen = uint16(decoder.ReadUint16()) |
| 7994 | return _getconfigreply, nil |
| 7995 | } |
| 7996 | |
| 7997 | func NewGetConfigReply() *GetConfigReply { |
| 7998 | obj := &GetConfigReply{ |
| 7999 | Header: NewHeader(8), |
| 8000 | } |
| 8001 | return obj |
| 8002 | } |
| 8003 | |
| 8004 | type GetConfigRequest struct { |
| 8005 | *Header |
| 8006 | } |
| 8007 | |
| 8008 | type IGetConfigRequest interface { |
| 8009 | IHeader |
| 8010 | } |
| 8011 | |
| 8012 | func (self *GetConfigRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8013 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8014 | if err := self.Header.Serialize(encoder); err != nil { |
| 8015 | return err |
| 8016 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8017 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8018 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8019 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8020 | |
| 8021 | return nil |
| 8022 | } |
| 8023 | |
| 8024 | func DecodeGetConfigRequest(parent *Header, decoder *goloxi.Decoder) (*GetConfigRequest, error) { |
| 8025 | _getconfigrequest := &GetConfigRequest{Header: parent} |
| 8026 | return _getconfigrequest, nil |
| 8027 | } |
| 8028 | |
| 8029 | func NewGetConfigRequest() *GetConfigRequest { |
| 8030 | obj := &GetConfigRequest{ |
| 8031 | Header: NewHeader(7), |
| 8032 | } |
| 8033 | return obj |
| 8034 | } |
| 8035 | |
| 8036 | type GroupMod struct { |
| 8037 | *Header |
| 8038 | Command GroupModCommand |
| 8039 | GroupType GroupType |
| 8040 | GroupId uint32 |
| 8041 | Buckets []*Bucket |
| 8042 | } |
| 8043 | |
| 8044 | type IGroupMod interface { |
| 8045 | IHeader |
| 8046 | GetCommand() GroupModCommand |
| 8047 | GetGroupType() GroupType |
| 8048 | GetGroupId() uint32 |
| 8049 | GetBuckets() []*Bucket |
| 8050 | } |
| 8051 | |
| 8052 | func (self *GroupMod) GetCommand() GroupModCommand { |
| 8053 | return self.Command |
| 8054 | } |
| 8055 | |
| 8056 | func (self *GroupMod) SetCommand(v GroupModCommand) { |
| 8057 | self.Command = v |
| 8058 | } |
| 8059 | |
| 8060 | func (self *GroupMod) GetGroupType() GroupType { |
| 8061 | return self.GroupType |
| 8062 | } |
| 8063 | |
| 8064 | func (self *GroupMod) SetGroupType(v GroupType) { |
| 8065 | self.GroupType = v |
| 8066 | } |
| 8067 | |
| 8068 | func (self *GroupMod) GetGroupId() uint32 { |
| 8069 | return self.GroupId |
| 8070 | } |
| 8071 | |
| 8072 | func (self *GroupMod) SetGroupId(v uint32) { |
| 8073 | self.GroupId = v |
| 8074 | } |
| 8075 | |
| 8076 | func (self *GroupMod) GetBuckets() []*Bucket { |
| 8077 | return self.Buckets |
| 8078 | } |
| 8079 | |
| 8080 | func (self *GroupMod) SetBuckets(v []*Bucket) { |
| 8081 | self.Buckets = v |
| 8082 | } |
| 8083 | |
| 8084 | func (self *GroupMod) Serialize(encoder *goloxi.Encoder) error { |
| 8085 | if err := self.Header.Serialize(encoder); err != nil { |
| 8086 | return err |
| 8087 | } |
| 8088 | |
| 8089 | encoder.PutUint16(uint16(self.Command)) |
| 8090 | encoder.PutUint8(uint8(self.GroupType)) |
| 8091 | encoder.Write(bytes.Repeat([]byte{0}, 1)) |
| 8092 | encoder.PutUint32(uint32(self.GroupId)) |
| 8093 | for _, obj := range self.Buckets { |
| 8094 | if err := obj.Serialize(encoder); err != nil { |
| 8095 | return err |
| 8096 | } |
| 8097 | } |
| 8098 | |
| 8099 | return nil |
| 8100 | } |
| 8101 | |
| 8102 | func DecodeGroupMod(parent *Header, decoder *goloxi.Decoder) (IGroupMod, error) { |
| 8103 | _groupmod := &GroupMod{Header: parent} |
| 8104 | if decoder.Length() < 8 { |
| 8105 | return nil, fmt.Errorf("GroupMod packet too short: %d < 8", decoder.Length()) |
| 8106 | } |
| 8107 | _groupmod.Command = GroupModCommand(decoder.ReadUint16()) |
| 8108 | _groupmod.GroupType = GroupType(decoder.ReadByte()) |
| 8109 | decoder.Skip(1) |
| 8110 | _groupmod.GroupId = uint32(decoder.ReadUint32()) |
| 8111 | |
| 8112 | for decoder.Length() >= 16 { |
| 8113 | item, err := DecodeBucket(decoder) |
| 8114 | if err != nil { |
| 8115 | return nil, err |
| 8116 | } |
| 8117 | if item != nil { |
| 8118 | _groupmod.Buckets = append(_groupmod.Buckets, item) |
| 8119 | } |
| 8120 | } |
| 8121 | |
| 8122 | switch _groupmod.Command { |
| 8123 | case 0: |
| 8124 | return DecodeGroupAdd(_groupmod, decoder) |
| 8125 | case 1: |
| 8126 | return DecodeGroupModify(_groupmod, decoder) |
| 8127 | case 2: |
| 8128 | return DecodeGroupDelete(_groupmod, decoder) |
| 8129 | default: |
| 8130 | return nil, fmt.Errorf("Invalid type '%d' for 'GroupMod'", _groupmod.Command) |
| 8131 | } |
| 8132 | } |
| 8133 | |
| 8134 | func NewGroupMod(_command GroupModCommand) *GroupMod { |
| 8135 | obj := &GroupMod{ |
| 8136 | Header: NewHeader(15), |
| 8137 | } |
| 8138 | obj.Command = _command |
| 8139 | return obj |
| 8140 | } |
| 8141 | |
| 8142 | type GroupAdd struct { |
| 8143 | *GroupMod |
| 8144 | } |
| 8145 | |
| 8146 | type IGroupAdd interface { |
| 8147 | IGroupMod |
| 8148 | } |
| 8149 | |
| 8150 | func (self *GroupAdd) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8151 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8152 | if err := self.GroupMod.Serialize(encoder); err != nil { |
| 8153 | return err |
| 8154 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8155 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8156 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8157 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8158 | |
| 8159 | return nil |
| 8160 | } |
| 8161 | |
| 8162 | func DecodeGroupAdd(parent *GroupMod, decoder *goloxi.Decoder) (*GroupAdd, error) { |
| 8163 | _groupadd := &GroupAdd{GroupMod: parent} |
| 8164 | return _groupadd, nil |
| 8165 | } |
| 8166 | |
| 8167 | func NewGroupAdd() *GroupAdd { |
| 8168 | obj := &GroupAdd{ |
| 8169 | GroupMod: NewGroupMod(0), |
| 8170 | } |
| 8171 | return obj |
| 8172 | } |
| 8173 | |
| 8174 | type GroupDelete struct { |
| 8175 | *GroupMod |
| 8176 | } |
| 8177 | |
| 8178 | type IGroupDelete interface { |
| 8179 | IGroupMod |
| 8180 | } |
| 8181 | |
| 8182 | func (self *GroupDelete) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8183 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8184 | if err := self.GroupMod.Serialize(encoder); err != nil { |
| 8185 | return err |
| 8186 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8187 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8188 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8189 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8190 | |
| 8191 | return nil |
| 8192 | } |
| 8193 | |
| 8194 | func DecodeGroupDelete(parent *GroupMod, decoder *goloxi.Decoder) (*GroupDelete, error) { |
| 8195 | _groupdelete := &GroupDelete{GroupMod: parent} |
| 8196 | return _groupdelete, nil |
| 8197 | } |
| 8198 | |
| 8199 | func NewGroupDelete() *GroupDelete { |
| 8200 | obj := &GroupDelete{ |
| 8201 | GroupMod: NewGroupMod(2), |
| 8202 | } |
| 8203 | return obj |
| 8204 | } |
| 8205 | |
| 8206 | type GroupDescStatsReply struct { |
| 8207 | *StatsReply |
| 8208 | Entries []*GroupDescStatsEntry |
| 8209 | } |
| 8210 | |
| 8211 | type IGroupDescStatsReply interface { |
| 8212 | IStatsReply |
| 8213 | GetEntries() []*GroupDescStatsEntry |
| 8214 | } |
| 8215 | |
| 8216 | func (self *GroupDescStatsReply) GetEntries() []*GroupDescStatsEntry { |
| 8217 | return self.Entries |
| 8218 | } |
| 8219 | |
| 8220 | func (self *GroupDescStatsReply) SetEntries(v []*GroupDescStatsEntry) { |
| 8221 | self.Entries = v |
| 8222 | } |
| 8223 | |
| 8224 | func (self *GroupDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8225 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8226 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 8227 | return err |
| 8228 | } |
| 8229 | |
| 8230 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8231 | for _, obj := range self.Entries { |
| 8232 | if err := obj.Serialize(encoder); err != nil { |
| 8233 | return err |
| 8234 | } |
| 8235 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8236 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8237 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8238 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8239 | |
| 8240 | return nil |
| 8241 | } |
| 8242 | |
| 8243 | func DecodeGroupDescStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*GroupDescStatsReply, error) { |
| 8244 | _groupdescstatsreply := &GroupDescStatsReply{StatsReply: parent} |
| 8245 | if decoder.Length() < 4 { |
| 8246 | return nil, fmt.Errorf("GroupDescStatsReply packet too short: %d < 4", decoder.Length()) |
| 8247 | } |
| 8248 | decoder.Skip(4) |
| 8249 | |
| 8250 | for decoder.Length() >= 8 { |
| 8251 | item, err := DecodeGroupDescStatsEntry(decoder) |
| 8252 | if err != nil { |
| 8253 | return nil, err |
| 8254 | } |
| 8255 | if item != nil { |
| 8256 | _groupdescstatsreply.Entries = append(_groupdescstatsreply.Entries, item) |
| 8257 | } |
| 8258 | } |
| 8259 | return _groupdescstatsreply, nil |
| 8260 | } |
| 8261 | |
| 8262 | func NewGroupDescStatsReply() *GroupDescStatsReply { |
| 8263 | obj := &GroupDescStatsReply{ |
| 8264 | StatsReply: NewStatsReply(7), |
| 8265 | } |
| 8266 | return obj |
| 8267 | } |
| 8268 | |
| 8269 | type GroupDescStatsRequest struct { |
| 8270 | *StatsRequest |
| 8271 | } |
| 8272 | |
| 8273 | type IGroupDescStatsRequest interface { |
| 8274 | IStatsRequest |
| 8275 | } |
| 8276 | |
| 8277 | func (self *GroupDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8278 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8279 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 8280 | return err |
| 8281 | } |
| 8282 | |
| 8283 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8284 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8285 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8286 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8287 | |
| 8288 | return nil |
| 8289 | } |
| 8290 | |
| 8291 | func DecodeGroupDescStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*GroupDescStatsRequest, error) { |
| 8292 | _groupdescstatsrequest := &GroupDescStatsRequest{StatsRequest: parent} |
| 8293 | if decoder.Length() < 4 { |
| 8294 | return nil, fmt.Errorf("GroupDescStatsRequest packet too short: %d < 4", decoder.Length()) |
| 8295 | } |
| 8296 | decoder.Skip(4) |
| 8297 | return _groupdescstatsrequest, nil |
| 8298 | } |
| 8299 | |
| 8300 | func NewGroupDescStatsRequest() *GroupDescStatsRequest { |
| 8301 | obj := &GroupDescStatsRequest{ |
| 8302 | StatsRequest: NewStatsRequest(7), |
| 8303 | } |
| 8304 | return obj |
| 8305 | } |
| 8306 | |
| 8307 | type GroupFeaturesStatsReply struct { |
| 8308 | *StatsReply |
| 8309 | Types uint32 |
| 8310 | Capabilities GroupCapabilities |
| 8311 | MaxGroupsAll uint32 |
| 8312 | MaxGroupsSelect uint32 |
| 8313 | MaxGroupsIndirect uint32 |
| 8314 | MaxGroupsFf uint32 |
| 8315 | ActionsAll uint32 |
| 8316 | ActionsSelect uint32 |
| 8317 | ActionsIndirect uint32 |
| 8318 | ActionsFf uint32 |
| 8319 | } |
| 8320 | |
| 8321 | type IGroupFeaturesStatsReply interface { |
| 8322 | IStatsReply |
| 8323 | GetTypes() uint32 |
| 8324 | GetCapabilities() GroupCapabilities |
| 8325 | GetMaxGroupsAll() uint32 |
| 8326 | GetMaxGroupsSelect() uint32 |
| 8327 | GetMaxGroupsIndirect() uint32 |
| 8328 | GetMaxGroupsFf() uint32 |
| 8329 | GetActionsAll() uint32 |
| 8330 | GetActionsSelect() uint32 |
| 8331 | GetActionsIndirect() uint32 |
| 8332 | GetActionsFf() uint32 |
| 8333 | } |
| 8334 | |
| 8335 | func (self *GroupFeaturesStatsReply) GetTypes() uint32 { |
| 8336 | return self.Types |
| 8337 | } |
| 8338 | |
| 8339 | func (self *GroupFeaturesStatsReply) SetTypes(v uint32) { |
| 8340 | self.Types = v |
| 8341 | } |
| 8342 | |
| 8343 | func (self *GroupFeaturesStatsReply) GetCapabilities() GroupCapabilities { |
| 8344 | return self.Capabilities |
| 8345 | } |
| 8346 | |
| 8347 | func (self *GroupFeaturesStatsReply) SetCapabilities(v GroupCapabilities) { |
| 8348 | self.Capabilities = v |
| 8349 | } |
| 8350 | |
| 8351 | func (self *GroupFeaturesStatsReply) GetMaxGroupsAll() uint32 { |
| 8352 | return self.MaxGroupsAll |
| 8353 | } |
| 8354 | |
| 8355 | func (self *GroupFeaturesStatsReply) SetMaxGroupsAll(v uint32) { |
| 8356 | self.MaxGroupsAll = v |
| 8357 | } |
| 8358 | |
| 8359 | func (self *GroupFeaturesStatsReply) GetMaxGroupsSelect() uint32 { |
| 8360 | return self.MaxGroupsSelect |
| 8361 | } |
| 8362 | |
| 8363 | func (self *GroupFeaturesStatsReply) SetMaxGroupsSelect(v uint32) { |
| 8364 | self.MaxGroupsSelect = v |
| 8365 | } |
| 8366 | |
| 8367 | func (self *GroupFeaturesStatsReply) GetMaxGroupsIndirect() uint32 { |
| 8368 | return self.MaxGroupsIndirect |
| 8369 | } |
| 8370 | |
| 8371 | func (self *GroupFeaturesStatsReply) SetMaxGroupsIndirect(v uint32) { |
| 8372 | self.MaxGroupsIndirect = v |
| 8373 | } |
| 8374 | |
| 8375 | func (self *GroupFeaturesStatsReply) GetMaxGroupsFf() uint32 { |
| 8376 | return self.MaxGroupsFf |
| 8377 | } |
| 8378 | |
| 8379 | func (self *GroupFeaturesStatsReply) SetMaxGroupsFf(v uint32) { |
| 8380 | self.MaxGroupsFf = v |
| 8381 | } |
| 8382 | |
| 8383 | func (self *GroupFeaturesStatsReply) GetActionsAll() uint32 { |
| 8384 | return self.ActionsAll |
| 8385 | } |
| 8386 | |
| 8387 | func (self *GroupFeaturesStatsReply) SetActionsAll(v uint32) { |
| 8388 | self.ActionsAll = v |
| 8389 | } |
| 8390 | |
| 8391 | func (self *GroupFeaturesStatsReply) GetActionsSelect() uint32 { |
| 8392 | return self.ActionsSelect |
| 8393 | } |
| 8394 | |
| 8395 | func (self *GroupFeaturesStatsReply) SetActionsSelect(v uint32) { |
| 8396 | self.ActionsSelect = v |
| 8397 | } |
| 8398 | |
| 8399 | func (self *GroupFeaturesStatsReply) GetActionsIndirect() uint32 { |
| 8400 | return self.ActionsIndirect |
| 8401 | } |
| 8402 | |
| 8403 | func (self *GroupFeaturesStatsReply) SetActionsIndirect(v uint32) { |
| 8404 | self.ActionsIndirect = v |
| 8405 | } |
| 8406 | |
| 8407 | func (self *GroupFeaturesStatsReply) GetActionsFf() uint32 { |
| 8408 | return self.ActionsFf |
| 8409 | } |
| 8410 | |
| 8411 | func (self *GroupFeaturesStatsReply) SetActionsFf(v uint32) { |
| 8412 | self.ActionsFf = v |
| 8413 | } |
| 8414 | |
| 8415 | func (self *GroupFeaturesStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8416 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8417 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 8418 | return err |
| 8419 | } |
| 8420 | |
| 8421 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8422 | encoder.PutUint32(uint32(self.Types)) |
| 8423 | encoder.PutUint32(uint32(self.Capabilities)) |
| 8424 | encoder.PutUint32(uint32(self.MaxGroupsAll)) |
| 8425 | encoder.PutUint32(uint32(self.MaxGroupsSelect)) |
| 8426 | encoder.PutUint32(uint32(self.MaxGroupsIndirect)) |
| 8427 | encoder.PutUint32(uint32(self.MaxGroupsFf)) |
| 8428 | encoder.PutUint32(uint32(self.ActionsAll)) |
| 8429 | encoder.PutUint32(uint32(self.ActionsSelect)) |
| 8430 | encoder.PutUint32(uint32(self.ActionsIndirect)) |
| 8431 | encoder.PutUint32(uint32(self.ActionsFf)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8432 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8433 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8434 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8435 | |
| 8436 | return nil |
| 8437 | } |
| 8438 | |
| 8439 | func DecodeGroupFeaturesStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*GroupFeaturesStatsReply, error) { |
| 8440 | _groupfeaturesstatsreply := &GroupFeaturesStatsReply{StatsReply: parent} |
| 8441 | if decoder.Length() < 44 { |
| 8442 | return nil, fmt.Errorf("GroupFeaturesStatsReply packet too short: %d < 44", decoder.Length()) |
| 8443 | } |
| 8444 | decoder.Skip(4) |
| 8445 | _groupfeaturesstatsreply.Types = uint32(decoder.ReadUint32()) |
| 8446 | _groupfeaturesstatsreply.Capabilities = GroupCapabilities(decoder.ReadUint32()) |
| 8447 | _groupfeaturesstatsreply.MaxGroupsAll = uint32(decoder.ReadUint32()) |
| 8448 | _groupfeaturesstatsreply.MaxGroupsSelect = uint32(decoder.ReadUint32()) |
| 8449 | _groupfeaturesstatsreply.MaxGroupsIndirect = uint32(decoder.ReadUint32()) |
| 8450 | _groupfeaturesstatsreply.MaxGroupsFf = uint32(decoder.ReadUint32()) |
| 8451 | _groupfeaturesstatsreply.ActionsAll = uint32(decoder.ReadUint32()) |
| 8452 | _groupfeaturesstatsreply.ActionsSelect = uint32(decoder.ReadUint32()) |
| 8453 | _groupfeaturesstatsreply.ActionsIndirect = uint32(decoder.ReadUint32()) |
| 8454 | _groupfeaturesstatsreply.ActionsFf = uint32(decoder.ReadUint32()) |
| 8455 | return _groupfeaturesstatsreply, nil |
| 8456 | } |
| 8457 | |
| 8458 | func NewGroupFeaturesStatsReply() *GroupFeaturesStatsReply { |
| 8459 | obj := &GroupFeaturesStatsReply{ |
| 8460 | StatsReply: NewStatsReply(8), |
| 8461 | } |
| 8462 | return obj |
| 8463 | } |
| 8464 | |
| 8465 | type GroupFeaturesStatsRequest struct { |
| 8466 | *StatsRequest |
| 8467 | } |
| 8468 | |
| 8469 | type IGroupFeaturesStatsRequest interface { |
| 8470 | IStatsRequest |
| 8471 | } |
| 8472 | |
| 8473 | func (self *GroupFeaturesStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8474 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8475 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 8476 | return err |
| 8477 | } |
| 8478 | |
| 8479 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8480 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8481 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8482 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8483 | |
| 8484 | return nil |
| 8485 | } |
| 8486 | |
| 8487 | func DecodeGroupFeaturesStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*GroupFeaturesStatsRequest, error) { |
| 8488 | _groupfeaturesstatsrequest := &GroupFeaturesStatsRequest{StatsRequest: parent} |
| 8489 | if decoder.Length() < 4 { |
| 8490 | return nil, fmt.Errorf("GroupFeaturesStatsRequest packet too short: %d < 4", decoder.Length()) |
| 8491 | } |
| 8492 | decoder.Skip(4) |
| 8493 | return _groupfeaturesstatsrequest, nil |
| 8494 | } |
| 8495 | |
| 8496 | func NewGroupFeaturesStatsRequest() *GroupFeaturesStatsRequest { |
| 8497 | obj := &GroupFeaturesStatsRequest{ |
| 8498 | StatsRequest: NewStatsRequest(8), |
| 8499 | } |
| 8500 | return obj |
| 8501 | } |
| 8502 | |
| 8503 | type GroupModFailedErrorMsg struct { |
| 8504 | *ErrorMsg |
| 8505 | Code GroupModFailedCode |
| 8506 | Data []byte |
| 8507 | } |
| 8508 | |
| 8509 | type IGroupModFailedErrorMsg interface { |
| 8510 | IErrorMsg |
| 8511 | GetCode() GroupModFailedCode |
| 8512 | GetData() []byte |
| 8513 | } |
| 8514 | |
| 8515 | func (self *GroupModFailedErrorMsg) GetCode() GroupModFailedCode { |
| 8516 | return self.Code |
| 8517 | } |
| 8518 | |
| 8519 | func (self *GroupModFailedErrorMsg) SetCode(v GroupModFailedCode) { |
| 8520 | self.Code = v |
| 8521 | } |
| 8522 | |
| 8523 | func (self *GroupModFailedErrorMsg) GetData() []byte { |
| 8524 | return self.Data |
| 8525 | } |
| 8526 | |
| 8527 | func (self *GroupModFailedErrorMsg) SetData(v []byte) { |
| 8528 | self.Data = v |
| 8529 | } |
| 8530 | |
| 8531 | func (self *GroupModFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8532 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8533 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 8534 | return err |
| 8535 | } |
| 8536 | |
| 8537 | encoder.PutUint16(uint16(self.Code)) |
| 8538 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8539 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8540 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8541 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8542 | |
| 8543 | return nil |
| 8544 | } |
| 8545 | |
| 8546 | func DecodeGroupModFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*GroupModFailedErrorMsg, error) { |
| 8547 | _groupmodfailederrormsg := &GroupModFailedErrorMsg{ErrorMsg: parent} |
| 8548 | if decoder.Length() < 2 { |
| 8549 | return nil, fmt.Errorf("GroupModFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 8550 | } |
| 8551 | _groupmodfailederrormsg.Code = GroupModFailedCode(decoder.ReadUint16()) |
| 8552 | _groupmodfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 8553 | return _groupmodfailederrormsg, nil |
| 8554 | } |
| 8555 | |
| 8556 | func NewGroupModFailedErrorMsg() *GroupModFailedErrorMsg { |
| 8557 | obj := &GroupModFailedErrorMsg{ |
| 8558 | ErrorMsg: NewErrorMsg(6), |
| 8559 | } |
| 8560 | return obj |
| 8561 | } |
| 8562 | |
| 8563 | type GroupModify struct { |
| 8564 | *GroupMod |
| 8565 | } |
| 8566 | |
| 8567 | type IGroupModify interface { |
| 8568 | IGroupMod |
| 8569 | } |
| 8570 | |
| 8571 | func (self *GroupModify) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8572 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8573 | if err := self.GroupMod.Serialize(encoder); err != nil { |
| 8574 | return err |
| 8575 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8576 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8577 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8578 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8579 | |
| 8580 | return nil |
| 8581 | } |
| 8582 | |
| 8583 | func DecodeGroupModify(parent *GroupMod, decoder *goloxi.Decoder) (*GroupModify, error) { |
| 8584 | _groupmodify := &GroupModify{GroupMod: parent} |
| 8585 | return _groupmodify, nil |
| 8586 | } |
| 8587 | |
| 8588 | func NewGroupModify() *GroupModify { |
| 8589 | obj := &GroupModify{ |
| 8590 | GroupMod: NewGroupMod(1), |
| 8591 | } |
| 8592 | return obj |
| 8593 | } |
| 8594 | |
| 8595 | type GroupStatsReply struct { |
| 8596 | *StatsReply |
| 8597 | Entries []*GroupStatsEntry |
| 8598 | } |
| 8599 | |
| 8600 | type IGroupStatsReply interface { |
| 8601 | IStatsReply |
| 8602 | GetEntries() []*GroupStatsEntry |
| 8603 | } |
| 8604 | |
| 8605 | func (self *GroupStatsReply) GetEntries() []*GroupStatsEntry { |
| 8606 | return self.Entries |
| 8607 | } |
| 8608 | |
| 8609 | func (self *GroupStatsReply) SetEntries(v []*GroupStatsEntry) { |
| 8610 | self.Entries = v |
| 8611 | } |
| 8612 | |
| 8613 | func (self *GroupStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8614 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8615 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 8616 | return err |
| 8617 | } |
| 8618 | |
| 8619 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8620 | for _, obj := range self.Entries { |
| 8621 | if err := obj.Serialize(encoder); err != nil { |
| 8622 | return err |
| 8623 | } |
| 8624 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8625 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8626 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8627 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8628 | |
| 8629 | return nil |
| 8630 | } |
| 8631 | |
| 8632 | func DecodeGroupStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*GroupStatsReply, error) { |
| 8633 | _groupstatsreply := &GroupStatsReply{StatsReply: parent} |
| 8634 | if decoder.Length() < 4 { |
| 8635 | return nil, fmt.Errorf("GroupStatsReply packet too short: %d < 4", decoder.Length()) |
| 8636 | } |
| 8637 | decoder.Skip(4) |
| 8638 | |
| 8639 | for decoder.Length() >= 40 { |
| 8640 | item, err := DecodeGroupStatsEntry(decoder) |
| 8641 | if err != nil { |
| 8642 | return nil, err |
| 8643 | } |
| 8644 | if item != nil { |
| 8645 | _groupstatsreply.Entries = append(_groupstatsreply.Entries, item) |
| 8646 | } |
| 8647 | } |
| 8648 | return _groupstatsreply, nil |
| 8649 | } |
| 8650 | |
| 8651 | func NewGroupStatsReply() *GroupStatsReply { |
| 8652 | obj := &GroupStatsReply{ |
| 8653 | StatsReply: NewStatsReply(6), |
| 8654 | } |
| 8655 | return obj |
| 8656 | } |
| 8657 | |
| 8658 | type GroupStatsRequest struct { |
| 8659 | *StatsRequest |
| 8660 | GroupId uint32 |
| 8661 | } |
| 8662 | |
| 8663 | type IGroupStatsRequest interface { |
| 8664 | IStatsRequest |
| 8665 | GetGroupId() uint32 |
| 8666 | } |
| 8667 | |
| 8668 | func (self *GroupStatsRequest) GetGroupId() uint32 { |
| 8669 | return self.GroupId |
| 8670 | } |
| 8671 | |
| 8672 | func (self *GroupStatsRequest) SetGroupId(v uint32) { |
| 8673 | self.GroupId = v |
| 8674 | } |
| 8675 | |
| 8676 | func (self *GroupStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8677 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8678 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 8679 | return err |
| 8680 | } |
| 8681 | |
| 8682 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8683 | encoder.PutUint32(uint32(self.GroupId)) |
| 8684 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8685 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8686 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8687 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8688 | |
| 8689 | return nil |
| 8690 | } |
| 8691 | |
| 8692 | func DecodeGroupStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*GroupStatsRequest, error) { |
| 8693 | _groupstatsrequest := &GroupStatsRequest{StatsRequest: parent} |
| 8694 | if decoder.Length() < 4 { |
| 8695 | return nil, fmt.Errorf("GroupStatsRequest packet too short: %d < 4", decoder.Length()) |
| 8696 | } |
| 8697 | decoder.Skip(4) |
| 8698 | _groupstatsrequest.GroupId = uint32(decoder.ReadUint32()) |
| 8699 | decoder.Skip(4) |
| 8700 | return _groupstatsrequest, nil |
| 8701 | } |
| 8702 | |
| 8703 | func NewGroupStatsRequest() *GroupStatsRequest { |
| 8704 | obj := &GroupStatsRequest{ |
| 8705 | StatsRequest: NewStatsRequest(6), |
| 8706 | } |
| 8707 | return obj |
| 8708 | } |
| 8709 | |
| 8710 | type Hello struct { |
| 8711 | *Header |
| 8712 | Elements []IHelloElem |
| 8713 | } |
| 8714 | |
| 8715 | type IHello interface { |
| 8716 | IHeader |
| 8717 | GetElements() []IHelloElem |
| 8718 | } |
| 8719 | |
| 8720 | func (self *Hello) GetElements() []IHelloElem { |
| 8721 | return self.Elements |
| 8722 | } |
| 8723 | |
| 8724 | func (self *Hello) SetElements(v []IHelloElem) { |
| 8725 | self.Elements = v |
| 8726 | } |
| 8727 | |
| 8728 | func (self *Hello) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8729 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8730 | if err := self.Header.Serialize(encoder); err != nil { |
| 8731 | return err |
| 8732 | } |
| 8733 | |
| 8734 | for _, obj := range self.Elements { |
| 8735 | if err := obj.Serialize(encoder); err != nil { |
| 8736 | return err |
| 8737 | } |
| 8738 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8739 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8740 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8741 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8742 | |
| 8743 | return nil |
| 8744 | } |
| 8745 | |
| 8746 | func DecodeHello(parent *Header, decoder *goloxi.Decoder) (*Hello, error) { |
| 8747 | _hello := &Hello{Header: parent} |
| 8748 | |
| 8749 | for decoder.Length() >= 4 { |
| 8750 | item, err := DecodeHelloElem(decoder) |
| 8751 | if err != nil { |
| 8752 | return nil, err |
| 8753 | } |
| 8754 | if item != nil { |
| 8755 | _hello.Elements = append(_hello.Elements, item) |
| 8756 | } |
| 8757 | } |
| 8758 | return _hello, nil |
| 8759 | } |
| 8760 | |
| 8761 | func NewHello() *Hello { |
| 8762 | obj := &Hello{ |
| 8763 | Header: NewHeader(0), |
| 8764 | } |
| 8765 | return obj |
| 8766 | } |
| 8767 | |
| 8768 | type HelloFailedErrorMsg struct { |
| 8769 | *ErrorMsg |
| 8770 | Code HelloFailedCode |
| 8771 | Data []byte |
| 8772 | } |
| 8773 | |
| 8774 | type IHelloFailedErrorMsg interface { |
| 8775 | IErrorMsg |
| 8776 | GetCode() HelloFailedCode |
| 8777 | GetData() []byte |
| 8778 | } |
| 8779 | |
| 8780 | func (self *HelloFailedErrorMsg) GetCode() HelloFailedCode { |
| 8781 | return self.Code |
| 8782 | } |
| 8783 | |
| 8784 | func (self *HelloFailedErrorMsg) SetCode(v HelloFailedCode) { |
| 8785 | self.Code = v |
| 8786 | } |
| 8787 | |
| 8788 | func (self *HelloFailedErrorMsg) GetData() []byte { |
| 8789 | return self.Data |
| 8790 | } |
| 8791 | |
| 8792 | func (self *HelloFailedErrorMsg) SetData(v []byte) { |
| 8793 | self.Data = v |
| 8794 | } |
| 8795 | |
| 8796 | func (self *HelloFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8797 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8798 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 8799 | return err |
| 8800 | } |
| 8801 | |
| 8802 | encoder.PutUint16(uint16(self.Code)) |
| 8803 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8804 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8805 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8806 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8807 | |
| 8808 | return nil |
| 8809 | } |
| 8810 | |
| 8811 | func DecodeHelloFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*HelloFailedErrorMsg, error) { |
| 8812 | _hellofailederrormsg := &HelloFailedErrorMsg{ErrorMsg: parent} |
| 8813 | if decoder.Length() < 2 { |
| 8814 | return nil, fmt.Errorf("HelloFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 8815 | } |
| 8816 | _hellofailederrormsg.Code = HelloFailedCode(decoder.ReadUint16()) |
| 8817 | _hellofailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 8818 | return _hellofailederrormsg, nil |
| 8819 | } |
| 8820 | |
| 8821 | func NewHelloFailedErrorMsg() *HelloFailedErrorMsg { |
| 8822 | obj := &HelloFailedErrorMsg{ |
| 8823 | ErrorMsg: NewErrorMsg(0), |
| 8824 | } |
| 8825 | return obj |
| 8826 | } |
| 8827 | |
| 8828 | type MeterConfigStatsReply struct { |
| 8829 | *StatsReply |
| 8830 | Entries []*MeterConfig |
| 8831 | } |
| 8832 | |
| 8833 | type IMeterConfigStatsReply interface { |
| 8834 | IStatsReply |
| 8835 | GetEntries() []*MeterConfig |
| 8836 | } |
| 8837 | |
| 8838 | func (self *MeterConfigStatsReply) GetEntries() []*MeterConfig { |
| 8839 | return self.Entries |
| 8840 | } |
| 8841 | |
| 8842 | func (self *MeterConfigStatsReply) SetEntries(v []*MeterConfig) { |
| 8843 | self.Entries = v |
| 8844 | } |
| 8845 | |
| 8846 | func (self *MeterConfigStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8847 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8848 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 8849 | return err |
| 8850 | } |
| 8851 | |
| 8852 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8853 | for _, obj := range self.Entries { |
| 8854 | if err := obj.Serialize(encoder); err != nil { |
| 8855 | return err |
| 8856 | } |
| 8857 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8858 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8859 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8860 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8861 | |
| 8862 | return nil |
| 8863 | } |
| 8864 | |
| 8865 | func DecodeMeterConfigStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*MeterConfigStatsReply, error) { |
| 8866 | _meterconfigstatsreply := &MeterConfigStatsReply{StatsReply: parent} |
| 8867 | if decoder.Length() < 4 { |
| 8868 | return nil, fmt.Errorf("MeterConfigStatsReply packet too short: %d < 4", decoder.Length()) |
| 8869 | } |
| 8870 | decoder.Skip(4) |
| 8871 | |
| 8872 | for decoder.Length() >= 8 { |
| 8873 | item, err := DecodeMeterConfig(decoder) |
| 8874 | if err != nil { |
| 8875 | return nil, err |
| 8876 | } |
| 8877 | if item != nil { |
| 8878 | _meterconfigstatsreply.Entries = append(_meterconfigstatsreply.Entries, item) |
| 8879 | } |
| 8880 | } |
| 8881 | return _meterconfigstatsreply, nil |
| 8882 | } |
| 8883 | |
| 8884 | func NewMeterConfigStatsReply() *MeterConfigStatsReply { |
| 8885 | obj := &MeterConfigStatsReply{ |
| 8886 | StatsReply: NewStatsReply(10), |
| 8887 | } |
| 8888 | return obj |
| 8889 | } |
| 8890 | |
| 8891 | type MeterConfigStatsRequest struct { |
| 8892 | *StatsRequest |
| 8893 | MeterId uint32 |
| 8894 | } |
| 8895 | |
| 8896 | type IMeterConfigStatsRequest interface { |
| 8897 | IStatsRequest |
| 8898 | GetMeterId() uint32 |
| 8899 | } |
| 8900 | |
| 8901 | func (self *MeterConfigStatsRequest) GetMeterId() uint32 { |
| 8902 | return self.MeterId |
| 8903 | } |
| 8904 | |
| 8905 | func (self *MeterConfigStatsRequest) SetMeterId(v uint32) { |
| 8906 | self.MeterId = v |
| 8907 | } |
| 8908 | |
| 8909 | func (self *MeterConfigStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8910 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8911 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 8912 | return err |
| 8913 | } |
| 8914 | |
| 8915 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8916 | encoder.PutUint32(uint32(self.MeterId)) |
| 8917 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8918 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8919 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8920 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8921 | |
| 8922 | return nil |
| 8923 | } |
| 8924 | |
| 8925 | func DecodeMeterConfigStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*MeterConfigStatsRequest, error) { |
| 8926 | _meterconfigstatsrequest := &MeterConfigStatsRequest{StatsRequest: parent} |
| 8927 | if decoder.Length() < 4 { |
| 8928 | return nil, fmt.Errorf("MeterConfigStatsRequest packet too short: %d < 4", decoder.Length()) |
| 8929 | } |
| 8930 | decoder.Skip(4) |
| 8931 | _meterconfigstatsrequest.MeterId = uint32(decoder.ReadUint32()) |
| 8932 | decoder.Skip(4) |
| 8933 | return _meterconfigstatsrequest, nil |
| 8934 | } |
| 8935 | |
| 8936 | func NewMeterConfigStatsRequest() *MeterConfigStatsRequest { |
| 8937 | obj := &MeterConfigStatsRequest{ |
| 8938 | StatsRequest: NewStatsRequest(10), |
| 8939 | } |
| 8940 | return obj |
| 8941 | } |
| 8942 | |
| 8943 | type MeterFeaturesStatsReply struct { |
| 8944 | *StatsReply |
| 8945 | Features MeterFeatures |
| 8946 | } |
| 8947 | |
| 8948 | type IMeterFeaturesStatsReply interface { |
| 8949 | IStatsReply |
| 8950 | GetFeatures() MeterFeatures |
| 8951 | } |
| 8952 | |
| 8953 | func (self *MeterFeaturesStatsReply) GetFeatures() MeterFeatures { |
| 8954 | return self.Features |
| 8955 | } |
| 8956 | |
| 8957 | func (self *MeterFeaturesStatsReply) SetFeatures(v MeterFeatures) { |
| 8958 | self.Features = v |
| 8959 | } |
| 8960 | |
| 8961 | func (self *MeterFeaturesStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8962 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8963 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 8964 | return err |
| 8965 | } |
| 8966 | |
| 8967 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 8968 | if err := self.Features.Serialize(encoder); err != nil { |
| 8969 | return err |
| 8970 | } |
| 8971 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 8972 | length := len(encoder.Bytes()) - startIndex |
| 8973 | |
| 8974 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 8975 | |
| 8976 | return nil |
| 8977 | } |
| 8978 | |
| 8979 | func DecodeMeterFeaturesStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*MeterFeaturesStatsReply, error) { |
| 8980 | _meterfeaturesstatsreply := &MeterFeaturesStatsReply{StatsReply: parent} |
| 8981 | if decoder.Length() < 20 { |
| 8982 | return nil, fmt.Errorf("MeterFeaturesStatsReply packet too short: %d < 20", decoder.Length()) |
| 8983 | } |
| 8984 | decoder.Skip(4) |
| 8985 | if err := _meterfeaturesstatsreply.Features.Decode(decoder); err != nil { |
| 8986 | return nil, err |
| 8987 | } |
| 8988 | |
| 8989 | return _meterfeaturesstatsreply, nil |
| 8990 | } |
| 8991 | |
| 8992 | func NewMeterFeaturesStatsReply() *MeterFeaturesStatsReply { |
| 8993 | obj := &MeterFeaturesStatsReply{ |
| 8994 | StatsReply: NewStatsReply(11), |
| 8995 | } |
| 8996 | return obj |
| 8997 | } |
| 8998 | |
| 8999 | type MeterFeaturesStatsRequest struct { |
| 9000 | *StatsRequest |
| 9001 | } |
| 9002 | |
| 9003 | type IMeterFeaturesStatsRequest interface { |
| 9004 | IStatsRequest |
| 9005 | } |
| 9006 | |
| 9007 | func (self *MeterFeaturesStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9008 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9009 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 9010 | return err |
| 9011 | } |
| 9012 | |
| 9013 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9014 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9015 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9016 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9017 | |
| 9018 | return nil |
| 9019 | } |
| 9020 | |
| 9021 | func DecodeMeterFeaturesStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*MeterFeaturesStatsRequest, error) { |
| 9022 | _meterfeaturesstatsrequest := &MeterFeaturesStatsRequest{StatsRequest: parent} |
| 9023 | if decoder.Length() < 4 { |
| 9024 | return nil, fmt.Errorf("MeterFeaturesStatsRequest packet too short: %d < 4", decoder.Length()) |
| 9025 | } |
| 9026 | decoder.Skip(4) |
| 9027 | return _meterfeaturesstatsrequest, nil |
| 9028 | } |
| 9029 | |
| 9030 | func NewMeterFeaturesStatsRequest() *MeterFeaturesStatsRequest { |
| 9031 | obj := &MeterFeaturesStatsRequest{ |
| 9032 | StatsRequest: NewStatsRequest(11), |
| 9033 | } |
| 9034 | return obj |
| 9035 | } |
| 9036 | |
| 9037 | type MeterMod struct { |
| 9038 | *Header |
| 9039 | Command MeterModCommand |
| 9040 | Flags MeterFlags |
| 9041 | MeterId uint32 |
| 9042 | Meters []IMeterBand |
| 9043 | } |
| 9044 | |
| 9045 | type IMeterMod interface { |
| 9046 | IHeader |
| 9047 | GetCommand() MeterModCommand |
| 9048 | GetFlags() MeterFlags |
| 9049 | GetMeterId() uint32 |
| 9050 | GetMeters() []IMeterBand |
| 9051 | } |
| 9052 | |
| 9053 | func (self *MeterMod) GetCommand() MeterModCommand { |
| 9054 | return self.Command |
| 9055 | } |
| 9056 | |
| 9057 | func (self *MeterMod) SetCommand(v MeterModCommand) { |
| 9058 | self.Command = v |
| 9059 | } |
| 9060 | |
| 9061 | func (self *MeterMod) GetFlags() MeterFlags { |
| 9062 | return self.Flags |
| 9063 | } |
| 9064 | |
| 9065 | func (self *MeterMod) SetFlags(v MeterFlags) { |
| 9066 | self.Flags = v |
| 9067 | } |
| 9068 | |
| 9069 | func (self *MeterMod) GetMeterId() uint32 { |
| 9070 | return self.MeterId |
| 9071 | } |
| 9072 | |
| 9073 | func (self *MeterMod) SetMeterId(v uint32) { |
| 9074 | self.MeterId = v |
| 9075 | } |
| 9076 | |
| 9077 | func (self *MeterMod) GetMeters() []IMeterBand { |
| 9078 | return self.Meters |
| 9079 | } |
| 9080 | |
| 9081 | func (self *MeterMod) SetMeters(v []IMeterBand) { |
| 9082 | self.Meters = v |
| 9083 | } |
| 9084 | |
| 9085 | func (self *MeterMod) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9086 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9087 | if err := self.Header.Serialize(encoder); err != nil { |
| 9088 | return err |
| 9089 | } |
| 9090 | |
| 9091 | encoder.PutUint16(uint16(self.Command)) |
| 9092 | encoder.PutUint16(uint16(self.Flags)) |
| 9093 | encoder.PutUint32(uint32(self.MeterId)) |
| 9094 | for _, obj := range self.Meters { |
| 9095 | if err := obj.Serialize(encoder); err != nil { |
| 9096 | return err |
| 9097 | } |
| 9098 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9099 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9100 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9101 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9102 | |
| 9103 | return nil |
| 9104 | } |
| 9105 | |
| 9106 | func DecodeMeterMod(parent *Header, decoder *goloxi.Decoder) (*MeterMod, error) { |
| 9107 | _metermod := &MeterMod{Header: parent} |
| 9108 | if decoder.Length() < 8 { |
| 9109 | return nil, fmt.Errorf("MeterMod packet too short: %d < 8", decoder.Length()) |
| 9110 | } |
| 9111 | _metermod.Command = MeterModCommand(decoder.ReadUint16()) |
| 9112 | _metermod.Flags = MeterFlags(decoder.ReadUint16()) |
| 9113 | _metermod.MeterId = uint32(decoder.ReadUint32()) |
| 9114 | |
| 9115 | for decoder.Length() >= 4 { |
| 9116 | item, err := DecodeMeterBand(decoder) |
| 9117 | if err != nil { |
| 9118 | return nil, err |
| 9119 | } |
| 9120 | if item != nil { |
| 9121 | _metermod.Meters = append(_metermod.Meters, item) |
| 9122 | } |
| 9123 | } |
| 9124 | return _metermod, nil |
| 9125 | } |
| 9126 | |
| 9127 | func NewMeterMod() *MeterMod { |
| 9128 | obj := &MeterMod{ |
| 9129 | Header: NewHeader(29), |
| 9130 | } |
| 9131 | return obj |
| 9132 | } |
| 9133 | |
| 9134 | type MeterModFailedErrorMsg struct { |
| 9135 | *ErrorMsg |
| 9136 | Code MeterModFailedCode |
| 9137 | Data []byte |
| 9138 | } |
| 9139 | |
| 9140 | type IMeterModFailedErrorMsg interface { |
| 9141 | IErrorMsg |
| 9142 | GetCode() MeterModFailedCode |
| 9143 | GetData() []byte |
| 9144 | } |
| 9145 | |
| 9146 | func (self *MeterModFailedErrorMsg) GetCode() MeterModFailedCode { |
| 9147 | return self.Code |
| 9148 | } |
| 9149 | |
| 9150 | func (self *MeterModFailedErrorMsg) SetCode(v MeterModFailedCode) { |
| 9151 | self.Code = v |
| 9152 | } |
| 9153 | |
| 9154 | func (self *MeterModFailedErrorMsg) GetData() []byte { |
| 9155 | return self.Data |
| 9156 | } |
| 9157 | |
| 9158 | func (self *MeterModFailedErrorMsg) SetData(v []byte) { |
| 9159 | self.Data = v |
| 9160 | } |
| 9161 | |
| 9162 | func (self *MeterModFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9163 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9164 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 9165 | return err |
| 9166 | } |
| 9167 | |
| 9168 | encoder.PutUint16(uint16(self.Code)) |
| 9169 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9170 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9171 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9172 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9173 | |
| 9174 | return nil |
| 9175 | } |
| 9176 | |
| 9177 | func DecodeMeterModFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*MeterModFailedErrorMsg, error) { |
| 9178 | _metermodfailederrormsg := &MeterModFailedErrorMsg{ErrorMsg: parent} |
| 9179 | if decoder.Length() < 2 { |
| 9180 | return nil, fmt.Errorf("MeterModFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 9181 | } |
| 9182 | _metermodfailederrormsg.Code = MeterModFailedCode(decoder.ReadUint16()) |
| 9183 | _metermodfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 9184 | return _metermodfailederrormsg, nil |
| 9185 | } |
| 9186 | |
| 9187 | func NewMeterModFailedErrorMsg() *MeterModFailedErrorMsg { |
| 9188 | obj := &MeterModFailedErrorMsg{ |
| 9189 | ErrorMsg: NewErrorMsg(12), |
| 9190 | } |
| 9191 | return obj |
| 9192 | } |
| 9193 | |
| 9194 | type MeterStatsReply struct { |
| 9195 | *StatsReply |
| 9196 | Entries []*MeterStats |
| 9197 | } |
| 9198 | |
| 9199 | type IMeterStatsReply interface { |
| 9200 | IStatsReply |
| 9201 | GetEntries() []*MeterStats |
| 9202 | } |
| 9203 | |
| 9204 | func (self *MeterStatsReply) GetEntries() []*MeterStats { |
| 9205 | return self.Entries |
| 9206 | } |
| 9207 | |
| 9208 | func (self *MeterStatsReply) SetEntries(v []*MeterStats) { |
| 9209 | self.Entries = v |
| 9210 | } |
| 9211 | |
| 9212 | func (self *MeterStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9213 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9214 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 9215 | return err |
| 9216 | } |
| 9217 | |
| 9218 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9219 | for _, obj := range self.Entries { |
| 9220 | if err := obj.Serialize(encoder); err != nil { |
| 9221 | return err |
| 9222 | } |
| 9223 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9224 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9225 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9226 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9227 | |
| 9228 | return nil |
| 9229 | } |
| 9230 | |
| 9231 | func DecodeMeterStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*MeterStatsReply, error) { |
| 9232 | _meterstatsreply := &MeterStatsReply{StatsReply: parent} |
| 9233 | if decoder.Length() < 4 { |
| 9234 | return nil, fmt.Errorf("MeterStatsReply packet too short: %d < 4", decoder.Length()) |
| 9235 | } |
| 9236 | decoder.Skip(4) |
| 9237 | |
| 9238 | for decoder.Length() >= 40 { |
| 9239 | item, err := DecodeMeterStats(decoder) |
| 9240 | if err != nil { |
| 9241 | return nil, err |
| 9242 | } |
| 9243 | if item != nil { |
| 9244 | _meterstatsreply.Entries = append(_meterstatsreply.Entries, item) |
| 9245 | } |
| 9246 | } |
| 9247 | return _meterstatsreply, nil |
| 9248 | } |
| 9249 | |
| 9250 | func NewMeterStatsReply() *MeterStatsReply { |
| 9251 | obj := &MeterStatsReply{ |
| 9252 | StatsReply: NewStatsReply(9), |
| 9253 | } |
| 9254 | return obj |
| 9255 | } |
| 9256 | |
| 9257 | type MeterStatsRequest struct { |
| 9258 | *StatsRequest |
| 9259 | MeterId uint32 |
| 9260 | } |
| 9261 | |
| 9262 | type IMeterStatsRequest interface { |
| 9263 | IStatsRequest |
| 9264 | GetMeterId() uint32 |
| 9265 | } |
| 9266 | |
| 9267 | func (self *MeterStatsRequest) GetMeterId() uint32 { |
| 9268 | return self.MeterId |
| 9269 | } |
| 9270 | |
| 9271 | func (self *MeterStatsRequest) SetMeterId(v uint32) { |
| 9272 | self.MeterId = v |
| 9273 | } |
| 9274 | |
| 9275 | func (self *MeterStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9276 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9277 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 9278 | return err |
| 9279 | } |
| 9280 | |
| 9281 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9282 | encoder.PutUint32(uint32(self.MeterId)) |
| 9283 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9284 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9285 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9286 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9287 | |
| 9288 | return nil |
| 9289 | } |
| 9290 | |
| 9291 | func DecodeMeterStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*MeterStatsRequest, error) { |
| 9292 | _meterstatsrequest := &MeterStatsRequest{StatsRequest: parent} |
| 9293 | if decoder.Length() < 4 { |
| 9294 | return nil, fmt.Errorf("MeterStatsRequest packet too short: %d < 4", decoder.Length()) |
| 9295 | } |
| 9296 | decoder.Skip(4) |
| 9297 | _meterstatsrequest.MeterId = uint32(decoder.ReadUint32()) |
| 9298 | decoder.Skip(4) |
| 9299 | return _meterstatsrequest, nil |
| 9300 | } |
| 9301 | |
| 9302 | func NewMeterStatsRequest() *MeterStatsRequest { |
| 9303 | obj := &MeterStatsRequest{ |
| 9304 | StatsRequest: NewStatsRequest(9), |
| 9305 | } |
| 9306 | return obj |
| 9307 | } |
| 9308 | |
| 9309 | type NiciraStatsReply struct { |
| 9310 | *ExperimenterStatsReply |
| 9311 | } |
| 9312 | |
| 9313 | type INiciraStatsReply interface { |
| 9314 | IExperimenterStatsReply |
| 9315 | } |
| 9316 | |
| 9317 | func (self *NiciraStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 9318 | if err := self.ExperimenterStatsReply.Serialize(encoder); err != nil { |
| 9319 | return err |
| 9320 | } |
| 9321 | |
| 9322 | return nil |
| 9323 | } |
| 9324 | |
| 9325 | func DecodeNiciraStatsReply(parent *ExperimenterStatsReply, decoder *goloxi.Decoder) (INiciraStatsReply, error) { |
| 9326 | _nicirastatsreply := &NiciraStatsReply{ExperimenterStatsReply: parent} |
| 9327 | if decoder.Length() < -4 { |
| 9328 | return nil, fmt.Errorf("NiciraStatsReply packet too short: %d < -4", decoder.Length()) |
| 9329 | } |
| 9330 | |
| 9331 | switch _nicirastatsreply.Subtype { |
| 9332 | case 0: |
| 9333 | return DecodeNiciraFlowStatsReply(_nicirastatsreply, decoder) |
| 9334 | case 2: |
| 9335 | return DecodeNiciraFlowMonitorReply(_nicirastatsreply, decoder) |
| 9336 | default: |
| 9337 | return nil, fmt.Errorf("Invalid type '%d' for 'NiciraStatsReply'", _nicirastatsreply.Subtype) |
| 9338 | } |
| 9339 | } |
| 9340 | |
| 9341 | func NewNiciraStatsReply(_subtype uint32) *NiciraStatsReply { |
| 9342 | obj := &NiciraStatsReply{ |
| 9343 | ExperimenterStatsReply: NewExperimenterStatsReply(8992), |
| 9344 | } |
| 9345 | obj.Subtype = _subtype |
| 9346 | return obj |
| 9347 | } |
| 9348 | |
| 9349 | type NiciraFlowMonitorReply struct { |
| 9350 | *NiciraStatsReply |
| 9351 | Updates []INiciraFlowUpdateEvent |
| 9352 | } |
| 9353 | |
| 9354 | type INiciraFlowMonitorReply interface { |
| 9355 | INiciraStatsReply |
| 9356 | GetUpdates() []INiciraFlowUpdateEvent |
| 9357 | } |
| 9358 | |
| 9359 | func (self *NiciraFlowMonitorReply) GetUpdates() []INiciraFlowUpdateEvent { |
| 9360 | return self.Updates |
| 9361 | } |
| 9362 | |
| 9363 | func (self *NiciraFlowMonitorReply) SetUpdates(v []INiciraFlowUpdateEvent) { |
| 9364 | self.Updates = v |
| 9365 | } |
| 9366 | |
| 9367 | func (self *NiciraFlowMonitorReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9368 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9369 | if err := self.NiciraStatsReply.Serialize(encoder); err != nil { |
| 9370 | return err |
| 9371 | } |
| 9372 | |
| 9373 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9374 | for _, obj := range self.Updates { |
| 9375 | if err := obj.Serialize(encoder); err != nil { |
| 9376 | return err |
| 9377 | } |
| 9378 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9379 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9380 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9381 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9382 | |
| 9383 | return nil |
| 9384 | } |
| 9385 | |
| 9386 | func DecodeNiciraFlowMonitorReply(parent *NiciraStatsReply, decoder *goloxi.Decoder) (*NiciraFlowMonitorReply, error) { |
| 9387 | _niciraflowmonitorreply := &NiciraFlowMonitorReply{NiciraStatsReply: parent} |
| 9388 | if decoder.Length() < 4 { |
| 9389 | return nil, fmt.Errorf("NiciraFlowMonitorReply packet too short: %d < 4", decoder.Length()) |
| 9390 | } |
| 9391 | decoder.Skip(4) |
| 9392 | |
| 9393 | for decoder.Length() >= 4 { |
| 9394 | item, err := DecodeNiciraFlowUpdateEvent(decoder) |
| 9395 | if err != nil { |
| 9396 | return nil, err |
| 9397 | } |
| 9398 | if item != nil { |
| 9399 | _niciraflowmonitorreply.Updates = append(_niciraflowmonitorreply.Updates, item) |
| 9400 | } |
| 9401 | } |
| 9402 | return _niciraflowmonitorreply, nil |
| 9403 | } |
| 9404 | |
| 9405 | func NewNiciraFlowMonitorReply() *NiciraFlowMonitorReply { |
| 9406 | obj := &NiciraFlowMonitorReply{ |
| 9407 | NiciraStatsReply: NewNiciraStatsReply(2), |
| 9408 | } |
| 9409 | return obj |
| 9410 | } |
| 9411 | |
| 9412 | type NiciraFlowMonitorRequest struct { |
| 9413 | *ExperimenterStatsRequest |
| 9414 | MonitorId uint32 |
| 9415 | MonitorFlags NxFlowMonitorFlags |
| 9416 | OutPort Port |
| 9417 | MatchLen uint16 |
| 9418 | TableId uint8 |
| 9419 | Match NiciraMatch |
| 9420 | } |
| 9421 | |
| 9422 | type INiciraFlowMonitorRequest interface { |
| 9423 | IExperimenterStatsRequest |
| 9424 | GetMonitorId() uint32 |
| 9425 | GetMonitorFlags() NxFlowMonitorFlags |
| 9426 | GetOutPort() Port |
| 9427 | GetMatchLen() uint16 |
| 9428 | GetTableId() uint8 |
| 9429 | GetMatch() NiciraMatch |
| 9430 | } |
| 9431 | |
| 9432 | func (self *NiciraFlowMonitorRequest) GetMonitorId() uint32 { |
| 9433 | return self.MonitorId |
| 9434 | } |
| 9435 | |
| 9436 | func (self *NiciraFlowMonitorRequest) SetMonitorId(v uint32) { |
| 9437 | self.MonitorId = v |
| 9438 | } |
| 9439 | |
| 9440 | func (self *NiciraFlowMonitorRequest) GetMonitorFlags() NxFlowMonitorFlags { |
| 9441 | return self.MonitorFlags |
| 9442 | } |
| 9443 | |
| 9444 | func (self *NiciraFlowMonitorRequest) SetMonitorFlags(v NxFlowMonitorFlags) { |
| 9445 | self.MonitorFlags = v |
| 9446 | } |
| 9447 | |
| 9448 | func (self *NiciraFlowMonitorRequest) GetOutPort() Port { |
| 9449 | return self.OutPort |
| 9450 | } |
| 9451 | |
| 9452 | func (self *NiciraFlowMonitorRequest) SetOutPort(v Port) { |
| 9453 | self.OutPort = v |
| 9454 | } |
| 9455 | |
| 9456 | func (self *NiciraFlowMonitorRequest) GetMatchLen() uint16 { |
| 9457 | return self.MatchLen |
| 9458 | } |
| 9459 | |
| 9460 | func (self *NiciraFlowMonitorRequest) SetMatchLen(v uint16) { |
| 9461 | self.MatchLen = v |
| 9462 | } |
| 9463 | |
| 9464 | func (self *NiciraFlowMonitorRequest) GetTableId() uint8 { |
| 9465 | return self.TableId |
| 9466 | } |
| 9467 | |
| 9468 | func (self *NiciraFlowMonitorRequest) SetTableId(v uint8) { |
| 9469 | self.TableId = v |
| 9470 | } |
| 9471 | |
| 9472 | func (self *NiciraFlowMonitorRequest) GetMatch() NiciraMatch { |
| 9473 | return self.Match |
| 9474 | } |
| 9475 | |
| 9476 | func (self *NiciraFlowMonitorRequest) SetMatch(v NiciraMatch) { |
| 9477 | self.Match = v |
| 9478 | } |
| 9479 | |
| 9480 | func (self *NiciraFlowMonitorRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9481 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9482 | if err := self.ExperimenterStatsRequest.Serialize(encoder); err != nil { |
| 9483 | return err |
| 9484 | } |
| 9485 | |
| 9486 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9487 | encoder.PutUint32(uint32(self.MonitorId)) |
| 9488 | encoder.PutUint16(uint16(self.MonitorFlags)) |
| 9489 | self.OutPort.Serialize(encoder) |
| 9490 | encoder.PutUint16(uint16(self.MatchLen)) |
| 9491 | encoder.PutUint8(uint8(self.TableId)) |
| 9492 | encoder.Write(bytes.Repeat([]byte{0}, 5)) |
| 9493 | if err := self.Match.Serialize(encoder); err != nil { |
| 9494 | return err |
| 9495 | } |
| 9496 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9497 | length := len(encoder.Bytes()) - startIndex |
| 9498 | |
| 9499 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9500 | |
| 9501 | return nil |
| 9502 | } |
| 9503 | |
| 9504 | func DecodeNiciraFlowMonitorRequest(parent *ExperimenterStatsRequest, decoder *goloxi.Decoder) (*NiciraFlowMonitorRequest, error) { |
| 9505 | _niciraflowmonitorrequest := &NiciraFlowMonitorRequest{ExperimenterStatsRequest: parent} |
| 9506 | if decoder.Length() < 22 { |
| 9507 | return nil, fmt.Errorf("NiciraFlowMonitorRequest packet too short: %d < 22", decoder.Length()) |
| 9508 | } |
| 9509 | decoder.Skip(4) |
| 9510 | _niciraflowmonitorrequest.MonitorId = uint32(decoder.ReadUint32()) |
| 9511 | _niciraflowmonitorrequest.MonitorFlags = NxFlowMonitorFlags(decoder.ReadUint16()) |
| 9512 | _niciraflowmonitorrequest.OutPort.Decode(decoder) |
| 9513 | _niciraflowmonitorrequest.MatchLen = uint16(decoder.ReadUint16()) |
| 9514 | _niciraflowmonitorrequest.TableId = uint8(decoder.ReadByte()) |
| 9515 | decoder.Skip(5) |
| 9516 | if err := _niciraflowmonitorrequest.Match.Decode(decoder); err != nil { |
| 9517 | return nil, err |
| 9518 | } |
| 9519 | |
| 9520 | decoder.SkipAlign() |
| 9521 | return _niciraflowmonitorrequest, nil |
| 9522 | } |
| 9523 | |
| 9524 | func NewNiciraFlowMonitorRequest() *NiciraFlowMonitorRequest { |
| 9525 | obj := &NiciraFlowMonitorRequest{ |
| 9526 | ExperimenterStatsRequest: NewExperimenterStatsRequest(8992), |
| 9527 | } |
| 9528 | return obj |
| 9529 | } |
| 9530 | |
| 9531 | type NiciraFlowStatsReply struct { |
| 9532 | *NiciraStatsReply |
| 9533 | Stats []*NiciraFlowStats |
| 9534 | } |
| 9535 | |
| 9536 | type INiciraFlowStatsReply interface { |
| 9537 | INiciraStatsReply |
| 9538 | GetStats() []*NiciraFlowStats |
| 9539 | } |
| 9540 | |
| 9541 | func (self *NiciraFlowStatsReply) GetStats() []*NiciraFlowStats { |
| 9542 | return self.Stats |
| 9543 | } |
| 9544 | |
| 9545 | func (self *NiciraFlowStatsReply) SetStats(v []*NiciraFlowStats) { |
| 9546 | self.Stats = v |
| 9547 | } |
| 9548 | |
| 9549 | func (self *NiciraFlowStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9550 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9551 | if err := self.NiciraStatsReply.Serialize(encoder); err != nil { |
| 9552 | return err |
| 9553 | } |
| 9554 | |
| 9555 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9556 | for _, obj := range self.Stats { |
| 9557 | if err := obj.Serialize(encoder); err != nil { |
| 9558 | return err |
| 9559 | } |
| 9560 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9561 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9562 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9563 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9564 | |
| 9565 | return nil |
| 9566 | } |
| 9567 | |
| 9568 | func DecodeNiciraFlowStatsReply(parent *NiciraStatsReply, decoder *goloxi.Decoder) (*NiciraFlowStatsReply, error) { |
| 9569 | _niciraflowstatsreply := &NiciraFlowStatsReply{NiciraStatsReply: parent} |
| 9570 | if decoder.Length() < 4 { |
| 9571 | return nil, fmt.Errorf("NiciraFlowStatsReply packet too short: %d < 4", decoder.Length()) |
| 9572 | } |
| 9573 | decoder.Skip(4) |
| 9574 | |
| 9575 | for decoder.Length() >= 48 { |
| 9576 | item, err := DecodeNiciraFlowStats(decoder) |
| 9577 | if err != nil { |
| 9578 | return nil, err |
| 9579 | } |
| 9580 | if item != nil { |
| 9581 | _niciraflowstatsreply.Stats = append(_niciraflowstatsreply.Stats, item) |
| 9582 | } |
| 9583 | } |
| 9584 | return _niciraflowstatsreply, nil |
| 9585 | } |
| 9586 | |
| 9587 | func NewNiciraFlowStatsReply() *NiciraFlowStatsReply { |
| 9588 | obj := &NiciraFlowStatsReply{ |
| 9589 | NiciraStatsReply: NewNiciraStatsReply(0), |
| 9590 | } |
| 9591 | return obj |
| 9592 | } |
| 9593 | |
| 9594 | type NiciraFlowStatsRequest struct { |
| 9595 | *ExperimenterStatsRequest |
| 9596 | OutPort Port |
| 9597 | MatchLen uint16 |
| 9598 | TableId uint8 |
| 9599 | } |
| 9600 | |
| 9601 | type INiciraFlowStatsRequest interface { |
| 9602 | IExperimenterStatsRequest |
| 9603 | GetOutPort() Port |
| 9604 | GetMatchLen() uint16 |
| 9605 | GetTableId() uint8 |
| 9606 | } |
| 9607 | |
| 9608 | func (self *NiciraFlowStatsRequest) GetOutPort() Port { |
| 9609 | return self.OutPort |
| 9610 | } |
| 9611 | |
| 9612 | func (self *NiciraFlowStatsRequest) SetOutPort(v Port) { |
| 9613 | self.OutPort = v |
| 9614 | } |
| 9615 | |
| 9616 | func (self *NiciraFlowStatsRequest) GetMatchLen() uint16 { |
| 9617 | return self.MatchLen |
| 9618 | } |
| 9619 | |
| 9620 | func (self *NiciraFlowStatsRequest) SetMatchLen(v uint16) { |
| 9621 | self.MatchLen = v |
| 9622 | } |
| 9623 | |
| 9624 | func (self *NiciraFlowStatsRequest) GetTableId() uint8 { |
| 9625 | return self.TableId |
| 9626 | } |
| 9627 | |
| 9628 | func (self *NiciraFlowStatsRequest) SetTableId(v uint8) { |
| 9629 | self.TableId = v |
| 9630 | } |
| 9631 | |
| 9632 | func (self *NiciraFlowStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9633 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9634 | if err := self.ExperimenterStatsRequest.Serialize(encoder); err != nil { |
| 9635 | return err |
| 9636 | } |
| 9637 | |
| 9638 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9639 | self.OutPort.Serialize(encoder) |
| 9640 | encoder.PutUint16(uint16(self.MatchLen)) |
| 9641 | encoder.PutUint8(uint8(self.TableId)) |
| 9642 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9643 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9644 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9645 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9646 | |
| 9647 | return nil |
| 9648 | } |
| 9649 | |
| 9650 | func DecodeNiciraFlowStatsRequest(parent *ExperimenterStatsRequest, decoder *goloxi.Decoder) (*NiciraFlowStatsRequest, error) { |
| 9651 | _niciraflowstatsrequest := &NiciraFlowStatsRequest{ExperimenterStatsRequest: parent} |
| 9652 | if decoder.Length() < 14 { |
| 9653 | return nil, fmt.Errorf("NiciraFlowStatsRequest packet too short: %d < 14", decoder.Length()) |
| 9654 | } |
| 9655 | decoder.Skip(4) |
| 9656 | _niciraflowstatsrequest.OutPort.Decode(decoder) |
| 9657 | _niciraflowstatsrequest.MatchLen = uint16(decoder.ReadUint16()) |
| 9658 | _niciraflowstatsrequest.TableId = uint8(decoder.ReadByte()) |
| 9659 | decoder.Skip(3) |
| 9660 | return _niciraflowstatsrequest, nil |
| 9661 | } |
| 9662 | |
| 9663 | func NewNiciraFlowStatsRequest() *NiciraFlowStatsRequest { |
| 9664 | obj := &NiciraFlowStatsRequest{ |
| 9665 | ExperimenterStatsRequest: NewExperimenterStatsRequest(8992), |
| 9666 | } |
| 9667 | return obj |
| 9668 | } |
| 9669 | |
| 9670 | type NiciraHeader struct { |
| 9671 | *Experimenter |
| 9672 | } |
| 9673 | |
| 9674 | type INiciraHeader interface { |
| 9675 | IExperimenter |
| 9676 | } |
| 9677 | |
| 9678 | func (self *NiciraHeader) Serialize(encoder *goloxi.Encoder) error { |
| 9679 | if err := self.Experimenter.Serialize(encoder); err != nil { |
| 9680 | return err |
| 9681 | } |
| 9682 | |
| 9683 | return nil |
| 9684 | } |
| 9685 | |
| 9686 | func DecodeNiciraHeader(parent *Experimenter, decoder *goloxi.Decoder) (INiciraHeader, error) { |
| 9687 | _niciraheader := &NiciraHeader{Experimenter: parent} |
| 9688 | return _niciraheader, nil |
| 9689 | } |
| 9690 | |
| 9691 | func NewNiciraHeader(_subtype uint32) *NiciraHeader { |
| 9692 | obj := &NiciraHeader{ |
| 9693 | Experimenter: NewExperimenter(8992), |
| 9694 | } |
| 9695 | obj.Subtype = _subtype |
| 9696 | return obj |
| 9697 | } |
| 9698 | |
| 9699 | type PacketIn struct { |
| 9700 | *Header |
| 9701 | BufferId uint32 |
| 9702 | TotalLen uint16 |
| 9703 | Reason uint8 |
| 9704 | TableId uint8 |
| 9705 | Cookie uint64 |
| 9706 | Match Match |
| 9707 | Data []byte |
| 9708 | } |
| 9709 | |
| 9710 | type IPacketIn interface { |
| 9711 | IHeader |
| 9712 | GetBufferId() uint32 |
| 9713 | GetTotalLen() uint16 |
| 9714 | GetReason() uint8 |
| 9715 | GetTableId() uint8 |
| 9716 | GetCookie() uint64 |
| 9717 | GetMatch() Match |
| 9718 | GetData() []byte |
| 9719 | } |
| 9720 | |
| 9721 | func (self *PacketIn) GetBufferId() uint32 { |
| 9722 | return self.BufferId |
| 9723 | } |
| 9724 | |
| 9725 | func (self *PacketIn) SetBufferId(v uint32) { |
| 9726 | self.BufferId = v |
| 9727 | } |
| 9728 | |
| 9729 | func (self *PacketIn) GetTotalLen() uint16 { |
| 9730 | return self.TotalLen |
| 9731 | } |
| 9732 | |
| 9733 | func (self *PacketIn) SetTotalLen(v uint16) { |
| 9734 | self.TotalLen = v |
| 9735 | } |
| 9736 | |
| 9737 | func (self *PacketIn) GetReason() uint8 { |
| 9738 | return self.Reason |
| 9739 | } |
| 9740 | |
| 9741 | func (self *PacketIn) SetReason(v uint8) { |
| 9742 | self.Reason = v |
| 9743 | } |
| 9744 | |
| 9745 | func (self *PacketIn) GetTableId() uint8 { |
| 9746 | return self.TableId |
| 9747 | } |
| 9748 | |
| 9749 | func (self *PacketIn) SetTableId(v uint8) { |
| 9750 | self.TableId = v |
| 9751 | } |
| 9752 | |
| 9753 | func (self *PacketIn) GetCookie() uint64 { |
| 9754 | return self.Cookie |
| 9755 | } |
| 9756 | |
| 9757 | func (self *PacketIn) SetCookie(v uint64) { |
| 9758 | self.Cookie = v |
| 9759 | } |
| 9760 | |
| 9761 | func (self *PacketIn) GetMatch() Match { |
| 9762 | return self.Match |
| 9763 | } |
| 9764 | |
| 9765 | func (self *PacketIn) SetMatch(v Match) { |
| 9766 | self.Match = v |
| 9767 | } |
| 9768 | |
| 9769 | func (self *PacketIn) GetData() []byte { |
| 9770 | return self.Data |
| 9771 | } |
| 9772 | |
| 9773 | func (self *PacketIn) SetData(v []byte) { |
| 9774 | self.Data = v |
| 9775 | } |
| 9776 | |
| 9777 | func (self *PacketIn) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9778 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9779 | if err := self.Header.Serialize(encoder); err != nil { |
| 9780 | return err |
| 9781 | } |
| 9782 | |
| 9783 | encoder.PutUint32(uint32(self.BufferId)) |
| 9784 | encoder.PutUint16(uint16(self.TotalLen)) |
| 9785 | encoder.PutUint8(uint8(self.Reason)) |
| 9786 | encoder.PutUint8(uint8(self.TableId)) |
| 9787 | encoder.PutUint64(uint64(self.Cookie)) |
| 9788 | if err := self.Match.Serialize(encoder); err != nil { |
| 9789 | return err |
| 9790 | } |
| 9791 | |
| 9792 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 9793 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9794 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9795 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9796 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9797 | |
| 9798 | return nil |
| 9799 | } |
| 9800 | |
| 9801 | func DecodePacketIn(parent *Header, decoder *goloxi.Decoder) (*PacketIn, error) { |
| 9802 | _packetin := &PacketIn{Header: parent} |
| 9803 | if decoder.Length() < 26 { |
| 9804 | return nil, fmt.Errorf("PacketIn packet too short: %d < 26", decoder.Length()) |
| 9805 | } |
| 9806 | _packetin.BufferId = uint32(decoder.ReadUint32()) |
| 9807 | _packetin.TotalLen = uint16(decoder.ReadUint16()) |
| 9808 | _packetin.Reason = uint8(decoder.ReadByte()) |
| 9809 | _packetin.TableId = uint8(decoder.ReadByte()) |
| 9810 | _packetin.Cookie = uint64(decoder.ReadUint64()) |
| 9811 | if err := _packetin.Match.Decode(decoder); err != nil { |
| 9812 | return nil, err |
| 9813 | } |
| 9814 | |
| 9815 | decoder.SkipAlign() |
| 9816 | decoder.Skip(2) |
| 9817 | _packetin.Data = decoder.Read(int(decoder.Length())) |
| 9818 | return _packetin, nil |
| 9819 | } |
| 9820 | |
| 9821 | func NewPacketIn() *PacketIn { |
| 9822 | obj := &PacketIn{ |
| 9823 | Header: NewHeader(10), |
| 9824 | } |
| 9825 | return obj |
| 9826 | } |
| 9827 | |
| 9828 | type PacketOut struct { |
| 9829 | *Header |
| 9830 | BufferId uint32 |
| 9831 | InPort Port |
| 9832 | ActionsLen uint16 |
| 9833 | Actions []goloxi.IAction |
| 9834 | Data []byte |
| 9835 | } |
| 9836 | |
| 9837 | type IPacketOut interface { |
| 9838 | IHeader |
| 9839 | GetBufferId() uint32 |
| 9840 | GetInPort() Port |
| 9841 | GetActionsLen() uint16 |
| 9842 | GetActions() []goloxi.IAction |
| 9843 | GetData() []byte |
| 9844 | } |
| 9845 | |
| 9846 | func (self *PacketOut) GetBufferId() uint32 { |
| 9847 | return self.BufferId |
| 9848 | } |
| 9849 | |
| 9850 | func (self *PacketOut) SetBufferId(v uint32) { |
| 9851 | self.BufferId = v |
| 9852 | } |
| 9853 | |
| 9854 | func (self *PacketOut) GetInPort() Port { |
| 9855 | return self.InPort |
| 9856 | } |
| 9857 | |
| 9858 | func (self *PacketOut) SetInPort(v Port) { |
| 9859 | self.InPort = v |
| 9860 | } |
| 9861 | |
| 9862 | func (self *PacketOut) GetActionsLen() uint16 { |
| 9863 | return self.ActionsLen |
| 9864 | } |
| 9865 | |
| 9866 | func (self *PacketOut) SetActionsLen(v uint16) { |
| 9867 | self.ActionsLen = v |
| 9868 | } |
| 9869 | |
| 9870 | func (self *PacketOut) GetActions() []goloxi.IAction { |
| 9871 | return self.Actions |
| 9872 | } |
| 9873 | |
| 9874 | func (self *PacketOut) SetActions(v []goloxi.IAction) { |
| 9875 | self.Actions = v |
| 9876 | } |
| 9877 | |
| 9878 | func (self *PacketOut) GetData() []byte { |
| 9879 | return self.Data |
| 9880 | } |
| 9881 | |
| 9882 | func (self *PacketOut) SetData(v []byte) { |
| 9883 | self.Data = v |
| 9884 | } |
| 9885 | |
| 9886 | func (self *PacketOut) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9887 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9888 | if err := self.Header.Serialize(encoder); err != nil { |
| 9889 | return err |
| 9890 | } |
| 9891 | |
| 9892 | encoder.PutUint32(uint32(self.BufferId)) |
| 9893 | self.InPort.Serialize(encoder) |
| 9894 | encoder.PutUint16(uint16(self.ActionsLen)) |
| 9895 | encoder.Write(bytes.Repeat([]byte{0}, 6)) |
| 9896 | for _, obj := range self.Actions { |
| 9897 | if err := obj.Serialize(encoder); err != nil { |
| 9898 | return err |
| 9899 | } |
| 9900 | } |
| 9901 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9902 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9903 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9904 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9905 | |
| 9906 | return nil |
| 9907 | } |
| 9908 | |
| 9909 | func DecodePacketOut(parent *Header, decoder *goloxi.Decoder) (*PacketOut, error) { |
| 9910 | _packetout := &PacketOut{Header: parent} |
| 9911 | if decoder.Length() < 16 { |
| 9912 | return nil, fmt.Errorf("PacketOut packet too short: %d < 16", decoder.Length()) |
| 9913 | } |
| 9914 | _packetout.BufferId = uint32(decoder.ReadUint32()) |
| 9915 | _packetout.InPort.Decode(decoder) |
| 9916 | _packetout.ActionsLen = uint16(decoder.ReadUint16()) |
| 9917 | decoder.Skip(6) |
| 9918 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9919 | end := decoder.Offset() + int(_packetout.ActionsLen) |
| 9920 | for decoder.Offset() < end { |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9921 | item, err := DecodeAction(decoder) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9922 | if err != nil { |
| 9923 | return nil, err |
| 9924 | } |
| 9925 | if item != nil { |
| 9926 | _packetout.Actions = append(_packetout.Actions, item) |
| 9927 | } |
| 9928 | } |
| 9929 | _packetout.Data = decoder.Read(int(decoder.Length())) |
| 9930 | return _packetout, nil |
| 9931 | } |
| 9932 | |
| 9933 | func NewPacketOut() *PacketOut { |
| 9934 | obj := &PacketOut{ |
| 9935 | Header: NewHeader(13), |
| 9936 | } |
| 9937 | return obj |
| 9938 | } |
| 9939 | |
| 9940 | type PortDescStatsReply struct { |
| 9941 | *StatsReply |
| 9942 | Entries []*PortDesc |
| 9943 | } |
| 9944 | |
| 9945 | type IPortDescStatsReply interface { |
| 9946 | IStatsReply |
| 9947 | GetEntries() []*PortDesc |
| 9948 | } |
| 9949 | |
| 9950 | func (self *PortDescStatsReply) GetEntries() []*PortDesc { |
| 9951 | return self.Entries |
| 9952 | } |
| 9953 | |
| 9954 | func (self *PortDescStatsReply) SetEntries(v []*PortDesc) { |
| 9955 | self.Entries = v |
| 9956 | } |
| 9957 | |
| 9958 | func (self *PortDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9959 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9960 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 9961 | return err |
| 9962 | } |
| 9963 | |
| 9964 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 9965 | for _, obj := range self.Entries { |
| 9966 | if err := obj.Serialize(encoder); err != nil { |
| 9967 | return err |
| 9968 | } |
| 9969 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9970 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9971 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 9972 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 9973 | |
| 9974 | return nil |
| 9975 | } |
| 9976 | |
| 9977 | func DecodePortDescStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*PortDescStatsReply, error) { |
| 9978 | _portdescstatsreply := &PortDescStatsReply{StatsReply: parent} |
| 9979 | if decoder.Length() < 4 { |
| 9980 | return nil, fmt.Errorf("PortDescStatsReply packet too short: %d < 4", decoder.Length()) |
| 9981 | } |
| 9982 | decoder.Skip(4) |
| 9983 | |
| 9984 | for decoder.Length() >= 64 { |
| 9985 | item := &PortDesc{} |
| 9986 | if err := item.Decode(decoder); err != nil { |
| 9987 | return nil, err |
| 9988 | } |
| 9989 | if item != nil { |
| 9990 | _portdescstatsreply.Entries = append(_portdescstatsreply.Entries, item) |
| 9991 | } |
| 9992 | } |
| 9993 | return _portdescstatsreply, nil |
| 9994 | } |
| 9995 | |
| 9996 | func NewPortDescStatsReply() *PortDescStatsReply { |
| 9997 | obj := &PortDescStatsReply{ |
| 9998 | StatsReply: NewStatsReply(13), |
| 9999 | } |
| 10000 | return obj |
| 10001 | } |
| 10002 | |
| 10003 | type PortDescStatsRequest struct { |
| 10004 | *StatsRequest |
| 10005 | } |
| 10006 | |
| 10007 | type IPortDescStatsRequest interface { |
| 10008 | IStatsRequest |
| 10009 | } |
| 10010 | |
| 10011 | func (self *PortDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10012 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10013 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 10014 | return err |
| 10015 | } |
| 10016 | |
| 10017 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10018 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10019 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10020 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10021 | |
| 10022 | return nil |
| 10023 | } |
| 10024 | |
| 10025 | func DecodePortDescStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*PortDescStatsRequest, error) { |
| 10026 | _portdescstatsrequest := &PortDescStatsRequest{StatsRequest: parent} |
| 10027 | if decoder.Length() < 4 { |
| 10028 | return nil, fmt.Errorf("PortDescStatsRequest packet too short: %d < 4", decoder.Length()) |
| 10029 | } |
| 10030 | decoder.Skip(4) |
| 10031 | return _portdescstatsrequest, nil |
| 10032 | } |
| 10033 | |
| 10034 | func NewPortDescStatsRequest() *PortDescStatsRequest { |
| 10035 | obj := &PortDescStatsRequest{ |
| 10036 | StatsRequest: NewStatsRequest(13), |
| 10037 | } |
| 10038 | return obj |
| 10039 | } |
| 10040 | |
| 10041 | type PortMod struct { |
| 10042 | *Header |
| 10043 | PortNo Port |
| 10044 | HwAddr net.HardwareAddr |
| 10045 | Config PortConfig |
| 10046 | Mask PortConfig |
| 10047 | Advertise uint32 |
| 10048 | } |
| 10049 | |
| 10050 | type IPortMod interface { |
| 10051 | IHeader |
| 10052 | GetPortNo() Port |
| 10053 | GetHwAddr() net.HardwareAddr |
| 10054 | GetConfig() PortConfig |
| 10055 | GetMask() PortConfig |
| 10056 | GetAdvertise() uint32 |
| 10057 | } |
| 10058 | |
| 10059 | func (self *PortMod) GetPortNo() Port { |
| 10060 | return self.PortNo |
| 10061 | } |
| 10062 | |
| 10063 | func (self *PortMod) SetPortNo(v Port) { |
| 10064 | self.PortNo = v |
| 10065 | } |
| 10066 | |
| 10067 | func (self *PortMod) GetHwAddr() net.HardwareAddr { |
| 10068 | return self.HwAddr |
| 10069 | } |
| 10070 | |
| 10071 | func (self *PortMod) SetHwAddr(v net.HardwareAddr) { |
| 10072 | self.HwAddr = v |
| 10073 | } |
| 10074 | |
| 10075 | func (self *PortMod) GetConfig() PortConfig { |
| 10076 | return self.Config |
| 10077 | } |
| 10078 | |
| 10079 | func (self *PortMod) SetConfig(v PortConfig) { |
| 10080 | self.Config = v |
| 10081 | } |
| 10082 | |
| 10083 | func (self *PortMod) GetMask() PortConfig { |
| 10084 | return self.Mask |
| 10085 | } |
| 10086 | |
| 10087 | func (self *PortMod) SetMask(v PortConfig) { |
| 10088 | self.Mask = v |
| 10089 | } |
| 10090 | |
| 10091 | func (self *PortMod) GetAdvertise() uint32 { |
| 10092 | return self.Advertise |
| 10093 | } |
| 10094 | |
| 10095 | func (self *PortMod) SetAdvertise(v uint32) { |
| 10096 | self.Advertise = v |
| 10097 | } |
| 10098 | |
| 10099 | func (self *PortMod) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10100 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10101 | if err := self.Header.Serialize(encoder); err != nil { |
| 10102 | return err |
| 10103 | } |
| 10104 | |
| 10105 | self.PortNo.Serialize(encoder) |
| 10106 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10107 | encoder.Write(self.HwAddr) |
| 10108 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 10109 | encoder.PutUint32(uint32(self.Config)) |
| 10110 | encoder.PutUint32(uint32(self.Mask)) |
| 10111 | encoder.PutUint32(uint32(self.Advertise)) |
| 10112 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10113 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10114 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10115 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10116 | |
| 10117 | return nil |
| 10118 | } |
| 10119 | |
| 10120 | func DecodePortMod(parent *Header, decoder *goloxi.Decoder) (*PortMod, error) { |
| 10121 | _portmod := &PortMod{Header: parent} |
| 10122 | if decoder.Length() < 32 { |
| 10123 | return nil, fmt.Errorf("PortMod packet too short: %d < 32", decoder.Length()) |
| 10124 | } |
| 10125 | _portmod.PortNo.Decode(decoder) |
| 10126 | decoder.Skip(4) |
| 10127 | _portmod.HwAddr = net.HardwareAddr(decoder.Read(6)) |
| 10128 | decoder.Skip(2) |
| 10129 | _portmod.Config = PortConfig(decoder.ReadUint32()) |
| 10130 | _portmod.Mask = PortConfig(decoder.ReadUint32()) |
| 10131 | _portmod.Advertise = uint32(decoder.ReadUint32()) |
| 10132 | decoder.Skip(4) |
| 10133 | return _portmod, nil |
| 10134 | } |
| 10135 | |
| 10136 | func NewPortMod() *PortMod { |
| 10137 | obj := &PortMod{ |
| 10138 | Header: NewHeader(16), |
| 10139 | } |
| 10140 | return obj |
| 10141 | } |
| 10142 | |
| 10143 | type PortModFailedErrorMsg struct { |
| 10144 | *ErrorMsg |
| 10145 | Code PortModFailedCode |
| 10146 | Data []byte |
| 10147 | } |
| 10148 | |
| 10149 | type IPortModFailedErrorMsg interface { |
| 10150 | IErrorMsg |
| 10151 | GetCode() PortModFailedCode |
| 10152 | GetData() []byte |
| 10153 | } |
| 10154 | |
| 10155 | func (self *PortModFailedErrorMsg) GetCode() PortModFailedCode { |
| 10156 | return self.Code |
| 10157 | } |
| 10158 | |
| 10159 | func (self *PortModFailedErrorMsg) SetCode(v PortModFailedCode) { |
| 10160 | self.Code = v |
| 10161 | } |
| 10162 | |
| 10163 | func (self *PortModFailedErrorMsg) GetData() []byte { |
| 10164 | return self.Data |
| 10165 | } |
| 10166 | |
| 10167 | func (self *PortModFailedErrorMsg) SetData(v []byte) { |
| 10168 | self.Data = v |
| 10169 | } |
| 10170 | |
| 10171 | func (self *PortModFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10172 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10173 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 10174 | return err |
| 10175 | } |
| 10176 | |
| 10177 | encoder.PutUint16(uint16(self.Code)) |
| 10178 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10179 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10180 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10181 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10182 | |
| 10183 | return nil |
| 10184 | } |
| 10185 | |
| 10186 | func DecodePortModFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*PortModFailedErrorMsg, error) { |
| 10187 | _portmodfailederrormsg := &PortModFailedErrorMsg{ErrorMsg: parent} |
| 10188 | if decoder.Length() < 2 { |
| 10189 | return nil, fmt.Errorf("PortModFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 10190 | } |
| 10191 | _portmodfailederrormsg.Code = PortModFailedCode(decoder.ReadUint16()) |
| 10192 | _portmodfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 10193 | return _portmodfailederrormsg, nil |
| 10194 | } |
| 10195 | |
| 10196 | func NewPortModFailedErrorMsg() *PortModFailedErrorMsg { |
| 10197 | obj := &PortModFailedErrorMsg{ |
| 10198 | ErrorMsg: NewErrorMsg(7), |
| 10199 | } |
| 10200 | return obj |
| 10201 | } |
| 10202 | |
| 10203 | type PortStatsReply struct { |
| 10204 | *StatsReply |
| 10205 | Entries []*PortStatsEntry |
| 10206 | } |
| 10207 | |
| 10208 | type IPortStatsReply interface { |
| 10209 | IStatsReply |
| 10210 | GetEntries() []*PortStatsEntry |
| 10211 | } |
| 10212 | |
| 10213 | func (self *PortStatsReply) GetEntries() []*PortStatsEntry { |
| 10214 | return self.Entries |
| 10215 | } |
| 10216 | |
| 10217 | func (self *PortStatsReply) SetEntries(v []*PortStatsEntry) { |
| 10218 | self.Entries = v |
| 10219 | } |
| 10220 | |
| 10221 | func (self *PortStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10222 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10223 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 10224 | return err |
| 10225 | } |
| 10226 | |
| 10227 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10228 | for _, obj := range self.Entries { |
| 10229 | if err := obj.Serialize(encoder); err != nil { |
| 10230 | return err |
| 10231 | } |
| 10232 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10233 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10234 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10235 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10236 | |
| 10237 | return nil |
| 10238 | } |
| 10239 | |
| 10240 | func DecodePortStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*PortStatsReply, error) { |
| 10241 | _portstatsreply := &PortStatsReply{StatsReply: parent} |
| 10242 | if decoder.Length() < 4 { |
| 10243 | return nil, fmt.Errorf("PortStatsReply packet too short: %d < 4", decoder.Length()) |
| 10244 | } |
| 10245 | decoder.Skip(4) |
| 10246 | |
| 10247 | for decoder.Length() >= 112 { |
| 10248 | item, err := DecodePortStatsEntry(decoder) |
| 10249 | if err != nil { |
| 10250 | return nil, err |
| 10251 | } |
| 10252 | if item != nil { |
| 10253 | _portstatsreply.Entries = append(_portstatsreply.Entries, item) |
| 10254 | } |
| 10255 | } |
| 10256 | return _portstatsreply, nil |
| 10257 | } |
| 10258 | |
| 10259 | func NewPortStatsReply() *PortStatsReply { |
| 10260 | obj := &PortStatsReply{ |
| 10261 | StatsReply: NewStatsReply(4), |
| 10262 | } |
| 10263 | return obj |
| 10264 | } |
| 10265 | |
| 10266 | type PortStatsRequest struct { |
| 10267 | *StatsRequest |
| 10268 | PortNo Port |
| 10269 | } |
| 10270 | |
| 10271 | type IPortStatsRequest interface { |
| 10272 | IStatsRequest |
| 10273 | GetPortNo() Port |
| 10274 | } |
| 10275 | |
| 10276 | func (self *PortStatsRequest) GetPortNo() Port { |
| 10277 | return self.PortNo |
| 10278 | } |
| 10279 | |
| 10280 | func (self *PortStatsRequest) SetPortNo(v Port) { |
| 10281 | self.PortNo = v |
| 10282 | } |
| 10283 | |
| 10284 | func (self *PortStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10285 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10286 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 10287 | return err |
| 10288 | } |
| 10289 | |
| 10290 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10291 | self.PortNo.Serialize(encoder) |
| 10292 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10293 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10294 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10295 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10296 | |
| 10297 | return nil |
| 10298 | } |
| 10299 | |
| 10300 | func DecodePortStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*PortStatsRequest, error) { |
| 10301 | _portstatsrequest := &PortStatsRequest{StatsRequest: parent} |
| 10302 | if decoder.Length() < 4 { |
| 10303 | return nil, fmt.Errorf("PortStatsRequest packet too short: %d < 4", decoder.Length()) |
| 10304 | } |
| 10305 | decoder.Skip(4) |
| 10306 | _portstatsrequest.PortNo.Decode(decoder) |
| 10307 | decoder.Skip(4) |
| 10308 | return _portstatsrequest, nil |
| 10309 | } |
| 10310 | |
| 10311 | func NewPortStatsRequest() *PortStatsRequest { |
| 10312 | obj := &PortStatsRequest{ |
| 10313 | StatsRequest: NewStatsRequest(4), |
| 10314 | } |
| 10315 | return obj |
| 10316 | } |
| 10317 | |
| 10318 | type PortStatus struct { |
| 10319 | *Header |
| 10320 | Reason PortReason |
| 10321 | Desc PortDesc |
| 10322 | } |
| 10323 | |
| 10324 | type IPortStatus interface { |
| 10325 | IHeader |
| 10326 | GetReason() PortReason |
| 10327 | GetDesc() PortDesc |
| 10328 | } |
| 10329 | |
| 10330 | func (self *PortStatus) GetReason() PortReason { |
| 10331 | return self.Reason |
| 10332 | } |
| 10333 | |
| 10334 | func (self *PortStatus) SetReason(v PortReason) { |
| 10335 | self.Reason = v |
| 10336 | } |
| 10337 | |
| 10338 | func (self *PortStatus) GetDesc() PortDesc { |
| 10339 | return self.Desc |
| 10340 | } |
| 10341 | |
| 10342 | func (self *PortStatus) SetDesc(v PortDesc) { |
| 10343 | self.Desc = v |
| 10344 | } |
| 10345 | |
| 10346 | func (self *PortStatus) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10347 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10348 | if err := self.Header.Serialize(encoder); err != nil { |
| 10349 | return err |
| 10350 | } |
| 10351 | |
| 10352 | encoder.PutUint8(uint8(self.Reason)) |
| 10353 | encoder.Write(bytes.Repeat([]byte{0}, 7)) |
| 10354 | if err := self.Desc.Serialize(encoder); err != nil { |
| 10355 | return err |
| 10356 | } |
| 10357 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10358 | length := len(encoder.Bytes()) - startIndex |
| 10359 | |
| 10360 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10361 | |
| 10362 | return nil |
| 10363 | } |
| 10364 | |
| 10365 | func DecodePortStatus(parent *Header, decoder *goloxi.Decoder) (*PortStatus, error) { |
| 10366 | _portstatus := &PortStatus{Header: parent} |
| 10367 | if decoder.Length() < 72 { |
| 10368 | return nil, fmt.Errorf("PortStatus packet too short: %d < 72", decoder.Length()) |
| 10369 | } |
| 10370 | _portstatus.Reason = PortReason(decoder.ReadByte()) |
| 10371 | decoder.Skip(7) |
| 10372 | if err := _portstatus.Desc.Decode(decoder); err != nil { |
| 10373 | return nil, err |
| 10374 | } |
| 10375 | |
| 10376 | return _portstatus, nil |
| 10377 | } |
| 10378 | |
| 10379 | func NewPortStatus() *PortStatus { |
| 10380 | obj := &PortStatus{ |
| 10381 | Header: NewHeader(12), |
| 10382 | } |
| 10383 | return obj |
| 10384 | } |
| 10385 | |
| 10386 | type QueueGetConfigReply struct { |
| 10387 | *Header |
| 10388 | Port Port |
| 10389 | Queues []*PacketQueue |
| 10390 | } |
| 10391 | |
| 10392 | type IQueueGetConfigReply interface { |
| 10393 | IHeader |
| 10394 | GetPort() Port |
| 10395 | GetQueues() []*PacketQueue |
| 10396 | } |
| 10397 | |
| 10398 | func (self *QueueGetConfigReply) GetPort() Port { |
| 10399 | return self.Port |
| 10400 | } |
| 10401 | |
| 10402 | func (self *QueueGetConfigReply) SetPort(v Port) { |
| 10403 | self.Port = v |
| 10404 | } |
| 10405 | |
| 10406 | func (self *QueueGetConfigReply) GetQueues() []*PacketQueue { |
| 10407 | return self.Queues |
| 10408 | } |
| 10409 | |
| 10410 | func (self *QueueGetConfigReply) SetQueues(v []*PacketQueue) { |
| 10411 | self.Queues = v |
| 10412 | } |
| 10413 | |
| 10414 | func (self *QueueGetConfigReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10415 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10416 | if err := self.Header.Serialize(encoder); err != nil { |
| 10417 | return err |
| 10418 | } |
| 10419 | |
| 10420 | self.Port.Serialize(encoder) |
| 10421 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10422 | for _, obj := range self.Queues { |
| 10423 | if err := obj.Serialize(encoder); err != nil { |
| 10424 | return err |
| 10425 | } |
| 10426 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10427 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10428 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10429 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10430 | |
| 10431 | return nil |
| 10432 | } |
| 10433 | |
| 10434 | func DecodeQueueGetConfigReply(parent *Header, decoder *goloxi.Decoder) (*QueueGetConfigReply, error) { |
| 10435 | _queuegetconfigreply := &QueueGetConfigReply{Header: parent} |
| 10436 | if decoder.Length() < 8 { |
| 10437 | return nil, fmt.Errorf("QueueGetConfigReply packet too short: %d < 8", decoder.Length()) |
| 10438 | } |
| 10439 | _queuegetconfigreply.Port.Decode(decoder) |
| 10440 | decoder.Skip(4) |
| 10441 | |
| 10442 | for decoder.Length() >= 16 { |
| 10443 | item, err := DecodePacketQueue(decoder) |
| 10444 | if err != nil { |
| 10445 | return nil, err |
| 10446 | } |
| 10447 | if item != nil { |
| 10448 | _queuegetconfigreply.Queues = append(_queuegetconfigreply.Queues, item) |
| 10449 | } |
| 10450 | } |
| 10451 | return _queuegetconfigreply, nil |
| 10452 | } |
| 10453 | |
| 10454 | func NewQueueGetConfigReply() *QueueGetConfigReply { |
| 10455 | obj := &QueueGetConfigReply{ |
| 10456 | Header: NewHeader(23), |
| 10457 | } |
| 10458 | return obj |
| 10459 | } |
| 10460 | |
| 10461 | type QueueGetConfigRequest struct { |
| 10462 | *Header |
| 10463 | Port Port |
| 10464 | } |
| 10465 | |
| 10466 | type IQueueGetConfigRequest interface { |
| 10467 | IHeader |
| 10468 | GetPort() Port |
| 10469 | } |
| 10470 | |
| 10471 | func (self *QueueGetConfigRequest) GetPort() Port { |
| 10472 | return self.Port |
| 10473 | } |
| 10474 | |
| 10475 | func (self *QueueGetConfigRequest) SetPort(v Port) { |
| 10476 | self.Port = v |
| 10477 | } |
| 10478 | |
| 10479 | func (self *QueueGetConfigRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10480 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10481 | if err := self.Header.Serialize(encoder); err != nil { |
| 10482 | return err |
| 10483 | } |
| 10484 | |
| 10485 | self.Port.Serialize(encoder) |
| 10486 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10487 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10488 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10489 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10490 | |
| 10491 | return nil |
| 10492 | } |
| 10493 | |
| 10494 | func DecodeQueueGetConfigRequest(parent *Header, decoder *goloxi.Decoder) (*QueueGetConfigRequest, error) { |
| 10495 | _queuegetconfigrequest := &QueueGetConfigRequest{Header: parent} |
| 10496 | if decoder.Length() < 8 { |
| 10497 | return nil, fmt.Errorf("QueueGetConfigRequest packet too short: %d < 8", decoder.Length()) |
| 10498 | } |
| 10499 | _queuegetconfigrequest.Port.Decode(decoder) |
| 10500 | decoder.Skip(4) |
| 10501 | return _queuegetconfigrequest, nil |
| 10502 | } |
| 10503 | |
| 10504 | func NewQueueGetConfigRequest() *QueueGetConfigRequest { |
| 10505 | obj := &QueueGetConfigRequest{ |
| 10506 | Header: NewHeader(22), |
| 10507 | } |
| 10508 | return obj |
| 10509 | } |
| 10510 | |
| 10511 | type QueueOpFailedErrorMsg struct { |
| 10512 | *ErrorMsg |
| 10513 | Code QueueOpFailedCode |
| 10514 | Data []byte |
| 10515 | } |
| 10516 | |
| 10517 | type IQueueOpFailedErrorMsg interface { |
| 10518 | IErrorMsg |
| 10519 | GetCode() QueueOpFailedCode |
| 10520 | GetData() []byte |
| 10521 | } |
| 10522 | |
| 10523 | func (self *QueueOpFailedErrorMsg) GetCode() QueueOpFailedCode { |
| 10524 | return self.Code |
| 10525 | } |
| 10526 | |
| 10527 | func (self *QueueOpFailedErrorMsg) SetCode(v QueueOpFailedCode) { |
| 10528 | self.Code = v |
| 10529 | } |
| 10530 | |
| 10531 | func (self *QueueOpFailedErrorMsg) GetData() []byte { |
| 10532 | return self.Data |
| 10533 | } |
| 10534 | |
| 10535 | func (self *QueueOpFailedErrorMsg) SetData(v []byte) { |
| 10536 | self.Data = v |
| 10537 | } |
| 10538 | |
| 10539 | func (self *QueueOpFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10540 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10541 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 10542 | return err |
| 10543 | } |
| 10544 | |
| 10545 | encoder.PutUint16(uint16(self.Code)) |
| 10546 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10547 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10548 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10549 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10550 | |
| 10551 | return nil |
| 10552 | } |
| 10553 | |
| 10554 | func DecodeQueueOpFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*QueueOpFailedErrorMsg, error) { |
| 10555 | _queueopfailederrormsg := &QueueOpFailedErrorMsg{ErrorMsg: parent} |
| 10556 | if decoder.Length() < 2 { |
| 10557 | return nil, fmt.Errorf("QueueOpFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 10558 | } |
| 10559 | _queueopfailederrormsg.Code = QueueOpFailedCode(decoder.ReadUint16()) |
| 10560 | _queueopfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 10561 | return _queueopfailederrormsg, nil |
| 10562 | } |
| 10563 | |
| 10564 | func NewQueueOpFailedErrorMsg() *QueueOpFailedErrorMsg { |
| 10565 | obj := &QueueOpFailedErrorMsg{ |
| 10566 | ErrorMsg: NewErrorMsg(9), |
| 10567 | } |
| 10568 | return obj |
| 10569 | } |
| 10570 | |
| 10571 | type QueueStatsReply struct { |
| 10572 | *StatsReply |
| 10573 | Entries []*QueueStatsEntry |
| 10574 | } |
| 10575 | |
| 10576 | type IQueueStatsReply interface { |
| 10577 | IStatsReply |
| 10578 | GetEntries() []*QueueStatsEntry |
| 10579 | } |
| 10580 | |
| 10581 | func (self *QueueStatsReply) GetEntries() []*QueueStatsEntry { |
| 10582 | return self.Entries |
| 10583 | } |
| 10584 | |
| 10585 | func (self *QueueStatsReply) SetEntries(v []*QueueStatsEntry) { |
| 10586 | self.Entries = v |
| 10587 | } |
| 10588 | |
| 10589 | func (self *QueueStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10590 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10591 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 10592 | return err |
| 10593 | } |
| 10594 | |
| 10595 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10596 | for _, obj := range self.Entries { |
| 10597 | if err := obj.Serialize(encoder); err != nil { |
| 10598 | return err |
| 10599 | } |
| 10600 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10601 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10602 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10603 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10604 | |
| 10605 | return nil |
| 10606 | } |
| 10607 | |
| 10608 | func DecodeQueueStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*QueueStatsReply, error) { |
| 10609 | _queuestatsreply := &QueueStatsReply{StatsReply: parent} |
| 10610 | if decoder.Length() < 4 { |
| 10611 | return nil, fmt.Errorf("QueueStatsReply packet too short: %d < 4", decoder.Length()) |
| 10612 | } |
| 10613 | decoder.Skip(4) |
| 10614 | |
| 10615 | for decoder.Length() >= 40 { |
| 10616 | item, err := DecodeQueueStatsEntry(decoder) |
| 10617 | if err != nil { |
| 10618 | return nil, err |
| 10619 | } |
| 10620 | if item != nil { |
| 10621 | _queuestatsreply.Entries = append(_queuestatsreply.Entries, item) |
| 10622 | } |
| 10623 | } |
| 10624 | return _queuestatsreply, nil |
| 10625 | } |
| 10626 | |
| 10627 | func NewQueueStatsReply() *QueueStatsReply { |
| 10628 | obj := &QueueStatsReply{ |
| 10629 | StatsReply: NewStatsReply(5), |
| 10630 | } |
| 10631 | return obj |
| 10632 | } |
| 10633 | |
| 10634 | type QueueStatsRequest struct { |
| 10635 | *StatsRequest |
| 10636 | PortNo Port |
| 10637 | QueueId uint32 |
| 10638 | } |
| 10639 | |
| 10640 | type IQueueStatsRequest interface { |
| 10641 | IStatsRequest |
| 10642 | GetPortNo() Port |
| 10643 | GetQueueId() uint32 |
| 10644 | } |
| 10645 | |
| 10646 | func (self *QueueStatsRequest) GetPortNo() Port { |
| 10647 | return self.PortNo |
| 10648 | } |
| 10649 | |
| 10650 | func (self *QueueStatsRequest) SetPortNo(v Port) { |
| 10651 | self.PortNo = v |
| 10652 | } |
| 10653 | |
| 10654 | func (self *QueueStatsRequest) GetQueueId() uint32 { |
| 10655 | return self.QueueId |
| 10656 | } |
| 10657 | |
| 10658 | func (self *QueueStatsRequest) SetQueueId(v uint32) { |
| 10659 | self.QueueId = v |
| 10660 | } |
| 10661 | |
| 10662 | func (self *QueueStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10663 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10664 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 10665 | return err |
| 10666 | } |
| 10667 | |
| 10668 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10669 | self.PortNo.Serialize(encoder) |
| 10670 | encoder.PutUint32(uint32(self.QueueId)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10671 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10672 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10673 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10674 | |
| 10675 | return nil |
| 10676 | } |
| 10677 | |
| 10678 | func DecodeQueueStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*QueueStatsRequest, error) { |
| 10679 | _queuestatsrequest := &QueueStatsRequest{StatsRequest: parent} |
| 10680 | if decoder.Length() < 12 { |
| 10681 | return nil, fmt.Errorf("QueueStatsRequest packet too short: %d < 12", decoder.Length()) |
| 10682 | } |
| 10683 | decoder.Skip(4) |
| 10684 | _queuestatsrequest.PortNo.Decode(decoder) |
| 10685 | _queuestatsrequest.QueueId = uint32(decoder.ReadUint32()) |
| 10686 | return _queuestatsrequest, nil |
| 10687 | } |
| 10688 | |
| 10689 | func NewQueueStatsRequest() *QueueStatsRequest { |
| 10690 | obj := &QueueStatsRequest{ |
| 10691 | StatsRequest: NewStatsRequest(5), |
| 10692 | } |
| 10693 | return obj |
| 10694 | } |
| 10695 | |
| 10696 | type RoleReply struct { |
| 10697 | *Header |
| 10698 | Role ControllerRole |
| 10699 | GenerationId uint64 |
| 10700 | } |
| 10701 | |
| 10702 | type IRoleReply interface { |
| 10703 | IHeader |
| 10704 | GetRole() ControllerRole |
| 10705 | GetGenerationId() uint64 |
| 10706 | } |
| 10707 | |
| 10708 | func (self *RoleReply) GetRole() ControllerRole { |
| 10709 | return self.Role |
| 10710 | } |
| 10711 | |
| 10712 | func (self *RoleReply) SetRole(v ControllerRole) { |
| 10713 | self.Role = v |
| 10714 | } |
| 10715 | |
| 10716 | func (self *RoleReply) GetGenerationId() uint64 { |
| 10717 | return self.GenerationId |
| 10718 | } |
| 10719 | |
| 10720 | func (self *RoleReply) SetGenerationId(v uint64) { |
| 10721 | self.GenerationId = v |
| 10722 | } |
| 10723 | |
| 10724 | func (self *RoleReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10725 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10726 | if err := self.Header.Serialize(encoder); err != nil { |
| 10727 | return err |
| 10728 | } |
| 10729 | |
| 10730 | encoder.PutUint32(uint32(self.Role)) |
| 10731 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10732 | encoder.PutUint64(uint64(self.GenerationId)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10733 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10734 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10735 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10736 | |
| 10737 | return nil |
| 10738 | } |
| 10739 | |
| 10740 | func DecodeRoleReply(parent *Header, decoder *goloxi.Decoder) (*RoleReply, error) { |
| 10741 | _rolereply := &RoleReply{Header: parent} |
| 10742 | if decoder.Length() < 16 { |
| 10743 | return nil, fmt.Errorf("RoleReply packet too short: %d < 16", decoder.Length()) |
| 10744 | } |
| 10745 | _rolereply.Role = ControllerRole(decoder.ReadUint32()) |
| 10746 | decoder.Skip(4) |
| 10747 | _rolereply.GenerationId = uint64(decoder.ReadUint64()) |
| 10748 | return _rolereply, nil |
| 10749 | } |
| 10750 | |
| 10751 | func NewRoleReply() *RoleReply { |
| 10752 | obj := &RoleReply{ |
| 10753 | Header: NewHeader(25), |
| 10754 | } |
| 10755 | return obj |
| 10756 | } |
| 10757 | |
| 10758 | type RoleRequest struct { |
| 10759 | *Header |
| 10760 | Role ControllerRole |
| 10761 | GenerationId uint64 |
| 10762 | } |
| 10763 | |
| 10764 | type IRoleRequest interface { |
| 10765 | IHeader |
| 10766 | GetRole() ControllerRole |
| 10767 | GetGenerationId() uint64 |
| 10768 | } |
| 10769 | |
| 10770 | func (self *RoleRequest) GetRole() ControllerRole { |
| 10771 | return self.Role |
| 10772 | } |
| 10773 | |
| 10774 | func (self *RoleRequest) SetRole(v ControllerRole) { |
| 10775 | self.Role = v |
| 10776 | } |
| 10777 | |
| 10778 | func (self *RoleRequest) GetGenerationId() uint64 { |
| 10779 | return self.GenerationId |
| 10780 | } |
| 10781 | |
| 10782 | func (self *RoleRequest) SetGenerationId(v uint64) { |
| 10783 | self.GenerationId = v |
| 10784 | } |
| 10785 | |
| 10786 | func (self *RoleRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10787 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10788 | if err := self.Header.Serialize(encoder); err != nil { |
| 10789 | return err |
| 10790 | } |
| 10791 | |
| 10792 | encoder.PutUint32(uint32(self.Role)) |
| 10793 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 10794 | encoder.PutUint64(uint64(self.GenerationId)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10795 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10796 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10797 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10798 | |
| 10799 | return nil |
| 10800 | } |
| 10801 | |
| 10802 | func DecodeRoleRequest(parent *Header, decoder *goloxi.Decoder) (*RoleRequest, error) { |
| 10803 | _rolerequest := &RoleRequest{Header: parent} |
| 10804 | if decoder.Length() < 16 { |
| 10805 | return nil, fmt.Errorf("RoleRequest packet too short: %d < 16", decoder.Length()) |
| 10806 | } |
| 10807 | _rolerequest.Role = ControllerRole(decoder.ReadUint32()) |
| 10808 | decoder.Skip(4) |
| 10809 | _rolerequest.GenerationId = uint64(decoder.ReadUint64()) |
| 10810 | return _rolerequest, nil |
| 10811 | } |
| 10812 | |
| 10813 | func NewRoleRequest() *RoleRequest { |
| 10814 | obj := &RoleRequest{ |
| 10815 | Header: NewHeader(24), |
| 10816 | } |
| 10817 | return obj |
| 10818 | } |
| 10819 | |
| 10820 | type RoleRequestFailedErrorMsg struct { |
| 10821 | *ErrorMsg |
| 10822 | Code RoleRequestFailedCode |
| 10823 | Data []byte |
| 10824 | } |
| 10825 | |
| 10826 | type IRoleRequestFailedErrorMsg interface { |
| 10827 | IErrorMsg |
| 10828 | GetCode() RoleRequestFailedCode |
| 10829 | GetData() []byte |
| 10830 | } |
| 10831 | |
| 10832 | func (self *RoleRequestFailedErrorMsg) GetCode() RoleRequestFailedCode { |
| 10833 | return self.Code |
| 10834 | } |
| 10835 | |
| 10836 | func (self *RoleRequestFailedErrorMsg) SetCode(v RoleRequestFailedCode) { |
| 10837 | self.Code = v |
| 10838 | } |
| 10839 | |
| 10840 | func (self *RoleRequestFailedErrorMsg) GetData() []byte { |
| 10841 | return self.Data |
| 10842 | } |
| 10843 | |
| 10844 | func (self *RoleRequestFailedErrorMsg) SetData(v []byte) { |
| 10845 | self.Data = v |
| 10846 | } |
| 10847 | |
| 10848 | func (self *RoleRequestFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10849 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10850 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 10851 | return err |
| 10852 | } |
| 10853 | |
| 10854 | encoder.PutUint16(uint16(self.Code)) |
| 10855 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10856 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10857 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10858 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10859 | |
| 10860 | return nil |
| 10861 | } |
| 10862 | |
| 10863 | func DecodeRoleRequestFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*RoleRequestFailedErrorMsg, error) { |
| 10864 | _rolerequestfailederrormsg := &RoleRequestFailedErrorMsg{ErrorMsg: parent} |
| 10865 | if decoder.Length() < 2 { |
| 10866 | return nil, fmt.Errorf("RoleRequestFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 10867 | } |
| 10868 | _rolerequestfailederrormsg.Code = RoleRequestFailedCode(decoder.ReadUint16()) |
| 10869 | _rolerequestfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 10870 | return _rolerequestfailederrormsg, nil |
| 10871 | } |
| 10872 | |
| 10873 | func NewRoleRequestFailedErrorMsg() *RoleRequestFailedErrorMsg { |
| 10874 | obj := &RoleRequestFailedErrorMsg{ |
| 10875 | ErrorMsg: NewErrorMsg(11), |
| 10876 | } |
| 10877 | return obj |
| 10878 | } |
| 10879 | |
| 10880 | type SetConfig struct { |
| 10881 | *Header |
| 10882 | Flags ConfigFlags |
| 10883 | MissSendLen uint16 |
| 10884 | } |
| 10885 | |
| 10886 | type ISetConfig interface { |
| 10887 | IHeader |
| 10888 | GetFlags() ConfigFlags |
| 10889 | GetMissSendLen() uint16 |
| 10890 | } |
| 10891 | |
| 10892 | func (self *SetConfig) GetFlags() ConfigFlags { |
| 10893 | return self.Flags |
| 10894 | } |
| 10895 | |
| 10896 | func (self *SetConfig) SetFlags(v ConfigFlags) { |
| 10897 | self.Flags = v |
| 10898 | } |
| 10899 | |
| 10900 | func (self *SetConfig) GetMissSendLen() uint16 { |
| 10901 | return self.MissSendLen |
| 10902 | } |
| 10903 | |
| 10904 | func (self *SetConfig) SetMissSendLen(v uint16) { |
| 10905 | self.MissSendLen = v |
| 10906 | } |
| 10907 | |
| 10908 | func (self *SetConfig) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10909 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10910 | if err := self.Header.Serialize(encoder); err != nil { |
| 10911 | return err |
| 10912 | } |
| 10913 | |
| 10914 | encoder.PutUint16(uint16(self.Flags)) |
| 10915 | encoder.PutUint16(uint16(self.MissSendLen)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10916 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10917 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10918 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10919 | |
| 10920 | return nil |
| 10921 | } |
| 10922 | |
| 10923 | func DecodeSetConfig(parent *Header, decoder *goloxi.Decoder) (*SetConfig, error) { |
| 10924 | _setconfig := &SetConfig{Header: parent} |
| 10925 | if decoder.Length() < 4 { |
| 10926 | return nil, fmt.Errorf("SetConfig packet too short: %d < 4", decoder.Length()) |
| 10927 | } |
| 10928 | _setconfig.Flags = ConfigFlags(decoder.ReadUint16()) |
| 10929 | _setconfig.MissSendLen = uint16(decoder.ReadUint16()) |
| 10930 | return _setconfig, nil |
| 10931 | } |
| 10932 | |
| 10933 | func NewSetConfig() *SetConfig { |
| 10934 | obj := &SetConfig{ |
| 10935 | Header: NewHeader(9), |
| 10936 | } |
| 10937 | return obj |
| 10938 | } |
| 10939 | |
| 10940 | type SwitchConfigFailedErrorMsg struct { |
| 10941 | *ErrorMsg |
| 10942 | Code SwitchConfigFailedCode |
| 10943 | Data []byte |
| 10944 | } |
| 10945 | |
| 10946 | type ISwitchConfigFailedErrorMsg interface { |
| 10947 | IErrorMsg |
| 10948 | GetCode() SwitchConfigFailedCode |
| 10949 | GetData() []byte |
| 10950 | } |
| 10951 | |
| 10952 | func (self *SwitchConfigFailedErrorMsg) GetCode() SwitchConfigFailedCode { |
| 10953 | return self.Code |
| 10954 | } |
| 10955 | |
| 10956 | func (self *SwitchConfigFailedErrorMsg) SetCode(v SwitchConfigFailedCode) { |
| 10957 | self.Code = v |
| 10958 | } |
| 10959 | |
| 10960 | func (self *SwitchConfigFailedErrorMsg) GetData() []byte { |
| 10961 | return self.Data |
| 10962 | } |
| 10963 | |
| 10964 | func (self *SwitchConfigFailedErrorMsg) SetData(v []byte) { |
| 10965 | self.Data = v |
| 10966 | } |
| 10967 | |
| 10968 | func (self *SwitchConfigFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10969 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10970 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 10971 | return err |
| 10972 | } |
| 10973 | |
| 10974 | encoder.PutUint16(uint16(self.Code)) |
| 10975 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10976 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10977 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 10978 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 10979 | |
| 10980 | return nil |
| 10981 | } |
| 10982 | |
| 10983 | func DecodeSwitchConfigFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*SwitchConfigFailedErrorMsg, error) { |
| 10984 | _switchconfigfailederrormsg := &SwitchConfigFailedErrorMsg{ErrorMsg: parent} |
| 10985 | if decoder.Length() < 2 { |
| 10986 | return nil, fmt.Errorf("SwitchConfigFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 10987 | } |
| 10988 | _switchconfigfailederrormsg.Code = SwitchConfigFailedCode(decoder.ReadUint16()) |
| 10989 | _switchconfigfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 10990 | return _switchconfigfailederrormsg, nil |
| 10991 | } |
| 10992 | |
| 10993 | func NewSwitchConfigFailedErrorMsg() *SwitchConfigFailedErrorMsg { |
| 10994 | obj := &SwitchConfigFailedErrorMsg{ |
| 10995 | ErrorMsg: NewErrorMsg(10), |
| 10996 | } |
| 10997 | return obj |
| 10998 | } |
| 10999 | |
| 11000 | type TableFeaturesFailedErrorMsg struct { |
| 11001 | *ErrorMsg |
| 11002 | Code TableFeaturesFailedCode |
| 11003 | Data []byte |
| 11004 | } |
| 11005 | |
| 11006 | type ITableFeaturesFailedErrorMsg interface { |
| 11007 | IErrorMsg |
| 11008 | GetCode() TableFeaturesFailedCode |
| 11009 | GetData() []byte |
| 11010 | } |
| 11011 | |
| 11012 | func (self *TableFeaturesFailedErrorMsg) GetCode() TableFeaturesFailedCode { |
| 11013 | return self.Code |
| 11014 | } |
| 11015 | |
| 11016 | func (self *TableFeaturesFailedErrorMsg) SetCode(v TableFeaturesFailedCode) { |
| 11017 | self.Code = v |
| 11018 | } |
| 11019 | |
| 11020 | func (self *TableFeaturesFailedErrorMsg) GetData() []byte { |
| 11021 | return self.Data |
| 11022 | } |
| 11023 | |
| 11024 | func (self *TableFeaturesFailedErrorMsg) SetData(v []byte) { |
| 11025 | self.Data = v |
| 11026 | } |
| 11027 | |
| 11028 | func (self *TableFeaturesFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11029 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11030 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 11031 | return err |
| 11032 | } |
| 11033 | |
| 11034 | encoder.PutUint16(uint16(self.Code)) |
| 11035 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11036 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11037 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11038 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11039 | |
| 11040 | return nil |
| 11041 | } |
| 11042 | |
| 11043 | func DecodeTableFeaturesFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*TableFeaturesFailedErrorMsg, error) { |
| 11044 | _tablefeaturesfailederrormsg := &TableFeaturesFailedErrorMsg{ErrorMsg: parent} |
| 11045 | if decoder.Length() < 2 { |
| 11046 | return nil, fmt.Errorf("TableFeaturesFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 11047 | } |
| 11048 | _tablefeaturesfailederrormsg.Code = TableFeaturesFailedCode(decoder.ReadUint16()) |
| 11049 | _tablefeaturesfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 11050 | return _tablefeaturesfailederrormsg, nil |
| 11051 | } |
| 11052 | |
| 11053 | func NewTableFeaturesFailedErrorMsg() *TableFeaturesFailedErrorMsg { |
| 11054 | obj := &TableFeaturesFailedErrorMsg{ |
| 11055 | ErrorMsg: NewErrorMsg(13), |
| 11056 | } |
| 11057 | return obj |
| 11058 | } |
| 11059 | |
| 11060 | type TableFeaturesStatsReply struct { |
| 11061 | *StatsReply |
| 11062 | Entries []*TableFeatures |
| 11063 | } |
| 11064 | |
| 11065 | type ITableFeaturesStatsReply interface { |
| 11066 | IStatsReply |
| 11067 | GetEntries() []*TableFeatures |
| 11068 | } |
| 11069 | |
| 11070 | func (self *TableFeaturesStatsReply) GetEntries() []*TableFeatures { |
| 11071 | return self.Entries |
| 11072 | } |
| 11073 | |
| 11074 | func (self *TableFeaturesStatsReply) SetEntries(v []*TableFeatures) { |
| 11075 | self.Entries = v |
| 11076 | } |
| 11077 | |
| 11078 | func (self *TableFeaturesStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11079 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11080 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 11081 | return err |
| 11082 | } |
| 11083 | |
| 11084 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 11085 | for _, obj := range self.Entries { |
| 11086 | if err := obj.Serialize(encoder); err != nil { |
| 11087 | return err |
| 11088 | } |
| 11089 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11090 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11091 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11092 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11093 | |
| 11094 | return nil |
| 11095 | } |
| 11096 | |
| 11097 | func DecodeTableFeaturesStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*TableFeaturesStatsReply, error) { |
| 11098 | _tablefeaturesstatsreply := &TableFeaturesStatsReply{StatsReply: parent} |
| 11099 | if decoder.Length() < 4 { |
| 11100 | return nil, fmt.Errorf("TableFeaturesStatsReply packet too short: %d < 4", decoder.Length()) |
| 11101 | } |
| 11102 | decoder.Skip(4) |
| 11103 | |
| 11104 | for decoder.Length() >= 64 { |
| 11105 | item, err := DecodeTableFeatures(decoder) |
| 11106 | if err != nil { |
| 11107 | return nil, err |
| 11108 | } |
| 11109 | if item != nil { |
| 11110 | _tablefeaturesstatsreply.Entries = append(_tablefeaturesstatsreply.Entries, item) |
| 11111 | } |
| 11112 | } |
| 11113 | return _tablefeaturesstatsreply, nil |
| 11114 | } |
| 11115 | |
| 11116 | func NewTableFeaturesStatsReply() *TableFeaturesStatsReply { |
| 11117 | obj := &TableFeaturesStatsReply{ |
| 11118 | StatsReply: NewStatsReply(12), |
| 11119 | } |
| 11120 | return obj |
| 11121 | } |
| 11122 | |
| 11123 | type TableFeaturesStatsRequest struct { |
| 11124 | *StatsRequest |
| 11125 | Entries []*TableFeatures |
| 11126 | } |
| 11127 | |
| 11128 | type ITableFeaturesStatsRequest interface { |
| 11129 | IStatsRequest |
| 11130 | GetEntries() []*TableFeatures |
| 11131 | } |
| 11132 | |
| 11133 | func (self *TableFeaturesStatsRequest) GetEntries() []*TableFeatures { |
| 11134 | return self.Entries |
| 11135 | } |
| 11136 | |
| 11137 | func (self *TableFeaturesStatsRequest) SetEntries(v []*TableFeatures) { |
| 11138 | self.Entries = v |
| 11139 | } |
| 11140 | |
| 11141 | func (self *TableFeaturesStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11142 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11143 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 11144 | return err |
| 11145 | } |
| 11146 | |
| 11147 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 11148 | for _, obj := range self.Entries { |
| 11149 | if err := obj.Serialize(encoder); err != nil { |
| 11150 | return err |
| 11151 | } |
| 11152 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11153 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11154 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11155 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11156 | |
| 11157 | return nil |
| 11158 | } |
| 11159 | |
| 11160 | func DecodeTableFeaturesStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*TableFeaturesStatsRequest, error) { |
| 11161 | _tablefeaturesstatsrequest := &TableFeaturesStatsRequest{StatsRequest: parent} |
| 11162 | if decoder.Length() < 4 { |
| 11163 | return nil, fmt.Errorf("TableFeaturesStatsRequest packet too short: %d < 4", decoder.Length()) |
| 11164 | } |
| 11165 | decoder.Skip(4) |
| 11166 | |
| 11167 | for decoder.Length() >= 64 { |
| 11168 | item, err := DecodeTableFeatures(decoder) |
| 11169 | if err != nil { |
| 11170 | return nil, err |
| 11171 | } |
| 11172 | if item != nil { |
| 11173 | _tablefeaturesstatsrequest.Entries = append(_tablefeaturesstatsrequest.Entries, item) |
| 11174 | } |
| 11175 | } |
| 11176 | return _tablefeaturesstatsrequest, nil |
| 11177 | } |
| 11178 | |
| 11179 | func NewTableFeaturesStatsRequest() *TableFeaturesStatsRequest { |
| 11180 | obj := &TableFeaturesStatsRequest{ |
| 11181 | StatsRequest: NewStatsRequest(12), |
| 11182 | } |
| 11183 | return obj |
| 11184 | } |
| 11185 | |
| 11186 | type TableMod struct { |
| 11187 | *Header |
| 11188 | TableId uint8 |
| 11189 | Config uint32 |
| 11190 | } |
| 11191 | |
| 11192 | type ITableMod interface { |
| 11193 | IHeader |
| 11194 | GetTableId() uint8 |
| 11195 | GetConfig() uint32 |
| 11196 | } |
| 11197 | |
| 11198 | func (self *TableMod) GetTableId() uint8 { |
| 11199 | return self.TableId |
| 11200 | } |
| 11201 | |
| 11202 | func (self *TableMod) SetTableId(v uint8) { |
| 11203 | self.TableId = v |
| 11204 | } |
| 11205 | |
| 11206 | func (self *TableMod) GetConfig() uint32 { |
| 11207 | return self.Config |
| 11208 | } |
| 11209 | |
| 11210 | func (self *TableMod) SetConfig(v uint32) { |
| 11211 | self.Config = v |
| 11212 | } |
| 11213 | |
| 11214 | func (self *TableMod) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11215 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11216 | if err := self.Header.Serialize(encoder); err != nil { |
| 11217 | return err |
| 11218 | } |
| 11219 | |
| 11220 | encoder.PutUint8(uint8(self.TableId)) |
| 11221 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 11222 | encoder.PutUint32(uint32(self.Config)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11223 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11224 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11225 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11226 | |
| 11227 | return nil |
| 11228 | } |
| 11229 | |
| 11230 | func DecodeTableMod(parent *Header, decoder *goloxi.Decoder) (*TableMod, error) { |
| 11231 | _tablemod := &TableMod{Header: parent} |
| 11232 | if decoder.Length() < 8 { |
| 11233 | return nil, fmt.Errorf("TableMod packet too short: %d < 8", decoder.Length()) |
| 11234 | } |
| 11235 | _tablemod.TableId = uint8(decoder.ReadByte()) |
| 11236 | decoder.Skip(3) |
| 11237 | _tablemod.Config = uint32(decoder.ReadUint32()) |
| 11238 | return _tablemod, nil |
| 11239 | } |
| 11240 | |
| 11241 | func NewTableMod() *TableMod { |
| 11242 | obj := &TableMod{ |
| 11243 | Header: NewHeader(17), |
| 11244 | } |
| 11245 | return obj |
| 11246 | } |
| 11247 | |
| 11248 | type TableModFailedErrorMsg struct { |
| 11249 | *ErrorMsg |
| 11250 | Code TableModFailedCode |
| 11251 | Data []byte |
| 11252 | } |
| 11253 | |
| 11254 | type ITableModFailedErrorMsg interface { |
| 11255 | IErrorMsg |
| 11256 | GetCode() TableModFailedCode |
| 11257 | GetData() []byte |
| 11258 | } |
| 11259 | |
| 11260 | func (self *TableModFailedErrorMsg) GetCode() TableModFailedCode { |
| 11261 | return self.Code |
| 11262 | } |
| 11263 | |
| 11264 | func (self *TableModFailedErrorMsg) SetCode(v TableModFailedCode) { |
| 11265 | self.Code = v |
| 11266 | } |
| 11267 | |
| 11268 | func (self *TableModFailedErrorMsg) GetData() []byte { |
| 11269 | return self.Data |
| 11270 | } |
| 11271 | |
| 11272 | func (self *TableModFailedErrorMsg) SetData(v []byte) { |
| 11273 | self.Data = v |
| 11274 | } |
| 11275 | |
| 11276 | func (self *TableModFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11277 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11278 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 11279 | return err |
| 11280 | } |
| 11281 | |
| 11282 | encoder.PutUint16(uint16(self.Code)) |
| 11283 | encoder.Write(self.Data) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11284 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11285 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11286 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11287 | |
| 11288 | return nil |
| 11289 | } |
| 11290 | |
| 11291 | func DecodeTableModFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*TableModFailedErrorMsg, error) { |
| 11292 | _tablemodfailederrormsg := &TableModFailedErrorMsg{ErrorMsg: parent} |
| 11293 | if decoder.Length() < 2 { |
| 11294 | return nil, fmt.Errorf("TableModFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 11295 | } |
| 11296 | _tablemodfailederrormsg.Code = TableModFailedCode(decoder.ReadUint16()) |
| 11297 | _tablemodfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 11298 | return _tablemodfailederrormsg, nil |
| 11299 | } |
| 11300 | |
| 11301 | func NewTableModFailedErrorMsg() *TableModFailedErrorMsg { |
| 11302 | obj := &TableModFailedErrorMsg{ |
| 11303 | ErrorMsg: NewErrorMsg(8), |
| 11304 | } |
| 11305 | return obj |
| 11306 | } |
| 11307 | |
| 11308 | type TableStatsReply struct { |
| 11309 | *StatsReply |
| 11310 | Entries []*TableStatsEntry |
| 11311 | } |
| 11312 | |
| 11313 | type ITableStatsReply interface { |
| 11314 | IStatsReply |
| 11315 | GetEntries() []*TableStatsEntry |
| 11316 | } |
| 11317 | |
| 11318 | func (self *TableStatsReply) GetEntries() []*TableStatsEntry { |
| 11319 | return self.Entries |
| 11320 | } |
| 11321 | |
| 11322 | func (self *TableStatsReply) SetEntries(v []*TableStatsEntry) { |
| 11323 | self.Entries = v |
| 11324 | } |
| 11325 | |
| 11326 | func (self *TableStatsReply) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11327 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11328 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 11329 | return err |
| 11330 | } |
| 11331 | |
| 11332 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 11333 | for _, obj := range self.Entries { |
| 11334 | if err := obj.Serialize(encoder); err != nil { |
| 11335 | return err |
| 11336 | } |
| 11337 | } |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11338 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11339 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11340 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11341 | |
| 11342 | return nil |
| 11343 | } |
| 11344 | |
| 11345 | func DecodeTableStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*TableStatsReply, error) { |
| 11346 | _tablestatsreply := &TableStatsReply{StatsReply: parent} |
| 11347 | if decoder.Length() < 4 { |
| 11348 | return nil, fmt.Errorf("TableStatsReply packet too short: %d < 4", decoder.Length()) |
| 11349 | } |
| 11350 | decoder.Skip(4) |
| 11351 | |
| 11352 | for decoder.Length() >= 24 { |
| 11353 | item, err := DecodeTableStatsEntry(decoder) |
| 11354 | if err != nil { |
| 11355 | return nil, err |
| 11356 | } |
| 11357 | if item != nil { |
| 11358 | _tablestatsreply.Entries = append(_tablestatsreply.Entries, item) |
| 11359 | } |
| 11360 | } |
| 11361 | return _tablestatsreply, nil |
| 11362 | } |
| 11363 | |
| 11364 | func NewTableStatsReply() *TableStatsReply { |
| 11365 | obj := &TableStatsReply{ |
| 11366 | StatsReply: NewStatsReply(3), |
| 11367 | } |
| 11368 | return obj |
| 11369 | } |
| 11370 | |
| 11371 | type TableStatsRequest struct { |
| 11372 | *StatsRequest |
| 11373 | } |
| 11374 | |
| 11375 | type ITableStatsRequest interface { |
| 11376 | IStatsRequest |
| 11377 | } |
| 11378 | |
| 11379 | func (self *TableStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11380 | startIndex := len(encoder.Bytes()) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11381 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 11382 | return err |
| 11383 | } |
| 11384 | |
| 11385 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11386 | length := len(encoder.Bytes()) - startIndex |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11387 | |
Jonathan Hart | 828908c | 2020-04-15 14:23:45 -0700 | [diff] [blame] | 11388 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [diff] [blame] | 11389 | |
| 11390 | return nil |
| 11391 | } |
| 11392 | |
| 11393 | func DecodeTableStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*TableStatsRequest, error) { |
| 11394 | _tablestatsrequest := &TableStatsRequest{StatsRequest: parent} |
| 11395 | if decoder.Length() < 4 { |
| 11396 | return nil, fmt.Errorf("TableStatsRequest packet too short: %d < 4", decoder.Length()) |
| 11397 | } |
| 11398 | decoder.Skip(4) |
| 11399 | return _tablestatsrequest, nil |
| 11400 | } |
| 11401 | |
| 11402 | func NewTableStatsRequest() *TableStatsRequest { |
| 11403 | obj := &TableStatsRequest{ |
| 11404 | StatsRequest: NewStatsRequest(3), |
| 11405 | } |
| 11406 | return obj |
| 11407 | } |