blob: 28dc5fc0c0f90873356901796f4e98ddbaa3d251 [file] [log] [blame]
Don Newton98fd8812019-09-23 15:15:02 -04001/*
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 of13
11
12import (
13 "bytes"
14 "encoding/binary"
15 "fmt"
16
Jonathan Hart828908c2020-04-15 14:23:45 -070017 "github.com/opencord/goloxi"
Don Newton98fd8812019-09-23 15:15:02 -040018)
19
20type Instruction struct {
21 Type uint16
22 Len uint16
23}
24
25type IInstruction interface {
26 goloxi.Serializable
27 GetType() uint16
28 GetLen() uint16
29}
30
31func (self *Instruction) GetType() uint16 {
32 return self.Type
33}
34
35func (self *Instruction) SetType(v uint16) {
36 self.Type = v
37}
38
39func (self *Instruction) GetLen() uint16 {
40 return self.Len
41}
42
43func (self *Instruction) SetLen(v uint16) {
44 self.Len = v
45}
46
47func (self *Instruction) Serialize(encoder *goloxi.Encoder) error {
48
49 encoder.PutUint16(uint16(self.Type))
50 encoder.PutUint16(uint16(self.Len))
51
52 return nil
53}
54
55func DecodeInstruction(decoder *goloxi.Decoder) (IInstruction, error) {
56 _instruction := &Instruction{}
57 if decoder.Length() < 4 {
58 return nil, fmt.Errorf("Instruction packet too short: %d < 4", decoder.Length())
59 }
60 _instruction.Type = uint16(decoder.ReadUint16())
61 _instruction.Len = uint16(decoder.ReadUint16())
62 oldDecoder := decoder
63 defer func() { decoder = oldDecoder }()
64 decoder = decoder.SliceDecoder(int(_instruction.Len), 2+2)
65
66 switch _instruction.Type {
67 case 1:
68 return DecodeInstructionGotoTable(_instruction, decoder)
69 case 2:
70 return DecodeInstructionWriteMetadata(_instruction, decoder)
71 case 3:
72 return DecodeInstructionWriteActions(_instruction, decoder)
73 case 4:
74 return DecodeInstructionApplyActions(_instruction, decoder)
75 case 5:
76 return DecodeInstructionClearActions(_instruction, decoder)
77 case 6:
78 return DecodeInstructionMeter(_instruction, decoder)
79 case 65535:
80 return DecodeInstructionExperimenter(_instruction, decoder)
81 default:
82 return nil, fmt.Errorf("Invalid type '%d' for 'Instruction'", _instruction.Type)
83 }
84}
85
86func NewInstruction(_type uint16) *Instruction {
87 obj := &Instruction{}
88 obj.Type = _type
89 return obj
90}
91
92type InstructionApplyActions struct {
93 *Instruction
94 Actions []goloxi.IAction
95}
96
97type IInstructionApplyActions interface {
98 IInstruction
99 GetActions() []goloxi.IAction
100}
101
102func (self *InstructionApplyActions) GetActions() []goloxi.IAction {
103 return self.Actions
104}
105
106func (self *InstructionApplyActions) SetActions(v []goloxi.IAction) {
107 self.Actions = v
108}
109
110func (self *InstructionApplyActions) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700111 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400112 if err := self.Instruction.Serialize(encoder); err != nil {
113 return err
114 }
115
116 encoder.Write(bytes.Repeat([]byte{0}, 4))
117 for _, obj := range self.Actions {
118 if err := obj.Serialize(encoder); err != nil {
119 return err
120 }
121 }
Jonathan Hart828908c2020-04-15 14:23:45 -0700122 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400123
Jonathan Hart828908c2020-04-15 14:23:45 -0700124 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400125
126 return nil
127}
128
129func DecodeInstructionApplyActions(parent *Instruction, decoder *goloxi.Decoder) (*InstructionApplyActions, error) {
130 _instructionapplyactions := &InstructionApplyActions{Instruction: parent}
131 if decoder.Length() < 4 {
132 return nil, fmt.Errorf("InstructionApplyActions packet too short: %d < 4", decoder.Length())
133 }
134 decoder.Skip(4)
135
136 for decoder.Length() >= 8 {
137 item, err := DecodeAction(decoder)
138 if err != nil {
139 return nil, err
140 }
141 if item != nil {
142 _instructionapplyactions.Actions = append(_instructionapplyactions.Actions, item)
143 }
144 }
145 return _instructionapplyactions, nil
146}
147
148func NewInstructionApplyActions() *InstructionApplyActions {
149 obj := &InstructionApplyActions{
150 Instruction: NewInstruction(4),
151 }
152 return obj
153}
154
155type InstructionExperimenter struct {
156 *Instruction
157 Experimenter uint32
158}
159
160type IInstructionExperimenter interface {
161 IInstruction
162 GetExperimenter() uint32
163}
164
165func (self *InstructionExperimenter) GetExperimenter() uint32 {
166 return self.Experimenter
167}
168
169func (self *InstructionExperimenter) SetExperimenter(v uint32) {
170 self.Experimenter = v
171}
172
173func (self *InstructionExperimenter) Serialize(encoder *goloxi.Encoder) error {
174 if err := self.Instruction.Serialize(encoder); err != nil {
175 return err
176 }
177
178 encoder.PutUint32(uint32(self.Experimenter))
179
180 return nil
181}
182
183func DecodeInstructionExperimenter(parent *Instruction, decoder *goloxi.Decoder) (IInstructionExperimenter, error) {
184 _instructionexperimenter := &InstructionExperimenter{Instruction: parent}
185 if decoder.Length() < 4 {
186 return nil, fmt.Errorf("InstructionExperimenter packet too short: %d < 4", decoder.Length())
187 }
188 _instructionexperimenter.Experimenter = uint32(decoder.ReadUint32())
189
190 switch _instructionexperimenter.Experimenter {
191 case 6035143:
192 return DecodeInstructionBsn(_instructionexperimenter, decoder)
193 default:
194 return nil, fmt.Errorf("Invalid type '%d' for 'InstructionExperimenter'", _instructionexperimenter.Experimenter)
195 }
196}
197
198func NewInstructionExperimenter(_experimenter uint32) *InstructionExperimenter {
199 obj := &InstructionExperimenter{
200 Instruction: NewInstruction(65535),
201 }
202 obj.Experimenter = _experimenter
203 return obj
204}
205
206type InstructionBsn struct {
207 *InstructionExperimenter
208 Subtype uint32
209}
210
211type IInstructionBsn interface {
212 IInstructionExperimenter
213 GetSubtype() uint32
214}
215
216func (self *InstructionBsn) GetSubtype() uint32 {
217 return self.Subtype
218}
219
220func (self *InstructionBsn) SetSubtype(v uint32) {
221 self.Subtype = v
222}
223
224func (self *InstructionBsn) Serialize(encoder *goloxi.Encoder) error {
225 if err := self.InstructionExperimenter.Serialize(encoder); err != nil {
226 return err
227 }
228
229 encoder.PutUint32(uint32(self.Subtype))
230
231 return nil
232}
233
234func DecodeInstructionBsn(parent *InstructionExperimenter, decoder *goloxi.Decoder) (IInstructionBsn, error) {
235 _instructionbsn := &InstructionBsn{InstructionExperimenter: parent}
236 if decoder.Length() < 4 {
237 return nil, fmt.Errorf("InstructionBsn packet too short: %d < 4", decoder.Length())
238 }
239 _instructionbsn.Subtype = uint32(decoder.ReadUint32())
240
241 switch _instructionbsn.Subtype {
242 case 0:
243 return DecodeInstructionBsnDisableSrcMacCheck(_instructionbsn, decoder)
244 case 1:
245 return DecodeInstructionBsnArpOffload(_instructionbsn, decoder)
246 case 2:
247 return DecodeInstructionBsnDhcpOffload(_instructionbsn, decoder)
248 case 3:
249 return DecodeInstructionBsnDisableSplitHorizonCheck(_instructionbsn, decoder)
250 case 4:
251 return DecodeInstructionBsnPermit(_instructionbsn, decoder)
252 case 5:
253 return DecodeInstructionBsnDeny(_instructionbsn, decoder)
254 case 6:
255 return DecodeInstructionBsnPacketOfDeath(_instructionbsn, decoder)
256 case 7:
257 return DecodeInstructionBsnPrioritizePdus(_instructionbsn, decoder)
258 case 8:
259 return DecodeInstructionBsnRequireVlanXlate(_instructionbsn, decoder)
260 case 9:
261 return DecodeInstructionBsnDisableVlanCounters(_instructionbsn, decoder)
262 case 10:
263 return DecodeInstructionBsnSpanDestination(_instructionbsn, decoder)
264 case 11:
265 return DecodeInstructionBsnAutoNegotiation(_instructionbsn, decoder)
266 case 12:
267 return DecodeInstructionBsnInternalPriority(_instructionbsn, decoder)
268 case 13:
269 return DecodeInstructionBsnDisableL3(_instructionbsn, decoder)
270 case 14:
271 return DecodeInstructionBsnNdpOffload(_instructionbsn, decoder)
272 case 15:
273 return DecodeInstructionBsnHashSelect(_instructionbsn, decoder)
274 case 16:
275 return DecodeInstructionBsnDirectedBroadcast(_instructionbsn, decoder)
276 default:
277 return nil, fmt.Errorf("Invalid type '%d' for 'InstructionBsn'", _instructionbsn.Subtype)
278 }
279}
280
281func NewInstructionBsn(_subtype uint32) *InstructionBsn {
282 obj := &InstructionBsn{
283 InstructionExperimenter: NewInstructionExperimenter(6035143),
284 }
285 obj.Subtype = _subtype
286 return obj
287}
288
289type InstructionBsnArpOffload struct {
290 *InstructionBsn
291}
292
293type IInstructionBsnArpOffload interface {
294 IInstructionBsn
295}
296
297func (self *InstructionBsnArpOffload) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700298 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400299 if err := self.InstructionBsn.Serialize(encoder); err != nil {
300 return err
301 }
302
303 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700304 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400305
Jonathan Hart828908c2020-04-15 14:23:45 -0700306 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400307
308 return nil
309}
310
311func DecodeInstructionBsnArpOffload(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnArpOffload, error) {
312 _instructionbsnarpoffload := &InstructionBsnArpOffload{InstructionBsn: parent}
313 if decoder.Length() < 4 {
314 return nil, fmt.Errorf("InstructionBsnArpOffload packet too short: %d < 4", decoder.Length())
315 }
316 decoder.Skip(4)
317 return _instructionbsnarpoffload, nil
318}
319
320func NewInstructionBsnArpOffload() *InstructionBsnArpOffload {
321 obj := &InstructionBsnArpOffload{
322 InstructionBsn: NewInstructionBsn(1),
323 }
324 return obj
325}
326
327type InstructionBsnAutoNegotiation struct {
328 *InstructionBsn
329}
330
331type IInstructionBsnAutoNegotiation interface {
332 IInstructionBsn
333}
334
335func (self *InstructionBsnAutoNegotiation) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700336 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400337 if err := self.InstructionBsn.Serialize(encoder); err != nil {
338 return err
339 }
340
341 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700342 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400343
Jonathan Hart828908c2020-04-15 14:23:45 -0700344 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400345
346 return nil
347}
348
349func DecodeInstructionBsnAutoNegotiation(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnAutoNegotiation, error) {
350 _instructionbsnautonegotiation := &InstructionBsnAutoNegotiation{InstructionBsn: parent}
351 if decoder.Length() < 4 {
352 return nil, fmt.Errorf("InstructionBsnAutoNegotiation packet too short: %d < 4", decoder.Length())
353 }
354 decoder.Skip(4)
355 return _instructionbsnautonegotiation, nil
356}
357
358func NewInstructionBsnAutoNegotiation() *InstructionBsnAutoNegotiation {
359 obj := &InstructionBsnAutoNegotiation{
360 InstructionBsn: NewInstructionBsn(11),
361 }
362 return obj
363}
364
365type InstructionBsnDeny struct {
366 *InstructionBsn
367}
368
369type IInstructionBsnDeny interface {
370 IInstructionBsn
371}
372
373func (self *InstructionBsnDeny) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700374 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400375 if err := self.InstructionBsn.Serialize(encoder); err != nil {
376 return err
377 }
378
379 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700380 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400381
Jonathan Hart828908c2020-04-15 14:23:45 -0700382 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400383
384 return nil
385}
386
387func DecodeInstructionBsnDeny(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnDeny, error) {
388 _instructionbsndeny := &InstructionBsnDeny{InstructionBsn: parent}
389 if decoder.Length() < 4 {
390 return nil, fmt.Errorf("InstructionBsnDeny packet too short: %d < 4", decoder.Length())
391 }
392 decoder.Skip(4)
393 return _instructionbsndeny, nil
394}
395
396func NewInstructionBsnDeny() *InstructionBsnDeny {
397 obj := &InstructionBsnDeny{
398 InstructionBsn: NewInstructionBsn(5),
399 }
400 return obj
401}
402
403type InstructionBsnDhcpOffload struct {
404 *InstructionBsn
405}
406
407type IInstructionBsnDhcpOffload interface {
408 IInstructionBsn
409}
410
411func (self *InstructionBsnDhcpOffload) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700412 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400413 if err := self.InstructionBsn.Serialize(encoder); err != nil {
414 return err
415 }
416
417 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700418 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400419
Jonathan Hart828908c2020-04-15 14:23:45 -0700420 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400421
422 return nil
423}
424
425func DecodeInstructionBsnDhcpOffload(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnDhcpOffload, error) {
426 _instructionbsndhcpoffload := &InstructionBsnDhcpOffload{InstructionBsn: parent}
427 if decoder.Length() < 4 {
428 return nil, fmt.Errorf("InstructionBsnDhcpOffload packet too short: %d < 4", decoder.Length())
429 }
430 decoder.Skip(4)
431 return _instructionbsndhcpoffload, nil
432}
433
434func NewInstructionBsnDhcpOffload() *InstructionBsnDhcpOffload {
435 obj := &InstructionBsnDhcpOffload{
436 InstructionBsn: NewInstructionBsn(2),
437 }
438 return obj
439}
440
441type InstructionBsnDirectedBroadcast struct {
442 *InstructionBsn
443}
444
445type IInstructionBsnDirectedBroadcast interface {
446 IInstructionBsn
447}
448
449func (self *InstructionBsnDirectedBroadcast) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700450 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400451 if err := self.InstructionBsn.Serialize(encoder); err != nil {
452 return err
453 }
454
455 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700456 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400457
Jonathan Hart828908c2020-04-15 14:23:45 -0700458 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400459
460 return nil
461}
462
463func DecodeInstructionBsnDirectedBroadcast(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnDirectedBroadcast, error) {
464 _instructionbsndirectedbroadcast := &InstructionBsnDirectedBroadcast{InstructionBsn: parent}
465 if decoder.Length() < 4 {
466 return nil, fmt.Errorf("InstructionBsnDirectedBroadcast packet too short: %d < 4", decoder.Length())
467 }
468 decoder.Skip(4)
469 return _instructionbsndirectedbroadcast, nil
470}
471
472func NewInstructionBsnDirectedBroadcast() *InstructionBsnDirectedBroadcast {
473 obj := &InstructionBsnDirectedBroadcast{
474 InstructionBsn: NewInstructionBsn(16),
475 }
476 return obj
477}
478
479type InstructionBsnDisableL3 struct {
480 *InstructionBsn
481}
482
483type IInstructionBsnDisableL3 interface {
484 IInstructionBsn
485}
486
487func (self *InstructionBsnDisableL3) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700488 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400489 if err := self.InstructionBsn.Serialize(encoder); err != nil {
490 return err
491 }
492
493 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700494 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400495
Jonathan Hart828908c2020-04-15 14:23:45 -0700496 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400497
498 return nil
499}
500
501func DecodeInstructionBsnDisableL3(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnDisableL3, error) {
502 _instructionbsndisablel3 := &InstructionBsnDisableL3{InstructionBsn: parent}
503 if decoder.Length() < 4 {
504 return nil, fmt.Errorf("InstructionBsnDisableL3 packet too short: %d < 4", decoder.Length())
505 }
506 decoder.Skip(4)
507 return _instructionbsndisablel3, nil
508}
509
510func NewInstructionBsnDisableL3() *InstructionBsnDisableL3 {
511 obj := &InstructionBsnDisableL3{
512 InstructionBsn: NewInstructionBsn(13),
513 }
514 return obj
515}
516
517type InstructionBsnDisableSplitHorizonCheck struct {
518 *InstructionBsn
519}
520
521type IInstructionBsnDisableSplitHorizonCheck interface {
522 IInstructionBsn
523}
524
525func (self *InstructionBsnDisableSplitHorizonCheck) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700526 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400527 if err := self.InstructionBsn.Serialize(encoder); err != nil {
528 return err
529 }
530
531 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700532 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400533
Jonathan Hart828908c2020-04-15 14:23:45 -0700534 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400535
536 return nil
537}
538
539func DecodeInstructionBsnDisableSplitHorizonCheck(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnDisableSplitHorizonCheck, error) {
540 _instructionbsndisablesplithorizoncheck := &InstructionBsnDisableSplitHorizonCheck{InstructionBsn: parent}
541 if decoder.Length() < 4 {
542 return nil, fmt.Errorf("InstructionBsnDisableSplitHorizonCheck packet too short: %d < 4", decoder.Length())
543 }
544 decoder.Skip(4)
545 return _instructionbsndisablesplithorizoncheck, nil
546}
547
548func NewInstructionBsnDisableSplitHorizonCheck() *InstructionBsnDisableSplitHorizonCheck {
549 obj := &InstructionBsnDisableSplitHorizonCheck{
550 InstructionBsn: NewInstructionBsn(3),
551 }
552 return obj
553}
554
555type InstructionBsnDisableSrcMacCheck struct {
556 *InstructionBsn
557}
558
559type IInstructionBsnDisableSrcMacCheck interface {
560 IInstructionBsn
561}
562
563func (self *InstructionBsnDisableSrcMacCheck) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700564 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400565 if err := self.InstructionBsn.Serialize(encoder); err != nil {
566 return err
567 }
568
569 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700570 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400571
Jonathan Hart828908c2020-04-15 14:23:45 -0700572 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400573
574 return nil
575}
576
577func DecodeInstructionBsnDisableSrcMacCheck(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnDisableSrcMacCheck, error) {
578 _instructionbsndisablesrcmaccheck := &InstructionBsnDisableSrcMacCheck{InstructionBsn: parent}
579 if decoder.Length() < 4 {
580 return nil, fmt.Errorf("InstructionBsnDisableSrcMacCheck packet too short: %d < 4", decoder.Length())
581 }
582 decoder.Skip(4)
583 return _instructionbsndisablesrcmaccheck, nil
584}
585
586func NewInstructionBsnDisableSrcMacCheck() *InstructionBsnDisableSrcMacCheck {
587 obj := &InstructionBsnDisableSrcMacCheck{
588 InstructionBsn: NewInstructionBsn(0),
589 }
590 return obj
591}
592
593type InstructionBsnDisableVlanCounters struct {
594 *InstructionBsn
595}
596
597type IInstructionBsnDisableVlanCounters interface {
598 IInstructionBsn
599}
600
601func (self *InstructionBsnDisableVlanCounters) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700602 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400603 if err := self.InstructionBsn.Serialize(encoder); err != nil {
604 return err
605 }
606
607 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700608 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400609
Jonathan Hart828908c2020-04-15 14:23:45 -0700610 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400611
612 return nil
613}
614
615func DecodeInstructionBsnDisableVlanCounters(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnDisableVlanCounters, error) {
616 _instructionbsndisablevlancounters := &InstructionBsnDisableVlanCounters{InstructionBsn: parent}
617 if decoder.Length() < 4 {
618 return nil, fmt.Errorf("InstructionBsnDisableVlanCounters packet too short: %d < 4", decoder.Length())
619 }
620 decoder.Skip(4)
621 return _instructionbsndisablevlancounters, nil
622}
623
624func NewInstructionBsnDisableVlanCounters() *InstructionBsnDisableVlanCounters {
625 obj := &InstructionBsnDisableVlanCounters{
626 InstructionBsn: NewInstructionBsn(9),
627 }
628 return obj
629}
630
631type InstructionBsnHashSelect struct {
632 *InstructionBsn
633 Flags BsnHashSelectFlags
634}
635
636type IInstructionBsnHashSelect interface {
637 IInstructionBsn
638 GetFlags() BsnHashSelectFlags
639}
640
641func (self *InstructionBsnHashSelect) GetFlags() BsnHashSelectFlags {
642 return self.Flags
643}
644
645func (self *InstructionBsnHashSelect) SetFlags(v BsnHashSelectFlags) {
646 self.Flags = v
647}
648
649func (self *InstructionBsnHashSelect) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700650 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400651 if err := self.InstructionBsn.Serialize(encoder); err != nil {
652 return err
653 }
654
655 encoder.PutUint32(uint32(self.Flags))
Jonathan Hart828908c2020-04-15 14:23:45 -0700656 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400657
Jonathan Hart828908c2020-04-15 14:23:45 -0700658 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400659
660 return nil
661}
662
663func DecodeInstructionBsnHashSelect(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnHashSelect, error) {
664 _instructionbsnhashselect := &InstructionBsnHashSelect{InstructionBsn: parent}
665 if decoder.Length() < 4 {
666 return nil, fmt.Errorf("InstructionBsnHashSelect packet too short: %d < 4", decoder.Length())
667 }
668 _instructionbsnhashselect.Flags = BsnHashSelectFlags(decoder.ReadUint32())
669 return _instructionbsnhashselect, nil
670}
671
672func NewInstructionBsnHashSelect() *InstructionBsnHashSelect {
673 obj := &InstructionBsnHashSelect{
674 InstructionBsn: NewInstructionBsn(15),
675 }
676 return obj
677}
678
679type InstructionBsnInternalPriority struct {
680 *InstructionBsn
681 Value uint32
682}
683
684type IInstructionBsnInternalPriority interface {
685 IInstructionBsn
686 GetValue() uint32
687}
688
689func (self *InstructionBsnInternalPriority) GetValue() uint32 {
690 return self.Value
691}
692
693func (self *InstructionBsnInternalPriority) SetValue(v uint32) {
694 self.Value = v
695}
696
697func (self *InstructionBsnInternalPriority) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700698 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400699 if err := self.InstructionBsn.Serialize(encoder); err != nil {
700 return err
701 }
702
703 encoder.PutUint32(uint32(self.Value))
Jonathan Hart828908c2020-04-15 14:23:45 -0700704 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400705
Jonathan Hart828908c2020-04-15 14:23:45 -0700706 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400707
708 return nil
709}
710
711func DecodeInstructionBsnInternalPriority(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnInternalPriority, error) {
712 _instructionbsninternalpriority := &InstructionBsnInternalPriority{InstructionBsn: parent}
713 if decoder.Length() < 4 {
714 return nil, fmt.Errorf("InstructionBsnInternalPriority packet too short: %d < 4", decoder.Length())
715 }
716 _instructionbsninternalpriority.Value = uint32(decoder.ReadUint32())
717 return _instructionbsninternalpriority, nil
718}
719
720func NewInstructionBsnInternalPriority() *InstructionBsnInternalPriority {
721 obj := &InstructionBsnInternalPriority{
722 InstructionBsn: NewInstructionBsn(12),
723 }
724 return obj
725}
726
727type InstructionBsnNdpOffload struct {
728 *InstructionBsn
729}
730
731type IInstructionBsnNdpOffload interface {
732 IInstructionBsn
733}
734
735func (self *InstructionBsnNdpOffload) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700736 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400737 if err := self.InstructionBsn.Serialize(encoder); err != nil {
738 return err
739 }
740
741 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700742 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400743
Jonathan Hart828908c2020-04-15 14:23:45 -0700744 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400745
746 return nil
747}
748
749func DecodeInstructionBsnNdpOffload(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnNdpOffload, error) {
750 _instructionbsnndpoffload := &InstructionBsnNdpOffload{InstructionBsn: parent}
751 if decoder.Length() < 4 {
752 return nil, fmt.Errorf("InstructionBsnNdpOffload packet too short: %d < 4", decoder.Length())
753 }
754 decoder.Skip(4)
755 return _instructionbsnndpoffload, nil
756}
757
758func NewInstructionBsnNdpOffload() *InstructionBsnNdpOffload {
759 obj := &InstructionBsnNdpOffload{
760 InstructionBsn: NewInstructionBsn(14),
761 }
762 return obj
763}
764
765type InstructionBsnPacketOfDeath struct {
766 *InstructionBsn
767}
768
769type IInstructionBsnPacketOfDeath interface {
770 IInstructionBsn
771}
772
773func (self *InstructionBsnPacketOfDeath) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700774 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400775 if err := self.InstructionBsn.Serialize(encoder); err != nil {
776 return err
777 }
778
779 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700780 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400781
Jonathan Hart828908c2020-04-15 14:23:45 -0700782 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400783
784 return nil
785}
786
787func DecodeInstructionBsnPacketOfDeath(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnPacketOfDeath, error) {
788 _instructionbsnpacketofdeath := &InstructionBsnPacketOfDeath{InstructionBsn: parent}
789 if decoder.Length() < 4 {
790 return nil, fmt.Errorf("InstructionBsnPacketOfDeath packet too short: %d < 4", decoder.Length())
791 }
792 decoder.Skip(4)
793 return _instructionbsnpacketofdeath, nil
794}
795
796func NewInstructionBsnPacketOfDeath() *InstructionBsnPacketOfDeath {
797 obj := &InstructionBsnPacketOfDeath{
798 InstructionBsn: NewInstructionBsn(6),
799 }
800 return obj
801}
802
803type InstructionBsnPermit struct {
804 *InstructionBsn
805}
806
807type IInstructionBsnPermit interface {
808 IInstructionBsn
809}
810
811func (self *InstructionBsnPermit) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700812 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400813 if err := self.InstructionBsn.Serialize(encoder); err != nil {
814 return err
815 }
816
817 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700818 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400819
Jonathan Hart828908c2020-04-15 14:23:45 -0700820 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400821
822 return nil
823}
824
825func DecodeInstructionBsnPermit(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnPermit, error) {
826 _instructionbsnpermit := &InstructionBsnPermit{InstructionBsn: parent}
827 if decoder.Length() < 4 {
828 return nil, fmt.Errorf("InstructionBsnPermit packet too short: %d < 4", decoder.Length())
829 }
830 decoder.Skip(4)
831 return _instructionbsnpermit, nil
832}
833
834func NewInstructionBsnPermit() *InstructionBsnPermit {
835 obj := &InstructionBsnPermit{
836 InstructionBsn: NewInstructionBsn(4),
837 }
838 return obj
839}
840
841type InstructionBsnPrioritizePdus struct {
842 *InstructionBsn
843}
844
845type IInstructionBsnPrioritizePdus interface {
846 IInstructionBsn
847}
848
849func (self *InstructionBsnPrioritizePdus) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700850 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400851 if err := self.InstructionBsn.Serialize(encoder); err != nil {
852 return err
853 }
854
855 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700856 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400857
Jonathan Hart828908c2020-04-15 14:23:45 -0700858 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400859
860 return nil
861}
862
863func DecodeInstructionBsnPrioritizePdus(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnPrioritizePdus, error) {
864 _instructionbsnprioritizepdus := &InstructionBsnPrioritizePdus{InstructionBsn: parent}
865 if decoder.Length() < 4 {
866 return nil, fmt.Errorf("InstructionBsnPrioritizePdus packet too short: %d < 4", decoder.Length())
867 }
868 decoder.Skip(4)
869 return _instructionbsnprioritizepdus, nil
870}
871
872func NewInstructionBsnPrioritizePdus() *InstructionBsnPrioritizePdus {
873 obj := &InstructionBsnPrioritizePdus{
874 InstructionBsn: NewInstructionBsn(7),
875 }
876 return obj
877}
878
879type InstructionBsnRequireVlanXlate struct {
880 *InstructionBsn
881}
882
883type IInstructionBsnRequireVlanXlate interface {
884 IInstructionBsn
885}
886
887func (self *InstructionBsnRequireVlanXlate) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700888 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400889 if err := self.InstructionBsn.Serialize(encoder); err != nil {
890 return err
891 }
892
893 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700894 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400895
Jonathan Hart828908c2020-04-15 14:23:45 -0700896 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400897
898 return nil
899}
900
901func DecodeInstructionBsnRequireVlanXlate(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnRequireVlanXlate, error) {
902 _instructionbsnrequirevlanxlate := &InstructionBsnRequireVlanXlate{InstructionBsn: parent}
903 if decoder.Length() < 4 {
904 return nil, fmt.Errorf("InstructionBsnRequireVlanXlate packet too short: %d < 4", decoder.Length())
905 }
906 decoder.Skip(4)
907 return _instructionbsnrequirevlanxlate, nil
908}
909
910func NewInstructionBsnRequireVlanXlate() *InstructionBsnRequireVlanXlate {
911 obj := &InstructionBsnRequireVlanXlate{
912 InstructionBsn: NewInstructionBsn(8),
913 }
914 return obj
915}
916
917type InstructionBsnSpanDestination struct {
918 *InstructionBsn
919}
920
921type IInstructionBsnSpanDestination interface {
922 IInstructionBsn
923}
924
925func (self *InstructionBsnSpanDestination) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700926 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400927 if err := self.InstructionBsn.Serialize(encoder); err != nil {
928 return err
929 }
930
931 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700932 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400933
Jonathan Hart828908c2020-04-15 14:23:45 -0700934 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400935
936 return nil
937}
938
939func DecodeInstructionBsnSpanDestination(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnSpanDestination, error) {
940 _instructionbsnspandestination := &InstructionBsnSpanDestination{InstructionBsn: parent}
941 if decoder.Length() < 4 {
942 return nil, fmt.Errorf("InstructionBsnSpanDestination packet too short: %d < 4", decoder.Length())
943 }
944 decoder.Skip(4)
945 return _instructionbsnspandestination, nil
946}
947
948func NewInstructionBsnSpanDestination() *InstructionBsnSpanDestination {
949 obj := &InstructionBsnSpanDestination{
950 InstructionBsn: NewInstructionBsn(10),
951 }
952 return obj
953}
954
955type InstructionClearActions struct {
956 *Instruction
957}
958
959type IInstructionClearActions interface {
960 IInstruction
961}
962
963func (self *InstructionClearActions) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -0700964 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -0400965 if err := self.Instruction.Serialize(encoder); err != nil {
966 return err
967 }
968
969 encoder.Write(bytes.Repeat([]byte{0}, 4))
Jonathan Hart828908c2020-04-15 14:23:45 -0700970 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -0400971
Jonathan Hart828908c2020-04-15 14:23:45 -0700972 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -0400973
974 return nil
975}
976
977func DecodeInstructionClearActions(parent *Instruction, decoder *goloxi.Decoder) (*InstructionClearActions, error) {
978 _instructionclearactions := &InstructionClearActions{Instruction: parent}
979 if decoder.Length() < 4 {
980 return nil, fmt.Errorf("InstructionClearActions packet too short: %d < 4", decoder.Length())
981 }
982 decoder.Skip(4)
983 return _instructionclearactions, nil
984}
985
986func NewInstructionClearActions() *InstructionClearActions {
987 obj := &InstructionClearActions{
988 Instruction: NewInstruction(5),
989 }
990 return obj
991}
992
993type InstructionGotoTable struct {
994 *Instruction
995 TableId uint8
996}
997
998type IInstructionGotoTable interface {
999 IInstruction
1000 GetTableId() uint8
1001}
1002
1003func (self *InstructionGotoTable) GetTableId() uint8 {
1004 return self.TableId
1005}
1006
1007func (self *InstructionGotoTable) SetTableId(v uint8) {
1008 self.TableId = v
1009}
1010
1011func (self *InstructionGotoTable) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -07001012 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -04001013 if err := self.Instruction.Serialize(encoder); err != nil {
1014 return err
1015 }
1016
1017 encoder.PutUint8(uint8(self.TableId))
1018 encoder.Write(bytes.Repeat([]byte{0}, 3))
Jonathan Hart828908c2020-04-15 14:23:45 -07001019 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -04001020
Jonathan Hart828908c2020-04-15 14:23:45 -07001021 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -04001022
1023 return nil
1024}
1025
1026func DecodeInstructionGotoTable(parent *Instruction, decoder *goloxi.Decoder) (*InstructionGotoTable, error) {
1027 _instructiongototable := &InstructionGotoTable{Instruction: parent}
1028 if decoder.Length() < 4 {
1029 return nil, fmt.Errorf("InstructionGotoTable packet too short: %d < 4", decoder.Length())
1030 }
1031 _instructiongototable.TableId = uint8(decoder.ReadByte())
1032 decoder.Skip(3)
1033 return _instructiongototable, nil
1034}
1035
1036func NewInstructionGotoTable() *InstructionGotoTable {
1037 obj := &InstructionGotoTable{
1038 Instruction: NewInstruction(1),
1039 }
1040 return obj
1041}
1042
1043type InstructionMeter struct {
1044 *Instruction
1045 MeterId uint32
1046}
1047
1048type IInstructionMeter interface {
1049 IInstruction
1050 GetMeterId() uint32
1051}
1052
1053func (self *InstructionMeter) GetMeterId() uint32 {
1054 return self.MeterId
1055}
1056
1057func (self *InstructionMeter) SetMeterId(v uint32) {
1058 self.MeterId = v
1059}
1060
1061func (self *InstructionMeter) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -07001062 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -04001063 if err := self.Instruction.Serialize(encoder); err != nil {
1064 return err
1065 }
1066
1067 encoder.PutUint32(uint32(self.MeterId))
Jonathan Hart828908c2020-04-15 14:23:45 -07001068 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -04001069
Jonathan Hart828908c2020-04-15 14:23:45 -07001070 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -04001071
1072 return nil
1073}
1074
1075func DecodeInstructionMeter(parent *Instruction, decoder *goloxi.Decoder) (*InstructionMeter, error) {
1076 _instructionmeter := &InstructionMeter{Instruction: parent}
1077 if decoder.Length() < 4 {
1078 return nil, fmt.Errorf("InstructionMeter packet too short: %d < 4", decoder.Length())
1079 }
1080 _instructionmeter.MeterId = uint32(decoder.ReadUint32())
1081 return _instructionmeter, nil
1082}
1083
1084func NewInstructionMeter() *InstructionMeter {
1085 obj := &InstructionMeter{
1086 Instruction: NewInstruction(6),
1087 }
1088 return obj
1089}
1090
1091type InstructionWriteActions struct {
1092 *Instruction
1093 Actions []goloxi.IAction
1094}
1095
1096type IInstructionWriteActions interface {
1097 IInstruction
1098 GetActions() []goloxi.IAction
1099}
1100
1101func (self *InstructionWriteActions) GetActions() []goloxi.IAction {
1102 return self.Actions
1103}
1104
1105func (self *InstructionWriteActions) SetActions(v []goloxi.IAction) {
1106 self.Actions = v
1107}
1108
1109func (self *InstructionWriteActions) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -07001110 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -04001111 if err := self.Instruction.Serialize(encoder); err != nil {
1112 return err
1113 }
1114
1115 encoder.Write(bytes.Repeat([]byte{0}, 4))
1116 for _, obj := range self.Actions {
1117 if err := obj.Serialize(encoder); err != nil {
1118 return err
1119 }
1120 }
Jonathan Hart828908c2020-04-15 14:23:45 -07001121 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -04001122
Jonathan Hart828908c2020-04-15 14:23:45 -07001123 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -04001124
1125 return nil
1126}
1127
1128func DecodeInstructionWriteActions(parent *Instruction, decoder *goloxi.Decoder) (*InstructionWriteActions, error) {
1129 _instructionwriteactions := &InstructionWriteActions{Instruction: parent}
1130 if decoder.Length() < 4 {
1131 return nil, fmt.Errorf("InstructionWriteActions packet too short: %d < 4", decoder.Length())
1132 }
1133 decoder.Skip(4)
1134
1135 for decoder.Length() >= 8 {
1136 item, err := DecodeAction(decoder)
1137 if err != nil {
1138 return nil, err
1139 }
1140 if item != nil {
1141 _instructionwriteactions.Actions = append(_instructionwriteactions.Actions, item)
1142 }
1143 }
1144 return _instructionwriteactions, nil
1145}
1146
1147func NewInstructionWriteActions() *InstructionWriteActions {
1148 obj := &InstructionWriteActions{
1149 Instruction: NewInstruction(3),
1150 }
1151 return obj
1152}
1153
1154type InstructionWriteMetadata struct {
1155 *Instruction
1156 Metadata uint64
1157 MetadataMask uint64
1158}
1159
1160type IInstructionWriteMetadata interface {
1161 IInstruction
1162 GetMetadata() uint64
1163 GetMetadataMask() uint64
1164}
1165
1166func (self *InstructionWriteMetadata) GetMetadata() uint64 {
1167 return self.Metadata
1168}
1169
1170func (self *InstructionWriteMetadata) SetMetadata(v uint64) {
1171 self.Metadata = v
1172}
1173
1174func (self *InstructionWriteMetadata) GetMetadataMask() uint64 {
1175 return self.MetadataMask
1176}
1177
1178func (self *InstructionWriteMetadata) SetMetadataMask(v uint64) {
1179 self.MetadataMask = v
1180}
1181
1182func (self *InstructionWriteMetadata) Serialize(encoder *goloxi.Encoder) error {
Jonathan Hart828908c2020-04-15 14:23:45 -07001183 startIndex := len(encoder.Bytes())
Don Newton98fd8812019-09-23 15:15:02 -04001184 if err := self.Instruction.Serialize(encoder); err != nil {
1185 return err
1186 }
1187
1188 encoder.Write(bytes.Repeat([]byte{0}, 4))
1189 encoder.PutUint64(uint64(self.Metadata))
1190 encoder.PutUint64(uint64(self.MetadataMask))
Jonathan Hart828908c2020-04-15 14:23:45 -07001191 length := len(encoder.Bytes()) - startIndex
Don Newton98fd8812019-09-23 15:15:02 -04001192
Jonathan Hart828908c2020-04-15 14:23:45 -07001193 binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length))
Don Newton98fd8812019-09-23 15:15:02 -04001194
1195 return nil
1196}
1197
1198func DecodeInstructionWriteMetadata(parent *Instruction, decoder *goloxi.Decoder) (*InstructionWriteMetadata, error) {
1199 _instructionwritemetadata := &InstructionWriteMetadata{Instruction: parent}
1200 if decoder.Length() < 20 {
1201 return nil, fmt.Errorf("InstructionWriteMetadata packet too short: %d < 20", decoder.Length())
1202 }
1203 decoder.Skip(4)
1204 _instructionwritemetadata.Metadata = uint64(decoder.ReadUint64())
1205 _instructionwritemetadata.MetadataMask = uint64(decoder.ReadUint64())
1206 return _instructionwritemetadata, nil
1207}
1208
1209func NewInstructionWriteMetadata() *InstructionWriteMetadata {
1210 obj := &InstructionWriteMetadata{
1211 Instruction: NewInstruction(2),
1212 }
1213 return obj
1214}