Jonathan Hart | 44bdbfc | 2020-04-14 17:45:47 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 3 | * Copyright (c) 2011, 2012 Open Networking Foundation |
| 4 | * Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler. |
| 5 | * Copyright 2018, Red Hat, Inc. |
| 6 | */ |
| 7 | // Automatically generated by LOXI from template module.go |
| 8 | // Do not modify |
| 9 | |
| 10 | package of11 |
| 11 | |
| 12 | import ( |
| 13 | "bytes" |
| 14 | "encoding/binary" |
| 15 | "fmt" |
| 16 | "net" |
| 17 | |
| 18 | "github.com/opencord/goloxi" |
| 19 | ) |
| 20 | |
| 21 | type Header struct { |
| 22 | Version uint8 |
| 23 | Type uint8 |
| 24 | Length uint16 |
| 25 | Xid uint32 |
| 26 | } |
| 27 | |
| 28 | type IHeader interface { |
| 29 | goloxi.Serializable |
| 30 | GetVersion() uint8 |
| 31 | GetType() uint8 |
| 32 | GetLength() uint16 |
| 33 | GetXid() uint32 |
| 34 | } |
| 35 | |
| 36 | func (self *Header) GetVersion() uint8 { |
| 37 | return self.Version |
| 38 | } |
| 39 | |
| 40 | func (self *Header) SetVersion(v uint8) { |
| 41 | self.Version = v |
| 42 | } |
| 43 | |
| 44 | func (self *Header) GetType() uint8 { |
| 45 | return self.Type |
| 46 | } |
| 47 | |
| 48 | func (self *Header) SetType(v uint8) { |
| 49 | self.Type = v |
| 50 | } |
| 51 | |
| 52 | func (self *Header) GetLength() uint16 { |
| 53 | return self.Length |
| 54 | } |
| 55 | |
| 56 | func (self *Header) SetLength(v uint16) { |
| 57 | self.Length = v |
| 58 | } |
| 59 | |
| 60 | func (self *Header) GetXid() uint32 { |
| 61 | return self.Xid |
| 62 | } |
| 63 | |
| 64 | func (self *Header) SetXid(v uint32) { |
| 65 | self.Xid = v |
| 66 | } |
| 67 | |
| 68 | func (self *Header) Serialize(encoder *goloxi.Encoder) error { |
| 69 | |
| 70 | encoder.PutUint8(uint8(2)) |
| 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 | default: |
| 155 | return nil, fmt.Errorf("Invalid type '%d' for 'Header'", _header.Type) |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | func NewHeader(_type uint8) *Header { |
| 160 | obj := &Header{} |
| 161 | obj.Type = _type |
| 162 | return obj |
| 163 | } |
| 164 | |
| 165 | type StatsReply struct { |
| 166 | *Header |
| 167 | StatsType uint16 |
| 168 | Flags StatsReplyFlags |
| 169 | } |
| 170 | |
| 171 | type IStatsReply interface { |
| 172 | IHeader |
| 173 | GetStatsType() uint16 |
| 174 | GetFlags() StatsReplyFlags |
| 175 | } |
| 176 | |
| 177 | func (self *StatsReply) GetStatsType() uint16 { |
| 178 | return self.StatsType |
| 179 | } |
| 180 | |
| 181 | func (self *StatsReply) SetStatsType(v uint16) { |
| 182 | self.StatsType = v |
| 183 | } |
| 184 | |
| 185 | func (self *StatsReply) GetFlags() StatsReplyFlags { |
| 186 | return self.Flags |
| 187 | } |
| 188 | |
| 189 | func (self *StatsReply) SetFlags(v StatsReplyFlags) { |
| 190 | self.Flags = v |
| 191 | } |
| 192 | |
| 193 | func (self *StatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 194 | if err := self.Header.Serialize(encoder); err != nil { |
| 195 | return err |
| 196 | } |
| 197 | |
| 198 | encoder.PutUint16(uint16(self.StatsType)) |
| 199 | encoder.PutUint16(uint16(self.Flags)) |
| 200 | |
| 201 | return nil |
| 202 | } |
| 203 | |
| 204 | func DecodeStatsReply(parent *Header, decoder *goloxi.Decoder) (IStatsReply, error) { |
| 205 | _statsreply := &StatsReply{Header: parent} |
| 206 | if decoder.Length() < 4 { |
| 207 | return nil, fmt.Errorf("StatsReply packet too short: %d < 4", decoder.Length()) |
| 208 | } |
| 209 | _statsreply.StatsType = uint16(decoder.ReadUint16()) |
| 210 | _statsreply.Flags = StatsReplyFlags(decoder.ReadUint16()) |
| 211 | |
| 212 | switch _statsreply.StatsType { |
| 213 | case 0: |
| 214 | return DecodeDescStatsReply(_statsreply, decoder) |
| 215 | case 1: |
| 216 | return DecodeFlowStatsReply(_statsreply, decoder) |
| 217 | case 2: |
| 218 | return DecodeAggregateStatsReply(_statsreply, decoder) |
| 219 | case 3: |
| 220 | return DecodeTableStatsReply(_statsreply, decoder) |
| 221 | case 4: |
| 222 | return DecodePortStatsReply(_statsreply, decoder) |
| 223 | case 5: |
| 224 | return DecodeQueueStatsReply(_statsreply, decoder) |
| 225 | case 6: |
| 226 | return DecodeGroupStatsReply(_statsreply, decoder) |
| 227 | case 7: |
| 228 | return DecodeGroupDescStatsReply(_statsreply, decoder) |
| 229 | case 65535: |
| 230 | return DecodeExperimenterStatsReply(_statsreply, decoder) |
| 231 | default: |
| 232 | return nil, fmt.Errorf("Invalid type '%d' for 'StatsReply'", _statsreply.StatsType) |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | func NewStatsReply(_stats_type uint16) *StatsReply { |
| 237 | obj := &StatsReply{ |
| 238 | Header: NewHeader(19), |
| 239 | } |
| 240 | obj.StatsType = _stats_type |
| 241 | return obj |
| 242 | } |
| 243 | |
| 244 | type AggregateStatsReply struct { |
| 245 | *StatsReply |
| 246 | PacketCount uint64 |
| 247 | ByteCount uint64 |
| 248 | FlowCount uint32 |
| 249 | } |
| 250 | |
| 251 | type IAggregateStatsReply interface { |
| 252 | IStatsReply |
| 253 | GetPacketCount() uint64 |
| 254 | GetByteCount() uint64 |
| 255 | GetFlowCount() uint32 |
| 256 | } |
| 257 | |
| 258 | func (self *AggregateStatsReply) GetPacketCount() uint64 { |
| 259 | return self.PacketCount |
| 260 | } |
| 261 | |
| 262 | func (self *AggregateStatsReply) SetPacketCount(v uint64) { |
| 263 | self.PacketCount = v |
| 264 | } |
| 265 | |
| 266 | func (self *AggregateStatsReply) GetByteCount() uint64 { |
| 267 | return self.ByteCount |
| 268 | } |
| 269 | |
| 270 | func (self *AggregateStatsReply) SetByteCount(v uint64) { |
| 271 | self.ByteCount = v |
| 272 | } |
| 273 | |
| 274 | func (self *AggregateStatsReply) GetFlowCount() uint32 { |
| 275 | return self.FlowCount |
| 276 | } |
| 277 | |
| 278 | func (self *AggregateStatsReply) SetFlowCount(v uint32) { |
| 279 | self.FlowCount = v |
| 280 | } |
| 281 | |
| 282 | func (self *AggregateStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 283 | startIndex := len(encoder.Bytes()) |
| 284 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 285 | return err |
| 286 | } |
| 287 | |
| 288 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 289 | encoder.PutUint64(uint64(self.PacketCount)) |
| 290 | encoder.PutUint64(uint64(self.ByteCount)) |
| 291 | encoder.PutUint32(uint32(self.FlowCount)) |
| 292 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 293 | length := len(encoder.Bytes()) - startIndex |
| 294 | |
| 295 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 296 | |
| 297 | return nil |
| 298 | } |
| 299 | |
| 300 | func DecodeAggregateStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*AggregateStatsReply, error) { |
| 301 | _aggregatestatsreply := &AggregateStatsReply{StatsReply: parent} |
| 302 | if decoder.Length() < 4 { |
| 303 | return nil, fmt.Errorf("AggregateStatsReply packet too short: %d < 4", decoder.Length()) |
| 304 | } |
| 305 | decoder.Skip(4) |
| 306 | _aggregatestatsreply.PacketCount = uint64(decoder.ReadUint64()) |
| 307 | _aggregatestatsreply.ByteCount = uint64(decoder.ReadUint64()) |
| 308 | _aggregatestatsreply.FlowCount = uint32(decoder.ReadUint32()) |
| 309 | decoder.Skip(4) |
| 310 | return _aggregatestatsreply, nil |
| 311 | } |
| 312 | |
| 313 | func NewAggregateStatsReply() *AggregateStatsReply { |
| 314 | obj := &AggregateStatsReply{ |
| 315 | StatsReply: NewStatsReply(2), |
| 316 | } |
| 317 | return obj |
| 318 | } |
| 319 | |
| 320 | type StatsRequest struct { |
| 321 | *Header |
| 322 | StatsType uint16 |
| 323 | Flags StatsRequestFlags |
| 324 | } |
| 325 | |
| 326 | type IStatsRequest interface { |
| 327 | IHeader |
| 328 | GetStatsType() uint16 |
| 329 | GetFlags() StatsRequestFlags |
| 330 | } |
| 331 | |
| 332 | func (self *StatsRequest) GetStatsType() uint16 { |
| 333 | return self.StatsType |
| 334 | } |
| 335 | |
| 336 | func (self *StatsRequest) SetStatsType(v uint16) { |
| 337 | self.StatsType = v |
| 338 | } |
| 339 | |
| 340 | func (self *StatsRequest) GetFlags() StatsRequestFlags { |
| 341 | return self.Flags |
| 342 | } |
| 343 | |
| 344 | func (self *StatsRequest) SetFlags(v StatsRequestFlags) { |
| 345 | self.Flags = v |
| 346 | } |
| 347 | |
| 348 | func (self *StatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 349 | if err := self.Header.Serialize(encoder); err != nil { |
| 350 | return err |
| 351 | } |
| 352 | |
| 353 | encoder.PutUint16(uint16(self.StatsType)) |
| 354 | encoder.PutUint16(uint16(self.Flags)) |
| 355 | |
| 356 | return nil |
| 357 | } |
| 358 | |
| 359 | func DecodeStatsRequest(parent *Header, decoder *goloxi.Decoder) (IStatsRequest, error) { |
| 360 | _statsrequest := &StatsRequest{Header: parent} |
| 361 | if decoder.Length() < 4 { |
| 362 | return nil, fmt.Errorf("StatsRequest packet too short: %d < 4", decoder.Length()) |
| 363 | } |
| 364 | _statsrequest.StatsType = uint16(decoder.ReadUint16()) |
| 365 | _statsrequest.Flags = StatsRequestFlags(decoder.ReadUint16()) |
| 366 | |
| 367 | switch _statsrequest.StatsType { |
| 368 | case 0: |
| 369 | return DecodeDescStatsRequest(_statsrequest, decoder) |
| 370 | case 1: |
| 371 | return DecodeFlowStatsRequest(_statsrequest, decoder) |
| 372 | case 2: |
| 373 | return DecodeAggregateStatsRequest(_statsrequest, decoder) |
| 374 | case 3: |
| 375 | return DecodeTableStatsRequest(_statsrequest, decoder) |
| 376 | case 4: |
| 377 | return DecodePortStatsRequest(_statsrequest, decoder) |
| 378 | case 5: |
| 379 | return DecodeQueueStatsRequest(_statsrequest, decoder) |
| 380 | case 6: |
| 381 | return DecodeGroupStatsRequest(_statsrequest, decoder) |
| 382 | case 7: |
| 383 | return DecodeGroupDescStatsRequest(_statsrequest, decoder) |
| 384 | case 65535: |
| 385 | return DecodeExperimenterStatsRequest(_statsrequest, decoder) |
| 386 | default: |
| 387 | return nil, fmt.Errorf("Invalid type '%d' for 'StatsRequest'", _statsrequest.StatsType) |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | func NewStatsRequest(_stats_type uint16) *StatsRequest { |
| 392 | obj := &StatsRequest{ |
| 393 | Header: NewHeader(18), |
| 394 | } |
| 395 | obj.StatsType = _stats_type |
| 396 | return obj |
| 397 | } |
| 398 | |
| 399 | type AggregateStatsRequest struct { |
| 400 | *StatsRequest |
| 401 | TableId uint8 |
| 402 | OutPort Port |
| 403 | OutGroup uint32 |
| 404 | Cookie uint64 |
| 405 | CookieMask uint64 |
| 406 | Match Match |
| 407 | } |
| 408 | |
| 409 | type IAggregateStatsRequest interface { |
| 410 | IStatsRequest |
| 411 | GetTableId() uint8 |
| 412 | GetOutPort() Port |
| 413 | GetOutGroup() uint32 |
| 414 | GetCookie() uint64 |
| 415 | GetCookieMask() uint64 |
| 416 | GetMatch() Match |
| 417 | } |
| 418 | |
| 419 | func (self *AggregateStatsRequest) GetTableId() uint8 { |
| 420 | return self.TableId |
| 421 | } |
| 422 | |
| 423 | func (self *AggregateStatsRequest) SetTableId(v uint8) { |
| 424 | self.TableId = v |
| 425 | } |
| 426 | |
| 427 | func (self *AggregateStatsRequest) GetOutPort() Port { |
| 428 | return self.OutPort |
| 429 | } |
| 430 | |
| 431 | func (self *AggregateStatsRequest) SetOutPort(v Port) { |
| 432 | self.OutPort = v |
| 433 | } |
| 434 | |
| 435 | func (self *AggregateStatsRequest) GetOutGroup() uint32 { |
| 436 | return self.OutGroup |
| 437 | } |
| 438 | |
| 439 | func (self *AggregateStatsRequest) SetOutGroup(v uint32) { |
| 440 | self.OutGroup = v |
| 441 | } |
| 442 | |
| 443 | func (self *AggregateStatsRequest) GetCookie() uint64 { |
| 444 | return self.Cookie |
| 445 | } |
| 446 | |
| 447 | func (self *AggregateStatsRequest) SetCookie(v uint64) { |
| 448 | self.Cookie = v |
| 449 | } |
| 450 | |
| 451 | func (self *AggregateStatsRequest) GetCookieMask() uint64 { |
| 452 | return self.CookieMask |
| 453 | } |
| 454 | |
| 455 | func (self *AggregateStatsRequest) SetCookieMask(v uint64) { |
| 456 | self.CookieMask = v |
| 457 | } |
| 458 | |
| 459 | func (self *AggregateStatsRequest) GetMatch() Match { |
| 460 | return self.Match |
| 461 | } |
| 462 | |
| 463 | func (self *AggregateStatsRequest) SetMatch(v Match) { |
| 464 | self.Match = v |
| 465 | } |
| 466 | |
| 467 | func (self *AggregateStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 468 | startIndex := len(encoder.Bytes()) |
| 469 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 470 | return err |
| 471 | } |
| 472 | |
| 473 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 474 | encoder.PutUint8(uint8(self.TableId)) |
| 475 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 476 | self.OutPort.Serialize(encoder) |
| 477 | encoder.PutUint32(uint32(self.OutGroup)) |
| 478 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 479 | encoder.PutUint64(uint64(self.Cookie)) |
| 480 | encoder.PutUint64(uint64(self.CookieMask)) |
| 481 | if err := self.Match.Serialize(encoder); err != nil { |
| 482 | return err |
| 483 | } |
| 484 | |
| 485 | length := len(encoder.Bytes()) - startIndex |
| 486 | |
| 487 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 488 | |
| 489 | return nil |
| 490 | } |
| 491 | |
| 492 | func DecodeAggregateStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*AggregateStatsRequest, error) { |
| 493 | _aggregatestatsrequest := &AggregateStatsRequest{StatsRequest: parent} |
| 494 | if decoder.Length() < 108 { |
| 495 | return nil, fmt.Errorf("AggregateStatsRequest packet too short: %d < 108", decoder.Length()) |
| 496 | } |
| 497 | decoder.Skip(4) |
| 498 | _aggregatestatsrequest.TableId = uint8(decoder.ReadByte()) |
| 499 | decoder.Skip(3) |
| 500 | _aggregatestatsrequest.OutPort.Decode(decoder) |
| 501 | _aggregatestatsrequest.OutGroup = uint32(decoder.ReadUint32()) |
| 502 | decoder.Skip(4) |
| 503 | _aggregatestatsrequest.Cookie = uint64(decoder.ReadUint64()) |
| 504 | _aggregatestatsrequest.CookieMask = uint64(decoder.ReadUint64()) |
| 505 | if err := _aggregatestatsrequest.Match.Decode(decoder); err != nil { |
| 506 | return nil, err |
| 507 | } |
| 508 | |
| 509 | return _aggregatestatsrequest, nil |
| 510 | } |
| 511 | |
| 512 | func NewAggregateStatsRequest() *AggregateStatsRequest { |
| 513 | obj := &AggregateStatsRequest{ |
| 514 | StatsRequest: NewStatsRequest(2), |
| 515 | } |
| 516 | return obj |
| 517 | } |
| 518 | |
| 519 | type ErrorMsg struct { |
| 520 | *Header |
| 521 | ErrType uint16 |
| 522 | } |
| 523 | |
| 524 | type IErrorMsg interface { |
| 525 | IHeader |
| 526 | GetErrType() uint16 |
| 527 | } |
| 528 | |
| 529 | func (self *ErrorMsg) GetErrType() uint16 { |
| 530 | return self.ErrType |
| 531 | } |
| 532 | |
| 533 | func (self *ErrorMsg) SetErrType(v uint16) { |
| 534 | self.ErrType = v |
| 535 | } |
| 536 | |
| 537 | func (self *ErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 538 | if err := self.Header.Serialize(encoder); err != nil { |
| 539 | return err |
| 540 | } |
| 541 | |
| 542 | encoder.PutUint16(uint16(self.ErrType)) |
| 543 | |
| 544 | return nil |
| 545 | } |
| 546 | |
| 547 | func DecodeErrorMsg(parent *Header, decoder *goloxi.Decoder) (IErrorMsg, error) { |
| 548 | _errormsg := &ErrorMsg{Header: parent} |
| 549 | if decoder.Length() < 2 { |
| 550 | return nil, fmt.Errorf("ErrorMsg packet too short: %d < 2", decoder.Length()) |
| 551 | } |
| 552 | _errormsg.ErrType = uint16(decoder.ReadUint16()) |
| 553 | |
| 554 | switch _errormsg.ErrType { |
| 555 | case 0: |
| 556 | return DecodeHelloFailedErrorMsg(_errormsg, decoder) |
| 557 | case 1: |
| 558 | return DecodeBadRequestErrorMsg(_errormsg, decoder) |
| 559 | case 2: |
| 560 | return DecodeBadActionErrorMsg(_errormsg, decoder) |
| 561 | case 3: |
| 562 | return DecodeBadInstructionErrorMsg(_errormsg, decoder) |
| 563 | case 4: |
| 564 | return DecodeBadMatchErrorMsg(_errormsg, decoder) |
| 565 | case 5: |
| 566 | return DecodeFlowModFailedErrorMsg(_errormsg, decoder) |
| 567 | case 6: |
| 568 | return DecodeGroupModFailedErrorMsg(_errormsg, decoder) |
| 569 | case 7: |
| 570 | return DecodePortModFailedErrorMsg(_errormsg, decoder) |
| 571 | case 8: |
| 572 | return DecodeTableModFailedErrorMsg(_errormsg, decoder) |
| 573 | case 9: |
| 574 | return DecodeQueueOpFailedErrorMsg(_errormsg, decoder) |
| 575 | case 10: |
| 576 | return DecodeSwitchConfigFailedErrorMsg(_errormsg, decoder) |
| 577 | default: |
| 578 | return nil, fmt.Errorf("Invalid type '%d' for 'ErrorMsg'", _errormsg.ErrType) |
| 579 | } |
| 580 | } |
| 581 | |
| 582 | func NewErrorMsg(_err_type uint16) *ErrorMsg { |
| 583 | obj := &ErrorMsg{ |
| 584 | Header: NewHeader(1), |
| 585 | } |
| 586 | obj.ErrType = _err_type |
| 587 | return obj |
| 588 | } |
| 589 | |
| 590 | type BadActionErrorMsg struct { |
| 591 | *ErrorMsg |
| 592 | Code BadActionCode |
| 593 | Data []byte |
| 594 | } |
| 595 | |
| 596 | type IBadActionErrorMsg interface { |
| 597 | IErrorMsg |
| 598 | GetCode() BadActionCode |
| 599 | GetData() []byte |
| 600 | } |
| 601 | |
| 602 | func (self *BadActionErrorMsg) GetCode() BadActionCode { |
| 603 | return self.Code |
| 604 | } |
| 605 | |
| 606 | func (self *BadActionErrorMsg) SetCode(v BadActionCode) { |
| 607 | self.Code = v |
| 608 | } |
| 609 | |
| 610 | func (self *BadActionErrorMsg) GetData() []byte { |
| 611 | return self.Data |
| 612 | } |
| 613 | |
| 614 | func (self *BadActionErrorMsg) SetData(v []byte) { |
| 615 | self.Data = v |
| 616 | } |
| 617 | |
| 618 | func (self *BadActionErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 619 | startIndex := len(encoder.Bytes()) |
| 620 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 621 | return err |
| 622 | } |
| 623 | |
| 624 | encoder.PutUint16(uint16(self.Code)) |
| 625 | encoder.Write(self.Data) |
| 626 | length := len(encoder.Bytes()) - startIndex |
| 627 | |
| 628 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 629 | |
| 630 | return nil |
| 631 | } |
| 632 | |
| 633 | func DecodeBadActionErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*BadActionErrorMsg, error) { |
| 634 | _badactionerrormsg := &BadActionErrorMsg{ErrorMsg: parent} |
| 635 | if decoder.Length() < 2 { |
| 636 | return nil, fmt.Errorf("BadActionErrorMsg packet too short: %d < 2", decoder.Length()) |
| 637 | } |
| 638 | _badactionerrormsg.Code = BadActionCode(decoder.ReadUint16()) |
| 639 | _badactionerrormsg.Data = decoder.Read(int(decoder.Length())) |
| 640 | return _badactionerrormsg, nil |
| 641 | } |
| 642 | |
| 643 | func NewBadActionErrorMsg() *BadActionErrorMsg { |
| 644 | obj := &BadActionErrorMsg{ |
| 645 | ErrorMsg: NewErrorMsg(2), |
| 646 | } |
| 647 | return obj |
| 648 | } |
| 649 | |
| 650 | type BadInstructionErrorMsg struct { |
| 651 | *ErrorMsg |
| 652 | Code BadInstructionCode |
| 653 | Data []byte |
| 654 | } |
| 655 | |
| 656 | type IBadInstructionErrorMsg interface { |
| 657 | IErrorMsg |
| 658 | GetCode() BadInstructionCode |
| 659 | GetData() []byte |
| 660 | } |
| 661 | |
| 662 | func (self *BadInstructionErrorMsg) GetCode() BadInstructionCode { |
| 663 | return self.Code |
| 664 | } |
| 665 | |
| 666 | func (self *BadInstructionErrorMsg) SetCode(v BadInstructionCode) { |
| 667 | self.Code = v |
| 668 | } |
| 669 | |
| 670 | func (self *BadInstructionErrorMsg) GetData() []byte { |
| 671 | return self.Data |
| 672 | } |
| 673 | |
| 674 | func (self *BadInstructionErrorMsg) SetData(v []byte) { |
| 675 | self.Data = v |
| 676 | } |
| 677 | |
| 678 | func (self *BadInstructionErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 679 | startIndex := len(encoder.Bytes()) |
| 680 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 681 | return err |
| 682 | } |
| 683 | |
| 684 | encoder.PutUint16(uint16(self.Code)) |
| 685 | encoder.Write(self.Data) |
| 686 | length := len(encoder.Bytes()) - startIndex |
| 687 | |
| 688 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 689 | |
| 690 | return nil |
| 691 | } |
| 692 | |
| 693 | func DecodeBadInstructionErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*BadInstructionErrorMsg, error) { |
| 694 | _badinstructionerrormsg := &BadInstructionErrorMsg{ErrorMsg: parent} |
| 695 | if decoder.Length() < 2 { |
| 696 | return nil, fmt.Errorf("BadInstructionErrorMsg packet too short: %d < 2", decoder.Length()) |
| 697 | } |
| 698 | _badinstructionerrormsg.Code = BadInstructionCode(decoder.ReadUint16()) |
| 699 | _badinstructionerrormsg.Data = decoder.Read(int(decoder.Length())) |
| 700 | return _badinstructionerrormsg, nil |
| 701 | } |
| 702 | |
| 703 | func NewBadInstructionErrorMsg() *BadInstructionErrorMsg { |
| 704 | obj := &BadInstructionErrorMsg{ |
| 705 | ErrorMsg: NewErrorMsg(3), |
| 706 | } |
| 707 | return obj |
| 708 | } |
| 709 | |
| 710 | type BadMatchErrorMsg struct { |
| 711 | *ErrorMsg |
| 712 | Code BadMatchCode |
| 713 | Data []byte |
| 714 | } |
| 715 | |
| 716 | type IBadMatchErrorMsg interface { |
| 717 | IErrorMsg |
| 718 | GetCode() BadMatchCode |
| 719 | GetData() []byte |
| 720 | } |
| 721 | |
| 722 | func (self *BadMatchErrorMsg) GetCode() BadMatchCode { |
| 723 | return self.Code |
| 724 | } |
| 725 | |
| 726 | func (self *BadMatchErrorMsg) SetCode(v BadMatchCode) { |
| 727 | self.Code = v |
| 728 | } |
| 729 | |
| 730 | func (self *BadMatchErrorMsg) GetData() []byte { |
| 731 | return self.Data |
| 732 | } |
| 733 | |
| 734 | func (self *BadMatchErrorMsg) SetData(v []byte) { |
| 735 | self.Data = v |
| 736 | } |
| 737 | |
| 738 | func (self *BadMatchErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 739 | startIndex := len(encoder.Bytes()) |
| 740 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 741 | return err |
| 742 | } |
| 743 | |
| 744 | encoder.PutUint16(uint16(self.Code)) |
| 745 | encoder.Write(self.Data) |
| 746 | length := len(encoder.Bytes()) - startIndex |
| 747 | |
| 748 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 749 | |
| 750 | return nil |
| 751 | } |
| 752 | |
| 753 | func DecodeBadMatchErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*BadMatchErrorMsg, error) { |
| 754 | _badmatcherrormsg := &BadMatchErrorMsg{ErrorMsg: parent} |
| 755 | if decoder.Length() < 2 { |
| 756 | return nil, fmt.Errorf("BadMatchErrorMsg packet too short: %d < 2", decoder.Length()) |
| 757 | } |
| 758 | _badmatcherrormsg.Code = BadMatchCode(decoder.ReadUint16()) |
| 759 | _badmatcherrormsg.Data = decoder.Read(int(decoder.Length())) |
| 760 | return _badmatcherrormsg, nil |
| 761 | } |
| 762 | |
| 763 | func NewBadMatchErrorMsg() *BadMatchErrorMsg { |
| 764 | obj := &BadMatchErrorMsg{ |
| 765 | ErrorMsg: NewErrorMsg(4), |
| 766 | } |
| 767 | return obj |
| 768 | } |
| 769 | |
| 770 | type BadRequestErrorMsg struct { |
| 771 | *ErrorMsg |
| 772 | Code BadRequestCode |
| 773 | Data []byte |
| 774 | } |
| 775 | |
| 776 | type IBadRequestErrorMsg interface { |
| 777 | IErrorMsg |
| 778 | GetCode() BadRequestCode |
| 779 | GetData() []byte |
| 780 | } |
| 781 | |
| 782 | func (self *BadRequestErrorMsg) GetCode() BadRequestCode { |
| 783 | return self.Code |
| 784 | } |
| 785 | |
| 786 | func (self *BadRequestErrorMsg) SetCode(v BadRequestCode) { |
| 787 | self.Code = v |
| 788 | } |
| 789 | |
| 790 | func (self *BadRequestErrorMsg) GetData() []byte { |
| 791 | return self.Data |
| 792 | } |
| 793 | |
| 794 | func (self *BadRequestErrorMsg) SetData(v []byte) { |
| 795 | self.Data = v |
| 796 | } |
| 797 | |
| 798 | func (self *BadRequestErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 799 | startIndex := len(encoder.Bytes()) |
| 800 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 801 | return err |
| 802 | } |
| 803 | |
| 804 | encoder.PutUint16(uint16(self.Code)) |
| 805 | encoder.Write(self.Data) |
| 806 | length := len(encoder.Bytes()) - startIndex |
| 807 | |
| 808 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 809 | |
| 810 | return nil |
| 811 | } |
| 812 | |
| 813 | func DecodeBadRequestErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*BadRequestErrorMsg, error) { |
| 814 | _badrequesterrormsg := &BadRequestErrorMsg{ErrorMsg: parent} |
| 815 | if decoder.Length() < 2 { |
| 816 | return nil, fmt.Errorf("BadRequestErrorMsg packet too short: %d < 2", decoder.Length()) |
| 817 | } |
| 818 | _badrequesterrormsg.Code = BadRequestCode(decoder.ReadUint16()) |
| 819 | _badrequesterrormsg.Data = decoder.Read(int(decoder.Length())) |
| 820 | return _badrequesterrormsg, nil |
| 821 | } |
| 822 | |
| 823 | func NewBadRequestErrorMsg() *BadRequestErrorMsg { |
| 824 | obj := &BadRequestErrorMsg{ |
| 825 | ErrorMsg: NewErrorMsg(1), |
| 826 | } |
| 827 | return obj |
| 828 | } |
| 829 | |
| 830 | type BarrierReply struct { |
| 831 | *Header |
| 832 | } |
| 833 | |
| 834 | type IBarrierReply interface { |
| 835 | IHeader |
| 836 | } |
| 837 | |
| 838 | func (self *BarrierReply) Serialize(encoder *goloxi.Encoder) error { |
| 839 | startIndex := len(encoder.Bytes()) |
| 840 | if err := self.Header.Serialize(encoder); err != nil { |
| 841 | return err |
| 842 | } |
| 843 | length := len(encoder.Bytes()) - startIndex |
| 844 | |
| 845 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 846 | |
| 847 | return nil |
| 848 | } |
| 849 | |
| 850 | func DecodeBarrierReply(parent *Header, decoder *goloxi.Decoder) (*BarrierReply, error) { |
| 851 | _barrierreply := &BarrierReply{Header: parent} |
| 852 | return _barrierreply, nil |
| 853 | } |
| 854 | |
| 855 | func NewBarrierReply() *BarrierReply { |
| 856 | obj := &BarrierReply{ |
| 857 | Header: NewHeader(21), |
| 858 | } |
| 859 | return obj |
| 860 | } |
| 861 | |
| 862 | type BarrierRequest struct { |
| 863 | *Header |
| 864 | } |
| 865 | |
| 866 | type IBarrierRequest interface { |
| 867 | IHeader |
| 868 | } |
| 869 | |
| 870 | func (self *BarrierRequest) Serialize(encoder *goloxi.Encoder) error { |
| 871 | startIndex := len(encoder.Bytes()) |
| 872 | if err := self.Header.Serialize(encoder); err != nil { |
| 873 | return err |
| 874 | } |
| 875 | length := len(encoder.Bytes()) - startIndex |
| 876 | |
| 877 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 878 | |
| 879 | return nil |
| 880 | } |
| 881 | |
| 882 | func DecodeBarrierRequest(parent *Header, decoder *goloxi.Decoder) (*BarrierRequest, error) { |
| 883 | _barrierrequest := &BarrierRequest{Header: parent} |
| 884 | return _barrierrequest, nil |
| 885 | } |
| 886 | |
| 887 | func NewBarrierRequest() *BarrierRequest { |
| 888 | obj := &BarrierRequest{ |
| 889 | Header: NewHeader(20), |
| 890 | } |
| 891 | return obj |
| 892 | } |
| 893 | |
| 894 | type Experimenter struct { |
| 895 | *Header |
| 896 | Experimenter uint32 |
| 897 | } |
| 898 | |
| 899 | type IExperimenter interface { |
| 900 | IHeader |
| 901 | GetExperimenter() uint32 |
| 902 | } |
| 903 | |
| 904 | func (self *Experimenter) GetExperimenter() uint32 { |
| 905 | return self.Experimenter |
| 906 | } |
| 907 | |
| 908 | func (self *Experimenter) SetExperimenter(v uint32) { |
| 909 | self.Experimenter = v |
| 910 | } |
| 911 | |
| 912 | func (self *Experimenter) Serialize(encoder *goloxi.Encoder) error { |
| 913 | if err := self.Header.Serialize(encoder); err != nil { |
| 914 | return err |
| 915 | } |
| 916 | |
| 917 | encoder.PutUint32(uint32(self.Experimenter)) |
| 918 | |
| 919 | return nil |
| 920 | } |
| 921 | |
| 922 | func DecodeExperimenter(parent *Header, decoder *goloxi.Decoder) (IExperimenter, error) { |
| 923 | _experimenter := &Experimenter{Header: parent} |
| 924 | if decoder.Length() < 4 { |
| 925 | return nil, fmt.Errorf("Experimenter packet too short: %d < 4", decoder.Length()) |
| 926 | } |
| 927 | _experimenter.Experimenter = uint32(decoder.ReadUint32()) |
| 928 | |
| 929 | switch _experimenter.Experimenter { |
| 930 | case 8992: |
| 931 | return DecodeNiciraHeader(_experimenter, decoder) |
| 932 | case 6035143: |
| 933 | return DecodeBsnHeader(_experimenter, decoder) |
| 934 | default: |
| 935 | return nil, fmt.Errorf("Invalid type '%d' for 'Experimenter'", _experimenter.Experimenter) |
| 936 | } |
| 937 | } |
| 938 | |
| 939 | func NewExperimenter(_experimenter uint32) *Experimenter { |
| 940 | obj := &Experimenter{ |
| 941 | Header: NewHeader(4), |
| 942 | } |
| 943 | obj.Experimenter = _experimenter |
| 944 | return obj |
| 945 | } |
| 946 | |
| 947 | type BsnHeader struct { |
| 948 | *Experimenter |
| 949 | Subtype uint32 |
| 950 | } |
| 951 | |
| 952 | type IBsnHeader interface { |
| 953 | IExperimenter |
| 954 | GetSubtype() uint32 |
| 955 | } |
| 956 | |
| 957 | func (self *BsnHeader) GetSubtype() uint32 { |
| 958 | return self.Subtype |
| 959 | } |
| 960 | |
| 961 | func (self *BsnHeader) SetSubtype(v uint32) { |
| 962 | self.Subtype = v |
| 963 | } |
| 964 | |
| 965 | func (self *BsnHeader) Serialize(encoder *goloxi.Encoder) error { |
| 966 | if err := self.Experimenter.Serialize(encoder); err != nil { |
| 967 | return err |
| 968 | } |
| 969 | |
| 970 | encoder.PutUint32(uint32(self.Subtype)) |
| 971 | |
| 972 | return nil |
| 973 | } |
| 974 | |
| 975 | func DecodeBsnHeader(parent *Experimenter, decoder *goloxi.Decoder) (IBsnHeader, error) { |
| 976 | _bsnheader := &BsnHeader{Experimenter: parent} |
| 977 | if decoder.Length() < 4 { |
| 978 | return nil, fmt.Errorf("BsnHeader packet too short: %d < 4", decoder.Length()) |
| 979 | } |
| 980 | _bsnheader.Subtype = uint32(decoder.ReadUint32()) |
| 981 | |
| 982 | switch _bsnheader.Subtype { |
| 983 | case 3: |
| 984 | return DecodeBsnSetMirroring(_bsnheader, decoder) |
| 985 | case 4: |
| 986 | return DecodeBsnGetMirroringRequest(_bsnheader, decoder) |
| 987 | case 5: |
| 988 | return DecodeBsnGetMirroringReply(_bsnheader, decoder) |
| 989 | case 9: |
| 990 | return DecodeBsnGetInterfacesRequest(_bsnheader, decoder) |
| 991 | case 10: |
| 992 | return DecodeBsnGetInterfacesReply(_bsnheader, decoder) |
| 993 | case 11: |
| 994 | return DecodeBsnSetPktinSuppressionRequest(_bsnheader, decoder) |
| 995 | case 15: |
| 996 | return DecodeBsnVirtualPortCreateRequest(_bsnheader, decoder) |
| 997 | case 16: |
| 998 | return DecodeBsnVirtualPortCreateReply(_bsnheader, decoder) |
| 999 | case 17: |
| 1000 | return DecodeBsnVirtualPortRemoveRequest(_bsnheader, decoder) |
| 1001 | case 18: |
| 1002 | return DecodeBsnBwEnableSetRequest(_bsnheader, decoder) |
| 1003 | case 19: |
| 1004 | return DecodeBsnBwEnableGetRequest(_bsnheader, decoder) |
| 1005 | case 20: |
| 1006 | return DecodeBsnBwEnableGetReply(_bsnheader, decoder) |
| 1007 | case 21: |
| 1008 | return DecodeBsnBwClearDataRequest(_bsnheader, decoder) |
| 1009 | case 22: |
| 1010 | return DecodeBsnBwClearDataReply(_bsnheader, decoder) |
| 1011 | case 23: |
| 1012 | return DecodeBsnBwEnableSetReply(_bsnheader, decoder) |
| 1013 | case 25: |
| 1014 | return DecodeBsnSetPktinSuppressionReply(_bsnheader, decoder) |
| 1015 | case 26: |
| 1016 | return DecodeBsnVirtualPortRemoveReply(_bsnheader, decoder) |
| 1017 | case 31: |
| 1018 | return DecodeBsnPduTxRequest(_bsnheader, decoder) |
| 1019 | case 32: |
| 1020 | return DecodeBsnPduTxReply(_bsnheader, decoder) |
| 1021 | case 33: |
| 1022 | return DecodeBsnPduRxRequest(_bsnheader, decoder) |
| 1023 | case 34: |
| 1024 | return DecodeBsnPduRxReply(_bsnheader, decoder) |
| 1025 | case 35: |
| 1026 | return DecodeBsnPduRxTimeout(_bsnheader, decoder) |
| 1027 | default: |
| 1028 | return nil, fmt.Errorf("Invalid type '%d' for 'BsnHeader'", _bsnheader.Subtype) |
| 1029 | } |
| 1030 | } |
| 1031 | |
| 1032 | func NewBsnHeader(_subtype uint32) *BsnHeader { |
| 1033 | obj := &BsnHeader{ |
| 1034 | Experimenter: NewExperimenter(6035143), |
| 1035 | } |
| 1036 | obj.Subtype = _subtype |
| 1037 | return obj |
| 1038 | } |
| 1039 | |
| 1040 | type BsnBwClearDataReply struct { |
| 1041 | *BsnHeader |
| 1042 | Status uint32 |
| 1043 | } |
| 1044 | |
| 1045 | type IBsnBwClearDataReply interface { |
| 1046 | IBsnHeader |
| 1047 | GetStatus() uint32 |
| 1048 | } |
| 1049 | |
| 1050 | func (self *BsnBwClearDataReply) GetStatus() uint32 { |
| 1051 | return self.Status |
| 1052 | } |
| 1053 | |
| 1054 | func (self *BsnBwClearDataReply) SetStatus(v uint32) { |
| 1055 | self.Status = v |
| 1056 | } |
| 1057 | |
| 1058 | func (self *BsnBwClearDataReply) Serialize(encoder *goloxi.Encoder) error { |
| 1059 | startIndex := len(encoder.Bytes()) |
| 1060 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1061 | return err |
| 1062 | } |
| 1063 | |
| 1064 | encoder.PutUint32(uint32(self.Status)) |
| 1065 | length := len(encoder.Bytes()) - startIndex |
| 1066 | |
| 1067 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1068 | |
| 1069 | return nil |
| 1070 | } |
| 1071 | |
| 1072 | func DecodeBsnBwClearDataReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwClearDataReply, error) { |
| 1073 | _bsnbwcleardatareply := &BsnBwClearDataReply{BsnHeader: parent} |
| 1074 | if decoder.Length() < 4 { |
| 1075 | return nil, fmt.Errorf("BsnBwClearDataReply packet too short: %d < 4", decoder.Length()) |
| 1076 | } |
| 1077 | _bsnbwcleardatareply.Status = uint32(decoder.ReadUint32()) |
| 1078 | return _bsnbwcleardatareply, nil |
| 1079 | } |
| 1080 | |
| 1081 | func NewBsnBwClearDataReply() *BsnBwClearDataReply { |
| 1082 | obj := &BsnBwClearDataReply{ |
| 1083 | BsnHeader: NewBsnHeader(22), |
| 1084 | } |
| 1085 | return obj |
| 1086 | } |
| 1087 | |
| 1088 | type BsnBwClearDataRequest struct { |
| 1089 | *BsnHeader |
| 1090 | } |
| 1091 | |
| 1092 | type IBsnBwClearDataRequest interface { |
| 1093 | IBsnHeader |
| 1094 | } |
| 1095 | |
| 1096 | func (self *BsnBwClearDataRequest) Serialize(encoder *goloxi.Encoder) error { |
| 1097 | startIndex := len(encoder.Bytes()) |
| 1098 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1099 | return err |
| 1100 | } |
| 1101 | length := len(encoder.Bytes()) - startIndex |
| 1102 | |
| 1103 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1104 | |
| 1105 | return nil |
| 1106 | } |
| 1107 | |
| 1108 | func DecodeBsnBwClearDataRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwClearDataRequest, error) { |
| 1109 | _bsnbwcleardatarequest := &BsnBwClearDataRequest{BsnHeader: parent} |
| 1110 | return _bsnbwcleardatarequest, nil |
| 1111 | } |
| 1112 | |
| 1113 | func NewBsnBwClearDataRequest() *BsnBwClearDataRequest { |
| 1114 | obj := &BsnBwClearDataRequest{ |
| 1115 | BsnHeader: NewBsnHeader(21), |
| 1116 | } |
| 1117 | return obj |
| 1118 | } |
| 1119 | |
| 1120 | type BsnBwEnableGetReply struct { |
| 1121 | *BsnHeader |
| 1122 | Enabled uint32 |
| 1123 | } |
| 1124 | |
| 1125 | type IBsnBwEnableGetReply interface { |
| 1126 | IBsnHeader |
| 1127 | GetEnabled() uint32 |
| 1128 | } |
| 1129 | |
| 1130 | func (self *BsnBwEnableGetReply) GetEnabled() uint32 { |
| 1131 | return self.Enabled |
| 1132 | } |
| 1133 | |
| 1134 | func (self *BsnBwEnableGetReply) SetEnabled(v uint32) { |
| 1135 | self.Enabled = v |
| 1136 | } |
| 1137 | |
| 1138 | func (self *BsnBwEnableGetReply) Serialize(encoder *goloxi.Encoder) error { |
| 1139 | startIndex := len(encoder.Bytes()) |
| 1140 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1141 | return err |
| 1142 | } |
| 1143 | |
| 1144 | encoder.PutUint32(uint32(self.Enabled)) |
| 1145 | length := len(encoder.Bytes()) - startIndex |
| 1146 | |
| 1147 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1148 | |
| 1149 | return nil |
| 1150 | } |
| 1151 | |
| 1152 | func DecodeBsnBwEnableGetReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwEnableGetReply, error) { |
| 1153 | _bsnbwenablegetreply := &BsnBwEnableGetReply{BsnHeader: parent} |
| 1154 | if decoder.Length() < 4 { |
| 1155 | return nil, fmt.Errorf("BsnBwEnableGetReply packet too short: %d < 4", decoder.Length()) |
| 1156 | } |
| 1157 | _bsnbwenablegetreply.Enabled = uint32(decoder.ReadUint32()) |
| 1158 | return _bsnbwenablegetreply, nil |
| 1159 | } |
| 1160 | |
| 1161 | func NewBsnBwEnableGetReply() *BsnBwEnableGetReply { |
| 1162 | obj := &BsnBwEnableGetReply{ |
| 1163 | BsnHeader: NewBsnHeader(20), |
| 1164 | } |
| 1165 | return obj |
| 1166 | } |
| 1167 | |
| 1168 | type BsnBwEnableGetRequest struct { |
| 1169 | *BsnHeader |
| 1170 | } |
| 1171 | |
| 1172 | type IBsnBwEnableGetRequest interface { |
| 1173 | IBsnHeader |
| 1174 | } |
| 1175 | |
| 1176 | func (self *BsnBwEnableGetRequest) Serialize(encoder *goloxi.Encoder) error { |
| 1177 | startIndex := len(encoder.Bytes()) |
| 1178 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1179 | return err |
| 1180 | } |
| 1181 | length := len(encoder.Bytes()) - startIndex |
| 1182 | |
| 1183 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1184 | |
| 1185 | return nil |
| 1186 | } |
| 1187 | |
| 1188 | func DecodeBsnBwEnableGetRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwEnableGetRequest, error) { |
| 1189 | _bsnbwenablegetrequest := &BsnBwEnableGetRequest{BsnHeader: parent} |
| 1190 | return _bsnbwenablegetrequest, nil |
| 1191 | } |
| 1192 | |
| 1193 | func NewBsnBwEnableGetRequest() *BsnBwEnableGetRequest { |
| 1194 | obj := &BsnBwEnableGetRequest{ |
| 1195 | BsnHeader: NewBsnHeader(19), |
| 1196 | } |
| 1197 | return obj |
| 1198 | } |
| 1199 | |
| 1200 | type BsnBwEnableSetReply struct { |
| 1201 | *BsnHeader |
| 1202 | Enable uint32 |
| 1203 | Status uint32 |
| 1204 | } |
| 1205 | |
| 1206 | type IBsnBwEnableSetReply interface { |
| 1207 | IBsnHeader |
| 1208 | GetEnable() uint32 |
| 1209 | GetStatus() uint32 |
| 1210 | } |
| 1211 | |
| 1212 | func (self *BsnBwEnableSetReply) GetEnable() uint32 { |
| 1213 | return self.Enable |
| 1214 | } |
| 1215 | |
| 1216 | func (self *BsnBwEnableSetReply) SetEnable(v uint32) { |
| 1217 | self.Enable = v |
| 1218 | } |
| 1219 | |
| 1220 | func (self *BsnBwEnableSetReply) GetStatus() uint32 { |
| 1221 | return self.Status |
| 1222 | } |
| 1223 | |
| 1224 | func (self *BsnBwEnableSetReply) SetStatus(v uint32) { |
| 1225 | self.Status = v |
| 1226 | } |
| 1227 | |
| 1228 | func (self *BsnBwEnableSetReply) Serialize(encoder *goloxi.Encoder) error { |
| 1229 | startIndex := len(encoder.Bytes()) |
| 1230 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1231 | return err |
| 1232 | } |
| 1233 | |
| 1234 | encoder.PutUint32(uint32(self.Enable)) |
| 1235 | encoder.PutUint32(uint32(self.Status)) |
| 1236 | length := len(encoder.Bytes()) - startIndex |
| 1237 | |
| 1238 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1239 | |
| 1240 | return nil |
| 1241 | } |
| 1242 | |
| 1243 | func DecodeBsnBwEnableSetReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwEnableSetReply, error) { |
| 1244 | _bsnbwenablesetreply := &BsnBwEnableSetReply{BsnHeader: parent} |
| 1245 | if decoder.Length() < 8 { |
| 1246 | return nil, fmt.Errorf("BsnBwEnableSetReply packet too short: %d < 8", decoder.Length()) |
| 1247 | } |
| 1248 | _bsnbwenablesetreply.Enable = uint32(decoder.ReadUint32()) |
| 1249 | _bsnbwenablesetreply.Status = uint32(decoder.ReadUint32()) |
| 1250 | return _bsnbwenablesetreply, nil |
| 1251 | } |
| 1252 | |
| 1253 | func NewBsnBwEnableSetReply() *BsnBwEnableSetReply { |
| 1254 | obj := &BsnBwEnableSetReply{ |
| 1255 | BsnHeader: NewBsnHeader(23), |
| 1256 | } |
| 1257 | return obj |
| 1258 | } |
| 1259 | |
| 1260 | type BsnBwEnableSetRequest struct { |
| 1261 | *BsnHeader |
| 1262 | Enable uint32 |
| 1263 | } |
| 1264 | |
| 1265 | type IBsnBwEnableSetRequest interface { |
| 1266 | IBsnHeader |
| 1267 | GetEnable() uint32 |
| 1268 | } |
| 1269 | |
| 1270 | func (self *BsnBwEnableSetRequest) GetEnable() uint32 { |
| 1271 | return self.Enable |
| 1272 | } |
| 1273 | |
| 1274 | func (self *BsnBwEnableSetRequest) SetEnable(v uint32) { |
| 1275 | self.Enable = v |
| 1276 | } |
| 1277 | |
| 1278 | func (self *BsnBwEnableSetRequest) Serialize(encoder *goloxi.Encoder) error { |
| 1279 | startIndex := len(encoder.Bytes()) |
| 1280 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1281 | return err |
| 1282 | } |
| 1283 | |
| 1284 | encoder.PutUint32(uint32(self.Enable)) |
| 1285 | length := len(encoder.Bytes()) - startIndex |
| 1286 | |
| 1287 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1288 | |
| 1289 | return nil |
| 1290 | } |
| 1291 | |
| 1292 | func DecodeBsnBwEnableSetRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnBwEnableSetRequest, error) { |
| 1293 | _bsnbwenablesetrequest := &BsnBwEnableSetRequest{BsnHeader: parent} |
| 1294 | if decoder.Length() < 4 { |
| 1295 | return nil, fmt.Errorf("BsnBwEnableSetRequest packet too short: %d < 4", decoder.Length()) |
| 1296 | } |
| 1297 | _bsnbwenablesetrequest.Enable = uint32(decoder.ReadUint32()) |
| 1298 | return _bsnbwenablesetrequest, nil |
| 1299 | } |
| 1300 | |
| 1301 | func NewBsnBwEnableSetRequest() *BsnBwEnableSetRequest { |
| 1302 | obj := &BsnBwEnableSetRequest{ |
| 1303 | BsnHeader: NewBsnHeader(18), |
| 1304 | } |
| 1305 | return obj |
| 1306 | } |
| 1307 | |
| 1308 | type BsnGetInterfacesReply struct { |
| 1309 | *BsnHeader |
| 1310 | Interfaces []*BsnInterface |
| 1311 | } |
| 1312 | |
| 1313 | type IBsnGetInterfacesReply interface { |
| 1314 | IBsnHeader |
| 1315 | GetInterfaces() []*BsnInterface |
| 1316 | } |
| 1317 | |
| 1318 | func (self *BsnGetInterfacesReply) GetInterfaces() []*BsnInterface { |
| 1319 | return self.Interfaces |
| 1320 | } |
| 1321 | |
| 1322 | func (self *BsnGetInterfacesReply) SetInterfaces(v []*BsnInterface) { |
| 1323 | self.Interfaces = v |
| 1324 | } |
| 1325 | |
| 1326 | func (self *BsnGetInterfacesReply) Serialize(encoder *goloxi.Encoder) error { |
| 1327 | startIndex := len(encoder.Bytes()) |
| 1328 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1329 | return err |
| 1330 | } |
| 1331 | |
| 1332 | for _, obj := range self.Interfaces { |
| 1333 | if err := obj.Serialize(encoder); err != nil { |
| 1334 | return err |
| 1335 | } |
| 1336 | } |
| 1337 | length := len(encoder.Bytes()) - startIndex |
| 1338 | |
| 1339 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1340 | |
| 1341 | return nil |
| 1342 | } |
| 1343 | |
| 1344 | func DecodeBsnGetInterfacesReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetInterfacesReply, error) { |
| 1345 | _bsngetinterfacesreply := &BsnGetInterfacesReply{BsnHeader: parent} |
| 1346 | |
| 1347 | for decoder.Length() >= 32 { |
| 1348 | item, err := DecodeBsnInterface(decoder) |
| 1349 | if err != nil { |
| 1350 | return nil, err |
| 1351 | } |
| 1352 | if item != nil { |
| 1353 | _bsngetinterfacesreply.Interfaces = append(_bsngetinterfacesreply.Interfaces, item) |
| 1354 | } |
| 1355 | } |
| 1356 | return _bsngetinterfacesreply, nil |
| 1357 | } |
| 1358 | |
| 1359 | func NewBsnGetInterfacesReply() *BsnGetInterfacesReply { |
| 1360 | obj := &BsnGetInterfacesReply{ |
| 1361 | BsnHeader: NewBsnHeader(10), |
| 1362 | } |
| 1363 | return obj |
| 1364 | } |
| 1365 | |
| 1366 | type BsnGetInterfacesRequest struct { |
| 1367 | *BsnHeader |
| 1368 | } |
| 1369 | |
| 1370 | type IBsnGetInterfacesRequest interface { |
| 1371 | IBsnHeader |
| 1372 | } |
| 1373 | |
| 1374 | func (self *BsnGetInterfacesRequest) Serialize(encoder *goloxi.Encoder) error { |
| 1375 | startIndex := len(encoder.Bytes()) |
| 1376 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1377 | return err |
| 1378 | } |
| 1379 | length := len(encoder.Bytes()) - startIndex |
| 1380 | |
| 1381 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1382 | |
| 1383 | return nil |
| 1384 | } |
| 1385 | |
| 1386 | func DecodeBsnGetInterfacesRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetInterfacesRequest, error) { |
| 1387 | _bsngetinterfacesrequest := &BsnGetInterfacesRequest{BsnHeader: parent} |
| 1388 | return _bsngetinterfacesrequest, nil |
| 1389 | } |
| 1390 | |
| 1391 | func NewBsnGetInterfacesRequest() *BsnGetInterfacesRequest { |
| 1392 | obj := &BsnGetInterfacesRequest{ |
| 1393 | BsnHeader: NewBsnHeader(9), |
| 1394 | } |
| 1395 | return obj |
| 1396 | } |
| 1397 | |
| 1398 | type BsnGetMirroringReply struct { |
| 1399 | *BsnHeader |
| 1400 | ReportMirrorPorts uint8 |
| 1401 | } |
| 1402 | |
| 1403 | type IBsnGetMirroringReply interface { |
| 1404 | IBsnHeader |
| 1405 | GetReportMirrorPorts() uint8 |
| 1406 | } |
| 1407 | |
| 1408 | func (self *BsnGetMirroringReply) GetReportMirrorPorts() uint8 { |
| 1409 | return self.ReportMirrorPorts |
| 1410 | } |
| 1411 | |
| 1412 | func (self *BsnGetMirroringReply) SetReportMirrorPorts(v uint8) { |
| 1413 | self.ReportMirrorPorts = v |
| 1414 | } |
| 1415 | |
| 1416 | func (self *BsnGetMirroringReply) Serialize(encoder *goloxi.Encoder) error { |
| 1417 | startIndex := len(encoder.Bytes()) |
| 1418 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1419 | return err |
| 1420 | } |
| 1421 | |
| 1422 | encoder.PutUint8(uint8(self.ReportMirrorPorts)) |
| 1423 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 1424 | length := len(encoder.Bytes()) - startIndex |
| 1425 | |
| 1426 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1427 | |
| 1428 | return nil |
| 1429 | } |
| 1430 | |
| 1431 | func DecodeBsnGetMirroringReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetMirroringReply, error) { |
| 1432 | _bsngetmirroringreply := &BsnGetMirroringReply{BsnHeader: parent} |
| 1433 | if decoder.Length() < 4 { |
| 1434 | return nil, fmt.Errorf("BsnGetMirroringReply packet too short: %d < 4", decoder.Length()) |
| 1435 | } |
| 1436 | _bsngetmirroringreply.ReportMirrorPorts = uint8(decoder.ReadByte()) |
| 1437 | decoder.Skip(3) |
| 1438 | return _bsngetmirroringreply, nil |
| 1439 | } |
| 1440 | |
| 1441 | func NewBsnGetMirroringReply() *BsnGetMirroringReply { |
| 1442 | obj := &BsnGetMirroringReply{ |
| 1443 | BsnHeader: NewBsnHeader(5), |
| 1444 | } |
| 1445 | return obj |
| 1446 | } |
| 1447 | |
| 1448 | type BsnGetMirroringRequest struct { |
| 1449 | *BsnHeader |
| 1450 | ReportMirrorPorts uint8 |
| 1451 | } |
| 1452 | |
| 1453 | type IBsnGetMirroringRequest interface { |
| 1454 | IBsnHeader |
| 1455 | GetReportMirrorPorts() uint8 |
| 1456 | } |
| 1457 | |
| 1458 | func (self *BsnGetMirroringRequest) GetReportMirrorPorts() uint8 { |
| 1459 | return self.ReportMirrorPorts |
| 1460 | } |
| 1461 | |
| 1462 | func (self *BsnGetMirroringRequest) SetReportMirrorPorts(v uint8) { |
| 1463 | self.ReportMirrorPorts = v |
| 1464 | } |
| 1465 | |
| 1466 | func (self *BsnGetMirroringRequest) Serialize(encoder *goloxi.Encoder) error { |
| 1467 | startIndex := len(encoder.Bytes()) |
| 1468 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1469 | return err |
| 1470 | } |
| 1471 | |
| 1472 | encoder.PutUint8(uint8(self.ReportMirrorPorts)) |
| 1473 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 1474 | length := len(encoder.Bytes()) - startIndex |
| 1475 | |
| 1476 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1477 | |
| 1478 | return nil |
| 1479 | } |
| 1480 | |
| 1481 | func DecodeBsnGetMirroringRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnGetMirroringRequest, error) { |
| 1482 | _bsngetmirroringrequest := &BsnGetMirroringRequest{BsnHeader: parent} |
| 1483 | if decoder.Length() < 4 { |
| 1484 | return nil, fmt.Errorf("BsnGetMirroringRequest packet too short: %d < 4", decoder.Length()) |
| 1485 | } |
| 1486 | _bsngetmirroringrequest.ReportMirrorPorts = uint8(decoder.ReadByte()) |
| 1487 | decoder.Skip(3) |
| 1488 | return _bsngetmirroringrequest, nil |
| 1489 | } |
| 1490 | |
| 1491 | func NewBsnGetMirroringRequest() *BsnGetMirroringRequest { |
| 1492 | obj := &BsnGetMirroringRequest{ |
| 1493 | BsnHeader: NewBsnHeader(4), |
| 1494 | } |
| 1495 | return obj |
| 1496 | } |
| 1497 | |
| 1498 | type BsnPduRxReply struct { |
| 1499 | *BsnHeader |
| 1500 | Status uint32 |
| 1501 | PortNo Port |
| 1502 | SlotNum uint8 |
| 1503 | } |
| 1504 | |
| 1505 | type IBsnPduRxReply interface { |
| 1506 | IBsnHeader |
| 1507 | GetStatus() uint32 |
| 1508 | GetPortNo() Port |
| 1509 | GetSlotNum() uint8 |
| 1510 | } |
| 1511 | |
| 1512 | func (self *BsnPduRxReply) GetStatus() uint32 { |
| 1513 | return self.Status |
| 1514 | } |
| 1515 | |
| 1516 | func (self *BsnPduRxReply) SetStatus(v uint32) { |
| 1517 | self.Status = v |
| 1518 | } |
| 1519 | |
| 1520 | func (self *BsnPduRxReply) GetPortNo() Port { |
| 1521 | return self.PortNo |
| 1522 | } |
| 1523 | |
| 1524 | func (self *BsnPduRxReply) SetPortNo(v Port) { |
| 1525 | self.PortNo = v |
| 1526 | } |
| 1527 | |
| 1528 | func (self *BsnPduRxReply) GetSlotNum() uint8 { |
| 1529 | return self.SlotNum |
| 1530 | } |
| 1531 | |
| 1532 | func (self *BsnPduRxReply) SetSlotNum(v uint8) { |
| 1533 | self.SlotNum = v |
| 1534 | } |
| 1535 | |
| 1536 | func (self *BsnPduRxReply) Serialize(encoder *goloxi.Encoder) error { |
| 1537 | startIndex := len(encoder.Bytes()) |
| 1538 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1539 | return err |
| 1540 | } |
| 1541 | |
| 1542 | encoder.PutUint32(uint32(self.Status)) |
| 1543 | self.PortNo.Serialize(encoder) |
| 1544 | encoder.PutUint8(uint8(self.SlotNum)) |
| 1545 | length := len(encoder.Bytes()) - startIndex |
| 1546 | |
| 1547 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1548 | |
| 1549 | return nil |
| 1550 | } |
| 1551 | |
| 1552 | func DecodeBsnPduRxReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduRxReply, error) { |
| 1553 | _bsnpdurxreply := &BsnPduRxReply{BsnHeader: parent} |
| 1554 | if decoder.Length() < 9 { |
| 1555 | return nil, fmt.Errorf("BsnPduRxReply packet too short: %d < 9", decoder.Length()) |
| 1556 | } |
| 1557 | _bsnpdurxreply.Status = uint32(decoder.ReadUint32()) |
| 1558 | _bsnpdurxreply.PortNo.Decode(decoder) |
| 1559 | _bsnpdurxreply.SlotNum = uint8(decoder.ReadByte()) |
| 1560 | return _bsnpdurxreply, nil |
| 1561 | } |
| 1562 | |
| 1563 | func NewBsnPduRxReply() *BsnPduRxReply { |
| 1564 | obj := &BsnPduRxReply{ |
| 1565 | BsnHeader: NewBsnHeader(34), |
| 1566 | } |
| 1567 | return obj |
| 1568 | } |
| 1569 | |
| 1570 | type BsnPduRxRequest struct { |
| 1571 | *BsnHeader |
| 1572 | TimeoutMs uint32 |
| 1573 | PortNo Port |
| 1574 | SlotNum uint8 |
| 1575 | Data []byte |
| 1576 | } |
| 1577 | |
| 1578 | type IBsnPduRxRequest interface { |
| 1579 | IBsnHeader |
| 1580 | GetTimeoutMs() uint32 |
| 1581 | GetPortNo() Port |
| 1582 | GetSlotNum() uint8 |
| 1583 | GetData() []byte |
| 1584 | } |
| 1585 | |
| 1586 | func (self *BsnPduRxRequest) GetTimeoutMs() uint32 { |
| 1587 | return self.TimeoutMs |
| 1588 | } |
| 1589 | |
| 1590 | func (self *BsnPduRxRequest) SetTimeoutMs(v uint32) { |
| 1591 | self.TimeoutMs = v |
| 1592 | } |
| 1593 | |
| 1594 | func (self *BsnPduRxRequest) GetPortNo() Port { |
| 1595 | return self.PortNo |
| 1596 | } |
| 1597 | |
| 1598 | func (self *BsnPduRxRequest) SetPortNo(v Port) { |
| 1599 | self.PortNo = v |
| 1600 | } |
| 1601 | |
| 1602 | func (self *BsnPduRxRequest) GetSlotNum() uint8 { |
| 1603 | return self.SlotNum |
| 1604 | } |
| 1605 | |
| 1606 | func (self *BsnPduRxRequest) SetSlotNum(v uint8) { |
| 1607 | self.SlotNum = v |
| 1608 | } |
| 1609 | |
| 1610 | func (self *BsnPduRxRequest) GetData() []byte { |
| 1611 | return self.Data |
| 1612 | } |
| 1613 | |
| 1614 | func (self *BsnPduRxRequest) SetData(v []byte) { |
| 1615 | self.Data = v |
| 1616 | } |
| 1617 | |
| 1618 | func (self *BsnPduRxRequest) Serialize(encoder *goloxi.Encoder) error { |
| 1619 | startIndex := len(encoder.Bytes()) |
| 1620 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1621 | return err |
| 1622 | } |
| 1623 | |
| 1624 | encoder.PutUint32(uint32(self.TimeoutMs)) |
| 1625 | self.PortNo.Serialize(encoder) |
| 1626 | encoder.PutUint8(uint8(self.SlotNum)) |
| 1627 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 1628 | encoder.Write(self.Data) |
| 1629 | length := len(encoder.Bytes()) - startIndex |
| 1630 | |
| 1631 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1632 | |
| 1633 | return nil |
| 1634 | } |
| 1635 | |
| 1636 | func DecodeBsnPduRxRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduRxRequest, error) { |
| 1637 | _bsnpdurxrequest := &BsnPduRxRequest{BsnHeader: parent} |
| 1638 | if decoder.Length() < 12 { |
| 1639 | return nil, fmt.Errorf("BsnPduRxRequest packet too short: %d < 12", decoder.Length()) |
| 1640 | } |
| 1641 | _bsnpdurxrequest.TimeoutMs = uint32(decoder.ReadUint32()) |
| 1642 | _bsnpdurxrequest.PortNo.Decode(decoder) |
| 1643 | _bsnpdurxrequest.SlotNum = uint8(decoder.ReadByte()) |
| 1644 | decoder.Skip(3) |
| 1645 | _bsnpdurxrequest.Data = decoder.Read(int(decoder.Length())) |
| 1646 | return _bsnpdurxrequest, nil |
| 1647 | } |
| 1648 | |
| 1649 | func NewBsnPduRxRequest() *BsnPduRxRequest { |
| 1650 | obj := &BsnPduRxRequest{ |
| 1651 | BsnHeader: NewBsnHeader(33), |
| 1652 | } |
| 1653 | return obj |
| 1654 | } |
| 1655 | |
| 1656 | type BsnPduRxTimeout struct { |
| 1657 | *BsnHeader |
| 1658 | PortNo Port |
| 1659 | SlotNum uint8 |
| 1660 | } |
| 1661 | |
| 1662 | type IBsnPduRxTimeout interface { |
| 1663 | IBsnHeader |
| 1664 | GetPortNo() Port |
| 1665 | GetSlotNum() uint8 |
| 1666 | } |
| 1667 | |
| 1668 | func (self *BsnPduRxTimeout) GetPortNo() Port { |
| 1669 | return self.PortNo |
| 1670 | } |
| 1671 | |
| 1672 | func (self *BsnPduRxTimeout) SetPortNo(v Port) { |
| 1673 | self.PortNo = v |
| 1674 | } |
| 1675 | |
| 1676 | func (self *BsnPduRxTimeout) GetSlotNum() uint8 { |
| 1677 | return self.SlotNum |
| 1678 | } |
| 1679 | |
| 1680 | func (self *BsnPduRxTimeout) SetSlotNum(v uint8) { |
| 1681 | self.SlotNum = v |
| 1682 | } |
| 1683 | |
| 1684 | func (self *BsnPduRxTimeout) Serialize(encoder *goloxi.Encoder) error { |
| 1685 | startIndex := len(encoder.Bytes()) |
| 1686 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1687 | return err |
| 1688 | } |
| 1689 | |
| 1690 | self.PortNo.Serialize(encoder) |
| 1691 | encoder.PutUint8(uint8(self.SlotNum)) |
| 1692 | length := len(encoder.Bytes()) - startIndex |
| 1693 | |
| 1694 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1695 | |
| 1696 | return nil |
| 1697 | } |
| 1698 | |
| 1699 | func DecodeBsnPduRxTimeout(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduRxTimeout, error) { |
| 1700 | _bsnpdurxtimeout := &BsnPduRxTimeout{BsnHeader: parent} |
| 1701 | if decoder.Length() < 5 { |
| 1702 | return nil, fmt.Errorf("BsnPduRxTimeout packet too short: %d < 5", decoder.Length()) |
| 1703 | } |
| 1704 | _bsnpdurxtimeout.PortNo.Decode(decoder) |
| 1705 | _bsnpdurxtimeout.SlotNum = uint8(decoder.ReadByte()) |
| 1706 | return _bsnpdurxtimeout, nil |
| 1707 | } |
| 1708 | |
| 1709 | func NewBsnPduRxTimeout() *BsnPduRxTimeout { |
| 1710 | obj := &BsnPduRxTimeout{ |
| 1711 | BsnHeader: NewBsnHeader(35), |
| 1712 | } |
| 1713 | return obj |
| 1714 | } |
| 1715 | |
| 1716 | type BsnPduTxReply struct { |
| 1717 | *BsnHeader |
| 1718 | Status uint32 |
| 1719 | PortNo Port |
| 1720 | SlotNum uint8 |
| 1721 | } |
| 1722 | |
| 1723 | type IBsnPduTxReply interface { |
| 1724 | IBsnHeader |
| 1725 | GetStatus() uint32 |
| 1726 | GetPortNo() Port |
| 1727 | GetSlotNum() uint8 |
| 1728 | } |
| 1729 | |
| 1730 | func (self *BsnPduTxReply) GetStatus() uint32 { |
| 1731 | return self.Status |
| 1732 | } |
| 1733 | |
| 1734 | func (self *BsnPduTxReply) SetStatus(v uint32) { |
| 1735 | self.Status = v |
| 1736 | } |
| 1737 | |
| 1738 | func (self *BsnPduTxReply) GetPortNo() Port { |
| 1739 | return self.PortNo |
| 1740 | } |
| 1741 | |
| 1742 | func (self *BsnPduTxReply) SetPortNo(v Port) { |
| 1743 | self.PortNo = v |
| 1744 | } |
| 1745 | |
| 1746 | func (self *BsnPduTxReply) GetSlotNum() uint8 { |
| 1747 | return self.SlotNum |
| 1748 | } |
| 1749 | |
| 1750 | func (self *BsnPduTxReply) SetSlotNum(v uint8) { |
| 1751 | self.SlotNum = v |
| 1752 | } |
| 1753 | |
| 1754 | func (self *BsnPduTxReply) Serialize(encoder *goloxi.Encoder) error { |
| 1755 | startIndex := len(encoder.Bytes()) |
| 1756 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1757 | return err |
| 1758 | } |
| 1759 | |
| 1760 | encoder.PutUint32(uint32(self.Status)) |
| 1761 | self.PortNo.Serialize(encoder) |
| 1762 | encoder.PutUint8(uint8(self.SlotNum)) |
| 1763 | length := len(encoder.Bytes()) - startIndex |
| 1764 | |
| 1765 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1766 | |
| 1767 | return nil |
| 1768 | } |
| 1769 | |
| 1770 | func DecodeBsnPduTxReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduTxReply, error) { |
| 1771 | _bsnpdutxreply := &BsnPduTxReply{BsnHeader: parent} |
| 1772 | if decoder.Length() < 9 { |
| 1773 | return nil, fmt.Errorf("BsnPduTxReply packet too short: %d < 9", decoder.Length()) |
| 1774 | } |
| 1775 | _bsnpdutxreply.Status = uint32(decoder.ReadUint32()) |
| 1776 | _bsnpdutxreply.PortNo.Decode(decoder) |
| 1777 | _bsnpdutxreply.SlotNum = uint8(decoder.ReadByte()) |
| 1778 | return _bsnpdutxreply, nil |
| 1779 | } |
| 1780 | |
| 1781 | func NewBsnPduTxReply() *BsnPduTxReply { |
| 1782 | obj := &BsnPduTxReply{ |
| 1783 | BsnHeader: NewBsnHeader(32), |
| 1784 | } |
| 1785 | return obj |
| 1786 | } |
| 1787 | |
| 1788 | type BsnPduTxRequest struct { |
| 1789 | *BsnHeader |
| 1790 | TxIntervalMs uint32 |
| 1791 | PortNo Port |
| 1792 | SlotNum uint8 |
| 1793 | Data []byte |
| 1794 | } |
| 1795 | |
| 1796 | type IBsnPduTxRequest interface { |
| 1797 | IBsnHeader |
| 1798 | GetTxIntervalMs() uint32 |
| 1799 | GetPortNo() Port |
| 1800 | GetSlotNum() uint8 |
| 1801 | GetData() []byte |
| 1802 | } |
| 1803 | |
| 1804 | func (self *BsnPduTxRequest) GetTxIntervalMs() uint32 { |
| 1805 | return self.TxIntervalMs |
| 1806 | } |
| 1807 | |
| 1808 | func (self *BsnPduTxRequest) SetTxIntervalMs(v uint32) { |
| 1809 | self.TxIntervalMs = v |
| 1810 | } |
| 1811 | |
| 1812 | func (self *BsnPduTxRequest) GetPortNo() Port { |
| 1813 | return self.PortNo |
| 1814 | } |
| 1815 | |
| 1816 | func (self *BsnPduTxRequest) SetPortNo(v Port) { |
| 1817 | self.PortNo = v |
| 1818 | } |
| 1819 | |
| 1820 | func (self *BsnPduTxRequest) GetSlotNum() uint8 { |
| 1821 | return self.SlotNum |
| 1822 | } |
| 1823 | |
| 1824 | func (self *BsnPduTxRequest) SetSlotNum(v uint8) { |
| 1825 | self.SlotNum = v |
| 1826 | } |
| 1827 | |
| 1828 | func (self *BsnPduTxRequest) GetData() []byte { |
| 1829 | return self.Data |
| 1830 | } |
| 1831 | |
| 1832 | func (self *BsnPduTxRequest) SetData(v []byte) { |
| 1833 | self.Data = v |
| 1834 | } |
| 1835 | |
| 1836 | func (self *BsnPduTxRequest) Serialize(encoder *goloxi.Encoder) error { |
| 1837 | startIndex := len(encoder.Bytes()) |
| 1838 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1839 | return err |
| 1840 | } |
| 1841 | |
| 1842 | encoder.PutUint32(uint32(self.TxIntervalMs)) |
| 1843 | self.PortNo.Serialize(encoder) |
| 1844 | encoder.PutUint8(uint8(self.SlotNum)) |
| 1845 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 1846 | encoder.Write(self.Data) |
| 1847 | length := len(encoder.Bytes()) - startIndex |
| 1848 | |
| 1849 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1850 | |
| 1851 | return nil |
| 1852 | } |
| 1853 | |
| 1854 | func DecodeBsnPduTxRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnPduTxRequest, error) { |
| 1855 | _bsnpdutxrequest := &BsnPduTxRequest{BsnHeader: parent} |
| 1856 | if decoder.Length() < 12 { |
| 1857 | return nil, fmt.Errorf("BsnPduTxRequest packet too short: %d < 12", decoder.Length()) |
| 1858 | } |
| 1859 | _bsnpdutxrequest.TxIntervalMs = uint32(decoder.ReadUint32()) |
| 1860 | _bsnpdutxrequest.PortNo.Decode(decoder) |
| 1861 | _bsnpdutxrequest.SlotNum = uint8(decoder.ReadByte()) |
| 1862 | decoder.Skip(3) |
| 1863 | _bsnpdutxrequest.Data = decoder.Read(int(decoder.Length())) |
| 1864 | return _bsnpdutxrequest, nil |
| 1865 | } |
| 1866 | |
| 1867 | func NewBsnPduTxRequest() *BsnPduTxRequest { |
| 1868 | obj := &BsnPduTxRequest{ |
| 1869 | BsnHeader: NewBsnHeader(31), |
| 1870 | } |
| 1871 | return obj |
| 1872 | } |
| 1873 | |
| 1874 | type BsnSetMirroring struct { |
| 1875 | *BsnHeader |
| 1876 | ReportMirrorPorts uint8 |
| 1877 | } |
| 1878 | |
| 1879 | type IBsnSetMirroring interface { |
| 1880 | IBsnHeader |
| 1881 | GetReportMirrorPorts() uint8 |
| 1882 | } |
| 1883 | |
| 1884 | func (self *BsnSetMirroring) GetReportMirrorPorts() uint8 { |
| 1885 | return self.ReportMirrorPorts |
| 1886 | } |
| 1887 | |
| 1888 | func (self *BsnSetMirroring) SetReportMirrorPorts(v uint8) { |
| 1889 | self.ReportMirrorPorts = v |
| 1890 | } |
| 1891 | |
| 1892 | func (self *BsnSetMirroring) Serialize(encoder *goloxi.Encoder) error { |
| 1893 | startIndex := len(encoder.Bytes()) |
| 1894 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1895 | return err |
| 1896 | } |
| 1897 | |
| 1898 | encoder.PutUint8(uint8(self.ReportMirrorPorts)) |
| 1899 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 1900 | length := len(encoder.Bytes()) - startIndex |
| 1901 | |
| 1902 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1903 | |
| 1904 | return nil |
| 1905 | } |
| 1906 | |
| 1907 | func DecodeBsnSetMirroring(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetMirroring, error) { |
| 1908 | _bsnsetmirroring := &BsnSetMirroring{BsnHeader: parent} |
| 1909 | if decoder.Length() < 4 { |
| 1910 | return nil, fmt.Errorf("BsnSetMirroring packet too short: %d < 4", decoder.Length()) |
| 1911 | } |
| 1912 | _bsnsetmirroring.ReportMirrorPorts = uint8(decoder.ReadByte()) |
| 1913 | decoder.Skip(3) |
| 1914 | return _bsnsetmirroring, nil |
| 1915 | } |
| 1916 | |
| 1917 | func NewBsnSetMirroring() *BsnSetMirroring { |
| 1918 | obj := &BsnSetMirroring{ |
| 1919 | BsnHeader: NewBsnHeader(3), |
| 1920 | } |
| 1921 | return obj |
| 1922 | } |
| 1923 | |
| 1924 | type BsnSetPktinSuppressionReply struct { |
| 1925 | *BsnHeader |
| 1926 | Status uint32 |
| 1927 | } |
| 1928 | |
| 1929 | type IBsnSetPktinSuppressionReply interface { |
| 1930 | IBsnHeader |
| 1931 | GetStatus() uint32 |
| 1932 | } |
| 1933 | |
| 1934 | func (self *BsnSetPktinSuppressionReply) GetStatus() uint32 { |
| 1935 | return self.Status |
| 1936 | } |
| 1937 | |
| 1938 | func (self *BsnSetPktinSuppressionReply) SetStatus(v uint32) { |
| 1939 | self.Status = v |
| 1940 | } |
| 1941 | |
| 1942 | func (self *BsnSetPktinSuppressionReply) Serialize(encoder *goloxi.Encoder) error { |
| 1943 | startIndex := len(encoder.Bytes()) |
| 1944 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 1945 | return err |
| 1946 | } |
| 1947 | |
| 1948 | encoder.PutUint32(uint32(self.Status)) |
| 1949 | length := len(encoder.Bytes()) - startIndex |
| 1950 | |
| 1951 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1952 | |
| 1953 | return nil |
| 1954 | } |
| 1955 | |
| 1956 | func DecodeBsnSetPktinSuppressionReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetPktinSuppressionReply, error) { |
| 1957 | _bsnsetpktinsuppressionreply := &BsnSetPktinSuppressionReply{BsnHeader: parent} |
| 1958 | if decoder.Length() < 4 { |
| 1959 | return nil, fmt.Errorf("BsnSetPktinSuppressionReply packet too short: %d < 4", decoder.Length()) |
| 1960 | } |
| 1961 | _bsnsetpktinsuppressionreply.Status = uint32(decoder.ReadUint32()) |
| 1962 | return _bsnsetpktinsuppressionreply, nil |
| 1963 | } |
| 1964 | |
| 1965 | func NewBsnSetPktinSuppressionReply() *BsnSetPktinSuppressionReply { |
| 1966 | obj := &BsnSetPktinSuppressionReply{ |
| 1967 | BsnHeader: NewBsnHeader(25), |
| 1968 | } |
| 1969 | return obj |
| 1970 | } |
| 1971 | |
| 1972 | type BsnSetPktinSuppressionRequest struct { |
| 1973 | *BsnHeader |
| 1974 | Enabled uint8 |
| 1975 | IdleTimeout uint16 |
| 1976 | HardTimeout uint16 |
| 1977 | Priority uint16 |
| 1978 | Cookie uint64 |
| 1979 | } |
| 1980 | |
| 1981 | type IBsnSetPktinSuppressionRequest interface { |
| 1982 | IBsnHeader |
| 1983 | GetEnabled() uint8 |
| 1984 | GetIdleTimeout() uint16 |
| 1985 | GetHardTimeout() uint16 |
| 1986 | GetPriority() uint16 |
| 1987 | GetCookie() uint64 |
| 1988 | } |
| 1989 | |
| 1990 | func (self *BsnSetPktinSuppressionRequest) GetEnabled() uint8 { |
| 1991 | return self.Enabled |
| 1992 | } |
| 1993 | |
| 1994 | func (self *BsnSetPktinSuppressionRequest) SetEnabled(v uint8) { |
| 1995 | self.Enabled = v |
| 1996 | } |
| 1997 | |
| 1998 | func (self *BsnSetPktinSuppressionRequest) GetIdleTimeout() uint16 { |
| 1999 | return self.IdleTimeout |
| 2000 | } |
| 2001 | |
| 2002 | func (self *BsnSetPktinSuppressionRequest) SetIdleTimeout(v uint16) { |
| 2003 | self.IdleTimeout = v |
| 2004 | } |
| 2005 | |
| 2006 | func (self *BsnSetPktinSuppressionRequest) GetHardTimeout() uint16 { |
| 2007 | return self.HardTimeout |
| 2008 | } |
| 2009 | |
| 2010 | func (self *BsnSetPktinSuppressionRequest) SetHardTimeout(v uint16) { |
| 2011 | self.HardTimeout = v |
| 2012 | } |
| 2013 | |
| 2014 | func (self *BsnSetPktinSuppressionRequest) GetPriority() uint16 { |
| 2015 | return self.Priority |
| 2016 | } |
| 2017 | |
| 2018 | func (self *BsnSetPktinSuppressionRequest) SetPriority(v uint16) { |
| 2019 | self.Priority = v |
| 2020 | } |
| 2021 | |
| 2022 | func (self *BsnSetPktinSuppressionRequest) GetCookie() uint64 { |
| 2023 | return self.Cookie |
| 2024 | } |
| 2025 | |
| 2026 | func (self *BsnSetPktinSuppressionRequest) SetCookie(v uint64) { |
| 2027 | self.Cookie = v |
| 2028 | } |
| 2029 | |
| 2030 | func (self *BsnSetPktinSuppressionRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2031 | startIndex := len(encoder.Bytes()) |
| 2032 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2033 | return err |
| 2034 | } |
| 2035 | |
| 2036 | encoder.PutUint8(uint8(self.Enabled)) |
| 2037 | encoder.Write(bytes.Repeat([]byte{0}, 1)) |
| 2038 | encoder.PutUint16(uint16(self.IdleTimeout)) |
| 2039 | encoder.PutUint16(uint16(self.HardTimeout)) |
| 2040 | encoder.PutUint16(uint16(self.Priority)) |
| 2041 | encoder.PutUint64(uint64(self.Cookie)) |
| 2042 | length := len(encoder.Bytes()) - startIndex |
| 2043 | |
| 2044 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2045 | |
| 2046 | return nil |
| 2047 | } |
| 2048 | |
| 2049 | func DecodeBsnSetPktinSuppressionRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnSetPktinSuppressionRequest, error) { |
| 2050 | _bsnsetpktinsuppressionrequest := &BsnSetPktinSuppressionRequest{BsnHeader: parent} |
| 2051 | if decoder.Length() < 16 { |
| 2052 | return nil, fmt.Errorf("BsnSetPktinSuppressionRequest packet too short: %d < 16", decoder.Length()) |
| 2053 | } |
| 2054 | _bsnsetpktinsuppressionrequest.Enabled = uint8(decoder.ReadByte()) |
| 2055 | decoder.Skip(1) |
| 2056 | _bsnsetpktinsuppressionrequest.IdleTimeout = uint16(decoder.ReadUint16()) |
| 2057 | _bsnsetpktinsuppressionrequest.HardTimeout = uint16(decoder.ReadUint16()) |
| 2058 | _bsnsetpktinsuppressionrequest.Priority = uint16(decoder.ReadUint16()) |
| 2059 | _bsnsetpktinsuppressionrequest.Cookie = uint64(decoder.ReadUint64()) |
| 2060 | return _bsnsetpktinsuppressionrequest, nil |
| 2061 | } |
| 2062 | |
| 2063 | func NewBsnSetPktinSuppressionRequest() *BsnSetPktinSuppressionRequest { |
| 2064 | obj := &BsnSetPktinSuppressionRequest{ |
| 2065 | BsnHeader: NewBsnHeader(11), |
| 2066 | } |
| 2067 | return obj |
| 2068 | } |
| 2069 | |
| 2070 | type ExperimenterStatsReply struct { |
| 2071 | *StatsReply |
| 2072 | Experimenter uint32 |
| 2073 | } |
| 2074 | |
| 2075 | type IExperimenterStatsReply interface { |
| 2076 | IStatsReply |
| 2077 | GetExperimenter() uint32 |
| 2078 | } |
| 2079 | |
| 2080 | func (self *ExperimenterStatsReply) GetExperimenter() uint32 { |
| 2081 | return self.Experimenter |
| 2082 | } |
| 2083 | |
| 2084 | func (self *ExperimenterStatsReply) SetExperimenter(v uint32) { |
| 2085 | self.Experimenter = v |
| 2086 | } |
| 2087 | |
| 2088 | func (self *ExperimenterStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 2089 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 2090 | return err |
| 2091 | } |
| 2092 | |
| 2093 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 2094 | encoder.PutUint32(uint32(self.Experimenter)) |
| 2095 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 2096 | |
| 2097 | return nil |
| 2098 | } |
| 2099 | |
| 2100 | func DecodeExperimenterStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (IExperimenterStatsReply, error) { |
| 2101 | _experimenterstatsreply := &ExperimenterStatsReply{StatsReply: parent} |
| 2102 | if decoder.Length() < 4 { |
| 2103 | return nil, fmt.Errorf("ExperimenterStatsReply packet too short: %d < 4", decoder.Length()) |
| 2104 | } |
| 2105 | decoder.Skip(4) |
| 2106 | _experimenterstatsreply.Experimenter = uint32(decoder.ReadUint32()) |
| 2107 | decoder.Skip(4) |
| 2108 | |
| 2109 | switch _experimenterstatsreply.Experimenter { |
| 2110 | case 8992: |
| 2111 | return DecodeNiciraStatsReply(_experimenterstatsreply, decoder) |
| 2112 | case 6035143: |
| 2113 | return DecodeBsnStatsReply(_experimenterstatsreply, decoder) |
| 2114 | default: |
| 2115 | return nil, fmt.Errorf("Invalid type '%d' for 'ExperimenterStatsReply'", _experimenterstatsreply.Experimenter) |
| 2116 | } |
| 2117 | } |
| 2118 | |
| 2119 | func NewExperimenterStatsReply(_experimenter uint32) *ExperimenterStatsReply { |
| 2120 | obj := &ExperimenterStatsReply{ |
| 2121 | StatsReply: NewStatsReply(65535), |
| 2122 | } |
| 2123 | obj.Experimenter = _experimenter |
| 2124 | return obj |
| 2125 | } |
| 2126 | |
| 2127 | type BsnStatsReply struct { |
| 2128 | *ExperimenterStatsReply |
| 2129 | Subtype uint32 |
| 2130 | } |
| 2131 | |
| 2132 | type IBsnStatsReply interface { |
| 2133 | IExperimenterStatsReply |
| 2134 | GetSubtype() uint32 |
| 2135 | } |
| 2136 | |
| 2137 | func (self *BsnStatsReply) GetSubtype() uint32 { |
| 2138 | return self.Subtype |
| 2139 | } |
| 2140 | |
| 2141 | func (self *BsnStatsReply) SetSubtype(v uint32) { |
| 2142 | self.Subtype = v |
| 2143 | } |
| 2144 | |
| 2145 | func (self *BsnStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 2146 | if err := self.ExperimenterStatsReply.Serialize(encoder); err != nil { |
| 2147 | return err |
| 2148 | } |
| 2149 | |
| 2150 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 2151 | encoder.PutUint32(uint32(self.Subtype)) |
| 2152 | |
| 2153 | return nil |
| 2154 | } |
| 2155 | |
| 2156 | func DecodeBsnStatsReply(parent *ExperimenterStatsReply, decoder *goloxi.Decoder) (IBsnStatsReply, error) { |
| 2157 | _bsnstatsreply := &BsnStatsReply{ExperimenterStatsReply: parent} |
| 2158 | if decoder.Length() < 12 { |
| 2159 | return nil, fmt.Errorf("BsnStatsReply packet too short: %d < 12", decoder.Length()) |
| 2160 | } |
| 2161 | decoder.Skip(4) |
| 2162 | _bsnstatsreply.Subtype = uint32(decoder.ReadUint32()) |
| 2163 | return _bsnstatsreply, nil |
| 2164 | } |
| 2165 | |
| 2166 | func NewBsnStatsReply(_subtype uint32) *BsnStatsReply { |
| 2167 | obj := &BsnStatsReply{ |
| 2168 | ExperimenterStatsReply: NewExperimenterStatsReply(6035143), |
| 2169 | } |
| 2170 | obj.Subtype = _subtype |
| 2171 | return obj |
| 2172 | } |
| 2173 | |
| 2174 | type ExperimenterStatsRequest struct { |
| 2175 | *StatsRequest |
| 2176 | Experimenter uint32 |
| 2177 | } |
| 2178 | |
| 2179 | type IExperimenterStatsRequest interface { |
| 2180 | IStatsRequest |
| 2181 | GetExperimenter() uint32 |
| 2182 | } |
| 2183 | |
| 2184 | func (self *ExperimenterStatsRequest) GetExperimenter() uint32 { |
| 2185 | return self.Experimenter |
| 2186 | } |
| 2187 | |
| 2188 | func (self *ExperimenterStatsRequest) SetExperimenter(v uint32) { |
| 2189 | self.Experimenter = v |
| 2190 | } |
| 2191 | |
| 2192 | func (self *ExperimenterStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2193 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 2194 | return err |
| 2195 | } |
| 2196 | |
| 2197 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 2198 | encoder.PutUint32(uint32(self.Experimenter)) |
| 2199 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 2200 | |
| 2201 | return nil |
| 2202 | } |
| 2203 | |
| 2204 | func DecodeExperimenterStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (IExperimenterStatsRequest, error) { |
| 2205 | _experimenterstatsrequest := &ExperimenterStatsRequest{StatsRequest: parent} |
| 2206 | if decoder.Length() < 4 { |
| 2207 | return nil, fmt.Errorf("ExperimenterStatsRequest packet too short: %d < 4", decoder.Length()) |
| 2208 | } |
| 2209 | decoder.Skip(4) |
| 2210 | _experimenterstatsrequest.Experimenter = uint32(decoder.ReadUint32()) |
| 2211 | decoder.Skip(4) |
| 2212 | |
| 2213 | switch _experimenterstatsrequest.Experimenter { |
| 2214 | case 8992: |
| 2215 | return DecodeNiciraFlowStatsRequest(_experimenterstatsrequest, decoder) |
| 2216 | case 6035143: |
| 2217 | return DecodeBsnStatsRequest(_experimenterstatsrequest, decoder) |
| 2218 | default: |
| 2219 | return nil, fmt.Errorf("Invalid type '%d' for 'ExperimenterStatsRequest'", _experimenterstatsrequest.Experimenter) |
| 2220 | } |
| 2221 | } |
| 2222 | |
| 2223 | func NewExperimenterStatsRequest(_experimenter uint32) *ExperimenterStatsRequest { |
| 2224 | obj := &ExperimenterStatsRequest{ |
| 2225 | StatsRequest: NewStatsRequest(65535), |
| 2226 | } |
| 2227 | obj.Experimenter = _experimenter |
| 2228 | return obj |
| 2229 | } |
| 2230 | |
| 2231 | type BsnStatsRequest struct { |
| 2232 | *ExperimenterStatsRequest |
| 2233 | Subtype uint32 |
| 2234 | } |
| 2235 | |
| 2236 | type IBsnStatsRequest interface { |
| 2237 | IExperimenterStatsRequest |
| 2238 | GetSubtype() uint32 |
| 2239 | } |
| 2240 | |
| 2241 | func (self *BsnStatsRequest) GetSubtype() uint32 { |
| 2242 | return self.Subtype |
| 2243 | } |
| 2244 | |
| 2245 | func (self *BsnStatsRequest) SetSubtype(v uint32) { |
| 2246 | self.Subtype = v |
| 2247 | } |
| 2248 | |
| 2249 | func (self *BsnStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2250 | if err := self.ExperimenterStatsRequest.Serialize(encoder); err != nil { |
| 2251 | return err |
| 2252 | } |
| 2253 | |
| 2254 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 2255 | encoder.PutUint32(uint32(self.Subtype)) |
| 2256 | |
| 2257 | return nil |
| 2258 | } |
| 2259 | |
| 2260 | func DecodeBsnStatsRequest(parent *ExperimenterStatsRequest, decoder *goloxi.Decoder) (IBsnStatsRequest, error) { |
| 2261 | _bsnstatsrequest := &BsnStatsRequest{ExperimenterStatsRequest: parent} |
| 2262 | if decoder.Length() < 12 { |
| 2263 | return nil, fmt.Errorf("BsnStatsRequest packet too short: %d < 12", decoder.Length()) |
| 2264 | } |
| 2265 | decoder.Skip(4) |
| 2266 | _bsnstatsrequest.Subtype = uint32(decoder.ReadUint32()) |
| 2267 | return _bsnstatsrequest, nil |
| 2268 | } |
| 2269 | |
| 2270 | func NewBsnStatsRequest(_subtype uint32) *BsnStatsRequest { |
| 2271 | obj := &BsnStatsRequest{ |
| 2272 | ExperimenterStatsRequest: NewExperimenterStatsRequest(6035143), |
| 2273 | } |
| 2274 | obj.Subtype = _subtype |
| 2275 | return obj |
| 2276 | } |
| 2277 | |
| 2278 | type BsnVirtualPortCreateReply struct { |
| 2279 | *BsnHeader |
| 2280 | Status uint32 |
| 2281 | VportNo uint32 |
| 2282 | } |
| 2283 | |
| 2284 | type IBsnVirtualPortCreateReply interface { |
| 2285 | IBsnHeader |
| 2286 | GetStatus() uint32 |
| 2287 | GetVportNo() uint32 |
| 2288 | } |
| 2289 | |
| 2290 | func (self *BsnVirtualPortCreateReply) GetStatus() uint32 { |
| 2291 | return self.Status |
| 2292 | } |
| 2293 | |
| 2294 | func (self *BsnVirtualPortCreateReply) SetStatus(v uint32) { |
| 2295 | self.Status = v |
| 2296 | } |
| 2297 | |
| 2298 | func (self *BsnVirtualPortCreateReply) GetVportNo() uint32 { |
| 2299 | return self.VportNo |
| 2300 | } |
| 2301 | |
| 2302 | func (self *BsnVirtualPortCreateReply) SetVportNo(v uint32) { |
| 2303 | self.VportNo = v |
| 2304 | } |
| 2305 | |
| 2306 | func (self *BsnVirtualPortCreateReply) Serialize(encoder *goloxi.Encoder) error { |
| 2307 | startIndex := len(encoder.Bytes()) |
| 2308 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2309 | return err |
| 2310 | } |
| 2311 | |
| 2312 | encoder.PutUint32(uint32(self.Status)) |
| 2313 | encoder.PutUint32(uint32(self.VportNo)) |
| 2314 | length := len(encoder.Bytes()) - startIndex |
| 2315 | |
| 2316 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2317 | |
| 2318 | return nil |
| 2319 | } |
| 2320 | |
| 2321 | func DecodeBsnVirtualPortCreateReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnVirtualPortCreateReply, error) { |
| 2322 | _bsnvirtualportcreatereply := &BsnVirtualPortCreateReply{BsnHeader: parent} |
| 2323 | if decoder.Length() < 8 { |
| 2324 | return nil, fmt.Errorf("BsnVirtualPortCreateReply packet too short: %d < 8", decoder.Length()) |
| 2325 | } |
| 2326 | _bsnvirtualportcreatereply.Status = uint32(decoder.ReadUint32()) |
| 2327 | _bsnvirtualportcreatereply.VportNo = uint32(decoder.ReadUint32()) |
| 2328 | return _bsnvirtualportcreatereply, nil |
| 2329 | } |
| 2330 | |
| 2331 | func NewBsnVirtualPortCreateReply() *BsnVirtualPortCreateReply { |
| 2332 | obj := &BsnVirtualPortCreateReply{ |
| 2333 | BsnHeader: NewBsnHeader(16), |
| 2334 | } |
| 2335 | return obj |
| 2336 | } |
| 2337 | |
| 2338 | type BsnVirtualPortCreateRequest struct { |
| 2339 | *BsnHeader |
| 2340 | Vport BSNVport |
| 2341 | } |
| 2342 | |
| 2343 | type IBsnVirtualPortCreateRequest interface { |
| 2344 | IBsnHeader |
| 2345 | GetVport() BSNVport |
| 2346 | } |
| 2347 | |
| 2348 | func (self *BsnVirtualPortCreateRequest) GetVport() BSNVport { |
| 2349 | return self.Vport |
| 2350 | } |
| 2351 | |
| 2352 | func (self *BsnVirtualPortCreateRequest) SetVport(v BSNVport) { |
| 2353 | self.Vport = v |
| 2354 | } |
| 2355 | |
| 2356 | func (self *BsnVirtualPortCreateRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2357 | startIndex := len(encoder.Bytes()) |
| 2358 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2359 | return err |
| 2360 | } |
| 2361 | |
| 2362 | if err := self.Vport.Serialize(encoder); err != nil { |
| 2363 | return err |
| 2364 | } |
| 2365 | |
| 2366 | length := len(encoder.Bytes()) - startIndex |
| 2367 | |
| 2368 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2369 | |
| 2370 | return nil |
| 2371 | } |
| 2372 | |
| 2373 | func DecodeBsnVirtualPortCreateRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnVirtualPortCreateRequest, error) { |
| 2374 | _bsnvirtualportcreaterequest := &BsnVirtualPortCreateRequest{BsnHeader: parent} |
| 2375 | if decoder.Length() < 4 { |
| 2376 | return nil, fmt.Errorf("BsnVirtualPortCreateRequest packet too short: %d < 4", decoder.Length()) |
| 2377 | } |
| 2378 | if err := _bsnvirtualportcreaterequest.Vport.Decode(decoder); err != nil { |
| 2379 | return nil, err |
| 2380 | } |
| 2381 | |
| 2382 | return _bsnvirtualportcreaterequest, nil |
| 2383 | } |
| 2384 | |
| 2385 | func NewBsnVirtualPortCreateRequest() *BsnVirtualPortCreateRequest { |
| 2386 | obj := &BsnVirtualPortCreateRequest{ |
| 2387 | BsnHeader: NewBsnHeader(15), |
| 2388 | } |
| 2389 | return obj |
| 2390 | } |
| 2391 | |
| 2392 | type BsnVirtualPortRemoveReply struct { |
| 2393 | *BsnHeader |
| 2394 | Status uint32 |
| 2395 | } |
| 2396 | |
| 2397 | type IBsnVirtualPortRemoveReply interface { |
| 2398 | IBsnHeader |
| 2399 | GetStatus() uint32 |
| 2400 | } |
| 2401 | |
| 2402 | func (self *BsnVirtualPortRemoveReply) GetStatus() uint32 { |
| 2403 | return self.Status |
| 2404 | } |
| 2405 | |
| 2406 | func (self *BsnVirtualPortRemoveReply) SetStatus(v uint32) { |
| 2407 | self.Status = v |
| 2408 | } |
| 2409 | |
| 2410 | func (self *BsnVirtualPortRemoveReply) Serialize(encoder *goloxi.Encoder) error { |
| 2411 | startIndex := len(encoder.Bytes()) |
| 2412 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2413 | return err |
| 2414 | } |
| 2415 | |
| 2416 | encoder.PutUint32(uint32(self.Status)) |
| 2417 | length := len(encoder.Bytes()) - startIndex |
| 2418 | |
| 2419 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2420 | |
| 2421 | return nil |
| 2422 | } |
| 2423 | |
| 2424 | func DecodeBsnVirtualPortRemoveReply(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnVirtualPortRemoveReply, error) { |
| 2425 | _bsnvirtualportremovereply := &BsnVirtualPortRemoveReply{BsnHeader: parent} |
| 2426 | if decoder.Length() < 4 { |
| 2427 | return nil, fmt.Errorf("BsnVirtualPortRemoveReply packet too short: %d < 4", decoder.Length()) |
| 2428 | } |
| 2429 | _bsnvirtualportremovereply.Status = uint32(decoder.ReadUint32()) |
| 2430 | return _bsnvirtualportremovereply, nil |
| 2431 | } |
| 2432 | |
| 2433 | func NewBsnVirtualPortRemoveReply() *BsnVirtualPortRemoveReply { |
| 2434 | obj := &BsnVirtualPortRemoveReply{ |
| 2435 | BsnHeader: NewBsnHeader(26), |
| 2436 | } |
| 2437 | return obj |
| 2438 | } |
| 2439 | |
| 2440 | type BsnVirtualPortRemoveRequest struct { |
| 2441 | *BsnHeader |
| 2442 | VportNo uint32 |
| 2443 | } |
| 2444 | |
| 2445 | type IBsnVirtualPortRemoveRequest interface { |
| 2446 | IBsnHeader |
| 2447 | GetVportNo() uint32 |
| 2448 | } |
| 2449 | |
| 2450 | func (self *BsnVirtualPortRemoveRequest) GetVportNo() uint32 { |
| 2451 | return self.VportNo |
| 2452 | } |
| 2453 | |
| 2454 | func (self *BsnVirtualPortRemoveRequest) SetVportNo(v uint32) { |
| 2455 | self.VportNo = v |
| 2456 | } |
| 2457 | |
| 2458 | func (self *BsnVirtualPortRemoveRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2459 | startIndex := len(encoder.Bytes()) |
| 2460 | if err := self.BsnHeader.Serialize(encoder); err != nil { |
| 2461 | return err |
| 2462 | } |
| 2463 | |
| 2464 | encoder.PutUint32(uint32(self.VportNo)) |
| 2465 | length := len(encoder.Bytes()) - startIndex |
| 2466 | |
| 2467 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2468 | |
| 2469 | return nil |
| 2470 | } |
| 2471 | |
| 2472 | func DecodeBsnVirtualPortRemoveRequest(parent *BsnHeader, decoder *goloxi.Decoder) (*BsnVirtualPortRemoveRequest, error) { |
| 2473 | _bsnvirtualportremoverequest := &BsnVirtualPortRemoveRequest{BsnHeader: parent} |
| 2474 | if decoder.Length() < 4 { |
| 2475 | return nil, fmt.Errorf("BsnVirtualPortRemoveRequest packet too short: %d < 4", decoder.Length()) |
| 2476 | } |
| 2477 | _bsnvirtualportremoverequest.VportNo = uint32(decoder.ReadUint32()) |
| 2478 | return _bsnvirtualportremoverequest, nil |
| 2479 | } |
| 2480 | |
| 2481 | func NewBsnVirtualPortRemoveRequest() *BsnVirtualPortRemoveRequest { |
| 2482 | obj := &BsnVirtualPortRemoveRequest{ |
| 2483 | BsnHeader: NewBsnHeader(17), |
| 2484 | } |
| 2485 | return obj |
| 2486 | } |
| 2487 | |
| 2488 | type DescStatsReply struct { |
| 2489 | *StatsReply |
| 2490 | MfrDesc string |
| 2491 | HwDesc string |
| 2492 | SwDesc string |
| 2493 | SerialNum string |
| 2494 | DpDesc string |
| 2495 | } |
| 2496 | |
| 2497 | type IDescStatsReply interface { |
| 2498 | IStatsReply |
| 2499 | GetMfrDesc() string |
| 2500 | GetHwDesc() string |
| 2501 | GetSwDesc() string |
| 2502 | GetSerialNum() string |
| 2503 | GetDpDesc() string |
| 2504 | } |
| 2505 | |
| 2506 | func (self *DescStatsReply) GetMfrDesc() string { |
| 2507 | return self.MfrDesc |
| 2508 | } |
| 2509 | |
| 2510 | func (self *DescStatsReply) SetMfrDesc(v string) { |
| 2511 | self.MfrDesc = v |
| 2512 | } |
| 2513 | |
| 2514 | func (self *DescStatsReply) GetHwDesc() string { |
| 2515 | return self.HwDesc |
| 2516 | } |
| 2517 | |
| 2518 | func (self *DescStatsReply) SetHwDesc(v string) { |
| 2519 | self.HwDesc = v |
| 2520 | } |
| 2521 | |
| 2522 | func (self *DescStatsReply) GetSwDesc() string { |
| 2523 | return self.SwDesc |
| 2524 | } |
| 2525 | |
| 2526 | func (self *DescStatsReply) SetSwDesc(v string) { |
| 2527 | self.SwDesc = v |
| 2528 | } |
| 2529 | |
| 2530 | func (self *DescStatsReply) GetSerialNum() string { |
| 2531 | return self.SerialNum |
| 2532 | } |
| 2533 | |
| 2534 | func (self *DescStatsReply) SetSerialNum(v string) { |
| 2535 | self.SerialNum = v |
| 2536 | } |
| 2537 | |
| 2538 | func (self *DescStatsReply) GetDpDesc() string { |
| 2539 | return self.DpDesc |
| 2540 | } |
| 2541 | |
| 2542 | func (self *DescStatsReply) SetDpDesc(v string) { |
| 2543 | self.DpDesc = v |
| 2544 | } |
| 2545 | |
| 2546 | func (self *DescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 2547 | startIndex := len(encoder.Bytes()) |
| 2548 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 2549 | return err |
| 2550 | } |
| 2551 | |
| 2552 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 2553 | encoder.Write([]byte(self.MfrDesc)) |
| 2554 | encoder.Write([]byte(self.HwDesc)) |
| 2555 | encoder.Write([]byte(self.SwDesc)) |
| 2556 | encoder.Write([]byte(self.SerialNum)) |
| 2557 | encoder.Write([]byte(self.DpDesc)) |
| 2558 | length := len(encoder.Bytes()) - startIndex |
| 2559 | |
| 2560 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2561 | |
| 2562 | return nil |
| 2563 | } |
| 2564 | |
| 2565 | func DecodeDescStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*DescStatsReply, error) { |
| 2566 | _descstatsreply := &DescStatsReply{StatsReply: parent} |
| 2567 | if decoder.Length() < 1060 { |
| 2568 | return nil, fmt.Errorf("DescStatsReply packet too short: %d < 1060", decoder.Length()) |
| 2569 | } |
| 2570 | decoder.Skip(4) |
| 2571 | _descstatsreply.MfrDesc = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 2572 | _descstatsreply.HwDesc = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 2573 | _descstatsreply.SwDesc = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 2574 | _descstatsreply.SerialNum = string(bytes.Trim(decoder.Read(32), "\x00")) |
| 2575 | _descstatsreply.DpDesc = string(bytes.Trim(decoder.Read(256), "\x00")) |
| 2576 | return _descstatsreply, nil |
| 2577 | } |
| 2578 | |
| 2579 | func NewDescStatsReply() *DescStatsReply { |
| 2580 | obj := &DescStatsReply{ |
| 2581 | StatsReply: NewStatsReply(0), |
| 2582 | } |
| 2583 | return obj |
| 2584 | } |
| 2585 | |
| 2586 | type DescStatsRequest struct { |
| 2587 | *StatsRequest |
| 2588 | } |
| 2589 | |
| 2590 | type IDescStatsRequest interface { |
| 2591 | IStatsRequest |
| 2592 | } |
| 2593 | |
| 2594 | func (self *DescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2595 | startIndex := len(encoder.Bytes()) |
| 2596 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 2597 | return err |
| 2598 | } |
| 2599 | |
| 2600 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 2601 | length := len(encoder.Bytes()) - startIndex |
| 2602 | |
| 2603 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2604 | |
| 2605 | return nil |
| 2606 | } |
| 2607 | |
| 2608 | func DecodeDescStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*DescStatsRequest, error) { |
| 2609 | _descstatsrequest := &DescStatsRequest{StatsRequest: parent} |
| 2610 | if decoder.Length() < 4 { |
| 2611 | return nil, fmt.Errorf("DescStatsRequest packet too short: %d < 4", decoder.Length()) |
| 2612 | } |
| 2613 | decoder.Skip(4) |
| 2614 | return _descstatsrequest, nil |
| 2615 | } |
| 2616 | |
| 2617 | func NewDescStatsRequest() *DescStatsRequest { |
| 2618 | obj := &DescStatsRequest{ |
| 2619 | StatsRequest: NewStatsRequest(0), |
| 2620 | } |
| 2621 | return obj |
| 2622 | } |
| 2623 | |
| 2624 | type EchoReply struct { |
| 2625 | *Header |
| 2626 | Data []byte |
| 2627 | } |
| 2628 | |
| 2629 | type IEchoReply interface { |
| 2630 | IHeader |
| 2631 | GetData() []byte |
| 2632 | } |
| 2633 | |
| 2634 | func (self *EchoReply) GetData() []byte { |
| 2635 | return self.Data |
| 2636 | } |
| 2637 | |
| 2638 | func (self *EchoReply) SetData(v []byte) { |
| 2639 | self.Data = v |
| 2640 | } |
| 2641 | |
| 2642 | func (self *EchoReply) Serialize(encoder *goloxi.Encoder) error { |
| 2643 | startIndex := len(encoder.Bytes()) |
| 2644 | if err := self.Header.Serialize(encoder); err != nil { |
| 2645 | return err |
| 2646 | } |
| 2647 | |
| 2648 | encoder.Write(self.Data) |
| 2649 | length := len(encoder.Bytes()) - startIndex |
| 2650 | |
| 2651 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2652 | |
| 2653 | return nil |
| 2654 | } |
| 2655 | |
| 2656 | func DecodeEchoReply(parent *Header, decoder *goloxi.Decoder) (*EchoReply, error) { |
| 2657 | _echoreply := &EchoReply{Header: parent} |
| 2658 | _echoreply.Data = decoder.Read(int(decoder.Length())) |
| 2659 | return _echoreply, nil |
| 2660 | } |
| 2661 | |
| 2662 | func NewEchoReply() *EchoReply { |
| 2663 | obj := &EchoReply{ |
| 2664 | Header: NewHeader(3), |
| 2665 | } |
| 2666 | return obj |
| 2667 | } |
| 2668 | |
| 2669 | type EchoRequest struct { |
| 2670 | *Header |
| 2671 | Data []byte |
| 2672 | } |
| 2673 | |
| 2674 | type IEchoRequest interface { |
| 2675 | IHeader |
| 2676 | GetData() []byte |
| 2677 | } |
| 2678 | |
| 2679 | func (self *EchoRequest) GetData() []byte { |
| 2680 | return self.Data |
| 2681 | } |
| 2682 | |
| 2683 | func (self *EchoRequest) SetData(v []byte) { |
| 2684 | self.Data = v |
| 2685 | } |
| 2686 | |
| 2687 | func (self *EchoRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2688 | startIndex := len(encoder.Bytes()) |
| 2689 | if err := self.Header.Serialize(encoder); err != nil { |
| 2690 | return err |
| 2691 | } |
| 2692 | |
| 2693 | encoder.Write(self.Data) |
| 2694 | length := len(encoder.Bytes()) - startIndex |
| 2695 | |
| 2696 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2697 | |
| 2698 | return nil |
| 2699 | } |
| 2700 | |
| 2701 | func DecodeEchoRequest(parent *Header, decoder *goloxi.Decoder) (*EchoRequest, error) { |
| 2702 | _echorequest := &EchoRequest{Header: parent} |
| 2703 | _echorequest.Data = decoder.Read(int(decoder.Length())) |
| 2704 | return _echorequest, nil |
| 2705 | } |
| 2706 | |
| 2707 | func NewEchoRequest() *EchoRequest { |
| 2708 | obj := &EchoRequest{ |
| 2709 | Header: NewHeader(2), |
| 2710 | } |
| 2711 | return obj |
| 2712 | } |
| 2713 | |
| 2714 | type FeaturesReply struct { |
| 2715 | *Header |
| 2716 | DatapathId uint64 |
| 2717 | NBuffers uint32 |
| 2718 | NTables uint8 |
| 2719 | Capabilities Capabilities |
| 2720 | Reserved uint32 |
| 2721 | Ports []*PortDesc |
| 2722 | } |
| 2723 | |
| 2724 | type IFeaturesReply interface { |
| 2725 | IHeader |
| 2726 | GetDatapathId() uint64 |
| 2727 | GetNBuffers() uint32 |
| 2728 | GetNTables() uint8 |
| 2729 | GetCapabilities() Capabilities |
| 2730 | GetReserved() uint32 |
| 2731 | GetPorts() []*PortDesc |
| 2732 | } |
| 2733 | |
| 2734 | func (self *FeaturesReply) GetDatapathId() uint64 { |
| 2735 | return self.DatapathId |
| 2736 | } |
| 2737 | |
| 2738 | func (self *FeaturesReply) SetDatapathId(v uint64) { |
| 2739 | self.DatapathId = v |
| 2740 | } |
| 2741 | |
| 2742 | func (self *FeaturesReply) GetNBuffers() uint32 { |
| 2743 | return self.NBuffers |
| 2744 | } |
| 2745 | |
| 2746 | func (self *FeaturesReply) SetNBuffers(v uint32) { |
| 2747 | self.NBuffers = v |
| 2748 | } |
| 2749 | |
| 2750 | func (self *FeaturesReply) GetNTables() uint8 { |
| 2751 | return self.NTables |
| 2752 | } |
| 2753 | |
| 2754 | func (self *FeaturesReply) SetNTables(v uint8) { |
| 2755 | self.NTables = v |
| 2756 | } |
| 2757 | |
| 2758 | func (self *FeaturesReply) GetCapabilities() Capabilities { |
| 2759 | return self.Capabilities |
| 2760 | } |
| 2761 | |
| 2762 | func (self *FeaturesReply) SetCapabilities(v Capabilities) { |
| 2763 | self.Capabilities = v |
| 2764 | } |
| 2765 | |
| 2766 | func (self *FeaturesReply) GetReserved() uint32 { |
| 2767 | return self.Reserved |
| 2768 | } |
| 2769 | |
| 2770 | func (self *FeaturesReply) SetReserved(v uint32) { |
| 2771 | self.Reserved = v |
| 2772 | } |
| 2773 | |
| 2774 | func (self *FeaturesReply) GetPorts() []*PortDesc { |
| 2775 | return self.Ports |
| 2776 | } |
| 2777 | |
| 2778 | func (self *FeaturesReply) SetPorts(v []*PortDesc) { |
| 2779 | self.Ports = v |
| 2780 | } |
| 2781 | |
| 2782 | func (self *FeaturesReply) Serialize(encoder *goloxi.Encoder) error { |
| 2783 | startIndex := len(encoder.Bytes()) |
| 2784 | if err := self.Header.Serialize(encoder); err != nil { |
| 2785 | return err |
| 2786 | } |
| 2787 | |
| 2788 | encoder.PutUint64(uint64(self.DatapathId)) |
| 2789 | encoder.PutUint32(uint32(self.NBuffers)) |
| 2790 | encoder.PutUint8(uint8(self.NTables)) |
| 2791 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 2792 | encoder.PutUint32(uint32(self.Capabilities)) |
| 2793 | encoder.PutUint32(uint32(self.Reserved)) |
| 2794 | for _, obj := range self.Ports { |
| 2795 | if err := obj.Serialize(encoder); err != nil { |
| 2796 | return err |
| 2797 | } |
| 2798 | } |
| 2799 | length := len(encoder.Bytes()) - startIndex |
| 2800 | |
| 2801 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2802 | |
| 2803 | return nil |
| 2804 | } |
| 2805 | |
| 2806 | func DecodeFeaturesReply(parent *Header, decoder *goloxi.Decoder) (*FeaturesReply, error) { |
| 2807 | _featuresreply := &FeaturesReply{Header: parent} |
| 2808 | if decoder.Length() < 24 { |
| 2809 | return nil, fmt.Errorf("FeaturesReply packet too short: %d < 24", decoder.Length()) |
| 2810 | } |
| 2811 | _featuresreply.DatapathId = uint64(decoder.ReadUint64()) |
| 2812 | _featuresreply.NBuffers = uint32(decoder.ReadUint32()) |
| 2813 | _featuresreply.NTables = uint8(decoder.ReadByte()) |
| 2814 | decoder.Skip(3) |
| 2815 | _featuresreply.Capabilities = Capabilities(decoder.ReadUint32()) |
| 2816 | _featuresreply.Reserved = uint32(decoder.ReadUint32()) |
| 2817 | |
| 2818 | for decoder.Length() >= 64 { |
| 2819 | item := &PortDesc{} |
| 2820 | if err := item.Decode(decoder); err != nil { |
| 2821 | return nil, err |
| 2822 | } |
| 2823 | if item != nil { |
| 2824 | _featuresreply.Ports = append(_featuresreply.Ports, item) |
| 2825 | } |
| 2826 | } |
| 2827 | return _featuresreply, nil |
| 2828 | } |
| 2829 | |
| 2830 | func NewFeaturesReply() *FeaturesReply { |
| 2831 | obj := &FeaturesReply{ |
| 2832 | Header: NewHeader(6), |
| 2833 | } |
| 2834 | return obj |
| 2835 | } |
| 2836 | |
| 2837 | type FeaturesRequest struct { |
| 2838 | *Header |
| 2839 | } |
| 2840 | |
| 2841 | type IFeaturesRequest interface { |
| 2842 | IHeader |
| 2843 | } |
| 2844 | |
| 2845 | func (self *FeaturesRequest) Serialize(encoder *goloxi.Encoder) error { |
| 2846 | startIndex := len(encoder.Bytes()) |
| 2847 | if err := self.Header.Serialize(encoder); err != nil { |
| 2848 | return err |
| 2849 | } |
| 2850 | length := len(encoder.Bytes()) - startIndex |
| 2851 | |
| 2852 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2853 | |
| 2854 | return nil |
| 2855 | } |
| 2856 | |
| 2857 | func DecodeFeaturesRequest(parent *Header, decoder *goloxi.Decoder) (*FeaturesRequest, error) { |
| 2858 | _featuresrequest := &FeaturesRequest{Header: parent} |
| 2859 | return _featuresrequest, nil |
| 2860 | } |
| 2861 | |
| 2862 | func NewFeaturesRequest() *FeaturesRequest { |
| 2863 | obj := &FeaturesRequest{ |
| 2864 | Header: NewHeader(5), |
| 2865 | } |
| 2866 | return obj |
| 2867 | } |
| 2868 | |
| 2869 | type FlowMod struct { |
| 2870 | *Header |
| 2871 | Cookie uint64 |
| 2872 | CookieMask uint64 |
| 2873 | TableId uint8 |
| 2874 | Command FmCmd |
| 2875 | IdleTimeout uint16 |
| 2876 | HardTimeout uint16 |
| 2877 | Priority uint16 |
| 2878 | BufferId uint32 |
| 2879 | OutPort Port |
| 2880 | OutGroup uint32 |
| 2881 | Flags FlowModFlags |
| 2882 | Match Match |
| 2883 | Instructions []IInstruction |
| 2884 | } |
| 2885 | |
| 2886 | type IFlowMod interface { |
| 2887 | IHeader |
| 2888 | GetCookie() uint64 |
| 2889 | GetCookieMask() uint64 |
| 2890 | GetTableId() uint8 |
| 2891 | GetCommand() FmCmd |
| 2892 | GetIdleTimeout() uint16 |
| 2893 | GetHardTimeout() uint16 |
| 2894 | GetPriority() uint16 |
| 2895 | GetBufferId() uint32 |
| 2896 | GetOutPort() Port |
| 2897 | GetOutGroup() uint32 |
| 2898 | GetFlags() FlowModFlags |
| 2899 | GetMatch() Match |
| 2900 | GetInstructions() []IInstruction |
| 2901 | } |
| 2902 | |
| 2903 | func (self *FlowMod) GetCookie() uint64 { |
| 2904 | return self.Cookie |
| 2905 | } |
| 2906 | |
| 2907 | func (self *FlowMod) SetCookie(v uint64) { |
| 2908 | self.Cookie = v |
| 2909 | } |
| 2910 | |
| 2911 | func (self *FlowMod) GetCookieMask() uint64 { |
| 2912 | return self.CookieMask |
| 2913 | } |
| 2914 | |
| 2915 | func (self *FlowMod) SetCookieMask(v uint64) { |
| 2916 | self.CookieMask = v |
| 2917 | } |
| 2918 | |
| 2919 | func (self *FlowMod) GetTableId() uint8 { |
| 2920 | return self.TableId |
| 2921 | } |
| 2922 | |
| 2923 | func (self *FlowMod) SetTableId(v uint8) { |
| 2924 | self.TableId = v |
| 2925 | } |
| 2926 | |
| 2927 | func (self *FlowMod) GetCommand() FmCmd { |
| 2928 | return self.Command |
| 2929 | } |
| 2930 | |
| 2931 | func (self *FlowMod) SetCommand(v FmCmd) { |
| 2932 | self.Command = v |
| 2933 | } |
| 2934 | |
| 2935 | func (self *FlowMod) GetIdleTimeout() uint16 { |
| 2936 | return self.IdleTimeout |
| 2937 | } |
| 2938 | |
| 2939 | func (self *FlowMod) SetIdleTimeout(v uint16) { |
| 2940 | self.IdleTimeout = v |
| 2941 | } |
| 2942 | |
| 2943 | func (self *FlowMod) GetHardTimeout() uint16 { |
| 2944 | return self.HardTimeout |
| 2945 | } |
| 2946 | |
| 2947 | func (self *FlowMod) SetHardTimeout(v uint16) { |
| 2948 | self.HardTimeout = v |
| 2949 | } |
| 2950 | |
| 2951 | func (self *FlowMod) GetPriority() uint16 { |
| 2952 | return self.Priority |
| 2953 | } |
| 2954 | |
| 2955 | func (self *FlowMod) SetPriority(v uint16) { |
| 2956 | self.Priority = v |
| 2957 | } |
| 2958 | |
| 2959 | func (self *FlowMod) GetBufferId() uint32 { |
| 2960 | return self.BufferId |
| 2961 | } |
| 2962 | |
| 2963 | func (self *FlowMod) SetBufferId(v uint32) { |
| 2964 | self.BufferId = v |
| 2965 | } |
| 2966 | |
| 2967 | func (self *FlowMod) GetOutPort() Port { |
| 2968 | return self.OutPort |
| 2969 | } |
| 2970 | |
| 2971 | func (self *FlowMod) SetOutPort(v Port) { |
| 2972 | self.OutPort = v |
| 2973 | } |
| 2974 | |
| 2975 | func (self *FlowMod) GetOutGroup() uint32 { |
| 2976 | return self.OutGroup |
| 2977 | } |
| 2978 | |
| 2979 | func (self *FlowMod) SetOutGroup(v uint32) { |
| 2980 | self.OutGroup = v |
| 2981 | } |
| 2982 | |
| 2983 | func (self *FlowMod) GetFlags() FlowModFlags { |
| 2984 | return self.Flags |
| 2985 | } |
| 2986 | |
| 2987 | func (self *FlowMod) SetFlags(v FlowModFlags) { |
| 2988 | self.Flags = v |
| 2989 | } |
| 2990 | |
| 2991 | func (self *FlowMod) GetMatch() Match { |
| 2992 | return self.Match |
| 2993 | } |
| 2994 | |
| 2995 | func (self *FlowMod) SetMatch(v Match) { |
| 2996 | self.Match = v |
| 2997 | } |
| 2998 | |
| 2999 | func (self *FlowMod) GetInstructions() []IInstruction { |
| 3000 | return self.Instructions |
| 3001 | } |
| 3002 | |
| 3003 | func (self *FlowMod) SetInstructions(v []IInstruction) { |
| 3004 | self.Instructions = v |
| 3005 | } |
| 3006 | |
| 3007 | func (self *FlowMod) Serialize(encoder *goloxi.Encoder) error { |
| 3008 | if err := self.Header.Serialize(encoder); err != nil { |
| 3009 | return err |
| 3010 | } |
| 3011 | |
| 3012 | encoder.PutUint64(uint64(self.Cookie)) |
| 3013 | encoder.PutUint64(uint64(self.CookieMask)) |
| 3014 | encoder.PutUint8(uint8(self.TableId)) |
| 3015 | self.Command.Serialize(encoder) |
| 3016 | encoder.PutUint16(uint16(self.IdleTimeout)) |
| 3017 | encoder.PutUint16(uint16(self.HardTimeout)) |
| 3018 | encoder.PutUint16(uint16(self.Priority)) |
| 3019 | encoder.PutUint32(uint32(self.BufferId)) |
| 3020 | self.OutPort.Serialize(encoder) |
| 3021 | encoder.PutUint32(uint32(self.OutGroup)) |
| 3022 | encoder.PutUint16(uint16(self.Flags)) |
| 3023 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 3024 | if err := self.Match.Serialize(encoder); err != nil { |
| 3025 | return err |
| 3026 | } |
| 3027 | |
| 3028 | for _, obj := range self.Instructions { |
| 3029 | if err := obj.Serialize(encoder); err != nil { |
| 3030 | return err |
| 3031 | } |
| 3032 | } |
| 3033 | |
| 3034 | return nil |
| 3035 | } |
| 3036 | |
| 3037 | func DecodeFlowMod(parent *Header, decoder *goloxi.Decoder) (IFlowMod, error) { |
| 3038 | _flowmod := &FlowMod{Header: parent} |
| 3039 | if decoder.Length() < 128 { |
| 3040 | return nil, fmt.Errorf("FlowMod packet too short: %d < 128", decoder.Length()) |
| 3041 | } |
| 3042 | _flowmod.Cookie = uint64(decoder.ReadUint64()) |
| 3043 | _flowmod.CookieMask = uint64(decoder.ReadUint64()) |
| 3044 | _flowmod.TableId = uint8(decoder.ReadByte()) |
| 3045 | _flowmod.Command.Decode(decoder) |
| 3046 | _flowmod.IdleTimeout = uint16(decoder.ReadUint16()) |
| 3047 | _flowmod.HardTimeout = uint16(decoder.ReadUint16()) |
| 3048 | _flowmod.Priority = uint16(decoder.ReadUint16()) |
| 3049 | _flowmod.BufferId = uint32(decoder.ReadUint32()) |
| 3050 | _flowmod.OutPort.Decode(decoder) |
| 3051 | _flowmod.OutGroup = uint32(decoder.ReadUint32()) |
| 3052 | _flowmod.Flags = FlowModFlags(decoder.ReadUint16()) |
| 3053 | decoder.Skip(2) |
| 3054 | if err := _flowmod.Match.Decode(decoder); err != nil { |
| 3055 | return nil, err |
| 3056 | } |
| 3057 | |
| 3058 | for decoder.Length() >= 8 { |
| 3059 | item, err := DecodeInstruction(decoder) |
| 3060 | if err != nil { |
| 3061 | return nil, err |
| 3062 | } |
| 3063 | if item != nil { |
| 3064 | _flowmod.Instructions = append(_flowmod.Instructions, item) |
| 3065 | } |
| 3066 | } |
| 3067 | |
| 3068 | switch _flowmod.Command { |
| 3069 | case 0: |
| 3070 | return DecodeFlowAdd(_flowmod, decoder) |
| 3071 | case 1: |
| 3072 | return DecodeFlowModify(_flowmod, decoder) |
| 3073 | case 2: |
| 3074 | return DecodeFlowModifyStrict(_flowmod, decoder) |
| 3075 | case 3: |
| 3076 | return DecodeFlowDelete(_flowmod, decoder) |
| 3077 | case 4: |
| 3078 | return DecodeFlowDeleteStrict(_flowmod, decoder) |
| 3079 | default: |
| 3080 | return nil, fmt.Errorf("Invalid type '%d' for 'FlowMod'", _flowmod.Command) |
| 3081 | } |
| 3082 | } |
| 3083 | |
| 3084 | func NewFlowMod(__command FmCmd) *FlowMod { |
| 3085 | obj := &FlowMod{ |
| 3086 | Header: NewHeader(14), |
| 3087 | } |
| 3088 | obj.Command = __command |
| 3089 | return obj |
| 3090 | } |
| 3091 | |
| 3092 | type FlowAdd struct { |
| 3093 | *FlowMod |
| 3094 | } |
| 3095 | |
| 3096 | type IFlowAdd interface { |
| 3097 | IFlowMod |
| 3098 | } |
| 3099 | |
| 3100 | func (self *FlowAdd) Serialize(encoder *goloxi.Encoder) error { |
| 3101 | startIndex := len(encoder.Bytes()) |
| 3102 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 3103 | return err |
| 3104 | } |
| 3105 | length := len(encoder.Bytes()) - startIndex |
| 3106 | |
| 3107 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3108 | |
| 3109 | return nil |
| 3110 | } |
| 3111 | |
| 3112 | func DecodeFlowAdd(parent *FlowMod, decoder *goloxi.Decoder) (*FlowAdd, error) { |
| 3113 | _flowadd := &FlowAdd{FlowMod: parent} |
| 3114 | return _flowadd, nil |
| 3115 | } |
| 3116 | |
| 3117 | func NewFlowAdd() *FlowAdd { |
| 3118 | obj := &FlowAdd{ |
| 3119 | FlowMod: NewFlowMod(0), |
| 3120 | } |
| 3121 | return obj |
| 3122 | } |
| 3123 | |
| 3124 | type FlowDelete struct { |
| 3125 | *FlowMod |
| 3126 | } |
| 3127 | |
| 3128 | type IFlowDelete interface { |
| 3129 | IFlowMod |
| 3130 | } |
| 3131 | |
| 3132 | func (self *FlowDelete) Serialize(encoder *goloxi.Encoder) error { |
| 3133 | startIndex := len(encoder.Bytes()) |
| 3134 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 3135 | return err |
| 3136 | } |
| 3137 | length := len(encoder.Bytes()) - startIndex |
| 3138 | |
| 3139 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3140 | |
| 3141 | return nil |
| 3142 | } |
| 3143 | |
| 3144 | func DecodeFlowDelete(parent *FlowMod, decoder *goloxi.Decoder) (*FlowDelete, error) { |
| 3145 | _flowdelete := &FlowDelete{FlowMod: parent} |
| 3146 | return _flowdelete, nil |
| 3147 | } |
| 3148 | |
| 3149 | func NewFlowDelete() *FlowDelete { |
| 3150 | obj := &FlowDelete{ |
| 3151 | FlowMod: NewFlowMod(3), |
| 3152 | } |
| 3153 | return obj |
| 3154 | } |
| 3155 | |
| 3156 | type FlowDeleteStrict struct { |
| 3157 | *FlowMod |
| 3158 | } |
| 3159 | |
| 3160 | type IFlowDeleteStrict interface { |
| 3161 | IFlowMod |
| 3162 | } |
| 3163 | |
| 3164 | func (self *FlowDeleteStrict) Serialize(encoder *goloxi.Encoder) error { |
| 3165 | startIndex := len(encoder.Bytes()) |
| 3166 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 3167 | return err |
| 3168 | } |
| 3169 | length := len(encoder.Bytes()) - startIndex |
| 3170 | |
| 3171 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3172 | |
| 3173 | return nil |
| 3174 | } |
| 3175 | |
| 3176 | func DecodeFlowDeleteStrict(parent *FlowMod, decoder *goloxi.Decoder) (*FlowDeleteStrict, error) { |
| 3177 | _flowdeletestrict := &FlowDeleteStrict{FlowMod: parent} |
| 3178 | return _flowdeletestrict, nil |
| 3179 | } |
| 3180 | |
| 3181 | func NewFlowDeleteStrict() *FlowDeleteStrict { |
| 3182 | obj := &FlowDeleteStrict{ |
| 3183 | FlowMod: NewFlowMod(4), |
| 3184 | } |
| 3185 | return obj |
| 3186 | } |
| 3187 | |
| 3188 | type FlowModFailedErrorMsg struct { |
| 3189 | *ErrorMsg |
| 3190 | Code FlowModFailedCode |
| 3191 | Data []byte |
| 3192 | } |
| 3193 | |
| 3194 | type IFlowModFailedErrorMsg interface { |
| 3195 | IErrorMsg |
| 3196 | GetCode() FlowModFailedCode |
| 3197 | GetData() []byte |
| 3198 | } |
| 3199 | |
| 3200 | func (self *FlowModFailedErrorMsg) GetCode() FlowModFailedCode { |
| 3201 | return self.Code |
| 3202 | } |
| 3203 | |
| 3204 | func (self *FlowModFailedErrorMsg) SetCode(v FlowModFailedCode) { |
| 3205 | self.Code = v |
| 3206 | } |
| 3207 | |
| 3208 | func (self *FlowModFailedErrorMsg) GetData() []byte { |
| 3209 | return self.Data |
| 3210 | } |
| 3211 | |
| 3212 | func (self *FlowModFailedErrorMsg) SetData(v []byte) { |
| 3213 | self.Data = v |
| 3214 | } |
| 3215 | |
| 3216 | func (self *FlowModFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 3217 | startIndex := len(encoder.Bytes()) |
| 3218 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 3219 | return err |
| 3220 | } |
| 3221 | |
| 3222 | encoder.PutUint16(uint16(self.Code)) |
| 3223 | encoder.Write(self.Data) |
| 3224 | length := len(encoder.Bytes()) - startIndex |
| 3225 | |
| 3226 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3227 | |
| 3228 | return nil |
| 3229 | } |
| 3230 | |
| 3231 | func DecodeFlowModFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*FlowModFailedErrorMsg, error) { |
| 3232 | _flowmodfailederrormsg := &FlowModFailedErrorMsg{ErrorMsg: parent} |
| 3233 | if decoder.Length() < 2 { |
| 3234 | return nil, fmt.Errorf("FlowModFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 3235 | } |
| 3236 | _flowmodfailederrormsg.Code = FlowModFailedCode(decoder.ReadUint16()) |
| 3237 | _flowmodfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 3238 | return _flowmodfailederrormsg, nil |
| 3239 | } |
| 3240 | |
| 3241 | func NewFlowModFailedErrorMsg() *FlowModFailedErrorMsg { |
| 3242 | obj := &FlowModFailedErrorMsg{ |
| 3243 | ErrorMsg: NewErrorMsg(5), |
| 3244 | } |
| 3245 | return obj |
| 3246 | } |
| 3247 | |
| 3248 | type FlowModify struct { |
| 3249 | *FlowMod |
| 3250 | } |
| 3251 | |
| 3252 | type IFlowModify interface { |
| 3253 | IFlowMod |
| 3254 | } |
| 3255 | |
| 3256 | func (self *FlowModify) Serialize(encoder *goloxi.Encoder) error { |
| 3257 | startIndex := len(encoder.Bytes()) |
| 3258 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 3259 | return err |
| 3260 | } |
| 3261 | length := len(encoder.Bytes()) - startIndex |
| 3262 | |
| 3263 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3264 | |
| 3265 | return nil |
| 3266 | } |
| 3267 | |
| 3268 | func DecodeFlowModify(parent *FlowMod, decoder *goloxi.Decoder) (*FlowModify, error) { |
| 3269 | _flowmodify := &FlowModify{FlowMod: parent} |
| 3270 | return _flowmodify, nil |
| 3271 | } |
| 3272 | |
| 3273 | func NewFlowModify() *FlowModify { |
| 3274 | obj := &FlowModify{ |
| 3275 | FlowMod: NewFlowMod(1), |
| 3276 | } |
| 3277 | return obj |
| 3278 | } |
| 3279 | |
| 3280 | type FlowModifyStrict struct { |
| 3281 | *FlowMod |
| 3282 | } |
| 3283 | |
| 3284 | type IFlowModifyStrict interface { |
| 3285 | IFlowMod |
| 3286 | } |
| 3287 | |
| 3288 | func (self *FlowModifyStrict) Serialize(encoder *goloxi.Encoder) error { |
| 3289 | startIndex := len(encoder.Bytes()) |
| 3290 | if err := self.FlowMod.Serialize(encoder); err != nil { |
| 3291 | return err |
| 3292 | } |
| 3293 | length := len(encoder.Bytes()) - startIndex |
| 3294 | |
| 3295 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3296 | |
| 3297 | return nil |
| 3298 | } |
| 3299 | |
| 3300 | func DecodeFlowModifyStrict(parent *FlowMod, decoder *goloxi.Decoder) (*FlowModifyStrict, error) { |
| 3301 | _flowmodifystrict := &FlowModifyStrict{FlowMod: parent} |
| 3302 | return _flowmodifystrict, nil |
| 3303 | } |
| 3304 | |
| 3305 | func NewFlowModifyStrict() *FlowModifyStrict { |
| 3306 | obj := &FlowModifyStrict{ |
| 3307 | FlowMod: NewFlowMod(2), |
| 3308 | } |
| 3309 | return obj |
| 3310 | } |
| 3311 | |
| 3312 | type FlowRemoved struct { |
| 3313 | *Header |
| 3314 | Cookie uint64 |
| 3315 | Priority uint16 |
| 3316 | Reason FlowRemovedReason |
| 3317 | TableId uint8 |
| 3318 | DurationSec uint32 |
| 3319 | DurationNsec uint32 |
| 3320 | IdleTimeout uint16 |
| 3321 | PacketCount uint64 |
| 3322 | ByteCount uint64 |
| 3323 | Match Match |
| 3324 | } |
| 3325 | |
| 3326 | type IFlowRemoved interface { |
| 3327 | IHeader |
| 3328 | GetCookie() uint64 |
| 3329 | GetPriority() uint16 |
| 3330 | GetReason() FlowRemovedReason |
| 3331 | GetTableId() uint8 |
| 3332 | GetDurationSec() uint32 |
| 3333 | GetDurationNsec() uint32 |
| 3334 | GetIdleTimeout() uint16 |
| 3335 | GetPacketCount() uint64 |
| 3336 | GetByteCount() uint64 |
| 3337 | GetMatch() Match |
| 3338 | } |
| 3339 | |
| 3340 | func (self *FlowRemoved) GetCookie() uint64 { |
| 3341 | return self.Cookie |
| 3342 | } |
| 3343 | |
| 3344 | func (self *FlowRemoved) SetCookie(v uint64) { |
| 3345 | self.Cookie = v |
| 3346 | } |
| 3347 | |
| 3348 | func (self *FlowRemoved) GetPriority() uint16 { |
| 3349 | return self.Priority |
| 3350 | } |
| 3351 | |
| 3352 | func (self *FlowRemoved) SetPriority(v uint16) { |
| 3353 | self.Priority = v |
| 3354 | } |
| 3355 | |
| 3356 | func (self *FlowRemoved) GetReason() FlowRemovedReason { |
| 3357 | return self.Reason |
| 3358 | } |
| 3359 | |
| 3360 | func (self *FlowRemoved) SetReason(v FlowRemovedReason) { |
| 3361 | self.Reason = v |
| 3362 | } |
| 3363 | |
| 3364 | func (self *FlowRemoved) GetTableId() uint8 { |
| 3365 | return self.TableId |
| 3366 | } |
| 3367 | |
| 3368 | func (self *FlowRemoved) SetTableId(v uint8) { |
| 3369 | self.TableId = v |
| 3370 | } |
| 3371 | |
| 3372 | func (self *FlowRemoved) GetDurationSec() uint32 { |
| 3373 | return self.DurationSec |
| 3374 | } |
| 3375 | |
| 3376 | func (self *FlowRemoved) SetDurationSec(v uint32) { |
| 3377 | self.DurationSec = v |
| 3378 | } |
| 3379 | |
| 3380 | func (self *FlowRemoved) GetDurationNsec() uint32 { |
| 3381 | return self.DurationNsec |
| 3382 | } |
| 3383 | |
| 3384 | func (self *FlowRemoved) SetDurationNsec(v uint32) { |
| 3385 | self.DurationNsec = v |
| 3386 | } |
| 3387 | |
| 3388 | func (self *FlowRemoved) GetIdleTimeout() uint16 { |
| 3389 | return self.IdleTimeout |
| 3390 | } |
| 3391 | |
| 3392 | func (self *FlowRemoved) SetIdleTimeout(v uint16) { |
| 3393 | self.IdleTimeout = v |
| 3394 | } |
| 3395 | |
| 3396 | func (self *FlowRemoved) GetPacketCount() uint64 { |
| 3397 | return self.PacketCount |
| 3398 | } |
| 3399 | |
| 3400 | func (self *FlowRemoved) SetPacketCount(v uint64) { |
| 3401 | self.PacketCount = v |
| 3402 | } |
| 3403 | |
| 3404 | func (self *FlowRemoved) GetByteCount() uint64 { |
| 3405 | return self.ByteCount |
| 3406 | } |
| 3407 | |
| 3408 | func (self *FlowRemoved) SetByteCount(v uint64) { |
| 3409 | self.ByteCount = v |
| 3410 | } |
| 3411 | |
| 3412 | func (self *FlowRemoved) GetMatch() Match { |
| 3413 | return self.Match |
| 3414 | } |
| 3415 | |
| 3416 | func (self *FlowRemoved) SetMatch(v Match) { |
| 3417 | self.Match = v |
| 3418 | } |
| 3419 | |
| 3420 | func (self *FlowRemoved) Serialize(encoder *goloxi.Encoder) error { |
| 3421 | startIndex := len(encoder.Bytes()) |
| 3422 | if err := self.Header.Serialize(encoder); err != nil { |
| 3423 | return err |
| 3424 | } |
| 3425 | |
| 3426 | encoder.PutUint64(uint64(self.Cookie)) |
| 3427 | encoder.PutUint16(uint16(self.Priority)) |
| 3428 | encoder.PutUint8(uint8(self.Reason)) |
| 3429 | encoder.PutUint8(uint8(self.TableId)) |
| 3430 | encoder.PutUint32(uint32(self.DurationSec)) |
| 3431 | encoder.PutUint32(uint32(self.DurationNsec)) |
| 3432 | encoder.PutUint16(uint16(self.IdleTimeout)) |
| 3433 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 3434 | encoder.PutUint64(uint64(self.PacketCount)) |
| 3435 | encoder.PutUint64(uint64(self.ByteCount)) |
| 3436 | if err := self.Match.Serialize(encoder); err != nil { |
| 3437 | return err |
| 3438 | } |
| 3439 | |
| 3440 | length := len(encoder.Bytes()) - startIndex |
| 3441 | |
| 3442 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3443 | |
| 3444 | return nil |
| 3445 | } |
| 3446 | |
| 3447 | func DecodeFlowRemoved(parent *Header, decoder *goloxi.Decoder) (*FlowRemoved, error) { |
| 3448 | _flowremoved := &FlowRemoved{Header: parent} |
| 3449 | if decoder.Length() < 128 { |
| 3450 | return nil, fmt.Errorf("FlowRemoved packet too short: %d < 128", decoder.Length()) |
| 3451 | } |
| 3452 | _flowremoved.Cookie = uint64(decoder.ReadUint64()) |
| 3453 | _flowremoved.Priority = uint16(decoder.ReadUint16()) |
| 3454 | _flowremoved.Reason = FlowRemovedReason(decoder.ReadByte()) |
| 3455 | _flowremoved.TableId = uint8(decoder.ReadByte()) |
| 3456 | _flowremoved.DurationSec = uint32(decoder.ReadUint32()) |
| 3457 | _flowremoved.DurationNsec = uint32(decoder.ReadUint32()) |
| 3458 | _flowremoved.IdleTimeout = uint16(decoder.ReadUint16()) |
| 3459 | decoder.Skip(2) |
| 3460 | _flowremoved.PacketCount = uint64(decoder.ReadUint64()) |
| 3461 | _flowremoved.ByteCount = uint64(decoder.ReadUint64()) |
| 3462 | if err := _flowremoved.Match.Decode(decoder); err != nil { |
| 3463 | return nil, err |
| 3464 | } |
| 3465 | |
| 3466 | return _flowremoved, nil |
| 3467 | } |
| 3468 | |
| 3469 | func NewFlowRemoved() *FlowRemoved { |
| 3470 | obj := &FlowRemoved{ |
| 3471 | Header: NewHeader(11), |
| 3472 | } |
| 3473 | return obj |
| 3474 | } |
| 3475 | |
| 3476 | type FlowStatsReply struct { |
| 3477 | *StatsReply |
| 3478 | Entries []*FlowStatsEntry |
| 3479 | } |
| 3480 | |
| 3481 | type IFlowStatsReply interface { |
| 3482 | IStatsReply |
| 3483 | GetEntries() []*FlowStatsEntry |
| 3484 | } |
| 3485 | |
| 3486 | func (self *FlowStatsReply) GetEntries() []*FlowStatsEntry { |
| 3487 | return self.Entries |
| 3488 | } |
| 3489 | |
| 3490 | func (self *FlowStatsReply) SetEntries(v []*FlowStatsEntry) { |
| 3491 | self.Entries = v |
| 3492 | } |
| 3493 | |
| 3494 | func (self *FlowStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 3495 | startIndex := len(encoder.Bytes()) |
| 3496 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 3497 | return err |
| 3498 | } |
| 3499 | |
| 3500 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 3501 | for _, obj := range self.Entries { |
| 3502 | if err := obj.Serialize(encoder); err != nil { |
| 3503 | return err |
| 3504 | } |
| 3505 | } |
| 3506 | length := len(encoder.Bytes()) - startIndex |
| 3507 | |
| 3508 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3509 | |
| 3510 | return nil |
| 3511 | } |
| 3512 | |
| 3513 | func DecodeFlowStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*FlowStatsReply, error) { |
| 3514 | _flowstatsreply := &FlowStatsReply{StatsReply: parent} |
| 3515 | if decoder.Length() < 4 { |
| 3516 | return nil, fmt.Errorf("FlowStatsReply packet too short: %d < 4", decoder.Length()) |
| 3517 | } |
| 3518 | decoder.Skip(4) |
| 3519 | |
| 3520 | for decoder.Length() >= 136 { |
| 3521 | item, err := DecodeFlowStatsEntry(decoder) |
| 3522 | if err != nil { |
| 3523 | return nil, err |
| 3524 | } |
| 3525 | if item != nil { |
| 3526 | _flowstatsreply.Entries = append(_flowstatsreply.Entries, item) |
| 3527 | } |
| 3528 | } |
| 3529 | return _flowstatsreply, nil |
| 3530 | } |
| 3531 | |
| 3532 | func NewFlowStatsReply() *FlowStatsReply { |
| 3533 | obj := &FlowStatsReply{ |
| 3534 | StatsReply: NewStatsReply(1), |
| 3535 | } |
| 3536 | return obj |
| 3537 | } |
| 3538 | |
| 3539 | type FlowStatsRequest struct { |
| 3540 | *StatsRequest |
| 3541 | TableId uint8 |
| 3542 | OutPort Port |
| 3543 | OutGroup uint32 |
| 3544 | Cookie uint64 |
| 3545 | CookieMask uint64 |
| 3546 | Match Match |
| 3547 | } |
| 3548 | |
| 3549 | type IFlowStatsRequest interface { |
| 3550 | IStatsRequest |
| 3551 | GetTableId() uint8 |
| 3552 | GetOutPort() Port |
| 3553 | GetOutGroup() uint32 |
| 3554 | GetCookie() uint64 |
| 3555 | GetCookieMask() uint64 |
| 3556 | GetMatch() Match |
| 3557 | } |
| 3558 | |
| 3559 | func (self *FlowStatsRequest) GetTableId() uint8 { |
| 3560 | return self.TableId |
| 3561 | } |
| 3562 | |
| 3563 | func (self *FlowStatsRequest) SetTableId(v uint8) { |
| 3564 | self.TableId = v |
| 3565 | } |
| 3566 | |
| 3567 | func (self *FlowStatsRequest) GetOutPort() Port { |
| 3568 | return self.OutPort |
| 3569 | } |
| 3570 | |
| 3571 | func (self *FlowStatsRequest) SetOutPort(v Port) { |
| 3572 | self.OutPort = v |
| 3573 | } |
| 3574 | |
| 3575 | func (self *FlowStatsRequest) GetOutGroup() uint32 { |
| 3576 | return self.OutGroup |
| 3577 | } |
| 3578 | |
| 3579 | func (self *FlowStatsRequest) SetOutGroup(v uint32) { |
| 3580 | self.OutGroup = v |
| 3581 | } |
| 3582 | |
| 3583 | func (self *FlowStatsRequest) GetCookie() uint64 { |
| 3584 | return self.Cookie |
| 3585 | } |
| 3586 | |
| 3587 | func (self *FlowStatsRequest) SetCookie(v uint64) { |
| 3588 | self.Cookie = v |
| 3589 | } |
| 3590 | |
| 3591 | func (self *FlowStatsRequest) GetCookieMask() uint64 { |
| 3592 | return self.CookieMask |
| 3593 | } |
| 3594 | |
| 3595 | func (self *FlowStatsRequest) SetCookieMask(v uint64) { |
| 3596 | self.CookieMask = v |
| 3597 | } |
| 3598 | |
| 3599 | func (self *FlowStatsRequest) GetMatch() Match { |
| 3600 | return self.Match |
| 3601 | } |
| 3602 | |
| 3603 | func (self *FlowStatsRequest) SetMatch(v Match) { |
| 3604 | self.Match = v |
| 3605 | } |
| 3606 | |
| 3607 | func (self *FlowStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 3608 | startIndex := len(encoder.Bytes()) |
| 3609 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 3610 | return err |
| 3611 | } |
| 3612 | |
| 3613 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 3614 | encoder.PutUint8(uint8(self.TableId)) |
| 3615 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 3616 | self.OutPort.Serialize(encoder) |
| 3617 | encoder.PutUint32(uint32(self.OutGroup)) |
| 3618 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 3619 | encoder.PutUint64(uint64(self.Cookie)) |
| 3620 | encoder.PutUint64(uint64(self.CookieMask)) |
| 3621 | if err := self.Match.Serialize(encoder); err != nil { |
| 3622 | return err |
| 3623 | } |
| 3624 | |
| 3625 | length := len(encoder.Bytes()) - startIndex |
| 3626 | |
| 3627 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3628 | |
| 3629 | return nil |
| 3630 | } |
| 3631 | |
| 3632 | func DecodeFlowStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*FlowStatsRequest, error) { |
| 3633 | _flowstatsrequest := &FlowStatsRequest{StatsRequest: parent} |
| 3634 | if decoder.Length() < 108 { |
| 3635 | return nil, fmt.Errorf("FlowStatsRequest packet too short: %d < 108", decoder.Length()) |
| 3636 | } |
| 3637 | decoder.Skip(4) |
| 3638 | _flowstatsrequest.TableId = uint8(decoder.ReadByte()) |
| 3639 | decoder.Skip(3) |
| 3640 | _flowstatsrequest.OutPort.Decode(decoder) |
| 3641 | _flowstatsrequest.OutGroup = uint32(decoder.ReadUint32()) |
| 3642 | decoder.Skip(4) |
| 3643 | _flowstatsrequest.Cookie = uint64(decoder.ReadUint64()) |
| 3644 | _flowstatsrequest.CookieMask = uint64(decoder.ReadUint64()) |
| 3645 | if err := _flowstatsrequest.Match.Decode(decoder); err != nil { |
| 3646 | return nil, err |
| 3647 | } |
| 3648 | |
| 3649 | return _flowstatsrequest, nil |
| 3650 | } |
| 3651 | |
| 3652 | func NewFlowStatsRequest() *FlowStatsRequest { |
| 3653 | obj := &FlowStatsRequest{ |
| 3654 | StatsRequest: NewStatsRequest(1), |
| 3655 | } |
| 3656 | return obj |
| 3657 | } |
| 3658 | |
| 3659 | type GetConfigReply struct { |
| 3660 | *Header |
| 3661 | Flags ConfigFlags |
| 3662 | MissSendLen uint16 |
| 3663 | } |
| 3664 | |
| 3665 | type IGetConfigReply interface { |
| 3666 | IHeader |
| 3667 | GetFlags() ConfigFlags |
| 3668 | GetMissSendLen() uint16 |
| 3669 | } |
| 3670 | |
| 3671 | func (self *GetConfigReply) GetFlags() ConfigFlags { |
| 3672 | return self.Flags |
| 3673 | } |
| 3674 | |
| 3675 | func (self *GetConfigReply) SetFlags(v ConfigFlags) { |
| 3676 | self.Flags = v |
| 3677 | } |
| 3678 | |
| 3679 | func (self *GetConfigReply) GetMissSendLen() uint16 { |
| 3680 | return self.MissSendLen |
| 3681 | } |
| 3682 | |
| 3683 | func (self *GetConfigReply) SetMissSendLen(v uint16) { |
| 3684 | self.MissSendLen = v |
| 3685 | } |
| 3686 | |
| 3687 | func (self *GetConfigReply) Serialize(encoder *goloxi.Encoder) error { |
| 3688 | startIndex := len(encoder.Bytes()) |
| 3689 | if err := self.Header.Serialize(encoder); err != nil { |
| 3690 | return err |
| 3691 | } |
| 3692 | |
| 3693 | encoder.PutUint16(uint16(self.Flags)) |
| 3694 | encoder.PutUint16(uint16(self.MissSendLen)) |
| 3695 | length := len(encoder.Bytes()) - startIndex |
| 3696 | |
| 3697 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3698 | |
| 3699 | return nil |
| 3700 | } |
| 3701 | |
| 3702 | func DecodeGetConfigReply(parent *Header, decoder *goloxi.Decoder) (*GetConfigReply, error) { |
| 3703 | _getconfigreply := &GetConfigReply{Header: parent} |
| 3704 | if decoder.Length() < 4 { |
| 3705 | return nil, fmt.Errorf("GetConfigReply packet too short: %d < 4", decoder.Length()) |
| 3706 | } |
| 3707 | _getconfigreply.Flags = ConfigFlags(decoder.ReadUint16()) |
| 3708 | _getconfigreply.MissSendLen = uint16(decoder.ReadUint16()) |
| 3709 | return _getconfigreply, nil |
| 3710 | } |
| 3711 | |
| 3712 | func NewGetConfigReply() *GetConfigReply { |
| 3713 | obj := &GetConfigReply{ |
| 3714 | Header: NewHeader(8), |
| 3715 | } |
| 3716 | return obj |
| 3717 | } |
| 3718 | |
| 3719 | type GetConfigRequest struct { |
| 3720 | *Header |
| 3721 | } |
| 3722 | |
| 3723 | type IGetConfigRequest interface { |
| 3724 | IHeader |
| 3725 | } |
| 3726 | |
| 3727 | func (self *GetConfigRequest) Serialize(encoder *goloxi.Encoder) error { |
| 3728 | startIndex := len(encoder.Bytes()) |
| 3729 | if err := self.Header.Serialize(encoder); err != nil { |
| 3730 | return err |
| 3731 | } |
| 3732 | length := len(encoder.Bytes()) - startIndex |
| 3733 | |
| 3734 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3735 | |
| 3736 | return nil |
| 3737 | } |
| 3738 | |
| 3739 | func DecodeGetConfigRequest(parent *Header, decoder *goloxi.Decoder) (*GetConfigRequest, error) { |
| 3740 | _getconfigrequest := &GetConfigRequest{Header: parent} |
| 3741 | return _getconfigrequest, nil |
| 3742 | } |
| 3743 | |
| 3744 | func NewGetConfigRequest() *GetConfigRequest { |
| 3745 | obj := &GetConfigRequest{ |
| 3746 | Header: NewHeader(7), |
| 3747 | } |
| 3748 | return obj |
| 3749 | } |
| 3750 | |
| 3751 | type GroupMod struct { |
| 3752 | *Header |
| 3753 | Command GroupModCommand |
| 3754 | GroupType GroupType |
| 3755 | GroupId uint32 |
| 3756 | Buckets []*Bucket |
| 3757 | } |
| 3758 | |
| 3759 | type IGroupMod interface { |
| 3760 | IHeader |
| 3761 | GetCommand() GroupModCommand |
| 3762 | GetGroupType() GroupType |
| 3763 | GetGroupId() uint32 |
| 3764 | GetBuckets() []*Bucket |
| 3765 | } |
| 3766 | |
| 3767 | func (self *GroupMod) GetCommand() GroupModCommand { |
| 3768 | return self.Command |
| 3769 | } |
| 3770 | |
| 3771 | func (self *GroupMod) SetCommand(v GroupModCommand) { |
| 3772 | self.Command = v |
| 3773 | } |
| 3774 | |
| 3775 | func (self *GroupMod) GetGroupType() GroupType { |
| 3776 | return self.GroupType |
| 3777 | } |
| 3778 | |
| 3779 | func (self *GroupMod) SetGroupType(v GroupType) { |
| 3780 | self.GroupType = v |
| 3781 | } |
| 3782 | |
| 3783 | func (self *GroupMod) GetGroupId() uint32 { |
| 3784 | return self.GroupId |
| 3785 | } |
| 3786 | |
| 3787 | func (self *GroupMod) SetGroupId(v uint32) { |
| 3788 | self.GroupId = v |
| 3789 | } |
| 3790 | |
| 3791 | func (self *GroupMod) GetBuckets() []*Bucket { |
| 3792 | return self.Buckets |
| 3793 | } |
| 3794 | |
| 3795 | func (self *GroupMod) SetBuckets(v []*Bucket) { |
| 3796 | self.Buckets = v |
| 3797 | } |
| 3798 | |
| 3799 | func (self *GroupMod) Serialize(encoder *goloxi.Encoder) error { |
| 3800 | if err := self.Header.Serialize(encoder); err != nil { |
| 3801 | return err |
| 3802 | } |
| 3803 | |
| 3804 | encoder.PutUint16(uint16(self.Command)) |
| 3805 | encoder.PutUint8(uint8(self.GroupType)) |
| 3806 | encoder.Write(bytes.Repeat([]byte{0}, 1)) |
| 3807 | encoder.PutUint32(uint32(self.GroupId)) |
| 3808 | for _, obj := range self.Buckets { |
| 3809 | if err := obj.Serialize(encoder); err != nil { |
| 3810 | return err |
| 3811 | } |
| 3812 | } |
| 3813 | |
| 3814 | return nil |
| 3815 | } |
| 3816 | |
| 3817 | func DecodeGroupMod(parent *Header, decoder *goloxi.Decoder) (IGroupMod, error) { |
| 3818 | _groupmod := &GroupMod{Header: parent} |
| 3819 | if decoder.Length() < 8 { |
| 3820 | return nil, fmt.Errorf("GroupMod packet too short: %d < 8", decoder.Length()) |
| 3821 | } |
| 3822 | _groupmod.Command = GroupModCommand(decoder.ReadUint16()) |
| 3823 | _groupmod.GroupType = GroupType(decoder.ReadByte()) |
| 3824 | decoder.Skip(1) |
| 3825 | _groupmod.GroupId = uint32(decoder.ReadUint32()) |
| 3826 | |
| 3827 | for decoder.Length() >= 16 { |
| 3828 | item, err := DecodeBucket(decoder) |
| 3829 | if err != nil { |
| 3830 | return nil, err |
| 3831 | } |
| 3832 | if item != nil { |
| 3833 | _groupmod.Buckets = append(_groupmod.Buckets, item) |
| 3834 | } |
| 3835 | } |
| 3836 | |
| 3837 | switch _groupmod.Command { |
| 3838 | case 0: |
| 3839 | return DecodeGroupAdd(_groupmod, decoder) |
| 3840 | case 1: |
| 3841 | return DecodeGroupModify(_groupmod, decoder) |
| 3842 | case 2: |
| 3843 | return DecodeGroupDelete(_groupmod, decoder) |
| 3844 | default: |
| 3845 | return nil, fmt.Errorf("Invalid type '%d' for 'GroupMod'", _groupmod.Command) |
| 3846 | } |
| 3847 | } |
| 3848 | |
| 3849 | func NewGroupMod(_command GroupModCommand) *GroupMod { |
| 3850 | obj := &GroupMod{ |
| 3851 | Header: NewHeader(15), |
| 3852 | } |
| 3853 | obj.Command = _command |
| 3854 | return obj |
| 3855 | } |
| 3856 | |
| 3857 | type GroupAdd struct { |
| 3858 | *GroupMod |
| 3859 | } |
| 3860 | |
| 3861 | type IGroupAdd interface { |
| 3862 | IGroupMod |
| 3863 | } |
| 3864 | |
| 3865 | func (self *GroupAdd) Serialize(encoder *goloxi.Encoder) error { |
| 3866 | startIndex := len(encoder.Bytes()) |
| 3867 | if err := self.GroupMod.Serialize(encoder); err != nil { |
| 3868 | return err |
| 3869 | } |
| 3870 | length := len(encoder.Bytes()) - startIndex |
| 3871 | |
| 3872 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3873 | |
| 3874 | return nil |
| 3875 | } |
| 3876 | |
| 3877 | func DecodeGroupAdd(parent *GroupMod, decoder *goloxi.Decoder) (*GroupAdd, error) { |
| 3878 | _groupadd := &GroupAdd{GroupMod: parent} |
| 3879 | return _groupadd, nil |
| 3880 | } |
| 3881 | |
| 3882 | func NewGroupAdd() *GroupAdd { |
| 3883 | obj := &GroupAdd{ |
| 3884 | GroupMod: NewGroupMod(0), |
| 3885 | } |
| 3886 | return obj |
| 3887 | } |
| 3888 | |
| 3889 | type GroupDelete struct { |
| 3890 | *GroupMod |
| 3891 | } |
| 3892 | |
| 3893 | type IGroupDelete interface { |
| 3894 | IGroupMod |
| 3895 | } |
| 3896 | |
| 3897 | func (self *GroupDelete) Serialize(encoder *goloxi.Encoder) error { |
| 3898 | startIndex := len(encoder.Bytes()) |
| 3899 | if err := self.GroupMod.Serialize(encoder); err != nil { |
| 3900 | return err |
| 3901 | } |
| 3902 | length := len(encoder.Bytes()) - startIndex |
| 3903 | |
| 3904 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3905 | |
| 3906 | return nil |
| 3907 | } |
| 3908 | |
| 3909 | func DecodeGroupDelete(parent *GroupMod, decoder *goloxi.Decoder) (*GroupDelete, error) { |
| 3910 | _groupdelete := &GroupDelete{GroupMod: parent} |
| 3911 | return _groupdelete, nil |
| 3912 | } |
| 3913 | |
| 3914 | func NewGroupDelete() *GroupDelete { |
| 3915 | obj := &GroupDelete{ |
| 3916 | GroupMod: NewGroupMod(2), |
| 3917 | } |
| 3918 | return obj |
| 3919 | } |
| 3920 | |
| 3921 | type GroupDescStatsReply struct { |
| 3922 | *StatsReply |
| 3923 | Entries []*GroupDescStatsEntry |
| 3924 | } |
| 3925 | |
| 3926 | type IGroupDescStatsReply interface { |
| 3927 | IStatsReply |
| 3928 | GetEntries() []*GroupDescStatsEntry |
| 3929 | } |
| 3930 | |
| 3931 | func (self *GroupDescStatsReply) GetEntries() []*GroupDescStatsEntry { |
| 3932 | return self.Entries |
| 3933 | } |
| 3934 | |
| 3935 | func (self *GroupDescStatsReply) SetEntries(v []*GroupDescStatsEntry) { |
| 3936 | self.Entries = v |
| 3937 | } |
| 3938 | |
| 3939 | func (self *GroupDescStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 3940 | startIndex := len(encoder.Bytes()) |
| 3941 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 3942 | return err |
| 3943 | } |
| 3944 | |
| 3945 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 3946 | for _, obj := range self.Entries { |
| 3947 | if err := obj.Serialize(encoder); err != nil { |
| 3948 | return err |
| 3949 | } |
| 3950 | } |
| 3951 | length := len(encoder.Bytes()) - startIndex |
| 3952 | |
| 3953 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3954 | |
| 3955 | return nil |
| 3956 | } |
| 3957 | |
| 3958 | func DecodeGroupDescStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*GroupDescStatsReply, error) { |
| 3959 | _groupdescstatsreply := &GroupDescStatsReply{StatsReply: parent} |
| 3960 | if decoder.Length() < 4 { |
| 3961 | return nil, fmt.Errorf("GroupDescStatsReply packet too short: %d < 4", decoder.Length()) |
| 3962 | } |
| 3963 | decoder.Skip(4) |
| 3964 | |
| 3965 | for decoder.Length() >= 8 { |
| 3966 | item, err := DecodeGroupDescStatsEntry(decoder) |
| 3967 | if err != nil { |
| 3968 | return nil, err |
| 3969 | } |
| 3970 | if item != nil { |
| 3971 | _groupdescstatsreply.Entries = append(_groupdescstatsreply.Entries, item) |
| 3972 | } |
| 3973 | } |
| 3974 | return _groupdescstatsreply, nil |
| 3975 | } |
| 3976 | |
| 3977 | func NewGroupDescStatsReply() *GroupDescStatsReply { |
| 3978 | obj := &GroupDescStatsReply{ |
| 3979 | StatsReply: NewStatsReply(7), |
| 3980 | } |
| 3981 | return obj |
| 3982 | } |
| 3983 | |
| 3984 | type GroupDescStatsRequest struct { |
| 3985 | *StatsRequest |
| 3986 | } |
| 3987 | |
| 3988 | type IGroupDescStatsRequest interface { |
| 3989 | IStatsRequest |
| 3990 | } |
| 3991 | |
| 3992 | func (self *GroupDescStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 3993 | startIndex := len(encoder.Bytes()) |
| 3994 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 3995 | return err |
| 3996 | } |
| 3997 | |
| 3998 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 3999 | length := len(encoder.Bytes()) - startIndex |
| 4000 | |
| 4001 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4002 | |
| 4003 | return nil |
| 4004 | } |
| 4005 | |
| 4006 | func DecodeGroupDescStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*GroupDescStatsRequest, error) { |
| 4007 | _groupdescstatsrequest := &GroupDescStatsRequest{StatsRequest: parent} |
| 4008 | if decoder.Length() < 4 { |
| 4009 | return nil, fmt.Errorf("GroupDescStatsRequest packet too short: %d < 4", decoder.Length()) |
| 4010 | } |
| 4011 | decoder.Skip(4) |
| 4012 | return _groupdescstatsrequest, nil |
| 4013 | } |
| 4014 | |
| 4015 | func NewGroupDescStatsRequest() *GroupDescStatsRequest { |
| 4016 | obj := &GroupDescStatsRequest{ |
| 4017 | StatsRequest: NewStatsRequest(7), |
| 4018 | } |
| 4019 | return obj |
| 4020 | } |
| 4021 | |
| 4022 | type GroupModFailedErrorMsg struct { |
| 4023 | *ErrorMsg |
| 4024 | Code GroupModFailedCode |
| 4025 | Data []byte |
| 4026 | } |
| 4027 | |
| 4028 | type IGroupModFailedErrorMsg interface { |
| 4029 | IErrorMsg |
| 4030 | GetCode() GroupModFailedCode |
| 4031 | GetData() []byte |
| 4032 | } |
| 4033 | |
| 4034 | func (self *GroupModFailedErrorMsg) GetCode() GroupModFailedCode { |
| 4035 | return self.Code |
| 4036 | } |
| 4037 | |
| 4038 | func (self *GroupModFailedErrorMsg) SetCode(v GroupModFailedCode) { |
| 4039 | self.Code = v |
| 4040 | } |
| 4041 | |
| 4042 | func (self *GroupModFailedErrorMsg) GetData() []byte { |
| 4043 | return self.Data |
| 4044 | } |
| 4045 | |
| 4046 | func (self *GroupModFailedErrorMsg) SetData(v []byte) { |
| 4047 | self.Data = v |
| 4048 | } |
| 4049 | |
| 4050 | func (self *GroupModFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 4051 | startIndex := len(encoder.Bytes()) |
| 4052 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 4053 | return err |
| 4054 | } |
| 4055 | |
| 4056 | encoder.PutUint16(uint16(self.Code)) |
| 4057 | encoder.Write(self.Data) |
| 4058 | length := len(encoder.Bytes()) - startIndex |
| 4059 | |
| 4060 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4061 | |
| 4062 | return nil |
| 4063 | } |
| 4064 | |
| 4065 | func DecodeGroupModFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*GroupModFailedErrorMsg, error) { |
| 4066 | _groupmodfailederrormsg := &GroupModFailedErrorMsg{ErrorMsg: parent} |
| 4067 | if decoder.Length() < 2 { |
| 4068 | return nil, fmt.Errorf("GroupModFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 4069 | } |
| 4070 | _groupmodfailederrormsg.Code = GroupModFailedCode(decoder.ReadUint16()) |
| 4071 | _groupmodfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 4072 | return _groupmodfailederrormsg, nil |
| 4073 | } |
| 4074 | |
| 4075 | func NewGroupModFailedErrorMsg() *GroupModFailedErrorMsg { |
| 4076 | obj := &GroupModFailedErrorMsg{ |
| 4077 | ErrorMsg: NewErrorMsg(6), |
| 4078 | } |
| 4079 | return obj |
| 4080 | } |
| 4081 | |
| 4082 | type GroupModify struct { |
| 4083 | *GroupMod |
| 4084 | } |
| 4085 | |
| 4086 | type IGroupModify interface { |
| 4087 | IGroupMod |
| 4088 | } |
| 4089 | |
| 4090 | func (self *GroupModify) Serialize(encoder *goloxi.Encoder) error { |
| 4091 | startIndex := len(encoder.Bytes()) |
| 4092 | if err := self.GroupMod.Serialize(encoder); err != nil { |
| 4093 | return err |
| 4094 | } |
| 4095 | length := len(encoder.Bytes()) - startIndex |
| 4096 | |
| 4097 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4098 | |
| 4099 | return nil |
| 4100 | } |
| 4101 | |
| 4102 | func DecodeGroupModify(parent *GroupMod, decoder *goloxi.Decoder) (*GroupModify, error) { |
| 4103 | _groupmodify := &GroupModify{GroupMod: parent} |
| 4104 | return _groupmodify, nil |
| 4105 | } |
| 4106 | |
| 4107 | func NewGroupModify() *GroupModify { |
| 4108 | obj := &GroupModify{ |
| 4109 | GroupMod: NewGroupMod(1), |
| 4110 | } |
| 4111 | return obj |
| 4112 | } |
| 4113 | |
| 4114 | type GroupStatsReply struct { |
| 4115 | *StatsReply |
| 4116 | Entries []*GroupStatsEntry |
| 4117 | } |
| 4118 | |
| 4119 | type IGroupStatsReply interface { |
| 4120 | IStatsReply |
| 4121 | GetEntries() []*GroupStatsEntry |
| 4122 | } |
| 4123 | |
| 4124 | func (self *GroupStatsReply) GetEntries() []*GroupStatsEntry { |
| 4125 | return self.Entries |
| 4126 | } |
| 4127 | |
| 4128 | func (self *GroupStatsReply) SetEntries(v []*GroupStatsEntry) { |
| 4129 | self.Entries = v |
| 4130 | } |
| 4131 | |
| 4132 | func (self *GroupStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 4133 | startIndex := len(encoder.Bytes()) |
| 4134 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 4135 | return err |
| 4136 | } |
| 4137 | |
| 4138 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 4139 | for _, obj := range self.Entries { |
| 4140 | if err := obj.Serialize(encoder); err != nil { |
| 4141 | return err |
| 4142 | } |
| 4143 | } |
| 4144 | length := len(encoder.Bytes()) - startIndex |
| 4145 | |
| 4146 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4147 | |
| 4148 | return nil |
| 4149 | } |
| 4150 | |
| 4151 | func DecodeGroupStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*GroupStatsReply, error) { |
| 4152 | _groupstatsreply := &GroupStatsReply{StatsReply: parent} |
| 4153 | if decoder.Length() < 4 { |
| 4154 | return nil, fmt.Errorf("GroupStatsReply packet too short: %d < 4", decoder.Length()) |
| 4155 | } |
| 4156 | decoder.Skip(4) |
| 4157 | |
| 4158 | for decoder.Length() >= 32 { |
| 4159 | item, err := DecodeGroupStatsEntry(decoder) |
| 4160 | if err != nil { |
| 4161 | return nil, err |
| 4162 | } |
| 4163 | if item != nil { |
| 4164 | _groupstatsreply.Entries = append(_groupstatsreply.Entries, item) |
| 4165 | } |
| 4166 | } |
| 4167 | return _groupstatsreply, nil |
| 4168 | } |
| 4169 | |
| 4170 | func NewGroupStatsReply() *GroupStatsReply { |
| 4171 | obj := &GroupStatsReply{ |
| 4172 | StatsReply: NewStatsReply(6), |
| 4173 | } |
| 4174 | return obj |
| 4175 | } |
| 4176 | |
| 4177 | type GroupStatsRequest struct { |
| 4178 | *StatsRequest |
| 4179 | GroupId uint32 |
| 4180 | } |
| 4181 | |
| 4182 | type IGroupStatsRequest interface { |
| 4183 | IStatsRequest |
| 4184 | GetGroupId() uint32 |
| 4185 | } |
| 4186 | |
| 4187 | func (self *GroupStatsRequest) GetGroupId() uint32 { |
| 4188 | return self.GroupId |
| 4189 | } |
| 4190 | |
| 4191 | func (self *GroupStatsRequest) SetGroupId(v uint32) { |
| 4192 | self.GroupId = v |
| 4193 | } |
| 4194 | |
| 4195 | func (self *GroupStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 4196 | startIndex := len(encoder.Bytes()) |
| 4197 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 4198 | return err |
| 4199 | } |
| 4200 | |
| 4201 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 4202 | encoder.PutUint32(uint32(self.GroupId)) |
| 4203 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 4204 | length := len(encoder.Bytes()) - startIndex |
| 4205 | |
| 4206 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4207 | |
| 4208 | return nil |
| 4209 | } |
| 4210 | |
| 4211 | func DecodeGroupStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*GroupStatsRequest, error) { |
| 4212 | _groupstatsrequest := &GroupStatsRequest{StatsRequest: parent} |
| 4213 | if decoder.Length() < 4 { |
| 4214 | return nil, fmt.Errorf("GroupStatsRequest packet too short: %d < 4", decoder.Length()) |
| 4215 | } |
| 4216 | decoder.Skip(4) |
| 4217 | _groupstatsrequest.GroupId = uint32(decoder.ReadUint32()) |
| 4218 | decoder.Skip(4) |
| 4219 | return _groupstatsrequest, nil |
| 4220 | } |
| 4221 | |
| 4222 | func NewGroupStatsRequest() *GroupStatsRequest { |
| 4223 | obj := &GroupStatsRequest{ |
| 4224 | StatsRequest: NewStatsRequest(6), |
| 4225 | } |
| 4226 | return obj |
| 4227 | } |
| 4228 | |
| 4229 | type Hello struct { |
| 4230 | *Header |
| 4231 | } |
| 4232 | |
| 4233 | type IHello interface { |
| 4234 | IHeader |
| 4235 | } |
| 4236 | |
| 4237 | func (self *Hello) Serialize(encoder *goloxi.Encoder) error { |
| 4238 | startIndex := len(encoder.Bytes()) |
| 4239 | if err := self.Header.Serialize(encoder); err != nil { |
| 4240 | return err |
| 4241 | } |
| 4242 | length := len(encoder.Bytes()) - startIndex |
| 4243 | |
| 4244 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4245 | |
| 4246 | return nil |
| 4247 | } |
| 4248 | |
| 4249 | func DecodeHello(parent *Header, decoder *goloxi.Decoder) (*Hello, error) { |
| 4250 | _hello := &Hello{Header: parent} |
| 4251 | return _hello, nil |
| 4252 | } |
| 4253 | |
| 4254 | func NewHello() *Hello { |
| 4255 | obj := &Hello{ |
| 4256 | Header: NewHeader(0), |
| 4257 | } |
| 4258 | return obj |
| 4259 | } |
| 4260 | |
| 4261 | type HelloFailedErrorMsg struct { |
| 4262 | *ErrorMsg |
| 4263 | Code HelloFailedCode |
| 4264 | Data []byte |
| 4265 | } |
| 4266 | |
| 4267 | type IHelloFailedErrorMsg interface { |
| 4268 | IErrorMsg |
| 4269 | GetCode() HelloFailedCode |
| 4270 | GetData() []byte |
| 4271 | } |
| 4272 | |
| 4273 | func (self *HelloFailedErrorMsg) GetCode() HelloFailedCode { |
| 4274 | return self.Code |
| 4275 | } |
| 4276 | |
| 4277 | func (self *HelloFailedErrorMsg) SetCode(v HelloFailedCode) { |
| 4278 | self.Code = v |
| 4279 | } |
| 4280 | |
| 4281 | func (self *HelloFailedErrorMsg) GetData() []byte { |
| 4282 | return self.Data |
| 4283 | } |
| 4284 | |
| 4285 | func (self *HelloFailedErrorMsg) SetData(v []byte) { |
| 4286 | self.Data = v |
| 4287 | } |
| 4288 | |
| 4289 | func (self *HelloFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 4290 | startIndex := len(encoder.Bytes()) |
| 4291 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 4292 | return err |
| 4293 | } |
| 4294 | |
| 4295 | encoder.PutUint16(uint16(self.Code)) |
| 4296 | encoder.Write(self.Data) |
| 4297 | length := len(encoder.Bytes()) - startIndex |
| 4298 | |
| 4299 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4300 | |
| 4301 | return nil |
| 4302 | } |
| 4303 | |
| 4304 | func DecodeHelloFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*HelloFailedErrorMsg, error) { |
| 4305 | _hellofailederrormsg := &HelloFailedErrorMsg{ErrorMsg: parent} |
| 4306 | if decoder.Length() < 2 { |
| 4307 | return nil, fmt.Errorf("HelloFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 4308 | } |
| 4309 | _hellofailederrormsg.Code = HelloFailedCode(decoder.ReadUint16()) |
| 4310 | _hellofailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 4311 | return _hellofailederrormsg, nil |
| 4312 | } |
| 4313 | |
| 4314 | func NewHelloFailedErrorMsg() *HelloFailedErrorMsg { |
| 4315 | obj := &HelloFailedErrorMsg{ |
| 4316 | ErrorMsg: NewErrorMsg(0), |
| 4317 | } |
| 4318 | return obj |
| 4319 | } |
| 4320 | |
| 4321 | type NiciraStatsReply struct { |
| 4322 | *ExperimenterStatsReply |
| 4323 | Subtype uint32 |
| 4324 | } |
| 4325 | |
| 4326 | type INiciraStatsReply interface { |
| 4327 | IExperimenterStatsReply |
| 4328 | GetSubtype() uint32 |
| 4329 | } |
| 4330 | |
| 4331 | func (self *NiciraStatsReply) GetSubtype() uint32 { |
| 4332 | return self.Subtype |
| 4333 | } |
| 4334 | |
| 4335 | func (self *NiciraStatsReply) SetSubtype(v uint32) { |
| 4336 | self.Subtype = v |
| 4337 | } |
| 4338 | |
| 4339 | func (self *NiciraStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 4340 | if err := self.ExperimenterStatsReply.Serialize(encoder); err != nil { |
| 4341 | return err |
| 4342 | } |
| 4343 | |
| 4344 | encoder.PutUint32(uint32(self.Subtype)) |
| 4345 | |
| 4346 | return nil |
| 4347 | } |
| 4348 | |
| 4349 | func DecodeNiciraStatsReply(parent *ExperimenterStatsReply, decoder *goloxi.Decoder) (INiciraStatsReply, error) { |
| 4350 | _nicirastatsreply := &NiciraStatsReply{ExperimenterStatsReply: parent} |
| 4351 | if decoder.Length() < 4 { |
| 4352 | return nil, fmt.Errorf("NiciraStatsReply packet too short: %d < 4", decoder.Length()) |
| 4353 | } |
| 4354 | _nicirastatsreply.Subtype = uint32(decoder.ReadUint32()) |
| 4355 | |
| 4356 | switch _nicirastatsreply.Subtype { |
| 4357 | case 0: |
| 4358 | return DecodeNiciraFlowStatsReply(_nicirastatsreply, decoder) |
| 4359 | case 2: |
| 4360 | return DecodeNiciraFlowMonitorReply(_nicirastatsreply, decoder) |
| 4361 | default: |
| 4362 | return nil, fmt.Errorf("Invalid type '%d' for 'NiciraStatsReply'", _nicirastatsreply.Subtype) |
| 4363 | } |
| 4364 | } |
| 4365 | |
| 4366 | func NewNiciraStatsReply(_subtype uint32) *NiciraStatsReply { |
| 4367 | obj := &NiciraStatsReply{ |
| 4368 | ExperimenterStatsReply: NewExperimenterStatsReply(8992), |
| 4369 | } |
| 4370 | obj.Subtype = _subtype |
| 4371 | return obj |
| 4372 | } |
| 4373 | |
| 4374 | type NiciraFlowMonitorReply struct { |
| 4375 | *NiciraStatsReply |
| 4376 | Updates []INiciraFlowUpdateEvent |
| 4377 | } |
| 4378 | |
| 4379 | type INiciraFlowMonitorReply interface { |
| 4380 | INiciraStatsReply |
| 4381 | GetUpdates() []INiciraFlowUpdateEvent |
| 4382 | } |
| 4383 | |
| 4384 | func (self *NiciraFlowMonitorReply) GetUpdates() []INiciraFlowUpdateEvent { |
| 4385 | return self.Updates |
| 4386 | } |
| 4387 | |
| 4388 | func (self *NiciraFlowMonitorReply) SetUpdates(v []INiciraFlowUpdateEvent) { |
| 4389 | self.Updates = v |
| 4390 | } |
| 4391 | |
| 4392 | func (self *NiciraFlowMonitorReply) Serialize(encoder *goloxi.Encoder) error { |
| 4393 | startIndex := len(encoder.Bytes()) |
| 4394 | if err := self.NiciraStatsReply.Serialize(encoder); err != nil { |
| 4395 | return err |
| 4396 | } |
| 4397 | |
| 4398 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 4399 | for _, obj := range self.Updates { |
| 4400 | if err := obj.Serialize(encoder); err != nil { |
| 4401 | return err |
| 4402 | } |
| 4403 | } |
| 4404 | length := len(encoder.Bytes()) - startIndex |
| 4405 | |
| 4406 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4407 | |
| 4408 | return nil |
| 4409 | } |
| 4410 | |
| 4411 | func DecodeNiciraFlowMonitorReply(parent *NiciraStatsReply, decoder *goloxi.Decoder) (*NiciraFlowMonitorReply, error) { |
| 4412 | _niciraflowmonitorreply := &NiciraFlowMonitorReply{NiciraStatsReply: parent} |
| 4413 | if decoder.Length() < 4 { |
| 4414 | return nil, fmt.Errorf("NiciraFlowMonitorReply packet too short: %d < 4", decoder.Length()) |
| 4415 | } |
| 4416 | decoder.Skip(4) |
| 4417 | |
| 4418 | for decoder.Length() >= 4 { |
| 4419 | item, err := DecodeNiciraFlowUpdateEvent(decoder) |
| 4420 | if err != nil { |
| 4421 | return nil, err |
| 4422 | } |
| 4423 | if item != nil { |
| 4424 | _niciraflowmonitorreply.Updates = append(_niciraflowmonitorreply.Updates, item) |
| 4425 | } |
| 4426 | } |
| 4427 | return _niciraflowmonitorreply, nil |
| 4428 | } |
| 4429 | |
| 4430 | func NewNiciraFlowMonitorReply() *NiciraFlowMonitorReply { |
| 4431 | obj := &NiciraFlowMonitorReply{ |
| 4432 | NiciraStatsReply: NewNiciraStatsReply(2), |
| 4433 | } |
| 4434 | return obj |
| 4435 | } |
| 4436 | |
| 4437 | type NiciraFlowMonitorRequest struct { |
| 4438 | *ExperimenterStatsRequest |
| 4439 | Subtype uint32 |
| 4440 | MonitorId uint32 |
| 4441 | MonitorFlags NxFlowMonitorFlags |
| 4442 | OutPort Port |
| 4443 | MatchLen uint16 |
| 4444 | TableId uint8 |
| 4445 | Match NiciraMatch |
| 4446 | } |
| 4447 | |
| 4448 | type INiciraFlowMonitorRequest interface { |
| 4449 | IExperimenterStatsRequest |
| 4450 | GetSubtype() uint32 |
| 4451 | GetMonitorId() uint32 |
| 4452 | GetMonitorFlags() NxFlowMonitorFlags |
| 4453 | GetOutPort() Port |
| 4454 | GetMatchLen() uint16 |
| 4455 | GetTableId() uint8 |
| 4456 | GetMatch() NiciraMatch |
| 4457 | } |
| 4458 | |
| 4459 | func (self *NiciraFlowMonitorRequest) GetSubtype() uint32 { |
| 4460 | return self.Subtype |
| 4461 | } |
| 4462 | |
| 4463 | func (self *NiciraFlowMonitorRequest) SetSubtype(v uint32) { |
| 4464 | self.Subtype = v |
| 4465 | } |
| 4466 | |
| 4467 | func (self *NiciraFlowMonitorRequest) GetMonitorId() uint32 { |
| 4468 | return self.MonitorId |
| 4469 | } |
| 4470 | |
| 4471 | func (self *NiciraFlowMonitorRequest) SetMonitorId(v uint32) { |
| 4472 | self.MonitorId = v |
| 4473 | } |
| 4474 | |
| 4475 | func (self *NiciraFlowMonitorRequest) GetMonitorFlags() NxFlowMonitorFlags { |
| 4476 | return self.MonitorFlags |
| 4477 | } |
| 4478 | |
| 4479 | func (self *NiciraFlowMonitorRequest) SetMonitorFlags(v NxFlowMonitorFlags) { |
| 4480 | self.MonitorFlags = v |
| 4481 | } |
| 4482 | |
| 4483 | func (self *NiciraFlowMonitorRequest) GetOutPort() Port { |
| 4484 | return self.OutPort |
| 4485 | } |
| 4486 | |
| 4487 | func (self *NiciraFlowMonitorRequest) SetOutPort(v Port) { |
| 4488 | self.OutPort = v |
| 4489 | } |
| 4490 | |
| 4491 | func (self *NiciraFlowMonitorRequest) GetMatchLen() uint16 { |
| 4492 | return self.MatchLen |
| 4493 | } |
| 4494 | |
| 4495 | func (self *NiciraFlowMonitorRequest) SetMatchLen(v uint16) { |
| 4496 | self.MatchLen = v |
| 4497 | } |
| 4498 | |
| 4499 | func (self *NiciraFlowMonitorRequest) GetTableId() uint8 { |
| 4500 | return self.TableId |
| 4501 | } |
| 4502 | |
| 4503 | func (self *NiciraFlowMonitorRequest) SetTableId(v uint8) { |
| 4504 | self.TableId = v |
| 4505 | } |
| 4506 | |
| 4507 | func (self *NiciraFlowMonitorRequest) GetMatch() NiciraMatch { |
| 4508 | return self.Match |
| 4509 | } |
| 4510 | |
| 4511 | func (self *NiciraFlowMonitorRequest) SetMatch(v NiciraMatch) { |
| 4512 | self.Match = v |
| 4513 | } |
| 4514 | |
| 4515 | func (self *NiciraFlowMonitorRequest) Serialize(encoder *goloxi.Encoder) error { |
| 4516 | startIndex := len(encoder.Bytes()) |
| 4517 | if err := self.ExperimenterStatsRequest.Serialize(encoder); err != nil { |
| 4518 | return err |
| 4519 | } |
| 4520 | |
| 4521 | encoder.PutUint32(uint32(self.Subtype)) |
| 4522 | encoder.PutUint32(uint32(self.MonitorId)) |
| 4523 | encoder.PutUint16(uint16(self.MonitorFlags)) |
| 4524 | self.OutPort.Serialize(encoder) |
| 4525 | encoder.PutUint16(uint16(self.MatchLen)) |
| 4526 | encoder.PutUint8(uint8(self.TableId)) |
| 4527 | encoder.Write(bytes.Repeat([]byte{0}, 5)) |
| 4528 | if err := self.Match.Serialize(encoder); err != nil { |
| 4529 | return err |
| 4530 | } |
| 4531 | |
| 4532 | length := len(encoder.Bytes()) - startIndex |
| 4533 | |
| 4534 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4535 | |
| 4536 | return nil |
| 4537 | } |
| 4538 | |
| 4539 | func DecodeNiciraFlowMonitorRequest(parent *ExperimenterStatsRequest, decoder *goloxi.Decoder) (*NiciraFlowMonitorRequest, error) { |
| 4540 | _niciraflowmonitorrequest := &NiciraFlowMonitorRequest{ExperimenterStatsRequest: parent} |
| 4541 | if decoder.Length() < 26 { |
| 4542 | return nil, fmt.Errorf("NiciraFlowMonitorRequest packet too short: %d < 26", decoder.Length()) |
| 4543 | } |
| 4544 | _niciraflowmonitorrequest.Subtype = uint32(decoder.ReadUint32()) |
| 4545 | _niciraflowmonitorrequest.MonitorId = uint32(decoder.ReadUint32()) |
| 4546 | _niciraflowmonitorrequest.MonitorFlags = NxFlowMonitorFlags(decoder.ReadUint16()) |
| 4547 | _niciraflowmonitorrequest.OutPort.Decode(decoder) |
| 4548 | _niciraflowmonitorrequest.MatchLen = uint16(decoder.ReadUint16()) |
| 4549 | _niciraflowmonitorrequest.TableId = uint8(decoder.ReadByte()) |
| 4550 | decoder.Skip(5) |
| 4551 | if err := _niciraflowmonitorrequest.Match.Decode(decoder); err != nil { |
| 4552 | return nil, err |
| 4553 | } |
| 4554 | |
| 4555 | decoder.SkipAlign() |
| 4556 | return _niciraflowmonitorrequest, nil |
| 4557 | } |
| 4558 | |
| 4559 | func NewNiciraFlowMonitorRequest() *NiciraFlowMonitorRequest { |
| 4560 | obj := &NiciraFlowMonitorRequest{ |
| 4561 | ExperimenterStatsRequest: NewExperimenterStatsRequest(8992), |
| 4562 | } |
| 4563 | return obj |
| 4564 | } |
| 4565 | |
| 4566 | type NiciraFlowStatsReply struct { |
| 4567 | *NiciraStatsReply |
| 4568 | Stats []*NiciraFlowStats |
| 4569 | } |
| 4570 | |
| 4571 | type INiciraFlowStatsReply interface { |
| 4572 | INiciraStatsReply |
| 4573 | GetStats() []*NiciraFlowStats |
| 4574 | } |
| 4575 | |
| 4576 | func (self *NiciraFlowStatsReply) GetStats() []*NiciraFlowStats { |
| 4577 | return self.Stats |
| 4578 | } |
| 4579 | |
| 4580 | func (self *NiciraFlowStatsReply) SetStats(v []*NiciraFlowStats) { |
| 4581 | self.Stats = v |
| 4582 | } |
| 4583 | |
| 4584 | func (self *NiciraFlowStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 4585 | startIndex := len(encoder.Bytes()) |
| 4586 | if err := self.NiciraStatsReply.Serialize(encoder); err != nil { |
| 4587 | return err |
| 4588 | } |
| 4589 | |
| 4590 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 4591 | for _, obj := range self.Stats { |
| 4592 | if err := obj.Serialize(encoder); err != nil { |
| 4593 | return err |
| 4594 | } |
| 4595 | } |
| 4596 | length := len(encoder.Bytes()) - startIndex |
| 4597 | |
| 4598 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4599 | |
| 4600 | return nil |
| 4601 | } |
| 4602 | |
| 4603 | func DecodeNiciraFlowStatsReply(parent *NiciraStatsReply, decoder *goloxi.Decoder) (*NiciraFlowStatsReply, error) { |
| 4604 | _niciraflowstatsreply := &NiciraFlowStatsReply{NiciraStatsReply: parent} |
| 4605 | if decoder.Length() < 4 { |
| 4606 | return nil, fmt.Errorf("NiciraFlowStatsReply packet too short: %d < 4", decoder.Length()) |
| 4607 | } |
| 4608 | decoder.Skip(4) |
| 4609 | |
| 4610 | for decoder.Length() >= 48 { |
| 4611 | item, err := DecodeNiciraFlowStats(decoder) |
| 4612 | if err != nil { |
| 4613 | return nil, err |
| 4614 | } |
| 4615 | if item != nil { |
| 4616 | _niciraflowstatsreply.Stats = append(_niciraflowstatsreply.Stats, item) |
| 4617 | } |
| 4618 | } |
| 4619 | return _niciraflowstatsreply, nil |
| 4620 | } |
| 4621 | |
| 4622 | func NewNiciraFlowStatsReply() *NiciraFlowStatsReply { |
| 4623 | obj := &NiciraFlowStatsReply{ |
| 4624 | NiciraStatsReply: NewNiciraStatsReply(0), |
| 4625 | } |
| 4626 | return obj |
| 4627 | } |
| 4628 | |
| 4629 | type NiciraFlowStatsRequest struct { |
| 4630 | *ExperimenterStatsRequest |
| 4631 | Subtype uint32 |
| 4632 | OutPort Port |
| 4633 | MatchLen uint16 |
| 4634 | TableId uint8 |
| 4635 | } |
| 4636 | |
| 4637 | type INiciraFlowStatsRequest interface { |
| 4638 | IExperimenterStatsRequest |
| 4639 | GetSubtype() uint32 |
| 4640 | GetOutPort() Port |
| 4641 | GetMatchLen() uint16 |
| 4642 | GetTableId() uint8 |
| 4643 | } |
| 4644 | |
| 4645 | func (self *NiciraFlowStatsRequest) GetSubtype() uint32 { |
| 4646 | return self.Subtype |
| 4647 | } |
| 4648 | |
| 4649 | func (self *NiciraFlowStatsRequest) SetSubtype(v uint32) { |
| 4650 | self.Subtype = v |
| 4651 | } |
| 4652 | |
| 4653 | func (self *NiciraFlowStatsRequest) GetOutPort() Port { |
| 4654 | return self.OutPort |
| 4655 | } |
| 4656 | |
| 4657 | func (self *NiciraFlowStatsRequest) SetOutPort(v Port) { |
| 4658 | self.OutPort = v |
| 4659 | } |
| 4660 | |
| 4661 | func (self *NiciraFlowStatsRequest) GetMatchLen() uint16 { |
| 4662 | return self.MatchLen |
| 4663 | } |
| 4664 | |
| 4665 | func (self *NiciraFlowStatsRequest) SetMatchLen(v uint16) { |
| 4666 | self.MatchLen = v |
| 4667 | } |
| 4668 | |
| 4669 | func (self *NiciraFlowStatsRequest) GetTableId() uint8 { |
| 4670 | return self.TableId |
| 4671 | } |
| 4672 | |
| 4673 | func (self *NiciraFlowStatsRequest) SetTableId(v uint8) { |
| 4674 | self.TableId = v |
| 4675 | } |
| 4676 | |
| 4677 | func (self *NiciraFlowStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 4678 | startIndex := len(encoder.Bytes()) |
| 4679 | if err := self.ExperimenterStatsRequest.Serialize(encoder); err != nil { |
| 4680 | return err |
| 4681 | } |
| 4682 | |
| 4683 | encoder.PutUint32(uint32(self.Subtype)) |
| 4684 | self.OutPort.Serialize(encoder) |
| 4685 | encoder.PutUint16(uint16(self.MatchLen)) |
| 4686 | encoder.PutUint8(uint8(self.TableId)) |
| 4687 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 4688 | length := len(encoder.Bytes()) - startIndex |
| 4689 | |
| 4690 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4691 | |
| 4692 | return nil |
| 4693 | } |
| 4694 | |
| 4695 | func DecodeNiciraFlowStatsRequest(parent *ExperimenterStatsRequest, decoder *goloxi.Decoder) (*NiciraFlowStatsRequest, error) { |
| 4696 | _niciraflowstatsrequest := &NiciraFlowStatsRequest{ExperimenterStatsRequest: parent} |
| 4697 | if decoder.Length() < 18 { |
| 4698 | return nil, fmt.Errorf("NiciraFlowStatsRequest packet too short: %d < 18", decoder.Length()) |
| 4699 | } |
| 4700 | _niciraflowstatsrequest.Subtype = uint32(decoder.ReadUint32()) |
| 4701 | _niciraflowstatsrequest.OutPort.Decode(decoder) |
| 4702 | _niciraflowstatsrequest.MatchLen = uint16(decoder.ReadUint16()) |
| 4703 | _niciraflowstatsrequest.TableId = uint8(decoder.ReadByte()) |
| 4704 | decoder.Skip(3) |
| 4705 | return _niciraflowstatsrequest, nil |
| 4706 | } |
| 4707 | |
| 4708 | func NewNiciraFlowStatsRequest() *NiciraFlowStatsRequest { |
| 4709 | obj := &NiciraFlowStatsRequest{ |
| 4710 | ExperimenterStatsRequest: NewExperimenterStatsRequest(8992), |
| 4711 | } |
| 4712 | return obj |
| 4713 | } |
| 4714 | |
| 4715 | type NiciraHeader struct { |
| 4716 | *Experimenter |
| 4717 | Subtype uint32 |
| 4718 | } |
| 4719 | |
| 4720 | type INiciraHeader interface { |
| 4721 | IExperimenter |
| 4722 | GetSubtype() uint32 |
| 4723 | } |
| 4724 | |
| 4725 | func (self *NiciraHeader) GetSubtype() uint32 { |
| 4726 | return self.Subtype |
| 4727 | } |
| 4728 | |
| 4729 | func (self *NiciraHeader) SetSubtype(v uint32) { |
| 4730 | self.Subtype = v |
| 4731 | } |
| 4732 | |
| 4733 | func (self *NiciraHeader) Serialize(encoder *goloxi.Encoder) error { |
| 4734 | if err := self.Experimenter.Serialize(encoder); err != nil { |
| 4735 | return err |
| 4736 | } |
| 4737 | |
| 4738 | encoder.PutUint32(uint32(self.Subtype)) |
| 4739 | |
| 4740 | return nil |
| 4741 | } |
| 4742 | |
| 4743 | func DecodeNiciraHeader(parent *Experimenter, decoder *goloxi.Decoder) (INiciraHeader, error) { |
| 4744 | _niciraheader := &NiciraHeader{Experimenter: parent} |
| 4745 | if decoder.Length() < 4 { |
| 4746 | return nil, fmt.Errorf("NiciraHeader packet too short: %d < 4", decoder.Length()) |
| 4747 | } |
| 4748 | _niciraheader.Subtype = uint32(decoder.ReadUint32()) |
| 4749 | return _niciraheader, nil |
| 4750 | } |
| 4751 | |
| 4752 | func NewNiciraHeader(_subtype uint32) *NiciraHeader { |
| 4753 | obj := &NiciraHeader{ |
| 4754 | Experimenter: NewExperimenter(8992), |
| 4755 | } |
| 4756 | obj.Subtype = _subtype |
| 4757 | return obj |
| 4758 | } |
| 4759 | |
| 4760 | type PacketIn struct { |
| 4761 | *Header |
| 4762 | BufferId uint32 |
| 4763 | InPort Port |
| 4764 | InPhyPort Port |
| 4765 | TotalLen uint16 |
| 4766 | Reason uint8 |
| 4767 | TableId uint8 |
| 4768 | Data []byte |
| 4769 | } |
| 4770 | |
| 4771 | type IPacketIn interface { |
| 4772 | IHeader |
| 4773 | GetBufferId() uint32 |
| 4774 | GetInPort() Port |
| 4775 | GetInPhyPort() Port |
| 4776 | GetTotalLen() uint16 |
| 4777 | GetReason() uint8 |
| 4778 | GetTableId() uint8 |
| 4779 | GetData() []byte |
| 4780 | } |
| 4781 | |
| 4782 | func (self *PacketIn) GetBufferId() uint32 { |
| 4783 | return self.BufferId |
| 4784 | } |
| 4785 | |
| 4786 | func (self *PacketIn) SetBufferId(v uint32) { |
| 4787 | self.BufferId = v |
| 4788 | } |
| 4789 | |
| 4790 | func (self *PacketIn) GetInPort() Port { |
| 4791 | return self.InPort |
| 4792 | } |
| 4793 | |
| 4794 | func (self *PacketIn) SetInPort(v Port) { |
| 4795 | self.InPort = v |
| 4796 | } |
| 4797 | |
| 4798 | func (self *PacketIn) GetInPhyPort() Port { |
| 4799 | return self.InPhyPort |
| 4800 | } |
| 4801 | |
| 4802 | func (self *PacketIn) SetInPhyPort(v Port) { |
| 4803 | self.InPhyPort = v |
| 4804 | } |
| 4805 | |
| 4806 | func (self *PacketIn) GetTotalLen() uint16 { |
| 4807 | return self.TotalLen |
| 4808 | } |
| 4809 | |
| 4810 | func (self *PacketIn) SetTotalLen(v uint16) { |
| 4811 | self.TotalLen = v |
| 4812 | } |
| 4813 | |
| 4814 | func (self *PacketIn) GetReason() uint8 { |
| 4815 | return self.Reason |
| 4816 | } |
| 4817 | |
| 4818 | func (self *PacketIn) SetReason(v uint8) { |
| 4819 | self.Reason = v |
| 4820 | } |
| 4821 | |
| 4822 | func (self *PacketIn) GetTableId() uint8 { |
| 4823 | return self.TableId |
| 4824 | } |
| 4825 | |
| 4826 | func (self *PacketIn) SetTableId(v uint8) { |
| 4827 | self.TableId = v |
| 4828 | } |
| 4829 | |
| 4830 | func (self *PacketIn) GetData() []byte { |
| 4831 | return self.Data |
| 4832 | } |
| 4833 | |
| 4834 | func (self *PacketIn) SetData(v []byte) { |
| 4835 | self.Data = v |
| 4836 | } |
| 4837 | |
| 4838 | func (self *PacketIn) Serialize(encoder *goloxi.Encoder) error { |
| 4839 | startIndex := len(encoder.Bytes()) |
| 4840 | if err := self.Header.Serialize(encoder); err != nil { |
| 4841 | return err |
| 4842 | } |
| 4843 | |
| 4844 | encoder.PutUint32(uint32(self.BufferId)) |
| 4845 | self.InPort.Serialize(encoder) |
| 4846 | self.InPhyPort.Serialize(encoder) |
| 4847 | encoder.PutUint16(uint16(self.TotalLen)) |
| 4848 | encoder.PutUint8(uint8(self.Reason)) |
| 4849 | encoder.PutUint8(uint8(self.TableId)) |
| 4850 | encoder.Write(self.Data) |
| 4851 | length := len(encoder.Bytes()) - startIndex |
| 4852 | |
| 4853 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4854 | |
| 4855 | return nil |
| 4856 | } |
| 4857 | |
| 4858 | func DecodePacketIn(parent *Header, decoder *goloxi.Decoder) (*PacketIn, error) { |
| 4859 | _packetin := &PacketIn{Header: parent} |
| 4860 | if decoder.Length() < 16 { |
| 4861 | return nil, fmt.Errorf("PacketIn packet too short: %d < 16", decoder.Length()) |
| 4862 | } |
| 4863 | _packetin.BufferId = uint32(decoder.ReadUint32()) |
| 4864 | _packetin.InPort.Decode(decoder) |
| 4865 | _packetin.InPhyPort.Decode(decoder) |
| 4866 | _packetin.TotalLen = uint16(decoder.ReadUint16()) |
| 4867 | _packetin.Reason = uint8(decoder.ReadByte()) |
| 4868 | _packetin.TableId = uint8(decoder.ReadByte()) |
| 4869 | _packetin.Data = decoder.Read(int(decoder.Length())) |
| 4870 | return _packetin, nil |
| 4871 | } |
| 4872 | |
| 4873 | func NewPacketIn() *PacketIn { |
| 4874 | obj := &PacketIn{ |
| 4875 | Header: NewHeader(10), |
| 4876 | } |
| 4877 | return obj |
| 4878 | } |
| 4879 | |
| 4880 | type PacketOut struct { |
| 4881 | *Header |
| 4882 | BufferId uint32 |
| 4883 | InPort Port |
| 4884 | ActionsLen uint16 |
| 4885 | Actions []goloxi.IAction |
| 4886 | Data []byte |
| 4887 | } |
| 4888 | |
| 4889 | type IPacketOut interface { |
| 4890 | IHeader |
| 4891 | GetBufferId() uint32 |
| 4892 | GetInPort() Port |
| 4893 | GetActionsLen() uint16 |
| 4894 | GetActions() []goloxi.IAction |
| 4895 | GetData() []byte |
| 4896 | } |
| 4897 | |
| 4898 | func (self *PacketOut) GetBufferId() uint32 { |
| 4899 | return self.BufferId |
| 4900 | } |
| 4901 | |
| 4902 | func (self *PacketOut) SetBufferId(v uint32) { |
| 4903 | self.BufferId = v |
| 4904 | } |
| 4905 | |
| 4906 | func (self *PacketOut) GetInPort() Port { |
| 4907 | return self.InPort |
| 4908 | } |
| 4909 | |
| 4910 | func (self *PacketOut) SetInPort(v Port) { |
| 4911 | self.InPort = v |
| 4912 | } |
| 4913 | |
| 4914 | func (self *PacketOut) GetActionsLen() uint16 { |
| 4915 | return self.ActionsLen |
| 4916 | } |
| 4917 | |
| 4918 | func (self *PacketOut) SetActionsLen(v uint16) { |
| 4919 | self.ActionsLen = v |
| 4920 | } |
| 4921 | |
| 4922 | func (self *PacketOut) GetActions() []goloxi.IAction { |
| 4923 | return self.Actions |
| 4924 | } |
| 4925 | |
| 4926 | func (self *PacketOut) SetActions(v []goloxi.IAction) { |
| 4927 | self.Actions = v |
| 4928 | } |
| 4929 | |
| 4930 | func (self *PacketOut) GetData() []byte { |
| 4931 | return self.Data |
| 4932 | } |
| 4933 | |
| 4934 | func (self *PacketOut) SetData(v []byte) { |
| 4935 | self.Data = v |
| 4936 | } |
| 4937 | |
| 4938 | func (self *PacketOut) Serialize(encoder *goloxi.Encoder) error { |
| 4939 | startIndex := len(encoder.Bytes()) |
| 4940 | if err := self.Header.Serialize(encoder); err != nil { |
| 4941 | return err |
| 4942 | } |
| 4943 | |
| 4944 | encoder.PutUint32(uint32(self.BufferId)) |
| 4945 | self.InPort.Serialize(encoder) |
| 4946 | encoder.PutUint16(uint16(self.ActionsLen)) |
| 4947 | encoder.Write(bytes.Repeat([]byte{0}, 6)) |
| 4948 | for _, obj := range self.Actions { |
| 4949 | if err := obj.Serialize(encoder); err != nil { |
| 4950 | return err |
| 4951 | } |
| 4952 | } |
| 4953 | encoder.Write(self.Data) |
| 4954 | length := len(encoder.Bytes()) - startIndex |
| 4955 | |
| 4956 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4957 | |
| 4958 | return nil |
| 4959 | } |
| 4960 | |
| 4961 | func DecodePacketOut(parent *Header, decoder *goloxi.Decoder) (*PacketOut, error) { |
| 4962 | _packetout := &PacketOut{Header: parent} |
| 4963 | if decoder.Length() < 16 { |
| 4964 | return nil, fmt.Errorf("PacketOut packet too short: %d < 16", decoder.Length()) |
| 4965 | } |
| 4966 | _packetout.BufferId = uint32(decoder.ReadUint32()) |
| 4967 | _packetout.InPort.Decode(decoder) |
| 4968 | _packetout.ActionsLen = uint16(decoder.ReadUint16()) |
| 4969 | decoder.Skip(6) |
| 4970 | |
| 4971 | end := decoder.Offset() + int(_packetout.ActionsLen) |
| 4972 | for decoder.Offset() < end { |
| 4973 | item, err := DecodeAction(decoder) |
| 4974 | if err != nil { |
| 4975 | return nil, err |
| 4976 | } |
| 4977 | if item != nil { |
| 4978 | _packetout.Actions = append(_packetout.Actions, item) |
| 4979 | } |
| 4980 | } |
| 4981 | _packetout.Data = decoder.Read(int(decoder.Length())) |
| 4982 | return _packetout, nil |
| 4983 | } |
| 4984 | |
| 4985 | func NewPacketOut() *PacketOut { |
| 4986 | obj := &PacketOut{ |
| 4987 | Header: NewHeader(13), |
| 4988 | } |
| 4989 | return obj |
| 4990 | } |
| 4991 | |
| 4992 | type PortMod struct { |
| 4993 | *Header |
| 4994 | PortNo Port |
| 4995 | HwAddr net.HardwareAddr |
| 4996 | Config PortConfig |
| 4997 | Mask PortConfig |
| 4998 | Advertise uint32 |
| 4999 | } |
| 5000 | |
| 5001 | type IPortMod interface { |
| 5002 | IHeader |
| 5003 | GetPortNo() Port |
| 5004 | GetHwAddr() net.HardwareAddr |
| 5005 | GetConfig() PortConfig |
| 5006 | GetMask() PortConfig |
| 5007 | GetAdvertise() uint32 |
| 5008 | } |
| 5009 | |
| 5010 | func (self *PortMod) GetPortNo() Port { |
| 5011 | return self.PortNo |
| 5012 | } |
| 5013 | |
| 5014 | func (self *PortMod) SetPortNo(v Port) { |
| 5015 | self.PortNo = v |
| 5016 | } |
| 5017 | |
| 5018 | func (self *PortMod) GetHwAddr() net.HardwareAddr { |
| 5019 | return self.HwAddr |
| 5020 | } |
| 5021 | |
| 5022 | func (self *PortMod) SetHwAddr(v net.HardwareAddr) { |
| 5023 | self.HwAddr = v |
| 5024 | } |
| 5025 | |
| 5026 | func (self *PortMod) GetConfig() PortConfig { |
| 5027 | return self.Config |
| 5028 | } |
| 5029 | |
| 5030 | func (self *PortMod) SetConfig(v PortConfig) { |
| 5031 | self.Config = v |
| 5032 | } |
| 5033 | |
| 5034 | func (self *PortMod) GetMask() PortConfig { |
| 5035 | return self.Mask |
| 5036 | } |
| 5037 | |
| 5038 | func (self *PortMod) SetMask(v PortConfig) { |
| 5039 | self.Mask = v |
| 5040 | } |
| 5041 | |
| 5042 | func (self *PortMod) GetAdvertise() uint32 { |
| 5043 | return self.Advertise |
| 5044 | } |
| 5045 | |
| 5046 | func (self *PortMod) SetAdvertise(v uint32) { |
| 5047 | self.Advertise = v |
| 5048 | } |
| 5049 | |
| 5050 | func (self *PortMod) Serialize(encoder *goloxi.Encoder) error { |
| 5051 | startIndex := len(encoder.Bytes()) |
| 5052 | if err := self.Header.Serialize(encoder); err != nil { |
| 5053 | return err |
| 5054 | } |
| 5055 | |
| 5056 | self.PortNo.Serialize(encoder) |
| 5057 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 5058 | encoder.Write(self.HwAddr) |
| 5059 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 5060 | encoder.PutUint32(uint32(self.Config)) |
| 5061 | encoder.PutUint32(uint32(self.Mask)) |
| 5062 | encoder.PutUint32(uint32(self.Advertise)) |
| 5063 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 5064 | length := len(encoder.Bytes()) - startIndex |
| 5065 | |
| 5066 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5067 | |
| 5068 | return nil |
| 5069 | } |
| 5070 | |
| 5071 | func DecodePortMod(parent *Header, decoder *goloxi.Decoder) (*PortMod, error) { |
| 5072 | _portmod := &PortMod{Header: parent} |
| 5073 | if decoder.Length() < 32 { |
| 5074 | return nil, fmt.Errorf("PortMod packet too short: %d < 32", decoder.Length()) |
| 5075 | } |
| 5076 | _portmod.PortNo.Decode(decoder) |
| 5077 | decoder.Skip(4) |
| 5078 | _portmod.HwAddr = net.HardwareAddr(decoder.Read(6)) |
| 5079 | decoder.Skip(2) |
| 5080 | _portmod.Config = PortConfig(decoder.ReadUint32()) |
| 5081 | _portmod.Mask = PortConfig(decoder.ReadUint32()) |
| 5082 | _portmod.Advertise = uint32(decoder.ReadUint32()) |
| 5083 | decoder.Skip(4) |
| 5084 | return _portmod, nil |
| 5085 | } |
| 5086 | |
| 5087 | func NewPortMod() *PortMod { |
| 5088 | obj := &PortMod{ |
| 5089 | Header: NewHeader(16), |
| 5090 | } |
| 5091 | return obj |
| 5092 | } |
| 5093 | |
| 5094 | type PortModFailedErrorMsg struct { |
| 5095 | *ErrorMsg |
| 5096 | Code PortModFailedCode |
| 5097 | Data []byte |
| 5098 | } |
| 5099 | |
| 5100 | type IPortModFailedErrorMsg interface { |
| 5101 | IErrorMsg |
| 5102 | GetCode() PortModFailedCode |
| 5103 | GetData() []byte |
| 5104 | } |
| 5105 | |
| 5106 | func (self *PortModFailedErrorMsg) GetCode() PortModFailedCode { |
| 5107 | return self.Code |
| 5108 | } |
| 5109 | |
| 5110 | func (self *PortModFailedErrorMsg) SetCode(v PortModFailedCode) { |
| 5111 | self.Code = v |
| 5112 | } |
| 5113 | |
| 5114 | func (self *PortModFailedErrorMsg) GetData() []byte { |
| 5115 | return self.Data |
| 5116 | } |
| 5117 | |
| 5118 | func (self *PortModFailedErrorMsg) SetData(v []byte) { |
| 5119 | self.Data = v |
| 5120 | } |
| 5121 | |
| 5122 | func (self *PortModFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 5123 | startIndex := len(encoder.Bytes()) |
| 5124 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 5125 | return err |
| 5126 | } |
| 5127 | |
| 5128 | encoder.PutUint16(uint16(self.Code)) |
| 5129 | encoder.Write(self.Data) |
| 5130 | length := len(encoder.Bytes()) - startIndex |
| 5131 | |
| 5132 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5133 | |
| 5134 | return nil |
| 5135 | } |
| 5136 | |
| 5137 | func DecodePortModFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*PortModFailedErrorMsg, error) { |
| 5138 | _portmodfailederrormsg := &PortModFailedErrorMsg{ErrorMsg: parent} |
| 5139 | if decoder.Length() < 2 { |
| 5140 | return nil, fmt.Errorf("PortModFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 5141 | } |
| 5142 | _portmodfailederrormsg.Code = PortModFailedCode(decoder.ReadUint16()) |
| 5143 | _portmodfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 5144 | return _portmodfailederrormsg, nil |
| 5145 | } |
| 5146 | |
| 5147 | func NewPortModFailedErrorMsg() *PortModFailedErrorMsg { |
| 5148 | obj := &PortModFailedErrorMsg{ |
| 5149 | ErrorMsg: NewErrorMsg(7), |
| 5150 | } |
| 5151 | return obj |
| 5152 | } |
| 5153 | |
| 5154 | type PortStatsReply struct { |
| 5155 | *StatsReply |
| 5156 | Entries []*PortStatsEntry |
| 5157 | } |
| 5158 | |
| 5159 | type IPortStatsReply interface { |
| 5160 | IStatsReply |
| 5161 | GetEntries() []*PortStatsEntry |
| 5162 | } |
| 5163 | |
| 5164 | func (self *PortStatsReply) GetEntries() []*PortStatsEntry { |
| 5165 | return self.Entries |
| 5166 | } |
| 5167 | |
| 5168 | func (self *PortStatsReply) SetEntries(v []*PortStatsEntry) { |
| 5169 | self.Entries = v |
| 5170 | } |
| 5171 | |
| 5172 | func (self *PortStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 5173 | startIndex := len(encoder.Bytes()) |
| 5174 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 5175 | return err |
| 5176 | } |
| 5177 | |
| 5178 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 5179 | for _, obj := range self.Entries { |
| 5180 | if err := obj.Serialize(encoder); err != nil { |
| 5181 | return err |
| 5182 | } |
| 5183 | } |
| 5184 | length := len(encoder.Bytes()) - startIndex |
| 5185 | |
| 5186 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5187 | |
| 5188 | return nil |
| 5189 | } |
| 5190 | |
| 5191 | func DecodePortStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*PortStatsReply, error) { |
| 5192 | _portstatsreply := &PortStatsReply{StatsReply: parent} |
| 5193 | if decoder.Length() < 4 { |
| 5194 | return nil, fmt.Errorf("PortStatsReply packet too short: %d < 4", decoder.Length()) |
| 5195 | } |
| 5196 | decoder.Skip(4) |
| 5197 | |
| 5198 | for decoder.Length() >= 104 { |
| 5199 | item, err := DecodePortStatsEntry(decoder) |
| 5200 | if err != nil { |
| 5201 | return nil, err |
| 5202 | } |
| 5203 | if item != nil { |
| 5204 | _portstatsreply.Entries = append(_portstatsreply.Entries, item) |
| 5205 | } |
| 5206 | } |
| 5207 | return _portstatsreply, nil |
| 5208 | } |
| 5209 | |
| 5210 | func NewPortStatsReply() *PortStatsReply { |
| 5211 | obj := &PortStatsReply{ |
| 5212 | StatsReply: NewStatsReply(4), |
| 5213 | } |
| 5214 | return obj |
| 5215 | } |
| 5216 | |
| 5217 | type PortStatsRequest struct { |
| 5218 | *StatsRequest |
| 5219 | PortNo Port |
| 5220 | } |
| 5221 | |
| 5222 | type IPortStatsRequest interface { |
| 5223 | IStatsRequest |
| 5224 | GetPortNo() Port |
| 5225 | } |
| 5226 | |
| 5227 | func (self *PortStatsRequest) GetPortNo() Port { |
| 5228 | return self.PortNo |
| 5229 | } |
| 5230 | |
| 5231 | func (self *PortStatsRequest) SetPortNo(v Port) { |
| 5232 | self.PortNo = v |
| 5233 | } |
| 5234 | |
| 5235 | func (self *PortStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 5236 | startIndex := len(encoder.Bytes()) |
| 5237 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 5238 | return err |
| 5239 | } |
| 5240 | |
| 5241 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 5242 | self.PortNo.Serialize(encoder) |
| 5243 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 5244 | length := len(encoder.Bytes()) - startIndex |
| 5245 | |
| 5246 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5247 | |
| 5248 | return nil |
| 5249 | } |
| 5250 | |
| 5251 | func DecodePortStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*PortStatsRequest, error) { |
| 5252 | _portstatsrequest := &PortStatsRequest{StatsRequest: parent} |
| 5253 | if decoder.Length() < 4 { |
| 5254 | return nil, fmt.Errorf("PortStatsRequest packet too short: %d < 4", decoder.Length()) |
| 5255 | } |
| 5256 | decoder.Skip(4) |
| 5257 | _portstatsrequest.PortNo.Decode(decoder) |
| 5258 | decoder.Skip(4) |
| 5259 | return _portstatsrequest, nil |
| 5260 | } |
| 5261 | |
| 5262 | func NewPortStatsRequest() *PortStatsRequest { |
| 5263 | obj := &PortStatsRequest{ |
| 5264 | StatsRequest: NewStatsRequest(4), |
| 5265 | } |
| 5266 | return obj |
| 5267 | } |
| 5268 | |
| 5269 | type PortStatus struct { |
| 5270 | *Header |
| 5271 | Reason PortReason |
| 5272 | Desc PortDesc |
| 5273 | } |
| 5274 | |
| 5275 | type IPortStatus interface { |
| 5276 | IHeader |
| 5277 | GetReason() PortReason |
| 5278 | GetDesc() PortDesc |
| 5279 | } |
| 5280 | |
| 5281 | func (self *PortStatus) GetReason() PortReason { |
| 5282 | return self.Reason |
| 5283 | } |
| 5284 | |
| 5285 | func (self *PortStatus) SetReason(v PortReason) { |
| 5286 | self.Reason = v |
| 5287 | } |
| 5288 | |
| 5289 | func (self *PortStatus) GetDesc() PortDesc { |
| 5290 | return self.Desc |
| 5291 | } |
| 5292 | |
| 5293 | func (self *PortStatus) SetDesc(v PortDesc) { |
| 5294 | self.Desc = v |
| 5295 | } |
| 5296 | |
| 5297 | func (self *PortStatus) Serialize(encoder *goloxi.Encoder) error { |
| 5298 | startIndex := len(encoder.Bytes()) |
| 5299 | if err := self.Header.Serialize(encoder); err != nil { |
| 5300 | return err |
| 5301 | } |
| 5302 | |
| 5303 | encoder.PutUint8(uint8(self.Reason)) |
| 5304 | encoder.Write(bytes.Repeat([]byte{0}, 7)) |
| 5305 | if err := self.Desc.Serialize(encoder); err != nil { |
| 5306 | return err |
| 5307 | } |
| 5308 | |
| 5309 | length := len(encoder.Bytes()) - startIndex |
| 5310 | |
| 5311 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5312 | |
| 5313 | return nil |
| 5314 | } |
| 5315 | |
| 5316 | func DecodePortStatus(parent *Header, decoder *goloxi.Decoder) (*PortStatus, error) { |
| 5317 | _portstatus := &PortStatus{Header: parent} |
| 5318 | if decoder.Length() < 72 { |
| 5319 | return nil, fmt.Errorf("PortStatus packet too short: %d < 72", decoder.Length()) |
| 5320 | } |
| 5321 | _portstatus.Reason = PortReason(decoder.ReadByte()) |
| 5322 | decoder.Skip(7) |
| 5323 | if err := _portstatus.Desc.Decode(decoder); err != nil { |
| 5324 | return nil, err |
| 5325 | } |
| 5326 | |
| 5327 | return _portstatus, nil |
| 5328 | } |
| 5329 | |
| 5330 | func NewPortStatus() *PortStatus { |
| 5331 | obj := &PortStatus{ |
| 5332 | Header: NewHeader(12), |
| 5333 | } |
| 5334 | return obj |
| 5335 | } |
| 5336 | |
| 5337 | type QueueGetConfigReply struct { |
| 5338 | *Header |
| 5339 | Port Port |
| 5340 | Queues []*PacketQueue |
| 5341 | } |
| 5342 | |
| 5343 | type IQueueGetConfigReply interface { |
| 5344 | IHeader |
| 5345 | GetPort() Port |
| 5346 | GetQueues() []*PacketQueue |
| 5347 | } |
| 5348 | |
| 5349 | func (self *QueueGetConfigReply) GetPort() Port { |
| 5350 | return self.Port |
| 5351 | } |
| 5352 | |
| 5353 | func (self *QueueGetConfigReply) SetPort(v Port) { |
| 5354 | self.Port = v |
| 5355 | } |
| 5356 | |
| 5357 | func (self *QueueGetConfigReply) GetQueues() []*PacketQueue { |
| 5358 | return self.Queues |
| 5359 | } |
| 5360 | |
| 5361 | func (self *QueueGetConfigReply) SetQueues(v []*PacketQueue) { |
| 5362 | self.Queues = v |
| 5363 | } |
| 5364 | |
| 5365 | func (self *QueueGetConfigReply) Serialize(encoder *goloxi.Encoder) error { |
| 5366 | startIndex := len(encoder.Bytes()) |
| 5367 | if err := self.Header.Serialize(encoder); err != nil { |
| 5368 | return err |
| 5369 | } |
| 5370 | |
| 5371 | self.Port.Serialize(encoder) |
| 5372 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 5373 | for _, obj := range self.Queues { |
| 5374 | if err := obj.Serialize(encoder); err != nil { |
| 5375 | return err |
| 5376 | } |
| 5377 | } |
| 5378 | length := len(encoder.Bytes()) - startIndex |
| 5379 | |
| 5380 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5381 | |
| 5382 | return nil |
| 5383 | } |
| 5384 | |
| 5385 | func DecodeQueueGetConfigReply(parent *Header, decoder *goloxi.Decoder) (*QueueGetConfigReply, error) { |
| 5386 | _queuegetconfigreply := &QueueGetConfigReply{Header: parent} |
| 5387 | if decoder.Length() < 8 { |
| 5388 | return nil, fmt.Errorf("QueueGetConfigReply packet too short: %d < 8", decoder.Length()) |
| 5389 | } |
| 5390 | _queuegetconfigreply.Port.Decode(decoder) |
| 5391 | decoder.Skip(4) |
| 5392 | |
| 5393 | for decoder.Length() >= 8 { |
| 5394 | item, err := DecodePacketQueue(decoder) |
| 5395 | if err != nil { |
| 5396 | return nil, err |
| 5397 | } |
| 5398 | if item != nil { |
| 5399 | _queuegetconfigreply.Queues = append(_queuegetconfigreply.Queues, item) |
| 5400 | } |
| 5401 | } |
| 5402 | return _queuegetconfigreply, nil |
| 5403 | } |
| 5404 | |
| 5405 | func NewQueueGetConfigReply() *QueueGetConfigReply { |
| 5406 | obj := &QueueGetConfigReply{ |
| 5407 | Header: NewHeader(23), |
| 5408 | } |
| 5409 | return obj |
| 5410 | } |
| 5411 | |
| 5412 | type QueueGetConfigRequest struct { |
| 5413 | *Header |
| 5414 | Port Port |
| 5415 | } |
| 5416 | |
| 5417 | type IQueueGetConfigRequest interface { |
| 5418 | IHeader |
| 5419 | GetPort() Port |
| 5420 | } |
| 5421 | |
| 5422 | func (self *QueueGetConfigRequest) GetPort() Port { |
| 5423 | return self.Port |
| 5424 | } |
| 5425 | |
| 5426 | func (self *QueueGetConfigRequest) SetPort(v Port) { |
| 5427 | self.Port = v |
| 5428 | } |
| 5429 | |
| 5430 | func (self *QueueGetConfigRequest) Serialize(encoder *goloxi.Encoder) error { |
| 5431 | startIndex := len(encoder.Bytes()) |
| 5432 | if err := self.Header.Serialize(encoder); err != nil { |
| 5433 | return err |
| 5434 | } |
| 5435 | |
| 5436 | self.Port.Serialize(encoder) |
| 5437 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 5438 | length := len(encoder.Bytes()) - startIndex |
| 5439 | |
| 5440 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5441 | |
| 5442 | return nil |
| 5443 | } |
| 5444 | |
| 5445 | func DecodeQueueGetConfigRequest(parent *Header, decoder *goloxi.Decoder) (*QueueGetConfigRequest, error) { |
| 5446 | _queuegetconfigrequest := &QueueGetConfigRequest{Header: parent} |
| 5447 | if decoder.Length() < 8 { |
| 5448 | return nil, fmt.Errorf("QueueGetConfigRequest packet too short: %d < 8", decoder.Length()) |
| 5449 | } |
| 5450 | _queuegetconfigrequest.Port.Decode(decoder) |
| 5451 | decoder.Skip(4) |
| 5452 | return _queuegetconfigrequest, nil |
| 5453 | } |
| 5454 | |
| 5455 | func NewQueueGetConfigRequest() *QueueGetConfigRequest { |
| 5456 | obj := &QueueGetConfigRequest{ |
| 5457 | Header: NewHeader(22), |
| 5458 | } |
| 5459 | return obj |
| 5460 | } |
| 5461 | |
| 5462 | type QueueOpFailedErrorMsg struct { |
| 5463 | *ErrorMsg |
| 5464 | Code QueueOpFailedCode |
| 5465 | Data []byte |
| 5466 | } |
| 5467 | |
| 5468 | type IQueueOpFailedErrorMsg interface { |
| 5469 | IErrorMsg |
| 5470 | GetCode() QueueOpFailedCode |
| 5471 | GetData() []byte |
| 5472 | } |
| 5473 | |
| 5474 | func (self *QueueOpFailedErrorMsg) GetCode() QueueOpFailedCode { |
| 5475 | return self.Code |
| 5476 | } |
| 5477 | |
| 5478 | func (self *QueueOpFailedErrorMsg) SetCode(v QueueOpFailedCode) { |
| 5479 | self.Code = v |
| 5480 | } |
| 5481 | |
| 5482 | func (self *QueueOpFailedErrorMsg) GetData() []byte { |
| 5483 | return self.Data |
| 5484 | } |
| 5485 | |
| 5486 | func (self *QueueOpFailedErrorMsg) SetData(v []byte) { |
| 5487 | self.Data = v |
| 5488 | } |
| 5489 | |
| 5490 | func (self *QueueOpFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 5491 | startIndex := len(encoder.Bytes()) |
| 5492 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 5493 | return err |
| 5494 | } |
| 5495 | |
| 5496 | encoder.PutUint16(uint16(self.Code)) |
| 5497 | encoder.Write(self.Data) |
| 5498 | length := len(encoder.Bytes()) - startIndex |
| 5499 | |
| 5500 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5501 | |
| 5502 | return nil |
| 5503 | } |
| 5504 | |
| 5505 | func DecodeQueueOpFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*QueueOpFailedErrorMsg, error) { |
| 5506 | _queueopfailederrormsg := &QueueOpFailedErrorMsg{ErrorMsg: parent} |
| 5507 | if decoder.Length() < 2 { |
| 5508 | return nil, fmt.Errorf("QueueOpFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 5509 | } |
| 5510 | _queueopfailederrormsg.Code = QueueOpFailedCode(decoder.ReadUint16()) |
| 5511 | _queueopfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 5512 | return _queueopfailederrormsg, nil |
| 5513 | } |
| 5514 | |
| 5515 | func NewQueueOpFailedErrorMsg() *QueueOpFailedErrorMsg { |
| 5516 | obj := &QueueOpFailedErrorMsg{ |
| 5517 | ErrorMsg: NewErrorMsg(9), |
| 5518 | } |
| 5519 | return obj |
| 5520 | } |
| 5521 | |
| 5522 | type QueueStatsReply struct { |
| 5523 | *StatsReply |
| 5524 | Entries []*QueueStatsEntry |
| 5525 | } |
| 5526 | |
| 5527 | type IQueueStatsReply interface { |
| 5528 | IStatsReply |
| 5529 | GetEntries() []*QueueStatsEntry |
| 5530 | } |
| 5531 | |
| 5532 | func (self *QueueStatsReply) GetEntries() []*QueueStatsEntry { |
| 5533 | return self.Entries |
| 5534 | } |
| 5535 | |
| 5536 | func (self *QueueStatsReply) SetEntries(v []*QueueStatsEntry) { |
| 5537 | self.Entries = v |
| 5538 | } |
| 5539 | |
| 5540 | func (self *QueueStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 5541 | startIndex := len(encoder.Bytes()) |
| 5542 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 5543 | return err |
| 5544 | } |
| 5545 | |
| 5546 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 5547 | for _, obj := range self.Entries { |
| 5548 | if err := obj.Serialize(encoder); err != nil { |
| 5549 | return err |
| 5550 | } |
| 5551 | } |
| 5552 | length := len(encoder.Bytes()) - startIndex |
| 5553 | |
| 5554 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5555 | |
| 5556 | return nil |
| 5557 | } |
| 5558 | |
| 5559 | func DecodeQueueStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*QueueStatsReply, error) { |
| 5560 | _queuestatsreply := &QueueStatsReply{StatsReply: parent} |
| 5561 | if decoder.Length() < 4 { |
| 5562 | return nil, fmt.Errorf("QueueStatsReply packet too short: %d < 4", decoder.Length()) |
| 5563 | } |
| 5564 | decoder.Skip(4) |
| 5565 | |
| 5566 | for decoder.Length() >= 32 { |
| 5567 | item, err := DecodeQueueStatsEntry(decoder) |
| 5568 | if err != nil { |
| 5569 | return nil, err |
| 5570 | } |
| 5571 | if item != nil { |
| 5572 | _queuestatsreply.Entries = append(_queuestatsreply.Entries, item) |
| 5573 | } |
| 5574 | } |
| 5575 | return _queuestatsreply, nil |
| 5576 | } |
| 5577 | |
| 5578 | func NewQueueStatsReply() *QueueStatsReply { |
| 5579 | obj := &QueueStatsReply{ |
| 5580 | StatsReply: NewStatsReply(5), |
| 5581 | } |
| 5582 | return obj |
| 5583 | } |
| 5584 | |
| 5585 | type QueueStatsRequest struct { |
| 5586 | *StatsRequest |
| 5587 | PortNo Port |
| 5588 | QueueId uint32 |
| 5589 | } |
| 5590 | |
| 5591 | type IQueueStatsRequest interface { |
| 5592 | IStatsRequest |
| 5593 | GetPortNo() Port |
| 5594 | GetQueueId() uint32 |
| 5595 | } |
| 5596 | |
| 5597 | func (self *QueueStatsRequest) GetPortNo() Port { |
| 5598 | return self.PortNo |
| 5599 | } |
| 5600 | |
| 5601 | func (self *QueueStatsRequest) SetPortNo(v Port) { |
| 5602 | self.PortNo = v |
| 5603 | } |
| 5604 | |
| 5605 | func (self *QueueStatsRequest) GetQueueId() uint32 { |
| 5606 | return self.QueueId |
| 5607 | } |
| 5608 | |
| 5609 | func (self *QueueStatsRequest) SetQueueId(v uint32) { |
| 5610 | self.QueueId = v |
| 5611 | } |
| 5612 | |
| 5613 | func (self *QueueStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 5614 | startIndex := len(encoder.Bytes()) |
| 5615 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 5616 | return err |
| 5617 | } |
| 5618 | |
| 5619 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 5620 | self.PortNo.Serialize(encoder) |
| 5621 | encoder.PutUint32(uint32(self.QueueId)) |
| 5622 | length := len(encoder.Bytes()) - startIndex |
| 5623 | |
| 5624 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5625 | |
| 5626 | return nil |
| 5627 | } |
| 5628 | |
| 5629 | func DecodeQueueStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*QueueStatsRequest, error) { |
| 5630 | _queuestatsrequest := &QueueStatsRequest{StatsRequest: parent} |
| 5631 | if decoder.Length() < 12 { |
| 5632 | return nil, fmt.Errorf("QueueStatsRequest packet too short: %d < 12", decoder.Length()) |
| 5633 | } |
| 5634 | decoder.Skip(4) |
| 5635 | _queuestatsrequest.PortNo.Decode(decoder) |
| 5636 | _queuestatsrequest.QueueId = uint32(decoder.ReadUint32()) |
| 5637 | return _queuestatsrequest, nil |
| 5638 | } |
| 5639 | |
| 5640 | func NewQueueStatsRequest() *QueueStatsRequest { |
| 5641 | obj := &QueueStatsRequest{ |
| 5642 | StatsRequest: NewStatsRequest(5), |
| 5643 | } |
| 5644 | return obj |
| 5645 | } |
| 5646 | |
| 5647 | type SetConfig struct { |
| 5648 | *Header |
| 5649 | Flags ConfigFlags |
| 5650 | MissSendLen uint16 |
| 5651 | } |
| 5652 | |
| 5653 | type ISetConfig interface { |
| 5654 | IHeader |
| 5655 | GetFlags() ConfigFlags |
| 5656 | GetMissSendLen() uint16 |
| 5657 | } |
| 5658 | |
| 5659 | func (self *SetConfig) GetFlags() ConfigFlags { |
| 5660 | return self.Flags |
| 5661 | } |
| 5662 | |
| 5663 | func (self *SetConfig) SetFlags(v ConfigFlags) { |
| 5664 | self.Flags = v |
| 5665 | } |
| 5666 | |
| 5667 | func (self *SetConfig) GetMissSendLen() uint16 { |
| 5668 | return self.MissSendLen |
| 5669 | } |
| 5670 | |
| 5671 | func (self *SetConfig) SetMissSendLen(v uint16) { |
| 5672 | self.MissSendLen = v |
| 5673 | } |
| 5674 | |
| 5675 | func (self *SetConfig) Serialize(encoder *goloxi.Encoder) error { |
| 5676 | startIndex := len(encoder.Bytes()) |
| 5677 | if err := self.Header.Serialize(encoder); err != nil { |
| 5678 | return err |
| 5679 | } |
| 5680 | |
| 5681 | encoder.PutUint16(uint16(self.Flags)) |
| 5682 | encoder.PutUint16(uint16(self.MissSendLen)) |
| 5683 | length := len(encoder.Bytes()) - startIndex |
| 5684 | |
| 5685 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5686 | |
| 5687 | return nil |
| 5688 | } |
| 5689 | |
| 5690 | func DecodeSetConfig(parent *Header, decoder *goloxi.Decoder) (*SetConfig, error) { |
| 5691 | _setconfig := &SetConfig{Header: parent} |
| 5692 | if decoder.Length() < 4 { |
| 5693 | return nil, fmt.Errorf("SetConfig packet too short: %d < 4", decoder.Length()) |
| 5694 | } |
| 5695 | _setconfig.Flags = ConfigFlags(decoder.ReadUint16()) |
| 5696 | _setconfig.MissSendLen = uint16(decoder.ReadUint16()) |
| 5697 | return _setconfig, nil |
| 5698 | } |
| 5699 | |
| 5700 | func NewSetConfig() *SetConfig { |
| 5701 | obj := &SetConfig{ |
| 5702 | Header: NewHeader(9), |
| 5703 | } |
| 5704 | return obj |
| 5705 | } |
| 5706 | |
| 5707 | type SwitchConfigFailedErrorMsg struct { |
| 5708 | *ErrorMsg |
| 5709 | Code SwitchConfigFailedCode |
| 5710 | Data []byte |
| 5711 | } |
| 5712 | |
| 5713 | type ISwitchConfigFailedErrorMsg interface { |
| 5714 | IErrorMsg |
| 5715 | GetCode() SwitchConfigFailedCode |
| 5716 | GetData() []byte |
| 5717 | } |
| 5718 | |
| 5719 | func (self *SwitchConfigFailedErrorMsg) GetCode() SwitchConfigFailedCode { |
| 5720 | return self.Code |
| 5721 | } |
| 5722 | |
| 5723 | func (self *SwitchConfigFailedErrorMsg) SetCode(v SwitchConfigFailedCode) { |
| 5724 | self.Code = v |
| 5725 | } |
| 5726 | |
| 5727 | func (self *SwitchConfigFailedErrorMsg) GetData() []byte { |
| 5728 | return self.Data |
| 5729 | } |
| 5730 | |
| 5731 | func (self *SwitchConfigFailedErrorMsg) SetData(v []byte) { |
| 5732 | self.Data = v |
| 5733 | } |
| 5734 | |
| 5735 | func (self *SwitchConfigFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 5736 | startIndex := len(encoder.Bytes()) |
| 5737 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 5738 | return err |
| 5739 | } |
| 5740 | |
| 5741 | encoder.PutUint16(uint16(self.Code)) |
| 5742 | encoder.Write(self.Data) |
| 5743 | length := len(encoder.Bytes()) - startIndex |
| 5744 | |
| 5745 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5746 | |
| 5747 | return nil |
| 5748 | } |
| 5749 | |
| 5750 | func DecodeSwitchConfigFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*SwitchConfigFailedErrorMsg, error) { |
| 5751 | _switchconfigfailederrormsg := &SwitchConfigFailedErrorMsg{ErrorMsg: parent} |
| 5752 | if decoder.Length() < 2 { |
| 5753 | return nil, fmt.Errorf("SwitchConfigFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 5754 | } |
| 5755 | _switchconfigfailederrormsg.Code = SwitchConfigFailedCode(decoder.ReadUint16()) |
| 5756 | _switchconfigfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 5757 | return _switchconfigfailederrormsg, nil |
| 5758 | } |
| 5759 | |
| 5760 | func NewSwitchConfigFailedErrorMsg() *SwitchConfigFailedErrorMsg { |
| 5761 | obj := &SwitchConfigFailedErrorMsg{ |
| 5762 | ErrorMsg: NewErrorMsg(10), |
| 5763 | } |
| 5764 | return obj |
| 5765 | } |
| 5766 | |
| 5767 | type TableMod struct { |
| 5768 | *Header |
| 5769 | TableId uint8 |
| 5770 | Config uint32 |
| 5771 | } |
| 5772 | |
| 5773 | type ITableMod interface { |
| 5774 | IHeader |
| 5775 | GetTableId() uint8 |
| 5776 | GetConfig() uint32 |
| 5777 | } |
| 5778 | |
| 5779 | func (self *TableMod) GetTableId() uint8 { |
| 5780 | return self.TableId |
| 5781 | } |
| 5782 | |
| 5783 | func (self *TableMod) SetTableId(v uint8) { |
| 5784 | self.TableId = v |
| 5785 | } |
| 5786 | |
| 5787 | func (self *TableMod) GetConfig() uint32 { |
| 5788 | return self.Config |
| 5789 | } |
| 5790 | |
| 5791 | func (self *TableMod) SetConfig(v uint32) { |
| 5792 | self.Config = v |
| 5793 | } |
| 5794 | |
| 5795 | func (self *TableMod) Serialize(encoder *goloxi.Encoder) error { |
| 5796 | startIndex := len(encoder.Bytes()) |
| 5797 | if err := self.Header.Serialize(encoder); err != nil { |
| 5798 | return err |
| 5799 | } |
| 5800 | |
| 5801 | encoder.PutUint8(uint8(self.TableId)) |
| 5802 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 5803 | encoder.PutUint32(uint32(self.Config)) |
| 5804 | length := len(encoder.Bytes()) - startIndex |
| 5805 | |
| 5806 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5807 | |
| 5808 | return nil |
| 5809 | } |
| 5810 | |
| 5811 | func DecodeTableMod(parent *Header, decoder *goloxi.Decoder) (*TableMod, error) { |
| 5812 | _tablemod := &TableMod{Header: parent} |
| 5813 | if decoder.Length() < 8 { |
| 5814 | return nil, fmt.Errorf("TableMod packet too short: %d < 8", decoder.Length()) |
| 5815 | } |
| 5816 | _tablemod.TableId = uint8(decoder.ReadByte()) |
| 5817 | decoder.Skip(3) |
| 5818 | _tablemod.Config = uint32(decoder.ReadUint32()) |
| 5819 | return _tablemod, nil |
| 5820 | } |
| 5821 | |
| 5822 | func NewTableMod() *TableMod { |
| 5823 | obj := &TableMod{ |
| 5824 | Header: NewHeader(17), |
| 5825 | } |
| 5826 | return obj |
| 5827 | } |
| 5828 | |
| 5829 | type TableModFailedErrorMsg struct { |
| 5830 | *ErrorMsg |
| 5831 | Code TableModFailedCode |
| 5832 | Data []byte |
| 5833 | } |
| 5834 | |
| 5835 | type ITableModFailedErrorMsg interface { |
| 5836 | IErrorMsg |
| 5837 | GetCode() TableModFailedCode |
| 5838 | GetData() []byte |
| 5839 | } |
| 5840 | |
| 5841 | func (self *TableModFailedErrorMsg) GetCode() TableModFailedCode { |
| 5842 | return self.Code |
| 5843 | } |
| 5844 | |
| 5845 | func (self *TableModFailedErrorMsg) SetCode(v TableModFailedCode) { |
| 5846 | self.Code = v |
| 5847 | } |
| 5848 | |
| 5849 | func (self *TableModFailedErrorMsg) GetData() []byte { |
| 5850 | return self.Data |
| 5851 | } |
| 5852 | |
| 5853 | func (self *TableModFailedErrorMsg) SetData(v []byte) { |
| 5854 | self.Data = v |
| 5855 | } |
| 5856 | |
| 5857 | func (self *TableModFailedErrorMsg) Serialize(encoder *goloxi.Encoder) error { |
| 5858 | startIndex := len(encoder.Bytes()) |
| 5859 | if err := self.ErrorMsg.Serialize(encoder); err != nil { |
| 5860 | return err |
| 5861 | } |
| 5862 | |
| 5863 | encoder.PutUint16(uint16(self.Code)) |
| 5864 | encoder.Write(self.Data) |
| 5865 | length := len(encoder.Bytes()) - startIndex |
| 5866 | |
| 5867 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5868 | |
| 5869 | return nil |
| 5870 | } |
| 5871 | |
| 5872 | func DecodeTableModFailedErrorMsg(parent *ErrorMsg, decoder *goloxi.Decoder) (*TableModFailedErrorMsg, error) { |
| 5873 | _tablemodfailederrormsg := &TableModFailedErrorMsg{ErrorMsg: parent} |
| 5874 | if decoder.Length() < 2 { |
| 5875 | return nil, fmt.Errorf("TableModFailedErrorMsg packet too short: %d < 2", decoder.Length()) |
| 5876 | } |
| 5877 | _tablemodfailederrormsg.Code = TableModFailedCode(decoder.ReadUint16()) |
| 5878 | _tablemodfailederrormsg.Data = decoder.Read(int(decoder.Length())) |
| 5879 | return _tablemodfailederrormsg, nil |
| 5880 | } |
| 5881 | |
| 5882 | func NewTableModFailedErrorMsg() *TableModFailedErrorMsg { |
| 5883 | obj := &TableModFailedErrorMsg{ |
| 5884 | ErrorMsg: NewErrorMsg(8), |
| 5885 | } |
| 5886 | return obj |
| 5887 | } |
| 5888 | |
| 5889 | type TableStatsReply struct { |
| 5890 | *StatsReply |
| 5891 | Entries []*TableStatsEntry |
| 5892 | } |
| 5893 | |
| 5894 | type ITableStatsReply interface { |
| 5895 | IStatsReply |
| 5896 | GetEntries() []*TableStatsEntry |
| 5897 | } |
| 5898 | |
| 5899 | func (self *TableStatsReply) GetEntries() []*TableStatsEntry { |
| 5900 | return self.Entries |
| 5901 | } |
| 5902 | |
| 5903 | func (self *TableStatsReply) SetEntries(v []*TableStatsEntry) { |
| 5904 | self.Entries = v |
| 5905 | } |
| 5906 | |
| 5907 | func (self *TableStatsReply) Serialize(encoder *goloxi.Encoder) error { |
| 5908 | startIndex := len(encoder.Bytes()) |
| 5909 | if err := self.StatsReply.Serialize(encoder); err != nil { |
| 5910 | return err |
| 5911 | } |
| 5912 | |
| 5913 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 5914 | for _, obj := range self.Entries { |
| 5915 | if err := obj.Serialize(encoder); err != nil { |
| 5916 | return err |
| 5917 | } |
| 5918 | } |
| 5919 | length := len(encoder.Bytes()) - startIndex |
| 5920 | |
| 5921 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5922 | |
| 5923 | return nil |
| 5924 | } |
| 5925 | |
| 5926 | func DecodeTableStatsReply(parent *StatsReply, decoder *goloxi.Decoder) (*TableStatsReply, error) { |
| 5927 | _tablestatsreply := &TableStatsReply{StatsReply: parent} |
| 5928 | if decoder.Length() < 4 { |
| 5929 | return nil, fmt.Errorf("TableStatsReply packet too short: %d < 4", decoder.Length()) |
| 5930 | } |
| 5931 | decoder.Skip(4) |
| 5932 | |
| 5933 | for decoder.Length() >= 88 { |
| 5934 | item, err := DecodeTableStatsEntry(decoder) |
| 5935 | if err != nil { |
| 5936 | return nil, err |
| 5937 | } |
| 5938 | if item != nil { |
| 5939 | _tablestatsreply.Entries = append(_tablestatsreply.Entries, item) |
| 5940 | } |
| 5941 | } |
| 5942 | return _tablestatsreply, nil |
| 5943 | } |
| 5944 | |
| 5945 | func NewTableStatsReply() *TableStatsReply { |
| 5946 | obj := &TableStatsReply{ |
| 5947 | StatsReply: NewStatsReply(3), |
| 5948 | } |
| 5949 | return obj |
| 5950 | } |
| 5951 | |
| 5952 | type TableStatsRequest struct { |
| 5953 | *StatsRequest |
| 5954 | } |
| 5955 | |
| 5956 | type ITableStatsRequest interface { |
| 5957 | IStatsRequest |
| 5958 | } |
| 5959 | |
| 5960 | func (self *TableStatsRequest) Serialize(encoder *goloxi.Encoder) error { |
| 5961 | startIndex := len(encoder.Bytes()) |
| 5962 | if err := self.StatsRequest.Serialize(encoder); err != nil { |
| 5963 | return err |
| 5964 | } |
| 5965 | |
| 5966 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 5967 | length := len(encoder.Bytes()) - startIndex |
| 5968 | |
| 5969 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5970 | |
| 5971 | return nil |
| 5972 | } |
| 5973 | |
| 5974 | func DecodeTableStatsRequest(parent *StatsRequest, decoder *goloxi.Decoder) (*TableStatsRequest, error) { |
| 5975 | _tablestatsrequest := &TableStatsRequest{StatsRequest: parent} |
| 5976 | if decoder.Length() < 4 { |
| 5977 | return nil, fmt.Errorf("TableStatsRequest packet too short: %d < 4", decoder.Length()) |
| 5978 | } |
| 5979 | decoder.Skip(4) |
| 5980 | return _tablestatsrequest, nil |
| 5981 | } |
| 5982 | |
| 5983 | func NewTableStatsRequest() *TableStatsRequest { |
| 5984 | obj := &TableStatsRequest{ |
| 5985 | StatsRequest: NewStatsRequest(3), |
| 5986 | } |
| 5987 | return obj |
| 5988 | } |