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