blob: aca49765d082ec2ef78c5ab1cdf2adcba1126cdc [file] [log] [blame]
Rich Lane2e079da2014-10-29 15:30:24 -07001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4# See the file LICENSE.pyloxi which should have been included in the source distribution
5
6# Automatically generated by LOXI from template module.py
7# Do not modify
8
9import struct
10import loxi
11import const
12import port_desc_prop
Rich Laneccd32ed2014-11-10 17:48:24 -080013import bsn_tlv
Rich Lane2e079da2014-10-29 15:30:24 -070014import meter_band
15import table_mod_prop
16import instruction
17import queue_desc_prop
18import oxm
19import bundle_prop
20import common
21import instruction_id
22import action
23import role_prop
24import message
25import queue_stats_prop
26import port_stats_prop
27import port_mod_prop
28import async_config_prop
29import action_id
30import util
31import loxi.generic_util
32
33class instruction_id(loxi.OFObject):
34 subtypes = {}
35
36
37 def __init__(self, type=None):
38 if type != None:
39 self.type = type
40 else:
41 self.type = 0
42 return
43
44 def pack(self):
45 packed = []
46 packed.append(struct.pack("!H", self.type))
47 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
48 length = sum([len(x) for x in packed])
49 packed[1] = struct.pack("!H", length)
50 return ''.join(packed)
51
52 @staticmethod
53 def unpack(reader):
54 subtype, = reader.peek('!H', 0)
55 subclass = instruction_id.subtypes.get(subtype)
56 if subclass:
57 return subclass.unpack(reader)
58
59 obj = instruction_id()
60 obj.type = reader.read("!H")[0]
61 _len = reader.read("!H")[0]
62 orig_reader = reader
63 reader = orig_reader.slice(_len - (2 + 2))
64 return obj
65
66 def __eq__(self, other):
67 if type(self) != type(other): return False
68 if self.type != other.type: return False
69 return True
70
71 def pretty_print(self, q):
72 q.text("instruction_id {")
73 with q.group():
74 with q.indent(2):
75 q.breakable()
76 q.breakable()
77 q.text('}')
78
79
80class apply_actions(instruction_id):
81 type = 4
82
83 def __init__(self):
84 return
85
86 def pack(self):
87 packed = []
88 packed.append(struct.pack("!H", self.type))
89 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
90 length = sum([len(x) for x in packed])
91 packed[1] = struct.pack("!H", length)
92 return ''.join(packed)
93
94 @staticmethod
95 def unpack(reader):
96 obj = apply_actions()
97 _type = reader.read("!H")[0]
98 assert(_type == 4)
99 _len = reader.read("!H")[0]
100 orig_reader = reader
101 reader = orig_reader.slice(_len - (2 + 2))
102 return obj
103
104 def __eq__(self, other):
105 if type(self) != type(other): return False
106 return True
107
108 def pretty_print(self, q):
109 q.text("apply_actions {")
110 with q.group():
111 with q.indent(2):
112 q.breakable()
113 q.breakable()
114 q.text('}')
115
116instruction_id.subtypes[4] = apply_actions
117
Rich Lane2e079da2014-10-29 15:30:24 -0700118class experimenter(instruction_id):
119 subtypes = {}
120
121 type = 65535
122
123 def __init__(self, experimenter=None):
124 if experimenter != None:
125 self.experimenter = experimenter
126 else:
127 self.experimenter = 0
128 return
129
130 def pack(self):
131 packed = []
132 packed.append(struct.pack("!H", self.type))
133 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
134 packed.append(struct.pack("!L", self.experimenter))
135 length = sum([len(x) for x in packed])
136 packed[1] = struct.pack("!H", length)
137 return ''.join(packed)
138
139 @staticmethod
140 def unpack(reader):
141 subtype, = reader.peek('!L', 4)
142 subclass = experimenter.subtypes.get(subtype)
143 if subclass:
144 return subclass.unpack(reader)
145
146 obj = experimenter()
147 _type = reader.read("!H")[0]
148 assert(_type == 65535)
149 _len = reader.read("!H")[0]
150 orig_reader = reader
151 reader = orig_reader.slice(_len - (2 + 2))
152 obj.experimenter = reader.read("!L")[0]
153 return obj
154
155 def __eq__(self, other):
156 if type(self) != type(other): return False
157 if self.experimenter != other.experimenter: return False
158 return True
159
160 def pretty_print(self, q):
161 q.text("experimenter {")
162 with q.group():
163 with q.indent(2):
164 q.breakable()
165 q.breakable()
166 q.text('}')
167
168instruction_id.subtypes[65535] = experimenter
169
Rich Laneccd32ed2014-11-10 17:48:24 -0800170class bsn(experimenter):
171 subtypes = {}
172
173 type = 65535
174 experimenter = 6035143
175
176 def __init__(self, subtype=None):
177 if subtype != None:
178 self.subtype = subtype
179 else:
180 self.subtype = 0
181 return
182
183 def pack(self):
184 packed = []
185 packed.append(struct.pack("!H", self.type))
186 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
187 packed.append(struct.pack("!L", self.experimenter))
188 packed.append(struct.pack("!L", self.subtype))
189 length = sum([len(x) for x in packed])
190 packed[1] = struct.pack("!H", length)
191 return ''.join(packed)
192
193 @staticmethod
194 def unpack(reader):
195 subtype, = reader.peek('!L', 8)
196 subclass = bsn.subtypes.get(subtype)
197 if subclass:
198 return subclass.unpack(reader)
199
200 obj = bsn()
201 _type = reader.read("!H")[0]
202 assert(_type == 65535)
203 _len = reader.read("!H")[0]
204 orig_reader = reader
205 reader = orig_reader.slice(_len - (2 + 2))
206 _experimenter = reader.read("!L")[0]
207 assert(_experimenter == 6035143)
208 obj.subtype = reader.read("!L")[0]
209 return obj
210
211 def __eq__(self, other):
212 if type(self) != type(other): return False
213 if self.subtype != other.subtype: return False
214 return True
215
216 def pretty_print(self, q):
217 q.text("bsn {")
218 with q.group():
219 with q.indent(2):
220 q.breakable()
221 q.breakable()
222 q.text('}')
223
224experimenter.subtypes[6035143] = bsn
225
226class bsn_arp_offload(bsn):
227 type = 65535
228 experimenter = 6035143
229 subtype = 1
230
231 def __init__(self):
232 return
233
234 def pack(self):
235 packed = []
236 packed.append(struct.pack("!H", self.type))
237 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
238 packed.append(struct.pack("!L", self.experimenter))
239 packed.append(struct.pack("!L", self.subtype))
240 length = sum([len(x) for x in packed])
241 packed[1] = struct.pack("!H", length)
242 return ''.join(packed)
243
244 @staticmethod
245 def unpack(reader):
246 obj = bsn_arp_offload()
247 _type = reader.read("!H")[0]
248 assert(_type == 65535)
249 _len = reader.read("!H")[0]
250 orig_reader = reader
251 reader = orig_reader.slice(_len - (2 + 2))
252 _experimenter = reader.read("!L")[0]
253 assert(_experimenter == 6035143)
254 _subtype = reader.read("!L")[0]
255 assert(_subtype == 1)
256 return obj
257
258 def __eq__(self, other):
259 if type(self) != type(other): return False
260 return True
261
262 def pretty_print(self, q):
263 q.text("bsn_arp_offload {")
264 with q.group():
265 with q.indent(2):
266 q.breakable()
267 q.breakable()
268 q.text('}')
269
270bsn.subtypes[1] = bsn_arp_offload
271
Harshmeet Singh301f7172014-12-08 13:07:29 -0800272class bsn_auto_negotiation(bsn):
273 type = 65535
274 experimenter = 6035143
275 subtype = 11
276
277 def __init__(self):
278 return
279
280 def pack(self):
281 packed = []
282 packed.append(struct.pack("!H", self.type))
283 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
284 packed.append(struct.pack("!L", self.experimenter))
285 packed.append(struct.pack("!L", self.subtype))
286 length = sum([len(x) for x in packed])
287 packed[1] = struct.pack("!H", length)
288 return ''.join(packed)
289
290 @staticmethod
291 def unpack(reader):
292 obj = bsn_auto_negotiation()
293 _type = reader.read("!H")[0]
294 assert(_type == 65535)
295 _len = reader.read("!H")[0]
296 orig_reader = reader
297 reader = orig_reader.slice(_len - (2 + 2))
298 _experimenter = reader.read("!L")[0]
299 assert(_experimenter == 6035143)
300 _subtype = reader.read("!L")[0]
301 assert(_subtype == 11)
302 return obj
303
304 def __eq__(self, other):
305 if type(self) != type(other): return False
306 return True
307
308 def pretty_print(self, q):
309 q.text("bsn_auto_negotiation {")
310 with q.group():
311 with q.indent(2):
312 q.breakable()
313 q.breakable()
314 q.text('}')
315
316bsn.subtypes[11] = bsn_auto_negotiation
317
Rich Laneccd32ed2014-11-10 17:48:24 -0800318class bsn_deny(bsn):
319 type = 65535
320 experimenter = 6035143
321 subtype = 5
322
323 def __init__(self):
324 return
325
326 def pack(self):
327 packed = []
328 packed.append(struct.pack("!H", self.type))
329 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
330 packed.append(struct.pack("!L", self.experimenter))
331 packed.append(struct.pack("!L", self.subtype))
332 length = sum([len(x) for x in packed])
333 packed[1] = struct.pack("!H", length)
334 return ''.join(packed)
335
336 @staticmethod
337 def unpack(reader):
338 obj = bsn_deny()
339 _type = reader.read("!H")[0]
340 assert(_type == 65535)
341 _len = reader.read("!H")[0]
342 orig_reader = reader
343 reader = orig_reader.slice(_len - (2 + 2))
344 _experimenter = reader.read("!L")[0]
345 assert(_experimenter == 6035143)
346 _subtype = reader.read("!L")[0]
347 assert(_subtype == 5)
348 return obj
349
350 def __eq__(self, other):
351 if type(self) != type(other): return False
352 return True
353
354 def pretty_print(self, q):
355 q.text("bsn_deny {")
356 with q.group():
357 with q.indent(2):
358 q.breakable()
359 q.breakable()
360 q.text('}')
361
362bsn.subtypes[5] = bsn_deny
363
364class bsn_dhcp_offload(bsn):
365 type = 65535
366 experimenter = 6035143
367 subtype = 2
368
369 def __init__(self):
370 return
371
372 def pack(self):
373 packed = []
374 packed.append(struct.pack("!H", self.type))
375 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
376 packed.append(struct.pack("!L", self.experimenter))
377 packed.append(struct.pack("!L", self.subtype))
378 length = sum([len(x) for x in packed])
379 packed[1] = struct.pack("!H", length)
380 return ''.join(packed)
381
382 @staticmethod
383 def unpack(reader):
384 obj = bsn_dhcp_offload()
385 _type = reader.read("!H")[0]
386 assert(_type == 65535)
387 _len = reader.read("!H")[0]
388 orig_reader = reader
389 reader = orig_reader.slice(_len - (2 + 2))
390 _experimenter = reader.read("!L")[0]
391 assert(_experimenter == 6035143)
392 _subtype = reader.read("!L")[0]
393 assert(_subtype == 2)
394 return obj
395
396 def __eq__(self, other):
397 if type(self) != type(other): return False
398 return True
399
400 def pretty_print(self, q):
401 q.text("bsn_dhcp_offload {")
402 with q.group():
403 with q.indent(2):
404 q.breakable()
405 q.breakable()
406 q.text('}')
407
408bsn.subtypes[2] = bsn_dhcp_offload
409
410class bsn_disable_src_mac_check(bsn):
411 type = 65535
412 experimenter = 6035143
413 subtype = 0
414
415 def __init__(self):
416 return
417
418 def pack(self):
419 packed = []
420 packed.append(struct.pack("!H", self.type))
421 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
422 packed.append(struct.pack("!L", self.experimenter))
423 packed.append(struct.pack("!L", self.subtype))
424 length = sum([len(x) for x in packed])
425 packed[1] = struct.pack("!H", length)
426 return ''.join(packed)
427
428 @staticmethod
429 def unpack(reader):
430 obj = bsn_disable_src_mac_check()
431 _type = reader.read("!H")[0]
432 assert(_type == 65535)
433 _len = reader.read("!H")[0]
434 orig_reader = reader
435 reader = orig_reader.slice(_len - (2 + 2))
436 _experimenter = reader.read("!L")[0]
437 assert(_experimenter == 6035143)
438 _subtype = reader.read("!L")[0]
439 assert(_subtype == 0)
440 return obj
441
442 def __eq__(self, other):
443 if type(self) != type(other): return False
444 return True
445
446 def pretty_print(self, q):
447 q.text("bsn_disable_src_mac_check {")
448 with q.group():
449 with q.indent(2):
450 q.breakable()
451 q.breakable()
452 q.text('}')
453
454bsn.subtypes[0] = bsn_disable_src_mac_check
455
456class bsn_disable_vlan_counters(bsn):
457 type = 65535
458 experimenter = 6035143
459 subtype = 9
460
461 def __init__(self):
462 return
463
464 def pack(self):
465 packed = []
466 packed.append(struct.pack("!H", self.type))
467 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
468 packed.append(struct.pack("!L", self.experimenter))
469 packed.append(struct.pack("!L", self.subtype))
470 length = sum([len(x) for x in packed])
471 packed[1] = struct.pack("!H", length)
472 return ''.join(packed)
473
474 @staticmethod
475 def unpack(reader):
476 obj = bsn_disable_vlan_counters()
477 _type = reader.read("!H")[0]
478 assert(_type == 65535)
479 _len = reader.read("!H")[0]
480 orig_reader = reader
481 reader = orig_reader.slice(_len - (2 + 2))
482 _experimenter = reader.read("!L")[0]
483 assert(_experimenter == 6035143)
484 _subtype = reader.read("!L")[0]
485 assert(_subtype == 9)
486 return obj
487
488 def __eq__(self, other):
489 if type(self) != type(other): return False
490 return True
491
492 def pretty_print(self, q):
493 q.text("bsn_disable_vlan_counters {")
494 with q.group():
495 with q.indent(2):
496 q.breakable()
497 q.breakable()
498 q.text('}')
499
500bsn.subtypes[9] = bsn_disable_vlan_counters
501
502class bsn_packet_of_death(bsn):
503 type = 65535
504 experimenter = 6035143
505 subtype = 6
506
507 def __init__(self):
508 return
509
510 def pack(self):
511 packed = []
512 packed.append(struct.pack("!H", self.type))
513 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
514 packed.append(struct.pack("!L", self.experimenter))
515 packed.append(struct.pack("!L", self.subtype))
516 length = sum([len(x) for x in packed])
517 packed[1] = struct.pack("!H", length)
518 return ''.join(packed)
519
520 @staticmethod
521 def unpack(reader):
522 obj = bsn_packet_of_death()
523 _type = reader.read("!H")[0]
524 assert(_type == 65535)
525 _len = reader.read("!H")[0]
526 orig_reader = reader
527 reader = orig_reader.slice(_len - (2 + 2))
528 _experimenter = reader.read("!L")[0]
529 assert(_experimenter == 6035143)
530 _subtype = reader.read("!L")[0]
531 assert(_subtype == 6)
532 return obj
533
534 def __eq__(self, other):
535 if type(self) != type(other): return False
536 return True
537
538 def pretty_print(self, q):
539 q.text("bsn_packet_of_death {")
540 with q.group():
541 with q.indent(2):
542 q.breakable()
543 q.breakable()
544 q.text('}')
545
546bsn.subtypes[6] = bsn_packet_of_death
547
548class bsn_permit(bsn):
549 type = 65535
550 experimenter = 6035143
551 subtype = 4
552
553 def __init__(self):
554 return
555
556 def pack(self):
557 packed = []
558 packed.append(struct.pack("!H", self.type))
559 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
560 packed.append(struct.pack("!L", self.experimenter))
561 packed.append(struct.pack("!L", self.subtype))
562 length = sum([len(x) for x in packed])
563 packed[1] = struct.pack("!H", length)
564 return ''.join(packed)
565
566 @staticmethod
567 def unpack(reader):
568 obj = bsn_permit()
569 _type = reader.read("!H")[0]
570 assert(_type == 65535)
571 _len = reader.read("!H")[0]
572 orig_reader = reader
573 reader = orig_reader.slice(_len - (2 + 2))
574 _experimenter = reader.read("!L")[0]
575 assert(_experimenter == 6035143)
576 _subtype = reader.read("!L")[0]
577 assert(_subtype == 4)
578 return obj
579
580 def __eq__(self, other):
581 if type(self) != type(other): return False
582 return True
583
584 def pretty_print(self, q):
585 q.text("bsn_permit {")
586 with q.group():
587 with q.indent(2):
588 q.breakable()
589 q.breakable()
590 q.text('}')
591
592bsn.subtypes[4] = bsn_permit
593
594class bsn_prioritize_pdus(bsn):
595 type = 65535
596 experimenter = 6035143
597 subtype = 7
598
599 def __init__(self):
600 return
601
602 def pack(self):
603 packed = []
604 packed.append(struct.pack("!H", self.type))
605 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
606 packed.append(struct.pack("!L", self.experimenter))
607 packed.append(struct.pack("!L", self.subtype))
608 length = sum([len(x) for x in packed])
609 packed[1] = struct.pack("!H", length)
610 return ''.join(packed)
611
612 @staticmethod
613 def unpack(reader):
614 obj = bsn_prioritize_pdus()
615 _type = reader.read("!H")[0]
616 assert(_type == 65535)
617 _len = reader.read("!H")[0]
618 orig_reader = reader
619 reader = orig_reader.slice(_len - (2 + 2))
620 _experimenter = reader.read("!L")[0]
621 assert(_experimenter == 6035143)
622 _subtype = reader.read("!L")[0]
623 assert(_subtype == 7)
624 return obj
625
626 def __eq__(self, other):
627 if type(self) != type(other): return False
628 return True
629
630 def pretty_print(self, q):
631 q.text("bsn_prioritize_pdus {")
632 with q.group():
633 with q.indent(2):
634 q.breakable()
635 q.breakable()
636 q.text('}')
637
638bsn.subtypes[7] = bsn_prioritize_pdus
639
640class bsn_require_vlan_xlate(bsn):
641 type = 65535
642 experimenter = 6035143
643 subtype = 8
644
645 def __init__(self):
646 return
647
648 def pack(self):
649 packed = []
650 packed.append(struct.pack("!H", self.type))
651 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
652 packed.append(struct.pack("!L", self.experimenter))
653 packed.append(struct.pack("!L", self.subtype))
654 length = sum([len(x) for x in packed])
655 packed[1] = struct.pack("!H", length)
656 return ''.join(packed)
657
658 @staticmethod
659 def unpack(reader):
660 obj = bsn_require_vlan_xlate()
661 _type = reader.read("!H")[0]
662 assert(_type == 65535)
663 _len = reader.read("!H")[0]
664 orig_reader = reader
665 reader = orig_reader.slice(_len - (2 + 2))
666 _experimenter = reader.read("!L")[0]
667 assert(_experimenter == 6035143)
668 _subtype = reader.read("!L")[0]
669 assert(_subtype == 8)
670 return obj
671
672 def __eq__(self, other):
673 if type(self) != type(other): return False
674 return True
675
676 def pretty_print(self, q):
677 q.text("bsn_require_vlan_xlate {")
678 with q.group():
679 with q.indent(2):
680 q.breakable()
681 q.breakable()
682 q.text('}')
683
684bsn.subtypes[8] = bsn_require_vlan_xlate
685
686class bsn_span_destination(bsn):
687 type = 65535
688 experimenter = 6035143
689 subtype = 10
690
691 def __init__(self):
692 return
693
694 def pack(self):
695 packed = []
696 packed.append(struct.pack("!H", self.type))
697 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
698 packed.append(struct.pack("!L", self.experimenter))
699 packed.append(struct.pack("!L", self.subtype))
700 length = sum([len(x) for x in packed])
701 packed[1] = struct.pack("!H", length)
702 return ''.join(packed)
703
704 @staticmethod
705 def unpack(reader):
706 obj = bsn_span_destination()
707 _type = reader.read("!H")[0]
708 assert(_type == 65535)
709 _len = reader.read("!H")[0]
710 orig_reader = reader
711 reader = orig_reader.slice(_len - (2 + 2))
712 _experimenter = reader.read("!L")[0]
713 assert(_experimenter == 6035143)
714 _subtype = reader.read("!L")[0]
715 assert(_subtype == 10)
716 return obj
717
718 def __eq__(self, other):
719 if type(self) != type(other): return False
720 return True
721
722 def pretty_print(self, q):
723 q.text("bsn_span_destination {")
724 with q.group():
725 with q.indent(2):
726 q.breakable()
727 q.breakable()
728 q.text('}')
729
730bsn.subtypes[10] = bsn_span_destination
731
732class clear_actions(instruction_id):
733 type = 5
734
735 def __init__(self):
736 return
737
738 def pack(self):
739 packed = []
740 packed.append(struct.pack("!H", self.type))
741 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
742 length = sum([len(x) for x in packed])
743 packed[1] = struct.pack("!H", length)
744 return ''.join(packed)
745
746 @staticmethod
747 def unpack(reader):
748 obj = clear_actions()
749 _type = reader.read("!H")[0]
750 assert(_type == 5)
751 _len = reader.read("!H")[0]
752 orig_reader = reader
753 reader = orig_reader.slice(_len - (2 + 2))
754 return obj
755
756 def __eq__(self, other):
757 if type(self) != type(other): return False
758 return True
759
760 def pretty_print(self, q):
761 q.text("clear_actions {")
762 with q.group():
763 with q.indent(2):
764 q.breakable()
765 q.breakable()
766 q.text('}')
767
768instruction_id.subtypes[5] = clear_actions
769
Rich Lane2e079da2014-10-29 15:30:24 -0700770class goto_table(instruction_id):
771 type = 1
772
773 def __init__(self):
774 return
775
776 def pack(self):
777 packed = []
778 packed.append(struct.pack("!H", self.type))
779 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
780 length = sum([len(x) for x in packed])
781 packed[1] = struct.pack("!H", length)
782 return ''.join(packed)
783
784 @staticmethod
785 def unpack(reader):
786 obj = goto_table()
787 _type = reader.read("!H")[0]
788 assert(_type == 1)
789 _len = reader.read("!H")[0]
790 orig_reader = reader
791 reader = orig_reader.slice(_len - (2 + 2))
792 return obj
793
794 def __eq__(self, other):
795 if type(self) != type(other): return False
796 return True
797
798 def pretty_print(self, q):
799 q.text("goto_table {")
800 with q.group():
801 with q.indent(2):
802 q.breakable()
803 q.breakable()
804 q.text('}')
805
806instruction_id.subtypes[1] = goto_table
807
808class meter(instruction_id):
809 type = 6
810
811 def __init__(self):
812 return
813
814 def pack(self):
815 packed = []
816 packed.append(struct.pack("!H", self.type))
817 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
818 length = sum([len(x) for x in packed])
819 packed[1] = struct.pack("!H", length)
820 return ''.join(packed)
821
822 @staticmethod
823 def unpack(reader):
824 obj = meter()
825 _type = reader.read("!H")[0]
826 assert(_type == 6)
827 _len = reader.read("!H")[0]
828 orig_reader = reader
829 reader = orig_reader.slice(_len - (2 + 2))
830 return obj
831
832 def __eq__(self, other):
833 if type(self) != type(other): return False
834 return True
835
836 def pretty_print(self, q):
837 q.text("meter {")
838 with q.group():
839 with q.indent(2):
840 q.breakable()
841 q.breakable()
842 q.text('}')
843
844instruction_id.subtypes[6] = meter
845
846class write_actions(instruction_id):
847 type = 3
848
849 def __init__(self):
850 return
851
852 def pack(self):
853 packed = []
854 packed.append(struct.pack("!H", self.type))
855 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
856 length = sum([len(x) for x in packed])
857 packed[1] = struct.pack("!H", length)
858 return ''.join(packed)
859
860 @staticmethod
861 def unpack(reader):
862 obj = write_actions()
863 _type = reader.read("!H")[0]
864 assert(_type == 3)
865 _len = reader.read("!H")[0]
866 orig_reader = reader
867 reader = orig_reader.slice(_len - (2 + 2))
868 return obj
869
870 def __eq__(self, other):
871 if type(self) != type(other): return False
872 return True
873
874 def pretty_print(self, q):
875 q.text("write_actions {")
876 with q.group():
877 with q.indent(2):
878 q.breakable()
879 q.breakable()
880 q.text('}')
881
882instruction_id.subtypes[3] = write_actions
883
884class write_metadata(instruction_id):
885 type = 2
886
887 def __init__(self):
888 return
889
890 def pack(self):
891 packed = []
892 packed.append(struct.pack("!H", self.type))
893 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
894 length = sum([len(x) for x in packed])
895 packed[1] = struct.pack("!H", length)
896 return ''.join(packed)
897
898 @staticmethod
899 def unpack(reader):
900 obj = write_metadata()
901 _type = reader.read("!H")[0]
902 assert(_type == 2)
903 _len = reader.read("!H")[0]
904 orig_reader = reader
905 reader = orig_reader.slice(_len - (2 + 2))
906 return obj
907
908 def __eq__(self, other):
909 if type(self) != type(other): return False
910 return True
911
912 def pretty_print(self, q):
913 q.text("write_metadata {")
914 with q.group():
915 with q.indent(2):
916 q.breakable()
917 q.breakable()
918 q.text('}')
919
920instruction_id.subtypes[2] = write_metadata
921
922